ngx-toastr 11.3.2 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,7 +37,8 @@ Latest version available for each version of Angular
37
37
  | 6.5.0 | 4.x |
38
38
  | 8.10.2 | 5.x |
39
39
  | 10.1.0 | 8.x 7.x 6.x |
40
- | current | >= 8.x |
40
+ | 11.3.3 | 8.x |
41
+ | current | >= 9.x |
41
42
 
42
43
  ## Install
43
44
 
@@ -284,15 +285,18 @@ export class AppComponent implements OnInit {
284
285
  ```
285
286
 
286
287
  ## Functions
288
+
289
+ ##### Clear
290
+ Remove all or a single toast by optional id
291
+ ```ts
292
+ toastrService.clear(toastId?: number);
287
293
  ```
288
- clear(toastId?: number): Takes toaster id which is optional
289
- ```
290
- Remove all or a single toast by id
291
- ##
294
+
295
+ ##### Remove
296
+ Remove and destroy a single toast by id
292
297
  ```
293
- remove(toastId?: number): Takes toaster id which is optional
298
+ toastrService.remove(toastId: number);
294
299
  ```
295
- Remove and destroy a single toast by id
296
300
 
297
301
 
298
302
  ## SystemJS
@@ -72,10 +72,11 @@
72
72
  }
73
73
 
74
74
  function __awaiter(thisArg, _arguments, P, generator) {
75
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
75
76
  return new (P || (P = Promise))(function (resolve, reject) {
76
77
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
77
78
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
78
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
79
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
79
80
  step((generator = generator.apply(thisArg, _arguments || [])).next());
80
81
  });
81
82
  }
@@ -113,14 +114,15 @@
113
114
  }
114
115
 
115
116
  function __values(o) {
116
- var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
117
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
117
118
  if (m) return m.call(o);
118
- return {
119
+ if (o && typeof o.length === "number") return {
119
120
  next: function () {
120
121
  if (o && i >= o.length) o = void 0;
121
122
  return { value: o && o[i++], done: !o };
122
123
  }
123
124
  };
125
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
124
126
  }
125
127
 
126
128
  function __read(o, n) {
@@ -199,6 +201,21 @@
199
201
 
200
202
  function __importDefault(mod) {
201
203
  return (mod && mod.__esModule) ? mod : { default: mod };
204
+ }
205
+
206
+ function __classPrivateFieldGet(receiver, privateMap) {
207
+ if (!privateMap.has(receiver)) {
208
+ throw new TypeError("attempted to get private field on non-instance");
209
+ }
210
+ return privateMap.get(receiver);
211
+ }
212
+
213
+ function __classPrivateFieldSet(receiver, privateMap, value) {
214
+ if (!privateMap.has(receiver)) {
215
+ throw new TypeError("attempted to set private field on non-instance");
216
+ }
217
+ privateMap.set(receiver, value);
218
+ return value;
202
219
  }
203
220
 
204
221
  var ToastContainerDirective = /** @class */ (function () {
@@ -215,8 +232,7 @@
215
232
  core.Directive({
216
233
  selector: '[toastContainer]',
217
234
  exportAs: 'toastContainer',
218
- }),
219
- __metadata("design:paramtypes", [core.ElementRef])
235
+ })
220
236
  ], ToastContainerDirective);
221
237
  return ToastContainerDirective;
222
238
  }());
@@ -457,11 +473,10 @@
457
473
  OverlayContainer.ctorParameters = function () { return [
458
474
  { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
459
475
  ]; };
460
- OverlayContainer.ngInjectableDef = core["ɵɵdefineInjectable"]({ factory: function OverlayContainer_Factory() { return new OverlayContainer(core["ɵɵinject"](common.DOCUMENT)); }, token: OverlayContainer, providedIn: "root" });
476
+ OverlayContainer.ɵprov = core.ɵɵdefineInjectable({ factory: function OverlayContainer_Factory() { return new OverlayContainer(core.ɵɵinject(common.DOCUMENT)); }, token: OverlayContainer, providedIn: "root" });
461
477
  OverlayContainer = __decorate([
462
478
  core.Injectable({ providedIn: 'root' }),
463
- __param(0, core.Inject(common.DOCUMENT)),
464
- __metadata("design:paramtypes", [Object])
479
+ __param(0, core.Inject(common.DOCUMENT))
465
480
  ], OverlayContainer);
466
481
  return OverlayContainer;
467
482
  }());
