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I,IAAI,CAAC,mBAAmB,EAAE;gBAC5B,IAAI,CAAC,mBAAmB,EAAE,CAAC;aAC5B;SACF;aAAM;YACL,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;SACzB;IACH,CAAC;IACH,gBAAC;AAAD,CAAC,AA9cD,IA8cC;;AAED,SAAS,aAAa,CAAyB,IAAW,EAAE,KAAc;IACxE,yBAAyB;IACjB,IAAA,qBAAgB,EAAhB,qCAAgB,CAAoC;IAC5D,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { IObjectWithKey, ISelection, SELECTION_CHANGE, SelectionMode } from './Selection.types';\nimport { EventGroup } from '../EventGroup';\n\n/**\n * {@docCategory Selection}\n */\nexport interface ISelectionOptions<TItem = IObjectWithKey> {\n onSelectionChanged?: () => void;\n /** Custom logic to generate item keys. Required if `TItem` does not have a `key` property. */\n getKey?: (item: TItem, index?: number) => string | number;\n canSelectItem?: (item: TItem, index?: number) => boolean;\n selectionMode?: SelectionMode;\n items?: TItem[];\n}\n\n/**\n * Selection options with required `getKey` property.\n * {@docCategory Selection}\n */\nexport type ISelectionOptionsWithRequiredGetKey<TItem> = ISelectionOptions<TItem> &\n Required<Pick<ISelectionOptions<TItem>, 'getKey'>>;\n\n/**\n * {@docCategory Selection}\n */\nexport class Selection<TItem = IObjectWithKey> implements ISelection<TItem> {\n /** Number of items selected. Do not modify. */\n public count: number;\n public readonly mode: SelectionMode;\n\n private _getKey: (item: TItem, index?: number) => string | number;\n private _canSelectItem: (item: TItem, index?: number) => boolean;\n\n private _changeEventSuppressionCount: number;\n private _items: TItem[];\n private _selectedItems: TItem[] | null;\n private _selectedIndices: number[] | undefined;\n private _isAllSelected: boolean;\n private _exemptedIndices: { [index: string]: boolean };\n private _exemptedCount: number;\n private _keyToIndexMap: { [key: string]: number };\n private _anchoredIndex: number;\n private _onSelectionChanged: (() => void) | undefined;\n private _hasChanged: boolean;\n private _unselectableIndices: { [index: string]: boolean };\n private _unselectableCount: number;\n private _isModal: boolean;\n\n /**\n * Create a new Selection. If `TItem` does not have a `key` property, you must provide an options\n * object with a `getKey` implementation. Providing options is optional otherwise.\n * (At most one `options` object is accepted.)\n */\n constructor(\n ...options: TItem extends IObjectWithKey // If the item type has a built-in key...\n ? [] | [ISelectionOptions<TItem>] // Then the arguments can be empty or have the options without `getKey`\n : [ISelectionOptionsWithRequiredGetKey<TItem>] // Otherwise, arguments require options with `getKey`.\n ) {\n const { onSelectionChanged, getKey, canSelectItem = () => true, items, selectionMode = SelectionMode.multiple } =\n options[0] || ({} as ISelectionOptions<TItem>);\n\n this.mode = selectionMode;\n\n this._getKey = getKey || defaultGetKey;\n\n this._changeEventSuppressionCount = 0;\n this._exemptedCount = 0;\n this._anchoredIndex = 0;\n this._unselectableCount = 0;\n\n this._onSelectionChanged = onSelectionChanged;\n this._canSelectItem = canSelectItem;\n\n this._isModal = false;\n\n this.setItems(items || [], true);\n\n this.count = this.getSelectedCount();\n }\n\n public canSelectItem(item: TItem, index?: number): boolean {\n if (typeof index === 'number' && index < 0) {\n return false;\n }\n\n return this._canSelectItem(item, index);\n }\n\n public getKey(item: TItem, index?: number): string {\n const key = this._getKey(item, index);\n\n return typeof key === 'number' || key ? `${key}` : '';\n }\n\n public setChangeEvents(isEnabled: boolean, suppressChange?: boolean): void {\n this._changeEventSuppressionCount += isEnabled ? -1 : 1;\n\n if (this._changeEventSuppressionCount === 0 && this._hasChanged) {\n this._hasChanged = false;\n\n if (!suppressChange) {\n this._change();\n }\n }\n }\n\n public isModal(): boolean {\n return this._isModal;\n }\n\n public setModal(isModal: boolean): void {\n if (this._isModal !== isModal) {\n this.setChangeEvents(false);\n\n this._isModal = isModal;\n\n if (!isModal) {\n this.setAllSelected(false);\n }\n\n this._change();\n\n this.setChangeEvents(true);\n }\n }\n\n /**\n * Selection needs the items, call this method to set them. If the set\n * of items is the same, this will re-evaluate selection and index maps.\n * Otherwise, shouldClear should be set to true, so that selection is\n * cleared.\n */\n public setItems(items: TItem[], shouldClear: boolean = true): void {\n const newKeyToIndexMap: { [key: string]: number } = {};\n const newUnselectableIndices: { [key: string]: boolean } = {};\n let hasSelectionChanged = false;\n\n this.setChangeEvents(false);\n\n // Reset the unselectable count.\n this._unselectableCount = 0;\n\n // Build lookup table for quick selection evaluation.\n for (let i = 0; i < items.length; i++) {\n const item = items[i];\n\n if (item) {\n const key = this.getKey(item, i);\n\n if (key) {\n newKeyToIndexMap[key] = i;\n }\n }\n\n newUnselectableIndices[i] = item && !this.canSelectItem(item);\n if (newUnselectableIndices[i]) {\n this._unselectableCount++;\n }\n }\n\n if (shouldClear || items.length === 0) {\n this._setAllSelected(false, true);\n }\n\n // Check the exemption list for discrepencies.\n const newExemptedIndicies: { [key: string]: boolean } = {};\n let newExemptedCount = 0;\n\n for (const indexProperty in this._exemptedIndices) {\n if (this._exemptedIndices.hasOwnProperty(indexProperty)) {\n const index = Number(indexProperty);\n const item = this._items[index];\n const exemptKey = item ? this.getKey(item, Number(index)) : undefined;\n const newIndex = exemptKey ? newKeyToIndexMap[exemptKey] : index;\n\n if (newIndex === undefined) {\n // The item has likely been replaced or removed.\n hasSelectionChanged = true;\n } else {\n // We know the new index of the item. update the existing exemption table.\n newExemptedIndicies[newIndex] = true;\n newExemptedCount++;\n hasSelectionChanged = hasSelectionChanged || newIndex !== index;\n }\n }\n }\n\n if (this._items && this._exemptedCount === 0 && items.length !== this._items.length && this._isAllSelected) {\n // If everything was selected but the number of items has changed, selection has changed.\n hasSelectionChanged = true;\n }\n\n this._exemptedIndices = newExemptedIndicies;\n this._exemptedCount = newExemptedCount;\n this._keyToIndexMap = newKeyToIndexMap;\n this._unselectableIndices = newUnselectableIndices;\n this._items = items;\n this._selectedItems = null;\n\n if (hasSelectionChanged) {\n this._updateCount();\n this._change();\n }\n\n this.setChangeEvents(true);\n }\n\n public getItems(): TItem[] {\n return this._items;\n }\n\n public getSelection(): TItem[] {\n if (!this._selectedItems) {\n this._selectedItems = [];\n\n const items = this._items;\n\n if (items) {\n for (let i = 0; i < items.length; i++) {\n if (this.isIndexSelected(i)) {\n this._selectedItems.push(items[i]);\n }\n }\n }\n }\n\n return this._selectedItems;\n }\n\n public getSelectedCount(): number {\n return this._isAllSelected\n ? this._items.length - this._exemptedCount - this._unselectableCount\n : this._exemptedCount;\n }\n\n public getSelectedIndices(): number[] {\n if (!this._selectedIndices) {\n this._selectedIndices = [];\n\n const items = this._items;\n\n if (items) {\n for (let i = 0; i < items.length; i++) {\n if (this.isIndexSelected(i)) {\n this._selectedIndices.push(i);\n }\n }\n }\n }\n\n return this._selectedIndices;\n }\n\n public isRangeSelected(fromIndex: number, count: number): boolean {\n if (count === 0) {\n return false;\n }\n\n const endIndex = fromIndex + count;\n\n for (let i = fromIndex; i < endIndex; i++) {\n if (!this.isIndexSelected(i)) {\n return false;\n }\n }\n\n return true;\n }\n\n public isAllSelected(): boolean {\n let selectableCount = this._items.length - this._unselectableCount;\n\n // In single mode, we can only have a max of 1 item.\n if (this.mode === SelectionMode.single) {\n selectableCount = Math.min(selectableCount, 1);\n }\n\n return (\n (this.count > 0 && this._isAllSelected && this._exemptedCount === 0) ||\n (!this._isAllSelected && this._exemptedCount === selectableCount && selectableCount > 0)\n );\n }\n\n public isKeySelected(key: string): boolean {\n const index = this._keyToIndexMap[key];\n\n return this.isIndexSelected(index);\n }\n\n public isIndexSelected(index: number): boolean {\n return !!(\n (this.count > 0 && this._isAllSelected && !this._exemptedIndices[index] && !this._unselectableIndices[index]) ||\n (!this._isAllSelected && this._exemptedIndices[index])\n );\n }\n\n public setAllSelected(isAllSelected: boolean): void {\n if (isAllSelected && this.mode !== SelectionMode.multiple) {\n return;\n }\n\n const selectableCount = this._items ? this._items.length - this._unselectableCount : 0;\n\n this.setChangeEvents(false);\n\n if (selectableCount > 0 && (this._exemptedCount > 0 || isAllSelected !== this._isAllSelected)) {\n this._exemptedIndices = {};\n\n if (isAllSelected !== this._isAllSelected || this._exemptedCount > 0) {\n this._exemptedCount = 0;\n this._isAllSelected = isAllSelected;\n this._change();\n }\n\n this._updateCount();\n }\n\n this.setChangeEvents(true);\n }\n\n public setKeySelected(key: string, isSelected: boolean, shouldAnchor: boolean): void {\n const index = this._keyToIndexMap[key];\n\n if (index >= 0) {\n this.setIndexSelected(index, isSelected, shouldAnchor);\n }\n }\n\n public setIndexSelected(index: number, isSelected: boolean, shouldAnchor: boolean): void {\n if (this.mode === SelectionMode.none) {\n return;\n }\n\n // Clamp the index.\n index = Math.min(Math.max(0, index), this._items.length - 1);\n\n // No-op on out of bounds selections.\n if (index < 0 || index >= this._items.length) {\n return;\n }\n\n this.setChangeEvents(false);\n\n const isExempt = this._exemptedIndices[index];\n const canSelect = !this._unselectableIndices[index];\n\n if (canSelect) {\n if (isSelected && this.mode === SelectionMode.single) {\n // If this is single-select, the previous selection should be removed.\n this._setAllSelected(false, true);\n }\n\n // Determine if we need to remove the exemption.\n if (isExempt && ((isSelected && this._isAllSelected) || (!isSelected && !this._isAllSelected))) {\n delete this._exemptedIndices[index];\n this._exemptedCount--;\n }\n\n // Determine if we need to add the exemption.\n if (!isExempt && ((isSelected && !this._isAllSelected) || (!isSelected && this._isAllSelected))) {\n this._exemptedIndices[index] = true;\n this._exemptedCount++;\n }\n\n if (shouldAnchor) {\n this._anchoredIndex = index;\n }\n }\n\n this._updateCount();\n\n this.setChangeEvents(true);\n }\n\n public selectToKey(key: string, clearSelection?: boolean): void {\n this.selectToIndex(this._keyToIndexMap[key], clearSelection);\n }\n\n public selectToIndex(index: number, clearSelection?: boolean): void {\n if (this.mode === SelectionMode.none) {\n return;\n }\n\n if (this.mode === SelectionMode.single) {\n this.setIndexSelected(index, true, true);\n return;\n }\n\n const anchorIndex = this._anchoredIndex || 0;\n let startIndex = Math.min(index, anchorIndex);\n const endIndex = Math.max(index, anchorIndex);\n\n this.setChangeEvents(false);\n\n if (clearSelection) {\n this._setAllSelected(false, true);\n }\n\n for (; startIndex <= endIndex; startIndex++) {\n this.setIndexSelected(startIndex, true, false);\n }\n\n this.setChangeEvents(true);\n }\n\n public toggleAllSelected(): void {\n this.setAllSelected(!this.isAllSelected());\n }\n\n public toggleKeySelected(key: string): void {\n this.setKeySelected(key, !this.isKeySelected(key), true);\n }\n\n public toggleIndexSelected(index: number): void {\n this.setIndexSelected(index, !this.isIndexSelected(index), true);\n }\n\n public toggleRangeSelected(fromIndex: number, count: number): void {\n if (this.mode === SelectionMode.none) {\n return;\n }\n\n const isRangeSelected = this.isRangeSelected(fromIndex, count);\n const endIndex = fromIndex + count;\n\n if (this.mode === SelectionMode.single && count > 1) {\n return;\n }\n\n this.setChangeEvents(false);\n for (let i = fromIndex; i < endIndex; i++) {\n this.setIndexSelected(i, !isRangeSelected, false);\n }\n this.setChangeEvents(true);\n }\n\n private _updateCount(preserveModalState: boolean = false): void {\n const count = this.getSelectedCount();\n\n if (count !== this.count) {\n this.count = count;\n this._change();\n }\n\n if (!this.count && !preserveModalState) {\n this.setModal(false);\n }\n }\n\n private _setAllSelected(isAllSelected: boolean, preserveModalState: boolean = false): void {\n if (isAllSelected && this.mode !== SelectionMode.multiple) {\n return;\n }\n\n const selectableCount = this._items ? this._items.length - this._unselectableCount : 0;\n\n this.setChangeEvents(false);\n\n if (selectableCount > 0 && (this._exemptedCount > 0 || isAllSelected !== this._isAllSelected)) {\n this._exemptedIndices = {};\n\n if (isAllSelected !== this._isAllSelected || this._exemptedCount > 0) {\n this._exemptedCount = 0;\n this._isAllSelected = isAllSelected;\n this._change();\n }\n\n this._updateCount(preserveModalState);\n }\n\n this.setChangeEvents(true);\n }\n\n private _change(): void {\n if (this._changeEventSuppressionCount === 0) {\n this._selectedItems = null;\n this._selectedIndices = undefined;\n\n EventGroup.raise(this, SELECTION_CHANGE);\n\n if (this._onSelectionChanged) {\n this._onSelectionChanged();\n }\n } else {\n this._hasChanged = true;\n }\n }\n}\n\nfunction defaultGetKey<TItem = IObjectWithKey>(item: TItem, index?: number): string | number {\n // 0 may be used as a key\n const { key = `${index}` } = (item || {}) as IObjectWithKey;\n return key;\n}\n"]}
\No newline at end of file