@angular/cdk 14.1.0-rc.0 → 14.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 (73) hide show
  1. package/a11y/index.d.ts +8 -8
  2. package/bidi/index.d.ts +1 -1
  3. package/clipboard/index.d.ts +2 -2
  4. package/drag-drop/index.d.ts +4 -4
  5. package/esm2020/a11y/live-announcer/live-announcer.mjs +1 -1
  6. package/esm2020/bidi/dir-document-token.mjs +2 -2
  7. package/esm2020/clipboard/pending-copy.mjs +3 -3
  8. package/esm2020/dialog/dialog.mjs +2 -2
  9. package/esm2020/drag-drop/directives/drag.mjs +1 -1
  10. package/esm2020/drag-drop/drag-drop-registry.mjs +2 -2
  11. package/esm2020/drag-drop/drag-ref.mjs +3 -3
  12. package/esm2020/drag-drop/sorting/single-axis-sort-strategy.mjs +2 -2
  13. package/esm2020/menu/menu-item-radio.mjs +2 -2
  14. package/esm2020/overlay/overlay-config.mjs +2 -2
  15. package/esm2020/overlay/overlay-ref.mjs +19 -1
  16. package/esm2020/overlay/position/flexible-connected-position-strategy.mjs +6 -6
  17. package/esm2020/scrolling/scroll-dispatcher.mjs +2 -2
  18. package/esm2020/stepper/stepper.mjs +3 -3
  19. package/esm2020/table/sticky-position-listener.mjs +1 -1
  20. package/esm2020/table/table-errors.mjs +2 -2
  21. package/esm2020/table/table.mjs +3 -3
  22. package/esm2020/version.mjs +1 -1
  23. package/fesm2015/a11y.mjs.map +1 -1
  24. package/fesm2015/bidi.mjs +1 -1
  25. package/fesm2015/bidi.mjs.map +1 -1
  26. package/fesm2015/cdk.mjs +1 -1
  27. package/fesm2015/cdk.mjs.map +1 -1
  28. package/fesm2015/clipboard.mjs +2 -2
  29. package/fesm2015/clipboard.mjs.map +1 -1
  30. package/fesm2015/dialog.mjs +1 -1
  31. package/fesm2015/dialog.mjs.map +1 -1
  32. package/fesm2015/drag-drop.mjs +4 -4
  33. package/fesm2015/drag-drop.mjs.map +1 -1
  34. package/fesm2015/menu.mjs +1 -1
  35. package/fesm2015/menu.mjs.map +1 -1
  36. package/fesm2015/overlay.mjs +24 -6
  37. package/fesm2015/overlay.mjs.map +1 -1
  38. package/fesm2015/scrolling.mjs +1 -1
  39. package/fesm2015/scrolling.mjs.map +1 -1
  40. package/fesm2015/stepper.mjs +2 -2
  41. package/fesm2015/stepper.mjs.map +1 -1
  42. package/fesm2015/table.mjs +3 -3
  43. package/fesm2015/table.mjs.map +1 -1
  44. package/fesm2020/a11y.mjs.map +1 -1
  45. package/fesm2020/bidi.mjs +1 -1
  46. package/fesm2020/bidi.mjs.map +1 -1
  47. package/fesm2020/cdk.mjs +1 -1
  48. package/fesm2020/cdk.mjs.map +1 -1
  49. package/fesm2020/clipboard.mjs +2 -2
  50. package/fesm2020/clipboard.mjs.map +1 -1
  51. package/fesm2020/dialog.mjs +1 -1
  52. package/fesm2020/dialog.mjs.map +1 -1
  53. package/fesm2020/drag-drop.mjs +4 -4
  54. package/fesm2020/drag-drop.mjs.map +1 -1
  55. package/fesm2020/menu.mjs +1 -1
  56. package/fesm2020/menu.mjs.map +1 -1
  57. package/fesm2020/overlay.mjs +24 -6
  58. package/fesm2020/overlay.mjs.map +1 -1
  59. package/fesm2020/scrolling.mjs +1 -1
  60. package/fesm2020/scrolling.mjs.map +1 -1
  61. package/fesm2020/stepper.mjs +2 -2
  62. package/fesm2020/stepper.mjs.map +1 -1
  63. package/fesm2020/table.mjs +3 -3
  64. package/fesm2020/table.mjs.map +1 -1
  65. package/menu/index.d.ts +1 -1
  66. package/overlay/index.d.ts +3 -3
  67. package/package.json +1 -1
  68. package/schematics/ng-add/index.js +1 -1
  69. package/schematics/ng-add/index.mjs +1 -1
  70. package/schematics/update-tool/component-resource-collector.js +10 -3
  71. package/schematics/update-tool/component-resource-collector.mjs +10 -3
  72. package/scrolling/index.d.ts +1 -1
  73. package/table/index.d.ts +4 -4
