@angular/cdk 11.0.0 → 11.0.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.
Files changed (117) hide show
  1. package/LICENSE +1 -1
  2. package/a11y/focus-monitor/focus-monitor.d.ts +6 -0
  3. package/a11y/focus-trap/focus-trap.d.ts +8 -8
  4. package/a11y/index.metadata.json +1 -1
  5. package/bundles/cdk-a11y.umd.js +39 -22
  6. package/bundles/cdk-a11y.umd.js.map +1 -1
  7. package/bundles/cdk-a11y.umd.min.js +8 -15
  8. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  9. package/bundles/cdk-coercion.umd.js +5 -5
  10. package/bundles/cdk-coercion.umd.js.map +1 -1
  11. package/bundles/cdk-coercion.umd.min.js.map +1 -1
  12. package/bundles/cdk-collections.umd.js +5 -5
  13. package/bundles/cdk-collections.umd.js.map +1 -1
  14. package/bundles/cdk-collections.umd.min.js +1 -1
  15. package/bundles/cdk-collections.umd.min.js.map +1 -1
  16. package/bundles/cdk-drag-drop.umd.js +121 -51
  17. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  18. package/bundles/cdk-drag-drop.umd.min.js +10 -10
  19. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  20. package/bundles/cdk-observers.umd.js +3 -4
  21. package/bundles/cdk-observers.umd.js.map +1 -1
  22. package/bundles/cdk-observers.umd.min.js +1 -1
  23. package/bundles/cdk-observers.umd.min.js.map +1 -1
  24. package/bundles/cdk-overlay.umd.js +20 -12
  25. package/bundles/cdk-overlay.umd.js.map +1 -1
  26. package/bundles/cdk-overlay.umd.min.js +18 -25
  27. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  28. package/bundles/cdk-platform.umd.js +1 -0
  29. package/bundles/cdk-platform.umd.js.map +1 -1
  30. package/bundles/cdk-platform.umd.min.js +1 -1
  31. package/bundles/cdk-platform.umd.min.js.map +1 -1
  32. package/bundles/cdk-portal.umd.js +5 -5
  33. package/bundles/cdk-portal.umd.js.map +1 -1
  34. package/bundles/cdk-portal.umd.min.js +1 -1
  35. package/bundles/cdk-portal.umd.min.js.map +1 -1
  36. package/bundles/cdk-scrolling.umd.js +14 -8
  37. package/bundles/cdk-scrolling.umd.js.map +1 -1
  38. package/bundles/cdk-scrolling.umd.min.js +3 -3
  39. package/bundles/cdk-scrolling.umd.min.js.map +1 -1
  40. package/bundles/cdk-table.umd.js +5 -5
  41. package/bundles/cdk-table.umd.js.map +1 -1
  42. package/bundles/cdk-table.umd.min.js +1 -1
  43. package/bundles/cdk-table.umd.min.js.map +1 -1
  44. package/bundles/cdk-testing-protractor.umd.js +5 -5
  45. package/bundles/cdk-testing-protractor.umd.js.map +1 -1
  46. package/bundles/cdk-testing-protractor.umd.min.js +1 -1
  47. package/bundles/cdk-testing-protractor.umd.min.js.map +1 -1
  48. package/bundles/cdk-testing-testbed.umd.js +5 -5
  49. package/bundles/cdk-testing-testbed.umd.js.map +1 -1
  50. package/bundles/cdk-testing-testbed.umd.min.js +1 -1
  51. package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
  52. package/bundles/cdk-testing.umd.js +5 -5
  53. package/bundles/cdk-testing.umd.js.map +1 -1
  54. package/bundles/cdk-testing.umd.min.js +1 -1
  55. package/bundles/cdk-testing.umd.min.js.map +1 -1
  56. package/bundles/cdk-tree.umd.js +5 -5
  57. package/bundles/cdk-tree.umd.js.map +1 -1
  58. package/bundles/cdk-tree.umd.min.js +2 -2
  59. package/bundles/cdk-tree.umd.min.js.map +1 -1
  60. package/bundles/cdk.umd.js +1 -1
  61. package/bundles/cdk.umd.js.map +1 -1
  62. package/bundles/cdk.umd.min.js +1 -1
  63. package/bundles/cdk.umd.min.js.map +1 -1
  64. package/drag-drop/directives/drag.d.ts +1 -1
  65. package/drag-drop/drag-drop-registry.d.ts +8 -1
  66. package/drag-drop/drag-ref.d.ts +15 -0
  67. package/drag-drop/drop-list-ref.d.ts +5 -1
  68. package/drag-drop/index.metadata.json +1 -1
  69. package/esm2015/a11y/focus-monitor/focus-monitor.js +18 -3
  70. package/esm2015/a11y/focus-trap/focus-trap.js +14 -9
  71. package/esm2015/drag-drop/directives/drag.js +6 -4
  72. package/esm2015/drag-drop/drag-drop-registry.js +25 -12
  73. package/esm2015/drag-drop/drag-ref.js +48 -15
  74. package/esm2015/drag-drop/drop-list-ref.js +39 -19
  75. package/esm2015/observers/observe-content.js +3 -4
  76. package/esm2015/overlay/scroll/block-scroll-strategy.js +13 -4
  77. package/esm2015/platform/features/scrolling.js +2 -1
  78. package/esm2015/scrolling/fixed-size-virtual-scroll.js +3 -2
  79. package/esm2015/scrolling/virtual-for-of.js +8 -4
  80. package/esm2015/tree/nested-node.js +1 -1
  81. package/esm2015/tree/padding.js +1 -1
  82. package/esm2015/tree/toggle.js +1 -1
  83. package/esm2015/tree/tree.js +1 -1
  84. package/esm2015/version.js +1 -1
  85. package/fesm2015/a11y.js +30 -10
  86. package/fesm2015/a11y.js.map +1 -1
  87. package/fesm2015/cdk.js +1 -1
  88. package/fesm2015/cdk.js.map +1 -1
  89. package/fesm2015/drag-drop.js +113 -45
  90. package/fesm2015/drag-drop.js.map +1 -1
  91. package/fesm2015/observers.js +2 -3
  92. package/fesm2015/observers.js.map +1 -1
  93. package/fesm2015/overlay.js +12 -4
  94. package/fesm2015/overlay.js.map +1 -1
  95. package/fesm2015/platform.js +1 -0
  96. package/fesm2015/platform.js.map +1 -1
  97. package/fesm2015/scrolling.js +9 -4
  98. package/fesm2015/scrolling.js.map +1 -1
  99. package/fesm2015/tree.js.map +1 -1
  100. package/observers/index.metadata.json +1 -1
  101. package/observers/observe-content.d.ts +2 -2
  102. package/overlay/index.metadata.json +1 -1
  103. package/package.json +1 -1
  104. package/schematics/migration.json +5 -0
  105. package/schematics/ng-add/index.js +1 -1
  106. package/schematics/ng-update/devkit-file-system.d.ts +1 -0
  107. package/schematics/ng-update/devkit-file-system.js +20 -13
  108. package/schematics/ng-update/index.d.ts +2 -0
  109. package/schematics/ng-update/index.js +7 -2
  110. package/schematics/update-tool/target-version.d.ts +2 -1
  111. package/schematics/update-tool/target-version.js +2 -1
  112. package/scrolling/index.metadata.json +1 -1
  113. package/tree/index.metadata.json +1 -1
  114. package/tree/nested-node.d.ts +3 -3
  115. package/tree/padding.d.ts +2 -2
  116. package/tree/toggle.d.ts +4 -4
  117. 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;
