@angular/cdk 6.4.6 → 6.4.7
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/a11y/typings/focus-monitor/focus-monitor.d.ts +1 -1
- package/a11y/typings/focus-trap/focus-trap.d.ts +1 -1
- package/a11y/typings/index.metadata.json +1 -1
- package/accordion/typings/accordion.d.ts +6 -1
- package/accordion/typings/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +9 -7
- 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-accordion.umd.js +28 -4
- package/bundles/cdk-accordion.umd.js.map +1 -1
- package/bundles/cdk-accordion.umd.min.js +1 -1
- package/bundles/cdk-accordion.umd.min.js.map +1 -1
- package/bundles/cdk-collections.umd.js +9 -3
- package/bundles/cdk-collections.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.min.js +1 -1
- package/bundles/cdk-collections.umd.min.js.map +1 -1
- package/bundles/cdk-observers.umd.js +5 -10
- 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.map +1 -1
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +1 -1
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-stepper.umd.js +36 -6
- 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 +29 -9
- 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 +12 -23
- 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.map +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/collections/typings/index.metadata.json +1 -1
- package/collections/typings/selection.d.ts +6 -0
- package/esm2015/a11y.js +10 -4
- package/esm2015/a11y.js.map +1 -1
- package/esm2015/accordion.js +18 -1
- package/esm2015/accordion.js.map +1 -1
- package/esm2015/cdk.js +1 -1
- package/esm2015/cdk.js.map +1 -1
- package/esm2015/collections.js +9 -3
- package/esm2015/collections.js.map +1 -1
- package/esm2015/observers.js +4 -4
- package/esm2015/observers.js.map +1 -1
- package/esm2015/overlay.js.map +1 -1
- package/esm2015/scrolling.js +1 -1
- package/esm2015/scrolling.js.map +1 -1
- package/esm2015/stepper.js +32 -4
- package/esm2015/stepper.js.map +1 -1
- package/esm2015/table.js +30 -8
- package/esm2015/table.js.map +1 -1
- package/esm2015/text-field.js +9 -9
- package/esm2015/text-field.js.map +1 -1
- package/esm2015/tree.js.map +1 -1
- package/esm5/a11y.es5.js +9 -7
- package/esm5/a11y.es5.js.map +1 -1
- package/esm5/accordion.es5.js +25 -1
- package/esm5/accordion.es5.js.map +1 -1
- package/esm5/cdk.es5.js +1 -1
- package/esm5/cdk.es5.js.map +1 -1
- package/esm5/collections.es5.js +9 -3
- package/esm5/collections.es5.js.map +1 -1
- package/esm5/observers.es5.js +5 -10
- package/esm5/observers.es5.js.map +1 -1
- package/esm5/overlay.es5.js.map +1 -1
- package/esm5/scrolling.es5.js +1 -1
- package/esm5/scrolling.es5.js.map +1 -1
- package/esm5/stepper.es5.js +34 -4
- package/esm5/stepper.es5.js.map +1 -1
- package/esm5/table.es5.js +28 -7
- package/esm5/table.es5.js.map +1 -1
- package/esm5/text-field.es5.js +12 -23
- package/esm5/text-field.es5.js.map +1 -1
- package/esm5/tree.es5.js.map +1 -1
- package/observers/typings/index.metadata.json +1 -1
- package/observers/typings/observe-content.d.ts +6 -1
- package/overlay/typings/index.metadata.json +1 -1
- package/overlay/typings/position/connected-position-strategy.d.ts +1 -1
- package/package.json +3 -3
- package/stepper/typings/index.metadata.json +1 -1
- package/stepper/typings/stepper.d.ts +10 -2
- package/table/typings/index.metadata.json +1 -1
- package/table/typings/sticky-styler.d.ts +3 -1
- package/table/typings/table.d.ts +10 -1
- package/text-field/typings/autofill.d.ts +13 -2
- package/text-field/typings/autosize.d.ts +1 -1
- package/text-field/typings/index.metadata.json +1 -1
- package/tree/typings/index.metadata.json +1 -1
- package/tree/typings/nested-node.d.ts +2 -2
- package/tree/typings/padding.d.ts +1 -1
- package/tree/typings/tree.d.ts +2 -2
- package/typings/a11y/focus-monitor/focus-monitor.d.ts +1 -1
- package/typings/a11y/focus-trap/focus-trap.d.ts +1 -1
- package/typings/a11y/index.metadata.json +1 -1
- package/typings/accordion/accordion.d.ts +6 -1
- package/typings/accordion/index.metadata.json +1 -1
- package/typings/collections/index.metadata.json +1 -1
- package/typings/collections/selection.d.ts +6 -0
- package/typings/esm5/a11y/focus-monitor/focus-monitor.d.ts +1 -1
- package/typings/esm5/a11y/focus-trap/focus-trap.d.ts +1 -1
- package/typings/esm5/a11y/index.metadata.json +1 -1
- package/typings/esm5/accordion/accordion.d.ts +6 -1
- package/typings/esm5/accordion/index.metadata.json +1 -1
- package/typings/esm5/collections/index.metadata.json +1 -1
- package/typings/esm5/collections/selection.d.ts +6 -0
- package/typings/esm5/index.metadata.json +1 -1
- package/typings/esm5/observers/index.metadata.json +1 -1
- package/typings/esm5/observers/observe-content.d.ts +6 -1
- package/typings/esm5/overlay/index.metadata.json +1 -1
- package/typings/esm5/overlay/position/connected-position-strategy.d.ts +1 -1
- package/typings/esm5/stepper/index.metadata.json +1 -1
- package/typings/esm5/stepper/stepper.d.ts +10 -2
- package/typings/esm5/table/index.metadata.json +1 -1
- package/typings/esm5/table/sticky-styler.d.ts +3 -1
- package/typings/esm5/table/table.d.ts +10 -1
- package/typings/esm5/text-field/autofill.d.ts +13 -2
- package/typings/esm5/text-field/autosize.d.ts +1 -1
- package/typings/esm5/text-field/index.metadata.json +1 -1
- package/typings/esm5/tree/index.metadata.json +1 -1
- package/typings/esm5/tree/nested-node.d.ts +2 -2
- package/typings/esm5/tree/padding.d.ts +1 -1
- package/typings/esm5/tree/tree.d.ts +2 -2
- package/typings/index.metadata.json +1 -1
- package/typings/observers/index.metadata.json +1 -1
- package/typings/observers/observe-content.d.ts +6 -1
- package/typings/overlay/index.metadata.json +1 -1
- package/typings/overlay/position/connected-position-strategy.d.ts +1 -1
- package/typings/stepper/index.metadata.json +1 -1
- package/typings/stepper/stepper.d.ts +10 -2
- package/typings/table/index.metadata.json +1 -1
- package/typings/table/sticky-styler.d.ts +3 -1
- package/typings/table/table.d.ts +10 -1
- package/typings/text-field/autofill.d.ts +13 -2
- package/typings/text-field/autosize.d.ts +1 -1
- package/typings/text-field/index.metadata.json +1 -1
- package/typings/tree/index.metadata.json +1 -1
- package/typings/tree/nested-node.d.ts +2 -2
- package/typings/tree/padding.d.ts +1 -1
- package/typings/tree/tree.d.ts +2 -2
package/esm2015/accordion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.js","sources":["../../../src/cdk/accordion/accordion-module.ts","../../../src/cdk/accordion/accordion-item.ts","../../../src/cdk/accordion/accordion.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 {NgModule} from '@angular/core';\nimport {CdkAccordion} from './accordion';\nimport {CdkAccordionItem} from './accordion-item';\n\n\n@NgModule({\n exports: [CdkAccordion, CdkAccordionItem],\n declarations: [CdkAccordion, CdkAccordionItem],\n})\nexport class CdkAccordionModule {}\n","/**\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 {\n Output,\n Directive,\n EventEmitter,\n Input,\n OnDestroy,\n Optional,\n ChangeDetectorRef,\n SkipSelf,\n} from '@angular/core';\nimport {UniqueSelectionDispatcher} from '@angular/cdk/collections';\nimport {CdkAccordion} from './accordion';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {Subscription} from 'rxjs';\n\n/** Used to generate unique ID for each accordion item. */\nlet nextId = 0;\n\n/**\n * An basic directive expected to be extended and decorated as a component. Sets up all\n * events and attributes needed to be managed by a CdkAccordion parent.\n */\n@Directive({\n selector: 'cdk-accordion-item, [cdkAccordionItem]',\n exportAs: 'cdkAccordionItem',\n providers: [\n // Provide CdkAccordion as undefined to prevent nested accordion items from registering\n // to the same accordion.\n {provide: CdkAccordion, useValue: undefined},\n ],\n})\nexport class CdkAccordionItem implements OnDestroy {\n /** Subscription to openAll/closeAll events. */\n private _openCloseAllSubscription = Subscription.EMPTY;\n /** Event emitted every time the AccordionItem is closed. */\n @Output() closed: EventEmitter<void> = new EventEmitter<void>();\n /** Event emitted every time the AccordionItem is opened. */\n @Output() opened: EventEmitter<void> = new EventEmitter<void>();\n /** Event emitted when the AccordionItem is destroyed. */\n @Output() destroyed: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * Emits whenever the expanded state of the accordion changes.\n * Primarily used to facilitate two-way binding.\n * @docs-private\n */\n @Output() expandedChange: EventEmitter<boolean> = new EventEmitter<boolean>();\n\n /** The unique AccordionItem id. */\n readonly id: string = `cdk-accordion-child-${nextId++}`;\n\n /** Whether the AccordionItem is expanded. */\n @Input()\n get expanded(): any { return this._expanded; }\n set expanded(expanded: any) {\n expanded = coerceBooleanProperty(expanded);\n\n // Only emit events and update the internal value if the value changes.\n if (this._expanded !== expanded) {\n this._expanded = expanded;\n this.expandedChange.emit(expanded);\n\n if (expanded) {\n this.opened.emit();\n /**\n * In the unique selection dispatcher, the id parameter is the id of the CdkAccordionItem,\n * the name value is the id of the accordion.\n */\n const accordionId = this.accordion ? this.accordion.id : this.id;\n this._expansionDispatcher.notify(this.id, accordionId);\n } else {\n this.closed.emit();\n }\n\n // Ensures that the animation will run when the value is set outside of an `@Input`.\n // This includes cases like the open, close and toggle methods.\n this._changeDetectorRef.markForCheck();\n }\n }\n private _expanded = false;\n\n /** Whether the AccordionItem is disabled. */\n @Input()\n get disabled() { return this._disabled; }\n set disabled(disabled: any) { this._disabled = coerceBooleanProperty(disabled); }\n private _disabled: boolean = false;\n\n /** Unregister function for _expansionDispatcher. */\n private _removeUniqueSelectionListener: () => void = () => {};\n\n constructor(@Optional() @SkipSelf() public accordion: CdkAccordion,\n private _changeDetectorRef: ChangeDetectorRef,\n protected _expansionDispatcher: UniqueSelectionDispatcher) {\n this._removeUniqueSelectionListener =\n _expansionDispatcher.listen((id: string, accordionId: string) => {\n if (this.accordion && !this.accordion.multi &&\n this.accordion.id === accordionId && this.id !== id) {\n this.expanded = false;\n }\n });\n\n // When an accordion item is hosted in an accordion, subscribe to open/close events.\n if (this.accordion) {\n this._openCloseAllSubscription = this._subscribeToOpenCloseAllActions();\n }\n }\n\n /** Emits an event for the accordion item being destroyed. */\n ngOnDestroy() {\n this.opened.complete();\n this.closed.complete();\n this.destroyed.emit();\n this.destroyed.complete();\n this._removeUniqueSelectionListener();\n this._openCloseAllSubscription.unsubscribe();\n }\n\n /** Toggles the expanded state of the accordion item. */\n toggle(): void {\n if (!this.disabled) {\n this.expanded = !this.expanded;\n }\n }\n\n /** Sets the expanded state of the accordion item to false. */\n close(): void {\n if (!this.disabled) {\n this.expanded = false;\n }\n }\n\n /** Sets the expanded state of the accordion item to true. */\n open(): void {\n if (!this.disabled) {\n this.expanded = true;\n }\n }\n\n private _subscribeToOpenCloseAllActions(): Subscription {\n return this.accordion._openCloseAllActions.subscribe(expanded => {\n // Only change expanded state if item is enabled\n if (!this.disabled) {\n this.expanded = expanded;\n }\n });\n }\n}\n","/**\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 {Directive, Input} from '@angular/core';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {Subject} from 'rxjs';\n\n/** Used to generate unique ID for each accordion. */\nlet nextId = 0;\n\n/**\n * Directive whose purpose is to manage the expanded state of CdkAccordionItem children.\n */\n@Directive({\n selector: 'cdk-accordion, [cdkAccordion]',\n exportAs: 'cdkAccordion',\n})\nexport class CdkAccordion {\n /** Stream that emits true/false when openAll/closeAll is triggered. */\n readonly _openCloseAllActions: Subject<boolean> = new Subject<boolean>();\n\n /** A readonly id value to use for unique selection coordination. */\n readonly id = `cdk-accordion-${nextId++}`;\n\n /** Whether the accordion should allow multiple expanded accordion items simultaneously. */\n @Input()\n get multi(): boolean { return this._multi; }\n set multi(multi: boolean) { this._multi = coerceBooleanProperty(multi); }\n private _multi: boolean = false;\n\n /** Opens all enabled accordion items in an accordion where multi is enabled. */\n openAll(): void {\n this._openCloseAll(true);\n }\n\n /** Closes all enabled accordion items in an accordion where multi is enabled. */\n closeAll(): void {\n this._openCloseAll(false);\n }\n\n private _openCloseAll(expanded: boolean): void {\n if (this.multi) {\n this._openCloseAllActions.next(expanded);\n }\n }\n}\n"],"names":["nextId"],"mappings":";;;;;;;;;;;;;;;;;;;AEaA,qBAAI,MAAM,GAAG,CAAC,CAAC;;;;AASf,AAAA,MAAA,YAAA,CAAA;;;;;QAEA,IAAA,CAAA,oBAAA,GAAoD,IAAI,OAAO,EAAW,CAA1E;;;;QAGA,IAAA,CAAA,EAAA,GAAgB,CAAhB,cAAA,EAAiC,MAAM,EAAE,CAAzC,CAA2C,CAA3C;QAMA,IAAA,CAAA,MAAA,GAA4B,KAAK,CAAjC;;;;;;IAFA,IAAM,KAAK,GAAX,EAAyB,OAAO,IAAI,CAAC,MAAM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../src/cdk/accordion/accordion.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 {NgModule} from '@angular/core';\nimport {CdkAccordion} from './accordion';\nimport {CdkAccordionItem} from './accordion-item';\n\n\n@NgModule({\n exports: [CdkAccordion, CdkAccordionItem],\n declarations: [CdkAccordion, CdkAccordionItem],\n})\nexport class CdkAccordionModule {}\n","/**\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 {\n Output,\n Directive,\n EventEmitter,\n Input,\n OnDestroy,\n Optional,\n ChangeDetectorRef,\n SkipSelf,\n} from '@angular/core';\nimport {UniqueSelectionDispatcher} from '@angular/cdk/collections';\nimport {CdkAccordion} from './accordion';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {Subscription} from 'rxjs';\n\n/** Used to generate unique ID for each accordion item. */\nlet nextId = 0;\n\n/**\n * An basic directive expected to be extended and decorated as a component. Sets up all\n * events and attributes needed to be managed by a CdkAccordion parent.\n */\n@Directive({\n selector: 'cdk-accordion-item, [cdkAccordionItem]',\n exportAs: 'cdkAccordionItem',\n providers: [\n // Provide CdkAccordion as undefined to prevent nested accordion items from registering\n // to the same accordion.\n {provide: CdkAccordion, useValue: undefined},\n ],\n})\nexport class CdkAccordionItem implements OnDestroy {\n /** Subscription to openAll/closeAll events. */\n private _openCloseAllSubscription = Subscription.EMPTY;\n /** Event emitted every time the AccordionItem is closed. */\n @Output() closed: EventEmitter<void> = new EventEmitter<void>();\n /** Event emitted every time the AccordionItem is opened. */\n @Output() opened: EventEmitter<void> = new EventEmitter<void>();\n /** Event emitted when the AccordionItem is destroyed. */\n @Output() destroyed: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * Emits whenever the expanded state of the accordion changes.\n * Primarily used to facilitate two-way binding.\n * @docs-private\n */\n @Output() expandedChange: EventEmitter<boolean> = new EventEmitter<boolean>();\n\n /** The unique AccordionItem id. */\n readonly id: string = `cdk-accordion-child-${nextId++}`;\n\n /** Whether the AccordionItem is expanded. */\n @Input()\n get expanded(): any { return this._expanded; }\n set expanded(expanded: any) {\n expanded = coerceBooleanProperty(expanded);\n\n // Only emit events and update the internal value if the value changes.\n if (this._expanded !== expanded) {\n this._expanded = expanded;\n this.expandedChange.emit(expanded);\n\n if (expanded) {\n this.opened.emit();\n /**\n * In the unique selection dispatcher, the id parameter is the id of the CdkAccordionItem,\n * the name value is the id of the accordion.\n */\n const accordionId = this.accordion ? this.accordion.id : this.id;\n this._expansionDispatcher.notify(this.id, accordionId);\n } else {\n this.closed.emit();\n }\n\n // Ensures that the animation will run when the value is set outside of an `@Input`.\n // This includes cases like the open, close and toggle methods.\n this._changeDetectorRef.markForCheck();\n }\n }\n private _expanded = false;\n\n /** Whether the AccordionItem is disabled. */\n @Input()\n get disabled() { return this._disabled; }\n set disabled(disabled: any) { this._disabled = coerceBooleanProperty(disabled); }\n private _disabled: boolean = false;\n\n /** Unregister function for _expansionDispatcher. */\n private _removeUniqueSelectionListener: () => void = () => {};\n\n constructor(@Optional() @SkipSelf() public accordion: CdkAccordion,\n private _changeDetectorRef: ChangeDetectorRef,\n protected _expansionDispatcher: UniqueSelectionDispatcher) {\n this._removeUniqueSelectionListener =\n _expansionDispatcher.listen((id: string, accordionId: string) => {\n if (this.accordion && !this.accordion.multi &&\n this.accordion.id === accordionId && this.id !== id) {\n this.expanded = false;\n }\n });\n\n // When an accordion item is hosted in an accordion, subscribe to open/close events.\n if (this.accordion) {\n this._openCloseAllSubscription = this._subscribeToOpenCloseAllActions();\n }\n }\n\n /** Emits an event for the accordion item being destroyed. */\n ngOnDestroy() {\n this.opened.complete();\n this.closed.complete();\n this.destroyed.emit();\n this.destroyed.complete();\n this._removeUniqueSelectionListener();\n this._openCloseAllSubscription.unsubscribe();\n }\n\n /** Toggles the expanded state of the accordion item. */\n toggle(): void {\n if (!this.disabled) {\n this.expanded = !this.expanded;\n }\n }\n\n /** Sets the expanded state of the accordion item to false. */\n close(): void {\n if (!this.disabled) {\n this.expanded = false;\n }\n }\n\n /** Sets the expanded state of the accordion item to true. */\n open(): void {\n if (!this.disabled) {\n this.expanded = true;\n }\n }\n\n private _subscribeToOpenCloseAllActions(): Subscription {\n return this.accordion._openCloseAllActions.subscribe(expanded => {\n // Only change expanded state if item is enabled\n if (!this.disabled) {\n this.expanded = expanded;\n }\n });\n }\n}\n","/**\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} from '@angular/cdk/coercion';\nimport {Directive, Input, OnChanges, OnDestroy, SimpleChanges} from '@angular/core';\nimport {Subject} from 'rxjs';\n\n/** Used to generate unique ID for each accordion. */\nlet nextId = 0;\n\n/**\n * Directive whose purpose is to manage the expanded state of CdkAccordionItem children.\n */\n@Directive({\n selector: 'cdk-accordion, [cdkAccordion]',\n exportAs: 'cdkAccordion',\n})\nexport class CdkAccordion implements OnDestroy, OnChanges {\n /** Emits when the state of the accordion changes */\n readonly _stateChanges = new Subject<SimpleChanges>();\n\n /** Stream that emits true/false when openAll/closeAll is triggered. */\n readonly _openCloseAllActions: Subject<boolean> = new Subject<boolean>();\n\n /** A readonly id value to use for unique selection coordination. */\n readonly id = `cdk-accordion-${nextId++}`;\n\n /** Whether the accordion should allow multiple expanded accordion items simultaneously. */\n @Input()\n get multi(): boolean { return this._multi; }\n set multi(multi: boolean) { this._multi = coerceBooleanProperty(multi); }\n private _multi: boolean = false;\n\n /** Opens all enabled accordion items in an accordion where multi is enabled. */\n openAll(): void {\n this._openCloseAll(true);\n }\n\n /** Closes all enabled accordion items in an accordion where multi is enabled. */\n closeAll(): void {\n this._openCloseAll(false);\n }\n\n ngOnChanges(changes: SimpleChanges) {\n this._stateChanges.next(changes);\n }\n\n ngOnDestroy() {\n this._stateChanges.complete();\n }\n\n private _openCloseAll(expanded: boolean): void {\n if (this.multi) {\n this._openCloseAllActions.next(expanded);\n }\n }\n}\n"],"names":["nextId"],"mappings":";;;;;;;;;;;;;;;;;;;AEaA,qBAAI,MAAM,GAAG,CAAC,CAAC;;;;AASf,AAAA,MAAA,YAAA,CAAA;;;;;QAEA,IAAA,CAAA,aAAA,GAA2B,IAAI,OAAO,EAAiB,CAAvD;;;;QAGA,IAAA,CAAA,oBAAA,GAAoD,IAAI,OAAO,EAAW,CAA1E;;;;QAGA,IAAA,CAAA,EAAA,GAAgB,CAAhB,cAAA,EAAiC,MAAM,EAAE,CAAzC,CAA2C,CAA3C;QAMA,IAAA,CAAA,MAAA,GAA4B,KAAK,CAAjC;;;;;;IAFA,IAAM,KAAK,GAAX,EAAyB,OAAO,IAAI,CAAC,MAAM,CAAC,EAA5C;;;;;IACE,IAAI,KAAK,CAAC,KAAc,EAA1B,EAA8B,IAAI,CAAC,MAAM,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC,EAAE;;;;;IAIzE,OAAO,GAAT;QACI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KAC1B;;;;;IAGD,QAAQ,GAAV;QACI,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;KAC3B;;;;;IAED,WAAW,CAAC,OAAsB,EAApC;QACI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KAClC;;;;IAED,WAAW,GAAb;QACI,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;KAC/B;;;;;IAEO,aAAa,CAAC,QAAiB,EAAzC;QACI,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC1C;;;;IAzCL,EAAA,IAAA,EAAC,SAAS,EAAV,IAAA,EAAA,CAAW;gBACT,QAAQ,EAAE,+BAA+B;gBACzC,QAAQ,EAAE,cAAc;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AjC;;;IAyBA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAG,MAAM,EAAT,EAAA;IAEA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAG,MAAM,EAAT,EAAA;IAEA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAG,MAAM,EAAT,EAAA;IAOA,gBAAA,EAAA,CAAA,EAAA,IAAA,EAAG,MAAM,EAAT,EAAA;IAMA,UAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,EAAA;IA8BA,UAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,EAAA;;;;;;;ADzEA,MAAA,kBAAA,CAAA;;;IAJA,EAAA,IAAA,EAAC,QAAQ,EAAT,IAAA,EAAA,CAAU;gBACR,OAAO,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC;gBACzC,YAAY,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC;aAC/C,EAAD,EAAA;;;;;;;;;;;;;;;"}
|
package/esm2015/cdk.js
CHANGED
|
@@ -14,7 +14,7 @@ import { Version } from '@angular/core';
|
|
|
14
14
|
/**
|
|
15
15
|
* Current version of the Angular Component Development Kit.
|
|
16
16
|
*/
|
|
17
|
-
const /** @type {?} */ VERSION = new Version('6.4.
|
|
17
|
+
const /** @type {?} */ VERSION = new Version('6.4.7');
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @fileoverview added by tsickle
|
package/esm2015/cdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk.js","sources":["../../src/cdk/version.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 {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('6.4.
|
|
1
|
+
{"version":3,"file":"cdk.js","sources":["../../src/cdk/version.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 {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('6.4.7');\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAWA,AAAA,MAAA,iBAAa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC;;;;;;;;;;;;;;"}
|
package/esm2015/collections.js
CHANGED
|
@@ -80,7 +80,13 @@ class SelectionModel {
|
|
|
80
80
|
/**
|
|
81
81
|
* Event emitted when the value has changed.
|
|
82
82
|
*/
|
|
83
|
-
this.
|
|
83
|
+
this.changed = this._emitChanges ? new Subject() : null;
|
|
84
|
+
/**
|
|
85
|
+
* Event emitted when the value has changed.
|
|
86
|
+
* @deprecated Use `changed` instead.
|
|
87
|
+
* \@breaking-change 8.0.0 To be changed to `changed`
|
|
88
|
+
*/
|
|
89
|
+
this.onChange = this.changed;
|
|
84
90
|
if (initiallySelectedValues && initiallySelectedValues.length) {
|
|
85
91
|
if (_multiple) {
|
|
86
92
|
initiallySelectedValues.forEach(value => this._markSelected(value));
|
|
@@ -185,8 +191,8 @@ class SelectionModel {
|
|
|
185
191
|
// Clear the selected values so they can be re-cached.
|
|
186
192
|
this._selected = null;
|
|
187
193
|
if (this._selectedToEmit.length || this._deselectedToEmit.length) {
|
|
188
|
-
if (this.
|
|
189
|
-
this.
|
|
194
|
+
if (this.changed) {
|
|
195
|
+
this.changed.next({
|
|
190
196
|
source: this,
|
|
191
197
|
added: this._selectedToEmit,
|
|
192
198
|
removed: this._deselectedToEmit
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","sources":["../../../src/cdk/collections/unique-selection-dispatcher.ts","../../../src/cdk/collections/selection.ts","../../../src/cdk/collections/array-data-source.ts","../../../src/cdk/collections/data-source.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 {Injectable, OnDestroy} from '@angular/core';\n\n\n// Users of the Dispatcher never need to see this type, but TypeScript requires it to be exported.\nexport type UniqueSelectionDispatcherListener = (id: string, name: string) => void;\n\n/**\n * Class to coordinate unique selection based on name.\n * Intended to be consumed as an Angular service.\n * This service is needed because native radio change events are only fired on the item currently\n * being selected, and we still need to uncheck the previous selection.\n *\n * This service does not *store* any IDs and names because they may change at any time, so it is\n * less error-prone if they are simply passed through when the events occur.\n */\n@Injectable({providedIn: 'root'})\nexport class UniqueSelectionDispatcher implements OnDestroy {\n private _listeners: UniqueSelectionDispatcherListener[] = [];\n\n /**\n * Notify other items that selection for the given name has been set.\n * @param id ID of the item.\n * @param name Name of the item.\n */\n notify(id: string, name: string) {\n for (let listener of this._listeners) {\n listener(id, name);\n }\n }\n\n /**\n * Listen for future changes to item selection.\n * @return Function used to deregister listener\n */\n listen(listener: UniqueSelectionDispatcherListener): () => void {\n this._listeners.push(listener);\n return () => {\n this._listeners = this._listeners.filter((registered: UniqueSelectionDispatcherListener) => {\n return listener !== registered;\n });\n };\n }\n\n ngOnDestroy() {\n this._listeners = [];\n }\n}\n","/**\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 {Subject} from 'rxjs';\n\n/**\n * Class to be used to power selecting one or more options from a list.\n */\nexport class SelectionModel<T> {\n /** Currently-selected values. */\n private _selection = new Set<T>();\n\n /** Keeps track of the deselected options that haven't been emitted by the change event. */\n private _deselectedToEmit: T[] = [];\n\n /** Keeps track of the selected options that haven't been emitted by the change event. */\n private _selectedToEmit: T[] = [];\n\n /** Cache for the array value of the selected items. */\n private _selected: T[] | null;\n\n /** Selected values. */\n get selected(): T[] {\n if (!this._selected) {\n this._selected = Array.from(this._selection.values());\n }\n\n return this._selected;\n }\n\n /** Event emitted when the value has changed. */\n onChange: Subject<SelectionChange<T>> | null = this._emitChanges ? new Subject() : null;\n\n constructor(\n private _multiple = false,\n initiallySelectedValues?: T[],\n private _emitChanges = true) {\n\n if (initiallySelectedValues && initiallySelectedValues.length) {\n if (_multiple) {\n initiallySelectedValues.forEach(value => this._markSelected(value));\n } else {\n this._markSelected(initiallySelectedValues[0]);\n }\n\n // Clear the array in order to avoid firing the change event for preselected values.\n this._selectedToEmit.length = 0;\n }\n }\n\n /**\n * Selects a value or an array of values.\n */\n select(...values: T[]): void {\n this._verifyValueAssignment(values);\n values.forEach(value => this._markSelected(value));\n this._emitChangeEvent();\n }\n\n /**\n * Deselects a value or an array of values.\n */\n deselect(...values: T[]): void {\n this._verifyValueAssignment(values);\n values.forEach(value => this._unmarkSelected(value));\n this._emitChangeEvent();\n }\n\n /**\n * Toggles a value between selected and deselected.\n */\n toggle(value: T): void {\n this.isSelected(value) ? this.deselect(value) : this.select(value);\n }\n\n /**\n * Clears all of the selected values.\n */\n clear(): void {\n this._unmarkAll();\n this._emitChangeEvent();\n }\n\n /**\n * Determines whether a value is selected.\n */\n isSelected(value: T): boolean {\n return this._selection.has(value);\n }\n\n /**\n * Determines whether the model does not have a value.\n */\n isEmpty(): boolean {\n return this._selection.size === 0;\n }\n\n /**\n * Determines whether the model has a value.\n */\n hasValue(): boolean {\n return !this.isEmpty();\n }\n\n /**\n * Sorts the selected values based on a predicate function.\n */\n sort(predicate?: (a: T, b: T) => number): void {\n if (this._multiple && this.selected) {\n this._selected!.sort(predicate);\n }\n }\n\n /**\n * Gets whether multiple values can be selected.\n */\n isMultipleSelection() {\n return this._multiple;\n }\n\n /** Emits a change event and clears the records of selected and deselected values. */\n private _emitChangeEvent() {\n // Clear the selected values so they can be re-cached.\n this._selected = null;\n\n if (this._selectedToEmit.length || this._deselectedToEmit.length) {\n if (this.onChange) {\n this.onChange.next({\n source: this,\n added: this._selectedToEmit,\n removed: this._deselectedToEmit\n });\n }\n\n this._deselectedToEmit = [];\n this._selectedToEmit = [];\n }\n }\n\n /** Selects a value. */\n private _markSelected(value: T) {\n if (!this.isSelected(value)) {\n if (!this._multiple) {\n this._unmarkAll();\n }\n\n this._selection.add(value);\n\n if (this._emitChanges) {\n this._selectedToEmit.push(value);\n }\n }\n }\n\n /** Deselects a value. */\n private _unmarkSelected(value: T) {\n if (this.isSelected(value)) {\n this._selection.delete(value);\n\n if (this._emitChanges) {\n this._deselectedToEmit.push(value);\n }\n }\n }\n\n /** Clears out the selected values. */\n private _unmarkAll() {\n if (!this.isEmpty()) {\n this._selection.forEach(value => this._unmarkSelected(value));\n }\n }\n\n /**\n * Verifies the value assignment and throws an error if the specified value array is\n * including multiple values while the selection model is not supporting multiple values.\n */\n private _verifyValueAssignment(values: T[]) {\n if (values.length > 1 && !this._multiple) {\n throw getMultipleValuesInSingleSelectionError();\n }\n }\n}\n\n/**\n * Event emitted when the value of a MatSelectionModel has changed.\n * @docs-private\n */\nexport interface SelectionChange<T> {\n /** Model that dispatched the event. */\n source: SelectionModel<T>;\n /** Options that were added to the model. */\n added: T[];\n /** Options that were removed from the model. */\n removed: T[];\n}\n\n/**\n * Returns an error that reports that multiple values are passed into a selection model\n * with a single value.\n */\nexport function getMultipleValuesInSingleSelectionError() {\n return Error('Cannot pass multiple values into SelectionModel with single-value mode.');\n}\n","/**\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 {Observable, of as observableOf} from 'rxjs';\nimport {DataSource} from './data-source';\n\n\n/** DataSource wrapper for a native array. */\nexport class ArrayDataSource<T> extends DataSource<T> {\n constructor(private _data: T[] | Observable<T[]>) {\n super();\n }\n\n connect(): Observable<T[]> {\n return this._data instanceof Observable ? this._data : observableOf(this._data);\n }\n\n disconnect() {}\n}\n","/**\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 {Observable} from 'rxjs';\nimport {CollectionViewer} from './collection-viewer';\n\nexport abstract class DataSource<T> {\n /**\n * Connects a collection viewer (such as a data-table) to this data source. Note that\n * the stream provided will be accessed during change detection and should not directly change\n * values that are bound in template views.\n * @param collectionViewer The component that exposes a view over the data provided by this\n * data source.\n * @returns Observable that emits a new value when the data changes.\n */\n abstract connect(collectionViewer: CollectionViewer): Observable<T[]>;\n\n /**\n * Disconnects a collection viewer (such as a data-table) from this data source. Can be used\n * to perform any clean-up or tear-down operations when a view is being destroyed.\n *\n * @param collectionViewer The component that exposes a view over the data provided by this\n * data source.\n */\n abstract disconnect(collectionViewer: CollectionViewer): void;\n}\n"],"names":["observableOf"],"mappings":";;;;;;;;;;;;;;;;;;;AGWA,AAAA,MAAA,UAAA,CAAA;CAmBC;;;;;;;;;;ADjBD,AAAA,MAAA,eAAgC,SAAQ,UAAa,CAArD;;;;IACE,WAAF,CAAsB,KAA4B,EAAlD;QACI,KAAK,EAAE,CAAC;QADU,IAAtB,CAAA,KAA2B,GAAL,KAAK,CAAuB;KAE/C;;;;IAED,OAAO,GAAT;QACI,OAAO,IAAI,CAAC,KAAK,YAAY,UAAU,GAAG,IAAI,CAAC,KAAK,GAAGA,EAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACjF;;;;IAED,UAAU,GAAZ,GAAiB;CAChB;;;;;;;;;;ADVD,AAAA,MAAA,cAAA,CAAA;;;;;;IAyBE,WAAF,CACY,SADZ,GACwB,KAAK,EACzB,uBAA6B,EACrB,YAHZ,GAG2B,IAAI,EAH/B;QACY,IAAZ,CAAA,SAAqB,GAAT,SAAS,CAArB;QAEY,IAAZ,CAAA,YAAwB,GAAZ,YAAY,CAAxB;;;;QA1BA,IAAA,CAAA,UAAA,GAAuB,IAAI,GAAG,EAAK,CAAnC;;;;QAGA,IAAA,CAAA,iBAAA,GAAmC,EAAE,CAArC;;;;QAGA,IAAA,CAAA,eAAA,GAAiC,EAAE,CAAnC;;;;QAeA,IAAA,CAAA,QAAA,GAAiD,IAAI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,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/B,OAAO,MAAX;YACM,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,UAA6C,KAA7F;gBACQ,OAAO,QAAQ,KAAK,UAAU,CAAC;aAChC,CAAC,CAAC;SACJ,CAAC;KACH;;;;IAED,WAAW,GAAb;QACI,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;KACtB;;;IA9BH,EAAA,IAAA,EAAC,UAAU,EAAX,IAAA,EAAA,CAAY,EAAC,UAAU,EAAE,MAAM,EAAC,EAAhC,EAAA;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"collections.js","sources":["../../../src/cdk/collections/unique-selection-dispatcher.ts","../../../src/cdk/collections/selection.ts","../../../src/cdk/collections/array-data-source.ts","../../../src/cdk/collections/data-source.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 {Injectable, OnDestroy} from '@angular/core';\n\n\n// Users of the Dispatcher never need to see this type, but TypeScript requires it to be exported.\nexport type UniqueSelectionDispatcherListener = (id: string, name: string) => void;\n\n/**\n * Class to coordinate unique selection based on name.\n * Intended to be consumed as an Angular service.\n * This service is needed because native radio change events are only fired on the item currently\n * being selected, and we still need to uncheck the previous selection.\n *\n * This service does not *store* any IDs and names because they may change at any time, so it is\n * less error-prone if they are simply passed through when the events occur.\n */\n@Injectable({providedIn: 'root'})\nexport class UniqueSelectionDispatcher implements OnDestroy {\n private _listeners: UniqueSelectionDispatcherListener[] = [];\n\n /**\n * Notify other items that selection for the given name has been set.\n * @param id ID of the item.\n * @param name Name of the item.\n */\n notify(id: string, name: string) {\n for (let listener of this._listeners) {\n listener(id, name);\n }\n }\n\n /**\n * Listen for future changes to item selection.\n * @return Function used to deregister listener\n */\n listen(listener: UniqueSelectionDispatcherListener): () => void {\n this._listeners.push(listener);\n return () => {\n this._listeners = this._listeners.filter((registered: UniqueSelectionDispatcherListener) => {\n return listener !== registered;\n });\n };\n }\n\n ngOnDestroy() {\n this._listeners = [];\n }\n}\n","/**\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 {Subject} from 'rxjs';\n\n/**\n * Class to be used to power selecting one or more options from a list.\n */\nexport class SelectionModel<T> {\n /** Currently-selected values. */\n private _selection = new Set<T>();\n\n /** Keeps track of the deselected options that haven't been emitted by the change event. */\n private _deselectedToEmit: T[] = [];\n\n /** Keeps track of the selected options that haven't been emitted by the change event. */\n private _selectedToEmit: T[] = [];\n\n /** Cache for the array value of the selected items. */\n private _selected: T[] | null;\n\n /** Selected values. */\n get selected(): T[] {\n if (!this._selected) {\n this._selected = Array.from(this._selection.values());\n }\n\n return this._selected;\n }\n\n /** Event emitted when the value has changed. */\n changed: Subject<SelectionChange<T>> | null = this._emitChanges ? new Subject() : null;\n\n /**\n * Event emitted when the value has changed.\n * @deprecated Use `changed` instead.\n * @breaking-change 8.0.0 To be changed to `changed`\n */\n onChange: Subject<SelectionChange<T>> | null = this.changed;\n\n constructor(\n private _multiple = false,\n initiallySelectedValues?: T[],\n private _emitChanges = true) {\n\n if (initiallySelectedValues && initiallySelectedValues.length) {\n if (_multiple) {\n initiallySelectedValues.forEach(value => this._markSelected(value));\n } else {\n this._markSelected(initiallySelectedValues[0]);\n }\n\n // Clear the array in order to avoid firing the change event for preselected values.\n this._selectedToEmit.length = 0;\n }\n }\n\n /**\n * Selects a value or an array of values.\n */\n select(...values: T[]): void {\n this._verifyValueAssignment(values);\n values.forEach(value => this._markSelected(value));\n this._emitChangeEvent();\n }\n\n /**\n * Deselects a value or an array of values.\n */\n deselect(...values: T[]): void {\n this._verifyValueAssignment(values);\n values.forEach(value => this._unmarkSelected(value));\n this._emitChangeEvent();\n }\n\n /**\n * Toggles a value between selected and deselected.\n */\n toggle(value: T): void {\n this.isSelected(value) ? this.deselect(value) : this.select(value);\n }\n\n /**\n * Clears all of the selected values.\n */\n clear(): void {\n this._unmarkAll();\n this._emitChangeEvent();\n }\n\n /**\n * Determines whether a value is selected.\n */\n isSelected(value: T): boolean {\n return this._selection.has(value);\n }\n\n /**\n * Determines whether the model does not have a value.\n */\n isEmpty(): boolean {\n return this._selection.size === 0;\n }\n\n /**\n * Determines whether the model has a value.\n */\n hasValue(): boolean {\n return !this.isEmpty();\n }\n\n /**\n * Sorts the selected values based on a predicate function.\n */\n sort(predicate?: (a: T, b: T) => number): void {\n if (this._multiple && this.selected) {\n this._selected!.sort(predicate);\n }\n }\n\n /**\n * Gets whether multiple values can be selected.\n */\n isMultipleSelection() {\n return this._multiple;\n }\n\n /** Emits a change event and clears the records of selected and deselected values. */\n private _emitChangeEvent() {\n // Clear the selected values so they can be re-cached.\n this._selected = null;\n\n if (this._selectedToEmit.length || this._deselectedToEmit.length) {\n if (this.changed) {\n this.changed.next({\n source: this,\n added: this._selectedToEmit,\n removed: this._deselectedToEmit\n });\n }\n\n this._deselectedToEmit = [];\n this._selectedToEmit = [];\n }\n }\n\n /** Selects a value. */\n private _markSelected(value: T) {\n if (!this.isSelected(value)) {\n if (!this._multiple) {\n this._unmarkAll();\n }\n\n this._selection.add(value);\n\n if (this._emitChanges) {\n this._selectedToEmit.push(value);\n }\n }\n }\n\n /** Deselects a value. */\n private _unmarkSelected(value: T) {\n if (this.isSelected(value)) {\n this._selection.delete(value);\n\n if (this._emitChanges) {\n this._deselectedToEmit.push(value);\n }\n }\n }\n\n /** Clears out the selected values. */\n private _unmarkAll() {\n if (!this.isEmpty()) {\n this._selection.forEach(value => this._unmarkSelected(value));\n }\n }\n\n /**\n * Verifies the value assignment and throws an error if the specified value array is\n * including multiple values while the selection model is not supporting multiple values.\n */\n private _verifyValueAssignment(values: T[]) {\n if (values.length > 1 && !this._multiple) {\n throw getMultipleValuesInSingleSelectionError();\n }\n }\n}\n\n/**\n * Event emitted when the value of a MatSelectionModel has changed.\n * @docs-private\n */\nexport interface SelectionChange<T> {\n /** Model that dispatched the event. */\n source: SelectionModel<T>;\n /** Options that were added to the model. */\n added: T[];\n /** Options that were removed from the model. */\n removed: T[];\n}\n\n/**\n * Returns an error that reports that multiple values are passed into a selection model\n * with a single value.\n */\nexport function getMultipleValuesInSingleSelectionError() {\n return Error('Cannot pass multiple values into SelectionModel with single-value mode.');\n}\n","/**\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 {Observable, of as observableOf} from 'rxjs';\nimport {DataSource} from './data-source';\n\n\n/** DataSource wrapper for a native array. */\nexport class ArrayDataSource<T> extends DataSource<T> {\n constructor(private _data: T[] | Observable<T[]>) {\n super();\n }\n\n connect(): Observable<T[]> {\n return this._data instanceof Observable ? this._data : observableOf(this._data);\n }\n\n disconnect() {}\n}\n","/**\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 {Observable} from 'rxjs';\nimport {CollectionViewer} from './collection-viewer';\n\nexport abstract class DataSource<T> {\n /**\n * Connects a collection viewer (such as a data-table) to this data source. Note that\n * the stream provided will be accessed during change detection and should not directly change\n * values that are bound in template views.\n * @param collectionViewer The component that exposes a view over the data provided by this\n * data source.\n * @returns Observable that emits a new value when the data changes.\n */\n abstract connect(collectionViewer: CollectionViewer): Observable<T[]>;\n\n /**\n * Disconnects a collection viewer (such as a data-table) from this data source. Can be used\n * to perform any clean-up or tear-down operations when a view is being destroyed.\n *\n * @param collectionViewer The component that exposes a view over the data provided by this\n * data source.\n */\n abstract disconnect(collectionViewer: CollectionViewer): void;\n}\n"],"names":["observableOf"],"mappings":";;;;;;;;;;;;;;;;;;;AGWA,AAAA,MAAA,UAAA,CAAA;CAmBC;;;;;;;;;;ADjBD,AAAA,MAAA,eAAgC,SAAQ,UAAa,CAArD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
52
|
this._observedElements.forEach((_, element) => this._cleanupObserver(element));
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
* @param {?} element The element to observe for content changes.
|
|
55
|
+
* @param {?} elementOrRef
|
|
57
56
|
* @return {?}
|
|
58
57
|
*/
|
|
59
|
-
observe(
|
|
58
|
+
observe(elementOrRef) {
|
|
59
|
+
const /** @type {?} */ element = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;
|
|
60
60
|
return Observable.create(observer => {
|
|
61
61
|
const /** @type {?} */ stream = this._observeElement(element);
|
|
62
62
|
const /** @type {?} */ subscription = stream.subscribe(observer);
|
|
@@ -200,7 +200,7 @@ class CdkObserveContent {
|
|
|
200
200
|
*/
|
|
201
201
|
_subscribe() {
|
|
202
202
|
this._unsubscribe();
|
|
203
|
-
const /** @type {?} */ stream = this._contentObserver.observe(this._elementRef
|
|
203
|
+
const /** @type {?} */ stream = this._contentObserver.observe(this._elementRef);
|
|
204
204
|
// TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.
|
|
205
205
|
// Consider brining it back inside the zone next time we're making breaking changes.
|
|
206
206
|
// Bringing it back inside can cause things like infinite change detection loops and changed
|
package/esm2015/observers.js.map
CHANGED
|
@@ -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} 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} 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 return Observable.create(observer => {\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 if (this._disabled) {\n this._unsubscribe();\n } else {\n this._subscribe();\n }\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, private _elementRef: ElementRef,\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.nativeElement);\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,uB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CAAU;gBACR,OAAO,EAAE,CAAC,iBAAiB,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} 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} 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 => {\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 if (this._disabled) {\n this._unsubscribe();\n } else {\n this._subscribe();\n }\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,uBAAA,CAAA;;;;;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,eAAA,CAAA;;;;IAQE,WAAF,CAAsB,wBAAiD,EAAvE;QAAsB,IAAtB,CAAA,wBAA8C,GAAxB,wBAAwB,CAAyB;;;;QANvE,IAAA,CAAA,iBAAA,GAA8B,IAAI,GAAG,EAI/B,CAJN;KAM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