@@ -370,7 +370,7 @@ class OverlayConfig {
370
370
  if (config[key] !== undefined) {
371
371
  // TypeScript, as of version 3.5, sees the left-hand-side of this expression
372
372
  // as "I don't know *which* key this is, so the only valid value is the intersection
373
- // of all the posible values." In this case, that happens to be `undefined`. TypeScript
373
+ // of all the possible values." In this case, that happens to be `undefined`. TypeScript
374
374
  // is not smart enough to see that the right-hand-side is actually an access of the same
375
375
  // exact type with the same exact key, meaning that the value type must be identical.
376
376
  // So we use `any` to work around this.
@@ -909,6 +909,24 @@ class OverlayRef {
909
909
  this._locationChanges = this._location.subscribe(() => this.dispose());
910
910
  }
911
911
  this._outsideClickDispatcher.add(this);
912
+ // TODO(crisbeto): the null check is here, because the portal outlet returns `any`.
913
+ // We should be guaranteed for the result to be `ComponentRef | EmbeddedViewRef`, but
914
+ // `instanceof EmbeddedViewRef` doesn't appear to work at the moment.
915
+ if (typeof attachResult?.onDestroy === 'function') {
916
+ // In most cases we control the portal and we know when it is being detached so that
917
+ // we can finish the disposal process. The exception is if the user passes in a custom
918
+ // `ViewContainerRef` that isn't destroyed through the overlay API. Note that we use
919
+ // `detach` here instead of `dispose`, because we don't know if the user intends to
920
+ // reattach the overlay at a later point. It also has the advantage of waiting for animations.
921
+ attachResult.onDestroy(() => {
922
+ if (this.hasAttached()) {
923
+ // We have to delay the `detach` call, because detaching immediately prevents
924
+ // other destroy hooks from running. This is likely a framework bug similar to
925
+ // https://github.com/angular/angular/issues/46119
926
+ this._ngZone.runOutsideAngular(() => Promise.resolve().then(() => this.detach()));
927
+ }
928
+ });
929
+ }
912
930
  return attachResult;
913
931
  }
914
932
  /**
@@ -1302,7 +1320,7 @@ class FlexibleConnectedPositionStrategy {
1302
1320
  * The selection of a position goes as follows:
1303
1321
  * - If any positions fit completely within the viewport as-is,
1304
1322
  * choose the first position that does so.
1305
- * - If flexible dimensions are enabled and at least one satifies the given minimum width/height,
1323
+ * - If flexible dimensions are enabled and at least one satisfies the given minimum width/height,
1306
1324
  * choose the position with the greatest available size modified by the positions' weight.
1307
1325
  * - If pushing is enabled, take the position that went off-screen the least and push it
1308
1326
  * on-screen.
@@ -1675,7 +1693,7 @@ class FlexibleConnectedPositionStrategy {
1675
1693
  }
1676
1694
  /**
1677
1695
  * Gets the point at which the overlay can be "pushed" on-screen. If the overlay is larger than
1678
- * the viewport, the top-left corner will be pushed on-screen (with overflow occuring on the
1696
+ * the viewport, the top-left corner will be pushed on-screen (with overflow occurring on the
1679
1697
  * right and bottom).
1680
1698
  *
1681
1699
  * @param start Starting point from which the overlay is pushed.
@@ -1744,7 +1762,7 @@ class FlexibleConnectedPositionStrategy {
1744
1762
  this._lastPosition = position;
1745
1763
  // Notify that the position has been changed along with its change properties.
1746
1764
  // We only emit if we've got any subscriptions, because the scroll visibility
1747
- // calculcations can be somewhat expensive.
1765
+ // calculations can be somewhat expensive.
1748
1766
  if (this._positionChanges.observers.length) {
1749
1767
  const scrollableViewProperties = this._getScrollVisibility();
1750
1768
  const changeEvent = new ConnectedOverlayPositionChange(position, scrollableViewProperties);
@@ -1838,7 +1856,7 @@ class FlexibleConnectedPositionStrategy {
1838
1856
  }
1839
1857
  /**
1840
1858
  * Sets the position and size of the overlay's sizing wrapper. The wrapper is positioned on the
1841
- * origin's connection point and stetches to the bounds of the viewport.
1859
+ * origin's connection point and stretches to the bounds of the viewport.
1842
1860
  *
1843
1861
  * @param origin The point on the origin element where the overlay is connected.
1844
1862
  * @param position The position preference
@@ -2076,7 +2094,7 @@ class FlexibleConnectedPositionStrategy {
2076
2094
  _getOffset(position, axis) {
2077
2095
  if (axis === 'x') {
2078
2096
  // We don't do something like `position['offset' + axis]` in
2079
- // order to avoid breking minifiers that rename properties.
2097
+ // order to avoid breaking minifiers that rename properties.
2080
2098
  return position.offsetX == null ? this._offsetX : position.offsetX;
2081
2099
  }
2082
2100
  return position.offsetY == null ? this._offsetY : position.offsetY;