@@ -561,13 +576,10 @@
561
576
  { type: core.ApplicationRef },
562
577
  { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
563
578
  ]; };
564
- Overlay.ngInjectableDef = core["ɵɵdefineInjectable"]({ factory: function Overlay_Factory() { return new Overlay(core["ɵɵinject"](OverlayContainer), core["ɵɵinject"](core.ComponentFactoryResolver), core["ɵɵinject"](core.ApplicationRef), core["ɵɵinject"](common.DOCUMENT)); }, token: Overlay, providedIn: "root" });
579
+ Overlay.ɵprov = core.ɵɵdefineInjectable({ factory: function Overlay_Factory() { return new Overlay(core.ɵɵinject(OverlayContainer), core.ɵɵinject(core.ComponentFactoryResolver), core.ɵɵinject(core.ApplicationRef), core.ɵɵinject(common.DOCUMENT)); }, token: Overlay, providedIn: "root" });
565
580
  Overlay = __decorate([
566
581
  core.Injectable({ providedIn: 'root' }),
567
- __param(3, core.Inject(common.DOCUMENT)),
568
- __metadata("design:paramtypes", [OverlayContainer,
569
- core.ComponentFactoryResolver,
570
- core.ApplicationRef, Object])
582
+ __param(3, core.Inject(common.DOCUMENT))
571
583
  ], Overlay);
572
584
  return Overlay;
573
585
  }());
@@ -667,9 +679,9 @@
667
679
  this.currentlyActive = 0;
668
680
  this.toasts = [];
669
681
  this.index = 0;
670
- this.toastrConfig = __assign({}, token.default, token.config);
682
+ this.toastrConfig = __assign(__assign({}, token.default), token.config);
671
683
  if (token.config.iconClasses) {
672
- this.toastrConfig.iconClasses = __assign({}, token.default.iconClasses, token.config.iconClasses);
684
+ this.toastrConfig.iconClasses = __assign(__assign({}, token.default.iconClasses), token.config.iconClasses);
673
685
  }
674
686
  }
675
687
  /** show toast */
@@ -780,7 +792,7 @@
780
792
  /** create a clone of global config and apply individual settings */
781
793
  ToastrService.prototype.applyConfig = function (override) {
782
794
  if (override === void 0) { override = {}; }
783
- return __assign({}, this.toastrConfig, override);
795
+ return __assign(__assign({}, this.toastrConfig), override);
784
796
  };
785
797
  /**
786
798
  * Find toast object by id
@@ -840,7 +852,7 @@
840
852
  var toastInjector = new ToastInjector(toastPackage, this._injector);
841
853
  var component = new ComponentPortal(config.toastComponent, toastInjector);
842
854
  var portal = overlayRef.attach(component, this.toastrConfig.newestOnTop);
843
- toastRef.componentInstance = portal._component;
855
+ toastRef.componentInstance = portal.instance;
844
856
  var ins = {
845
857
  toastId: this.index,
846
858
  message: message || '',
@@ -867,14 +879,10 @@
867
879
  { type: platformBrowser.DomSanitizer },
868
880
  { type: core.NgZone }
869
881
  ]; };
870
- ToastrService.ngInjectableDef = core["ɵɵdefineInjectable"]({ factory: function ToastrService_Factory() { return new ToastrService(core["ɵɵinject"](TOAST_CONFIG), core["ɵɵinject"](Overlay), core["ɵɵinject"](core.INJECTOR), core["ɵɵinject"](platformBrowser.DomSanitizer), core["ɵɵinject"](core.NgZone)); }, token: ToastrService, providedIn: "root" });
882
+ ToastrService.ɵprov = core.ɵɵdefineInjectable({ factory: function ToastrService_Factory() { return new ToastrService(core.ɵɵinject(TOAST_CONFIG), core.ɵɵinject(Overlay), core.ɵɵinject(core.INJECTOR), core.ɵɵinject(platformBrowser.DomSanitizer), core.ɵɵinject(core.NgZone)); }, token: ToastrService, providedIn: "root" });
871
883
  ToastrService = __decorate([
872
884
  core.Injectable({ providedIn: 'root' }),
873
- __param(0, core.Inject(TOAST_CONFIG)),
874
- __metadata("design:paramtypes", [Object, Overlay,
875
- core.Injector,
876
- platformBrowser.DomSanitizer,
877
- core.NgZone])
885
+ __param(0, core.Inject(TOAST_CONFIG))
878
886
  ], ToastrService);
879
887
  return ToastrService;
880
888
  }());
@@ -938,7 +946,7 @@
938
946
  */
