Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notification model add title property and angular 11 compatibilty is ok. #197

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added angular-notifier-1.0.0.tgz
Binary file not shown.
Binary file added angular-notifier-1.0.1.tgz
Binary file not shown.
Binary file added angular-notifier-1.0.2.tgz
Binary file not shown.
Binary file added angular-notifier-1.0.3.tgz
Binary file not shown.
164 changes: 44 additions & 120 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@
"release": "automatic-release",
"start": "ng serve angular-notifier-demo",
"test:library:coverage": "codecov -f coverage/coverage-final.json",
"test:library": "ng test angular-notifier"
"test:library": "ng test angular-notifier",
"copy-files": "cp README.md dist/angular-notifier",
"pack-archive": "cd dist/angular-notifier && npm pack . && cp angular-notifier-1.*.tgz ../..",
"remove-archive": "rm dist/angular-notifier/angular-notifier-1.*.tgz && cd ../..",
"copy-styles": "cp -r projects/angular-notifier/src/styles dist/angular-notifier/styles && cp projects/angular-notifier/src/styles.scss dist/angular-notifier/",
"compile-lib": "npm run build:library:angular && npm run copy-styles && npm run copy-files && npm run pack-archive && npm run remove-archive"
},
"dependencies": {
"tslib": "1.10.x"
Expand Down Expand Up @@ -79,4 +84,4 @@
"web-animations-js": "2.3.x",
"zone.js": "0.9.x"
}
}
}
3 changes: 2 additions & 1 deletion projects/angular-notifier/package.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"name": "angular-notifier"
"name": "angular-notifier",
"version": "1.0.3"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
</ng-container>

<ng-template #predefinedNotification>
<h2 class="notifier__notification-title">{{ notification.title }}</h2>

<p class="notifier__notification-message">{{ notification.message }}</p>
<button class="notifier__notification-button" type="button" title="dismiss" *ngIf="config.behaviour.showDismissButton" (click)="onClickDismiss()">
<svg class="notifier__notification-button-icon" viewBox="0 0 24 24" width="20" height="20">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export class NotifierNotification {
*/
public message: string;

/**
* Notification title
*/
public title: string;

/**
* The template to customize
* the appearance of the notification
Expand Down Expand Up @@ -67,6 +72,11 @@ export interface NotifierNotificationOptions {
*/
type: string;

/**
* Notification title
*/
title: string;

/**
* Notificatin message
*/
Expand Down
2 changes: 1 addition & 1 deletion projects/angular-notifier/src/lib/notifier.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class NotifierModule {
* @param [options={}] - Custom notifier options
* @returns - Notifier module with custom providers
*/
public static withConfig( options: NotifierOptions = {} ): ModuleWithProviders {
public static withConfig( options: NotifierOptions = {} ): ModuleWithProviders<NotifierModule> {
return {
ngModule: NotifierModule,
providers: [
Expand Down
31 changes: 16 additions & 15 deletions projects/angular-notifier/src/lib/services/notifier.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,50 +53,50 @@ export class NotifierService {
*
* @param notificationOptions Notification options
*/
public show( notificationOptions: NotifierNotificationOptions ): void {
this.queueService.push( {
public show(notificationOptions: NotifierNotificationOptions): void {
this.queueService.push({
payload: notificationOptions,
type: 'SHOW'
} );
});
}

/**
* API: Hide a specific notification, given its ID
*
* @param notificationId ID of the notification to hide
*/
public hide( notificationId: string ): void {
this.queueService.push( {
public hide(notificationId: string): void {
this.queueService.push({
payload: notificationId,
type: 'HIDE'
} );
});
}

/**
* API: Hide the newest notification
*/
public hideNewest(): void {
this.queueService.push( {
this.queueService.push({
type: 'HIDE_NEWEST'
} );
});
}

/**
* API: Hide the oldest notification
*/
public hideOldest(): void {
this.queueService.push( {
this.queueService.push({
type: 'HIDE_OLDEST'
} );
});
}

/**
* API: Hide all notifications at once
*/
public hideAll(): void {
this.queueService.push( {
this.queueService.push({
type: 'HIDE_ALL'
} );
});
}

/**
Expand All @@ -106,15 +106,16 @@ export class NotifierService {
* @param message Message of the notification
* @param [notificationId] Unique ID for the notification (optional)
*/
public notify( type: string, message: string, notificationId?: string ): void {
public notify(type: string, title: string, message: string, notificationId?: string): void {
let notificationOptions: NotifierNotificationOptions = {
message,
title,
type
};
if ( notificationId !== undefined ) {
if (notificationId !== undefined) {
notificationOptions.id = notificationId;
}
this.show( notificationOptions );
this.show(notificationOptions);
}

}