index.d.ts 9.1 KB

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