[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | import { LiveAnnouncer } from '@angular/cdk/a11y';
|
---|
| 9 | import { BreakpointObserver } from '@angular/cdk/layout';
|
---|
| 10 | import { Overlay } from '@angular/cdk/overlay';
|
---|
| 11 | import { ComponentType } from '@angular/cdk/portal';
|
---|
| 12 | import { EmbeddedViewRef, InjectionToken, Injector, TemplateRef, OnDestroy, Type } from '@angular/core';
|
---|
| 13 | import { TextOnlySnackBar } from './simple-snack-bar';
|
---|
| 14 | import { MatSnackBarConfig } from './snack-bar-config';
|
---|
| 15 | import { _SnackBarContainer } from './snack-bar-container';
|
---|
| 16 | import { MatSnackBarRef } from './snack-bar-ref';
|
---|
| 17 | /** Injection token that can be used to specify default snack bar. */
|
---|
| 18 | export declare const MAT_SNACK_BAR_DEFAULT_OPTIONS: InjectionToken<MatSnackBarConfig<any>>;
|
---|
| 19 | /** @docs-private */
|
---|
| 20 | export declare function MAT_SNACK_BAR_DEFAULT_OPTIONS_FACTORY(): MatSnackBarConfig;
|
---|
| 21 | /**
|
---|
| 22 | * Service to dispatch Material Design snack bar messages.
|
---|
| 23 | */
|
---|
| 24 | export declare class MatSnackBar implements OnDestroy {
|
---|
| 25 | private _overlay;
|
---|
| 26 | private _live;
|
---|
| 27 | private _injector;
|
---|
| 28 | private _breakpointObserver;
|
---|
| 29 | private _parentSnackBar;
|
---|
| 30 | private _defaultConfig;
|
---|
| 31 | /**
|
---|
| 32 | * Reference to the current snack bar in the view *at this level* (in the Angular injector tree).
|
---|
| 33 | * If there is a parent snack-bar service, all operations should delegate to that parent
|
---|
| 34 | * via `_openedSnackBarRef`.
|
---|
| 35 | */
|
---|
| 36 | private _snackBarRefAtThisLevel;
|
---|
| 37 | /** The component that should be rendered as the snack bar's simple component. */
|
---|
| 38 | protected simpleSnackBarComponent: Type<TextOnlySnackBar>;
|
---|
| 39 | /** The container component that attaches the provided template or component. */
|
---|
| 40 | protected snackBarContainerComponent: Type<_SnackBarContainer>;
|
---|
| 41 | /** The CSS class to apply for handset mode. */
|
---|
| 42 | protected handsetCssClass: string;
|
---|
| 43 | /** Reference to the currently opened snackbar at *any* level. */
|
---|
| 44 | get _openedSnackBarRef(): MatSnackBarRef<any> | null;
|
---|
| 45 | set _openedSnackBarRef(value: MatSnackBarRef<any> | null);
|
---|
| 46 | constructor(_overlay: Overlay, _live: LiveAnnouncer, _injector: Injector, _breakpointObserver: BreakpointObserver, _parentSnackBar: MatSnackBar, _defaultConfig: MatSnackBarConfig);
|
---|
| 47 | /**
|
---|
| 48 | * Creates and dispatches a snack bar with a custom component for the content, removing any
|
---|
| 49 | * currently opened snack bars.
|
---|
| 50 | *
|
---|
| 51 | * @param component Component to be instantiated.
|
---|
| 52 | * @param config Extra configuration for the snack bar.
|
---|
| 53 | */
|
---|
| 54 | openFromComponent<T>(component: ComponentType<T>, config?: MatSnackBarConfig): MatSnackBarRef<T>;
|
---|
| 55 | /**
|
---|
| 56 | * Creates and dispatches a snack bar with a custom template for the content, removing any
|
---|
| 57 | * currently opened snack bars.
|
---|
| 58 | *
|
---|
| 59 | * @param template Template to be instantiated.
|
---|
| 60 | * @param config Extra configuration for the snack bar.
|
---|
| 61 | */
|
---|
| 62 | openFromTemplate(template: TemplateRef<any>, config?: MatSnackBarConfig): MatSnackBarRef<EmbeddedViewRef<any>>;
|
---|
| 63 | /**
|
---|
| 64 | * Opens a snackbar with a message and an optional action.
|
---|
| 65 | * @param message The message to show in the snackbar.
|
---|
| 66 | * @param action The label for the snackbar action.
|
---|
| 67 | * @param config Additional configuration options for the snackbar.
|
---|
| 68 | */
|
---|
| 69 | open(message: string, action?: string, config?: MatSnackBarConfig): MatSnackBarRef<TextOnlySnackBar>;
|
---|
| 70 | /**
|
---|
| 71 | * Dismisses the currently-visible snack bar.
|
---|
| 72 | */
|
---|
| 73 | dismiss(): void;
|
---|
| 74 | ngOnDestroy(): void;
|
---|
| 75 | /**
|
---|
| 76 | * Attaches the snack bar container component to the overlay.
|
---|
| 77 | */
|
---|
| 78 | private _attachSnackBarContainer;
|
---|
| 79 | /**
|
---|
| 80 | * Places a new component or a template as the content of the snack bar container.
|
---|
| 81 | */
|
---|
| 82 | private _attach;
|
---|
| 83 | /** Animates the old snack bar out and the new one in. */
|
---|
| 84 | private _animateSnackBar;
|
---|
| 85 | /**
|
---|
| 86 | * Creates a new overlay and places it in the correct location.
|
---|
| 87 | * @param config The user-specified snack bar config.
|
---|
| 88 | */
|
---|
| 89 | private _createOverlay;
|
---|
| 90 | /**
|
---|
| 91 | * Creates an injector to be used inside of a snack bar component.
|
---|
| 92 | * @param config Config that was used to create the snack bar.
|
---|
| 93 | * @param snackBarRef Reference to the snack bar.
|
---|
| 94 | */
|
---|
| 95 | private _createInjector;
|
---|
| 96 | }
|
---|