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