ngx-toastr 16.2.0 → 17.0.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.
Files changed (33) hide show
  1. package/README.md +44 -6
  2. package/esm2022/overlay/overlay-container.mjs +45 -0
  3. package/esm2022/overlay/overlay-ref.mjs +21 -0
  4. package/esm2022/overlay/overlay.mjs +79 -0
  5. package/esm2022/portal/dom-portal-host.mjs +55 -0
  6. package/{esm2020 → esm2022}/portal/portal.mjs +16 -1
  7. package/esm2022/toastr/toast-noanimation.component.mjs +253 -0
  8. package/esm2022/toastr/toast-ref.mjs +75 -0
  9. package/esm2022/toastr/toast.component.mjs +271 -0
  10. package/esm2022/toastr/toast.directive.mjs +23 -0
  11. package/esm2022/toastr/toastr-config.mjs +77 -0
  12. package/esm2022/toastr/toastr.module.mjs +49 -0
  13. package/esm2022/toastr/toastr.service.mjs +207 -0
  14. package/{fesm2020 → fesm2022}/ngx-toastr.mjs +149 -87
  15. package/fesm2022/ngx-toastr.mjs.map +1 -0
  16. package/package.json +8 -14
  17. package/esm2020/overlay/overlay-container.mjs +0 -45
  18. package/esm2020/overlay/overlay-ref.mjs +0 -20
  19. package/esm2020/overlay/overlay.mjs +0 -81
  20. package/esm2020/portal/dom-portal-host.mjs +0 -52
  21. package/esm2020/toastr/toast-noanimation.component.mjs +0 -236
  22. package/esm2020/toastr/toast-ref.mjs +0 -72
  23. package/esm2020/toastr/toast.component.mjs +0 -255
  24. package/esm2020/toastr/toast.directive.mjs +0 -21
  25. package/esm2020/toastr/toastr-config.mjs +0 -71
  26. package/esm2020/toastr/toastr.module.mjs +0 -47
  27. package/esm2020/toastr/toastr.service.mjs +0 -199
  28. package/fesm2015/ngx-toastr.mjs +0 -1157
  29. package/fesm2015/ngx-toastr.mjs.map +0 -1
  30. package/fesm2020/ngx-toastr.mjs.map +0 -1
  31. /package/{esm2020 → esm2022}/ngx-toastr.mjs +0 -0
  32. /package/{esm2020 → esm2022}/public_api.mjs +0 -0
  33. /package/{esm2020 → esm2022}/toastr/toast.provider.mjs +0 -0