@@ -479,6 +480,7 @@
479
480
  if (newValue !== this._disabled) {
480
481
  this._disabled = newValue;
481
482
  this._toggleNativeDragInteractions();
483
+ this._handles.forEach(function (handle) { return toggleNativeDragInteractions(handle, newValue); });
482
484
  }
483
485
  },
484
486
  enumerable: false,
@@ -504,9 +506,21 @@
504
506
  };
505
507
  /** Registers the handles that can be used to drag the element. */
506
508
  DragRef.prototype.withHandles = function (handles) {
509
+ var _this = this;
507
510
  this._handles = handles.map(function (handle) { return coercion.coerceElement(handle); });
508
- this._handles.forEach(function (handle) { return toggleNativeDragInteractions(handle, false); });
511
+ this._handles.forEach(function (handle) { return toggleNativeDragInteractions(handle, _this.disabled); });
509
512
  this._toggleNativeDragInteractions();
513
+ // Delete any lingering disabled handles that may have been destroyed. Note that we re-create
514
+ // the set, rather than iterate over it and filter out the destroyed handles, because while
515
+ // the ES spec allows for sets to be modified while they're being iterated over, some polyfills
516
+ // use an array internally which may throw an error.
517
+ var disabledHandles = new Set();
518
+ this._disabledHandles.forEach(function (handle) {
519
+ if (_this._handles.indexOf(handle) > -1) {
520
+ disabledHandles.add(handle);
521
+ }
522
+ });
523
+ this._disabledHandles = disabledHandles;
510
524
  return this;
511
525
  };
