@angular/cdk 12.1.0-next.1 → 12.1.2

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 (155) hide show
  1. package/a11y/index.metadata.json +1 -1
  2. package/a11y/input-modality/input-modality-detector.d.ts +0 -2
  3. package/bundles/cdk-a11y.umd.js +11 -16
  4. package/bundles/cdk-a11y.umd.js.map +1 -1
  5. package/bundles/cdk-drag-drop.umd.js +95 -46
  6. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  7. package/bundles/cdk-overlay.umd.js +6 -6
  8. package/bundles/cdk-overlay.umd.js.map +1 -1
  9. package/bundles/cdk-platform.umd.js +7 -0
  10. package/bundles/cdk-platform.umd.js.map +1 -1
  11. package/bundles/cdk-portal.umd.js.map +1 -1
  12. package/bundles/cdk-scrolling.umd.js +3 -3
  13. package/bundles/cdk-scrolling.umd.js.map +1 -1
  14. package/bundles/cdk-stepper.umd.js +11 -7
  15. package/bundles/cdk-stepper.umd.js.map +1 -1
  16. package/bundles/cdk-table.umd.js +25 -9
  17. package/bundles/cdk-table.umd.js.map +1 -1
  18. package/bundles/cdk-testing-protractor.umd.js.map +1 -1
  19. package/bundles/cdk-testing-selenium-webdriver.umd.js.map +1 -1
  20. package/bundles/cdk-testing-testbed.umd.js +4 -2
  21. package/bundles/cdk-testing-testbed.umd.js.map +1 -1
  22. package/bundles/cdk-testing.umd.js.map +1 -1
  23. package/bundles/cdk-tree.umd.js +3 -5
  24. package/bundles/cdk-tree.umd.js.map +1 -1
  25. package/bundles/cdk.umd.js +1 -1
  26. package/bundles/cdk.umd.js.map +1 -1
  27. package/drag-drop/drag-drop-registry.d.ts +14 -2
  28. package/drag-drop/drag-styling.d.ts +5 -10
  29. package/drag-drop/index.metadata.json +1 -1
  30. package/esm2015/a11y/fake-event-detection.js +7 -6
  31. package/esm2015/a11y/focus-monitor/focus-monitor.js +5 -5
  32. package/esm2015/a11y/focus-trap/configurable-focus-trap.js +1 -1
  33. package/esm2015/a11y/input-modality/input-modality-detector.js +5 -11
  34. package/esm2015/a11y/key-manager/activedescendant-key-manager.js +1 -1
  35. package/esm2015/a11y/key-manager/focus-key-manager.js +1 -1
  36. package/esm2015/drag-drop/drag-drop-registry.js +37 -3
  37. package/esm2015/drag-drop/drag-ref.js +29 -19
  38. package/esm2015/drag-drop/drag-styling.js +26 -16
  39. package/esm2015/drag-drop/drop-list-ref.js +4 -2
  40. package/esm2015/drag-drop/parent-position-tracker.js +3 -2
  41. package/esm2015/overlay/dispatchers/overlay-keyboard-dispatcher.js +1 -1
  42. package/esm2015/overlay/dispatchers/overlay-outside-click-dispatcher.js +3 -4
  43. package/esm2015/overlay/fullscreen-overlay-container.js +1 -1
  44. package/esm2015/overlay/overlay-container.js +6 -5
  45. package/esm2015/platform/features/shadow-dom.js +7 -1
  46. package/esm2015/portal/dom-portal-outlet.js +1 -1
  47. package/esm2015/portal/portal-directives.js +1 -1
  48. package/esm2015/portal/portal.js +1 -1
  49. package/esm2015/scrolling/viewport-ruler.js +4 -4
  50. package/esm2015/scrolling/virtual-scroll-viewport.js +1 -1
  51. package/esm2015/stepper/stepper.js +9 -4
  52. package/esm2015/table/cell.js +16 -4
  53. package/esm2015/table/row.js +1 -1
  54. package/esm2015/table/table.js +2 -2
  55. package/esm2015/testing/protractor/protractor-element.js +1 -1
  56. package/esm2015/testing/selenium-webdriver/selenium-web-driver-element.js +1 -1
  57. package/esm2015/testing/test-element.js +1 -1
  58. package/esm2015/testing/testbed/fake-events/event-objects.js +5 -3
  59. package/esm2015/testing/testbed/unit-test-element.js +1 -1
  60. package/esm2015/tree/control/flat-tree-control.js +1 -1
  61. package/esm2015/tree/control/nested-tree-control.js +1 -1
  62. package/esm2015/tree/nested-node.js +4 -6
  63. package/esm2015/version.js +1 -1
  64. package/fesm2015/a11y.js +12 -17
  65. package/fesm2015/a11y.js.map +1 -1
  66. package/fesm2015/cdk.js +1 -1
  67. package/fesm2015/cdk.js.map +1 -1
  68. package/fesm2015/drag-drop.js +92 -36
  69. package/fesm2015/drag-drop.js.map +1 -1
  70. package/fesm2015/overlay.js +7 -7
  71. package/fesm2015/overlay.js.map +1 -1
  72. package/fesm2015/platform.js +7 -1
  73. package/fesm2015/platform.js.map +1 -1
  74. package/fesm2015/portal.js.map +1 -1
  75. package/fesm2015/scrolling.js +3 -3
  76. package/fesm2015/scrolling.js.map +1 -1
  77. package/fesm2015/stepper.js +8 -3
  78. package/fesm2015/stepper.js.map +1 -1
  79. package/fesm2015/table.js +15 -3
  80. package/fesm2015/table.js.map +1 -1
  81. package/fesm2015/testing/protractor.js.map +1 -1
  82. package/fesm2015/testing/selenium-webdriver.js.map +1 -1
  83. package/fesm2015/testing/testbed.js +4 -2
  84. package/fesm2015/testing/testbed.js.map +1 -1
  85. package/fesm2015/testing.js.map +1 -1
  86. package/fesm2015/tree.js +3 -5
  87. package/fesm2015/tree.js.map +1 -1
  88. package/overlay/index.metadata.json +1 -1
  89. package/package.json +1 -1
  90. package/platform/features/shadow-dom.d.ts +2 -0
  91. package/platform/index.metadata.json +1 -1
  92. package/schematics/ng-add/index.js +1 -1
  93. package/schematics/ng-add/index.mjs +1 -1
  94. package/schematics/ng-add/package-config.js +5 -2
  95. package/schematics/ng-add/package-config.mjs +5 -2
  96. package/schematics/ng-update/devkit-migration-rule.js +1 -1
  97. package/schematics/ng-update/devkit-migration-rule.mjs +1 -1
  98. package/schematics/ng-update/find-stylesheets.js +2 -2
  99. package/schematics/ng-update/find-stylesheets.mjs +2 -2
  100. package/schematics/ng-update/html-parsing/elements.d.ts +2 -1
  101. package/schematics/ng-update/html-parsing/elements.js +6 -4
  102. package/schematics/ng-update/html-parsing/elements.mjs +6 -4
  103. package/schematics/ng-update/migrations/attribute-selectors.d.ts +3 -2
  104. package/schematics/ng-update/migrations/attribute-selectors.js +1 -1
  105. package/schematics/ng-update/migrations/attribute-selectors.mjs +1 -1
  106. package/schematics/ng-update/migrations/class-inheritance.js +1 -1
  107. package/schematics/ng-update/migrations/class-inheritance.mjs +1 -1
  108. package/schematics/ng-update/migrations/class-names.js +1 -1
  109. package/schematics/ng-update/migrations/class-names.mjs +1 -1
  110. package/schematics/ng-update/migrations/constructor-signature.js +1 -1
  111. package/schematics/ng-update/migrations/constructor-signature.mjs +1 -1
  112. package/schematics/ng-update/migrations/css-selectors.js +1 -1
  113. package/schematics/ng-update/migrations/css-selectors.mjs +1 -1
  114. package/schematics/ng-update/migrations/element-selectors.d.ts +3 -2
  115. package/schematics/ng-update/migrations/element-selectors.js +1 -1
  116. package/schematics/ng-update/migrations/element-selectors.mjs +1 -1
  117. package/schematics/ng-update/migrations/input-names.js +1 -1
  118. package/schematics/ng-update/migrations/input-names.mjs +1 -1
  119. package/schematics/ng-update/migrations/method-call-arguments.js +1 -1
  120. package/schematics/ng-update/migrations/method-call-arguments.mjs +1 -1
  121. package/schematics/ng-update/migrations/misc-template.js +1 -1
  122. package/schematics/ng-update/migrations/misc-template.mjs +1 -1
  123. package/schematics/ng-update/migrations/output-names.js +1 -1
  124. package/schematics/ng-update/migrations/output-names.mjs +1 -1
  125. package/schematics/ng-update/migrations/property-names.js +1 -1
  126. package/schematics/ng-update/migrations/property-names.mjs +1 -1
  127. package/schematics/ng-update/typescript/base-types.js +2 -2
  128. package/schematics/ng-update/typescript/base-types.mjs +2 -2
  129. package/schematics/tsconfig.json +6 -0
  130. package/schematics/update-tool/migration.d.ts +2 -2
  131. package/schematics/update-tool/migration.js +1 -1
  132. package/schematics/update-tool/migration.mjs +1 -1
  133. package/schematics/utils/build-component.js +7 -4
  134. package/schematics/utils/build-component.mjs +7 -4
  135. package/schematics/utils/html-manipulation.d.ts +2 -2
  136. package/schematics/utils/html-manipulation.js +1 -1
  137. package/schematics/utils/html-manipulation.mjs +1 -1
  138. package/schematics/utils/parse5-element.d.ts +2 -2
  139. package/schematics/utils/parse5-element.js +2 -2
  140. package/schematics/utils/parse5-element.mjs +2 -2
  141. package/schematics/utils/schematic-options.d.ts +2 -6
  142. package/schematics/utils/schematic-options.js +3 -2
  143. package/schematics/utils/schematic-options.mjs +3 -2
  144. package/schematics/utils/vendored-ast-utils/index.js +8 -7
  145. package/schematics/utils/vendored-ast-utils/index.mjs +8 -7
  146. package/scrolling/index.metadata.json +1 -1
  147. package/stepper/index.metadata.json +1 -1
  148. package/stepper/stepper.d.ts +6 -2
  149. package/table/index.metadata.json +1 -1
  150. package/testing/protractor/protractor-element.d.ts +1 -1
  151. package/testing/selenium-webdriver/selenium-web-driver-element.d.ts +1 -1
  152. package/testing/test-element.d.ts +1 -1
  153. package/testing/testbed/unit-test-element.d.ts +1 -1
  154. package/tree/index.metadata.json +1 -1
  155. package/tree/nested-node.d.ts +1 -3
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/cdk/scrolling'), require('@angular/cdk/platform'), require('@angular/cdk/coercion'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/bidi')) :
3
- typeof define === 'function' && define.amd ? define('@angular/cdk/drag-drop', ['exports', '@angular/core', '@angular/common', '@angular/cdk/scrolling', '@angular/cdk/platform', '@angular/cdk/coercion', 'rxjs', 'rxjs/operators', '@angular/cdk/bidi'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.cdk = global.ng.cdk || {}, global.ng.cdk.dragDrop = {}), global.ng.core, global.ng.common, global.ng.cdk.scrolling, global.ng.cdk.platform, global.ng.cdk.coercion, global.rxjs, global.rxjs.operators, global.ng.cdk.bidi));
5
- }(this, (function (exports, i0, i1, i2, platform, coercion, rxjs, operators, bidi) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/cdk/scrolling'), require('@angular/cdk/platform'), require('@angular/cdk/coercion'), require('@angular/cdk/a11y'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/bidi')) :
3
+ typeof define === 'function' && define.amd ? define('@angular/cdk/drag-drop', ['exports', '@angular/core', '@angular/common', '@angular/cdk/scrolling', '@angular/cdk/platform', '@angular/cdk/coercion', '@angular/cdk/a11y', 'rxjs', 'rxjs/operators', '@angular/cdk/bidi'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.cdk = global.ng.cdk || {}, global.ng.cdk.dragDrop = {}), global.ng.core, global.ng.common, global.ng.cdk.scrolling, global.ng.cdk.platform, global.ng.cdk.coercion, global.ng.cdk.a11y, global.rxjs, global.rxjs.operators, global.ng.cdk.bidi));
5
+ }(this, (function (exports, i0, i1, i2, platform, coercion, a11y, rxjs, operators, bidi) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -36,13 +36,20 @@
36
36
  * found in the LICENSE file at https://angular.io/license
37
37
  */
38
38
  /**
39
- * Shallow-extends a stylesheet object with another stylesheet object.
39
+ * Shallow-extends a stylesheet object with another stylesheet-like object.
40
+ * Note that the keys in `source` have to be dash-cased.
40
41
  * @docs-private
41
42
  */
42
- function extendStyles(dest, source) {
43
+ function extendStyles(dest, source, importantProperties) {
43
44
  for (var key in source) {
44
45
  if (source.hasOwnProperty(key)) {
45
- dest[key] = source[key];
46
+ var value = source[key];
47
+ if (value) {
48
+ dest.setProperty(key, value, (importantProperties === null || importantProperties === void 0 ? void 0 : importantProperties.has(key)) ? 'important' : '');
49
+ }
50
+ else {
51
+ dest.removeProperty(key);
52
+ }
46
53
  }
47
54
  }
48
55
  return dest;
@@ -56,26 +63,29 @@
56
63
  function toggleNativeDragInteractions(element, enable) {
57
64
  var userSelect = enable ? '' : 'none';
58
65
  extendStyles(element.style, {
59
- touchAction: enable ? '' : 'none',
60
- webkitUserDrag: enable ? '' : 'none',
61
- webkitTapHighlightColor: enable ? '' : 'transparent',
62
- userSelect: userSelect,
63
- msUserSelect: userSelect,
64
- webkitUserSelect: userSelect,
65
- MozUserSelect: userSelect
66
+ 'touch-action': enable ? '' : 'none',
67
+ '-webkit-user-drag': enable ? '' : 'none',
68
+ '-webkit-tap-highlight-color': enable ? '' : 'transparent',
69
+ 'user-select': userSelect,
70
+ '-ms-user-select': userSelect,
71
+ '-webkit-user-select': userSelect,
72
+ '-moz-user-select': userSelect
66
73
  });
67
74
  }
68
75
  /**
69
76
  * Toggles whether an element is visible while preserving its dimensions.
70
77
  * @param element Element whose visibility to toggle
71
78
  * @param enable Whether the element should be visible.
79
+ * @param importantProperties Properties to be set as `!important`.
72
80
  * @docs-private
73
81
  */
74
- function toggleVisibility(element, enable) {
75
- var styles = element.style;
76
- styles.position = enable ? '' : 'fixed';
77
- styles.top = styles.opacity = enable ? '' : '0';
78
- styles.left = enable ? '' : '-999em';
82
+ function toggleVisibility(element, enable, importantProperties) {
83
+ extendStyles(element.style, {
84
+ position: enable ? '' : 'fixed',
85
+ top: enable ? '' : '0',
86
+ opacity: enable ? '' : '0',
87
+ left: enable ? '' : '-999em'
88
+ }, importantProperties);
79
89
  }
80
90
  /**
81
91
  * Combines a transform string with an optional other transform
@@ -216,7 +226,7 @@
216
226
  };
217
227
  /** Handles scrolling while a drag is taking place. */
218
228
  ParentPositionTracker.prototype.handleScroll = function (event) {
219
- var target = event.target;
229
+ var target = platform._getEventTarget(event);
220
230
  var cachedPosition = this.positions.get(target);
221
231
  if (!cachedPosition) {
222
232
  return null;
@@ -336,6 +346,11 @@
336
346
  * addition to touch events.
337
347
  */
338
348
  var MOUSE_EVENT_IGNORE_TIME = 800;
349
+ /** Inline styles to be set as `!important` while dragging. */
350
+ var dragImportantProperties = new Set([
351
+ // Needs to be important, because some `mat-table` sets `position: sticky !important`. See #22781.
352
+ 'position'
353
+ ]);
339
354
  /**
340
355
  * Reference to a draggable item. Used to manipulate or dispose of the item.
341
356
  */
@@ -412,7 +427,7 @@
412
427
  // Delegate the event based on whether it started from a handle or the element itself.
413
428
  if (_this._handles.length) {
414
429
  var targetHandle = _this._handles.find(function (handle) {
415
- var target = event.target;
430
+ var target = platform._getEventTarget(event);
416
431
  return !!target && (target === handle || handle.contains(target));
417
432
  });
418
433
  if (targetHandle && !_this._disabledHandles.has(targetHandle) && !_this.disabled) {
@@ -827,7 +842,7 @@
827
842
  // We move the element out at the end of the body and we make it hidden, because keeping it in
828
843
  // place will throw off the consumer's `:last-child` selectors. We can't remove the element
829
844
  // from the DOM completely, because iOS will stop firing all subsequent events in the chain.
830
- toggleVisibility(element, false);
845
+ toggleVisibility(element, false, dragImportantProperties);
831
846
  this._document.body.appendChild(parent.replaceChild(placeholder, element));
832
847
  this._getPreviewInsertionPoint(parent, shadowRoot).appendChild(this._preview);
833
848
  this.started.next({ source: this }); // Emit before notifying the container.
@@ -860,19 +875,22 @@
860
875
  var isTouchSequence = isTouchEvent(event);
861
876
  var isAuxiliaryMouseButton = !isTouchSequence && event.button !== 0;
862
877
  var rootElement = this._rootElement;
878
+ var target = platform._getEventTarget(event);
863
879
  var isSyntheticEvent = !isTouchSequence && this._lastTouchEventTime &&
864
880
  this._lastTouchEventTime + MOUSE_EVENT_IGNORE_TIME > Date.now();
881
+ var isFakeEvent = isTouchSequence ? a11y.isFakeTouchstartFromScreenReader(event) :
882
+ a11y.isFakeMousedownFromScreenReader(event);
865
883
  // If the event started from an element with the native HTML drag&drop, it'll interfere
866
884
  // with our own dragging (e.g. `img` tags do it by default). Prevent the default action
867
885
  // to stop it from happening. Note that preventing on `dragstart` also seems to work, but
868
886
  // it's flaky and it fails if the user drags it away quickly. Also note that we only want
869
887
  // to do this for `mousedown` since doing the same for `touchstart` will stop any `click`
870
888
  // events from firing on touch devices.
871
- if (event.target && event.target.draggable && event.type === 'mousedown') {
889
+ if (target && target.draggable && event.type === 'mousedown') {
872
890
  event.preventDefault();
873
891
  }
874
892
  // Abort if the user is already dragging or is using a mouse button other than the primary one.
875
- if (isDragging || isAuxiliaryMouseButton || isSyntheticEvent) {
893
+ if (isDragging || isAuxiliaryMouseButton || isSyntheticEvent || isFakeEvent) {
876
894
  return;
877
895
  }
878
896
  // If we've got handles, we need to disable the tap highlight on the entire root element,
@@ -888,9 +906,9 @@
888
906
  this._removeSubscriptions();
889
907
  this._pointerMoveSubscription = this._dragDropRegistry.pointerMove.subscribe(this._pointerMove);
890
908
  this._pointerUpSubscription = this._dragDropRegistry.pointerUp.subscribe(this._pointerUp);
891
- this._scrollSubscription = this._dragDropRegistry.scroll.subscribe(function (scrollEvent) {
892
- _this._updateOnScroll(scrollEvent);
893
- });
909
+ this._scrollSubscription = this._dragDropRegistry
910
+ .scrolled(this._getShadowRoot())
911
+ .subscribe(function (scrollEvent) { return _this._updateOnScroll(scrollEvent); });
894
912
  if (this._boundaryElement) {
895
913
  this._boundaryRect = getMutableClientRect(this._boundaryElement);
896
914
  }
@@ -915,7 +933,7 @@
915
933
  // It's important that we maintain the position, because moving the element around in the DOM
916
934
  // can throw off `NgFor` which does smart diffing and re-creates elements only when necessary,
917
935
  // while moving the existing elements in all other cases.
918
- toggleVisibility(this._rootElement, true);
936
+ toggleVisibility(this._rootElement, true, dragImportantProperties);
919
937
  this._anchor.parentNode.replaceChild(this._rootElement, this._anchor);
920
938
  this._destroyPreview();
921
939
  this._destroyPlaceholder();
@@ -1021,14 +1039,14 @@
1021
1039
  extendStyles(preview.style, {
1022
1040
  // It's important that we disable the pointer events on the preview, because
1023
1041
  // it can throw off the `document.elementFromPoint` calls in the `CdkDropList`.
1024
- pointerEvents: 'none',
1042
+ 'pointer-events': 'none',
1025
1043
  // We have to reset the margin, because it can throw off positioning relative to the viewport.
1026
- margin: '0',
1027
- position: 'fixed',
1028
- top: '0',
1029
- left: '0',
1030
- zIndex: "" + (this._config.zIndex || 1000)
1031
- });
1044
+ 'margin': '0',
1045
+ 'position': 'fixed',
1046
+ 'top': '0',
1047
+ 'left': '0',
1048
+ 'z-index': "" + (this._config.zIndex || 1000)
1049
+ }, dragImportantProperties);
1032
1050
  toggleNativeDragInteractions(preview, false);
1033
1051
  preview.classList.add('cdk-drag-preview');
1034
1052
  preview.setAttribute('dir', this._direction);
@@ -1068,7 +1086,8 @@
1068
1086
  return this._ngZone.runOutsideAngular(function () {
1069
1087
  return new Promise(function (resolve) {
1070
1088
  var handler = (function (event) {
1071
- if (!event || (event.target === _this._preview && event.propertyName === 'transform')) {
1089
+ if (!event || (platform._getEventTarget(event) === _this._preview &&
1090
+ event.propertyName === 'transform')) {
1072
1091
  _this._preview.removeEventListener('transitionend', handler);
1073
1092
  resolve();
1074
1093
  clearTimeout(timeout);
@@ -1316,7 +1335,7 @@
1316
1335
  DragRef.prototype._updateOnScroll = function (event) {
1317
1336
  var scrollDifference = this._parentPositions.handleScroll(event);
1318
1337
  if (scrollDifference) {
1319
- var target = event.target;
1338
+ var target = platform._getEventTarget(event);
1320
1339
  // ClientRect dimensions are based on the scroll position of the page and its parent node so
1321
1340
  // we have to update the cached boundary ClientRect if the user has scrolled. Check for
1322
1341
  // the `document` specifically since IE doesn't support `contains` on it.
@@ -2487,7 +2506,9 @@
2487
2506
  */
2488
2507
  DropListRef.prototype._listenToScrollEvents = function () {
2489
2508
  var _this = this;
2490
- this._viewportScrollSubscription = this._dragDropRegistry.scroll.subscribe(function (event) {
2509
+ this._viewportScrollSubscription = this._dragDropRegistry
2510
+ .scrolled(this._getShadowRoot())
2511
+ .subscribe(function (event) {
2491
2512
  if (_this.isDragging()) {
2492
2513
  var scrollDifference_1 = _this._parentPositions.handleScroll(event);
2493
2514
  if (scrollDifference_1) {
@@ -2653,13 +2674,6 @@
2653
2674
  return [verticalScrollDirection, horizontalScrollDirection];
2654
2675
  }
2655
2676
 
2656
- /**
2657
- * @license
2658
- * Copyright Google LLC All Rights Reserved.
2659
- *
2660
- * Use of this source code is governed by an MIT-style license that can be
2661
- * found in the LICENSE file at https://angular.io/license
2662
- */
2663
2677
  /** Event options that can be used to bind an active, capturing event. */
2664
2678
  var activeCapturingEventOptions = platform.normalizePassiveListenerOptions({
2665
2679
  passive: false,
@@ -2700,7 +2714,11 @@
2700
2714
  * while the user is dragging a drag item instance.
2701
2715
  */
2702
2716
  this.pointerUp = new rxjs.Subject();
2703
- /** Emits when the viewport has been scrolled while the user is dragging an item. */
2717
+ /**
2718
+ * Emits when the viewport has been scrolled while the user is dragging an item.
2719
+ * @deprecated To be turned into a private member. Use the `scrolled` method instead.
2720
+ * @breaking-change 13.0.0
2721
+ */
2704
2722
  this.scroll = new rxjs.Subject();
2705
2723
  /**
2706
2724
  * Event listener that will prevent the default browser action while the user is dragging.
@@ -2823,6 +2841,37 @@
2823
2841
  DragDropRegistry.prototype.isDragging = function (drag) {
2824
2842
  return this._activeDragInstances.indexOf(drag) > -1;
2825
2843
  };
2844
+ /**
2845
+ * Gets a stream that will emit when any element on the page is scrolled while an item is being
2846
+ * dragged.
2847
+ * @param shadowRoot Optional shadow root that the current dragging sequence started from.
2848
+ * Top-level listeners won't pick up events coming from the shadow DOM so this parameter can
2849
+ * be used to include an additional top-level listener at the shadow root level.
2850
+ */
2851
+ DragDropRegistry.prototype.scrolled = function (shadowRoot) {
2852
+ var _this = this;
2853
+ var streams = [this.scroll];
2854
+ if (shadowRoot && shadowRoot !== this._document) {
2855
+ // Note that this is basically the same as `fromEvent` from rjxs, but we do it ourselves,
2856
+ // because we want to guarantee that the event is bound outside of the `NgZone`. With
2857
+ // `fromEvent` it'll only happen if the subscription is outside the `NgZone`.
2858
+ streams.push(new rxjs.Observable(function (observer) {
2859
+ return _this._ngZone.runOutsideAngular(function () {
2860
+ var eventOptions = true;
2861
+ var callback = function (event) {
2862
+ if (_this._activeDragInstances.length) {
2863
+ observer.next(event);
2864
+ }
2865
+ };
2866
+ shadowRoot.addEventListener('scroll', callback, eventOptions);
2867
+ return function () {
2868
+ shadowRoot.removeEventListener('scroll', callback, eventOptions);
2869
+ };
2870
+ });
2871
+ }));
2872
+ }
2873
+ return rxjs.merge.apply(void 0, __spreadArray([], __read(streams)));
2874
+ };
2826
2875
  DragDropRegistry.prototype.ngOnDestroy = function () {
2827
2876
  var _this = this;
2828
2877
  this._dragInstances.forEach(function (instance) { return _this.removeDragItem(instance); });