939
947
  Toast.prototype.activateToast = function () {
940
948
  var _this = this;
941
- this.state = __assign({}, this.state, { value: 'active' });
949
+ this.state = __assign(__assign({}, this.state), { value: 'active' });
942
950
  if (!(this.options.disableTimeOut === true || this.options.disableTimeOut === 'timeOut') && this.options.timeOut) {
943
951
  this.outsideTimeout(function () { return _this.remove(); }, this.options.timeOut);
944
952
  this.hideTime = new Date().getTime() + this.options.timeOut;
@@ -971,7 +979,7 @@
971
979
  var _this = this;
972
980
  clearTimeout(this.timeout);
973
981
  clearInterval(this.intervalId);
974
- this.state = __assign({}, this.state, { value: 'active' });
982
+ this.state = __assign(__assign({}, this.state), { value: 'active' });
975
983
  this.outsideTimeout(function () { return _this.remove(); }, this.originalTimeout);
976
984
  this.options.timeOut = this.originalTimeout;
977
985
  this.hideTime = new Date().getTime() + (this.options.timeOut || 0);
@@ -989,7 +997,7 @@
989
997
  return;
990
998
  }
991
999
  clearTimeout(this.timeout);
992
- this.state = __assign({}, this.state, { value: 'removed' });
1000
+ this.state = __assign(__assign({}, this.state), { value: 'removed' });
993
1001
  this.outsideTimeout(function () { return _this.toastrService.remove(_this.toastPackage.toastId); }, +this.toastPackage.config.easeTime);
994
1002
  };
995
1003
  Toast.prototype.tapToast = function () {
@@ -1063,35 +1071,22 @@
1063
1071
  { type: core.NgZone }
1064
1072
  ]; };
1065
1073
  __decorate([
1066
- core.HostBinding('class'),
1067
- __metadata("design:type", Object)
1074
+ core.HostBinding('class')
1068
1075
  ], Toast.prototype, "toastClasses", void 0);
1069
1076
  __decorate([
1070
- core.HostBinding('@flyInOut'),
1071
- __metadata("design:type", Object)
1077
+ core.HostBinding('@flyInOut')
1072
1078
  ], Toast.prototype, "state", void 0);
1073
1079
  __decorate([
1074
- core.HostBinding('style.display'),
1075
- __metadata("design:type", Object),
1076
- __metadata("design:paramtypes", [])
1080
+ core.HostBinding('style.display')
1077
1081
  ], Toast.prototype, "displayStyle", null);
1078
1082
  __decorate([
1079
- core.HostListener('click'),
1080
- __metadata("design:type", Function),
1081
- __metadata("design:paramtypes", []),
1082
- __metadata("design:returntype", void 0)
1083
+ core.HostListener('click')
1083
1084
  ], Toast.prototype, "tapToast", null);
1084
1085
  __decorate([
1085
- core.HostListener('mouseenter'),
1086
- __metadata("design:type", Function),
1087
- __metadata("design:paramtypes", []),
1088
- __metadata("design:returntype", void 0)
1086
+ core.HostListener('mouseenter')
1089
1087
  ], Toast.prototype, "stickAround", null);
1090
1088
  __decorate([
1091
- core.HostListener('mouseleave'),
1092
- __metadata("design:type", Function),
1093
- __metadata("design:paramtypes", []),
1094
- __metadata("design:returntype", void 0)
1089
+ core.HostListener('mouseleave')
1095
1090
  ], Toast.prototype, "delayedHideToast", null);
1096
1091
  Toast = __decorate([
1097
1092
  core.Component({
@@ -1107,15 +1102,12 @@
1107
1102
  ])
1108
1103
  ],
1109
1104
  preserveWhitespaces: false
1110
- }),
1111
- __metadata("design:paramtypes", [ToastrService,
1112
- ToastPackage,
1113
- core.NgZone])
1105
+ })
1114
1106
  ], Toast);
