/** * @license * Copyright Endlessjs. All Rights Reserved. * Licensed under the MIT License. See License.txt in the project root for license information. */ import { ComponentFactoryResolver, ComponentRef } from '@angular/core'; import { ElOverlayRef } from '../cdk/overlay/mapping'; import { ElOverlayService } from '../cdk/overlay/overlay-service'; import { ElPositionBuilderService } from '../cdk/overlay/overlay-position'; import { ElGlobalLogicalPosition, ElGlobalPosition, ElPositionHelper } from '../cdk/overlay/position-helper'; import { ElToastrContainerComponent } from './toastr-container.component'; import { ElToastrConfig } from './toastr-config'; import { ElToast } from './model'; import { ElToastComponent } from './toast.component'; export declare class ElToastRef { private toastContainer; private toast; constructor(toastContainer: ElToastContainer, toast: ElToast); close(): void; } export declare class ElToastContainer { protected position: ElGlobalPosition; protected containerRef: ComponentRef; protected positionHelper: ElPositionHelper; protected toasts: ElToast[]; protected prevToast: ElToast; readonly nativeElement: any; constructor(position: ElGlobalPosition, containerRef: ComponentRef, positionHelper: ElPositionHelper); attach(toast: ElToast): ElToastRef; destroy(toast: ElToast): void; protected isDuplicate(toast: ElToast): boolean; protected isDuplicatePrevious(toast: ElToast): boolean; protected isDuplicateAmongAll(toast: ElToast): boolean; protected toastDuplicateCompareFunc: (t1: ElToast, t2: ElToast) => boolean; protected removeToastIfLimitReached(toast: ElToast): void; protected attachToast(toast: ElToast): ElToastComponent; protected attachToTop(toast: ElToast): ElToastComponent; protected attachToBottom(toast: ElToast): ElToastComponent; protected setDestroyTimeout(toast: ElToast): void; protected subscribeOnClick(toastComponent: ElToastComponent, toast: ElToast): void; protected updateContainer(): void; } interface ElToastrOverlayWithContainer { overlayRef: ElOverlayRef; toastrContainer: ElToastContainer; } export declare class ElToastrContainerRegistry { protected overlay: ElOverlayService; protected positionBuilder: ElPositionBuilderService; protected positionHelper: ElPositionHelper; protected cfr: ComponentFactoryResolver; protected document: any; protected overlays: Map; constructor(overlay: ElOverlayService, positionBuilder: ElPositionBuilderService, positionHelper: ElPositionHelper, cfr: ComponentFactoryResolver, document: any); get(position: ElGlobalPosition): ElToastContainer; protected instantiateContainer(position: ElGlobalLogicalPosition): void; protected createContainer(position: ElGlobalLogicalPosition): ElToastrOverlayWithContainer; protected existsInDom(toastContainer: ElToastContainer): boolean; } /** * The `ElToastrService` provides a capability to build toast notifications. * * @stacked-example(Showcase, toastr/toastr-showcase.component) * * `ElToastrService.show(message, title, config)` accepts three params, title and config are optional. * * ### Installation * * Import `ElToastrModule.forRoot()` to your app module. * ```ts * @NgModule({ * imports: [ * // ... * ElToastrModule.forRoot(config), * ], * }) * export class AppModule { } * ``` * * ### Usage * * Calling `ElToastrService.show(...)` will render new toast and return `ElToastrRef` with * help of which you may close newly created toast by calling `close` method. * * ```ts * const toastRef: ElToastRef = this.toastrService.show(...); * toastRef.close(); * ``` * * Config accepts following options: * * `position` - determines where on the screen toast will be rendered. * Default is `top-end`. * * @stacked-example(Position, toastr/toastr-positions.component) * * `status` - coloring and icon of the toast. * Default is `primary` * * @stacked-example(Status, toastr/toastr-statuses.component) * * `duration` - the time after which the toast will be destroyed. * `0` means endless toast, that may be destroyed by click only. * Default is 3000 ms. * * @stacked-example(Duration, toastr/toastr-duration.component) * * `destroyByClick` - provides a capability to destroy toast by click. * Default is true. * * @stacked-example(Destroy by click, toastr/toastr-destroy-by-click.component) * * `preventDuplicates` - don't create new toast if it has the same title, message and status. * Default is false. * * @stacked-example(Prevent duplicates, toastr/toastr-prevent-duplicates.component) * * `duplicatesBehaviour` - determines how to threat the toasts duplication. * Compare with the previous message `previous` * or with all visible messages `all`. * * @stacked-example(Prevent duplicates behaviour , toastr/toastr-prevent-duplicates-behaviour.component) * * `limit` - the number of visible toasts in the toast container. The number of toasts is unlimited by default. * * @stacked-example(Prevent duplicates behaviour , toastr/toastr-limit.component) * * `hasIcon` - if true then render toast icon. * `icon` - you can pass icon class that will be applied into the toast. * * @stacked-example(Has icon, toastr/toastr-icon.component) * */ export declare class ElToastrService { protected globalConfig: ElToastrConfig; protected containerRegistry: ElToastrContainerRegistry; constructor(globalConfig: ElToastrConfig, containerRegistry: ElToastrContainerRegistry); /** * Shows toast with message, title and user config. * */ show(message: any, title?: any, userConfig?: Partial): ElToastRef; /** * Shows success toast with message, title and user config. * */ success(message: any, title?: any, config?: Partial): ElToastRef; /** * Shows info toast with message, title and user config. * */ info(message: any, title?: any, config?: Partial): ElToastRef; /** * Shows warning toast with message, title and user config. * */ warning(message: any, title?: any, config?: Partial): ElToastRef; /** * Shows primary toast with message, title and user config. * */ primary(message: any, title?: any, config?: Partial): ElToastRef; /** * Shows danger toast with message, title and user config. * */ danger(message: any, title?: any, config?: Partial): ElToastRef; /** * Shows default toast with message, title and user config. * */ default(message: any, title?: any, config?: Partial): ElToastRef; } export {};