@angular/cdk 5.2.1 → 5.2.5
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/_overlay.scss +6 -0
- package/a11y/typings/aria-describer/aria-describer.d.ts +2 -0
- package/a11y/typings/index.metadata.json +1 -1
- package/a11y/typings/key-manager/list-key-manager.d.ts +11 -0
- package/bundles/cdk-a11y.umd.js +65 -13
- 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-collections.umd.js +7 -11
- 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-overlay.umd.js +24 -5
- 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-platform.umd.js +3 -3
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +1 -1
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +17 -4
- 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 +3 -1
- 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.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 +3 -10
- package/esm2015/a11y.js +48 -13
- package/esm2015/a11y.js.map +1 -1
- package/esm2015/cdk.js +1 -1
- package/esm2015/cdk.js.map +1 -1
- package/esm2015/collections.js +8 -15
- package/esm2015/collections.js.map +1 -1
- package/esm2015/overlay.js +20 -5
- package/esm2015/overlay.js.map +1 -1
- package/esm2015/platform.js +3 -3
- package/esm2015/platform.js.map +1 -1
- package/esm2015/scrolling.js +18 -5
- package/esm2015/scrolling.js.map +1 -1
- package/esm2015/stepper.js +3 -1
- package/esm2015/stepper.js.map +1 -1
- package/esm5/a11y.es5.js +65 -13
- 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/collections.es5.js +8 -11
- package/esm5/collections.es5.js.map +1 -1
- package/esm5/overlay.es5.js +24 -5
- package/esm5/overlay.es5.js.map +1 -1
- package/esm5/platform.es5.js +3 -3
- package/esm5/platform.es5.js.map +1 -1
- package/esm5/scrolling.es5.js +17 -4
- package/esm5/scrolling.es5.js.map +1 -1
- package/esm5/stepper.es5.js +3 -1
- package/esm5/stepper.es5.js.map +1 -1
- package/overlay/typings/index.metadata.json +1 -1
- package/overlay/typings/overlay-directives.d.ts +4 -1
- package/overlay/typings/overlay.d.ts +1 -1
- package/overlay/typings/position/connected-position-strategy.d.ts +0 -2
- package/overlay-prebuilt.css +1 -1
- package/package.json +3 -3
- package/scrolling/typings/index.metadata.json +1 -1
- package/scrolling/typings/viewport-ruler.d.ts +2 -1
- package/typings/a11y/aria-describer/aria-describer.d.ts +2 -0
- package/typings/a11y/index.metadata.json +1 -1
- package/typings/a11y/key-manager/list-key-manager.d.ts +11 -0
- package/typings/collections/index.metadata.json +1 -1
- package/typings/collections/selection.d.ts +3 -10
- package/typings/esm5/a11y/aria-describer/aria-describer.d.ts +2 -0
- package/typings/esm5/a11y/index.metadata.json +1 -1
- package/typings/esm5/a11y/key-manager/list-key-manager.d.ts +11 -0
- package/typings/esm5/collections/index.metadata.json +1 -1
- package/typings/esm5/collections/selection.d.ts +3 -10
- 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 +4 -1
- package/typings/esm5/overlay/overlay.d.ts +1 -1
- package/typings/esm5/overlay/position/connected-position-strategy.d.ts +0 -2
- package/typings/esm5/scrolling/index.metadata.json +1 -1
- package/typings/esm5/scrolling/viewport-ruler.d.ts +2 -1
- package/typings/index.metadata.json +1 -1
- package/typings/overlay/index.metadata.json +1 -1
- package/typings/overlay/overlay-directives.d.ts +4 -1
- package/typings/overlay/overlay.d.ts +1 -1
- package/typings/overlay/position/connected-position-strategy.d.ts +0 -2
- package/typings/scrolling/index.metadata.json +1 -1
- package/typings/scrolling/viewport-ruler.d.ts +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk-collections.umd.js","sources":["../../src/cdk/collections/unique-selection-dispatcher.ts","../../src/cdk/collections/selection.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, Optional, SkipSelf, 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()\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/** @docs-private */\nexport function UNIQUE_SELECTION_DISPATCHER_PROVIDER_FACTORY(\n parentDispatcher: UniqueSelectionDispatcher) {\n return parentDispatcher || new UniqueSelectionDispatcher();\n}\n\n/** @docs-private */\nexport const UNIQUE_SELECTION_DISPATCHER_PROVIDER = {\n // If there is already a dispatcher available, use that. Otherwise, provide a new one.\n provide: UniqueSelectionDispatcher,\n deps: [[new Optional(), new SkipSelf(), UniqueSelectionDispatcher]],\n useFactory: UNIQUE_SELECTION_DISPATCHER_PROVIDER_FACTORY\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/Subject';\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: Set<T> = new Set();\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 /** 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 const eventData = new SelectionChange<T>(this, this._selectedToEmit, this._deselectedToEmit);\n\n if (this.onChange) {\n this.onChange.next(eventData);\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 class SelectionChange<T> {\n constructor(\n /** Model that dispatched the event. */\n public source: SelectionModel<T>,\n /** Options that were added to the model. */\n public added?: T[],\n /** Options that were removed from the model. */\n public 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} from 'rxjs/Observable';\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":["Optional","SkipSelf","Injectable","Subject"],"mappings":";;;;;;;;;;;;;;;;;;;;;AEWA,IAAA,UAAA,kBAAA,YAAA;;;IAXA,OAAA,UAAA,CAAA;CA8BA,EAAA,CAAC,CAAA;;;;;;;;;;ADjBD,IAAA,cAAA,kBAAA,YAAA;IAyBE,SAAF,cAAA,C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AyDA,SAAA,4CAAA,CACI,gBAA2C,EAD/C;IAEE,OAAO,gBAAgB,IAAI,IAAI,yBAAyB,EAAE,CAAC;CAC5D;;;;AAGD,IAAa,oCAAoC,GAAG;;IAElD,OAAO,EAAE,yBAAyB;IAClC,IAAI,EAAE,CAAC,CAAC,IAAIF,sBAAQ,EAAE,EAAE,IAAIC,sBAAQ,EAAE,EAAE,yBAAyB,CAAC,CAAC;IACnE,UAAU,EAAE,4CAA4C;CACzD,CAAC;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"cdk-collections.umd.js","sources":["../../src/cdk/collections/unique-selection-dispatcher.ts","../../src/cdk/collections/selection.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, Optional, SkipSelf, 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()\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/** @docs-private */\nexport function UNIQUE_SELECTION_DISPATCHER_PROVIDER_FACTORY(\n parentDispatcher: UniqueSelectionDispatcher) {\n return parentDispatcher || new UniqueSelectionDispatcher();\n}\n\n/** @docs-private */\nexport const UNIQUE_SELECTION_DISPATCHER_PROVIDER = {\n // If there is already a dispatcher available, use that. Otherwise, provide a new one.\n provide: UniqueSelectionDispatcher,\n deps: [[new Optional(), new SkipSelf(), UniqueSelectionDispatcher]],\n useFactory: UNIQUE_SELECTION_DISPATCHER_PROVIDER_FACTORY\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/Subject';\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: Set<T> = new Set();\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 /** 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} from 'rxjs/Observable';\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":["Optional","SkipSelf","Injectable","Subject"],"mappings":";;;;;;;;;;;;;;;;;;;;;AEWA,IAAA,UAAA,kBAAA,YAAA;;;IAXA,OAAA,UAAA,CAAA;CA8BA,EAAA,CAAC,CAAA;;;;;;;;;;ADjBD,IAAA,cAAA,kBAAA,YAAA;IAyBE,SAAF,cAAA,CACY,SADZ,EAEI,uBAA6B,EACrB,YAHZ,EAAA;;;QAAE,IAAF,KAAA,GAAA,IAAA,CAeG;QAdS,IAAZ,CAAA,SAAqB,GAAT,SAAS,CAArB;QAEY,IAAZ,CAAA,YAAwB,GAAZ,YAAY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,CAAwC,EAAf,EAAzB,GAAyB,IAAI,CAAC,UAAU,EAAf,EAAzB,GAAA,EAAA,CAAA,MAAwC,EAAf,EAAzB,EAAwC,EAAxC;YAAS,IAAI,QAAQ,GAArB,EAAA,CAAA,EAAA,CAAqB,CAArB;YACM,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;SACpB;KACF,CAAH;;;;;;;;;;IAME,yBAAF,CAAA,SAAA,CAAA,MAAQ;;;;;IAAN,UAAO,QAA2C,EAApD;QAAE,IAAF,KAAA,GAAA,IAAA,CAOG;QANC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/B,OAAO,YAAX;YACM,KAAI,CAAC,UAAU,GAAG,KAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAC,UAA6C,EAA7F;gBACQ,OAAO,QAAQ,KAAK,UAAU,CAAC;aAChC,CAAC,CAAC;SACJ,CAAC;KACH,CAAH;;;;IAEE,yBAAF,CAAA,SAAA,CAAA,WAAa;;;IAAX,YAAF;QACI,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;KACtB,CAAH;;QA9BA,EAAA,IAAA,EAACD,wBAAU,EAAX;;;;IAvBA,OAAA,yBAAA,CAAA;;;;;;;AAyDA,SAAA,4CAAA,CACI,gBAA2C,EAD/C;IAEE,OAAO,gBAAgB,IAAI,IAAI,yBAAyB,EAAE,CAAC;CAC5D;;;;AAGD,IAAa,oCAAoC,GAAG;;IAElD,OAAO,EAAE,yBAAyB;IAClC,IAAI,EAAE,CAAC,CAAC,IAAIF,sBAAQ,EAAE,EAAE,IAAIC,sBAAQ,EAAE,EAAE,yBAAyB,CAAC,CAAC;IACnE,UAAU,EAAE,4CAA4C;CACzD,CAAC;;;;;;;;;;;"}
|
|
@@ -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("rxjs/Subject"),require("@angular/core")):"function"==typeof define&&define.amd?define(["exports","rxjs/Subject","@angular/core"],t):t((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.collections=e.ng.cdk.collections||{}),e.Rx,e.ng.core)}(this,function(e,t,n){"use strict";function i(){return Error("Cannot pass multiple values into SelectionModel with single-value mode.")}function s(e){return e||new l}var o=function(){function e(){}return e}(),r=function(){function e(e,n,i){void 0===e&&(e=!1),void 0===i&&(i=!0);var s=this;this._multiple=e,this._emitChanges=i,this._selection=new Set,this._deselectedToEmit=[],this._selectedToEmit=[],this.onChange=this._emitChanges?new t.Subject:null,n&&n.length&&(e?n.forEach(function(e){return s._markSelected(e)}):this._markSelected(n[0]),this._selectedToEmit.length=0)}return Object.defineProperty(e.prototype,"selected",{get:function(){return this._selected||(this._selected=Array.from(this._selection.values())),this._selected},enumerable:!0,configurable:!0}),e.prototype.select=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._verifyValueAssignment(t),t.forEach(function(t){return e._markSelected(t)}),this._emitChangeEvent()},e.prototype.deselect=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._verifyValueAssignment(t),t.forEach(function(t){return e._unmarkSelected(t)}),this._emitChangeEvent()},e.prototype.toggle=function(e){this.isSelected(e)?this.deselect(e):this.select(e)},e.prototype.clear=function(){this._unmarkAll(),this._emitChangeEvent()},e.prototype.isSelected=function(e){return this._selection.has(e)},e.prototype.isEmpty=function(){return 0===this._selection.size},e.prototype.hasValue=function(){return!this.isEmpty()},e.prototype.sort=function(e){this._multiple&&this._selected&&this._selected.sort(e)},e.prototype._emitChangeEvent=function(){
|
|
8
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("rxjs/Subject"),require("@angular/core")):"function"==typeof define&&define.amd?define(["exports","rxjs/Subject","@angular/core"],t):t((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.collections=e.ng.cdk.collections||{}),e.Rx,e.ng.core)}(this,function(e,t,n){"use strict";function i(){return Error("Cannot pass multiple values into SelectionModel with single-value mode.")}function s(e){return e||new l}var o=function(){function e(){}return e}(),r=function(){function e(e,n,i){void 0===e&&(e=!1),void 0===i&&(i=!0);var s=this;this._multiple=e,this._emitChanges=i,this._selection=new Set,this._deselectedToEmit=[],this._selectedToEmit=[],this.onChange=this._emitChanges?new t.Subject:null,n&&n.length&&(e?n.forEach(function(e){return s._markSelected(e)}):this._markSelected(n[0]),this._selectedToEmit.length=0)}return Object.defineProperty(e.prototype,"selected",{get:function(){return this._selected||(this._selected=Array.from(this._selection.values())),this._selected},enumerable:!0,configurable:!0}),e.prototype.select=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._verifyValueAssignment(t),t.forEach(function(t){return e._markSelected(t)}),this._emitChangeEvent()},e.prototype.deselect=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._verifyValueAssignment(t),t.forEach(function(t){return e._unmarkSelected(t)}),this._emitChangeEvent()},e.prototype.toggle=function(e){this.isSelected(e)?this.deselect(e):this.select(e)},e.prototype.clear=function(){this._unmarkAll(),this._emitChangeEvent()},e.prototype.isSelected=function(e){return this._selection.has(e)},e.prototype.isEmpty=function(){return 0===this._selection.size},e.prototype.hasValue=function(){return!this.isEmpty()},e.prototype.sort=function(e){this._multiple&&this._selected&&this._selected.sort(e)},e.prototype._emitChangeEvent=function(){this._selected=null,(this._selectedToEmit.length||this._deselectedToEmit.length)&&(this.onChange&&this.onChange.next({source:this,added:this._selectedToEmit,removed:this._deselectedToEmit}),this._deselectedToEmit=[],this._selectedToEmit=[])},e.prototype._markSelected=function(e){this.isSelected(e)||(this._multiple||this._unmarkAll(),this._selection.add(e),this._emitChanges&&this._selectedToEmit.push(e))},e.prototype._unmarkSelected=function(e){this.isSelected(e)&&(this._selection.delete(e),this._emitChanges&&this._deselectedToEmit.push(e))},e.prototype._unmarkAll=function(){var e=this;this.isEmpty()||this._selection.forEach(function(t){return e._unmarkSelected(t)})},e.prototype._verifyValueAssignment=function(e){if(e.length>1&&!this._multiple)throw i()},e}(),l=function(){function e(){this._listeners=[]}return e.prototype.notify=function(e,t){for(var n=0,i=this._listeners;n<i.length;n++){(0,i[n])(e,t)}},e.prototype.listen=function(e){var t=this;return this._listeners.push(e),function(){t._listeners=t._listeners.filter(function(t){return e!==t})}},e.prototype.ngOnDestroy=function(){this._listeners=[]},e.decorators=[{type:n.Injectable}],e.ctorParameters=function(){return[]},e}(),c={provide:l,deps:[[new n.Optional,new n.SkipSelf,l]],useFactory:s};e.UniqueSelectionDispatcher=l,e.UNIQUE_SELECTION_DISPATCHER_PROVIDER=c,e.DataSource=o,e.SelectionModel=r,e.getMultipleValuesInSingleSelectionError=i,e.ɵa=s,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
9
9
|
//# sourceMappingURL=cdk-collections.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk-collections.umd.min.js","sources":["../../src/cdk/collections/selection.ts","../../src/cdk/collections/unique-selection-dispatcher.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 {Subject} from 'rxjs/Subject';\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: Set<T> = new Set();\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 /** 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 const eventData = new SelectionChange<T>(this, this._selectedToEmit, this._deselectedToEmit);\n\n if (this.onChange) {\n this.onChange.next(eventData);\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 class SelectionChange<T> {\n constructor(\n /** Model that dispatched the event. */\n public source: SelectionModel<T>,\n /** Options that were added to the model. */\n public added?: T[],\n /** Options that were removed from the model. */\n public 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 {Injectable, Optional, SkipSelf, 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()\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/** @docs-private */\nexport function UNIQUE_SELECTION_DISPATCHER_PROVIDER_FACTORY(\n parentDispatcher: UniqueSelectionDispatcher) {\n return parentDispatcher || new UniqueSelectionDispatcher();\n}\n\n/** @docs-private */\nexport const UNIQUE_SELECTION_DISPATCHER_PROVIDER = {\n // If there is already a dispatcher available, use that. Otherwise, provide a new one.\n provide: UniqueSelectionDispatcher,\n deps: [[new Optional(), new SkipSelf(), UniqueSelectionDispatcher]],\n useFactory: UNIQUE_SELECTION_DISPATCHER_PROVIDER_FACTORY\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/Observable';\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":["getMultipleValuesInSingleSelectionError","Error","UNIQUE_SELECTION_DISPATCHER_PROVIDER_FACTORY","parentDispatcher","UniqueSelectionDispatcher","DataSource","SelectionModel","_multiple","initiallySelectedValues","_emitChanges","_this","this","_selection","Set","_deselectedToEmit","_selectedToEmit","onChange","Subject","length","forEach","value","_markSelected","Object","defineProperty","prototype","_selected","Array","from","values","select","_i","arguments","_verifyValueAssignment","_emitChangeEvent","deselect","_unmarkSelected","toggle","isSelected","clear","_unmarkAll","has","isEmpty","size","hasValue","sort","predicate","eventData","SelectionChange","next","add","push","delete","source","added","removed","_listeners","notify","id","name","_a","listener","listen","filter","registered","ngOnDestroy","type","Injectable","UNIQUE_SELECTION_DISPATCHER_PROVIDER","provide","deps","Optional","SkipSelf","useFactory"],"mappings":";;;;;;;mWAqMA,SAAAA,KACE,MAAOC,OAAM,2EC7If,QAAAC,GACIC,GACF,MAAOA,IAAoB,GAAIC,GChDjC,GAAAC,GAAA,yBAXA,MAAAA,MFaAC,EAAA,WAyBE,QAAFA,GACYC,EACRC,EACQC,wCAHV,IAAFC,GAAAC,IACYA,MAAZJ,UAAYA,EAEAI,KAAZF,aAAYA,EA1BZE,KAAAC,WAA+B,GAAIC,KAGnCF,KAAAG,qBAGAH,KAAAI,mBAeAJ,KAAAK,SAAiDL,KAAKF,aAAe,GAAIQ,GAAAA,QAAY,KAO7ET,GAA2BA,EAAwBU,SACjDX,EACFC,EAAwBW,QAAQ,SAAAC,GAAS,MAAAV,GAAKW,cAAcD,KAE5DT,KAAKU,cAAcb,EAAwB,IAI7CG,KAAKI,gBAAgBG,OAAS,GAnDpC,MA2BEI,QAAFC,eAAMjB,EAANkB,UAAA,gBAAE,WAKE,MAJKb,MAAKc,YACRd,KAAKc,UAAYC,MAAMC,KAAKhB,KAAKC,WAAWgB,WAGvCjB,KAAKc,2CA0BdnB,EAAFkB,UAAAK,OAAE,WAAF,IAAS,GAATnB,GAAAC,KAAAiB,KAAAE,EAAA,EAASA,EAATC,UAAAb,OAASY,IAAAF,EAATE,GAAAC,U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K9B,KAMxBd,EAAVkB,UAAAW,gBAAA,SAA0Bf,GAClBT,KAAK0B,WAAWjB,KAClBT,KAAKC,WAAWuC,OAAO/B,GAEnBT,KAAKF,cACPE,KAAKG,kBAAkBoC,KAAK9B,KAM1Bd,EAAVkB,UAAAe,gCACS5B,MAAK8B,WACR9B,KAAKC,WAAWO,QAAQ,SAAAC,GAAS,MAAAV,GAAKyB,gBAAgBf,MAQlDd,EAAVkB,UAAAQ,uBAAA,SAAiCJ,GAC7B,GAAIA,EAAOV,OAAS,IAAMP,KAAKJ,UAC7B,KAAMP,MA9KZM,KAuLAyC,EAAA,WACE,QAAFA,GAEWK,EAEAC,EAEAC,GAJA3C,KAAXyC,OAAWA,EAEAzC,KAAX0C,MAAWA,EAEA1C,KAAX2C,QAAWA,EA9LX,MAAAP,gCCyBApC,KAAA4C,cAzBA,MAgCEnD,GAAFoB,UAAAgC,OAAE,SAAOC,EAAYC,GACjB,IAAqB,GAAzB5B,GAAA,EAAyB6B,EAAAhD,KAAK4C,WAALzB,EAAzB6B,EAAAzC,OAAyBY,IAAzB,EACM8B,EADND,EAAA7B,IACe2B,EAAIC,KAQjBtD,EAAFoB,UAAAqC,OAAE,SAAOD,GAAP,GAAFlD,GAAAC,IAEI,OADAA,MAAK4C,WAAWL,KAAKU,GACd,WACLlD,EAAK6C,WAAa7C,EAAK6C,WAAWO,OAAO,SAACC,GACxC,MAAOH,KAAaG,MAK1B3D,EAAFoB,UAAAwC,YAAE,WACErD,KAAK4C,8BA7BTU,KAACC,EAAAA,mDAvBD9D,KA+Da+D,GAEXC,QAAShE,EACTiE,OAAQ,GAAIC,GAAAA,SAAY,GAAIC,GAAAA,SAAYnE,IACxCoE,WAAYtE"}
|
|
1
|
+
{"version":3,"file":"cdk-collections.umd.min.js","sources":["../../src/cdk/collections/selection.ts","../../src/cdk/collections/unique-selection-dispatcher.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 {Subject} from 'rxjs/Subject';\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: Set<T> = new Set();\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 /** 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 {Injectable, Optional, SkipSelf, 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()\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/** @docs-private */\nexport function UNIQUE_SELECTION_DISPATCHER_PROVIDER_FACTORY(\n parentDispatcher: UniqueSelectionDispatcher) {\n return parentDispatcher || new UniqueSelectionDispatcher();\n}\n\n/** @docs-private */\nexport const UNIQUE_SELECTION_DISPATCHER_PROVIDER = {\n // If there is already a dispatcher available, use that. Otherwise, provide a new one.\n provide: UniqueSelectionDispatcher,\n deps: [[new Optional(), new SkipSelf(), UniqueSelectionDispatcher]],\n useFactory: UNIQUE_SELECTION_DISPATCHER_PROVIDER_FACTORY\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/Observable';\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":["getMultipleValuesInSingleSelectionError","Error","UNIQUE_SELECTION_DISPATCHER_PROVIDER_FACTORY","parentDispatcher","UniqueSelectionDispatcher","DataSource","SelectionModel","_multiple","initiallySelectedValues","_emitChanges","_this","this","_selection","Set","_deselectedToEmit","_selectedToEmit","onChange","Subject","length","forEach","value","_markSelected","Object","defineProperty","prototype","_selected","Array","from","values","select","_i","arguments","_verifyValueAssignment","_emitChangeEvent","deselect","_unmarkSelected","toggle","isSelected","clear","_unmarkAll","has","isEmpty","size","hasValue","sort","predicate","next","source","added","removed","add","push","delete","_listeners","notify","id","name","_a","listener","listen","filter","registered","ngOnDestroy","type","Injectable","UNIQUE_SELECTION_DISPATCHER_PROVIDER","provide","deps","Optional","SkipSelf","useFactory"],"mappings":";;;;;;;mWAsMA,SAAAA,KACE,MAAOC,OAAM,2EC9If,QAAAC,GACIC,GACF,MAAOA,IAAoB,GAAIC,GChDjC,GAAAC,GAAA,yBAXA,MAAAA,MFaAC,EAAA,WAyBE,QAAFA,GACYC,EACRC,EACQC,wCAHV,IAAFC,GAAAC,IACYA,MAAZJ,UAAYA,EAEAI,KAAZF,aAAYA,EA1BZE,KAAAC,WAA+B,GAAIC,KAGnCF,KAAAG,qBAGAH,KAAAI,mBAeAJ,KAAAK,SAAiDL,KAAKF,aAAe,GAAIQ,GAAAA,QAAY,KAO7ET,GAA2BA,EAAwBU,SACjDX,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AA,SAAY,GAAIC,GAAAA,SAAYjE,IACxCkE,WAAYpE"}
|
|
@@ -1162,7 +1162,6 @@ var ConnectedPositionStrategy = /** @class */ (function () {
|
|
|
1162
1162
|
*/
|
|
1163
1163
|
function (overlayRef) {
|
|
1164
1164
|
var _this = this;
|
|
1165
|
-
this._overlayRef = overlayRef;
|
|
1166
1165
|
this._pane = overlayRef.overlayElement;
|
|
1167
1166
|
this._resizeSubscription.unsubscribe();
|
|
1168
1167
|
this._resizeSubscription = this._viewportRuler.change().subscribe(function () { return _this.apply(); });
|
|
@@ -2287,7 +2286,7 @@ var OVERLAY_CONTAINER_PROVIDER = {
|
|
|
2287
2286
|
var nextUniqueId = 0;
|
|
2288
2287
|
/**
|
|
2289
2288
|
* Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be
|
|
2290
|
-
* used as a low-level building
|
|
2289
|
+
* used as a low-level building block for other components. Dialogs, tooltips, menus,
|
|
2291
2290
|
* selects, etc. can all be built using overlays. The service should primarily be used by authors
|
|
2292
2291
|
* of re-usable components rather than developers building end-user applications.
|
|
2293
2292
|
*
|
|
@@ -2453,6 +2452,7 @@ var CdkConnectedOverlay = /** @class */ (function () {
|
|
|
2453
2452
|
this._scrollStrategy = _scrollStrategy;
|
|
2454
2453
|
this._dir = _dir;
|
|
2455
2454
|
this._hasBackdrop = false;
|
|
2455
|
+
this._lockPosition = false;
|
|
2456
2456
|
this._backdropSubscription = rxjs_Subscription.Subscription.EMPTY;
|
|
2457
2457
|
this._offsetX = 0;
|
|
2458
2458
|
this._offsetY = 0;
|
|
@@ -2534,6 +2534,20 @@ var CdkConnectedOverlay = /** @class */ (function () {
|
|
|
2534
2534
|
enumerable: true,
|
|
2535
2535
|
configurable: true
|
|
2536
2536
|
});
|
|
2537
|
+
Object.defineProperty(CdkConnectedOverlay.prototype, "lockPosition", {
|
|
2538
|
+
get: /**
|
|
2539
|
+
* Whether or not the overlay should be locked when scrolling.
|
|
2540
|
+
* @return {?}
|
|
2541
|
+
*/
|
|
2542
|
+
function () { return this._lockPosition; },
|
|
2543
|
+
set: /**
|
|
2544
|
+
* @param {?} value
|
|
2545
|
+
* @return {?}
|
|
2546
|
+
*/
|
|
2547
|
+
function (value) { this._lockPosition = _angular_cdk_coercion.coerceBooleanProperty(value); },
|
|
2548
|
+
enumerable: true,
|
|
2549
|
+
configurable: true
|
|
2550
|
+
});
|
|
2537
2551
|
Object.defineProperty(CdkConnectedOverlay.prototype, "_deprecatedOrigin", {
|
|
2538
2552
|
get: /**
|
|
2539
2553
|
* @deprecated
|
|
@@ -2762,6 +2776,9 @@ var CdkConnectedOverlay = /** @class */ (function () {
|
|
|
2762
2776
|
if (changes['positions'] || changes['_deprecatedPositions']) {
|
|
2763
2777
|
this._position.withPositions(this.positions);
|
|
2764
2778
|
}
|
|
2779
|
+
if (changes['lockPosition']) {
|
|
2780
|
+
this._position.withLockedPosition(this.lockPosition);
|
|
2781
|
+
}
|
|
2765
2782
|
if (changes['origin'] || changes['_deprecatedOrigin']) {
|
|
2766
2783
|
this._position.setOrigin(this.origin.elementRef);
|
|
2767
2784
|
if (this.open) {
|
|
@@ -2835,7 +2852,8 @@ var CdkConnectedOverlay = /** @class */ (function () {
|
|
|
2835
2852
|
var /** @type {?} */ strategy = this._overlay.position()
|
|
2836
2853
|
.connectedTo(this.origin.elementRef, originPoint, overlayPoint)
|
|
2837
2854
|
.withOffsetX(this.offsetX)
|
|
2838
|
-
.withOffsetY(this.offsetY)
|
|
2855
|
+
.withOffsetY(this.offsetY)
|
|
2856
|
+
.withLockedPosition(this.lockPosition);
|
|
2839
2857
|
for (var /** @type {?} */ i = 1; i < this.positions.length; i++) {
|
|
2840
2858
|
strategy.withFallbackPosition({ originX: this.positions[i].originX, originY: this.positions[i].originY }, { overlayX: this.positions[i].overlayX, overlayY: this.positions[i].overlayY });
|
|
2841
2859
|
}
|
|
@@ -2876,8 +2894,8 @@ var CdkConnectedOverlay = /** @class */ (function () {
|
|
|
2876
2894
|
this.attach.emit();
|
|
2877
2895
|
}
|
|
2878
2896
|
if (this.hasBackdrop) {
|
|
2879
|
-
this._backdropSubscription = this._overlayRef.backdropClick().subscribe(function () {
|
|
2880
|
-
_this.backdropClick.emit();
|
|
2897
|
+
this._backdropSubscription = this._overlayRef.backdropClick().subscribe(function (event) {
|
|
2898
|
+
_this.backdropClick.emit(event);
|
|
2881
2899
|
});
|
|
2882
2900
|
}
|
|
2883
2901
|
};
|
|
@@ -2937,6 +2955,7 @@ var CdkConnectedOverlay = /** @class */ (function () {
|
|
|
2937
2955
|
"scrollStrategy": [{ type: _angular_core.Input, args: ['cdkConnectedOverlayScrollStrategy',] },],
|
|
2938
2956
|
"open": [{ type: _angular_core.Input, args: ['cdkConnectedOverlayOpen',] },],
|
|
2939
2957
|
"hasBackdrop": [{ type: _angular_core.Input, args: ['cdkConnectedOverlayHasBackdrop',] },],
|
|
2958
|
+
"lockPosition": [{ type: _angular_core.Input, args: ['cdkConnectedOverlayLockPosition',] },],
|
|
2940
2959
|
"_deprecatedOrigin": [{ type: _angular_core.Input, args: ['origin',] },],
|
|
2941
2960
|
"_deprecatedPositions": [{ type: _angular_core.Input, args: ['positions',] },],
|
|
2942
2961
|
"_deprecatedOffsetX": [{ type: _angular_core.Input, args: ['offsetX',] },],
|