source: trip-planner-front/node_modules/@angular/material/esm2015/dialog/dialog-container.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: 33.6 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 { FocusMonitor, FocusTrapFactory } from '@angular/cdk/a11y';
9import { _getFocusedElementPierceShadowDom } from '@angular/cdk/platform';
10import { BasePortalOutlet, CdkPortalOutlet } from '@angular/cdk/portal';
11import { DOCUMENT } from '@angular/common';
12import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Directive, ElementRef, EventEmitter, Inject, Optional, ViewChild, ViewEncapsulation, } from '@angular/core';
13import { matDialogAnimations } from './dialog-animations';
14import { MatDialogConfig } from './dialog-config';
15/**
16 * Throws an exception for the case when a ComponentPortal is
17 * attached to a DomPortalOutlet without an origin.
18 * @docs-private
19 */
20export function throwMatDialogContentAlreadyAttachedError() {
21 throw Error('Attempting to attach dialog content after content is already attached');
22}
23/**
24 * Base class for the `MatDialogContainer`. The base class does not implement
25 * animations as these are left to implementers of the dialog container.
26 */
27export class _MatDialogContainerBase extends BasePortalOutlet {
28 constructor(_elementRef, _focusTrapFactory, _changeDetectorRef, _document,
29 /** The dialog configuration. */
30 _config, _focusMonitor) {
31 super();
32 this._elementRef = _elementRef;
33 this._focusTrapFactory = _focusTrapFactory;
34 this._changeDetectorRef = _changeDetectorRef;
35 this._config = _config;
36 this._focusMonitor = _focusMonitor;
37 /** Emits when an animation state changes. */
38 this._animationStateChanged = new EventEmitter();
39 /** Element that was focused before the dialog was opened. Save this to restore upon close. */
40 this._elementFocusedBeforeDialogWasOpened = null;
41 /**
42 * Type of interaction that led to the dialog being closed. This is used to determine
43 * whether the focus style will be applied when returning focus to its original location
44 * after the dialog is closed.
45 */
46 this._closeInteractionType = null;
47 /**
48 * Attaches a DOM portal to the dialog container.
49 * @param portal Portal to be attached.
50 * @deprecated To be turned into a method.
51 * @breaking-change 10.0.0
52 */
53 this.attachDomPortal = (portal) => {
54 if (this._portalOutlet.hasAttached() && (typeof ngDevMode === 'undefined' || ngDevMode)) {
55 throwMatDialogContentAlreadyAttachedError();
56 }
57 return this._portalOutlet.attachDomPortal(portal);
58 };
59 this._ariaLabelledBy = _config.ariaLabelledBy || null;
60 this._document = _document;
61 }
62 /** Initializes the dialog container with the attached content. */
63 _initializeWithAttachedContent() {
64 this._setupFocusTrap();
65 // Save the previously focused element. This element will be re-focused
66 // when the dialog closes.
67 this._capturePreviouslyFocusedElement();
68 // Move focus onto the dialog immediately in order to prevent the user
69 // from accidentally opening multiple dialogs at the same time.
70 this._focusDialogContainer();
71 }
72 /**
73 * Attach a ComponentPortal as content to this dialog container.
74 * @param portal Portal to be attached as the dialog content.
75 */
76 attachComponentPortal(portal) {
77 if (this._portalOutlet.hasAttached() && (typeof ngDevMode === 'undefined' || ngDevMode)) {
78 throwMatDialogContentAlreadyAttachedError();
79 }
80 return this._portalOutlet.attachComponentPortal(portal);
81 }
82 /**
83 * Attach a TemplatePortal as content to this dialog container.
84 * @param portal Portal to be attached as the dialog content.
85 */
86 attachTemplatePortal(portal) {
87 if (this._portalOutlet.hasAttached() && (typeof ngDevMode === 'undefined' || ngDevMode)) {
88 throwMatDialogContentAlreadyAttachedError();
89 }
90 return this._portalOutlet.attachTemplatePortal(portal);
91 }
92 /** Moves focus back into the dialog if it was moved out. */
93 _recaptureFocus() {
94 if (!this._containsFocus()) {
95 const focusContainer = !this._config.autoFocus || !this._focusTrap.focusInitialElement();
96 if (focusContainer) {
97 this._elementRef.nativeElement.focus();
98 }
99 }
100 }
101 /** Moves the focus inside the focus trap. */
102 _trapFocus() {
103 // If we were to attempt to focus immediately, then the content of the dialog would not yet be
104 // ready in instances where change detection has to run first. To deal with this, we simply
105 // wait for the microtask queue to be empty.
106 if (this._config.autoFocus) {
107 this._focusTrap.focusInitialElementWhenReady();
108 }
109 else if (!this._containsFocus()) {
110 // Otherwise ensure that focus is on the dialog container. It's possible that a different
111 // component tried to move focus while the open animation was running. See:
112 // https://github.com/angular/components/issues/16215. Note that we only want to do this
113 // if the focus isn't inside the dialog already, because it's possible that the consumer
114 // turned off `autoFocus` in order to move focus themselves.
115 this._elementRef.nativeElement.focus();
116 }
117 }
118 /** Restores focus to the element that was focused before the dialog opened. */
119 _restoreFocus() {
120 const previousElement = this._elementFocusedBeforeDialogWasOpened;
121 // We need the extra check, because IE can set the `activeElement` to null in some cases.
122 if (this._config.restoreFocus && previousElement &&
123 typeof previousElement.focus === 'function') {
124 const activeElement = _getFocusedElementPierceShadowDom();
125 const element = this._elementRef.nativeElement;
126 // Make sure that focus is still inside the dialog or is on the body (usually because a
127 // non-focusable element like the backdrop was clicked) before moving it. It's possible that
128 // the consumer moved it themselves before the animation was done, in which case we shouldn't
129 // do anything.
130 if (!activeElement || activeElement === this._document.body || activeElement === element ||
131 element.contains(activeElement)) {
132 if (this._focusMonitor) {
133 this._focusMonitor.focusVia(previousElement, this._closeInteractionType);
134 this._closeInteractionType = null;
135 }
136 else {
137 previousElement.focus();
138 }
139 }
140 }
141 if (this._focusTrap) {
142 this._focusTrap.destroy();
143 }
144 }
145 /** Sets up the focus trap. */
146 _setupFocusTrap() {
147 this._focusTrap = this._focusTrapFactory.create(this._elementRef.nativeElement);
148 }
149 /** Captures the element that was focused before the dialog was opened. */
150 _capturePreviouslyFocusedElement() {
151 if (this._document) {
152 this._elementFocusedBeforeDialogWasOpened = _getFocusedElementPierceShadowDom();
153 }
154 }
155 /** Focuses the dialog container. */
156 _focusDialogContainer() {
157 // Note that there is no focus method when rendering on the server.
158 if (this._elementRef.nativeElement.focus) {
159 this._elementRef.nativeElement.focus();
160 }
161 }
162 /** Returns whether focus is inside the dialog. */
163 _containsFocus() {
164 const element = this._elementRef.nativeElement;
165 const activeElement = _getFocusedElementPierceShadowDom();
166 return element === activeElement || element.contains(activeElement);
167 }
168}
169_MatDialogContainerBase.decorators = [
170 { type: Directive }
171];
172_MatDialogContainerBase.ctorParameters = () => [
173 { type: ElementRef },
174 { type: FocusTrapFactory },
175 { type: ChangeDetectorRef },
176 { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] },
177 { type: MatDialogConfig },
178 { type: FocusMonitor }
179];
180_MatDialogContainerBase.propDecorators = {
181 _portalOutlet: [{ type: ViewChild, args: [CdkPortalOutlet, { static: true },] }]
182};
183/**
184 * Internal component that wraps user-provided dialog content.
185 * Animation is based on https://material.io/guidelines/motion/choreography.html.
186 * @docs-private
187 */
188export class MatDialogContainer extends _MatDialogContainerBase {
189 constructor() {
190 super(...arguments);
191 /** State of the dialog animation. */
192 this._state = 'enter';
193 }
194 /** Callback, invoked whenever an animation on the host completes. */
195 _onAnimationDone({ toState, totalTime }) {
196 if (toState === 'enter') {
197 this._trapFocus();
198 this._animationStateChanged.next({ state: 'opened', totalTime });
199 }
200 else if (toState === 'exit') {
201 this._restoreFocus();
202 this._animationStateChanged.next({ state: 'closed', totalTime });
203 }
204 }
205 /** Callback, invoked when an animation on the host starts. */
206 _onAnimationStart({ toState, totalTime }) {
207 if (toState === 'enter') {
208 this._animationStateChanged.next({ state: 'opening', totalTime });
209 }
210 else if (toState === 'exit' || toState === 'void') {
211 this._animationStateChanged.next({ state: 'closing', totalTime });
212 }
213 }
214 /** Starts the dialog exit animation. */
215 _startExitAnimation() {
216 this._state = 'exit';
217 // Mark the container for check so it can react if the
218 // view container is using OnPush change detection.
219 this._changeDetectorRef.markForCheck();
220 }
221}
222MatDialogContainer.decorators = [
223 { type: Component, args: [{
224 selector: 'mat-dialog-container',
225 template: "<ng-template cdkPortalOutlet></ng-template>\n",
226 encapsulation: ViewEncapsulation.None,
227 // Using OnPush for dialogs caused some G3 sync issues. Disabled until we can track them down.
228 // tslint:disable-next-line:validate-decorators
229 changeDetection: ChangeDetectionStrategy.Default,
230 animations: [matDialogAnimations.dialogContainer],
231 host: {
232 'class': 'mat-dialog-container',
233 'tabindex': '-1',
234 'aria-modal': 'true',
235 '[id]': '_id',
236 '[attr.role]': '_config.role',
237 '[attr.aria-labelledby]': '_config.ariaLabel ? null : _ariaLabelledBy',
238 '[attr.aria-label]': '_config.ariaLabel',
239 '[attr.aria-describedby]': '_config.ariaDescribedBy || null',
240 '[@dialogContainer]': '_state',
241 '(@dialogContainer.start)': '_onAnimationStart($event)',
242 '(@dialogContainer.done)': '_onAnimationDone($event)',
243 },
244 styles: [".mat-dialog-container{display:block;padding:24px;border-radius:4px;box-sizing:border-box;overflow:auto;outline:0;width:100%;height:100%;min-height:inherit;max-height:inherit}.cdk-high-contrast-active .mat-dialog-container{outline:solid 1px}.mat-dialog-content{display:block;margin:0 -24px;padding:0 24px;max-height:65vh;overflow:auto;-webkit-overflow-scrolling:touch}.mat-dialog-title{margin:0 0 20px;display:block}.mat-dialog-actions{padding:8px 0;display:flex;flex-wrap:wrap;min-height:52px;align-items:center;box-sizing:content-box;margin-bottom:-24px}.mat-dialog-actions[align=end]{justify-content:flex-end}.mat-dialog-actions[align=center]{justify-content:center}.mat-dialog-actions .mat-button-base+.mat-button-base,.mat-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-dialog-actions .mat-button-base+.mat-button-base,[dir=rtl] .mat-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}\n"]
245 },] }
246];
247//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlhbG9nLWNvbnRhaW5lci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9kaWFsb2cvZGlhbG9nLWNvbnRhaW5lci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFHSCxPQUFPLEVBQUMsWUFBWSxFQUEwQixnQkFB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