1 | import { ComponentRef, Injector, NgZone } from '@angular/core';
|
2 | import { DomSanitizer } from '@angular/platform-browser';
|
3 | import { Observable } from 'rxjs';
|
4 | import { Overlay } from '../overlay/overlay';
|
5 | import { ToastRef } from './toast-ref';
|
6 | import { ToastContainerDirective } from './toast.directive';
|
7 | import { GlobalConfig, IndividualConfig, ToastToken } from './toastr-config';
|
8 | import * as i0 from "@angular/core";
|
9 | export interface ActiveToast<C> {
|
10 |
|
11 | toastId: number;
|
12 |
|
13 | title: string;
|
14 |
|
15 | message: string;
|
16 |
|
17 | portal: ComponentRef<C>;
|
18 |
|
19 | toastRef: ToastRef<C>;
|
20 |
|
21 | onShown: Observable<void>;
|
22 |
|
23 | onHidden: Observable<void>;
|
24 |
|
25 | onTap: Observable<void>;
|
26 |
|
27 | onAction: Observable<any>;
|
28 | }
|
29 | export declare class ToastrService {
|
30 | private overlay;
|
31 | private _injector;
|
32 | private sanitizer;
|
33 | private ngZone;
|
34 | toastrConfig: GlobalConfig;
|
35 | currentlyActive: number;
|
36 | toasts: ActiveToast<any>[];
|
37 | overlayContainer?: ToastContainerDirective;
|
38 | previousToastMessage: string | undefined;
|
39 | private index;
|
40 | constructor(token: ToastToken, overlay: Overlay, _injector: Injector, sanitizer: DomSanitizer, ngZone: NgZone);
|
41 | /** show toast */
|
42 | show<ConfigPayload = any>(message?: string, title?: string, override?: Partial<IndividualConfig<ConfigPayload>>, type?: string): ActiveToast<any>;
|
43 | /** show successful toast */
|
44 | success<ConfigPayload = any>(message?: string, title?: string, override?: Partial<IndividualConfig<ConfigPayload>>): ActiveToast<any>;
|
45 | /** show error toast */
|
46 | error<ConfigPayload = any>(message?: string, title?: string, override?: Partial<IndividualConfig<ConfigPayload>>): ActiveToast<any>;
|
47 | /** show info toast */
|
48 | info<ConfigPayload = any>(message?: string, title?: string, override?: Partial<IndividualConfig<ConfigPayload>>): ActiveToast<any>;
|
49 | /** show warning toast */
|
50 | warning<ConfigPayload = any>(message?: string, title?: string, override?: Partial<IndividualConfig<ConfigPayload>>): ActiveToast<any>;
|
51 | /**
|
52 | * Remove all or a single toast by id
|
53 | */
|
54 | clear(toastId?: number): void;
|
55 | /**
|
56 | * Remove and destroy a single toast by id
|
57 | */
|
58 | remove(toastId: number): boolean;
|
59 | /**
|
60 | * Determines if toast message is already shown
|
61 | */
|
62 | findDuplicate(title: string, message: string, resetOnDuplicate: boolean, countDuplicates: boolean): ActiveToast<any>;
|
63 | /** create a clone of global config and apply individual settings */
|
64 | private applyConfig;
|
65 | /**
|
66 | * Find toast object by id
|
67 | */
|
68 | private _findToast;
|
69 | /**
|
70 | * Determines the need to run inside angular's zone then builds the toast
|
71 | */
|
72 | private _preBuildNotification;
|
73 | /**
|
74 | * Creates and attaches toast data to component
|
75 | * returns the active toast, or in case preventDuplicates is enabled the original/non-duplicate active toast.
|
76 | */
|
77 | private _buildNotification;
|
78 | static ɵfac: i0.ɵɵFactoryDeclaration<ToastrService, never>;
|
79 | static ɵprov: i0.ɵɵInjectableDeclaration<ToastrService>;
|
80 | }
|