@angular/cdk 11.0.2 → 11.1.0
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/LICENSE +1 -1
- package/a11y/aria-describer/aria-describer.d.ts +9 -14
- package/a11y/focus-monitor/focus-monitor.d.ts +6 -0
- package/a11y/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +83 -66
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +13 -21
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-accordion.umd.js.map +1 -1
- package/bundles/cdk-bidi.umd.js.map +1 -1
- package/bundles/cdk-coercion.umd.js +9 -1
- package/bundles/cdk-coercion.umd.js.map +1 -1
- package/bundles/cdk-coercion.umd.min.js.map +1 -1
- package/bundles/cdk-collections.umd.js +9 -1
- package/bundles/cdk-collections.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.min.js +1 -1
- package/bundles/cdk-collections.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +96 -50
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +8 -8
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +48 -10
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +18 -25
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +1 -0
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +1 -1
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-portal.umd.js +9 -1
- package/bundles/cdk-portal.umd.js.map +1 -1
- package/bundles/cdk-portal.umd.min.js +2 -2
- package/bundles/cdk-portal.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +25 -11
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +4 -4
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +99 -30
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +7 -7
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.js +59 -13
- package/bundles/cdk-testing-protractor.umd.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.min.js +2 -2
- package/bundles/cdk-testing-protractor.umd.min.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.js +40 -15
- package/bundles/cdk-testing-testbed.umd.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.min.js +7 -7
- package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
- package/bundles/cdk-testing.umd.js +11 -10
- package/bundles/cdk-testing.umd.js.map +1 -1
- package/bundles/cdk-testing.umd.min.js +2 -2
- package/bundles/cdk-testing.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +9 -1
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.min.js +5 -5
- package/bundles/cdk-tree.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/drag-drop/directives/drag.d.ts +1 -1
- package/drag-drop/directives/drop-list.d.ts +4 -1
- package/drag-drop/drag-drop-registry.d.ts +8 -1
- package/drag-drop/drag-ref.d.ts +2 -0
- package/drag-drop/drop-list-ref.d.ts +7 -1
- package/drag-drop/index.metadata.json +1 -1
- package/esm2015/a11y/aria-describer/aria-describer.js +50 -55
- package/esm2015/a11y/focus-monitor/focus-monitor.js +18 -3
- package/esm2015/drag-drop/directives/drag.js +6 -4
- package/esm2015/drag-drop/directives/drop-list.js +4 -2
- package/esm2015/drag-drop/drag-drop-registry.js +25 -12
- package/esm2015/drag-drop/drag-ref.js +10 -8
- package/esm2015/drag-drop/drop-list-ref.js +46 -28
- package/esm2015/overlay/position/flexible-connected-position-strategy.js +25 -3
- package/esm2015/overlay/scroll/block-scroll-strategy.js +13 -4
- package/esm2015/platform/features/scrolling.js +2 -1
- package/esm2015/scrolling/fixed-size-virtual-scroll.js +3 -2
- package/esm2015/scrolling/scroll-dispatcher.js +9 -8
- package/esm2015/scrolling/virtual-for-of.js +8 -4
- package/esm2015/scrolling/virtual-scroll-viewport.js +1 -1
- package/esm2015/table/public-api.js +2 -1
- package/esm2015/table/sticky-position-listener.js +11 -0
- package/esm2015/table/sticky-styler.js +60 -14
- package/esm2015/table/table.js +9 -4
- package/esm2015/testing/change-detection.js +1 -8
- package/esm2015/testing/harness-environment.js +3 -3
- package/esm2015/testing/protractor/protractor-element.js +29 -13
- package/esm2015/testing/test-element.js +1 -1
- package/esm2015/testing/testbed/fake-events/dispatch-events.js +3 -3
- package/esm2015/testing/testbed/fake-events/event-objects.js +6 -6
- package/esm2015/testing/testbed/unit-test-element.js +21 -9
- package/esm2015/tree/nested-node.js +1 -1
- package/esm2015/tree/padding.js +1 -1
- package/esm2015/tree/toggle.js +1 -1
- package/esm2015/tree/tree.js +1 -1
- package/esm2015/version.js +1 -1
- package/fesm2015/a11y.js +67 -55
- package/fesm2015/a11y.js.map +1 -1
- package/fesm2015/accordion.js.map +1 -1
- package/fesm2015/bidi.js.map +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/drag-drop.js +85 -48
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/overlay.js +36 -6
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/platform.js +1 -0
- package/fesm2015/platform.js.map +1 -1
- package/fesm2015/scrolling.js +17 -12
- package/fesm2015/scrolling.js.map +1 -1
- package/fesm2015/table.js +77 -17
- package/fesm2015/table.js.map +1 -1
- package/fesm2015/testing/protractor.js +27 -11
- package/fesm2015/testing/protractor.js.map +1 -1
- package/fesm2015/testing/testbed.js +25 -13
- package/fesm2015/testing/testbed.js.map +1 -1
- package/fesm2015/testing.js +2 -9
- package/fesm2015/testing.js.map +1 -1
- package/fesm2015/tree.js.map +1 -1
- package/overlay/index.metadata.json +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/scrolling/index.metadata.json +1 -1
- package/scrolling/scroll-dispatcher.d.ts +3 -3
- package/table/index.metadata.json +1 -1
- package/table/public-api.d.ts +1 -0
- package/table/sticky-position-listener.d.ts +28 -0
- package/table/sticky-styler.d.ts +7 -2
- package/table/table.d.ts +4 -2
- package/testing/change-detection.d.ts +44 -1
- package/testing/protractor/protractor-element.d.ts +12 -4
- package/testing/test-element.d.ts +11 -5
- package/testing/testbed/fake-events/dispatch-events.d.ts +1 -1
- package/testing/testbed/fake-events/event-objects.d.ts +1 -1
- package/testing/testbed/unit-test-element.d.ts +12 -4
- package/tree/index.metadata.json +1 -1
- package/tree/nested-node.d.ts +3 -3
- package/tree/padding.d.ts +2 -2
- package/tree/toggle.d.ts +4 -4
- package/tree/tree.d.ts +5 -5
|
@@ -389,9 +389,6 @@
|
|
|
389
389
|
};
|
|
390
390
|
/** Handler that is invoked when the user moves their pointer after they've initiated a drag. */
|
|
391
391
|
this._pointerMove = function (event) {
|
|
392
|
-
// Prevent the default action as early as possible in order to block
|
|
393
|
-
// native actions like dragging the selected text or images with the mouse.
|
|
394
|
-
event.preventDefault();
|
|
395
392
|
var pointerPosition = _this._getPointerPositionOnPage(event);
|
|
396
393
|
if (!_this._hasStartedDragging) {
|
|
397
394
|
var distanceX = Math.abs(pointerPosition.x - _this._pickupPositionOnPage.x);
|
|
@@ -426,6 +423,10 @@
|
|
|
426
423
|
_this._previewRect = (_this._preview || _this._rootElement).getBoundingClientRect();
|
|
427
424
|
}
|
|
428
425
|
}
|
|
426
|
+
// We prevent the default action down here so that we know that dragging has started. This is
|
|
427
|
+
// important for touch devices where doing this too early can unnecessarily block scrolling,
|
|
428
|
+
// if there's a dragging delay.
|
|
429
|
+
event.preventDefault();
|
|
429
430
|
var constrainedPointerPosition = _this._getConstrainedPointerPosition(pointerPosition);
|
|
430
431
|
_this._hasMoved = true;
|
|
431
432
|
_this._lastKnownPointerPosition = pointerPosition;
|
|
@@ -791,10 +792,11 @@
|
|
|
791
792
|
*/
|
|
792
793
|
DragRef.prototype._initializeDragSequence = function (referenceElement, event) {
|
|
793
794
|
var _this = this;
|
|
794
|
-
//
|
|
795
|
-
//
|
|
796
|
-
|
|
797
|
-
|
|
795
|
+
// Stop propagation if the item is inside another
|
|
796
|
+
// draggable so we don't start multiple drag sequences.
|
|
797
|
+
if (this._config.parentDragRef) {
|
|
798
|
+
event.stopPropagation();
|
|
799
|
+
}
|
|
798
800
|
var isDragging = this.isDragging();
|
|
799
801
|
var isTouchSequence = isTouchEvent(event);
|
|
800
802
|
var isAuxiliaryMouseButton = !isTouchSequence && event.button !== 0;
|
|
@@ -1366,6 +1368,8 @@
|
|
|
1366
1368
|
return extendStatics(d, b);
|
|
1367
1369
|
};
|
|
1368
1370
|
function __extends(d, b) {
|
|
1371
|
+
if (typeof b !== "function" && b !== null)
|
|
1372
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
1369
1373
|
extendStatics(d, b);
|
|
1370
1374
|
function __() { this.constructor = d; }
|
|
1371
1375
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -1551,11 +1555,13 @@
|
|
|
1551
1555
|
}
|
|
1552
1556
|
return ar;
|
|
1553
1557
|
}
|
|
1558
|
+
/** @deprecated */
|
|
1554
1559
|
function __spread() {
|
|
1555
1560
|
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
1556
1561
|
ar = ar.concat(__read(arguments[i]));
|
|
1557
1562
|
return ar;
|
|
1558
1563
|
}
|
|
1564
|
+
/** @deprecated */
|
|
1559
1565
|
function __spreadArrays() {
|
|
1560
1566
|
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
1561
1567
|
s += arguments[i].length;
|
|
@@ -1564,7 +1570,11 @@
|
|
|
1564
1570
|
r[k] = a[j];
|
|
1565
1571
|
return r;
|
|
1566
1572
|
}
|
|
1567
|
-
|
|
1573
|
+
function __spreadArray(to, from) {
|
|
1574
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
1575
|
+
to[j] = from[i];
|
|
1576
|
+
return to;
|
|
1577
|
+
}
|
|
1568
1578
|
function __await(v) {
|
|
1569
1579
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
1570
1580
|
}
|
|
@@ -1713,11 +1723,6 @@
|
|
|
1713
1723
|
* viewport. The value comes from trying it out manually until it feels right.
|
|
1714
1724
|
*/
|
|
1715
1725
|
var SCROLL_PROXIMITY_THRESHOLD = 0.05;
|
|
1716
|
-
/**
|
|
1717
|
-
* Number of pixels to scroll for each frame when auto-scrolling an element.
|
|
1718
|
-
* The value comes from trying it out manually until it feels right.
|
|
1719
|
-
*/
|
|
1720
|
-
var AUTO_SCROLL_STEP = 2;
|
|
1721
1726
|
/**
|
|
1722
1727
|
* Reference to a drop list. Used to manipulate or dispose of the container.
|
|
1723
1728
|
*/
|
|
@@ -1736,6 +1741,8 @@
|
|
|
1736
1741
|
* moves their pointer close to the edges is disabled.
|
|
1737
1742
|
*/
|
|
1738
1743
|
this.autoScrollDisabled = false;
|
|
1744
|
+
/** Number of pixels to scroll for each frame when auto-scrolling an element. */
|
|
1745
|
+
this.autoScrollStep = 2;
|
|
1739
1746
|
/**
|
|
1740
1747
|
* Function that is used to determine whether an item
|
|
1741
1748
|
* is allowed to be moved into a drop container.
|
|
@@ -1768,6 +1775,8 @@
|
|
|
1768
1775
|
* overlap with the swapped item after the swapping occurred.
|
|
1769
1776
|
*/
|
|
1770
1777
|
this._previousSwap = { drag: null, delta: 0, overlaps: false };
|
|
1778
|
+
/** Draggable items in the container. */
|
|
1779
|
+
this._draggables = [];
|
|
1771
1780
|
/** Drop lists that are connected to the current one. */
|
|
1772
1781
|
this._siblings = [];
|
|
1773
1782
|
/** Direction in which the list is oriented. */
|
|
@@ -1793,17 +1802,18 @@
|
|
|
1793
1802
|
.pipe(operators.takeUntil(_this._stopScrollTimers))
|
|
1794
1803
|
.subscribe(function () {
|
|
1795
1804
|
var node = _this._scrollNode;
|
|
1805
|
+
var scrollStep = _this.autoScrollStep;
|
|
1796
1806
|
if (_this._verticalScrollDirection === 1 /* UP */) {
|
|
1797
|
-
incrementVerticalScroll(node, -
|
|
1807
|
+
incrementVerticalScroll(node, -scrollStep);
|
|
1798
1808
|
}
|
|
1799
1809
|
else if (_this._verticalScrollDirection === 2 /* DOWN */) {
|
|
1800
|
-
incrementVerticalScroll(node,
|
|
1810
|
+
incrementVerticalScroll(node, scrollStep);
|
|
1801
1811
|
}
|
|
1802
1812
|
if (_this._horizontalScrollDirection === 1 /* LEFT */) {
|
|
1803
|
-
incrementHorizontalScroll(node, -
|
|
1813
|
+
incrementHorizontalScroll(node, -scrollStep);
|
|
1804
1814
|
}
|
|
1805
1815
|
else if (_this._horizontalScrollDirection === 2 /* RIGHT */) {
|
|
1806
|
-
incrementHorizontalScroll(node,
|
|
1816
|
+
incrementHorizontalScroll(node, scrollStep);
|
|
1807
1817
|
}
|
|
1808
1818
|
});
|
|
1809
1819
|
};
|
|
@@ -1834,19 +1844,8 @@
|
|
|
1834
1844
|
};
|
|
1835
1845
|
/** Starts dragging an item. */
|
|
1836
1846
|
DropListRef.prototype.start = function () {
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
this.beforeStarted.next();
|
|
1840
|
-
this._isDragging = true;
|
|
1841
|
-
// We need to disable scroll snapping while the user is dragging, because it breaks automatic
|
|
1842
|
-
// scrolling. The browser seems to round the value based on the snapping points which means
|
|
1843
|
-
// that we can't increment/decrement the scroll position.
|
|
1844
|
-
this._initialScrollSnap = styles.msScrollSnapType || styles.scrollSnapType || '';
|
|
1845
|
-
styles.scrollSnapType = styles.msScrollSnapType = 'none';
|
|
1846
|
-
this._cacheItems();
|
|
1847
|
-
this._siblings.forEach(function (sibling) { return sibling._startReceiving(_this); });
|
|
1848
|
-
this._viewportScrollSubscription.unsubscribe();
|
|
1849
|
-
this._listenToScrollEvents();
|
|
1847
|
+
this._draggingStarted();
|
|
1848
|
+
this._notifyReceivingSiblings();
|
|
1850
1849
|
};
|
|
1851
1850
|
/**
|
|
1852
1851
|
* Emits an event to indicate that the user moved an item into the container.
|
|
@@ -1857,7 +1856,7 @@
|
|
|
1857
1856
|
* out automatically.
|
|
1858
1857
|
*/
|
|
1859
1858
|
DropListRef.prototype.enter = function (item, pointerX, pointerY, index) {
|
|
1860
|
-
this.
|
|
1859
|
+
this._draggingStarted();
|
|
1861
1860
|
// If sorting is disabled, we want the item to return to its starting
|
|
1862
1861
|
// position if the user is returning it to its initial container.
|
|
1863
1862
|
var newIndex;
|
|
@@ -1909,6 +1908,8 @@
|
|
|
1909
1908
|
// but we need to refresh them since the amount of items has changed and also parent rects.
|
|
1910
1909
|
this._cacheItemPositions();
|
|
1911
1910
|
this._cacheParentPositions();
|
|
1911
|
+
// Notify siblings at the end so that the item has been inserted into the `activeDraggables`.
|
|
1912
|
+
this._notifyReceivingSiblings();
|
|
1912
1913
|
this.entered.next({ item: item, container: this, currentIndex: this.getItemIndex(item) });
|
|
1913
1914
|
};
|
|
1914
1915
|
/**
|
|
@@ -2032,7 +2033,7 @@
|
|
|
2032
2033
|
*/
|
|
2033
2034
|
DropListRef.prototype._sortItem = function (item, pointerX, pointerY, pointerDelta) {
|
|
2034
2035
|
// Don't sort the item if sorting is disabled or it's out of range.
|
|
2035
|
-
if (this.sortingDisabled ||
|
|
2036
|
+
if (this.sortingDisabled || !this._clientRect ||
|
|
2036
2037
|
!isPointerNearClientRect(this._clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
2037
2038
|
return;
|
|
2038
2039
|
}
|
|
@@ -2148,6 +2149,20 @@
|
|
|
2148
2149
|
DropListRef.prototype._stopScrolling = function () {
|
|
2149
2150
|
this._stopScrollTimers.next();
|
|
2150
2151
|
};
|
|
2152
|
+
/** Starts the dragging sequence within the list. */
|
|
2153
|
+
DropListRef.prototype._draggingStarted = function () {
|
|
2154
|
+
var styles = coercion.coerceElement(this.element).style;
|
|
2155
|
+
this.beforeStarted.next();
|
|
2156
|
+
this._isDragging = true;
|
|
2157
|
+
// We need to disable scroll snapping while the user is dragging, because it breaks automatic
|
|
2158
|
+
// scrolling. The browser seems to round the value based on the snapping points which means
|
|
2159
|
+
// that we can't increment/decrement the scroll position.
|
|
2160
|
+
this._initialScrollSnap = styles.msScrollSnapType || styles.scrollSnapType || '';
|
|
2161
|
+
styles.scrollSnapType = styles.msScrollSnapType = 'none';
|
|
2162
|
+
this._cacheItems();
|
|
2163
|
+
this._viewportScrollSubscription.unsubscribe();
|
|
2164
|
+
this._listenToScrollEvents();
|
|
2165
|
+
};
|
|
2151
2166
|
/** Caches the positions of the configured scrollable parents. */
|
|
2152
2167
|
DropListRef.prototype._cacheParentPositions = function () {
|
|
2153
2168
|
var element = coercion.coerceElement(this.element);
|
|
@@ -2304,7 +2319,7 @@
|
|
|
2304
2319
|
* @param y Pointer position along the Y axis.
|
|
2305
2320
|
*/
|
|
2306
2321
|
DropListRef.prototype._isOverContainer = function (x, y) {
|
|
2307
|
-
return isInsideClientRect(this._clientRect, x, y);
|
|
2322
|
+
return this._clientRect != null && isInsideClientRect(this._clientRect, x, y);
|
|
2308
2323
|
};
|
|
2309
2324
|
/**
|
|
2310
2325
|
* Figures out whether an item should be moved into a sibling
|
|
@@ -2323,7 +2338,8 @@
|
|
|
2323
2338
|
* @param y Position of the item along the Y axis.
|
|
2324
2339
|
*/
|
|
2325
2340
|
DropListRef.prototype._canReceive = function (item, x, y) {
|
|
2326
|
-
if (!isInsideClientRect(this._clientRect, x, y) ||
|
|
2341
|
+
if (!this._clientRect || !isInsideClientRect(this._clientRect, x, y) ||
|
|
2342
|
+
!this.enterPredicate(item, this)) {
|
|
2327
2343
|
return false;
|
|
2328
2344
|
}
|
|
2329
2345
|
var elementFromPoint = this._getShadowRoot().elementFromPoint(x, y);
|
|
@@ -2345,9 +2361,16 @@
|
|
|
2345
2361
|
* Called by one of the connected drop lists when a dragging sequence has started.
|
|
2346
2362
|
* @param sibling Sibling in which dragging has started.
|
|
2347
2363
|
*/
|
|
2348
|
-
DropListRef.prototype._startReceiving = function (sibling) {
|
|
2364
|
+
DropListRef.prototype._startReceiving = function (sibling, items) {
|
|
2365
|
+
var _this = this;
|
|
2349
2366
|
var activeSiblings = this._activeSiblings;
|
|
2350
|
-
if (!activeSiblings.has(sibling)) {
|
|
2367
|
+
if (!activeSiblings.has(sibling) && items.every(function (item) {
|
|
2368
|
+
// Note that we have to add an exception to the `enterPredicate` for items that started off
|
|
2369
|
+
// in this drop list. The drag ref has logic that allows an item to return to its initial
|
|
2370
|
+
// container, if it has left the initial container and none of the connected containers
|
|
2371
|
+
// allow it to enter. See `DragRef._updateActiveDropContainer` for more context.
|
|
2372
|
+
return _this.enterPredicate(item, _this) || _this._draggables.indexOf(item) > -1;
|
|
2373
|
+
})) {
|
|
2351
2374
|
activeSiblings.add(sibling);
|
|
2352
2375
|
this._cacheParentPositions();
|
|
2353
2376
|
this._listenToScrollEvents();
|
|
@@ -2409,6 +2432,12 @@
|
|
|
2409
2432
|
}
|
|
2410
2433
|
return this._cachedShadowRoot;
|
|
2411
2434
|
};
|
|
2435
|
+
/** Notifies any siblings that may potentially receive the item. */
|
|
2436
|
+
DropListRef.prototype._notifyReceivingSiblings = function () {
|
|
2437
|
+
var _this = this;
|
|
2438
|
+
var draggedItems = this._activeDraggables.filter(function (item) { return item.isDragging(); });
|
|
2439
|
+
this._siblings.forEach(function (sibling) { return sibling._startReceiving(_this, draggedItems); });
|
|
2440
|
+
};
|
|
2412
2441
|
return DropListRef;
|
|
2413
2442
|
}());
|
|
2414
2443
|
/**
|
|
@@ -2556,9 +2585,14 @@
|
|
|
2556
2585
|
/** Registered drag item instances. */
|
|
2557
2586
|
this._dragInstances = new Set();
|
|
2558
2587
|
/** Drag item instances that are currently being dragged. */
|
|
2559
|
-
this._activeDragInstances =
|
|
2588
|
+
this._activeDragInstances = [];
|
|
2560
2589
|
/** Keeps track of the event listeners that we've bound to the `document`. */
|
|
2561
2590
|
this._globalListeners = new Map();
|
|
2591
|
+
/**
|
|
2592
|
+
* Predicate function to check if an item is being dragged. Moved out into a property,
|
|
2593
|
+
* because it'll be called a lot and we don't want to create a new function every time.
|
|
2594
|
+
*/
|
|
2595
|
+
this._draggingPredicate = function (item) { return item.isDragging(); };
|
|
2562
2596
|
/**
|
|
2563
2597
|
* Emits the `touchmove` or `mousemove` events that are dispatched
|
|
2564
2598
|
* while the user is dragging a drag item instance.
|
|
@@ -2576,14 +2610,19 @@
|
|
|
2576
2610
|
* @param event Event whose default action should be prevented.
|
|
2577
2611
|
*/
|
|
2578
2612
|
this._preventDefaultWhileDragging = function (event) {
|
|
2579
|
-
if (_this._activeDragInstances.
|
|
2613
|
+
if (_this._activeDragInstances.length > 0) {
|
|
2580
2614
|
event.preventDefault();
|
|
2581
2615
|
}
|
|
2582
2616
|
};
|
|
2583
2617
|
/** Event listener for `touchmove` that is bound even if no dragging is happening. */
|
|
2584
2618
|
this._persistentTouchmoveListener = function (event) {
|
|
2585
|
-
if (_this._activeDragInstances.
|
|
2586
|
-
|
|
2619
|
+
if (_this._activeDragInstances.length > 0) {
|
|
2620
|
+
// Note that we only want to prevent the default action after dragging has actually started.
|
|
2621
|
+
// Usually this is the same time at which the item is added to the `_activeDragInstances`,
|
|
2622
|
+
// but it could be pushed back if the user has set up a drag delay or threshold.
|
|
2623
|
+
if (_this._activeDragInstances.some(_this._draggingPredicate)) {
|
|
2624
|
+
event.preventDefault();
|
|
2625
|
+
}
|
|
2587
2626
|
_this.pointerMove.next(event);
|
|
2588
2627
|
}
|
|
2589
2628
|
};
|
|
@@ -2630,11 +2669,11 @@
|
|
|
2630
2669
|
DragDropRegistry.prototype.startDragging = function (drag, event) {
|
|
2631
2670
|
var _this = this;
|
|
2632
2671
|
// Do not process the same drag twice to avoid memory leaks and redundant listeners
|
|
2633
|
-
if (this._activeDragInstances.
|
|
2672
|
+
if (this._activeDragInstances.indexOf(drag) > -1) {
|
|
2634
2673
|
return;
|
|
2635
2674
|
}
|
|
2636
|
-
this._activeDragInstances.
|
|
2637
|
-
if (this._activeDragInstances.
|
|
2675
|
+
this._activeDragInstances.push(drag);
|
|
2676
|
+
if (this._activeDragInstances.length === 1) {
|
|
2638
2677
|
var isTouchEvent = event.type.startsWith('touch');
|
|
2639
2678
|
// We explicitly bind __active__ listeners here, because newer browsers will default to
|
|
2640
2679
|
// passive ones for `mousemove` and `touchmove`. The events need to be active, because we
|
|
@@ -2675,14 +2714,17 @@
|
|
|
2675
2714
|
};
|
|
2676
2715
|
/** Stops dragging a drag item instance. */
|
|
2677
2716
|
DragDropRegistry.prototype.stopDragging = function (drag) {
|
|
2678
|
-
this._activeDragInstances.
|
|
2679
|
-
if (
|
|
2680
|
-
this.
|
|
2717
|
+
var index = this._activeDragInstances.indexOf(drag);
|
|
2718
|
+
if (index > -1) {
|
|
2719
|
+
this._activeDragInstances.splice(index, 1);
|
|
2720
|
+
if (this._activeDragInstances.length === 0) {
|
|
2721
|
+
this._clearGlobalListeners();
|
|
2722
|
+
}
|
|
2681
2723
|
}
|
|
2682
2724
|
};
|
|
2683
2725
|
/** Gets whether a drag item instance is currently being dragged. */
|
|
2684
2726
|
DragDropRegistry.prototype.isDragging = function (drag) {
|
|
2685
|
-
return this._activeDragInstances.
|
|
2727
|
+
return this._activeDragInstances.indexOf(drag) > -1;
|
|
2686
2728
|
};
|
|
2687
2729
|
DragDropRegistry.prototype.ngOnDestroy = function () {
|
|
2688
2730
|
var _this = this;
|
|
@@ -3042,6 +3084,7 @@
|
|
|
3042
3084
|
ref.lockAxis = _this.lockAxis;
|
|
3043
3085
|
ref.sortingDisabled = coercion.coerceBooleanProperty(_this.sortingDisabled);
|
|
3044
3086
|
ref.autoScrollDisabled = coercion.coerceBooleanProperty(_this.autoScrollDisabled);
|
|
3087
|
+
ref.autoScrollStep = coercion.coerceNumberProperty(_this.autoScrollStep, 2);
|
|
3045
3088
|
ref
|
|
3046
3089
|
.connectedTo(siblings.filter(function (drop) { return drop && drop !== _this; }).map(function (list) { return list._dropListRef; }))
|
|
3047
3090
|
.withOrientation(_this.orientation);
|
|
@@ -3148,6 +3191,7 @@
|
|
|
3148
3191
|
enterPredicate: [{ type: i0.Input, args: ['cdkDropListEnterPredicate',] }],
|
|
3149
3192
|
sortPredicate: [{ type: i0.Input, args: ['cdkDropListSortPredicate',] }],
|
|
3150
3193
|
autoScrollDisabled: [{ type: i0.Input, args: ['cdkDropListAutoScrollDisabled',] }],
|
|
3194
|
+
autoScrollStep: [{ type: i0.Input, args: ['cdkDropListAutoScrollStep',] }],
|
|
3151
3195
|
dropped: [{ type: i0.Output, args: ['cdkDropListDropped',] }],
|
|
3152
3196
|
entered: [{ type: i0.Output, args: ['cdkDropListEntered',] }],
|
|
3153
3197
|
exited: [{ type: i0.Output, args: ['cdkDropListExited',] }],
|
|
@@ -3303,7 +3347,7 @@
|
|
|
3303
3347
|
* @deprecated `_document` parameter no longer being used and will be removed.
|
|
3304
3348
|
* @breaking-change 12.0.0
|
|
3305
3349
|
*/
|
|
3306
|
-
_document, _ngZone, _viewContainerRef, config, _dir, dragDrop, _changeDetectorRef, _selfHandle) {
|
|
3350
|
+
_document, _ngZone, _viewContainerRef, config, _dir, dragDrop, _changeDetectorRef, _selfHandle, parentDrag) {
|
|
3307
3351
|
var _this = this;
|
|
3308
3352
|
this.element = element;
|
|
3309
3353
|
this.dropContainer = dropContainer;
|
|
@@ -3346,7 +3390,8 @@
|
|
|
3346
3390
|
config.dragStartThreshold : 5,
|
|
3347
3391
|
pointerDirectionChangeThreshold: config && config.pointerDirectionChangeThreshold != null ?
|
|
3348
3392
|
config.pointerDirectionChangeThreshold : 5,
|
|
3349
|
-
zIndex: config === null || config === void 0 ? void 0 : config.zIndex
|
|
3393
|
+
zIndex: config === null || config === void 0 ? void 0 : config.zIndex,
|
|
3394
|
+
parentDragRef: parentDrag === null || parentDrag === void 0 ? void 0 : parentDrag._dragRef
|
|
3350
3395
|
});
|
|
3351
3396
|
this._dragRef.data = this;
|
|
3352
3397
|
if (config) {
|
|
@@ -3609,7 +3654,8 @@
|
|
|
3609
3654
|
{ type: bidi.Directionality, decorators: [{ type: i0.Optional }] },
|
|
3610
3655
|
{ type: DragDrop },
|
|
3611
3656
|
{ type: i0.ChangeDetectorRef },
|
|
3612
|
-
{ type: CdkDragHandle, decorators: [{ type: i0.Optional }, { type: i0.Self }, { type: i0.Inject, args: [CDK_DRAG_HANDLE,] }] }
|
|
3657
|
+
{ type: CdkDragHandle, decorators: [{ type: i0.Optional }, { type: i0.Self }, { type: i0.Inject, args: [CDK_DRAG_HANDLE,] }] },
|
|
3658
|
+
{ type: CdkDrag, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }, { type: i0.Inject, args: [CDK_DRAG_PARENT,] }] }
|
|
3613
3659
|
]; };
|
|
3614
3660
|
CdkDrag.propDecorators = {
|
|
3615
3661
|
_handles: [{ type: i0.ContentChildren, args: [CDK_DRAG_HANDLE, { descendants: true },] }],
|