@angular/cdk 19.0.3 → 19.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dialog/index.d.ts +1 -0
- package/drag-drop/index.d.ts +30 -3
- package/fesm2022/cdk.mjs +1 -1
- package/fesm2022/cdk.mjs.map +1 -1
- package/fesm2022/dialog.mjs +6 -5
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/drag-drop.mjs +78 -32
- package/fesm2022/drag-drop.mjs.map +1 -1
- package/fesm2022/menu.mjs +6 -0
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/observers/private.mjs +5 -5
- package/fesm2022/observers/private.mjs.map +1 -1
- package/fesm2022/overlay.mjs +38 -48
- package/fesm2022/overlay.mjs.map +1 -1
- package/fesm2022/scrolling.mjs +9 -15
- package/fesm2022/scrolling.mjs.map +1 -1
- package/fesm2022/testing/testbed.mjs +83 -40
- package/fesm2022/testing/testbed.mjs.map +1 -1
- package/fesm2022/text-field.mjs +8 -5
- package/fesm2022/text-field.mjs.map +1 -1
- package/fesm2022/tree.mjs +22 -4
- package/fesm2022/tree.mjs.map +1 -1
- package/observers/private/index.d.ts +1 -0
- package/overlay/index.d.ts +10 -5
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/scrolling/index.d.ts +1 -2
- package/text-field/index.d.ts +2 -0
- package/tree/index.d.ts +2 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, NgZone, Injectable } from '@angular/core';
|
|
2
|
+
import { inject, NgZone, RendererFactory2, Injectable } from '@angular/core';
|
|
3
3
|
import { Subject, Observable } from 'rxjs';
|
|
4
4
|
import { filter, shareReplay, takeUntil } from 'rxjs/operators';
|
|
5
5
|
|
|
@@ -77,6 +77,7 @@ class SingleBoxSharedResizeObserver {
|
|
|
77
77
|
* earlier calls.
|
|
78
78
|
*/
|
|
79
79
|
class SharedResizeObserver {
|
|
80
|
+
_cleanupErrorListener;
|
|
80
81
|
/** Map of box type to shared resize observer. */
|
|
81
82
|
_observers = new Map();
|
|
82
83
|
/** The Angular zone. */
|
|
@@ -84,7 +85,8 @@ class SharedResizeObserver {
|
|
|
84
85
|
constructor() {
|
|
85
86
|
if (typeof ResizeObserver !== 'undefined' && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
86
87
|
this._ngZone.runOutsideAngular(() => {
|
|
87
|
-
|
|
88
|
+
const renderer = inject(RendererFactory2).createRenderer(null, null);
|
|
89
|
+
this._cleanupErrorListener = renderer.listen('window', 'error', loopLimitExceededErrorHandler);
|
|
88
90
|
});
|
|
89
91
|
}
|
|
90
92
|
}
|
|
@@ -93,9 +95,7 @@ class SharedResizeObserver {
|
|
|
93
95
|
observer.destroy();
|
|
94
96
|
}
|
|
95
97
|
this._observers.clear();
|
|
96
|
-
|
|
97
|
-
window.removeEventListener('error', loopLimitExceededErrorHandler);
|
|
98
|
-
}
|
|
98
|
+
this._cleanupErrorListener?.();
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* Gets a stream of resize events for the given target element and box type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private.mjs","sources":["../../../../../../../src/cdk/observers/private/shared-resize-observer.ts","../../../../../../../src/cdk/observers/private/private_public_index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\nimport {inject, Injectable, NgZone, OnDestroy} from '@angular/core';\nimport {Observable, Subject} from 'rxjs';\nimport {filter, shareReplay, takeUntil} from 'rxjs/operators';\n\n/**\n * Handler that logs \"ResizeObserver loop limit exceeded\" errors.\n * These errors are not shown in the Chrome console, so we log them to ensure developers are aware.\n * @param e The error\n */\nconst loopLimitExceededErrorHandler = (e: unknown) => {\n if (e instanceof ErrorEvent && e.message === 'ResizeObserver loop limit exceeded') {\n console.error(\n `${e.message}. This could indicate a performance issue with your app. See https://github.com/WICG/resize-observer/blob/master/explainer.md#error-handling`,\n );\n }\n};\n\n/**\n * A shared ResizeObserver to be used for a particular box type (content-box, border-box, or\n * device-pixel-content-box)\n */\nclass SingleBoxSharedResizeObserver {\n /** Stream that emits when the shared observer is destroyed. */\n private _destroyed = new Subject<void>();\n /** Stream of all events from the ResizeObserver. */\n private _resizeSubject = new Subject<ResizeObserverEntry[]>();\n /** ResizeObserver used to observe element resize events. */\n private _resizeObserver?: ResizeObserver;\n /** A map of elements to streams of their resize events. */\n private _elementObservables = new Map<Element, Observable<ResizeObserverEntry[]>>();\n\n constructor(\n /** The box type to observe for resizes. */\n private _box: ResizeObserverBoxOptions,\n ) {\n if (typeof ResizeObserver !== 'undefined') {\n this._resizeObserver = new ResizeObserver(entries => this._resizeSubject.next(entries));\n }\n }\n\n /**\n * Gets a stream of resize events for the given element.\n * @param target The element to observe.\n * @return The stream of resize events for the element.\n */\n observe(target: Element): Observable<ResizeObserverEntry[]> {\n if (!this._elementObservables.has(target)) {\n this._elementObservables.set(\n target,\n new Observable<ResizeObserverEntry[]>(observer => {\n const subscription = this._resizeSubject.subscribe(observer);\n this._resizeObserver?.observe(target, {box: this._box});\n return () => {\n this._resizeObserver?.unobserve(target);\n subscription.unsubscribe();\n this._elementObservables.delete(target);\n };\n }).pipe(\n filter(entries => entries.some(entry => entry.target === target)),\n // Share a replay of the last event so that subsequent calls to observe the same element\n // receive initial sizing info like the first one. Also enable ref counting so the\n // element will be automatically unobserved when there are no more subscriptions.\n shareReplay({bufferSize: 1, refCount: true}),\n takeUntil(this._destroyed),\n ),\n );\n }\n return this._elementObservables.get(target)!;\n }\n\n /** Destroys this instance. */\n destroy() {\n this._destroyed.next();\n this._destroyed.complete();\n this._resizeSubject.complete();\n this._elementObservables.clear();\n }\n}\n\n/**\n * Allows observing resize events on multiple elements using a shared set of ResizeObserver.\n * Sharing a ResizeObserver instance is recommended for better performance (see\n * https://github.com/WICG/resize-observer/issues/59).\n *\n * Rather than share a single `ResizeObserver`, this class creates one `ResizeObserver` per type\n * of observed box ('content-box', 'border-box', and 'device-pixel-content-box'). This avoids\n * later calls to `observe` with a different box type from influencing the events dispatched to\n * earlier calls.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class SharedResizeObserver implements OnDestroy {\n /** Map of box type to shared resize observer. */\n private _observers = new Map<ResizeObserverBoxOptions, SingleBoxSharedResizeObserver>();\n\n /** The Angular zone. */\n private _ngZone = inject(NgZone);\n\n constructor() {\n if (typeof ResizeObserver !== 'undefined' && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n this._ngZone.runOutsideAngular(() => {\n
|
|
1
|
+
{"version":3,"file":"private.mjs","sources":["../../../../../../../src/cdk/observers/private/shared-resize-observer.ts","../../../../../../../src/cdk/observers/private/private_public_index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\nimport {inject, Injectable, NgZone, OnDestroy, RendererFactory2} from '@angular/core';\nimport {Observable, Subject} from 'rxjs';\nimport {filter, shareReplay, takeUntil} from 'rxjs/operators';\n\n/**\n * Handler that logs \"ResizeObserver loop limit exceeded\" errors.\n * These errors are not shown in the Chrome console, so we log them to ensure developers are aware.\n * @param e The error\n */\nconst loopLimitExceededErrorHandler = (e: unknown) => {\n if (e instanceof ErrorEvent && e.message === 'ResizeObserver loop limit exceeded') {\n console.error(\n `${e.message}. This could indicate a performance issue with your app. See https://github.com/WICG/resize-observer/blob/master/explainer.md#error-handling`,\n );\n }\n};\n\n/**\n * A shared ResizeObserver to be used for a particular box type (content-box, border-box, or\n * device-pixel-content-box)\n */\nclass SingleBoxSharedResizeObserver {\n /** Stream that emits when the shared observer is destroyed. */\n private _destroyed = new Subject<void>();\n /** Stream of all events from the ResizeObserver. */\n private _resizeSubject = new Subject<ResizeObserverEntry[]>();\n /** ResizeObserver used to observe element resize events. */\n private _resizeObserver?: ResizeObserver;\n /** A map of elements to streams of their resize events. */\n private _elementObservables = new Map<Element, Observable<ResizeObserverEntry[]>>();\n\n constructor(\n /** The box type to observe for resizes. */\n private _box: ResizeObserverBoxOptions,\n ) {\n if (typeof ResizeObserver !== 'undefined') {\n this._resizeObserver = new ResizeObserver(entries => this._resizeSubject.next(entries));\n }\n }\n\n /**\n * Gets a stream of resize events for the given element.\n * @param target The element to observe.\n * @return The stream of resize events for the element.\n */\n observe(target: Element): Observable<ResizeObserverEntry[]> {\n if (!this._elementObservables.has(target)) {\n this._elementObservables.set(\n target,\n new Observable<ResizeObserverEntry[]>(observer => {\n const subscription = this._resizeSubject.subscribe(observer);\n this._resizeObserver?.observe(target, {box: this._box});\n return () => {\n this._resizeObserver?.unobserve(target);\n subscription.unsubscribe();\n this._elementObservables.delete(target);\n };\n }).pipe(\n filter(entries => entries.some(entry => entry.target === target)),\n // Share a replay of the last event so that subsequent calls to observe the same element\n // receive initial sizing info like the first one. Also enable ref counting so the\n // element will be automatically unobserved when there are no more subscriptions.\n shareReplay({bufferSize: 1, refCount: true}),\n takeUntil(this._destroyed),\n ),\n );\n }\n return this._elementObservables.get(target)!;\n }\n\n /** Destroys this instance. */\n destroy() {\n this._destroyed.next();\n this._destroyed.complete();\n this._resizeSubject.complete();\n this._elementObservables.clear();\n }\n}\n\n/**\n * Allows observing resize events on multiple elements using a shared set of ResizeObserver.\n * Sharing a ResizeObserver instance is recommended for better performance (see\n * https://github.com/WICG/resize-observer/issues/59).\n *\n * Rather than share a single `ResizeObserver`, this class creates one `ResizeObserver` per type\n * of observed box ('content-box', 'border-box', and 'device-pixel-content-box'). This avoids\n * later calls to `observe` with a different box type from influencing the events dispatched to\n * earlier calls.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class SharedResizeObserver implements OnDestroy {\n private _cleanupErrorListener: (() => void) | undefined;\n\n /** Map of box type to shared resize observer. */\n private _observers = new Map<ResizeObserverBoxOptions, SingleBoxSharedResizeObserver>();\n\n /** The Angular zone. */\n private _ngZone = inject(NgZone);\n\n constructor() {\n if (typeof ResizeObserver !== 'undefined' && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n this._ngZone.runOutsideAngular(() => {\n const renderer = inject(RendererFactory2).createRenderer(null, null);\n this._cleanupErrorListener = renderer.listen(\n 'window',\n 'error',\n loopLimitExceededErrorHandler,\n );\n });\n }\n }\n\n ngOnDestroy() {\n for (const [, observer] of this._observers) {\n observer.destroy();\n }\n this._observers.clear();\n this._cleanupErrorListener?.();\n }\n\n /**\n * Gets a stream of resize events for the given target element and box type.\n * @param target The element to observe for resizes.\n * @param options Options to pass to the `ResizeObserver`\n * @return The stream of resize events for the element.\n */\n observe(target: Element, options?: ResizeObserverOptions): Observable<ResizeObserverEntry[]> {\n const box = options?.box || 'content-box';\n if (!this._observers.has(box)) {\n this._observers.set(box, new SingleBoxSharedResizeObserver(box));\n }\n return this._observers.get(box)!.observe(target);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAWA;;;;AAIG;AACH,MAAM,6BAA6B,GAAG,CAAC,CAAU,KAAI;IACnD,IAAI,CAAC,YAAY,UAAU,IAAI,CAAC,CAAC,OAAO,KAAK,oCAAoC,EAAE;QACjF,OAAO,CAAC,KAAK,CACX,CAAA,EAAG,CAAC,CAAC,OAAO,CAA8I,4IAAA,CAAA,CAC3J,CAAC;KACH;AACH,CAAC,CAAC;AAEF;;;AAGG;AACH,MAAM,6BAA6B,CAAA;AAYvB,IAAA,IAAA,CAAA;;AAVF,IAAA,UAAU,GAAG,IAAI,OAAO,EAAQ,CAAC;;AAEjC,IAAA,cAAc,GAAG,IAAI,OAAO,EAAyB,CAAC;;AAEtD,IAAA,eAAe,CAAkB;;AAEjC,IAAA,mBAAmB,GAAG,IAAI,GAAG,EAA8C,CAAC;AAEpF,IAAA,WAAA;;IAEU,IAA8B,EAAA;QAA9B,IAA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,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AAC7B,YAAA,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,6BAA6B,CAAC,GAAG,CAAC,CAAC,CAAC;SAClE;AACD,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;KAClD;uGA1CU,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAApB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,cAFnB,MAAM,EAAA,CAAA,CAAA;;2FAEP,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA,CAAA;;;AClGD;;AAEG;;;;"}
|
package/fesm2022/overlay.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { ScrollDispatcher, ViewportRuler, ScrollingModule } from '@angular/cdk/s
|
|
|
2
2
|
export { CdkScrollable, ScrollDispatcher, ViewportRuler } from '@angular/cdk/scrolling';
|
|
3
3
|
import { DOCUMENT, Location } from '@angular/common';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
|
-
import { inject, NgZone, Injectable, Component, ChangeDetectionStrategy, ViewEncapsulation, untracked, afterRender, afterNextRender, ElementRef, Injector, ANIMATION_MODULE_TYPE, EnvironmentInjector, ApplicationRef, InjectionToken, Directive, EventEmitter, TemplateRef, ViewContainerRef, booleanAttribute, Input, Output, NgModule } from '@angular/core';
|
|
5
|
+
import { inject, NgZone, Injectable, RendererFactory2, Component, ChangeDetectionStrategy, ViewEncapsulation, untracked, afterRender, afterNextRender, ElementRef, Injector, ANIMATION_MODULE_TYPE, EnvironmentInjector, ApplicationRef, InjectionToken, Directive, EventEmitter, TemplateRef, ViewContainerRef, booleanAttribute, Input, Output, NgModule } from '@angular/core';
|
|
6
6
|
import { coerceCssPixelValue, coerceArray } from '@angular/cdk/coercion';
|
|
7
7
|
import { supportsScrollBehavior, Platform, _getEventTarget, _isTestEnvironment } from '@angular/cdk/platform';
|
|
8
8
|
import { filter, takeUntil, takeWhile } from 'rxjs/operators';
|
|
@@ -497,26 +497,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
497
497
|
* on event target and order of overlay opens.
|
|
498
498
|
*/
|
|
499
499
|
class OverlayKeyboardDispatcher extends BaseOverlayDispatcher {
|
|
500
|
-
_ngZone = inject(NgZone
|
|
500
|
+
_ngZone = inject(NgZone);
|
|
501
|
+
_renderer = inject(RendererFactory2).createRenderer(null, null);
|
|
502
|
+
_cleanupKeydown;
|
|
501
503
|
/** Add a new overlay to the list of attached overlay refs. */
|
|
502
504
|
add(overlayRef) {
|
|
503
505
|
super.add(overlayRef);
|
|
504
506
|
// Lazily start dispatcher once first overlay is added
|
|
505
507
|
if (!this._isAttached) {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
}
|
|
510
|
-
else {
|
|
511
|
-
this._document.body.addEventListener('keydown', this._keydownListener);
|
|
512
|
-
}
|
|
508
|
+
this._ngZone.runOutsideAngular(() => {
|
|
509
|
+
this._cleanupKeydown = this._renderer.listen('body', 'keydown', this._keydownListener);
|
|
510
|
+
});
|
|
513
511
|
this._isAttached = true;
|
|
514
512
|
}
|
|
515
513
|
}
|
|
516
514
|
/** Detaches the global keyboard event listener. */
|
|
517
515
|
detach() {
|
|
518
516
|
if (this._isAttached) {
|
|
519
|
-
this.
|
|
517
|
+
this._cleanupKeydown?.();
|
|
520
518
|
this._isAttached = false;
|
|
521
519
|
}
|
|
522
520
|
}
|
|
@@ -531,14 +529,7 @@ class OverlayKeyboardDispatcher extends BaseOverlayDispatcher {
|
|
|
531
529
|
// because we don't want overlays that don't handle keyboard events to block the ones below
|
|
532
530
|
// them that do.
|
|
533
531
|
if (overlays[i]._keydownEvents.observers.length > 0) {
|
|
534
|
-
|
|
535
|
-
/** @breaking-change 14.0.0 _ngZone will be required. */
|
|
536
|
-
if (this._ngZone) {
|
|
537
|
-
this._ngZone.run(() => keydownEvents.next(event));
|
|
538
|
-
}
|
|
539
|
-
else {
|
|
540
|
-
keydownEvents.next(event);
|
|
541
|
-
}
|
|
532
|
+
this._ngZone.run(() => overlays[i]._keydownEvents.next(event));
|
|
542
533
|
break;
|
|
543
534
|
}
|
|
544
535
|
}
|
|
@@ -777,6 +768,7 @@ class OverlayRef {
|
|
|
777
768
|
_outsideClickDispatcher;
|
|
778
769
|
_animationsDisabled;
|
|
779
770
|
_injector;
|
|
771
|
+
_renderer;
|
|
780
772
|
_backdropElement = null;
|
|
781
773
|
_backdropTimeout;
|
|
782
774
|
_backdropClick = new Subject();
|
|
@@ -785,10 +777,8 @@ class OverlayRef {
|
|
|
785
777
|
_positionStrategy;
|
|
786
778
|
_scrollStrategy;
|
|
787
779
|
_locationChanges = Subscription.EMPTY;
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
this._disposeBackdrop(event.target);
|
|
791
|
-
};
|
|
780
|
+
_cleanupBackdropClick;
|
|
781
|
+
_cleanupBackdropTransitionEnd;
|
|
792
782
|
/**
|
|
793
783
|
* Reference to the parent of the `_host` at the time it was detached. Used to restore
|
|
794
784
|
* the `_host` to its original position in the DOM when it gets re-attached.
|
|
@@ -802,7 +792,7 @@ class OverlayRef {
|
|
|
802
792
|
_afterRenderRef;
|
|
803
793
|
/** Reference to the currently-running `afterNextRender` call. */
|
|
804
794
|
_afterNextRenderRef;
|
|
805
|
-
constructor(_portalOutlet, _host, _pane, _config, _ngZone, _keyboardDispatcher, _document, _location, _outsideClickDispatcher, _animationsDisabled = false, _injector) {
|
|
795
|
+
constructor(_portalOutlet, _host, _pane, _config, _ngZone, _keyboardDispatcher, _document, _location, _outsideClickDispatcher, _animationsDisabled = false, _injector, _renderer) {
|
|
806
796
|
this._portalOutlet = _portalOutlet;
|
|
807
797
|
this._host = _host;
|
|
808
798
|
this._pane = _pane;
|
|
@@ -814,6 +804,7 @@ class OverlayRef {
|
|
|
814
804
|
this._outsideClickDispatcher = _outsideClickDispatcher;
|
|
815
805
|
this._animationsDisabled = _animationsDisabled;
|
|
816
806
|
this._injector = _injector;
|
|
807
|
+
this._renderer = _renderer;
|
|
817
808
|
if (_config.scrollStrategy) {
|
|
818
809
|
this._scrollStrategy = _config.scrollStrategy;
|
|
819
810
|
this._scrollStrategy.attach(this);
|
|
@@ -1099,7 +1090,8 @@ class OverlayRef {
|
|
|
1099
1090
|
this._host.parentElement.insertBefore(this._backdropElement, this._host);
|
|
1100
1091
|
// Forward backdrop clicks such that the consumer of the overlay can perform whatever
|
|
1101
1092
|
// action desired when such a click occurs (usually closing the overlay).
|
|
1102
|
-
this.
|
|
1093
|
+
this._cleanupBackdropClick?.();
|
|
1094
|
+
this._cleanupBackdropClick = this._renderer.listen(this._backdropElement, 'click', (event) => this._backdropClick.next(event));
|
|
1103
1095
|
// Add class to fade-in the backdrop after one frame.
|
|
1104
1096
|
if (!this._animationsDisabled && typeof requestAnimationFrame !== 'undefined') {
|
|
1105
1097
|
this._ngZone.runOutsideAngular(() => {
|
|
@@ -1138,7 +1130,10 @@ class OverlayRef {
|
|
|
1138
1130
|
}
|
|
1139
1131
|
backdropToDetach.classList.remove('cdk-overlay-backdrop-showing');
|
|
1140
1132
|
this._ngZone.runOutsideAngular(() => {
|
|
1141
|
-
|
|
1133
|
+
this._cleanupBackdropTransitionEnd?.();
|
|
1134
|
+
this._cleanupBackdropTransitionEnd = this._renderer.listen(backdropToDetach, 'transitionend', (event) => {
|
|
1135
|
+
this._disposeBackdrop(event.target);
|
|
1136
|
+
});
|
|
1142
1137
|
});
|
|
1143
1138
|
// If the backdrop doesn't have a transition, the `transitionend` event won't fire.
|
|
1144
1139
|
// In this case we make it unclickable and we try to remove it after a delay.
|
|
@@ -1196,9 +1191,9 @@ class OverlayRef {
|
|
|
1196
1191
|
}
|
|
1197
1192
|
/** Removes a backdrop element from the DOM. */
|
|
1198
1193
|
_disposeBackdrop(backdrop) {
|
|
1194
|
+
this._cleanupBackdropClick?.();
|
|
1195
|
+
this._cleanupBackdropTransitionEnd?.();
|
|
1199
1196
|
if (backdrop) {
|
|
1200
|
-
backdrop.removeEventListener('click', this._backdropClickHandler);
|
|
1201
|
-
backdrop.removeEventListener('transitionend', this._backdropTransitionendHandler);
|
|
1202
1197
|
backdrop.remove();
|
|
1203
1198
|
// It is possible that a new portal has been attached to this overlay since we started
|
|
1204
1199
|
// removing the backdrop. If that is the case, only clear the backdrop reference if it
|
|
@@ -2518,6 +2513,7 @@ class Overlay {
|
|
|
2518
2513
|
_outsideClickDispatcher = inject(OverlayOutsideClickDispatcher);
|
|
2519
2514
|
_animationsModuleType = inject(ANIMATION_MODULE_TYPE, { optional: true });
|
|
2520
2515
|
_idGenerator = inject(_IdGenerator);
|
|
2516
|
+
_renderer = inject(RendererFactory2).createRenderer(null, null);
|
|
2521
2517
|
_appRef;
|
|
2522
2518
|
_styleLoader = inject(_CdkPrivateStyleLoader);
|
|
2523
2519
|
constructor() { }
|
|
@@ -2535,7 +2531,7 @@ class Overlay {
|
|
|
2535
2531
|
const portalOutlet = this._createPortalOutlet(pane);
|
|
2536
2532
|
const overlayConfig = new OverlayConfig(config);
|
|
2537
2533
|
overlayConfig.direction = overlayConfig.direction || this._directionality.value;
|
|
2538
|
-
return new OverlayRef(portalOutlet, host, pane, overlayConfig, this._ngZone, this._keyboardDispatcher, this._document, this._location, this._outsideClickDispatcher, this._animationsModuleType === 'NoopAnimations', this._injector.get(EnvironmentInjector));
|
|
2534
|
+
return new OverlayRef(portalOutlet, host, pane, overlayConfig, this._ngZone, this._keyboardDispatcher, this._document, this._location, this._outsideClickDispatcher, this._animationsModuleType === 'NoopAnimations', this._injector.get(EnvironmentInjector), this._renderer);
|
|
2539
2535
|
}
|
|
2540
2536
|
/**
|
|
2541
2537
|
* Gets a position builder that can be used, via fluent API,
|
|
@@ -3043,38 +3039,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
|
|
|
3043
3039
|
* Should be provided in the root component.
|
|
3044
3040
|
*/
|
|
3045
3041
|
class FullscreenOverlayContainer extends OverlayContainer {
|
|
3042
|
+
_renderer = inject(RendererFactory2).createRenderer(null, null);
|
|
3046
3043
|
_fullScreenEventName;
|
|
3047
|
-
|
|
3044
|
+
_cleanupFullScreenListener;
|
|
3048
3045
|
constructor() {
|
|
3049
3046
|
super();
|
|
3050
3047
|
}
|
|
3051
3048
|
ngOnDestroy() {
|
|
3052
3049
|
super.ngOnDestroy();
|
|
3053
|
-
|
|
3054
|
-
this._document.removeEventListener(this._fullScreenEventName, this._fullScreenListener);
|
|
3055
|
-
}
|
|
3050
|
+
this._cleanupFullScreenListener?.();
|
|
3056
3051
|
}
|
|
3057
3052
|
_createContainer() {
|
|
3053
|
+
const eventName = this._getEventName();
|
|
3058
3054
|
super._createContainer();
|
|
3059
3055
|
this._adjustParentForFullscreenChange();
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3056
|
+
if (eventName) {
|
|
3057
|
+
this._cleanupFullScreenListener?.();
|
|
3058
|
+
this._cleanupFullScreenListener = this._renderer.listen('document', eventName, () => {
|
|
3059
|
+
this._adjustParentForFullscreenChange();
|
|
3060
|
+
});
|
|
3065
3061
|
}
|
|
3066
|
-
const fullscreenElement = this.getFullscreenElement();
|
|
3067
|
-
const parent = fullscreenElement || this._document.body;
|
|
3068
|
-
parent.appendChild(this._containerElement);
|
|
3069
3062
|
}
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
}
|
|
3076
|
-
this._document.addEventListener(eventName, fn);
|
|
3077
|
-
this._fullScreenListener = fn;
|
|
3063
|
+
_adjustParentForFullscreenChange() {
|
|
3064
|
+
if (this._containerElement) {
|
|
3065
|
+
const fullscreenElement = this.getFullscreenElement();
|
|
3066
|
+
const parent = fullscreenElement || this._document.body;
|
|
3067
|
+
parent.appendChild(this._containerElement);
|
|
3078
3068
|
}
|
|
3079
3069
|
}
|
|
3080
3070
|
_getEventName() {
|