@angular/cdk 12.1.0-next.0 → 12.1.1

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 (132) hide show
  1. package/a11y/focus-monitor/focus-monitor.d.ts +25 -31
  2. package/a11y/index.metadata.json +1 -1
  3. package/a11y/input-modality/input-modality-detector.d.ts +105 -0
  4. package/a11y/public-api.d.ts +1 -0
  5. package/bundles/cdk-a11y.umd.js +282 -146
  6. package/bundles/cdk-a11y.umd.js.map +1 -1
  7. package/bundles/cdk-drag-drop.umd.js +64 -20
  8. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  9. package/bundles/cdk-overlay.umd.js +7 -3
  10. package/bundles/cdk-overlay.umd.js.map +1 -1
  11. package/bundles/cdk-portal.umd.js.map +1 -1
  12. package/bundles/cdk-scrolling.umd.js.map +1 -1
  13. package/bundles/cdk-stepper.umd.js +11 -7
  14. package/bundles/cdk-stepper.umd.js.map +1 -1
  15. package/bundles/cdk-table.umd.js.map +1 -1
  16. package/bundles/cdk-tree.umd.js +3 -5
  17. package/bundles/cdk-tree.umd.js.map +1 -1
  18. package/bundles/cdk.umd.js +1 -1
  19. package/bundles/cdk.umd.js.map +1 -1
  20. package/drag-drop/drag-drop-registry.d.ts +14 -2
  21. package/drag-drop/index.metadata.json +1 -1
  22. package/drag-drop/parent-position-tracker.d.ts +2 -0
  23. package/esm2015/a11y/focus-monitor/focus-monitor.js +81 -121
  24. package/esm2015/a11y/focus-trap/configurable-focus-trap.js +1 -1
  25. package/esm2015/a11y/input-modality/input-modality-detector.js +179 -0
  26. package/esm2015/a11y/key-manager/activedescendant-key-manager.js +1 -1
  27. package/esm2015/a11y/key-manager/focus-key-manager.js +1 -1
  28. package/esm2015/a11y/public-api.js +2 -1
  29. package/esm2015/drag-drop/drag-drop-registry.js +37 -3
  30. package/esm2015/drag-drop/drag-ref.js +22 -12
  31. package/esm2015/drag-drop/drop-list-ref.js +4 -2
  32. package/esm2015/drag-drop/parent-position-tracker.js +6 -2
  33. package/esm2015/overlay/dispatchers/overlay-keyboard-dispatcher.js +1 -1
  34. package/esm2015/overlay/dispatchers/overlay-outside-click-dispatcher.js +1 -1
  35. package/esm2015/overlay/fullscreen-overlay-container.js +1 -1
  36. package/esm2015/overlay/overlay-container.js +8 -4
  37. package/esm2015/portal/dom-portal-outlet.js +1 -1
  38. package/esm2015/portal/portal-directives.js +1 -1
  39. package/esm2015/portal/portal.js +1 -1
  40. package/esm2015/scrolling/virtual-scroll-viewport.js +1 -1
  41. package/esm2015/stepper/stepper.js +9 -4
  42. package/esm2015/table/row.js +1 -1
  43. package/esm2015/tree/control/flat-tree-control.js +1 -1
  44. package/esm2015/tree/control/nested-tree-control.js +1 -1
  45. package/esm2015/tree/nested-node.js +4 -6
  46. package/esm2015/version.js +1 -1
  47. package/fesm2015/a11y.js +276 -149
  48. package/fesm2015/a11y.js.map +1 -1
  49. package/fesm2015/cdk.js +1 -1
  50. package/fesm2015/cdk.js.map +1 -1
  51. package/fesm2015/drag-drop.js +63 -13
  52. package/fesm2015/drag-drop.js.map +1 -1
  53. package/fesm2015/overlay.js +7 -3
  54. package/fesm2015/overlay.js.map +1 -1
  55. package/fesm2015/portal.js.map +1 -1
  56. package/fesm2015/scrolling.js.map +1 -1
  57. package/fesm2015/stepper.js +8 -3
  58. package/fesm2015/stepper.js.map +1 -1
  59. package/fesm2015/table.js.map +1 -1
  60. package/fesm2015/tree.js +3 -5
  61. package/fesm2015/tree.js.map +1 -1
  62. package/overlay/index.metadata.json +1 -1
  63. package/package.json +1 -1
  64. package/schematics/migration.json +5 -0
  65. package/schematics/ng-add/index.js +1 -1
  66. package/schematics/ng-add/index.mjs +1 -1
  67. package/schematics/ng-add/package-config.js +5 -2
  68. package/schematics/ng-add/package-config.mjs +5 -2
  69. package/schematics/ng-update/devkit-file-system.d.ts +2 -2
  70. package/schematics/ng-update/devkit-file-system.js +20 -21
  71. package/schematics/ng-update/devkit-file-system.mjs +20 -21
  72. package/schematics/ng-update/find-stylesheets.js +2 -2
  73. package/schematics/ng-update/find-stylesheets.mjs +2 -2
  74. package/schematics/ng-update/html-parsing/elements.d.ts +2 -1
  75. package/schematics/ng-update/html-parsing/elements.js +5 -4
  76. package/schematics/ng-update/html-parsing/elements.mjs +5 -4
  77. package/schematics/ng-update/index.d.ts +2 -0
  78. package/schematics/ng-update/index.js +7 -2
  79. package/schematics/ng-update/index.mjs +7 -2
  80. package/schematics/ng-update/migrations/attribute-selectors.d.ts +3 -2
  81. package/schematics/ng-update/migrations/attribute-selectors.js +1 -1
  82. package/schematics/ng-update/migrations/attribute-selectors.mjs +1 -1
  83. package/schematics/ng-update/migrations/class-inheritance.js +1 -1
  84. package/schematics/ng-update/migrations/class-inheritance.mjs +1 -1
  85. package/schematics/ng-update/migrations/class-names.js +1 -1
  86. package/schematics/ng-update/migrations/class-names.mjs +1 -1
  87. package/schematics/ng-update/migrations/constructor-signature.js +1 -1
  88. package/schematics/ng-update/migrations/constructor-signature.mjs +1 -1
  89. package/schematics/ng-update/migrations/css-selectors.js +1 -1
  90. package/schematics/ng-update/migrations/css-selectors.mjs +1 -1
  91. package/schematics/ng-update/migrations/element-selectors.d.ts +3 -2
  92. package/schematics/ng-update/migrations/element-selectors.js +1 -1
  93. package/schematics/ng-update/migrations/element-selectors.mjs +1 -1
  94. package/schematics/ng-update/migrations/input-names.js +1 -1
  95. package/schematics/ng-update/migrations/input-names.mjs +1 -1
  96. package/schematics/ng-update/migrations/method-call-arguments.js +1 -1
  97. package/schematics/ng-update/migrations/method-call-arguments.mjs +1 -1
  98. package/schematics/ng-update/migrations/misc-template.js +1 -1
  99. package/schematics/ng-update/migrations/misc-template.mjs +1 -1
  100. package/schematics/ng-update/migrations/output-names.js +1 -1
  101. package/schematics/ng-update/migrations/output-names.mjs +1 -1
  102. package/schematics/ng-update/migrations/property-names.js +1 -1
  103. package/schematics/ng-update/migrations/property-names.mjs +1 -1
  104. package/schematics/tsconfig.json +5 -0
  105. package/schematics/update-tool/component-resource-collector.js +2 -2
  106. package/schematics/update-tool/component-resource-collector.mjs +2 -2
  107. package/schematics/update-tool/file-system.d.ts +4 -2
  108. package/schematics/update-tool/file-system.js +1 -1
  109. package/schematics/update-tool/file-system.mjs +1 -1
  110. package/schematics/update-tool/target-version.d.ts +2 -1
  111. package/schematics/update-tool/target-version.js +2 -1
  112. package/schematics/update-tool/target-version.mjs +2 -1
  113. package/schematics/update-tool/utils/virtual-host.js +3 -3
  114. package/schematics/update-tool/utils/virtual-host.mjs +3 -3
  115. package/schematics/utils/build-component.js +7 -3
  116. package/schematics/utils/build-component.mjs +7 -3
  117. package/schematics/utils/html-manipulation.d.ts +2 -2
  118. package/schematics/utils/html-manipulation.js +1 -1
  119. package/schematics/utils/html-manipulation.mjs +1 -1
  120. package/schematics/utils/parse5-element.d.ts +2 -2
  121. package/schematics/utils/parse5-element.js +2 -2
  122. package/schematics/utils/parse5-element.mjs +2 -2
  123. package/schematics/utils/schematic-options.d.ts +2 -6
  124. package/schematics/utils/schematic-options.js +3 -2
  125. package/schematics/utils/schematic-options.mjs +3 -2
  126. package/schematics/utils/vendored-ast-utils/index.js +8 -7
  127. package/schematics/utils/vendored-ast-utils/index.mjs +8 -7
  128. package/scrolling/index.metadata.json +1 -1
  129. package/stepper/index.metadata.json +1 -1
  130. package/stepper/stepper.d.ts +6 -2
  131. package/tree/index.metadata.json +1 -1
  132. package/tree/nested-node.d.ts +1 -3
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('12.1.0-next.0');
11
+ const VERSION = new Version('12.1.1');
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('12.1.0-next.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;;;;;;;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;ACXtD;;;;;;;;ACAA;;;;;;;;;;"}
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('12.1.1');\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;;;;;;;AAUA;MACa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;ACXtD;;;;;;;;ACAA;;;;;;;;;;"}
@@ -197,7 +197,7 @@ class ParentPositionTracker {
197
197
  }
198
198
  /** Handles scrolling while a drag is taking place. */
199
199
  handleScroll(event) {
200
- const target = event.target;
200
+ const target = getEventTarget(event);
201
201
  const cachedPosition = this.positions.get(target);
202
202
  if (!cachedPosition) {
203
203
  return null;
@@ -232,6 +232,10 @@ class ParentPositionTracker {
232
232
  return { top: topDifference, left: leftDifference };
233
233
  }
234
234
  }
235
+ /** Gets the target of an event while accounting for shadow dom. */
236
+ function getEventTarget(event) {
237
+ return (event.composedPath ? event.composedPath()[0] : event.target);
238
+ }
235
239
 
236
240
  /**
237
241
  * @license
@@ -335,6 +339,11 @@ class DragRef {
335
339
  this._passiveTransform = { x: 0, y: 0 };
336
340
  /** CSS `transform` that is applied to the element while it's being dragged. */
337
341
  this._activeTransform = { x: 0, y: 0 };
342
+ /**
343
+ * Whether the dragging sequence has been started. Doesn't
344
+ * necessarily mean that the element has been moved.
345
+ */
346
+ this._hasStartedDragging = false;
338
347
  /** Emits when the item is being moved. */
339
348
  this._moveEvents = new Subject();
340
349
  /** Subscription to pointer movement events. */
@@ -386,7 +395,7 @@ class DragRef {
386
395
  // Delegate the event based on whether it started from a handle or the element itself.
387
396
  if (this._handles.length) {
388
397
  const targetHandle = this._handles.find(handle => {
389
- const target = event.target;
398
+ const target = getEventTarget(event);
390
399
  return !!target && (target === handle || handle.contains(target));
391
400
  });
392
401
  if (targetHandle && !this._disabledHandles.has(targetHandle) && !this.disabled) {
@@ -825,6 +834,7 @@ class DragRef {
825
834
  const isTouchSequence = isTouchEvent(event);
826
835
  const isAuxiliaryMouseButton = !isTouchSequence && event.button !== 0;
827
836
  const rootElement = this._rootElement;
837
+ const target = getEventTarget(event);
828
838
  const isSyntheticEvent = !isTouchSequence && this._lastTouchEventTime &&
829
839
  this._lastTouchEventTime + MOUSE_EVENT_IGNORE_TIME > Date.now();
830
840
  // If the event started from an element with the native HTML drag&drop, it'll interfere
@@ -833,7 +843,7 @@ class DragRef {
833
843
  // it's flaky and it fails if the user drags it away quickly. Also note that we only want
834
844
  // to do this for `mousedown` since doing the same for `touchstart` will stop any `click`
835
845
  // events from firing on touch devices.
836
- if (event.target && event.target.draggable && event.type === 'mousedown') {
846
+ if (target && target.draggable && event.type === 'mousedown') {
837
847
  event.preventDefault();
838
848
  }
839
849
  // Abort if the user is already dragging or is using a mouse button other than the primary one.
@@ -853,9 +863,9 @@ class DragRef {
853
863
  this._removeSubscriptions();
854
864
  this._pointerMoveSubscription = this._dragDropRegistry.pointerMove.subscribe(this._pointerMove);
855
865
  this._pointerUpSubscription = this._dragDropRegistry.pointerUp.subscribe(this._pointerUp);
856
- this._scrollSubscription = this._dragDropRegistry.scroll.subscribe(scrollEvent => {
857
- this._updateOnScroll(scrollEvent);
858
- });
866
+ this._scrollSubscription = this._dragDropRegistry
867
+ .scrolled(this._getShadowRoot())
868
+ .subscribe(scrollEvent => this._updateOnScroll(scrollEvent));
859
869
  if (this._boundaryElement) {
860
870
  this._boundaryRect = getMutableClientRect(this._boundaryElement);
861
871
  }
@@ -939,9 +949,12 @@ class DragRef {
939
949
  });
940
950
  });
941
951
  }
942
- this._dropContainer._startScrollingIfNecessary(rawX, rawY);
943
- this._dropContainer._sortItem(this, x, y, this._pointerDirectionDelta);
944
- this._applyPreviewTransform(x - this._pickupPositionInElement.x, y - this._pickupPositionInElement.y);
952
+ // Dragging may have been interrupted as a result of the events above.
953
+ if (this.isDragging()) {
954
+ this._dropContainer._startScrollingIfNecessary(rawX, rawY);
955
+ this._dropContainer._sortItem(this, x, y, this._pointerDirectionDelta);
956
+ this._applyPreviewTransform(x - this._pickupPositionInElement.x, y - this._pickupPositionInElement.y);
957
+ }
945
958
  }
946
959
  /**
947
960
  * Creates the element that will be rendered next to the user's pointer
@@ -1025,7 +1038,8 @@ class DragRef {
1025
1038
  return this._ngZone.runOutsideAngular(() => {
1026
1039
  return new Promise(resolve => {
1027
1040
  const handler = ((event) => {
1028
- if (!event || (event.target === this._preview && event.propertyName === 'transform')) {
1041
+ if (!event || (getEventTarget(event) === this._preview &&
1042
+ event.propertyName === 'transform')) {
1029
1043
  this._preview.removeEventListener('transitionend', handler);
1030
1044
  resolve();
1031
1045
  clearTimeout(timeout);
@@ -1273,7 +1287,7 @@ class DragRef {
1273
1287
  _updateOnScroll(event) {
1274
1288
  const scrollDifference = this._parentPositions.handleScroll(event);
1275
1289
  if (scrollDifference) {
1276
- const target = event.target;
1290
+ const target = getEventTarget(event);
1277
1291
  // ClientRect dimensions are based on the scroll position of the page and its parent node so
1278
1292
  // we have to update the cached boundary ClientRect if the user has scrolled. Check for
1279
1293
  // the `document` specifically since IE doesn't support `contains` on it.
@@ -2129,7 +2143,9 @@ class DropListRef {
2129
2143
  * Used for updating the internal state of the list.
2130
2144
  */
2131
2145
  _listenToScrollEvents() {
2132
- this._viewportScrollSubscription = this._dragDropRegistry.scroll.subscribe(event => {
2146
+ this._viewportScrollSubscription = this._dragDropRegistry
2147
+ .scrolled(this._getShadowRoot())
2148
+ .subscribe(event => {
2133
2149
  if (this.isDragging()) {
2134
2150
  const scrollDifference = this._parentPositions.handleScroll(event);
2135
2151
  if (scrollDifference) {
@@ -2337,7 +2353,11 @@ class DragDropRegistry {
2337
2353
  * while the user is dragging a drag item instance.
2338
2354
  */
2339
2355
  this.pointerUp = new Subject();
2340
- /** Emits when the viewport has been scrolled while the user is dragging an item. */
2356
+ /**
2357
+ * Emits when the viewport has been scrolled while the user is dragging an item.
2358
+ * @deprecated To be turned into a private member. Use the `scrolled` method instead.
2359
+ * @breaking-change 13.0.0
2360
+ */
2341
2361
  this.scroll = new Subject();
2342
2362
  /**
2343
2363
  * Event listener that will prevent the default browser action while the user is dragging.
@@ -2458,6 +2478,36 @@ class DragDropRegistry {
2458
2478
  isDragging(drag) {
2459
2479
  return this._activeDragInstances.indexOf(drag) > -1;
2460
2480
  }
2481
+ /**
2482
+ * Gets a stream that will emit when any element on the page is scrolled while an item is being
2483
+ * dragged.
2484
+ * @param shadowRoot Optional shadow root that the current dragging sequence started from.
2485
+ * Top-level listeners won't pick up events coming from the shadow DOM so this parameter can
2486
+ * be used to include an additional top-level listener at the shadow root level.
2487
+ */
2488
+ scrolled(shadowRoot) {
2489
+ const streams = [this.scroll];
2490
+ if (shadowRoot && shadowRoot !== this._document) {
2491
+ // Note that this is basically the same as `fromEvent` from rjxs, but we do it ourselves,
2492
+ // because we want to guarantee that the event is bound outside of the `NgZone`. With
2493
+ // `fromEvent` it'll only happen if the subscription is outside the `NgZone`.
2494
+ streams.push(new Observable((observer) => {
2495
+ return this._ngZone.runOutsideAngular(() => {
2496
+ const eventOptions = true;
2497
+ const callback = (event) => {
2498
+ if (this._activeDragInstances.length) {
2499
+ observer.next(event);
2500
+ }
2501
+ };
2502
+ shadowRoot.addEventListener('scroll', callback, eventOptions);
2503
+ return () => {
2504
+ shadowRoot.removeEventListener('scroll', callback, eventOptions);
2505
+ };
2506
+ });
2507
+ }));
2508
+ }
2509
+ return merge(...streams);
2510
+ }
2461
2511
  ngOnDestroy() {
2462
2512
  this._dragInstances.forEach(instance => this.removeDragItem(instance));
2463
2513
  this._dropInstances.forEach(instance => this.removeDropContainer(instance));