[6a3a178] | 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 { FocusMonitor, FocusOrigin, FocusTrapFactory } from '@angular/cdk/a11y';
|
---|
| 10 | import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, DomPortal, TemplatePortal } from '@angular/cdk/portal';
|
---|
| 11 | import { ChangeDetectorRef, ComponentRef, ElementRef, EmbeddedViewRef, EventEmitter } from '@angular/core';
|
---|
| 12 | import { MatDialogConfig } from './dialog-config';
|
---|
| 13 | /** Event that captures the state of dialog container animations. */
|
---|
| 14 | import * as ɵngcc0 from '@angular/core';
|
---|
| 15 | interface DialogAnimationEvent {
|
---|
| 16 | state: 'opened' | 'opening' | 'closing' | 'closed';
|
---|
| 17 | totalTime: number;
|
---|
| 18 | }
|
---|
| 19 | /**
|
---|
| 20 | * Throws an exception for the case when a ComponentPortal is
|
---|
| 21 | * attached to a DomPortalOutlet without an origin.
|
---|
| 22 | * @docs-private
|
---|
| 23 | */
|
---|
| 24 | export declare function throwMatDialogContentAlreadyAttachedError(): void;
|
---|
| 25 | /**
|
---|
| 26 | * Base class for the `MatDialogContainer`. The base class does not implement
|
---|
| 27 | * animations as these are left to implementers of the dialog container.
|
---|
| 28 | */
|
---|
| 29 | export declare abstract class _MatDialogContainerBase extends BasePortalOutlet {
|
---|
| 30 | protected _elementRef: ElementRef;
|
---|
| 31 | protected _focusTrapFactory: FocusTrapFactory;
|
---|
| 32 | protected _changeDetectorRef: ChangeDetectorRef;
|
---|
| 33 | /** The dialog configuration. */
|
---|
| 34 | _config: MatDialogConfig;
|
---|
| 35 | private _focusMonitor?;
|
---|
| 36 | protected _document: Document;
|
---|
| 37 | /** The portal outlet inside of this container into which the dialog content will be loaded. */
|
---|
| 38 | _portalOutlet: CdkPortalOutlet;
|
---|
| 39 | /** The class that traps and manages focus within the dialog. */
|
---|
| 40 | private _focusTrap;
|
---|
| 41 | /** Emits when an animation state changes. */
|
---|
| 42 | _animationStateChanged: EventEmitter<DialogAnimationEvent>;
|
---|
| 43 | /** Element that was focused before the dialog was opened. Save this to restore upon close. */
|
---|
| 44 | private _elementFocusedBeforeDialogWasOpened;
|
---|
| 45 | /**
|
---|
| 46 | * Type of interaction that led to the dialog being closed. This is used to determine
|
---|
| 47 | * whether the focus style will be applied when returning focus to its original location
|
---|
| 48 | * after the dialog is closed.
|
---|
| 49 | */
|
---|
| 50 | _closeInteractionType: FocusOrigin | null;
|
---|
| 51 | /** ID of the element that should be considered as the dialog's label. */
|
---|
| 52 | _ariaLabelledBy: string | null;
|
---|
| 53 | /** ID for the container DOM element. */
|
---|
| 54 | _id: string;
|
---|
| 55 | constructor(_elementRef: ElementRef, _focusTrapFactory: FocusTrapFactory, _changeDetectorRef: ChangeDetectorRef, _document: any,
|
---|
| 56 | /** The dialog configuration. */
|
---|
| 57 | _config: MatDialogConfig, _focusMonitor?: FocusMonitor | undefined);
|
---|
| 58 | /** Starts the dialog exit animation. */
|
---|
| 59 | abstract _startExitAnimation(): void;
|
---|
| 60 | /** Initializes the dialog container with the attached content. */
|
---|
| 61 | _initializeWithAttachedContent(): void;
|
---|
| 62 | /**
|
---|
| 63 | * Attach a ComponentPortal as content to this dialog container.
|
---|
| 64 | * @param portal Portal to be attached as the dialog content.
|
---|
| 65 | */
|
---|
| 66 | attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>;
|
---|
| 67 | /**
|
---|
| 68 | * Attach a TemplatePortal as content to this dialog container.
|
---|
| 69 | * @param portal Portal to be attached as the dialog content.
|
---|
| 70 | */
|
---|
| 71 | attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C>;
|
---|
| 72 | /**
|
---|
| 73 | * Attaches a DOM portal to the dialog container.
|
---|
| 74 | * @param portal Portal to be attached.
|
---|
| 75 | * @deprecated To be turned into a method.
|
---|
| 76 | * @breaking-change 10.0.0
|
---|
| 77 | */
|
---|
| 78 | attachDomPortal: (portal: DomPortal) => void;
|
---|
| 79 | /** Moves focus back into the dialog if it was moved out. */
|
---|
| 80 | _recaptureFocus(): void;
|
---|
| 81 | /** Moves the focus inside the focus trap. */
|
---|
| 82 | protected _trapFocus(): void;
|
---|
| 83 | /** Restores focus to the element that was focused before the dialog opened. */
|
---|
| 84 | protected _restoreFocus(): void;
|
---|
| 85 | /** Sets up the focus trap. */
|
---|
| 86 | private _setupFocusTrap;
|
---|
| 87 | /** Captures the element that was focused before the dialog was opened. */
|
---|
| 88 | private _capturePreviouslyFocusedElement;
|
---|
| 89 | /** Focuses the dialog container. */
|
---|
| 90 | private _focusDialogContainer;
|
---|
| 91 | /** Returns whether focus is inside the dialog. */
|
---|
| 92 | private _containsFocus;
|
---|
| 93 | static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<_MatDialogContainerBase, [null, null, null, { optional: true; }, null, null]>;
|
---|
| 94 | static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<_MatDialogContainerBase, never, never, {}, {}, never>;
|
---|
| 95 | }
|
---|
| 96 | /**
|
---|
| 97 | * Internal component that wraps user-provided dialog content.
|
---|
| 98 | * Animation is based on https://material.io/guidelines/motion/choreography.html.
|
---|
| 99 | * @docs-private
|
---|
| 100 | */
|
---|
| 101 | export declare class MatDialogContainer extends _MatDialogContainerBase {
|
---|
| 102 | /** State of the dialog animation. */
|
---|
| 103 | _state: 'void' | 'enter' | 'exit';
|
---|
| 104 | /** Callback, invoked whenever an animation on the host completes. */
|
---|
| 105 | _onAnimationDone({ toState, totalTime }: AnimationEvent): void;
|
---|
| 106 | /** Callback, invoked when an animation on the host starts. */
|
---|
| 107 | _onAnimationStart({ toState, totalTime }: AnimationEvent): void;
|
---|
| 108 | /** Starts the dialog exit animation. */
|
---|
| 109 | _startExitAnimation(): void;
|
---|
| 110 | static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatDialogContainer, never>;
|
---|
| 111 | static ɵcmp: ɵngcc0.ɵɵComponentDeclaration<MatDialogContainer, "mat-dialog-container", never, {}, {}, never, never>;
|
---|
| 112 | }
|
---|
| 113 | export {};
|
---|
| 114 |
|
---|
| 115 | //# sourceMappingURL=dialog-container.d.ts.map |
---|