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 { Overlay, OverlayContainer, ScrollStrategy } from '@angular/cdk/overlay';
|
---|
9 | import { ComponentType } from '@angular/cdk/portal';
|
---|
10 | import { Location } from '@angular/common';
|
---|
11 | import { InjectionToken, Injector, OnDestroy, TemplateRef, Type } from '@angular/core';
|
---|
12 | import { Observable, Subject } from 'rxjs';
|
---|
13 | import { MatDialogConfig } from './dialog-config';
|
---|
14 | import { MatDialogContainer, _MatDialogContainerBase } from './dialog-container';
|
---|
15 | import { MatDialogRef } from './dialog-ref';
|
---|
16 | /** Injection token that can be used to access the data that was passed in to a dialog. */
|
---|
17 | export declare const MAT_DIALOG_DATA: InjectionToken<any>;
|
---|
18 | /** Injection token that can be used to specify default dialog options. */
|
---|
19 | export declare const MAT_DIALOG_DEFAULT_OPTIONS: InjectionToken<MatDialogConfig<any>>;
|
---|
20 | /** Injection token that determines the scroll handling while the dialog is open. */
|
---|
21 | export declare const MAT_DIALOG_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>;
|
---|
22 | /** @docs-private */
|
---|
23 | export declare function MAT_DIALOG_SCROLL_STRATEGY_FACTORY(overlay: Overlay): () => ScrollStrategy;
|
---|
24 | /** @docs-private */
|
---|
25 | export declare function MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): () => ScrollStrategy;
|
---|
26 | /** @docs-private */
|
---|
27 | export declare const MAT_DIALOG_SCROLL_STRATEGY_PROVIDER: {
|
---|
28 | provide: InjectionToken<() => ScrollStrategy>;
|
---|
29 | deps: (typeof Overlay)[];
|
---|
30 | useFactory: typeof MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY;
|
---|
31 | };
|
---|
32 | /**
|
---|
33 | * Base class for dialog services. The base dialog service allows
|
---|
34 | * for arbitrary dialog refs and dialog container components.
|
---|
35 | */
|
---|
36 | export declare abstract class _MatDialogBase<C extends _MatDialogContainerBase> implements OnDestroy {
|
---|
37 | private _overlay;
|
---|
38 | private _injector;
|
---|
39 | private _defaultOptions;
|
---|
40 | private _parentDialog;
|
---|
41 | private _overlayContainer;
|
---|
42 | private _dialogRefConstructor;
|
---|
43 | private _dialogContainerType;
|
---|
44 | private _dialogDataToken;
|
---|
45 | private _openDialogsAtThisLevel;
|
---|
46 | private readonly _afterAllClosedAtThisLevel;
|
---|
47 | private readonly _afterOpenedAtThisLevel;
|
---|
48 | private _ariaHiddenElements;
|
---|
49 | private _scrollStrategy;
|
---|
50 | /** Keeps track of the currently-open dialogs. */
|
---|
51 | get openDialogs(): MatDialogRef<any>[];
|
---|
52 | /** Stream that emits when a dialog has been opened. */
|
---|
53 | get afterOpened(): Subject<MatDialogRef<any>>;
|
---|
54 | _getAfterAllClosed(): Subject<void>;
|
---|
55 | /**
|
---|
56 | * Stream that emits when all open dialog have finished closing.
|
---|
57 | * Will emit on subscribe if there are no open dialogs to begin with.
|
---|
58 | */
|
---|
59 | readonly afterAllClosed: Observable<void>;
|
---|
60 | constructor(_overlay: Overlay, _injector: Injector, _defaultOptions: MatDialogConfig | undefined, _parentDialog: _MatDialogBase<C> | undefined, _overlayContainer: OverlayContainer, scrollStrategy: any, _dialogRefConstructor: Type<MatDialogRef<any>>, _dialogContainerType: Type<C>, _dialogDataToken: InjectionToken<any>);
|
---|
61 | /**
|
---|
62 | * Opens a modal dialog containing the given component.
|
---|
63 | * @param component Type of the component to load into the dialog.
|
---|
64 | * @param config Extra configuration options.
|
---|
65 | * @returns Reference to the newly-opened dialog.
|
---|
66 | */
|
---|
67 | open<T, D = any, R = any>(component: ComponentType<T>, config?: MatDialogConfig<D>): MatDialogRef<T, R>;
|
---|
68 | /**
|
---|
69 | * Opens a modal dialog containing the given template.
|
---|
70 | * @param template TemplateRef to instantiate as the dialog content.
|
---|
71 | * @param config Extra configuration options.
|
---|
72 | * @returns Reference to the newly-opened dialog.
|
---|
73 | */
|
---|
74 | open<T, D = any, R = any>(template: TemplateRef<T>, config?: MatDialogConfig<D>): MatDialogRef<T, R>;
|
---|
75 | open<T, D = any, R = any>(template: ComponentType<T> | TemplateRef<T>, config?: MatDialogConfig<D>): MatDialogRef<T, R>;
|
---|
76 | /**
|
---|
77 | * Closes all of the currently-open dialogs.
|
---|
78 | */
|
---|
79 | closeAll(): void;
|
---|
80 | /**
|
---|
81 | * Finds an open dialog by its id.
|
---|
82 | * @param id ID to use when looking up the dialog.
|
---|
83 | */
|
---|
84 | getDialogById(id: string): MatDialogRef<any> | undefined;
|
---|
85 | ngOnDestroy(): void;
|
---|
86 | /**
|
---|
87 | * Creates the overlay into which the dialog will be loaded.
|
---|
88 | * @param config The dialog configuration.
|
---|
89 | * @returns A promise resolving to the OverlayRef for the created overlay.
|
---|
90 | */
|
---|
91 | private _createOverlay;
|
---|
92 | /**
|
---|
93 | * Creates an overlay config from a dialog config.
|
---|
94 | * @param dialogConfig The dialog configuration.
|
---|
95 | * @returns The overlay configuration.
|
---|
96 | */
|
---|
97 | private _getOverlayConfig;
|
---|
98 | /**
|
---|
99 | * Attaches a dialog container to a dialog's already-created overlay.
|
---|
100 | * @param overlay Reference to the dialog's underlying overlay.
|
---|
101 | * @param config The dialog configuration.
|
---|
102 | * @returns A promise resolving to a ComponentRef for the attached container.
|
---|
103 | */
|
---|
104 | private _attachDialogContainer;
|
---|
105 | /**
|
---|
106 | * Attaches the user-provided component to the already-created dialog container.
|
---|
107 | * @param componentOrTemplateRef The type of component being loaded into the dialog,
|
---|
108 | * or a TemplateRef to instantiate as the content.
|
---|
109 | * @param dialogContainer Reference to the wrapping dialog container.
|
---|
110 | * @param overlayRef Reference to the overlay in which the dialog resides.
|
---|
111 | * @param config The dialog configuration.
|
---|
112 | * @returns A promise resolving to the MatDialogRef that should be returned to the user.
|
---|
113 | */
|
---|
114 | private _attachDialogContent;
|
---|
115 | /**
|
---|
116 | * Creates a custom injector to be used inside the dialog. This allows a component loaded inside
|
---|
117 | * of a dialog to close itself and, optionally, to return a value.
|
---|
118 | * @param config Config object that is used to construct the dialog.
|
---|
119 | * @param dialogRef Reference to the dialog.
|
---|
120 | * @param dialogContainer Dialog container element that wraps all of the contents.
|
---|
121 | * @returns The custom injector that can be used inside the dialog.
|
---|
122 | */
|
---|
123 | private _createInjector;
|
---|
124 | /**
|
---|
125 | * Removes a dialog from the array of open dialogs.
|
---|
126 | * @param dialogRef Dialog to be removed.
|
---|
127 | */
|
---|
128 | private _removeOpenDialog;
|
---|
129 | /**
|
---|
130 | * Hides all of the content that isn't an overlay from assistive technology.
|
---|
131 | */
|
---|
132 | private _hideNonDialogContentFromAssistiveTechnology;
|
---|
133 | /** Closes all of the dialogs in an array. */
|
---|
134 | private _closeDialogs;
|
---|
135 | }
|
---|
136 | /**
|
---|
137 | * Service to open Material Design modal dialogs.
|
---|
138 | */
|
---|
139 | export declare class MatDialog extends _MatDialogBase<MatDialogContainer> {
|
---|
140 | constructor(overlay: Overlay, injector: Injector,
|
---|
141 | /**
|
---|
142 | * @deprecated `_location` parameter to be removed.
|
---|
143 | * @breaking-change 10.0.0
|
---|
144 | */
|
---|
145 | location: Location, defaultOptions: MatDialogConfig, scrollStrategy: any, parentDialog: MatDialog, overlayContainer: OverlayContainer);
|
---|
146 | }
|
---|