@angular/cdk 12.1.1 → 12.1.2
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/a11y/index.metadata.json +1 -1
- package/a11y/input-modality/input-modality-detector.d.ts +0 -2
- package/bundles/cdk-a11y.umd.js +11 -16
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +51 -38
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +1 -2
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.js +7 -0
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +3 -3
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-table.umd.js +25 -9
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.js.map +1 -1
- package/bundles/cdk-testing-selenium-webdriver.umd.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.js +4 -2
- package/bundles/cdk-testing-testbed.umd.js.map +1 -1
- package/bundles/cdk-testing.umd.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/drag-drop/drag-styling.d.ts +5 -10
- package/drag-drop/index.metadata.json +1 -1
- package/drag-drop/parent-position-tracker.d.ts +0 -2
- package/esm2015/a11y/fake-event-detection.js +7 -6
- package/esm2015/a11y/focus-monitor/focus-monitor.js +5 -5
- package/esm2015/a11y/input-modality/input-modality-detector.js +5 -11
- package/esm2015/drag-drop/drag-ref.js +25 -17
- package/esm2015/drag-drop/drag-styling.js +26 -16
- package/esm2015/drag-drop/parent-position-tracker.js +3 -6
- package/esm2015/overlay/dispatchers/overlay-outside-click-dispatcher.js +3 -4
- package/esm2015/platform/features/shadow-dom.js +7 -1
- package/esm2015/scrolling/viewport-ruler.js +4 -4
- package/esm2015/table/cell.js +16 -4
- package/esm2015/table/table.js +2 -2
- package/esm2015/testing/protractor/protractor-element.js +1 -1
- package/esm2015/testing/selenium-webdriver/selenium-web-driver-element.js +1 -1
- package/esm2015/testing/test-element.js +1 -1
- package/esm2015/testing/testbed/fake-events/event-objects.js +5 -3
- package/esm2015/testing/testbed/unit-test-element.js +1 -1
- package/esm2015/version.js +1 -1
- package/fesm2015/a11y.js +12 -17
- package/fesm2015/a11y.js.map +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/drag-drop.js +49 -35
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/overlay.js +2 -3
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/platform.js +7 -1
- package/fesm2015/platform.js.map +1 -1
- package/fesm2015/scrolling.js +3 -3
- package/fesm2015/scrolling.js.map +1 -1
- package/fesm2015/table.js +15 -3
- package/fesm2015/table.js.map +1 -1
- package/fesm2015/testing/protractor.js.map +1 -1
- package/fesm2015/testing/selenium-webdriver.js.map +1 -1
- package/fesm2015/testing/testbed.js +4 -2
- package/fesm2015/testing/testbed.js.map +1 -1
- package/fesm2015/testing.js.map +1 -1
- package/package.json +1 -1
- package/platform/features/shadow-dom.d.ts +2 -0
- package/platform/index.metadata.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-update/devkit-migration-rule.js +1 -1
- package/schematics/ng-update/devkit-migration-rule.mjs +1 -1
- package/schematics/ng-update/html-parsing/elements.js +3 -2
- package/schematics/ng-update/html-parsing/elements.mjs +3 -2
- package/schematics/ng-update/typescript/base-types.js +2 -2
- package/schematics/ng-update/typescript/base-types.mjs +2 -2
- package/schematics/tsconfig.json +1 -0
- package/schematics/update-tool/migration.d.ts +2 -2
- package/schematics/update-tool/migration.js +1 -1
- package/schematics/update-tool/migration.mjs +1 -1
- package/schematics/utils/build-component.js +7 -8
- package/schematics/utils/build-component.mjs +7 -8
- package/table/index.metadata.json +1 -1
- package/testing/protractor/protractor-element.d.ts +1 -1
- package/testing/selenium-webdriver/selenium-web-driver-element.d.ts +1 -1
- package/testing/test-element.d.ts +1 -1
- package/testing/testbed/unit-test-element.d.ts +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/cdk/scrolling'), require('@angular/cdk/platform'), require('@angular/cdk/coercion'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/bidi')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@angular/cdk/drag-drop', ['exports', '@angular/core', '@angular/common', '@angular/cdk/scrolling', '@angular/cdk/platform', '@angular/cdk/coercion', 'rxjs', 'rxjs/operators', '@angular/cdk/bidi'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.cdk = global.ng.cdk || {}, global.ng.cdk.dragDrop = {}), global.ng.core, global.ng.common, global.ng.cdk.scrolling, global.ng.cdk.platform, global.ng.cdk.coercion, global.rxjs, global.rxjs.operators, global.ng.cdk.bidi));
|
|
5
|
-
}(this, (function (exports, i0, i1, i2, platform, coercion, rxjs, operators, bidi) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/cdk/scrolling'), require('@angular/cdk/platform'), require('@angular/cdk/coercion'), require('@angular/cdk/a11y'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/bidi')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@angular/cdk/drag-drop', ['exports', '@angular/core', '@angular/common', '@angular/cdk/scrolling', '@angular/cdk/platform', '@angular/cdk/coercion', '@angular/cdk/a11y', 'rxjs', 'rxjs/operators', '@angular/cdk/bidi'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.cdk = global.ng.cdk || {}, global.ng.cdk.dragDrop = {}), global.ng.core, global.ng.common, global.ng.cdk.scrolling, global.ng.cdk.platform, global.ng.cdk.coercion, global.ng.cdk.a11y, global.rxjs, global.rxjs.operators, global.ng.cdk.bidi));
|
|
5
|
+
}(this, (function (exports, i0, i1, i2, platform, coercion, a11y, rxjs, operators, bidi) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -36,13 +36,20 @@
|
|
|
36
36
|
* found in the LICENSE file at https://angular.io/license
|
|
37
37
|
*/
|
|
38
38
|
/**
|
|
39
|
-
* Shallow-extends a stylesheet object with another stylesheet object.
|
|
39
|
+
* Shallow-extends a stylesheet object with another stylesheet-like object.
|
|
40
|
+
* Note that the keys in `source` have to be dash-cased.
|
|
40
41
|
* @docs-private
|
|
41
42
|
*/
|
|
42
|
-
function extendStyles(dest, source) {
|
|
43
|
+
function extendStyles(dest, source, importantProperties) {
|
|
43
44
|
for (var key in source) {
|
|
44
45
|
if (source.hasOwnProperty(key)) {
|
|
45
|
-
|
|
46
|
+
var value = source[key];
|
|
47
|
+
if (value) {
|
|
48
|
+
dest.setProperty(key, value, (importantProperties === null || importantProperties === void 0 ? void 0 : importantProperties.has(key)) ? 'important' : '');
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
dest.removeProperty(key);
|
|
52
|
+
}
|
|
46
53
|
}
|
|
47
54
|
}
|
|
48
55
|
return dest;
|
|
@@ -56,26 +63,29 @@
|
|
|
56
63
|
function toggleNativeDragInteractions(element, enable) {
|
|
57
64
|
var userSelect = enable ? '' : 'none';
|
|
58
65
|
extendStyles(element.style, {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
'touch-action': enable ? '' : 'none',
|
|
67
|
+
'-webkit-user-drag': enable ? '' : 'none',
|
|
68
|
+
'-webkit-tap-highlight-color': enable ? '' : 'transparent',
|
|
69
|
+
'user-select': userSelect,
|
|
70
|
+
'-ms-user-select': userSelect,
|
|
71
|
+
'-webkit-user-select': userSelect,
|
|
72
|
+
'-moz-user-select': userSelect
|
|
66
73
|
});
|
|
67
74
|
}
|
|
68
75
|
/**
|
|
69
76
|
* Toggles whether an element is visible while preserving its dimensions.
|
|
70
77
|
* @param element Element whose visibility to toggle
|
|
71
78
|
* @param enable Whether the element should be visible.
|
|
79
|
+
* @param importantProperties Properties to be set as `!important`.
|
|
72
80
|
* @docs-private
|
|
73
81
|
*/
|
|
74
|
-
function toggleVisibility(element, enable) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
function toggleVisibility(element, enable, importantProperties) {
|
|
83
|
+
extendStyles(element.style, {
|
|
84
|
+
position: enable ? '' : 'fixed',
|
|
85
|
+
top: enable ? '' : '0',
|
|
86
|
+
opacity: enable ? '' : '0',
|
|
87
|
+
left: enable ? '' : '-999em'
|
|
88
|
+
}, importantProperties);
|
|
79
89
|
}
|
|
80
90
|
/**
|
|
81
91
|
* Combines a transform string with an optional other transform
|
|
@@ -216,7 +226,7 @@
|
|
|
216
226
|
};
|
|
217
227
|
/** Handles scrolling while a drag is taking place. */
|
|
218
228
|
ParentPositionTracker.prototype.handleScroll = function (event) {
|
|
219
|
-
var target =
|
|
229
|
+
var target = platform._getEventTarget(event);
|
|
220
230
|
var cachedPosition = this.positions.get(target);
|
|
221
231
|
if (!cachedPosition) {
|
|
222
232
|
return null;
|
|
@@ -252,10 +262,6 @@
|
|
|
252
262
|
};
|
|
253
263
|
return ParentPositionTracker;
|
|
254
264
|
}());
|
|
255
|
-
/** Gets the target of an event while accounting for shadow dom. */
|
|
256
|
-
function getEventTarget(event) {
|
|
257
|
-
return (event.composedPath ? event.composedPath()[0] : event.target);
|
|
258
|
-
}
|
|
259
265
|
|
|
260
266
|
/**
|
|
261
267
|
* @license
|
|
@@ -340,6 +346,11 @@
|
|
|
340
346
|
* addition to touch events.
|
|
341
347
|
*/
|
|
342
348
|
var MOUSE_EVENT_IGNORE_TIME = 800;
|
|
349
|
+
/** Inline styles to be set as `!important` while dragging. */
|
|
350
|
+
var dragImportantProperties = new Set([
|
|
351
|
+
// Needs to be important, because some `mat-table` sets `position: sticky !important`. See #22781.
|
|
352
|
+
'position'
|
|
353
|
+
]);
|
|
343
354
|
/**
|
|
344
355
|
* Reference to a draggable item. Used to manipulate or dispose of the item.
|
|
345
356
|
*/
|
|
@@ -416,7 +427,7 @@
|
|
|
416
427
|
// Delegate the event based on whether it started from a handle or the element itself.
|
|
417
428
|
if (_this._handles.length) {
|
|
418
429
|
var targetHandle = _this._handles.find(function (handle) {
|
|
419
|
-
var target =
|
|
430
|
+
var target = platform._getEventTarget(event);
|
|
420
431
|
return !!target && (target === handle || handle.contains(target));
|
|
421
432
|
});
|
|
422
433
|
if (targetHandle && !_this._disabledHandles.has(targetHandle) && !_this.disabled) {
|
|
@@ -831,7 +842,7 @@
|
|
|
831
842
|
// We move the element out at the end of the body and we make it hidden, because keeping it in
|
|
832
843
|
// place will throw off the consumer's `:last-child` selectors. We can't remove the element
|
|
833
844
|
// from the DOM completely, because iOS will stop firing all subsequent events in the chain.
|
|
834
|
-
toggleVisibility(element, false);
|
|
845
|
+
toggleVisibility(element, false, dragImportantProperties);
|
|
835
846
|
this._document.body.appendChild(parent.replaceChild(placeholder, element));
|
|
836
847
|
this._getPreviewInsertionPoint(parent, shadowRoot).appendChild(this._preview);
|
|
837
848
|
this.started.next({ source: this }); // Emit before notifying the container.
|
|
@@ -864,9 +875,11 @@
|
|
|
864
875
|
var isTouchSequence = isTouchEvent(event);
|
|
865
876
|
var isAuxiliaryMouseButton = !isTouchSequence && event.button !== 0;
|
|
866
877
|
var rootElement = this._rootElement;
|
|
867
|
-
var target =
|
|
878
|
+
var target = platform._getEventTarget(event);
|
|
868
879
|
var isSyntheticEvent = !isTouchSequence && this._lastTouchEventTime &&
|
|
869
880
|
this._lastTouchEventTime + MOUSE_EVENT_IGNORE_TIME > Date.now();
|
|
881
|
+
var isFakeEvent = isTouchSequence ? a11y.isFakeTouchstartFromScreenReader(event) :
|
|
882
|
+
a11y.isFakeMousedownFromScreenReader(event);
|
|
870
883
|
// If the event started from an element with the native HTML drag&drop, it'll interfere
|
|
871
884
|
// with our own dragging (e.g. `img` tags do it by default). Prevent the default action
|
|
872
885
|
// to stop it from happening. Note that preventing on `dragstart` also seems to work, but
|
|
@@ -877,7 +890,7 @@
|
|
|
877
890
|
event.preventDefault();
|
|
878
891
|
}
|
|
879
892
|
// Abort if the user is already dragging or is using a mouse button other than the primary one.
|
|
880
|
-
if (isDragging || isAuxiliaryMouseButton || isSyntheticEvent) {
|
|
893
|
+
if (isDragging || isAuxiliaryMouseButton || isSyntheticEvent || isFakeEvent) {
|
|
881
894
|
return;
|
|
882
895
|
}
|
|
883
896
|
// If we've got handles, we need to disable the tap highlight on the entire root element,
|
|
@@ -920,7 +933,7 @@
|
|
|
920
933
|
// It's important that we maintain the position, because moving the element around in the DOM
|
|
921
934
|
// can throw off `NgFor` which does smart diffing and re-creates elements only when necessary,
|
|
922
935
|
// while moving the existing elements in all other cases.
|
|
923
|
-
toggleVisibility(this._rootElement, true);
|
|
936
|
+
toggleVisibility(this._rootElement, true, dragImportantProperties);
|
|
924
937
|
this._anchor.parentNode.replaceChild(this._rootElement, this._anchor);
|
|
925
938
|
this._destroyPreview();
|
|
926
939
|
this._destroyPlaceholder();
|
|
@@ -1026,14 +1039,14 @@
|
|
|
1026
1039
|
extendStyles(preview.style, {
|
|
1027
1040
|
// It's important that we disable the pointer events on the preview, because
|
|
1028
1041
|
// it can throw off the `document.elementFromPoint` calls in the `CdkDropList`.
|
|
1029
|
-
|
|
1042
|
+
'pointer-events': 'none',
|
|
1030
1043
|
// We have to reset the margin, because it can throw off positioning relative to the viewport.
|
|
1031
|
-
margin: '0',
|
|
1032
|
-
position: 'fixed',
|
|
1033
|
-
top: '0',
|
|
1034
|
-
left: '0',
|
|
1035
|
-
|
|
1036
|
-
});
|
|
1044
|
+
'margin': '0',
|
|
1045
|
+
'position': 'fixed',
|
|
1046
|
+
'top': '0',
|
|
1047
|
+
'left': '0',
|
|
1048
|
+
'z-index': "" + (this._config.zIndex || 1000)
|
|
1049
|
+
}, dragImportantProperties);
|
|
1037
1050
|
toggleNativeDragInteractions(preview, false);
|
|
1038
1051
|
preview.classList.add('cdk-drag-preview');
|
|
1039
1052
|
preview.setAttribute('dir', this._direction);
|
|
@@ -1073,7 +1086,7 @@
|
|
|
1073
1086
|
return this._ngZone.runOutsideAngular(function () {
|
|
1074
1087
|
return new Promise(function (resolve) {
|
|
1075
1088
|
var handler = (function (event) {
|
|
1076
|
-
if (!event || (
|
|
1089
|
+
if (!event || (platform._getEventTarget(event) === _this._preview &&
|
|
1077
1090
|
event.propertyName === 'transform')) {
|
|
1078
1091
|
_this._preview.removeEventListener('transitionend', handler);
|
|
1079
1092
|
resolve();
|
|
@@ -1322,7 +1335,7 @@
|
|
|
1322
1335
|
DragRef.prototype._updateOnScroll = function (event) {
|
|
1323
1336
|
var scrollDifference = this._parentPositions.handleScroll(event);
|
|
1324
1337
|
if (scrollDifference) {
|
|
1325
|
-
var target =
|
|
1338
|
+
var target = platform._getEventTarget(event);
|
|
1326
1339
|
// ClientRect dimensions are based on the scroll position of the page and its parent node so
|
|
1327
1340
|
// we have to update the cached boundary ClientRect if the user has scrolled. Check for
|
|
1328
1341
|
// the `document` specifically since IE doesn't support `contains` on it.
|