ngx-toastr 17.0.2 → 19.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 +2 -3
- package/esm2022/overlay/overlay-container.mjs +5 -6
- package/esm2022/overlay/overlay.mjs +5 -6
- package/esm2022/portal/dom-portal-host.mjs +1 -1
- package/esm2022/portal/portal.mjs +1 -1
- package/esm2022/toastr/toast-noanimation.component.mjs +38 -37
- package/esm2022/toastr/toast-ref.mjs +1 -1
- package/esm2022/toastr/toast.component.mjs +37 -34
- package/esm2022/toastr/toast.directive.mjs +6 -7
- package/esm2022/toastr/toastr-config.mjs +1 -1
- package/esm2022/toastr/toastr.module.mjs +11 -13
- package/esm2022/toastr/toastr.service.mjs +7 -8
- package/fesm2022/ngx-toastr.mjs +92 -86
- package/fesm2022/ngx-toastr.mjs.map +1 -1
- package/package.json +1 -1
- package/toastr/toast-noanimation.component.d.ts +2 -2
- package/toastr/toast.component.d.ts +11 -4
package/fesm2022/ngx-toastr.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
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';
|
2
|
+
import { Directive, InjectionToken, inject, Injectable, ComponentFactoryResolver, ApplicationRef, SecurityContext, Injector, Inject, signal, Component, ChangeDetectionStrategy, HostBinding, HostListener, makeEnvironmentProviders, NgModule } from '@angular/core';
|
3
3
|
import { trigger, state, style, transition, animate } from '@angular/animations';
|
4
4
|
import { DOCUMENT, NgIf } from '@angular/common';
|
5
5
|
import { Subject } from 'rxjs';
|
@@ -13,17 +13,17 @@ class ToastContainerDirective {
|
|
13
13
|
getContainerElement() {
|
14
14
|
return this.el.nativeElement;
|
15
15
|
}
|
16
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
17
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
16
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastContainerDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
17
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.0", type: ToastContainerDirective, isStandalone: true, selector: "[toastContainer]", exportAs: ["toastContainer"], ngImport: i0 });
|
18
18
|
}
|
19
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastContainerDirective, decorators: [{
|
20
20
|
type: Directive,
|
21
21
|
args: [{
|
22
22
|
selector: '[toastContainer]',
|
23
23
|
exportAs: 'toastContainer',
|
24
24
|
standalone: true
|
25
25
|
}]
|
26
|
-
}], ctorParameters:
|
26
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }] });
|
27
27
|
|
28
28
|
/**
|
29
29
|
* A `ComponentPortal` is a portal that instantiates some Component upon attachment.
|
@@ -333,10 +333,10 @@ class OverlayContainer {
|
|
333
333
|
this._document.body.appendChild(container);
|
334
334
|
this._containerElement = container;
|
335
335
|
}
|
336
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
337
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
336
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: OverlayContainer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
337
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: OverlayContainer, providedIn: 'root' });
|
338
338
|
}
|
339
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
339
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: OverlayContainer, decorators: [{
|
340
340
|
type: Injectable,
|
341
341
|
args: [{ providedIn: 'root' }]
|
342
342
|
}] });
|
@@ -426,10 +426,10 @@ class Overlay {
|
|
426
426
|
_createOverlayRef(pane) {
|
427
427
|
return new OverlayRef(this._createPortalHost(pane));
|
428
428
|
}
|
429
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
430
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
429
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: Overlay, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
430
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: Overlay, providedIn: 'root' });
|
431
431
|
}
|
432
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
432
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: Overlay, decorators: [{
|
433
433
|
type: Injectable,
|
434
434
|
args: [{ providedIn: 'root' }]
|
435
435
|
}] });
|
@@ -622,16 +622,16 @@ class ToastrService {
|
|
622
622
|
this.toasts.push(ins);
|
623
623
|
return ins;
|
624
624
|
}
|
625
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
626
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
625
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", 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: "18.0.0", ngImport: i0, type: ToastrService, providedIn: 'root' });
|
627
627
|
}
|
628
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
628
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastrService, decorators: [{
|
629
629
|
type: Injectable,
|
630
630
|
args: [{ providedIn: 'root' }]
|
631
|
-
}], ctorParameters:
|
631
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
632
632
|
type: Inject,
|
633
633
|
args: [TOAST_CONFIG]
|
634
|
-
}] }, { type: Overlay }, { type: i0.Injector }, { type: i2.DomSanitizer }, { type: i0.NgZone }]
|
634
|
+
}] }, { type: Overlay }, { type: i0.Injector }, { type: i2.DomSanitizer }, { type: i0.NgZone }] });
|
635
635
|
|
636
636
|
class Toast {
|
637
637
|
toastrService;
|
@@ -643,14 +643,17 @@ class Toast {
|
|
643
643
|
duplicatesCount;
|
644
644
|
originalTimeout;
|
645
645
|
/** width of progress bar */
|
646
|
-
width = -1;
|
646
|
+
width = signal(-1);
|
647
647
|
/** a combination of toast type and options.toastClass */
|
648
648
|
toastClasses = '';
|
649
|
-
/** controls animation */
|
650
649
|
state;
|
650
|
+
/** controls animation */
|
651
|
+
get _state() {
|
652
|
+
return this.state();
|
653
|
+
}
|
651
654
|
/** hides component when waiting to be displayed */
|
652
655
|
get displayStyle() {
|
653
|
-
if (this.state.value === 'inactive') {
|
656
|
+
if (this.state().value === 'inactive') {
|
654
657
|
return 'none';
|
655
658
|
}
|
656
659
|
return;
|
@@ -683,13 +686,13 @@ class Toast {
|
|
683
686
|
this.sub3 = toastPackage.toastRef.countDuplicate().subscribe(count => {
|
684
687
|
this.duplicatesCount = count;
|
685
688
|
});
|
686
|
-
this.state = {
|
689
|
+
this.state = signal({
|
687
690
|
value: 'inactive',
|
688
691
|
params: {
|
689
692
|
easeTime: this.toastPackage.config.easeTime,
|
690
693
|
easing: 'ease-in',
|
691
694
|
},
|
692
|
-
};
|
695
|
+
});
|
693
696
|
}
|
694
697
|
ngOnDestroy() {
|
695
698
|
this.sub.unsubscribe();
|
@@ -703,7 +706,7 @@ class Toast {
|
|
703
706
|
* activates toast and sets timeout
|
704
707
|
*/
|
705
708
|
activateToast() {
|
706
|
-
this.state
|
709
|
+
this.state.update(state => ({ ...state, value: 'active' }));
|
707
710
|
if (!(this.options.disableTimeOut === true || this.options.disableTimeOut === 'timeOut') &&
|
708
711
|
this.options.timeOut) {
|
709
712
|
this.outsideTimeout(() => this.remove(), this.options.timeOut);
|
@@ -717,30 +720,30 @@ class Toast {
|
|
717
720
|
* updates progress bar width
|
718
721
|
*/
|
719
722
|
updateProgress() {
|
720
|
-
if (this.width === 0 || this.width === 100 || !this.options.timeOut) {
|
723
|
+
if (this.width() === 0 || this.width() === 100 || !this.options.timeOut) {
|
721
724
|
return;
|
722
725
|
}
|
723
726
|
const now = new Date().getTime();
|
724
727
|
const remaining = this.hideTime - now;
|
725
|
-
this.width
|
728
|
+
this.width.set((remaining / this.options.timeOut) * 100);
|
726
729
|
if (this.options.progressAnimation === 'increasing') {
|
727
|
-
this.width
|
730
|
+
this.width.update(width => 100 - width);
|
728
731
|
}
|
729
|
-
if (this.width <= 0) {
|
730
|
-
this.width
|
732
|
+
if (this.width() <= 0) {
|
733
|
+
this.width.set(0);
|
731
734
|
}
|
732
|
-
if (this.width >= 100) {
|
733
|
-
this.width
|
735
|
+
if (this.width() >= 100) {
|
736
|
+
this.width.set(100);
|
734
737
|
}
|
735
738
|
}
|
736
739
|
resetTimeout() {
|
737
740
|
clearTimeout(this.timeout);
|
738
741
|
clearInterval(this.intervalId);
|
739
|
-
this.state
|
742
|
+
this.state.update(state => ({ ...state, value: 'active' }));
|
740
743
|
this.outsideTimeout(() => this.remove(), this.originalTimeout);
|
741
744
|
this.options.timeOut = this.originalTimeout;
|
742
745
|
this.hideTime = new Date().getTime() + (this.options.timeOut || 0);
|
743
|
-
this.width
|
746
|
+
this.width.set(-1);
|
744
747
|
if (this.options.progressBar) {
|
745
748
|
this.outsideInterval(() => this.updateProgress(), 10);
|
746
749
|
}
|
@@ -749,15 +752,15 @@ class Toast {
|
|
749
752
|
* tells toastrService to remove this toast after animation time
|
750
753
|
*/
|
751
754
|
remove() {
|
752
|
-
if (this.state.value === 'removed') {
|
755
|
+
if (this.state().value === 'removed') {
|
753
756
|
return;
|
754
757
|
}
|
755
758
|
clearTimeout(this.timeout);
|
756
|
-
this.state
|
759
|
+
this.state.update(state => ({ ...state, value: 'removed' }));
|
757
760
|
this.outsideTimeout(() => this.toastrService.remove(this.toastPackage.toastId), +this.toastPackage.config.easeTime);
|
758
761
|
}
|
759
762
|
tapToast() {
|
760
|
-
if (this.state.value === 'removed') {
|
763
|
+
if (this.state().value === 'removed') {
|
761
764
|
return;
|
762
765
|
}
|
763
766
|
this.toastPackage.triggerTap();
|
@@ -766,7 +769,7 @@ class Toast {
|
|
766
769
|
}
|
767
770
|
}
|
768
771
|
stickAround() {
|
769
|
-
if (this.state.value === 'removed') {
|
772
|
+
if (this.state().value === 'removed') {
|
770
773
|
return;
|
771
774
|
}
|
772
775
|
if (this.options.disableTimeOut !== 'extendedTimeOut') {
|
@@ -775,19 +778,19 @@ class Toast {
|
|
775
778
|
this.hideTime = 0;
|
776
779
|
// disable progressBar
|
777
780
|
clearInterval(this.intervalId);
|
778
|
-
this.width
|
781
|
+
this.width.set(0);
|
779
782
|
}
|
780
783
|
}
|
781
784
|
delayedHideToast() {
|
782
785
|
if ((this.options.disableTimeOut === true || this.options.disableTimeOut === 'extendedTimeOut') ||
|
783
786
|
this.options.extendedTimeOut === 0 ||
|
784
|
-
this.state.value === 'removed') {
|
787
|
+
this.state().value === 'removed') {
|
785
788
|
return;
|
786
789
|
}
|
787
790
|
this.outsideTimeout(() => this.remove(), this.options.extendedTimeOut);
|
788
791
|
this.options.timeOut = this.options.extendedTimeOut;
|
789
792
|
this.hideTime = new Date().getTime() + (this.options.timeOut || 0);
|
790
|
-
this.width
|
793
|
+
this.width.set(-1);
|
791
794
|
if (this.options.progressBar) {
|
792
795
|
this.outsideInterval(() => this.updateProgress(), 10);
|
793
796
|
}
|
@@ -816,8 +819,8 @@ class Toast {
|
|
816
819
|
func();
|
817
820
|
}
|
818
821
|
}
|
819
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
820
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
822
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: Toast, deps: [{ token: ToastrService }, { token: ToastPackage }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
823
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.0", 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: `
|
821
824
|
<button *ngIf="options.closeButton" (click)="remove()" type="button" class="toast-close-button" aria-label="Close">
|
822
825
|
<span aria-hidden="true">×</span>
|
823
826
|
</button>
|
@@ -832,7 +835,7 @@ class Toast {
|
|
832
835
|
{{ message }}
|
833
836
|
</div>
|
834
837
|
<div *ngIf="options.progressBar">
|
835
|
-
<div class="toast-progress" [style.width]="width + '%'"></div>
|
838
|
+
<div class="toast-progress" [style.width]="width() + '%'"></div>
|
836
839
|
</div>
|
837
840
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], animations: [
|
838
841
|
trigger('flyInOut', [
|
@@ -842,9 +845,9 @@ class Toast {
|
|
842
845
|
transition('inactive => active', animate('{{ easeTime }}ms {{ easing }}')),
|
843
846
|
transition('active => removed', animate('{{ easeTime }}ms {{ easing }}')),
|
844
847
|
]),
|
845
|
-
] });
|
848
|
+
], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
846
849
|
}
|
847
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
850
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: Toast, decorators: [{
|
848
851
|
type: Component,
|
849
852
|
args: [{
|
850
853
|
selector: '[toast-component]',
|
@@ -863,7 +866,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImpor
|
|
863
866
|
{{ message }}
|
864
867
|
</div>
|
865
868
|
<div *ngIf="options.progressBar">
|
866
|
-
<div class="toast-progress" [style.width]="width + '%'"></div>
|
869
|
+
<div class="toast-progress" [style.width]="width() + '%'"></div>
|
867
870
|
</div>
|
868
871
|
`,
|
869
872
|
animations: [
|
@@ -878,11 +881,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImpor
|
|
878
881
|
preserveWhitespaces: false,
|
879
882
|
standalone: true,
|
880
883
|
imports: [NgIf],
|
884
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
881
885
|
}]
|
882
|
-
}], ctorParameters:
|
886
|
+
}], ctorParameters: () => [{ type: ToastrService }, { type: ToastPackage }, { type: i0.NgZone }], propDecorators: { toastClasses: [{
|
883
887
|
type: HostBinding,
|
884
888
|
args: ['class']
|
885
|
-
}],
|
889
|
+
}], _state: [{
|
886
890
|
type: HostBinding,
|
887
891
|
args: ['@flyInOut']
|
888
892
|
}], displayStyle: [{
|
@@ -943,11 +947,11 @@ class ToastrModule {
|
|
943
947
|
providers: [provideToastr(config)],
|
944
948
|
};
|
945
949
|
}
|
946
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
947
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
948
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
950
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastrModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
951
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.0", ngImport: i0, type: ToastrModule, imports: [Toast], exports: [Toast] });
|
952
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastrModule });
|
949
953
|
}
|
950
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
954
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastrModule, decorators: [{
|
951
955
|
type: NgModule,
|
952
956
|
args: [{
|
953
957
|
imports: [Toast],
|
@@ -969,11 +973,11 @@ class ToastrComponentlessModule {
|
|
969
973
|
],
|
970
974
|
};
|
971
975
|
}
|
972
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
973
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
974
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
976
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastrComponentlessModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
977
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.0", ngImport: i0, type: ToastrComponentlessModule });
|
978
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastrComponentlessModule });
|
975
979
|
}
|
976
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
980
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastrComponentlessModule, decorators: [{
|
977
981
|
type: NgModule,
|
978
982
|
args: [{}]
|
979
983
|
}] });
|
@@ -988,17 +992,18 @@ class ToastNoAnimation {
|
|
988
992
|
duplicatesCount;
|
989
993
|
originalTimeout;
|
990
994
|
/** width of progress bar */
|
991
|
-
width = -1;
|
995
|
+
width = signal(-1);
|
992
996
|
/** a combination of toast type and options.toastClass */
|
993
997
|
toastClasses = '';
|
994
998
|
/** hides component when waiting to be displayed */
|
995
999
|
get displayStyle() {
|
996
|
-
if (this.state === 'inactive') {
|
1000
|
+
if (this.state() === 'inactive') {
|
997
1001
|
return 'none';
|
998
1002
|
}
|
1003
|
+
return null;
|
999
1004
|
}
|
1000
1005
|
/** controls animation */
|
1001
|
-
state = 'inactive';
|
1006
|
+
state = signal('inactive');
|
1002
1007
|
timeout;
|
1003
1008
|
intervalId;
|
1004
1009
|
hideTime;
|
@@ -1040,7 +1045,7 @@ class ToastNoAnimation {
|
|
1040
1045
|
* activates toast and sets timeout
|
1041
1046
|
*/
|
1042
1047
|
activateToast() {
|
1043
|
-
this.state
|
1048
|
+
this.state.set('active');
|
1044
1049
|
if (!(this.options.disableTimeOut === true || this.options.disableTimeOut === 'timeOut') && this.options.timeOut) {
|
1045
1050
|
this.timeout = setTimeout(() => {
|
1046
1051
|
this.remove();
|
@@ -1058,30 +1063,30 @@ class ToastNoAnimation {
|
|
1058
1063
|
* updates progress bar width
|
1059
1064
|
*/
|
1060
1065
|
updateProgress() {
|
1061
|
-
if (this.width === 0 || this.width === 100 || !this.options.timeOut) {
|
1066
|
+
if (this.width() === 0 || this.width() === 100 || !this.options.timeOut) {
|
1062
1067
|
return;
|
1063
1068
|
}
|
1064
1069
|
const now = new Date().getTime();
|
1065
1070
|
const remaining = this.hideTime - now;
|
1066
|
-
this.width
|
1071
|
+
this.width.set((remaining / this.options.timeOut) * 100);
|
1067
1072
|
if (this.options.progressAnimation === 'increasing') {
|
1068
|
-
this.width
|
1073
|
+
this.width.update(width => 100 - width);
|
1069
1074
|
}
|
1070
|
-
if (this.width <= 0) {
|
1071
|
-
this.width
|
1075
|
+
if (this.width() <= 0) {
|
1076
|
+
this.width.set(0);
|
1072
1077
|
}
|
1073
|
-
if (this.width >= 100) {
|
1074
|
-
this.width
|
1078
|
+
if (this.width() >= 100) {
|
1079
|
+
this.width.set(100);
|
1075
1080
|
}
|
1076
1081
|
}
|
1077
1082
|
resetTimeout() {
|
1078
1083
|
clearTimeout(this.timeout);
|
1079
1084
|
clearInterval(this.intervalId);
|
1080
|
-
this.state
|
1085
|
+
this.state.set('active');
|
1081
1086
|
this.options.timeOut = this.originalTimeout;
|
1082
1087
|
this.timeout = setTimeout(() => this.remove(), this.originalTimeout);
|
1083
1088
|
this.hideTime = new Date().getTime() + (this.originalTimeout || 0);
|
1084
|
-
this.width
|
1089
|
+
this.width.set(-1);
|
1085
1090
|
if (this.options.progressBar) {
|
1086
1091
|
this.intervalId = setInterval(() => this.updateProgress(), 10);
|
1087
1092
|
}
|
@@ -1090,15 +1095,15 @@ class ToastNoAnimation {
|
|
1090
1095
|
* tells toastrService to remove this toast after animation time
|
1091
1096
|
*/
|
1092
1097
|
remove() {
|
1093
|
-
if (this.state === 'removed') {
|
1098
|
+
if (this.state() === 'removed') {
|
1094
1099
|
return;
|
1095
1100
|
}
|
1096
1101
|
clearTimeout(this.timeout);
|
1097
|
-
this.state
|
1102
|
+
this.state.set('removed');
|
1098
1103
|
this.timeout = setTimeout(() => this.toastrService.remove(this.toastPackage.toastId));
|
1099
1104
|
}
|
1100
1105
|
tapToast() {
|
1101
|
-
if (this.state === 'removed') {
|
1106
|
+
if (this.state() === 'removed') {
|
1102
1107
|
return;
|
1103
1108
|
}
|
1104
1109
|
this.toastPackage.triggerTap();
|
@@ -1107,7 +1112,7 @@ class ToastNoAnimation {
|
|
1107
1112
|
}
|
1108
1113
|
}
|
1109
1114
|
stickAround() {
|
1110
|
-
if (this.state === 'removed') {
|
1115
|
+
if (this.state() === 'removed') {
|
1111
1116
|
return;
|
1112
1117
|
}
|
1113
1118
|
clearTimeout(this.timeout);
|
@@ -1115,24 +1120,24 @@ class ToastNoAnimation {
|
|
1115
1120
|
this.hideTime = 0;
|
1116
1121
|
// disable progressBar
|
1117
1122
|
clearInterval(this.intervalId);
|
1118
|
-
this.width
|
1123
|
+
this.width.set(0);
|
1119
1124
|
}
|
1120
1125
|
delayedHideToast() {
|
1121
1126
|
if ((this.options.disableTimeOut === true || this.options.disableTimeOut === 'extendedTimeOut') ||
|
1122
1127
|
this.options.extendedTimeOut === 0 ||
|
1123
|
-
this.state === 'removed') {
|
1128
|
+
this.state() === 'removed') {
|
1124
1129
|
return;
|
1125
1130
|
}
|
1126
1131
|
this.timeout = setTimeout(() => this.remove(), this.options.extendedTimeOut);
|
1127
1132
|
this.options.timeOut = this.options.extendedTimeOut;
|
1128
1133
|
this.hideTime = new Date().getTime() + (this.options.timeOut || 0);
|
1129
|
-
this.width
|
1134
|
+
this.width.set(-1);
|
1130
1135
|
if (this.options.progressBar) {
|
1131
1136
|
this.intervalId = setInterval(() => this.updateProgress(), 10);
|
1132
1137
|
}
|
1133
1138
|
}
|
1134
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
1135
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
1139
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastNoAnimation, deps: [{ token: ToastrService }, { token: ToastPackage }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Component });
|
1140
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.0.0", 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: `
|
1136
1141
|
<button *ngIf="options.closeButton" (click)="remove()" type="button" class="toast-close-button" aria-label="Close">
|
1137
1142
|
<span aria-hidden="true">×</span>
|
1138
1143
|
</button>
|
@@ -1147,11 +1152,11 @@ class ToastNoAnimation {
|
|
1147
1152
|
{{ message }}
|
1148
1153
|
</div>
|
1149
1154
|
<div *ngIf="options.progressBar">
|
1150
|
-
<div class="toast-progress" [style.width]="width + '%'"></div>
|
1155
|
+
<div class="toast-progress" [style.width]="width() + '%'"></div>
|
1151
1156
|
</div>
|
1152
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
1157
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1153
1158
|
}
|
1154
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
1159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastNoAnimation, decorators: [{
|
1155
1160
|
type: Component,
|
1156
1161
|
args: [{
|
1157
1162
|
selector: '[toast-component]',
|
@@ -1170,13 +1175,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImpor
|
|
1170
1175
|
{{ message }}
|
1171
1176
|
</div>
|
1172
1177
|
<div *ngIf="options.progressBar">
|
1173
|
-
<div class="toast-progress" [style.width]="width + '%'"></div>
|
1178
|
+
<div class="toast-progress" [style.width]="width() + '%'"></div>
|
1174
1179
|
</div>
|
1175
1180
|
`,
|
1176
1181
|
standalone: true,
|
1177
|
-
imports: [NgIf]
|
1182
|
+
imports: [NgIf],
|
1183
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
1178
1184
|
}]
|
1179
|
-
}], ctorParameters:
|
1185
|
+
}], ctorParameters: () => [{ type: ToastrService }, { type: ToastPackage }, { type: i0.ApplicationRef }], propDecorators: { toastClasses: [{
|
1180
1186
|
type: HostBinding,
|
1181
1187
|
args: ['class']
|
1182
1188
|
}], displayStyle: [{
|
@@ -1211,11 +1217,11 @@ class ToastNoAnimationModule {
|
|
1211
1217
|
],
|
1212
1218
|
};
|
1213
1219
|
}
|
1214
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
1215
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
1216
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
1220
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastNoAnimationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1221
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.0", ngImport: i0, type: ToastNoAnimationModule, imports: [ToastNoAnimation], exports: [ToastNoAnimation] });
|
1222
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastNoAnimationModule });
|
1217
1223
|
}
|
1218
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
1224
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastNoAnimationModule, decorators: [{
|
1219
1225
|
type: NgModule,
|
1220
1226
|
args: [{
|
1221
1227
|
imports: [ToastNoAnimation],
|