@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
@@ -5,11 +5,11 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- import { coerceCssPixelValue, coerceArray, coerceElement, coerceBooleanProperty } from '@angular/cdk/coercion';
8
+ import { coerceCssPixelValue, coerceArray, coerceBooleanProperty } from '@angular/cdk/coercion';
9
9
  import { ScrollDispatcher, ViewportRuler, ScrollingModule, VIEWPORT_RULER_PROVIDER } from '@angular/cdk/scrolling';
10
10
  export { ViewportRuler, VIEWPORT_RULER_PROVIDER, CdkScrollable, ScrollDispatcher } from '@angular/cdk/scrolling';
11
11
  import { DOCUMENT, Location } from '@angular/common';
12
- import { Inject, Injectable, NgZone, Optional, NgModule, SkipSelf, ApplicationRef, ComponentFactoryResolver, Injector, Directive, ElementRef, EventEmitter, InjectionToken, Input, Output, TemplateRef, ViewContainerRef, defineInjectable, inject } from '@angular/core';
12
+ import { Inject, Injectable, NgZone, Optional, NgModule, SkipSelf, ApplicationRef, ComponentFactoryResolver, Injector, ElementRef, Directive, EventEmitter, InjectionToken, Input, Output, TemplateRef, ViewContainerRef, defineInjectable, inject } from '@angular/core';
13
13
  import { __assign, __extends } from 'tslib';
14
14
  import { Observable, Subject, merge, Subscription } from 'rxjs';
15
15
  import { take, takeUntil } from 'rxjs/operators';
@@ -1264,6 +1264,38 @@ OverlayRef = /** @class */ (function () {
1264
1264
  this._config = __assign({}, this._config, { direction: dir });
1265
1265
  this._updateElementDirection();
1266
1266
  };
1267
+ /** Add a CSS class or an array of classes to the overlay pane. */
1268
+ /**
1269
+ * Add a CSS class or an array of classes to the overlay pane.
1270
+ * @param {?} classes
1271
+ * @return {?}
1272
+ */
1273
+ OverlayRef.prototype.addPanelClass = /**
1274
+ * Add a CSS class or an array of classes to the overlay pane.
1275
+ * @param {?} classes
1276
+ * @return {?}
1277
+ */
1278
+ function (classes) {
1279
+ if (this._pane) {
1280
+ this._toggleClasses(this._pane, classes, true);
1281
+ }
1282
+ };
1283
+ /** Remove a CSS class or an array of classes from the overlay pane. */
1284
+ /**
1285
+ * Remove a CSS class or an array of classes from the overlay pane.
1286
+ * @param {?} classes
1287
+ * @return {?}
1288
+ */
1289
+ OverlayRef.prototype.removePanelClass = /**
1290
+ * Remove a CSS class or an array of classes from the overlay pane.
1291
+ * @param {?} classes
1292
+ * @return {?}
1293
+ */
1294
+ function (classes) {
1295
+ if (this._pane) {
1296
+ this._toggleClasses(this._pane, classes, false);
1297
+ }
1298
+ };
1267
1299
  /**
1268
1300
  * Returns the layout direction of the overlay panel.
1269
1301
  */
@@ -1734,7 +1766,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
1734
1766
  // the overlay relative to the origin.
1735
1767
  // We use the viewport rect to determine whether a position would go off-screen.
1736
1768
  this._viewportRect = this._getNarrowedViewportRect();
1737
- this._originRect = this._origin.getBoundingClientRect();
1769
+ this._originRect = this._getOriginRect();
1738
1770
  this._overlayRect = this._pane.getBoundingClientRect();
1739
1771
  /** @type {?} */
1740
1772
  var originRect = this._originRect;
@@ -1890,7 +1922,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
1890
1922
  */
1891
1923
  function () {
1892
1924
  if (!this._isDisposed && (!this._platform || this._platform.isBrowser)) {
1893
- this._originRect = this._origin.getBoundingClientRect();
1925
+ this._originRect = this._getOriginRect();
1894
1926
  this._overlayRect = this._pane.getBoundingClientRect();
1895
1927
  this._viewportRect = this._getNarrowedViewportRect();
1896
1928
  /** @type {?} */
@@ -2062,25 +2094,34 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2062
2094
  return (/** @type {?} */ (this));
2063
2095
  };
2064
2096
  /**
2065
- * Sets the origin element, relative to which to position the overlay.
2066
- * @param origin Reference to the new origin element.
2097
+ * Sets the origin, relative to which to position the overlay.
2098
+ * Using an element origin is useful for building components that need to be positioned
2099
+ * relatively to a trigger (e.g. dropdown menus or tooltips), whereas using a point can be
2100
+ * used for cases like contextual menus which open relative to the user's pointer.
2101
+ * @param origin Reference to the new origin.
2067
2102
  */
2068
2103
  /**
2069
- * Sets the origin element, relative to which to position the overlay.
2104
+ * Sets the origin, relative to which to position the overlay.
2105
+ * Using an element origin is useful for building components that need to be positioned
2106
+ * relatively to a trigger (e.g. dropdown menus or tooltips), whereas using a point can be
2107
+ * used for cases like contextual menus which open relative to the user's pointer.
2070
2108
  * @template THIS
2071
2109
  * @this {THIS}
2072
- * @param {?} origin Reference to the new origin element.
2110
+ * @param {?} origin Reference to the new origin.
2073
2111
  * @return {THIS}
2074
2112
  */
2075
2113
  FlexibleConnectedPositionStrategy.prototype.setOrigin = /**
2076
- * Sets the origin element, relative to which to position the overlay.
2114
+ * Sets the origin, relative to which to position the overlay.
2115
+ * Using an element origin is useful for building components that need to be positioned
2116
+ * relatively to a trigger (e.g. dropdown menus or tooltips), whereas using a point can be
2117
+ * used for cases like contextual menus which open relative to the user's pointer.
2077
2118
  * @template THIS
2078
2119
  * @this {THIS}
2079
- * @param {?} origin Reference to the new origin element.
2120
+ * @param {?} origin Reference to the new origin.
2080
2121
  * @return {THIS}
2081
2122
  */
2082
2123
  function (origin) {
2083
- (/** @type {?} */ (this))._origin = coerceElement(origin);
2124
+ (/** @type {?} */ (this))._origin = origin;
2084
2125
  return (/** @type {?} */ (this));
2085
2126
  };
2086
2127
  /**
@@ -2908,7 +2949,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
2908
2949
  function () {
2909
2950
  // Note: needs fresh rects since the position could've changed.
2910
2951
  /** @type {?} */
2911
- var originBounds = this._origin.getBoundingClientRect();
2952
+ var originBounds = this._getOriginRect();
2912
2953
  /** @type {?} */
2913
2954
  var overlayBounds = this._pane.getBoundingClientRect();
2914
2955
  // TODO(jelbourn): instead of needing all of the client rects for these scrolling containers
@@ -3098,6 +3139,36 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
3098
3139
  this._appliedPanelClasses = [];
3099
3140
  }
3100
3141
  };
