@angular/cdk 11.0.0-rc.4 → 11.0.3

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 (82) hide show
  1. package/a11y/focus-trap/focus-trap.d.ts +8 -8
  2. package/a11y/index.metadata.json +1 -1
  3. package/bundles/cdk-a11y.umd.js +18 -13
  4. package/bundles/cdk-a11y.umd.js.map +1 -1
  5. package/bundles/cdk-a11y.umd.min.js +7 -7
  6. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  7. package/bundles/cdk-coercion.umd.js +5 -5
  8. package/bundles/cdk-coercion.umd.js.map +1 -1
  9. package/bundles/cdk-coercion.umd.min.js.map +1 -1
  10. package/bundles/cdk-collections.umd.js +5 -5
  11. package/bundles/cdk-collections.umd.js.map +1 -1
  12. package/bundles/cdk-collections.umd.min.js +1 -1
  13. package/bundles/cdk-collections.umd.min.js.map +1 -1
  14. package/bundles/cdk-drag-drop.umd.js +43 -11
  15. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  16. package/bundles/cdk-drag-drop.umd.min.js +8 -8
  17. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  18. package/bundles/cdk-observers.umd.js +3 -4
  19. package/bundles/cdk-observers.umd.js.map +1 -1
  20. package/bundles/cdk-observers.umd.min.js +1 -1
  21. package/bundles/cdk-observers.umd.min.js.map +1 -1
  22. package/bundles/cdk-overlay.umd.js +5 -5
  23. package/bundles/cdk-overlay.umd.js.map +1 -1
  24. package/bundles/cdk-overlay.umd.min.js +1 -1
  25. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  26. package/bundles/cdk-portal.umd.js +5 -5
  27. package/bundles/cdk-portal.umd.js.map +1 -1
  28. package/bundles/cdk-portal.umd.min.js +1 -1
  29. package/bundles/cdk-portal.umd.min.js.map +1 -1
  30. package/bundles/cdk-scrolling.umd.js +5 -5
  31. package/bundles/cdk-scrolling.umd.js.map +1 -1
  32. package/bundles/cdk-scrolling.umd.min.js +2 -2
  33. package/bundles/cdk-scrolling.umd.min.js.map +1 -1
  34. package/bundles/cdk-table.umd.js +5 -5
  35. package/bundles/cdk-table.umd.js.map +1 -1
  36. package/bundles/cdk-table.umd.min.js +1 -1
  37. package/bundles/cdk-table.umd.min.js.map +1 -1
  38. package/bundles/cdk-testing-protractor.umd.js +5 -5
  39. package/bundles/cdk-testing-protractor.umd.js.map +1 -1
  40. package/bundles/cdk-testing-protractor.umd.min.js +1 -1
  41. package/bundles/cdk-testing-protractor.umd.min.js.map +1 -1
  42. package/bundles/cdk-testing-testbed.umd.js +5 -5
  43. package/bundles/cdk-testing-testbed.umd.js.map +1 -1
  44. package/bundles/cdk-testing-testbed.umd.min.js +1 -1
  45. package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
  46. package/bundles/cdk-testing.umd.js +5 -5
  47. package/bundles/cdk-testing.umd.js.map +1 -1
  48. package/bundles/cdk-testing.umd.min.js +1 -1
  49. package/bundles/cdk-testing.umd.min.js.map +1 -1
  50. package/bundles/cdk-tree.umd.js +5 -5
  51. package/bundles/cdk-tree.umd.js.map +1 -1
  52. package/bundles/cdk-tree.umd.min.js +2 -2
  53. package/bundles/cdk-tree.umd.min.js.map +1 -1
  54. package/bundles/cdk.umd.js +1 -1
  55. package/bundles/cdk.umd.js.map +1 -1
  56. package/bundles/cdk.umd.min.js +1 -1
  57. package/bundles/cdk.umd.min.js.map +1 -1
  58. package/drag-drop/drag-ref.d.ts +13 -0
  59. package/drag-drop/index.metadata.json +1 -1
  60. package/esm2015/a11y/focus-trap/focus-trap.js +14 -9
  61. package/esm2015/drag-drop/drag-ref.js +39 -8
  62. package/esm2015/observers/observe-content.js +3 -4
  63. package/esm2015/version.js +1 -1
  64. package/fesm2015/a11y.js +13 -8
  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 +37 -6
  69. package/fesm2015/drag-drop.js.map +1 -1
  70. package/fesm2015/observers.js +2 -3
  71. package/fesm2015/observers.js.map +1 -1
  72. package/observers/index.metadata.json +1 -1
  73. package/observers/observe-content.d.ts +2 -2
  74. package/package.json +3 -3
  75. package/schematics/migration.json +5 -0
  76. package/schematics/ng-add/index.js +1 -1
  77. package/schematics/ng-update/devkit-file-system.d.ts +1 -0
  78. package/schematics/ng-update/devkit-file-system.js +20 -13
  79. package/schematics/ng-update/index.d.ts +2 -0
  80. package/schematics/ng-update/index.js +7 -2
  81. package/schematics/update-tool/target-version.d.ts +2 -1
  82. package/schematics/update-tool/target-version.js +2 -1
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-rc.4');
11
+ const VERSION = new Version('11.0.3');
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-rc.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;;;;"}
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.3');\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;;;;"}
@@ -478,6 +478,7 @@ class DragRef {
478
478
  if (newValue !== this._disabled) {
479
479
  this._disabled = newValue;
480
480
  this._toggleNativeDragInteractions();
481
+ this._handles.forEach(handle => toggleNativeDragInteractions(handle, newValue));
481
482
  }
482
483
  }
