ngx-toastr 16.1.1 → 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.
- package/README.md +44 -6
- package/esm2022/overlay/overlay-container.mjs +45 -0
- package/esm2022/overlay/overlay-ref.mjs +21 -0
- package/esm2022/overlay/overlay.mjs +79 -0
- package/esm2022/portal/dom-portal-host.mjs +55 -0
- package/{esm2020 → esm2022}/portal/portal.mjs +16 -1
- package/esm2022/public_api.mjs +13 -0
- package/esm2022/toastr/toast-noanimation.component.mjs +253 -0
- package/esm2022/toastr/toast-ref.mjs +75 -0
- package/esm2022/toastr/toast.component.mjs +271 -0
- package/esm2022/toastr/toast.directive.mjs +23 -0
- package/esm2022/toastr/toast.provider.mjs +40 -0
- package/esm2022/toastr/toastr-config.mjs +77 -0
- package/esm2022/toastr/toastr.module.mjs +49 -0
- package/esm2022/toastr/toastr.service.mjs +207 -0
- package/{fesm2020 → fesm2022}/ngx-toastr.mjs +221 -152
- package/fesm2022/ngx-toastr.mjs.map +1 -0
- package/overlay/overlay-container.d.ts +1 -2
- package/overlay/overlay.d.ts +0 -3
- package/package.json +8 -14
- package/public_api.d.ts +1 -0
- package/toastr/toast-noanimation.component.d.ts +2 -3
- package/toastr/toast.component.d.ts +1 -1
- package/toastr/toast.directive.d.ts +1 -6
- package/toastr/toast.provider.d.ts +24 -0
- package/toastr/toastr.module.d.ts +2 -4
- package/esm2020/overlay/overlay-container.mjs +0 -48
- package/esm2020/overlay/overlay-ref.mjs +0 -20
- package/esm2020/overlay/overlay.mjs +0 -84
- package/esm2020/portal/dom-portal-host.mjs +0 -52
- package/esm2020/public_api.mjs +0 -12
- package/esm2020/toastr/toast-noanimation.component.mjs +0 -236
- package/esm2020/toastr/toast-ref.mjs +0 -72
- package/esm2020/toastr/toast.component.mjs +0 -253
- package/esm2020/toastr/toast.directive.mjs +0 -32
- package/esm2020/toastr/toastr-config.mjs +0 -71
- package/esm2020/toastr/toastr.module.mjs +0 -62
- package/esm2020/toastr/toastr.service.mjs +0 -199
- package/fesm2015/ngx-toastr.mjs +0 -1154
- package/fesm2015/ngx-toastr.mjs.map +0 -1
- package/fesm2020/ngx-toastr.mjs.map +0 -1
- /package/{esm2020 → esm2022}/ngx-toastr.mjs +0 -0
@@ -1,45 +1,45 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { Directive,
|
2
|
+
import { Directive, InjectionToken, inject, Injectable, ComponentFactoryResolver, ApplicationRef, SecurityContext, Injector, Inject, Component, HostBinding, HostListener, makeEnvironmentProviders, NgModule } from '@angular/core';
|
3
3
|
import { trigger, state, style, transition, animate } from '@angular/animations';
|
4
|
+
import { DOCUMENT, NgIf } from '@angular/common';
|
4
5
|
import { Subject } from 'rxjs';
|
5
|
-
import * as i3 from '@angular/common';
|
6
|
-
import { DOCUMENT, CommonModule } from '@angular/common';
|
7
6
|
import * as i2 from '@angular/platform-browser';
|
8
7
|
|
9
8
|
class ToastContainerDirective {
|
9
|
+
el;
|
10
10
|
constructor(el) {
|
11
11
|
this.el = el;
|
12
12
|
}
|
13
13
|
getContainerElement() {
|
14
14
|
return this.el.nativeElement;
|
15
15
|
}
|
16
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastContainerDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
17
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.1", type: ToastContainerDirective, isStandalone: true, selector: "[toastContainer]", exportAs: ["toastContainer"], ngImport: i0 });
|
16
18
|
}
|
17
|
-
|
18
|
-
ToastContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.7", type: ToastContainerDirective, selector: "[toastContainer]", exportAs: ["toastContainer"], ngImport: i0 });
|
19
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastContainerDirective, decorators: [{
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastContainerDirective, decorators: [{
|
20
20
|
type: Directive,
|
21
21
|
args: [{
|
22
22
|
selector: '[toastContainer]',
|
23
23
|
exportAs: 'toastContainer',
|
24
|
+
standalone: true
|
24
25
|
}]
|
25
26
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
|
26
|
-
class ToastContainerModule {
|
27
|
-
}
|
28
|
-
ToastContainerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastContainerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
29
|
-
ToastContainerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: ToastContainerModule, declarations: [ToastContainerDirective], exports: [ToastContainerDirective] });
|
30
|
-
ToastContainerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastContainerModule });
|
31
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastContainerModule, decorators: [{
|
32
|
-
type: NgModule,
|
33
|
-
args: [{
|
34
|
-
declarations: [ToastContainerDirective],
|
35
|
-
exports: [ToastContainerDirective],
|
36
|
-
}]
|
37
|
-
}] });
|
38
27
|
|
39
28
|
/**
|
40
29
|
* A `ComponentPortal` is a portal that instantiates some Component upon attachment.
|
41
30
|
*/
|
42
31
|
class ComponentPortal {
|
32
|
+
_attachedHost;
|
33
|
+
/** The type of the component that will be instantiated for attachment. */
|
34
|
+
component;
|
35
|
+
/**
|
36
|
+
* [Optional] Where the attached component should live in Angular's *logical* component tree.
|
37
|
+
* This is different from where the component *renders*, which is determined by the PortalHost.
|
38
|
+
* The origin necessary when the host is outside of the Angular application context.
|
39
|
+
*/
|
40
|
+
viewContainerRef;
|
41
|
+
/** Injector used for the instantiation of the component. */
|
42
|
+
injector;
|
43
43
|
constructor(component, injector) {
|
44
44
|
this.component = component;
|
45
45
|
this.injector = injector;
|
@@ -74,6 +74,10 @@ class ComponentPortal {
|
|
74
74
|
* ComponentPortal
|
75
75
|
*/
|
76
76
|
class BasePortalHost {
|
77
|
+
/** The portal currently attached to the host. */
|
78
|
+
_attachedPortal;
|
79
|
+
/** A function that will permanently dispose this host. */
|
80
|
+
_disposeFn;
|
77
81
|
attach(portal, newestOnTop) {
|
78
82
|
this._attachedPortal = portal;
|
79
83
|
return this.attachComponentPortal(portal, newestOnTop);
|
@@ -97,20 +101,23 @@ class BasePortalHost {
|
|
97
101
|
* Reference to a toast opened via the Toastr service.
|
98
102
|
*/
|
99
103
|
class ToastRef {
|
104
|
+
_overlayRef;
|
105
|
+
/** The instance of component opened into the toast. */
|
106
|
+
componentInstance;
|
107
|
+
/** Count of duplicates of this toast */
|
108
|
+
duplicatesCount = 0;
|
109
|
+
/** Subject for notifying the user that the toast has finished closing. */
|
110
|
+
_afterClosed = new Subject();
|
111
|
+
/** triggered when toast is activated */
|
112
|
+
_activate = new Subject();
|
113
|
+
/** notifies the toast that it should close before the timeout */
|
114
|
+
_manualClose = new Subject();
|
115
|
+
/** notifies the toast that it should reset the timeouts */
|
116
|
+
_resetTimeout = new Subject();
|
117
|
+
/** notifies the toast that it should count a duplicate toast */
|
118
|
+
_countDuplicate = new Subject();
|
100
119
|
constructor(_overlayRef) {
|
101
120
|
this._overlayRef = _overlayRef;
|
102
|
-
/** Count of duplicates of this toast */
|
103
|
-
this.duplicatesCount = 0;
|
104
|
-
/** Subject for notifying the user that the toast has finished closing. */
|
105
|
-
this._afterClosed = new Subject();
|
106
|
-
/** triggered when toast is activated */
|
107
|
-
this._activate = new Subject();
|
108
|
-
/** notifies the toast that it should close before the timeout */
|
109
|
-
this._manualClose = new Subject();
|
110
|
-
/** notifies the toast that it should reset the timeouts */
|
111
|
-
this._resetTimeout = new Subject();
|
112
|
-
/** notifies the toast that it should count a duplicate toast */
|
113
|
-
this._countDuplicate = new Subject();
|
114
121
|
}
|
115
122
|
manualClose() {
|
116
123
|
this._manualClose.next();
|
@@ -168,6 +175,14 @@ class ToastRef {
|
|
168
175
|
* Everything a toast needs to launch
|
169
176
|
*/
|
170
177
|
class ToastPackage {
|
178
|
+
toastId;
|
179
|
+
config;
|
180
|
+
message;
|
181
|
+
title;
|
182
|
+
toastType;
|
183
|
+
toastRef;
|
184
|
+
_onTap = new Subject();
|
185
|
+
_onAction = new Subject();
|
171
186
|
constructor(toastId, config, message, title, toastType, toastRef) {
|
172
187
|
this.toastId = toastId;
|
173
188
|
this.config = config;
|
@@ -175,8 +190,6 @@ class ToastPackage {
|
|
175
190
|
this.title = title;
|
176
191
|
this.toastType = toastType;
|
177
192
|
this.toastRef = toastRef;
|
178
|
-
this._onTap = new Subject();
|
179
|
-
this._onAction = new Subject();
|
180
193
|
this.toastRef.afterClosed().subscribe(() => {
|
181
194
|
this._onAction.complete();
|
182
195
|
this._onTap.complete();
|
@@ -240,6 +253,9 @@ const TOAST_CONFIG = new InjectionToken('ToastConfig');
|
|
240
253
|
* This is the only part of the portal core that directly touches the DOM.
|
241
254
|
*/
|
242
255
|
class DomPortalHost extends BasePortalHost {
|
256
|
+
_hostDomElement;
|
257
|
+
_componentFactoryResolver;
|
258
|
+
_appRef;
|
243
259
|
constructor(_hostDomElement, _componentFactoryResolver, _appRef) {
|
244
260
|
super();
|
245
261
|
this._hostDomElement = _hostDomElement;
|
@@ -284,31 +300,10 @@ class DomPortalHost extends BasePortalHost {
|
|
284
300
|
}
|
285
301
|
}
|
286
302
|
|
287
|
-
/**
|
288
|
-
* Reference to an overlay that has been created with the Overlay service.
|
289
|
-
* Used to manipulate or dispose of said overlay.
|
290
|
-
*/
|
291
|
-
class OverlayRef {
|
292
|
-
constructor(_portalHost) {
|
293
|
-
this._portalHost = _portalHost;
|
294
|
-
}
|
295
|
-
attach(portal, newestOnTop = true) {
|
296
|
-
return this._portalHost.attach(portal, newestOnTop);
|
297
|
-
}
|
298
|
-
/**
|
299
|
-
* Detaches an overlay from a portal.
|
300
|
-
* @returns Resolves when the overlay has been detached.
|
301
|
-
*/
|
302
|
-
detach() {
|
303
|
-
return this._portalHost.detach();
|
304
|
-
}
|
305
|
-
}
|
306
|
-
|
307
303
|
/** Container inside which all toasts will render. */
|
308
304
|
class OverlayContainer {
|
309
|
-
|
310
|
-
|
311
|
-
}
|
305
|
+
_document = inject(DOCUMENT);
|
306
|
+
_containerElement;
|
312
307
|
ngOnDestroy() {
|
313
308
|
if (this._containerElement && this._containerElement.parentNode) {
|
314
309
|
this._containerElement.parentNode.removeChild(this._containerElement);
|
@@ -338,18 +333,35 @@ class OverlayContainer {
|
|
338
333
|
this._document.body.appendChild(container);
|
339
334
|
this._containerElement = container;
|
340
335
|
}
|
336
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: OverlayContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
337
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: OverlayContainer, providedIn: 'root' });
|
341
338
|
}
|
342
|
-
|
343
|
-
OverlayContainer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: OverlayContainer, providedIn: 'root' });
|
344
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: OverlayContainer, decorators: [{
|
339
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: OverlayContainer, decorators: [{
|
345
340
|
type: Injectable,
|
346
341
|
args: [{ providedIn: 'root' }]
|
347
|
-
}]
|
348
|
-
|
349
|
-
|
350
|
-
|
342
|
+
}] });
|
343
|
+
|
344
|
+
/**
|
345
|
+
* Reference to an overlay that has been created with the Overlay service.
|
346
|
+
* Used to manipulate or dispose of said overlay.
|
347
|
+
*/
|
348
|
+
class OverlayRef {
|
349
|
+
_portalHost;
|
350
|
+
constructor(_portalHost) {
|
351
|
+
this._portalHost = _portalHost;
|
352
|
+
}
|
353
|
+
attach(portal, newestOnTop = true) {
|
354
|
+
return this._portalHost.attach(portal, newestOnTop);
|
355
|
+
}
|
356
|
+
/**
|
357
|
+
* Detaches an overlay from a portal.
|
358
|
+
* @returns Resolves when the overlay has been detached.
|
359
|
+
*/
|
360
|
+
detach() {
|
361
|
+
return this._portalHost.detach();
|
362
|
+
}
|
363
|
+
}
|
351
364
|
|
352
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
353
365
|
/**
|
354
366
|
* Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be
|
355
367
|
* used as a low-level building building block for other components. Dialogs, tooltips, menus,
|
@@ -359,14 +371,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
359
371
|
* An overlay *is* a PortalHost, so any kind of Portal can be loaded into one.
|
360
372
|
*/
|
361
373
|
class Overlay {
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
this._paneElements = new Map();
|
369
|
-
}
|
374
|
+
_overlayContainer = inject(OverlayContainer);
|
375
|
+
_componentFactoryResolver = inject(ComponentFactoryResolver);
|
376
|
+
_appRef = inject(ApplicationRef);
|
377
|
+
_document = inject(DOCUMENT);
|
378
|
+
// Namespace panes by overlay container
|
379
|
+
_paneElements = new Map();
|
370
380
|
/**
|
371
381
|
* Creates an overlay.
|
372
382
|
* @returns A reference to the created overlay.
|
@@ -416,26 +426,30 @@ class Overlay {
|
|
416
426
|
_createOverlayRef(pane) {
|
417
427
|
return new OverlayRef(this._createPortalHost(pane));
|
418
428
|
}
|
429
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: Overlay, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
430
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: Overlay, providedIn: 'root' });
|
419
431
|
}
|
420
|
-
|
421
|
-
Overlay.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: Overlay, providedIn: 'root' });
|
422
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: Overlay, decorators: [{
|
432
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: Overlay, decorators: [{
|
423
433
|
type: Injectable,
|
424
434
|
args: [{ providedIn: 'root' }]
|
425
|
-
}]
|
426
|
-
type: Inject,
|
427
|
-
args: [DOCUMENT]
|
428
|
-
}] }]; } });
|
435
|
+
}] });
|
429
436
|
|
430
437
|
class ToastrService {
|
438
|
+
overlay;
|
439
|
+
_injector;
|
440
|
+
sanitizer;
|
441
|
+
ngZone;
|
442
|
+
toastrConfig;
|
443
|
+
currentlyActive = 0;
|
444
|
+
toasts = [];
|
445
|
+
overlayContainer;
|
446
|
+
previousToastMessage;
|
447
|
+
index = 0;
|
431
448
|
constructor(token, overlay, _injector, sanitizer, ngZone) {
|
432
449
|
this.overlay = overlay;
|
433
450
|
this._injector = _injector;
|
434
451
|
this.sanitizer = sanitizer;
|
435
452
|
this.ngZone = ngZone;
|
436
|
-
this.currentlyActive = 0;
|
437
|
-
this.toasts = [];
|
438
|
-
this.index = 0;
|
439
453
|
this.toastrConfig = {
|
440
454
|
...token.default,
|
441
455
|
...token.config,
|
@@ -608,10 +622,10 @@ class ToastrService {
|
|
608
622
|
this.toasts.push(ins);
|
609
623
|
return ins;
|
610
624
|
}
|
625
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastrService, deps: [{ token: TOAST_CONFIG }, { token: Overlay }, { token: i0.Injector }, { token: i2.DomSanitizer }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
626
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastrService, providedIn: 'root' });
|
611
627
|
}
|
612
|
-
|
613
|
-
ToastrService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrService, providedIn: 'root' });
|
614
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrService, decorators: [{
|
628
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastrService, decorators: [{
|
615
629
|
type: Injectable,
|
616
630
|
args: [{ providedIn: 'root' }]
|
617
631
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
@@ -620,6 +634,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
620
634
|
}] }, { type: Overlay }, { type: i0.Injector }, { type: i2.DomSanitizer }, { type: i0.NgZone }]; } });
|
621
635
|
|
622
636
|
class Toast {
|
637
|
+
toastrService;
|
638
|
+
toastPackage;
|
639
|
+
ngZone;
|
640
|
+
message;
|
641
|
+
title;
|
642
|
+
options;
|
643
|
+
duplicatesCount;
|
644
|
+
originalTimeout;
|
645
|
+
/** width of progress bar */
|
646
|
+
width = -1;
|
647
|
+
/** a combination of toast type and options.toastClass */
|
648
|
+
toastClasses = '';
|
649
|
+
/** controls animation */
|
650
|
+
state = {
|
651
|
+
value: 'inactive',
|
652
|
+
params: {
|
653
|
+
easeTime: this.toastPackage.config.easeTime,
|
654
|
+
easing: 'ease-in'
|
655
|
+
}
|
656
|
+
};
|
623
657
|
/** hides component when waiting to be displayed */
|
624
658
|
get displayStyle() {
|
625
659
|
if (this.state.value === 'inactive') {
|
@@ -627,22 +661,17 @@ class Toast {
|
|
627
661
|
}
|
628
662
|
return;
|
629
663
|
}
|
664
|
+
timeout;
|
665
|
+
intervalId;
|
666
|
+
hideTime;
|
667
|
+
sub;
|
668
|
+
sub1;
|
669
|
+
sub2;
|
670
|
+
sub3;
|
630
671
|
constructor(toastrService, toastPackage, ngZone) {
|
631
672
|
this.toastrService = toastrService;
|
632
673
|
this.toastPackage = toastPackage;
|
633
674
|
this.ngZone = ngZone;
|
634
|
-
/** width of progress bar */
|
635
|
-
this.width = -1;
|
636
|
-
/** a combination of toast type and options.toastClass */
|
637
|
-
this.toastClasses = '';
|
638
|
-
/** controls animation */
|
639
|
-
this.state = {
|
640
|
-
value: 'inactive',
|
641
|
-
params: {
|
642
|
-
easeTime: this.toastPackage.config.easeTime,
|
643
|
-
easing: 'ease-in'
|
644
|
-
}
|
645
|
-
};
|
646
675
|
this.message = toastPackage.message;
|
647
676
|
this.title = toastPackage.title;
|
648
677
|
this.options = toastPackage.config;
|
@@ -785,9 +814,8 @@ class Toast {
|
|
785
814
|
func();
|
786
815
|
}
|
787
816
|
}
|
788
|
-
}
|
789
|
-
|
790
|
-
Toast.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: Toast, 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: `
|
817
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: Toast, deps: [{ token: ToastrService }, { token: ToastPackage }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
818
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", 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: `
|
791
819
|
<button *ngIf="options.closeButton" (click)="remove()" type="button" class="toast-close-button" aria-label="Close">
|
792
820
|
<span aria-hidden="true">×</span>
|
793
821
|
</button>
|
@@ -804,16 +832,17 @@ Toast.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7
|
|
804
832
|
<div *ngIf="options.progressBar">
|
805
833
|
<div class="toast-progress" [style.width]="width + '%'"></div>
|
806
834
|
</div>
|
807
|
-
`, isInline: true, dependencies: [{ kind: "directive", type:
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
835
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], animations: [
|
836
|
+
trigger('flyInOut', [
|
837
|
+
state('inactive', style({ opacity: 0 })),
|
838
|
+
state('active', style({ opacity: 1 })),
|
839
|
+
state('removed', style({ opacity: 0 })),
|
840
|
+
transition('inactive => active', animate('{{ easeTime }}ms {{ easing }}')),
|
841
|
+
transition('active => removed', animate('{{ easeTime }}ms {{ easing }}')),
|
842
|
+
]),
|
843
|
+
] });
|
844
|
+
}
|
845
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: Toast, decorators: [{
|
817
846
|
type: Component,
|
818
847
|
args: [{
|
819
848
|
selector: '[toast-component]',
|
@@ -841,10 +870,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
841
870
|
state('active', style({ opacity: 1 })),
|
842
871
|
state('removed', style({ opacity: 0 })),
|
843
872
|
transition('inactive => active', animate('{{ easeTime }}ms {{ easing }}')),
|
844
|
-
transition('active => removed', animate('{{ easeTime }}ms {{ easing }}'))
|
845
|
-
])
|
873
|
+
transition('active => removed', animate('{{ easeTime }}ms {{ easing }}')),
|
874
|
+
]),
|
846
875
|
],
|
847
|
-
preserveWhitespaces: false
|
876
|
+
preserveWhitespaces: false,
|
877
|
+
standalone: true,
|
878
|
+
imports: [NgIf],
|
848
879
|
}]
|
849
880
|
}], ctorParameters: function () { return [{ type: ToastrService }, { type: ToastPackage }, { type: i0.NgZone }]; }, propDecorators: { toastClasses: [{
|
850
881
|
type: HostBinding,
|
@@ -870,30 +901,54 @@ const DefaultGlobalConfig = {
|
|
870
901
|
...DefaultNoComponentGlobalConfig,
|
871
902
|
toastComponent: Toast,
|
872
903
|
};
|
904
|
+
/**
|
905
|
+
* @description
|
906
|
+
* Provides the `TOAST_CONFIG` token with the given config.
|
907
|
+
*
|
908
|
+
* @param config The config to configure toastr.
|
909
|
+
* @returns The environment providers.
|
910
|
+
*
|
911
|
+
* @example
|
912
|
+
* ```ts
|
913
|
+
* import { provideToastr } from 'ngx-toastr';
|
914
|
+
*
|
915
|
+
* bootstrap(AppComponent, {
|
916
|
+
* providers: [
|
917
|
+
* provideToastr({
|
918
|
+
* timeOut: 2000,
|
919
|
+
* positionClass: 'toast-top-right',
|
920
|
+
* }),
|
921
|
+
* ],
|
922
|
+
* })
|
923
|
+
*/
|
924
|
+
const provideToastr = (config = {}) => {
|
925
|
+
const providers = [
|
926
|
+
{
|
927
|
+
provide: TOAST_CONFIG,
|
928
|
+
useValue: {
|
929
|
+
default: DefaultGlobalConfig,
|
930
|
+
config,
|
931
|
+
}
|
932
|
+
}
|
933
|
+
];
|
934
|
+
return makeEnvironmentProviders(providers);
|
935
|
+
};
|
936
|
+
|
873
937
|
class ToastrModule {
|
874
938
|
static forRoot(config = {}) {
|
875
939
|
return {
|
876
940
|
ngModule: ToastrModule,
|
877
|
-
providers: [
|
878
|
-
{
|
879
|
-
provide: TOAST_CONFIG,
|
880
|
-
useValue: {
|
881
|
-
default: DefaultGlobalConfig,
|
882
|
-
config,
|
883
|
-
},
|
884
|
-
},
|
885
|
-
],
|
941
|
+
providers: [provideToastr(config)],
|
886
942
|
};
|
887
943
|
}
|
944
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastrModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
945
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.1", ngImport: i0, type: ToastrModule, imports: [Toast], exports: [Toast] });
|
946
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastrModule });
|
888
947
|
}
|
889
|
-
|
890
|
-
ToastrModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: ToastrModule, declarations: [Toast], imports: [CommonModule], exports: [Toast] });
|
891
|
-
ToastrModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrModule, imports: [CommonModule] });
|
892
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrModule, decorators: [{
|
948
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastrModule, decorators: [{
|
893
949
|
type: NgModule,
|
894
950
|
args: [{
|
895
|
-
imports: [
|
896
|
-
declarations: [Toast],
|
951
|
+
imports: [Toast],
|
897
952
|
exports: [Toast],
|
898
953
|
}]
|
899
954
|
}] });
|
@@ -912,34 +967,47 @@ class ToastrComponentlessModule {
|
|
912
967
|
],
|
913
968
|
};
|
914
969
|
}
|
970
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastrComponentlessModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
971
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.1", ngImport: i0, type: ToastrComponentlessModule });
|
972
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastrComponentlessModule });
|
915
973
|
}
|
916
|
-
|
917
|
-
ToastrComponentlessModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: ToastrComponentlessModule, imports: [CommonModule] });
|
918
|
-
ToastrComponentlessModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrComponentlessModule, imports: [CommonModule] });
|
919
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastrComponentlessModule, decorators: [{
|
974
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastrComponentlessModule, decorators: [{
|
920
975
|
type: NgModule,
|
921
|
-
args: [{
|
922
|
-
imports: [CommonModule],
|
923
|
-
}]
|
976
|
+
args: [{}]
|
924
977
|
}] });
|
925
978
|
|
926
979
|
class ToastNoAnimation {
|
980
|
+
toastrService;
|
981
|
+
toastPackage;
|
982
|
+
appRef;
|
983
|
+
message;
|
984
|
+
title;
|
985
|
+
options;
|
986
|
+
duplicatesCount;
|
987
|
+
originalTimeout;
|
988
|
+
/** width of progress bar */
|
989
|
+
width = -1;
|
990
|
+
/** a combination of toast type and options.toastClass */
|
991
|
+
toastClasses = '';
|
927
992
|
/** hides component when waiting to be displayed */
|
928
993
|
get displayStyle() {
|
929
994
|
if (this.state === 'inactive') {
|
930
995
|
return 'none';
|
931
996
|
}
|
932
997
|
}
|
998
|
+
/** controls animation */
|
999
|
+
state = 'inactive';
|
1000
|
+
timeout;
|
1001
|
+
intervalId;
|
1002
|
+
hideTime;
|
1003
|
+
sub;
|
1004
|
+
sub1;
|
1005
|
+
sub2;
|
1006
|
+
sub3;
|
933
1007
|
constructor(toastrService, toastPackage, appRef) {
|
934
1008
|
this.toastrService = toastrService;
|
935
1009
|
this.toastPackage = toastPackage;
|
936
1010
|
this.appRef = appRef;
|
937
|
-
/** width of progress bar */
|
938
|
-
this.width = -1;
|
939
|
-
/** a combination of toast type and options.toastClass */
|
940
|
-
this.toastClasses = '';
|
941
|
-
/** controls animation */
|
942
|
-
this.state = 'inactive';
|
943
1011
|
this.message = toastPackage.message;
|
944
1012
|
this.title = toastPackage.title;
|
945
1013
|
this.options = toastPackage.config;
|
@@ -1061,9 +1129,8 @@ class ToastNoAnimation {
|
|
1061
1129
|
this.intervalId = setInterval(() => this.updateProgress(), 10);
|
1062
1130
|
}
|
1063
1131
|
}
|
1064
|
-
}
|
1065
|
-
|
1066
|
-
ToastNoAnimation.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: ToastNoAnimation, selector: "[toast-component]", host: { listeners: { "click": "tapToast()", "mouseenter": "stickAround()", "mouseleave": "delayedHideToast()" }, properties: { "class": "this.toastClasses", "style.display": "this.displayStyle" } }, ngImport: i0, template: `
|
1132
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastNoAnimation, deps: [{ token: ToastrService }, { token: ToastPackage }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Component });
|
1133
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", 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: `
|
1067
1134
|
<button *ngIf="options.closeButton" (click)="remove()" type="button" class="toast-close-button" aria-label="Close">
|
1068
1135
|
<span aria-hidden="true">×</span>
|
1069
1136
|
</button>
|
@@ -1080,8 +1147,9 @@ ToastNoAnimation.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versi
|
|
1080
1147
|
<div *ngIf="options.progressBar">
|
1081
1148
|
<div class="toast-progress" [style.width]="width + '%'"></div>
|
1082
1149
|
</div>
|
1083
|
-
`, isInline: true, dependencies: [{ kind: "directive", type:
|
1084
|
-
|
1150
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
1151
|
+
}
|
1152
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastNoAnimation, decorators: [{
|
1085
1153
|
type: Component,
|
1086
1154
|
args: [{
|
1087
1155
|
selector: '[toast-component]',
|
@@ -1103,6 +1171,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
1103
1171
|
<div class="toast-progress" [style.width]="width + '%'"></div>
|
1104
1172
|
</div>
|
1105
1173
|
`,
|
1174
|
+
standalone: true,
|
1175
|
+
imports: [NgIf]
|
1106
1176
|
}]
|
1107
1177
|
}], ctorParameters: function () { return [{ type: ToastrService }, { type: ToastPackage }, { type: i0.ApplicationRef }]; }, propDecorators: { toastClasses: [{
|
1108
1178
|
type: HostBinding,
|
@@ -1139,15 +1209,14 @@ class ToastNoAnimationModule {
|
|
1139
1209
|
],
|
1140
1210
|
};
|
1141
1211
|
}
|
1212
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastNoAnimationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1213
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.1", ngImport: i0, type: ToastNoAnimationModule, imports: [ToastNoAnimation], exports: [ToastNoAnimation] });
|
1214
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastNoAnimationModule });
|
1142
1215
|
}
|
1143
|
-
|
1144
|
-
ToastNoAnimationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: ToastNoAnimationModule, declarations: [ToastNoAnimation], imports: [CommonModule], exports: [ToastNoAnimation] });
|
1145
|
-
ToastNoAnimationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastNoAnimationModule, imports: [CommonModule] });
|
1146
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ToastNoAnimationModule, decorators: [{
|
1216
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ToastNoAnimationModule, decorators: [{
|
1147
1217
|
type: NgModule,
|
1148
1218
|
args: [{
|
1149
|
-
imports: [
|
1150
|
-
declarations: [ToastNoAnimation],
|
1219
|
+
imports: [ToastNoAnimation],
|
1151
1220
|
exports: [ToastNoAnimation],
|
1152
1221
|
}]
|
1153
1222
|
}] });
|
@@ -1156,5 +1225,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
1156
1225
|
* Generated bundle index. Do not edit.
|
1157
1226
|
*/
|
1158
1227
|
|
1159
|
-
export { BasePortalHost, ComponentPortal, DefaultGlobalConfig, DefaultNoAnimationsGlobalConfig, DefaultNoComponentGlobalConfig, Overlay, OverlayContainer, OverlayRef, TOAST_CONFIG, Toast, ToastContainerDirective,
|
1228
|
+
export { BasePortalHost, ComponentPortal, DefaultGlobalConfig, DefaultNoAnimationsGlobalConfig, DefaultNoComponentGlobalConfig, Overlay, OverlayContainer, OverlayRef, TOAST_CONFIG, Toast, ToastContainerDirective, ToastNoAnimation, ToastNoAnimationModule, ToastPackage, ToastRef, ToastrComponentlessModule, ToastrModule, ToastrService, provideToastr };
|
1160
1229
|
//# sourceMappingURL=ngx-toastr.mjs.map
|