[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 { FocusOrigin } from '@angular/cdk/a11y';
|
---|
| 9 | import { OverlayRef } from '@angular/cdk/overlay';
|
---|
| 10 | import { Observable } from 'rxjs';
|
---|
| 11 | import { DialogPosition } from './dialog-config';
|
---|
| 12 | import { _MatDialogContainerBase } from './dialog-container';
|
---|
| 13 | /** Possible states of the lifecycle of a dialog. */
|
---|
| 14 | export declare const enum MatDialogState {
|
---|
| 15 | OPEN = 0,
|
---|
| 16 | CLOSING = 1,
|
---|
| 17 | CLOSED = 2
|
---|
| 18 | }
|
---|
| 19 | /**
|
---|
| 20 | * Reference to a dialog opened via the MatDialog service.
|
---|
| 21 | */
|
---|
| 22 | export declare class MatDialogRef<T, R = any> {
|
---|
| 23 | private _overlayRef;
|
---|
| 24 | _containerInstance: _MatDialogContainerBase;
|
---|
| 25 | /** Id of the dialog. */
|
---|
| 26 | readonly id: string;
|
---|
| 27 | /** The instance of component opened into the dialog. */
|
---|
| 28 | componentInstance: T;
|
---|
| 29 | /** Whether the user is allowed to close the dialog. */
|
---|
| 30 | disableClose: boolean | undefined;
|
---|
| 31 | /** Subject for notifying the user that the dialog has finished opening. */
|
---|
| 32 | private readonly _afterOpened;
|
---|
| 33 | /** Subject for notifying the user that the dialog has finished closing. */
|
---|
| 34 | private readonly _afterClosed;
|
---|
| 35 | /** Subject for notifying the user that the dialog has started closing. */
|
---|
| 36 | private readonly _beforeClosed;
|
---|
| 37 | /** Result to be passed to afterClosed. */
|
---|
| 38 | private _result;
|
---|
| 39 | /** Handle to the timeout that's running as a fallback in case the exit animation doesn't fire. */
|
---|
| 40 | private _closeFallbackTimeout;
|
---|
| 41 | /** Current state of the dialog. */
|
---|
| 42 | private _state;
|
---|
| 43 | constructor(_overlayRef: OverlayRef, _containerInstance: _MatDialogContainerBase,
|
---|
| 44 | /** Id of the dialog. */
|
---|
| 45 | id?: string);
|
---|
| 46 | /**
|
---|
| 47 | * Close the dialog.
|
---|
| 48 | * @param dialogResult Optional result to return to the dialog opener.
|
---|
| 49 | */
|
---|
| 50 | close(dialogResult?: R): void;
|
---|
| 51 | /**
|
---|
| 52 | * Gets an observable that is notified when the dialog is finished opening.
|
---|
| 53 | */
|
---|
| 54 | afterOpened(): Observable<void>;
|
---|
| 55 | /**
|
---|
| 56 | * Gets an observable that is notified when the dialog is finished closing.
|
---|
| 57 | */
|
---|
| 58 | afterClosed(): Observable<R | undefined>;
|
---|
| 59 | /**
|
---|
| 60 | * Gets an observable that is notified when the dialog has started closing.
|
---|
| 61 | */
|
---|
| 62 | beforeClosed(): Observable<R | undefined>;
|
---|
| 63 | /**
|
---|
| 64 | * Gets an observable that emits when the overlay's backdrop has been clicked.
|
---|
| 65 | */
|
---|
| 66 | backdropClick(): Observable<MouseEvent>;
|
---|
| 67 | /**
|
---|
| 68 | * Gets an observable that emits when keydown events are targeted on the overlay.
|
---|
| 69 | */
|
---|
| 70 | keydownEvents(): Observable<KeyboardEvent>;
|
---|
| 71 | /**
|
---|
| 72 | * Updates the dialog's position.
|
---|
| 73 | * @param position New dialog position.
|
---|
| 74 | */
|
---|
| 75 | updatePosition(position?: DialogPosition): this;
|
---|
| 76 | /**
|
---|
| 77 | * Updates the dialog's width and height.
|
---|
| 78 | * @param width New width of the dialog.
|
---|
| 79 | * @param height New height of the dialog.
|
---|
| 80 | */
|
---|
| 81 | updateSize(width?: string, height?: string): this;
|
---|
| 82 | /** Add a CSS class or an array of classes to the overlay pane. */
|
---|
| 83 | addPanelClass(classes: string | string[]): this;
|
---|
| 84 | /** Remove a CSS class or an array of classes from the overlay pane. */
|
---|
| 85 | removePanelClass(classes: string | string[]): this;
|
---|
| 86 | /** Gets the current state of the dialog's lifecycle. */
|
---|
| 87 | getState(): MatDialogState;
|
---|
| 88 | /**
|
---|
| 89 | * Finishes the dialog close by updating the state of the dialog
|
---|
| 90 | * and disposing the overlay.
|
---|
| 91 | */
|
---|
| 92 | private _finishDialogClose;
|
---|
| 93 | /** Fetches the position strategy object from the overlay ref. */
|
---|
| 94 | private _getPositionStrategy;
|
---|
| 95 | }
|
---|
| 96 | /**
|
---|
| 97 | * Closes the dialog with the specified interaction type. This is currently not part of
|
---|
| 98 | * `MatDialogRef` as that would conflict with custom dialog ref mocks provided in tests.
|
---|
| 99 | * More details. See: https://github.com/angular/components/pull/9257#issuecomment-651342226.
|
---|
| 100 | */
|
---|
| 101 | export declare function _closeDialogVia<R>(ref: MatDialogRef<R>, interactionType: FocusOrigin, result?: R): void;
|
---|