483
484
  /**
@@ -501,8 +502,19 @@ class DragRef {
501
502
  /** Registers the handles that can be used to drag the element. */
502
503
  withHandles(handles) {
503
504
  this._handles = handles.map(handle => coerceElement(handle));
504
- this._handles.forEach(handle => toggleNativeDragInteractions(handle, false));
505
+ this._handles.forEach(handle => toggleNativeDragInteractions(handle, this.disabled));
505
506
  this._toggleNativeDragInteractions();
507
+ // Delete any lingering disabled handles that may have been destroyed. Note that we re-create
508
+ // the set, rather than iterate over it and filter out the destroyed handles, because while
509
+ // the ES spec allows for sets to be modified while they're being iterated over, some polyfills
510
+ // use an array internally which may throw an error.
511
+ const disabledHandles = new Set();
512
+ this._disabledHandles.forEach(handle => {
513
+ if (this._handles.indexOf(handle) > -1) {
514
+ disabledHandles.add(handle);
515
+ }
516
+ });
517
+ this._disabledHandles = disabledHandles;
506
518
  return this;
507
519
  }
508
520
  /**
@@ -603,8 +615,9 @@ class DragRef {
603
615
  * @param handle Handle element that should be disabled.
604
616
  */
605
617
  disableHandle(handle) {
606
- if (this._handles.indexOf(handle) > -1) {
618
+ if (!this._disabledHandles.has(handle) && this._handles.indexOf(handle) > -1) {
607
619
  this._disabledHandles.add(handle);
620
+ toggleNativeDragInteractions(handle, true);
608
621
  }
609
622
  }
610
623
  /**
@@ -612,7 +625,10 @@ class DragRef {
612
625
  * @param handle Handle element to be enabled.
613
626
  */
614
627
  enableHandle(handle) {
615
- this._disabledHandles.delete(handle);
628
+ if (this._disabledHandles.has(handle)) {
629
+ this._disabledHandles.delete(handle);
630
+ toggleNativeDragInteractions(handle, this.disabled);
631
+ }
616
632
  }
617
633
  /** Sets the layout direction of the draggable item. */
618
634
  withDirection(direction) {
@@ -736,6 +752,8 @@ class DragRef {
736
752
  const preview = this._preview = this._createPreviewElement();
737
753
  const placeholder = this._placeholder = this._createPlaceholderElement();
738
754
  const anchor = this._anchor = this._anchor || this._document.createComment('');
755
+ // Needs to happen before the root element is moved.
756
+ const shadowRoot = this._getShadowRoot();
739
757
  // Insert an anchor node so that we can restore the element's position in the DOM.
740
758
  parent.insertBefore(anchor, element);
741
759
  // We move the element out at the end of the body and we make it hidden, because keeping it in
@@ -743,7 +761,7 @@ class DragRef {
743
761
  // from the DOM completely, because iOS will stop firing all subsequent events in the chain.
744
762
  toggleVisibility(element, false);
745
763
  this._document.body.appendChild(parent.replaceChild(placeholder, element));
746
- getPreviewInsertionPoint(this._document).appendChild(preview);
764
+ getPreviewInsertionPoint(this._document, shadowRoot).appendChild(preview);
747
765
  this.started.next({ source: this }); // Emit before notifying the container.
748
766
  dropContainer.start();
749
767
  this._initialContainer = dropContainer;
@@ -1230,6 +1248,18 @@ class DragRef {
1230
1248
  return cachedPosition ? cachedPosition.scrollPosition :
1231
1249
  this._viewportRuler.getViewportScrollPosition();
1232
1250
  }
1251
+ /**
1252
+ * Lazily resolves and returns the shadow root of the element. We do this in a function, rather
1253
+ * than saving it in property directly on init, because we want to resolve it as late as possible
1254
+ * in order to ensure that the element has been moved into the shadow DOM. Doing it inside the
1255
+ * constructor might be too early if the element is inside of something like `ngFor` or `ngIf`.
1256
+ */
1257
+ _getShadowRoot() {
1258
+ if (this._cachedShadowRoot === undefined) {
1259
+ this._cachedShadowRoot = _getShadowRoot(this._rootElement);
1260
+ }
1261
+ return this._cachedShadowRoot;
1262
+ }
1233
1263
  }
1234
1264
  /**
1235
1265
  * Gets a 3d `transform` that can be applied to an element.
@@ -1262,11 +1292,12 @@ function isTouchEvent(event) {
1262
1292
  return event.type[0] === 't';
1263
1293
  }
1264
1294
  /** Gets the element into which the drag preview should be inserted. */
1265
- function getPreviewInsertionPoint(documentRef) {
1295
+ function getPreviewInsertionPoint(documentRef, shadowRoot) {
1266
1296
  // We can't use the body if the user is in fullscreen mode,
1267
1297
  // because the preview will render under the fullscreen element.
1268
1298
  // TODO(crisbeto): dedupe this with the `FullscreenOverlayContainer` eventually.
1269
- return documentRef.fullscreenElement ||
1299
+ return shadowRoot ||
1300
+ documentRef.fullscreenElement ||
1270
1301
  documentRef.webkitFullscreenElement ||
1271
1302
  documentRef.mozFullScreenElement ||
1272
1303
  documentRef.msFullscreenElement ||