@angular/cdk 17.3.8 → 17.3.10
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/drag-drop/index.d.ts +4 -4
- package/esm2022/drag-drop/drag-drop-registry.mjs +35 -2
- package/esm2022/drag-drop/drag-drop.mjs +2 -35
- package/esm2022/drag-drop/public-api.mjs +2 -2
- package/esm2022/observers/private/shared-resize-observer.mjs +2 -2
- package/esm2022/overlay/overlay-directives.mjs +22 -7
- package/esm2022/version.mjs +1 -1
- package/fesm2022/cdk.mjs +1 -1
- package/fesm2022/cdk.mjs.map +1 -1
- package/fesm2022/drag-drop.mjs +34 -34
- package/fesm2022/drag-drop.mjs.map +1 -1
- package/fesm2022/observers/private.mjs +1 -1
- package/fesm2022/observers/private.mjs.map +1 -1
- package/fesm2022/overlay.mjs +20 -6
- package/fesm2022/overlay.mjs.map +1 -1
- package/overlay/index.d.ts +2 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
|
@@ -9,7 +9,7 @@ import { filter, shareReplay, takeUntil } from 'rxjs/operators';
|
|
|
9
9
|
* @param e The error
|
|
10
10
|
*/
|
|
11
11
|
const loopLimitExceededErrorHandler = (e) => {
|
|
12
|
-
if (e instanceof
|
|
12
|
+
if (e instanceof ErrorEvent && e.message === 'ResizeObserver loop limit exceeded') {
|
|
13
13
|
console.error(`${e.message}. This could indicate a performance issue with your app. See https://github.com/WICG/resize-observer/blob/master/explainer.md#error-handling`);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
@@ -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.io/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
|
|
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.io/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 window.addEventListener('error', loopLimitExceededErrorHandler);\n });\n }\n }\n\n ngOnDestroy() {\n for (const [, observer] of this._observers) {\n observer.destroy();\n }\n this._observers.clear();\n if (typeof ResizeObserver !== 'undefined' && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n window.removeEventListener('error', loopLimitExceededErrorHandler);\n }\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;AAUjC,IAAA,WAAA;;IAEU,IAA8B,EAAA;QAA9B,IAAI,CAAA,IAAA,GAAJ,IAAI,CAA0B;;AAVhC,QAAA,IAAA,CAAA,UAAU,GAAG,IAAI,OAAO,EAAQ,CAAC;;AAEjC,QAAA,IAAA,CAAA,cAAc,GAAG,IAAI,OAAO,EAAyB,CAAC;;AAItD,QAAA,IAAA,CAAA,mBAAmB,GAAG,IAAI,GAAG,EAA8C,CAAC;AAMlF,QAAA,IAAI,OAAO,cAAc,KAAK,WAAW,EAAE;AACzC,YAAA,IAAI,CAAC,eAAe,GAAG,IAAI,cAAc,CAAC,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;SACzF;KACF;AAED;;;;AAIG;AACH,IAAA,OAAO,CAAC,MAAe,EA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AA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAApB,IAAA,SAAA,IAAA,CAAA,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,EAAA;;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
|
@@ -2663,7 +2663,11 @@ class CdkConnectedOverlay {
|
|
|
2663
2663
|
}
|
|
2664
2664
|
});
|
|
2665
2665
|
this._overlayRef.outsidePointerEvents().subscribe((event) => {
|
|
2666
|
-
this.
|
|
2666
|
+
const origin = this._getOriginElement();
|
|
2667
|
+
const target = _getEventTarget(event);
|
|
2668
|
+
if (!origin || (origin !== target && !origin.contains(target))) {
|
|
2669
|
+
this.overlayOutsideClick.next(event);
|
|
2670
|
+
}
|
|
2667
2671
|
});
|
|
2668
2672
|
}
|
|
2669
2673
|
/** Builds the overlay config based on the directive's inputs */
|
|
@@ -2709,7 +2713,7 @@ class CdkConnectedOverlay {
|
|
|
2709
2713
|
panelClass: currentPosition.panelClass || undefined,
|
|
2710
2714
|
}));
|
|
2711
2715
|
return positionStrategy
|
|
2712
|
-
.setOrigin(this.
|
|
2716
|
+
.setOrigin(this._getOrigin())
|
|
2713
2717
|
.withPositions(positions)
|
|
2714
2718
|
.withFlexibleDimensions(this.flexibleDimensions)
|
|
2715
2719
|
.withPush(this.push)
|
|
@@ -2720,13 +2724,11 @@ class CdkConnectedOverlay {
|
|
|
2720
2724
|
}
|
|
2721
2725
|
/** Returns the position strategy of the overlay to be set on the overlay config */
|
|
2722
2726
|
_createPositionStrategy() {
|
|
2723
|
-
const strategy = this._overlay
|
|
2724
|
-
.position()
|
|
2725
|
-
.flexibleConnectedTo(this._getFlexibleConnectedPositionStrategyOrigin());
|
|
2727
|
+
const strategy = this._overlay.position().flexibleConnectedTo(this._getOrigin());
|
|
2726
2728
|
this._updatePositionStrategy(strategy);
|
|
2727
2729
|
return strategy;
|
|
2728
2730
|
}
|
|
2729
|
-
|
|
2731
|
+
_getOrigin() {
|
|
2730
2732
|
if (this.origin instanceof CdkOverlayOrigin) {
|
|
2731
2733
|
return this.origin.elementRef;
|
|
2732
2734
|
}
|
|
@@ -2734,6 +2736,18 @@ class CdkConnectedOverlay {
|
|
|
2734
2736
|
return this.origin;
|
|
2735
2737
|
}
|
|
2736
2738
|
}
|
|
2739
|
+
_getOriginElement() {
|
|
2740
|
+
if (this.origin instanceof CdkOverlayOrigin) {
|
|
2741
|
+
return this.origin.elementRef.nativeElement;
|
|
2742
|
+
}
|
|
2743
|
+
if (this.origin instanceof ElementRef) {
|
|
2744
|
+
return this.origin.nativeElement;
|
|
2745
|
+
}
|
|
2746
|
+
if (typeof Element !== 'undefined' && this.origin instanceof Element) {
|
|
2747
|
+
return this.origin;
|
|
2748
|
+
}
|
|
2749
|
+
return null;
|
|
2750
|
+
}
|
|
2737
2751
|
/** Attaches the overlay and subscribes to backdrop clicks if backdrop exists */
|
|
2738
2752
|
_attachOverlay() {
|
|
2739
2753
|
if (!this._overlayRef) {
|