512
526
  /**
@@ -609,8 +623,9 @@
609
623
  * @param handle Handle element that should be disabled.
610
624
  */
611
625
  DragRef.prototype.disableHandle = function (handle) {
612
- if (this._handles.indexOf(handle) > -1) {
626
+ if (!this._disabledHandles.has(handle) && this._handles.indexOf(handle) > -1) {
613
627
  this._disabledHandles.add(handle);
628
+ toggleNativeDragInteractions(handle, true);
614
629
  }
615
630
  };
616
631
  /**
@@ -618,7 +633,10 @@
618
633
  * @param handle Handle element to be enabled.
619
634
  */
620
635
  DragRef.prototype.enableHandle = function (handle) {
621
- this._disabledHandles.delete(handle);
636
+ if (this._disabledHandles.has(handle)) {
637
+ this._disabledHandles.delete(handle);
638
+ toggleNativeDragInteractions(handle, this.disabled);
639
+ }
622
640
  };
623
641
  /** Sets the layout direction of the draggable item. */
624
642
  DragRef.prototype.withDirection = function (direction) {
@@ -743,6 +761,8 @@
743
761
  var preview = this._preview = this._createPreviewElement();
744
762
  var placeholder = this._placeholder = this._createPlaceholderElement();
745
763
  var anchor = this._anchor = this._anchor || this._document.createComment('');
764
+ // Needs to happen before the root element is moved.
765
+ var shadowRoot = this._getShadowRoot();
746
766
  // Insert an anchor node so that we can restore the element's position in the DOM.
747
767
  parent.insertBefore(anchor, element);
748
768
  // We move the element out at the end of the body and we make it hidden, because keeping it in
@@ -750,7 +770,7 @@
750
770
  // from the DOM completely, because iOS will stop firing all subsequent events in the chain.
751
771
  toggleVisibility(element, false);
752
772
  this._document.body.appendChild(parent.replaceChild(placeholder, element));
753
- getPreviewInsertionPoint(this._document).appendChild(preview);
773
+ getPreviewInsertionPoint(this._document, shadowRoot).appendChild(preview);
754
774
  this.started.next({ source: this }); // Emit before notifying the container.
755
775
  dropContainer.start();
756
776
  this._initialContainer = dropContainer;
@@ -772,10 +792,11 @@
772
792
  */
773
793
  DragRef.prototype._initializeDragSequence = function (referenceElement, event) {
774
794
  var _this = this;
775
- // Always stop propagation for the event that initializes
776
- // the dragging sequence, in order to prevent it from potentially
777
- // starting another sequence for a draggable parent somewhere up the DOM tree.
778
- event.stopPropagation();
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
+ }
779
800
  var isDragging = this.isDragging();
780
801
  var isTouchSequence = isTouchEvent(event);
781
802
  var isAuxiliaryMouseButton = !isTouchSequence && event.button !== 0;
@@ -1243,6 +1264,18 @@
1243
1264
  return cachedPosition ? cachedPosition.scrollPosition :
1244
1265
  this._viewportRuler.getViewportScrollPosition();
1245
1266
  };
1267
+ /**
1268
+ * Lazily resolves and returns the shadow root of the element. We do this in a function, rather
1269
+ * than saving it in property directly on init, because we want to resolve it as late as possible
1270
+ * in order to ensure that the element has been moved into the shadow DOM. Doing it inside the
1271
+ * constructor might be too early if the element is inside of something like `ngFor` or `ngIf`.
1272
+ */
1273
+ DragRef.prototype._getShadowRoot = function () {
1274
+ if (this._cachedShadowRoot === undefined) {
1275
+ this._cachedShadowRoot = platform._getShadowRoot(this._rootElement);
1276
+ }
1277
+ return this._cachedShadowRoot;
1278
+ };
1246
1279
  return DragRef;
1247
1280
  }());
