UNPKG

@xui/components

Version:

xUI Components for Angular

78 lines (77 loc) 3.54 kB
import { EmbeddedViewRef, Injector, OnDestroy, TemplateRef } from '@angular/core'; import { SnackBarConfig } from '../config'; import { ComponentType, Overlay } from '@angular/cdk/overlay'; import { SimpleSnackBar, TextOnlySnackBar } from './simple-snack-bar'; import { SnackBarRef } from './snack-bar-ref'; import { SnackBarContainer } from './snack-bar-container'; import { LiveAnnouncer } from '@angular/cdk/a11y'; import { BreakpointObserver } from '@angular/cdk/layout'; import * as i0 from "@angular/core"; export declare class XuiSnackBar implements OnDestroy { private overlay; private live; private injector; private breakpointObserver; private parentSnackBar; /** * Reference to the current snack bar in the view *at this level* (in the Angular injector tree). * If there is a parent snack-bar service, all operations should delegate to that parent * via `openedSnackBarRef`. */ private snackBarRefAtThisLevel; /** The component that should be rendered as the snack bar's simple component. */ simpleSnackBarComponent: typeof SimpleSnackBar; /** The container component that attaches the provided template or component. */ snackBarContainerComponent: typeof SnackBarContainer; /** The CSS class to apply for handset mode. */ handsetCssClass: string; /** Reference to the currently opened snackbar at *any* level. */ get openedSnackBarRef(): SnackBarRef<any> | null; set openedSnackBarRef(value: SnackBarRef<any> | null); constructor(overlay: Overlay, live: LiveAnnouncer, injector: Injector, breakpointObserver: BreakpointObserver, parentSnackBar: XuiSnackBar); /** * Creates and dispatches a snack bar with a custom component for the content, removing any * currently opened snack bars. * * @param component Component to be instantiated. * @param config Extra configuration for the snack bar. */ openFromComponent<T, D = any>(component: ComponentType<T>, config?: SnackBarConfig<D>): SnackBarRef<T>; /** * Creates and dispatches a snack bar with a custom template for the content, removing any * currently opened snack bars. * * @param template Template to be instantiated. * @param config Extra configuration for the snack bar. */ openFromTemplate(template: TemplateRef<any>, config?: SnackBarConfig): SnackBarRef<EmbeddedViewRef<any>>; open(message: string, action?: string, config?: SnackBarConfig): SnackBarRef<TextOnlySnackBar>; /** * Dismisses the currently-visible snack bar. */ dismiss(): void; ngOnDestroy(): void; /** * Attaches the snack bar container component to the overlay. */ private attachSnackBarContainer; /** * Places a new component or a template as the content of the snack bar container. */ private attach; /** Animates the old snack bar out and the new one in. */ private animateSnackBar; /** * Creates a new overlay and places it in the correct location. * @param config The user-specified snack bar config. */ private createOverlay; /** * Creates an injector to be used inside a snack bar component. * @param config Config that was used to create the snack bar. * @param snackBarRef Reference to the snack bar. */ private createInjector; static ɵfac: i0.ɵɵFactoryDeclaration<XuiSnackBar, [null, null, null, null, { optional: true; skipSelf: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<XuiSnackBar>; }