@visactor/vtable-plugins 1.23.3-alpha.0 → 1.24.0
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/cjs/auto-fill/index.d.ts +3 -2
- package/cjs/auto-fill/index.js.map +1 -1
- package/cjs/auto-fill/series-converters.d.ts +3 -3
- package/cjs/auto-fill/series-converters.js.map +1 -1
- package/cjs/contextmenu/handle-menu-helper.js +1 -2
- package/cjs/contextmenu/index.js +2 -1
- package/cjs/excel-edit-cell-keyboard.d.ts +4 -2
- package/cjs/excel-edit-cell-keyboard.js.map +1 -1
- package/cjs/filter/filter-engine.js +5 -1
- package/cjs/filter/filter-engine.js.map +1 -1
- package/cjs/filter/filter-state-manager.d.ts +6 -1
- package/cjs/filter/filter-state-manager.js +81 -0
- package/cjs/filter/filter-state-manager.js.map +1 -1
- package/cjs/filter/filter-toolbar.d.ts +2 -0
- package/cjs/filter/filter-toolbar.js +23 -3
- package/cjs/filter/filter-toolbar.js.map +1 -1
- package/cjs/filter/filter.d.ts +4 -2
- package/cjs/filter/filter.js +32 -10
- package/cjs/filter/filter.js.map +1 -1
- package/cjs/filter/index.js +2 -1
- package/cjs/filter/types.d.ts +3 -0
- package/cjs/filter/types.js.map +1 -1
- package/cjs/filter/value-filter.js +11 -41
- package/cjs/filter/value-filter.js.map +1 -1
- package/cjs/filter/value-filter.syncSingleStateFromTableData.backup.d.ts +46 -0
- package/cjs/filter/value-filter.syncSingleStateFromTableData.backup.js +247 -0
- package/cjs/filter/value-filter.syncSingleStateFromTableData.backup.js.map +1 -0
- package/cjs/history/formula.d.ts +40 -0
- package/cjs/history/formula.js +112 -0
- package/cjs/history/formula.js.map +1 -0
- package/cjs/history/history-plugin.d.ts +88 -0
- package/cjs/history/history-plugin.js +699 -0
- package/cjs/history/history-plugin.js.map +1 -0
- package/cjs/history/index.d.ts +3 -0
- package/cjs/history/index.js +24 -0
- package/cjs/history/index.js.map +1 -0
- package/cjs/history/replay.d.ts +9 -0
- package/cjs/history/replay.js +268 -0
- package/cjs/history/replay.js.map +1 -0
- package/cjs/history/sheet-key.d.ts +9 -0
- package/cjs/history/sheet-key.js +44 -0
- package/cjs/history/sheet-key.js.map +1 -0
- package/cjs/history/snapshot.d.ts +15 -0
- package/cjs/history/snapshot.js +78 -0
- package/cjs/history/snapshot.js.map +1 -0
- package/cjs/history/types.d.ts +105 -0
- package/cjs/history/types.js +6 -0
- package/cjs/history/types.js.map +1 -0
- package/cjs/history-plugin.d.ts +1 -0
- package/cjs/history-plugin.js +21 -0
- package/cjs/history-plugin.js.map +1 -0
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +2 -1
- package/cjs/index.js.map +1 -1
- package/cjs/master-detail-plugin/checkbox.js +1 -1
- package/cjs/master-detail-plugin/config.js +1 -1
- package/cjs/master-detail-plugin/core.js +1 -1
- package/cjs/master-detail-plugin/events.js +1 -1
- package/cjs/master-detail-plugin/types.d.ts +1 -1
- package/cjs/master-detail-plugin/types.js.map +1 -1
- package/cjs/rotate-table.d.ts +7 -6
- package/cjs/rotate-table.js +12 -13
- package/cjs/rotate-table.js.map +1 -1
- package/cjs/row-series.js +2 -1
- package/cjs/table-export/util/pagination.js.map +1 -1
- package/cjs/wps-fill-handle.d.ts +4 -2
- package/cjs/wps-fill-handle.js.map +1 -1
- package/dist/vtable-plugins.js +1903 -81
- package/dist/vtable-plugins.min.js +3 -3
- package/es/auto-fill/index.d.ts +3 -2
- package/es/auto-fill/index.js.map +1 -1
- package/es/auto-fill/series-converters.d.ts +3 -3
- package/es/auto-fill/series-converters.js.map +1 -1
- package/es/contextmenu/handle-menu-helper.js +1 -2
- package/es/contextmenu/index.js +2 -1
- package/es/excel-edit-cell-keyboard.d.ts +4 -2
- package/es/excel-edit-cell-keyboard.js.map +1 -1
- package/es/filter/filter-engine.js +5 -1
- package/es/filter/filter-engine.js.map +1 -1
- package/es/filter/filter-state-manager.d.ts +6 -1
- package/es/filter/filter-state-manager.js +81 -0
- package/es/filter/filter-state-manager.js.map +1 -1
- package/es/filter/filter-toolbar.d.ts +2 -0
- package/es/filter/filter-toolbar.js +23 -3
- package/es/filter/filter-toolbar.js.map +1 -1
- package/es/filter/filter.d.ts +4 -2
- package/es/filter/filter.js +32 -10
- package/es/filter/filter.js.map +1 -1
- package/es/filter/index.js +2 -1
- package/es/filter/types.d.ts +3 -0
- package/es/filter/types.js.map +1 -1
- package/es/filter/value-filter.js +12 -41
- package/es/filter/value-filter.js.map +1 -1
- package/es/filter/value-filter.syncSingleStateFromTableData.backup.d.ts +46 -0
- package/es/filter/value-filter.syncSingleStateFromTableData.backup.js +242 -0
- package/es/filter/value-filter.syncSingleStateFromTableData.backup.js.map +1 -0
- package/es/history/formula.d.ts +40 -0
- package/es/history/formula.js +103 -0
- package/es/history/formula.js.map +1 -0
- package/es/history/history-plugin.d.ts +88 -0
- package/es/history/history-plugin.js +698 -0
- package/es/history/history-plugin.js.map +1 -0
- package/es/history/index.d.ts +3 -0
- package/es/history/index.js +4 -0
- package/es/history/index.js.map +1 -0
- package/es/history/replay.d.ts +9 -0
- package/es/history/replay.js +260 -0
- package/es/history/replay.js.map +1 -0
- package/es/history/sheet-key.d.ts +9 -0
- package/es/history/sheet-key.js +38 -0
- package/es/history/sheet-key.js.map +1 -0
- package/es/history/snapshot.d.ts +15 -0
- package/es/history/snapshot.js +71 -0
- package/es/history/snapshot.js.map +1 -0
- package/es/history/types.d.ts +105 -0
- package/es/history/types.js +2 -0
- package/es/history/types.js.map +1 -0
- package/es/history-plugin.d.ts +1 -0
- package/es/history-plugin.js +2 -0
- package/es/history-plugin.js.map +1 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -0
- package/es/index.js.map +1 -1
- package/es/master-detail-plugin/checkbox.js +1 -1
- package/es/master-detail-plugin/config.js +1 -1
- package/es/master-detail-plugin/core.js +1 -1
- package/es/master-detail-plugin/events.js +1 -1
- package/es/master-detail-plugin/types.d.ts +1 -1
- package/es/master-detail-plugin/types.js.map +1 -1
- package/es/rotate-table.d.ts +7 -6
- package/es/rotate-table.js +2 -3
- package/es/rotate-table.js.map +1 -1
- package/es/row-series.js +2 -1
- package/es/table-export/util/pagination.js.map +1 -1
- package/es/wps-fill-handle.d.ts +4 -2
- package/es/wps-fill-handle.js.map +1 -1
- package/package.json +10 -8
- package/cjs/auto-fill/__tests__/formula-integration.test.d.ts +0 -23
- package/cjs/auto-fill/__tests__/formula-integration.test.js +0 -61
- package/cjs/auto-fill/__tests__/formula-integration.test.js.map +0 -1
- package/es/auto-fill/__tests__/formula-integration.test.d.ts +0 -23
- package/es/auto-fill/__tests__/formula-integration.test.js +0 -54
- package/es/auto-fill/__tests__/formula-integration.test.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/filter/value-filter.ts"],"names":[],"mappings":";;;AACA,6CAAuD;AAEvD,mCAA2C;AAE3C,qCAAuC;AAEvC,MAAa,WAAW;IA0BtB,YAAY,KAA6B,EAAE,kBAAsC,EAAE,aAA4B;QApBvG,iBAAY,GAAG,IAAI,GAAG,EAAyC,CAAC;QAChE,kBAAa,GAAG,IAAI,GAAG,EAAiD,CAAC;QACzE,kBAAa,GAAG,IAAI,GAAG,EAAqD,CAAC;QAC7E,uBAAkB,GAAG,IAAI,GAAG,EAAuC,CAAC;QAEpE,0BAAqB,GAAiD,IAAI,GAAG,EAAE,CAAC;QAgBtF,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,IAAI,EAAE,CAAC;IAC3C,CAAC;IAED,gBAAgB,CAAC,OAAwB;QACvC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;IAC/B,CAAC;IAEO,gBAAgB,CAAC,OAAwB;QAC/C,IAAI,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,G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AC7C,IAAI,CAAC,wBAAwB,GAAG,SAAgB,CAAC;QAEjD,IAAI,IAAI,CAAC,kBAAkB,EAAE;YAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC;YACrD,IAAI,MAAM,EAAE;gBACV,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;aAC7C;iBAAM;gBAEL,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC;aAClC;SACF;QAGD,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC7B,IAAI,CAAC,oBAAoB,CAAC,SAAS,GAAG,EAAE,CAAC;SAC1C;QACD,IAAI,IAAI,CAAC,wBAAwB,EAAE;YACjC,IAAI,CAAC,wBAAwB,CAAC,KAAK,GAAG,EAAE,CAAC;SAC1C;QAGD,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC/C,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QACjD,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QACjD,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;QAC3D,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;QAGhE,IAAI,CAAC,kBAA0B,GAAG,SAAS,CAAC;QAC5C,IAAI,CAAC,wBAAgC,GAAG,SAAS,CAAC;QAClD,IAAI,CAAC,iBAAyB,GAAG,SAAS,CAAC;QAC3C,IAAI,CAAC,cAAsB,GAAG,SAAS,CAAC;QACxC,IAAI,CAAC,oBAA4B,GAAG,SAAS,CAAC;IACjD,CAAC;CACF;AA5iBD,kCA4iBC","file":"value-filter.js","sourcesContent":["import type { ListTable, PivotTable } from '@visactor/vtable';\nimport { arrayEqual, isValid } from '@visactor/vutils';\nimport type { ValueFilterOptionDom, FilterState, FilterOptions, FilterStyles } from './types';\nimport { FilterActionType } from './types';\nimport type { FilterStateManager } from './filter-state-manager';\nimport { applyStyles } from './styles';\n\nexport class ValueFilter {\n private table: ListTable | PivotTable;\n private filterStateManager: FilterStateManager;\n private pluginOptions: FilterOptions;\n private styles: Record<any, any>;\n private selectedField: string | number;\n private selectedKeys = new Map<string | number, Set<string | number>>(); // 存储 format 之前的原始数据\n private candidateKeys = new Map<string | number, Map<string | number, number>>(); // 存储 format 后的数据\n private formatFnCache = new Map<string | number, (record: any) => string | number>();\n private toUnformattedCache = new Map<string | number, Map<any, Set<any>>>();\n\n private valueFilterOptionList: Map<string | number, ValueFilterOptionDom[]> = new Map();\n\n private filterByValuePanel: HTMLElement;\n private searchContainer: HTMLElement;\n private optionsContainer: HTMLElement;\n private selectAllItemDiv: HTMLElement;\n private selectAllLabel: HTMLElement;\n private filterByValueSearchInput: HTMLInputElement;\n private selectAllCheckbox: HTMLInputElement;\n private totalCountSpan: HTMLSpanElement;\n private filterItemsContainer: HTMLElement;\n\n private _onInputKeyUpHandler: (event: KeyboardEvent) => void;\n private _onCheckboxChangeHandler: (event: Event) => void;\n\n constructor(table: ListTable | PivotTable, filterStateManager: FilterStateManager, pluginOptions: FilterOptions) {\n this.table = table;\n this.filterStateManager = filterStateManager;\n this.pluginOptions = pluginOptions;\n this.styles = pluginOptions.styles || {};\n }\n\n setSelectedField(fieldId: string | number): void {\n this.selectedField = fieldId;\n }\n\n private getFormatFnCache(fieldId: string | number) {\n let formatFn = this.formatFnCache.get(fieldId);\n if (formatFn !== null && formatFn !== undefined) {\n return formatFn;\n }\n\n const headerAddress = this.table.internalProps.layoutMap.getHeaderCellAddressByField(String(fieldId));\n const bodyInfo = this.table.internalProps.layoutMap.getBody(headerAddress?.col, headerAddress?.row);\n if (bodyInfo && 'fieldFormat' in bodyInfo && typeof bodyInfo.fieldFormat === 'function') {\n formatFn = bodyInfo.fieldFormat;\n } else if (bodyInfo && 'format' in bodyInfo && typeof bodyInfo.format === 'function') {\n formatFn = bodyInfo.format;\n } else {\n formatFn = (record: any) => record[fieldId];\n }\n\n this.formatFnCache.set(fieldId, formatFn);\n return formatFn;\n }\n\n private getRecords(table: ListTable | PivotTable, original: boolean): any[] {\n if (original === true) {\n return table.internalProps.records;\n }\n\n const records = [];\n const stack = [...table.internalProps.dataSource.records];\n while (stack.length > 0) {\n const item = stack.pop();\n\n if (item?.vtableMerge && Array.isArray(item?.children)) {\n for (let i = item.children.length - 1; i >= 0; i--) {\n stack.push(item.children[i]);\n }\n } else {\n records.push(item);\n }\n }\n\n return records.reverse();\n }\n\n /**\n * 为未应用筛选的列,收集候选值集合\n */\n private collectCandidateKeysForUnfilteredColumn(fieldId: string | number): void {\n const syncFilterItemsState = this.pluginOptions?.syncFilterItemsState ?? true;\n const countMap = new Map<any, number>(); // 计算每个候选值的计数\n let records = [];\n // 如果各个筛选器之间不联动, 则永远从原数据中获取候选值\n if (!syncFilterItemsState) {\n records = this.table.internalProps.records;\n } else {\n records = this.getRecords(this.table, false); // 未筛选:使用当前表格数据\n }\n\n const formatFn = this.getFormatFnCache(fieldId);\n const toUnformatted = new Map();\n\n records.forEach(record => {\n // 空行不做处理\n if (isValid(record)) {\n const originalValue = record[fieldId];\n const formattedValue = formatFn(record) ?? '(空白)';\n if (formattedValue !== undefined && formattedValue !== null) {\n countMap.set(formattedValue, (countMap.get(formattedValue) || 0) + 1);\n\n const unformattedSet = toUnformatted.get(formattedValue);\n if (unformattedSet !== undefined && unformattedSet !== null) {\n unformattedSet.add(originalValue);\n } else {\n toUnformatted.set(formattedValue, new Set([originalValue]));\n }\n }\n }\n });\n\n this.candidateKeys.set(fieldId, countMap);\n this.toUnformattedCache.set(fieldId, toUnformatted);\n }\n\n /**\n * 为已应用筛选的列,收集候选值集合\n */\n private collectCandidateKeysForFilteredColumn(candidateField: string | number): void {\n const syncFilterItemsState = this.pluginOptions?.syncFilterItemsState ?? true;\n const filteredFields = this.filterStateManager.getActiveFilterFields().filter(field => field !== candidateField);\n const toUnformatted = new Map();\n const formatFn = this.getFormatFnCache(candidateField);\n\n const countMap = new Map<any, number>(); // 计算每个候选值的计数\n let records = [];\n // 如果各个筛选器之间不联动, 则永远从原数据中获取候选值\n if (!syncFilterItemsState) {\n records = this.table.internalProps.records;\n } else {\n const recordsList = this.getRecords(this.table, true); // 已筛选:使用原始表格数据\n records = recordsList.filter(record =>\n filteredFields.every(field => {\n const filterType = this.filterStateManager.getFilterState(field)?.type;\n if (filterType !== 'byValue' && filterType !== null && filterType !== undefined) {\n this.syncSingleStateFromTableData(field);\n }\n const set = this.selectedKeys.get(field);\n return set.has(record[field]);\n })\n );\n }\n\n records.forEach(record => {\n // 空行不做处理\n if (isValid(record)) {\n const originalValue = record[candidateField];\n const formattedValue = formatFn(record) ?? '(空白)';\n countMap.set(formattedValue, (countMap.get(formattedValue) || 0) + 1);\n if (formattedValue !== undefined && formattedValue !== null) {\n const unformattedSet = toUnformatted.get(formattedValue);\n if (unformattedSet !== undefined && unformattedSet !== null) {\n unformattedSet.add(originalValue);\n } else {\n toUnformatted.set(formattedValue, new Set([originalValue]));\n }\n }\n }\n });\n\n this.candidateKeys.set(candidateField, countMap);\n this.toUnformattedCache.set(candidateField, toUnformatted);\n }\n\n private toggleSelectAll(fieldId: string | number, selected: boolean): void {\n const options = this.valueFilterOptionList.get(fieldId);\n options.forEach(option => {\n if (option.itemContainer.style.display !== 'none') {\n option.checkbox.checked = selected;\n }\n });\n }\n\n private syncSelectAllCheckbox(fieldId: string | number): void {\n const options = this.valueFilterOptionList.get(fieldId) || [];\n const allChecked = options.every(o => o.checkbox.checked);\n const noneChecked = options.every(o => !o.checkbox.checked);\n\n this.selectAllCheckbox.checked = allChecked;\n this.selectAllCheckbox.indeterminate = !allChecked && !noneChecked;\n }\n\n private onSearch(fieldId: string | number, value: string): void {\n // 更新UI显示\n const items = this.valueFilterOptionList.get(fieldId);\n const filterKeywords = value\n .toUpperCase()\n .split(' ')\n .filter(s => s);\n\n for (const item of items) {\n const txtValue = item.id.toUpperCase() || '';\n const match = filterKeywords.some(keyword => txtValue.includes(keyword));\n const isVisible = filterKeywords.length === 0 || match;\n\n item.itemContainer.style.display = isVisible ? 'flex' : 'none';\n }\n }\n\n /**\n * 根据当前表格中的数据,更新 filter 的被选状态\n * 适用情况:表格数据发生变化,或者需要自动检测当前表格的数据情况\n */\n syncSingleStateFromTableData(fieldId: string | number): void {\n const selectedValues = new Set<any>();\n const originalValues = new Set<any>();\n const originalRecords = this.table.internalProps.records; // 原始数据\n originalRecords.forEach(record => {\n // 空行不做处理\n if (isValid(record)) {\n originalValues.add(record[fieldId]);\n }\n });\n\n const syncFilterItemsState = this.pluginOptions?.syncFilterItemsState ?? true;\n const hasFiltered = !arrayEqual(Array.from(originalValues), Array.from(selectedValues));\n if (syncFilterItemsState) {\n if (hasFiltered) {\n this.selectedKeys.set(fieldId, selectedValues);\n\n this.filterStateManager.dispatch({\n type: FilterActionType.UPDATE_FILTER,\n payload: {\n field: fieldId,\n values: Array.from(selectedValues),\n enable: true\n }\n });\n const hasFiltered = !arrayEqual(Array.from(originalValues), Array.from(selectedValues));\n if (hasFiltered) {\n this.selectedKeys.set(fieldId, selectedValues);\n this.filterStateManager.dispatch({\n type: FilterActionType.ADD_FILTER,\n payload: {\n field: fieldId,\n type: 'byValue',\n values: Array.from(selectedValues),\n enable: true\n }\n });\n }\n }\n } else {\n const selectedRules = this.filterStateManager.getFilterState(fieldId)?.values; // 如果按值筛选没有状态, 则默认选中所有值\n if (selectedRules) {\n const hasFiltered = !arrayEqual(Array.from(originalValues), selectedRules);\n if (hasFiltered) {\n this.selectedKeys.set(fieldId, new Set(selectedRules));\n this.filterStateManager.dispatch({\n type: FilterActionType.ADD_FILTER,\n payload: {\n field: fieldId,\n type: 'byValue',\n values: selectedRules,\n enable: true,\n shouldKeepUnrelatedState: true\n }\n });\n }\n } else {\n this.selectedKeys.set(fieldId, originalValues);\n }\n }\n }\n\n applyFilter(fieldId: string | number = this.selectedField): void {\n const options = this.valueFilterOptionList.get(fieldId);\n if (!options || options.length === 0) {\n return;\n }\n\n const selections = options\n .map(option => {\n if (option.checkbox.checked) {\n return option.originalValue;\n }\n return null;\n })\n .filter(key => key !== null)\n .flat();\n\n this.selectedKeys.set(fieldId, new Set(selections));\n\n const syncFilterItemsState = this.pluginOptions?.syncFilterItemsState ?? true;\n\n if (\n (selections.length >= 0 && selections.length < this.valueFilterOptionList.get(fieldId).length) ||\n !syncFilterItemsState\n ) {\n this.filterStateManager.dispatch({\n type: FilterActionType.APPLY_FILTERS,\n payload: {\n field: fieldId,\n type: 'byValue',\n values: selections,\n enable: true,\n shouldKeepUnrelatedState: !syncFilterItemsState\n }\n });\n } else {\n this.filterStateManager.dispatch({\n type: FilterActionType.REMOVE_FILTER,\n payload: {\n field: fieldId,\n type: 'byValue'\n }\n });\n }\n }\n\n clearFilter(fieldId: string | number): void {\n this.filterStateManager.dispatch({\n type: FilterActionType.REMOVE_FILTER,\n payload: {\n field: fieldId\n }\n });\n\n this.hide();\n }\n\n render(container: HTMLElement): void {\n const filterStyles = this.styles;\n // === 按值筛选的菜单内容 ===\n this.filterByValuePanel = document.createElement('div');\n applyStyles(this.filterByValuePanel, filterStyles.filterPanel);\n\n // -- 搜索栏 ---\n this.searchContainer = document.createElement('div');\n applyStyles(this.searchContainer, this.styles.searchContainer);\n\n this.filterByValueSearchInput = document.createElement('input');\n this.filterByValueSearchInput.type = 'text';\n this.filterByValueSearchInput.placeholder = filterStyles.searchInput?.placeholder || '可使用空格分隔多个关键词';\n applyStyles(this.filterByValueSearchInput, filterStyles.searchInput);\n\n this.searchContainer.appendChild(this.filterByValueSearchInput);\n\n // --- 筛选选项 ---\n this.optionsContainer = document.createElement('div');\n applyStyles(this.optionsContainer, this.styles.optionsContainer);\n\n this.selectAllItemDiv = document.createElement('div');\n applyStyles(this.selectAllItemDiv, this.styles.optionItem);\n\n this.selectAllLabel = document.createElement('label');\n applyStyles(this.selectAllLabel, this.styles.optionLabel);\n\n this.selectAllCheckbox = document.createElement('input');\n this.selectAllCheckbox.type = 'checkbox';\n this.selectAllCheckbox.checked = true; // 默认全选\n applyStyles(this.selectAllCheckbox, filterStyles.checkbox);\n\n this.totalCountSpan = document.createElement('span');\n this.totalCountSpan.textContent = '';\n applyStyles(this.totalCountSpan, filterStyles.countSpan);\n\n this.selectAllLabel.append(this.selectAllCheckbox, ' 全选');\n this.selectAllItemDiv.appendChild(this.selectAllLabel);\n\n this.filterItemsContainer = document.createElement('div'); // 筛选条目的容器,后续应动态 appendChild\n\n this.optionsContainer.append(this.selectAllItemDiv, this.filterItemsContainer);\n this.filterByValuePanel.append(this.searchContainer, this.optionsContainer);\n\n container.appendChild(this.filterByValuePanel);\n\n this.bindEventForFilterByValue();\n }\n\n updateStyles(styles: FilterStyles): void {\n applyStyles(this.filterByValuePanel, styles.filterPanel);\n applyStyles(this.searchContainer, styles.searchContainer);\n this.filterByValueSearchInput.placeholder = styles.searchInput?.placeholder || '可使用空格分隔多个关键词';\n applyStyles(this.filterByValueSearchInput, styles.searchInput);\n applyStyles(this.optionsContainer, styles.optionsContainer);\n applyStyles(this.selectAllItemDiv, styles.optionItem);\n applyStyles(this.selectAllLabel, styles.optionLabel);\n applyStyles(this.selectAllCheckbox, styles.checkbox);\n }\n\n private renderFilterOptions(field: string | number): void {\n const filterStyles = this.styles;\n this.filterItemsContainer.innerHTML = '';\n this.valueFilterOptionList.delete(field);\n this.valueFilterOptionList.set(field, []);\n\n let totalCount = 0;\n let allChecked = true;\n let noneChecked = true;\n const selectedKeysSet = this.selectedKeys.get(field);\n const itemDomList: ValueFilterOptionDom[] = [];\n const isFiltered = this.filterStateManager.getFilterState(field)?.enable;\n const toUnformatted = this.toUnformattedCache.get(field);\n\n const candidates = this.candidateKeys.get(field);\n if (!candidates || candidates.size === 0) {\n return;\n }\n const candidatesArr = [...candidates.entries()] as [string, number][] | [number, number][];\n const sortedCandidatesArr =\n typeof candidatesArr[0][0] === 'number'\n ? [...candidatesArr]?.sort(([a], [b]) => Number(a) - Number(b))\n : [...candidatesArr]?.sort(([a], [b]) => String(a).localeCompare(String(b)));\n\n sortedCandidatesArr?.forEach(([val, count]) => {\n totalCount += count;\n const unformattedArr = Array.from(toUnformatted.get(val) || new Set());\n const itemDiv = document.createElement('div');\n applyStyles(itemDiv, filterStyles.optionItem);\n itemDiv.style.display = 'flex';\n\n const label = document.createElement('label');\n applyStyles(label, filterStyles.optionLabel);\n\n const checkbox = document.createElement('input');\n checkbox.type = 'checkbox';\n checkbox.value = String(val); // 显示值作为checkbox的value\n checkbox.checked = isFiltered ? unformattedArr.some(v => selectedKeysSet?.has(v)) : true;\n applyStyles(checkbox, filterStyles.checkbox);\n\n if (checkbox.checked) {\n noneChecked = false;\n } else {\n allChecked = false;\n }\n\n const countSpan = document.createElement('span');\n countSpan.textContent = String(count);\n applyStyles(countSpan, filterStyles.countSpan);\n\n label.append(checkbox, ` ${this.pluginOptions.checkboxItemFormat?.(val, unformattedArr) || val}`); // UI显示格式化值 或 用户二次加工的值\n itemDiv.append(label, countSpan);\n this.filterItemsContainer.appendChild(itemDiv);\n\n const itemDom: ValueFilterOptionDom = {\n id: String(val), // 显示值作为id,用于UI交互\n originalValue: unformattedArr,\n itemContainer: itemDiv,\n checkbox: checkbox,\n countSpan: countSpan\n };\n\n itemDomList.push(itemDom);\n });\n\n this.valueFilterOptionList.set(field, itemDomList);\n this.selectAllCheckbox.checked = allChecked;\n this.selectAllCheckbox.indeterminate = !allChecked && !noneChecked;\n this.totalCountSpan.textContent = String(totalCount);\n }\n\n private bindEventForFilterByValue(): void {\n this._onInputKeyUpHandler = (event: KeyboardEvent) => {\n const target = event.target as EventTarget;\n if (target instanceof HTMLInputElement && target.type === 'text') {\n const value = target.value;\n this.onSearch(this.selectedField, value);\n }\n };\n\n this._onCheckboxChangeHandler = (event: Event) => {\n const target = event.target as EventTarget;\n if (target instanceof HTMLInputElement && target.type === 'checkbox') {\n if (target === this.selectAllCheckbox) {\n this.toggleSelectAll(this.selectedField, this.selectAllCheckbox.checked);\n } else {\n this.syncSelectAllCheckbox(this.selectedField);\n }\n }\n };\n\n this.filterByValuePanel.addEventListener('keyup', this._onInputKeyUpHandler);\n this.filterByValuePanel.addEventListener('change', this._onCheckboxChangeHandler);\n }\n\n show(): void {\n // 1. 收集候选值列表(根据筛选状态选择数据源)\n const isFiltered = this.filterStateManager.getFilterState(this.selectedField)?.enable;\n if (!isFiltered) {\n this.collectCandidateKeysForUnfilteredColumn(this.selectedField);\n } else {\n this.collectCandidateKeysForFilteredColumn(this.selectedField);\n }\n\n // 2. 初始筛选状态\n const filterType = this.filterStateManager.getFilterState(this.selectedField)?.type;\n if (filterType !== null && filterType !== undefined && filterType !== 'byValue') {\n this.syncSingleStateFromTableData(this.selectedField);\n }\n\n // 3. 清空搜索框\n if (this.filterByValueSearchInput) {\n this.filterByValueSearchInput.value = '';\n }\n\n // 4. 渲染选项(此时状态已经初始化完成)\n this.renderFilterOptions(this.selectedField);\n this.filterByValuePanel.style.display = 'block';\n }\n\n hide(): void {\n this.filterByValuePanel.style.display = 'none';\n }\n\n clearSearchInputValue(): void {\n this.filterByValueSearchInput.value = '';\n }\n\n destroy(): void {\n if (this.filterByValuePanel) {\n if (this._onInputKeyUpHandler) {\n this.filterByValuePanel.removeEventListener('keyup', this._onInputKeyUpHandler);\n }\n if (this._onCheckboxChangeHandler) {\n this.filterByValuePanel.removeEventListener('change', this._onCheckboxChangeHandler);\n }\n }\n this._onInputKeyUpHandler = undefined as any;\n this._onCheckboxChangeHandler = undefined as any;\n\n if (this.filterByValuePanel) {\n const parent = this.filterByValuePanel.parentElement;\n if (parent) {\n parent.removeChild(this.filterByValuePanel);\n } else {\n // if not attached, ensure it's removed\n this.filterByValuePanel.remove();\n }\n }\n\n // clear DOM contents to release child references\n if (this.filterItemsContainer) {\n this.filterItemsContainer.innerHTML = '';\n }\n if (this.filterByValueSearchInput) {\n this.filterByValueSearchInput.value = '';\n }\n\n // Clear in-memory caches and collections to avoid unbounded growth\n this.selectedKeys && this.selectedKeys.clear();\n this.candidateKeys && this.candidateKeys.clear();\n this.formatFnCache && this.formatFnCache.clear();\n this.toUnformattedCache && this.toUnformattedCache.clear();\n this.valueFilterOptionList && this.valueFilterOptionList.clear();\n\n // Nullify references (use casts to avoid TS strict errors at assignment)\n (this.filterByValuePanel as any) = undefined;\n (this.filterByValueSearchInput as any) = undefined;\n (this.selectAllCheckbox as any) = undefined;\n (this.totalCountSpan as any) = undefined;\n (this.filterItemsContainer as any) = undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/filter/value-filter.ts"],"names":[],"mappings":";;;AACA,6CAA2C;AAE3C,mCAA2C;AAE3C,qCAAuC;AAEvC,MAAa,WAAW;IA0BtB,YAAY,KAA6B,EAAE,kBAAsC,EAAE,aAA4B;QApBvG,iBAAY,GAAG,IAAI,GAAG,EAAyC,CAAC;QAChE,kBAAa,GAAG,IAAI,GAAG,EAAiD,CAAC;QACzE,kBAAa,GAAG,IAAI,GAAG,EAAqD,CAAC;QAC7E,uBAAkB,GAAG,IAAI,GAAG,EAAuC,CAAC;QAEpE,0BAAqB,GAAiD,IAAI,GAAG,EAAE,CAAC;QAgBtF,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,IAAI,EAAE,CAAC;IAC3C,CAAC;IAED,gBAAgB,CAAC,OAAwB;QACvC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;IAC/B,CAAC;IAEO,gBAAgB,CAAC,OAAwB;QAC/C,IAAI,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC/C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AG,SAAS,CAAC;QAC3C,IAAI,CAAC,cAAsB,GAAG,SAAS,CAAC;QACxC,IAAI,CAAC,oBAA4B,GAAG,SAAS,CAAC;IACjD,CAAC;CACF;AA5gBD,kCA4gBC","file":"value-filter.js","sourcesContent":["import type { ListTable, PivotTable } from '@visactor/vtable';\nimport { isValid } from '@visactor/vutils';\nimport type { ValueFilterOptionDom, FilterOptions, FilterStyles } from './types';\nimport { FilterActionType } from './types';\nimport type { FilterStateManager } from './filter-state-manager';\nimport { applyStyles } from './styles';\n\nexport class ValueFilter {\n private table: ListTable | PivotTable;\n private filterStateManager: FilterStateManager;\n private pluginOptions: FilterOptions;\n private styles: Record<any, any>;\n private selectedField: string | number;\n private selectedKeys = new Map<string | number, Set<string | number>>(); // 存储 format 之前的原始数据\n private candidateKeys = new Map<string | number, Map<string | number, number>>(); // 存储 format 后的数据\n private formatFnCache = new Map<string | number, (record: any) => string | number>();\n private toUnformattedCache = new Map<string | number, Map<any, Set<any>>>();\n\n private valueFilterOptionList: Map<string | number, ValueFilterOptionDom[]> = new Map();\n\n private filterByValuePanel: HTMLElement;\n private searchContainer: HTMLElement;\n private optionsContainer: HTMLElement;\n private selectAllItemDiv: HTMLElement;\n private selectAllLabel: HTMLElement;\n private filterByValueSearchInput: HTMLInputElement;\n private selectAllCheckbox: HTMLInputElement;\n private totalCountSpan: HTMLSpanElement;\n private filterItemsContainer: HTMLElement;\n\n private _onInputKeyUpHandler: (event: KeyboardEvent) => void;\n private _onCheckboxChangeHandler: (event: Event) => void;\n\n constructor(table: ListTable | PivotTable, filterStateManager: FilterStateManager, pluginOptions: FilterOptions) {\n this.table = table;\n this.filterStateManager = filterStateManager;\n this.pluginOptions = pluginOptions;\n this.styles = pluginOptions.styles || {};\n }\n\n setSelectedField(fieldId: string | number): void {\n this.selectedField = fieldId;\n }\n\n private getFormatFnCache(fieldId: string | number) {\n let formatFn = this.formatFnCache.get(fieldId);\n if (formatFn !== null && formatFn !== undefined) {\n return formatFn;\n }\n\n const headerAddress = this.table.internalProps.layoutMap.getHeaderCellAddressByField(String(fieldId));\n const bodyInfo = this.table.internalProps.layoutMap.getBody(headerAddress?.col, headerAddress?.row);\n if (bodyInfo && 'fieldFormat' in bodyInfo && typeof bodyInfo.fieldFormat === 'function') {\n formatFn = bodyInfo.fieldFormat;\n } else if (bodyInfo && 'format' in bodyInfo && typeof bodyInfo.format === 'function') {\n formatFn = bodyInfo.format;\n } else {\n formatFn = (record: any) => record[fieldId];\n }\n\n this.formatFnCache.set(fieldId, formatFn);\n return formatFn;\n }\n\n private getRecords(table: ListTable | PivotTable, original: boolean): any[] {\n if (original === true) {\n return table.internalProps.records;\n }\n\n const records = [];\n const stack = [...table.internalProps.dataSource.records];\n while (stack.length > 0) {\n const item = stack.pop();\n\n if (item?.vtableMerge && Array.isArray(item?.children)) {\n for (let i = item.children.length - 1; i >= 0; i--) {\n stack.push(item.children[i]);\n }\n } else {\n records.push(item);\n }\n }\n\n return records.reverse();\n }\n\n /**\n * 为未应用筛选的列,收集候选值集合\n */\n private collectCandidateKeysForUnfilteredColumn(fieldId: string | number): void {\n const syncFilterItemsState = this.pluginOptions?.syncFilterItemsState ?? true;\n const countMap = new Map<any, number>(); // 计算每个候选值的计数\n let records = [];\n // 如果各个筛选器之间不联动, 则永远从原数据中获取候选值\n if (!syncFilterItemsState) {\n records = this.table.internalProps.records;\n } else {\n records = this.getRecords(this.table, false); // 未筛选:使用当前表格数据\n }\n\n const formatFn = this.getFormatFnCache(fieldId);\n const toUnformatted = new Map();\n\n records.forEach(record => {\n // 空行不做处理\n if (isValid(record)) {\n const originalValue = record[fieldId];\n const formattedValue = formatFn(record) ?? '(空白)';\n if (formattedValue !== undefined && formattedValue !== null) {\n countMap.set(formattedValue, (countMap.get(formattedValue) || 0) + 1);\n\n const unformattedSet = toUnformatted.get(formattedValue);\n if (unformattedSet !== undefined && unformattedSet !== null) {\n unformattedSet.add(originalValue);\n } else {\n toUnformatted.set(formattedValue, new Set([originalValue]));\n }\n }\n }\n });\n\n this.candidateKeys.set(fieldId, countMap);\n this.toUnformattedCache.set(fieldId, toUnformatted);\n }\n\n /**\n * 为已应用筛选的列,收集候选值集合\n */\n private collectCandidateKeysForFilteredColumn(candidateField: string | number): void {\n const syncFilterItemsState = this.pluginOptions?.syncFilterItemsState ?? true;\n const filteredFields = this.filterStateManager.getActiveFilterFields().filter(field => field !== candidateField);\n const toUnformatted = new Map();\n const formatFn = this.getFormatFnCache(candidateField);\n\n const countMap = new Map<any, number>(); // 计算每个候选值的计数\n let records = [];\n // 如果各个筛选器之间不联动, 则永远从原数据中获取候选值\n if (!syncFilterItemsState) {\n records = this.table.internalProps.records;\n } else {\n const recordsList = this.getRecords(this.table, true); // 已筛选:使用原始表格数据\n records = recordsList.filter(record =>\n filteredFields.every(field => {\n const filterType = this.filterStateManager.getFilterState(field)?.type;\n if (filterType !== 'byValue' && filterType !== null && filterType !== undefined) {\n this.syncSingleStateFromTableData(field);\n }\n const set = this.selectedKeys.get(field);\n return set.has(record[field]);\n })\n );\n }\n\n records.forEach(record => {\n // 空行不做处理\n if (isValid(record)) {\n const originalValue = record[candidateField];\n const formattedValue = formatFn(record) ?? '(空白)';\n countMap.set(formattedValue, (countMap.get(formattedValue) || 0) + 1);\n if (formattedValue !== undefined && formattedValue !== null) {\n const unformattedSet = toUnformatted.get(formattedValue);\n if (unformattedSet !== undefined && unformattedSet !== null) {\n unformattedSet.add(originalValue);\n } else {\n toUnformatted.set(formattedValue, new Set([originalValue]));\n }\n }\n }\n });\n\n this.candidateKeys.set(candidateField, countMap);\n this.toUnformattedCache.set(candidateField, toUnformatted);\n }\n\n private toggleSelectAll(fieldId: string | number, selected: boolean): void {\n const options = this.valueFilterOptionList.get(fieldId) || [];\n options.forEach(option => {\n if (option.itemContainer.style.display !== 'none') {\n option.checkbox.checked = selected;\n }\n });\n }\n\n private syncSelectAllCheckbox(fieldId: string | number): void {\n const options = this.valueFilterOptionList.get(fieldId) || [];\n const allChecked = options.every(o => o.checkbox.checked);\n const noneChecked = options.every(o => !o.checkbox.checked);\n\n this.selectAllCheckbox.checked = allChecked;\n this.selectAllCheckbox.indeterminate = !allChecked && !noneChecked;\n }\n\n private onSearch(fieldId: string | number, value: string): void {\n // 更新UI显示\n const items = this.valueFilterOptionList.get(fieldId) || [];\n const filterKeywords = value\n .toUpperCase()\n .split(' ')\n .filter(s => s);\n\n for (const item of items) {\n const txtValue = item.id.toUpperCase() || '';\n const match = filterKeywords.some(keyword => txtValue.includes(keyword));\n const isVisible = filterKeywords.length === 0 || match;\n\n item.itemContainer.style.display = isVisible ? 'flex' : 'none';\n }\n }\n\n /**\n * 根据当前表格中的数据,更新 filter 的被选状态\n * 适用情况:表格数据发生变化,或者需要自动检测当前表格的数据情况\n */\n syncSingleStateFromTableData(fieldId: string | number): void {\n const originalValues = new Set<any>();\n const originalRecords = this.table.internalProps.records; // 原始数据\n originalRecords.forEach(record => {\n if (isValid(record)) {\n originalValues.add(record[fieldId]);\n }\n });\n\n const current = this.filterStateManager.getFilterState(fieldId);\n if (current?.type === 'byValue' && Array.isArray(current.values)) {\n this.selectedKeys.set(fieldId, new Set(current.values));\n return;\n }\n\n if (current?.type === 'byCondition' && current.enable) {\n const visibleValues = new Set<any>();\n const visibleRecords = this.getRecords(this.table, false);\n visibleRecords.forEach(record => {\n if (isValid(record)) {\n visibleValues.add(record[fieldId]);\n }\n });\n this.selectedKeys.set(fieldId, visibleValues);\n return;\n }\n\n this.selectedKeys.set(fieldId, originalValues);\n }\n\n applyFilter(fieldId: string | number = this.selectedField): void {\n const options = this.valueFilterOptionList.get(fieldId);\n if (!options || options.length === 0) {\n return;\n }\n\n const selections = options\n .map(option => {\n if (option.checkbox.checked) {\n return option.originalValue;\n }\n return null;\n })\n .filter(key => key !== null)\n .flat();\n\n this.selectedKeys.set(fieldId, new Set(selections));\n\n const syncFilterItemsState = this.pluginOptions?.syncFilterItemsState ?? true;\n\n if (\n (selections.length >= 0 && selections.length < this.valueFilterOptionList.get(fieldId).length) ||\n !syncFilterItemsState\n ) {\n this.filterStateManager.dispatch({\n type: FilterActionType.APPLY_FILTERS,\n payload: {\n field: fieldId,\n type: 'byValue',\n values: selections,\n enable: true,\n shouldKeepUnrelatedState: !syncFilterItemsState\n }\n });\n } else {\n this.filterStateManager.dispatch({\n type: FilterActionType.REMOVE_FILTER,\n payload: {\n field: fieldId,\n type: 'byValue'\n }\n });\n }\n }\n\n clearFilter(fieldId: string | number): void {\n this.filterStateManager.dispatch({\n type: FilterActionType.REMOVE_FILTER,\n payload: {\n field: fieldId\n }\n });\n\n this.hide();\n }\n\n render(container: HTMLElement): void {\n const filterStyles = this.styles;\n // === 按值筛选的菜单内容 ===\n this.filterByValuePanel = document.createElement('div');\n applyStyles(this.filterByValuePanel, filterStyles.filterPanel);\n\n // -- 搜索栏 ---\n this.searchContainer = document.createElement('div');\n applyStyles(this.searchContainer, this.styles.searchContainer);\n\n this.filterByValueSearchInput = document.createElement('input');\n this.filterByValueSearchInput.type = 'text';\n this.filterByValueSearchInput.placeholder = filterStyles.searchInput?.placeholder || '可使用空格分隔多个关键词';\n applyStyles(this.filterByValueSearchInput, filterStyles.searchInput);\n\n this.searchContainer.appendChild(this.filterByValueSearchInput);\n\n // --- 筛选选项 ---\n this.optionsContainer = document.createElement('div');\n applyStyles(this.optionsContainer, this.styles.optionsContainer);\n\n this.selectAllItemDiv = document.createElement('div');\n applyStyles(this.selectAllItemDiv, this.styles.optionItem);\n\n this.selectAllLabel = document.createElement('label');\n applyStyles(this.selectAllLabel, this.styles.optionLabel);\n\n this.selectAllCheckbox = document.createElement('input');\n this.selectAllCheckbox.type = 'checkbox';\n this.selectAllCheckbox.checked = true; // 默认全选\n applyStyles(this.selectAllCheckbox, filterStyles.checkbox);\n\n this.totalCountSpan = document.createElement('span');\n this.totalCountSpan.textContent = '';\n applyStyles(this.totalCountSpan, filterStyles.countSpan);\n\n this.selectAllLabel.append(this.selectAllCheckbox, ' 全选');\n this.selectAllItemDiv.appendChild(this.selectAllLabel);\n\n this.filterItemsContainer = document.createElement('div'); // 筛选条目的容器,后续应动态 appendChild\n\n this.optionsContainer.append(this.selectAllItemDiv, this.filterItemsContainer);\n this.filterByValuePanel.append(this.searchContainer, this.optionsContainer);\n\n container.appendChild(this.filterByValuePanel);\n\n this.bindEventForFilterByValue();\n }\n\n updateStyles(styles: FilterStyles): void {\n applyStyles(this.filterByValuePanel, styles.filterPanel);\n applyStyles(this.searchContainer, styles.searchContainer);\n this.filterByValueSearchInput.placeholder = styles.searchInput?.placeholder || '可使用空格分隔多个关键词';\n applyStyles(this.filterByValueSearchInput, styles.searchInput);\n applyStyles(this.optionsContainer, styles.optionsContainer);\n applyStyles(this.selectAllItemDiv, styles.optionItem);\n applyStyles(this.selectAllLabel, styles.optionLabel);\n applyStyles(this.selectAllCheckbox, styles.checkbox);\n }\n\n private renderFilterOptions(field: string | number): void {\n const filterStyles = this.styles;\n this.filterItemsContainer.innerHTML = '';\n this.valueFilterOptionList.delete(field);\n this.valueFilterOptionList.set(field, []);\n\n let totalCount = 0;\n let allChecked = true;\n let noneChecked = true;\n const selectedKeysSet = this.selectedKeys.get(field);\n const itemDomList: ValueFilterOptionDom[] = [];\n const isFiltered = this.filterStateManager.getFilterState(field)?.enable;\n const toUnformatted = this.toUnformattedCache.get(field);\n\n const candidates = this.candidateKeys.get(field);\n if (!candidates || candidates.size === 0) {\n return;\n }\n const candidatesArr = [...candidates.entries()] as [string, number][] | [number, number][];\n const sortedCandidatesArr =\n typeof candidatesArr[0][0] === 'number'\n ? [...candidatesArr]?.sort(([a], [b]) => Number(a) - Number(b))\n : [...candidatesArr]?.sort(([a], [b]) => String(a).localeCompare(String(b)));\n\n sortedCandidatesArr?.forEach(([val, count]) => {\n totalCount += count;\n const unformattedArr = Array.from(toUnformatted.get(val) || new Set());\n const itemDiv = document.createElement('div');\n applyStyles(itemDiv, filterStyles.optionItem);\n itemDiv.style.display = 'flex';\n\n const label = document.createElement('label');\n applyStyles(label, filterStyles.optionLabel);\n\n const checkbox = document.createElement('input');\n checkbox.type = 'checkbox';\n checkbox.value = String(val); // 显示值作为checkbox的value\n checkbox.checked = isFiltered ? unformattedArr.some(v => selectedKeysSet?.has(v)) : true;\n applyStyles(checkbox, filterStyles.checkbox);\n\n if (checkbox.checked) {\n noneChecked = false;\n } else {\n allChecked = false;\n }\n\n const countSpan = document.createElement('span');\n countSpan.textContent = String(count);\n applyStyles(countSpan, filterStyles.countSpan);\n\n label.append(checkbox, ` ${this.pluginOptions.checkboxItemFormat?.(val, unformattedArr) || val}`); // UI显示格式化值 或 用户二次加工的值\n itemDiv.append(label, countSpan);\n this.filterItemsContainer.appendChild(itemDiv);\n\n const itemDom: ValueFilterOptionDom = {\n id: String(val), // 显示值作为id,用于UI交互\n originalValue: unformattedArr,\n itemContainer: itemDiv,\n checkbox: checkbox,\n countSpan: countSpan\n };\n\n itemDomList.push(itemDom);\n });\n\n this.valueFilterOptionList.set(field, itemDomList);\n this.selectAllCheckbox.checked = allChecked;\n this.selectAllCheckbox.indeterminate = !allChecked && !noneChecked;\n this.totalCountSpan.textContent = String(totalCount);\n }\n\n private bindEventForFilterByValue(): void {\n this._onInputKeyUpHandler = (event: KeyboardEvent) => {\n const target = event.target as EventTarget;\n if (target instanceof HTMLInputElement && target.type === 'text') {\n const value = target.value;\n this.onSearch(this.selectedField, value);\n }\n };\n\n this._onCheckboxChangeHandler = (event: Event) => {\n const target = event.target as EventTarget;\n if (target instanceof HTMLInputElement && target.type === 'checkbox') {\n if (target === this.selectAllCheckbox) {\n this.toggleSelectAll(this.selectedField, this.selectAllCheckbox.checked);\n } else {\n this.syncSelectAllCheckbox(this.selectedField);\n }\n }\n };\n\n this.filterByValuePanel.addEventListener('keyup', this._onInputKeyUpHandler);\n this.filterByValuePanel.addEventListener('change', this._onCheckboxChangeHandler);\n }\n\n show(): void {\n // 1. 收集候选值列表(根据筛选状态选择数据源)\n const isFiltered = this.filterStateManager.getFilterState(this.selectedField)?.enable;\n if (!isFiltered) {\n this.collectCandidateKeysForUnfilteredColumn(this.selectedField);\n } else {\n this.collectCandidateKeysForFilteredColumn(this.selectedField);\n }\n\n // 2. 初始筛选状态\n const filterType = this.filterStateManager.getFilterState(this.selectedField)?.type;\n if (filterType !== null && filterType !== undefined && filterType !== 'byValue') {\n this.syncSingleStateFromTableData(this.selectedField);\n }\n\n // 3. 清空搜索框\n if (this.filterByValueSearchInput) {\n this.filterByValueSearchInput.value = '';\n }\n\n // 4. 渲染选项(此时状态已经初始化完成)\n this.renderFilterOptions(this.selectedField);\n this.filterByValuePanel.style.display = 'block';\n }\n\n hide(): void {\n this.filterByValuePanel.style.display = 'none';\n }\n\n clearSearchInputValue(): void {\n this.filterByValueSearchInput.value = '';\n }\n\n destroy(): void {\n if (this.filterByValuePanel) {\n if (this._onInputKeyUpHandler) {\n this.filterByValuePanel.removeEventListener('keyup', this._onInputKeyUpHandler);\n }\n if (this._onCheckboxChangeHandler) {\n this.filterByValuePanel.removeEventListener('change', this._onCheckboxChangeHandler);\n }\n }\n this._onInputKeyUpHandler = undefined as any;\n this._onCheckboxChangeHandler = undefined as any;\n\n if (this.filterByValuePanel) {\n const parent = this.filterByValuePanel.parentElement;\n if (parent) {\n parent.removeChild(this.filterByValuePanel);\n } else {\n // if not attached, ensure it's removed\n this.filterByValuePanel.remove();\n }\n }\n\n // clear DOM contents to release child references\n if (this.filterItemsContainer) {\n this.filterItemsContainer.innerHTML = '';\n }\n if (this.filterByValueSearchInput) {\n this.filterByValueSearchInput.value = '';\n }\n\n // Clear in-memory caches and collections to avoid unbounded growth\n this.selectedKeys && this.selectedKeys.clear();\n this.candidateKeys && this.candidateKeys.clear();\n this.formatFnCache && this.formatFnCache.clear();\n this.toUnformattedCache && this.toUnformattedCache.clear();\n this.valueFilterOptionList && this.valueFilterOptionList.clear();\n\n // Nullify references (use casts to avoid TS strict errors at assignment)\n (this.filterByValuePanel as any) = undefined;\n (this.filterByValueSearchInput as any) = undefined;\n (this.selectAllCheckbox as any) = undefined;\n (this.totalCountSpan as any) = undefined;\n (this.filterItemsContainer as any) = undefined;\n }\n}\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ListTable, PivotTable } from '@visactor/vtable';
|
|
2
|
+
import type { FilterOptions, FilterStyles } from './types';
|
|
3
|
+
import type { FilterStateManager } from './filter-state-manager';
|
|
4
|
+
export declare class ValueFilter {
|
|
5
|
+
private table;
|
|
6
|
+
private filterStateManager;
|
|
7
|
+
private pluginOptions;
|
|
8
|
+
private styles;
|
|
9
|
+
private selectedField;
|
|
10
|
+
private selectedKeys;
|
|
11
|
+
private candidateKeys;
|
|
12
|
+
private formatFnCache;
|
|
13
|
+
private toUnformattedCache;
|
|
14
|
+
private valueFilterOptionList;
|
|
15
|
+
private filterByValuePanel;
|
|
16
|
+
private searchContainer;
|
|
17
|
+
private optionsContainer;
|
|
18
|
+
private selectAllItemDiv;
|
|
19
|
+
private selectAllLabel;
|
|
20
|
+
private filterByValueSearchInput;
|
|
21
|
+
private selectAllCheckbox;
|
|
22
|
+
private totalCountSpan;
|
|
23
|
+
private filterItemsContainer;
|
|
24
|
+
private _onInputKeyUpHandler;
|
|
25
|
+
private _onCheckboxChangeHandler;
|
|
26
|
+
constructor(table: ListTable | PivotTable, filterStateManager: FilterStateManager, pluginOptions: FilterOptions);
|
|
27
|
+
setSelectedField(fieldId: string | number): void;
|
|
28
|
+
private getFormatFnCache;
|
|
29
|
+
private getRecords;
|
|
30
|
+
private collectCandidateKeysForUnfilteredColumn;
|
|
31
|
+
private collectCandidateKeysForFilteredColumn;
|
|
32
|
+
private toggleSelectAll;
|
|
33
|
+
private syncSelectAllCheckbox;
|
|
34
|
+
private onSearch;
|
|
35
|
+
syncSingleStateFromTableData(fieldId: string | number): void;
|
|
36
|
+
applyFilter(fieldId?: string | number): void;
|
|
37
|
+
clearFilter(fieldId: string | number): void;
|
|
38
|
+
render(container: HTMLElement): void;
|
|
39
|
+
updateStyles(styles: FilterStyles): void;
|
|
40
|
+
private renderFilterOptions;
|
|
41
|
+
private bindEventForFilterByValue;
|
|
42
|
+
show(): void;
|
|
43
|
+
hide(): void;
|
|
44
|
+
clearSearchInputValue(): void;
|
|
45
|
+
destroy(): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.ValueFilter = void 0;
|
|
6
|
+
|
|
7
|
+
const vutils_1 = require("@visactor/vutils"), types_1 = require("./types"), styles_1 = require("./styles");
|
|
8
|
+
|
|
9
|
+
class ValueFilter {
|
|
10
|
+
constructor(table, filterStateManager, pluginOptions) {
|
|
11
|
+
this.selectedKeys = new Map, this.candidateKeys = new Map, this.formatFnCache = new Map,
|
|
12
|
+
this.toUnformattedCache = new Map, this.valueFilterOptionList = new Map, this.table = table,
|
|
13
|
+
this.filterStateManager = filterStateManager, this.pluginOptions = pluginOptions,
|
|
14
|
+
this.styles = pluginOptions.styles || {};
|
|
15
|
+
}
|
|
16
|
+
setSelectedField(fieldId) {
|
|
17
|
+
this.selectedField = fieldId;
|
|
18
|
+
}
|
|
19
|
+
getFormatFnCache(fieldId) {
|
|
20
|
+
let formatFn = this.formatFnCache.get(fieldId);
|
|
21
|
+
if (null != formatFn) return formatFn;
|
|
22
|
+
const headerAddress = this.table.internalProps.layoutMap.getHeaderCellAddressByField(String(fieldId)), bodyInfo = this.table.internalProps.layoutMap.getBody(null == headerAddress ? void 0 : headerAddress.col, null == headerAddress ? void 0 : headerAddress.row);
|
|
23
|
+
return formatFn = bodyInfo && "fieldFormat" in bodyInfo && "function" == typeof bodyInfo.fieldFormat ? bodyInfo.fieldFormat : bodyInfo && "format" in bodyInfo && "function" == typeof bodyInfo.format ? bodyInfo.format : record => record[fieldId],
|
|
24
|
+
this.formatFnCache.set(fieldId, formatFn), formatFn;
|
|
25
|
+
}
|
|
26
|
+
getRecords(table, original) {
|
|
27
|
+
if (!0 === original) return table.internalProps.records;
|
|
28
|
+
const records = [], stack = [ ...table.internalProps.dataSource.records ];
|
|
29
|
+
for (;stack.length > 0; ) {
|
|
30
|
+
const item = stack.pop();
|
|
31
|
+
if ((null == item ? void 0 : item.vtableMerge) && Array.isArray(null == item ? void 0 : item.children)) for (let i = item.children.length - 1; i >= 0; i--) stack.push(item.children[i]); else records.push(item);
|
|
32
|
+
}
|
|
33
|
+
return records.reverse();
|
|
34
|
+
}
|
|
35
|
+
collectCandidateKeysForUnfilteredColumn(fieldId) {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
const syncFilterItemsState = null === (_b = null === (_a = this.pluginOptions) || void 0 === _a ? void 0 : _a.syncFilterItemsState) || void 0 === _b || _b, countMap = new Map;
|
|
38
|
+
let records = [];
|
|
39
|
+
records = syncFilterItemsState ? this.getRecords(this.table, !1) : this.table.internalProps.records;
|
|
40
|
+
const formatFn = this.getFormatFnCache(fieldId), toUnformatted = new Map;
|
|
41
|
+
records.forEach((record => {
|
|
42
|
+
var _a;
|
|
43
|
+
if ((0, vutils_1.isValid)(record)) {
|
|
44
|
+
const originalValue = record[fieldId], formattedValue = null !== (_a = formatFn(record)) && void 0 !== _a ? _a : "(空白)";
|
|
45
|
+
if (null != formattedValue) {
|
|
46
|
+
countMap.set(formattedValue, (countMap.get(formattedValue) || 0) + 1);
|
|
47
|
+
const unformattedSet = toUnformatted.get(formattedValue);
|
|
48
|
+
null != unformattedSet ? unformattedSet.add(originalValue) : toUnformatted.set(formattedValue, new Set([ originalValue ]));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})), this.candidateKeys.set(fieldId, countMap), this.toUnformattedCache.set(fieldId, toUnformatted);
|
|
52
|
+
}
|
|
53
|
+
collectCandidateKeysForFilteredColumn(candidateField) {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
const syncFilterItemsState = null === (_b = null === (_a = this.pluginOptions) || void 0 === _a ? void 0 : _a.syncFilterItemsState) || void 0 === _b || _b, filteredFields = this.filterStateManager.getActiveFilterFields().filter((field => field !== candidateField)), toUnformatted = new Map, formatFn = this.getFormatFnCache(candidateField), countMap = new Map;
|
|
56
|
+
let records = [];
|
|
57
|
+
if (syncFilterItemsState) {
|
|
58
|
+
records = this.getRecords(this.table, !0).filter((record => filteredFields.every((field => {
|
|
59
|
+
var _a;
|
|
60
|
+
const filterType = null === (_a = this.filterStateManager.getFilterState(field)) || void 0 === _a ? void 0 : _a.type;
|
|
61
|
+
"byValue" !== filterType && null != filterType && this.syncSingleStateFromTableData(field);
|
|
62
|
+
return this.selectedKeys.get(field).has(record[field]);
|
|
63
|
+
}))));
|
|
64
|
+
} else records = this.table.internalProps.records;
|
|
65
|
+
records.forEach((record => {
|
|
66
|
+
var _a;
|
|
67
|
+
if ((0, vutils_1.isValid)(record)) {
|
|
68
|
+
const originalValue = record[candidateField], formattedValue = null !== (_a = formatFn(record)) && void 0 !== _a ? _a : "(空白)";
|
|
69
|
+
if (countMap.set(formattedValue, (countMap.get(formattedValue) || 0) + 1), null != formattedValue) {
|
|
70
|
+
const unformattedSet = toUnformatted.get(formattedValue);
|
|
71
|
+
null != unformattedSet ? unformattedSet.add(originalValue) : toUnformatted.set(formattedValue, new Set([ originalValue ]));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
})), this.candidateKeys.set(candidateField, countMap), this.toUnformattedCache.set(candidateField, toUnformatted);
|
|
75
|
+
}
|
|
76
|
+
toggleSelectAll(fieldId, selected) {
|
|
77
|
+
this.valueFilterOptionList.get(fieldId).forEach((option => {
|
|
78
|
+
"none" !== option.itemContainer.style.display && (option.checkbox.checked = selected);
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
syncSelectAllCheckbox(fieldId) {
|
|
82
|
+
const options = this.valueFilterOptionList.get(fieldId) || [], allChecked = options.every((o => o.checkbox.checked)), noneChecked = options.every((o => !o.checkbox.checked));
|
|
83
|
+
this.selectAllCheckbox.checked = allChecked, this.selectAllCheckbox.indeterminate = !allChecked && !noneChecked;
|
|
84
|
+
}
|
|
85
|
+
onSearch(fieldId, value) {
|
|
86
|
+
const items = this.valueFilterOptionList.get(fieldId), filterKeywords = value.toUpperCase().split(" ").filter((s => s));
|
|
87
|
+
for (const item of items) {
|
|
88
|
+
const txtValue = item.id.toUpperCase() || "", match = filterKeywords.some((keyword => txtValue.includes(keyword))), isVisible = 0 === filterKeywords.length || match;
|
|
89
|
+
item.itemContainer.style.display = isVisible ? "flex" : "none";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
syncSingleStateFromTableData(fieldId) {
|
|
93
|
+
const originalValues = new Set;
|
|
94
|
+
this.table.internalProps.records.forEach((record => {
|
|
95
|
+
(0, vutils_1.isValid)(record) && originalValues.add(record[fieldId]);
|
|
96
|
+
}));
|
|
97
|
+
const current = this.filterStateManager.getFilterState(fieldId);
|
|
98
|
+
if ("byValue" === (null == current ? void 0 : current.type) && Array.isArray(current.values)) this.selectedKeys.set(fieldId, new Set(current.values)); else {
|
|
99
|
+
if ("byCondition" === (null == current ? void 0 : current.type) && current.enable) {
|
|
100
|
+
const visibleValues = new Set;
|
|
101
|
+
return this.getRecords(this.table, !1).forEach((record => {
|
|
102
|
+
(0, vutils_1.isValid)(record) && visibleValues.add(record[fieldId]);
|
|
103
|
+
})), void this.selectedKeys.set(fieldId, visibleValues);
|
|
104
|
+
}
|
|
105
|
+
this.selectedKeys.set(fieldId, originalValues);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
applyFilter(fieldId = this.selectedField) {
|
|
109
|
+
var _a, _b;
|
|
110
|
+
const options = this.valueFilterOptionList.get(fieldId);
|
|
111
|
+
if (!options || 0 === options.length) return;
|
|
112
|
+
const selections = options.map((option => option.checkbox.checked ? option.originalValue : null)).filter((key => null !== key)).flat();
|
|
113
|
+
this.selectedKeys.set(fieldId, new Set(selections));
|
|
114
|
+
const syncFilterItemsState = null === (_b = null === (_a = this.pluginOptions) || void 0 === _a ? void 0 : _a.syncFilterItemsState) || void 0 === _b || _b;
|
|
115
|
+
selections.length >= 0 && selections.length < this.valueFilterOptionList.get(fieldId).length || !syncFilterItemsState ? this.filterStateManager.dispatch({
|
|
116
|
+
type: types_1.FilterActionType.APPLY_FILTERS,
|
|
117
|
+
payload: {
|
|
118
|
+
field: fieldId,
|
|
119
|
+
type: "byValue",
|
|
120
|
+
values: selections,
|
|
121
|
+
enable: !0,
|
|
122
|
+
shouldKeepUnrelatedState: !syncFilterItemsState
|
|
123
|
+
}
|
|
124
|
+
}) : this.filterStateManager.dispatch({
|
|
125
|
+
type: types_1.FilterActionType.REMOVE_FILTER,
|
|
126
|
+
payload: {
|
|
127
|
+
field: fieldId,
|
|
128
|
+
type: "byValue"
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
clearFilter(fieldId) {
|
|
133
|
+
this.filterStateManager.dispatch({
|
|
134
|
+
type: types_1.FilterActionType.REMOVE_FILTER,
|
|
135
|
+
payload: {
|
|
136
|
+
field: fieldId
|
|
137
|
+
}
|
|
138
|
+
}), this.hide();
|
|
139
|
+
}
|
|
140
|
+
render(container) {
|
|
141
|
+
var _a;
|
|
142
|
+
const filterStyles = this.styles;
|
|
143
|
+
this.filterByValuePanel = document.createElement("div"), (0, styles_1.applyStyles)(this.filterByValuePanel, filterStyles.filterPanel),
|
|
144
|
+
this.searchContainer = document.createElement("div"), (0, styles_1.applyStyles)(this.searchContainer, this.styles.searchContainer),
|
|
145
|
+
this.filterByValueSearchInput = document.createElement("input"), this.filterByValueSearchInput.type = "text",
|
|
146
|
+
this.filterByValueSearchInput.placeholder = (null === (_a = filterStyles.searchInput) || void 0 === _a ? void 0 : _a.placeholder) || "可使用空格分隔多个关键词",
|
|
147
|
+
(0, styles_1.applyStyles)(this.filterByValueSearchInput, filterStyles.searchInput),
|
|
148
|
+
this.searchContainer.appendChild(this.filterByValueSearchInput), this.optionsContainer = document.createElement("div"),
|
|
149
|
+
(0, styles_1.applyStyles)(this.optionsContainer, this.styles.optionsContainer),
|
|
150
|
+
this.selectAllItemDiv = document.createElement("div"), (0, styles_1.applyStyles)(this.selectAllItemDiv, this.styles.optionItem),
|
|
151
|
+
this.selectAllLabel = document.createElement("label"), (0, styles_1.applyStyles)(this.selectAllLabel, this.styles.optionLabel),
|
|
152
|
+
this.selectAllCheckbox = document.createElement("input"), this.selectAllCheckbox.type = "checkbox",
|
|
153
|
+
this.selectAllCheckbox.checked = !0, (0, styles_1.applyStyles)(this.selectAllCheckbox, filterStyles.checkbox),
|
|
154
|
+
this.totalCountSpan = document.createElement("span"), this.totalCountSpan.textContent = "",
|
|
155
|
+
(0, styles_1.applyStyles)(this.totalCountSpan, filterStyles.countSpan), this.selectAllLabel.append(this.selectAllCheckbox, " 全选"),
|
|
156
|
+
this.selectAllItemDiv.appendChild(this.selectAllLabel), this.filterItemsContainer = document.createElement("div"),
|
|
157
|
+
this.optionsContainer.append(this.selectAllItemDiv, this.filterItemsContainer),
|
|
158
|
+
this.filterByValuePanel.append(this.searchContainer, this.optionsContainer), container.appendChild(this.filterByValuePanel),
|
|
159
|
+
this.bindEventForFilterByValue();
|
|
160
|
+
}
|
|
161
|
+
updateStyles(styles) {
|
|
162
|
+
var _a;
|
|
163
|
+
(0, styles_1.applyStyles)(this.filterByValuePanel, styles.filterPanel), (0, styles_1.applyStyles)(this.searchContainer, styles.searchContainer),
|
|
164
|
+
this.filterByValueSearchInput.placeholder = (null === (_a = styles.searchInput) || void 0 === _a ? void 0 : _a.placeholder) || "可使用空格分隔多个关键词",
|
|
165
|
+
(0, styles_1.applyStyles)(this.filterByValueSearchInput, styles.searchInput), (0,
|
|
166
|
+
styles_1.applyStyles)(this.optionsContainer, styles.optionsContainer), (0, styles_1.applyStyles)(this.selectAllItemDiv, styles.optionItem),
|
|
167
|
+
(0, styles_1.applyStyles)(this.selectAllLabel, styles.optionLabel), (0, styles_1.applyStyles)(this.selectAllCheckbox, styles.checkbox);
|
|
168
|
+
}
|
|
169
|
+
renderFilterOptions(field) {
|
|
170
|
+
var _a, _b, _c;
|
|
171
|
+
const filterStyles = this.styles;
|
|
172
|
+
this.filterItemsContainer.innerHTML = "", this.valueFilterOptionList.delete(field),
|
|
173
|
+
this.valueFilterOptionList.set(field, []);
|
|
174
|
+
let totalCount = 0, allChecked = !0, noneChecked = !0;
|
|
175
|
+
const selectedKeysSet = this.selectedKeys.get(field), itemDomList = [], isFiltered = null === (_a = this.filterStateManager.getFilterState(field)) || void 0 === _a ? void 0 : _a.enable, toUnformatted = this.toUnformattedCache.get(field), candidates = this.candidateKeys.get(field);
|
|
176
|
+
if (!candidates || 0 === candidates.size) return;
|
|
177
|
+
const candidatesArr = [ ...candidates.entries() ], sortedCandidatesArr = "number" == typeof candidatesArr[0][0] ? null === (_b = [ ...candidatesArr ]) || void 0 === _b ? void 0 : _b.sort((([a], [b]) => Number(a) - Number(b))) : null === (_c = [ ...candidatesArr ]) || void 0 === _c ? void 0 : _c.sort((([a], [b]) => String(a).localeCompare(String(b))));
|
|
178
|
+
null == sortedCandidatesArr || sortedCandidatesArr.forEach((([val, count]) => {
|
|
179
|
+
var _a, _b;
|
|
180
|
+
totalCount += count;
|
|
181
|
+
const unformattedArr = Array.from(toUnformatted.get(val) || new Set), itemDiv = document.createElement("div");
|
|
182
|
+
(0, styles_1.applyStyles)(itemDiv, filterStyles.optionItem), itemDiv.style.display = "flex";
|
|
183
|
+
const label = document.createElement("label");
|
|
184
|
+
(0, styles_1.applyStyles)(label, filterStyles.optionLabel);
|
|
185
|
+
const checkbox = document.createElement("input");
|
|
186
|
+
checkbox.type = "checkbox", checkbox.value = String(val), checkbox.checked = !isFiltered || unformattedArr.some((v => null == selectedKeysSet ? void 0 : selectedKeysSet.has(v))),
|
|
187
|
+
(0, styles_1.applyStyles)(checkbox, filterStyles.checkbox), checkbox.checked ? noneChecked = !1 : allChecked = !1;
|
|
188
|
+
const countSpan = document.createElement("span");
|
|
189
|
+
countSpan.textContent = String(count), (0, styles_1.applyStyles)(countSpan, filterStyles.countSpan),
|
|
190
|
+
label.append(checkbox, ` ${(null === (_b = (_a = this.pluginOptions).checkboxItemFormat) || void 0 === _b ? void 0 : _b.call(_a, val, unformattedArr)) || val}`),
|
|
191
|
+
itemDiv.append(label, countSpan), this.filterItemsContainer.appendChild(itemDiv);
|
|
192
|
+
const itemDom = {
|
|
193
|
+
id: String(val),
|
|
194
|
+
originalValue: unformattedArr,
|
|
195
|
+
itemContainer: itemDiv,
|
|
196
|
+
checkbox: checkbox,
|
|
197
|
+
countSpan: countSpan
|
|
198
|
+
};
|
|
199
|
+
itemDomList.push(itemDom);
|
|
200
|
+
})), this.valueFilterOptionList.set(field, itemDomList), this.selectAllCheckbox.checked = allChecked,
|
|
201
|
+
this.selectAllCheckbox.indeterminate = !allChecked && !noneChecked, this.totalCountSpan.textContent = String(totalCount);
|
|
202
|
+
}
|
|
203
|
+
bindEventForFilterByValue() {
|
|
204
|
+
this._onInputKeyUpHandler = event => {
|
|
205
|
+
const target = event.target;
|
|
206
|
+
if (target instanceof HTMLInputElement && "text" === target.type) {
|
|
207
|
+
const value = target.value;
|
|
208
|
+
this.onSearch(this.selectedField, value);
|
|
209
|
+
}
|
|
210
|
+
}, this._onCheckboxChangeHandler = event => {
|
|
211
|
+
const target = event.target;
|
|
212
|
+
target instanceof HTMLInputElement && "checkbox" === target.type && (target === this.selectAllCheckbox ? this.toggleSelectAll(this.selectedField, this.selectAllCheckbox.checked) : this.syncSelectAllCheckbox(this.selectedField));
|
|
213
|
+
}, this.filterByValuePanel.addEventListener("keyup", this._onInputKeyUpHandler),
|
|
214
|
+
this.filterByValuePanel.addEventListener("change", this._onCheckboxChangeHandler);
|
|
215
|
+
}
|
|
216
|
+
show() {
|
|
217
|
+
var _a, _b;
|
|
218
|
+
(null === (_a = this.filterStateManager.getFilterState(this.selectedField)) || void 0 === _a ? void 0 : _a.enable) ? this.collectCandidateKeysForFilteredColumn(this.selectedField) : this.collectCandidateKeysForUnfilteredColumn(this.selectedField);
|
|
219
|
+
const filterType = null === (_b = this.filterStateManager.getFilterState(this.selectedField)) || void 0 === _b ? void 0 : _b.type;
|
|
220
|
+
null != filterType && "byValue" !== filterType && this.syncSingleStateFromTableData(this.selectedField),
|
|
221
|
+
this.filterByValueSearchInput && (this.filterByValueSearchInput.value = ""), this.renderFilterOptions(this.selectedField),
|
|
222
|
+
this.filterByValuePanel.style.display = "block";
|
|
223
|
+
}
|
|
224
|
+
hide() {
|
|
225
|
+
this.filterByValuePanel.style.display = "none";
|
|
226
|
+
}
|
|
227
|
+
clearSearchInputValue() {
|
|
228
|
+
this.filterByValueSearchInput.value = "";
|
|
229
|
+
}
|
|
230
|
+
destroy() {
|
|
231
|
+
if (this.filterByValuePanel && (this._onInputKeyUpHandler && this.filterByValuePanel.removeEventListener("keyup", this._onInputKeyUpHandler),
|
|
232
|
+
this._onCheckboxChangeHandler && this.filterByValuePanel.removeEventListener("change", this._onCheckboxChangeHandler)),
|
|
233
|
+
this._onInputKeyUpHandler = void 0, this._onCheckboxChangeHandler = void 0, this.filterByValuePanel) {
|
|
234
|
+
const parent = this.filterByValuePanel.parentElement;
|
|
235
|
+
parent ? parent.removeChild(this.filterByValuePanel) : this.filterByValuePanel.remove();
|
|
236
|
+
}
|
|
237
|
+
this.filterItemsContainer && (this.filterItemsContainer.innerHTML = ""), this.filterByValueSearchInput && (this.filterByValueSearchInput.value = ""),
|
|
238
|
+
this.selectedKeys && this.selectedKeys.clear(), this.candidateKeys && this.candidateKeys.clear(),
|
|
239
|
+
this.formatFnCache && this.formatFnCache.clear(), this.toUnformattedCache && this.toUnformattedCache.clear(),
|
|
240
|
+
this.valueFilterOptionList && this.valueFilterOptionList.clear(), this.filterByValuePanel = void 0,
|
|
241
|
+
this.filterByValueSearchInput = void 0, this.selectAllCheckbox = void 0, this.totalCountSpan = void 0,
|
|
242
|
+
this.filterItemsContainer = void 0;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
exports.ValueFilter = ValueFilter;
|
|
247
|
+
//# sourceMapping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YAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC;YACrD,IAAI,MAAM,EAAE;gBACV,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;aAC7C;iBAAM;gBAEL,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC;aAClC;SACF;QAGD,IAAI,IAAI,CAAC,oBAAoB,EAAE;YAC7B,IAAI,CAAC,oBAAoB,CAAC,SAAS,GAAG,EAAE,CAAC;SAC1C;QACD,IAAI,IAAI,CAAC,wBAAwB,EAAE;YACjC,IAAI,CAAC,wBAAwB,CAAC,KAAK,GAAG,EAAE,CAAC;SAC1C;QAGD,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;QAC/C,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QACjD,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QACjD,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;QAC3D,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;QAGhE,IAAI,CAAC,kBAA0B,GAAG,SAAS,CAAC;QAC5C,IAAI,CAAC,wBAAgC,GAAG,SAAS,CAAC;QAClD,IAAI,CAAC,iBAAyB,GAAG,SAAS,CAAC;QAC3C,IAAI,CAAC,cAAsB,GAAG,SAAS,CAAC;QACxC,IAAI,CAAC,oBAA4B,GAAG,SAAS,CAAC;IACjD,CAAC;CACF;AA5gBD,kCA4gBC","file":"value-filter.syncSingleStateFromTableData.backup.js","sourcesContent":["import type { ListTable, PivotTable } from '@visactor/vtable';\nimport { isValid } from '@visactor/vutils';\nimport type { ValueFilterOptionDom, FilterOptions, FilterStyles } from './types';\nimport { FilterActionType } from './types';\nimport type { FilterStateManager } from './filter-state-manager';\nimport { applyStyles } from './styles';\n\nexport class ValueFilter {\n private table: ListTable | PivotTable;\n private filterStateManager: FilterStateManager;\n private pluginOptions: FilterOptions;\n private styles: Record<any, any>;\n private selectedField: string | number;\n private selectedKeys = new Map<string | number, Set<string | number>>(); // 存储 format 之前的原始数据\n private candidateKeys = new Map<string | number, Map<string | number, number>>(); // 存储 format 后的数据\n private formatFnCache = new Map<string | number, (record: any) => string | number>();\n private toUnformattedCache = new Map<string | number, Map<any, Set<any>>>();\n\n private valueFilterOptionList: Map<string | number, ValueFilterOptionDom[]> = new Map();\n\n private filterByValuePanel: HTMLElement;\n private searchContainer: HTMLElement;\n private optionsContainer: HTMLElement;\n private selectAllItemDiv: HTMLElement;\n private selectAllLabel: HTMLElement;\n private filterByValueSearchInput: HTMLInputElement;\n private selectAllCheckbox: HTMLInputElement;\n private totalCountSpan: HTMLSpanElement;\n private filterItemsContainer: HTMLElement;\n\n private _onInputKeyUpHandler: (event: KeyboardEvent) => void;\n private _onCheckboxChangeHandler: (event: Event) => void;\n\n constructor(table: ListTable | PivotTable, filterStateManager: FilterStateManager, pluginOptions: FilterOptions) {\n this.table = table;\n this.filterStateManager = filterStateManager;\n this.pluginOptions = pluginOptions;\n this.styles = pluginOptions.styles || {};\n }\n\n setSelectedField(fieldId: string | number): void {\n this.selectedField = fieldId;\n }\n\n private getFormatFnCache(fieldId: string | number) {\n let formatFn = this.formatFnCache.get(fieldId);\n if (formatFn !== null && formatFn !== undefined) {\n return formatFn;\n }\n\n const headerAddress = this.table.internalProps.layoutMap.getHeaderCellAddressByField(String(fieldId));\n const bodyInfo = this.table.internalProps.layoutMap.getBody(headerAddress?.col, headerAddress?.row);\n if (bodyInfo && 'fieldFormat' in bodyInfo && typeof bodyInfo.fieldFormat === 'function') {\n formatFn = bodyInfo.fieldFormat;\n } else if (bodyInfo && 'format' in bodyInfo && typeof bodyInfo.format === 'function') {\n formatFn = bodyInfo.format;\n } else {\n formatFn = (record: any) => record[fieldId];\n }\n\n this.formatFnCache.set(fieldId, formatFn);\n return formatFn;\n }\n\n private getRecords(table: ListTable | PivotTable, original: boolean): any[] {\n if (original === true) {\n return table.internalProps.records;\n }\n\n const records = [];\n const stack = [...table.internalProps.dataSource.records];\n while (stack.length > 0) {\n const item = stack.pop();\n\n if (item?.vtableMerge && Array.isArray(item?.children)) {\n for (let i = item.children.length - 1; i >= 0; i--) {\n stack.push(item.children[i]);\n }\n } else {\n records.push(item);\n }\n }\n\n return records.reverse();\n }\n\n /**\n * 为未应用筛选的列,收集候选值集合\n */\n private collectCandidateKeysForUnfilteredColumn(fieldId: string | number): void {\n const syncFilterItemsState = this.pluginOptions?.syncFilterItemsState ?? true;\n const countMap = new Map<any, number>(); // 计算每个候选值的计数\n let records = [];\n // 如果各个筛选器之间不联动, 则永远从原数据中获取候选值\n if (!syncFilterItemsState) {\n records = this.table.internalProps.records;\n } else {\n records = this.getRecords(this.table, false); // 未筛选:使用当前表格数据\n }\n\n const formatFn = this.getFormatFnCache(fieldId);\n const toUnformatted = new Map();\n\n records.forEach(record => {\n // 空行不做处理\n if (isValid(record)) {\n const originalValue = record[fieldId];\n const formattedValue = formatFn(record) ?? '(空白)';\n if (formattedValue !== undefined && formattedValue !== null) {\n countMap.set(formattedValue, (countMap.get(formattedValue) || 0) + 1);\n\n const unformattedSet = toUnformatted.get(formattedValue);\n if (unformattedSet !== undefined && unformattedSet !== null) {\n unformattedSet.add(originalValue);\n } else {\n toUnformatted.set(formattedValue, new Set([originalValue]));\n }\n }\n }\n });\n\n this.candidateKeys.set(fieldId, countMap);\n this.toUnformattedCache.set(fieldId, toUnformatted);\n }\n\n /**\n * 为已应用筛选的列,收集候选值集合\n */\n private collectCandidateKeysForFilteredColumn(candidateField: string | number): void {\n const syncFilterItemsState = this.pluginOptions?.syncFilterItemsState ?? true;\n const filteredFields = this.filterStateManager.getActiveFilterFields().filter(field => field !== candidateField);\n const toUnformatted = new Map();\n const formatFn = this.getFormatFnCache(candidateField);\n\n const countMap = new Map<any, number>(); // 计算每个候选值的计数\n let records = [];\n // 如果各个筛选器之间不联动, 则永远从原数据中获取候选值\n if (!syncFilterItemsState) {\n records = this.table.internalProps.records;\n } else {\n const recordsList = this.getRecords(this.table, true); // 已筛选:使用原始表格数据\n records = recordsList.filter(record =>\n filteredFields.every(field => {\n const filterType = this.filterStateManager.getFilterState(field)?.type;\n if (filterType !== 'byValue' && filterType !== null && filterType !== undefined) {\n this.syncSingleStateFromTableData(field);\n }\n const set = this.selectedKeys.get(field);\n return set.has(record[field]);\n })\n );\n }\n\n records.forEach(record => {\n // 空行不做处理\n if (isValid(record)) {\n const originalValue = record[candidateField];\n const formattedValue = formatFn(record) ?? '(空白)';\n countMap.set(formattedValue, (countMap.get(formattedValue) || 0) + 1);\n if (formattedValue !== undefined && formattedValue !== null) {\n const unformattedSet = toUnformatted.get(formattedValue);\n if (unformattedSet !== undefined && unformattedSet !== null) {\n unformattedSet.add(originalValue);\n } else {\n toUnformatted.set(formattedValue, new Set([originalValue]));\n }\n }\n }\n });\n\n this.candidateKeys.set(candidateField, countMap);\n this.toUnformattedCache.set(candidateField, toUnformatted);\n }\n\n private toggleSelectAll(fieldId: string | number, selected: boolean): void {\n const options = this.valueFilterOptionList.get(fieldId);\n options.forEach(option => {\n if (option.itemContainer.style.display !== 'none') {\n option.checkbox.checked = selected;\n }\n });\n }\n\n private syncSelectAllCheckbox(fieldId: string | number): void {\n const options = this.valueFilterOptionList.get(fieldId) || [];\n const allChecked = options.every(o => o.checkbox.checked);\n const noneChecked = options.every(o => !o.checkbox.checked);\n\n this.selectAllCheckbox.checked = allChecked;\n this.selectAllCheckbox.indeterminate = !allChecked && !noneChecked;\n }\n\n private onSearch(fieldId: string | number, value: string): void {\n // 更新UI显示\n const items = this.valueFilterOptionList.get(fieldId);\n const filterKeywords = value\n .toUpperCase()\n .split(' ')\n .filter(s => s);\n\n for (const item of items) {\n const txtValue = item.id.toUpperCase() || '';\n const match = filterKeywords.some(keyword => txtValue.includes(keyword));\n const isVisible = filterKeywords.length === 0 || match;\n\n item.itemContainer.style.display = isVisible ? 'flex' : 'none';\n }\n }\n\n /**\n * 根据当前表格中的数据,更新 filter 的被选状态\n * 适用情况:表格数据发生变化,或者需要自动检测当前表格的数据情况\n */\n syncSingleStateFromTableData(fieldId: string | number): void {\n const originalValues = new Set<any>();\n const originalRecords = this.table.internalProps.records; // 原始数据\n originalRecords.forEach(record => {\n if (isValid(record)) {\n originalValues.add(record[fieldId]);\n }\n });\n\n const current = this.filterStateManager.getFilterState(fieldId);\n if (current?.type === 'byValue' && Array.isArray(current.values)) {\n this.selectedKeys.set(fieldId, new Set(current.values));\n return;\n }\n\n if (current?.type === 'byCondition' && current.enable) {\n const visibleValues = new Set<any>();\n const visibleRecords = this.getRecords(this.table, false);\n visibleRecords.forEach(record => {\n if (isValid(record)) {\n visibleValues.add(record[fieldId]);\n }\n });\n this.selectedKeys.set(fieldId, visibleValues);\n return;\n }\n\n this.selectedKeys.set(fieldId, originalValues);\n }\n\n applyFilter(fieldId: string | number = this.selectedField): void {\n const options = this.valueFilterOptionList.get(fieldId);\n if (!options || options.length === 0) {\n return;\n }\n\n const selections = options\n .map(option => {\n if (option.checkbox.checked) {\n return option.originalValue;\n }\n return null;\n })\n .filter(key => key !== null)\n .flat();\n\n this.selectedKeys.set(fieldId, new Set(selections));\n\n const syncFilterItemsState = this.pluginOptions?.syncFilterItemsState ?? true;\n\n if (\n (selections.length >= 0 && selections.length < this.valueFilterOptionList.get(fieldId).length) ||\n !syncFilterItemsState\n ) {\n this.filterStateManager.dispatch({\n type: FilterActionType.APPLY_FILTERS,\n payload: {\n field: fieldId,\n type: 'byValue',\n values: selections,\n enable: true,\n shouldKeepUnrelatedState: !syncFilterItemsState\n }\n });\n } else {\n this.filterStateManager.dispatch({\n type: FilterActionType.REMOVE_FILTER,\n payload: {\n field: fieldId,\n type: 'byValue'\n }\n });\n }\n }\n\n clearFilter(fieldId: string | number): void {\n this.filterStateManager.dispatch({\n type: FilterActionType.REMOVE_FILTER,\n payload: {\n field: fieldId\n }\n });\n\n this.hide();\n }\n\n render(container: HTMLElement): void {\n const filterStyles = this.styles;\n // === 按值筛选的菜单内容 ===\n this.filterByValuePanel = document.createElement('div');\n applyStyles(this.filterByValuePanel, filterStyles.filterPanel);\n\n // -- 搜索栏 ---\n this.searchContainer = document.createElement('div');\n applyStyles(this.searchContainer, this.styles.searchContainer);\n\n this.filterByValueSearchInput = document.createElement('input');\n this.filterByValueSearchInput.type = 'text';\n this.filterByValueSearchInput.placeholder = filterStyles.searchInput?.placeholder || '可使用空格分隔多个关键词';\n applyStyles(this.filterByValueSearchInput, filterStyles.searchInput);\n\n this.searchContainer.appendChild(this.filterByValueSearchInput);\n\n // --- 筛选选项 ---\n this.optionsContainer = document.createElement('div');\n applyStyles(this.optionsContainer, this.styles.optionsContainer);\n\n this.selectAllItemDiv = document.createElement('div');\n applyStyles(this.selectAllItemDiv, this.styles.optionItem);\n\n this.selectAllLabel = document.createElement('label');\n applyStyles(this.selectAllLabel, this.styles.optionLabel);\n\n this.selectAllCheckbox = document.createElement('input');\n this.selectAllCheckbox.type = 'checkbox';\n this.selectAllCheckbox.checked = true; // 默认全选\n applyStyles(this.selectAllCheckbox, filterStyles.checkbox);\n\n this.totalCountSpan = document.createElement('span');\n this.totalCountSpan.textContent = '';\n applyStyles(this.totalCountSpan, filterStyles.countSpan);\n\n this.selectAllLabel.append(this.selectAllCheckbox, ' 全选');\n this.selectAllItemDiv.appendChild(this.selectAllLabel);\n\n this.filterItemsContainer = document.createElement('div'); // 筛选条目的容器,后续应动态 appendChild\n\n this.optionsContainer.append(this.selectAllItemDiv, this.filterItemsContainer);\n this.filterByValuePanel.append(this.searchContainer, this.optionsContainer);\n\n container.appendChild(this.filterByValuePanel);\n\n this.bindEventForFilterByValue();\n }\n\n updateStyles(styles: FilterStyles): void {\n applyStyles(this.filterByValuePanel, styles.filterPanel);\n applyStyles(this.searchContainer, styles.searchContainer);\n this.filterByValueSearchInput.placeholder = styles.searchInput?.placeholder || '可使用空格分隔多个关键词';\n applyStyles(this.filterByValueSearchInput, styles.searchInput);\n applyStyles(this.optionsContainer, styles.optionsContainer);\n applyStyles(this.selectAllItemDiv, styles.optionItem);\n applyStyles(this.selectAllLabel, styles.optionLabel);\n applyStyles(this.selectAllCheckbox, styles.checkbox);\n }\n\n private renderFilterOptions(field: string | number): void {\n const filterStyles = this.styles;\n this.filterItemsContainer.innerHTML = '';\n this.valueFilterOptionList.delete(field);\n this.valueFilterOptionList.set(field, []);\n\n let totalCount = 0;\n let allChecked = true;\n let noneChecked = true;\n const selectedKeysSet = this.selectedKeys.get(field);\n const itemDomList: ValueFilterOptionDom[] = [];\n const isFiltered = this.filterStateManager.getFilterState(field)?.enable;\n const toUnformatted = this.toUnformattedCache.get(field);\n\n const candidates = this.candidateKeys.get(field);\n if (!candidates || candidates.size === 0) {\n return;\n }\n const candidatesArr = [...candidates.entries()] as [string, number][] | [number, number][];\n const sortedCandidatesArr =\n typeof candidatesArr[0][0] === 'number'\n ? [...candidatesArr]?.sort(([a], [b]) => Number(a) - Number(b))\n : [...candidatesArr]?.sort(([a], [b]) => String(a).localeCompare(String(b)));\n\n sortedCandidatesArr?.forEach(([val, count]) => {\n totalCount += count;\n const unformattedArr = Array.from(toUnformatted.get(val) || new Set());\n const itemDiv = document.createElement('div');\n applyStyles(itemDiv, filterStyles.optionItem);\n itemDiv.style.display = 'flex';\n\n const label = document.createElement('label');\n applyStyles(label, filterStyles.optionLabel);\n\n const checkbox = document.createElement('input');\n checkbox.type = 'checkbox';\n checkbox.value = String(val); // 显示值作为checkbox的value\n checkbox.checked = isFiltered ? unformattedArr.some(v => selectedKeysSet?.has(v)) : true;\n applyStyles(checkbox, filterStyles.checkbox);\n\n if (checkbox.checked) {\n noneChecked = false;\n } else {\n allChecked = false;\n }\n\n const countSpan = document.createElement('span');\n countSpan.textContent = String(count);\n applyStyles(countSpan, filterStyles.countSpan);\n\n label.append(checkbox, ` ${this.pluginOptions.checkboxItemFormat?.(val, unformattedArr) || val}`); // UI显示格式化值 或 用户二次加工的值\n itemDiv.append(label, countSpan);\n this.filterItemsContainer.appendChild(itemDiv);\n\n const itemDom: ValueFilterOptionDom = {\n id: String(val), // 显示值作为id,用于UI交互\n originalValue: unformattedArr,\n itemContainer: itemDiv,\n checkbox: checkbox,\n countSpan: countSpan\n };\n\n itemDomList.push(itemDom);\n });\n\n this.valueFilterOptionList.set(field, itemDomList);\n this.selectAllCheckbox.checked = allChecked;\n this.selectAllCheckbox.indeterminate = !allChecked && !noneChecked;\n this.totalCountSpan.textContent = String(totalCount);\n }\n\n private bindEventForFilterByValue(): void {\n this._onInputKeyUpHandler = (event: KeyboardEvent) => {\n const target = event.target as EventTarget;\n if (target instanceof HTMLInputElement && target.type === 'text') {\n const value = target.value;\n this.onSearch(this.selectedField, value);\n }\n };\n\n this._onCheckboxChangeHandler = (event: Event) => {\n const target = event.target as EventTarget;\n if (target instanceof HTMLInputElement && target.type === 'checkbox') {\n if (target === this.selectAllCheckbox) {\n this.toggleSelectAll(this.selectedField, this.selectAllCheckbox.checked);\n } else {\n this.syncSelectAllCheckbox(this.selectedField);\n }\n }\n };\n\n this.filterByValuePanel.addEventListener('keyup', this._onInputKeyUpHandler);\n this.filterByValuePanel.addEventListener('change', this._onCheckboxChangeHandler);\n }\n\n show(): void {\n // 1. 收集候选值列表(根据筛选状态选择数据源)\n const isFiltered = this.filterStateManager.getFilterState(this.selectedField)?.enable;\n if (!isFiltered) {\n this.collectCandidateKeysForUnfilteredColumn(this.selectedField);\n } else {\n this.collectCandidateKeysForFilteredColumn(this.selectedField);\n }\n\n // 2. 初始筛选状态\n const filterType = this.filterStateManager.getFilterState(this.selectedField)?.type;\n if (filterType !== null && filterType !== undefined && filterType !== 'byValue') {\n this.syncSingleStateFromTableData(this.selectedField);\n }\n\n // 3. 清空搜索框\n if (this.filterByValueSearchInput) {\n this.filterByValueSearchInput.value = '';\n }\n\n // 4. 渲染选项(此时状态已经初始化完成)\n this.renderFilterOptions(this.selectedField);\n this.filterByValuePanel.style.display = 'block';\n }\n\n hide(): void {\n this.filterByValuePanel.style.display = 'none';\n }\n\n clearSearchInputValue(): void {\n this.filterByValueSearchInput.value = '';\n }\n\n destroy(): void {\n if (this.filterByValuePanel) {\n if (this._onInputKeyUpHandler) {\n this.filterByValuePanel.removeEventListener('keyup', this._onInputKeyUpHandler);\n }\n if (this._onCheckboxChangeHandler) {\n this.filterByValuePanel.removeEventListener('change', this._onCheckboxChangeHandler);\n }\n }\n this._onInputKeyUpHandler = undefined as any;\n this._onCheckboxChangeHandler = undefined as any;\n\n if (this.filterByValuePanel) {\n const parent = this.filterByValuePanel.parentElement;\n if (parent) {\n parent.removeChild(this.filterByValuePanel);\n } else {\n // if not attached, ensure it's removed\n this.filterByValuePanel.remove();\n }\n }\n\n // clear DOM contents to release child references\n if (this.filterItemsContainer) {\n this.filterItemsContainer.innerHTML = '';\n }\n if (this.filterByValueSearchInput) {\n this.filterByValueSearchInput.value = '';\n }\n\n // Clear in-memory caches and collections to avoid unbounded growth\n this.selectedKeys && this.selectedKeys.clear();\n this.candidateKeys && this.candidateKeys.clear();\n this.formatFnCache && this.formatFnCache.clear();\n this.toUnformattedCache && this.toUnformattedCache.clear();\n this.valueFilterOptionList && this.valueFilterOptionList.clear();\n\n // Nullify references (use casts to avoid TS strict errors at assignment)\n (this.filterByValuePanel as any) = undefined;\n (this.filterByValueSearchInput as any) = undefined;\n (this.selectAllCheckbox as any) = undefined;\n (this.totalCountSpan as any) = undefined;\n (this.filterItemsContainer as any) = undefined;\n }\n}\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ListTable } from '@visactor/vtable';
|
|
2
|
+
export declare function makeCellKey(sheetKey: string, row: number, col: number): string;
|
|
3
|
+
export declare function parseA1Notation(a1: string): {
|
|
4
|
+
row: number;
|
|
5
|
+
col: number;
|
|
6
|
+
} | null;
|
|
7
|
+
export declare function captureCellPreChangeContent(args: {
|
|
8
|
+
sheetKey: string | undefined;
|
|
9
|
+
row: number;
|
|
10
|
+
col: number;
|
|
11
|
+
currentValue: any;
|
|
12
|
+
formulaManager: any;
|
|
13
|
+
store: Map<string, any>;
|
|
14
|
+
}): void;
|
|
15
|
+
export declare function popCellPreChangeContent(args: {
|
|
16
|
+
sheetKey: string | undefined;
|
|
17
|
+
row: number;
|
|
18
|
+
col: number;
|
|
19
|
+
fallbackOldContent: any;
|
|
20
|
+
store: Map<string, any>;
|
|
21
|
+
}): any;
|
|
22
|
+
export declare function applyCellContent(args: {
|
|
23
|
+
table: ListTable;
|
|
24
|
+
sheetKey: string | undefined;
|
|
25
|
+
row: number;
|
|
26
|
+
col: number;
|
|
27
|
+
content: any;
|
|
28
|
+
formulaManager: any;
|
|
29
|
+
}): void;
|
|
30
|
+
export declare function refreshDependentDisplays(args: {
|
|
31
|
+
table: ListTable;
|
|
32
|
+
sheetKey: string;
|
|
33
|
+
startCell: {
|
|
34
|
+
sheet: string;
|
|
35
|
+
row: number;
|
|
36
|
+
col: number;
|
|
37
|
+
};
|
|
38
|
+
formulaManager: any;
|
|
39
|
+
maxCells?: number;
|
|
40
|
+
}): void;
|