@angular/cdk 7.2.2 → 7.3.0

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/bundles/cdk-drag-drop.umd.js +2798 -2597
  2. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  3. package/bundles/cdk-drag-drop.umd.min.js +2 -2
  4. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  5. package/bundles/cdk-overlay.umd.js +86 -15
  6. package/bundles/cdk-overlay.umd.js.map +1 -1
  7. package/bundles/cdk-overlay.umd.min.js +2 -2
  8. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  9. package/bundles/cdk-stepper.umd.js +2 -2
  10. package/bundles/cdk-stepper.umd.js.map +1 -1
  11. package/bundles/cdk-stepper.umd.min.js.map +1 -1
  12. package/bundles/cdk.umd.js +1 -1
  13. package/bundles/cdk.umd.js.map +1 -1
  14. package/bundles/cdk.umd.min.js +1 -1
  15. package/bundles/cdk.umd.min.js.map +1 -1
  16. package/drag-drop/typings/directives/drag.d.ts +8 -4
  17. package/drag-drop/typings/directives/drop-list.d.ts +17 -3
  18. package/drag-drop/typings/drag-drop.d.ts +33 -0
  19. package/drag-drop/typings/drag-ref.d.ts +20 -13
  20. package/drag-drop/typings/drop-list-ref.d.ts +8 -4
  21. package/drag-drop/typings/index.d.ts +2 -2
  22. package/drag-drop/typings/index.metadata.json +1 -1
  23. package/drag-drop/typings/public-api.d.ts +4 -1
  24. package/esm2015/cdk.js +1 -1
  25. package/esm2015/cdk.js.map +1 -1
  26. package/esm2015/drag-drop.js +2213 -2058
  27. package/esm2015/drag-drop.js.map +1 -1
  28. package/esm2015/overlay.js +58 -11
  29. package/esm2015/overlay.js.map +1 -1
  30. package/esm2015/stepper.js +1 -1
  31. package/esm2015/stepper.js.map +1 -1
  32. package/esm5/cdk.es5.js +1 -1
  33. package/esm5/cdk.es5.js.map +1 -1
  34. package/esm5/drag-drop.es5.js +2792 -2594
  35. package/esm5/drag-drop.es5.js.map +1 -1
  36. package/esm5/overlay.es5.js +88 -17
  37. package/esm5/overlay.es5.js.map +1 -1
  38. package/esm5/stepper.es5.js +2 -2
  39. package/esm5/stepper.es5.js.map +1 -1
  40. package/overlay/typings/index.metadata.json +1 -1
  41. package/overlay/typings/overlay-ref.d.ts +4 -0
  42. package/overlay/typings/position/flexible-connected-position-strategy.d.ts +17 -4
  43. package/overlay/typings/position/overlay-position-builder.d.ts +3 -3
  44. package/package.json +4 -4
  45. package/stepper/typings/stepper.d.ts +1 -1
  46. package/typings/drag-drop/directives/drag.d.ts +8 -4
  47. package/typings/drag-drop/directives/drop-list.d.ts +17 -3
  48. package/typings/drag-drop/drag-drop.d.ts +33 -0
  49. package/typings/drag-drop/drag-ref.d.ts +20 -13
  50. package/typings/drag-drop/drop-list-ref.d.ts +8 -4
  51. package/typings/drag-drop/index.d.ts +2 -2
  52. package/typings/drag-drop/index.metadata.json +1 -1
  53. package/typings/drag-drop/public-api.d.ts +4 -1
  54. package/typings/esm5/drag-drop/directives/drag.d.ts +8 -4
  55. package/typings/esm5/drag-drop/directives/drop-list.d.ts +17 -3
  56. package/typings/esm5/drag-drop/drag-drop.d.ts +33 -0
  57. package/typings/esm5/drag-drop/drag-ref.d.ts +20 -13
  58. package/typings/esm5/drag-drop/drop-list-ref.d.ts +8 -4
  59. package/typings/esm5/drag-drop/index.d.ts +2 -2
  60. package/typings/esm5/drag-drop/index.metadata.json +1 -1
  61. package/typings/esm5/drag-drop/public-api.d.ts +4 -1
  62. package/typings/esm5/index.metadata.json +1 -1
  63. package/typings/esm5/overlay/index.metadata.json +1 -1
  64. package/typings/esm5/overlay/overlay-ref.d.ts +4 -0
  65. package/typings/esm5/overlay/position/flexible-connected-position-strategy.d.ts +17 -4
  66. package/typings/esm5/overlay/position/overlay-position-builder.d.ts +3 -3
  67. package/typings/esm5/stepper/stepper.d.ts +1 -1
  68. package/typings/index.metadata.json +1 -1
  69. package/typings/overlay/index.metadata.json +1 -1
  70. package/typings/overlay/overlay-ref.d.ts +4 -0
  71. package/typings/overlay/position/flexible-connected-position-strategy.d.ts +17 -4
  72. package/typings/overlay/position/overlay-position-builder.d.ts +3 -3
  73. package/typings/stepper/stepper.d.ts +1 -1
