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 { Subject, merge, Subscription } from 'rxjs';
|
---|
9 | import { take, takeUntil } from 'rxjs/operators';
|
---|
10 | import { coerceCssPixelValue, coerceArray } from '@angular/cdk/coercion';
|
---|
11 | /**
|
---|
12 | * Reference to an overlay that has been created with the Overlay service.
|
---|
13 | * Used to manipulate or dispose of said overlay.
|
---|
14 | */
|
---|
15 | export class OverlayRef {
|
---|
16 | constructor(_portalOutlet, _host, _pane, _config, _ngZone, _keyboardDispatcher, _document, _location, _outsideClickDispatcher) {
|
---|
17 | this._portalOutlet = _portalOutlet;
|
---|
18 | this._host = _host;
|
---|
19 | this._pane = _pane;
|
---|
20 | this._config = _config;
|
---|
21 | this._ngZone = _ngZone;
|
---|
22 | this._keyboardDispatcher = _keyboardDispatcher;
|
---|
23 | this._document = _document;
|
---|
24 | this._location = _location;
|
---|
25 | this._outsideClickDispatcher = _outsideClickDispatcher;
|
---|
26 | this._backdropElement = null;
|
---|
27 | this._backdropClick = new Subject();
|
---|
28 | this._attachments = new Subject();
|
---|
29 | this._detachments = new Subject();
|
---|
30 | this._locationChanges = Subscription.EMPTY;
|
---|
31 | this._backdropClickHandler = (event) => this._backdropClick.next(event);
|
---|
32 | /** Stream of keydown events dispatched to this overlay. */
|
---|
33 | this._keydownEvents = new Subject();
|
---|
34 | /** Stream of mouse outside events dispatched to this overlay. */
|
---|
35 | this._outsidePointerEvents = new Subject();
|
---|
36 | if (_config.scrollStrategy) {
|
---|
37 | this._scrollStrategy = _config.scrollStrategy;
|
---|
38 | this._scrollStrategy.attach(this);
|
---|
39 | }
|
---|
40 | this._positionStrategy = _config.positionStrategy;
|
---|
41 | }
|
---|
42 | /** The overlay's HTML element */
|
---|
43 | get overlayElement() {
|
---|
44 | return this._pane;
|
---|
45 | }
|
---|
46 | /** The overlay's backdrop HTML element. */
|
---|
47 | get backdropElement() {
|
---|
48 | return this._backdropElement;
|
---|
49 | }
|
---|
50 | /**
|
---|
51 | * Wrapper around the panel element. Can be used for advanced
|
---|
52 | * positioning where a wrapper with specific styling is
|
---|
53 | * required around the overlay pane.
|
---|
54 | */
|
---|
55 | get hostElement() {
|
---|
56 | return this._host;
|
---|
57 | }
|
---|
58 | /**
|
---|
59 | * Attaches content, given via a Portal, to the overlay.
|
---|
60 | * If the overlay is configured to have a backdrop, it will be created.
|
---|
61 | *
|
---|
62 | * @param portal Portal instance to which to attach the overlay.
|
---|
63 | * @returns The portal attachment result.
|
---|
64 | */
|
---|
65 | attach(portal) {
|
---|
66 | let attachResult = this._portalOutlet.attach(portal);
|
---|
67 | // Update the pane element with the given configuration.
|
---|
68 | if (!this._host.parentElement && this._previousHostParent) {
|
---|
69 | this._previousHostParent.appendChild(this._host);
|
---|
70 | }
|
---|
71 | if (this._positionStrategy) {
|
---|
72 | this._positionStrategy.attach(this);
|
---|
73 | }
|
---|
74 | this._updateStackingOrder();
|
---|
75 | this._updateElementSize();
|
---|
76 | this._updateElementDirection();
|
---|
77 | if (this._scrollStrategy) {
|
---|
78 | this._scrollStrategy.enable();
|
---|
79 | }
|
---|
80 | // Update the position once the zone is stable so that the overlay will be fully rendered
|
---|
81 | // before attempting to position it, as the position may depend on the size of the rendered
|
---|
82 | // content.
|
---|
83 | this._ngZone.onStable
|
---|
84 | .pipe(take(1))
|
---|
85 | .subscribe(() => {
|
---|
86 | // The overlay could've been detached before the zone has stabilized.
|
---|
87 | if (this.hasAttached()) {
|
---|
88 | this.updatePosition();
|
---|
89 | }
|
---|
90 | });
|
---|
91 | // Enable pointer events for the overlay pane element.
|
---|
92 | this._togglePointerEvents(true);
|
---|
93 | if (this._config.hasBackdrop) {
|
---|
94 | this._attachBackdrop();
|
---|
95 | }
|
---|
96 | if (this._config.panelClass) {
|
---|
97 | this._toggleClasses(this._pane, this._config.panelClass, true);
|
---|
98 | }
|
---|
99 | // Only emit the `attachments` event once all other setup is done.
|
---|
100 | this._attachments.next();
|
---|
101 | // Track this overlay by the keyboard dispatcher
|
---|
102 | this._keyboardDispatcher.add(this);
|
---|
103 | if (this._config.disposeOnNavigation) {
|
---|
104 | this._locationChanges = this._location.subscribe(() => this.dispose());
|
---|
105 | }
|
---|
106 | this._outsideClickDispatcher.add(this);
|
---|
107 | return attachResult;
|
---|
108 | }
|
---|
109 | /**
|
---|
110 | * Detaches an overlay from a portal.
|
---|
111 | * @returns The portal detachment result.
|
---|
112 | */
|
---|
113 | detach() {
|
---|
114 | if (!this.hasAttached()) {
|
---|
115 | return;
|
---|
116 | }
|
---|
117 | this.detachBackdrop();
|
---|
118 | // When the overlay is detached, the pane element should disable pointer events.
|
---|
119 | // This is necessary because otherwise the pane element will cover the page and disable
|
---|
120 | // pointer events therefore. Depends on the position strategy and the applied pane boundaries.
|
---|
121 | this._togglePointerEvents(false);
|
---|
122 | if (this._positionStrategy && this._positionStrategy.detach) {
|
---|
123 | this._positionStrategy.detach();
|
---|
124 | }
|
---|
125 | if (this._scrollStrategy) {
|
---|
126 | this._scrollStrategy.disable();
|
---|
127 | }
|
---|
128 | const detachmentResult = this._portalOutlet.detach();
|
---|
129 | // Only emit after everything is detached.
|
---|
130 | this._detachments.next();
|
---|
131 | // Remove this overlay from keyboard dispatcher tracking.
|
---|
132 | this._keyboardDispatcher.remove(this);
|
---|
133 | // Keeping the host element in the DOM can cause scroll jank, because it still gets
|
---|
134 | // rendered, even though it's transparent and unclickable which is why we remove it.
|
---|
135 | this._detachContentWhenStable();
|
---|
136 | this._locationChanges.unsubscribe();
|
---|
137 | this._outsideClickDispatcher.remove(this);
|
---|
138 | return detachmentResult;
|
---|
139 | }
|
---|
140 | /** Cleans up the overlay from the DOM. */
|
---|
141 | dispose() {
|
---|
142 | const isAttached = this.hasAttached();
|
---|
143 | if (this._positionStrategy) {
|
---|
144 | this._positionStrategy.dispose();
|
---|
145 | }
|
---|
146 | this._disposeScrollStrategy();
|
---|
147 | this._disposeBackdrop(this._backdropElement);
|
---|
148 | this._locationChanges.unsubscribe();
|
---|
149 | this._keyboardDispatcher.remove(this);
|
---|
150 | this._portalOutlet.dispose();
|
---|
151 | this._attachments.complete();
|
---|
152 | this._backdropClick.complete();
|
---|
153 | this._keydownEvents.complete();
|
---|
154 | this._outsidePointerEvents.complete();
|
---|
155 | this._outsideClickDispatcher.remove(this);
|
---|
156 | if (this._host && this._host.parentNode) {
|
---|
157 | this._host.parentNode.removeChild(this._host);
|
---|
158 | this._host = null;
|
---|
159 | }
|
---|
160 | this._previousHostParent = this._pane = null;
|
---|
161 | if (isAttached) {
|
---|
162 | this._detachments.next();
|
---|
163 | }
|
---|
164 | this._detachments.complete();
|
---|
165 | }
|
---|
166 | /** Whether the overlay has attached content. */
|
---|
167 | hasAttached() {
|
---|
168 | return this._portalOutlet.hasAttached();
|
---|
169 | }
|
---|
170 | /** Gets an observable that emits when the backdrop has been clicked. */
|
---|
171 | backdropClick() {
|
---|
172 | return this._backdropClick;
|
---|
173 | }
|
---|
174 | /** Gets an observable that emits when the overlay has been attached. */
|
---|
175 | attachments() {
|
---|
176 | return this._attachments;
|
---|
177 | }
|
---|
178 | /** Gets an observable that emits when the overlay has been detached. */
|
---|
179 | detachments() {
|
---|
180 | return this._detachments;
|
---|
181 | }
|
---|
182 | /** Gets an observable of keydown events targeted to this overlay. */
|
---|
183 | keydownEvents() {
|
---|
184 | return this._keydownEvents;
|
---|
185 | }
|
---|
186 | /** Gets an observable of pointer events targeted outside this overlay. */
|
---|
187 | outsidePointerEvents() {
|
---|
188 | return this._outsidePointerEvents;
|
---|
189 | }
|
---|
190 | /** Gets the current overlay configuration, which is immutable. */
|
---|
191 | getConfig() {
|
---|
192 | return this._config;
|
---|
193 | }
|
---|
194 | /** Updates the position of the overlay based on the position strategy. */
|
---|
195 | updatePosition() {
|
---|
196 | if (this._positionStrategy) {
|
---|
197 | this._positionStrategy.apply();
|
---|
198 | }
|
---|
199 | }
|
---|
200 | /** Switches to a new position strategy and updates the overlay position. */
|
---|
201 | updatePositionStrategy(strategy) {
|
---|
202 | if (strategy === this._positionStrategy) {
|
---|
203 | return;
|
---|
204 | }
|
---|
205 | if (this._positionStrategy) {
|
---|
206 | this._positionStrategy.dispose();
|
---|
207 | }
|
---|
208 | this._positionStrategy = strategy;
|
---|
209 | if (this.hasAttached()) {
|
---|
210 | strategy.attach(this);
|
---|
211 | this.updatePosition();
|
---|
212 | }
|
---|
213 | }
|
---|
214 | /** Update the size properties of the overlay. */
|
---|
215 | updateSize(sizeConfig) {
|
---|
216 | this._config = Object.assign(Object.assign({}, this._config), sizeConfig);
|
---|
217 | this._updateElementSize();
|
---|
218 | }
|
---|
219 | /** Sets the LTR/RTL direction for the overlay. */
|
---|
220 | setDirection(dir) {
|
---|
221 | this._config = Object.assign(Object.assign({}, this._config), { direction: dir });
|
---|
222 | this._updateElementDirection();
|
---|
223 | }
|
---|
224 | /** Add a CSS class or an array of classes to the overlay pane. */
|
---|
225 | addPanelClass(classes) {
|
---|
226 | if (this._pane) {
|
---|
227 | this._toggleClasses(this._pane, classes, true);
|
---|
228 | }
|
---|
229 | }
|
---|
230 | /** Remove a CSS class or an array of classes from the overlay pane. */
|
---|
231 | removePanelClass(classes) {
|
---|
232 | if (this._pane) {
|
---|
233 | this._toggleClasses(this._pane, classes, false);
|
---|
234 | }
|
---|
235 | }
|
---|
236 | /**
|
---|
237 | * Returns the layout direction of the overlay panel.
|
---|
238 | */
|
---|
239 | getDirection() {
|
---|
240 | const direction = this._config.direction;
|
---|
241 | if (!direction) {
|
---|
242 | return 'ltr';
|
---|
243 | }
|
---|
244 | return typeof direction === 'string' ? direction : direction.value;
|
---|
245 | }
|
---|
246 | /** Switches to a new scroll strategy. */
|
---|
247 | updateScrollStrategy(strategy) {
|
---|
248 | if (strategy === this._scrollStrategy) {
|
---|
249 | return;
|
---|
250 | }
|
---|
251 | this._disposeScrollStrategy();
|
---|
252 | this._scrollStrategy = strategy;
|
---|
253 | if (this.hasAttached()) {
|
---|
254 | strategy.attach(this);
|
---|
255 | strategy.enable();
|
---|
256 | }
|
---|
257 | }
|
---|
258 | /** Updates the text direction of the overlay panel. */
|
---|
259 | _updateElementDirection() {
|
---|
260 | this._host.setAttribute('dir', this.getDirection());
|
---|
261 | }
|
---|
262 | /** Updates the size of the overlay element based on the overlay config. */
|
---|
263 | _updateElementSize() {
|
---|
264 | if (!this._pane) {
|
---|
265 | return;
|
---|
266 | }
|
---|
267 | const style = this._pane.style;
|
---|
268 | style.width = coerceCssPixelValue(this._config.width);
|
---|
269 | style.height = coerceCssPixelValue(this._config.height);
|
---|
270 | style.minWidth = coerceCssPixelValue(this._config.minWidth);
|
---|
271 | style.minHeight = coerceCssPixelValue(this._config.minHeight);
|
---|
272 | style.maxWidth = coerceCssPixelValue(this._config.maxWidth);
|
---|
273 | style.maxHeight = coerceCssPixelValue(this._config.maxHeight);
|
---|
274 | }
|
---|
275 | /** Toggles the pointer events for the overlay pane element. */
|
---|
276 | _togglePointerEvents(enablePointer) {
|
---|
277 | this._pane.style.pointerEvents = enablePointer ? '' : 'none';
|
---|
278 | }
|
---|
279 | /** Attaches a backdrop for this overlay. */
|
---|
280 | _attachBackdrop() {
|
---|
281 | const showingClass = 'cdk-overlay-backdrop-showing';
|
---|
282 | this._backdropElement = this._document.createElement('div');
|
---|
283 | this._backdropElement.classList.add('cdk-overlay-backdrop');
|
---|
284 | if (this._config.backdropClass) {
|
---|
285 | this._toggleClasses(this._backdropElement, this._config.backdropClass, true);
|
---|
286 | }
|
---|
287 | // Insert the backdrop before the pane in the DOM order,
|
---|
288 | // in order to handle stacked overlays properly.
|
---|
289 | this._host.parentElement.insertBefore(this._backdropElement, this._host);
|
---|
290 | // Forward backdrop clicks such that the consumer of the overlay can perform whatever
|
---|
291 | // action desired when such a click occurs (usually closing the overlay).
|
---|
292 | this._backdropElement.addEventListener('click', this._backdropClickHandler);
|
---|
293 | // Add class to fade-in the backdrop after one frame.
|
---|
294 | if (typeof requestAnimationFrame !== 'undefined') {
|
---|
295 | this._ngZone.runOutsideAngular(() => {
|
---|
296 | requestAnimationFrame(() => {
|
---|
297 | if (this._backdropElement) {
|
---|
298 | this._backdropElement.classList.add(showingClass);
|
---|
299 | }
|
---|
300 | });
|
---|
301 | });
|
---|
302 | }
|
---|
303 | else {
|
---|
304 | this._backdropElement.classList.add(showingClass);
|
---|
305 | }
|
---|
306 | }
|
---|
307 | /**
|
---|
308 | * Updates the stacking order of the element, moving it to the top if necessary.
|
---|
309 | * This is required in cases where one overlay was detached, while another one,
|
---|
310 | * that should be behind it, was destroyed. The next time both of them are opened,
|
---|
311 | * the stacking will be wrong, because the detached element's pane will still be
|
---|
312 | * in its original DOM position.
|
---|
313 | */
|
---|
314 | _updateStackingOrder() {
|
---|
315 | if (this._host.nextSibling) {
|
---|
316 | this._host.parentNode.appendChild(this._host);
|
---|
317 | }
|
---|
318 | }
|
---|
319 | /** Detaches the backdrop (if any) associated with the overlay. */
|
---|
320 | detachBackdrop() {
|
---|
321 | const backdropToDetach = this._backdropElement;
|
---|
322 | if (!backdropToDetach) {
|
---|
323 | return;
|
---|
324 | }
|
---|
325 | let timeoutId;
|
---|
326 | const finishDetach = () => {
|
---|
327 | // It may not be attached to anything in certain cases (e.g. unit tests).
|
---|
328 | if (backdropToDetach) {
|
---|
329 | backdropToDetach.removeEventListener('click', this._backdropClickHandler);
|
---|
330 | backdropToDetach.removeEventListener('transitionend', finishDetach);
|
---|
331 | this._disposeBackdrop(backdropToDetach);
|
---|
332 | }
|
---|
333 | if (this._config.backdropClass) {
|
---|
334 | this._toggleClasses(backdropToDetach, this._config.backdropClass, false);
|
---|
335 | }
|
---|
336 | clearTimeout(timeoutId);
|
---|
337 | };
|
---|
338 | backdropToDetach.classList.remove('cdk-overlay-backdrop-showing');
|
---|
339 | this._ngZone.runOutsideAngular(() => {
|
---|
340 | backdropToDetach.addEventListener('transitionend', finishDetach);
|
---|
341 | });
|
---|
342 | // If the backdrop doesn't have a transition, the `transitionend` event won't fire.
|
---|
343 | // In this case we make it unclickable and we try to remove it after a delay.
|
---|
344 | backdropToDetach.style.pointerEvents = 'none';
|
---|
345 | // Run this outside the Angular zone because there's nothing that Angular cares about.
|
---|
346 | // If it were to run inside the Angular zone, every test that used Overlay would have to be
|
---|
347 | // either async or fakeAsync.
|
---|
348 | timeoutId = this._ngZone.runOutsideAngular(() => setTimeout(finishDetach, 500));
|
---|
349 | }
|
---|
350 | /** Toggles a single CSS class or an array of classes on an element. */
|
---|
351 | _toggleClasses(element, cssClasses, isAdd) {
|
---|
352 | const classList = element.classList;
|
---|
353 | coerceArray(cssClasses).forEach(cssClass => {
|
---|
354 | // We can't do a spread here, because IE doesn't support setting multiple classes.
|
---|
355 | // Also trying to add an empty string to a DOMTokenList will throw.
|
---|
356 | if (cssClass) {
|
---|
357 | isAdd ? classList.add(cssClass) : classList.remove(cssClass);
|
---|
358 | }
|
---|
359 | });
|
---|
360 | }
|
---|
361 | /** Detaches the overlay content next time the zone stabilizes. */
|
---|
362 | _detachContentWhenStable() {
|
---|
363 | // Normally we wouldn't have to explicitly run this outside the `NgZone`, however
|
---|
364 | // if the consumer is using `zone-patch-rxjs`, the `Subscription.unsubscribe` call will
|
---|
365 | // be patched to run inside the zone, which will throw us into an infinite loop.
|
---|
366 | this._ngZone.runOutsideAngular(() => {
|
---|
367 | // We can't remove the host here immediately, because the overlay pane's content
|
---|
368 | // might still be animating. This stream helps us avoid interrupting the animation
|
---|
369 | // by waiting for the pane to become empty.
|
---|
370 | const subscription = this._ngZone.onStable
|
---|
371 | .pipe(takeUntil(merge(this._attachments, this._detachments)))
|
---|
372 | .subscribe(() => {
|
---|
373 | // Needs a couple of checks for the pane and host, because
|
---|
374 | // they may have been removed by the time the zone stabilizes.
|
---|
375 | if (!this._pane || !this._host || this._pane.children.length === 0) {
|
---|
376 | if (this._pane && this._config.panelClass) {
|
---|
377 | this._toggleClasses(this._pane, this._config.panelClass, false);
|
---|
378 | }
|
---|
379 | if (this._host && this._host.parentElement) {
|
---|
380 | this._previousHostParent = this._host.parentElement;
|
---|
381 | this._previousHostParent.removeChild(this._host);
|
---|
382 | }
|
---|
383 | subscription.unsubscribe();
|
---|
384 | }
|
---|
385 | });
|
---|
386 | });
|
---|
387 | }
|
---|
388 | /** Disposes of a scroll strategy. */
|
---|
389 | _disposeScrollStrategy() {
|
---|
390 | const scrollStrategy = this._scrollStrategy;
|
---|
391 | if (scrollStrategy) {
|
---|
392 | scrollStrategy.disable();
|
---|
393 | if (scrollStrategy.detach) {
|
---|
394 | scrollStrategy.detach();
|
---|
395 | }
|
---|
396 | }
|
---|
397 | }
|
---|
398 | /** Removes a backdrop element from the DOM. */
|
---|
399 | _disposeBackdrop(backdrop) {
|
---|
400 | if (backdrop) {
|
---|
401 | if (backdrop.parentNode) {
|
---|
402 | backdrop.parentNode.removeChild(backdrop);
|
---|
403 | }
|
---|
404 | // It is possible that a new portal has been attached to this overlay since we started
|
---|
405 | // removing the backdrop. If that is the case, only clear the backdrop reference if it
|
---|
406 | // is still the same instance that we started to remove.
|
---|
407 | if (this._backdropElement === backdrop) {
|
---|
408 | this._backdropElement = null;
|
---|
409 | }
|
---|
410 | }
|
---|
411 | }
|
---|
412 | }
|
---|
413 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3ZlcmxheS1yZWYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL292ZXJsYXkvb3ZlcmxheS1yZWYudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBTUgsT0FBTyxFQUFhLE9BQU8sRUFBRSxLQUFLLEVBQW9CLFlBQVksRUFBQyxNQUFNLE1BQU0sQ0FBQztBQUNoRixPQUFPLEVBQUMsSUFBSSxFQUFFLFNBQVMsRUFBQyxNQUFNLGdCQUFnQixDQUFDO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