@visactor/vtable-plugins 1.22.7 → 1.22.8-alpha.12
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/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 +10 -4
- package/cjs/filter/filter-toolbar.js +47 -29
- 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 +114 -56
- 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/dist/vtable-plugins.js +9835 -166
- package/dist/vtable-plugins.min.js +3 -3
- 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 +10 -4
- package/es/filter/filter-toolbar.js +48 -26
- 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 +111 -53
- 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/package.json +8 -8
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
import type { ListTable, PivotTable } from '@visactor/vtable';
|
|
2
2
|
import type { FilterStateManager } from './filter-state-manager';
|
|
3
|
+
import type { FilterOptions, FilterStyles, OperatorOption } from './types';
|
|
3
4
|
export declare class ConditionFilter {
|
|
4
5
|
private table;
|
|
5
6
|
private filterStateManager;
|
|
7
|
+
private pluginOptions;
|
|
8
|
+
private filterToolBarHide;
|
|
9
|
+
private styles;
|
|
6
10
|
private filterByConditionPanel;
|
|
11
|
+
private conditionContainer;
|
|
12
|
+
private categoryLabel;
|
|
7
13
|
private selectedField;
|
|
8
14
|
private operatorSelect;
|
|
9
15
|
private valueInput;
|
|
16
|
+
private andLabel;
|
|
10
17
|
private valueInputMax;
|
|
11
18
|
private categorySelect;
|
|
19
|
+
private operatorLabel;
|
|
20
|
+
private rangeInputContainer;
|
|
21
|
+
private valueLabel;
|
|
12
22
|
private currentCategory;
|
|
13
|
-
private operators;
|
|
14
23
|
private categories;
|
|
15
|
-
|
|
24
|
+
protected operators: OperatorOption[];
|
|
25
|
+
constructor(table: ListTable | PivotTable, filterStateManager: FilterStateManager, pluginOptions: FilterOptions, filterToolBarHide: () => void);
|
|
16
26
|
setSelectedField(fieldId: string | number): void;
|
|
17
27
|
private updateOperatorOptions;
|
|
18
28
|
private handleCategoryChange;
|
|
@@ -24,6 +34,7 @@ export declare class ConditionFilter {
|
|
|
24
34
|
applyFilter(fieldId?: string | number): void;
|
|
25
35
|
clearFilter(fieldId: string | number): void;
|
|
26
36
|
render(container: HTMLElement): void;
|
|
37
|
+
updateStyles(styles: FilterStyles): void;
|
|
27
38
|
private bindEvents;
|
|
28
39
|
show(): void;
|
|
29
40
|
hide(): void;
|
|
@@ -4,125 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.ConditionFilter = void 0;
|
|
6
6
|
|
|
7
|
-
const styles_1 = require("./styles"), types_1 = require("./types");
|
|
7
|
+
const styles_1 = require("./styles"), types_1 = require("./types"), constant_1 = require("./constant");
|
|
8
8
|
|
|
9
9
|
class ConditionFilter {
|
|
10
|
-
constructor(table, filterStateManager) {
|
|
11
|
-
this.currentCategory = types_1.FilterOperatorCategory.ALL, this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}, {
|
|
16
|
-
value: "notEquals",
|
|
17
|
-
label: "不等于",
|
|
18
|
-
category: types_1.FilterOperatorCategory.ALL
|
|
19
|
-
}, {
|
|
20
|
-
value: "equals",
|
|
21
|
-
label: "等于",
|
|
22
|
-
category: types_1.FilterOperatorCategory.NUMBER
|
|
23
|
-
}, {
|
|
24
|
-
value: "notEquals",
|
|
25
|
-
label: "不等于",
|
|
26
|
-
category: types_1.FilterOperatorCategory.NUMBER
|
|
27
|
-
}, {
|
|
28
|
-
value: "greaterThan",
|
|
29
|
-
label: "大于",
|
|
30
|
-
category: types_1.FilterOperatorCategory.NUMBER
|
|
31
|
-
}, {
|
|
32
|
-
value: "lessThan",
|
|
33
|
-
label: "小于",
|
|
34
|
-
category: types_1.FilterOperatorCategory.NUMBER
|
|
35
|
-
}, {
|
|
36
|
-
value: "greaterThanOrEqual",
|
|
37
|
-
label: "大于等于",
|
|
38
|
-
category: types_1.FilterOperatorCategory.NUMBER
|
|
39
|
-
}, {
|
|
40
|
-
value: "lessThanOrEqual",
|
|
41
|
-
label: "小于等于",
|
|
42
|
-
category: types_1.FilterOperatorCategory.NUMBER
|
|
43
|
-
}, {
|
|
44
|
-
value: "between",
|
|
45
|
-
label: "介于",
|
|
46
|
-
category: types_1.FilterOperatorCategory.NUMBER
|
|
47
|
-
}, {
|
|
48
|
-
value: "notBetween",
|
|
49
|
-
label: "不介于",
|
|
50
|
-
category: types_1.FilterOperatorCategory.NUMBER
|
|
51
|
-
}, {
|
|
52
|
-
value: "equals",
|
|
53
|
-
label: "等于",
|
|
54
|
-
category: types_1.FilterOperatorCategory.TEXT
|
|
55
|
-
}, {
|
|
56
|
-
value: "notEquals",
|
|
57
|
-
label: "不等于",
|
|
58
|
-
category: types_1.FilterOperatorCategory.TEXT
|
|
59
|
-
}, {
|
|
60
|
-
value: "contains",
|
|
61
|
-
label: "包含",
|
|
62
|
-
category: types_1.FilterOperatorCategory.TEXT
|
|
63
|
-
}, {
|
|
64
|
-
value: "notContains",
|
|
65
|
-
label: "不包含",
|
|
66
|
-
category: types_1.FilterOperatorCategory.TEXT
|
|
67
|
-
}, {
|
|
68
|
-
value: "startsWith",
|
|
69
|
-
label: "开头是",
|
|
70
|
-
category: types_1.FilterOperatorCategory.TEXT
|
|
71
|
-
}, {
|
|
72
|
-
value: "notStartsWith",
|
|
73
|
-
label: "开头不是",
|
|
74
|
-
category: types_1.FilterOperatorCategory.TEXT
|
|
75
|
-
}, {
|
|
76
|
-
value: "endsWith",
|
|
77
|
-
label: "结尾是",
|
|
78
|
-
category: types_1.FilterOperatorCategory.TEXT
|
|
79
|
-
}, {
|
|
80
|
-
value: "notEndsWith",
|
|
81
|
-
label: "结尾不是",
|
|
82
|
-
category: types_1.FilterOperatorCategory.TEXT
|
|
83
|
-
}, {
|
|
84
|
-
value: "equals",
|
|
85
|
-
label: "等于",
|
|
86
|
-
category: types_1.FilterOperatorCategory.COLOR
|
|
87
|
-
}, {
|
|
88
|
-
value: "notEquals",
|
|
89
|
-
label: "不等于",
|
|
90
|
-
category: types_1.FilterOperatorCategory.COLOR
|
|
91
|
-
}, {
|
|
92
|
-
value: "isChecked",
|
|
93
|
-
label: "已选中",
|
|
94
|
-
category: types_1.FilterOperatorCategory.CHECKBOX
|
|
95
|
-
}, {
|
|
96
|
-
value: "isUnchecked",
|
|
97
|
-
label: "未选中",
|
|
98
|
-
category: types_1.FilterOperatorCategory.CHECKBOX
|
|
99
|
-
}, {
|
|
100
|
-
value: "isChecked",
|
|
101
|
-
label: "已选中",
|
|
102
|
-
category: types_1.FilterOperatorCategory.RADIO
|
|
103
|
-
}, {
|
|
104
|
-
value: "isUnchecked",
|
|
105
|
-
label: "未选中",
|
|
106
|
-
category: types_1.FilterOperatorCategory.RADIO
|
|
107
|
-
} ], this.categories = [ {
|
|
108
|
-
value: types_1.FilterOperatorCategory.ALL,
|
|
109
|
-
label: "全部"
|
|
110
|
-
}, {
|
|
111
|
-
value: types_1.FilterOperatorCategory.TEXT,
|
|
112
|
-
label: "文本"
|
|
113
|
-
}, {
|
|
114
|
-
value: types_1.FilterOperatorCategory.NUMBER,
|
|
115
|
-
label: "数值"
|
|
116
|
-
}, {
|
|
117
|
-
value: types_1.FilterOperatorCategory.COLOR,
|
|
118
|
-
label: "颜色"
|
|
119
|
-
}, {
|
|
120
|
-
value: types_1.FilterOperatorCategory.CHECKBOX,
|
|
121
|
-
label: "复选框"
|
|
122
|
-
}, {
|
|
123
|
-
value: types_1.FilterOperatorCategory.RADIO,
|
|
124
|
-
label: "单选框"
|
|
125
|
-
} ], this.table = table, this.filterStateManager = filterStateManager;
|
|
10
|
+
constructor(table, filterStateManager, pluginOptions, filterToolBarHide) {
|
|
11
|
+
this.currentCategory = types_1.FilterOperatorCategory.ALL, this.categories = [],
|
|
12
|
+
this.operators = [], this.table = table, this.filterStateManager = filterStateManager,
|
|
13
|
+
this.pluginOptions = pluginOptions, this.styles = pluginOptions.styles || {}, this.categories = pluginOptions.conditionCategories,
|
|
14
|
+
this.operators = constant_1.operators, this.filterToolBarHide = filterToolBarHide;
|
|
126
15
|
}
|
|
127
16
|
setSelectedField(fieldId) {
|
|
128
17
|
this.selectedField = fieldId, this.updateOperatorOptions(), this.loadCurrentFilterState();
|
|
@@ -132,7 +21,7 @@ class ConditionFilter {
|
|
|
132
21
|
let filteredOperators;
|
|
133
22
|
if (this.operatorSelect.innerHTML = "", this.currentCategory === types_1.FilterOperatorCategory.ALL) {
|
|
134
23
|
const uniqueOperators = new Map;
|
|
135
|
-
this.operators.forEach((op => {
|
|
24
|
+
this.operators.filter((op => this.categories.map((cat => cat.value)).includes(op.category))).forEach((op => {
|
|
136
25
|
uniqueOperators.has(op.value) || uniqueOperators.set(op.value, op);
|
|
137
26
|
})), filteredOperators = Array.from(uniqueOperators.values());
|
|
138
27
|
} else filteredOperators = this.operators.filter((op => op.category === this.currentCategory));
|
|
@@ -146,10 +35,11 @@ class ConditionFilter {
|
|
|
146
35
|
this.syncUIState());
|
|
147
36
|
}
|
|
148
37
|
loadCurrentFilterState() {
|
|
149
|
-
|
|
150
|
-
filter
|
|
151
|
-
|
|
152
|
-
this.
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
|
+
const filter = this.filterStateManager.getFilterState(this.selectedField), syncFilterItemsState = null === (_b = null === (_a = this.pluginOptions) || void 0 === _a ? void 0 : _a.syncFilterItemsState) || void 0 === _b || _b;
|
|
40
|
+
filter && "byCondition" === filter.type || !syncFilterItemsState ? (this.operatorSelect && (this.operatorSelect.value = null !== (_c = null == filter ? void 0 : filter.operator) && void 0 !== _c ? _c : constant_1.operators[0].value),
|
|
41
|
+
this.valueInput && (Array.isArray(null == filter ? void 0 : filter.condition) ? (this.valueInput.value = String(filter.condition[0]),
|
|
42
|
+
this.valueInputMax && (this.valueInputMax.value = String(filter.condition[1]))) : (this.valueInput.value = String(null !== (_d = null == filter ? void 0 : filter.condition) && void 0 !== _d ? _d : ""),
|
|
153
43
|
this.valueInputMax && (this.valueInputMax.value = ""))), this.syncUIState()) : this.reset();
|
|
154
44
|
}
|
|
155
45
|
reset() {
|
|
@@ -172,33 +62,35 @@ class ConditionFilter {
|
|
|
172
62
|
return "between" === operator || "notBetween" === operator;
|
|
173
63
|
}
|
|
174
64
|
applyFilter(fieldId = this.selectedField) {
|
|
175
|
-
var _a, _b;
|
|
65
|
+
var _a, _b, _c, _d;
|
|
176
66
|
if (!this.operatorSelect || !this.valueInput) return;
|
|
177
67
|
const operator = null === (_a = this.operatorSelect) || void 0 === _a ? void 0 : _a.value;
|
|
178
68
|
let conditionValue = null === (_b = this.valueInput) || void 0 === _b ? void 0 : _b.value;
|
|
179
|
-
if (this.currentCategory
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
189
|
-
conditionValue = [ minValue, maxValue ];
|
|
69
|
+
if (this.currentCategory === types_1.FilterOperatorCategory.NUMBER && (conditionValue = parseFloat(conditionValue),
|
|
70
|
+
isNaN(conditionValue))) return;
|
|
71
|
+
if (this.isRangeOperator(operator)) {
|
|
72
|
+
const minValue = conditionValue;
|
|
73
|
+
let maxValue = this.valueInputMax.value.trim();
|
|
74
|
+
if (this.currentCategory === types_1.FilterOperatorCategory.NUMBER) {
|
|
75
|
+
const numMaxValue = parseFloat(maxValue);
|
|
76
|
+
if (isNaN(numMaxValue)) return;
|
|
77
|
+
maxValue = numMaxValue;
|
|
190
78
|
}
|
|
191
|
-
conditionValue
|
|
192
|
-
type: types_1.FilterActionType.APPLY_FILTERS,
|
|
193
|
-
payload: {
|
|
194
|
-
field: fieldId,
|
|
195
|
-
type: "byCondition",
|
|
196
|
-
operator: operator,
|
|
197
|
-
condition: conditionValue,
|
|
198
|
-
enable: !0
|
|
199
|
-
}
|
|
200
|
-
}), this.hide()) : this.clearFilter(fieldId);
|
|
79
|
+
conditionValue = [ minValue, maxValue ];
|
|
201
80
|
}
|
|
81
|
+
if (!conditionValue && !1 !== conditionValue && 0 !== conditionValue && !this.isBooleanOperator(operator)) return void this.clearFilter(fieldId);
|
|
82
|
+
const syncFilterItemsState = null === (_d = null === (_c = this.pluginOptions) || void 0 === _c ? void 0 : _c.syncFilterItemsState) || void 0 === _d || _d;
|
|
83
|
+
this.filterStateManager.dispatch({
|
|
84
|
+
type: types_1.FilterActionType.APPLY_FILTERS,
|
|
85
|
+
payload: {
|
|
86
|
+
field: fieldId,
|
|
87
|
+
type: "byCondition",
|
|
88
|
+
operator: operator,
|
|
89
|
+
condition: conditionValue,
|
|
90
|
+
enable: !0,
|
|
91
|
+
shouldKeepUnrelatedState: !syncFilterItemsState
|
|
92
|
+
}
|
|
93
|
+
});
|
|
202
94
|
}
|
|
203
95
|
clearFilter(fieldId) {
|
|
204
96
|
this.filterStateManager.dispatch({
|
|
@@ -209,46 +101,51 @@ class ConditionFilter {
|
|
|
209
101
|
}), this.hide();
|
|
210
102
|
}
|
|
211
103
|
render(container) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
(0, styles_1.applyStyles)(conditionContainer,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
styles_1.createElement)("select"), (0, styles_1.applyStyles)(this.categorySelect,
|
|
104
|
+
const filterStyles = this.styles;
|
|
105
|
+
this.filterByConditionPanel = document.createElement("div"), (0, styles_1.applyStyles)(this.filterByConditionPanel, filterStyles.filterPanel),
|
|
106
|
+
this.conditionContainer = document.createElement("div"), (0, styles_1.applyStyles)(this.conditionContainer, this.styles.conditionContainer),
|
|
107
|
+
this.categoryLabel = (0, styles_1.createElement)("label", {}, [ "筛选类型:" ]), (0,
|
|
108
|
+
styles_1.applyStyles)(this.categoryLabel, this.styles.formLabel), this.categorySelect = (0,
|
|
109
|
+
styles_1.createElement)("select"), (0, styles_1.applyStyles)(this.categorySelect, filterStyles.operatorSelect),
|
|
218
110
|
this.categories.forEach((category => {
|
|
219
111
|
const option = document.createElement("option");
|
|
220
112
|
option.value = category.value, option.textContent = category.label, this.categorySelect.appendChild(option);
|
|
221
|
-
}))
|
|
222
|
-
|
|
223
|
-
(0, styles_1.applyStyles)(
|
|
224
|
-
styles_1.createElement)("
|
|
225
|
-
|
|
226
|
-
(0, styles_1.applyStyles)(valueLabel, styles_1.filterStyles.formLabel);
|
|
227
|
-
const rangeInputContainer = (0, styles_1.createElement)("div");
|
|
228
|
-
(0, styles_1.applyStyles)(rangeInputContainer, styles_1.filterStyles.rangeInputContainer),
|
|
113
|
+
})), this.operatorLabel = (0, styles_1.createElement)("label", {}, [ "筛选条件:" ]),
|
|
114
|
+
(0, styles_1.applyStyles)(this.operatorLabel, this.styles.formLabel), this.operatorSelect = (0,
|
|
115
|
+
styles_1.createElement)("select"), (0, styles_1.applyStyles)(this.operatorSelect, filterStyles.operatorSelect),
|
|
116
|
+
this.valueLabel = (0, styles_1.createElement)("label", {}, [ "筛选值:" ]), (0, styles_1.applyStyles)(this.valueLabel, this.styles.formLabel),
|
|
117
|
+
this.rangeInputContainer = (0, styles_1.createElement)("div"), (0, styles_1.applyStyles)(this.rangeInputContainer, this.styles.rangeInputContainer),
|
|
229
118
|
this.valueInput = (0, styles_1.createElement)("input", {
|
|
230
119
|
type: "text",
|
|
231
120
|
placeholder: "请输入筛选值"
|
|
232
|
-
}), (0, styles_1.applyStyles)(this.valueInput,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
this.valueInputMax = (0, styles_1.createElement)("input", {
|
|
121
|
+
}), (0, styles_1.applyStyles)(this.valueInput, filterStyles.searchInput), this.andLabel = (0,
|
|
122
|
+
styles_1.createElement)("span", {}, [ "和" ]), (0, styles_1.applyStyles)(this.andLabel, this.styles.addLabel),
|
|
123
|
+
this.andLabel.style.display = "none", this.valueInputMax = (0, styles_1.createElement)("input", {
|
|
236
124
|
type: "text",
|
|
237
125
|
placeholder: "最大值"
|
|
238
|
-
}), (0, styles_1.applyStyles)(this.valueInputMax,
|
|
239
|
-
this.
|
|
240
|
-
rangeInputContainer.appendChild(
|
|
241
|
-
conditionContainer.appendChild(
|
|
242
|
-
conditionContainer.appendChild(
|
|
243
|
-
conditionContainer.appendChild(
|
|
244
|
-
this.filterByConditionPanel.
|
|
245
|
-
this.
|
|
126
|
+
}), (0, styles_1.applyStyles)(this.valueInputMax, filterStyles.searchInput), this.valueInputMax.style.display = "none",
|
|
127
|
+
this.rangeInputContainer.appendChild(this.valueInput), this.rangeInputContainer.appendChild(this.andLabel),
|
|
128
|
+
this.rangeInputContainer.appendChild(this.valueInputMax), this.conditionContainer.appendChild(this.categoryLabel),
|
|
129
|
+
this.conditionContainer.appendChild(this.categorySelect), this.conditionContainer.appendChild(this.operatorLabel),
|
|
130
|
+
this.conditionContainer.appendChild(this.operatorSelect), this.conditionContainer.appendChild(this.valueLabel),
|
|
131
|
+
this.conditionContainer.appendChild(this.rangeInputContainer), this.filterByConditionPanel.appendChild(this.conditionContainer),
|
|
132
|
+
container.appendChild(this.filterByConditionPanel), this.hide(), this.updateOperatorOptions(),
|
|
133
|
+
this.bindEvents();
|
|
134
|
+
}
|
|
135
|
+
updateStyles(styles) {
|
|
136
|
+
(0, styles_1.applyStyles)(this.filterByConditionPanel, styles.filterPanel), (0,
|
|
137
|
+
styles_1.applyStyles)(this.conditionContainer, styles.conditionContainer), (0, styles_1.applyStyles)(this.categoryLabel, styles.formLabel),
|
|
138
|
+
(0, styles_1.applyStyles)(this.categorySelect, styles.operatorSelect), (0, styles_1.applyStyles)(this.operatorLabel, styles.formLabel),
|
|
139
|
+
(0, styles_1.applyStyles)(this.operatorSelect, styles.operatorSelect), (0, styles_1.applyStyles)(this.valueLabel, styles.formLabel),
|
|
140
|
+
(0, styles_1.applyStyles)(this.rangeInputContainer, styles.rangeInputContainer),
|
|
141
|
+
(0, styles_1.applyStyles)(this.valueInput, styles.searchInput), (0, styles_1.applyStyles)(this.andLabel, styles.addLabel),
|
|
142
|
+
(0, styles_1.applyStyles)(this.valueInputMax, styles.searchInput);
|
|
246
143
|
}
|
|
247
144
|
bindEvents() {
|
|
248
145
|
this.valueInput.addEventListener("keypress", (event => {
|
|
249
|
-
"Enter" === event.key && this.applyFilter();
|
|
146
|
+
"Enter" === event.key && (this.applyFilter(), this.filterToolBarHide());
|
|
250
147
|
})), this.valueInputMax.addEventListener("keypress", (event => {
|
|
251
|
-
"Enter" === event.key && this.applyFilter();
|
|
148
|
+
"Enter" === event.key && (this.applyFilter(), this.filterToolBarHide());
|
|
252
149
|
})), this.categorySelect.addEventListener("change", (() => {
|
|
253
150
|
this.handleCategoryChange();
|
|
254
151
|
})), this.operatorSelect.addEventListener("change", (() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/filter/condition-filter.ts"],"names":[],"mappings":";;;AAEA,qCAAoE;AAEpE,mCAAmE;AAKnE,MAAa,eAAe;IA4D1B,YAAY,KAA6B,EAAE,kBAAsC;QAnDzE,oBAAe,GAA2B,8BAAsB,CAAC,GAAG,CAAC;QAGrE,cAAS,GAAqB;YAEpC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,8BAAsB,CAAC,GAAG,EAAE;YACtE,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,8BAAsB,CAAC,GAAG,EAAE;YAG1E,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,8BAAsB,CAAC,MAAM,EAAE;YACzE,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,8BAAsB,CAAC,MAAM,EAAE;YAC7E,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,8BAAsB,CAAC,MAAM,EAAE;YAC9E,EAAE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C;gBACpC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,GAAG,cAAc,CAAC;gBAClD,QAAQ,CAAC,KAAK,CAAC,OAAO,GAAG,cAAc,CAAC;aACzC;iBAAM;gBACL,IAAI,CAAC,UAAU,CAAC,WAAW,GAAG,QAAQ,CAAC;gBACvC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;gBAC1C,QAAQ,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;aACjC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAKD,IAAI;QACF,IAAI,IAAI,CAAC,sBAAsB,EAAE;YAC/B,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;YACpD,IAAI,CAAC,sBAAsB,EAAE,CAAC;SAC/B;IACH,CAAC;IAKD,IAAI;QACF,IAAI,IAAI,CAAC,sBAAsB,EAAE;YAC/B,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;SACpD;IACH,CAAC;CACF;AA1bD,0CA0bC","file":"condition-filter.js","sourcesContent":["import type { ListTable, PivotTable } from '@visactor/vtable';\nimport type { FilterStateManager } from './filter-state-manager';\nimport { applyStyles, filterStyles, createElement } from './styles';\nimport type { FilterOperator, OperatorOption } from './types';\nimport { FilterActionType, FilterOperatorCategory } from './types';\n\n/**\n * 按条件筛选组件\n */\nexport class ConditionFilter {\n private table: ListTable | PivotTable;\n private filterStateManager: FilterStateManager;\n private filterByConditionPanel: HTMLElement;\n private selectedField: string | number;\n private operatorSelect: HTMLSelectElement;\n private valueInput: HTMLInputElement;\n private valueInputMax: HTMLInputElement;\n private categorySelect: HTMLSelectElement;\n private currentCategory: FilterOperatorCategory = FilterOperatorCategory.ALL;\n\n // 按分类组织的操作符选项\n private operators: OperatorOption[] = [\n // 通用操作符 (全部分类中显示)\n { value: 'equals', label: '等于', category: FilterOperatorCategory.ALL },\n { value: 'notEquals', label: '不等于', category: FilterOperatorCategory.ALL },\n\n // 数值操作符\n { value: 'equals', label: '等于', category: FilterOperatorCategory.NUMBER },\n { value: 'notEquals', label: '不等于', category: FilterOperatorCategory.NUMBER },\n { value: 'greaterThan', label: '大于', category: FilterOperatorCategory.NUMBER },\n { value: 'lessThan', label: '小于', category: FilterOperatorCategory.NUMBER },\n { value: 'greaterThanOrEqual', label: '大于等于', category: FilterOperatorCategory.NUMBER },\n { value: 'lessThanOrEqual', label: '小于等于', category: FilterOperatorCategory.NUMBER },\n { value: 'between', label: '介于', category: FilterOperatorCategory.NUMBER },\n { value: 'notBetween', label: '不介于', category: FilterOperatorCategory.NUMBER },\n\n // 文本操作符\n { value: 'equals', label: '等于', category: FilterOperatorCategory.TEXT },\n { value: 'notEquals', label: '不等于', category: FilterOperatorCategory.TEXT },\n { value: 'contains', label: '包含', category: FilterOperatorCategory.TEXT },\n { value: 'notContains', label: '不包含', category: FilterOperatorCategory.TEXT },\n { value: 'startsWith', label: '开头是', category: FilterOperatorCategory.TEXT },\n { value: 'notStartsWith', label: '开头不是', category: FilterOperatorCategory.TEXT },\n { value: 'endsWith', label: '结尾是', category: FilterOperatorCategory.TEXT },\n { value: 'notEndsWith', label: '结尾不是', category: FilterOperatorCategory.TEXT },\n\n // 颜色操作符\n { value: 'equals', label: '等于', category: FilterOperatorCategory.COLOR },\n { value: 'notEquals', label: '不等于', category: FilterOperatorCategory.COLOR },\n\n // 复选框操作符\n { value: 'isChecked', label: '已选中', category: FilterOperatorCategory.CHECKBOX },\n { value: 'isUnchecked', label: '未选中', category: FilterOperatorCategory.CHECKBOX },\n\n // 单选框操作符\n { value: 'isChecked', label: '已选中', category: FilterOperatorCategory.RADIO },\n { value: 'isUnchecked', label: '未选中', category: FilterOperatorCategory.RADIO }\n ];\n\n // 分类下拉选项\n private categories = [\n { value: FilterOperatorCategory.ALL, label: '全部' },\n { value: FilterOperatorCategory.TEXT, label: '文本' },\n { value: FilterOperatorCategory.NUMBER, label: '数值' },\n { value: FilterOperatorCategory.COLOR, label: '颜色' },\n { value: FilterOperatorCategory.CHECKBOX, label: '复选框' },\n { value: FilterOperatorCategory.RADIO, label: '单选框' }\n ];\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 this.updateOperatorOptions();\n this.loadCurrentFilterState();\n }\n\n /**\n * 更新操作符下拉选项\n */\n private updateOperatorOptions(): void {\n if (!this.operatorSelect) {\n return;\n }\n this.operatorSelect.innerHTML = '';\n let filteredOperators: OperatorOption[];\n\n if (this.currentCategory === FilterOperatorCategory.ALL) {\n // 当选择\"全部\"时,收集所有不重复的操作符\n const uniqueOperators = new Map<string, OperatorOption>();\n this.operators.forEach(op => {\n if (!uniqueOperators.has(op.value)) {\n uniqueOperators.set(op.value, op);\n }\n });\n filteredOperators = Array.from(uniqueOperators.values());\n } else {\n // 其他类别正常筛选\n filteredOperators = this.operators.filter(op => op.category === this.currentCategory);\n }\n\n // 添加新选项\n filteredOperators.forEach(op => {\n const option = document.createElement('option');\n option.value = op.value;\n option.textContent = op.label;\n this.operatorSelect.appendChild(option);\n });\n }\n\n private handleCategoryChange(): void {\n if (!this.categorySelect) {\n return;\n }\n\n this.currentCategory = this.categorySelect.value as FilterOperatorCategory;\n this.updateOperatorOptions();\n\n // 分类切换后也需要同步UI状态\n this.syncUIState();\n }\n\n /**\n * 加载当前的筛选状态\n */\n private loadCurrentFilterState(): void {\n const filter = this.filterStateManager.getFilterState(this.selectedField);\n\n if (filter && filter.type === 'byCondition') {\n // 设置操作符\n if (filter.operator && this.operatorSelect) {\n this.operatorSelect.value = filter.operator;\n }\n\n // 设置条件值\n if (filter.condition !== undefined && this.valueInput) {\n if (Array.isArray(filter.condition)) {\n this.valueInput.value = String(filter.condition[0]);\n if (this.valueInputMax) {\n this.valueInputMax.value = String(filter.condition[1]);\n }\n } else {\n this.valueInput.value = String(filter.condition);\n if (this.valueInputMax) {\n this.valueInputMax.value = '';\n }\n }\n }\n\n // 同步UI状态:根据当前操作符显示/隐藏范围输入框\n this.syncUIState();\n } else {\n // 重置为默认值\n this.reset();\n }\n }\n\n /**\n * 重置筛选条件到默认状态\n */\n reset(): void {\n // 重置操作符选择\n if (this.operatorSelect) {\n this.operatorSelect.selectedIndex = 0;\n }\n\n // 重置所有输入框\n if (this.valueInput) {\n this.valueInput.value = '';\n this.valueInput.placeholder = '请输入筛选值';\n }\n\n if (this.valueInputMax) {\n this.valueInputMax.value = '';\n }\n\n // 重置分类选择\n this.currentCategory = FilterOperatorCategory.ALL;\n if (this.categorySelect) {\n this.categorySelect.value = FilterOperatorCategory.ALL;\n }\n\n // 更新操作符选项\n this.updateOperatorOptions();\n\n // 同步UI状态\n this.syncUIState();\n }\n\n /**\n * 同步UI状态:根据当前选择的操作符调整UI显示\n */\n private syncUIState(): void {\n if (!this.operatorSelect || !this.valueInput) {\n return;\n }\n\n const selectedOperator = this.operatorSelect.value as FilterOperator;\n const andLabel = this.valueInput.nextElementSibling as HTMLElement;\n\n if (this.isRangeOperator(selectedOperator)) {\n // 显示范围输入相关UI\n this.valueInput.placeholder = '最小值';\n if (this.valueInputMax) {\n this.valueInputMax.style.display = 'inline-block';\n }\n if (andLabel) {\n andLabel.style.display = 'inline-block';\n }\n } else {\n // 隐藏范围输入相关UI\n this.valueInput.placeholder = '请输入筛选值';\n if (this.valueInputMax) {\n this.valueInputMax.style.display = 'none';\n }\n if (andLabel) {\n andLabel.style.display = 'none';\n }\n }\n }\n\n private isBooleanOperator(operator: FilterOperator): boolean {\n const booleanCondition = ['isChecked', 'isUnchecked'];\n return booleanCondition.includes(operator);\n }\n\n private isRangeOperator(operator: FilterOperator): boolean {\n return operator === 'between' || operator === 'notBetween';\n }\n\n /**\n * 应用筛选条件\n */\n applyFilter(fieldId: string | number = this.selectedField): void {\n if (!this.operatorSelect || !this.valueInput) {\n return;\n }\n\n const operator = this.operatorSelect?.value as FilterOperator;\n let conditionValue: any = this.valueInput?.value;\n\n // 根据所选操作符和分类尝试转换输入值\n if (this.currentCategory === FilterOperatorCategory.NUMBER) {\n conditionValue = parseFloat(conditionValue);\n if (isNaN(conditionValue)) {\n console.warn('请输入有效的数字');\n return;\n }\n }\n\n // 处理范围操作符的双值输入\n if (this.isRangeOperator(operator)) {\n const minValue = conditionValue;\n let maxValue: string | number = this.valueInputMax.value.trim();\n\n // 尝试将最大值也转换为数字\n if (this.currentCategory === FilterOperatorCategory.NUMBER) {\n const numMaxValue = parseFloat(maxValue);\n if (!isNaN(numMaxValue)) {\n maxValue = numMaxValue;\n } else {\n console.warn('请输入有效的最大值');\n return;\n }\n }\n\n // 使用数组形式传递范围值\n conditionValue = [minValue, maxValue];\n }\n\n if (!conditionValue && conditionValue !== false && conditionValue !== 0 && !this.isBooleanOperator(operator)) {\n this.clearFilter(fieldId);\n return;\n }\n\n // TODO:处理单元格颜色和字体颜色的筛选\n\n this.filterStateManager.dispatch({\n type: FilterActionType.APPLY_FILTERS,\n payload: {\n field: fieldId,\n type: 'byCondition',\n operator,\n condition: conditionValue,\n enable: true\n }\n });\n\n this.hide();\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 /**\n * 渲染条件筛选面板\n */\n render(container: HTMLElement): void {\n // 按条件筛选面板\n this.filterByConditionPanel = document.createElement('div');\n applyStyles(this.filterByConditionPanel, filterStyles.filterPanel);\n\n // 条件选择区域\n const conditionContainer = document.createElement('div');\n applyStyles(conditionContainer, filterStyles.conditionContainer);\n\n // 分类选择下拉框\n const categoryLabel = createElement('label', {}, ['筛选类型:']);\n applyStyles(categoryLabel, filterStyles.formLabel);\n\n this.categorySelect = createElement('select') as HTMLSelectElement;\n applyStyles(this.categorySelect, filterStyles.operatorSelect);\n\n // 添加分类选项\n this.categories.forEach(category => {\n const option = document.createElement('option');\n option.value = category.value;\n option.textContent = category.label;\n this.categorySelect.appendChild(option);\n });\n\n // 操作符选择下拉框\n const operatorLabel = createElement('label', {}, ['筛选条件:']);\n applyStyles(operatorLabel, filterStyles.formLabel);\n\n this.operatorSelect = createElement('select') as HTMLSelectElement;\n applyStyles(this.operatorSelect, filterStyles.operatorSelect);\n\n // 条件值输入框\n const valueLabel = createElement('label', {}, ['筛选值:']);\n applyStyles(valueLabel, filterStyles.formLabel);\n\n // 一个容器来包装两个输入框和\"和\"字\n const rangeInputContainer = createElement('div');\n applyStyles(rangeInputContainer, filterStyles.rangeInputContainer);\n\n this.valueInput = createElement('input', {\n type: 'text',\n placeholder: '请输入筛选值'\n }) as HTMLInputElement;\n applyStyles(this.valueInput, filterStyles.searchInput);\n\n // \"和\"字标签\n const andLabel = createElement('span', {}, ['和']);\n applyStyles(andLabel, filterStyles.addLabel);\n andLabel.style.display = 'none'; // 默认隐藏\n\n // 范围筛选的最大值输入框\n this.valueInputMax = createElement('input', {\n type: 'text',\n placeholder: '最大值'\n }) as HTMLInputElement;\n applyStyles(this.valueInputMax, filterStyles.searchInput);\n this.valueInputMax.style.display = 'none'; // 默认隐藏\n\n // 将输入框和\"和\"字添加到容器中\n rangeInputContainer.appendChild(this.valueInput);\n rangeInputContainer.appendChild(andLabel);\n rangeInputContainer.appendChild(this.valueInputMax);\n\n // 将元素添加到容器中\n conditionContainer.appendChild(categoryLabel);\n conditionContainer.appendChild(this.categorySelect);\n conditionContainer.appendChild(operatorLabel);\n conditionContainer.appendChild(this.operatorSelect);\n conditionContainer.appendChild(valueLabel);\n conditionContainer.appendChild(rangeInputContainer);\n\n this.filterByConditionPanel.appendChild(conditionContainer);\n container.appendChild(this.filterByConditionPanel);\n\n // 默认隐藏\n this.hide();\n\n // 初始化操作符选项\n this.updateOperatorOptions();\n this.bindEvents();\n }\n\n /**\n * 绑定事件\n */\n private bindEvents(): void {\n // 输入框回车事件\n this.valueInput.addEventListener('keypress', event => {\n if (event.key === 'Enter') {\n this.applyFilter();\n }\n });\n\n // 最大值输入框回车事件\n this.valueInputMax.addEventListener('keypress', event => {\n if (event.key === 'Enter') {\n this.applyFilter();\n }\n });\n\n // 分类切换事件\n this.categorySelect.addEventListener('change', () => {\n this.handleCategoryChange();\n });\n\n // 操作符切换事件\n this.operatorSelect.addEventListener('change', () => {\n const selectedOperator = this.operatorSelect.value as FilterOperator;\n const andLabel = this.valueInput.nextElementSibling as HTMLElement;\n\n if (this.isRangeOperator(selectedOperator)) {\n this.valueInput.placeholder = '最小值';\n this.valueInputMax.style.display = 'inline-block';\n andLabel.style.display = 'inline-block';\n } else {\n this.valueInput.placeholder = '请输入筛选值';\n this.valueInputMax.style.display = 'none';\n andLabel.style.display = 'none';\n }\n });\n }\n\n /**\n * 显示筛选面板\n */\n show(): void {\n if (this.filterByConditionPanel) {\n this.filterByConditionPanel.style.display = 'block';\n this.loadCurrentFilterState();\n }\n }\n\n /**\n * 隐藏筛选面板\n */\n hide(): void {\n if (this.filterByConditionPanel) {\n this.filterByConditionPanel.style.display = 'none';\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/filter/condition-filter.ts"],"names":[],"mappings":";;;AAEA,qCAAoE;AAQpE,mCAAmE;AACnE,yCAAuC;AAKvC,MAAa,eAAe;IA0B1B,YACE,KAA6B,EAC7B,kBAAsC,EACtC,aAA4B,EAC5B,iBAA6B;QATvB,oBAAe,GAA2B,8BAAsB,CAAC,GAAG,CAAC;QAErE,eAAU,GAAmC,EAAE,CAAC;QAC9C,cAAS,GAAqB,EAAE,CAAC;QAQzC,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;QACzC,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC,mBA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sBAAsB,EAAE,CAAC;SAC/B;IACH,CAAC;IAKD,IAAI;QACF,IAAI,IAAI,CAAC,sBAAsB,EAAE;YAC/B,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;SACpD;IACH,CAAC;CACF;AAtbD,0CAsbC","file":"condition-filter.js","sourcesContent":["import type { ListTable, PivotTable } from '@visactor/vtable';\nimport type { FilterStateManager } from './filter-state-manager';\nimport { applyStyles, filterStyles, createElement } from './styles';\nimport type {\n FilterOperator,\n FilterOperatorCategoryOption,\n FilterOptions,\n FilterStyles,\n OperatorOption\n} from './types';\nimport { FilterActionType, FilterOperatorCategory } from './types';\nimport { operators } from './constant';\n\n/**\n * 按条件筛选组件\n */\nexport class ConditionFilter {\n private table: ListTable | PivotTable;\n private filterStateManager: FilterStateManager;\n private pluginOptions: FilterOptions;\n private filterToolBarHide: () => void;\n\n private styles: Record<any, any>;\n\n private filterByConditionPanel: HTMLElement;\n private conditionContainer: HTMLElement;\n private categoryLabel: HTMLElement;\n private selectedField: string | number;\n private operatorSelect: HTMLSelectElement;\n private valueInput: HTMLInputElement;\n private andLabel: HTMLElement;\n private valueInputMax: HTMLInputElement;\n private categorySelect: HTMLSelectElement;\n private operatorLabel: HTMLElement;\n private rangeInputContainer: HTMLElement;\n private valueLabel: HTMLElement;\n\n private currentCategory: FilterOperatorCategory = FilterOperatorCategory.ALL;\n\n private categories: FilterOperatorCategoryOption[] = [];\n protected operators: OperatorOption[] = [];\n\n constructor(\n table: ListTable | PivotTable,\n filterStateManager: FilterStateManager,\n pluginOptions: FilterOptions,\n filterToolBarHide: () => void\n ) {\n this.table = table;\n this.filterStateManager = filterStateManager;\n this.pluginOptions = pluginOptions;\n this.styles = pluginOptions.styles || {};\n this.categories = pluginOptions.conditionCategories;\n this.operators = operators;\n this.filterToolBarHide = filterToolBarHide;\n }\n\n setSelectedField(fieldId: string | number): void {\n this.selectedField = fieldId;\n this.updateOperatorOptions();\n this.loadCurrentFilterState();\n }\n\n /**\n * 更新操作符下拉选项\n */\n private updateOperatorOptions(): void {\n if (!this.operatorSelect) {\n return;\n }\n this.operatorSelect.innerHTML = '';\n let filteredOperators: OperatorOption[];\n\n if (this.currentCategory === FilterOperatorCategory.ALL) {\n // 当选择\"全部\"时,收集所有配置的分类中, 不重复的操作符\n const uniqueOperators = new Map<string, OperatorOption>();\n this.operators\n .filter(op => this.categories.map(cat => cat.value).includes(op.category))\n .forEach(op => {\n if (!uniqueOperators.has(op.value)) {\n uniqueOperators.set(op.value, op);\n }\n });\n filteredOperators = Array.from(uniqueOperators.values());\n } else {\n // 其他类别正常筛选\n filteredOperators = this.operators.filter(op => op.category === this.currentCategory);\n }\n\n // 添加新选项\n filteredOperators.forEach(op => {\n const option = document.createElement('option');\n option.value = op.value;\n option.textContent = op.label;\n this.operatorSelect.appendChild(option);\n });\n }\n\n private handleCategoryChange(): void {\n if (!this.categorySelect) {\n return;\n }\n\n this.currentCategory = this.categorySelect.value as FilterOperatorCategory;\n this.updateOperatorOptions();\n\n // 分类切换后也需要同步UI状态\n this.syncUIState();\n }\n\n /**\n * 加载当前的筛选状态\n */\n private loadCurrentFilterState(): void {\n const filter = this.filterStateManager.getFilterState(this.selectedField);\n const syncFilterItemsState = this.pluginOptions?.syncFilterItemsState ?? true;\n\n // 不联动的场景下, 用户的配置始终会被展示出来\n if ((filter && filter.type === 'byCondition') || !syncFilterItemsState) {\n // 设置操作符\n if (this.operatorSelect) {\n this.operatorSelect.value = filter?.operator ?? operators[0].value;\n }\n\n // 设置条件值\n if (this.valueInput) {\n if (Array.isArray(filter?.condition)) {\n this.valueInput.value = String(filter.condition[0]);\n if (this.valueInputMax) {\n this.valueInputMax.value = String(filter.condition[1]);\n }\n } else {\n this.valueInput.value = String(filter?.condition ?? '');\n if (this.valueInputMax) {\n this.valueInputMax.value = '';\n }\n }\n }\n\n // 同步UI状态:根据当前操作符显示/隐藏范围输入框\n this.syncUIState();\n } else {\n // 重置为默认值\n this.reset();\n }\n }\n\n /**\n * 重置筛选条件到默认状态\n */\n reset(): void {\n // 重置操作符选择\n if (this.operatorSelect) {\n this.operatorSelect.selectedIndex = 0;\n }\n\n // 重置所有输入框\n if (this.valueInput) {\n this.valueInput.value = '';\n this.valueInput.placeholder = '请输入筛选值';\n }\n\n if (this.valueInputMax) {\n this.valueInputMax.value = '';\n }\n\n // 重置分类选择\n this.currentCategory = FilterOperatorCategory.ALL;\n if (this.categorySelect) {\n this.categorySelect.value = FilterOperatorCategory.ALL;\n }\n\n // 更新操作符选项\n this.updateOperatorOptions();\n\n // 同步UI状态\n this.syncUIState();\n }\n\n /**\n * 同步UI状态:根据当前选择的操作符调整UI显示\n */\n private syncUIState(): void {\n if (!this.operatorSelect || !this.valueInput) {\n return;\n }\n\n const selectedOperator = this.operatorSelect.value as FilterOperator;\n const andLabel = this.valueInput.nextElementSibling as HTMLElement;\n\n if (this.isRangeOperator(selectedOperator)) {\n // 显示范围输入相关UI\n this.valueInput.placeholder = '最小值';\n if (this.valueInputMax) {\n this.valueInputMax.style.display = 'inline-block';\n }\n if (andLabel) {\n andLabel.style.display = 'inline-block';\n }\n } else {\n // 隐藏范围输入相关UI\n this.valueInput.placeholder = '请输入筛选值';\n if (this.valueInputMax) {\n this.valueInputMax.style.display = 'none';\n }\n if (andLabel) {\n andLabel.style.display = 'none';\n }\n }\n }\n\n private isBooleanOperator(operator: FilterOperator): boolean {\n const booleanCondition = ['isChecked', 'isUnchecked'];\n return booleanCondition.includes(operator);\n }\n\n private isRangeOperator(operator: FilterOperator): boolean {\n return operator === 'between' || operator === 'notBetween';\n }\n\n /**\n * 应用筛选条件\n */\n applyFilter(fieldId: string | number = this.selectedField): void {\n if (!this.operatorSelect || !this.valueInput) {\n return;\n }\n\n const operator = this.operatorSelect?.value as FilterOperator;\n let conditionValue: any = this.valueInput?.value;\n\n // 根据所选操作符和分类尝试转换输入值\n if (this.currentCategory === FilterOperatorCategory.NUMBER) {\n conditionValue = parseFloat(conditionValue);\n if (isNaN(conditionValue)) {\n console.warn('请输入有效的数字');\n return;\n }\n }\n\n // 处理范围操作符的双值输入\n if (this.isRangeOperator(operator)) {\n const minValue = conditionValue;\n let maxValue: string | number = this.valueInputMax.value.trim();\n\n // 尝试将最大值也转换为数字\n if (this.currentCategory === FilterOperatorCategory.NUMBER) {\n const numMaxValue = parseFloat(maxValue);\n if (!isNaN(numMaxValue)) {\n maxValue = numMaxValue;\n } else {\n console.warn('请输入有效的最大值');\n return;\n }\n }\n\n // 使用数组形式传递范围值\n conditionValue = [minValue, maxValue];\n }\n\n if (!conditionValue && conditionValue !== false && conditionValue !== 0 && !this.isBooleanOperator(operator)) {\n this.clearFilter(fieldId);\n return;\n }\n\n // TODO:处理单元格颜色和字体颜色的筛选\n const syncFilterItemsState = this.pluginOptions?.syncFilterItemsState ?? true;\n this.filterStateManager.dispatch({\n type: FilterActionType.APPLY_FILTERS,\n payload: {\n field: fieldId,\n type: 'byCondition',\n operator,\n condition: conditionValue,\n enable: true,\n shouldKeepUnrelatedState: !syncFilterItemsState\n }\n });\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 /**\n * 渲染条件筛选面板\n */\n render(container: HTMLElement): void {\n const filterStyles = this.styles;\n // 按条件筛选面板\n this.filterByConditionPanel = document.createElement('div');\n applyStyles(this.filterByConditionPanel, filterStyles.filterPanel);\n\n // 条件选择区域\n this.conditionContainer = document.createElement('div');\n applyStyles(this.conditionContainer, this.styles.conditionContainer);\n\n // 分类选择下拉框\n this.categoryLabel = createElement('label', {}, ['筛选类型:']);\n applyStyles(this.categoryLabel, this.styles.formLabel);\n\n this.categorySelect = createElement('select') as HTMLSelectElement;\n applyStyles(this.categorySelect, filterStyles.operatorSelect);\n\n // 添加分类选项\n this.categories.forEach(category => {\n const option = document.createElement('option');\n option.value = category.value;\n option.textContent = category.label;\n this.categorySelect.appendChild(option);\n });\n\n // 操作符选择下拉框\n this.operatorLabel = createElement('label', {}, ['筛选条件:']);\n applyStyles(this.operatorLabel, this.styles.formLabel);\n\n this.operatorSelect = createElement('select') as HTMLSelectElement;\n applyStyles(this.operatorSelect, filterStyles.operatorSelect);\n\n // 条件值输入框\n this.valueLabel = createElement('label', {}, ['筛选值:']);\n applyStyles(this.valueLabel, this.styles.formLabel);\n\n // 一个容器来包装两个输入框和\"和\"字\n this.rangeInputContainer = createElement('div');\n applyStyles(this.rangeInputContainer, this.styles.rangeInputContainer);\n\n this.valueInput = createElement('input', {\n type: 'text',\n placeholder: '请输入筛选值'\n }) as HTMLInputElement;\n applyStyles(this.valueInput, filterStyles.searchInput);\n\n // \"和\"字标签\n this.andLabel = createElement('span', {}, ['和']);\n applyStyles(this.andLabel, this.styles.addLabel);\n this.andLabel.style.display = 'none'; // 默认隐藏\n\n // 范围筛选的最大值输入框\n this.valueInputMax = createElement('input', {\n type: 'text',\n placeholder: '最大值'\n }) as HTMLInputElement;\n applyStyles(this.valueInputMax, filterStyles.searchInput);\n this.valueInputMax.style.display = 'none'; // 默认隐藏\n\n // 将输入框和\"和\"字添加到容器中\n this.rangeInputContainer.appendChild(this.valueInput);\n this.rangeInputContainer.appendChild(this.andLabel);\n this.rangeInputContainer.appendChild(this.valueInputMax);\n\n // 将元素添加到容器中\n this.conditionContainer.appendChild(this.categoryLabel);\n this.conditionContainer.appendChild(this.categorySelect);\n this.conditionContainer.appendChild(this.operatorLabel);\n this.conditionContainer.appendChild(this.operatorSelect);\n this.conditionContainer.appendChild(this.valueLabel);\n this.conditionContainer.appendChild(this.rangeInputContainer);\n\n this.filterByConditionPanel.appendChild(this.conditionContainer);\n container.appendChild(this.filterByConditionPanel);\n\n // 默认隐藏\n this.hide();\n\n // 初始化操作符选项\n this.updateOperatorOptions();\n this.bindEvents();\n }\n\n updateStyles(styles: FilterStyles) {\n applyStyles(this.filterByConditionPanel, styles.filterPanel);\n applyStyles(this.conditionContainer, styles.conditionContainer);\n applyStyles(this.categoryLabel, styles.formLabel);\n applyStyles(this.categorySelect, styles.operatorSelect);\n applyStyles(this.operatorLabel, styles.formLabel);\n applyStyles(this.operatorSelect, styles.operatorSelect);\n applyStyles(this.valueLabel, styles.formLabel);\n applyStyles(this.rangeInputContainer, styles.rangeInputContainer);\n applyStyles(this.valueInput, styles.searchInput);\n applyStyles(this.andLabel, styles.addLabel);\n applyStyles(this.valueInputMax, styles.searchInput);\n }\n\n /**\n * 绑定事件\n */\n private bindEvents(): void {\n // 输入框回车事件\n this.valueInput.addEventListener('keypress', event => {\n if (event.key === 'Enter') {\n this.applyFilter();\n this.filterToolBarHide();\n }\n });\n\n // 最大值输入框回车事件\n this.valueInputMax.addEventListener('keypress', event => {\n if (event.key === 'Enter') {\n this.applyFilter();\n this.filterToolBarHide();\n }\n });\n\n // 分类切换事件\n this.categorySelect.addEventListener('change', () => {\n this.handleCategoryChange();\n });\n\n // 操作符切换事件\n this.operatorSelect.addEventListener('change', () => {\n const selectedOperator = this.operatorSelect.value as FilterOperator;\n const andLabel = this.valueInput.nextElementSibling as HTMLElement;\n\n if (this.isRangeOperator(selectedOperator)) {\n this.valueInput.placeholder = '最小值';\n this.valueInputMax.style.display = 'inline-block';\n andLabel.style.display = 'inline-block';\n } else {\n this.valueInput.placeholder = '请输入筛选值';\n this.valueInputMax.style.display = 'none';\n andLabel.style.display = 'none';\n }\n });\n }\n\n /**\n * 显示筛选面板\n */\n show(): void {\n if (this.filterByConditionPanel) {\n this.filterByConditionPanel.style.display = 'block';\n this.loadCurrentFilterState();\n }\n }\n\n /**\n * 隐藏筛选面板\n */\n hide(): void {\n if (this.filterByConditionPanel) {\n this.filterByConditionPanel.style.display = 'none';\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.operators = exports.categories = void 0;
|
|
6
|
+
|
|
7
|
+
const types_1 = require("./types");
|
|
8
|
+
|
|
9
|
+
exports.categories = [ {
|
|
10
|
+
value: types_1.FilterOperatorCategory.ALL,
|
|
11
|
+
label: "全部"
|
|
12
|
+
}, {
|
|
13
|
+
value: types_1.FilterOperatorCategory.TEXT,
|
|
14
|
+
label: "文本"
|
|
15
|
+
}, {
|
|
16
|
+
value: types_1.FilterOperatorCategory.NUMBER,
|
|
17
|
+
label: "数值"
|
|
18
|
+
}, {
|
|
19
|
+
value: types_1.FilterOperatorCategory.COLOR,
|
|
20
|
+
label: "颜色"
|
|
21
|
+
}, {
|
|
22
|
+
value: types_1.FilterOperatorCategory.CHECKBOX,
|
|
23
|
+
label: "复选框"
|
|
24
|
+
}, {
|
|
25
|
+
value: types_1.FilterOperatorCategory.RADIO,
|
|
26
|
+
label: "单选框"
|
|
27
|
+
} ], exports.operators = [ {
|
|
28
|
+
value: "equals",
|
|
29
|
+
label: "等于",
|
|
30
|
+
category: types_1.FilterOperatorCategory.ALL
|
|
31
|
+
}, {
|
|
32
|
+
value: "notEquals",
|
|
33
|
+
label: "不等于",
|
|
34
|
+
category: types_1.FilterOperatorCategory.ALL
|
|
35
|
+
}, {
|
|
36
|
+
value: "equals",
|
|
37
|
+
label: "等于",
|
|
38
|
+
category: types_1.FilterOperatorCategory.NUMBER
|
|
39
|
+
}, {
|
|
40
|
+
value: "notEquals",
|
|
41
|
+
label: "不等于",
|
|
42
|
+
category: types_1.FilterOperatorCategory.NUMBER
|
|
43
|
+
}, {
|
|
44
|
+
value: "greaterThan",
|
|
45
|
+
label: "大于",
|
|
46
|
+
category: types_1.FilterOperatorCategory.NUMBER
|
|
47
|
+
}, {
|
|
48
|
+
value: "lessThan",
|
|
49
|
+
label: "小于",
|
|
50
|
+
category: types_1.FilterOperatorCategory.NUMBER
|
|
51
|
+
}, {
|
|
52
|
+
value: "greaterThanOrEqual",
|
|
53
|
+
label: "大于等于",
|
|
54
|
+
category: types_1.FilterOperatorCategory.NUMBER
|
|
55
|
+
}, {
|
|
56
|
+
value: "lessThanOrEqual",
|
|
57
|
+
label: "小于等于",
|
|
58
|
+
category: types_1.FilterOperatorCategory.NUMBER
|
|
59
|
+
}, {
|
|
60
|
+
value: "between",
|
|
61
|
+
label: "介于",
|
|
62
|
+
category: types_1.FilterOperatorCategory.NUMBER
|
|
63
|
+
}, {
|
|
64
|
+
value: "notBetween",
|
|
65
|
+
label: "不介于",
|
|
66
|
+
category: types_1.FilterOperatorCategory.NUMBER
|
|
67
|
+
}, {
|
|
68
|
+
value: "equals",
|
|
69
|
+
label: "等于",
|
|
70
|
+
category: types_1.FilterOperatorCategory.TEXT
|
|
71
|
+
}, {
|
|
72
|
+
value: "notEquals",
|
|
73
|
+
label: "不等于",
|
|
74
|
+
category: types_1.FilterOperatorCategory.TEXT
|
|
75
|
+
}, {
|
|
76
|
+
value: "contains",
|
|
77
|
+
label: "包含",
|
|
78
|
+
category: types_1.FilterOperatorCategory.TEXT
|
|
79
|
+
}, {
|
|
80
|
+
value: "notContains",
|
|
81
|
+
label: "不包含",
|
|
82
|
+
category: types_1.FilterOperatorCategory.TEXT
|
|
83
|
+
}, {
|
|
84
|
+
value: "startsWith",
|
|
85
|
+
label: "开头是",
|
|
86
|
+
category: types_1.FilterOperatorCategory.TEXT
|
|
87
|
+
}, {
|
|
88
|
+
value: "notStartsWith",
|
|
89
|
+
label: "开头不是",
|
|
90
|
+
category: types_1.FilterOperatorCategory.TEXT
|
|
91
|
+
}, {
|
|
92
|
+
value: "endsWith",
|
|
93
|
+
label: "结尾是",
|
|
94
|
+
category: types_1.FilterOperatorCategory.TEXT
|
|
95
|
+
}, {
|
|
96
|
+
value: "notEndsWith",
|
|
97
|
+
label: "结尾不是",
|
|
98
|
+
category: types_1.FilterOperatorCategory.TEXT
|
|
99
|
+
}, {
|
|
100
|
+
value: "equals",
|
|
101
|
+
label: "等于",
|
|
102
|
+
category: types_1.FilterOperatorCategory.COLOR
|
|
103
|
+
}, {
|
|
104
|
+
value: "notEquals",
|
|
105
|
+
label: "不等于",
|
|
106
|
+
category: types_1.FilterOperatorCategory.COLOR
|
|
107
|
+
}, {
|
|
108
|
+
value: "isChecked",
|
|
109
|
+
label: "已选中",
|
|
110
|
+
category: types_1.FilterOperatorCategory.CHECKBOX
|
|
111
|
+
}, {
|
|
112
|
+
value: "isUnchecked",
|
|
113
|
+
label: "未选中",
|
|
114
|
+
category: types_1.FilterOperatorCategory.CHECKBOX
|
|
115
|
+
}, {
|
|
116
|
+
value: "isChecked",
|
|
117
|
+
label: "已选中",
|
|
118
|
+
category: types_1.FilterOperatorCategory.RADIO
|
|
119
|
+
}, {
|
|
120
|
+
value: "isUnchecked",
|
|
121
|
+
label: "未选中",
|
|
122
|
+
category: types_1.FilterOperatorCategory.RADIO
|
|
123
|
+
} ];
|
|
124
|
+
//# sourceMappingURL=constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/filter/constant.ts"],"names":[],"mappings":";;;AACA,mCAAiD;AAGpC,QAAA,UAAU,GAAG;IACxB,EAAE,KAAK,EAAE,8BAAsB,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE;IAClD,EAAE,KAAK,EAAE,8BAAsB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;IACnD,EAAE,KAAK,EAAE,8BAAsB,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE;IACrD,EAAE,KAAK,EAAE,8BAAsB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;IACpD,EAAE,KAAK,EAAE,8BAAsB,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE;IACxD,EAAE,KAAK,EAAE,8BAAsB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;CACtD,CAAC;AAGW,QAAA,SAAS,GAAqB;IAEzC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,8BAAs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E;IACzE,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,8BAAsB,CAAC,IAAI,EAAE;IAC7E,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,8BAAsB,CAAC,IAAI,EAAE;IAC5E,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,8BAAsB,CAAC,IAAI,EAAE;IAChF,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,8BAAsB,CAAC,IAAI,EAAE;IAC1E,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,8BAAsB,CAAC,IAAI,EAAE;IAG9E,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,8BAAsB,CAAC,KAAK,EAAE;IACxE,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,8BAAsB,CAAC,KAAK,EAAE;IAG5E,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,8BAAsB,CAAC,QAAQ,EAAE;IAC/E,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,8BAAsB,CAAC,QAAQ,EAAE;IAGjF,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,8BAAsB,CAAC,KAAK,EAAE;IAC5E,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,8BAAsB,CAAC,KAAK,EAAE;CAC/E,CAAC","file":"constant.js","sourcesContent":["import type { OperatorOption } from './types';\nimport { FilterOperatorCategory } from './types';\n\n// 分类下拉选项\nexport const categories = [\n { value: FilterOperatorCategory.ALL, label: '全部' },\n { value: FilterOperatorCategory.TEXT, label: '文本' },\n { value: FilterOperatorCategory.NUMBER, label: '数值' },\n { value: FilterOperatorCategory.COLOR, label: '颜色' },\n { value: FilterOperatorCategory.CHECKBOX, label: '复选框' },\n { value: FilterOperatorCategory.RADIO, label: '单选框' }\n];\n\n// 按分类组织的操作符选项\nexport const operators: OperatorOption[] = [\n // 通用操作符 (全部分类中显示)\n { value: 'equals', label: '等于', category: FilterOperatorCategory.ALL },\n { value: 'notEquals', label: '不等于', category: FilterOperatorCategory.ALL },\n\n // 数值操作符\n { value: 'equals', label: '等于', category: FilterOperatorCategory.NUMBER },\n { value: 'notEquals', label: '不等于', category: FilterOperatorCategory.NUMBER },\n { value: 'greaterThan', label: '大于', category: FilterOperatorCategory.NUMBER },\n { value: 'lessThan', label: '小于', category: FilterOperatorCategory.NUMBER },\n { value: 'greaterThanOrEqual', label: '大于等于', category: FilterOperatorCategory.NUMBER },\n { value: 'lessThanOrEqual', label: '小于等于', category: FilterOperatorCategory.NUMBER },\n { value: 'between', label: '介于', category: FilterOperatorCategory.NUMBER },\n { value: 'notBetween', label: '不介于', category: FilterOperatorCategory.NUMBER },\n\n // 文本操作符\n { value: 'equals', label: '等于', category: FilterOperatorCategory.TEXT },\n { value: 'notEquals', label: '不等于', category: FilterOperatorCategory.TEXT },\n { value: 'contains', label: '包含', category: FilterOperatorCategory.TEXT },\n { value: 'notContains', label: '不包含', category: FilterOperatorCategory.TEXT },\n { value: 'startsWith', label: '开头是', category: FilterOperatorCategory.TEXT },\n { value: 'notStartsWith', label: '开头不是', category: FilterOperatorCategory.TEXT },\n { value: 'endsWith', label: '结尾是', category: FilterOperatorCategory.TEXT },\n { value: 'notEndsWith', label: '结尾不是', category: FilterOperatorCategory.TEXT },\n\n // 颜色操作符\n { value: 'equals', label: '等于', category: FilterOperatorCategory.COLOR },\n { value: 'notEquals', label: '不等于', category: FilterOperatorCategory.COLOR },\n\n // 复选框操作符\n { value: 'isChecked', label: '已选中', category: FilterOperatorCategory.CHECKBOX },\n { value: 'isUnchecked', label: '未选中', category: FilterOperatorCategory.CHECKBOX },\n\n // 单选框操作符\n { value: 'isChecked', label: '已选中', category: FilterOperatorCategory.RADIO },\n { value: 'isUnchecked', label: '未选中', category: FilterOperatorCategory.RADIO }\n];\n"]}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ListTable, PivotTable, TYPES } from '@visactor/vtable';
|
|
2
|
-
import type { FilterState } from './types';
|
|
2
|
+
import type { FilterState, FilterOptions } from './types';
|
|
3
3
|
export declare class FilterEngine {
|
|
4
4
|
filterFuncRule: (TYPES.FilterFuncRule & {
|
|
5
5
|
fieldId?: string;
|
|
6
6
|
})[];
|
|
7
7
|
filterValueRule: TYPES.FilterValueRule[];
|
|
8
|
+
private pluginOptions;
|
|
9
|
+
constructor(filterPluginOptions: FilterOptions);
|
|
8
10
|
applyFilter(state: FilterState, table: ListTable | PivotTable): void;
|
|
9
11
|
private createFilterFunction;
|
|
10
12
|
private compareValues;
|