From 9203faedc354d75b50abe0316d4d9833ec89fa52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn?= Date: Mon, 23 Mar 2020 14:25:13 +0100 Subject: [PATCH 1/3] Add ng-zorro-antd installation --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index aa290793..8210ed86 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,10 @@ You can play around with this library with **[this Stackblitz right here](https: You can get **angular-notifier** via **npm** by either adding it as a new _dependency_ to your `package.json` file and running npm install, or running the following command: +NOTE: You will also need to have ng-zorro-antd installed. ```bash +npm install ng-zorro-antd npm install angular-notifier ``` From 1f93e8ad97ebaf3e3314d686e1bc8af6562f0235 Mon Sep 17 00:00:00 2001 From: mrivar Date: Mon, 23 Mar 2020 14:25:54 +0100 Subject: [PATCH 2/3] Add ng-zorro-antd alert style --- package-lock.json | 214 ++++++++---------- package.json | 1 + .../notifier-notification.component.html | 13 +- .../lib/models/notifier-notification.model.ts | 12 +- .../src/lib/notifier.module.ts | 4 +- .../src/lib/services/notifier.service.ts | 3 +- projects/angular-notifier/src/styles.scss | 12 +- 7 files changed, 122 insertions(+), 137 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8205f26e..e56fe3a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -243,6 +243,15 @@ } } }, + "@angular/cdk": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/@angular/cdk/-/cdk-8.2.3.tgz", + "integrity": "sha512-ZwO5Sn720RA2YvBqud0JAHkZXjmjxM0yNzCO8RVtRE9i8Gl26Wk0j0nQeJkVm4zwv2QO8MwbKUKGTMt8evsokA==", + "requires": { + "parse5": "^5.0.0", + "tslib": "^1.7.1" + } + }, "@angular/cli": { "version": "8.3.12", "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-8.3.12.tgz", @@ -414,8 +423,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -436,14 +444,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -458,20 +464,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -588,8 +591,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -601,7 +603,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -616,7 +617,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -624,14 +624,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -650,7 +648,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -731,8 +728,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -744,7 +740,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -830,8 +825,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -867,7 +861,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -887,7 +880,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -931,14 +923,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -1064,6 +1054,23 @@ "tslib": "^1.9.0" } }, + "@ant-design/colors": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@ant-design/colors/-/colors-3.2.2.tgz", + "integrity": "sha512-YKgNbG2dlzqMhA9NtI3/pbY16m3Yl/EeWBRa+lB1X1YaYxHrxNexiQYCLTWO/uDvAjLFMEDU+zR901waBtMtjQ==", + "requires": { + "tinycolor2": "^1.4.1" + } + }, + "@ant-design/icons-angular": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@ant-design/icons-angular/-/icons-angular-8.1.1.tgz", + "integrity": "sha512-JMfavPHwahJcGWT13bTCt4IHzrsNgbJzzB+VWYtzjwWszMCVkkOOn+aJbslupHOl72KWDvklN/LjCQPBgu7xLQ==", + "requires": { + "@ant-design/colors": "^3.1.0", + "tslib": "^1.9.0" + } + }, "@babel/code-frame": { "version": "7.5.5", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", @@ -5006,6 +5013,11 @@ "whatwg-url": "^7.0.0" } }, + "date-fns": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz", + "integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==" + }, "date-now": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", @@ -8156,8 +8168,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -8178,14 +8189,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -8200,20 +8209,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -8330,8 +8336,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -8343,7 +8348,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -8358,7 +8362,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -8366,14 +8369,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -8392,7 +8393,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -8473,8 +8473,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -8486,7 +8485,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -8572,8 +8570,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -8609,7 +8606,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -8629,7 +8625,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -8673,14 +8668,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -10153,6 +10146,17 @@ } } }, + "ng-zorro-antd": { + "version": "8.5.2", + "resolved": "https://registry.npmjs.org/ng-zorro-antd/-/ng-zorro-antd-8.5.2.tgz", + "integrity": "sha512-x+QJULyU1IXiAbf/lFPxYC/JUJvBGzU9UXnXSyLnMPZpdtEXodaF/L1N1CpSUr5SimLiHRe/jsVHDWkg0HqfYg==", + "requires": { + "@angular/cdk": "^8.0.0", + "@ant-design/icons-angular": "^8.0.2", + "date-fns": "^1.30.1", + "tslib": "^1.9.0" + } + }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -11133,8 +11137,7 @@ "parse5": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.0.tgz", - "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==", - "dev": true + "integrity": "sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==" }, "parseurl": { "version": "1.3.3", @@ -13822,6 +13825,11 @@ "setimmediate": "^1.0.4" } }, + "tinycolor2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.4.1.tgz", + "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g=" + }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -14537,8 +14545,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -14559,14 +14566,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -14581,20 +14586,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -14711,8 +14713,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -14724,7 +14725,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -14739,7 +14739,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -14747,14 +14746,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -14773,7 +14770,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -14854,8 +14850,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -14867,7 +14862,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -14953,8 +14947,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -14990,7 +14983,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -15010,7 +15002,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -15054,14 +15045,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -15303,8 +15292,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -15325,14 +15313,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -15347,20 +15333,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -15477,8 +15460,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -15490,7 +15472,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -15505,7 +15486,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -15513,14 +15493,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -15539,7 +15517,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -15620,8 +15597,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -15633,7 +15609,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -15719,8 +15694,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -15756,7 +15730,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -15776,7 +15749,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -15820,14 +15792,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, diff --git a/package.json b/package.json index d82d079f..1ce1317d 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "test:library": "ng test angular-notifier" }, "dependencies": { + "ng-zorro-antd": "^8.5.2", "tslib": "1.10.x" }, "peerDependencies": { diff --git a/projects/angular-notifier/src/lib/components/notifier-notification.component.html b/projects/angular-notifier/src/lib/components/notifier-notification.component.html index ae934352..46e6f467 100644 --- a/projects/angular-notifier/src/lib/components/notifier-notification.component.html +++ b/projects/angular-notifier/src/lib/components/notifier-notification.component.html @@ -2,10 +2,11 @@ -

