{"version":3,"file":"cdk-collections.umd.js","sources":["cdk/collections.es5.js"],"sourcesContent":["/**\n * @license\n * Copyright Google Inc. 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 */\nimport { Subject } from 'rxjs/Subject';\nimport { Injectable, Optional, SkipSelf } from '@angular/core';\n\n/**\n * @abstract\n */\nvar DataSource = (function () {\n function DataSource() {\n }\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 * @abstract\n * @param {?} collectionViewer The component that exposes a view over the data provided by this\n * data source.\n * @return {?} Observable that emits a new value when the data changes.\n */\n DataSource.prototype.connect = function (collectionViewer) { };\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 * @abstract\n * @param {?} collectionViewer The component that exposes a view over the data provided by this\n * data source.\n * @return {?}\n */\n DataSource.prototype.disconnect = function (collectionViewer) { };\n return DataSource;\n}());\n\n/**\n * Class to be used to power selecting one or more options from a list.\n */\nvar SelectionModel = (function () {\n /**\n * @param {?=} _isMulti\n * @param {?=} initiallySelectedValues\n * @param {?=} _emitChanges\n */\n function SelectionModel(_isMulti, initiallySelectedValues, _emitChanges) {\n if (_isMulti === void 0) { _isMulti = false; }\n if (_emitChanges === void 0) { _emitChanges = true; }\n var _this = this;\n this._isMulti = _isMulti;\n this._emitChanges = _emitChanges;\n /**\n * Currently-selected values.\n */\n this._selection = new Set();\n /**\n * Keeps track of the deselected options that haven't been emitted by the change event.\n */\n this._deselectedToEmit = [];\n /**\n * Keeps track of the selected option that haven't been emitted by the change event.\n */\n this._selectedToEmit = [];\n /**\n * Event emitted when the value has changed.\n */\n this.onChange = this._emitChanges ? new Subject() : null;\n if (initiallySelectedValues) {\n if (_isMulti) {\n initiallySelectedValues.forEach(function (value) { return _this._markSelected(value); });\n }\n else {\n this._markSelected(initiallySelectedValues[0]);\n }\n // Clear the array in order to avoid firing the change event for preselected values.\n this._selectedToEmit.length = 0;\n }\n }\n Object.defineProperty(SelectionModel.prototype, \"selected\", {\n /**\n * Selected value(s).\n * @return {?}\n */\n get: function () {\n if (!this._selected) {\n this._selected = Array.from(this._selection.values());\n }\n return this._selected;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Selects a value or an array of values.\n * @param {...?} values\n * @return {?}\n */\n SelectionModel.prototype.select = function () {\n var _this = this;\n var values = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n values[_i] = arguments[_i];\n }\n this._verifyValueAssignment(values);\n values.forEach(function (value) { return _this._markSelected(value); });\n this._emitChangeEvent();\n };\n /**\n * Deselects a value or an array of values.\n * @param {...?} values\n * @return {?}\n */\n SelectionModel.prototype.deselect = function () {\n var _this = this;\n var values = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n values[_i] = arguments[_i];\n }\n this._verifyValueAssignment(values);\n values.forEach(function (value) { return _this._unmarkSelected(value); });\n this._emitChangeEvent();\n };\n /**\n * Toggles a value between selected and deselected.\n * @param {?} value\n * @return {?}\n */\n SelectionModel.prototype.toggle = function (value) {\n this.isSelected(value) ? this.deselect(value) : this.select(value);\n };\n /**\n * Clears all of the selected values.\n * @return {?}\n */\n SelectionModel.prototype.clear = function () {\n this._unmarkAll();\n this._emitChangeEvent();\n };\n /**\n * Determines whether a value is selected.\n * @param {?} value\n * @return {?}\n */\n SelectionModel.prototype.isSelected = function (value) {\n return this._selection.has(value);\n };\n /**\n * Determines whether the model does not have a value.\n * @return {?}\n */\n SelectionModel.prototype.isEmpty = function () {\n return this._selection.size === 0;\n };\n /**\n * Determines whether the model has a value.\n * @return {?}\n */\n SelectionModel.prototype.hasValue = function () {\n return !this.isEmpty();\n };\n /**\n * Sorts the selected values based on a predicate function.\n * @param {?=} predicate\n * @return {?}\n */\n SelectionModel.prototype.sort = function (predicate) {\n if (this._isMulti && 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 * @return {?}\n */\n SelectionModel.prototype._emitChangeEvent = function () {\n if (this._selectedToEmit.length || this._deselectedToEmit.length) {\n var /** @type {?} */ eventData = new SelectionChange(this._selectedToEmit, this._deselectedToEmit);\n if (this.onChange) {\n this.onChange.next(eventData);\n }\n this._deselectedToEmit = [];\n this._selectedToEmit = [];\n }\n this._selected = null;\n };\n /**\n * Selects a value.\n * @param {?} value\n * @return {?}\n */\n SelectionModel.prototype._markSelected = function (value) {\n if (!this.isSelected(value)) {\n if (!this._isMulti) {\n this._unmarkAll();\n }\n this._selection.add(value);\n if (this._emitChanges) {\n this._selectedToEmit.push(value);\n }\n }\n };\n /**\n * Deselects a value.\n * @param {?} value\n * @return {?}\n */\n SelectionModel.prototype._unmarkSelected = function (value) {\n if (this.isSelected(value)) {\n this._selection.delete(value);\n if (this._emitChanges) {\n this._deselectedToEmit.push(value);\n }\n }\n };\n /**\n * Clears out the selected values.\n * @return {?}\n */\n SelectionModel.prototype._unmarkAll = function () {\n var _this = this;\n if (!this.isEmpty()) {\n this._selection.forEach(function (value) { return _this._unmarkSelected(value); });\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 * @param {?} values\n * @return {?}\n */\n SelectionModel.prototype._verifyValueAssignment = function (values) {\n if (values.length > 1 && !this._isMulti) {\n throw getMultipleValuesInSingleSelectionError();\n }\n };\n return SelectionModel;\n}());\n/**\n * Describes an event emitted when the value of a MatSelectionModel has changed.\n * \\@docs-private\n */\nvar SelectionChange = (function () {\n /**\n * @param {?=} added\n * @param {?=} removed\n */\n function SelectionChange(added, removed) {\n this.added = added;\n this.removed = removed;\n }\n return SelectionChange;\n}());\n/**\n * Returns an error that reports that multiple values are passed into a selection model\n * with a single value.\n * @return {?}\n */\nfunction getMultipleValuesInSingleSelectionError() {\n return Error('Cannot pass multiple values into SelectionModel with single-value mode.');\n}\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 */\nvar UniqueSelectionDispatcher = (function () {\n function UniqueSelectionDispatcher() {\n this._listeners = [];\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 * @return {?}\n */\n UniqueSelectionDispatcher.prototype.notify = function (id, name) {\n for (var _i = 0, _a = this._listeners; _i < _a.length; _i++) {\n var listener = _a[_i];\n listener(id, name);\n }\n };\n /**\n * Listen for future changes to item selection.\n * @param {?} listener\n * @return {?} Function used to deregister listener\n */\n UniqueSelectionDispatcher.prototype.listen = function (listener) {\n var _this = this;\n this._listeners.push(listener);\n return function () {\n _this._listeners = _this._listeners.filter(function (registered) {\n return listener !== registered;\n });\n };\n };\n UniqueSelectionDispatcher.decorators = [\n { type: Injectable },\n ];\n /**\n * @nocollapse\n */\n UniqueSelectionDispatcher.ctorParameters = function () { return []; };\n return UniqueSelectionDispatcher;\n}());\n/**\n * \\@docs-private\n * @param {?} parentDispatcher\n * @return {?}\n */\nfunction UNIQUE_SELECTION_DISPATCHER_PROVIDER_FACTORY(parentDispatcher) {\n return parentDispatcher || new UniqueSelectionDispatcher();\n}\n/**\n * \\@docs-private\n */\nvar 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/**\n * Generated bundle index. Do not edit.\n */\n\nexport { UniqueSelectionDispatcher, UNIQUE_SELECTION_DISPATCHER_PROVIDER, DataSource, SelectionModel, SelectionChange, getMultipleValuesInSingleSelectionError, UNIQUE_SELECTION_DISPATCHER_PROVIDER_FACTORY as ɵa };\n//# sourceMappingURL=collections.es5.js.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