@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
package/fesm2015/cdk.js 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('11.0.0');
11
+ const VERSION = new Version('11.0.4');
12
12
 
13
13
  /**
14
14
  * @license
@@ -1 +1 @@
1
- {"version":3,"file":"cdk.js","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('11.0.0');\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;;;;;;;AAQA,AAEA;AACA,MAAa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC;;ACXvD;;;;;;GAMG;;ACNH;;;;;;GAMG;;;;"}
1
+ {"version":3,"file":"cdk.js","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('11.0.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;;;;;;;AAQA,AAEA;AACA,MAAa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC;;ACXvD;;;;;;GAMG;;ACNH;;;;;;GAMG;;;;"}
@@ -389,9 +389,6 @@ class DragRef {
389
389
  };
390
390
  /** Handler that is invoked when the user moves their pointer after they've initiated a drag. */
391
391
  this._pointerMove = (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
  const pointerPosition = this._getPointerPositionOnPage(event);
396
393
  if (!this._hasStartedDragging) {
397
394
  const distanceX = Math.abs(pointerPosition.x - this._pickupPositionOnPage.x);
@@ -426,6 +423,10 @@ class DragRef {
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
  const constrainedPointerPosition = this._getConstrainedPointerPosition(pointerPosition);
430
431
  this._hasMoved = true;
431
432
  this._lastKnownPointerPosition = pointerPosition;
@@ -478,6 +479,7 @@ class DragRef {
478
479
  if (newValue !== this._disabled) {
479
480
  this._disabled = newValue;
480
481
  this._toggleNativeDragInteractions();
482
+ this._handles.forEach(handle => toggleNativeDragInteractions(handle, newValue));
481
483
  }
482
484
  }
483
485
  /**
@@ -501,8 +503,19 @@ class DragRef {
501
503
  /** Registers the handles that can be used to drag the element. */
502
504
  withHandles(handles) {
503
505
  this._handles = handles.map(handle => coerceElement(handle));
504
- this._handles.forEach(handle => toggleNativeDragInteractions(handle, false));
506
+ this._handles.forEach(handle => toggleNativeDragInteractions(handle, this.disabled));
505
507
  this._toggleNativeDragInteractions();
508
+ // Delete any lingering disabled handles that may have been destroyed. Note that we re-create
509
+ // the set, rather than iterate over it and filter out the destroyed handles, because while
510
+ // the ES spec allows for sets to be modified while they're being iterated over, some polyfills
511
+ // use an array internally which may throw an error.
512
+ const disabledHandles = new Set();
513
+ this._disabledHandles.forEach(handle => {
514
+ if (this._handles.indexOf(handle) > -1) {
515
+ disabledHandles.add(handle);
516
+ }
517
+ });
518
+ this._disabledHandles = disabledHandles;
506
519
  return this;
507
520
  }
508
521
  /**
@@ -603,8 +616,9 @@ class DragRef {
603
616
  * @param handle Handle element that should be disabled.
604
617
  */
605
618
  disableHandle(handle) {
606
- if (this._handles.indexOf(handle) > -1) {
619
+ if (!this._disabledHandles.has(handle) && this._handles.indexOf(handle) > -1) {
607
620
  this._disabledHandles.add(handle);
621
+ toggleNativeDragInteractions(handle, true);
608
622
  }
609
623
  }
610
624
  /**
@@ -612,7 +626,10 @@ class DragRef {
612
626
  * @param handle Handle element to be enabled.
613
627
  */
614
628
  enableHandle(handle) {
615
- this._disabledHandles.delete(handle);
629
+ if (this._disabledHandles.has(handle)) {
630
+ this._disabledHandles.delete(handle);
631
+ toggleNativeDragInteractions(handle, this.disabled);
632
+ }
616
633
  }
617
634
  /** Sets the layout direction of the draggable item. */
618
635
  withDirection(direction) {
@@ -736,6 +753,8 @@ class DragRef {
736
753
  const preview = this._preview = this._createPreviewElement();
737
754
  const placeholder = this._placeholder = this._createPlaceholderElement();
738
755
  const anchor = this._anchor = this._anchor || this._document.createComment('');
756
+ // Needs to happen before the root element is moved.
757
+ const shadowRoot = this._getShadowRoot();
739
758
  // Insert an anchor node so that we can restore the element's position in the DOM.
740
759
  parent.insertBefore(anchor, element);
741
760
  // We move the element out at the end of the body and we make it hidden, because keeping it in
@@ -743,7 +762,7 @@ class DragRef {
743
762
  // from the DOM completely, because iOS will stop firing all subsequent events in the chain.
744
763
  toggleVisibility(element, false);
745
764
  this._document.body.appendChild(parent.replaceChild(placeholder, element));
746
- getPreviewInsertionPoint(this._document).appendChild(preview);
765
+ getPreviewInsertionPoint(this._document, shadowRoot).appendChild(preview);
747
766
  this.started.next({ source: this }); // Emit before notifying the container.
748
767
  dropContainer.start();
749
768
  this._initialContainer = dropContainer;
@@ -764,10 +783,11 @@ class DragRef {
764
783
  * @param event Browser event object that started the sequence.
765
784
  */
766
785
  _initializeDragSequence(referenceElement, event) {
767
- // Always stop propagation for the event that initializes
768
- // the dragging sequence, in order to prevent it from potentially
769
- // starting another sequence for a draggable parent somewhere up the DOM tree.
770
- event.stopPropagation();
786
+ // Stop propagation if the item is inside another
787
+ // draggable so we don't start multiple drag sequences.
788
+ if (this._config.parentDragRef) {
789
+ event.stopPropagation();
790
+ }
771
791
  const isDragging = this.isDragging();
772
792
  const isTouchSequence = isTouchEvent(event);
773
793
  const isAuxiliaryMouseButton = !isTouchSequence && event.button !== 0;
@@ -1230,6 +1250,18 @@ class DragRef {
1230
1250
  return cachedPosition ? cachedPosition.scrollPosition :
1231
1251
  this._viewportRuler.getViewportScrollPosition();
1232
1252
  }
1253
+ /**
1254
+ * Lazily resolves and returns the shadow root of the element. We do this in a function, rather
1255
+ * than saving it in property directly on init, because we want to resolve it as late as possible
1256
+ * in order to ensure that the element has been moved into the shadow DOM. Doing it inside the
1257
+ * constructor might be too early if the element is inside of something like `ngFor` or `ngIf`.
1258
+ */
1259
+ _getShadowRoot() {
1260
+ if (this._cachedShadowRoot === undefined) {
1261
+ this._cachedShadowRoot = _getShadowRoot(this._rootElement);
1262
+ }
1263
+ return this._cachedShadowRoot;
1264
+ }
1233
1265
  }
1234
1266
  /**
1235
1267
  * Gets a 3d `transform` that can be applied to an element.
@@ -1262,11 +1294,12 @@ function isTouchEvent(event) {
1262
1294
  return event.type[0] === 't';
1263
1295
  }
1264
1296
  /** Gets the element into which the drag preview should be inserted. */
1265
- function getPreviewInsertionPoint(documentRef) {
1297
+ function getPreviewInsertionPoint(documentRef, shadowRoot) {
1266
1298
  // We can't use the body if the user is in fullscreen mode,
1267
1299
  // because the preview will render under the fullscreen element.
1268
1300
  // TODO(crisbeto): dedupe this with the `FullscreenOverlayContainer` eventually.
1269
- return documentRef.fullscreenElement ||
1301
+ return shadowRoot ||
1302
+ documentRef.fullscreenElement ||
1270
1303
  documentRef.webkitFullscreenElement ||
1271
1304
  documentRef.mozFullScreenElement ||
1272
1305
  documentRef.msFullscreenElement ||
@@ -1427,6 +1460,8 @@ class DropListRef {
1427
1460
  * overlap with the swapped item after the swapping occurred.
1428
1461
  */
1429
1462
  this._previousSwap = { drag: null, delta: 0, overlaps: false };
1463
+ /** Draggable items in the container. */
1464
+ this._draggables = [];
1430
1465
  /** Drop lists that are connected to the current one. */
1431
1466
  this._siblings = [];
1432
1467
  /** Direction in which the list is oriented. */
@@ -1493,18 +1528,8 @@ class DropListRef {
1493
1528
  }
1494
1529
  /** Starts dragging an item. */
1495
1530
  start() {
1496
- const styles = coerceElement(this.element).style;
1497
- this.beforeStarted.next();
1498
- this._isDragging = true;
1499
- // We need to disable scroll snapping while the user is dragging, because it breaks automatic
1500
- // scrolling. The browser seems to round the value based on the snapping points which means
1501
- // that we can't increment/decrement the scroll position.
1502
- this._initialScrollSnap = styles.msScrollSnapType || styles.scrollSnapType || '';
1503
- styles.scrollSnapType = styles.msScrollSnapType = 'none';
1504
- this._cacheItems();
1505
- this._siblings.forEach(sibling => sibling._startReceiving(this));
1506
- this._viewportScrollSubscription.unsubscribe();
1507
- this._listenToScrollEvents();
1531
+ this._draggingStarted();
1532
+ this._notifyReceivingSiblings();
1508
1533
  }
1509
1534
  /**
1510
1535
  * Emits an event to indicate that the user moved an item into the container.
@@ -1515,7 +1540,7 @@ class DropListRef {
1515
1540
  * out automatically.
1516
1541
  */
1517
1542
  enter(item, pointerX, pointerY, index) {
1518
- this.start();
1543
+ this._draggingStarted();
1519
1544
  // If sorting is disabled, we want the item to return to its starting
1520
1545
  // position if the user is returning it to its initial container.
1521
1546
  let newIndex;
@@ -1567,6 +1592,8 @@ class DropListRef {
1567
1592
  // but we need to refresh them since the amount of items has changed and also parent rects.
1568
1593
  this._cacheItemPositions();
1569
1594
  this._cacheParentPositions();
1595
+ // Notify siblings at the end so that the item has been inserted into the `activeDraggables`.
1596
+ this._notifyReceivingSiblings();
1570
1597
  this.entered.next({ item, container: this, currentIndex: this.getItemIndex(item) });
1571
1598
  }
1572
1599
  /**
@@ -1689,7 +1716,7 @@ class DropListRef {
1689
1716
  */
1690
1717
  _sortItem(item, pointerX, pointerY, pointerDelta) {
1691
1718
  // Don't sort the item if sorting is disabled or it's out of range.
1692
- if (this.sortingDisabled ||
1719
+ if (this.sortingDisabled || !this._clientRect ||
1693
1720
  !isPointerNearClientRect(this._clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
1694
1721
  return;
1695
1722
  }
@@ -1803,6 +1830,20 @@ class DropListRef {
1803
1830
  _stopScrolling() {
1804
1831
  this._stopScrollTimers.next();
1805
1832
  }
1833
+ /** Starts the dragging sequence within the list. */
1834
+ _draggingStarted() {
1835
+ const styles = coerceElement(this.element).style;
1836
+ this.beforeStarted.next();
1837
+ this._isDragging = true;
1838
+ // We need to disable scroll snapping while the user is dragging, because it breaks automatic
1839
+ // scrolling. The browser seems to round the value based on the snapping points which means
1840
+ // that we can't increment/decrement the scroll position.
1841
+ this._initialScrollSnap = styles.msScrollSnapType || styles.scrollSnapType || '';
1842
+ styles.scrollSnapType = styles.msScrollSnapType = 'none';
1843
+ this._cacheItems();
1844
+ this._viewportScrollSubscription.unsubscribe();
1845
+ this._listenToScrollEvents();
1846
+ }
1806
1847
  /** Caches the positions of the configured scrollable parents. */
1807
1848
  _cacheParentPositions() {
1808
1849
  const element = coerceElement(this.element);
@@ -1956,7 +1997,7 @@ class DropListRef {
1956
1997
  * @param y Pointer position along the Y axis.
1957
1998
  */
1958
1999
  _isOverContainer(x, y) {
1959
- return isInsideClientRect(this._clientRect, x, y);
2000
+ return this._clientRect != null && isInsideClientRect(this._clientRect, x, y);
1960
2001
  }
1961
2002
  /**
1962
2003
  * Figures out whether an item should be moved into a sibling
@@ -1975,7 +2016,8 @@ class DropListRef {
1975
2016
  * @param y Position of the item along the Y axis.
1976
2017
  */
1977
2018
  _canReceive(item, x, y) {
1978
- if (!isInsideClientRect(this._clientRect, x, y) || !this.enterPredicate(item, this)) {
2019
+ if (!this._clientRect || !isInsideClientRect(this._clientRect, x, y) ||
2020
+ !this.enterPredicate(item, this)) {
1979
2021
  return false;
1980
2022
  }
1981
2023
  const elementFromPoint = this._getShadowRoot().elementFromPoint(x, y);
@@ -1997,9 +2039,15 @@ class DropListRef {
1997
2039
  * Called by one of the connected drop lists when a dragging sequence has started.
1998
2040
  * @param sibling Sibling in which dragging has started.
1999
2041
  */
2000
- _startReceiving(sibling) {
2042
+ _startReceiving(sibling, items) {
2001
2043
  const activeSiblings = this._activeSiblings;
2002
- if (!activeSiblings.has(sibling)) {
2044
+ if (!activeSiblings.has(sibling) && items.every(item => {
2045
+ // Note that we have to add an exception to the `enterPredicate` for items that started off
2046
+ // in this drop list. The drag ref has logic that allows an item to return to its initial
2047
+ // container, if it has left the initial container and none of the connected containers
2048
+ // allow it to enter. See `DragRef._updateActiveDropContainer` for more context.
2049
+ return this.enterPredicate(item, this) || this._draggables.indexOf(item) > -1;
2050
+ })) {
2003
2051
  activeSiblings.add(sibling);
2004
2052
  this._cacheParentPositions();
2005
2053
  this._listenToScrollEvents();
@@ -2058,6 +2106,11 @@ class DropListRef {
2058
2106
  }
2059
2107
  return this._cachedShadowRoot;
2060
2108
  }
2109
+ /** Notifies any siblings that may potentially receive the item. */
2110
+ _notifyReceivingSiblings() {
2111
+ const draggedItems = this._activeDraggables.filter(item => item.isDragging());
2112
+ this._siblings.forEach(sibling => sibling._startReceiving(this, draggedItems));
2113
+ }
2061
2114
  }
2062
2115
  /**
2063
2116
  * Finds the index of an item that matches a predicate function. Used as an equivalent
@@ -2203,9 +2256,14 @@ class DragDropRegistry {
2203
2256
  /** Registered drag item instances. */
2204
2257
  this._dragInstances = new Set();
2205
2258
  /** Drag item instances that are currently being dragged. */
2206
- this._activeDragInstances = new Set();
2259
+ this._activeDragInstances = [];
2207
2260
  /** Keeps track of the event listeners that we've bound to the `document`. */
2208
2261
  this._globalListeners = new Map();
2262
+ /**
2263
+ * Predicate function to check if an item is being dragged. Moved out into a property,
2264
+ * because it'll be called a lot and we don't want to create a new function every time.
2265
+ */
2266
+ this._draggingPredicate = (item) => item.isDragging();
2209
2267
  /**
2210
2268
  * Emits the `touchmove` or `mousemove` events that are dispatched
2211
2269
  * while the user is dragging a drag item instance.
@@ -2223,14 +2281,19 @@ class DragDropRegistry {
2223
2281
  * @param event Event whose default action should be prevented.
2224
2282
  */
2225
2283
  this._preventDefaultWhileDragging = (event) => {
2226
- if (this._activeDragInstances.size) {
2284
+ if (this._activeDragInstances.length > 0) {
2227
2285
  event.preventDefault();
2228
2286
  }
2229
2287
  };
2230
2288
  /** Event listener for `touchmove` that is bound even if no dragging is happening. */
2231
2289
  this._persistentTouchmoveListener = (event) => {
2232
- if (this._activeDragInstances.size) {
2233
- event.preventDefault();
2290
+ if (this._activeDragInstances.length > 0) {
2291
+ // Note that we only want to prevent the default action after dragging has actually started.
2292
+ // Usually this is the same time at which the item is added to the `_activeDragInstances`,
2293
+ // but it could be pushed back if the user has set up a drag delay or threshold.
2294
+ if (this._activeDragInstances.some(this._draggingPredicate)) {
2295
+ event.preventDefault();
2296
+ }
2234
2297
  this.pointerMove.next(event);
2235
2298
  }
2236
2299
  };
@@ -2275,11 +2338,11 @@ class DragDropRegistry {
2275
2338
  */
2276
2339
  startDragging(drag, event) {
2277
2340
  // Do not process the same drag twice to avoid memory leaks and redundant listeners
2278
- if (this._activeDragInstances.has(drag)) {
2341
+ if (this._activeDragInstances.indexOf(drag) > -1) {
2279
2342
  return;
2280
2343
  }
2281
- this._activeDragInstances.add(drag);
2282
- if (this._activeDragInstances.size === 1) {
2344
+ this._activeDragInstances.push(drag);
2345
+ if (this._activeDragInstances.length === 1) {
2283
2346
  const isTouchEvent = event.type.startsWith('touch');
2284
2347
  // We explicitly bind __active__ listeners here, because newer browsers will default to
2285
2348
  // passive ones for `mousemove` and `touchmove`. The events need to be active, because we
@@ -2320,14 +2383,17 @@ class DragDropRegistry {
2320
2383
  }
2321
2384
  /** Stops dragging a drag item instance. */
2322
2385
  stopDragging(drag) {
2323
- this._activeDragInstances.delete(drag);
2324
- if (this._activeDragInstances.size === 0) {
2325
- this._clearGlobalListeners();
2386
+ const index = this._activeDragInstances.indexOf(drag);
2387
+ if (index > -1) {
2388
+ this._activeDragInstances.splice(index, 1);
2389
+ if (this._activeDragInstances.length === 0) {
2390
+ this._clearGlobalListeners();
2391
+ }
2326
2392
  }
2327
2393
  }
2328
2394
  /** Gets whether a drag item instance is currently being dragged. */
2329
2395
  isDragging(drag) {
2330
- return this._activeDragInstances.has(drag);
2396
+ return this._activeDragInstances.indexOf(drag) > -1;
2331
2397
  }
2332
2398
  ngOnDestroy() {
2333
2399
  this._dragInstances.forEach(instance => this.removeDragItem(instance));
@@ -2934,7 +3000,7 @@ class CdkDrag {
2934
3000
  * @deprecated `_document` parameter no longer being used and will be removed.
2935
3001
  * @breaking-change 12.0.0
2936
3002
  */
2937
- _document, _ngZone, _viewContainerRef, config, _dir, dragDrop, _changeDetectorRef, _selfHandle) {
3003
+ _document, _ngZone, _viewContainerRef, config, _dir, dragDrop, _changeDetectorRef, _selfHandle, parentDrag) {
2938
3004
  this.element = element;
2939
3005
  this.dropContainer = dropContainer;
2940
3006
  this._ngZone = _ngZone;
@@ -2976,7 +3042,8 @@ class CdkDrag {
2976
3042
  config.dragStartThreshold : 5,
2977
3043
  pointerDirectionChangeThreshold: config && config.pointerDirectionChangeThreshold != null ?
2978
3044
  config.pointerDirectionChangeThreshold : 5,
2979
- zIndex: config === null || config === void 0 ? void 0 : config.zIndex
3045
+ zIndex: config === null || config === void 0 ? void 0 : config.zIndex,
3046
+ parentDragRef: parentDrag === null || parentDrag === void 0 ? void 0 : parentDrag._dragRef
2980
3047
  });
2981
3048
  this._dragRef.data = this;
2982
3049
  if (config) {
@@ -3231,7 +3298,8 @@ CdkDrag.ctorParameters = () => [
3231
3298
  { type: Directionality, decorators: [{ type: Optional }] },
3232
3299
  { type: DragDrop },
3233
3300
  { type: ChangeDetectorRef },
3234
- { type: CdkDragHandle, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [CDK_DRAG_HANDLE,] }] }
3301
+ { type: CdkDragHandle, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [CDK_DRAG_HANDLE,] }] },
3302
+ { type: CdkDrag, decorators: [{ type: Optional }, { type: SkipSelf }, { type: Inject, args: [CDK_DRAG_PARENT,] }] }
3235
3303
  ];
3236
3304
  CdkDrag.propDecorators = {
3237
3305
  _handles: [{ type: ContentChildren, args: [CDK_DRAG_HANDLE, { descendants: true },] }],