3142
+ /** Returns the ClientRect of the current origin. */
3143
+ /**
3144
+ * Returns the ClientRect of the current origin.
3145
+ * @private
3146
+ * @return {?}
3147
+ */
3148
+ FlexibleConnectedPositionStrategy.prototype._getOriginRect = /**
3149
+ * Returns the ClientRect of the current origin.
3150
+ * @private
3151
+ * @return {?}
3152
+ */
3153
+ function () {
3154
+ /** @type {?} */
3155
+ var origin = this._origin;
3156
+ if (origin instanceof ElementRef) {
3157
+ return origin.nativeElement.getBoundingClientRect();
3158
+ }
3159
+ if (origin instanceof HTMLElement) {
3160
+ return origin.getBoundingClientRect();
3161
+ }
3162
+ // If the origin is a point, return a client rect as if it was a 0x0 element at the point.
3163
+ return {
3164
+ top: origin.y,
3165
+ bottom: origin.y,
3166
+ left: origin.x,
3167
+ right: origin.x,
3168
+ height: 0,
3169
+ width: 0
3170
+ };
3171
+ };
3101
3172
  return FlexibleConnectedPositionStrategy;
3102
3173
  }());
3103
3174
  /**
@@ -3909,20 +3980,20 @@ var OverlayPositionBuilder = /** @class */ (function () {
3909
3980
  };
3910
3981
  /**
3911
3982
  * Creates a flexible position strategy.
3912
- * @param elementRef
3983
+ * @param origin Origin relative to which to position the overlay.
3913
3984
  */
3914
3985
  /**
3915
3986
  * Creates a flexible position strategy.
3916
- * @param {?} elementRef
3987
+ * @param {?} origin Origin relative to which to position the overlay.
3917
3988
  * @return {?}
3918
3989
  */
3919
3990
  OverlayPositionBuilder.prototype.flexibleConnectedTo = /**
3920
3991
  * Creates a flexible position strategy.
3921
- * @param {?} elementRef
3992
+ * @param {?} origin Origin relative to which to position the overlay.
3922
3993
  * @return {?}
3923
3994
  */
3924
- function (elementRef) {
3925
- return new FlexibleConnectedPositionStrategy(elementRef, this._viewportRuler, this._document, this._platform, this._overlayContainer);
3995
+ function (origin) {
3996
+ return new FlexibleConnectedPositionStrategy(origin, this._viewportRuler, this._document, this._platform, this._overlayContainer);
3926
3997
  };
3927
3998
  OverlayPositionBuilder.decorators = [
3928
3999
  { type: Injectable, args: [{ providedIn: 'root' },] },