@angular/cdk 7.2.1 → 7.2.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 (122) hide show
  1. package/a11y/typings/index.metadata.json +1 -1
  2. package/bundles/cdk-a11y.umd.js +2 -1
  3. package/bundles/cdk-a11y.umd.js.map +1 -1
  4. package/bundles/cdk-a11y.umd.min.js +1 -1
  5. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  6. package/bundles/cdk-drag-drop.umd.js +274 -126
  7. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  8. package/bundles/cdk-drag-drop.umd.min.js +2 -2
  9. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  10. package/bundles/cdk-observers.umd.js +1 -1
  11. package/bundles/cdk-observers.umd.js.map +1 -1
  12. package/bundles/cdk-observers.umd.min.js +1 -1
  13. package/bundles/cdk-observers.umd.min.js.map +1 -1
  14. package/bundles/cdk-overlay.umd.js +13 -12
  15. package/bundles/cdk-overlay.umd.js.map +1 -1
  16. package/bundles/cdk-overlay.umd.min.js +2 -2
  17. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  18. package/bundles/cdk-portal.umd.js +3 -3
  19. package/bundles/cdk-portal.umd.js.map +1 -1
  20. package/bundles/cdk-portal.umd.min.js.map +1 -1
  21. package/bundles/cdk-scrolling.umd.js +9 -6
  22. package/bundles/cdk-scrolling.umd.js.map +1 -1
  23. package/bundles/cdk-scrolling.umd.min.js +1 -1
  24. package/bundles/cdk-scrolling.umd.min.js.map +1 -1
  25. package/bundles/cdk-stepper.umd.js +23 -11
  26. package/bundles/cdk-stepper.umd.js.map +1 -1
  27. package/bundles/cdk-stepper.umd.min.js +1 -1
  28. package/bundles/cdk-stepper.umd.min.js.map +1 -1
  29. package/bundles/cdk-table.umd.js +8 -4
  30. package/bundles/cdk-table.umd.js.map +1 -1
  31. package/bundles/cdk-table.umd.min.js +1 -1
  32. package/bundles/cdk-table.umd.min.js.map +1 -1
  33. package/bundles/cdk-text-field.umd.js +1 -1
  34. package/bundles/cdk-text-field.umd.min.js +1 -1
  35. package/bundles/cdk-text-field.umd.min.js.map +1 -1
  36. package/bundles/cdk.umd.js +1 -1
  37. package/bundles/cdk.umd.js.map +1 -1
  38. package/bundles/cdk.umd.min.js +1 -1
  39. package/bundles/cdk.umd.min.js.map +1 -1
  40. package/drag-drop/typings/directives/drag-handle.d.ts +6 -2
  41. package/drag-drop/typings/directives/drag.d.ts +3 -2
  42. package/drag-drop/typings/directives/drop-list.d.ts +2 -5
  43. package/drag-drop/typings/drag-ref.d.ts +27 -19
  44. package/drag-drop/typings/drop-list-ref.d.ts +28 -14
  45. package/drag-drop/typings/index.metadata.json +1 -1
  46. package/esm2015/a11y.js +2 -1
  47. package/esm2015/a11y.js.map +1 -1
  48. package/esm2015/cdk.js +1 -1
  49. package/esm2015/cdk.js.map +1 -1
  50. package/esm2015/drag-drop.js +192 -108
  51. package/esm2015/drag-drop.js.map +1 -1
  52. package/esm2015/observers.js +1 -1
  53. package/esm2015/observers.js.map +1 -1
  54. package/esm2015/overlay.js +11 -10
  55. package/esm2015/overlay.js.map +1 -1
  56. package/esm2015/portal.js +1 -1
  57. package/esm2015/portal.js.map +1 -1
  58. package/esm2015/scrolling.js +9 -6
  59. package/esm2015/scrolling.js.map +1 -1
  60. package/esm2015/stepper.js +18 -11
  61. package/esm2015/stepper.js.map +1 -1
  62. package/esm2015/table.js +8 -4
  63. package/esm2015/table.js.map +1 -1
  64. package/esm5/a11y.es5.js +2 -1
  65. package/esm5/a11y.es5.js.map +1 -1
  66. package/esm5/cdk.es5.js +1 -1
  67. package/esm5/cdk.es5.js.map +1 -1
  68. package/esm5/drag-drop.es5.js +276 -128
  69. package/esm5/drag-drop.es5.js.map +1 -1
  70. package/esm5/observers.es5.js +1 -1
  71. package/esm5/observers.es5.js.map +1 -1
  72. package/esm5/overlay.es5.js +13 -12
  73. package/esm5/overlay.es5.js.map +1 -1
  74. package/esm5/portal.es5.js +3 -3
  75. package/esm5/portal.es5.js.map +1 -1
  76. package/esm5/scrolling.es5.js +9 -6
  77. package/esm5/scrolling.es5.js.map +1 -1
  78. package/esm5/stepper.es5.js +23 -11
  79. package/esm5/stepper.es5.js.map +1 -1
  80. package/esm5/table.es5.js +8 -4
  81. package/esm5/table.es5.js.map +1 -1
  82. package/overlay/typings/index.metadata.json +1 -1
  83. package/overlay/typings/overlay-ref.d.ts +1 -1
  84. package/package.json +3 -3
  85. package/portal/typings/portal.d.ts +1 -1
  86. package/schematics/migration.json +5 -0
  87. package/schematics/ng-update/index.d.ts +2 -0
  88. package/schematics/ng-update/index.js +5 -0
  89. package/schematics/ng-update/index.js.map +1 -1
  90. package/schematics/ng-update/target-version.d.ts +7 -1
  91. package/schematics/ng-update/target-version.js +10 -0
  92. package/schematics/ng-update/target-version.js.map +1 -1
  93. package/stepper/typings/index.metadata.json +1 -1
  94. package/stepper/typings/stepper.d.ts +7 -1
  95. package/typings/a11y/index.metadata.json +1 -1
  96. package/typings/drag-drop/directives/drag-handle.d.ts +6 -2
  97. package/typings/drag-drop/directives/drag.d.ts +3 -2
  98. package/typings/drag-drop/directives/drop-list.d.ts +2 -5
  99. package/typings/drag-drop/drag-ref.d.ts +27 -19
  100. package/typings/drag-drop/drop-list-ref.d.ts +28 -14
  101. package/typings/drag-drop/index.metadata.json +1 -1
  102. package/typings/esm5/a11y/index.metadata.json +1 -1
  103. package/typings/esm5/drag-drop/directives/drag-handle.d.ts +6 -2
  104. package/typings/esm5/drag-drop/directives/drag.d.ts +3 -2
  105. package/typings/esm5/drag-drop/directives/drop-list.d.ts +2 -5
  106. package/typings/esm5/drag-drop/drag-ref.d.ts +27 -19
  107. package/typings/esm5/drag-drop/drop-list-ref.d.ts +28 -14
  108. package/typings/esm5/drag-drop/index.metadata.json +1 -1
  109. package/typings/esm5/index.metadata.json +1 -1
  110. package/typings/esm5/overlay/index.metadata.json +1 -1
  111. package/typings/esm5/overlay/overlay-ref.d.ts +1 -1
  112. package/typings/esm5/portal/portal.d.ts +1 -1
  113. package/typings/esm5/stepper/index.metadata.json +1 -1
  114. package/typings/esm5/stepper/stepper.d.ts +7 -1
  115. package/typings/index.metadata.json +1 -1
  116. package/typings/overlay/index.metadata.json +1 -1
  117. package/typings/overlay/overlay-ref.d.ts +1 -1
  118. package/typings/portal/portal.d.ts +1 -1
  119. package/typings/schematics/ng-update/index.d.ts +2 -0
  120. package/typings/schematics/ng-update/target-version.d.ts +7 -1
  121. package/typings/stepper/index.metadata.json +1 -1
  122. package/typings/stepper/stepper.d.ts +7 -1