@@ -1297,6 +1297,38 @@ OverlayRef = /** @class */ (function () {
1297
1297
  this._config = __assign({}, this._config, { direction: dir });
1298
1298
  this._updateElementDirection();
1299
1299
  };
1300
+ /** Add a CSS class or an array of classes to the overlay pane. */
1301
+ /**
1302
+ * Add a CSS class or an array of classes to the overlay pane.
1303
+ * @param {?} classes
1304
+ * @return {?}
1305
+ */
1306
+ OverlayRef.prototype.addPanelClass = /**
1307
+ * Add a CSS class or an array of classes to the overlay pane.
1308
+ * @param {?} classes
1309
+ * @return {?}
1310
+ */
1311
+ function (classes) {
1312
+ if (this._pane) {
1313
+ this._toggleClasses(this._pane, classes, true);
1314
+ }
1315
+ };
1316
+ /** Remove a CSS class or an array of classes from the overlay pane. */
1317
+ /**
1318
+ * Remove a CSS class or an array of classes from the overlay pane.
1319
+ * @param {?} classes
1320
+ * @return {?}
1321
+ */
1322
+ OverlayRef.prototype.removePanelClass = /**
1323
+ * Remove a CSS class or an array of classes from the overlay pane.
1324
+ * @param {?} classes
1325
+ * @return {?}
1326
+ */
1327
+ function (classes) {
1328
+ if (this._pane) {
1329
+ this._toggleClasses(this._pane, classes, false);
1330
+ }
1331
+ };
1300
1332
  /**
1301
1333
  * Returns the layout direction of the overlay panel.
1302
1334
  */
@@ -1767,7 +1799,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
1767
1799
  // the overlay relative to the origin.
1768
1800
  // We use the viewport rect to determine whether a position would go off-screen.
1769
1801
  this._viewportRect = this._getNarrowedViewportRect();
1770
- this._originRect = this._origin.getBoundingClientRect();
1802
+ this._originRect = this._getOriginRect();
1771
1803
  this._overlayRect = this._pane.getBoundingClientRect();
1772
1804
  /** @type {?} */
1773
1805
  var originRect = this._originRect;
@@ -1923,7 +1955,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
1923
1955
  */
1924
1956
  function () {
1925
1957
  if (!this._isDisposed && (!this._platform || this._platform.isBrowser)) {
1926
- this._originRect = this._origin.getBoundingClientRect();
1958
+ this._originRect = this._getOriginRect();
1927
1959
  this._overlayRect = this._pane.getBoundingClientRect();
1928
1960
  this._viewportRect = this._getNarrowedViewportRect();
1929
1961
  /** @type {?} */
@@ -2095,25 +2127,34 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2095
2127
  return (/** @type {?} */ (this));
2096
2128
  };
2097
2129
  /**
2098
- * Sets the origin element, relative to which to position the overlay.
2099
- * @param origin Reference to the new origin element.
2130
+ * Sets the origin, relative to which to position the overlay.
2131
+ * Using an element origin is useful for building components that need to be positioned
2132
+ * relatively to a trigger (e.g. dropdown menus or tooltips), whereas using a point can be
2133
+ * used for cases like contextual menus which open relative to the user's pointer.
2134
+ * @param origin Reference to the new origin.
2100
2135
  */
2101
2136
  /**
2102
- * Sets the origin element, relative to which to position the overlay.
2137
+ * Sets the origin, relative to which to position the overlay.
2138
+ * Using an element origin is useful for building components that need to be positioned
2139
+ * relatively to a trigger (e.g. dropdown menus or tooltips), whereas using a point can be
2140
+ * used for cases like contextual menus which open relative to the user's pointer.
2103
2141
  * @template THIS
2104
2142
  * @this {THIS}
2105
- * @param {?} origin Reference to the new origin element.
2143
+ * @param {?} origin Reference to the new origin.
2106
2144
  * @return {THIS}
2107
2145
  */
2108
2146
  FlexibleConnectedPositionStrategy.prototype.setOrigin = /**
2109
- * Sets the origin element, relative to which to position the overlay.
2147
+ * Sets the origin, relative to which to position the overlay.
2148
+ * Using an element origin is useful for building components that need to be positioned
2149
+ * relatively to a trigger (e.g. dropdown menus or tooltips), whereas using a point can be
2150
+ * used for cases like contextual menus which open relative to the user's pointer.
2110
2151
  * @template THIS
2111
2152
  * @this {THIS}
2112
- * @param {?} origin Reference to the new origin element.
2153
+ * @param {?} origin Reference to the new origin.
2113
2154
  * @return {THIS}
2114
2155
  */
2115
2156
  function (origin) {
2116
- (/** @type {?} */ (this))._origin = coercion.coerceElement(origin);
2157
+ (/** @type {?} */ (this))._origin = origin;
2117
2158
  return (/** @type {?} */ (this));
2118
2159
  };
2119
2160
  /**
@@ -2941,7 +2982,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2941
2982
  function () {
2942
2983
  // Note: needs fresh rects since the position could've changed.
2943
2984
  /** @type {?} */
2944
- var originBounds = this._origin.getBoundingClientRect();
2985
+ var originBounds = this._getOriginRect();
2945
2986
  /** @type {?} */
2946
2987
  var overlayBounds = this._pane.getBoundingClientRect();
2947
2988
  // TODO(jelbourn): instead of needing all of the client rects for these scrolling containers
@@ -3131,6 +3172,36 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
3131
3172
  this._appliedPanelClasses = [];
3132
3173
  }
3133
3174
  };