1248
1281
  /**
@@ -1276,11 +1309,12 @@
1276
1309
  return event.type[0] === 't';
1277
1310
  }
1278
1311
  /** Gets the element into which the drag preview should be inserted. */
1279
- function getPreviewInsertionPoint(documentRef) {
1312
+ function getPreviewInsertionPoint(documentRef, shadowRoot) {
1280
1313
  // We can't use the body if the user is in fullscreen mode,
1281
1314
  // because the preview will render under the fullscreen element.
1282
1315
  // TODO(crisbeto): dedupe this with the `FullscreenOverlayContainer` eventually.
1283
- return documentRef.fullscreenElement ||
1316
+ return shadowRoot ||
1317
+ documentRef.fullscreenElement ||
1284
1318
  documentRef.webkitFullscreenElement ||
1285
1319
  documentRef.mozFullScreenElement ||
1286
1320
  documentRef.msFullscreenElement ||
@@ -1329,7 +1363,7 @@
1329
1363
  extendStatics = Object.setPrototypeOf ||
1330
1364
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
1331
1365
  function (d, b) { for (var p in b)
1332
- if (b.hasOwnProperty(p))
1366
+ if (Object.prototype.hasOwnProperty.call(b, p))
1333
1367
  d[p] = b[p]; };
1334
1368
  return extendStatics(d, b);
1335
1369
  };
@@ -1476,10 +1510,10 @@
1476
1510
  k2 = k;
1477
1511
  o[k2] = m[k];
1478
1512
  });