{{ notification.message }}

- +
diff --git a/projects/angular-notifier/src/lib/models/notifier-notification.model.ts b/projects/angular-notifier/src/lib/models/notifier-notification.model.ts index b65704cd..8c9b0467 100644 --- a/projects/angular-notifier/src/lib/models/notifier-notification.model.ts +++ b/projects/angular-notifier/src/lib/models/notifier-notification.model.ts @@ -17,6 +17,11 @@ export class NotifierNotification { */ public type: string; + /** + * Notification title + */ + title: string; + /** * Notification message */ @@ -68,7 +73,12 @@ export interface NotifierNotificationOptions { type: string; /** - * Notificatin message + * Notification title + */ + title: string; + + /** + * Notification message */ message: string; diff --git a/projects/angular-notifier/src/lib/notifier.module.ts b/projects/angular-notifier/src/lib/notifier.module.ts index fb05837a..f5b520cd 100644 --- a/projects/angular-notifier/src/lib/notifier.module.ts +++ b/projects/angular-notifier/src/lib/notifier.module.ts @@ -8,6 +8,7 @@ import { NotifierAnimationService } from './services/notifier-animation.service' import { NotifierQueueService } from './services/notifier-queue.service'; import { NotifierService } from './services/notifier.service'; import { NotifierConfigToken, NotifierOptionsToken } from './notifier.tokens'; +import { NzAlertModule } from 'ng-zorro-antd/alert' /** * Factory for a notifier configuration with custom options @@ -46,7 +47,8 @@ export function notifierDefaultConfigFactory(): NotifierConfig { NotifierContainerComponent ], imports: [ - CommonModule + CommonModule, + NzAlertModule ], providers: [ NotifierAnimationService, diff --git a/projects/angular-notifier/src/lib/services/notifier.service.ts b/projects/angular-notifier/src/lib/services/notifier.service.ts index 40b141ad..8bad417b 100644 --- a/projects/angular-notifier/src/lib/services/notifier.service.ts +++ b/projects/angular-notifier/src/lib/services/notifier.service.ts @@ -106,8 +106,9 @@ 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 = { + title, message, type }; diff --git a/projects/angular-notifier/src/styles.scss b/projects/angular-notifier/src/styles.scss index 43feed8f..dd3621ea 100644 --- a/projects/angular-notifier/src/styles.scss +++ b/projects/angular-notifier/src/styles.scss @@ -11,11 +11,11 @@ @import "./styles/core.scss"; // Themes -@import "./styles/themes/theme-material.scss"; +//@import "./styles/themes/theme-material.scss"; // Types -@import "./styles/types/type-default.scss"; -@import "./styles/types/type-error.scss"; -@import "./styles/types/type-info.scss"; -@import "./styles/types/type-success.scss"; -@import "./styles/types/type-warning.scss"; +//@import "./styles/types/type-default.scss"; +//@import "./styles/types/type-error.scss"; +//@import "./styles/types/type-info.scss"; +//@import "./styles/types/type-success.scss"; +//@import "./styles/types/type-warning.scss"; From 49dddbda21529529d3d1c78e167d890e5bff7ef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn?= Date: Mon, 23 Mar 2020 14:30:58 +0100 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8210ed86..55855456 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ NOTE: You will also need to have ng-zorro-antd installed. ```bash npm install ng-zorro-antd -npm install angular-notifier +npm install https://github.com/mrivar/angular-notifier/tarball/master ```