index.d.ts 8.7 KB

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