3175
+ /** Returns the ClientRect of the current origin. */
3176
+ /**
3177
+ * Returns the ClientRect of the current origin.
3178
+ * @private
3179
+ * @return {?}
3180
+ */
3181
+ FlexibleConnectedPositionStrategy.prototype._getOriginRect = /**
3182
+ * Returns the ClientRect of the current origin.
3183
+ * @private
3184
+ * @return {?}
3185
+ */
3186
+ function () {
3187
+ /** @type {?} */
3188
+ var origin = this._origin;
3189
+ if (origin instanceof core.ElementRef) {
3190
+ return origin.nativeElement.getBoundingClientRect();
3191
+ }
3192
+ if (origin instanceof HTMLElement) {
3193
+ return origin.getBoundingClientRect();
3194
+ }
3195
+ // If the origin is a point, return a client rect as if it was a 0x0 element at the point.
3196
+ return {
3197
+ top: origin.y,
3198
+ bottom: origin.y,
3199
+ left: origin.x,
3200
+ right: origin.x,
3201
+ height: 0,
3202
+ width: 0
3203
+ };
3204
+ };
3134
3205
  return FlexibleConnectedPositionStrategy;
3135
3206
  }());
3136
3207
  /**
@@ -3942,20 +4013,20 @@ var OverlayPositionBuilder = /** @class */ (function () {
3942
4013
  };
3943
4014
  /**
3944
4015
  * Creates a flexible position strategy.
3945
- * @param elementRef
4016
+ * @param origin Origin relative to which to position the overlay.
3946
4017
  */
3947
4018
  /**
3948
4019
  * Creates a flexible position strategy.
3949
- * @param {?} elementRef
4020
+ * @param {?} origin Origin relative to which to position the overlay.
3950
4021
  * @return {?}
3951
4022
  */
3952
4023
  OverlayPositionBuilder.prototype.flexibleConnectedTo = /**
3953
4024
  * Creates a flexible position strategy.
3954
- * @param {?} elementRef
4025
+ * @param {?} origin Origin relative to which to position the overlay.
3955
4026
  * @return {?}
3956
4027
  */
3957
- function (elementRef) {
3958
- return new FlexibleConnectedPositionStrategy(elementRef, this._viewportRuler, this._document, this._platform, this._overlayContainer);
4028
+ function (origin) {
4029
+ return new FlexibleConnectedPositionStrategy(origin, this._viewportRuler, this._document, this._platform, this._overlayContainer);
3959
4030
  };
3960
4031
  OverlayPositionBuilder.decorators = [
3961
4032
  { type: core.Injectable, args: [{ providedIn: 'root' },] },