1479
- function __exportStar(m, exports) {
1513
+ function __exportStar(m, o) {
1480
1514
  for (var p in m)
1481
- if (p !== "default" && !exports.hasOwnProperty(p))
1482
- __createBinding(exports, m, p);
1515
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
1516
+ __createBinding(o, m, p);
1483
1517
  }
1484
1518
  function __values(o) {
1485
1519
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
@@ -1589,7 +1623,7 @@
1589
1623
  var result = {};
1590
1624
  if (mod != null)
1591
1625
  for (var k in mod)
1592
- if (Object.hasOwnProperty.call(mod, k))
1626
+ if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
1593
1627
  __createBinding(result, mod, k);
1594
1628
  __setModuleDefault(result, mod);
1595
1629
  return result;
@@ -1736,6 +1770,8 @@
1736
1770
  * overlap with the swapped item after the swapping occurred.
1737
1771
  */
1738
1772
  this._previousSwap = { drag: null, delta: 0, overlaps: false };
1773
+ /** Draggable items in the container. */
1774
+ this._draggables = [];
1739
1775
  /** Drop lists that are connected to the current one. */
1740
1776
  this._siblings = [];
1741
1777
  /** Direction in which the list is oriented. */
@@ -1802,19 +1838,8 @@
1802
1838
  };
1803
1839
  /** Starts dragging an item. */
1804
1840
  DropListRef.prototype.start = function () {
1805
- var _this = this;
1806
- var styles = coercion.coerceElement(this.element).style;
1807
- this.beforeStarted.next();
1808
- this._isDragging = true;
1809
- // We need to disable scroll snapping while the user is dragging, because it breaks automatic
1810
- // scrolling. The browser seems to round the value based on the snapping points which means
1811
- // that we can't increment/decrement the scroll position.
1812
- this._initialScrollSnap = styles.msScrollSnapType || styles.scrollSnapType || '';
1813
- styles.scrollSnapType = styles.msScrollSnapType = 'none';
1814
- this._cacheItems();
1815
- this._siblings.forEach(function (sibling) { return sibling._startReceiving(_this); });
1816
- this._viewportScrollSubscription.unsubscribe();
1817
- this._listenToScrollEvents();
1841
+ this._draggingStarted();
1842
+ this._notifyReceivingSiblings();
1818
1843
  };
1819
1844
  /**
1820
1845
  * Emits an event to indicate that the user moved an item into the container.
@@ -1825,7 +1850,7 @@
1825
1850
  * out automatically.
1826
1851
  */
1827
1852
  DropListRef.prototype.enter = function (item, pointerX, pointerY, index) {
1828
- this.start();
1853
+ this._draggingStarted();
1829
1854
  // If sorting is disabled, we want the item to return to its starting
1830
1855
  // position if the user is returning it to its initial container.
1831
1856
  var newIndex;
@@ -1877,6 +1902,8 @@
1877
1902
  // but we need to refresh them since the amount of items has changed and also parent rects.
1878
1903
  this._cacheItemPositions();
1879
1904
  this._cacheParentPositions();
1905
+ // Notify siblings at the end so that the item has been inserted into the `activeDraggables`.
1906
+ this._notifyReceivingSiblings();
1880
1907
  this.entered.next({ item: item, container: this, currentIndex: this.getItemIndex(item) });
1881
1908
  };
1882
1909
  /**
@@ -2000,7 +2027,7 @@
2000
2027
  */
2001
2028
  DropListRef.prototype._sortItem = function (item, pointerX, pointerY, pointerDelta) {
2002
2029
  // Don't sort the item if sorting is disabled or it's out of range.
2003
- if (this.sortingDisabled ||
2030
+ if (this.sortingDisabled || !this._clientRect ||
2004
2031
  !isPointerNearClientRect(this._clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
2005
2032
  return;
2006
2033
  }
@@ -2116,6 +2143,20 @@
2116
2143
  DropListRef.prototype._stopScrolling = function () {
2117
2144
  this._stopScrollTimers.next();
2118
2145
  };
2146
+ /** Starts the dragging sequence within the list. */
2147
+ DropListRef.prototype._draggingStarted = function () {
2148
+ var styles = coercion.coerceElement(this.element).style;
2149
+ this.beforeStarted.next();
2150
+ this._isDragging = true;
2151
+ // We need to disable scroll snapping while the user is dragging, because it breaks automatic
2152
+ // scrolling. The browser seems to round the value based on the snapping points which means
2153
+ // that we can't increment/decrement the scroll position.
2154
+ this._initialScrollSnap = styles.msScrollSnapType || styles.scrollSnapType || '';
2155
+ styles.scrollSnapType = styles.msScrollSnapType = 'none';
2156
+ this._cacheItems();
2157
+ this._viewportScrollSubscription.unsubscribe();
2158
+ this._listenToScrollEvents();
2159
+ };
2119
2160
  /** Caches the positions of the configured scrollable parents. */
2120
2161
  DropListRef.prototype._cacheParentPositions = function () {
2121
2162
  var element = coercion.coerceElement(this.element);
@@ -2272,7 +2313,7 @@
2272
2313
  * @param y Pointer position along the Y axis.
2273
2314
  */
2274
2315
  DropListRef.prototype._isOverContainer = function (x, y) {
2275
- return isInsideClientRect(this._clientRect, x, y);
2316
+ return this._clientRect != null && isInsideClientRect(this._clientRect, x, y);
2276
2317
  };
2277
2318
  /**
2278
2319
  * Figures out whether an item should be moved into a sibling
@@ -2291,7 +2332,8 @@
2291
2332
  * @param y Position of the item along the Y axis.
2292
2333
  */
2293
2334
  DropListRef.prototype._canReceive = function (item, x, y) {
2294
- if (!isInsideClientRect(this._clientRect, x, y) || !this.enterPredicate(item, this)) {
2335
+ if (!this._clientRect || !isInsideClientRect(this._clientRect, x, y) ||
2336
+ !this.enterPredicate(item, this)) {
2295
2337
  return false;
2296
2338
  }
2297
2339
  var elementFromPoint = this._getShadowRoot().elementFromPoint(x, y);
@@ -2313,9 +2355,16 @@
2313
2355
  * Called by one of the connected drop lists when a dragging sequence has started.
2314
2356
  * @param sibling Sibling in which dragging has started.
2315
2357
  */
2316
- DropListRef.prototype._startReceiving = function (sibling) {
2358
+ DropListRef.prototype._startReceiving = function (sibling, items) {
2359
+ var _this = this;
2317
2360
  var activeSiblings = this._activeSiblings;
2318
- if (!activeSiblings.has(sibling)) {
2361
+ if (!activeSiblings.has(sibling) && items.every(function (item) {
2362
+ // Note that we have to add an exception to the `enterPredicate` for items that started off
2363
+ // in this drop list. The drag ref has logic that allows an item to return to its initial
2364
+ // container, if it has left the initial container and none of the connected containers
2365
+ // allow it to enter. See `DragRef._updateActiveDropContainer` for more context.
2366
+ return _this.enterPredicate(item, _this) || _this._draggables.indexOf(item) > -1;
2367
+ })) {
2319
2368
  activeSiblings.add(sibling);
2320
2369
  this._cacheParentPositions();
2321
2370
  this._listenToScrollEvents();
@@ -2377,6 +2426,12 @@
2377
2426
  }
2378
2427
  return this._cachedShadowRoot;
2379
2428
  };
2429
+ /** Notifies any siblings that may potentially receive the item. */
2430
+ DropListRef.prototype._notifyReceivingSiblings = function () {
2431
+ var _this = this;
2432
+ var draggedItems = this._activeDraggables.filter(function (item) { return item.isDragging(); });
2433
+ this._siblings.forEach(function (sibling) { return sibling._startReceiving(_this, draggedItems); });
2434
+ };
2380
2435
  return DropListRef;
2381
2436
  }());
2382
2437
  /**
@@ -2524,9 +2579,14 @@
2524
2579
  /** Registered drag item instances. */
2525
2580
  this._dragInstances = new Set();
2526
2581
  /** Drag item instances that are currently being dragged. */
2527
- this._activeDragInstances = new Set();
2582
+ this._activeDragInstances = [];
2528
2583
  /** Keeps track of the event listeners that we've bound to the `document`. */
2529
2584
  this._globalListeners = new Map();
2585
+ /**
2586
+ * Predicate function to check if an item is being dragged. Moved out into a property,
2587
+ * because it'll be called a lot and we don't want to create a new function every time.
2588
+ */
2589
+ this._draggingPredicate = function (item) { return item.isDragging(); };
2530
2590
  /**
2531
2591
  * Emits the `touchmove` or `mousemove` events that are dispatched
2532
2592
  * while the user is dragging a drag item instance.
@@ -2544,14 +2604,19 @@
2544
2604
  * @param event Event whose default action should be prevented.
2545
2605
  */
2546
2606
  this._preventDefaultWhileDragging = function (event) {
2547
- if (_this._activeDragInstances.size) {
2607
+ if (_this._activeDragInstances.length > 0) {
2548
2608
  event.preventDefault();
2549
2609
  }
2550
2610
  };
2551
2611
  /** Event listener for `touchmove` that is bound even if no dragging is happening. */
2552
2612
  this._persistentTouchmoveListener = function (event) {
2553
- if (_this._activeDragInstances.size) {
2554
- event.preventDefault();
2613
+ if (_this._activeDragInstances.length > 0) {
2614
+ // Note that we only want to prevent the default action after dragging has actually started.
2615
+ // Usually this is the same time at which the item is added to the `_activeDragInstances`,
2616
+ // but it could be pushed back if the user has set up a drag delay or threshold.
2617
+ if (_this._activeDragInstances.some(_this._draggingPredicate)) {
2618
+ event.preventDefault();
2619
+ }
2555
2620
  _this.pointerMove.next(event);
2556
2621
  }
2557
2622
  };
@@ -2598,11 +2663,11 @@
2598
2663
  DragDropRegistry.prototype.startDragging = function (drag, event) {
2599
2664
  var _this = this;
2600
2665
  // Do not process the same drag twice to avoid memory leaks and redundant listeners
2601
- if (this._activeDragInstances.has(drag)) {
2666
+ if (this._activeDragInstances.indexOf(drag) > -1) {
2602
2667
  return;
2603
2668
  }
2604
- this._activeDragInstances.add(drag);
2605
- if (this._activeDragInstances.size === 1) {
2669
+ this._activeDragInstances.push(drag);
2670
+ if (this._activeDragInstances.length === 1) {
2606
2671
  var isTouchEvent = event.type.startsWith('touch');
2607
2672
  // We explicitly bind __active__ listeners here, because newer browsers will default to
2608
2673
  // passive ones for `mousemove` and `touchmove`. The events need to be active, because we
@@ -2643,14 +2708,17 @@
2643
2708
  };
2644
2709
  /** Stops dragging a drag item instance. */
2645
2710
  DragDropRegistry.prototype.stopDragging = function (drag) {
2646
- this._activeDragInstances.delete(drag);
2647
- if (this._activeDragInstances.size === 0) {
2648
- this._clearGlobalListeners();
2711
+ var index = this._activeDragInstances.indexOf(drag);
2712
+ if (index > -1) {
2713
+ this._activeDragInstances.splice(index, 1);
2714
+ if (this._activeDragInstances.length === 0) {
2715
+ this._clearGlobalListeners();
2716
+ }
2649
2717
  }
2650
2718
  };
2651
2719
  /** Gets whether a drag item instance is currently being dragged. */
2652
2720
  DragDropRegistry.prototype.isDragging = function (drag) {
2653
- return this._activeDragInstances.has(drag);
2721
+ return this._activeDragInstances.indexOf(drag) > -1;
2654
2722
  };
2655
2723
  DragDropRegistry.prototype.ngOnDestroy = function () {
2656
2724
  var _this = this;
@@ -3271,7 +3339,7 @@
3271
3339
  * @deprecated `_document` parameter no longer being used and will be removed.
3272
3340
  * @breaking-change 12.0.0
3273
3341
  */
3274
- _document, _ngZone, _viewContainerRef, config, _dir, dragDrop, _changeDetectorRef, _selfHandle) {
3342
+ _document, _ngZone, _viewContainerRef, config, _dir, dragDrop, _changeDetectorRef, _selfHandle, parentDrag) {
3275
3343
  var _this = this;
3276
3344
  this.element = element;
3277
3345
  this.dropContainer = dropContainer;
@@ -3314,7 +3382,8 @@
3314
3382
  config.dragStartThreshold : 5,
3315
3383
  pointerDirectionChangeThreshold: config && config.pointerDirectionChangeThreshold != null ?
3316
3384
  config.pointerDirectionChangeThreshold : 5,
3317
- zIndex: config === null || config === void 0 ? void 0 : config.zIndex
3385
+ zIndex: config === null || config === void 0 ? void 0 : config.zIndex,
3386
+ parentDragRef: parentDrag === null || parentDrag === void 0 ? void 0 : parentDrag._dragRef
3318
3387
  });
3319
3388
  this._dragRef.data = this;
3320
3389
  if (config) {
@@ -3577,7 +3646,8 @@
3577
3646
  { type: bidi.Directionality, decorators: [{ type: i0.Optional }] },
3578
3647
  { type: DragDrop },
3579
3648
  { type: i0.ChangeDetectorRef },
3580
- { type: CdkDragHandle, decorators: [{ type: i0.Optional }, { type: i0.Self }, { type: i0.Inject, args: [CDK_DRAG_HANDLE,] }] }
3649
+ { type: CdkDragHandle, decorators: [{ type: i0.Optional }, { type: i0.Self }, { type: i0.Inject, args: [CDK_DRAG_HANDLE,] }] },
3650
+ { type: CdkDrag, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }, { type: i0.Inject, args: [CDK_DRAG_PARENT,] }] }
3581
3651
  ]; };
3582
3652
  CdkDrag.propDecorators = {
3583
3653
  _handles: [{ type: i0.ContentChildren, args: [CDK_DRAG_HANDLE, { descendants: true },] }],