bottom-sheet-container.d.ts 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 { ComponentRef, EmbeddedViewRef, OnDestroy, ElementRef, ChangeDetectorRef, EventEmitter } from '@angular/core';
  9. import { AnimationEvent } from '@angular/animations';
  10. import { BasePortalOutlet, ComponentPortal, TemplatePortal, CdkPortalOutlet } from '@angular/cdk/portal';
  11. import { BreakpointObserver } from '@angular/cdk/layout';
  12. import { MatBottomSheetConfig } from './bottom-sheet-config';
  13. import { FocusTrapFactory } from '@angular/cdk/a11y';
  14. /**
  15. * Internal component that wraps user-provided bottom sheet content.
  16. * @docs-private
  17. */
  18. export declare class MatBottomSheetContainer extends BasePortalOutlet implements OnDestroy {
  19. private _elementRef;
  20. private _changeDetectorRef;
  21. private _focusTrapFactory;
  22. /** The bottom sheet configuration. */
  23. bottomSheetConfig: MatBottomSheetConfig;
  24. private _breakpointSubscription;
  25. /** The portal outlet inside of this container into which the content will be loaded. */
  26. _portalOutlet: CdkPortalOutlet;
  27. /** The state of the bottom sheet animations. */
  28. _animationState: 'void' | 'visible' | 'hidden';
  29. /** Emits whenever the state of the animation changes. */
  30. _animationStateChanged: EventEmitter<AnimationEvent>;
  31. /** The class that traps and manages focus within the bottom sheet. */
  32. private _focusTrap;
  33. /** Element that was focused before the bottom sheet was opened. */
  34. private _elementFocusedBeforeOpened;
  35. /** Server-side rendering-compatible reference to the global document object. */
  36. private _document;
  37. /** Whether the component has been destroyed. */
  38. private _destroyed;
  39. constructor(_elementRef: ElementRef<HTMLElement>, _changeDetectorRef: ChangeDetectorRef, _focusTrapFactory: FocusTrapFactory, breakpointObserver: BreakpointObserver, document: any,
  40. /** The bottom sheet configuration. */
  41. bottomSheetConfig: MatBottomSheetConfig);
  42. /** Attach a component portal as content to this bottom sheet container. */
  43. attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>;
  44. /** Attach a template portal as content to this bottom sheet container. */
  45. attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C>;
  46. /** Begin animation of bottom sheet entrance into view. */
  47. enter(): void;
  48. /** Begin animation of the bottom sheet exiting from view. */
  49. exit(): void;
  50. ngOnDestroy(): void;
  51. _onAnimationDone(event: AnimationEvent): void;
  52. _onAnimationStart(event: AnimationEvent): void;
  53. private _toggleClass;
  54. private _validatePortalAttached;
  55. private _setPanelClass;
  56. /** Moves the focus inside the focus trap. */
  57. private _trapFocus;
  58. /** Restores focus to the element that was focused before the bottom sheet was opened. */
  59. private _restoreFocus;
  60. /** Saves a reference to the element that was focused before the bottom sheet was opened. */
  61. private _savePreviouslyFocusedElement;
  62. }