snack-bar-container.d.ts 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 { AnimationEvent } from '@angular/animations';
  9. import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
  10. import { ChangeDetectorRef, ComponentRef, ElementRef, EmbeddedViewRef, NgZone, OnDestroy } from '@angular/core';
  11. import { Observable, Subject } from 'rxjs';
  12. import { MatSnackBarConfig } from './snack-bar-config';
  13. /**
  14. * Internal component that wraps user-provided snack bar content.
  15. * @docs-private
  16. */
  17. export declare class MatSnackBarContainer extends BasePortalOutlet implements OnDestroy {
  18. private _ngZone;
  19. private _elementRef;
  20. private _changeDetectorRef;
  21. /** The snack bar configuration. */
  22. snackBarConfig: MatSnackBarConfig;
  23. /** Whether the component has been destroyed. */
  24. private _destroyed;
  25. /** The portal outlet inside of this container into which the snack bar content will be loaded. */
  26. _portalOutlet: CdkPortalOutlet;
  27. /** Subject for notifying that the snack bar has exited from view. */
  28. readonly _onExit: Subject<any>;
  29. /** Subject for notifying that the snack bar has finished entering the view. */
  30. readonly _onEnter: Subject<any>;
  31. /** The state of the snack bar animations. */
  32. _animationState: string;
  33. /** ARIA role for the snack bar container. */
  34. _role: 'alert' | 'status' | null;
  35. constructor(_ngZone: NgZone, _elementRef: ElementRef<HTMLElement>, _changeDetectorRef: ChangeDetectorRef,
  36. /** The snack bar configuration. */
  37. snackBarConfig: MatSnackBarConfig);
  38. /** Attach a component portal as content to this snack bar container. */
  39. attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>;
  40. /** Attach a template portal as content to this snack bar container. */
  41. attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C>;
  42. /** Handle end of animations, updating the state of the snackbar. */
  43. onAnimationEnd(event: AnimationEvent): void;
  44. /** Begin animation of snack bar entrance into view. */
  45. enter(): void;
  46. /** Begin animation of the snack bar exiting from view. */
  47. exit(): Observable<void>;
  48. /** Makes sure the exit callbacks have been invoked when the element is destroyed. */
  49. ngOnDestroy(): void;
  50. /**
  51. * Waits for the zone to settle before removing the element. Helps prevent
  52. * errors where we end up removing an element which is in the middle of an animation.
  53. */
  54. private _completeExit;
  55. /** Applies the various positioning and user-configured CSS classes to the snack bar. */
  56. private _applySnackBarClasses;
  57. /** Asserts that no content is already attached to the container. */
  58. private _assertNotAttached;
  59. }