@visactor/vtable-plugins 1.22.7 → 1.22.8-alpha.13
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/excel-edit-cell-keyboard.js +1 -0
- package/cjs/excel-edit-cell-keyboard.js.map +1 -1
- package/cjs/filter/condition-filter.d.ts +13 -2
- package/cjs/filter/condition-filter.js +69 -172
- package/cjs/filter/condition-filter.js.map +1 -1
- package/cjs/filter/constant.d.ts +7 -0
- package/cjs/filter/constant.js +124 -0
- package/cjs/filter/constant.js.map +1 -0
- package/cjs/filter/filter-engine.d.ts +3 -1
- package/cjs/filter/filter-engine.js +6 -4
- package/cjs/filter/filter-engine.js.map +1 -1
- package/cjs/filter/filter-state-manager.js +8 -2
- package/cjs/filter/filter-state-manager.js.map +1 -1
- package/cjs/filter/filter-toolbar.d.ts +9 -4
- package/cjs/filter/filter-toolbar.js +44 -27
- package/cjs/filter/filter-toolbar.js.map +1 -1
- package/cjs/filter/filter.d.ts +2 -0
- package/cjs/filter/filter.js +29 -15
- package/cjs/filter/filter.js.map +1 -1
- package/cjs/filter/styles.js +1 -1
- package/cjs/filter/styles.js.map +1 -1
- package/cjs/filter/types.d.ts +35 -0
- package/cjs/filter/types.js.map +1 -1
- package/cjs/filter/value-filter.d.ts +10 -2
- package/cjs/filter/value-filter.js +115 -57
- package/cjs/filter/value-filter.js.map +1 -1
- package/cjs/focus-highlight.js +1 -1
- package/cjs/focus-highlight.js.map +1 -1
- package/cjs/master-detail-plugin/checkbox.js +0 -1
- package/cjs/master-detail-plugin/config.js +2 -1
- package/cjs/master-detail-plugin/utils.js +1 -1
- package/cjs/table-series-number.js +1 -0
- package/cjs/table-series-number.js.map +1 -1
- package/dist/vtable-plugins.js +9839 -168
- package/dist/vtable-plugins.min.js +3 -3
- package/es/excel-edit-cell-keyboard.js +1 -0
- package/es/excel-edit-cell-keyboard.js.map +1 -1
- package/es/filter/condition-filter.d.ts +13 -2
- package/es/filter/condition-filter.js +67 -168
- package/es/filter/condition-filter.js.map +1 -1
- package/es/filter/constant.d.ts +7 -0
- package/es/filter/constant.js +120 -0
- package/es/filter/constant.js.map +1 -0
- package/es/filter/filter-engine.d.ts +3 -1
- package/es/filter/filter-engine.js +6 -4
- package/es/filter/filter-engine.js.map +1 -1
- package/es/filter/filter-state-manager.js +8 -2
- package/es/filter/filter-state-manager.js.map +1 -1
- package/es/filter/filter-toolbar.d.ts +9 -4
- package/es/filter/filter-toolbar.js +44 -24
- package/es/filter/filter-toolbar.js.map +1 -1
- package/es/filter/filter.d.ts +2 -0
- package/es/filter/filter.js +36 -16
- package/es/filter/filter.js.map +1 -1
- package/es/filter/styles.js +1 -1
- package/es/filter/styles.js.map +1 -1
- package/es/filter/types.d.ts +35 -0
- package/es/filter/types.js.map +1 -1
- package/es/filter/value-filter.d.ts +10 -2
- package/es/filter/value-filter.js +112 -54
- package/es/filter/value-filter.js.map +1 -1
- package/es/focus-highlight.js +1 -1
- package/es/focus-highlight.js.map +1 -1
- package/es/master-detail-plugin/checkbox.js +1 -2
- package/es/master-detail-plugin/config.js +2 -1
- package/es/master-detail-plugin/utils.js +1 -1
- package/es/table-series-number.js +1 -0
- package/es/table-series-number.js.map +1 -1
- package/package.json +7 -7
|
@@ -7,10 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
const vutils_1 = require("@visactor/vutils"), types_1 = require("./types"), styles_1 = require("./styles");
|
|
8
8
|
|
|
9
9
|
class ValueFilter {
|
|
10
|
-
constructor(table, filterStateManager) {
|
|
10
|
+
constructor(table, filterStateManager, pluginOptions) {
|
|
11
11
|
this.selectedKeys = new Map, this.candidateKeys = new Map, this.formatFnCache = new Map,
|
|
12
12
|
this.toUnformattedCache = new Map, this.valueFilterOptionList = new Map, this.table = table,
|
|
13
|
-
this.filterStateManager = filterStateManager
|
|
13
|
+
this.filterStateManager = filterStateManager, this.pluginOptions = pluginOptions,
|
|
14
|
+
this.styles = pluginOptions.styles || {};
|
|
14
15
|
}
|
|
15
16
|
setSelectedField(fieldId) {
|
|
16
17
|
this.selectedField = fieldId;
|
|
@@ -32,34 +33,47 @@ class ValueFilter {
|
|
|
32
33
|
return records.reverse();
|
|
33
34
|
}
|
|
34
35
|
collectCandidateKeysForUnfilteredColumn(fieldId) {
|
|
35
|
-
|
|
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;
|
|
36
41
|
records.forEach((record => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
if ((0, vutils_1.isValid)(record)) {
|
|
43
|
+
const originalValue = record[fieldId], formattedValue = formatFn(record);
|
|
44
|
+
if (null != formattedValue) {
|
|
45
|
+
countMap.set(formattedValue, (countMap.get(formattedValue) || 0) + 1);
|
|
46
|
+
const unformattedSet = toUnformatted.get(formattedValue);
|
|
47
|
+
null != unformattedSet ? unformattedSet.add(originalValue) : toUnformatted.set(formattedValue, new Set([ originalValue ]));
|
|
48
|
+
}
|
|
42
49
|
}
|
|
43
50
|
})), this.candidateKeys.set(fieldId, countMap), this.toUnformattedCache.set(fieldId, toUnformatted);
|
|
44
51
|
}
|
|
45
52
|
collectCandidateKeysForFilteredColumn(candidateField) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
var _a, _b;
|
|
54
|
+
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;
|
|
55
|
+
let records = [];
|
|
56
|
+
if (syncFilterItemsState) {
|
|
57
|
+
this.getRecords(this.table, !0).filter((record => filteredFields.every((field => {
|
|
58
|
+
var _a;
|
|
59
|
+
const filterType = null === (_a = this.filterStateManager.getFilterState(field)) || void 0 === _a ? void 0 : _a.type;
|
|
60
|
+
"byValue" !== filterType && null != filterType && this.syncSingleStateFromTableData(field);
|
|
61
|
+
return this.selectedKeys.get(field).has(record[field]);
|
|
62
|
+
}))));
|
|
63
|
+
} else records = this.table.internalProps.records;
|
|
64
|
+
records.forEach((record => {
|
|
65
|
+
if ((0, vutils_1.isValid)(record)) {
|
|
66
|
+
const originalValue = record[candidateField], formattedValue = formatFn(record);
|
|
67
|
+
if (countMap.set(formattedValue, (countMap.get(formattedValue) || 0) + 1), null != formattedValue) {
|
|
68
|
+
const unformattedSet = toUnformatted.get(formattedValue);
|
|
69
|
+
null != unformattedSet ? unformattedSet.add(originalValue) : toUnformatted.set(formattedValue, new Set([ originalValue ]));
|
|
70
|
+
}
|
|
57
71
|
}
|
|
58
72
|
})), this.candidateKeys.set(candidateField, countMap), this.toUnformattedCache.set(candidateField, toUnformatted);
|
|
59
73
|
}
|
|
60
74
|
toggleSelectAll(fieldId, selected) {
|
|
61
75
|
this.valueFilterOptionList.get(fieldId).forEach((option => {
|
|
62
|
-
option.checkbox.checked = selected;
|
|
76
|
+
"none" !== option.itemContainer.style.display && (option.checkbox.checked = selected);
|
|
63
77
|
}));
|
|
64
78
|
}
|
|
65
79
|
syncSelectAllCheckbox(fieldId) {
|
|
@@ -74,39 +88,72 @@ class ValueFilter {
|
|
|
74
88
|
}
|
|
75
89
|
}
|
|
76
90
|
syncSingleStateFromTableData(fieldId) {
|
|
91
|
+
var _a, _b, _c;
|
|
77
92
|
const selectedValues = new Set, originalValues = new Set;
|
|
78
|
-
this.table.internalProps.dataSource.records.forEach((record => {
|
|
79
|
-
selectedValues.add(record[fieldId]);
|
|
80
|
-
}));
|
|
81
93
|
this.table.internalProps.records.forEach((record => {
|
|
82
|
-
originalValues.add(record[fieldId]);
|
|
94
|
+
(0, vutils_1.isValid)(record) && originalValues.add(record[fieldId]);
|
|
83
95
|
}));
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
96
|
+
const syncFilterItemsState = null === (_b = null === (_a = this.pluginOptions) || void 0 === _a ? void 0 : _a.syncFilterItemsState) || void 0 === _b || _b, hasFiltered = !(0,
|
|
97
|
+
vutils_1.arrayEqual)(Array.from(originalValues), Array.from(selectedValues));
|
|
98
|
+
if (syncFilterItemsState) {
|
|
99
|
+
if (hasFiltered) {
|
|
100
|
+
this.selectedKeys.set(fieldId, selectedValues), this.filterStateManager.dispatch({
|
|
101
|
+
type: types_1.FilterActionType.UPDATE_FILTER,
|
|
102
|
+
payload: {
|
|
103
|
+
field: fieldId,
|
|
104
|
+
values: Array.from(selectedValues),
|
|
105
|
+
enable: !0
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
!(0, vutils_1.arrayEqual)(Array.from(originalValues), Array.from(selectedValues)) && (this.selectedKeys.set(fieldId, selectedValues),
|
|
109
|
+
this.filterStateManager.dispatch({
|
|
110
|
+
type: types_1.FilterActionType.ADD_FILTER,
|
|
111
|
+
payload: {
|
|
112
|
+
field: fieldId,
|
|
113
|
+
type: "byValue",
|
|
114
|
+
values: Array.from(selectedValues),
|
|
115
|
+
enable: !0
|
|
116
|
+
}
|
|
117
|
+
}));
|
|
91
118
|
}
|
|
92
|
-
}
|
|
119
|
+
} else {
|
|
120
|
+
const selectedRules = null === (_c = this.filterStateManager.getFilterState(fieldId)) || void 0 === _c ? void 0 : _c.values;
|
|
121
|
+
if (selectedRules) {
|
|
122
|
+
!(0, vutils_1.arrayEqual)(Array.from(originalValues), selectedRules) && (this.selectedKeys.set(fieldId, new Set(selectedRules)),
|
|
123
|
+
this.filterStateManager.dispatch({
|
|
124
|
+
type: types_1.FilterActionType.ADD_FILTER,
|
|
125
|
+
payload: {
|
|
126
|
+
field: fieldId,
|
|
127
|
+
type: "byValue",
|
|
128
|
+
values: selectedRules,
|
|
129
|
+
enable: !0,
|
|
130
|
+
shouldKeepUnrelatedState: !0
|
|
131
|
+
}
|
|
132
|
+
}));
|
|
133
|
+
} else this.selectedKeys.set(fieldId, originalValues);
|
|
134
|
+
}
|
|
93
135
|
}
|
|
94
136
|
applyFilter(fieldId = this.selectedField) {
|
|
137
|
+
var _a, _b;
|
|
95
138
|
const options = this.valueFilterOptionList.get(fieldId);
|
|
96
139
|
if (!options || 0 === options.length) return;
|
|
97
140
|
const selections = options.map((option => option.checkbox.checked ? option.originalValue : null)).filter((key => null !== key)).flat();
|
|
98
|
-
this.selectedKeys.set(fieldId, new Set(selections))
|
|
141
|
+
this.selectedKeys.set(fieldId, new Set(selections));
|
|
142
|
+
const syncFilterItemsState = null === (_b = null === (_a = this.pluginOptions) || void 0 === _a ? void 0 : _a.syncFilterItemsState) || void 0 === _b || _b;
|
|
143
|
+
selections.length >= 0 && selections.length < this.valueFilterOptionList.get(fieldId).length || !syncFilterItemsState ? this.filterStateManager.dispatch({
|
|
99
144
|
type: types_1.FilterActionType.APPLY_FILTERS,
|
|
100
145
|
payload: {
|
|
101
146
|
field: fieldId,
|
|
102
147
|
type: "byValue",
|
|
103
148
|
values: selections,
|
|
104
|
-
enable: !0
|
|
149
|
+
enable: !0,
|
|
150
|
+
shouldKeepUnrelatedState: !syncFilterItemsState
|
|
105
151
|
}
|
|
106
152
|
}) : this.filterStateManager.dispatch({
|
|
107
153
|
type: types_1.FilterActionType.REMOVE_FILTER,
|
|
108
154
|
payload: {
|
|
109
|
-
field: fieldId
|
|
155
|
+
field: fieldId,
|
|
156
|
+
type: "byValue"
|
|
110
157
|
}
|
|
111
158
|
});
|
|
112
159
|
}
|
|
@@ -119,28 +166,37 @@ class ValueFilter {
|
|
|
119
166
|
}), this.hide();
|
|
120
167
|
}
|
|
121
168
|
render(container) {
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
(0, styles_1.applyStyles)(
|
|
169
|
+
var _a;
|
|
170
|
+
const filterStyles = this.styles;
|
|
171
|
+
this.filterByValuePanel = document.createElement("div"), (0, styles_1.applyStyles)(this.filterByValuePanel, filterStyles.filterPanel),
|
|
172
|
+
this.searchContainer = document.createElement("div"), (0, styles_1.applyStyles)(this.searchContainer, this.styles.searchContainer),
|
|
125
173
|
this.filterByValueSearchInput = document.createElement("input"), this.filterByValueSearchInput.type = "text",
|
|
126
|
-
this.filterByValueSearchInput.placeholder =
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
(0, styles_1.applyStyles)(optionsContainer,
|
|
130
|
-
|
|
131
|
-
(0, styles_1.applyStyles)(
|
|
132
|
-
|
|
133
|
-
(0, styles_1.applyStyles)(
|
|
134
|
-
this.
|
|
135
|
-
styles_1.applyStyles)(this.
|
|
136
|
-
this.
|
|
137
|
-
|
|
138
|
-
this.
|
|
139
|
-
this.filterByValuePanel.append(searchContainer, optionsContainer), container.appendChild(this.filterByValuePanel),
|
|
174
|
+
this.filterByValueSearchInput.placeholder = (null === (_a = filterStyles.searchInput) || void 0 === _a ? void 0 : _a.placeholder) || "可使用空格分隔多个关键词",
|
|
175
|
+
(0, styles_1.applyStyles)(this.filterByValueSearchInput, filterStyles.searchInput),
|
|
176
|
+
this.searchContainer.appendChild(this.filterByValueSearchInput), this.optionsContainer = document.createElement("div"),
|
|
177
|
+
(0, styles_1.applyStyles)(this.optionsContainer, this.styles.optionsContainer),
|
|
178
|
+
this.selectAllItemDiv = document.createElement("div"), (0, styles_1.applyStyles)(this.selectAllItemDiv, this.styles.optionItem),
|
|
179
|
+
this.selectAllLabel = document.createElement("label"), (0, styles_1.applyStyles)(this.selectAllLabel, this.styles.optionLabel),
|
|
180
|
+
this.selectAllCheckbox = document.createElement("input"), this.selectAllCheckbox.type = "checkbox",
|
|
181
|
+
this.selectAllCheckbox.checked = !0, (0, styles_1.applyStyles)(this.selectAllCheckbox, filterStyles.checkbox),
|
|
182
|
+
this.totalCountSpan = document.createElement("span"), this.totalCountSpan.textContent = "",
|
|
183
|
+
(0, styles_1.applyStyles)(this.totalCountSpan, filterStyles.countSpan), this.selectAllLabel.append(this.selectAllCheckbox, " 全选"),
|
|
184
|
+
this.selectAllItemDiv.appendChild(this.selectAllLabel), this.filterItemsContainer = document.createElement("div"),
|
|
185
|
+
this.optionsContainer.append(this.selectAllItemDiv, this.filterItemsContainer),
|
|
186
|
+
this.filterByValuePanel.append(this.searchContainer, this.optionsContainer), container.appendChild(this.filterByValuePanel),
|
|
140
187
|
this.bindEventForFilterByValue();
|
|
141
188
|
}
|
|
189
|
+
updateStyles(styles) {
|
|
190
|
+
var _a;
|
|
191
|
+
(0, styles_1.applyStyles)(this.filterByValuePanel, styles.filterPanel), (0, styles_1.applyStyles)(this.searchContainer, styles.searchContainer),
|
|
192
|
+
this.filterByValueSearchInput.placeholder = (null === (_a = styles.searchInput) || void 0 === _a ? void 0 : _a.placeholder) || "可使用空格分隔多个关键词",
|
|
193
|
+
(0, styles_1.applyStyles)(this.filterByValueSearchInput, styles.searchInput), (0,
|
|
194
|
+
styles_1.applyStyles)(this.optionsContainer, styles.optionsContainer), (0, styles_1.applyStyles)(this.selectAllItemDiv, styles.optionItem),
|
|
195
|
+
(0, styles_1.applyStyles)(this.selectAllLabel, styles.optionLabel), (0, styles_1.applyStyles)(this.selectAllCheckbox, styles.checkbox);
|
|
196
|
+
}
|
|
142
197
|
renderFilterOptions(field) {
|
|
143
198
|
var _a, _b, _c;
|
|
199
|
+
const filterStyles = this.styles;
|
|
144
200
|
this.filterItemsContainer.innerHTML = "", this.valueFilterOptionList.delete(field),
|
|
145
201
|
this.valueFilterOptionList.set(field, []);
|
|
146
202
|
let totalCount = 0, allChecked = !0, noneChecked = !0;
|
|
@@ -148,17 +204,19 @@ class ValueFilter {
|
|
|
148
204
|
if (!candidates || 0 === candidates.size) return;
|
|
149
205
|
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))));
|
|
150
206
|
null == sortedCandidatesArr || sortedCandidatesArr.forEach((([val, count]) => {
|
|
207
|
+
var _a, _b;
|
|
151
208
|
totalCount += count;
|
|
152
209
|
const unformattedArr = Array.from(toUnformatted.get(val) || new Set), itemDiv = document.createElement("div");
|
|
153
|
-
(0, styles_1.applyStyles)(itemDiv,
|
|
210
|
+
(0, styles_1.applyStyles)(itemDiv, filterStyles.optionItem), itemDiv.style.display = "flex";
|
|
154
211
|
const label = document.createElement("label");
|
|
155
|
-
(0, styles_1.applyStyles)(label,
|
|
212
|
+
(0, styles_1.applyStyles)(label, filterStyles.optionLabel);
|
|
156
213
|
const checkbox = document.createElement("input");
|
|
157
214
|
checkbox.type = "checkbox", checkbox.value = String(val), checkbox.checked = !isFiltered || unformattedArr.some((v => null == selectedKeysSet ? void 0 : selectedKeysSet.has(v))),
|
|
158
|
-
(0, styles_1.applyStyles)(checkbox,
|
|
215
|
+
(0, styles_1.applyStyles)(checkbox, filterStyles.checkbox), checkbox.checked ? noneChecked = !1 : allChecked = !1;
|
|
159
216
|
const countSpan = document.createElement("span");
|
|
160
|
-
countSpan.textContent = String(count), (0, styles_1.applyStyles)(countSpan,
|
|
161
|
-
label.append(checkbox, ` ${
|
|
217
|
+
countSpan.textContent = String(count), (0, styles_1.applyStyles)(countSpan, filterStyles.countSpan),
|
|
218
|
+
label.append(checkbox, ` ${(null === (_b = (_a = this.pluginOptions).checkboxItemFormat) || void 0 === _b ? void 0 : _b.call(_a, val, unformattedArr)) || val}`),
|
|
219
|
+
itemDiv.append(label, countSpan), this.filterItemsContainer.appendChild(itemDiv);
|
|
162
220
|
const itemDom = {
|
|
163
221
|
id: String(val),
|
|
164
222
|
originalValue: unformattedArr,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/filter/value-filter.ts"],"names":[],"mappings":";;;AACA,6CAA8C;AAE9C,mCAA2C;AAE3C,qCAAqD;AAErD,MAAa,WAAW;IAmBtB,YAAY,KAA6B,EAAE,kBAAsC;QAfzE,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;QAWtF,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,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,OAAO,QAAQ,CAAC;SACjB;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,2BAA2B,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACtG,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,GAAG,EAAE,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,GAAG,CAAC,CAAC;QACpG,IAAI,QAAQ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I,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;AAvdD,kCAudC","file":"value-filter.js","sourcesContent":["import { ListTable, PivotTable } from '@visactor/vtable';\nimport { arrayEqual } from '@visactor/vutils';\nimport type { FilterConfig, ValueFilterOptionDom, FilterState } from './types';\nimport { FilterActionType } from './types';\nimport type { FilterStateManager } from './filter-state-manager';\nimport { applyStyles, filterStyles } from './styles';\n\nexport class ValueFilter {\n private table: ListTable | PivotTable;\n private filterStateManager: FilterStateManager;\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 private filterByValuePanel: 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) {\n this.table = table;\n this.filterStateManager = filterStateManager;\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 countMap = new Map<any, number>(); // 计算每个候选值的计数\n const records = this.getRecords(this.table, false); // 未筛选:使用当前表格数据\n const formatFn = this.getFormatFnCache(fieldId);\n const toUnformatted = new Map();\n\n records.forEach(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 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 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 const recordsList = this.getRecords(this.table, true); // 已筛选:使用原始表格数据\n const 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 records.forEach(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 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 option.checkbox.checked = selected;\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\n const currentRecords = this.table.internalProps.dataSource.records; // 当前数据\n currentRecords.forEach(record => {\n selectedValues.add(record[fieldId]);\n });\n\n const originalRecords = this.table.internalProps.records; // 原始数据\n originalRecords.forEach(record => {\n originalValues.add(record[fieldId]);\n });\n\n const hasFiltered = !arrayEqual(Array.from(originalValues), Array.from(selectedValues));\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 }\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 if (selections.length > 0 && selections.length < this.valueFilterOptionList.get(fieldId).length) {\n this.filterStateManager.dispatch({\n type: FilterActionType.APPLY_FILTERS,\n payload: {\n field: fieldId,\n type: 'byValue',\n values: selections,\n enable: true\n }\n });\n } else {\n this.filterStateManager.dispatch({\n type: FilterActionType.REMOVE_FILTER,\n payload: {\n field: fieldId\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 // === 按值筛选的菜单内容 ===\n this.filterByValuePanel = document.createElement('div');\n applyStyles(this.filterByValuePanel, filterStyles.filterPanel);\n\n // -- 搜索栏 ---\n const searchContainer = document.createElement('div');\n applyStyles(searchContainer, filterStyles.searchContainer);\n\n this.filterByValueSearchInput = document.createElement('input');\n this.filterByValueSearchInput.type = 'text';\n this.filterByValueSearchInput.placeholder = '可使用空格分隔多个关键词';\n applyStyles(this.filterByValueSearchInput, filterStyles.searchInput);\n\n searchContainer.appendChild(this.filterByValueSearchInput);\n\n // --- 筛选选项 ---\n const optionsContainer = document.createElement('div');\n applyStyles(optionsContainer, filterStyles.optionsContainer);\n\n const selectAllItemDiv = document.createElement('div');\n applyStyles(selectAllItemDiv, filterStyles.optionItem);\n\n const selectAllLabel = document.createElement('label');\n applyStyles(selectAllLabel, filterStyles.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 selectAllLabel.append(this.selectAllCheckbox, ' 全选');\n selectAllItemDiv.append(selectAllLabel, this.totalCountSpan);\n\n this.filterItemsContainer = document.createElement('div'); // 筛选条目的容器,后续应动态 appendChild\n\n optionsContainer.append(selectAllItemDiv, this.filterItemsContainer);\n this.filterByValuePanel.append(searchContainer, optionsContainer);\n\n container.appendChild(this.filterByValuePanel);\n\n this.bindEventForFilterByValue();\n }\n\n private renderFilterOptions(field: string | number): void {\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, ` ${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,6CAAuD;AAEvD,mCAA2C;AAE3C,qCAAuC;AAEvC,MAAa,WAAW;IA0BtB,YAAY,KAA6B,EAAE,kBAAsC,EAAE,aAA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AK,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 const 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"]}
|
package/cjs/focus-highlight.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/focus-highlight.ts"],"names":[],"mappings":";;;AACA,yDAAyD;AAEzD,qEAAmE;AAInE,6DAA+D;AAC/D,6CAAoD;AAQpD,MAAa,oBAAoB;IAQ/B,YACE,UAAuC;QACrC,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,GAAG;QACZ,cAAc,EAAE,SAAS;KAC1B;;QAZH,OAAE,GAAG,iBAAiB,CAAC;QACvB,SAAI,GAAG,iBAAiB,CAAC;QACzB,YAAO,GAAG,CAAC,yBAAgB,C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K,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK;4BAC3B,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM;4BAC7B,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI;4BAC7B,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO;yBACpC,CAAC,CAAC;wBACH,UAAU,CAAC,IAAI,GAAG,aAAa,CAAC;wBAChC,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;qBACrC;gBACH,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACD,MAAM;QACJ,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAChD,CAAC;CACF;AA/ID,oDA+IC","file":"focus-highlight.js","sourcesContent":["import type { INode } from '@visactor/vtable/es/vrender';\nimport { createRect } from '@visactor/vtable/es/vrender';\nimport type { Group } from '@visactor/vtable/es/scenegraph/graphic/group';\nimport { isSameRange } from '@visactor/vtable/es/tools/cell-range';\nimport type { CellAddress, CellRange } from '@visactor/vtable/es/ts-types';\nimport type { pluginsDefinition } from '@visactor/vtable';\nimport type { BaseTableAPI } from '@visactor/vtable/es/ts-types/base-table';\nimport { cellInRange } from '@visactor/vtable/es/tools/helper';\nimport { TABLE_EVENT_TYPE } from '@visactor/vtable';\nexport interface FocusHighlightPluginOptions {\n id?: string;\n fill?: string;\n opacity?: number;\n highlightRange?: CellAddress | CellRange; //初始化聚焦高亮范围\n}\n\nexport class FocusHighlightPlugin implements pluginsDefinition.IVTablePlugin {\n id = `focus-highlight`;\n name = 'Focus Highlight';\n runTime = [TABLE_EVENT_TYPE.INITIALIZED, TABLE_EVENT_TYPE.SELECTED_CELL, TABLE_EVENT_TYPE.SELECTED_CLEAR];\n table: BaseTableAPI;\n range?: CellRange;\n pluginOptions: FocusHighlightPluginOptions;\n\n constructor(\n options: FocusHighlightPluginOptions = {\n fill: '#000',\n opacity: 0.5,\n highlightRange: undefined\n }\n ) {\n this.id = options.id ?? this.id;\n this.pluginOptions = Object.assign(\n {\n fill: '#000',\n opacity: 0.5\n },\n options\n );\n }\n run(...args: any[]) {\n if (!this.table) {\n this.table = args[2] as BaseTableAPI;\n }\n if (args[1] === TABLE_EVENT_TYPE.INITIALIZED) {\n this.pluginOptions.highlightRange && this.setFocusHighlightRange(this.pluginOptions.highlightRange);\n } else if (args[1] === TABLE_EVENT_TYPE.SELECTED_CELL) {\n const posCell = this.table.stateManager.select.cellPos;\n if (this.table.isHeader(posCell.col, posCell.row)) {\n this.setFocusHighlightRange(undefined);\n } else {\n const ranges = this.table.stateManager.select.ranges;\n const min_col = 0;\n const max_col = this.table.colCount - 1;\n const min_row = Math.min(ranges[0].start.row, ranges[0].end.row);\n const max_row = Math.max(ranges[0].start.row, ranges[0].end.row);\n this.setFocusHighlightRange({\n start: { col: min_col, row: min_row },\n end: { col: max_col, row: max_row }\n });\n }\n } else if (args[1] === TABLE_EVENT_TYPE.SELECTED_CLEAR) {\n this.setFocusHighlightRange(undefined);\n }\n }\n\n setFocusHighlightRange(range?: CellAddress | CellRange, forceUpdate: boolean = false) {\n let cellRange: CellRange;\n if (range && 'start' in range && 'end' in range) {\n cellRange = range as CellRange;\n } else if (range) {\n cellRange = {\n start: range as CellAddress,\n end: range as CellAddress\n };\n }\n if (isSameRange(this.range, cellRange) && !forceUpdate) {\n return;\n }\n\n this.range = cellRange;\n if (!range) {\n // reset highlight\n this.deleteAllCellGroupShadow();\n } else {\n // update highlight\n this.updateCellGroupShadow();\n }\n\n this.table.scenegraph.updateNextFrame();\n }\n\n deleteAllCellGroupShadow() {\n if (!this.table.isPivotTable()) {\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup);\n }\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup);\n }\n\n updateCellGroupShadow() {\n if (!this.table.isPivotTable()) {\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup, this.range);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup, this.range);\n }\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup, this.range);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup, this.range);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup), this.range;\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup, this.range);\n }\n updateCellGroupShadowInContainer(container: Group, range?: CellAddress | CellRange) {\n let cellRange: CellRange;\n if (range && 'start' in range && 'end' in range) {\n cellRange = range;\n } else if (range) {\n cellRange = {\n start: range as CellAddress,\n end: range as CellAddress\n };\n }\n container.forEachChildrenSkipChild((item: INode) => {\n const column = item as unknown as Group;\n if (column.role === 'column') {\n column.forEachChildrenSkipChild((item: INode) => {\n const cell = item as unknown as Group;\n if (cell.role !== 'cell') {\n return;\n }\n cell.attachShadow(cell.shadowRoot);\n const shadowGroup = cell.shadowRoot;\n if (!cellRange) {\n // no highlight\n shadowGroup.removeAllChild();\n } else if (cellInRange(cellRange, cell.col, cell.row)) {\n // inside highlight\n shadowGroup.removeAllChild();\n } else if (!shadowGroup.firstChild) {\n // outside highlight\n const shadowRect = createRect({\n x: 0,\n y: 0,\n width: cell.attribute.width,\n height: cell.attribute.height,\n fill: this.pluginOptions.fill,\n opacity: this.pluginOptions.opacity\n });\n shadowRect.name = 'shadow-rect';\n shadowGroup.appendChild(shadowRect);\n }\n });\n }\n });\n }\n update() {\n this.setFocusHighlightRange(this.range, true);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/focus-highlight.ts"],"names":[],"mappings":";;;AACA,yDAAyD;AAEzD,q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S,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE;wBAErD,WAAW,CAAC,cAAc,EAAE,CAAC;qBAC9B;yBAAM,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE;wBAElC,MAAM,UAAU,GAAG,IAAA,oBAAU,EAAC;4BAC5B,CAAC,EAAE,CAAC;4BACJ,CAAC,EAAE,CAAC;4BACJ,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK;4BAC3B,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM;4BAC7B,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI;4BAC7B,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO;yBACpC,CAAC,CAAC;wBACH,UAAU,CAAC,IAAI,GAAG,aAAa,CAAC;wBAChC,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;qBACrC;gBACH,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACD,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;SAC/C;IACH,CAAC;CACF;AAjJD,oDAiJC","file":"focus-highlight.js","sourcesContent":["import type { INode } from '@visactor/vtable/es/vrender';\nimport { createRect } from '@visactor/vtable/es/vrender';\nimport type { Group } from '@visactor/vtable/es/scenegraph/graphic/group';\nimport { isSameRange } from '@visactor/vtable/es/tools/cell-range';\nimport type { CellAddress, CellRange } from '@visactor/vtable/es/ts-types';\nimport type { pluginsDefinition } from '@visactor/vtable';\nimport type { BaseTableAPI } from '@visactor/vtable/es/ts-types/base-table';\nimport { cellInRange } from '@visactor/vtable/es/tools/helper';\nimport { TABLE_EVENT_TYPE } from '@visactor/vtable';\nexport interface FocusHighlightPluginOptions {\n id?: string;\n fill?: string;\n opacity?: number;\n highlightRange?: CellAddress | CellRange; //初始化聚焦高亮范围\n}\n\nexport class FocusHighlightPlugin implements pluginsDefinition.IVTablePlugin {\n id = `focus-highlight`;\n name = 'Focus Highlight';\n runTime = [TABLE_EVENT_TYPE.INITIALIZED, TABLE_EVENT_TYPE.SELECTED_CELL, TABLE_EVENT_TYPE.SELECTED_CLEAR];\n table: BaseTableAPI;\n range?: CellRange;\n pluginOptions: FocusHighlightPluginOptions;\n\n constructor(\n options: FocusHighlightPluginOptions = {\n fill: '#000',\n opacity: 0.5,\n highlightRange: undefined\n }\n ) {\n this.id = options.id ?? this.id;\n this.pluginOptions = Object.assign(\n {\n fill: '#000',\n opacity: 0.5\n },\n options\n );\n }\n run(...args: any[]) {\n if (!this.table) {\n this.table = args[2] as BaseTableAPI;\n }\n if (args[1] === TABLE_EVENT_TYPE.INITIALIZED) {\n this.pluginOptions.highlightRange && this.setFocusHighlightRange(this.pluginOptions.highlightRange);\n } else if (args[1] === TABLE_EVENT_TYPE.SELECTED_CELL) {\n const posCell = this.table.stateManager.select.cellPos;\n if (this.table.isHeader(posCell.col, posCell.row)) {\n this.setFocusHighlightRange(undefined);\n } else {\n const ranges = this.table.stateManager.select.ranges;\n const min_col = 0;\n const max_col = this.table.colCount - 1;\n const min_row = Math.min(ranges[0].start.row, ranges[0].end.row);\n const max_row = Math.max(ranges[0].start.row, ranges[0].end.row);\n this.setFocusHighlightRange({\n start: { col: min_col, row: min_row },\n end: { col: max_col, row: max_row }\n });\n }\n } else if (args[1] === TABLE_EVENT_TYPE.SELECTED_CLEAR) {\n this.setFocusHighlightRange(undefined);\n }\n }\n\n setFocusHighlightRange(range?: CellAddress | CellRange, forceUpdate: boolean = false) {\n let cellRange: CellRange;\n if (range && 'start' in range && 'end' in range) {\n cellRange = range as CellRange;\n } else if (range) {\n cellRange = {\n start: range as CellAddress,\n end: range as CellAddress\n };\n }\n if (isSameRange(this.range, cellRange) && !forceUpdate) {\n return;\n }\n\n this.range = cellRange;\n if (!range) {\n // reset highlight\n this.deleteAllCellGroupShadow();\n } else {\n // update highlight\n this.updateCellGroupShadow();\n }\n\n this.table.scenegraph.updateNextFrame();\n }\n\n deleteAllCellGroupShadow() {\n if (!this.table.isPivotTable()) {\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup);\n }\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup);\n }\n\n updateCellGroupShadow() {\n if (!this.table.isPivotTable()) {\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup, this.range);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup, this.range);\n }\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup, this.range);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup, this.range);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup), this.range;\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup, this.range);\n }\n updateCellGroupShadowInContainer(container: Group, range?: CellAddress | CellRange) {\n let cellRange: CellRange;\n if (range && 'start' in range && 'end' in range) {\n cellRange = range;\n } else if (range) {\n cellRange = {\n start: range as CellAddress,\n end: range as CellAddress\n };\n }\n container.forEachChildrenSkipChild((item: INode) => {\n const column = item as unknown as Group;\n if (column.role === 'column') {\n column.forEachChildrenSkipChild((item: INode) => {\n const cell = item as unknown as Group;\n if (cell.role !== 'cell') {\n return;\n }\n cell.attachShadow(cell.shadowRoot);\n const shadowGroup = cell.shadowRoot;\n if (!cellRange) {\n // no highlight\n shadowGroup.removeAllChild();\n } else if (cellInRange(cellRange, cell.col, cell.row)) {\n // inside highlight\n shadowGroup.removeAllChild();\n } else if (!shadowGroup.firstChild) {\n // outside highlight\n const shadowRect = createRect({\n x: 0,\n y: 0,\n width: cell.attribute.width,\n height: cell.attribute.height,\n fill: this.pluginOptions.fill,\n opacity: this.pluginOptions.opacity\n });\n shadowRect.name = 'shadow-rect';\n shadowGroup.appendChild(shadowRect);\n }\n });\n }\n });\n }\n update() {\n if (this.table) {\n this.setFocusHighlightRange(this.range, true);\n }\n }\n}\n"]}
|
|
@@ -59,4 +59,4 @@ function setCellCheckboxStateByAttribute(col, row, checked, table) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
exports.findCheckboxColumnIndex = findCheckboxColumnIndex, exports.setCellCheckboxStateByAttribute = setCellCheckboxStateByAttribute;
|
|
62
|
-
//# sourceMappingURL=utils.js.map
|
|
62
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -297,6 +297,7 @@ class TableSeriesNumber {
|
|
|
297
297
|
this.seriesNumberComponent = null);
|
|
298
298
|
}
|
|
299
299
|
syncRowHeightToComponent() {
|
|
300
|
+
if (!this.table.getBodyVisibleRowRange()) return;
|
|
300
301
|
const {rowStart: rowStart, rowEnd: rowEnd} = this.table.getBodyVisibleRowRange(), adjustStartRowIndex = Math.max(rowStart - 2, this.table.frozenRowCount), adjustEndRowIndex = Math.min(rowEnd + 2, this.table.rowCount - 1);
|
|
301
302
|
this.table.frozenRowCount !== this.seriesNumberComponent.getAttributes().frozenRowCount && this.seriesNumberComponent.setAttributes({
|
|
302
303
|
frozenRowCount: this.table.frozenRowCount
|