@@ -1,1157 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Directive, InjectionToken, inject, Injectable, ComponentFactoryResolver, ApplicationRef, SecurityContext, Injector, Inject, Component, HostBinding, HostListener, makeEnvironmentProviders, NgModule } from '@angular/core';
3
- import { trigger, state, style, transition, animate } from '@angular/animations';
4
- import { DOCUMENT, NgIf } from '@angular/common';
5
- import { Subject } from 'rxjs';
6
- import * as i2 from '@angular/platform-browser';
7
-
8
- class ToastContainerDirective {
9
- constructor(el) {
10
- this.el = el;
11
- }
12
- getContainerElement() {
13
- return this.el.nativeElement;
14
- }
15
- }
16
- ToastContainerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastContainerDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
17
- ToastContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.7", type: ToastContainerDirective, isStandalone: true, selector: "[toastContainer]", exportAs: ["toastContainer"], ngImport: i0 });
18
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastContainerDirective, decorators: [{
19
- type: Directive,
20
- args: [{
21
- selector: '[toastContainer]',
22
- exportAs: 'toastContainer',
23
- standalone: true
24
- }]
25
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
26
-
27
- /**
28
- * A `ComponentPortal` is a portal that instantiates some Component upon attachment.
29
- */
30
- class ComponentPortal {
31
- constructor(component, injector) {
32
- this.component = component;
33
- this.injector = injector;
34
- }
35
- /** Attach this portal to a host. */
36
- attach(host, newestOnTop) {
37
- this._attachedHost = host;
38
- return host.attach(this, newestOnTop);
39
- }
40
- /** Detach this portal from its host */
41
- detach() {
42
- const host = this._attachedHost;
43
- if (host) {
44
- this._attachedHost = undefined;
45
- return host.detach();
46
- }
47
- }
48
- /** Whether this portal is attached to a host. */
49
- get isAttached() {
50
- return this._attachedHost != null;
51
- }
52
- /**
53
- * Sets the PortalHost reference without performing `attach()`. This is used directly by
54
- * the PortalHost when it is performing an `attach()` or `detach()`.
55
- */
56
- setAttachedHost(host) {
57
- this._attachedHost = host;
58
- }
59
- }
60
- /**
61
- * Partial implementation of PortalHost that only deals with attaching a
62
- * ComponentPortal
63
- */
64
- class BasePortalHost {
65
- attach(portal, newestOnTop) {
66
- this._attachedPortal = portal;
67
- return this.attachComponentPortal(portal, newestOnTop);
68
- }
69
- detach() {
70
- if (this._attachedPortal) {
71
- this._attachedPortal.setAttachedHost();
72
- }
73
- this._attachedPortal = undefined;
74
- if (this._disposeFn) {
75
- this._disposeFn();
76
- this._disposeFn = undefined;
77
- }
78
- }
79
- setDisposeFn(fn) {
80
- this._disposeFn = fn;
81
- }
82
- }
83
-
84
- /**
85
- * Reference to a toast opened via the Toastr service.
86
- */
87
- class ToastRef {
88
- constructor(_overlayRef) {
89
- this._overlayRef = _overlayRef;
90
- /** Count of duplicates of this toast */
91
- this.duplicatesCount = 0;
92
- /** Subject for notifying the user that the toast has finished closing. */
93
- this._afterClosed = new Subject();
94
- /** triggered when toast is activated */
95
- this._activate = new Subject();
96
- /** notifies the toast that it should close before the timeout */
97
- this._manualClose = new Subject();
98
- /** notifies the toast that it should reset the timeouts */
99
- this._resetTimeout = new Subject();
100
- /** notifies the toast that it should count a duplicate toast */
101
- this._countDuplicate = new Subject();
102
- }
103
- manualClose() {
104
- this._manualClose.next();
105
- this._manualClose.complete();
106
- }
107
- manualClosed() {
108
- return this._manualClose.asObservable();
109
- }
110
- timeoutReset() {
111
- return this._resetTimeout.asObservable();
112
- }
113
- countDuplicate() {
114
- return this._countDuplicate.asObservable();
115
- }
116
- /**
117
- * Close the toast.
118
- */
119
- close() {
120
- this._overlayRef.detach();
121
- this._afterClosed.next();
122
- this._manualClose.next();
123
- this._afterClosed.complete();
124
- this._manualClose.complete();
125
- this._activate.complete();
126
- this._resetTimeout.complete();
127
- this._countDuplicate.complete();
128
- }
129
- /** Gets an observable that is notified when the toast is finished closing. */
130
- afterClosed() {
131
- return this._afterClosed.asObservable();
132
- }
133
- isInactive() {
134
- return this._activate.isStopped;
135
- }
136
- activate() {
137
- this._activate.next();
138
- this._activate.complete();
139
- }
140
- /** Gets an observable that is notified when the toast has started opening. */
141
- afterActivate() {
142
- return this._activate.asObservable();
143
- }
144
- /** Reset the toast timouts and count duplicates */
145
- onDuplicate(resetTimeout, countDuplicate) {
146
- if (resetTimeout) {
147
- this._resetTimeout.next();
148
- }
149
- if (countDuplicate) {
150
- this._countDuplicate.next(++this.duplicatesCount);
151
- }
152
- }
153
- }
154
-
155
- /**
156
- * Everything a toast needs to launch
157
- */
158
- class ToastPackage {
159
- constructor(toastId, config, message, title, toastType, toastRef) {
160
- this.toastId = toastId;
161
- this.config = config;
162
- this.message = message;
163
- this.title = title;
164
- this.toastType = toastType;
165
- this.toastRef = toastRef;
166
- this._onTap = new Subject();
167
- this._onAction = new Subject();
168
- this.toastRef.afterClosed().subscribe(() => {
169
- this._onAction.complete();
170
- this._onTap.complete();
171
- });
172
- }
173
- /** Fired on click */
174
- triggerTap() {
175
- this._onTap.next();
176
- if (this.config.tapToDismiss) {
177
- this._onTap.complete();
178
- }
179
- }
180
- onTap() {
181
- return this._onTap.asObservable();
182
- }
183
- /** available for use in custom toast */
184
- triggerAction(action) {
185
- this._onAction.next(action);
186
- }
187
- onAction() {
188
- return this._onAction.asObservable();
189
- }
190
- }
191
- const DefaultNoComponentGlobalConfig = {
192
- maxOpened: 0,
193
- autoDismiss: false,
194
- newestOnTop: true,
195
- preventDuplicates: false,
196
- countDuplicates: false,
197
- resetTimeoutOnDuplicate: false,
198
- includeTitleDuplicates: false,
199
- iconClasses: {
200
- error: 'toast-error',
201
- info: 'toast-info',
202
- success: 'toast-success',
203
- warning: 'toast-warning',
204
- },
205
- // Individual
206
- closeButton: false,
207
- disableTimeOut: false,
208
- timeOut: 5000,
209
- extendedTimeOut: 1000,
210
- enableHtml: false,
211
- progressBar: false,
212
- toastClass: 'ngx-toastr',
213
- positionClass: 'toast-top-right',
214
- titleClass: 'toast-title',
215
- messageClass: 'toast-message',
216
- easing: 'ease-in',
217
- easeTime: 300,
218
- tapToDismiss: true,
219
- onActivateTick: false,
220
- progressAnimation: 'decreasing',
221
- };
222
- const TOAST_CONFIG = new InjectionToken('ToastConfig');
223
-
224
- /**
225
- * A PortalHost for attaching portals to an arbitrary DOM element outside of the Angular
226
- * application context.
227
- *
228
- * This is the only part of the portal core that directly touches the DOM.
229
- */
230
- class DomPortalHost extends BasePortalHost {
231
- constructor(_hostDomElement, _componentFactoryResolver, _appRef) {
232
- super();
233
- this._hostDomElement = _hostDomElement;
234
- this._componentFactoryResolver = _componentFactoryResolver;
235
- this._appRef = _appRef;
236
- }
237
- /**
238
- * Attach the given ComponentPortal to DOM element using the ComponentFactoryResolver.
239
- * @param portal Portal to be attached
240
- */
241
- attachComponentPortal(portal, newestOnTop) {
242
- const componentFactory = this._componentFactoryResolver.resolveComponentFactory(portal.component);
243
- let componentRef;
244
- // If the portal specifies a ViewContainerRef, we will use that as the attachment point
245
- // for the component (in terms of Angular's component tree, not rendering).
246
- // When the ViewContainerRef is missing, we use the factory to create the component directly
247
- // and then manually attach the ChangeDetector for that component to the application (which
248
- // happens automatically when using a ViewContainer).
249
- componentRef = componentFactory.create(portal.injector);
250
- // When creating a component outside of a ViewContainer, we need to manually register
251
- // its ChangeDetector with the application. This API is unfortunately not yet published
252
- // in Angular core. The change detector must also be deregistered when the component
253
- // is destroyed to prevent memory leaks.
254
- this._appRef.attachView(componentRef.hostView);
255
- this.setDisposeFn(() => {
256
- this._appRef.detachView(componentRef.hostView);
257
- componentRef.destroy();
258
- });
259
- // At this point the component has been instantiated, so we move it to the location in the DOM
260
- // where we want it to be rendered.
261
- if (newestOnTop) {
262
- this._hostDomElement.insertBefore(this._getComponentRootNode(componentRef), this._hostDomElement.firstChild);
263
- }
264
- else {
265
- this._hostDomElement.appendChild(this._getComponentRootNode(componentRef));
266
- }
267
- return componentRef;
268
- }
269
- /** Gets the root HTMLElement for an instantiated component. */
270
- _getComponentRootNode(componentRef) {
271
- return componentRef.hostView.rootNodes[0];
272
- }
273
- }
274
-
275
- /** Container inside which all toasts will render. */
276
- class OverlayContainer {
277
- constructor() {
278
- this._document = inject(DOCUMENT);
279
- }
280
- ngOnDestroy() {
281
- if (this._containerElement && this._containerElement.parentNode) {
282
- this._containerElement.parentNode.removeChild(this._containerElement);
283
- }
284
- }
285
- /**
286
- * This method returns the overlay container element. It will lazily
287
- * create the element the first time it is called to facilitate using
288
- * the container in non-browser environments.
289
- * @returns the container element
290
- */
291
- getContainerElement() {
292
- if (!this._containerElement) {
293
- this._createContainer();
294
- }
295
- return this._containerElement;
296
- }
297
- /**
298
- * Create the overlay container element, which is simply a div
299
- * with the 'cdk-overlay-container' class on the document body
300
- * and 'aria-live="polite"'
301
- */
302
- _createContainer() {
303
- const container = this._document.createElement('div');
304
- container.classList.add('overlay-container');
305
- container.setAttribute('aria-live', 'polite');
306
- this._document.body.appendChild(container);
307
- this._containerElement = container;
308
- }
309
- }
310
- OverlayContainer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: OverlayContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
311
- OverlayContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: OverlayContainer, providedIn: 'root' });
312
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: OverlayContainer, decorators: [{
313
- type: Injectable,
314
- args: [{ providedIn: 'root' }]
315
- }] });
316
-
317
- /**
318
- * Reference to an overlay that has been created with the Overlay service.
319
- * Used to manipulate or dispose of said overlay.
320
- */
321
- class OverlayRef {
322
- constructor(_portalHost) {
323
- this._portalHost = _portalHost;
324
- }
325
- attach(portal, newestOnTop = true) {
326
- return this._portalHost.attach(portal, newestOnTop);
327
- }
328
- /**
329
- * Detaches an overlay from a portal.
330
- * @returns Resolves when the overlay has been detached.
331
- */
332
- detach() {
333
- return this._portalHost.detach();
334
- }
335
- }
336
-
337
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
338
- /**
339
- * Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be
340
- * used as a low-level building building block for other components. Dialogs, tooltips, menus,
341
- * selects, etc. can all be built using overlays. The service should primarily be used by authors
342
- * of re-usable components rather than developers building end-user applications.
343
- *
344
- * An overlay *is* a PortalHost, so any kind of Portal can be loaded into one.
345
- */
346
- class Overlay {
347
- constructor() {
348
- this._overlayContainer = inject(OverlayContainer);
349
- this._componentFactoryResolver = inject(ComponentFactoryResolver);
350
- this._appRef = inject(ApplicationRef);
351
- this._document = inject(DOCUMENT);
352
- // Namespace panes by overlay container
353
- this._paneElements = new Map();
354
- }
355
- /**
356
- * Creates an overlay.
357
- * @returns A reference to the created overlay.
358
- */
359
- create(positionClass, overlayContainer) {
360
- // get existing pane if possible
361
- return this._createOverlayRef(this.getPaneElement(positionClass, overlayContainer));
362
- }
363
- getPaneElement(positionClass = '', overlayContainer) {
364
- if (!this._paneElements.get(overlayContainer)) {
365
- this._paneElements.set(overlayContainer, {});
366
- }
367
- if (!this._paneElements.get(overlayContainer)[positionClass]) {
368
- this._paneElements.get(overlayContainer)[positionClass] = this._createPaneElement(positionClass, overlayContainer);
369
- }
370
- return this._paneElements.get(overlayContainer)[positionClass];
371
- }
372
- /**
373
- * Creates the DOM element for an overlay and appends it to the overlay container.
374
- * @returns Newly-created pane element
375
- */
376
- _createPaneElement(positionClass, overlayContainer) {
377
- const pane = this._document.createElement('div');
378
- pane.id = 'toast-container';
379
- pane.classList.add(positionClass);
380
- pane.classList.add('toast-container');
381
- if (!overlayContainer) {
382
- this._overlayContainer.getContainerElement().appendChild(pane);
383
- }
384
- else {
385
- overlayContainer.getContainerElement().appendChild(pane);
386
- }
387
- return pane;
388
- }
389
- /**
390
- * Create a DomPortalHost into which the overlay content can be loaded.
391
- * @param pane The DOM element to turn into a portal host.
392
- * @returns A portal host for the given DOM element.
393
- */
394
- _createPortalHost(pane) {
395
- return new DomPortalHost(pane, this._componentFactoryResolver, this._appRef);
396
- }
397
- /**
398
- * Creates an OverlayRef for an overlay in the given DOM element.
399
- * @param pane DOM element for the overlay
400
- */
401
- _createOverlayRef(pane) {
402
- return new OverlayRef(this._createPortalHost(pane));
403
- }
404
- }
405
- Overlay.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: Overlay, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
406
- Overlay.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: Overlay, providedIn: 'root' });
407
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: Overlay, decorators: [{
408
- type: Injectable,
409
- args: [{ providedIn: 'root' }]
410
- }] });
411
-
412
- class ToastrService {
413
- constructor(token, overlay, _injector, sanitizer, ngZone) {
414
- this.overlay = overlay;
415
- this._injector = _injector;
416
- this.sanitizer = sanitizer;
417
- this.ngZone = ngZone;
418
- this.currentlyActive = 0;
419
- this.toasts = [];
420
- this.index = 0;
421
- this.toastrConfig = Object.assign(Object.assign({}, token.default), token.config);
422
- if (token.config.iconClasses) {
423
- this.toastrConfig.iconClasses = Object.assign(Object.assign({}, token.default.iconClasses), token.config.iconClasses);
424
- }
425
- }
426
- /** show toast */
427
- show(message, title, override = {}, type = '') {
428
- return this._preBuildNotification(type, message, title, this.applyConfig(override));
429
- }
430
- /** show successful toast */
431
- success(message, title, override = {}) {
432
- const type = this.toastrConfig.iconClasses.success || '';
433
- return this._preBuildNotification(type, message, title, this.applyConfig(override));
434
- }
435
- /** show error toast */
436
- error(message, title, override = {}) {
437
- const type = this.toastrConfig.iconClasses.error || '';
438
- return this._preBuildNotification(type, message, title, this.applyConfig(override));
439
- }
440
- /** show info toast */
441
- info(message, title, override = {}) {
442
- const type = this.toastrConfig.iconClasses.info || '';
443
- return this._preBuildNotification(type, message, title, this.applyConfig(override));
444
- }
445
- /** show warning toast */
446
- warning(message, title, override = {}) {
447
- const type = this.toastrConfig.iconClasses.warning || '';
448
- return this._preBuildNotification(type, message, title, this.applyConfig(override));
449
- }
450
- /**
451
- * Remove all or a single toast by id
452
- */
453
- clear(toastId) {
454
- // Call every toastRef manualClose function
455
- for (const toast of this.toasts) {
456
- if (toastId !== undefined) {
457
- if (toast.toastId === toastId) {
458
- toast.toastRef.manualClose();
459
- return;
460
- }
461
- }
462
- else {
463
- toast.toastRef.manualClose();
464
- }
465
- }
466
- }
467
- /**
468
- * Remove and destroy a single toast by id
469
- */
470
- remove(toastId) {
471
- const found = this._findToast(toastId);
472
- if (!found) {
473
- return false;
474
- }
475
- found.activeToast.toastRef.close();
476
- this.toasts.splice(found.index, 1);
477
- this.currentlyActive = this.currentlyActive - 1;
478
- if (!this.toastrConfig.maxOpened || !this.toasts.length) {
479
- return false;
480
- }
481
- if (this.currentlyActive < this.toastrConfig.maxOpened && this.toasts[this.currentlyActive]) {
482
- const p = this.toasts[this.currentlyActive].toastRef;
483
- if (!p.isInactive()) {
484
- this.currentlyActive = this.currentlyActive + 1;
485
- p.activate();
486
- }
487
- }
488
- return true;
489
- }
490
- /**
491
- * Determines if toast message is already shown
492
- */
493
- findDuplicate(title = '', message = '', resetOnDuplicate, countDuplicates) {
494
- const { includeTitleDuplicates } = this.toastrConfig;
495
- for (const toast of this.toasts) {
496
- const hasDuplicateTitle = includeTitleDuplicates && toast.title === title;
497
- if ((!includeTitleDuplicates || hasDuplicateTitle) && toast.message === message) {
498
- toast.toastRef.onDuplicate(resetOnDuplicate, countDuplicates);
499
- return toast;
500
- }
501
- }
502
- return null;
503
- }
504
- /** create a clone of global config and apply individual settings */
505
- applyConfig(override = {}) {
506
- return Object.assign(Object.assign({}, this.toastrConfig), override);
507
- }
508
- /**
509
- * Find toast object by id
510
- */
511
- _findToast(toastId) {
512
- for (let i = 0; i < this.toasts.length; i++) {
513
- if (this.toasts[i].toastId === toastId) {
514
- return { index: i, activeToast: this.toasts[i] };
515
- }
516
- }
517
- return null;
518
- }
519
- /**
520
- * Determines the need to run inside angular's zone then builds the toast
521
- */
522
- _preBuildNotification(toastType, message, title, config) {
523
- if (config.onActivateTick) {
524
- return this.ngZone.run(() => this._buildNotification(toastType, message, title, config));
525
- }
526
- return this._buildNotification(toastType, message, title, config);
527
- }
528
- /**
529
- * Creates and attaches toast data to component
530
- * returns the active toast, or in case preventDuplicates is enabled the original/non-duplicate active toast.
531
- */
532
- _buildNotification(toastType, message, title, config) {
533
- if (!config.toastComponent) {
534
- throw new Error('toastComponent required');
535
- }
536
- // max opened and auto dismiss = true
537
- // if timeout = 0 resetting it would result in setting this.hideTime = Date.now(). Hence, we only want to reset timeout if there is
538
- // a timeout at all
539
- const duplicate = this.findDuplicate(title, message, this.toastrConfig.resetTimeoutOnDuplicate && config.timeOut > 0, this.toastrConfig.countDuplicates);
540
- if (((this.toastrConfig.includeTitleDuplicates && title) || message) &&
541
- this.toastrConfig.preventDuplicates &&
542
- duplicate !== null) {
543
- return duplicate;
544
- }
545
- this.previousToastMessage = message;
546
- let keepInactive = false;
547
- if (this.toastrConfig.maxOpened && this.currentlyActive >= this.toastrConfig.maxOpened) {
548
- keepInactive = true;
549
- if (this.toastrConfig.autoDismiss) {
550
- this.clear(this.toasts[0].toastId);
551
- }
552
- }
553
- const overlayRef = this.overlay.create(config.positionClass, this.overlayContainer);
554
- this.index = this.index + 1;
555
- let sanitizedMessage = message;
556
- if (message && config.enableHtml) {
557
- sanitizedMessage = this.sanitizer.sanitize(SecurityContext.HTML, message);
558
- }
559
- const toastRef = new ToastRef(overlayRef);
560
- const toastPackage = new ToastPackage(this.index, config, sanitizedMessage, title, toastType, toastRef);
561
- /** New injector that contains an instance of `ToastPackage`. */
562
- const providers = [{ provide: ToastPackage, useValue: toastPackage }];
563
- const toastInjector = Injector.create({ providers, parent: this._injector });
564
- const component = new ComponentPortal(config.toastComponent, toastInjector);
565
- const portal = overlayRef.attach(component, config.newestOnTop);
566
- toastRef.componentInstance = portal.instance;
567
- const ins = {
568
- toastId: this.index,
569
- title: title || '',
570
- message: message || '',
571
- toastRef,
572
- onShown: toastRef.afterActivate(),
573
- onHidden: toastRef.afterClosed(),
574
- onTap: toastPackage.onTap(),
575
- onAction: toastPackage.onAction(),
576
- portal,
577
- };
578
- if (!keepInactive) {
579
- this.currentlyActive = this.currentlyActive + 1;
580
- setTimeout(() => {
581
- ins.toastRef.activate();
582
- });
583
- }
584
- this.toasts.push(ins);
585
- return ins;
586
- }
587
- }
588
- ToastrService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrService, deps: [{ token: TOAST_CONFIG }, { token: Overlay }, { token: i0.Injector }, { token: i2.DomSanitizer }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
589
- ToastrService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrService, providedIn: 'root' });
590
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrService, decorators: [{
591
- type: Injectable,
592
- args: [{ providedIn: 'root' }]
593
- }], ctorParameters: function () {
594
- return [{ type: undefined, decorators: [{
595
- type: Inject,
596
- args: [TOAST_CONFIG]
597
- }] }, { type: Overlay }, { type: i0.Injector }, { type: i2.DomSanitizer }, { type: i0.NgZone }];
598
- } });
599
-
600
- class Toast {
601
- /** hides component when waiting to be displayed */
602
- get displayStyle() {
603
- if (this.state.value === 'inactive') {
604
- return 'none';
605
- }
606
- return;
607
- }
608
- constructor(toastrService, toastPackage, ngZone) {
609
- this.toastrService = toastrService;
610
- this.toastPackage = toastPackage;
611
- this.ngZone = ngZone;
612
- /** width of progress bar */
613
- this.width = -1;
614
- /** a combination of toast type and options.toastClass */
615
- this.toastClasses = '';
616
- /** controls animation */
617
- this.state = {
618
- value: 'inactive',
619
- params: {
620
- easeTime: this.toastPackage.config.easeTime,
621
- easing: 'ease-in'
622
- }
623
- };
624
- this.message = toastPackage.message;
625
- this.title = toastPackage.title;
626
- this.options = toastPackage.config;
627
- this.originalTimeout = toastPackage.config.timeOut;
628
- this.toastClasses = `${toastPackage.toastType} ${toastPackage.config.toastClass}`;
629
- this.sub = toastPackage.toastRef.afterActivate().subscribe(() => {
630
- this.activateToast();
631
- });
632
- this.sub1 = toastPackage.toastRef.manualClosed().subscribe(() => {
633
- this.remove();
634
- });
635
- this.sub2 = toastPackage.toastRef.timeoutReset().subscribe(() => {
636
- this.resetTimeout();
637
- });
638
- this.sub3 = toastPackage.toastRef.countDuplicate().subscribe(count => {
639
- this.duplicatesCount = count;
640
- });
641
- }
642
- ngOnDestroy() {
643
- this.sub.unsubscribe();
644
- this.sub1.unsubscribe();
645
- this.sub2.unsubscribe();
646
- this.sub3.unsubscribe();
647
- clearInterval(this.intervalId);
648
- clearTimeout(this.timeout);
649
- }
650
- /**
651
- * activates toast and sets timeout
652
- */
653
- activateToast() {
654
- this.state = Object.assign(Object.assign({}, this.state), { value: 'active' });
655
- if (!(this.options.disableTimeOut === true || this.options.disableTimeOut === 'timeOut') && this.options.timeOut) {
656
- this.outsideTimeout(() => this.remove(), this.options.timeOut);
657
- this.hideTime = new Date().getTime() + this.options.timeOut;
658
- if (this.options.progressBar) {
659
- this.outsideInterval(() => this.updateProgress(), 10);
660
- }
661
- }
662
- }
663
- /**
664
- * updates progress bar width
665
- */
666
- updateProgress() {
667
- if (this.width === 0 || this.width === 100 || !this.options.timeOut) {
668
- return;
669
- }
670
- const now = new Date().getTime();
671
- const remaining = this.hideTime - now;
672
- this.width = (remaining / this.options.timeOut) * 100;
673
- if (this.options.progressAnimation === 'increasing') {
674
- this.width = 100 - this.width;
675
- }
676
- if (this.width <= 0) {
677
- this.width = 0;
678
- }
679
- if (this.width >= 100) {
680
- this.width = 100;
681
- }
682
- }
683
- resetTimeout() {
684
- clearTimeout(this.timeout);
685
- clearInterval(this.intervalId);
686
- this.state = Object.assign(Object.assign({}, this.state), { value: 'active' });
687
- this.outsideTimeout(() => this.remove(), this.originalTimeout);
688
- this.options.timeOut = this.originalTimeout;
689
- this.hideTime = new Date().getTime() + (this.options.timeOut || 0);
690
- this.width = -1;
691
- if (this.options.progressBar) {
692
- this.outsideInterval(() => this.updateProgress(), 10);
693
- }
694
- }
695
- /**
696
- * tells toastrService to remove this toast after animation time
697
- */
698
- remove() {
699
- if (this.state.value === 'removed') {
700
- return;
701
- }
702
- clearTimeout(this.timeout);
703
- this.state = Object.assign(Object.assign({}, this.state), { value: 'removed' });
704
- this.outsideTimeout(() => this.toastrService.remove(this.toastPackage.toastId), +this.toastPackage.config.easeTime);
705
- }
706
- tapToast() {
707
- if (this.state.value === 'removed') {
708
- return;
709
- }
710
- this.toastPackage.triggerTap();
711
- if (this.options.tapToDismiss) {
712
- this.remove();
713
- }
714
- }
715
- stickAround() {
716
- if (this.state.value === 'removed') {
717
- return;
718
- }
719
- if (this.options.disableTimeOut !== 'extendedTimeOut') {
720
- clearTimeout(this.timeout);
721
- this.options.timeOut = 0;
722
- this.hideTime = 0;
723
- // disable progressBar
724
- clearInterval(this.intervalId);
725
- this.width = 0;
726
- }
727
- }
728
- delayedHideToast() {
729
- if ((this.options.disableTimeOut === true || this.options.disableTimeOut === 'extendedTimeOut') ||
730
- this.options.extendedTimeOut === 0 ||
731
- this.state.value === 'removed') {
732
- return;
733
- }
734
- this.outsideTimeout(() => this.remove(), this.options.extendedTimeOut);
735
- this.options.timeOut = this.options.extendedTimeOut;
736
- this.hideTime = new Date().getTime() + (this.options.timeOut || 0);
737
- this.width = -1;
738
- if (this.options.progressBar) {
739
- this.outsideInterval(() => this.updateProgress(), 10);
740
- }
741
- }
742
- outsideTimeout(func, timeout) {
743
- if (this.ngZone) {
744
- this.ngZone.runOutsideAngular(() => (this.timeout = setTimeout(() => this.runInsideAngular(func), timeout)));
745
- }
746
- else {
747
- this.timeout = setTimeout(() => func(), timeout);
748
- }
749
- }
750
- outsideInterval(func, timeout) {
751
- if (this.ngZone) {
752
- this.ngZone.runOutsideAngular(() => (this.intervalId = setInterval(() => this.runInsideAngular(func), timeout)));
753
- }
754
- else {
755
- this.intervalId = setInterval(() => func(), timeout);
756
- }
757
- }
758
- runInsideAngular(func) {
759
- if (this.ngZone) {
760
- this.ngZone.run(() => func());
761
- }
762
- else {
763
- func();
764
- }
765
- }
766
- }
767
- Toast.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: Toast, deps: [{ token: ToastrService }, { token: ToastPackage }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
768
- Toast.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: Toast, isStandalone: true, selector: "[toast-component]", host: { listeners: { "click": "tapToast()", "mouseenter": "stickAround()", "mouseleave": "delayedHideToast()" }, properties: { "class": "this.toastClasses", "@flyInOut": "this.state", "style.display": "this.displayStyle" } }, ngImport: i0, template: `
769
- <button *ngIf="options.closeButton" (click)="remove()" type="button" class="toast-close-button" aria-label="Close">
770
- <span aria-hidden="true">&times;</span>
771
- </button>
772
- <div *ngIf="title" [class]="options.titleClass" [attr.aria-label]="title">
773
- {{ title }} <ng-container *ngIf="duplicatesCount">[{{ duplicatesCount + 1 }}]</ng-container>
774
- </div>
775
- <div *ngIf="message && options.enableHtml" role="alert"
776
- [class]="options.messageClass" [innerHTML]="message">
777
- </div>
778
- <div *ngIf="message && !options.enableHtml" role="alert"
779
- [class]="options.messageClass" [attr.aria-label]="message">
780
- {{ message }}
781
- </div>
782
- <div *ngIf="options.progressBar">
783
- <div class="toast-progress" [style.width]="width + '%'"></div>
784
- </div>
785
- `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], animations: [
786
- trigger('flyInOut', [
787
- state('inactive', style({ opacity: 0 })),
788
- state('active', style({ opacity: 1 })),
789
- state('removed', style({ opacity: 0 })),
790
- transition('inactive => active', animate('{{ easeTime }}ms {{ easing }}')),
791
- transition('active => removed', animate('{{ easeTime }}ms {{ easing }}')),
792
- ]),
793
- ] });
794
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: Toast, decorators: [{
795
- type: Component,
796
- args: [{
797
- selector: '[toast-component]',
798
- template: `
799
- <button *ngIf="options.closeButton" (click)="remove()" type="button" class="toast-close-button" aria-label="Close">
800
- <span aria-hidden="true">&times;</span>
801
- </button>
802
- <div *ngIf="title" [class]="options.titleClass" [attr.aria-label]="title">
803
- {{ title }} <ng-container *ngIf="duplicatesCount">[{{ duplicatesCount + 1 }}]</ng-container>
804
- </div>
805
- <div *ngIf="message && options.enableHtml" role="alert"
806
- [class]="options.messageClass" [innerHTML]="message">
807
- </div>
808
- <div *ngIf="message && !options.enableHtml" role="alert"
809
- [class]="options.messageClass" [attr.aria-label]="message">
810
- {{ message }}
811
- </div>
812
- <div *ngIf="options.progressBar">
813
- <div class="toast-progress" [style.width]="width + '%'"></div>
814
- </div>
815
- `,
816
- animations: [
817
- trigger('flyInOut', [
818
- state('inactive', style({ opacity: 0 })),
819
- state('active', style({ opacity: 1 })),
820
- state('removed', style({ opacity: 0 })),
821
- transition('inactive => active', animate('{{ easeTime }}ms {{ easing }}')),
822
- transition('active => removed', animate('{{ easeTime }}ms {{ easing }}')),
823
- ]),
824
- ],
825
- preserveWhitespaces: false,
826
- standalone: true,
827
- imports: [NgIf],
828
- }]
829
- }], ctorParameters: function () { return [{ type: ToastrService }, { type: ToastPackage }, { type: i0.NgZone }]; }, propDecorators: { toastClasses: [{
830
- type: HostBinding,
831
- args: ['class']
832
- }], state: [{
833
- type: HostBinding,
834
- args: ['@flyInOut']
835
- }], displayStyle: [{
836
- type: HostBinding,
837
- args: ['style.display']
838
- }], tapToast: [{
839
- type: HostListener,
840
- args: ['click']
841
- }], stickAround: [{
842
- type: HostListener,
843
- args: ['mouseenter']
844
- }], delayedHideToast: [{
845
- type: HostListener,
846
- args: ['mouseleave']
847
- }] } });
848
-
849
- const DefaultGlobalConfig = Object.assign(Object.assign({}, DefaultNoComponentGlobalConfig), { toastComponent: Toast });
850
- /**
851
- * @description
852
- * Provides the `TOAST_CONFIG` token with the given config.
853
- *
854
- * @param config The config to configure toastr.
855
- * @returns The environment providers.
856
- *
857
- * @example
858
- * ```ts
859
- * import { provideToastr } from 'ngx-toastr';
860
- *
861
- * bootstrap(AppComponent, {
862
- * providers: [
863
- * provideToastr({
864
- * timeOut: 2000,
865
- * positionClass: 'toast-top-right',
866
- * }),
867
- * ],
868
- * })
869
- */
870
- const provideToastr = (config = {}) => {
871
- const providers = [
872
- {
873
- provide: TOAST_CONFIG,
874
- useValue: {
875
- default: DefaultGlobalConfig,
876
- config,
877
- }
878
- }
879
- ];
880
- return makeEnvironmentProviders(providers);
881
- };
882
-
883
- class ToastrModule {
884
- static forRoot(config = {}) {
885
- return {
886
- ngModule: ToastrModule,
887
- providers: [provideToastr(config)],
888
- };
889
- }
890
- }
891
- ToastrModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
892
- ToastrModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: ToastrModule, imports: [Toast], exports: [Toast] });
893
- ToastrModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrModule, imports: [Toast] });
894
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrModule, decorators: [{
895
- type: NgModule,
896
- args: [{
897
- imports: [Toast],
898
- exports: [Toast],
899
- }]
900
- }] });
901
- class ToastrComponentlessModule {
902
- static forRoot(config = {}) {
903
- return {
904
- ngModule: ToastrModule,
905
- providers: [
906
- {
907
- provide: TOAST_CONFIG,
908
- useValue: {
909
- default: DefaultNoComponentGlobalConfig,
910
- config,
911
- },
912
- },
913
- ],
914
- };
915
- }
916
- }
917
- ToastrComponentlessModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrComponentlessModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
918
- ToastrComponentlessModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: ToastrComponentlessModule });
919
- ToastrComponentlessModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrComponentlessModule });
920
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrComponentlessModule, decorators: [{
921
- type: NgModule,
922
- args: [{}]
923
- }] });
924
-
925
- class ToastNoAnimation {
926
- /** hides component when waiting to be displayed */
927
- get displayStyle() {
928
- if (this.state === 'inactive') {
929
- return 'none';
930
- }
931
- }
932
- constructor(toastrService, toastPackage, appRef) {
933
- this.toastrService = toastrService;
934
- this.toastPackage = toastPackage;
935
- this.appRef = appRef;
936
- /** width of progress bar */
937
- this.width = -1;
938
- /** a combination of toast type and options.toastClass */
939
- this.toastClasses = '';
940
- /** controls animation */
941
- this.state = 'inactive';
942
- this.message = toastPackage.message;
943
- this.title = toastPackage.title;
944
- this.options = toastPackage.config;
945
- this.originalTimeout = toastPackage.config.timeOut;
946
- this.toastClasses = `${toastPackage.toastType} ${toastPackage.config.toastClass}`;
947
- this.sub = toastPackage.toastRef.afterActivate().subscribe(() => {
948
- this.activateToast();
949
- });
950
- this.sub1 = toastPackage.toastRef.manualClosed().subscribe(() => {
951
- this.remove();
952
- });
953
- this.sub2 = toastPackage.toastRef.timeoutReset().subscribe(() => {
954
- this.resetTimeout();
955
- });
956
- this.sub3 = toastPackage.toastRef.countDuplicate().subscribe(count => {
957
- this.duplicatesCount = count;
958
- });
959
- }
960
- ngOnDestroy() {
961
- this.sub.unsubscribe();
962
- this.sub1.unsubscribe();
963
- this.sub2.unsubscribe();
964
- this.sub3.unsubscribe();
965
- clearInterval(this.intervalId);
966
- clearTimeout(this.timeout);
967
- }
968
- /**
969
- * activates toast and sets timeout
970
- */
971
- activateToast() {
972
- this.state = 'active';
973
- if (!(this.options.disableTimeOut === true || this.options.disableTimeOut === 'timeOut') && this.options.timeOut) {
974
- this.timeout = setTimeout(() => {
975
- this.remove();
976
- }, this.options.timeOut);
977
- this.hideTime = new Date().getTime() + this.options.timeOut;
978
- if (this.options.progressBar) {
979
- this.intervalId = setInterval(() => this.updateProgress(), 10);
980
- }
981
- }
982
- if (this.options.onActivateTick) {
983
- this.appRef.tick();
984
- }
985
- }
986
- /**
987
- * updates progress bar width
988
- */
989
- updateProgress() {
990
- if (this.width === 0 || this.width === 100 || !this.options.timeOut) {
991
- return;
992
- }
993
- const now = new Date().getTime();
994
- const remaining = this.hideTime - now;
995
- this.width = (remaining / this.options.timeOut) * 100;
996
- if (this.options.progressAnimation === 'increasing') {
997
- this.width = 100 - this.width;
998
- }
999
- if (this.width <= 0) {
1000
- this.width = 0;
1001
- }
1002
- if (this.width >= 100) {
1003
- this.width = 100;
1004
- }
1005
- }
1006
- resetTimeout() {
1007
- clearTimeout(this.timeout);
1008
- clearInterval(this.intervalId);
1009
- this.state = 'active';
1010
- this.options.timeOut = this.originalTimeout;
1011
- this.timeout = setTimeout(() => this.remove(), this.originalTimeout);
1012
- this.hideTime = new Date().getTime() + (this.originalTimeout || 0);
1013
- this.width = -1;
1014
- if (this.options.progressBar) {
1015
- this.intervalId = setInterval(() => this.updateProgress(), 10);
1016
- }
1017
- }
1018
- /**
1019
- * tells toastrService to remove this toast after animation time
1020
- */
1021
- remove() {
1022
- if (this.state === 'removed') {
1023
- return;
1024
- }
1025
- clearTimeout(this.timeout);
1026
- this.state = 'removed';
1027
- this.timeout = setTimeout(() => this.toastrService.remove(this.toastPackage.toastId));
1028
- }
1029
- tapToast() {
1030
- if (this.state === 'removed') {
1031
- return;
1032
- }
1033
- this.toastPackage.triggerTap();
1034
- if (this.options.tapToDismiss) {
1035
- this.remove();
1036
- }
1037
- }
1038
- stickAround() {
1039
- if (this.state === 'removed') {
1040
- return;
1041
- }
1042
- clearTimeout(this.timeout);
1043
- this.options.timeOut = 0;
1044
- this.hideTime = 0;
1045
- // disable progressBar
1046
- clearInterval(this.intervalId);
1047
- this.width = 0;
1048
- }
1049
- delayedHideToast() {
1050
- if ((this.options.disableTimeOut === true || this.options.disableTimeOut === 'extendedTimeOut') ||
1051
- this.options.extendedTimeOut === 0 ||
1052
- this.state === 'removed') {
1053
- return;
1054
- }
1055
- this.timeout = setTimeout(() => this.remove(), this.options.extendedTimeOut);
1056
- this.options.timeOut = this.options.extendedTimeOut;
1057
- this.hideTime = new Date().getTime() + (this.options.timeOut || 0);
1058
- this.width = -1;
1059
- if (this.options.progressBar) {
1060
- this.intervalId = setInterval(() => this.updateProgress(), 10);
1061
- }
1062
- }
1063
- }
1064
- ToastNoAnimation.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastNoAnimation, deps: [{ token: ToastrService }, { token: ToastPackage }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Component });
1065
- ToastNoAnimation.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: ToastNoAnimation, isStandalone: true, selector: "[toast-component]", host: { listeners: { "click": "tapToast()", "mouseenter": "stickAround()", "mouseleave": "delayedHideToast()" }, properties: { "class": "this.toastClasses", "style.display": "this.displayStyle" } }, ngImport: i0, template: `
1066
- <button *ngIf="options.closeButton" (click)="remove()" type="button" class="toast-close-button" aria-label="Close">
1067
- <span aria-hidden="true">&times;</span>
1068
- </button>
1069
- <div *ngIf="title" [class]="options.titleClass" [attr.aria-label]="title">
1070
- {{ title }} <ng-container *ngIf="duplicatesCount">[{{ duplicatesCount + 1 }}]</ng-container>
1071
- </div>
1072
- <div *ngIf="message && options.enableHtml" role="alert"
1073
- [class]="options.messageClass" [innerHTML]="message">
1074
- </div>
1075
- <div *ngIf="message && !options.enableHtml" role="alert"
1076
- [class]="options.messageClass" [attr.aria-label]="message">
1077
- {{ message }}
1078
- </div>
1079
- <div *ngIf="options.progressBar">
1080
- <div class="toast-progress" [style.width]="width + '%'"></div>
1081
- </div>
1082
- `, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1083
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastNoAnimation, decorators: [{
1084
- type: Component,
1085
- args: [{
1086
- selector: '[toast-component]',
1087
- template: `
1088
- <button *ngIf="options.closeButton" (click)="remove()" type="button" class="toast-close-button" aria-label="Close">
1089
- <span aria-hidden="true">&times;</span>
1090
- </button>
1091
- <div *ngIf="title" [class]="options.titleClass" [attr.aria-label]="title">
1092
- {{ title }} <ng-container *ngIf="duplicatesCount">[{{ duplicatesCount + 1 }}]</ng-container>
1093
- </div>
1094
- <div *ngIf="message && options.enableHtml" role="alert"
1095
- [class]="options.messageClass" [innerHTML]="message">
1096
- </div>
1097
- <div *ngIf="message && !options.enableHtml" role="alert"
1098
- [class]="options.messageClass" [attr.aria-label]="message">
1099
- {{ message }}
1100
- </div>
1101
- <div *ngIf="options.progressBar">
1102
- <div class="toast-progress" [style.width]="width + '%'"></div>
1103
- </div>
1104
- `,
1105
- standalone: true,
1106
- imports: [NgIf]
1107
- }]
1108
- }], ctorParameters: function () { return [{ type: ToastrService }, { type: ToastPackage }, { type: i0.ApplicationRef }]; }, propDecorators: { toastClasses: [{
1109
- type: HostBinding,
1110
- args: ['class']
1111
- }], displayStyle: [{
1112
- type: HostBinding,
1113
- args: ['style.display']
1114
- }], tapToast: [{
1115
- type: HostListener,
1116
- args: ['click']
1117
- }], stickAround: [{
1118
- type: HostListener,
1119
- args: ['mouseenter']
1120
- }], delayedHideToast: [{
1121
- type: HostListener,
1122
- args: ['mouseleave']
1123
- }] } });
1124
- const DefaultNoAnimationsGlobalConfig = Object.assign(Object.assign({}, DefaultNoComponentGlobalConfig), { toastComponent: ToastNoAnimation });
1125
- class ToastNoAnimationModule {
1126
- static forRoot(config = {}) {
1127
- return {
1128
- ngModule: ToastNoAnimationModule,
1129
- providers: [
1130
- {
1131
- provide: TOAST_CONFIG,
1132
- useValue: {
1133
- default: DefaultNoAnimationsGlobalConfig,
1134
- config,
1135
- },
1136
- },
1137
- ],
1138
- };
1139
- }
1140
- }
1141
- ToastNoAnimationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastNoAnimationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1142
- ToastNoAnimationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: ToastNoAnimationModule, imports: [ToastNoAnimation], exports: [ToastNoAnimation] });
1143
- ToastNoAnimationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastNoAnimationModule, imports: [ToastNoAnimation] });
1144
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastNoAnimationModule, decorators: [{
1145
- type: NgModule,
1146
- args: [{
1147
- imports: [ToastNoAnimation],
1148
- exports: [ToastNoAnimation],
1149
- }]
1150
- }] });
1151
-
1152
- /**
1153
- * Generated bundle index. Do not edit.
1154
- */
1155
-
1156
- export { BasePortalHost, ComponentPortal, DefaultGlobalConfig, DefaultNoAnimationsGlobalConfig, DefaultNoComponentGlobalConfig, Overlay, OverlayContainer, OverlayRef, TOAST_CONFIG, Toast, ToastContainerDirective, ToastNoAnimation, ToastNoAnimationModule, ToastPackage, ToastRef, ToastrComponentlessModule, ToastrModule, ToastrService, provideToastr };
1157
- //# sourceMappingURL=ngx-toastr.mjs.map