@angular/cdk 19.1.3 → 19.1.4
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/fesm2022/cdk.mjs +1 -1
- package/fesm2022/cdk.mjs.map +1 -1
- package/fesm2022/overlay.mjs +57 -68
- package/fesm2022/overlay.mjs.map +1 -1
- package/fesm2022/table.mjs +13 -14
- package/fesm2022/table.mjs.map +1 -1
- package/overlay/index.d.ts +1 -6
- package/package.json +6 -2
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
package/fesm2022/cdk.mjs
CHANGED
package/fesm2022/cdk.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk.mjs","sources":["../../../../../../src/cdk/version.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 */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('19.1.
|
|
1
|
+
{"version":3,"file":"cdk.mjs","sources":["../../../../../../src/cdk/version.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 */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('19.1.4');\n"],"names":[],"mappings":";;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;;;"}
|
package/fesm2022/overlay.mjs
CHANGED
|
@@ -752,6 +752,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImpor
|
|
|
752
752
|
args: [{ providedIn: 'root' }]
|
|
753
753
|
}], ctorParameters: () => [] });
|
|
754
754
|
|
|
755
|
+
/** Encapsulates the logic for attaching and detaching a backdrop. */
|
|
756
|
+
class BackdropRef {
|
|
757
|
+
_renderer;
|
|
758
|
+
_ngZone;
|
|
759
|
+
element;
|
|
760
|
+
_cleanupClick;
|
|
761
|
+
_cleanupTransitionEnd;
|
|
762
|
+
_fallbackTimeout;
|
|
763
|
+
constructor(document, _renderer, _ngZone, onClick) {
|
|
764
|
+
this._renderer = _renderer;
|
|
765
|
+
this._ngZone = _ngZone;
|
|
766
|
+
this.element = document.createElement('div');
|
|
767
|
+
this.element.classList.add('cdk-overlay-backdrop');
|
|
768
|
+
this._cleanupClick = _renderer.listen(this.element, 'click', onClick);
|
|
769
|
+
}
|
|
770
|
+
detach() {
|
|
771
|
+
this._ngZone.runOutsideAngular(() => {
|
|
772
|
+
const element = this.element;
|
|
773
|
+
clearTimeout(this._fallbackTimeout);
|
|
774
|
+
this._cleanupTransitionEnd?.();
|
|
775
|
+
this._cleanupTransitionEnd = this._renderer.listen(element, 'transitionend', this.dispose);
|
|
776
|
+
this._fallbackTimeout = setTimeout(this.dispose, 500);
|
|
777
|
+
// If the backdrop doesn't have a transition, the `transitionend` event won't fire.
|
|
778
|
+
// In this case we make it unclickable and we try to remove it after a delay.
|
|
779
|
+
element.style.pointerEvents = 'none';
|
|
780
|
+
element.classList.remove('cdk-overlay-backdrop-showing');
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
dispose = () => {
|
|
784
|
+
clearTimeout(this._fallbackTimeout);
|
|
785
|
+
this._cleanupClick?.();
|
|
786
|
+
this._cleanupTransitionEnd?.();
|
|
787
|
+
this._cleanupClick = this._cleanupTransitionEnd = this._fallbackTimeout = undefined;
|
|
788
|
+
this.element.remove();
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
|
|
755
792
|
/**
|
|
756
793
|
* Reference to an overlay that has been created with the Overlay service.
|
|
757
794
|
* Used to manipulate or dispose of said overlay.
|
|
@@ -769,16 +806,13 @@ class OverlayRef {
|
|
|
769
806
|
_animationsDisabled;
|
|
770
807
|
_injector;
|
|
771
808
|
_renderer;
|
|
772
|
-
_backdropElement = null;
|
|
773
|
-
_backdropTimeout;
|
|
774
809
|
_backdropClick = new Subject();
|
|
775
810
|
_attachments = new Subject();
|
|
776
811
|
_detachments = new Subject();
|
|
777
812
|
_positionStrategy;
|
|
778
813
|
_scrollStrategy;
|
|
779
814
|
_locationChanges = Subscription.EMPTY;
|
|
780
|
-
|
|
781
|
-
_cleanupBackdropTransitionEnd;
|
|
815
|
+
_backdropRef = null;
|
|
782
816
|
/**
|
|
783
817
|
* Reference to the parent of the `_host` at the time it was detached. Used to restore
|
|
784
818
|
* the `_host` to its original position in the DOM when it gets re-attached.
|
|
@@ -823,7 +857,7 @@ class OverlayRef {
|
|
|
823
857
|
}
|
|
824
858
|
/** The overlay's backdrop HTML element. */
|
|
825
859
|
get backdropElement() {
|
|
826
|
-
return this.
|
|
860
|
+
return this._backdropRef?.element || null;
|
|
827
861
|
}
|
|
828
862
|
/**
|
|
829
863
|
* Wrapper around the panel element. Can be used for advanced
|
|
@@ -942,7 +976,7 @@ class OverlayRef {
|
|
|
942
976
|
this._positionStrategy.dispose();
|
|
943
977
|
}
|
|
944
978
|
this._disposeScrollStrategy();
|
|
945
|
-
this.
|
|
979
|
+
this._backdropRef?.dispose();
|
|
946
980
|
this._locationChanges.unsubscribe();
|
|
947
981
|
this._keyboardDispatcher.remove(this);
|
|
948
982
|
this._portalOutlet.dispose();
|
|
@@ -953,7 +987,7 @@ class OverlayRef {
|
|
|
953
987
|
this._outsideClickDispatcher.remove(this);
|
|
954
988
|
this._host?.remove();
|
|
955
989
|
this._afterNextRenderRef?.destroy();
|
|
956
|
-
this._previousHostParent = this._pane = this._host = null;
|
|
990
|
+
this._previousHostParent = this._pane = this._host = this._backdropRef = null;
|
|
957
991
|
if (isAttached) {
|
|
958
992
|
this._detachments.next();
|
|
959
993
|
}
|
|
@@ -1077,33 +1111,27 @@ class OverlayRef {
|
|
|
1077
1111
|
/** Attaches a backdrop for this overlay. */
|
|
1078
1112
|
_attachBackdrop() {
|
|
1079
1113
|
const showingClass = 'cdk-overlay-backdrop-showing';
|
|
1080
|
-
this.
|
|
1081
|
-
this.
|
|
1114
|
+
this._backdropRef?.dispose();
|
|
1115
|
+
this._backdropRef = new BackdropRef(this._document, this._renderer, this._ngZone, event => {
|
|
1116
|
+
this._backdropClick.next(event);
|
|
1117
|
+
});
|
|
1082
1118
|
if (this._animationsDisabled) {
|
|
1083
|
-
this.
|
|
1119
|
+
this._backdropRef.element.classList.add('cdk-overlay-backdrop-noop-animation');
|
|
1084
1120
|
}
|
|
1085
1121
|
if (this._config.backdropClass) {
|
|
1086
|
-
this._toggleClasses(this.
|
|
1122
|
+
this._toggleClasses(this._backdropRef.element, this._config.backdropClass, true);
|
|
1087
1123
|
}
|
|
1088
1124
|
// Insert the backdrop before the pane in the DOM order,
|
|
1089
1125
|
// in order to handle stacked overlays properly.
|
|
1090
|
-
this._host.parentElement.insertBefore(this.
|
|
1091
|
-
// Forward backdrop clicks such that the consumer of the overlay can perform whatever
|
|
1092
|
-
// action desired when such a click occurs (usually closing the overlay).
|
|
1093
|
-
this._cleanupBackdropClick?.();
|
|
1094
|
-
this._cleanupBackdropClick = this._renderer.listen(this._backdropElement, 'click', (event) => this._backdropClick.next(event));
|
|
1126
|
+
this._host.parentElement.insertBefore(this._backdropRef.element, this._host);
|
|
1095
1127
|
// Add class to fade-in the backdrop after one frame.
|
|
1096
1128
|
if (!this._animationsDisabled && typeof requestAnimationFrame !== 'undefined') {
|
|
1097
1129
|
this._ngZone.runOutsideAngular(() => {
|
|
1098
|
-
requestAnimationFrame(() =>
|
|
1099
|
-
if (this._backdropElement) {
|
|
1100
|
-
this._backdropElement.classList.add(showingClass);
|
|
1101
|
-
}
|
|
1102
|
-
});
|
|
1130
|
+
requestAnimationFrame(() => this._backdropRef?.element.classList.add(showingClass));
|
|
1103
1131
|
});
|
|
1104
1132
|
}
|
|
1105
1133
|
else {
|
|
1106
|
-
this.
|
|
1134
|
+
this._backdropRef.element.classList.add(showingClass);
|
|
1107
1135
|
}
|
|
1108
1136
|
}
|
|
1109
1137
|
/**
|
|
@@ -1120,30 +1148,13 @@ class OverlayRef {
|
|
|
1120
1148
|
}
|
|
1121
1149
|
/** Detaches the backdrop (if any) associated with the overlay. */
|
|
1122
1150
|
detachBackdrop() {
|
|
1123
|
-
const backdropToDetach = this._backdropElement;
|
|
1124
|
-
if (!backdropToDetach) {
|
|
1125
|
-
return;
|
|
1126
|
-
}
|
|
1127
1151
|
if (this._animationsDisabled) {
|
|
1128
|
-
this.
|
|
1129
|
-
|
|
1152
|
+
this._backdropRef?.dispose();
|
|
1153
|
+
this._backdropRef = null;
|
|
1154
|
+
}
|
|
1155
|
+
else {
|
|
1156
|
+
this._backdropRef?.detach();
|
|
1130
1157
|
}
|
|
1131
|
-
backdropToDetach.classList.remove('cdk-overlay-backdrop-showing');
|
|
1132
|
-
this._ngZone.runOutsideAngular(() => {
|
|
1133
|
-
this._cleanupBackdropTransitionEnd?.();
|
|
1134
|
-
this._cleanupBackdropTransitionEnd = this._renderer.listen(backdropToDetach, 'transitionend', (event) => {
|
|
1135
|
-
this._disposeBackdrop(event.target);
|
|
1136
|
-
});
|
|
1137
|
-
});
|
|
1138
|
-
// If the backdrop doesn't have a transition, the `transitionend` event won't fire.
|
|
1139
|
-
// In this case we make it unclickable and we try to remove it after a delay.
|
|
1140
|
-
backdropToDetach.style.pointerEvents = 'none';
|
|
1141
|
-
// Run this outside the Angular zone because there's nothing that Angular cares about.
|
|
1142
|
-
// If it were to run inside the Angular zone, every test that used Overlay would have to be
|
|
1143
|
-
// either async or fakeAsync.
|
|
1144
|
-
this._backdropTimeout = this._ngZone.runOutsideAngular(() => setTimeout(() => {
|
|
1145
|
-
this._disposeBackdrop(backdropToDetach);
|
|
1146
|
-
}, 500));
|
|
1147
1158
|
}
|
|
1148
1159
|
/** Toggles a single CSS class or an array of classes on an element. */
|
|
1149
1160
|
_toggleClasses(element, cssClasses, isAdd) {
|
|
@@ -1182,30 +1193,8 @@ class OverlayRef {
|
|
|
1182
1193
|
/** Disposes of a scroll strategy. */
|
|
1183
1194
|
_disposeScrollStrategy() {
|
|
1184
1195
|
const scrollStrategy = this._scrollStrategy;
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
if (scrollStrategy.detach) {
|
|
1188
|
-
scrollStrategy.detach();
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
/** Removes a backdrop element from the DOM. */
|
|
1193
|
-
_disposeBackdrop(backdrop) {
|
|
1194
|
-
this._cleanupBackdropClick?.();
|
|
1195
|
-
this._cleanupBackdropTransitionEnd?.();
|
|
1196
|
-
if (backdrop) {
|
|
1197
|
-
backdrop.remove();
|
|
1198
|
-
// It is possible that a new portal has been attached to this overlay since we started
|
|
1199
|
-
// removing the backdrop. If that is the case, only clear the backdrop reference if it
|
|
1200
|
-
// is still the same instance that we started to remove.
|
|
1201
|
-
if (this._backdropElement === backdrop) {
|
|
1202
|
-
this._backdropElement = null;
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
if (this._backdropTimeout) {
|
|
1206
|
-
clearTimeout(this._backdropTimeout);
|
|
1207
|
-
this._backdropTimeout = undefined;
|
|
1208
|
-
}
|
|
1196
|
+
scrollStrategy?.disable();
|
|
1197
|
+
scrollStrategy?.detach?.();
|
|
1209
1198
|
}
|
|
1210
1199
|
}
|
|
1211
1200
|
|