ngx-toastr 18.0.0 → 19.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/overlay/overlay-container.mjs +4 -4
- package/esm2022/overlay/overlay.mjs +4 -4
- package/esm2022/portal/dom-portal-host.mjs +1 -1
- package/esm2022/portal/portal.mjs +1 -1
- package/esm2022/toastr/toast-noanimation.component.mjs +34 -32
- package/esm2022/toastr/toast-ref.mjs +1 -1
- package/esm2022/toastr/toast.component.mjs +35 -31
- package/esm2022/toastr/toast.directive.mjs +3 -3
- package/esm2022/toastr/toastr-config.mjs +1 -1
- package/esm2022/toastr/toastr.module.mjs +8 -8
- package/esm2022/toastr/toastr.service.mjs +4 -4
- package/fesm2022/ngx-toastr.mjs +87 -82
- package/fesm2022/ngx-toastr.mjs.map +1 -1
- package/package.json +5 -2
- package/toastr/toast-noanimation.component.d.ts +2 -2
- package/toastr/toast.component.d.ts +11 -4
package/fesm2022/ngx-toastr.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
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';
|
3
|
-
import {
|
2
|
+
import { Directive, InjectionToken, inject, Injectable, ComponentFactoryResolver, ApplicationRef, SecurityContext, Injector, Inject, signal, Component, ChangeDetectionStrategy, HostBinding, HostListener, makeEnvironmentProviders, NgModule } from '@angular/core';
|
3
|
+
import { trigger, state, style, transition, animate } from '@angular/animations';
|
4
4
|
import { DOCUMENT, NgIf } from '@angular/common';
|
5
5
|
import { Subject } from 'rxjs';
|
6
6
|
import * as i2 from '@angular/platform-browser';
|
@@ -13,10 +13,10 @@ 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]',
|
@@ -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,10 +622,10 @@ 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
631
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
@@ -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: "17.0.3", 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: "17.0.3", ngImpor
|
|
878
881
|
preserveWhitespaces: false,
|
879
882
|
standalone: true,
|
880
883
|
imports: [NgIf],
|
884
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
881
885
|
}]
|
882
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,18 +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
|
}
|
999
1003
|
return null;
|
1000
1004
|
}
|
1001
1005
|
/** controls animation */
|
1002
|
-
state = 'inactive';
|
1006
|
+
state = signal('inactive');
|
1003
1007
|
timeout;
|
1004
1008
|
intervalId;
|
1005
1009
|
hideTime;
|
@@ -1041,7 +1045,7 @@ class ToastNoAnimation {
|
|
1041
1045
|
* activates toast and sets timeout
|
1042
1046
|
*/
|
1043
1047
|
activateToast() {
|
1044
|
-
this.state
|
1048
|
+
this.state.set('active');
|
1045
1049
|
if (!(this.options.disableTimeOut === true || this.options.disableTimeOut === 'timeOut') && this.options.timeOut) {
|
1046
1050
|
this.timeout = setTimeout(() => {
|
1047
1051
|
this.remove();
|
@@ -1059,30 +1063,30 @@ class ToastNoAnimation {
|
|
1059
1063
|
* updates progress bar width
|
1060
1064
|
*/
|
1061
1065
|
updateProgress() {
|
1062
|
-
if (this.width === 0 || this.width === 100 || !this.options.timeOut) {
|
1066
|
+
if (this.width() === 0 || this.width() === 100 || !this.options.timeOut) {
|
1063
1067
|
return;
|
1064
1068
|
}
|
1065
1069
|
const now = new Date().getTime();
|
1066
1070
|
const remaining = this.hideTime - now;
|
1067
|
-
this.width
|
1071
|
+
this.width.set((remaining / this.options.timeOut) * 100);
|
1068
1072
|
if (this.options.progressAnimation === 'increasing') {
|
1069
|
-
this.width
|
1073
|
+
this.width.update(width => 100 - width);
|
1070
1074
|
}
|
1071
|
-
if (this.width <= 0) {
|
1072
|
-
this.width
|
1075
|
+
if (this.width() <= 0) {
|
1076
|
+
this.width.set(0);
|
1073
1077
|
}
|
1074
|
-
if (this.width >= 100) {
|
1075
|
-
this.width
|
1078
|
+
if (this.width() >= 100) {
|
1079
|
+
this.width.set(100);
|
1076
1080
|
}
|
1077
1081
|
}
|
1078
1082
|
resetTimeout() {
|
1079
1083
|
clearTimeout(this.timeout);
|
1080
1084
|
clearInterval(this.intervalId);
|
1081
|
-
this.state
|
1085
|
+
this.state.set('active');
|
1082
1086
|
this.options.timeOut = this.originalTimeout;
|
1083
1087
|
this.timeout = setTimeout(() => this.remove(), this.originalTimeout);
|
1084
1088
|
this.hideTime = new Date().getTime() + (this.originalTimeout || 0);
|
1085
|
-
this.width
|
1089
|
+
this.width.set(-1);
|
1086
1090
|
if (this.options.progressBar) {
|
1087
1091
|
this.intervalId = setInterval(() => this.updateProgress(), 10);
|
1088
1092
|
}
|
@@ -1091,15 +1095,15 @@ class ToastNoAnimation {
|
|
1091
1095
|
* tells toastrService to remove this toast after animation time
|
1092
1096
|
*/
|
1093
1097
|
remove() {
|
1094
|
-
if (this.state === 'removed') {
|
1098
|
+
if (this.state() === 'removed') {
|
1095
1099
|
return;
|
1096
1100
|
}
|
1097
1101
|
clearTimeout(this.timeout);
|
1098
|
-
this.state
|
1102
|
+
this.state.set('removed');
|
1099
1103
|
this.timeout = setTimeout(() => this.toastrService.remove(this.toastPackage.toastId));
|
1100
1104
|
}
|
1101
1105
|
tapToast() {
|
1102
|
-
if (this.state === 'removed') {
|
1106
|
+
if (this.state() === 'removed') {
|
1103
1107
|
return;
|
1104
1108
|
}
|
1105
1109
|
this.toastPackage.triggerTap();
|
@@ -1108,7 +1112,7 @@ class ToastNoAnimation {
|
|
1108
1112
|
}
|
1109
1113
|
}
|
1110
1114
|
stickAround() {
|
1111
|
-
if (this.state === 'removed') {
|
1115
|
+
if (this.state() === 'removed') {
|
1112
1116
|
return;
|
1113
1117
|
}
|
1114
1118
|
clearTimeout(this.timeout);
|
@@ -1116,24 +1120,24 @@ class ToastNoAnimation {
|
|
1116
1120
|
this.hideTime = 0;
|
1117
1121
|
// disable progressBar
|
1118
1122
|
clearInterval(this.intervalId);
|
1119
|
-
this.width
|
1123
|
+
this.width.set(0);
|
1120
1124
|
}
|
1121
1125
|
delayedHideToast() {
|
1122
1126
|
if ((this.options.disableTimeOut === true || this.options.disableTimeOut === 'extendedTimeOut') ||
|
1123
1127
|
this.options.extendedTimeOut === 0 ||
|
1124
|
-
this.state === 'removed') {
|
1128
|
+
this.state() === 'removed') {
|
1125
1129
|
return;
|
1126
1130
|
}
|
1127
1131
|
this.timeout = setTimeout(() => this.remove(), this.options.extendedTimeOut);
|
1128
1132
|
this.options.timeOut = this.options.extendedTimeOut;
|
1129
1133
|
this.hideTime = new Date().getTime() + (this.options.timeOut || 0);
|
1130
|
-
this.width
|
1134
|
+
this.width.set(-1);
|
1131
1135
|
if (this.options.progressBar) {
|
1132
1136
|
this.intervalId = setInterval(() => this.updateProgress(), 10);
|
1133
1137
|
}
|
1134
1138
|
}
|
1135
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
1136
|
-
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: `
|
1137
1141
|
<button *ngIf="options.closeButton" (click)="remove()" type="button" class="toast-close-button" aria-label="Close">
|
1138
1142
|
<span aria-hidden="true">×</span>
|
1139
1143
|
</button>
|
@@ -1148,11 +1152,11 @@ class ToastNoAnimation {
|
|
1148
1152
|
{{ message }}
|
1149
1153
|
</div>
|
1150
1154
|
<div *ngIf="options.progressBar">
|
1151
|
-
<div class="toast-progress" [style.width]="width + '%'"></div>
|
1155
|
+
<div class="toast-progress" [style.width]="width() + '%'"></div>
|
1152
1156
|
</div>
|
1153
|
-
`, 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 });
|
1154
1158
|
}
|
1155
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
1159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastNoAnimation, decorators: [{
|
1156
1160
|
type: Component,
|
1157
1161
|
args: [{
|
1158
1162
|
selector: '[toast-component]',
|
@@ -1171,11 +1175,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImpor
|
|
1171
1175
|
{{ message }}
|
1172
1176
|
</div>
|
1173
1177
|
<div *ngIf="options.progressBar">
|
1174
|
-
<div class="toast-progress" [style.width]="width + '%'"></div>
|
1178
|
+
<div class="toast-progress" [style.width]="width() + '%'"></div>
|
1175
1179
|
</div>
|
1176
1180
|
`,
|
1177
1181
|
standalone: true,
|
1178
|
-
imports: [NgIf]
|
1182
|
+
imports: [NgIf],
|
1183
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
1179
1184
|
}]
|
1180
1185
|
}], ctorParameters: () => [{ type: ToastrService }, { type: ToastPackage }, { type: i0.ApplicationRef }], propDecorators: { toastClasses: [{
|
1181
1186
|
type: HostBinding,
|
@@ -1212,11 +1217,11 @@ class ToastNoAnimationModule {
|
|
1212
1217
|
],
|
1213
1218
|
};
|
1214
1219
|
}
|
1215
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
1216
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
1217
|
-
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 });
|
1218
1223
|
}
|
1219
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
1224
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0", ngImport: i0, type: ToastNoAnimationModule, decorators: [{
|
1220
1225
|
type: NgModule,
|
1221
1226
|
args: [{
|
1222
1227
|
imports: [ToastNoAnimation],
|