Sets the current selection from an array of items.
(values: T[])
| 177 | |
| 178 | /** Sets the current selection from an array of items. */ |
| 179 | private _setSelection(values: T[]) { |
| 180 | this._verifyValueAssignment(values); |
| 181 | const oldValues = this.selected; |
| 182 | const newSelectedSet = new Set(values.map(value => this._getConcreteValue(value))); |
| 183 | values.forEach(value => this._markSelected(value)); |
| 184 | oldValues |
| 185 | .filter(value => !newSelectedSet.has(this._getConcreteValue(value, newSelectedSet))) |
| 186 | .forEach(value => this._unmarkSelected(value)); |
| 187 | const changed = this._hasQueuedChanges(); |
| 188 | this._emitChangeEvent(); |
| 189 | return changed; |
| 190 | } |
| 191 | |
| 192 | /** Emits a change event and clears the records of selected and deselected values. */ |
| 193 | private _emitChangeEvent() { |
no test coverage detected