source: trip-planner-front/node_modules/@angular/material/esm2015/dialog/dialog.js@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 47.1 KB
Line 
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 */
8import { Directionality } from '@angular/cdk/bidi';
9import { Overlay, OverlayConfig, OverlayContainer, } from '@angular/cdk/overlay';
10import { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
11import { Location } from '@angular/common';
12import { Directive, Inject, Injectable, InjectFlags, InjectionToken, Injector, Optional, SkipSelf, TemplateRef, Type, } from '@angular/core';
13import { defer, of as observableOf, Subject } from 'rxjs';
14import { startWith } from 'rxjs/operators';
15import { MatDialogConfig } from './dialog-config';
16import { MatDialogContainer } from './dialog-container';
17import { MatDialogRef } from './dialog-ref';
18/** Injection token that can be used to access the data that was passed in to a dialog. */
19export const MAT_DIALOG_DATA = new InjectionToken('MatDialogData');
20/** Injection token that can be used to specify default dialog options. */
21export const MAT_DIALOG_DEFAULT_OPTIONS = new InjectionToken('mat-dialog-default-options');
22/** Injection token that determines the scroll handling while the dialog is open. */
23export const MAT_DIALOG_SCROLL_STRATEGY = new InjectionToken('mat-dialog-scroll-strategy');
24/** @docs-private */
25export function MAT_DIALOG_SCROLL_STRATEGY_FACTORY(overlay) {
26 return () => overlay.scrollStrategies.block();
27}
28/** @docs-private */
29export function MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay) {
30 return () => overlay.scrollStrategies.block();
31}
32/** @docs-private */
33export const MAT_DIALOG_SCROLL_STRATEGY_PROVIDER = {
34 provide: MAT_DIALOG_SCROLL_STRATEGY,
35 deps: [Overlay],
36 useFactory: MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY,
37};
38/**
39 * Base class for dialog services. The base dialog service allows
40 * for arbitrary dialog refs and dialog container components.
41 */
42export class _MatDialogBase {
43 constructor(_overlay, _injector, _defaultOptions, _parentDialog, _overlayContainer, scrollStrategy, _dialogRefConstructor, _dialogContainerType, _dialogDataToken) {
44 this._overlay = _overlay;
45 this._injector = _injector;
46 this._defaultOptions = _defaultOptions;
47 this._parentDialog = _parentDialog;
48 this._overlayContainer = _overlayContainer;
49 this._dialogRefConstructor = _dialogRefConstructor;
50 this._dialogContainerType = _dialogContainerType;
51 this._dialogDataToken = _dialogDataToken;
52 this._openDialogsAtThisLevel = [];
53 this._afterAllClosedAtThisLevel = new Subject();
54 this._afterOpenedAtThisLevel = new Subject();
55 this._ariaHiddenElements = new Map();
56 // TODO (jelbourn): tighten the typing right-hand side of this expression.
57 /**
58 * Stream that emits when all open dialog have finished closing.
59 * Will emit on subscribe if there are no open dialogs to begin with.
60 */
61 this.afterAllClosed = defer(() => this.openDialogs.length ?
62 this._getAfterAllClosed() :
63 this._getAfterAllClosed().pipe(startWith(undefined)));
64 this._scrollStrategy = scrollStrategy;
65 }
66 /** Keeps track of the currently-open dialogs. */
67 get openDialogs() {
68 return this._parentDialog ? this._parentDialog.openDialogs : this._openDialogsAtThisLevel;
69 }
70 /** Stream that emits when a dialog has been opened. */
71 get afterOpened() {
72 return this._parentDialog ? this._parentDialog.afterOpened : this._afterOpenedAtThisLevel;
73 }
74 _getAfterAllClosed() {
75 const parent = this._parentDialog;
76 return parent ? parent._getAfterAllClosed() : this._afterAllClosedAtThisLevel;
77 }
78 open(componentOrTemplateRef, config) {
79 config = _applyConfigDefaults(config, this._defaultOptions || new MatDialogConfig());
80 if (config.id && this.getDialogById(config.id) &&
81 (typeof ngDevMode === 'undefined' || ngDevMode)) {
82 throw Error(`Dialog with id "${config.id}" exists already. The dialog id must be unique.`);
83 }
84 const overlayRef = this._createOverlay(config);
85 const dialogContainer = this._attachDialogContainer(overlayRef, config);
86 const dialogRef = this._attachDialogContent(componentOrTemplateRef, dialogContainer, overlayRef, config);
87 // If this is the first dialog that we're opening, hide all the non-overlay content.
88 if (!this.openDialogs.length) {
89 this._hideNonDialogContentFromAssistiveTechnology();
90 }
91 this.openDialogs.push(dialogRef);
92 dialogRef.afterClosed().subscribe(() => this._removeOpenDialog(dialogRef));
93 this.afterOpened.next(dialogRef);
94 // Notify the dialog container that the content has been attached.
95 dialogContainer._initializeWithAttachedContent();
96 return dialogRef;
97 }
98 /**
99 * Closes all of the currently-open dialogs.
100 */
101 closeAll() {
102 this._closeDialogs(this.openDialogs);
103 }
104 /**
105 * Finds an open dialog by its id.
106 * @param id ID to use when looking up the dialog.
107 */
108 getDialogById(id) {
109 return this.openDialogs.find(dialog => dialog.id === id);
110 }
111 ngOnDestroy() {
112 // Only close the dialogs at this level on destroy
113 // since the parent service may still be active.
114 this._closeDialogs(this._openDialogsAtThisLevel);
115 this._afterAllClosedAtThisLevel.complete();
116 this._afterOpenedAtThisLevel.complete();
117 }
118 /**
119 * Creates the overlay into which the dialog will be loaded.
120 * @param config The dialog configuration.
121 * @returns A promise resolving to the OverlayRef for the created overlay.
122 */
123 _createOverlay(config) {
124 const overlayConfig = this._getOverlayConfig(config);
125 return this._overlay.create(overlayConfig);
126 }
127 /**
128 * Creates an overlay config from a dialog config.
129 * @param dialogConfig The dialog configuration.
130 * @returns The overlay configuration.
131 */
132 _getOverlayConfig(dialogConfig) {
133 const state = new OverlayConfig({
134 positionStrategy: this._overlay.position().global(),
135 scrollStrategy: dialogConfig.scrollStrategy || this._scrollStrategy(),
136 panelClass: dialogConfig.panelClass,
137 hasBackdrop: dialogConfig.hasBackdrop,
138 direction: dialogConfig.direction,
139 minWidth: dialogConfig.minWidth,
140 minHeight: dialogConfig.minHeight,
141 maxWidth: dialogConfig.maxWidth,
142 maxHeight: dialogConfig.maxHeight,
143 disposeOnNavigation: dialogConfig.closeOnNavigation
144 });
145 if (dialogConfig.backdropClass) {
146 state.backdropClass = dialogConfig.backdropClass;
147 }
148 return state;
149 }
150 /**
151 * Attaches a dialog container to a dialog's already-created overlay.
152 * @param overlay Reference to the dialog's underlying overlay.
153 * @param config The dialog configuration.
154 * @returns A promise resolving to a ComponentRef for the attached container.
155 */
156 _attachDialogContainer(overlay, config) {
157 const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
158 const injector = Injector.create({
159 parent: userInjector || this._injector,
160 providers: [{ provide: MatDialogConfig, useValue: config }]
161 });
162 const containerPortal = new ComponentPortal(this._dialogContainerType, config.viewContainerRef, injector, config.componentFactoryResolver);
163 const containerRef = overlay.attach(containerPortal);
164 return containerRef.instance;
165 }
166 /**
167 * Attaches the user-provided component to the already-created dialog container.
168 * @param componentOrTemplateRef The type of component being loaded into the dialog,
169 * or a TemplateRef to instantiate as the content.
170 * @param dialogContainer Reference to the wrapping dialog container.
171 * @param overlayRef Reference to the overlay in which the dialog resides.
172 * @param config The dialog configuration.
173 * @returns A promise resolving to the MatDialogRef that should be returned to the user.
174 */
175 _attachDialogContent(componentOrTemplateRef, dialogContainer, overlayRef, config) {
176 // Create a reference to the dialog we're creating in order to give the user a handle
177 // to modify and close it.
178 const dialogRef = new this._dialogRefConstructor(overlayRef, dialogContainer, config.id);
179 if (componentOrTemplateRef instanceof TemplateRef) {
180 dialogContainer.attachTemplatePortal(new TemplatePortal(componentOrTemplateRef, null, { $implicit: config.data, dialogRef }));
181 }
182 else {
183 const injector = this._createInjector(config, dialogRef, dialogContainer);
184 const contentRef = dialogContainer.attachComponentPortal(new ComponentPortal(componentOrTemplateRef, config.viewContainerRef, injector));
185 dialogRef.componentInstance = contentRef.instance;
186 }
187 dialogRef
188 .updateSize(config.width, config.height)
189 .updatePosition(config.position);
190 return dialogRef;
191 }
192 /**
193 * Creates a custom injector to be used inside the dialog. This allows a component loaded inside
194 * of a dialog to close itself and, optionally, to return a value.
195 * @param config Config object that is used to construct the dialog.
196 * @param dialogRef Reference to the dialog.
197 * @param dialogContainer Dialog container element that wraps all of the contents.
198 * @returns The custom injector that can be used inside the dialog.
199 */
200 _createInjector(config, dialogRef, dialogContainer) {
201 const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
202 // The dialog container should be provided as the dialog container and the dialog's
203 // content are created out of the same `ViewContainerRef` and as such, are siblings
204 // for injector purposes. To allow the hierarchy that is expected, the dialog
205 // container is explicitly provided in the injector.
206 const providers = [
207 { provide: this._dialogContainerType, useValue: dialogContainer },
208 { provide: this._dialogDataToken, useValue: config.data },
209 { provide: this._dialogRefConstructor, useValue: dialogRef }
210 ];
211 if (config.direction && (!userInjector ||
212 !userInjector.get(Directionality, null, InjectFlags.Optional))) {
213 providers.push({
214 provide: Directionality,
215 useValue: { value: config.direction, change: observableOf() }
216 });
217 }
218 return Injector.create({ parent: userInjector || this._injector, providers });
219 }
220 /**
221 * Removes a dialog from the array of open dialogs.
222 * @param dialogRef Dialog to be removed.
223 */
224 _removeOpenDialog(dialogRef) {
225 const index = this.openDialogs.indexOf(dialogRef);
226 if (index > -1) {
227 this.openDialogs.splice(index, 1);
228 // If all the dialogs were closed, remove/restore the `aria-hidden`
229 // to a the siblings and emit to the `afterAllClosed` stream.
230 if (!this.openDialogs.length) {
231 this._ariaHiddenElements.forEach((previousValue, element) => {
232 if (previousValue) {
233 element.setAttribute('aria-hidden', previousValue);
234 }
235 else {
236 element.removeAttribute('aria-hidden');
237 }
238 });
239 this._ariaHiddenElements.clear();
240 this._getAfterAllClosed().next();
241 }
242 }
243 }
244 /**
245 * Hides all of the content that isn't an overlay from assistive technology.
246 */
247 _hideNonDialogContentFromAssistiveTechnology() {
248 const overlayContainer = this._overlayContainer.getContainerElement();
249 // Ensure that the overlay container is attached to the DOM.
250 if (overlayContainer.parentElement) {
251 const siblings = overlayContainer.parentElement.children;
252 for (let i = siblings.length - 1; i > -1; i--) {
253 let sibling = siblings[i];
254 if (sibling !== overlayContainer &&
255 sibling.nodeName !== 'SCRIPT' &&
256 sibling.nodeName !== 'STYLE' &&
257 !sibling.hasAttribute('aria-live')) {
258 this._ariaHiddenElements.set(sibling, sibling.getAttribute('aria-hidden'));
259 sibling.setAttribute('aria-hidden', 'true');
260 }
261 }
262 }
263 }
264 /** Closes all of the dialogs in an array. */
265 _closeDialogs(dialogs) {
266 let i = dialogs.length;
267 while (i--) {
268 // The `_openDialogs` property isn't updated after close until the rxjs subscription
269 // runs on the next microtask, in addition to modifying the array as we're going
270 // through it. We loop through all of them and call close without assuming that
271 // they'll be removed from the list instantaneously.
272 dialogs[i].close();
273 }
274 }
275}
276_MatDialogBase.decorators = [
277 { type: Directive }
278];
279_MatDialogBase.ctorParameters = () => [
280 { type: Overlay },
281 { type: Injector },
282 { type: undefined },
283 { type: undefined },
284 { type: OverlayContainer },
285 { type: undefined },
286 { type: Type },
287 { type: Type },
288 { type: InjectionToken }
289];
290/**
291 * Service to open Material Design modal dialogs.
292 */
293export class MatDialog extends _MatDialogBase {
294 constructor(overlay, injector,
295 /**
296 * @deprecated `_location` parameter to be removed.
297 * @breaking-change 10.0.0
298 */
299 location, defaultOptions, scrollStrategy, parentDialog, overlayContainer) {
300 super(overlay, injector, defaultOptions, parentDialog, overlayContainer, scrollStrategy, MatDialogRef, MatDialogContainer, MAT_DIALOG_DATA);
301 }
302}
303MatDialog.decorators = [
304 { type: Injectable }
305];
306MatDialog.ctorParameters = () => [
307 { type: Overlay },
308 { type: Injector },
309 { type: Location, decorators: [{ type: Optional }] },
310 { type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] },
311 { type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_SCROLL_STRATEGY,] }] },
312 { type: MatDialog, decorators: [{ type: Optional }, { type: SkipSelf }] },
313 { type: OverlayContainer }
314];
315/**
316 * Applies default options to the dialog config.
317 * @param config Config to be modified.
318 * @param defaultOptions Default options provided.
319 * @returns The new configuration object.
320 */
321function _applyConfigDefaults(config, defaultOptions) {
322 return Object.assign(Object.assign({}, defaultOptions), config);
323}
324//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlhbG9nLmpz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3B0aW9ucywgLi4uY29uZmlnfTtcbn1cbiJdfQ==
Note: See TracBrowser for help on using the repository browser.