@@ -58,7 +58,7 @@ class ContentObserver {
58
58
  observe(elementOrRef) {
59
59
  /** @type {?} */
60
60
  const element = coerceElement(elementOrRef);
61
- return Observable.create((observer) => {
61
+ return new Observable((observer) => {
62
62
  /** @type {?} */
63
63
  const stream = this._observeElement(element);
64
64
  /** @type {?} */
@@ -1 +1 @@
1
- {"version":3,"file":"observers.js","sources":["../../../src/cdk/observers/observe-content.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 {coerceBooleanProperty, coerceNumberProperty, coerceElement} from '@angular/cdk/coercion';\nimport {\n AfterContentInit,\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n Input,\n NgModule,\n NgZone,\n OnDestroy,\n Output,\n} from '@angular/core';\nimport {Observable, Subject, Subscription, Observer} from 'rxjs';\nimport {debounceTime} from 'rxjs/operators';\n\n/**\n * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.\n * @docs-private\n */\n@Injectable({providedIn: 'root'})\nexport class MutationObserverFactory {\n create(callback: MutationCallback): MutationObserver | null {\n return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);\n }\n}\n\n\n/** An injectable service that allows watching elements for changes to their content. */\n@Injectable({providedIn: 'root'})\nexport class ContentObserver implements OnDestroy {\n /** Keeps track of the existing MutationObservers so they can be reused. */\n private _observedElements = new Map<Element, {\n observer: MutationObserver | null,\n stream: Subject<MutationRecord[]>,\n count: number\n }>();\n\n constructor(private _mutationObserverFactory: MutationObserverFactory) {}\n\n ngOnDestroy() {\n this._observedElements.forEach((_, element) => this._cleanupObserver(element));\n }\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: Element): Observable<MutationRecord[]>;\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: ElementRef<Element>): Observable<MutationRecord[]>;\n\n observe(elementOrRef: Element | ElementRef<Element>): Observable<MutationRecord[]> {\n const element = coerceElement(elementOrRef);\n\n return Observable.create((observer: Observer<MutationRecord[]>) => {\n const stream = this._observeElement(element);\n const subscription = stream.subscribe(observer);\n\n return () => {\n subscription.unsubscribe();\n this._unobserveElement(element);\n };\n });\n }\n\n /**\n * Observes the given element by using the existing MutationObserver if available, or creating a\n * new one if not.\n */\n private _observeElement(element: Element): Subject<MutationRecord[]> {\n if (!this._observedElements.has(element)) {\n const stream = new Subject<MutationRecord[]>();\n const observer = this._mutationObserverFactory.create(mutations => stream.next(mutations));\n if (observer) {\n observer.observe(element, {\n characterData: true,\n childList: true,\n subtree: true\n });\n }\n this._observedElements.set(element, {observer, stream, count: 1});\n } else {\n this._observedElements.get(element)!.count++;\n }\n return this._observedElements.get(element)!.stream;\n }\n\n /**\n * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is\n * observing this element.\n */\n private _unobserveElement(element: Element) {\n if (this._observedElements.has(element)) {\n this._observedElements.get(element)!.count--;\n if (!this._observedElements.get(element)!.count) {\n this._cleanupObserver(element);\n }\n }\n }\n\n /** Clean up the underlying MutationObserver for the specified element. */\n private _cleanupObserver(element: Element) {\n if (this._observedElements.has(element)) {\n const {observer, stream} = this._observedElements.get(element)!;\n if (observer) {\n observer.disconnect();\n }\n stream.complete();\n this._observedElements.delete(element);\n }\n }\n}\n\n\n/**\n * Directive that triggers a callback whenever the content of\n * its associated element has changed.\n */\n@Directive({\n selector: '[cdkObserveContent]',\n exportAs: 'cdkObserveContent',\n})\nexport class CdkObserveContent implements AfterContentInit, OnDestroy {\n /** Event emitted for each change in the element's content. */\n @Output('cdkObserveContent') event = new EventEmitter<MutationRecord[]>();\n\n /**\n * Whether observing content is disabled. This option can be used\n * to disconnect the underlying MutationObserver until it is needed.\n */\n @Input('cdkObserveContentDisabled')\n get disabled() { return this._disabled; }\n set disabled(value: any) {\n this._disabled = coerceBooleanProperty(value);\n this._disabled ? this._unsubscribe() : this._subscribe();\n }\n private _disabled = false;\n\n /** Debounce interval for emitting the changes. */\n @Input()\n get debounce(): number { return this._debounce; }\n set debounce(value: number) {\n this._debounce = coerceNumberProperty(value);\n this._subscribe();\n }\n private _debounce: number;\n\n private _currentSubscription: Subscription | null = null;\n\n constructor(private _contentObserver: ContentObserver,\n private _elementRef: ElementRef<HTMLElement>,\n private _ngZone: NgZone) {}\n\n ngAfterContentInit() {\n if (!this._currentSubscription && !this.disabled) {\n this._subscribe();\n }\n }\n\n ngOnDestroy() {\n this._unsubscribe();\n }\n\n private _subscribe() {\n this._unsubscribe();\n const stream = this._contentObserver.observe(this._elementRef);\n\n // TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.\n // Consider brining it back inside the zone next time we're making breaking changes.\n // Bringing it back inside can cause things like infinite change detection loops and changed\n // after checked errors if people's code isn't handling it properly.\n this._ngZone.runOutsideAngular(() => {\n this._currentSubscription =\n (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);\n });\n }\n\n private _unsubscribe() {\n if (this._currentSubscription) {\n this._currentSubscription.unsubscribe();\n }\n }\n}\n\n\n@NgModule({\n exports: [CdkObserveContent],\n declarations: [CdkObserveContent],\n providers: [MutationObserverFactory]\n})\nexport class ObserversModule {}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA6BA,AAAA,MAAa,uBAAuB,CAApC;;;;;IACE,MAAM,CAAC,QAA0B,EAAnC;QACI,OAAO,OAAO,gBAAg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BAAiB,CAAC;gBAC5B,YAAY,EAAE,CAAC,iBAAiB,CAAC;gBACjC,SAAS,EAAE,CAAC,uBAAuB,CAAC;aACrC,EAAD,EAAA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"observers.js","sources":["../../../src/cdk/observers/observe-content.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 {coerceBooleanProperty, coerceNumberProperty, coerceElement} from '@angular/cdk/coercion';\nimport {\n AfterContentInit,\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n Input,\n NgModule,\n NgZone,\n OnDestroy,\n Output,\n} from '@angular/core';\nimport {Observable, Subject, Subscription, Observer} from 'rxjs';\nimport {debounceTime} from 'rxjs/operators';\n\n/**\n * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.\n * @docs-private\n */\n@Injectable({providedIn: 'root'})\nexport class MutationObserverFactory {\n create(callback: MutationCallback): MutationObserver | null {\n return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);\n }\n}\n\n\n/** An injectable service that allows watching elements for changes to their content. */\n@Injectable({providedIn: 'root'})\nexport class ContentObserver implements OnDestroy {\n /** Keeps track of the existing MutationObservers so they can be reused. */\n private _observedElements = new Map<Element, {\n observer: MutationObserver | null,\n stream: Subject<MutationRecord[]>,\n count: number\n }>();\n\n constructor(private _mutationObserverFactory: MutationObserverFactory) {}\n\n ngOnDestroy() {\n this._observedElements.forEach((_, element) => this._cleanupObserver(element));\n }\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: Element): Observable<MutationRecord[]>;\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: ElementRef<Element>): Observable<MutationRecord[]>;\n\n observe(elementOrRef: Element | ElementRef<Element>): Observable<MutationRecord[]> {\n const element = coerceElement(elementOrRef);\n\n return new Observable((observer: Observer<MutationRecord[]>) => {\n const stream = this._observeElement(element);\n const subscription = stream.subscribe(observer);\n\n return () => {\n subscription.unsubscribe();\n this._unobserveElement(element);\n };\n });\n }\n\n /**\n * Observes the given element by using the existing MutationObserver if available, or creating a\n * new one if not.\n */\n private _observeElement(element: Element): Subject<MutationRecord[]> {\n if (!this._observedElements.has(element)) {\n const stream = new Subject<MutationRecord[]>();\n const observer = this._mutationObserverFactory.create(mutations => stream.next(mutations));\n if (observer) {\n observer.observe(element, {\n characterData: true,\n childList: true,\n subtree: true\n });\n }\n this._observedElements.set(element, {observer, stream, count: 1});\n } else {\n this._observedElements.get(element)!.count++;\n }\n return this._observedElements.get(element)!.stream;\n }\n\n /**\n * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is\n * observing this element.\n */\n private _unobserveElement(element: Element) {\n if (this._observedElements.has(element)) {\n this._observedElements.get(element)!.count--;\n if (!this._observedElements.get(element)!.count) {\n this._cleanupObserver(element);\n }\n }\n }\n\n /** Clean up the underlying MutationObserver for the specified element. */\n private _cleanupObserver(element: Element) {\n if (this._observedElements.has(element)) {\n const {observer, stream} = this._observedElements.get(element)!;\n if (observer) {\n observer.disconnect();\n }\n stream.complete();\n this._observedElements.delete(element);\n }\n }\n}\n\n\n/**\n * Directive that triggers a callback whenever the content of\n * its associated element has changed.\n */\n@Directive({\n selector: '[cdkObserveContent]',\n exportAs: 'cdkObserveContent',\n})\nexport class CdkObserveContent implements AfterContentInit, OnDestroy {\n /** Event emitted for each change in the element's content. */\n @Output('cdkObserveContent') event = new EventEmitter<MutationRecord[]>();\n\n /**\n * Whether observing content is disabled. This option can be used\n * to disconnect the underlying MutationObserver until it is needed.\n */\n @Input('cdkObserveContentDisabled')\n get disabled() { return this._disabled; }\n set disabled(value: any) {\n this._disabled = coerceBooleanProperty(value);\n this._disabled ? this._unsubscribe() : this._subscribe();\n }\n private _disabled = false;\n\n /** Debounce interval for emitting the changes. */\n @Input()\n get debounce(): number { return this._debounce; }\n set debounce(value: number) {\n this._debounce = coerceNumberProperty(value);\n this._subscribe();\n }\n private _debounce: number;\n\n private _currentSubscription: Subscription | null = null;\n\n constructor(private _contentObserver: ContentObserver,\n private _elementRef: ElementRef<HTMLElement>,\n private _ngZone: NgZone) {}\n\n ngAfterContentInit() {\n if (!this._currentSubscription && !this.disabled) {\n this._subscribe();\n }\n }\n\n ngOnDestroy() {\n this._unsubscribe();\n }\n\n private _subscribe() {\n this._unsubscribe();\n const stream = this._contentObserver.observe(this._elementRef);\n\n // TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.\n // Consider brining it back inside the zone next time we're making breaking changes.\n // Bringing it back inside can cause things like infinite change detection loops and changed\n // after checked errors if people's code isn't handling it properly.\n this._ngZone.runOutsideAngular(() => {\n this._currentSubscription =\n (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);\n });\n }\n\n private _unsubscribe() {\n if (this._currentSubscription) {\n this._currentSubscription.unsubscribe();\n }\n }\n}\n\n\n@NgModule({\n exports: [CdkObserveContent],\n declarations: [CdkObserveContent],\n providers: [MutationObserverFactory]\n})\nexport class ObserversModule {}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA6BA,AAAA,MAAa,uBAAuB,CAApC;;;;;IACE,MAAM,CAAC,QAA0B,EAAnC;QACI,OAAO,OAAO,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;KACxF;;;IAJH,EAAA,IAAA,EAAC,UAAU,EAAX,IAAA,EAAA,CAAY,EAAC,UAAU,EAAE,MAAM,EAAC,EAAhC,EAAA;;;;;;AAUA,AAAA,MAAa,eAAe,CAA5B;;;;IAQE,WAAF,CAAsB,wBAAiD,EAAvE;QAAsB,IAAtB,CAAA,wBAA8C,GAAxB,wBAAwB,CAAyB;;;;QAN7D,IAAV,CAAA,iBAA2B,GAAG,IAAI,GAAG,EAI/B,CAAC;KAEoE;;;;IAEzE,WAAW,GAAb;QACI,IAAI,CAAC,iBAAiB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,IAAI,CAAC,KAAK,CAAC,CAAC;SAC/F,CAAC,CAAC;KACJ;;;;;IAEO,YAAY,GAAtB;QACI,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC7B,IAAI,CAAC,oBAAoB,CAAC,WAAW,EAAE,CAAC;SACzC;KACF;;;IA/DH,EAAA,IAAA,EAAC,SAAS,EAAV,IAAA,EAAA,CAAW;gBACT,QAAQ,EAAE,qBAAqB;gBAC/B,QAAQ,EAAE,mBAAmB;aAC9B,EAAD,EAAA;;;;IA4BA,EAAA,IAAA,EAAwC,eAAe,EAAvD;IAtJA,EAAA,IAAA,EAAE,UAAU,EAAZ;IAKA,EAAA,IAAA,EAAE,MAAM,EAAR;;;IAwHA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAG,MAAM,EAAT,IAAA,EAAA,CAAU,mBAAmB,EAA7B,EAAA,CAAA;IAMA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,IAAA,EAAA,CAAS,2BAA2B,EAApC,EAAA,CAAA;IASA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,CAAA;;AAmDA,MAAa,eAAe,CAA5B;;;IALA,EAAA,IAAA,EAAC,QAAQ,EAAT,IAAA,EAAA,CAAU;gBACR,OAAO,EAAE,CAAC,iBAAiB,CAAC;gBAC5B,YAAY,EAAE,CAAC,iBAAiB,CAAC;gBACjC,SAAS,EAAE,CAAC,uBAAuB,CAAC;aACrC,EAAD,EAAA;;;;;;;;;;;;;;;"}
@@ -786,7 +786,7 @@ class OverlayRef {
786
786
  this._attachments = new Subject();
787
787
  this._detachments = new Subject();
788
788
  this._locationChanges = Subscription.EMPTY;
789
- this._keydownEventsObservable = Observable.create((observer) => {
789
+ this._keydownEventsObservable = new Observable((observer) => {
790
790
  /** @type {?} */
791
791
  const subscription = this._keydownEvents.subscribe(observer);
792
792
  this._keydownEventSubscriptions++;
@@ -983,7 +983,7 @@ class OverlayRef {
983
983
  return this._keydownEventsObservable;
984
984
  }
985
985
  /**
986
- * Gets the the current overlay configuration, which is immutable.
986
+ * Gets the current overlay configuration, which is immutable.
987
987
  * @return {?}
988
988
  */
989
989
  getConfig() {
@@ -1311,7 +1311,7 @@ class FlexibleConnectedPositionStrategy {
1311
1311
  /**
1312
1312
  * Observable sequence of position changes.
1313
1313
  */
1314
- this.positionChanges = Observable.create((observer) => {
1314
+ this.positionChanges = new Observable((observer) => {
1315
1315
  /** @type {?} */
1316
1316
  const subscription = this._positionChanges.subscribe(observer);
1317
1317
  this._positionChangeSubscriptions++;
@@ -1949,7 +1949,7 @@ class FlexibleConnectedPositionStrategy {
1949
1949
  if (position.overlayY === 'top') {
1950
1950
  // Overlay is opening "downward" and thus is bound by the bottom viewport edge.
1951
1951
  top = origin.y;
1952
- height = viewport.bottom - origin.y;
1952
+ height = viewport.height - top + this._viewportMargin;
1953
1953
  }
1954
1954
  else if (position.overlayY === 'bottom') {
1955
1955
  // Overlay is opening "upward" and thus is bound by the top viewport edge. We need to add
@@ -2100,6 +2100,7 @@ class FlexibleConnectedPositionStrategy {
2100
2100
  bottom: '',
2101
2101
  right: '',
2102
2102
  position: '',
2103
+ transform: '',
2103
2104
  })));
2104
2105
  }
2105
2106
  /**
@@ -3247,6 +3248,12 @@ class CdkConnectedOverlay {
3247
3248
  ngOnChanges(changes) {
3248
3249
  if (this._position) {
3249
3250
  this._updatePositionStrategy(this._position);
3251
+ this._overlayRef.updateSize({
3252
+ width: this.width,
3253
+ minWidth: this.minWidth,
3254
+ height: this.height,
3255
+ minHeight: this.minHeight,
3256
+ });
3250
3257
  if (changes['origin'] && this.open) {
3251
3258
  this._position.apply();
3252
3259
  }
@@ -3355,12 +3362,6 @@ class CdkConnectedOverlay {
3355
3362
  }
3356
3363
  else {
3357
3364
  // Update the overlay size, in case the directive's inputs have changed
3358
- this._overlayRef.updateSize({
3359
- width: this.width,
3360
- minWidth: this.minWidth,
3361
- height: this.height,
3362
- minHeight: this.minHeight,
3363
- });
3364
3365
  this._overlayRef.getConfig().hasBackdrop = this.hasBackdrop;
3365
3366
  }
3366
3367
  if (!this._overlayRef.hasAttached()) {