1115
1107
  return Toast;
1116
1108
  }());
1117
1109
 
1118
- var DefaultGlobalConfig = __assign({}, DefaultNoComponentGlobalConfig, { toastComponent: Toast });
1110
+ var DefaultGlobalConfig = __assign(__assign({}, DefaultNoComponentGlobalConfig), { toastComponent: Toast });
1119
1111
  var ToastrModule = /** @class */ (function () {
1120
1112
  function ToastrModule() {
1121
1113
  }
@@ -1327,44 +1319,29 @@
1327
1319
  { type: core.ApplicationRef }
1328
1320
  ]; };
1329
1321
  __decorate([
1330
- core.HostBinding('class'),
1331
- __metadata("design:type", Object)
1322
+ core.HostBinding('class')
1332
1323
  ], ToastNoAnimation.prototype, "toastClasses", void 0);
1333
1324
  __decorate([
1334
- core.HostBinding('style.display'),
1335
- __metadata("design:type", Object),
1336
- __metadata("design:paramtypes", [])
1325
+ core.HostBinding('style.display')
1337
1326
  ], ToastNoAnimation.prototype, "displayStyle", null);
1338
1327
  __decorate([
1339
- core.HostListener('click'),
1340
- __metadata("design:type", Function),
1341
- __metadata("design:paramtypes", []),
1342
- __metadata("design:returntype", void 0)
1328
+ core.HostListener('click')
1343
1329
  ], ToastNoAnimation.prototype, "tapToast", null);
1344
1330
  __decorate([
1345
- core.HostListener('mouseenter'),
1346
- __metadata("design:type", Function),
1347
- __metadata("design:paramtypes", []),
1348
- __metadata("design:returntype", void 0)
1331
+ core.HostListener('mouseenter')
1349
1332
  ], ToastNoAnimation.prototype, "stickAround", null);
1350
1333
  __decorate([
1351
- core.HostListener('mouseleave'),
1352
- __metadata("design:type", Function),
1353
- __metadata("design:paramtypes", []),
1354
- __metadata("design:returntype", void 0)
1334
+ core.HostListener('mouseleave')
1355
1335
  ], ToastNoAnimation.prototype, "delayedHideToast", null);
1356
1336
  ToastNoAnimation = __decorate([
1357
1337
  core.Component({
1358
1338
  selector: '[toast-component]',
1359
1339
  template: "\n <button *ngIf=\"options.closeButton\" (click)=\"remove()\" class=\"toast-close-button\" aria-label=\"Close\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n <div *ngIf=\"title\" [class]=\"options.titleClass\" [attr.aria-label]=\"title\">\n {{ title }} <ng-container *ngIf=\"duplicatesCount\">[{{ duplicatesCount + 1 }}]</ng-container>\n </div>\n <div *ngIf=\"message && options.enableHtml\" role=\"alert\" aria-live=\"polite\"\n [class]=\"options.messageClass\" [innerHTML]=\"message\">\n </div>\n <div *ngIf=\"message && !options.enableHtml\" role=\"alert\" aria-live=\"polite\"\n [class]=\"options.messageClass\" [attr.aria-label]=\"message\">\n {{ message }}\n </div>\n <div *ngIf=\"options.progressBar\">\n <div class=\"toast-progress\" [style.width]=\"width + '%'\"></div>\n </div>\n "
1360
- }),
1361
- __metadata("design:paramtypes", [ToastrService,
1362
- ToastPackage,
1363
- core.ApplicationRef])
1340
+ })
1364
1341
  ], ToastNoAnimation);
1365
1342
  return ToastNoAnimation;
1366
1343
  }());
1367
- var DefaultNoAnimationsGlobalConfig = __assign({}, DefaultNoComponentGlobalConfig, { toastComponent: ToastNoAnimation });
1344
+ var DefaultNoAnimationsGlobalConfig = __assign(__assign({}, DefaultNoComponentGlobalConfig), { toastComponent: ToastNoAnimation });
1368
1345
  var ToastNoAnimationModule = /** @class */ (function () {
1369
1346
  function ToastNoAnimationModule() {
1370
1347
  }