UNPKG

9.19 kBTypeScriptView Raw
1import { AnimationEvent as AnimationEvent_2 } from '@angular/animations';
2import { AnimationTriggerMetadata } from '@angular/animations';
3import { BreakpointObserver } from '@angular/cdk/layout';
4import { CdkDialogContainer } from '@angular/cdk/dialog';
5import { ChangeDetectorRef } from '@angular/core';
6import { ComponentType } from '@angular/cdk/portal';
7import { DialogConfig } from '@angular/cdk/dialog';
8import { DialogRef } from '@angular/cdk/dialog';
9import { Direction } from '@angular/cdk/bidi';
10import { ElementRef } from '@angular/core';
11import { EventEmitter } from '@angular/core';
12import { FocusMonitor } from '@angular/cdk/a11y';
13import { FocusTrapFactory } from '@angular/cdk/a11y';
14import * as i0 from '@angular/core';
15import * as i2 from '@angular/cdk/dialog';
16import * as i3 from '@angular/material/core';
17import * as i4 from '@angular/cdk/portal';
18import { InjectionToken } from '@angular/core';
19import { Injector } from '@angular/core';
20import { InteractivityChecker } from '@angular/cdk/a11y';
21import { NgZone } from '@angular/core';
22import { Observable } from 'rxjs';
23import { OnDestroy } from '@angular/core';
24import { Overlay } from '@angular/cdk/overlay';
25import { OverlayRef } from '@angular/cdk/overlay';
26import { ScrollStrategy } from '@angular/cdk/overlay';
27import { TemplateRef } from '@angular/core';
28import { ViewContainerRef } from '@angular/core';
29
30/** Options for where to set focus to automatically on dialog open */
31export declare type AutoFocusTarget = 'dialog' | 'first-tabbable' | 'first-heading';
32
33declare namespace i1 {
34 export {
35 MatBottomSheetContainer
36 }
37}
38
39/** Injection token that can be used to access the data that was passed in to a bottom sheet. */
40export declare const MAT_BOTTOM_SHEET_DATA: InjectionToken<any>;
41
42/** Injection token that can be used to specify default bottom sheet options. */
43export declare const MAT_BOTTOM_SHEET_DEFAULT_OPTIONS: InjectionToken<MatBottomSheetConfig<any>>;
44
45/**
46 * Service to trigger Material Design bottom sheets.
47 */
48export declare class MatBottomSheet implements OnDestroy {
49 private _overlay;
50 private _parentBottomSheet;
51 private _defaultOptions?;
52 private _bottomSheetRefAtThisLevel;
53 private _dialog;
54 /** Reference to the currently opened bottom sheet. */
55 get _openedBottomSheetRef(): MatBottomSheetRef<any> | null;
56 set _openedBottomSheetRef(value: MatBottomSheetRef<any> | null);
57 constructor(_overlay: Overlay, injector: Injector, _parentBottomSheet: MatBottomSheet, _defaultOptions?: MatBottomSheetConfig<any> | undefined);
58 /**
59 * Opens a bottom sheet containing the given component.
60 * @param component Type of the component to load into the bottom sheet.
61 * @param config Extra configuration options.
62 * @returns Reference to the newly-opened bottom sheet.
63 */
64 open<T, D = any, R = any>(component: ComponentType<T>, config?: MatBottomSheetConfig<D>): MatBottomSheetRef<T, R>;
65 /**
66 * Opens a bottom sheet containing the given template.
67 * @param template TemplateRef to instantiate as the bottom sheet content.
68 * @param config Extra configuration options.
69 * @returns Reference to the newly-opened bottom sheet.
70 */
71 open<T, D = any, R = any>(template: TemplateRef<T>, config?: MatBottomSheetConfig<D>): MatBottomSheetRef<T, R>;
72 /**
73 * Dismisses the currently-visible bottom sheet.
74 * @param result Data to pass to the bottom sheet instance.
75 */
76 dismiss<R = any>(result?: R): void;
77 ngOnDestroy(): void;
78 static ɵfac: i0.ɵɵFactoryDeclaration<MatBottomSheet, [null, null, { optional: true; skipSelf: true; }, { optional: true; }]>;
79 static ɵprov: i0.ɵɵInjectableDeclaration<MatBottomSheet>;
80}
81
82/** Animations used by the Material bottom sheet. */
83export declare const matBottomSheetAnimations: {
84 readonly bottomSheetState: AnimationTriggerMetadata;
85};
86
87/**
88 * Configuration used when opening a bottom sheet.
89 */
90export declare class MatBottomSheetConfig<D = any> {
91 /** The view container to place the overlay for the bottom sheet into. */
92 viewContainerRef?: ViewContainerRef;
93 /** Extra CSS classes to be added to the bottom sheet container. */
94 panelClass?: string | string[];
95 /** Text layout direction for the bottom sheet. */
96 direction?: Direction;
97 /** Data being injected into the child component. */
98 data?: D | null;
99 /** Whether the bottom sheet has a backdrop. */
100 hasBackdrop?: boolean;
101 /** Custom class for the backdrop. */
102 backdropClass?: string;
103 /** Whether the user can use escape or clicking outside to close the bottom sheet. */
104 disableClose?: boolean;
105 /** Aria label to assign to the bottom sheet element. */
106 ariaLabel?: string | null;
107 /**
108 * Whether the bottom sheet should close when the user goes backwards/forwards in history.
109 * Note that this usually doesn't include clicking on links (unless the user is using
110 * the `HashLocationStrategy`).
111 */
112 closeOnNavigation?: boolean;
113 /**
114 * Where the bottom sheet should focus on open.
115 * @breaking-change 14.0.0 Remove boolean option from autoFocus. Use string or
116 * AutoFocusTarget instead.
117 */
118 autoFocus?: AutoFocusTarget | string | boolean;
119 /**
120 * Whether the bottom sheet should restore focus to the
121 * previously-focused element, after it's closed.
122 */
123 restoreFocus?: boolean;
124 /** Scroll strategy to be used for the bottom sheet. */
125 scrollStrategy?: ScrollStrategy;
126}
127
128/**
129 * Internal component that wraps user-provided bottom sheet content.
130 * @docs-private
131 */
132export declare class MatBottomSheetContainer extends CdkDialogContainer implements OnDestroy {
133 private _changeDetectorRef;
134 private _breakpointSubscription;
135 /** The state of the bottom sheet animations. */
136 _animationState: 'void' | 'visible' | 'hidden';
137 /** Emits whenever the state of the animation changes. */
138 _animationStateChanged: EventEmitter<AnimationEvent_2>;
139 /** Whether the component has been destroyed. */
140 private _destroyed;
141 constructor(elementRef: ElementRef, focusTrapFactory: FocusTrapFactory, document: any, config: DialogConfig, checker: InteractivityChecker, ngZone: NgZone, overlayRef: OverlayRef, breakpointObserver: BreakpointObserver, _changeDetectorRef: ChangeDetectorRef, focusMonitor?: FocusMonitor);
142 /** Begin animation of bottom sheet entrance into view. */
143 enter(): void;
144 /** Begin animation of the bottom sheet exiting from view. */
145 exit(): void;
146 ngOnDestroy(): void;
147 _onAnimationDone(event: AnimationEvent_2): void;
148 _onAnimationStart(event: AnimationEvent_2): void;
149 protected _captureInitialFocus(): void;
150 private _toggleClass;
151 static ɵfac: i0.ɵɵFactoryDeclaration<MatBottomSheetContainer, [null, null, { optional: true; }, null, null, null, null, null, null, null]>;
152 static ɵcmp: i0.ɵɵComponentDeclaration<MatBottomSheetContainer, "mat-bottom-sheet-container", never, {}, {}, never, never, false>;
153}
154
155export declare class MatBottomSheetModule {
156 static ɵfac: i0.ɵɵFactoryDeclaration<MatBottomSheetModule, never>;
157 static ɵmod: i0.ɵɵNgModuleDeclaration<MatBottomSheetModule, [typeof i1.MatBottomSheetContainer], [typeof i2.DialogModule, typeof i3.MatCommonModule, typeof i4.PortalModule], [typeof i1.MatBottomSheetContainer, typeof i3.MatCommonModule]>;
158 static ɵinj: i0.ɵɵInjectorDeclaration<MatBottomSheetModule>;
159}
160
161/**
162 * Reference to a bottom sheet dispatched from the bottom sheet service.
163 */
164export declare class MatBottomSheetRef<T = any, R = any> {
165 private _ref;
166 /** Instance of the component making up the content of the bottom sheet. */
167 get instance(): T;
168 /**
169 * Instance of the component into which the bottom sheet content is projected.
170 * @docs-private
171 */
172 containerInstance: MatBottomSheetContainer;
173 /** Whether the user is allowed to close the bottom sheet. */
174 disableClose: boolean | undefined;
175 /** Subject for notifying the user that the bottom sheet has opened and appeared. */
176 private readonly _afterOpened;
177 /** Result to be passed down to the `afterDismissed` stream. */
178 private _result;
179 /** Handle to the timeout that's running as a fallback in case the exit animation doesn't fire. */
180 private _closeFallbackTimeout;
181 constructor(_ref: DialogRef<R, T>, config: MatBottomSheetConfig, containerInstance: MatBottomSheetContainer);
182 /**
183 * Dismisses the bottom sheet.
184 * @param result Data to be passed back to the bottom sheet opener.
185 */
186 dismiss(result?: R): void;
187 /** Gets an observable that is notified when the bottom sheet is finished closing. */
188 afterDismissed(): Observable<R | undefined>;
189 /** Gets an observable that is notified when the bottom sheet has opened and appeared. */
190 afterOpened(): Observable<void>;
191 /**
192 * Gets an observable that emits when the overlay's backdrop has been clicked.
193 */
194 backdropClick(): Observable<MouseEvent>;
195 /**
196 * Gets an observable that emits when keydown events are targeted on the overlay.
197 */
198 keydownEvents(): Observable<KeyboardEvent>;
199}
200
201export { }