@angular/cdk 14.0.0-next.1 → 14.0.0-next.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/a11y/a11y-module.d.ts +2 -3
- package/drag-drop/parent-position-tracker.d.ts +11 -3
- package/esm2020/a11y/a11y-module.mjs +4 -5
- package/esm2020/a11y/high-contrast-mode/high-contrast-mode-detector.mjs +4 -9
- package/esm2020/drag-drop/drag-ref.mjs +15 -6
- package/esm2020/drag-drop/drop-list-ref.mjs +2 -2
- package/esm2020/drag-drop/parent-position-tracker.mjs +13 -5
- package/esm2020/scrolling/scrolling-module.mjs +4 -5
- package/esm2020/scrolling/virtual-scroll-viewport.mjs +3 -1
- package/esm2020/stepper/stepper.mjs +4 -17
- package/esm2020/testing/component-harness.mjs +7 -1
- package/esm2020/testing/harness-environment.mjs +9 -1
- package/esm2020/text-field/text-field-module.mjs +3 -5
- package/esm2020/version.mjs +1 -1
- package/fesm2015/a11y.mjs +7 -12
- 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 +28 -10
- package/fesm2015/drag-drop.mjs.map +1 -1
- package/fesm2015/scrolling.mjs +6 -4
- package/fesm2015/scrolling.mjs.map +1 -1
- package/fesm2015/stepper.mjs +3 -16
- package/fesm2015/stepper.mjs.map +1 -1
- package/fesm2015/testing.mjs +20 -0
- 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 +7 -12
- 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 +27 -10
- package/fesm2020/drag-drop.mjs.map +1 -1
- package/fesm2020/scrolling.mjs +6 -4
- package/fesm2020/scrolling.mjs.map +1 -1
- package/fesm2020/stepper.mjs +3 -16
- package/fesm2020/stepper.mjs.map +1 -1
- package/fesm2020/testing.mjs +14 -0
- package/fesm2020/testing.mjs.map +1 -1
- package/fesm2020/text-field.mjs +3 -4
- package/fesm2020/text-field.mjs.map +1 -1
- package/package.json +3 -3
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-generate/drag-drop/schema.json +1 -1
- package/schematics/ng-update/data/constructor-checks.js +7 -1
- package/schematics/ng-update/data/constructor-checks.mjs +7 -1
- package/schematics/ng-update/devkit-migration.js +1 -1
- package/schematics/ng-update/devkit-migration.mjs +1 -1
- package/schematics/tsconfig.json +2 -10
- package/scrolling/scrolling-module.d.ts +1 -2
- package/stepper/stepper.d.ts +3 -12
- package/testing/component-harness.d.ts +18 -0
- package/testing/harness-environment.d.ts +2 -0
- package/text-field/text-field-module.d.ts +1 -2
package/fesm2020/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('14.0.0-next.
|
|
11
|
+
const VERSION = new Version('14.0.0-next.4');
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
package/fesm2020/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('14.0.0-next.
|
|
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('14.0.0-next.4');\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/fesm2020/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
|
/**
|
|
@@ -496,7 +504,7 @@ class DragRef {
|
|
|
496
504
|
this._endDragSequence(event);
|
|
497
505
|
};
|
|
498
506
|
this.withRootElement(element).withParent(_config.parentDragRef || null);
|
|
499
|
-
this._parentPositions = new ParentPositionTracker(_document
|
|
507
|
+
this._parentPositions = new ParentPositionTracker(_document);
|
|
500
508
|
_dragDropRegistry.registerDragItem(this);
|
|
501
509
|
}
|
|
502
510
|
/** Whether starting to drag this element is disabled. */
|
|
@@ -577,6 +585,9 @@ class DragRef {
|
|
|
577
585
|
this._ngZone.runOutsideAngular(() => {
|
|
578
586
|
element.addEventListener('mousedown', this._pointerDown, activeEventListenerOptions);
|
|
579
587
|
element.addEventListener('touchstart', this._pointerDown, passiveEventListenerOptions);
|
|
588
|
+
// Usually this isn't necessary since the we prevent the default action in `pointerDown`,
|
|
589
|
+
// but some cases like dragging of links can slip through (see #24403).
|
|
590
|
+
element.addEventListener('dragstart', preventDefault, activeEventListenerOptions);
|
|
580
591
|
});
|
|
581
592
|
this._initialTransform = undefined;
|
|
582
593
|
this._rootElement = element;
|
|
@@ -1081,6 +1092,9 @@ class DragRef {
|
|
|
1081
1092
|
else {
|
|
1082
1093
|
placeholder = deepCloneNode(this._rootElement);
|
|
1083
1094
|
}
|
|
1095
|
+
// Stop pointer events on the preview so the user can't
|
|
1096
|
+
// interact with it while the preview is animating.
|
|
1097
|
+
placeholder.style.pointerEvents = 'none';
|
|
1084
1098
|
placeholder.classList.add('cdk-drag-placeholder');
|
|
1085
1099
|
return placeholder;
|
|
1086
1100
|
}
|
|
@@ -1190,6 +1204,7 @@ class DragRef {
|
|
|
1190
1204
|
_removeRootElementListeners(element) {
|
|
1191
1205
|
element.removeEventListener('mousedown', this._pointerDown, activeEventListenerOptions);
|
|
1192
1206
|
element.removeEventListener('touchstart', this._pointerDown, passiveEventListenerOptions);
|
|
1207
|
+
element.removeEventListener('dragstart', preventDefault, activeEventListenerOptions);
|
|
1193
1208
|
}
|
|
1194
1209
|
/**
|
|
1195
1210
|
* Applies a `transform` to the root element, taking into account any existing transforms on it.
|
|
@@ -1326,10 +1341,8 @@ class DragRef {
|
|
|
1326
1341
|
}
|
|
1327
1342
|
/** Gets the scroll position of the viewport. */
|
|
1328
1343
|
_getViewportScrollPosition() {
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
? cachedPosition.scrollPosition
|
|
1332
|
-
: this._viewportRuler.getViewportScrollPosition();
|
|
1344
|
+
return (this._parentPositions.positions.get(this._document)?.scrollPosition ||
|
|
1345
|
+
this._parentPositions.getViewportScrollPosition());
|
|
1333
1346
|
}
|
|
1334
1347
|
/**
|
|
1335
1348
|
* Lazily resolves and returns the shadow root of the element. We do this in a function, rather
|
|
@@ -1408,6 +1421,10 @@ function matchElementSize(target, sourceRect) {
|
|
|
1408
1421
|
target.style.height = `${sourceRect.height}px`;
|
|
1409
1422
|
target.style.transform = getTransform(sourceRect.left, sourceRect.top);
|
|
1410
1423
|
}
|
|
1424
|
+
/** Utility to prevent the default action of an event. */
|
|
1425
|
+
function preventDefault(event) {
|
|
1426
|
+
event.preventDefault();
|
|
1427
|
+
}
|
|
1411
1428
|
|
|
1412
1429
|
/**
|
|
1413
1430
|
* @license
|
|
@@ -1583,7 +1600,7 @@ class DropListRef {
|
|
|
1583
1600
|
this._document = _document;
|
|
1584
1601
|
this.withScrollableParents([this.element]);
|
|
1585
1602
|
_dragDropRegistry.registerDropContainer(this);
|
|
1586
|
-
this._parentPositions = new ParentPositionTracker(_document
|
|
1603
|
+
this._parentPositions = new ParentPositionTracker(_document);
|
|
1587
1604
|
}
|
|
1588
1605
|
/** Removes the drop list functionality from the DOM element. */
|
|
1589
1606
|
dispose() {
|