@angular/cdk 7.1.1 → 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.
- package/LICENSE +1 -1
- package/_a11y.scss +1 -1
- package/a11y/typings/focus-monitor/focus-monitor.d.ts +0 -1
- package/a11y/typings/focus-trap/focus-trap.d.ts +2 -0
- package/a11y/typings/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +30 -24
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +1 -1
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-coercion.umd.js +20 -4
- package/bundles/cdk-coercion.umd.js.map +1 -1
- package/bundles/cdk-coercion.umd.min.js +1 -1
- package/bundles/cdk-coercion.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +3246 -1894
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +2 -1
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-observers.umd.js +2 -2
- package/bundles/cdk-observers.umd.js.map +1 -1
- package/bundles/cdk-observers.umd.min.js +1 -1
- package/bundles/cdk-observers.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +107 -45
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +2 -2
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-portal.umd.js +3 -3
- package/bundles/cdk-portal.umd.js.map +1 -1
- package/bundles/cdk-portal.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +9 -6
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +1 -1
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-stepper.umd.js +36 -16
- package/bundles/cdk-stepper.umd.js.map +1 -1
- package/bundles/cdk-stepper.umd.min.js +1 -1
- package/bundles/cdk-stepper.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +8 -4
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +1 -1
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +47 -22
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +1 -1
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +1 -1
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.min.js +1 -1
- package/bundles/cdk-tree.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/coercion/typings/element.d.ts +13 -0
- package/coercion/typings/index.metadata.json +1 -1
- package/coercion/typings/public-api.d.ts +1 -0
- package/drag-drop/typings/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
- package/drag-drop/typings/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
- package/drag-drop/typings/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
- package/drag-drop/typings/directives/drag.d.ts +114 -0
- package/{typings/esm5/drag-drop → drag-drop/typings/directives}/drop-list-group.d.ts +3 -0
- package/drag-drop/typings/{drop-list.d.ts → directives/drop-list.d.ts} +44 -70
- package/drag-drop/typings/drag-drop-registry.d.ts +8 -3
- package/drag-drop/typings/drag-drop.d.ts +33 -0
- package/drag-drop/typings/drag-events.d.ts +14 -7
- package/{typings/esm5/drag-drop/drag.d.ts → drag-drop/typings/drag-ref.d.ts} +162 -86
- package/drag-drop/typings/drop-list-container.d.ts +19 -3
- package/drag-drop/typings/drop-list-ref.d.ts +238 -0
- package/drag-drop/typings/index.d.ts +2 -1
- package/drag-drop/typings/index.metadata.json +1 -1
- package/drag-drop/typings/public-api.d.ts +16 -6
- package/esm2015/a11y.js +30 -20
- package/esm2015/a11y.js.map +1 -1
- package/esm2015/cdk.js +1 -1
- package/esm2015/cdk.js.map +1 -1
- package/esm2015/coercion.js +18 -1
- package/esm2015/coercion.js.map +1 -1
- package/esm2015/drag-drop.js +2281 -1289
- package/esm2015/drag-drop.js.map +1 -1
- package/esm2015/observers.js +3 -3
- package/esm2015/observers.js.map +1 -1
- package/esm2015/overlay.js +75 -31
- package/esm2015/overlay.js.map +1 -1
- package/esm2015/portal.js +1 -1
- package/esm2015/portal.js.map +1 -1
- package/esm2015/scrolling.js +9 -6
- package/esm2015/scrolling.js.map +1 -1
- package/esm2015/stepper.js +30 -16
- package/esm2015/stepper.js.map +1 -1
- package/esm2015/table.js +8 -4
- package/esm2015/table.js.map +1 -1
- package/esm2015/text-field.js +31 -19
- package/esm2015/text-field.js.map +1 -1
- package/esm2015/tree.js +2 -2
- package/esm2015/tree.js.map +1 -1
- package/esm5/a11y.es5.js +31 -25
- package/esm5/a11y.es5.js.map +1 -1
- package/esm5/cdk.es5.js +1 -1
- package/esm5/cdk.es5.js.map +1 -1
- package/esm5/coercion.es5.js +18 -1
- package/esm5/coercion.es5.js.map +1 -1
- package/esm5/drag-drop.es5.js +3247 -1899
- package/esm5/drag-drop.es5.js.map +1 -1
- package/esm5/observers.es5.js +3 -3
- package/esm5/observers.es5.js.map +1 -1
- package/esm5/overlay.es5.js +107 -45
- package/esm5/overlay.es5.js.map +1 -1
- package/esm5/portal.es5.js +3 -3
- package/esm5/portal.es5.js.map +1 -1
- package/esm5/scrolling.es5.js +9 -6
- package/esm5/scrolling.es5.js.map +1 -1
- package/esm5/stepper.es5.js +36 -17
- package/esm5/stepper.es5.js.map +1 -1
- package/esm5/table.es5.js +8 -4
- package/esm5/table.es5.js.map +1 -1
- package/esm5/text-field.es5.js +44 -19
- package/esm5/text-field.es5.js.map +1 -1
- package/esm5/tree.es5.js +2 -2
- package/esm5/tree.es5.js.map +1 -1
- package/overlay/typings/index.metadata.json +1 -1
- package/overlay/typings/overlay-directives.d.ts +0 -2
- package/overlay/typings/overlay-ref.d.ts +5 -1
- package/overlay/typings/position/flexible-connected-position-strategy.d.ts +17 -4
- package/overlay/typings/position/overlay-position-builder.d.ts +3 -3
- package/package.json +4 -4
- package/portal/typings/portal.d.ts +1 -1
- package/schematics/migration.json +5 -0
- package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts +2 -2
- package/schematics/ng-update/index.d.ts +2 -0
- package/schematics/ng-update/index.js +5 -0
- package/schematics/ng-update/index.js.map +1 -1
- package/schematics/ng-update/target-version.d.ts +7 -1
- package/schematics/ng-update/target-version.js +10 -0
- package/schematics/ng-update/target-version.js.map +1 -1
- package/schematics/ng-update/upgrade-data.js +2 -1
- package/schematics/ng-update/upgrade-data.js.map +1 -1
- package/schematics/ng-update/upgrade-rules/index.js +3 -2
- package/schematics/ng-update/upgrade-rules/index.js.map +1 -1
- package/schematics/utils/ast/ng-module-imports.d.ts +1 -1
- package/schematics/utils/ast/ng-module-imports.js +25 -13
- package/schematics/utils/ast/ng-module-imports.js.map +1 -1
- package/schematics/utils/get-project.js +2 -1
- package/schematics/utils/get-project.js.map +1 -1
- package/schematics/utils/parse5-element.js +3 -2
- package/schematics/utils/parse5-element.js.map +1 -1
- package/schematics/utils/project-targets.js +2 -1
- package/schematics/utils/project-targets.js.map +1 -1
- package/schematics/utils/version-agnostic-typescript.js +3 -2
- package/schematics/utils/version-agnostic-typescript.js.map +1 -1
- package/stepper/typings/index.metadata.json +1 -1
- package/stepper/typings/stepper.d.ts +14 -2
- package/text-field/typings/autosize.d.ts +6 -0
- package/text-field/typings/index.metadata.json +1 -1
- package/tree/typings/control/base-tree-control.d.ts +1 -1
- package/tree/typings/control/nested-tree-control.d.ts +2 -2
- package/tree/typings/control/tree-control.d.ts +1 -1
- package/typings/a11y/focus-monitor/focus-monitor.d.ts +0 -1
- package/typings/a11y/focus-trap/focus-trap.d.ts +2 -0
- package/typings/a11y/index.metadata.json +1 -1
- package/typings/coercion/element.d.ts +13 -0
- package/typings/coercion/index.metadata.json +1 -1
- package/typings/coercion/public-api.d.ts +1 -0
- package/typings/drag-drop/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
- package/typings/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
- package/typings/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
- package/typings/drag-drop/directives/drag.d.ts +114 -0
- package/typings/drag-drop/{drop-list-group.d.ts → directives/drop-list-group.d.ts} +3 -0
- package/typings/{esm5/drag-drop → drag-drop/directives}/drop-list.d.ts +44 -70
- package/typings/drag-drop/drag-drop-registry.d.ts +8 -3
- package/typings/drag-drop/drag-drop.d.ts +33 -0
- package/typings/drag-drop/drag-events.d.ts +14 -7
- package/typings/drag-drop/{drag.d.ts → drag-ref.d.ts} +162 -86
- package/typings/drag-drop/drop-list-container.d.ts +19 -3
- package/typings/drag-drop/drop-list-ref.d.ts +238 -0
- package/typings/drag-drop/index.d.ts +2 -1
- package/typings/drag-drop/index.metadata.json +1 -1
- package/typings/drag-drop/public-api.d.ts +16 -6
- package/typings/esm5/a11y/focus-monitor/focus-monitor.d.ts +0 -1
- package/typings/esm5/a11y/focus-trap/focus-trap.d.ts +2 -0
- package/typings/esm5/a11y/index.metadata.json +1 -1
- package/typings/esm5/coercion/element.d.ts +13 -0
- package/typings/esm5/coercion/index.metadata.json +1 -1
- package/typings/esm5/coercion/public-api.d.ts +1 -0
- package/typings/esm5/drag-drop/{drag-handle.d.ts → directives/drag-handle.d.ts} +6 -2
- package/typings/esm5/drag-drop/{drag-placeholder.d.ts → directives/drag-placeholder.d.ts} +0 -0
- package/typings/esm5/drag-drop/{drag-preview.d.ts → directives/drag-preview.d.ts} +0 -0
- package/typings/esm5/drag-drop/directives/drag.d.ts +114 -0
- package/{drag-drop/typings → typings/esm5/drag-drop/directives}/drop-list-group.d.ts +3 -0
- package/typings/{drag-drop → esm5/drag-drop/directives}/drop-list.d.ts +44 -70
- package/typings/esm5/drag-drop/drag-drop-registry.d.ts +8 -3
- package/typings/esm5/drag-drop/drag-drop.d.ts +33 -0
- package/typings/esm5/drag-drop/drag-events.d.ts +14 -7
- package/{drag-drop/typings/drag.d.ts → typings/esm5/drag-drop/drag-ref.d.ts} +162 -86
- package/typings/esm5/drag-drop/drop-list-container.d.ts +19 -3
- package/typings/esm5/drag-drop/drop-list-ref.d.ts +238 -0
- package/typings/esm5/drag-drop/index.d.ts +2 -1
- package/typings/esm5/drag-drop/index.metadata.json +1 -1
- package/typings/esm5/drag-drop/public-api.d.ts +16 -6
- package/typings/esm5/index.metadata.json +1 -1
- package/typings/esm5/overlay/index.metadata.json +1 -1
- package/typings/esm5/overlay/overlay-directives.d.ts +0 -2
- package/typings/esm5/overlay/overlay-ref.d.ts +5 -1
- package/typings/esm5/overlay/position/flexible-connected-position-strategy.d.ts +17 -4
- package/typings/esm5/overlay/position/overlay-position-builder.d.ts +3 -3
- package/typings/esm5/portal/portal.d.ts +1 -1
- package/typings/esm5/stepper/index.metadata.json +1 -1
- package/typings/esm5/stepper/stepper.d.ts +14 -2
- package/typings/esm5/text-field/autosize.d.ts +6 -0
- package/typings/esm5/text-field/index.metadata.json +1 -1
- package/typings/esm5/tree/control/base-tree-control.d.ts +1 -1
- package/typings/esm5/tree/control/nested-tree-control.d.ts +2 -2
- package/typings/esm5/tree/control/tree-control.d.ts +1 -1
- package/typings/index.metadata.json +1 -1
- package/typings/overlay/index.metadata.json +1 -1
- package/typings/overlay/overlay-directives.d.ts +0 -2
- package/typings/overlay/overlay-ref.d.ts +5 -1
- package/typings/overlay/position/flexible-connected-position-strategy.d.ts +17 -4
- package/typings/overlay/position/overlay-position-builder.d.ts +3 -3
- package/typings/portal/portal.d.ts +1 -1
- package/typings/schematics/ng-update/index.d.ts +2 -0
- package/typings/schematics/ng-update/target-version.d.ts +7 -1
- package/typings/schematics/utils/ast/ng-module-imports.d.ts +1 -1
- package/typings/stepper/index.metadata.json +1 -1
- package/typings/stepper/stepper.d.ts +14 -2
- package/typings/text-field/autosize.d.ts +6 -0
- package/typings/text-field/index.metadata.json +1 -1
- package/typings/tree/control/base-tree-control.d.ts +1 -1
- package/typings/tree/control/nested-tree-control.d.ts +2 -2
- package/typings/tree/control/tree-control.d.ts +1 -1
|
@@ -71,8 +71,8 @@ var ContentObserver = /** @class */ (function () {
|
|
|
71
71
|
function (elementOrRef) {
|
|
72
72
|
var _this = this;
|
|
73
73
|
/** @type {?} */
|
|
74
|
-
var element =
|
|
75
|
-
return rxjs.Observable
|
|
74
|
+
var element = coercion.coerceElement(elementOrRef);
|
|
75
|
+
return new rxjs.Observable(function (observer) {
|
|
76
76
|
/** @type {?} */
|
|
77
77
|
var stream = _this._observeElement(element);
|
|
78
78
|
/** @type {?} */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk-observers.umd.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} 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 = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : 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":["NgModule","Input","Output","NgZone","ElementRef","Directive","debounceTime","coerceNumberProperty","coerceBooleanProperty","EventEmitter","Injectable","Subject","Observable"],"mappings":";;;;;;;;;;;;;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AAY,EAAE,CAAC,iBAAiB,CAAC;oBACjC,SAAS,EAAE,CAAC,uBAAuB,CAAC;iBACrC,EAAD,EAAA;;IAC8B,OAA9B,eAA+B,CAA/B;CAA+B,EAA/B,CAAA;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"cdk-observers.umd.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":["NgModule","Input","Output","NgZone","ElementRef","Directive","debounceTime","coerceNumberProperty","coerceBooleanProperty","EventEmitter","Injectable","Subject","Observable","coerceElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4BA,AAAA,IAAA,uBAAA,kBAAA,YAAA;IAAA,SAAA,uBAAA,GAAA;KAKC;;;;;IAHC,uBAAF,CAAA,SAAA,CAAA,MAAQ;;;;IAAN,UAAO,QAA0B,EAAnC;QACI,OAAO,OAAO,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;KACxF,CAAH;;QAJA,EAAA,IAAA,EAACU,eAAU,EAAX,IAAA,EAAA,CAAY,EAAC,UAAU,EAAE,MAAM,EAAC,EAAhC,EAAA;;;IA5BA,OAAA,uBAAA,CA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B,IAAI,CAAC,oBAAoB,CAAC,WAAW,EAAE,CAAC;SACzC;KACF,CAAH;;QA/DA,EAAA,IAAA,EAACD,cAAS,EAAV,IAAA,EAAA,CAAW;oBACT,QAAQ,EAAE,qBAAqB;oBAC/B,QAAQ,EAAE,mBAAmB;iBAC9B,EAAD,EAAA;;;;QA4BA,EAAA,IAAA,EAAwC,eAAe,EAAvD;QAtJA,EAAA,IAAA,EAAED,eAAU,EAAZ;QAKA,EAAA,IAAA,EAAED,WAAM,EAAR;;;QAwHA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAGD,WAAM,EAAT,IAAA,EAAA,CAAU,mBAAmB,EAA7B,EAAA,CAAA;QAMA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAGD,UAAK,EAAR,IAAA,EAAA,CAAS,2BAA2B,EAApC,EAAA,CAAA;QASA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAGA,UAAK,EAAR,CAAA;;IA2CA,OAAA,iBAAC,CAAD;CAAC,EAAD,CAAA,CAAC;AA5DD,AAAA,IA+DA,eAAA,kBAAA,YAAA;IAAA,SAAA,eAAA,GAAA;KAK+B;;QAL/B,EAAA,IAAA,EAACD,aAAQ,EAAT,IAAA,EAAA,CAAU;oBACR,OAAO,EAAE,CAAC,iBAAiB,CAAC;oBAC5B,YAAY,EAAE,CAAC,iBAAiB,CAAC;oBACjC,SAAS,EAAE,CAAC,uBAAuB,CAAC;iBACrC,EAAD,EAAA;;IAC8B,OAA9B,eAA+B,CAA/B;CAA+B,EAA/B,CAAA;;;;;;;;;;;;;;;"}
|
|
@@ -5,5 +5,5 @@
|
|
|
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
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/coercion"),require("@angular/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@angular/cdk/observers",["exports","@angular/cdk/coercion","@angular/core","rxjs","rxjs/operators"],t):t((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.observers={}),e.ng.cdk.coercion,e.ng.core,e.rxjs,e.rxjs.operators)}(this,function(e,t,r,n,o){"use strict";var s=function(){function e(){}return e.prototype.create=function(e){return"undefined"==typeof MutationObserver?null:new MutationObserver(e)},e.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=r.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}(),i=function(){function e(e){this._mutationObserverFactory=e,this._observedElements=new Map}return e.prototype.ngOnDestroy=function(){var e=this;this._observedElements.forEach(function(t,r){return e._cleanupObserver(r)})},e.prototype.observe=function(e){var
|
|
8
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/coercion"),require("@angular/core"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@angular/cdk/observers",["exports","@angular/cdk/coercion","@angular/core","rxjs","rxjs/operators"],t):t((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.observers={}),e.ng.cdk.coercion,e.ng.core,e.rxjs,e.rxjs.operators)}(this,function(e,t,r,n,o){"use strict";var s=function(){function e(){}return e.prototype.create=function(e){return"undefined"==typeof MutationObserver?null:new MutationObserver(e)},e.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=r.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}(),i=function(){function e(e){this._mutationObserverFactory=e,this._observedElements=new Map}return e.prototype.ngOnDestroy=function(){var e=this;this._observedElements.forEach(function(t,r){return e._cleanupObserver(r)})},e.prototype.observe=function(e){var r=this,o=t.coerceElement(e);return new n.Observable(function(e){var t=r._observeElement(o),n=t.subscribe(e);return function(){n.unsubscribe(),r._unobserveElement(o)}})},e.prototype._observeElement=function(e){if(this._observedElements.has(e))this._observedElements.get(e).count++;else{var t=new n.Subject,r=this._mutationObserverFactory.create(function(e){return t.next(e)});r&&r.observe(e,{characterData:!0,childList:!0,subtree:!0}),this._observedElements.set(e,{observer:r,stream:t,count:1})}return this._observedElements.get(e).stream},e.prototype._unobserveElement=function(e){this._observedElements.has(e)&&(--this._observedElements.get(e).count||this._cleanupObserver(e))},e.prototype._cleanupObserver=function(e){if(this._observedElements.has(e)){var t=this._observedElements.get(e),r=t.observer,n=t.stream;r&&r.disconnect(),n.complete(),this._observedElements.delete(e)}},e.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:s}]},e.ngInjectableDef=r.defineInjectable({factory:function(){return new e(r.inject(s))},token:e,providedIn:"root"}),e}(),c=function(){function e(e,t,n){this._contentObserver=e,this._elementRef=t,this._ngZone=n,this.event=new r.EventEmitter,this._disabled=!1,this._currentSubscription=null}return Object.defineProperty(e.prototype,"disabled",{get:function(){return this._disabled},set:function(e){this._disabled=t.coerceBooleanProperty(e),this._disabled?this._unsubscribe():this._subscribe()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"debounce",{get:function(){return this._debounce},set:function(e){this._debounce=t.coerceNumberProperty(e),this._subscribe()},enumerable:!0,configurable:!0}),e.prototype.ngAfterContentInit=function(){this._currentSubscription||this.disabled||this._subscribe()},e.prototype.ngOnDestroy=function(){this._unsubscribe()},e.prototype._subscribe=function(){var e=this;this._unsubscribe();var t=this._contentObserver.observe(this._elementRef);this._ngZone.runOutsideAngular(function(){e._currentSubscription=(e.debounce?t.pipe(o.debounceTime(e.debounce)):t).subscribe(e.event)})},e.prototype._unsubscribe=function(){this._currentSubscription&&this._currentSubscription.unsubscribe()},e.decorators=[{type:r.Directive,args:[{selector:"[cdkObserveContent]",exportAs:"cdkObserveContent"}]}],e.ctorParameters=function(){return[{type:i},{type:r.ElementRef},{type:r.NgZone}]},e.propDecorators={event:[{type:r.Output,args:["cdkObserveContent"]}],disabled:[{type:r.Input,args:["cdkObserveContentDisabled"]}],debounce:[{type:r.Input}]},e}(),u=function(){function e(){}return e.decorators=[{type:r.NgModule,args:[{exports:[c],declarations:[c],providers:[s]}]}],e}();e.MutationObserverFactory=s,e.ContentObserver=i,e.CdkObserveContent=c,e.ObserversModule=u,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
9
9
|
//# sourceMappingURL=cdk-observers.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk-observers.umd.min.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} 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 = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : 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":["MutationObserverFactory","prototype","create","callback","MutationObserver","type","Injectable","args","providedIn","ContentObserver","_mutationObserverFactory","this","_observedElements","Map","ngOnDestroy","_this","forEach","_","element","_cleanupObserver","observe","elementOrRef","ElementRef","nativeElement","Observable","observer","stream","_observeElement","subscription","subscribe","unsubscribe","_unobserveElement","has","get","count","stream_1","Subject","mutations","next","characterData","childList","subtree","set","_a","disconnect","complete","delete","CdkObserveContent","_contentObserver","_elementRef","_ngZone","event","EventEmitter","_disabled","_currentSubscription","Object","defineProperty","value","coerceBooleanProperty","_unsubscribe","_subscribe","_debounce","coerceNumberProperty","ngAfterContentInit","disabled","runOutsideAngular","debounce","pipe","debounceTime","Directive","selector","exportAs","NgZone","Output","Input","ObserversModule","NgModule","exports","declarations","providers"],"mappings":";;;;;;;ieA4BA,IAAAA,GAAA,WAAA,QAAAA,MA5BA,MA8BEA,GAAFC,UAAAC,OAAE,SAAOC,GACL,MAAmC,mBAArBC,kBAAmC,KAAO,GAAIA,kBAAiBD,mBAHjFE,KAACC,EAAAA,WAADC,OAAaC,WAAY,8GA5BzBR,KAqCAS,EAAA,WASE,QAAFA,GAAsBC,GAAAC,KAAtBD,yBAAsBA,EANZC,KAAVC,kBAA8B,GAAIC,KAxClC,MAgDEJ,GAAFR,UAAAa,YAAE,WAAA,GAAFC,GAAAJ,IACIA,MAAKC,kBAAkBI,QAAQ,SAACC,EAAGC,GAAY,MAAAH,GAAKI,iBAAiBD,MAevET,EAAFR,UAAAmB,QAAE,SAAQC,GAAR,GAAFN,GAAAJ,KACUO,EAAUG,YAAwBC,GAAAA,WAAaD,EAAaE,cAAgBF,CAElF,OAAOG,GAAAA,WAAWtB,OAAO,SAACuB,GAC9B,GAAYC,GAASX,EAAKY,gBAAgBT,GAC9BU,EAAeF,EAAOG,UAAUJ,EAEtC,OAAO,YACLG,EAAaE,cACbf,EAAKgB,kBAAkBb,OASrBT,EAAVR,UAAA0B,gBAAE,SAAwBT,GACtB,GAAKP,KAAKC,kBAAkBoB,IAAId,GAY9BP,KAAKC,kBAAkBqB,IAAIf,GAAUgB,YAZG,CAC9C,GAAYC,GAAS,GAAIC,GAAAA,QACbX,EAAWd,KAAKD,yBAAyBR,OAAO,SAAAmC,GAAa,MAAAF,GAAOG,KAAKD,IAC3EZ,IACFA,EAASL,QAAQF,GACfqB,eAAe,EACfC,WAAW,EACXC,SAAS,IAGb9B,KAAKC,kBAAkB8B,IAAIxB,GAAUO,SAA3CA,EAAqDC,OAArDS,EAA6DD,MAAO,IAIhE,MAAOvB,MAAKC,kBAAkBqB,IAAIf,GAAUQ,QAOtCjB,EAAVR,UAAA8B,kBAAE,SAA0Bb,GACpBP,KAAKC,kBAA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KuC,sBACAvC,EAAKmD,SAAWxC,EAAOyC,KAAKC,EAAAA,aAAarD,EAAKmD,WAAaxC,GAAQG,UAAUd,EAAKoC,UAInFJ,EAAV9C,UAAA0D,aAAE,WACMhD,KAAK2C,sBACP3C,KAAK2C,qBAAqBxB,8BA7DhCzB,KAACgE,EAAAA,UAAD9D,OACE+D,SAAU,sBACVC,SAAU,4DA6BZlE,KAAwCI,IAtJxCJ,KAAEiB,EAAAA,aAKFjB,KAAEmE,EAAAA,4BAwHFrB,QAAA9C,KAAGoE,EAAAA,OAAHlE,MAAU,uBAMVyD,WAAA3D,KAAGqE,EAAAA,MAAHnE,MAAS,+BAST2D,WAAA7D,KAAGqE,EAAAA,SA2CH3B,KAGA4B,EAAA,WAAA,QAAAA,MAK8B,sBAL9BtE,KAACuE,EAAAA,SAADrE,OACEsE,SAAU9B,GACV+B,cAAe/B,GACfgC,WAAY/E,OAEd2E"}
|
|
1
|
+
{"version":3,"file":"cdk-observers.umd.min.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":["MutationObserverFactory","prototype","create","callback","MutationObserver","type","Injectable","args","providedIn","ContentObserver","_mutationObserverFactory","this","_observedElements","Map","ngOnDestroy","_this","forEach","_","element","_cleanupObserver","observe","elementOrRef","coerceElement","Observable","observer","stream","_observeElement","subscription","subscribe","unsubscribe","_unobserveElement","has","get","count","stream_1","Subject","mutations","next","characterData","childList","subtree","set","_a","disconnect","complete","delete","CdkObserveContent","_contentObserver","_elementRef","_ngZone","event","EventEmitter","_disabled","_currentSubscription","Object","defineProperty","value","coerceBooleanProperty","_unsubscribe","_subscribe","_debounce","coerceNumberProperty","ngAfterContentInit","disabled","runOutsideAngular","debounce","pipe","debounceTime","Directive","selector","exportAs","ElementRef","NgZone","Output","Input","ObserversModule","NgModule","exports","declarations","providers"],"mappings":";;;;;;;ieA4BA,IAAAA,GAAA,WAAA,QAAAA,MA5BA,MA8BEA,GAAFC,UAAAC,OAAE,SAAOC,GACL,MAAmC,mBAArBC,kBAAmC,KAAO,GAAIA,kBAAiBD,mBAHjFE,KAACC,EAAAA,WAADC,OAAaC,WAAY,8GA5BzBR,KAqCAS,EAAA,WASE,QAAFA,GAAsBC,GAAAC,KAAtBD,yBAAsBA,EANZC,KAAVC,kBAA8B,GAAIC,KAxClC,MAgDEJ,GAAFR,UAAAa,YAAE,WAAA,GAAFC,GAAAJ,IACIA,MAAKC,kBAAkBI,QAAQ,SAACC,EAAGC,GAAY,MAAAH,GAAKI,iBAAiBD,MAevET,EAAFR,UAAAmB,QAAE,SAAQC,GAAR,GAAFN,GAAAJ,KACUO,EAAUI,EAAAA,cAAcD,EAE9B,OAAO,IAAIE,GAAAA,WAAW,SAACC,GAC3B,GAAYC,GAASV,EAAKW,gBAAgBR,GAC9BS,EAAeF,EAAOG,UAAUJ,EAEtC,OAAO,YACLG,EAAaE,cACbd,EAAKe,kBAAkBZ,OASrBT,EAAVR,UAAAyB,gBAAE,SAAwBR,GACtB,GAAKP,KAAKC,kBAAkBmB,IAAIb,GAY9BP,KAAKC,kBAAkBoB,IAAId,GAAUe,YAZG,CAC9C,GAAYC,GAAS,GAAIC,GAAAA,QACbX,EAAWb,KAAKD,yBAAyBR,OA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Pb,EAAF7C,UAAA6D,mBAAE,WACOnD,KAAK0C,sBAAyB1C,KAAKoD,UACtCpD,KAAKgD,cAITb,EAAF7C,UAAAa,YAAE,WACEH,KAAK+C,gBAGCZ,EAAV7C,UAAA0D,WAAE,WAAA,GAAF5C,GAAAJ,IACIA,MAAK+C,cACT,IAAUjC,GAASd,KAAKoC,iBAAiB3B,QAAQT,KAAKqC,YAMlDrC,MAAKsC,QAAQe,kBAAkB,WAC7BjD,EAAKsC,sBACAtC,EAAKkD,SAAWxC,EAAOyC,KAAKC,EAAAA,aAAapD,EAAKkD,WAAaxC,GAAQG,UAAUb,EAAKmC,UAInFJ,EAAV7C,UAAAyD,aAAE,WACM/C,KAAK0C,sBACP1C,KAAK0C,qBAAqBxB,8BA7DhCxB,KAAC+D,EAAAA,UAAD7D,OACE8D,SAAU,sBACVC,SAAU,4DA6BZjE,KAAwCI,IAtJxCJ,KAAEkE,EAAAA,aAKFlE,KAAEmE,EAAAA,4BAwHFtB,QAAA7C,KAAGoE,EAAAA,OAAHlE,MAAU,uBAMVwD,WAAA1D,KAAGqE,EAAAA,MAAHnE,MAAS,+BAST0D,WAAA5D,KAAGqE,EAAAA,SA2CH5B,KAGA6B,EAAA,WAAA,QAAAA,MAK8B,sBAL9BtE,KAACuE,EAAAA,SAADrE,OACEsE,SAAU/B,GACVgC,cAAehC,GACfiC,WAAY/E,OAEd2E"}
|
|
@@ -949,7 +949,7 @@ OverlayRef = /** @class */ (function () {
|
|
|
949
949
|
this._attachments = new rxjs.Subject();
|
|
950
950
|
this._detachments = new rxjs.Subject();
|
|
951
951
|
this._locationChanges = rxjs.Subscription.EMPTY;
|
|
952
|
-
this._keydownEventsObservable = rxjs.Observable
|
|
952
|
+
this._keydownEventsObservable = new rxjs.Observable(function (observer) {
|
|
953
953
|
/** @type {?} */
|
|
954
954
|
var subscription = _this._keydownEvents.subscribe(observer);
|
|
955
955
|
_this._keydownEventSubscriptions++;
|
|
@@ -1217,13 +1217,13 @@ OverlayRef = /** @class */ (function () {
|
|
|
1217
1217
|
function () {
|
|
1218
1218
|
return this._keydownEventsObservable;
|
|
1219
1219
|
};
|
|
1220
|
-
/** Gets the
|
|
1220
|
+
/** Gets the current overlay configuration, which is immutable. */
|
|
1221
1221
|
/**
|
|
1222
|
-
* Gets the
|
|
1222
|
+
* Gets the current overlay configuration, which is immutable.
|
|
1223
1223
|
* @return {?}
|
|
1224
1224
|
*/
|
|
1225
1225
|
OverlayRef.prototype.getConfig = /**
|
|
1226
|
-
* Gets the
|
|
1226
|
+
* Gets the current overlay configuration, which is immutable.
|
|
1227
1227
|
* @return {?}
|
|
1228
1228
|
*/
|
|
1229
1229
|
function () {
|
|
@@ -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
|
*/
|
|
@@ -1647,7 +1679,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
|
|
|
1647
1679
|
/**
|
|
1648
1680
|
* Observable sequence of position changes.
|
|
1649
1681
|
*/
|
|
1650
|
-
this.positionChanges = rxjs.Observable
|
|
1682
|
+
this.positionChanges = new rxjs.Observable(function (observer) {
|
|
1651
1683
|
/** @type {?} */
|
|
1652
1684
|
var subscription = _this._positionChanges.subscribe(observer);
|
|
1653
1685
|
_this._positionChangeSubscriptions++;
|
|
@@ -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.
|
|
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.
|
|
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
|
|
2099
|
-
*
|
|
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
|
|
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
|
|
2143
|
+
* @param {?} origin Reference to the new origin.
|
|
2106
2144
|
* @return {THIS}
|
|
2107
2145
|
*/
|
|
2108
2146
|
FlexibleConnectedPositionStrategy.prototype.setOrigin = /**
|
|
2109
|
-
* Sets the origin
|
|
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
|
|
2153
|
+
* @param {?} origin Reference to the new origin.
|
|
2113
2154
|
* @return {THIS}
|
|
2114
2155
|
*/
|
|
2115
2156
|
function (origin) {
|
|
2116
|
-
(/** @type {?} */ (this))._origin = origin
|
|
2157
|
+
(/** @type {?} */ (this))._origin = origin;
|
|
2117
2158
|
return (/** @type {?} */ (this));
|
|
2118
2159
|
};
|
|
2119
2160
|
/**
|
|
@@ -2581,7 +2622,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
|
|
|
2581
2622
|
if (position.overlayY === 'top') {
|
|
2582
2623
|
// Overlay is opening "downward" and thus is bound by the bottom viewport edge.
|
|
2583
2624
|
top = origin.y;
|
|
2584
|
-
height = viewport.
|
|
2625
|
+
height = viewport.height - top + this._viewportMargin;
|
|
2585
2626
|
}
|
|
2586
2627
|
else if (position.overlayY === 'bottom') {
|
|
2587
2628
|
// Overlay is opening "upward" and thus is bound by the top viewport edge. We need to add
|
|
@@ -2760,6 +2801,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
|
|
|
2760
2801
|
bottom: '',
|
|
2761
2802
|
right: '',
|
|
2762
2803
|
position: '',
|
|
2804
|
+
transform: '',
|
|
2763
2805
|
})));
|
|
2764
2806
|
};
|
|
2765
2807
|
/** Sets positioning styles to the overlay element. */
|
|
@@ -2940,7 +2982,7 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
|
|
|
2940
2982
|
function () {
|
|
2941
2983
|
// Note: needs fresh rects since the position could've changed.
|
|
2942
2984
|
/** @type {?} */
|
|
2943
|
-
var originBounds = this.
|
|
2985
|
+
var originBounds = this._getOriginRect();
|
|
2944
2986
|
/** @type {?} */
|
|
2945
2987
|
var overlayBounds = this._pane.getBoundingClientRect();
|
|
2946
2988
|
// TODO(jelbourn): instead of needing all of the client rects for these scrolling containers
|
|
@@ -3130,6 +3172,36 @@ FlexibleConnectedPositionStrategy = /** @class */ (function () {
|
|
|
3130
3172
|
this._appliedPanelClasses = [];
|
|
3131
3173
|
}
|
|
3132
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
|
+
};
|
|
3133
3205
|
return FlexibleConnectedPositionStrategy;
|
|
3134
3206
|
}());
|
|
3135
3207
|
/**
|
|
@@ -3941,20 +4013,20 @@ var OverlayPositionBuilder = /** @class */ (function () {
|
|
|
3941
4013
|
};
|
|
3942
4014
|
/**
|
|
3943
4015
|
* Creates a flexible position strategy.
|
|
3944
|
-
* @param
|
|
4016
|
+
* @param origin Origin relative to which to position the overlay.
|
|
3945
4017
|
*/
|
|
3946
4018
|
/**
|
|
3947
4019
|
* Creates a flexible position strategy.
|
|
3948
|
-
* @param {?}
|
|
4020
|
+
* @param {?} origin Origin relative to which to position the overlay.
|
|
3949
4021
|
* @return {?}
|
|
3950
4022
|
*/
|
|
3951
4023
|
OverlayPositionBuilder.prototype.flexibleConnectedTo = /**
|
|
3952
4024
|
* Creates a flexible position strategy.
|
|
3953
|
-
* @param {?}
|
|
4025
|
+
* @param {?} origin Origin relative to which to position the overlay.
|
|
3954
4026
|
* @return {?}
|
|
3955
4027
|
*/
|
|
3956
|
-
function (
|
|
3957
|
-
return new FlexibleConnectedPositionStrategy(
|
|
4028
|
+
function (origin) {
|
|
4029
|
+
return new FlexibleConnectedPositionStrategy(origin, this._viewportRuler, this._document, this._platform, this._overlayContainer);
|
|
3958
4030
|
};
|
|
3959
4031
|
OverlayPositionBuilder.decorators = [
|
|
3960
4032
|
{ type: core.Injectable, args: [{ providedIn: 'root' },] },
|
|
@@ -4392,7 +4464,10 @@ var CdkConnectedOverlay = /** @class */ (function () {
|
|
|
4392
4464
|
* @return {?}
|
|
4393
4465
|
*/
|
|
4394
4466
|
function () {
|
|
4395
|
-
this.
|
|
4467
|
+
if (this._overlayRef) {
|
|
4468
|
+
this._overlayRef.dispose();
|
|
4469
|
+
}
|
|
4470
|
+
this._backdropSubscription.unsubscribe();
|
|
4396
4471
|
};
|
|
4397
4472
|
/**
|
|
4398
4473
|
* @param {?} changes
|
|
@@ -4405,6 +4480,12 @@ var CdkConnectedOverlay = /** @class */ (function () {
|
|
|
4405
4480
|
function (changes) {
|
|
4406
4481
|
if (this._position) {
|
|
4407
4482
|
this._updatePositionStrategy(this._position);
|
|
4483
|
+
this._overlayRef.updateSize({
|
|
4484
|
+
width: this.width,
|
|
4485
|
+
minWidth: this.minWidth,
|
|
4486
|
+
height: this.height,
|
|
4487
|
+
minHeight: this.minHeight,
|
|
4488
|
+
});
|
|
4408
4489
|
if (changes['origin'] && this.open) {
|
|
4409
4490
|
this._position.apply();
|
|
4410
4491
|
}
|
|
@@ -4548,12 +4629,7 @@ var CdkConnectedOverlay = /** @class */ (function () {
|
|
|
4548
4629
|
}
|
|
4549
4630
|
else {
|
|
4550
4631
|
// Update the overlay size, in case the directive's inputs have changed
|
|
4551
|
-
this._overlayRef.
|
|
4552
|
-
width: this.width,
|
|
4553
|
-
minWidth: this.minWidth,
|
|
4554
|
-
height: this.height,
|
|
4555
|
-
minHeight: this.minHeight,
|
|
4556
|
-
});
|
|
4632
|
+
this._overlayRef.getConfig().hasBackdrop = this.hasBackdrop;
|
|
4557
4633
|
}
|
|
4558
4634
|
if (!this._overlayRef.hasAttached()) {
|
|
4559
4635
|
this._overlayRef.attach(this._templatePortal);
|
|
@@ -4564,6 +4640,9 @@ var CdkConnectedOverlay = /** @class */ (function () {
|
|
|
4564
4640
|
_this.backdropClick.emit(event);
|
|
4565
4641
|
});
|
|
4566
4642
|
}
|
|
4643
|
+
else {
|
|
4644
|
+
this._backdropSubscription.unsubscribe();
|
|
4645
|
+
}
|
|
4567
4646
|
};
|
|
4568
4647
|
/** Detaches the overlay and unsubscribes to backdrop clicks if backdrop exists */
|
|
4569
4648
|
/**
|
|
@@ -4583,23 +4662,6 @@ var CdkConnectedOverlay = /** @class */ (function () {
|
|
|
4583
4662
|
}
|
|
4584
4663
|
this._backdropSubscription.unsubscribe();
|
|
4585
4664
|
};
|
|
4586
|
-
/** Destroys the overlay created by this directive. */
|
|
4587
|
-
/**
|
|
4588
|
-
* Destroys the overlay created by this directive.
|
|
4589
|
-
* @private
|
|
4590
|
-
* @return {?}
|
|
4591
|
-
*/
|
|
4592
|
-
CdkConnectedOverlay.prototype._destroyOverlay = /**
|
|
4593
|
-
* Destroys the overlay created by this directive.
|
|
4594
|
-
* @private
|
|
4595
|
-
* @return {?}
|
|
4596
|
-
*/
|
|
4597
|
-
function () {
|
|
4598
|
-
if (this._overlayRef) {
|
|
4599
|
-
this._overlayRef.dispose();
|
|
4600
|
-
}
|
|
4601
|
-
this._backdropSubscription.unsubscribe();
|
|
4602
|
-
};
|
|
4603
4665
|
CdkConnectedOverlay.decorators = [
|
|
4604
4666
|
{ type: core.Directive, args: [{
|
|
4605
4667
|
selector: '[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]',
|