@angular/cdk 12.0.2 → 12.0.6
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.scss +9 -7
- package/bundles/cdk-drag-drop.umd.js +64 -20
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +6 -3
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +1 -0
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/drag-drop/drag-drop-registry.d.ts +14 -2
- package/drag-drop/index.metadata.json +1 -1
- package/drag-drop/parent-position-tracker.d.ts +2 -0
- package/esm2015/drag-drop/drag-drop-registry.js +37 -3
- package/esm2015/drag-drop/drag-ref.js +22 -12
- package/esm2015/drag-drop/drop-list-ref.js +4 -2
- package/esm2015/drag-drop/parent-position-tracker.js +6 -2
- package/esm2015/overlay/overlay-container.js +7 -4
- package/esm2015/scrolling/viewport-ruler.js +2 -1
- package/esm2015/version.js +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/drag-drop.js +63 -13
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/overlay.js +6 -3
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/scrolling.js +1 -0
- package/fesm2015/scrolling.js.map +1 -1
- package/overlay/_index.scss +1 -1
- package/overlay/index.metadata.json +1 -1
- package/package.json +1 -1
- package/schematics/migration.json +5 -0
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/schematics/ng-update/devkit-file-system.d.ts +2 -2
- package/schematics/ng-update/devkit-file-system.js +20 -21
- package/schematics/ng-update/devkit-file-system.mjs +20 -21
- package/schematics/ng-update/index.d.ts +2 -0
- package/schematics/ng-update/index.js +7 -2
- package/schematics/ng-update/index.mjs +7 -2
- package/schematics/ng-update/migrations/constructor-signature.js +4 -3
- package/schematics/ng-update/migrations/constructor-signature.mjs +4 -3
- package/schematics/update-tool/component-resource-collector.js +2 -2
- package/schematics/update-tool/component-resource-collector.mjs +2 -2
- package/schematics/update-tool/file-system.d.ts +4 -2
- package/schematics/update-tool/file-system.js +1 -1
- package/schematics/update-tool/file-system.mjs +1 -1
- package/schematics/update-tool/target-version.d.ts +2 -1
- package/schematics/update-tool/target-version.js +2 -1
- package/schematics/update-tool/target-version.mjs +2 -1
- package/schematics/update-tool/utils/virtual-host.js +3 -3
- package/schematics/update-tool/utils/virtual-host.mjs +3 -3
- package/scrolling/viewport-ruler.d.ts +1 -0
package/a11y/_index.scss
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// Emits a CSS class, `.cdk-visually-hidden`. This class can be applied to an element
|
|
2
|
+
/// to make that element visually hidden while remaining available to assitive technology.
|
|
3
|
+
@mixin a11y-visually-hidden() {
|
|
2
4
|
.cdk-visually-hidden {
|
|
3
5
|
border: 0;
|
|
4
6
|
clip: rect(0 0 0 0);
|
|
@@ -22,14 +24,14 @@
|
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
@mixin a11y {
|
|
27
|
+
/// @deprecated Use `a11y-visually-hidden`.
|
|
28
|
+
@mixin a11y() {
|
|
27
29
|
@include a11y-visually-hidden;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
/// Emits the mixin's content nested under `$selector-context` if `$selector-context`
|
|
31
33
|
/// is non-empty.
|
|
32
|
-
/// @param selector-context The selector under which to nest the mixin's content.
|
|
34
|
+
/// @param {String} selector-context The selector under which to nest the mixin's content.
|
|
33
35
|
@mixin _optionally-nest-content($selector-context) {
|
|
34
36
|
@if ($selector-context == '') {
|
|
35
37
|
@content;
|
|
@@ -45,9 +47,9 @@
|
|
|
45
47
|
/// to Microsoft browsers. Chrome can be included by checking for the `html[hc]`
|
|
46
48
|
/// attribute, however Chrome handles high contrast differently.
|
|
47
49
|
///
|
|
48
|
-
/// @param target
|
|
49
|
-
///
|
|
50
|
-
/// @param encapsulation Whether to emit styles for view encapsulation. Values are:
|
|
50
|
+
/// @param {String} target Type of high contrast setting to target. Defaults to `active`, can be
|
|
51
|
+
/// `white-on-black` or `black-on-white`.
|
|
52
|
+
/// @param {String} encapsulation Whether to emit styles for view encapsulation. Values are:
|
|
51
53
|
/// * `on` - works for `Emulated`, `Native`, and `ShadowDom`
|
|
52
54
|
/// * `off` - works for `None`
|
|
53
55
|
/// * `any` - works for all encapsulation modes by emitting the CSS twice (default).
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
};
|
|
217
217
|
/** Handles scrolling while a drag is taking place. */
|
|
218
218
|
ParentPositionTracker.prototype.handleScroll = function (event) {
|
|
219
|
-
var target = event
|
|
219
|
+
var target = getEventTarget(event);
|
|
220
220
|
var cachedPosition = this.positions.get(target);
|
|
221
221
|
if (!cachedPosition) {
|
|
222
222
|
return null;
|
|
@@ -252,6 +252,10 @@
|
|
|
252
252
|
};
|
|
253
253
|
return ParentPositionTracker;
|
|
254
254
|
}());
|
|
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
|
+
}
|
|
255
259
|
|
|
256
260
|
/**
|
|
257
261
|
* @license
|
|
@@ -356,6 +360,11 @@
|
|
|
356
360
|
this._passiveTransform = { x: 0, y: 0 };
|
|
357
361
|
/** CSS `transform` that is applied to the element while it's being dragged. */
|
|
358
362
|
this._activeTransform = { x: 0, y: 0 };
|
|
363
|
+
/**
|
|
364
|
+
* Whether the dragging sequence has been started. Doesn't
|
|
365
|
+
* necessarily mean that the element has been moved.
|
|
366
|
+
*/
|
|
367
|
+
this._hasStartedDragging = false;
|
|
359
368
|
/** Emits when the item is being moved. */
|
|
360
369
|
this._moveEvents = new rxjs.Subject();
|
|
361
370
|
/** Subscription to pointer movement events. */
|
|
@@ -407,7 +416,7 @@
|
|
|
407
416
|
// Delegate the event based on whether it started from a handle or the element itself.
|
|
408
417
|
if (_this._handles.length) {
|
|
409
418
|
var targetHandle = _this._handles.find(function (handle) {
|
|
410
|
-
var target = event
|
|
419
|
+
var target = getEventTarget(event);
|
|
411
420
|
return !!target && (target === handle || handle.contains(target));
|
|
412
421
|
});
|
|
413
422
|
if (targetHandle && !_this._disabledHandles.has(targetHandle) && !_this.disabled) {
|
|
@@ -855,6 +864,7 @@
|
|
|
855
864
|
var isTouchSequence = isTouchEvent(event);
|
|
856
865
|
var isAuxiliaryMouseButton = !isTouchSequence && event.button !== 0;
|
|
857
866
|
var rootElement = this._rootElement;
|
|
867
|
+
var target = getEventTarget(event);
|
|
858
868
|
var isSyntheticEvent = !isTouchSequence && this._lastTouchEventTime &&
|
|
859
869
|
this._lastTouchEventTime + MOUSE_EVENT_IGNORE_TIME > Date.now();
|
|
860
870
|
// If the event started from an element with the native HTML drag&drop, it'll interfere
|
|
@@ -863,7 +873,7 @@
|
|
|
863
873
|
// it's flaky and it fails if the user drags it away quickly. Also note that we only want
|
|
864
874
|
// to do this for `mousedown` since doing the same for `touchstart` will stop any `click`
|
|
865
875
|
// events from firing on touch devices.
|
|
866
|
-
if (
|
|
876
|
+
if (target && target.draggable && event.type === 'mousedown') {
|
|
867
877
|
event.preventDefault();
|
|
868
878
|
}
|
|
869
879
|
// Abort if the user is already dragging or is using a mouse button other than the primary one.
|
|
@@ -883,9 +893,9 @@
|
|
|
883
893
|
this._removeSubscriptions();
|
|
884
894
|
this._pointerMoveSubscription = this._dragDropRegistry.pointerMove.subscribe(this._pointerMove);
|
|
885
895
|
this._pointerUpSubscription = this._dragDropRegistry.pointerUp.subscribe(this._pointerUp);
|
|
886
|
-
this._scrollSubscription = this._dragDropRegistry
|
|
887
|
-
|
|
888
|
-
|
|
896
|
+
this._scrollSubscription = this._dragDropRegistry
|
|
897
|
+
.scrolled(this._getShadowRoot())
|
|
898
|
+
.subscribe(function (scrollEvent) { return _this._updateOnScroll(scrollEvent); });
|
|
889
899
|
if (this._boundaryElement) {
|
|
890
900
|
this._boundaryRect = getMutableClientRect(this._boundaryElement);
|
|
891
901
|
}
|
|
@@ -973,9 +983,12 @@
|
|
|
973
983
|
});
|
|
974
984
|
});
|
|
975
985
|
}
|
|
976
|
-
|
|
977
|
-
this.
|
|
978
|
-
|
|
986
|
+
// Dragging may have been interrupted as a result of the events above.
|
|
987
|
+
if (this.isDragging()) {
|
|
988
|
+
this._dropContainer._startScrollingIfNecessary(rawX, rawY);
|
|
989
|
+
this._dropContainer._sortItem(this, x, y, this._pointerDirectionDelta);
|
|
990
|
+
this._applyPreviewTransform(x - this._pickupPositionInElement.x, y - this._pickupPositionInElement.y);
|
|
991
|
+
}
|
|
979
992
|
};
|
|
980
993
|
/**
|
|
981
994
|
* Creates the element that will be rendered next to the user's pointer
|
|
@@ -1060,7 +1073,8 @@
|
|
|
1060
1073
|
return this._ngZone.runOutsideAngular(function () {
|
|
1061
1074
|
return new Promise(function (resolve) {
|
|
1062
1075
|
var handler = (function (event) {
|
|
1063
|
-
if (!event || (event
|
|
1076
|
+
if (!event || (getEventTarget(event) === _this._preview &&
|
|
1077
|
+
event.propertyName === 'transform')) {
|
|
1064
1078
|
_this._preview.removeEventListener('transitionend', handler);
|
|
1065
1079
|
resolve();
|
|
1066
1080
|
clearTimeout(timeout);
|
|
@@ -1308,7 +1322,7 @@
|
|
|
1308
1322
|
DragRef.prototype._updateOnScroll = function (event) {
|
|
1309
1323
|
var scrollDifference = this._parentPositions.handleScroll(event);
|
|
1310
1324
|
if (scrollDifference) {
|
|
1311
|
-
var target = event
|
|
1325
|
+
var target = getEventTarget(event);
|
|
1312
1326
|
// ClientRect dimensions are based on the scroll position of the page and its parent node so
|
|
1313
1327
|
// we have to update the cached boundary ClientRect if the user has scrolled. Check for
|
|
1314
1328
|
// the `document` specifically since IE doesn't support `contains` on it.
|
|
@@ -2476,7 +2490,9 @@
|
|
|
2476
2490
|
*/
|
|
2477
2491
|
DropListRef.prototype._listenToScrollEvents = function () {
|
|
2478
2492
|
var _this = this;
|
|
2479
|
-
this._viewportScrollSubscription = this._dragDropRegistry
|
|
2493
|
+
this._viewportScrollSubscription = this._dragDropRegistry
|
|
2494
|
+
.scrolled(this._getShadowRoot())
|
|
2495
|
+
.subscribe(function (event) {
|
|
2480
2496
|
if (_this.isDragging()) {
|
|
2481
2497
|
var scrollDifference_1 = _this._parentPositions.handleScroll(event);
|
|
2482
2498
|
if (scrollDifference_1) {
|
|
@@ -2642,13 +2658,6 @@
|
|
|
2642
2658
|
return [verticalScrollDirection, horizontalScrollDirection];
|
|
2643
2659
|
}
|
|
2644
2660
|
|
|
2645
|
-
/**
|
|
2646
|
-
* @license
|
|
2647
|
-
* Copyright Google LLC All Rights Reserved.
|
|
2648
|
-
*
|
|
2649
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
2650
|
-
* found in the LICENSE file at https://angular.io/license
|
|
2651
|
-
*/
|
|
2652
2661
|
/** Event options that can be used to bind an active, capturing event. */
|
|
2653
2662
|
var activeCapturingEventOptions = platform.normalizePassiveListenerOptions({
|
|
2654
2663
|
passive: false,
|
|
@@ -2689,7 +2698,11 @@
|
|
|
2689
2698
|
* while the user is dragging a drag item instance.
|
|
2690
2699
|
*/
|
|
2691
2700
|
this.pointerUp = new rxjs.Subject();
|
|
2692
|
-
/**
|
|
2701
|
+
/**
|
|
2702
|
+
* Emits when the viewport has been scrolled while the user is dragging an item.
|
|
2703
|
+
* @deprecated To be turned into a private member. Use the `scrolled` method instead.
|
|
2704
|
+
* @breaking-change 13.0.0
|
|
2705
|
+
*/
|
|
2693
2706
|
this.scroll = new rxjs.Subject();
|
|
2694
2707
|
/**
|
|
2695
2708
|
* Event listener that will prevent the default browser action while the user is dragging.
|
|
@@ -2812,6 +2825,37 @@
|
|
|
2812
2825
|
DragDropRegistry.prototype.isDragging = function (drag) {
|
|
2813
2826
|
return this._activeDragInstances.indexOf(drag) > -1;
|
|
2814
2827
|
};
|
|
2828
|
+
/**
|
|
2829
|
+
* Gets a stream that will emit when any element on the page is scrolled while an item is being
|
|
2830
|
+
* dragged.
|
|
2831
|
+
* @param shadowRoot Optional shadow root that the current dragging sequence started from.
|
|
2832
|
+
* Top-level listeners won't pick up events coming from the shadow DOM so this parameter can
|
|
2833
|
+
* be used to include an additional top-level listener at the shadow root level.
|
|
2834
|
+
*/
|
|
2835
|
+
DragDropRegistry.prototype.scrolled = function (shadowRoot) {
|
|
2836
|
+
var _this = this;
|
|
2837
|
+
var streams = [this.scroll];
|
|
2838
|
+
if (shadowRoot && shadowRoot !== this._document) {
|
|
2839
|
+
// Note that this is basically the same as `fromEvent` from rjxs, but we do it ourselves,
|
|
2840
|
+
// because we want to guarantee that the event is bound outside of the `NgZone`. With
|
|
2841
|
+
// `fromEvent` it'll only happen if the subscription is outside the `NgZone`.
|
|
2842
|
+
streams.push(new rxjs.Observable(function (observer) {
|
|
2843
|
+
return _this._ngZone.runOutsideAngular(function () {
|
|
2844
|
+
var eventOptions = true;
|
|
2845
|
+
var callback = function (event) {
|
|
2846
|
+
if (_this._activeDragInstances.length) {
|
|
2847
|
+
observer.next(event);
|
|
2848
|
+
}
|
|
2849
|
+
};
|
|
2850
|
+
shadowRoot.addEventListener('scroll', callback, eventOptions);
|
|
2851
|
+
return function () {
|
|
2852
|
+
shadowRoot.removeEventListener('scroll', callback, eventOptions);
|
|
2853
|
+
};
|
|
2854
|
+
});
|
|
2855
|
+
}));
|
|
2856
|
+
}
|
|
2857
|
+
return rxjs.merge.apply(void 0, __spreadArray([], __read(streams)));
|
|
2858
|
+
};
|
|
2815
2859
|
DragDropRegistry.prototype.ngOnDestroy = function () {
|
|
2816
2860
|
var _this = this;
|
|
2817
2861
|
this._dragInstances.forEach(function (instance) { return _this.removeDragItem(instance); });
|