UNPKG

9.31 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 /** Whether this is a modal bottom sheet. Used to set the `aria-modal` attribute. */
108 ariaModal?: boolean;
109 /**
110 * Whether the bottom sheet should close when the user goes backwards/forwards in history.
111 * Note that this usually doesn't include clicking on links (unless the user is using
112 * the `HashLocationStrategy`).
113 */
114 closeOnNavigation?: boolean;
115 /**
116 * Where the bottom sheet should focus on open.
117 * @breaking-change 14.0.0 Remove boolean option from autoFocus. Use string or
118 * AutoFocusTarget instead.
119 */
120 autoFocus?: AutoFocusTarget | string | boolean;
121 /**
122 * Whether the bottom sheet should restore focus to the
123 * previously-focused element, after it's closed.
124 */
125 restoreFocus?: boolean;
126 /** Scroll strategy to be used for the bottom sheet. */
127 scrollStrategy?: ScrollStrategy;
128}
129
130/**
131 * Internal component that wraps user-provided bottom sheet content.
132 * @docs-private
133 */
134export declare class MatBottomSheetContainer extends CdkDialogContainer implements OnDestroy {
135 private _changeDetectorRef;
136 private _breakpointSubscription;
137 /** The state of the bottom sheet animations. */
138 _animationState: 'void' | 'visible' | 'hidden';
139 /** Emits whenever the state of the animation changes. */
140 _animationStateChanged: EventEmitter<AnimationEvent_2>;
141 /** Whether the component has been destroyed. */
142 private _destroyed;
143 constructor(elementRef: ElementRef, focusTrapFactory: FocusTrapFactory, document: any, config: DialogConfig, checker: InteractivityChecker, ngZone: NgZone, overlayRef: OverlayRef, breakpointObserver: BreakpointObserver, _changeDetectorRef: ChangeDetectorRef, focusMonitor?: FocusMonitor);
144 /** Begin animation of bottom sheet entrance into view. */
145 enter(): void;
146 /** Begin animation of the bottom sheet exiting from view. */
147 exit(): void;
148 ngOnDestroy(): void;
149 _onAnimationDone(event: AnimationEvent_2): void;
150 _onAnimationStart(event: AnimationEvent_2): void;
151 protected _captureInitialFocus(): void;
152 private _toggleClass;
153 static ɵfac: i0.ɵɵFactoryDeclaration<MatBottomSheetContainer, [null, null, { optional: true; }, null, null, null, null, null, null, null]>;
154 static ɵcmp: i0.ɵɵComponentDeclaration<MatBottomSheetContainer, "mat-bottom-sheet-container", never, {}, {}, never, never, false, never>;
155}
156
157export declare class MatBottomSheetModule {
158 static ɵfac: i0.ɵɵFactoryDeclaration<MatBottomSheetModule, never>;
159 static ɵmod: i0.ɵɵNgModuleDeclaration<MatBottomSheetModule, [typeof i1.MatBottomSheetContainer], [typeof i2.DialogModule, typeof i3.MatCommonModule, typeof i4.PortalModule], [typeof i1.MatBottomSheetContainer, typeof i3.MatCommonModule]>;
160 static ɵinj: i0.ɵɵInjectorDeclaration<MatBottomSheetModule>;
161}
162
163/**
164 * Reference to a bottom sheet dispatched from the bottom sheet service.
165 */
166export declare class MatBottomSheetRef<T = any, R = any> {
167 private _ref;
168 /** Instance of the component making up the content of the bottom sheet. */
169 get instance(): T;
170 /**
171 * Instance of the component into which the bottom sheet content is projected.
172 * @docs-private
173 */
174 containerInstance: MatBottomSheetContainer;
175 /** Whether the user is allowed to close the bottom sheet. */
176 disableClose: boolean | undefined;
177 /** Subject for notifying the user that the bottom sheet has opened and appeared. */
178 private readonly _afterOpened;
179 /** Result to be passed down to the `afterDismissed` stream. */
180 private _result;
181 /** Handle to the timeout that's running as a fallback in case the exit animation doesn't fire. */
182 private _closeFallbackTimeout;
183 constructor(_ref: DialogRef<R, T>, config: MatBottomSheetConfig, containerInstance: MatBottomSheetContainer);
184 /**
185 * Dismisses the bottom sheet.
186 * @param result Data to be passed back to the bottom sheet opener.
187 */
188 dismiss(result?: R): void;
189 /** Gets an observable that is notified when the bottom sheet is finished closing. */
190 afterDismissed(): Observable<R | undefined>;
191 /** Gets an observable that is notified when the bottom sheet has opened and appeared. */
192 afterOpened(): Observable<void>;
193 /**
194 * Gets an observable that emits when the overlay's backdrop has been clicked.
195 */
196 backdropClick(): Observable<MouseEvent>;
197 /**
198 * Gets an observable that emits when keydown events are targeted on the overlay.
199 */
200 keydownEvents(): Observable<KeyboardEvent>;
201}
202
203export { }