@angular/cdk 13.2.2 → 13.2.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/a11y/a11y-module.d.ts +2 -3
- package/drag-drop/drag-ref.d.ts +3 -1
- package/drag-drop/parent-position-tracker.d.ts +11 -3
- package/esm2020/a11y/a11y-module.mjs +4 -5
- package/esm2020/drag-drop/drag-ref.mjs +27 -17
- package/esm2020/drag-drop/drop-list-ref.mjs +2 -2
- package/esm2020/drag-drop/parent-position-tracker.mjs +13 -5
- package/esm2020/overlay/dispatchers/overlay-keyboard-dispatcher.mjs +24 -6
- package/esm2020/overlay/dispatchers/overlay-outside-click-dispatcher.mjs +31 -10
- package/esm2020/scrolling/scrolling-module.mjs +4 -5
- package/esm2020/testing/protractor/protractor-element.mjs +8 -3
- package/esm2020/testing/public-api.mjs +2 -1
- package/esm2020/testing/selenium-webdriver/selenium-web-driver-element.mjs +8 -3
- package/esm2020/testing/test-element-errors.mjs +15 -0
- package/esm2020/testing/test-element.mjs +1 -1
- package/esm2020/testing/testbed/fake-events/type-in-element.mjs +12 -3
- package/esm2020/testing/testbed/unit-test-element.mjs +19 -5
- package/esm2020/text-field/text-field-module.mjs +3 -5
- package/esm2020/version.mjs +1 -1
- package/fesm2015/a11y.mjs +4 -4
- package/fesm2015/a11y.mjs.map +1 -1
- package/fesm2015/cdk.mjs +1 -1
- package/fesm2015/cdk.mjs.map +1 -1
- package/fesm2015/drag-drop.mjs +40 -21
- package/fesm2015/drag-drop.mjs.map +1 -1
- package/fesm2015/overlay.mjs +52 -13
- package/fesm2015/overlay.mjs.map +1 -1
- package/fesm2015/scrolling.mjs +4 -4
- package/fesm2015/scrolling.mjs.map +1 -1
- package/fesm2015/testing/protractor.mjs +7 -2
- package/fesm2015/testing/protractor.mjs.map +1 -1
- package/fesm2015/testing/selenium-webdriver.mjs +7 -2
- package/fesm2015/testing/selenium-webdriver.mjs.map +1 -1
- package/fesm2015/testing/testbed.mjs +29 -7
- package/fesm2015/testing/testbed.mjs.map +1 -1
- package/fesm2015/testing.mjs +16 -1
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2015/text-field.mjs +3 -4
- package/fesm2015/text-field.mjs.map +1 -1
- package/fesm2020/a11y.mjs +4 -4
- package/fesm2020/a11y.mjs.map +1 -1
- package/fesm2020/cdk.mjs +1 -1
- package/fesm2020/cdk.mjs.map +1 -1
- package/fesm2020/drag-drop.mjs +39 -21
- package/fesm2020/drag-drop.mjs.map +1 -1
- package/fesm2020/overlay.mjs +52 -13
- package/fesm2020/overlay.mjs.map +1 -1
- package/fesm2020/scrolling.mjs +4 -4
- package/fesm2020/scrolling.mjs.map +1 -1
- package/fesm2020/testing/protractor.mjs +7 -2
- package/fesm2020/testing/protractor.mjs.map +1 -1
- package/fesm2020/testing/selenium-webdriver.mjs +7 -2
- package/fesm2020/testing/selenium-webdriver.mjs.map +1 -1
- package/fesm2020/testing/testbed.mjs +29 -7
- package/fesm2020/testing/testbed.mjs.map +1 -1
- package/fesm2020/testing.mjs +16 -1
- package/fesm2020/testing.mjs.map +1 -1
- package/fesm2020/text-field.mjs +3 -4
- package/fesm2020/text-field.mjs.map +1 -1
- package/overlay/dispatchers/overlay-keyboard-dispatcher.d.ts +7 -2
- package/overlay/dispatchers/overlay-outside-click-dispatcher.d.ts +8 -2
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/scrolling/scrolling-module.d.ts +1 -2
- package/testing/public-api.d.ts +1 -0
- package/testing/test-element-errors.d.ts +12 -0
- package/testing/test-element.d.ts +4 -2
- package/testing/testbed/fake-events/type-in-element.d.ts +2 -2
- package/testing/testbed/unit-test-element.d.ts +4 -1
- package/text-field/text-field-module.d.ts +1 -2
package/fesm2015/cdk.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { Version } from '@angular/core';
|
|
|
8
8
|
* found in the LICENSE file at https://angular.io/license
|
|
9
9
|
*/
|
|
10
10
|
/** Current version of the Angular Component Development Kit. */
|
|
11
|
-
const VERSION = new Version('13.2.
|
|
11
|
+
const VERSION = new Version('13.2.5');
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
package/fesm2015/cdk.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk.mjs","sources":["../../../../../../src/cdk/version.ts","../../../../../../src/cdk/public-api.ts","../../../../../../src/cdk/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 */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('13.2.
|
|
1
|
+
{"version":3,"file":"cdk.mjs","sources":["../../../../../../src/cdk/version.ts","../../../../../../src/cdk/public-api.ts","../../../../../../src/cdk/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 */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('13.2.5');\n","/**\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 */\n\nexport * from './version';\n","/**\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 */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;;;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;ACXtD;;;;;;;;ACAA;;;;;;;;;;"}
|
package/fesm2015/drag-drop.mjs
CHANGED
|
@@ -188,9 +188,8 @@ function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
|
|
|
188
188
|
*/
|
|
189
189
|
/** Keeps track of the scroll position and dimensions of the parents of an element. */
|
|
190
190
|
class ParentPositionTracker {
|
|
191
|
-
constructor(_document
|
|
191
|
+
constructor(_document) {
|
|
192
192
|
this._document = _document;
|
|
193
|
-
this._viewportRuler = _viewportRuler;
|
|
194
193
|
/** Cached positions of the scrollable parent elements. */
|
|
195
194
|
this.positions = new Map();
|
|
196
195
|
}
|
|
@@ -202,7 +201,7 @@ class ParentPositionTracker {
|
|
|
202
201
|
cache(elements) {
|
|
203
202
|
this.clear();
|
|
204
203
|
this.positions.set(this._document, {
|
|
205
|
-
scrollPosition: this.
|
|
204
|
+
scrollPosition: this.getViewportScrollPosition(),
|
|
206
205
|
});
|
|
207
206
|
elements.forEach(element => {
|
|
208
207
|
this.positions.set(element, {
|
|
@@ -222,7 +221,7 @@ class ParentPositionTracker {
|
|
|
222
221
|
let newTop;
|
|
223
222
|
let newLeft;
|
|
224
223
|
if (target === this._document) {
|
|
225
|
-
const viewportScrollPosition = this.
|
|
224
|
+
const viewportScrollPosition = this.getViewportScrollPosition();
|
|
226
225
|
newTop = viewportScrollPosition.top;
|
|
227
226
|
newLeft = viewportScrollPosition.left;
|
|
228
227
|
}
|
|
@@ -243,6 +242,15 @@ class ParentPositionTracker {
|
|
|
243
242
|
scrollPosition.left = newLeft;
|
|
244
243
|
return { top: topDifference, left: leftDifference };
|
|
245
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Gets the scroll position of the viewport. Note that we use the scrollX and scrollY directly,
|
|
247
|
+
* instead of going through the `ViewportRuler`, because the first value the ruler looks at is
|
|
248
|
+
* the top/left offset of the `document.documentElement` which works for most cases, but breaks
|
|
249
|
+
* if the element is offset by something like the `BlockScrollStrategy`.
|
|
250
|
+
*/
|
|
251
|
+
getViewportScrollPosition() {
|
|
252
|
+
return { top: window.scrollY, left: window.scrollX };
|
|
253
|
+
}
|
|
246
254
|
}
|
|
247
255
|
|
|
248
256
|
/**
|
|
@@ -449,14 +457,6 @@ class DragRef {
|
|
|
449
457
|
}
|
|
450
458
|
return;
|
|
451
459
|
}
|
|
452
|
-
// We only need the preview dimensions if we have a boundary element.
|
|
453
|
-
if (this._boundaryElement) {
|
|
454
|
-
// Cache the preview element rect if we haven't cached it already or if
|
|
455
|
-
// we cached it too early before the element dimensions were computed.
|
|
456
|
-
if (!this._previewRect || (!this._previewRect.width && !this._previewRect.height)) {
|
|
457
|
-
this._previewRect = (this._preview || this._rootElement).getBoundingClientRect();
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
460
|
// We prevent the default action down here so that we know that dragging has started. This is
|
|
461
461
|
// important for touch devices where doing this too early can unnecessarily block scrolling,
|
|
462
462
|
// if there's a dragging delay.
|
|
@@ -496,7 +496,7 @@ class DragRef {
|
|
|
496
496
|
this._endDragSequence(event);
|
|
497
497
|
};
|
|
498
498
|
this.withRootElement(element).withParent(_config.parentDragRef || null);
|
|
499
|
-
this._parentPositions = new ParentPositionTracker(_document
|
|
499
|
+
this._parentPositions = new ParentPositionTracker(_document);
|
|
500
500
|
_dragDropRegistry.registerDragItem(this);
|
|
501
501
|
}
|
|
502
502
|
/** Whether starting to drag this element is disabled. */
|
|
@@ -577,6 +577,9 @@ class DragRef {
|
|
|
577
577
|
this._ngZone.runOutsideAngular(() => {
|
|
578
578
|
element.addEventListener('mousedown', this._pointerDown, activeEventListenerOptions);
|
|
579
579
|
element.addEventListener('touchstart', this._pointerDown, passiveEventListenerOptions);
|
|
580
|
+
// Usually this isn't necessary since the we prevent the default action in `pointerDown`,
|
|
581
|
+
// but some cases like dragging of links can slip through (see #24403).
|
|
582
|
+
element.addEventListener('dragstart', preventDefault, activeEventListenerOptions);
|
|
580
583
|
});
|
|
581
584
|
this._initialTransform = undefined;
|
|
582
585
|
this._rootElement = element;
|
|
@@ -1085,6 +1088,9 @@ class DragRef {
|
|
|
1085
1088
|
else {
|
|
1086
1089
|
placeholder = deepCloneNode(this._rootElement);
|
|
1087
1090
|
}
|
|
1091
|
+
// Stop pointer events on the preview so the user can't
|
|
1092
|
+
// interact with it while the preview is animating.
|
|
1093
|
+
placeholder.style.pointerEvents = 'none';
|
|
1088
1094
|
placeholder.classList.add('cdk-drag-placeholder');
|
|
1089
1095
|
return placeholder;
|
|
1090
1096
|
}
|
|
@@ -1147,11 +1153,11 @@ class DragRef {
|
|
|
1147
1153
|
if (this._boundaryRect) {
|
|
1148
1154
|
const { x: pickupX, y: pickupY } = this._pickupPositionInElement;
|
|
1149
1155
|
const boundaryRect = this._boundaryRect;
|
|
1150
|
-
const
|
|
1156
|
+
const { width: previewWidth, height: previewHeight } = this._getPreviewRect();
|
|
1151
1157
|
const minY = boundaryRect.top + pickupY;
|
|
1152
|
-
const maxY = boundaryRect.bottom - (
|
|
1158
|
+
const maxY = boundaryRect.bottom - (previewHeight - pickupY);
|
|
1153
1159
|
const minX = boundaryRect.left + pickupX;
|
|
1154
|
-
const maxX = boundaryRect.right - (
|
|
1160
|
+
const maxX = boundaryRect.right - (previewWidth - pickupX);
|
|
1155
1161
|
x = clamp$1(x, minX, maxX);
|
|
1156
1162
|
y = clamp$1(y, minY, maxY);
|
|
1157
1163
|
}
|
|
@@ -1194,6 +1200,7 @@ class DragRef {
|
|
|
1194
1200
|
_removeRootElementListeners(element) {
|
|
1195
1201
|
element.removeEventListener('mousedown', this._pointerDown, activeEventListenerOptions);
|
|
1196
1202
|
element.removeEventListener('touchstart', this._pointerDown, passiveEventListenerOptions);
|
|
1203
|
+
element.removeEventListener('dragstart', preventDefault, activeEventListenerOptions);
|
|
1197
1204
|
}
|
|
1198
1205
|
/**
|
|
1199
1206
|
* Applies a `transform` to the root element, taking into account any existing transforms on it.
|
|
@@ -1331,10 +1338,9 @@ class DragRef {
|
|
|
1331
1338
|
}
|
|
1332
1339
|
/** Gets the scroll position of the viewport. */
|
|
1333
1340
|
_getViewportScrollPosition() {
|
|
1334
|
-
|
|
1335
|
-
return
|
|
1336
|
-
|
|
1337
|
-
: this._viewportRuler.getViewportScrollPosition();
|
|
1341
|
+
var _a;
|
|
1342
|
+
return (((_a = this._parentPositions.positions.get(this._document)) === null || _a === void 0 ? void 0 : _a.scrollPosition) ||
|
|
1343
|
+
this._parentPositions.getViewportScrollPosition());
|
|
1338
1344
|
}
|
|
1339
1345
|
/**
|
|
1340
1346
|
* Lazily resolves and returns the shadow root of the element. We do this in a function, rather
|
|
@@ -1368,6 +1374,15 @@ class DragRef {
|
|
|
1368
1374
|
}
|
|
1369
1375
|
return coerceElement(previewContainer);
|
|
1370
1376
|
}
|
|
1377
|
+
/** Lazily resolves and returns the dimensions of the preview. */
|
|
1378
|
+
_getPreviewRect() {
|
|
1379
|
+
// Cache the preview element rect if we haven't cached it already or if
|
|
1380
|
+
// we cached it too early before the element dimensions were computed.
|
|
1381
|
+
if (!this._previewRect || (!this._previewRect.width && !this._previewRect.height)) {
|
|
1382
|
+
this._previewRect = (this._preview || this._rootElement).getBoundingClientRect();
|
|
1383
|
+
}
|
|
1384
|
+
return this._previewRect;
|
|
1385
|
+
}
|
|
1371
1386
|
}
|
|
1372
1387
|
/**
|
|
1373
1388
|
* Gets a 3d `transform` that can be applied to an element.
|
|
@@ -1413,6 +1428,10 @@ function matchElementSize(target, sourceRect) {
|
|
|
1413
1428
|
target.style.height = `${sourceRect.height}px`;
|
|
1414
1429
|
target.style.transform = getTransform(sourceRect.left, sourceRect.top);
|
|
1415
1430
|
}
|
|
1431
|
+
/** Utility to prevent the default action of an event. */
|
|
1432
|
+
function preventDefault(event) {
|
|
1433
|
+
event.preventDefault();
|
|
1434
|
+
}
|
|
1416
1435
|
|
|
1417
1436
|
/**
|
|
1418
1437
|
* @license
|
|
@@ -1588,7 +1607,7 @@ class DropListRef {
|
|
|
1588
1607
|
this._document = _document;
|
|
1589
1608
|
this.withScrollableParents([this.element]);
|
|
1590
1609
|
_dragDropRegistry.registerDropContainer(this);
|
|
1591
|
-
this._parentPositions = new ParentPositionTracker(_document
|
|
1610
|
+
this._parentPositions = new ParentPositionTracker(_document);
|
|
1592
1611
|
}
|
|
1593
1612
|
/** Removes the drop list functionality from the DOM element. */
|
|
1594
1613
|
dispose() {
|