@univerjs/sheets-filter-ui 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +70 -2
- package/lib/cjs/locale/ca-ES.js +1 -1
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/es-ES.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ja-JP.js +1 -1
- package/lib/cjs/locale/ko-KR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/sk-SK.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/index.js +70 -2433
- package/lib/es/locale/ca-ES.js +1 -85
- package/lib/es/locale/en-US.js +1 -85
- package/lib/es/locale/es-ES.js +1 -85
- package/lib/es/locale/fa-IR.js +1 -85
- package/lib/es/locale/fr-FR.js +1 -85
- package/lib/es/locale/ja-JP.js +1 -85
- package/lib/es/locale/ko-KR.js +1 -85
- package/lib/es/locale/ru-RU.js +1 -85
- package/lib/es/locale/sk-SK.js +1 -85
- package/lib/es/locale/vi-VN.js +1 -85
- package/lib/es/locale/zh-CN.js +1 -85
- package/lib/es/locale/zh-TW.js +1 -85
- package/lib/index.css +393 -1
- package/lib/index.js +70 -2433
- package/lib/locale/ca-ES.js +1 -85
- package/lib/locale/en-US.js +1 -85
- package/lib/locale/es-ES.js +1 -85
- package/lib/locale/fa-IR.js +1 -85
- package/lib/locale/fr-FR.js +1 -85
- package/lib/locale/ja-JP.js +1 -85
- package/lib/locale/ko-KR.js +1 -85
- package/lib/locale/ru-RU.js +1 -85
- package/lib/locale/sk-SK.js +1 -85
- package/lib/locale/vi-VN.js +1 -85
- package/lib/locale/zh-CN.js +1 -85
- package/lib/locale/zh-TW.js +1 -85
- package/lib/types/__testing__/data.d.ts +16 -1
- package/lib/types/commands/operations/sheets-filter.operation.d.ts +17 -2
- package/lib/types/config/config.d.ts +16 -1
- package/lib/types/controllers/sheets-filter-permission.controller.d.ts +16 -1
- package/lib/types/controllers/sheets-filter-ui-desktop.controller.d.ts +15 -0
- package/lib/types/controllers/sheets-filter-ui-mobile.controller.d.ts +15 -0
- package/lib/types/controllers/sheets-filter.shortcut.d.ts +16 -1
- package/lib/types/locale/ca-ES.d.ts +16 -1
- package/lib/types/locale/es-ES.d.ts +16 -1
- package/lib/types/locale/fa-IR.d.ts +16 -1
- package/lib/types/locale/fr-FR.d.ts +16 -1
- package/lib/types/locale/ja-JP.d.ts +16 -1
- package/lib/types/locale/ko-KR.d.ts +16 -1
- package/lib/types/locale/ru-RU.d.ts +16 -1
- package/lib/types/locale/sk-SK.d.ts +16 -1
- package/lib/types/locale/vi-VN.d.ts +16 -1
- package/lib/types/locale/zh-CN.d.ts +16 -1
- package/lib/types/locale/zh-TW.d.ts +16 -1
- package/lib/types/menu/schema.d.ts +16 -1
- package/lib/types/menu/sheets-filter.menu.d.ts +17 -2
- package/lib/types/mobile-plugin.d.ts +16 -1
- package/lib/types/models/conditions.d.ts +18 -2
- package/lib/types/models/utils.d.ts +16 -1
- package/lib/types/plugin.d.ts +16 -1
- package/lib/types/services/sheets-filter-panel.service.d.ts +22 -5
- package/lib/types/services/util.d.ts +16 -1
- package/lib/types/views/components/SheetsFilterByColorsPanel.d.ts +16 -1
- package/lib/types/views/components/SheetsFilterByConditionsPanel.d.ts +16 -1
- package/lib/types/views/components/SheetsFilterByValuesPanel.d.ts +16 -1
- package/lib/types/views/components/SheetsFilterPanel.stories.d.ts +16 -1
- package/lib/types/views/render-modules/sheets-filter.render-controller.d.ts +18 -2
- package/lib/types/views/widgets/drawings.d.ts +16 -1
- package/lib/types/views/widgets/filter-button.shape.d.ts +17 -1
- package/lib/types/worker/generate-filter-values.service.d.ts +20 -4
- package/lib/types/worker/plugin.d.ts +15 -0
- package/lib/umd/index.js +70 -2
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +15 -14
package/lib/es/index.js
CHANGED
|
@@ -1,2438 +1,75 @@
|
|
|
1
|
-
var cr = Object.defineProperty;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
testMappingParams: ({ operator1: i }) => i === g.NOT_EMPTY,
|
|
54
|
-
mapToFilterColumn: () => ({ customFilters: { customFilters: [{ val: "", operator: u.NOT_EQUALS }] } }),
|
|
55
|
-
testMappingFilterColumn: (i) => {
|
|
56
|
-
var c;
|
|
57
|
-
if (((c = i.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
|
|
58
|
-
return !1;
|
|
59
|
-
const o = i.customFilters.customFilters[0];
|
|
60
|
-
return o.val === " " && o.operator === u.NOT_EQUALS ? { operator1: g.NOT_EMPTY } : !1;
|
|
61
|
-
}
|
|
62
|
-
}, t.TEXT_CONTAINS = {
|
|
63
|
-
label: "sheets-filter.conditions.text-contains",
|
|
64
|
-
operator: g.CONTAINS,
|
|
65
|
-
order: b.FIRST,
|
|
66
|
-
numOfParameters: 1,
|
|
67
|
-
getDefaultFormParams: () => ({ operator1: g.CONTAINS, val1: "" }),
|
|
68
|
-
testMappingParams: (i) => {
|
|
69
|
-
const [o] = x(i);
|
|
70
|
-
return o === g.CONTAINS;
|
|
71
|
-
},
|
|
72
|
-
mapToFilterColumn: (i) => {
|
|
73
|
-
const { val1: o } = i;
|
|
74
|
-
return o === "" ? null : {
|
|
75
|
-
customFilters: { customFilters: [{ val: `*${o}*` }] }
|
|
76
|
-
};
|
|
77
|
-
},
|
|
78
|
-
testMappingFilterColumn: (i) => {
|
|
79
|
-
var c;
|
|
80
|
-
if (((c = i.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
|
|
81
|
-
return !1;
|
|
82
|
-
const o = i.customFilters.customFilters[0], l = o.val.toString();
|
|
83
|
-
return !o.operator && l.startsWith("*") && l.endsWith("*") ? { operator1: g.CONTAINS, val1: l.slice(1, -1) } : !1;
|
|
84
|
-
}
|
|
85
|
-
}, t.DOES_NOT_CONTAIN = {
|
|
86
|
-
label: "sheets-filter.conditions.does-not-contain",
|
|
87
|
-
operator: g.DOES_NOT_CONTAIN,
|
|
88
|
-
order: b.FIRST,
|
|
89
|
-
numOfParameters: 1,
|
|
90
|
-
getDefaultFormParams: () => ({ operator1: g.DOES_NOT_CONTAIN, val1: "" }),
|
|
91
|
-
mapToFilterColumn: (i) => ({
|
|
92
|
-
customFilters: { customFilters: [{ val: `*${i.val1}*`, operator: u.NOT_EQUALS }] }
|
|
93
|
-
}),
|
|
94
|
-
testMappingParams: (i) => {
|
|
95
|
-
const [o] = x(i);
|
|
96
|
-
return o === g.DOES_NOT_CONTAIN;
|
|
97
|
-
},
|
|
98
|
-
testMappingFilterColumn: (i) => {
|
|
99
|
-
var c;
|
|
100
|
-
if (((c = i.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
|
|
101
|
-
return !1;
|
|
102
|
-
const o = i.customFilters.customFilters[0], l = o.val.toString();
|
|
103
|
-
return o.operator === u.NOT_EQUALS && l.startsWith("*") && l.endsWith("*") ? { operator1: g.DOES_NOT_CONTAIN, val1: l.slice(1, -1) } : !1;
|
|
104
|
-
}
|
|
105
|
-
}, t.STARTS_WITH = {
|
|
106
|
-
label: "sheets-filter.conditions.starts-with",
|
|
107
|
-
operator: g.STARTS_WITH,
|
|
108
|
-
order: b.FIRST,
|
|
109
|
-
numOfParameters: 1,
|
|
110
|
-
getDefaultFormParams: () => ({ operator1: g.STARTS_WITH, val1: "" }),
|
|
111
|
-
mapToFilterColumn: (i) => ({
|
|
112
|
-
customFilters: { customFilters: [{ val: `${i.val1}*` }] }
|
|
113
|
-
}),
|
|
114
|
-
testMappingParams: (i) => {
|
|
115
|
-
const [o] = x(i);
|
|
116
|
-
return o === g.STARTS_WITH;
|
|
117
|
-
},
|
|
118
|
-
testMappingFilterColumn: (i) => {
|
|
119
|
-
var c;
|
|
120
|
-
if (((c = i.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
|
|
121
|
-
return !1;
|
|
122
|
-
const o = i.customFilters.customFilters[0], l = o.val.toString();
|
|
123
|
-
return !o.operator && l.endsWith("*") && !l.startsWith("*") ? { operator1: g.STARTS_WITH, val1: l.slice(0, -1) } : !1;
|
|
124
|
-
}
|
|
125
|
-
}, t.ENDS_WITH = {
|
|
126
|
-
label: "sheets-filter.conditions.ends-with",
|
|
127
|
-
operator: g.ENDS_WITH,
|
|
128
|
-
order: b.FIRST,
|
|
129
|
-
numOfParameters: 1,
|
|
130
|
-
getDefaultFormParams: () => ({ operator1: g.ENDS_WITH, val1: "" }),
|
|
131
|
-
mapToFilterColumn: (i) => ({
|
|
132
|
-
customFilters: { customFilters: [{ val: `*${i.val1}` }] }
|
|
133
|
-
}),
|
|
134
|
-
testMappingParams: (i) => {
|
|
135
|
-
const [o] = x(i);
|
|
136
|
-
return o === g.ENDS_WITH;
|
|
137
|
-
},
|
|
138
|
-
testMappingFilterColumn: (i) => {
|
|
139
|
-
var c;
|
|
140
|
-
if (((c = i.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
|
|
141
|
-
return !1;
|
|
142
|
-
const o = i.customFilters.customFilters[0], l = o.val.toString();
|
|
143
|
-
return !o.operator && l.startsWith("*") && !l.endsWith("*") ? { operator1: g.ENDS_WITH, val1: l.slice(1) } : !1;
|
|
144
|
-
}
|
|
145
|
-
}, t.EQUALS = {
|
|
146
|
-
label: "sheets-filter.conditions.equals",
|
|
147
|
-
operator: g.EQUALS,
|
|
148
|
-
order: b.FIRST,
|
|
149
|
-
numOfParameters: 1,
|
|
150
|
-
getDefaultFormParams: () => ({ operator1: g.EQUALS, val1: "" }),
|
|
151
|
-
testMappingParams: (i) => {
|
|
152
|
-
const [o] = x(i);
|
|
153
|
-
return o === g.EQUALS;
|
|
154
|
-
},
|
|
155
|
-
mapToFilterColumn: (i) => {
|
|
156
|
-
const { val1: o } = i;
|
|
157
|
-
return o === "" ? null : {
|
|
158
|
-
customFilters: { customFilters: [{ val: o }] }
|
|
159
|
-
};
|
|
160
|
-
},
|
|
161
|
-
testMappingFilterColumn: (i) => {
|
|
162
|
-
var o, l, c;
|
|
163
|
-
return ((l = (o = i.filters) == null ? void 0 : o.filters) == null ? void 0 : l.length) === 1 ? { operator1: g.EQUALS, val1: "" } : ((c = i.customFilters) == null ? void 0 : c.customFilters.length) === 1 && !i.customFilters.customFilters[0].operator ? { operator1: g.EQUALS, val1: i.customFilters.customFilters[0].val.toString() } : !1;
|
|
164
|
-
}
|
|
165
|
-
}, t.GREATER_THAN = {
|
|
166
|
-
label: "sheets-filter.conditions.greater-than",
|
|
167
|
-
operator: u.GREATER_THAN,
|
|
168
|
-
numOfParameters: 1,
|
|
169
|
-
order: b.FIRST,
|
|
170
|
-
getDefaultFormParams: () => ({ operator1: u.GREATER_THAN, val1: "" }),
|
|
171
|
-
mapToFilterColumn: (i) => ({
|
|
172
|
-
customFilters: { customFilters: [{ val: i.val1, operator: u.GREATER_THAN }] }
|
|
173
|
-
}),
|
|
174
|
-
testMappingParams: (i) => {
|
|
175
|
-
const [o] = x(i);
|
|
176
|
-
return o === u.GREATER_THAN;
|
|
177
|
-
},
|
|
178
|
-
testMappingFilterColumn: (i) => {
|
|
179
|
-
var l;
|
|
180
|
-
if (((l = i.customFilters) == null ? void 0 : l.customFilters.length) !== 1)
|
|
181
|
-
return !1;
|
|
182
|
-
const o = i.customFilters.customFilters[0];
|
|
183
|
-
return o.operator !== u.GREATER_THAN ? !1 : { operator1: u.GREATER_THAN, val1: o.val.toString() };
|
|
184
|
-
}
|
|
185
|
-
}, t.GREATER_THAN_OR_EQUAL = {
|
|
186
|
-
label: "sheets-filter.conditions.greater-than-or-equal",
|
|
187
|
-
operator: u.GREATER_THAN_OR_EQUAL,
|
|
188
|
-
numOfParameters: 1,
|
|
189
|
-
order: b.FIRST,
|
|
190
|
-
getDefaultFormParams: () => ({ operator1: u.GREATER_THAN_OR_EQUAL, val1: "" }),
|
|
191
|
-
testMappingParams: (i) => {
|
|
192
|
-
const [o] = x(i);
|
|
193
|
-
return o === u.GREATER_THAN_OR_EQUAL;
|
|
194
|
-
},
|
|
195
|
-
mapToFilterColumn: (i) => ({
|
|
196
|
-
customFilters: { customFilters: [{ val: i.val1, operator: u.GREATER_THAN_OR_EQUAL }] }
|
|
197
|
-
}),
|
|
198
|
-
testMappingFilterColumn: (i) => {
|
|
199
|
-
var l;
|
|
200
|
-
if (((l = i.customFilters) == null ? void 0 : l.customFilters.length) !== 1)
|
|
201
|
-
return !1;
|
|
202
|
-
const o = i.customFilters.customFilters[0];
|
|
203
|
-
return o.operator !== u.GREATER_THAN_OR_EQUAL ? !1 : { operator1: u.GREATER_THAN_OR_EQUAL, val1: o.val.toString() };
|
|
204
|
-
}
|
|
205
|
-
}, t.LESS_THAN = {
|
|
206
|
-
label: "sheets-filter.conditions.less-than",
|
|
207
|
-
operator: u.LESS_THAN,
|
|
208
|
-
numOfParameters: 1,
|
|
209
|
-
order: b.FIRST,
|
|
210
|
-
getDefaultFormParams: () => ({ operator1: u.LESS_THAN, val1: "" }),
|
|
211
|
-
testMappingParams: (i) => {
|
|
212
|
-
const [o] = x(i);
|
|
213
|
-
return o === u.LESS_THAN;
|
|
214
|
-
},
|
|
215
|
-
mapToFilterColumn: (i) => ({
|
|
216
|
-
customFilters: { customFilters: [{ val: i.val1, operator: u.LESS_THAN }] }
|
|
217
|
-
}),
|
|
218
|
-
testMappingFilterColumn: (i) => {
|
|
219
|
-
var l;
|
|
220
|
-
if (((l = i.customFilters) == null ? void 0 : l.customFilters.length) !== 1)
|
|
221
|
-
return !1;
|
|
222
|
-
const o = i.customFilters.customFilters[0];
|
|
223
|
-
return o.operator !== u.LESS_THAN ? !1 : { operator1: u.LESS_THAN, val1: o.val.toString() };
|
|
224
|
-
}
|
|
225
|
-
}, t.LESS_THAN_OR_EQUAL = {
|
|
226
|
-
label: "sheets-filter.conditions.less-than-or-equal",
|
|
227
|
-
operator: u.LESS_THAN_OR_EQUAL,
|
|
228
|
-
numOfParameters: 1,
|
|
229
|
-
order: b.FIRST,
|
|
230
|
-
getDefaultFormParams: () => ({ operator1: u.LESS_THAN_OR_EQUAL, val1: "" }),
|
|
231
|
-
testMappingParams: (i) => {
|
|
232
|
-
const [o] = x(i);
|
|
233
|
-
return o === u.LESS_THAN_OR_EQUAL;
|
|
234
|
-
},
|
|
235
|
-
mapToFilterColumn: (i) => ({
|
|
236
|
-
customFilters: { customFilters: [{ val: i.val1, operator: u.LESS_THAN_OR_EQUAL }] }
|
|
237
|
-
}),
|
|
238
|
-
testMappingFilterColumn: (i) => {
|
|
239
|
-
var l;
|
|
240
|
-
if (((l = i.customFilters) == null ? void 0 : l.customFilters.length) !== 1)
|
|
241
|
-
return !1;
|
|
242
|
-
const o = i.customFilters.customFilters[0];
|
|
243
|
-
return o.operator !== u.LESS_THAN_OR_EQUAL ? !1 : { operator1: u.LESS_THAN_OR_EQUAL, val1: o.val.toString() };
|
|
244
|
-
}
|
|
245
|
-
}, t.EQUAL = {
|
|
246
|
-
label: "sheets-filter.conditions.equal",
|
|
247
|
-
operator: u.EQUAL,
|
|
248
|
-
numOfParameters: 1,
|
|
249
|
-
order: b.FIRST,
|
|
250
|
-
getDefaultFormParams: () => ({ operator1: u.EQUAL, val1: "" }),
|
|
251
|
-
testMappingParams: (i) => {
|
|
252
|
-
const [o] = x(i);
|
|
253
|
-
return o === u.EQUAL;
|
|
254
|
-
},
|
|
255
|
-
mapToFilterColumn: (i) => ({
|
|
256
|
-
customFilters: { customFilters: [{ val: i.val1, operator: u.EQUAL }] }
|
|
257
|
-
}),
|
|
258
|
-
testMappingFilterColumn: (i) => {
|
|
259
|
-
var l;
|
|
260
|
-
if (((l = i.customFilters) == null ? void 0 : l.customFilters.length) !== 1)
|
|
261
|
-
return !1;
|
|
262
|
-
const o = i.customFilters.customFilters[0];
|
|
263
|
-
return o.operator !== u.EQUAL ? !1 : { operator1: u.EQUAL, val1: o.val.toString() };
|
|
264
|
-
}
|
|
265
|
-
}, t.NOT_EQUAL = {
|
|
266
|
-
label: "sheets-filter.conditions.not-equal",
|
|
267
|
-
operator: u.NOT_EQUALS,
|
|
268
|
-
numOfParameters: 1,
|
|
269
|
-
order: b.FIRST,
|
|
270
|
-
getDefaultFormParams: () => ({ operator1: u.NOT_EQUALS, val1: "" }),
|
|
271
|
-
testMappingParams: (i) => {
|
|
272
|
-
const [o] = x(i);
|
|
273
|
-
return o === u.NOT_EQUALS;
|
|
274
|
-
},
|
|
275
|
-
mapToFilterColumn: (i) => ({
|
|
276
|
-
customFilters: { customFilters: [{ val: i.val1, operator: u.NOT_EQUALS }] }
|
|
277
|
-
}),
|
|
278
|
-
testMappingFilterColumn: (i) => {
|
|
279
|
-
var l;
|
|
280
|
-
if (((l = i.customFilters) == null ? void 0 : l.customFilters.length) !== 1)
|
|
281
|
-
return !1;
|
|
282
|
-
const o = i.customFilters.customFilters[0];
|
|
283
|
-
return o.operator !== u.NOT_EQUALS ? !1 : { operator1: u.NOT_EQUALS, val1: o.val.toString() };
|
|
284
|
-
}
|
|
285
|
-
}, t.BETWEEN = {
|
|
286
|
-
label: "sheets-filter.conditions.between",
|
|
287
|
-
operator: g.BETWEEN,
|
|
288
|
-
order: b.SECOND,
|
|
289
|
-
numOfParameters: 2,
|
|
290
|
-
getDefaultFormParams: () => ({
|
|
291
|
-
and: !0,
|
|
292
|
-
operator1: u.GREATER_THAN_OR_EQUAL,
|
|
293
|
-
val1: "",
|
|
294
|
-
operator2: u.LESS_THAN_OR_EQUAL,
|
|
295
|
-
val2: ""
|
|
296
|
-
}),
|
|
297
|
-
testMappingParams: (i) => {
|
|
298
|
-
const { and: o, operator1: l, operator2: c } = i;
|
|
299
|
-
if (!o) return !1;
|
|
300
|
-
const h = [l, c];
|
|
301
|
-
return h.includes(u.GREATER_THAN_OR_EQUAL) && h.includes(u.LESS_THAN_OR_EQUAL);
|
|
302
|
-
},
|
|
303
|
-
mapToFilterColumn: (i) => {
|
|
304
|
-
const { val1: o, val2: l, operator1: c } = i, h = c === u.GREATER_THAN_OR_EQUAL;
|
|
305
|
-
return {
|
|
306
|
-
customFilters: {
|
|
307
|
-
and: _t.TRUE,
|
|
308
|
-
customFilters: [
|
|
309
|
-
{ val: h ? o : l, operator: u.GREATER_THAN_OR_EQUAL },
|
|
310
|
-
{ val: h ? l : o, operator: u.LESS_THAN_OR_EQUAL }
|
|
311
|
-
]
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
},
|
|
315
|
-
testMappingFilterColumn: (i) => {
|
|
316
|
-
var c;
|
|
317
|
-
if (((c = i.customFilters) == null ? void 0 : c.customFilters.length) !== 2)
|
|
318
|
-
return !1;
|
|
319
|
-
const [o, l] = i.customFilters.customFilters;
|
|
320
|
-
return o.operator === u.GREATER_THAN_OR_EQUAL && l.operator === u.LESS_THAN_OR_EQUAL && i.customFilters.and ? {
|
|
321
|
-
and: !0,
|
|
322
|
-
operator1: u.GREATER_THAN_OR_EQUAL,
|
|
323
|
-
val1: o.val.toString(),
|
|
324
|
-
operator2: u.LESS_THAN_OR_EQUAL,
|
|
325
|
-
val2: l.val.toString()
|
|
326
|
-
} : l.operator === u.GREATER_THAN_OR_EQUAL && o.operator === u.LESS_THAN_OR_EQUAL && i.customFilters.and ? {
|
|
327
|
-
and: !0,
|
|
328
|
-
operator1: u.GREATER_THAN_OR_EQUAL,
|
|
329
|
-
val1: l.val.toString(),
|
|
330
|
-
operator2: u.LESS_THAN_OR_EQUAL,
|
|
331
|
-
val2: o.val.toLocaleString()
|
|
332
|
-
} : !1;
|
|
333
|
-
}
|
|
334
|
-
}, t.NOT_BETWEEN = {
|
|
335
|
-
label: "sheets-filter.conditions.not-between",
|
|
336
|
-
operator: g.NOT_BETWEEN,
|
|
337
|
-
order: b.SECOND,
|
|
338
|
-
numOfParameters: 2,
|
|
339
|
-
getDefaultFormParams: () => ({
|
|
340
|
-
operator1: u.LESS_THAN,
|
|
341
|
-
val1: "",
|
|
342
|
-
operator2: u.GREATER_THAN,
|
|
343
|
-
val2: ""
|
|
344
|
-
}),
|
|
345
|
-
testMappingParams: (i) => {
|
|
346
|
-
const { and: o, operator1: l, operator2: c } = i;
|
|
347
|
-
if (o) return !1;
|
|
348
|
-
const h = [l, c];
|
|
349
|
-
return h.includes(u.GREATER_THAN) && h.includes(u.LESS_THAN);
|
|
350
|
-
},
|
|
351
|
-
mapToFilterColumn: (i) => {
|
|
352
|
-
const { val1: o, val2: l, operator1: c } = i, h = c === u.GREATER_THAN;
|
|
353
|
-
return {
|
|
354
|
-
customFilters: {
|
|
355
|
-
customFilters: [
|
|
356
|
-
{ val: h ? o : l, operator: u.GREATER_THAN },
|
|
357
|
-
{ val: h ? l : o, operator: u.LESS_THAN }
|
|
358
|
-
]
|
|
359
|
-
}
|
|
360
|
-
};
|
|
361
|
-
},
|
|
362
|
-
testMappingFilterColumn: (i) => {
|
|
363
|
-
var c;
|
|
364
|
-
if (((c = i.customFilters) == null ? void 0 : c.customFilters.length) !== 2)
|
|
365
|
-
return !1;
|
|
366
|
-
const [o, l] = i.customFilters.customFilters;
|
|
367
|
-
return o.operator === u.LESS_THAN && l.operator === u.GREATER_THAN && !i.customFilters.and ? {
|
|
368
|
-
operator1: u.LESS_THAN,
|
|
369
|
-
val1: o.val.toString(),
|
|
370
|
-
operator2: u.GREATER_THAN,
|
|
371
|
-
val2: l.val.toString()
|
|
372
|
-
} : l.operator === u.LESS_THAN && o.operator === u.GREATER_THAN && !i.customFilters.and ? {
|
|
373
|
-
operator1: u.GREATER_THAN,
|
|
374
|
-
val1: l.val.toString(),
|
|
375
|
-
operator2: u.LESS_THAN,
|
|
376
|
-
val2: o.val.toLocaleString()
|
|
377
|
-
} : !1;
|
|
378
|
-
}
|
|
379
|
-
}, t.CUSTOM = {
|
|
380
|
-
label: "sheets-filter.conditions.custom",
|
|
381
|
-
operator: g.CUSTOM,
|
|
382
|
-
order: b.SECOND,
|
|
383
|
-
numOfParameters: 2,
|
|
384
|
-
getDefaultFormParams: () => ({
|
|
385
|
-
operator1: g.NONE,
|
|
386
|
-
val1: "",
|
|
387
|
-
operator2: g.NONE,
|
|
388
|
-
val2: ""
|
|
389
|
-
}),
|
|
390
|
-
testMappingParams: () => !0,
|
|
391
|
-
mapToFilterColumn: (i) => {
|
|
392
|
-
const { and: o, val1: l, val2: c, operator1: h, operator2: m } = i;
|
|
393
|
-
function S(R, O) {
|
|
394
|
-
for (const A of t.ALL_CONDITIONS)
|
|
395
|
-
if (A.operator === R)
|
|
396
|
-
return A.mapToFilterColumn({ val1: O, operator1: R });
|
|
397
|
-
}
|
|
398
|
-
const p = !h || h === t.NONE.operator, _ = !m || m === t.NONE.operator;
|
|
399
|
-
if (p && _)
|
|
400
|
-
return t.NONE.mapToFilterColumn({});
|
|
401
|
-
if (p)
|
|
402
|
-
return S(m, c);
|
|
403
|
-
if (_)
|
|
404
|
-
return S(h, l);
|
|
405
|
-
const C = S(h, l), N = S(m, c), F = {
|
|
406
|
-
customFilters: [
|
|
407
|
-
C.customFilters.customFilters[0],
|
|
408
|
-
N.customFilters.customFilters[0]
|
|
409
|
-
]
|
|
410
|
-
};
|
|
411
|
-
return o && (F.and = _t.TRUE), { customFilters: F };
|
|
412
|
-
},
|
|
413
|
-
testMappingFilterColumn: (i) => {
|
|
414
|
-
var c;
|
|
415
|
-
if (((c = i.customFilters) == null ? void 0 : c.customFilters.length) !== 2)
|
|
416
|
-
return !1;
|
|
417
|
-
const o = i.customFilters.customFilters.map((h) => a({ customFilters: { customFilters: [h] } })), l = {
|
|
418
|
-
operator1: o[0][0].operator,
|
|
419
|
-
val1: o[0][1].val1,
|
|
420
|
-
operator2: o[1][0].operator,
|
|
421
|
-
val2: o[1][1].val1
|
|
422
|
-
};
|
|
423
|
-
return i.customFilters.and && (l.and = !0), l;
|
|
424
|
-
}
|
|
425
|
-
}, t.ALL_CONDITIONS = [
|
|
426
|
-
// ------------------------------
|
|
427
|
-
t.NONE,
|
|
428
|
-
// ------------------------------
|
|
429
|
-
t.EMPTY,
|
|
430
|
-
t.NOT_EMPTY,
|
|
431
|
-
// ------------------------------
|
|
432
|
-
t.TEXT_CONTAINS,
|
|
433
|
-
t.DOES_NOT_CONTAIN,
|
|
434
|
-
t.STARTS_WITH,
|
|
435
|
-
t.ENDS_WITH,
|
|
436
|
-
t.EQUALS,
|
|
437
|
-
// ------------------------------
|
|
438
|
-
t.GREATER_THAN,
|
|
439
|
-
t.GREATER_THAN_OR_EQUAL,
|
|
440
|
-
t.LESS_THAN,
|
|
441
|
-
t.LESS_THAN_OR_EQUAL,
|
|
442
|
-
t.EQUAL,
|
|
443
|
-
t.NOT_EQUAL,
|
|
444
|
-
t.BETWEEN,
|
|
445
|
-
t.NOT_BETWEEN,
|
|
446
|
-
// ------------------------------
|
|
447
|
-
t.CUSTOM
|
|
448
|
-
];
|
|
449
|
-
function e(i) {
|
|
450
|
-
const o = t.ALL_CONDITIONS.find((l) => l.operator === i);
|
|
451
|
-
if (!o)
|
|
452
|
-
throw new Error(`[SheetsFilter]: no condition item found for operator: ${i}`);
|
|
453
|
-
return o;
|
|
454
|
-
}
|
|
455
|
-
t.getItemByOperator = e;
|
|
456
|
-
function r(i, o) {
|
|
457
|
-
for (const l of t.ALL_CONDITIONS.filter((c) => c.numOfParameters === o))
|
|
458
|
-
if (l.numOfParameters !== 0 && l.testMappingParams(i))
|
|
459
|
-
return l;
|
|
460
|
-
for (const l of t.ALL_CONDITIONS)
|
|
461
|
-
if (l.testMappingParams(i))
|
|
462
|
-
return l;
|
|
463
|
-
throw new Error("[SheetsFilter]: no condition item can be mapped from the filter map params!");
|
|
464
|
-
}
|
|
465
|
-
t.testMappingParams = r;
|
|
466
|
-
function s(i) {
|
|
467
|
-
const o = t.ALL_CONDITIONS.find((l) => l.operator === i);
|
|
468
|
-
return (o == null ? void 0 : o.numOfParameters) === 0 ? { operator1: o.operator } : o.getDefaultFormParams();
|
|
469
|
-
}
|
|
470
|
-
t.getInitialFormParams = s;
|
|
471
|
-
function n(i, o) {
|
|
472
|
-
return i.mapToFilterColumn(o);
|
|
473
|
-
}
|
|
474
|
-
t.mapToFilterColumn = n;
|
|
475
|
-
function a(i) {
|
|
476
|
-
if (!i)
|
|
477
|
-
return [t.NONE, {}];
|
|
478
|
-
for (const o of t.ALL_CONDITIONS) {
|
|
479
|
-
const l = o.testMappingFilterColumn(i);
|
|
480
|
-
if (l)
|
|
481
|
-
return [o, l];
|
|
482
|
-
}
|
|
483
|
-
return [t.NONE, {}];
|
|
484
|
-
}
|
|
485
|
-
t.testMappingFilterColumn = a;
|
|
486
|
-
})(f || (f = {}));
|
|
487
|
-
function x(t) {
|
|
488
|
-
const { operator1: e, operator2: r, val1: s, val2: n } = t;
|
|
489
|
-
if (e && r)
|
|
490
|
-
throw new Error("Both operator1 and operator2 are set!");
|
|
491
|
-
if (!e && !r)
|
|
492
|
-
throw new Error("Neither operator1 and operator2 and both not set!");
|
|
493
|
-
return e ? [e, s] : [r, n];
|
|
494
|
-
}
|
|
495
|
-
function tt(t) {
|
|
496
|
-
const e = [], r = [];
|
|
497
|
-
let s = 0, n = 0;
|
|
498
|
-
function a(i) {
|
|
499
|
-
i.leaf && (i.checked ? (e.push(i), s += i.count) : (r.push(i), n += i.count)), i.children && i.children.forEach(a);
|
|
500
|
-
}
|
|
501
|
-
return t.forEach(a), {
|
|
502
|
-
checkedItems: e,
|
|
503
|
-
uncheckedItems: r,
|
|
504
|
-
checked: s,
|
|
505
|
-
unchecked: n
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
var vi = Object.getOwnPropertyDescriptor, _i = (t, e, r, s) => {
|
|
509
|
-
for (var n = s > 1 ? void 0 : s ? vi(e, r) : e, a = t.length - 1, i; a >= 0; a--)
|
|
510
|
-
(i = t[a]) && (n = i(n) || n);
|
|
511
|
-
return n;
|
|
512
|
-
}, Xe = (t, e) => (r, s) => e(r, s, t);
|
|
513
|
-
const ft = "sheets-filter.generate-filter-values.service", Le = Mt(ft);
|
|
514
|
-
let rt = class extends fe {
|
|
515
|
-
constructor(t, e, r) {
|
|
516
|
-
super(), this._localeService = t, this._univerInstanceService = e, this._logService = r;
|
|
517
|
-
}
|
|
518
|
-
async getFilterValues(t) {
|
|
519
|
-
var m;
|
|
520
|
-
const { unitId: e, subUnitId: r, filteredOutRowsByOtherColumns: s, filterColumn: n, filters: a, blankChecked: i, iterateRange: o, alreadyChecked: l } = t, c = this._univerInstanceService.getUnit(e), h = (m = this._univerInstanceService.getUnit(e)) == null ? void 0 : m.getSheetBySheetId(r);
|
|
521
|
-
return !c || !h ? [] : (this._logService.debug("[SheetsGenerateFilterValuesService]", "getFilterValues for", { unitId: e, subUnitId: r }), qt(
|
|
522
|
-
a,
|
|
523
|
-
this._localeService,
|
|
524
|
-
o,
|
|
525
|
-
h,
|
|
526
|
-
new Set(s),
|
|
527
|
-
n,
|
|
528
|
-
new Set(l.map(String)),
|
|
529
|
-
i,
|
|
530
|
-
c.getStyles()
|
|
531
|
-
));
|
|
532
|
-
}
|
|
533
|
-
};
|
|
534
|
-
rt = _i([
|
|
535
|
-
Xe(0, T(G)),
|
|
536
|
-
Xe(1, Be),
|
|
537
|
-
Xe(2, hr)
|
|
538
|
-
], rt);
|
|
539
|
-
function qt(t, e, r, s, n, a, i, o, l) {
|
|
540
|
-
var N, F, R, O, A, w, Y, Z, se, M;
|
|
541
|
-
const c = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), m = "yyyy-mm-dd", S = "empty", p = !t && ((a == null ? void 0 : a.filterBy) === P.COLORS || (a == null ? void 0 : a.filterBy) === P.CONDITIONS) && ((N = a.filteredOutRows) == null ? void 0 : N.size);
|
|
542
|
-
let _ = 0;
|
|
543
|
-
for (const E of s.iterateByColumn(r, !1, !1)) {
|
|
544
|
-
const { row: Ye, rowSpan: Re = 1 } = E;
|
|
545
|
-
let ne = 0;
|
|
546
|
-
for (; ne < Re; ) {
|
|
547
|
-
const ar = Ye + ne;
|
|
548
|
-
if (n.has(ar)) {
|
|
549
|
-
ne++;
|
|
550
|
-
continue;
|
|
551
|
-
}
|
|
552
|
-
const J = E != null && E.value ? dr(E.value) : "";
|
|
553
|
-
if (!J) {
|
|
554
|
-
_ += 1, ne += Re;
|
|
555
|
-
continue;
|
|
556
|
-
}
|
|
557
|
-
const Ae = (F = E.value) != null && F.v && !E.value.p ? (A = (O = l.get((R = E.value) == null ? void 0 : R.s)) == null ? void 0 : O.n) == null ? void 0 : A.pattern : "", pt = Ae && Ke.getFormatInfo(Ae).isDate;
|
|
558
|
-
let vt = !1;
|
|
559
|
-
if (pt) {
|
|
560
|
-
const { year: k, month: z, day: I } = Ke.getFormatDateInfo(Ae);
|
|
561
|
-
vt = k || z || I;
|
|
562
|
-
}
|
|
563
|
-
if (Ae && pt && vt) {
|
|
564
|
-
const k = (w = s.getCellRaw(E.row, E.col)) == null ? void 0 : w.v;
|
|
565
|
-
if (!k) {
|
|
566
|
-
ne++;
|
|
567
|
-
continue;
|
|
568
|
-
}
|
|
569
|
-
const z = Ke.format(m, Number(k)), [I, H, ge] = z.split("-").map(Number);
|
|
570
|
-
let ee = c.get(`${I}`);
|
|
571
|
-
ee || (ee = {
|
|
572
|
-
title: `${I}`,
|
|
573
|
-
key: `${I}`,
|
|
574
|
-
children: [],
|
|
575
|
-
count: 0,
|
|
576
|
-
leaf: !1,
|
|
577
|
-
checked: !1
|
|
578
|
-
}, c.set(`${I}`, ee), h.set(`${I}`, [`${I}`]));
|
|
579
|
-
let W = (Y = ee.children) == null ? void 0 : Y.find((ze) => ze.key === `${I}-${H}`);
|
|
580
|
-
W || (W = {
|
|
581
|
-
title: e.t(`sheets-filter.date.${H}`),
|
|
582
|
-
key: `${I}-${H}`,
|
|
583
|
-
children: [],
|
|
584
|
-
count: 0,
|
|
585
|
-
leaf: !1,
|
|
586
|
-
checked: !1
|
|
587
|
-
}, (Z = ee.children) == null || Z.push(W), h.set(`${I}-${H}`, [`${I}`, `${I}-${H}`]));
|
|
588
|
-
const Ze = (se = W == null ? void 0 : W.children) == null ? void 0 : se.find((ze) => ze.key === `${I}-${H}-${ge}`);
|
|
589
|
-
Ze ? (Ze.originValues.add(J), Ze.count++, W.count++, ee.count++) : ((M = W.children) == null || M.push({
|
|
590
|
-
title: `${ge}`,
|
|
591
|
-
key: `${I}-${H}-${ge}`,
|
|
592
|
-
count: 1,
|
|
593
|
-
originValues: /* @__PURE__ */ new Set([J]),
|
|
594
|
-
leaf: !0,
|
|
595
|
-
checked: p ? !1 : i.size ? i.has(J) : !o
|
|
596
|
-
}), W.count++, ee.count++, h.set(`${I}-${H}-${ge}`, [`${I}`, `${I}-${H}`, `${I}-${H}-${ge}`]));
|
|
597
|
-
} else {
|
|
598
|
-
const k = J;
|
|
599
|
-
let z = c.get(k);
|
|
600
|
-
z ? z.count++ : (z = {
|
|
601
|
-
title: J,
|
|
602
|
-
leaf: !0,
|
|
603
|
-
checked: p ? !1 : i.size ? i.has(J) : !o,
|
|
604
|
-
key: k,
|
|
605
|
-
count: 1
|
|
606
|
-
}, c.set(k, z), h.set(k, [k]));
|
|
607
|
-
}
|
|
608
|
-
ne++;
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
const C = p ? !1 : t ? o : !0;
|
|
612
|
-
if (_ > 0) {
|
|
613
|
-
const E = {
|
|
614
|
-
title: e.t("sheets-filter.panel.empty"),
|
|
615
|
-
count: _,
|
|
616
|
-
leaf: !0,
|
|
617
|
-
checked: C,
|
|
618
|
-
key: S
|
|
619
|
-
};
|
|
620
|
-
c.set("empty", E), h.set("empty", [S]);
|
|
621
|
-
}
|
|
622
|
-
return {
|
|
623
|
-
filterTreeItems: gi(Array.from(c.values())),
|
|
624
|
-
filterTreeMapCache: h
|
|
625
|
-
};
|
|
626
|
-
}
|
|
627
|
-
function gi(t) {
|
|
628
|
-
return Array.from(t).sort((e, r) => e.children && !r.children ? -1 : !e.children && r.children ? 1 : Si(e.title, r.title)).map((e) => (e.children && e.children.sort((r, s) => {
|
|
629
|
-
const n = Number.parseInt(r.key.split("-")[1], 10), a = Number.parseInt(s.key.split("-")[1], 10);
|
|
630
|
-
return n - a;
|
|
631
|
-
}).forEach((r) => {
|
|
632
|
-
r.children && r.children.sort((s, n) => {
|
|
633
|
-
const a = Number.parseInt(s.key.split("-")[2], 10), i = Number.parseInt(n.key.split("-")[2], 10);
|
|
634
|
-
return a - i;
|
|
635
|
-
});
|
|
636
|
-
}), e));
|
|
637
|
-
}
|
|
638
|
-
const Ot = (t) => !Number.isNaN(Number(t)) && !Number.isNaN(Number.parseFloat(t));
|
|
639
|
-
function Si(t, e) {
|
|
640
|
-
const r = Ot(t), s = Ot(e);
|
|
641
|
-
return r && s ? Number.parseFloat(t) - Number.parseFloat(e) : r && !s ? -1 : !r && s ? 1 : t.localeCompare(e);
|
|
642
|
-
}
|
|
643
|
-
function it(t, e) {
|
|
644
|
-
for (const r of t) {
|
|
645
|
-
if (r.key === e)
|
|
646
|
-
return r;
|
|
647
|
-
if (r.children) {
|
|
648
|
-
const s = it(r.children, e);
|
|
649
|
-
if (s)
|
|
650
|
-
return s;
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
return null;
|
|
654
|
-
}
|
|
655
|
-
function Xt(t) {
|
|
656
|
-
return t.leaf ? t.checked : t.children ? t.children.every((e) => Xt(e)) : !0;
|
|
657
|
-
}
|
|
658
|
-
function Ee(t, e) {
|
|
659
|
-
t.leaf && (e !== void 0 ? t.checked = e : t.checked = !t.checked), t.children && t.children.forEach((r) => Ee(r, e));
|
|
660
|
-
}
|
|
661
|
-
function Jt(t, e) {
|
|
662
|
-
const r = [];
|
|
663
|
-
return t.forEach((s) => {
|
|
664
|
-
const n = s.originValues ? e.some(
|
|
665
|
-
(o) => Array.from(s.originValues).some(
|
|
666
|
-
(l) => l.toLowerCase().includes(o.toLowerCase())
|
|
667
|
-
)
|
|
668
|
-
) : !1, a = !n && e.some(
|
|
669
|
-
(o) => s.title.toLowerCase().includes(o.toLowerCase())
|
|
670
|
-
);
|
|
671
|
-
if (n || a)
|
|
672
|
-
r.push({ ...s });
|
|
673
|
-
else if (s.children) {
|
|
674
|
-
const o = Jt(s.children, e);
|
|
675
|
-
if (o.length > 0) {
|
|
676
|
-
const l = o.reduce((c, h) => c + h.count, 0);
|
|
677
|
-
r.push({ ...s, count: l, children: o });
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
}), r;
|
|
681
|
-
}
|
|
682
|
-
var Ci = Object.getOwnPropertyDescriptor, Qe = (t, e, r, s) => {
|
|
683
|
-
for (var n = s > 1 ? void 0 : s ? Ci(e, r) : e, a = t.length - 1, i; a >= 0; a--)
|
|
684
|
-
(i = t[a]) && (n = i(n) || n);
|
|
685
|
-
return n;
|
|
686
|
-
}, Ie = (t, e) => (r, s) => e(r, s, t);
|
|
687
|
-
Mt("sheets-filter-ui.sheets-filter-panel.service");
|
|
688
|
-
let q = class extends fe {
|
|
689
|
-
constructor(e, r) {
|
|
690
|
-
super();
|
|
691
|
-
v(this, "_filterBy$", new Q(P.VALUES));
|
|
692
|
-
v(this, "filterBy$", this._filterBy$.asObservable());
|
|
693
|
-
v(this, "_filterByModel$", new Jr(1));
|
|
694
|
-
v(this, "filterByModel$", this._filterByModel$.asObservable());
|
|
695
|
-
v(this, "_filterByModel", null);
|
|
696
|
-
v(this, "_hasCriteria$", new Q(!1));
|
|
697
|
-
v(this, "hasCriteria$", this._hasCriteria$.asObservable());
|
|
698
|
-
v(this, "_filterModel", null);
|
|
699
|
-
v(this, "_col$", new Q(-1));
|
|
700
|
-
v(this, "col$", this._col$.asObservable());
|
|
701
|
-
v(this, "_filterHeaderListener", null);
|
|
702
|
-
this._injector = e, this._refRangeService = r;
|
|
703
|
-
}
|
|
704
|
-
get filterBy() {
|
|
705
|
-
return this._filterBy$.getValue();
|
|
706
|
-
}
|
|
707
|
-
get filterByModel() {
|
|
708
|
-
return this._filterByModel;
|
|
709
|
-
}
|
|
710
|
-
set filterByModel(e) {
|
|
711
|
-
this._filterByModel = e, this._filterByModel$.next(e);
|
|
712
|
-
}
|
|
713
|
-
get filterModel() {
|
|
714
|
-
return this._filterModel;
|
|
715
|
-
}
|
|
716
|
-
get col() {
|
|
717
|
-
return this._col$.getValue();
|
|
718
|
-
}
|
|
719
|
-
dispose() {
|
|
720
|
-
this._filterBy$.complete(), this._filterByModel$.complete(), this._hasCriteria$.complete();
|
|
721
|
-
}
|
|
722
|
-
setupCol(e, r) {
|
|
723
|
-
this.terminate(), this._filterModel = e, this._col$.next(r);
|
|
724
|
-
const s = e.getFilterColumn(r);
|
|
725
|
-
if (s) {
|
|
726
|
-
const n = s.getColumnData();
|
|
727
|
-
if (n.customFilters) {
|
|
728
|
-
this._hasCriteria$.next(!0), this._setupByConditions(e, r);
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
if (n.colorFilters) {
|
|
732
|
-
this._hasCriteria$.next(!0), this._setupByColors(e, r);
|
|
733
|
-
return;
|
|
734
|
-
}
|
|
735
|
-
if (n.filters) {
|
|
736
|
-
this._hasCriteria$.next(!0), this._setupByValues(e, r);
|
|
737
|
-
return;
|
|
738
|
-
}
|
|
739
|
-
this._hasCriteria$.next(!1), this._setupByValues(e, r);
|
|
740
|
-
return;
|
|
741
|
-
}
|
|
742
|
-
this._hasCriteria$.next(!1), this._setupByValues(e, r);
|
|
743
|
-
}
|
|
744
|
-
changeFilterBy(e) {
|
|
745
|
-
if (!this._filterModel || this.col === -1)
|
|
746
|
-
return !1;
|
|
747
|
-
switch (e) {
|
|
748
|
-
case P.VALUES:
|
|
749
|
-
this._setupByValues(this._filterModel, this.col);
|
|
750
|
-
break;
|
|
751
|
-
case P.COLORS:
|
|
752
|
-
this._setupByColors(this._filterModel, this.col);
|
|
753
|
-
break;
|
|
754
|
-
case P.CONDITIONS:
|
|
755
|
-
this._setupByConditions(this._filterModel, this.col);
|
|
756
|
-
break;
|
|
757
|
-
}
|
|
758
|
-
return !0;
|
|
759
|
-
}
|
|
760
|
-
terminate() {
|
|
761
|
-
return this._filterModel = null, this._col$.next(-1), this._disposeFilterHeaderChangeListener(), !0;
|
|
762
|
-
}
|
|
763
|
-
_disposeFilterHeaderChangeListener() {
|
|
764
|
-
var e;
|
|
765
|
-
(e = this._filterHeaderListener) == null || e.dispose(), this._filterHeaderListener = null;
|
|
766
|
-
}
|
|
767
|
-
_listenToFilterHeaderChange(e, r) {
|
|
768
|
-
this._disposeFilterHeaderChangeListener();
|
|
769
|
-
const s = e.unitId, n = e.subUnitId, a = e.getRange(), i = {
|
|
770
|
-
startColumn: r,
|
|
771
|
-
startRow: a.startRow,
|
|
772
|
-
endRow: a.startRow,
|
|
773
|
-
endColumn: r
|
|
774
|
-
};
|
|
775
|
-
this._filterHeaderListener = this._refRangeService.watchRange(s, n, i, (o, l) => {
|
|
776
|
-
if (!l)
|
|
777
|
-
this.terminate();
|
|
778
|
-
else {
|
|
779
|
-
const c = l.startColumn - o.startColumn;
|
|
780
|
-
c !== 0 && this._filterByModel.deltaCol(c);
|
|
781
|
-
}
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
|
-
async _setupByValues(e, r) {
|
|
785
|
-
this._disposePreviousModel();
|
|
786
|
-
const s = e.getRange();
|
|
787
|
-
if (s.startRow === s.endRow) return !1;
|
|
788
|
-
const n = await xe.fromFilterColumn(
|
|
789
|
-
this._injector,
|
|
790
|
-
e,
|
|
791
|
-
r
|
|
792
|
-
);
|
|
793
|
-
return this.filterByModel = n, this._filterBy$.next(P.VALUES), this._listenToFilterHeaderChange(e, r), !0;
|
|
794
|
-
}
|
|
795
|
-
async _setupByColors(e, r) {
|
|
796
|
-
this._disposePreviousModel();
|
|
797
|
-
const s = e.getRange();
|
|
798
|
-
if (s.startRow === s.endRow) return !1;
|
|
799
|
-
const n = await Ue.fromFilterColumn(
|
|
800
|
-
this._injector,
|
|
801
|
-
e,
|
|
802
|
-
r
|
|
803
|
-
);
|
|
804
|
-
return this.filterByModel = n, this._filterBy$.next(P.COLORS), this._listenToFilterHeaderChange(e, r), !0;
|
|
805
|
-
}
|
|
806
|
-
_setupByConditions(e, r) {
|
|
807
|
-
this._disposePreviousModel();
|
|
808
|
-
const s = e.getRange();
|
|
809
|
-
if (s.startRow === s.endRow) return !1;
|
|
810
|
-
const n = Me.fromFilterColumn(
|
|
811
|
-
this._injector,
|
|
812
|
-
e,
|
|
813
|
-
r,
|
|
814
|
-
e.getFilterColumn(r)
|
|
815
|
-
);
|
|
816
|
-
return this.filterByModel = n, this._filterBy$.next(P.CONDITIONS), this._listenToFilterHeaderChange(e, r), !0;
|
|
817
|
-
}
|
|
818
|
-
_disposePreviousModel() {
|
|
819
|
-
var e;
|
|
820
|
-
(e = this._filterByModel) == null || e.dispose(), this.filterByModel = null;
|
|
821
|
-
}
|
|
822
|
-
};
|
|
823
|
-
q = Qe([
|
|
824
|
-
Ie(0, T(re)),
|
|
825
|
-
Ie(1, T(Gr))
|
|
826
|
-
], q);
|
|
827
|
-
let Me = class extends fe {
|
|
828
|
-
constructor(e, r, s, n, a) {
|
|
829
|
-
super();
|
|
830
|
-
v(this, "canApply$", pe(!0));
|
|
831
|
-
v(this, "_conditionItem$");
|
|
832
|
-
v(this, "conditionItem$");
|
|
833
|
-
v(this, "_filterConditionFormParams$");
|
|
834
|
-
v(this, "filterConditionFormParams$");
|
|
835
|
-
this._filterModel = e, this.col = r, this._commandService = a, this._conditionItem$ = new Q(s), this.conditionItem$ = this._conditionItem$.asObservable(), this._filterConditionFormParams$ = new Q(n), this.filterConditionFormParams$ = this._filterConditionFormParams$.asObservable();
|
|
836
|
-
}
|
|
837
|
-
/**
|
|
838
|
-
* Create a model with targeting filter column. If there is not a filter column, the model would be created with
|
|
839
|
-
* default values.
|
|
840
|
-
*
|
|
841
|
-
* @param injector
|
|
842
|
-
* @param filterModel
|
|
843
|
-
* @param col
|
|
844
|
-
* @param filterColumn
|
|
845
|
-
*
|
|
846
|
-
* @returns the model to control the panel's state
|
|
847
|
-
*/
|
|
848
|
-
static fromFilterColumn(e, r, s, n) {
|
|
849
|
-
const [a, i] = f.testMappingFilterColumn(n == null ? void 0 : n.getColumnData());
|
|
850
|
-
return e.createInstance(Me, r, s, a, i);
|
|
851
|
-
}
|
|
852
|
-
get conditionItem() {
|
|
853
|
-
return this._conditionItem$.getValue();
|
|
854
|
-
}
|
|
855
|
-
get filterConditionFormParams() {
|
|
856
|
-
return this._filterConditionFormParams$.getValue();
|
|
857
|
-
}
|
|
858
|
-
dispose() {
|
|
859
|
-
super.dispose(), this._conditionItem$.complete(), this._filterConditionFormParams$.complete();
|
|
860
|
-
}
|
|
861
|
-
deltaCol(e) {
|
|
862
|
-
this.col += e;
|
|
863
|
-
}
|
|
864
|
-
clear() {
|
|
865
|
-
return this._disposed ? Promise.resolve(!1) : this._commandService.executeCommand(V.id, {
|
|
866
|
-
unitId: this._filterModel.unitId,
|
|
867
|
-
subUnitId: this._filterModel.subUnitId,
|
|
868
|
-
col: this.col,
|
|
869
|
-
criteria: null
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
|
-
/**
|
|
873
|
-
* Apply the filter condition to the target filter column.
|
|
874
|
-
*/
|
|
875
|
-
async apply() {
|
|
876
|
-
if (this._disposed) return !1;
|
|
877
|
-
const e = f.mapToFilterColumn(this.conditionItem, this.filterConditionFormParams);
|
|
878
|
-
return this._commandService.executeCommand(V.id, {
|
|
879
|
-
unitId: this._filterModel.unitId,
|
|
880
|
-
subUnitId: this._filterModel.subUnitId,
|
|
881
|
-
col: this.col,
|
|
882
|
-
criteria: e
|
|
883
|
-
});
|
|
884
|
-
}
|
|
885
|
-
/**
|
|
886
|
-
* This method would be called when user changes the primary condition. The model would load the corresponding
|
|
887
|
-
* `IFilterConditionFormParams` and load default condition form params.
|
|
888
|
-
*/
|
|
889
|
-
onPrimaryConditionChange(e) {
|
|
890
|
-
const r = f.ALL_CONDITIONS.find((s) => s.operator === e);
|
|
891
|
-
if (!r)
|
|
892
|
-
throw new Error(`[ByConditionsModel]: condition item not found for operator: ${e}!`);
|
|
893
|
-
this._conditionItem$.next(r), this._filterConditionFormParams$.next(f.getInitialFormParams(e));
|
|
894
|
-
}
|
|
895
|
-
/**
|
|
896
|
-
* This method would be called when user changes the primary conditions, the input values or "AND" "OR" ratio.
|
|
897
|
-
* If the primary conditions or the ratio is changed, the method would load the corresponding `IFilterCondition`.
|
|
898
|
-
*
|
|
899
|
-
* When the panel call this method, it only has to pass the changed keys.
|
|
900
|
-
*
|
|
901
|
-
* @param params
|
|
902
|
-
*/
|
|
903
|
-
onConditionFormChange(e) {
|
|
904
|
-
const r = { ...this.filterConditionFormParams, ...e };
|
|
905
|
-
if (r.and !== !0 && delete r.and, typeof e.and < "u" || typeof e.operator1 < "u" || typeof e.operator2 < "u") {
|
|
906
|
-
const s = f.testMappingParams(r, this.conditionItem.numOfParameters);
|
|
907
|
-
this._conditionItem$.next(s);
|
|
908
|
-
}
|
|
909
|
-
this._filterConditionFormParams$.next(r);
|
|
910
|
-
}
|
|
911
|
-
};
|
|
912
|
-
Me = Qe([
|
|
913
|
-
Ie(4, j)
|
|
914
|
-
], Me);
|
|
915
|
-
let xe = class extends fe {
|
|
916
|
-
constructor(e, r, s, n, a) {
|
|
917
|
-
super();
|
|
918
|
-
v(this, "_rawFilterItems$");
|
|
919
|
-
v(this, "rawFilterItems$");
|
|
920
|
-
v(this, "filterItems$");
|
|
921
|
-
v(this, "_filterItems", []);
|
|
922
|
-
v(this, "_treeMapCache");
|
|
923
|
-
v(this, "canApply$");
|
|
924
|
-
v(this, "_manuallyUpdateFilterItems$");
|
|
925
|
-
v(this, "_searchString$");
|
|
926
|
-
v(this, "searchString$");
|
|
927
|
-
this._filterModel = e, this.col = r, this._commandService = a, this._treeMapCache = n, this._searchString$ = new Q(""), this.searchString$ = this._searchString$.asObservable(), this._rawFilterItems$ = new Q(s), this.rawFilterItems$ = this._rawFilterItems$.asObservable(), this._manuallyUpdateFilterItems$ = new ei(), this.filterItems$ = ti(
|
|
928
|
-
ri([
|
|
929
|
-
this._searchString$.pipe(
|
|
930
|
-
jt(500, void 0, { leading: !0, trailing: !0 }),
|
|
931
|
-
Yt(void 0)
|
|
932
|
-
),
|
|
933
|
-
this._rawFilterItems$
|
|
934
|
-
]).pipe(
|
|
935
|
-
ae(([i, o]) => {
|
|
936
|
-
if (!i) return o;
|
|
937
|
-
const c = i.toLowerCase().split(/\s+/).filter((h) => !!h);
|
|
938
|
-
return Jt(o, c);
|
|
939
|
-
})
|
|
940
|
-
),
|
|
941
|
-
this._manuallyUpdateFilterItems$
|
|
942
|
-
).pipe(ii(1)), this.canApply$ = this.filterItems$.pipe(ae((i) => tt(i).checked > 0)), this.disposeWithMe(this.filterItems$.subscribe((i) => this._filterItems = i));
|
|
943
|
-
}
|
|
944
|
-
/**
|
|
945
|
-
* Create a model with targeting filter column. If there is not a filter column, the model would be created with
|
|
946
|
-
* default values.
|
|
947
|
-
*
|
|
948
|
-
* @param injector
|
|
949
|
-
* @param filterModel
|
|
950
|
-
* @param col
|
|
951
|
-
*
|
|
952
|
-
* @returns the model to control the panel's state
|
|
953
|
-
*/
|
|
954
|
-
static async fromFilterColumn(e, r, s) {
|
|
955
|
-
const n = e.get(Be), a = e.get(G), i = e.get(Le, xt.OPTIONAL), { unitId: o, subUnitId: l } = r, c = n.getUniverSheetInstance(o);
|
|
956
|
-
if (!c) throw new Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${o}!`);
|
|
957
|
-
const h = c == null ? void 0 : c.getSheetBySheetId(l);
|
|
958
|
-
if (!h) throw new Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${o} and subUnitId: ${l}!`);
|
|
959
|
-
const m = r.getRange(), S = s, p = r.getFilterColumn(s), _ = p == null ? void 0 : p.getColumnData().filters, C = new Set(_ == null ? void 0 : _.filters), N = !!(_ && _.blank), F = r.getFilteredOutRowsExceptCol(s), R = { ...m, startRow: m.startRow + 1, startColumn: S, endColumn: S };
|
|
960
|
-
let O, A;
|
|
961
|
-
if (i) {
|
|
962
|
-
const w = await i.getFilterValues({
|
|
963
|
-
unitId: o,
|
|
964
|
-
subUnitId: l,
|
|
965
|
-
filteredOutRowsByOtherColumns: Array.from(F),
|
|
966
|
-
filterColumn: p,
|
|
967
|
-
filters: !!_,
|
|
968
|
-
blankChecked: N,
|
|
969
|
-
iterateRange: R,
|
|
970
|
-
alreadyChecked: Array.from(C)
|
|
971
|
-
});
|
|
972
|
-
O = w.filterTreeItems, A = w.filterTreeMapCache;
|
|
973
|
-
} else {
|
|
974
|
-
const w = qt(
|
|
975
|
-
!!_,
|
|
976
|
-
a,
|
|
977
|
-
R,
|
|
978
|
-
h,
|
|
979
|
-
F,
|
|
980
|
-
p,
|
|
981
|
-
C,
|
|
982
|
-
N,
|
|
983
|
-
c.getStyles()
|
|
984
|
-
);
|
|
985
|
-
O = w.filterTreeItems, A = w.filterTreeMapCache;
|
|
986
|
-
}
|
|
987
|
-
return e.createInstance(xe, r, s, O, A);
|
|
988
|
-
}
|
|
989
|
-
get rawFilterItems() {
|
|
990
|
-
return this._rawFilterItems$.getValue();
|
|
991
|
-
}
|
|
992
|
-
get filterItems() {
|
|
993
|
-
return this._filterItems;
|
|
994
|
-
}
|
|
995
|
-
get treeMapCache() {
|
|
996
|
-
return this._treeMapCache;
|
|
997
|
-
}
|
|
998
|
-
dispose() {
|
|
999
|
-
this._rawFilterItems$.complete(), this._searchString$.complete();
|
|
1000
|
-
}
|
|
1001
|
-
deltaCol(e) {
|
|
1002
|
-
this.col += e;
|
|
1003
|
-
}
|
|
1004
|
-
setSearchString(e) {
|
|
1005
|
-
this._searchString$.next(e);
|
|
1006
|
-
}
|
|
1007
|
-
onCheckAllToggled(e) {
|
|
1008
|
-
const r = Pe.deepClone(this._filterItems);
|
|
1009
|
-
r.forEach((s) => Ee(s, e)), this._manuallyUpdateFilterItems(r);
|
|
1010
|
-
}
|
|
1011
|
-
/**
|
|
1012
|
-
* Toggle a filter item.
|
|
1013
|
-
*/
|
|
1014
|
-
onFilterCheckToggled(e) {
|
|
1015
|
-
const r = Pe.deepClone(this._filterItems), s = it(r, e.key);
|
|
1016
|
-
if (!s)
|
|
1017
|
-
return;
|
|
1018
|
-
const n = Xt(s);
|
|
1019
|
-
Ee(s, !n), this._manuallyUpdateFilterItems(r);
|
|
1020
|
-
}
|
|
1021
|
-
onFilterOnly(e) {
|
|
1022
|
-
const r = Pe.deepClone(this._filterItems);
|
|
1023
|
-
r.forEach((s) => Ee(s, !1)), e.forEach((s) => {
|
|
1024
|
-
const n = it(r, s);
|
|
1025
|
-
n && Ee(n, !0);
|
|
1026
|
-
}), this._manuallyUpdateFilterItems(r);
|
|
1027
|
-
}
|
|
1028
|
-
_manuallyUpdateFilterItems(e) {
|
|
1029
|
-
this._manuallyUpdateFilterItems$.next(e);
|
|
1030
|
-
}
|
|
1031
|
-
// expose method here to let the panel change filter items
|
|
1032
|
-
// #region ByValuesModel apply methods
|
|
1033
|
-
clear() {
|
|
1034
|
-
return this._disposed ? Promise.resolve(!1) : this._commandService.executeCommand(V.id, {
|
|
1035
|
-
unitId: this._filterModel.unitId,
|
|
1036
|
-
subUnitId: this._filterModel.subUnitId,
|
|
1037
|
-
col: this.col,
|
|
1038
|
-
criteria: null
|
|
1039
|
-
});
|
|
1040
|
-
}
|
|
1041
|
-
/**
|
|
1042
|
-
* Apply the filter condition to the target filter column.
|
|
1043
|
-
*/
|
|
1044
|
-
async apply() {
|
|
1045
|
-
if (this._disposed)
|
|
1046
|
-
return !1;
|
|
1047
|
-
const e = tt(this._filterItems), { checked: r, checkedItems: s } = e, n = this.rawFilterItems;
|
|
1048
|
-
let a = 0;
|
|
1049
|
-
for (const c of n)
|
|
1050
|
-
a += c.count;
|
|
1051
|
-
const i = r === 0, o = e.checked === a, l = { colId: this.col };
|
|
1052
|
-
if (i)
|
|
1053
|
-
throw new Error("[ByValuesModel]: no checked items!");
|
|
1054
|
-
if (o)
|
|
1055
|
-
return this._commandService.executeCommand(V.id, {
|
|
1056
|
-
unitId: this._filterModel.unitId,
|
|
1057
|
-
subUnitId: this._filterModel.subUnitId,
|
|
1058
|
-
col: this.col,
|
|
1059
|
-
criteria: null
|
|
1060
|
-
});
|
|
1061
|
-
{
|
|
1062
|
-
l.filters = {};
|
|
1063
|
-
const c = s.filter((m) => m.key !== "empty");
|
|
1064
|
-
c.length > 0 && (l.filters = {
|
|
1065
|
-
filters: c.flatMap((m) => m.originValues ? Array.from(m.originValues) : [m.title])
|
|
1066
|
-
}), c.length !== s.length && (l.filters.blank = !0);
|
|
1067
|
-
}
|
|
1068
|
-
return this._commandService.executeCommand(V.id, {
|
|
1069
|
-
unitId: this._filterModel.unitId,
|
|
1070
|
-
subUnitId: this._filterModel.subUnitId,
|
|
1071
|
-
col: this.col,
|
|
1072
|
-
criteria: l
|
|
1073
|
-
});
|
|
1074
|
-
}
|
|
1075
|
-
// #endregion
|
|
1076
|
-
};
|
|
1077
|
-
xe = Qe([
|
|
1078
|
-
Ie(4, j)
|
|
1079
|
-
], xe);
|
|
1080
|
-
let Ue = class extends fe {
|
|
1081
|
-
constructor(e, r, s, n, a) {
|
|
1082
|
-
super();
|
|
1083
|
-
v(this, "canApply$", pe(!0));
|
|
1084
|
-
v(this, "_cellFillColors$");
|
|
1085
|
-
v(this, "cellFillColors$");
|
|
1086
|
-
v(this, "_cellTextColors$");
|
|
1087
|
-
v(this, "cellTextColors$");
|
|
1088
|
-
this._filterModel = e, this.col = r, this._commandService = a, this._cellFillColors$ = new Q(Array.from(s.values())), this.cellFillColors$ = this._cellFillColors$.asObservable(), this._cellTextColors$ = new Q(Array.from(n.values())), this.cellTextColors$ = this._cellTextColors$.asObservable();
|
|
1089
|
-
}
|
|
1090
|
-
/**
|
|
1091
|
-
* Create a model with targeting filter column. If there is not a filter column, the model would be created with
|
|
1092
|
-
* default values.
|
|
1093
|
-
*
|
|
1094
|
-
* @param injector
|
|
1095
|
-
* @param filterModel
|
|
1096
|
-
* @param col
|
|
1097
|
-
*
|
|
1098
|
-
* @returns the model to control the panel's state
|
|
1099
|
-
*/
|
|
1100
|
-
static async fromFilterColumn(e, r, s) {
|
|
1101
|
-
var R, O, A;
|
|
1102
|
-
const n = e.get(Be), { unitId: a, subUnitId: i } = r, o = n.getUniverSheetInstance(a);
|
|
1103
|
-
if (!o) throw new Error(`[ByColorsModel]: Workbook not found for filter model with unitId: ${a}!`);
|
|
1104
|
-
const l = o == null ? void 0 : o.getSheetBySheetId(i);
|
|
1105
|
-
if (!l) throw new Error(`[ByColorsModel]: Worksheet not found for filter model with unitId: ${a} and subUnitId: ${i}!`);
|
|
1106
|
-
const c = r.getRange(), h = s, m = (R = r.getFilterColumn(s)) == null ? void 0 : R.getColumnData().colorFilters, S = r.getFilteredOutRowsExceptCol(s), p = { ...c, startRow: c.startRow + 1, startColumn: h, endColumn: h }, _ = /* @__PURE__ */ new Map(), C = new Set((O = m == null ? void 0 : m.cellFillColors) != null ? O : []), N = /* @__PURE__ */ new Map(), F = new Set((A = m == null ? void 0 : m.cellTextColors) != null ? A : []);
|
|
1107
|
-
for (const w of l.iterateByColumn(p, !1, !0)) {
|
|
1108
|
-
const { row: Y, col: Z, value: se } = w;
|
|
1109
|
-
if (S.has(Y))
|
|
1110
|
-
continue;
|
|
1111
|
-
const M = l.getComposedCellStyleByCellData(Y, Z, se);
|
|
1112
|
-
if (M.bg && M.bg.rgb) {
|
|
1113
|
-
const E = new gt(M.bg.rgb).toRgbString();
|
|
1114
|
-
_.has(E) || _.set(E, { color: E, checked: C.has(E) });
|
|
1115
|
-
} else
|
|
1116
|
-
_.set("default-fill-color", { color: null, checked: C.has(null) });
|
|
1117
|
-
if (M.cl && M.cl.rgb) {
|
|
1118
|
-
const E = new gt(M.cl.rgb).toRgbString();
|
|
1119
|
-
N.has(E) || N.set(E, { color: E, checked: F.has(E) });
|
|
1120
|
-
} else
|
|
1121
|
-
N.set("default-font-color", { color: Et, checked: F.has(Et) });
|
|
1122
|
-
}
|
|
1123
|
-
return e.createInstance(Ue, r, s, _, N);
|
|
1124
|
-
}
|
|
1125
|
-
get cellFillColors() {
|
|
1126
|
-
return this._cellFillColors$.getValue();
|
|
1127
|
-
}
|
|
1128
|
-
get cellTextColors() {
|
|
1129
|
-
return this._cellTextColors$.getValue();
|
|
1130
|
-
}
|
|
1131
|
-
dispose() {
|
|
1132
|
-
super.dispose(), this._cellFillColors$.complete();
|
|
1133
|
-
}
|
|
1134
|
-
deltaCol(e) {
|
|
1135
|
-
this.col += e;
|
|
1136
|
-
}
|
|
1137
|
-
// expose method here to let the panel change filter items
|
|
1138
|
-
// #region ByColorsModel apply methods
|
|
1139
|
-
clear() {
|
|
1140
|
-
return this._disposed ? Promise.resolve(!1) : this._commandService.executeCommand(V.id, {
|
|
1141
|
-
unitId: this._filterModel.unitId,
|
|
1142
|
-
subUnitId: this._filterModel.subUnitId,
|
|
1143
|
-
col: this.col,
|
|
1144
|
-
criteria: null
|
|
1145
|
-
});
|
|
1146
|
-
}
|
|
1147
|
-
onFilterCheckToggled(e, r = !0) {
|
|
1148
|
-
const s = r ? this.cellFillColors : this.cellTextColors, n = [];
|
|
1149
|
-
let a = !1;
|
|
1150
|
-
for (let i = 0; i < s.length; i++) {
|
|
1151
|
-
const o = s[i];
|
|
1152
|
-
if (o.color === e.color) {
|
|
1153
|
-
a = !0, n.push({
|
|
1154
|
-
color: o.color,
|
|
1155
|
-
checked: !o.checked
|
|
1156
|
-
});
|
|
1157
|
-
continue;
|
|
1158
|
-
}
|
|
1159
|
-
n.push({
|
|
1160
|
-
color: o.color,
|
|
1161
|
-
checked: o.checked
|
|
1162
|
-
});
|
|
1163
|
-
}
|
|
1164
|
-
a && (this._resetColorsCheckedStatus(!r), r ? this._cellFillColors$.next([...n]) : this._cellTextColors$.next([...n]));
|
|
1165
|
-
}
|
|
1166
|
-
_resetColorsCheckedStatus(e = !0) {
|
|
1167
|
-
const r = e ? this.cellFillColors : this.cellTextColors, s = [];
|
|
1168
|
-
for (let n = 0; n < r.length; n++)
|
|
1169
|
-
s.push({
|
|
1170
|
-
color: r[n].color,
|
|
1171
|
-
checked: !1
|
|
1172
|
-
});
|
|
1173
|
-
e ? this._cellFillColors$.next([...s]) : this._cellTextColors$.next([...s]);
|
|
1174
|
-
}
|
|
1175
|
-
/**
|
|
1176
|
-
* Apply the filter condition to the target filter column.
|
|
1177
|
-
*/
|
|
1178
|
-
async apply() {
|
|
1179
|
-
if (this._disposed)
|
|
1180
|
-
return !1;
|
|
1181
|
-
const e = this.cellFillColors.filter((n) => n.checked).map((n) => n.color), r = this.cellTextColors.filter((n) => n.checked).map((n) => n.color);
|
|
1182
|
-
if (e.length === 0 && r.length === 0)
|
|
1183
|
-
return this._commandService.executeCommand(V.id, {
|
|
1184
|
-
unitId: this._filterModel.unitId,
|
|
1185
|
-
subUnitId: this._filterModel.subUnitId,
|
|
1186
|
-
col: this.col,
|
|
1187
|
-
criteria: null
|
|
1188
|
-
});
|
|
1189
|
-
const s = { colId: this.col };
|
|
1190
|
-
return e.length > 0 ? s.colorFilters = {
|
|
1191
|
-
cellFillColors: e
|
|
1192
|
-
} : r.length > 0 && (s.colorFilters = {
|
|
1193
|
-
cellTextColors: r
|
|
1194
|
-
}), this._commandService.executeCommand(V.id, {
|
|
1195
|
-
unitId: this._filterModel.unitId,
|
|
1196
|
-
subUnitId: this._filterModel.subUnitId,
|
|
1197
|
-
col: this.col,
|
|
1198
|
-
criteria: s
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
|
-
// #endregion
|
|
1202
|
-
};
|
|
1203
|
-
Ue = Qe([
|
|
1204
|
-
Ie(4, j)
|
|
1205
|
-
], Ue);
|
|
1206
|
-
const ce = "FILTER_PANEL_OPENED", ke = {
|
|
1207
|
-
id: "sheet.operation.open-filter-panel",
|
|
1208
|
-
type: We.OPERATION,
|
|
1209
|
-
handler: (t, e) => {
|
|
1210
|
-
const r = t.get(Ve), s = t.get(X), n = t.get(q), a = t.get(j), i = t.has(Ct) ? t.get(Ct) : null;
|
|
1211
|
-
i != null && i.isVisible().visible && a.syncExecuteCommand(Ir.id, { visible: !1 });
|
|
1212
|
-
const { unitId: o, subUnitId: l, col: c } = e, h = s.getFilterModel(o, l);
|
|
1213
|
-
return h ? (n.setupCol(h, c), r.getContextValue(ce) || r.setContextValue(ce, !0), !0) : !1;
|
|
1214
|
-
}
|
|
1215
|
-
}, Ne = {
|
|
1216
|
-
id: "sheet.operation.close-filter-panel",
|
|
1217
|
-
type: We.OPERATION,
|
|
1218
|
-
handler: (t) => {
|
|
1219
|
-
const e = t.get(Ve), r = t.get(q), s = t.get(xr, xt.OPTIONAL);
|
|
1220
|
-
return e.getContextValue(ce) ? (e.setContextValue(ce, !1), s == null || s.focus(), r.terminate()) : !1;
|
|
1221
|
-
}
|
|
1222
|
-
}, er = {
|
|
1223
|
-
id: "sheet.operation.apply-filter",
|
|
1224
|
-
type: We.OPERATION,
|
|
1225
|
-
handler: (t, e) => {
|
|
1226
|
-
const { filterBy: r } = e;
|
|
1227
|
-
return t.get(q).changeFilterBy(r);
|
|
1228
|
-
}
|
|
1229
|
-
}, Ti = "@univerjs/sheets-filter-ui", Ei = "0.17.0", ue = {
|
|
1230
|
-
name: Ti,
|
|
1231
|
-
version: Ei
|
|
1232
|
-
}, tr = "sheets-filter-ui.config", He = {};
|
|
1233
|
-
var Ni = Object.getOwnPropertyDescriptor, Fi = (t, e, r, s) => {
|
|
1234
|
-
for (var n = s > 1 ? void 0 : s ? Ni(e, r) : e, a = t.length - 1, i; a >= 0; a--)
|
|
1235
|
-
(i = t[a]) && (n = i(n) || n);
|
|
1236
|
-
return n;
|
|
1237
|
-
}, oe = (t, e) => (r, s) => e(r, s, t);
|
|
1238
|
-
let he = class extends fe {
|
|
1239
|
-
constructor(t, e, r, s, n, a) {
|
|
1240
|
-
super(), this._sheetsFilterService = t, this._localeService = e, this._commandService = r, this._sheetPermissionCheckPermission = s, this._injector = n, this._sheetsSelectionService = a, this._commandExecutedListener();
|
|
1241
|
-
}
|
|
1242
|
-
_commandExecutedListener() {
|
|
1243
|
-
this.disposeWithMe(
|
|
1244
|
-
this._commandService.beforeCommandExecuted((t) => {
|
|
1245
|
-
var e, r, s;
|
|
1246
|
-
if (t.id === Oe.id) {
|
|
1247
|
-
const n = this._injector.get(Be), a = Zr(n);
|
|
1248
|
-
if (!a) return;
|
|
1249
|
-
const { unitId: i, subUnitId: o, worksheet: l } = a, c = (e = this._sheetsFilterService.getFilterModel(i, o)) == null ? void 0 : e.getRange();
|
|
1250
|
-
let h;
|
|
1251
|
-
if (c)
|
|
1252
|
-
h = this._sheetPermissionCheckPermission.permissionCheckWithRanges({
|
|
1253
|
-
rangeTypes: [Te],
|
|
1254
|
-
worksheetTypes: [Se, Ce]
|
|
1255
|
-
}, [c], i, o);
|
|
1256
|
-
else {
|
|
1257
|
-
const m = (r = this._sheetsSelectionService.getCurrentLastSelection()) == null ? void 0 : r.range;
|
|
1258
|
-
if (m) {
|
|
1259
|
-
let S = { ...m };
|
|
1260
|
-
S = m.startColumn === m.endColumn && m.startRow === m.endRow ? zr(S, { left: !0, right: !0, up: !0, down: !0 }, l) : S, h = this._sheetPermissionCheckPermission.permissionCheckWithRanges({
|
|
1261
|
-
rangeTypes: [Te],
|
|
1262
|
-
worksheetTypes: [Ce, Se]
|
|
1263
|
-
}, [S], i, o);
|
|
1264
|
-
} else
|
|
1265
|
-
h = this._sheetPermissionCheckPermission.permissionCheckWithoutRange({
|
|
1266
|
-
rangeTypes: [Te],
|
|
1267
|
-
worksheetTypes: [Ce, Se]
|
|
1268
|
-
});
|
|
1269
|
-
}
|
|
1270
|
-
h || this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr"));
|
|
1271
|
-
}
|
|
1272
|
-
if (t.id === ke.id) {
|
|
1273
|
-
const n = t.params, { unitId: a, subUnitId: i } = n, o = (s = this._sheetsFilterService.getFilterModel(a, i)) == null ? void 0 : s.getRange(), l = Pe.deepClone(o);
|
|
1274
|
-
l && (l.startColumn = n.col, l.endColumn = n.col, this._sheetPermissionCheckPermission.permissionCheckWithRanges({
|
|
1275
|
-
rangeTypes: [Te],
|
|
1276
|
-
worksheetTypes: [Se, Ce]
|
|
1277
|
-
}, [l], a, i) || this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr")));
|
|
1278
|
-
}
|
|
1279
|
-
})
|
|
1280
|
-
);
|
|
1281
|
-
}
|
|
1282
|
-
};
|
|
1283
|
-
he = Fi([
|
|
1284
|
-
oe(0, T(X)),
|
|
1285
|
-
oe(1, T(G)),
|
|
1286
|
-
oe(2, j),
|
|
1287
|
-
oe(3, T(jr)),
|
|
1288
|
-
oe(4, T(re)),
|
|
1289
|
-
oe(5, T(Yr))
|
|
1290
|
-
], he);
|
|
1291
|
-
const K = 16, Ii = new Path2D("M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z");
|
|
1292
|
-
class bt {
|
|
1293
|
-
static drawNoCriteria(e, r, s, n) {
|
|
1294
|
-
e.save(), Nt.drawWith(e, {
|
|
1295
|
-
radius: 2,
|
|
1296
|
-
width: K,
|
|
1297
|
-
height: K,
|
|
1298
|
-
fill: n
|
|
1299
|
-
}), e.lineCap = "square", e.strokeStyle = s, e.scale(r / K, r / K), e.beginPath(), e.lineWidth = 1, e.lineCap = "round", e.moveTo(3, 4), e.lineTo(13, 4), e.moveTo(4.5, 8), e.lineTo(11.5, 8), e.moveTo(6, 12), e.lineTo(10, 12), e.stroke(), e.restore();
|
|
1300
|
-
}
|
|
1301
|
-
static drawHasCriteria(e, r, s, n) {
|
|
1302
|
-
e.save(), Nt.drawWith(e, {
|
|
1303
|
-
radius: 2,
|
|
1304
|
-
width: K,
|
|
1305
|
-
height: K,
|
|
1306
|
-
fill: n
|
|
1307
|
-
}), e.scale(r / K, r / K), e.fillStyle = s, e.fill(Ii), e.restore();
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
var yi = Object.getOwnPropertyDescriptor, Oi = (t, e, r, s) => {
|
|
1311
|
-
for (var n = s > 1 ? void 0 : s ? yi(e, r) : e, a = t.length - 1, i; a >= 0; a--)
|
|
1312
|
-
(i = t[a]) && (n = i(n) || n);
|
|
1313
|
-
return n;
|
|
1314
|
-
}, Je = (t, e) => (r, s) => e(r, s, t);
|
|
1315
|
-
const B = 16, Fe = 1;
|
|
1316
|
-
let st = class extends Qr {
|
|
1317
|
-
constructor(e, r, s, n, a) {
|
|
1318
|
-
super(e, r);
|
|
1319
|
-
v(this, "_cellWidth", 0);
|
|
1320
|
-
v(this, "_cellHeight", 0);
|
|
1321
|
-
v(this, "_filterParams");
|
|
1322
|
-
v(this, "_hovered", !1);
|
|
1323
|
-
this._contextService = s, this._commandService = n, this._themeService = a, this.setShapeProps(r), this.onPointerDown$.subscribeEvent((i) => this.onPointerDown(i)), this.onPointerEnter$.subscribeEvent(() => this.onPointerEnter()), this.onPointerLeave$.subscribeEvent(() => this.onPointerLeave());
|
|
1324
|
-
}
|
|
1325
|
-
setShapeProps(e) {
|
|
1326
|
-
typeof e.cellHeight < "u" && (this._cellHeight = e.cellHeight), typeof e.cellWidth < "u" && (this._cellWidth = e.cellWidth), typeof e.filterParams < "u" && (this._filterParams = e.filterParams), this.transformByState({
|
|
1327
|
-
width: e.width,
|
|
1328
|
-
height: e.height
|
|
1329
|
-
});
|
|
1330
|
-
}
|
|
1331
|
-
_draw(e) {
|
|
1332
|
-
const r = this._cellHeight, s = this._cellWidth, n = B - s, a = B - r;
|
|
1333
|
-
e.save();
|
|
1334
|
-
const i = new Path2D();
|
|
1335
|
-
i.rect(n, a, s, r), e.clip(i);
|
|
1336
|
-
const { hasCriteria: o } = this._filterParams, l = this._themeService.getColorFromTheme("primary.600"), c = this._hovered ? this._themeService.getColorFromTheme("gray.50") : "rgba(255, 255, 255, 1.0)";
|
|
1337
|
-
o ? bt.drawHasCriteria(e, B, l, c) : bt.drawNoCriteria(e, B, l, c), e.restore();
|
|
1338
|
-
}
|
|
1339
|
-
onPointerDown(e) {
|
|
1340
|
-
if (e.button === 2)
|
|
1341
|
-
return;
|
|
1342
|
-
const { col: r, unitId: s, subUnitId: n } = this._filterParams;
|
|
1343
|
-
this._contextService.getContextValue(ce) || !this._commandService.hasCommand(ke.id) || setTimeout(() => {
|
|
1344
|
-
this._commandService.executeCommand(ke.id, {
|
|
1345
|
-
unitId: s,
|
|
1346
|
-
subUnitId: n,
|
|
1347
|
-
col: r
|
|
1348
|
-
});
|
|
1349
|
-
}, 200);
|
|
1350
|
-
}
|
|
1351
|
-
onPointerEnter() {
|
|
1352
|
-
this._hovered = !0, this.makeDirty(!0);
|
|
1353
|
-
}
|
|
1354
|
-
onPointerLeave() {
|
|
1355
|
-
this._hovered = !1, this.makeDirty(!0);
|
|
1356
|
-
}
|
|
1357
|
-
};
|
|
1358
|
-
st = Oi([
|
|
1359
|
-
Je(2, Ve),
|
|
1360
|
-
Je(3, j),
|
|
1361
|
-
Je(4, T(Ut))
|
|
1362
|
-
], st);
|
|
1363
|
-
var bi = Object.getOwnPropertyDescriptor, Ri = (t, e, r, s) => {
|
|
1364
|
-
for (var n = s > 1 ? void 0 : s ? bi(e, r) : e, a = t.length - 1, i; a >= 0; a--)
|
|
1365
|
-
(i = t[a]) && (n = i(n) || n);
|
|
1366
|
-
return n;
|
|
1367
|
-
}, te = (t, e) => (r, s) => e(r, s, t);
|
|
1368
|
-
const Ai = 1e3, Pi = 5e3;
|
|
1369
|
-
function wi(t, e, r, s) {
|
|
1370
|
-
switch (s) {
|
|
1371
|
-
case we.TOP:
|
|
1372
|
-
return t + Fe;
|
|
1373
|
-
case we.MIDDLE:
|
|
1374
|
-
return t + Math.max(0, (r - B) / 2);
|
|
1375
|
-
case we.BOTTOM:
|
|
1376
|
-
default:
|
|
1377
|
-
return e - B - Fe;
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
let nt = class extends kt {
|
|
1381
|
-
constructor(e, r, s, n, a, i, o, l) {
|
|
1382
|
-
super();
|
|
1383
|
-
v(this, "_filterRangeShape", null);
|
|
1384
|
-
v(this, "_buttonRenderDisposable", null);
|
|
1385
|
-
v(this, "_filterButtonShapes", []);
|
|
1386
|
-
this._context = e, this._injector = r, this._sheetSkeletonManagerService = s, this._sheetsFilterService = n, this._themeService = a, this._sheetInterceptorService = i, this._commandService = o, this._selectionRenderService = l, this._initRenderer();
|
|
1387
|
-
}
|
|
1388
|
-
dispose() {
|
|
1389
|
-
super.dispose(), this._disposeRendering();
|
|
1390
|
-
}
|
|
1391
|
-
_initRenderer() {
|
|
1392
|
-
this._sheetSkeletonManagerService.currentSkeleton$.pipe(
|
|
1393
|
-
ht((e) => {
|
|
1394
|
-
var o, l;
|
|
1395
|
-
if (!e) return pe(null);
|
|
1396
|
-
const { unit: r, unitId: s } = this._context, n = ((o = r.getActiveSheet()) == null ? void 0 : o.getSheetId()) || "", a = (l = this._sheetsFilterService.getFilterModel(s, n)) != null ? l : void 0, i = () => ({
|
|
1397
|
-
unitId: s,
|
|
1398
|
-
worksheetId: n,
|
|
1399
|
-
filterModel: a,
|
|
1400
|
-
range: a == null ? void 0 : a.getRange(),
|
|
1401
|
-
skeleton: e.skeleton
|
|
1402
|
-
});
|
|
1403
|
-
return mr(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(
|
|
1404
|
-
si(
|
|
1405
|
-
([c]) => {
|
|
1406
|
-
var h;
|
|
1407
|
-
return c.type === We.MUTATION && ((h = c.params) == null ? void 0 : h.unitId) === r.getUnitId() && (_r.has(c.id) || c.id === qr.id);
|
|
1408
|
-
}
|
|
1409
|
-
),
|
|
1410
|
-
jt(20, void 0, { leading: !1, trailing: !0 }),
|
|
1411
|
-
ae(i),
|
|
1412
|
-
Yt(i())
|
|
1413
|
-
// must trigger once
|
|
1414
|
-
);
|
|
1415
|
-
}),
|
|
1416
|
-
ni(this.dispose$)
|
|
1417
|
-
).subscribe((e) => {
|
|
1418
|
-
this._disposeRendering(), !(!e || !e.range) && (this._renderRange(e.range, e.skeleton), this._renderButtons(e));
|
|
1419
|
-
});
|
|
1420
|
-
}
|
|
1421
|
-
_renderRange(e, r) {
|
|
1422
|
-
const { scene: s } = this._context, { rowHeaderWidth: n, columnHeaderHeight: a } = r, i = this._filterRangeShape = new br(
|
|
1423
|
-
s,
|
|
1424
|
-
Ai,
|
|
1425
|
-
this._themeService,
|
|
1426
|
-
{
|
|
1427
|
-
rowHeaderWidth: n,
|
|
1428
|
-
columnHeaderHeight: a,
|
|
1429
|
-
enableAutoFill: !1,
|
|
1430
|
-
highlightHeader: !1
|
|
1431
|
-
}
|
|
1432
|
-
), l = Rr({
|
|
1433
|
-
range: e,
|
|
1434
|
-
primary: null,
|
|
1435
|
-
style: { fill: "rgba(0, 0, 0, 0.0)" }
|
|
1436
|
-
}, r);
|
|
1437
|
-
i.updateRangeBySelectionWithCoord(l), i.setEvent(!1), s.makeDirty(!0);
|
|
1438
|
-
}
|
|
1439
|
-
_renderButtons(e) {
|
|
1440
|
-
const { range: r, filterModel: s, unitId: n, skeleton: a, worksheetId: i } = e, { unit: o, scene: l } = this._context, c = o.getSheetBySheetId(i);
|
|
1441
|
-
if (!c)
|
|
1442
|
-
return;
|
|
1443
|
-
this._interceptCellContent(n, i, e.range);
|
|
1444
|
-
const { startColumn: h, endColumn: m, startRow: S } = r;
|
|
1445
|
-
for (let p = h; p <= m; p++) {
|
|
1446
|
-
const _ = `sheets-filter-button-${p}`, C = Ar(S, p, l, a), N = c.getComposedCellStyle(S, p), F = (N == null ? void 0 : N.vt) || we.BOTTOM, { startX: R, startY: O, endX: A, endY: w } = C, Y = A - R, Z = w - O;
|
|
1447
|
-
if (Z <= Fe || Y <= Fe)
|
|
1448
|
-
continue;
|
|
1449
|
-
const se = !!s.getFilterColumn(p), M = A - B - Fe, E = wi(O, w, Z, F), Ye = {
|
|
1450
|
-
left: M,
|
|
1451
|
-
top: E,
|
|
1452
|
-
height: B,
|
|
1453
|
-
width: B,
|
|
1454
|
-
zIndex: Pi,
|
|
1455
|
-
cellHeight: Z,
|
|
1456
|
-
cellWidth: Y,
|
|
1457
|
-
filterParams: { unitId: n, subUnitId: i, col: p, hasCriteria: se }
|
|
1458
|
-
}, Re = this._injector.createInstance(st, _, Ye);
|
|
1459
|
-
this._filterButtonShapes.push(Re);
|
|
1460
|
-
}
|
|
1461
|
-
l.addObjects(this._filterButtonShapes), l.makeDirty();
|
|
1462
|
-
}
|
|
1463
|
-
_interceptCellContent(e, r, s) {
|
|
1464
|
-
const { startRow: n, startColumn: a, endColumn: i } = s;
|
|
1465
|
-
this._buttonRenderDisposable = this._sheetInterceptorService.intercept(Xr.CELL_CONTENT, {
|
|
1466
|
-
effect: fr.Style,
|
|
1467
|
-
handler: (o, l, c) => {
|
|
1468
|
-
const { row: h, col: m, unitId: S, subUnitId: p } = l;
|
|
1469
|
-
return S !== e || p !== r || h !== n || m < a || m > i || ((!o || o === l.rawData) && (o = { ...l.rawData }), o.fontRenderExtension = {
|
|
1470
|
-
...o == null ? void 0 : o.fontRenderExtension,
|
|
1471
|
-
rightOffset: B
|
|
1472
|
-
}), c(o);
|
|
1473
|
-
},
|
|
1474
|
-
priority: 10
|
|
1475
|
-
});
|
|
1476
|
-
}
|
|
1477
|
-
_disposeRendering() {
|
|
1478
|
-
var e, r;
|
|
1479
|
-
(e = this._filterRangeShape) == null || e.dispose(), this._filterButtonShapes.forEach((s) => s.dispose()), (r = this._buttonRenderDisposable) == null || r.dispose(), this._filterRangeShape = null, this._buttonRenderDisposable = null, this._filterButtonShapes = [];
|
|
1480
|
-
}
|
|
1481
|
-
};
|
|
1482
|
-
nt = Ri([
|
|
1483
|
-
te(1, T(re)),
|
|
1484
|
-
te(2, T(yr)),
|
|
1485
|
-
te(3, T(X)),
|
|
1486
|
-
te(4, T(Ut)),
|
|
1487
|
-
te(5, T(Kr)),
|
|
1488
|
-
te(6, j),
|
|
1489
|
-
te(7, Or)
|
|
1490
|
-
], nt);
|
|
1491
|
-
var $i = Object.getOwnPropertyDescriptor, Li = (t, e, r, s) => {
|
|
1492
|
-
for (var n = s > 1 ? void 0 : s ? $i(e, r) : e, a = t.length - 1, i; a >= 0; a--)
|
|
1493
|
-
(i = t[a]) && (n = i(n) || n);
|
|
1494
|
-
return n;
|
|
1495
|
-
}, Rt = (t, e) => (r, s) => e(r, s, t);
|
|
1496
|
-
let ye = class extends kt {
|
|
1497
|
-
constructor(t, e) {
|
|
1498
|
-
super(), this._renderManagerService = t, this._sheetsRenderService = e, [
|
|
1499
|
-
gr,
|
|
1500
|
-
Sr,
|
|
1501
|
-
Cr,
|
|
1502
|
-
Tr
|
|
1503
|
-
].forEach((r) => this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(r.id))), this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
1504
|
-
ie.UNIVER_SHEET,
|
|
1505
|
-
[nt]
|
|
1506
|
-
));
|
|
1507
|
-
}
|
|
1508
|
-
};
|
|
1509
|
-
ye = Li([
|
|
1510
|
-
Rt(0, Gt),
|
|
1511
|
-
Rt(1, T(Vt))
|
|
1512
|
-
], ye);
|
|
1513
|
-
var Mi = Object.defineProperty, xi = Object.getOwnPropertyDescriptor, Ui = (t, e, r) => e in t ? Mi(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ki = (t, e, r, s) => {
|
|
1514
|
-
for (var n = s > 1 ? void 0 : s ? xi(e, r) : e, a = t.length - 1, i; a >= 0; a--)
|
|
1515
|
-
(i = t[a]) && (n = i(n) || n);
|
|
1516
|
-
return n;
|
|
1517
|
-
}, At = (t, e) => (r, s) => e(r, s, t), Ge = (t, e, r) => Ui(t, typeof e != "symbol" ? e + "" : e, r);
|
|
1518
|
-
let de = class extends ot {
|
|
1519
|
-
constructor(t = He, e, r) {
|
|
1520
|
-
super(), this._config = t, this._injector = e, this._configService = r;
|
|
1521
|
-
const { menu: s, ...n } = Bt(
|
|
1522
|
-
{},
|
|
1523
|
-
He,
|
|
1524
|
-
this._config
|
|
1525
|
-
);
|
|
1526
|
-
s && this._configService.setConfig("menu", s, { merge: !0 }), this._configService.setConfig(tr, n);
|
|
1527
|
-
}
|
|
1528
|
-
onStarting() {
|
|
1529
|
-
[
|
|
1530
|
-
[he],
|
|
1531
|
-
[ye]
|
|
1532
|
-
].forEach((t) => this._injector.add(t));
|
|
1533
|
-
}
|
|
1534
|
-
onReady() {
|
|
1535
|
-
this._injector.get(he);
|
|
1536
|
-
}
|
|
1537
|
-
onRendered() {
|
|
1538
|
-
this._injector.get(ye);
|
|
1539
|
-
}
|
|
1540
|
-
};
|
|
1541
|
-
Ge(de, "type", ie.UNIVER_SHEET);
|
|
1542
|
-
Ge(de, "pluginName", "SHEET_FILTER_UI_PLUGIN");
|
|
1543
|
-
Ge(de, "packageName", ue.name);
|
|
1544
|
-
Ge(de, "version", ue.version);
|
|
1545
|
-
de = ki([
|
|
1546
|
-
Ht(Wt),
|
|
1547
|
-
At(1, T(re)),
|
|
1548
|
-
At(2, Dt)
|
|
1549
|
-
], de);
|
|
1550
|
-
function _e({ ref: t, ...e }) {
|
|
1551
|
-
const { icon: r, id: s, className: n, extend: a, ...i } = e, o = `univerjs-icon univerjs-icon-${s} ${n || ""}`.trim(), l = pi(`_${Bi()}`);
|
|
1552
|
-
return rr(r, `${s}`, {
|
|
1553
|
-
defIds: r.defIds,
|
|
1554
|
-
idSuffix: l.current
|
|
1555
|
-
}, {
|
|
1556
|
-
ref: t,
|
|
1557
|
-
className: o,
|
|
1558
|
-
...i
|
|
1559
|
-
}, a);
|
|
1560
|
-
}
|
|
1561
|
-
function rr(t, e, r, s, n) {
|
|
1562
|
-
return ve(t.tag, {
|
|
1563
|
-
key: e,
|
|
1564
|
-
...Hi(t, r, n),
|
|
1565
|
-
...s
|
|
1566
|
-
}, (Di(t, r).children || []).map((a, i) => rr(a, `${e}-${t.tag}-${i}`, r, void 0, n)));
|
|
1567
|
-
}
|
|
1568
|
-
function Hi(t, e, r) {
|
|
1569
|
-
const s = { ...t.attrs };
|
|
1570
|
-
r != null && r.colorChannel1 && s.fill === "colorChannel1" && (s.fill = r.colorChannel1), t.tag === "mask" && s.id && (s.id = s.id + e.idSuffix), Object.entries(s).forEach(([a, i]) => {
|
|
1571
|
-
a === "mask" && typeof i == "string" && (s[a] = i.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
|
|
1572
|
-
});
|
|
1573
|
-
const { defIds: n } = e;
|
|
1574
|
-
return !n || n.length === 0 || (t.tag === "use" && s["xlink:href"] && (s["xlink:href"] = s["xlink:href"] + e.idSuffix), Object.entries(s).forEach(([a, i]) => {
|
|
1575
|
-
typeof i == "string" && (s[a] = i.replace(/url\(#(.*)\)/, `url(#$1${e.idSuffix})`));
|
|
1576
|
-
})), s;
|
|
1577
|
-
}
|
|
1578
|
-
function Di(t, e) {
|
|
1579
|
-
var s;
|
|
1580
|
-
const { defIds: r } = e;
|
|
1581
|
-
return !r || r.length === 0 ? t : t.tag === "defs" && ((s = t.children) != null && s.length) ? {
|
|
1582
|
-
...t,
|
|
1583
|
-
children: t.children.map((n) => typeof n.attrs.id == "string" && r && r.includes(n.attrs.id) ? {
|
|
1584
|
-
...n,
|
|
1585
|
-
attrs: {
|
|
1586
|
-
...n.attrs,
|
|
1587
|
-
id: n.attrs.id + e.idSuffix
|
|
1588
|
-
}
|
|
1589
|
-
} : n)
|
|
1590
|
-
} : t;
|
|
1591
|
-
}
|
|
1592
|
-
function Bi() {
|
|
1593
|
-
return Math.random().toString(36).substring(2, 8);
|
|
1594
|
-
}
|
|
1595
|
-
_e.displayName = "UniverIcon";
|
|
1596
|
-
const Wi = {
|
|
1597
|
-
tag: "svg",
|
|
1598
|
-
attrs: {
|
|
1599
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1600
|
-
fill: "none",
|
|
1601
|
-
viewBox: "0 0 20 20",
|
|
1602
|
-
width: "1em",
|
|
1603
|
-
height: "1em"
|
|
1604
|
-
},
|
|
1605
|
-
children: [{
|
|
1606
|
-
tag: "path",
|
|
1607
|
-
attrs: {
|
|
1608
|
-
fill: "currentColor",
|
|
1609
|
-
d: "M10 1.05957C10.356 1.05957 10.6816 1.26162 10.8408 1.58008L18.8408 17.5801L18.8799 17.668C19.0486 18.1134 18.8551 18.6232 18.4199 18.8408C17.9557 19.0727 17.3913 18.8841 17.1592 18.4199L10 4.10156L2.84082 18.4199C2.60871 18.8841 2.04434 19.0727 1.58008 18.8408C1.11587 18.6087 0.92731 18.0443 1.15918 17.5801L9.15918 1.58008C9.31841 1.26162 9.64395 1.05957 10 1.05957Z"
|
|
1610
|
-
}
|
|
1611
|
-
}, {
|
|
1612
|
-
tag: "path",
|
|
1613
|
-
attrs: {
|
|
1614
|
-
fill: "currentColor",
|
|
1615
|
-
d: "M15.3337 11.7261L15.4294 11.731C15.9035 11.779 16.2732 12.1798 16.2732 12.6665C16.2732 13.1532 15.9035 13.554 15.4294 13.602L15.3337 13.6069H4.66675C4.1476 13.6069 3.72632 13.1856 3.72632 12.6665C3.72632 12.1474 4.1476 11.7261 4.66675 11.7261H15.3337Z"
|
|
1616
|
-
}
|
|
1617
|
-
}]
|
|
1618
|
-
}, ir = be(function(e, r) {
|
|
1619
|
-
return ve(_e, Object.assign({}, e, {
|
|
1620
|
-
id: "a-icon",
|
|
1621
|
-
ref: r,
|
|
1622
|
-
icon: Wi
|
|
1623
|
-
}));
|
|
1624
|
-
});
|
|
1625
|
-
ir.displayName = "AIcon";
|
|
1626
|
-
const Vi = {
|
|
1627
|
-
tag: "svg",
|
|
1628
|
-
attrs: {
|
|
1629
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1630
|
-
fill: "none",
|
|
1631
|
-
viewBox: "0 0 20 20",
|
|
1632
|
-
width: "1em",
|
|
1633
|
-
height: "1em"
|
|
1634
|
-
},
|
|
1635
|
-
children: [{
|
|
1636
|
-
tag: "path",
|
|
1637
|
-
attrs: {
|
|
1638
|
-
fill: "currentColor",
|
|
1639
|
-
d: "M17.0596 10C17.0596 6.10087 13.8992 2.94043 10 2.94043C6.10087 2.94043 2.94043 6.10087 2.94043 10C2.94043 13.8992 6.10087 17.0596 10 17.0596C13.8992 17.0596 17.0596 13.8992 17.0596 10ZM18.9404 10C18.9404 14.9374 14.9374 18.9404 10 18.9404C5.06257 18.9404 1.05957 14.9374 1.05957 10C1.05957 5.06257 5.06257 1.05957 10 1.05957C14.9374 1.05957 18.9404 5.06257 18.9404 10Z"
|
|
1640
|
-
}
|
|
1641
|
-
}, {
|
|
1642
|
-
tag: "path",
|
|
1643
|
-
attrs: {
|
|
1644
|
-
fill: "currentColor",
|
|
1645
|
-
d: "M4.29492 4.13476C4.63911 3.79057 5.1845 3.76906 5.55371 4.07031L5.625 4.13476L16.0244 14.5352L16.0889 14.6064C16.3902 14.9757 16.3686 15.52 16.0244 15.8643C15.6573 16.2313 15.0624 16.2313 14.6953 15.8643L4.29492 5.46484L4.23047 5.39355C3.92922 5.02434 3.95073 4.47895 4.29492 4.13476Z"
|
|
1646
|
-
}
|
|
1647
|
-
}]
|
|
1648
|
-
}, sr = be(function(e, r) {
|
|
1649
|
-
return ve(_e, Object.assign({}, e, {
|
|
1650
|
-
id: "ban-icon",
|
|
1651
|
-
ref: r,
|
|
1652
|
-
icon: Vi
|
|
1653
|
-
}));
|
|
1654
|
-
});
|
|
1655
|
-
sr.displayName = "BanIcon";
|
|
1656
|
-
const Qi = {
|
|
1657
|
-
tag: "svg",
|
|
1658
|
-
attrs: {
|
|
1659
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1660
|
-
fill: "none",
|
|
1661
|
-
viewBox: "0 0 17 16",
|
|
1662
|
-
width: "1em",
|
|
1663
|
-
height: "1em"
|
|
1664
|
-
},
|
|
1665
|
-
children: [{
|
|
1666
|
-
tag: "path",
|
|
1667
|
-
attrs: {
|
|
1668
|
-
fill: "currentColor",
|
|
1669
|
-
d: "M3.32182 2.60967C2.98161 2.60967 2.79671 3.0074 3.01601 3.2675L6.85819 7.8246C6.94943 7.93282 6.99947 8.06981 6.99947 8.21136V12.7338C6.99947 12.898 7.0998 13.0455 7.2525 13.1058L8.73833 13.6928C9.00085 13.7965 9.28531 13.6031 9.28531 13.3208V8.21136C9.28531 8.06981 9.33535 7.93282 9.42659 7.8246L13.2688 3.2675C13.4881 3.0074 13.3032 2.60967 12.963 2.60967H3.32182ZM2.09858 4.04101C1.22139 3.0006 1.96097 1.40967 3.32182 1.40967H12.963C14.3238 1.40967 15.0634 3.0006 14.1862 4.04101L10.4853 8.43054V13.3208C10.4853 14.4498 9.34747 15.2237 8.29742 14.8089L6.81158 14.2219C6.20078 13.9806 5.79947 13.3905 5.79947 12.7338V8.43054L2.09858 4.04101Z",
|
|
1670
|
-
fillRule: "evenodd",
|
|
1671
|
-
clipRule: "evenodd"
|
|
1672
|
-
}
|
|
1673
|
-
}]
|
|
1674
|
-
}, nr = be(function(e, r) {
|
|
1675
|
-
return ve(_e, Object.assign({}, e, {
|
|
1676
|
-
id: "filter-icon",
|
|
1677
|
-
ref: r,
|
|
1678
|
-
icon: Qi
|
|
1679
|
-
}));
|
|
1680
|
-
});
|
|
1681
|
-
nr.displayName = "FilterIcon";
|
|
1682
|
-
const Gi = {
|
|
1683
|
-
tag: "svg",
|
|
1684
|
-
attrs: {
|
|
1685
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1686
|
-
fill: "none",
|
|
1687
|
-
viewBox: "0 0 16 16",
|
|
1688
|
-
width: "1em",
|
|
1689
|
-
height: "1em"
|
|
1690
|
-
},
|
|
1691
|
-
children: [{
|
|
1692
|
-
tag: "path",
|
|
1693
|
-
attrs: {
|
|
1694
|
-
fill: "currentColor",
|
|
1695
|
-
d: "M8.00016 1.33203C6.68162 1.33203 5.39269 1.72302 4.29636 2.45557C3.20004 3.18811 2.34555 4.2293 1.84097 5.44747C1.33638 6.66565 1.20436 8.00609 1.4616 9.2993C1.71883 10.5925 2.35377 11.7804 3.28612 12.7127C4.21847 13.6451 5.40636 14.28 6.69956 14.5373C7.99277 14.7945 9.33321 14.6625 10.5514 14.1579C11.7696 13.6533 12.8108 12.7988 13.5433 11.7025C14.2758 10.6062 14.6668 9.31724 14.6668 7.9987C14.6649 6.23118 13.9619 4.53662 12.7121 3.2868C11.4622 2.03697 9.76768 1.33397 8.00016 1.33203ZM7.66683 3.9987C7.86461 3.9987 8.05795 4.05735 8.2224 4.16723C8.38685 4.27711 8.51502 4.43329 8.59071 4.61601C8.6664 4.79874 8.6862 4.99981 8.64762 5.19379C8.60903 5.38777 8.51379 5.56595 8.37394 5.7058C8.23409 5.84566 8.0559 5.9409 7.86192 5.97948C7.66794 6.01807 7.46687 5.99826 7.28415 5.92258C7.10142 5.84689 6.94524 5.71872 6.83536 5.55427C6.72548 5.38982 6.66683 5.19648 6.66683 4.9987C6.66683 4.73348 6.77219 4.47913 6.95972 4.29159C7.14726 4.10405 7.40162 3.9987 7.66683 3.9987ZM9.3335 11.332H6.66683C6.49002 11.332 6.32045 11.2618 6.19543 11.1368C6.0704 11.0117 6.00016 10.8422 6.00016 10.6654C6.00016 10.4886 6.0704 10.319 6.19543 10.194C6.32045 10.0689 6.49002 9.9987 6.66683 9.9987H7.3335V7.9987H6.66683C6.49002 7.9987 6.32045 7.92846 6.19543 7.80343C6.0704 7.67841 6.00016 7.50884 6.00016 7.33203C6.00016 7.15522 6.0704 6.98565 6.19543 6.86063C6.32045 6.7356 6.49002 6.66536 6.66683 6.66536H8.00016C8.17698 6.66536 8.34655 6.7356 8.47157 6.86063C8.59659 6.98565 8.66683 7.15522 8.66683 7.33203V9.9987H9.3335C9.51031 9.9987 9.67988 10.0689 9.8049 10.194C9.92993 10.319 10.0002 10.4886 10.0002 10.6654C10.0002 10.8422 9.92993 11.0117 9.8049 11.1368C9.67988 11.2618 9.51031 11.332 9.3335 11.332Z"
|
|
1696
|
-
}
|
|
1697
|
-
}]
|
|
1698
|
-
}, or = be(function(e, r) {
|
|
1699
|
-
return ve(_e, Object.assign({}, e, {
|
|
1700
|
-
id: "info-icon",
|
|
1701
|
-
ref: r,
|
|
1702
|
-
icon: Gi
|
|
1703
|
-
}));
|
|
1704
|
-
});
|
|
1705
|
-
or.displayName = "InfoIcon";
|
|
1706
|
-
const ji = {
|
|
1707
|
-
tag: "svg",
|
|
1708
|
-
attrs: {
|
|
1709
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1710
|
-
fill: "none",
|
|
1711
|
-
viewBox: "0 0 16 16",
|
|
1712
|
-
width: "1em",
|
|
1713
|
-
height: "1em"
|
|
1714
|
-
},
|
|
1715
|
-
children: [{
|
|
1716
|
-
tag: "path",
|
|
1717
|
-
attrs: {
|
|
1718
|
-
fill: "currentColor",
|
|
1719
|
-
d: "M8 15C11.866 15 15 11.866 15 8C15 4.13401 11.866 1 8 1C4.13401 1 1 4.13401 1 8C1 11.866 4.13401 15 8 15ZM11.7245 6.42417C11.9588 6.18985 11.9588 5.80995 11.7245 5.57564C11.4901 5.34132 11.1102 5.34132 10.8759 5.57564L7.3002 9.15137L5.72446 7.57564C5.49014 7.34132 5.11025 7.34132 4.87593 7.57564C4.64162 7.80995 4.64162 8.18985 4.87593 8.42417L6.87593 10.4242C7.11025 10.6585 7.49014 10.6585 7.72446 10.4242L11.7245 6.42417Z",
|
|
1720
|
-
fillRule: "evenodd",
|
|
1721
|
-
clipRule: "evenodd"
|
|
1722
|
-
}
|
|
1723
|
-
}]
|
|
1724
|
-
}, lr = be(function(e, r) {
|
|
1725
|
-
return ve(_e, Object.assign({}, e, {
|
|
1726
|
-
id: "success-icon",
|
|
1727
|
-
ref: r,
|
|
1728
|
-
icon: ji
|
|
1729
|
-
}));
|
|
1730
|
-
});
|
|
1731
|
-
lr.displayName = "SuccessIcon";
|
|
1732
|
-
function Yi(t) {
|
|
1733
|
-
const e = t.get(X);
|
|
1734
|
-
return {
|
|
1735
|
-
id: Oe.id,
|
|
1736
|
-
type: ut.BUTTON_SELECTOR,
|
|
1737
|
-
icon: "FilterIcon",
|
|
1738
|
-
tooltip: "sheets-filter.toolbar.smart-toggle-filter-tooltip",
|
|
1739
|
-
hidden$: ct(t, ie.UNIVER_SHEET),
|
|
1740
|
-
activated$: e.activeFilterModel$.pipe(ae((r) => !!r)),
|
|
1741
|
-
disabled$: Pr(
|
|
1742
|
-
t,
|
|
1743
|
-
wr(
|
|
1744
|
-
t,
|
|
1745
|
-
{
|
|
1746
|
-
worksheetTypes: [Se, Ce],
|
|
1747
|
-
rangeTypes: [Te]
|
|
1748
|
-
}
|
|
1749
|
-
)
|
|
1750
|
-
)
|
|
1751
|
-
};
|
|
1752
|
-
}
|
|
1753
|
-
function Zi(t) {
|
|
1754
|
-
const e = t.get(X);
|
|
1755
|
-
return {
|
|
1756
|
-
id: at.id,
|
|
1757
|
-
type: ut.BUTTON,
|
|
1758
|
-
title: "sheets-filter.toolbar.clear-filter-criteria",
|
|
1759
|
-
hidden$: ct(t, ie.UNIVER_SHEET),
|
|
1760
|
-
disabled$: e.activeFilterModel$.pipe(ht((r) => {
|
|
1761
|
-
var s;
|
|
1762
|
-
return (s = r == null ? void 0 : r.hasCriteria$.pipe(ae((n) => !n))) != null ? s : pe(!0);
|
|
1763
|
-
}))
|
|
1764
|
-
};
|
|
1765
|
-
}
|
|
1766
|
-
function zi(t) {
|
|
1767
|
-
const e = t.get(X);
|
|
1768
|
-
return {
|
|
1769
|
-
id: lt.id,
|
|
1770
|
-
type: ut.BUTTON,
|
|
1771
|
-
title: "sheets-filter.toolbar.re-calc-filter-conditions",
|
|
1772
|
-
hidden$: ct(t, ie.UNIVER_SHEET),
|
|
1773
|
-
disabled$: e.activeFilterModel$.pipe(ht((r) => {
|
|
1774
|
-
var s;
|
|
1775
|
-
return (s = r == null ? void 0 : r.hasCriteria$.pipe(ae((n) => !n))) != null ? s : pe(!0);
|
|
1776
|
-
}))
|
|
1777
|
-
};
|
|
1778
|
-
}
|
|
1779
|
-
const Ki = {
|
|
1780
|
-
[Ur.ORGANIZATION]: {
|
|
1781
|
-
[Oe.id]: {
|
|
1782
|
-
order: 2,
|
|
1783
|
-
menuItemFactory: Yi,
|
|
1784
|
-
[at.id]: {
|
|
1785
|
-
order: 0,
|
|
1786
|
-
menuItemFactory: Zi
|
|
1787
|
-
},
|
|
1788
|
-
[lt.id]: {
|
|
1789
|
-
order: 1,
|
|
1790
|
-
menuItemFactory: zi
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
}
|
|
1794
|
-
};
|
|
1795
|
-
function qi(t) {
|
|
1796
|
-
const { model: e } = t, r = D(G), s = L(e.cellFillColors$, [], !0), n = L(e.cellTextColors$, [], !0), a = U((o) => {
|
|
1797
|
-
e.onFilterCheckToggled(o);
|
|
1798
|
-
}, [e]), i = U((o) => {
|
|
1799
|
-
e.onFilterCheckToggled(o, !1);
|
|
1800
|
-
}, [e]);
|
|
1801
|
-
return /* @__PURE__ */ d(
|
|
1802
|
-
"div",
|
|
1803
|
-
{
|
|
1804
|
-
"data-u-comp": "sheets-filter-panel-colors-container",
|
|
1805
|
-
className: "univer-flex univer-h-full univer-min-h-[300px] univer-flex-col",
|
|
1806
|
-
children: /* @__PURE__ */ y(
|
|
1807
|
-
"div",
|
|
1808
|
-
{
|
|
1809
|
-
"data-u-comp": "sheets-filter-panel",
|
|
1810
|
-
className: $e("univer-mt-2 univer-box-border univer-flex univer-h-[300px] univer-flex-grow univer-flex-col univer-gap-4 univer-overflow-auto univer-rounded-md univer-px-2 univer-py-2.5", dt),
|
|
1811
|
-
children: [
|
|
1812
|
-
s.length > 1 && /* @__PURE__ */ y("div", { children: [
|
|
1813
|
-
/* @__PURE__ */ d(
|
|
1814
|
-
"div",
|
|
1815
|
-
{
|
|
1816
|
-
className: "univer-mb-2 univer-text-sm univer-text-gray-900 dark:!univer-text-white",
|
|
1817
|
-
children: r.t("sheets-filter.panel.filter-by-cell-fill-color")
|
|
1818
|
-
}
|
|
1819
|
-
),
|
|
1820
|
-
/* @__PURE__ */ d(
|
|
1821
|
-
"div",
|
|
1822
|
-
{
|
|
1823
|
-
className: "univer-grid univer-grid-cols-8 univer-items-center univer-justify-start univer-gap-2",
|
|
1824
|
-
children: s.map((o, l) => /* @__PURE__ */ y(
|
|
1825
|
-
"div",
|
|
1826
|
-
{
|
|
1827
|
-
className: "univer-relative univer-size-6",
|
|
1828
|
-
onClick: () => a(o),
|
|
1829
|
-
children: [
|
|
1830
|
-
o.color ? /* @__PURE__ */ d(
|
|
1831
|
-
"button",
|
|
1832
|
-
{
|
|
1833
|
-
type: "button",
|
|
1834
|
-
className: $e("univer-box-border univer-size-6 univer-cursor-pointer univer-rounded-full univer-border univer-border-solid univer-border-transparent univer-bg-gray-300 univer-transition-shadow hover:univer-ring-2 hover:univer-ring-offset-2 hover:univer-ring-offset-white"),
|
|
1835
|
-
style: { backgroundColor: o.color }
|
|
1836
|
-
}
|
|
1837
|
-
) : /* @__PURE__ */ d(
|
|
1838
|
-
sr,
|
|
1839
|
-
{
|
|
1840
|
-
className: "univer-size-6 univer-cursor-pointer univer-rounded-full hover:univer-ring-2 hover:univer-ring-offset-2 hover:univer-ring-offset-white"
|
|
1841
|
-
}
|
|
1842
|
-
),
|
|
1843
|
-
o.checked && /* @__PURE__ */ d(Pt, {})
|
|
1844
|
-
]
|
|
1845
|
-
},
|
|
1846
|
-
`sheets-filter-cell-fill-color-${l}`
|
|
1847
|
-
))
|
|
1848
|
-
}
|
|
1849
|
-
)
|
|
1850
|
-
] }),
|
|
1851
|
-
n.length > 1 && /* @__PURE__ */ y("div", { children: [
|
|
1852
|
-
/* @__PURE__ */ d(
|
|
1853
|
-
"div",
|
|
1854
|
-
{
|
|
1855
|
-
className: "univer-mb-2 univer-text-sm univer-text-gray-900 dark:!univer-text-white",
|
|
1856
|
-
children: r.t("sheets-filter.panel.filter-by-cell-text-color")
|
|
1857
|
-
}
|
|
1858
|
-
),
|
|
1859
|
-
/* @__PURE__ */ d(
|
|
1860
|
-
"div",
|
|
1861
|
-
{
|
|
1862
|
-
className: "univer-grid univer-grid-cols-8 univer-items-center univer-justify-start univer-gap-2",
|
|
1863
|
-
children: n.map((o, l) => /* @__PURE__ */ y(
|
|
1864
|
-
"div",
|
|
1865
|
-
{
|
|
1866
|
-
className: "univer-relative univer-size-6",
|
|
1867
|
-
onClick: () => i(o),
|
|
1868
|
-
children: [
|
|
1869
|
-
/* @__PURE__ */ d(
|
|
1870
|
-
"div",
|
|
1871
|
-
{
|
|
1872
|
-
className: "univer-box-border univer-flex univer-size-full univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-full univer-border univer-border-solid univer-border-[rgba(13,13,13,0.06)] univer-p-0.5 hover:univer-ring-2 hover:univer-ring-offset-2 hover:univer-ring-offset-white dark:!univer-border-[rgba(255,255,255,0.06)]",
|
|
1873
|
-
children: /* @__PURE__ */ d(ir, { style: { color: o.color } })
|
|
1874
|
-
}
|
|
1875
|
-
),
|
|
1876
|
-
o.checked && /* @__PURE__ */ d(Pt, {})
|
|
1877
|
-
]
|
|
1878
|
-
},
|
|
1879
|
-
`sheets-filter-cell-text-color-${l}`
|
|
1880
|
-
))
|
|
1881
|
-
}
|
|
1882
|
-
)
|
|
1883
|
-
] }),
|
|
1884
|
-
s.length <= 1 && n.length <= 1 && /* @__PURE__ */ d(
|
|
1885
|
-
"div",
|
|
1886
|
-
{
|
|
1887
|
-
className: "univer-flex univer-size-full univer-items-center univer-justify-center univer-text-sm univer-text-gray-900 dark:!univer-text-gray-200",
|
|
1888
|
-
children: r.t("sheets-filter.panel.filter-by-color-none")
|
|
1889
|
-
}
|
|
1890
|
-
)
|
|
1891
|
-
]
|
|
1892
|
-
}
|
|
1893
|
-
)
|
|
1894
|
-
}
|
|
1895
|
-
);
|
|
1896
|
-
}
|
|
1897
|
-
function Pt() {
|
|
1898
|
-
return /* @__PURE__ */ d(
|
|
1899
|
-
"div",
|
|
1900
|
-
{
|
|
1901
|
-
className: "univer-absolute -univer-bottom-0.5 -univer-right-0.5 univer-flex univer-size-3 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-full univer-bg-white",
|
|
1902
|
-
children: /* @__PURE__ */ d(
|
|
1903
|
-
lr,
|
|
1904
|
-
{
|
|
1905
|
-
className: "univer-size-full univer-font-bold univer-text-[#418F1F]"
|
|
1906
|
-
}
|
|
1907
|
-
)
|
|
1908
|
-
}
|
|
1909
|
-
);
|
|
1910
|
-
}
|
|
1911
|
-
function Xi(t) {
|
|
1912
|
-
var p, _;
|
|
1913
|
-
const { model: e } = t, r = D(G), s = L(e.conditionItem$, void 0), n = L(e.filterConditionFormParams$, void 0), a = n != null && n.and ? "AND" : "OR", i = U((C) => {
|
|
1914
|
-
e.onConditionFormChange({ and: C === "AND" });
|
|
1915
|
-
}, [e]), o = Ji(r), l = U((C) => {
|
|
1916
|
-
e.onPrimaryConditionChange(C);
|
|
1917
|
-
}, [e]), c = es(r), h = U((C) => {
|
|
1918
|
-
e.onConditionFormChange(C);
|
|
1919
|
-
}, [e]), m = r.t("sheets-filter.panel.input-values-placeholder");
|
|
1920
|
-
function S(C, N, F) {
|
|
1921
|
-
const R = f.getItemByOperator(C).numOfParameters === 1;
|
|
1922
|
-
return /* @__PURE__ */ y(yt, { children: [
|
|
1923
|
-
F === "operator2" && /* @__PURE__ */ y(ci, { value: a, onChange: i, children: [
|
|
1924
|
-
/* @__PURE__ */ d(It, { value: "AND", children: r.t("sheets-filter.panel.and") }),
|
|
1925
|
-
/* @__PURE__ */ d(It, { value: "OR", children: r.t("sheets-filter.panel.or") })
|
|
1926
|
-
] }),
|
|
1927
|
-
/* @__PURE__ */ d(
|
|
1928
|
-
Ft,
|
|
1929
|
-
{
|
|
1930
|
-
value: C,
|
|
1931
|
-
options: c,
|
|
1932
|
-
onChange: (O) => h({ [F]: O })
|
|
1933
|
-
}
|
|
1934
|
-
),
|
|
1935
|
-
R && /* @__PURE__ */ d("div", { children: /* @__PURE__ */ d(
|
|
1936
|
-
zt,
|
|
1937
|
-
{
|
|
1938
|
-
className: "univer-mt-2",
|
|
1939
|
-
value: N,
|
|
1940
|
-
placeholder: m,
|
|
1941
|
-
onChange: (O) => h({ [F === "operator1" ? "val1" : "val2"]: O })
|
|
1942
|
-
}
|
|
1943
|
-
) })
|
|
1944
|
-
] });
|
|
1945
|
-
}
|
|
1946
|
-
return /* @__PURE__ */ d(
|
|
1947
|
-
"div",
|
|
1948
|
-
{
|
|
1949
|
-
"data-u-comp": "sheets-filter-panel-conditions-container",
|
|
1950
|
-
className: "univer-flex univer-h-full univer-min-h-[300px] univer-flex-col",
|
|
1951
|
-
children: s && n && /* @__PURE__ */ y(yt, { children: [
|
|
1952
|
-
/* @__PURE__ */ d(Ft, { value: s.operator, options: o, onChange: l }),
|
|
1953
|
-
f.getItemByOperator(s.operator).numOfParameters !== 0 ? /* @__PURE__ */ y(
|
|
1954
|
-
"div",
|
|
1955
|
-
{
|
|
1956
|
-
"data-u-comp": "sheets-filter-panel-conditions-container-inner",
|
|
1957
|
-
className: $e("univer-mt-2 univer-flex-grow univer-overflow-hidden univer-rounded-md univer-p-2", dt),
|
|
1958
|
-
children: [
|
|
1959
|
-
s.numOfParameters >= 1 && S(n.operator1, (p = n.val1) != null ? p : "", "operator1"),
|
|
1960
|
-
s.numOfParameters >= 2 && S(n.operator2, (_ = n.val2) != null ? _ : "", "operator2"),
|
|
1961
|
-
/* @__PURE__ */ y(
|
|
1962
|
-
"div",
|
|
1963
|
-
{
|
|
1964
|
-
"data-u-comp": "sheets-filter-panel-conditions-desc",
|
|
1965
|
-
className: "univer-mt-2 univer-text-xs univer-text-gray-500",
|
|
1966
|
-
children: [
|
|
1967
|
-
r.t("sheets-filter.panel.?"),
|
|
1968
|
-
/* @__PURE__ */ d("br", {}),
|
|
1969
|
-
r.t("sheets-filter.panel.*")
|
|
1970
|
-
]
|
|
1971
|
-
}
|
|
1972
|
-
)
|
|
1973
|
-
]
|
|
1974
|
-
}
|
|
1975
|
-
) : null
|
|
1976
|
-
] })
|
|
1977
|
-
}
|
|
1978
|
-
);
|
|
1979
|
-
}
|
|
1980
|
-
function Ji(t) {
|
|
1981
|
-
const e = t.getCurrentLocale();
|
|
1982
|
-
return mt(() => [
|
|
1983
|
-
{
|
|
1984
|
-
options: [
|
|
1985
|
-
{ label: t.t(f.NONE.label), value: f.NONE.operator }
|
|
1986
|
-
]
|
|
1987
|
-
},
|
|
1988
|
-
{
|
|
1989
|
-
options: [
|
|
1990
|
-
{ label: t.t(f.EMPTY.label), value: f.EMPTY.operator },
|
|
1991
|
-
{ label: t.t(f.NOT_EMPTY.label), value: f.NOT_EMPTY.operator }
|
|
1992
|
-
]
|
|
1993
|
-
},
|
|
1994
|
-
{
|
|
1995
|
-
options: [
|
|
1996
|
-
{ label: t.t(f.TEXT_CONTAINS.label), value: f.TEXT_CONTAINS.operator },
|
|
1997
|
-
{ label: t.t(f.DOES_NOT_CONTAIN.label), value: f.DOES_NOT_CONTAIN.operator },
|
|
1998
|
-
{ label: t.t(f.STARTS_WITH.label), value: f.STARTS_WITH.operator },
|
|
1999
|
-
{ label: t.t(f.ENDS_WITH.label), value: f.ENDS_WITH.operator },
|
|
2000
|
-
{ label: t.t(f.EQUALS.label), value: f.EQUALS.operator }
|
|
2001
|
-
]
|
|
2002
|
-
},
|
|
2003
|
-
{
|
|
2004
|
-
options: [
|
|
2005
|
-
{ label: t.t(f.GREATER_THAN.label), value: f.GREATER_THAN.operator },
|
|
2006
|
-
{ label: t.t(f.GREATER_THAN_OR_EQUAL.label), value: f.GREATER_THAN_OR_EQUAL.operator },
|
|
2007
|
-
{ label: t.t(f.LESS_THAN.label), value: f.LESS_THAN.operator },
|
|
2008
|
-
{ label: t.t(f.LESS_THAN_OR_EQUAL.label), value: f.LESS_THAN_OR_EQUAL.operator },
|
|
2009
|
-
{ label: t.t(f.EQUAL.label), value: f.EQUAL.operator },
|
|
2010
|
-
{ label: t.t(f.NOT_EQUAL.label), value: f.NOT_EQUAL.operator },
|
|
2011
|
-
{ label: t.t(f.BETWEEN.label), value: f.BETWEEN.operator },
|
|
2012
|
-
{ label: t.t(f.NOT_BETWEEN.label), value: f.NOT_BETWEEN.operator }
|
|
2013
|
-
]
|
|
2014
|
-
},
|
|
2015
|
-
{
|
|
2016
|
-
options: [
|
|
2017
|
-
{ label: t.t(f.CUSTOM.label), value: f.CUSTOM.operator }
|
|
2018
|
-
]
|
|
2019
|
-
}
|
|
2020
|
-
], [e, t]);
|
|
2021
|
-
}
|
|
2022
|
-
function es(t) {
|
|
2023
|
-
const e = t.getCurrentLocale();
|
|
2024
|
-
return mt(() => f.ALL_CONDITIONS.filter((r) => r.numOfParameters !== 2).map((r) => ({ label: t.t(r.label), value: r.operator })), [e, t]);
|
|
2025
|
-
}
|
|
2026
|
-
function ts(t) {
|
|
2027
|
-
const { model: e } = t, r = D(G), s = L(e.searchString$, "", !0), n = L(e.filterItems$, void 0, !0), a = r.t("sheets-filter.panel.filter-only"), i = tt(n), o = i.checked > 0 && i.unchecked === 0, l = i.checked > 0 && i.unchecked > 0, c = e.treeMapCache, h = U(() => {
|
|
2028
|
-
e.onCheckAllToggled(!o);
|
|
2029
|
-
}, [e, o]), m = U((p) => {
|
|
2030
|
-
e.setSearchString(p);
|
|
2031
|
-
}, [e]);
|
|
2032
|
-
function S(p) {
|
|
2033
|
-
let _ = [];
|
|
2034
|
-
return p.forEach((C) => {
|
|
2035
|
-
C.checked && _.push(C.key), C.children && (_ = _.concat(S(C.children)));
|
|
2036
|
-
}), _;
|
|
2037
|
-
}
|
|
2038
|
-
return /* @__PURE__ */ y(
|
|
2039
|
-
"div",
|
|
2040
|
-
{
|
|
2041
|
-
"data-u-comp": "sheets-filter-panel-values-container",
|
|
2042
|
-
className: "univer-flex univer-h-full univer-min-h-[300px] univer-flex-col",
|
|
2043
|
-
children: [
|
|
2044
|
-
/* @__PURE__ */ d(
|
|
2045
|
-
zt,
|
|
2046
|
-
{
|
|
2047
|
-
autoFocus: !0,
|
|
2048
|
-
value: s,
|
|
2049
|
-
placeholder: r.t("sheets-filter.panel.search-placeholder"),
|
|
2050
|
-
onChange: m
|
|
2051
|
-
}
|
|
2052
|
-
),
|
|
2053
|
-
/* @__PURE__ */ y(
|
|
2054
|
-
"div",
|
|
2055
|
-
{
|
|
2056
|
-
"data-u-comp": "sheets-filter-panel",
|
|
2057
|
-
className: $e("univer-mt-2 univer-box-border univer-flex univer-flex-grow univer-flex-col univer-overflow-hidden univer-rounded-md univer-px-2 univer-py-2.5", dt),
|
|
2058
|
-
children: [
|
|
2059
|
-
/* @__PURE__ */ d(
|
|
2060
|
-
"div",
|
|
2061
|
-
{
|
|
2062
|
-
"data-u-comp": "sheets-filter-panel-values-item",
|
|
2063
|
-
className: "univer-box-border univer-h-8 univer-w-full univer-py-0.5",
|
|
2064
|
-
children: /* @__PURE__ */ y(
|
|
2065
|
-
"div",
|
|
2066
|
-
{
|
|
2067
|
-
"data-u-comp": "sheets-filter-panel-values-item-inner",
|
|
2068
|
-
className: "univer-box-border univer-flex univer-h-7 univer-items-center univer-rounded-md univer-py-0 univer-pl-5 univer-pr-0.5 univer-text-sm",
|
|
2069
|
-
children: [
|
|
2070
|
-
/* @__PURE__ */ d(
|
|
2071
|
-
ui,
|
|
2072
|
-
{
|
|
2073
|
-
indeterminate: l,
|
|
2074
|
-
disabled: n.length === 0,
|
|
2075
|
-
checked: o,
|
|
2076
|
-
onChange: h
|
|
2077
|
-
}
|
|
2078
|
-
),
|
|
2079
|
-
/* @__PURE__ */ d(
|
|
2080
|
-
"span",
|
|
2081
|
-
{
|
|
2082
|
-
"data-u-comp": "sheets-filter-panel-values-item-text",
|
|
2083
|
-
className: "univer-mx-1 univer-inline-block univer-flex-shrink univer-truncate univer-text-gray-900 dark:!univer-text-white",
|
|
2084
|
-
children: `${r.t("sheets-filter.panel.select-all")}`
|
|
2085
|
-
}
|
|
2086
|
-
),
|
|
2087
|
-
/* @__PURE__ */ d(
|
|
2088
|
-
"span",
|
|
2089
|
-
{
|
|
2090
|
-
"data-u-comp": "sheets-filter-panel-values-item-count",
|
|
2091
|
-
className: "univer-text-gray-400 dark:!univer-text-gray-500",
|
|
2092
|
-
children: `(${i.checked}/${i.checked + i.unchecked})`
|
|
2093
|
-
}
|
|
2094
|
-
)
|
|
2095
|
-
]
|
|
2096
|
-
}
|
|
2097
|
-
)
|
|
2098
|
-
}
|
|
2099
|
-
),
|
|
2100
|
-
/* @__PURE__ */ d("div", { "data-u-comp": "sheets-filter-panel-values-virtual", className: "univer-flex-grow", children: /* @__PURE__ */ d(
|
|
2101
|
-
hi,
|
|
2102
|
-
{
|
|
2103
|
-
data: n,
|
|
2104
|
-
defaultExpandAll: !1,
|
|
2105
|
-
valueGroup: S(n),
|
|
2106
|
-
onChange: (p) => {
|
|
2107
|
-
e.onFilterCheckToggled(p);
|
|
2108
|
-
},
|
|
2109
|
-
defaultCache: c,
|
|
2110
|
-
itemHeight: 28,
|
|
2111
|
-
treeNodeClassName: `
|
|
1
|
+
import{BooleanNumber as e,ColorKit as t,CommandType as n,DependentOn as r,Disposable as i,ICommandService as a,IConfigService as o,IContextService as s,ILogService as c,IUniverInstanceService as l,Inject as u,Injector as d,InterceptorEffectEnum as f,LocaleService as p,Optional as m,Plugin as h,Quantity as g,RxDisposable as _,ThemeService as v,Tools as y,UniverInstanceType as b,VerticalAlign as x,createIdentifier as S,extractPureTextFromCell as ee,fromCallback as C,merge as w,numfmt as te,registerDependencies as ne,touchDependencies as re}from"@univerjs/core";import{ClearSheetsFilterCriteriaCommand as ie,CustomFilterOperator as T,FILTER_MUTATIONS as ae,FilterBy as E,ReCalcSheetsFilterCommand as oe,ReCalcSheetsFilterMutation as se,RemoveSheetFilterCommand as ce,RemoveSheetsFilterMutation as le,SetSheetFilterRangeCommand as ue,SetSheetsFilterCriteriaCommand as D,SetSheetsFilterCriteriaMutation as de,SetSheetsFilterRangeMutation as fe,SheetsFilterService as O,SheetsFilterSyncController as pe,SmartToggleSheetsFilterCommand as me,UniverSheetsFilterPlugin as he}from"@univerjs/sheets-filter";import{IEditorBridgeService as ge,ISheetSelectionRenderService as _e,SelectionControl as ve,SetCellEditVisibleOperation as ye,SheetCanvasPopManagerService as be,SheetSkeletonManagerService as xe,SheetsRenderService as Se,SheetsUIPart as Ce,attachSelectionWithCoord as we,getCoordByCell as Te,getCurrentRangeDisable$ as Ee,getObservableWithExclusiveRange$ as De,whenSheetEditorFocused as Oe}from"@univerjs/sheets-ui";import{ComponentContainer as ke,ComponentManager as Ae,ILayoutService as je,IMenuManagerService as Me,IMessageService as Ne,IShortcutService as Pe,KeyCode as Fe,MenuItemType as Ie,MetaKeys as Le,RibbonDataGroup as Re,getMenuHiddenObservable as ze,useComponentsOfPart as Be,useDependency as k,useObservable as A}from"@univerjs/ui";import{COLOR_BLACK_RGB as Ve,IRenderManagerService as He,Rect as Ue,Shape as We}from"@univerjs/engine-render";import{INTERCEPTOR_POINT as Ge,RangeProtectionPermissionViewPoint as j,RefRangeService as Ke,SetRangeValuesMutation as qe,SheetInterceptorService as Je,SheetPermissionCheckController as Ye,SheetsSelectionsService as Xe,WorksheetFilterPermission as M,WorksheetViewPermission as N,expandToContinuousRange as Ze,getSheetCommandTarget as Qe}from"@univerjs/sheets";import{BehaviorSubject as P,ReplaySubject as $e,Subject as et,combineLatest as tt,distinctUntilChanged as nt,filter as rt,map as F,merge as it,of as I,shareReplay as at,startWith as ot,switchMap as st,takeUntil as ct,throttleTime as lt}from"rxjs";import{IRPCChannelService as ut,fromModule as dt,toModule as ft}from"@univerjs/rpc";import{Button as pt,Checkbox as mt,Input as ht,MessageType as gt,Radio as _t,RadioGroup as vt,Segmented as yt,Select as bt,Switch as xt,Tooltip as St,Tree as Ct,borderClassName as wt,clsx as Tt}from"@univerjs/design";import{AIcon as Et,BanIcon as Dt,FilterIcon as Ot,InfoIcon as kt,SuccessIcon as At}from"@univerjs/icons";import{useCallback as L,useMemo as jt}from"react";import{Fragment as Mt,jsx as R,jsxs as z}from"react/jsx-runtime";let B=function(e){return e[e.FIRST=0]=`FIRST`,e[e.SECOND=1]=`SECOND`,e}({}),V=function(e){return e.NONE=`none`,e.STARTS_WITH=`startsWith`,e.DOES_NOT_START_WITH=`doesNotStartWith`,e.ENDS_WITH=`endsWith`,e.DOES_NOT_END_WITH=`doesNotEndWith`,e.CONTAINS=`contains`,e.DOES_NOT_CONTAIN=`doesNotContain`,e.EQUALS=`equals`,e.NOT_EQUALS=`notEquals`,e.EMPTY=`empty`,e.NOT_EMPTY=`notEmpty`,e.BETWEEN=`between`,e.NOT_BETWEEN=`notBetween`,e.CUSTOM=`custom`,e}({}),H;(function(t){let n=t.NONE={label:`sheets-filter.conditions.none`,operator:V.NONE,order:B.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw Error(`[FilterConditionItems.NONE]: should not have initial form params!`)},testMappingParams:e=>e.operator1===V.NONE,mapToFilterColumn:()=>null,testMappingFilterColumn:e=>!e.customFilters&&!e.filters?{}:!1},r=t.ALL_CONDITIONS=[n,t.EMPTY={label:`sheets-filter.conditions.empty`,operator:V.EMPTY,order:B.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw Error(`[FilterConditionItems.EMPTY]: should not have initial form params!`)},testMappingParams:({operator1:e})=>e===V.EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:``}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0];return n.val===``&&n.operator===void 0?{operator1:V.EMPTY}:!1}},t.NOT_EMPTY={label:`sheets-filter.conditions.not-empty`,operator:V.NOT_EMPTY,order:B.SECOND,numOfParameters:0,getDefaultFormParams:()=>{throw Error(`[FilterConditionItems.NOT_EMPTY]: should not have initial form params!`)},testMappingParams:({operator1:e})=>e===V.NOT_EMPTY,mapToFilterColumn:()=>({customFilters:{customFilters:[{val:``,operator:T.NOT_EQUALS}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0];return n.val===` `&&n.operator===T.NOT_EQUALS?{operator1:V.NOT_EMPTY}:!1}},t.TEXT_CONTAINS={label:`sheets-filter.conditions.text-contains`,operator:V.CONTAINS,order:B.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:V.CONTAINS,val1:``}),testMappingParams:e=>{let[t]=U(e);return t===V.CONTAINS},mapToFilterColumn:e=>{let{val1:t}=e;return t===``?null:{customFilters:{customFilters:[{val:`*${t}*`}]}}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0],r=n.val.toString();return!n.operator&&r.startsWith(`*`)&&r.endsWith(`*`)?{operator1:V.CONTAINS,val1:r.slice(1,-1)}:!1}},t.DOES_NOT_CONTAIN={label:`sheets-filter.conditions.does-not-contain`,operator:V.DOES_NOT_CONTAIN,order:B.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:V.DOES_NOT_CONTAIN,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:`*${e.val1}*`,operator:T.NOT_EQUALS}]}}),testMappingParams:e=>{let[t]=U(e);return t===V.DOES_NOT_CONTAIN},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0],r=n.val.toString();return n.operator===T.NOT_EQUALS&&r.startsWith(`*`)&&r.endsWith(`*`)?{operator1:V.DOES_NOT_CONTAIN,val1:r.slice(1,-1)}:!1}},t.STARTS_WITH={label:`sheets-filter.conditions.starts-with`,operator:V.STARTS_WITH,order:B.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:V.STARTS_WITH,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:`${e.val1}*`}]}}),testMappingParams:e=>{let[t]=U(e);return t===V.STARTS_WITH},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0],r=n.val.toString();return!n.operator&&r.endsWith(`*`)&&!r.startsWith(`*`)?{operator1:V.STARTS_WITH,val1:r.slice(0,-1)}:!1}},t.ENDS_WITH={label:`sheets-filter.conditions.ends-with`,operator:V.ENDS_WITH,order:B.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:V.ENDS_WITH,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:`*${e.val1}`}]}}),testMappingParams:e=>{let[t]=U(e);return t===V.ENDS_WITH},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0],r=n.val.toString();return!n.operator&&r.startsWith(`*`)&&!r.endsWith(`*`)?{operator1:V.ENDS_WITH,val1:r.slice(1)}:!1}},t.EQUALS={label:`sheets-filter.conditions.equals`,operator:V.EQUALS,order:B.FIRST,numOfParameters:1,getDefaultFormParams:()=>({operator1:V.EQUALS,val1:``}),testMappingParams:e=>{let[t]=U(e);return t===V.EQUALS},mapToFilterColumn:e=>{let{val1:t}=e;return t===``?null:{customFilters:{customFilters:[{val:t}]}}},testMappingFilterColumn:e=>{var t,n;return((t=e.filters)==null||(t=t.filters)==null?void 0:t.length)===1?{operator1:V.EQUALS,val1:``}:((n=e.customFilters)==null?void 0:n.customFilters.length)===1&&!e.customFilters.customFilters[0].operator?{operator1:V.EQUALS,val1:e.customFilters.customFilters[0].val.toString()}:!1}},t.GREATER_THAN={label:`sheets-filter.conditions.greater-than`,operator:T.GREATER_THAN,numOfParameters:1,order:B.FIRST,getDefaultFormParams:()=>({operator1:T.GREATER_THAN,val1:``}),mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:T.GREATER_THAN}]}}),testMappingParams:e=>{let[t]=U(e);return t===T.GREATER_THAN},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0];return n.operator===T.GREATER_THAN?{operator1:T.GREATER_THAN,val1:n.val.toString()}:!1}},t.GREATER_THAN_OR_EQUAL={label:`sheets-filter.conditions.greater-than-or-equal`,operator:T.GREATER_THAN_OR_EQUAL,numOfParameters:1,order:B.FIRST,getDefaultFormParams:()=>({operator1:T.GREATER_THAN_OR_EQUAL,val1:``}),testMappingParams:e=>{let[t]=U(e);return t===T.GREATER_THAN_OR_EQUAL},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:T.GREATER_THAN_OR_EQUAL}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0];return n.operator===T.GREATER_THAN_OR_EQUAL?{operator1:T.GREATER_THAN_OR_EQUAL,val1:n.val.toString()}:!1}},t.LESS_THAN={label:`sheets-filter.conditions.less-than`,operator:T.LESS_THAN,numOfParameters:1,order:B.FIRST,getDefaultFormParams:()=>({operator1:T.LESS_THAN,val1:``}),testMappingParams:e=>{let[t]=U(e);return t===T.LESS_THAN},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:T.LESS_THAN}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0];return n.operator===T.LESS_THAN?{operator1:T.LESS_THAN,val1:n.val.toString()}:!1}},t.LESS_THAN_OR_EQUAL={label:`sheets-filter.conditions.less-than-or-equal`,operator:T.LESS_THAN_OR_EQUAL,numOfParameters:1,order:B.FIRST,getDefaultFormParams:()=>({operator1:T.LESS_THAN_OR_EQUAL,val1:``}),testMappingParams:e=>{let[t]=U(e);return t===T.LESS_THAN_OR_EQUAL},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:T.LESS_THAN_OR_EQUAL}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0];return n.operator===T.LESS_THAN_OR_EQUAL?{operator1:T.LESS_THAN_OR_EQUAL,val1:n.val.toString()}:!1}},t.EQUAL={label:`sheets-filter.conditions.equal`,operator:T.EQUAL,numOfParameters:1,order:B.FIRST,getDefaultFormParams:()=>({operator1:T.EQUAL,val1:``}),testMappingParams:e=>{let[t]=U(e);return t===T.EQUAL},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:T.EQUAL}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0];return n.operator===T.EQUAL?{operator1:T.EQUAL,val1:n.val.toString()}:!1}},t.NOT_EQUAL={label:`sheets-filter.conditions.not-equal`,operator:T.NOT_EQUALS,numOfParameters:1,order:B.FIRST,getDefaultFormParams:()=>({operator1:T.NOT_EQUALS,val1:``}),testMappingParams:e=>{let[t]=U(e);return t===T.NOT_EQUALS},mapToFilterColumn:e=>({customFilters:{customFilters:[{val:e.val1,operator:T.NOT_EQUALS}]}}),testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==1)return!1;let n=e.customFilters.customFilters[0];return n.operator===T.NOT_EQUALS?{operator1:T.NOT_EQUALS,val1:n.val.toString()}:!1}},t.BETWEEN={label:`sheets-filter.conditions.between`,operator:V.BETWEEN,order:B.SECOND,numOfParameters:2,getDefaultFormParams:()=>({and:!0,operator1:T.GREATER_THAN_OR_EQUAL,val1:``,operator2:T.LESS_THAN_OR_EQUAL,val2:``}),testMappingParams:e=>{let{and:t,operator1:n,operator2:r}=e;if(!t)return!1;let i=[n,r];return i.includes(T.GREATER_THAN_OR_EQUAL)&&i.includes(T.LESS_THAN_OR_EQUAL)},mapToFilterColumn:t=>{let{val1:n,val2:r,operator1:i}=t,a=i===T.GREATER_THAN_OR_EQUAL;return{customFilters:{and:e.TRUE,customFilters:[{val:a?n:r,operator:T.GREATER_THAN_OR_EQUAL},{val:a?r:n,operator:T.LESS_THAN_OR_EQUAL}]}}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==2)return!1;let[n,r]=e.customFilters.customFilters;return n.operator===T.GREATER_THAN_OR_EQUAL&&r.operator===T.LESS_THAN_OR_EQUAL&&e.customFilters.and?{and:!0,operator1:T.GREATER_THAN_OR_EQUAL,val1:n.val.toString(),operator2:T.LESS_THAN_OR_EQUAL,val2:r.val.toString()}:r.operator===T.GREATER_THAN_OR_EQUAL&&n.operator===T.LESS_THAN_OR_EQUAL&&e.customFilters.and?{and:!0,operator1:T.GREATER_THAN_OR_EQUAL,val1:r.val.toString(),operator2:T.LESS_THAN_OR_EQUAL,val2:n.val.toLocaleString()}:!1}},t.NOT_BETWEEN={label:`sheets-filter.conditions.not-between`,operator:V.NOT_BETWEEN,order:B.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:T.LESS_THAN,val1:``,operator2:T.GREATER_THAN,val2:``}),testMappingParams:e=>{let{and:t,operator1:n,operator2:r}=e;if(t)return!1;let i=[n,r];return i.includes(T.GREATER_THAN)&&i.includes(T.LESS_THAN)},mapToFilterColumn:e=>{let{val1:t,val2:n,operator1:r}=e,i=r===T.GREATER_THAN;return{customFilters:{customFilters:[{val:i?t:n,operator:T.GREATER_THAN},{val:i?n:t,operator:T.LESS_THAN}]}}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==2)return!1;let[n,r]=e.customFilters.customFilters;return n.operator===T.LESS_THAN&&r.operator===T.GREATER_THAN&&!e.customFilters.and?{operator1:T.LESS_THAN,val1:n.val.toString(),operator2:T.GREATER_THAN,val2:r.val.toString()}:r.operator===T.LESS_THAN&&n.operator===T.GREATER_THAN&&!e.customFilters.and?{operator1:T.GREATER_THAN,val1:r.val.toString(),operator2:T.LESS_THAN,val2:n.val.toLocaleString()}:!1}},t.CUSTOM={label:`sheets-filter.conditions.custom`,operator:V.CUSTOM,order:B.SECOND,numOfParameters:2,getDefaultFormParams:()=>({operator1:V.NONE,val1:``,operator2:V.NONE,val2:``}),testMappingParams:()=>!0,mapToFilterColumn:t=>{let{and:i,val1:a,val2:o,operator1:s,operator2:c}=t;function l(e,t){for(let n of r)if(n.operator===e)return n.mapToFilterColumn({val1:t,operator1:e})}let u=!s||s===H.NONE.operator,d=!c||c===H.NONE.operator;if(u&&d)return n.mapToFilterColumn({});if(u)return l(c,o);if(d)return l(s,a);let f=l(s,a),p=l(c,o),m={customFilters:[f.customFilters.customFilters[0],p.customFilters.customFilters[0]]};return i&&(m.and=e.TRUE),{customFilters:m}},testMappingFilterColumn:e=>{var t;if(((t=e.customFilters)==null?void 0:t.customFilters.length)!==2)return!1;let n=e.customFilters.customFilters.map(e=>c({customFilters:{customFilters:[e]}})),r={operator1:n[0][0].operator,val1:n[0][1].val1,operator2:n[1][0].operator,val2:n[1][1].val1};return e.customFilters.and&&(r.and=!0),r}}];function i(e){let t=r.find(t=>t.operator===e);if(!t)throw Error(`[SheetsFilter]: no condition item found for operator: ${e}`);return t}t.getItemByOperator=i;function a(e,t){for(let n of r.filter(e=>e.numOfParameters===t))if(n.numOfParameters!==0&&n.testMappingParams(e))return n;for(let t of r)if(t.testMappingParams(e))return t;throw Error(`[SheetsFilter]: no condition item can be mapped from the filter map params!`)}t.testMappingParams=a;function o(e){let t=r.find(t=>t.operator===e);return(t==null?void 0:t.numOfParameters)===0?{operator1:t.operator}:t.getDefaultFormParams()}t.getInitialFormParams=o;function s(e,t){return e.mapToFilterColumn(t)}t.mapToFilterColumn=s;function c(e){if(!e)return[n,{}];for(let t of r){let n=t.testMappingFilterColumn(e);if(n)return[t,n]}return[n,{}]}t.testMappingFilterColumn=c})(H||(H={}));function U(e){let{operator1:t,operator2:n,val1:r,val2:i}=e;if(t&&n)throw Error(`Both operator1 and operator2 are set!`);if(!t&&!n)throw Error(`Neither operator1 and operator2 and both not set!`);return t?[t,r]:[n,i]}function Nt(e){let t=[],n=[],r=0,i=0;function a(e){e.leaf&&(e.checked?(t.push(e),r+=e.count):(n.push(e),i+=e.count)),e.children&&e.children.forEach(a)}return e.forEach(a),{checkedItems:t,uncheckedItems:n,checked:r,unchecked:i}}function W(e,t){return function(n,r){t(n,r,e)}}function G(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}const Pt=`sheets-filter.generate-filter-values.service`,Ft=S(Pt);let It=class extends i{constructor(e,t,n){super(),this._localeService=e,this._univerInstanceService=t,this._logService=n}async getFilterValues(e){var t;let{unitId:n,subUnitId:r,filteredOutRowsByOtherColumns:i,filterColumn:a,filters:o,blankChecked:s,iterateRange:c,alreadyChecked:l}=e,u=this._univerInstanceService.getUnit(n),d=(t=this._univerInstanceService.getUnit(n))==null?void 0:t.getSheetBySheetId(r);return!u||!d?[]:(this._logService.debug(`[SheetsGenerateFilterValuesService]`,`getFilterValues for`,{unitId:n,subUnitId:r}),Lt(o,this._localeService,c,d,new Set(i),a,new Set(l.map(String)),s,u.getStyles()))}};It=G([W(0,u(p)),W(1,l),W(2,c)],It);function Lt(e,t,n,r,i,a,o,s,c){var l;let u=new Map,d=new Map,f=`empty`,p=!e&&((a==null?void 0:a.filterBy)===E.COLORS||(a==null?void 0:a.filterBy)===E.CONDITIONS)&&((l=a.filteredOutRows)==null?void 0:l.size),m=0;for(let e of r.iterateByColumn(n,!1,!1)){let{row:n,rowSpan:a=1}=e,l=0;for(;l<a;){var h,g,_;let f=n+l;if(i.has(f)){l++;continue}let C=e!=null&&e.value?ee(e.value):``;if(!C){m+=1,l+=a;continue}let w=(h=e.value)!=null&&h.v&&!e.value.p?(g=c.get((_=e.value)==null?void 0:_.s))==null||(g=g.n)==null?void 0:g.pattern:``,ne=w&&te.getFormatInfo(w).isDate,re=!1;if(ne){let{year:e,month:t,day:n}=te.getFormatDateInfo(w);re=e||t||n}if(w&&ne&&re){var v,y,b;let n=(v=r.getCellRaw(e.row,e.col))==null?void 0:v.v;if(!n){l++;continue}let[i,a,c]=te.format(`yyyy-mm-dd`,Number(n)).split(`-`).map(Number),f=u.get(`${i}`);f||(f={title:`${i}`,key:`${i}`,children:[],count:0,leaf:!1,checked:!1},u.set(`${i}`,f),d.set(`${i}`,[`${i}`]));let m=(y=f.children)==null?void 0:y.find(e=>e.key===`${i}-${a}`);if(!m){var x;m={title:t.t(`sheets-filter.date.${a}`),key:`${i}-${a}`,children:[],count:0,leaf:!1,checked:!1},(x=f.children)==null||x.push(m),d.set(`${i}-${a}`,[`${i}`,`${i}-${a}`])}let h=m==null||(b=m.children)==null?void 0:b.find(e=>e.key===`${i}-${a}-${c}`);if(h)h.originValues.add(C),h.count++,m.count++,f.count++;else{var S;(S=m.children)==null||S.push({title:`${c}`,key:`${i}-${a}-${c}`,count:1,originValues:new Set([C]),leaf:!0,checked:p?!1:o.size?o.has(C):!s}),m.count++,f.count++,d.set(`${i}-${a}-${c}`,[`${i}`,`${i}-${a}`,`${i}-${a}-${c}`])}}else{let e=C,t=u.get(e);t?t.count++:(t={title:C,leaf:!0,checked:p?!1:o.size?o.has(C):!s,key:e,count:1},u.set(e,t),d.set(e,[e]))}l++}}let C=p?!1:e?s:!0;if(m>0){let e={title:t.t(`sheets-filter.panel.empty`),count:m,leaf:!0,checked:C,key:f};u.set(`empty`,e),d.set(`empty`,[f])}return{filterTreeItems:Rt(Array.from(u.values())),filterTreeMapCache:d}}function Rt(e){return Array.from(e).sort((e,t)=>e.children&&!t.children?-1:!e.children&&t.children?1:Bt(e.title,t.title)).map(e=>(e.children&&e.children.sort((e,t)=>Number.parseInt(e.key.split(`-`)[1],10)-Number.parseInt(t.key.split(`-`)[1],10)).forEach(e=>{e.children&&e.children.sort((e,t)=>Number.parseInt(e.key.split(`-`)[2],10)-Number.parseInt(t.key.split(`-`)[2],10))}),e))}const zt=e=>!Number.isNaN(Number(e))&&!Number.isNaN(Number.parseFloat(e));function Bt(e,t){let n=zt(e),r=zt(t);return n&&r?Number.parseFloat(e)-Number.parseFloat(t):n&&!r?-1:!n&&r?1:e.localeCompare(t)}function Vt(e,t){for(let n of e){if(n.key===t)return n;if(n.children){let e=Vt(n.children,t);if(e)return e}}return null}function Ht(e){return e.leaf?e.checked:e.children?e.children.every(e=>Ht(e)):!0}function K(e,t){e.leaf&&(t===void 0?e.checked=!e.checked:e.checked=t),e.children&&e.children.forEach(e=>K(e,t))}function Ut(e,t){let n=[];return e.forEach(e=>{let r=e.originValues?t.some(t=>Array.from(e.originValues).some(e=>e.toLowerCase().includes(t.toLowerCase()))):!1,i=!r&&t.some(t=>e.title.toLowerCase().includes(t.toLowerCase()));if(r||i)n.push({...e});else if(e.children){let r=Ut(e.children,t);if(r.length>0){let t=r.reduce((e,t)=>e+t.count,0);n.push({...e,count:t,children:r})}}}),n}function Wt(e){"@babel/helpers - typeof";return Wt=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Wt(e)}function Gt(e,t){if(Wt(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(Wt(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Kt(e){var t=Gt(e,`string`);return Wt(t)==`symbol`?t:t+``}function q(e,t,n){return(t=Kt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var qt,Jt,Yt;S(`sheets-filter-ui.sheets-filter-panel.service`);let J=class extends i{get filterBy(){return this._filterBy$.getValue()}get filterByModel(){return this._filterByModel}set filterByModel(e){this._filterByModel=e,this._filterByModel$.next(e)}get filterModel(){return this._filterModel}get col(){return this._col$.getValue()}constructor(e,t){super(),this._injector=e,this._refRangeService=t,q(this,`_filterBy$`,new P(E.VALUES)),q(this,`filterBy$`,this._filterBy$.asObservable()),q(this,`_filterByModel$`,new $e(1)),q(this,`filterByModel$`,this._filterByModel$.asObservable()),q(this,`_filterByModel`,null),q(this,`_hasCriteria$`,new P(!1)),q(this,`hasCriteria$`,this._hasCriteria$.asObservable()),q(this,`_filterModel`,null),q(this,`_col$`,new P(-1)),q(this,`col$`,this._col$.asObservable()),q(this,`_filterHeaderListener`,null)}dispose(){this._filterBy$.complete(),this._filterByModel$.complete(),this._hasCriteria$.complete()}setupCol(e,t){this.terminate(),this._filterModel=e,this._col$.next(t);let n=e.getFilterColumn(t);if(n){let r=n.getColumnData();if(r.customFilters){this._hasCriteria$.next(!0),this._setupByConditions(e,t);return}if(r.colorFilters){this._hasCriteria$.next(!0),this._setupByColors(e,t);return}if(r.filters){this._hasCriteria$.next(!0),this._setupByValues(e,t);return}this._hasCriteria$.next(!1),this._setupByValues(e,t);return}this._hasCriteria$.next(!1),this._setupByValues(e,t)}changeFilterBy(e){if(!this._filterModel||this.col===-1)return!1;switch(e){case E.VALUES:this._setupByValues(this._filterModel,this.col);break;case E.COLORS:this._setupByColors(this._filterModel,this.col);break;case E.CONDITIONS:this._setupByConditions(this._filterModel,this.col);break}return!0}terminate(){return this._filterModel=null,this._col$.next(-1),this._disposeFilterHeaderChangeListener(),!0}_disposeFilterHeaderChangeListener(){var e;(e=this._filterHeaderListener)==null||e.dispose(),this._filterHeaderListener=null}_listenToFilterHeaderChange(e,t){this._disposeFilterHeaderChangeListener();let n=e.unitId,r=e.subUnitId,i=e.getRange(),a={startColumn:t,startRow:i.startRow,endRow:i.startRow,endColumn:t};this._filterHeaderListener=this._refRangeService.watchRange(n,r,a,(e,t)=>{if(!t)this.terminate();else{let n=t.startColumn-e.startColumn;n!==0&&this._filterByModel.deltaCol(n)}})}async _setupByValues(e,t){this._disposePreviousModel();let n=e.getRange();return n.startRow===n.endRow?!1:(this.filterByModel=await Zt.fromFilterColumn(this._injector,e,t),this._filterBy$.next(E.VALUES),this._listenToFilterHeaderChange(e,t),!0)}async _setupByColors(e,t){this._disposePreviousModel();let n=e.getRange();return n.startRow===n.endRow?!1:(this.filterByModel=await Qt.fromFilterColumn(this._injector,e,t),this._filterBy$.next(E.COLORS),this._listenToFilterHeaderChange(e,t),!0)}_setupByConditions(e,t){this._disposePreviousModel();let n=e.getRange();return n.startRow===n.endRow?!1:(this.filterByModel=Xt.fromFilterColumn(this._injector,e,t,e.getFilterColumn(t)),this._filterBy$.next(E.CONDITIONS),this._listenToFilterHeaderChange(e,t),!0)}_disposePreviousModel(){var e;(e=this._filterByModel)==null||e.dispose(),this.filterByModel=null}};J=G([W(0,u(d)),W(1,u(Ke))],J);let Xt=qt=class extends i{static fromFilterColumn(e,t,n,r){let[i,a]=H.testMappingFilterColumn(r==null?void 0:r.getColumnData());return e.createInstance(qt,t,n,i,a)}get conditionItem(){return this._conditionItem$.getValue()}get filterConditionFormParams(){return this._filterConditionFormParams$.getValue()}constructor(e,t,n,r,i){super(),this._filterModel=e,this.col=t,this._commandService=i,q(this,`canApply$`,I(!0)),q(this,`_conditionItem$`,void 0),q(this,`conditionItem$`,void 0),q(this,`_filterConditionFormParams$`,void 0),q(this,`filterConditionFormParams$`,void 0),this._conditionItem$=new P(n),this.conditionItem$=this._conditionItem$.asObservable(),this._filterConditionFormParams$=new P(r),this.filterConditionFormParams$=this._filterConditionFormParams$.asObservable()}dispose(){super.dispose(),this._conditionItem$.complete(),this._filterConditionFormParams$.complete()}deltaCol(e){this.col+=e}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(D.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;let e=H.mapToFilterColumn(this.conditionItem,this.filterConditionFormParams);return this._commandService.executeCommand(D.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:e})}onPrimaryConditionChange(e){let t=H.ALL_CONDITIONS.find(t=>t.operator===e);if(!t)throw Error(`[ByConditionsModel]: condition item not found for operator: ${e}!`);this._conditionItem$.next(t),this._filterConditionFormParams$.next(H.getInitialFormParams(e))}onConditionFormChange(e){let t={...this.filterConditionFormParams,...e};if(t.and!==!0&&delete t.and,e.and!==void 0||e.operator1!==void 0||e.operator2!==void 0){let e=H.testMappingParams(t,this.conditionItem.numOfParameters);this._conditionItem$.next(e)}this._filterConditionFormParams$.next(t)}};Xt=qt=G([W(4,a)],Xt);let Zt=Jt=class extends i{static async fromFilterColumn(e,t,n){let r=e.get(l),i=e.get(p),a=e.get(Ft,g.OPTIONAL),{unitId:o,subUnitId:s}=t,c=r.getUniverSheetInstance(o);if(!c)throw Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${o}!`);let u=c==null?void 0:c.getSheetBySheetId(s);if(!u)throw Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${o} and subUnitId: ${s}!`);let d=t.getRange(),f=n,m=t.getFilterColumn(n),h=m==null?void 0:m.getColumnData().filters,_=new Set(h==null?void 0:h.filters),v=!!(h&&h.blank),y=t.getFilteredOutRowsExceptCol(n),b={...d,startRow:d.startRow+1,startColumn:f,endColumn:f},x,S;if(a){let e=await a.getFilterValues({unitId:o,subUnitId:s,filteredOutRowsByOtherColumns:Array.from(y),filterColumn:m,filters:!!h,blankChecked:v,iterateRange:b,alreadyChecked:Array.from(_)});x=e.filterTreeItems,S=e.filterTreeMapCache}else{let e=Lt(!!h,i,b,u,y,m,_,v,c.getStyles());x=e.filterTreeItems,S=e.filterTreeMapCache}return e.createInstance(Jt,t,n,x,S)}get rawFilterItems(){return this._rawFilterItems$.getValue()}get filterItems(){return this._filterItems}get treeMapCache(){return this._treeMapCache}constructor(e,t,n,r,i){super(),this._filterModel=e,this.col=t,this._commandService=i,q(this,`_rawFilterItems$`,void 0),q(this,`rawFilterItems$`,void 0),q(this,`filterItems$`,void 0),q(this,`_filterItems`,[]),q(this,`_treeMapCache`,void 0),q(this,`canApply$`,void 0),q(this,`_manuallyUpdateFilterItems$`,void 0),q(this,`_searchString$`,void 0),q(this,`searchString$`,void 0),this._treeMapCache=r,this._searchString$=new P(``),this.searchString$=this._searchString$.asObservable(),this._rawFilterItems$=new P(n),this.rawFilterItems$=this._rawFilterItems$.asObservable(),this._manuallyUpdateFilterItems$=new et,this.filterItems$=it(tt([this._searchString$.pipe(lt(500,void 0,{leading:!0,trailing:!0}),ot(void 0)),this._rawFilterItems$]).pipe(F(([e,t])=>e?Ut(t,e.toLowerCase().split(/\s+/).filter(e=>!!e)):t)),this._manuallyUpdateFilterItems$).pipe(at(1)),this.canApply$=this.filterItems$.pipe(F(e=>Nt(e).checked>0)),this.disposeWithMe(this.filterItems$.subscribe(e=>this._filterItems=e))}dispose(){this._rawFilterItems$.complete(),this._searchString$.complete()}deltaCol(e){this.col+=e}setSearchString(e){this._searchString$.next(e)}onCheckAllToggled(e){let t=y.deepClone(this._filterItems);t.forEach(t=>K(t,e)),this._manuallyUpdateFilterItems(t)}onFilterCheckToggled(e){let t=y.deepClone(this._filterItems),n=Vt(t,e.key);n&&(K(n,!Ht(n)),this._manuallyUpdateFilterItems(t))}onFilterOnly(e){let t=y.deepClone(this._filterItems);t.forEach(e=>K(e,!1)),e.forEach(e=>{let n=Vt(t,e);n&&K(n,!0)}),this._manuallyUpdateFilterItems(t)}_manuallyUpdateFilterItems(e){this._manuallyUpdateFilterItems$.next(e)}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(D.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}async apply(){if(this._disposed)return!1;let e=Nt(this._filterItems),{checked:t,checkedItems:n}=e,r=this.rawFilterItems,i=0;for(let e of r)i+=e.count;let a=t===0,o=e.checked===i,s={colId:this.col};if(a)throw Error(`[ByValuesModel]: no checked items!`);if(o)return this._commandService.executeCommand(D.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});{s.filters={};let e=n.filter(e=>e.key!==`empty`);e.length>0&&(s.filters={filters:e.flatMap(e=>e.originValues?Array.from(e.originValues):[e.title])}),e.length!==n.length&&(s.filters.blank=!0)}return this._commandService.executeCommand(D.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:s})}};Zt=Jt=G([W(4,a)],Zt);let Qt=Yt=class extends i{static async fromFilterColumn(e,n,r){var i,a,o;let s=e.get(l),{unitId:c,subUnitId:u}=n,d=s.getUniverSheetInstance(c);if(!d)throw Error(`[ByColorsModel]: Workbook not found for filter model with unitId: ${c}!`);let f=d==null?void 0:d.getSheetBySheetId(u);if(!f)throw Error(`[ByColorsModel]: Worksheet not found for filter model with unitId: ${c} and subUnitId: ${u}!`);let p=n.getRange(),m=r,h=(i=n.getFilterColumn(r))==null?void 0:i.getColumnData().colorFilters,g=n.getFilteredOutRowsExceptCol(r),_={...p,startRow:p.startRow+1,startColumn:m,endColumn:m},v=new Map,y=new Set((a=h==null?void 0:h.cellFillColors)==null?[]:a),b=new Map,x=new Set((o=h==null?void 0:h.cellTextColors)==null?[]:o);for(let e of f.iterateByColumn(_,!1,!0)){let{row:n,col:r,value:i}=e;if(g.has(n))continue;let a=f.getComposedCellStyleByCellData(n,r,i);if(a.bg&&a.bg.rgb){let e=new t(a.bg.rgb).toRgbString();v.has(e)||v.set(e,{color:e,checked:y.has(e)})}else v.set(`default-fill-color`,{color:null,checked:y.has(null)});if(a.cl&&a.cl.rgb){let e=new t(a.cl.rgb).toRgbString();b.has(e)||b.set(e,{color:e,checked:x.has(e)})}else b.set(`default-font-color`,{color:Ve,checked:x.has(Ve)})}return e.createInstance(Yt,n,r,v,b)}get cellFillColors(){return this._cellFillColors$.getValue()}get cellTextColors(){return this._cellTextColors$.getValue()}constructor(e,t,n,r,i){super(),this._filterModel=e,this.col=t,this._commandService=i,q(this,`canApply$`,I(!0)),q(this,`_cellFillColors$`,void 0),q(this,`cellFillColors$`,void 0),q(this,`_cellTextColors$`,void 0),q(this,`cellTextColors$`,void 0),this._cellFillColors$=new P(Array.from(n.values())),this.cellFillColors$=this._cellFillColors$.asObservable(),this._cellTextColors$=new P(Array.from(r.values())),this.cellTextColors$=this._cellTextColors$.asObservable()}dispose(){super.dispose(),this._cellFillColors$.complete()}deltaCol(e){this.col+=e}clear(){return this._disposed?Promise.resolve(!1):this._commandService.executeCommand(D.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null})}onFilterCheckToggled(e,t=!0){let n=t?this.cellFillColors:this.cellTextColors,r=[],i=!1;for(let t=0;t<n.length;t++){let a=n[t];if(a.color===e.color){i=!0,r.push({color:a.color,checked:!a.checked});continue}r.push({color:a.color,checked:a.checked})}i&&(this._resetColorsCheckedStatus(!t),t?this._cellFillColors$.next([...r]):this._cellTextColors$.next([...r]))}_resetColorsCheckedStatus(e=!0){let t=e?this.cellFillColors:this.cellTextColors,n=[];for(let e=0;e<t.length;e++)n.push({color:t[e].color,checked:!1});e?this._cellFillColors$.next([...n]):this._cellTextColors$.next([...n])}async apply(){if(this._disposed)return!1;let e=this.cellFillColors.filter(e=>e.checked).map(e=>e.color),t=this.cellTextColors.filter(e=>e.checked).map(e=>e.color);if(e.length===0&&t.length===0)return this._commandService.executeCommand(D.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:null});let n={colId:this.col};return e.length>0?n.colorFilters={cellFillColors:e}:t.length>0&&(n.colorFilters={cellTextColors:t}),this._commandService.executeCommand(D.id,{unitId:this._filterModel.unitId,subUnitId:this._filterModel.subUnitId,col:this.col,criteria:n})}};Qt=Yt=G([W(4,a)],Qt);const $t=`FILTER_PANEL_OPENED`,en={id:`sheet.operation.open-filter-panel`,type:n.OPERATION,handler:(e,t)=>{let n=e.get(s),r=e.get(O),i=e.get(J),o=e.get(a),c=e.has(ge)?e.get(ge):null;c!=null&&c.isVisible().visible&&o.syncExecuteCommand(ye.id,{visible:!1});let{unitId:l,subUnitId:u,col:d}=t,f=r.getFilterModel(l,u);return f?(i.setupCol(f,d),n.getContextValue(`FILTER_PANEL_OPENED`)||n.setContextValue($t,!0),!0):!1}},Y={id:`sheet.operation.close-filter-panel`,type:n.OPERATION,handler:e=>{let t=e.get(s),n=e.get(J),r=e.get(je,g.OPTIONAL);return t.getContextValue(`FILTER_PANEL_OPENED`)?(t.setContextValue($t,!1),r==null||r.focus(),n.terminate()):!1}},tn={id:`sheet.operation.apply-filter`,type:n.OPERATION,handler:(e,t)=>{let{filterBy:n}=t;return e.get(J).changeFilterBy(n)}};var nn=`@univerjs/sheets-filter-ui`,rn=`0.18.0`;const an=`sheets-filter-ui.config`;Symbol(an);const on={};let X=class extends i{constructor(e,t,n,r,i,a){super(),this._sheetsFilterService=e,this._localeService=t,this._commandService=n,this._sheetPermissionCheckPermission=r,this._injector=i,this._sheetsSelectionService=a,this._commandExecutedListener()}_commandExecutedListener(){this.disposeWithMe(this._commandService.beforeCommandExecuted(e=>{if(e.id===me.id){var t;let e=Qe(this._injector.get(l));if(!e)return;let{unitId:r,subUnitId:i,worksheet:a}=e,o=(t=this._sheetsFilterService.getFilterModel(r,i))==null?void 0:t.getRange(),s;if(o)s=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[j],worksheetTypes:[M,N]},[o],r,i);else{var n;let e=(n=this._sheetsSelectionService.getCurrentLastSelection())==null?void 0:n.range;if(e){let t={...e};t=e.startColumn===e.endColumn&&e.startRow===e.endRow?Ze(t,{left:!0,right:!0,up:!0,down:!0},a):t,s=this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[j],worksheetTypes:[N,M]},[t],r,i)}else s=this._sheetPermissionCheckPermission.permissionCheckWithoutRange({rangeTypes:[j],worksheetTypes:[N,M]})}s||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.filterErr`))}if(e.id===en.id){var r;let t=e.params,{unitId:n,subUnitId:i}=t,a=(r=this._sheetsFilterService.getFilterModel(n,i))==null?void 0:r.getRange(),o=y.deepClone(a);o&&(o.startColumn=t.col,o.endColumn=t.col,this._sheetPermissionCheckPermission.permissionCheckWithRanges({rangeTypes:[j],worksheetTypes:[M,N]},[o],n,i)||this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t(`permission.dialog.filterErr`)))}}))}};X=G([W(0,u(O)),W(1,u(p)),W(2,a),W(3,u(Ye)),W(4,u(d)),W(5,u(Xe))],X);const sn=new Path2D(`M3.30363 3C2.79117 3 2.51457 3.60097 2.84788 3.99024L6.8 8.60593V12.5662C6.8 12.7184 6.8864 12.8575 7.02289 12.9249L8.76717 13.7863C8.96655 13.8847 9.2 13.7396 9.2 13.5173V8.60593L13.1521 3.99024C13.4854 3.60097 13.2088 3 12.6964 3H3.30363Z`);var cn=class{static drawNoCriteria(e,t,n,r){e.save(),Ue.drawWith(e,{radius:2,width:16,height:16,fill:r}),e.lineCap=`square`,e.strokeStyle=n,e.scale(t/16,t/16),e.beginPath(),e.lineWidth=1,e.lineCap=`round`,e.moveTo(3,4),e.lineTo(13,4),e.moveTo(4.5,8),e.lineTo(11.5,8),e.moveTo(6,12),e.lineTo(10,12),e.stroke(),e.restore()}static drawHasCriteria(e,t,n,r){e.save(),Ue.drawWith(e,{radius:2,width:16,height:16,fill:r}),e.scale(t/16,t/16),e.fillStyle=n,e.fill(sn),e.restore()}};let ln=class extends We{constructor(e,t,n,r,i){super(e,t),this._contextService=n,this._commandService=r,this._themeService=i,q(this,`_cellWidth`,0),q(this,`_cellHeight`,0),q(this,`_filterParams`,void 0),q(this,`_hovered`,!1),this.setShapeProps(t),this.onPointerDown$.subscribeEvent(e=>this.onPointerDown(e)),this.onPointerEnter$.subscribeEvent(()=>this.onPointerEnter()),this.onPointerLeave$.subscribeEvent(()=>this.onPointerLeave())}setShapeProps(e){e.cellHeight!==void 0&&(this._cellHeight=e.cellHeight),e.cellWidth!==void 0&&(this._cellWidth=e.cellWidth),e.filterParams!==void 0&&(this._filterParams=e.filterParams),this.transformByState({width:e.width,height:e.height})}_draw(e){let t=this._cellHeight,n=this._cellWidth,r=16-n,i=16-t;e.save();let a=new Path2D;a.rect(r,i,n,t),e.clip(a);let{hasCriteria:o}=this._filterParams,s=this._themeService.getColorFromTheme(`primary.600`),c=this._hovered?this._themeService.getColorFromTheme(`gray.50`):`rgba(255, 255, 255, 1.0)`;o?cn.drawHasCriteria(e,16,s,c):cn.drawNoCriteria(e,16,s,c),e.restore()}onPointerDown(e){if(e.button===2)return;let{col:t,unitId:n,subUnitId:r}=this._filterParams;this._contextService.getContextValue(`FILTER_PANEL_OPENED`)||!this._commandService.hasCommand(en.id)||setTimeout(()=>{this._commandService.executeCommand(en.id,{unitId:n,subUnitId:r,col:t})},200)}onPointerEnter(){this._hovered=!0,this.makeDirty(!0)}onPointerLeave(){this._hovered=!1,this.makeDirty(!0)}};ln=G([W(2,s),W(3,a),W(4,u(v))],ln);function un(e,t,n,r){switch(r){case x.TOP:return e+1;case x.MIDDLE:return e+Math.max(0,(n-16)/2);case x.BOTTOM:default:return t-16-1}}let dn=class extends _{constructor(e,t,n,r,i,a,o,s){super(),this._context=e,this._injector=t,this._sheetSkeletonManagerService=n,this._sheetsFilterService=r,this._themeService=i,this._sheetInterceptorService=a,this._commandService=o,this._selectionRenderService=s,q(this,`_filterRangeShape`,null),q(this,`_buttonRenderDisposable`,null),q(this,`_filterButtonShapes`,[]),this._initRenderer()}dispose(){super.dispose(),this._disposeRendering()}_initRenderer(){this._sheetSkeletonManagerService.currentSkeleton$.pipe(st(e=>{var t,r;if(!e)return I(null);let{unit:i,unitId:a}=this._context,o=((t=i.getActiveSheet())==null?void 0:t.getSheetId())||``,s=(r=this._sheetsFilterService.getFilterModel(a,o))==null?void 0:r,c=()=>({unitId:a,worksheetId:o,filterModel:s,range:s==null?void 0:s.getRange(),skeleton:e.skeleton});return C(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(rt(([e])=>{var t;return e.type===n.MUTATION&&((t=e.params)==null?void 0:t.unitId)===i.getUnitId()&&(ae.has(e.id)||e.id===qe.id)}),lt(20,void 0,{leading:!1,trailing:!0}),F(c),ot(c()))}),ct(this.dispose$)).subscribe(e=>{this._disposeRendering(),!(!e||!e.range)&&(this._renderRange(e.range,e.skeleton),this._renderButtons(e))})}_renderRange(e,t){let{scene:n}=this._context,{rowHeaderWidth:r,columnHeaderHeight:i}=t,a=this._filterRangeShape=new ve(n,1e3,this._themeService,{rowHeaderWidth:r,columnHeaderHeight:i,enableAutoFill:!1,highlightHeader:!1}),o=we({range:e,primary:null,style:{fill:`rgba(0, 0, 0, 0.0)`}},t);a.updateRangeBySelectionWithCoord(o),a.setEvent(!1),n.makeDirty(!0)}_renderButtons(e){let{range:t,filterModel:n,unitId:r,skeleton:i,worksheetId:a}=e,{unit:o,scene:s}=this._context,c=o.getSheetBySheetId(a);if(!c)return;this._interceptCellContent(r,a,e.range);let{startColumn:l,endColumn:u,startRow:d}=t;for(let e=l;e<=u;e++){let t=`sheets-filter-button-${e}`,o=Te(d,e,s,i),l=c.getComposedCellStyle(d,e),u=(l==null?void 0:l.vt)||x.BOTTOM,{startX:f,startY:p,endX:m,endY:h}=o,g=m-f,_=h-p;if(_<=1||g<=1)continue;let v=!!n.getFilterColumn(e),y={left:m-16-1,top:un(p,h,_,u),height:16,width:16,zIndex:5e3,cellHeight:_,cellWidth:g,filterParams:{unitId:r,subUnitId:a,col:e,hasCriteria:v}},b=this._injector.createInstance(ln,t,y);this._filterButtonShapes.push(b)}s.addObjects(this._filterButtonShapes),s.makeDirty()}_interceptCellContent(e,t,n){let{startRow:r,startColumn:i,endColumn:a}=n;this._buttonRenderDisposable=this._sheetInterceptorService.intercept(Ge.CELL_CONTENT,{effect:f.Style,handler:(n,o,s)=>{let{row:c,col:l,unitId:u,subUnitId:d}=o;return u!==e||d!==t||c!==r||l<i||l>a?s(n):((!n||n===o.rawData)&&(n={...o.rawData}),n.fontRenderExtension={...n==null?void 0:n.fontRenderExtension,rightOffset:16},s(n))},priority:10})}_disposeRendering(){var e,t;(e=this._filterRangeShape)==null||e.dispose(),this._filterButtonShapes.forEach(e=>e.dispose()),(t=this._buttonRenderDisposable)==null||t.dispose(),this._filterRangeShape=null,this._buttonRenderDisposable=null,this._filterButtonShapes=[]}};dn=G([W(1,u(d)),W(2,u(xe)),W(3,u(O)),W(4,u(v)),W(5,u(Je)),W(6,a),W(7,_e)],dn);let fn=class extends _{constructor(e,t){super(),this._renderManagerService=e,this._sheetsRenderService=t,[fe,de,le,se].forEach(e=>this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(e.id))),this.disposeWithMe(this._renderManagerService.registerRenderModule(b.UNIVER_SHEET,[dn]))}};fn=G([W(0,He),W(1,u(Se))],fn);let Z=class extends h{constructor(e=on,t,n){super(),this._config=e,this._injector=t,this._configService=n;let{menu:r,...i}=w({},on,this._config);r&&this._configService.setConfig(`menu`,r,{merge:!0}),this._configService.setConfig(an,i)}onStarting(){[[X],[fn]].forEach(e=>this._injector.add(e))}onReady(){this._injector.get(X)}onRendered(){this._injector.get(fn)}};q(Z,`type`,b.UNIVER_SHEET),q(Z,`pluginName`,`SHEET_FILTER_UI_PLUGIN`),q(Z,`packageName`,nn),q(Z,`version`,rn),Z=G([r(he),W(1,u(d)),W(2,o)],Z);function pn(e){let t=e.get(O);return{id:me.id,type:Ie.BUTTON_SELECTOR,icon:`FilterIcon`,tooltip:`sheets-filter.toolbar.smart-toggle-filter-tooltip`,hidden$:ze(e,b.UNIVER_SHEET),activated$:t.activeFilterModel$.pipe(F(e=>!!e)),disabled$:De(e,Ee(e,{worksheetTypes:[M,N],rangeTypes:[j]}))}}function mn(e){let t=e.get(O);return{id:ie.id,type:Ie.BUTTON,title:`sheets-filter.toolbar.clear-filter-criteria`,hidden$:ze(e,b.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(st(e=>{var t;return(t=e==null?void 0:e.hasCriteria$.pipe(F(e=>!e)))==null?I(!0):t}))}}function hn(e){let t=e.get(O);return{id:oe.id,type:Ie.BUTTON,title:`sheets-filter.toolbar.re-calc-filter-conditions`,hidden$:ze(e,b.UNIVER_SHEET),disabled$:t.activeFilterModel$.pipe(st(e=>{var t;return(t=e==null?void 0:e.hasCriteria$.pipe(F(e=>!e)))==null?I(!0):t}))}}const gn={[Re.ORGANIZATION]:{[me.id]:{order:2,menuItemFactory:pn,[ie.id]:{order:0,menuItemFactory:mn},[oe.id]:{order:1,menuItemFactory:hn}}}};function _n(e){let{model:t}=e,n=k(p),r=A(t.cellFillColors$,[],!0),i=A(t.cellTextColors$,[],!0),a=L(e=>{t.onFilterCheckToggled(e)},[t]),o=L(e=>{t.onFilterCheckToggled(e,!1)},[t]);return R(`div`,{"data-u-comp":`sheets-filter-panel-colors-container`,className:`univer-flex univer-h-full univer-min-h-[300px] univer-flex-col`,children:z(`div`,{"data-u-comp":`sheets-filter-panel`,className:Tt(`
|
|
2
|
+
univer-mt-2 univer-box-border univer-flex univer-h-[300px] univer-flex-grow univer-flex-col
|
|
3
|
+
univer-gap-4 univer-overflow-auto univer-rounded-md univer-px-2 univer-py-2.5
|
|
4
|
+
`,wt),children:[r.length>1&&z(`div`,{children:[R(`div`,{className:`
|
|
5
|
+
univer-mb-2 univer-text-sm univer-text-gray-900
|
|
6
|
+
dark:!univer-text-white
|
|
7
|
+
`,children:n.t(`sheets-filter.panel.filter-by-cell-fill-color`)}),R(`div`,{className:`
|
|
8
|
+
univer-grid univer-grid-cols-8 univer-items-center univer-justify-start univer-gap-2
|
|
9
|
+
`,children:r.map((e,t)=>z(`div`,{className:`univer-relative univer-size-6`,onClick:()=>a(e),children:[e.color?R(`button`,{type:`button`,className:Tt(`
|
|
10
|
+
univer-box-border univer-size-6 univer-cursor-pointer
|
|
11
|
+
univer-rounded-full univer-border univer-border-solid
|
|
12
|
+
univer-border-transparent univer-bg-gray-300 univer-transition-shadow
|
|
13
|
+
hover:univer-ring-2 hover:univer-ring-offset-2
|
|
14
|
+
hover:univer-ring-offset-white
|
|
15
|
+
`),style:{backgroundColor:e.color}}):R(Dt,{className:`
|
|
16
|
+
univer-size-6 univer-cursor-pointer univer-rounded-full
|
|
17
|
+
hover:univer-ring-2 hover:univer-ring-offset-2
|
|
18
|
+
hover:univer-ring-offset-white
|
|
19
|
+
`}),e.checked&&R(vn,{})]},`sheets-filter-cell-fill-color-${t}`))})]}),i.length>1&&z(`div`,{children:[R(`div`,{className:`
|
|
20
|
+
univer-mb-2 univer-text-sm univer-text-gray-900
|
|
21
|
+
dark:!univer-text-white
|
|
22
|
+
`,children:n.t(`sheets-filter.panel.filter-by-cell-text-color`)}),R(`div`,{className:`
|
|
23
|
+
univer-grid univer-grid-cols-8 univer-items-center univer-justify-start univer-gap-2
|
|
24
|
+
`,children:i.map((e,t)=>z(`div`,{className:`univer-relative univer-size-6`,onClick:()=>o(e),children:[R(`div`,{className:`
|
|
25
|
+
univer-box-border univer-flex univer-size-full univer-cursor-pointer
|
|
26
|
+
univer-items-center univer-justify-center univer-rounded-full univer-border
|
|
27
|
+
univer-border-solid univer-border-[rgba(13,13,13,0.06)] univer-p-0.5
|
|
28
|
+
hover:univer-ring-2 hover:univer-ring-offset-2 hover:univer-ring-offset-white
|
|
29
|
+
dark:!univer-border-[rgba(255,255,255,0.06)]
|
|
30
|
+
`,children:R(Et,{style:{color:e.color}})}),e.checked&&R(vn,{})]},`sheets-filter-cell-text-color-${t}`))})]}),r.length<=1&&i.length<=1&&R(`div`,{className:`
|
|
31
|
+
univer-flex univer-size-full univer-items-center univer-justify-center univer-text-sm
|
|
32
|
+
univer-text-gray-900
|
|
33
|
+
dark:!univer-text-gray-200
|
|
34
|
+
`,children:n.t(`sheets-filter.panel.filter-by-color-none`)})]})})}function vn(){return R(`div`,{className:`
|
|
35
|
+
univer-absolute -univer-bottom-0.5 -univer-right-0.5 univer-flex univer-size-3 univer-cursor-pointer
|
|
36
|
+
univer-items-center univer-justify-center univer-rounded-full univer-bg-white
|
|
37
|
+
`,children:R(At,{className:`univer-size-full univer-font-bold univer-text-[#418F1F]`})})}function yn(e){var t,n;let{model:r}=e,i=k(p),a=A(r.conditionItem$,void 0),o=A(r.filterConditionFormParams$,void 0),s=o!=null&&o.and?`AND`:`OR`,c=L(e=>{r.onConditionFormChange({and:e===`AND`})},[r]),l=bn(i),u=L(e=>{r.onPrimaryConditionChange(e)},[r]),d=xn(i),f=L(e=>{r.onConditionFormChange(e)},[r]),m=i.t(`sheets-filter.panel.input-values-placeholder`);function h(e,t,n){let r=H.getItemByOperator(e).numOfParameters===1;return z(Mt,{children:[n===`operator2`&&z(vt,{value:s,onChange:c,children:[R(_t,{value:`AND`,children:i.t(`sheets-filter.panel.and`)}),R(_t,{value:`OR`,children:i.t(`sheets-filter.panel.or`)})]}),R(bt,{value:e,options:d,onChange:e=>f({[n]:e})}),r&&R(`div`,{children:R(ht,{className:`univer-mt-2`,value:t,placeholder:m,onChange:e=>f({[n===`operator1`?`val1`:`val2`]:e})})})]})}return R(`div`,{"data-u-comp":`sheets-filter-panel-conditions-container`,className:`univer-flex univer-h-full univer-min-h-[300px] univer-flex-col`,children:a&&o&&z(Mt,{children:[R(bt,{value:a.operator,options:l,onChange:u}),H.getItemByOperator(a.operator).numOfParameters===0?null:z(`div`,{"data-u-comp":`sheets-filter-panel-conditions-container-inner`,className:Tt(`
|
|
38
|
+
univer-mt-2 univer-flex-grow univer-overflow-hidden univer-rounded-md univer-p-2
|
|
39
|
+
`,wt),children:[a.numOfParameters>=1&&h(o.operator1,(t=o.val1)==null?``:t,`operator1`),a.numOfParameters>=2&&h(o.operator2,(n=o.val2)==null?``:n,`operator2`),z(`div`,{"data-u-comp":`sheets-filter-panel-conditions-desc`,className:`univer-mt-2 univer-text-xs univer-text-gray-500`,children:[i.t(`sheets-filter.panel.?`),R(`br`,{}),i.t(`sheets-filter.panel.*`)]})]})]})})}function bn(e){return jt(()=>[{options:[{label:e.t(H.NONE.label),value:H.NONE.operator}]},{options:[{label:e.t(H.EMPTY.label),value:H.EMPTY.operator},{label:e.t(H.NOT_EMPTY.label),value:H.NOT_EMPTY.operator}]},{options:[{label:e.t(H.TEXT_CONTAINS.label),value:H.TEXT_CONTAINS.operator},{label:e.t(H.DOES_NOT_CONTAIN.label),value:H.DOES_NOT_CONTAIN.operator},{label:e.t(H.STARTS_WITH.label),value:H.STARTS_WITH.operator},{label:e.t(H.ENDS_WITH.label),value:H.ENDS_WITH.operator},{label:e.t(H.EQUALS.label),value:H.EQUALS.operator}]},{options:[{label:e.t(H.GREATER_THAN.label),value:H.GREATER_THAN.operator},{label:e.t(H.GREATER_THAN_OR_EQUAL.label),value:H.GREATER_THAN_OR_EQUAL.operator},{label:e.t(H.LESS_THAN.label),value:H.LESS_THAN.operator},{label:e.t(H.LESS_THAN_OR_EQUAL.label),value:H.LESS_THAN_OR_EQUAL.operator},{label:e.t(H.EQUAL.label),value:H.EQUAL.operator},{label:e.t(H.NOT_EQUAL.label),value:H.NOT_EQUAL.operator},{label:e.t(H.BETWEEN.label),value:H.BETWEEN.operator},{label:e.t(H.NOT_BETWEEN.label),value:H.NOT_BETWEEN.operator}]},{options:[{label:e.t(H.CUSTOM.label),value:H.CUSTOM.operator}]}],[e.getCurrentLocale(),e])}function xn(e){return jt(()=>H.ALL_CONDITIONS.filter(e=>e.numOfParameters!==2).map(t=>({label:e.t(t.label),value:t.operator})),[e.getCurrentLocale(),e])}function Sn(e){let{model:t}=e,n=k(p),r=A(t.searchString$,``,!0),i=A(t.filterItems$,void 0,!0),a=n.t(`sheets-filter.panel.filter-only`),o=Nt(i),s=o.checked>0&&o.unchecked===0,c=o.checked>0&&o.unchecked>0,l=t.treeMapCache,u=L(()=>{t.onCheckAllToggled(!s)},[t,s]),d=L(e=>{t.setSearchString(e)},[t]);function f(e){let t=[];return e.forEach(e=>{e.checked&&t.push(e.key),e.children&&(t=t.concat(f(e.children)))}),t}return z(`div`,{"data-u-comp":`sheets-filter-panel-values-container`,className:`univer-flex univer-h-full univer-min-h-[300px] univer-flex-col`,children:[R(ht,{autoFocus:!0,value:r,placeholder:n.t(`sheets-filter.panel.search-placeholder`),onChange:d}),z(`div`,{"data-u-comp":`sheets-filter-panel`,className:Tt(`
|
|
40
|
+
univer-mt-2 univer-box-border univer-flex univer-flex-grow univer-flex-col univer-overflow-hidden
|
|
41
|
+
univer-rounded-md univer-px-2 univer-py-2.5
|
|
42
|
+
`,wt),children:[R(`div`,{"data-u-comp":`sheets-filter-panel-values-item`,className:`univer-box-border univer-h-8 univer-w-full univer-py-0.5`,children:z(`div`,{"data-u-comp":`sheets-filter-panel-values-item-inner`,className:`
|
|
43
|
+
univer-box-border univer-flex univer-h-7 univer-items-center univer-rounded-md univer-py-0
|
|
44
|
+
univer-pl-5 univer-pr-0.5 univer-text-sm
|
|
45
|
+
`,children:[R(mt,{indeterminate:c,disabled:i.length===0,checked:s,onChange:u}),R(`span`,{"data-u-comp":`sheets-filter-panel-values-item-text`,className:`
|
|
46
|
+
univer-mx-1 univer-inline-block univer-flex-shrink univer-truncate univer-text-gray-900
|
|
47
|
+
dark:!univer-text-white
|
|
48
|
+
`,children:`${n.t(`sheets-filter.panel.select-all`)}`}),R(`span`,{"data-u-comp":`sheets-filter-panel-values-item-count`,className:`
|
|
49
|
+
univer-text-gray-400
|
|
50
|
+
dark:!univer-text-gray-500
|
|
51
|
+
`,children:`(${o.checked}/${o.checked+o.unchecked})`})]})}),R(`div`,{"data-u-comp":`sheets-filter-panel-values-virtual`,className:`univer-flex-grow`,children:R(Ct,{data:i,defaultExpandAll:!1,valueGroup:f(i),onChange:e=>{t.onFilterCheckToggled(e)},defaultCache:l,itemHeight:28,treeNodeClassName:`
|
|
2112
52
|
univer-pr-2 univer-border-box univer-rounded-md
|
|
2113
53
|
[&:hover_a]:univer-inline-block
|
|
2114
54
|
hover:univer-bg-gray-50 univer-h-full
|
|
2115
55
|
univer-text-gray-900 dark:hover:!univer-bg-gray-900
|
|
2116
56
|
dark:!univer-text-white
|
|
2117
|
-
`,
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
const _ = [];
|
|
2137
|
-
p.children ? p.children.forEach((C) => {
|
|
2138
|
-
C.children ? C.children.forEach((N) => {
|
|
2139
|
-
_.push(N.key);
|
|
2140
|
-
}) : _.push(C.key);
|
|
2141
|
-
}) : _.push(p.key), e.onFilterOnly(_);
|
|
2142
|
-
},
|
|
2143
|
-
children: a
|
|
2144
|
-
}
|
|
2145
|
-
)
|
|
2146
|
-
]
|
|
2147
|
-
}
|
|
2148
|
-
)
|
|
2149
|
-
}
|
|
2150
|
-
) })
|
|
2151
|
-
]
|
|
2152
|
-
}
|
|
2153
|
-
)
|
|
2154
|
-
]
|
|
2155
|
-
}
|
|
2156
|
-
);
|
|
2157
|
-
}
|
|
2158
|
-
function rs() {
|
|
2159
|
-
const t = D(Er);
|
|
2160
|
-
if (!L(t.visible$, void 0, !0)) return null;
|
|
2161
|
-
const r = D(G), s = D(Qt), n = L(t.enabled$, void 0, !0);
|
|
2162
|
-
return /* @__PURE__ */ y(
|
|
2163
|
-
"div",
|
|
2164
|
-
{
|
|
2165
|
-
className: "univer-mt-2 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-900 dark:!univer-text-gray-200",
|
|
2166
|
-
children: [
|
|
2167
|
-
/* @__PURE__ */ y("div", { className: "univer-flex univer-items-center univer-gap-1", children: [
|
|
2168
|
-
/* @__PURE__ */ d("span", { children: r.t("sheets-filter.sync.title") }),
|
|
2169
|
-
/* @__PURE__ */ d(
|
|
2170
|
-
di,
|
|
2171
|
-
{
|
|
2172
|
-
title: n ? r.t("sheets-filter.sync.statusTips.off") : r.t("sheets-filter.sync.statusTips.on"),
|
|
2173
|
-
asChild: !0,
|
|
2174
|
-
children: /* @__PURE__ */ d(or, { className: "univer-block" })
|
|
2175
|
-
}
|
|
2176
|
-
)
|
|
2177
|
-
] }),
|
|
2178
|
-
/* @__PURE__ */ d(
|
|
2179
|
-
mi,
|
|
2180
|
-
{
|
|
2181
|
-
defaultChecked: n,
|
|
2182
|
-
onChange: (a) => {
|
|
2183
|
-
const i = a ? r.t("sheets-filter.sync.switchTips.on") : r.t("sheets-filter.sync.switchTips.off");
|
|
2184
|
-
t.setEnabled(a), s.show({
|
|
2185
|
-
content: i,
|
|
2186
|
-
type: Kt.Success,
|
|
2187
|
-
duration: 2e3
|
|
2188
|
-
});
|
|
2189
|
-
}
|
|
2190
|
-
}
|
|
2191
|
-
)
|
|
2192
|
-
]
|
|
2193
|
-
}
|
|
2194
|
-
);
|
|
2195
|
-
}
|
|
2196
|
-
function is() {
|
|
2197
|
-
var N;
|
|
2198
|
-
const t = D(q), e = D(G), r = D(j), s = L(t.filterBy$, void 0, !0), n = L(t.filterByModel$, void 0, !1), a = L(() => (n == null ? void 0 : n.canApply$) || pe(!1), void 0, !1, [n]), i = ss(e), o = !L(t.hasCriteria$), l = U((F) => {
|
|
2199
|
-
r.executeCommand(er.id, { filterBy: F });
|
|
2200
|
-
}, [r]), c = U(async () => {
|
|
2201
|
-
await (n == null ? void 0 : n.clear()), r.executeCommand(Ne.id);
|
|
2202
|
-
}, [n, r]), h = U(() => {
|
|
2203
|
-
r.executeCommand(Ne.id);
|
|
2204
|
-
}, [r]), m = U(async () => {
|
|
2205
|
-
await (n == null ? void 0 : n.apply()), r.executeCommand(Ne.id);
|
|
2206
|
-
}, [n, r]), p = (N = D(X).activeFilterModel) == null ? void 0 : N.getRange(), _ = t.col, C = kr($r.FILTER_PANEL_EMBED_POINT);
|
|
2207
|
-
return /* @__PURE__ */ y(
|
|
2208
|
-
"div",
|
|
2209
|
-
{
|
|
2210
|
-
"data-u-comp": "sheets-filter-panel",
|
|
2211
|
-
className: "univer-box-border univer-flex univer-max-h-[500px] univer-w-[400px] univer-flex-col univer-rounded-lg univer-bg-white univer-p-4 univer-shadow-lg dark:!univer-border-gray-600 dark:!univer-bg-gray-700",
|
|
2212
|
-
children: [
|
|
2213
|
-
/* @__PURE__ */ d(
|
|
2214
|
-
Hr,
|
|
2215
|
-
{
|
|
2216
|
-
components: C,
|
|
2217
|
-
sharedProps: { range: p, colIndex: _, onClose: h }
|
|
2218
|
-
}
|
|
2219
|
-
),
|
|
2220
|
-
/* @__PURE__ */ d("div", { className: "univer-mb-1 univer-flex-shrink-0 univer-flex-grow-0", children: /* @__PURE__ */ d(
|
|
2221
|
-
fi,
|
|
2222
|
-
{
|
|
2223
|
-
value: s,
|
|
2224
|
-
items: i,
|
|
2225
|
-
onChange: (F) => l(F)
|
|
2226
|
-
}
|
|
2227
|
-
) }),
|
|
2228
|
-
n ? /* @__PURE__ */ d(
|
|
2229
|
-
"div",
|
|
2230
|
-
{
|
|
2231
|
-
"data-u-comp": "sheets-filter-panel-content",
|
|
2232
|
-
className: "univer-flex-shrink univer-flex-grow univer-pt-2",
|
|
2233
|
-
children: s === P.VALUES ? /* @__PURE__ */ d(ts, { model: n }) : s === P.COLORS ? /* @__PURE__ */ d(qi, { model: n }) : /* @__PURE__ */ d(Xi, { model: n })
|
|
2234
|
-
}
|
|
2235
|
-
) : /* @__PURE__ */ d("div", { className: "univer-flex-1" }),
|
|
2236
|
-
/* @__PURE__ */ d(rs, {}),
|
|
2237
|
-
/* @__PURE__ */ y(
|
|
2238
|
-
"div",
|
|
2239
|
-
{
|
|
2240
|
-
"data-u-comp": "sheets-filter-panel-footer",
|
|
2241
|
-
className: "univer-mt-4 univer-inline-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-nowrap univer-justify-between univer-overflow-hidden",
|
|
2242
|
-
children: [
|
|
2243
|
-
/* @__PURE__ */ d(qe, { variant: "link", onClick: c, disabled: o, children: e.t("sheets-filter.panel.clear-filter") }),
|
|
2244
|
-
/* @__PURE__ */ y("span", { className: "univer-flex univer-gap-2", children: [
|
|
2245
|
-
/* @__PURE__ */ d(qe, { variant: "default", onClick: h, children: e.t("sheets-filter.panel.cancel") }),
|
|
2246
|
-
/* @__PURE__ */ d(qe, { disabled: !a, variant: "primary", onClick: m, children: e.t("sheets-filter.panel.confirm") })
|
|
2247
|
-
] })
|
|
2248
|
-
]
|
|
2249
|
-
}
|
|
2250
|
-
)
|
|
2251
|
-
]
|
|
2252
|
-
}
|
|
2253
|
-
);
|
|
2254
|
-
}
|
|
2255
|
-
function ss(t) {
|
|
2256
|
-
const e = t.getCurrentLocale();
|
|
2257
|
-
return mt(() => [
|
|
2258
|
-
{ label: t.t("sheets-filter.panel.by-values"), value: P.VALUES },
|
|
2259
|
-
{ label: t.t("sheets-filter.panel.by-colors"), value: P.COLORS },
|
|
2260
|
-
{ label: t.t("sheets-filter.panel.by-conditions"), value: P.CONDITIONS }
|
|
2261
|
-
], [e, t]);
|
|
2262
|
-
}
|
|
2263
|
-
const ns = {
|
|
2264
|
-
id: Oe.id,
|
|
2265
|
-
binding: Dr.L | Tt.CTRL_COMMAND | Tt.SHIFT,
|
|
2266
|
-
description: "sheets-filter.shortcut.smart-toggle-filter",
|
|
2267
|
-
preconditions: Lr,
|
|
2268
|
-
group: "4_sheet-edit"
|
|
2269
|
-
};
|
|
2270
|
-
var os = Object.getOwnPropertyDescriptor, ls = (t, e, r, s) => {
|
|
2271
|
-
for (var n = s > 1 ? void 0 : s ? os(e, r) : e, a = t.length - 1, i; a >= 0; a--)
|
|
2272
|
-
(i = t[a]) && (n = i(n) || n);
|
|
2273
|
-
return n;
|
|
2274
|
-
}, $ = (t, e) => (r, s) => e(r, s, t);
|
|
2275
|
-
const wt = "FILTER_PANEL_POPUP";
|
|
2276
|
-
let De = class extends ye {
|
|
2277
|
-
constructor(e, r, s, n, a, i, o, l, c, h, m, S, p) {
|
|
2278
|
-
super(p, S);
|
|
2279
|
-
v(this, "_popupDisposable");
|
|
2280
|
-
this._injector = e, this._componentManager = r, this._sheetsFilterPanelService = s, this._sheetCanvasPopupService = n, this._sheetsFilterService = a, this._localeService = i, this._shortcutService = o, this._commandService = l, this._menuManagerService = c, this._contextService = h, this._messageService = m, this._initCommands(), this._initShortcuts(), this._initMenuItems(), this._initUI();
|
|
2281
|
-
}
|
|
2282
|
-
dispose() {
|
|
2283
|
-
super.dispose(), this._closeFilterPopup();
|
|
2284
|
-
}
|
|
2285
|
-
_initShortcuts() {
|
|
2286
|
-
[
|
|
2287
|
-
ns
|
|
2288
|
-
].forEach((e) => {
|
|
2289
|
-
this.disposeWithMe(this._shortcutService.registerShortcut(e));
|
|
2290
|
-
});
|
|
2291
|
-
}
|
|
2292
|
-
_initCommands() {
|
|
2293
|
-
[
|
|
2294
|
-
Oe,
|
|
2295
|
-
Nr,
|
|
2296
|
-
Fr,
|
|
2297
|
-
V,
|
|
2298
|
-
at,
|
|
2299
|
-
lt,
|
|
2300
|
-
er,
|
|
2301
|
-
ke,
|
|
2302
|
-
Ne
|
|
2303
|
-
].forEach((e) => {
|
|
2304
|
-
this.disposeWithMe(this._commandService.registerCommand(e));
|
|
2305
|
-
});
|
|
2306
|
-
}
|
|
2307
|
-
_initMenuItems() {
|
|
2308
|
-
this._menuManagerService.mergeMenu(Ki);
|
|
2309
|
-
}
|
|
2310
|
-
_initUI() {
|
|
2311
|
-
[
|
|
2312
|
-
[wt, is],
|
|
2313
|
-
["FilterIcon", nr]
|
|
2314
|
-
].forEach(([e, r]) => {
|
|
2315
|
-
this.disposeWithMe(
|
|
2316
|
-
this._componentManager.register(e, r)
|
|
2317
|
-
);
|
|
2318
|
-
}), this.disposeWithMe(this._contextService.subscribeContextValue$(ce).pipe(oi()).subscribe((e) => {
|
|
2319
|
-
e ? this._openFilterPopup() : this._closeFilterPopup();
|
|
2320
|
-
})), this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe((e) => {
|
|
2321
|
-
e && this._messageService.show({
|
|
2322
|
-
type: Kt.Error,
|
|
2323
|
-
content: this._localeService.t(e)
|
|
2324
|
-
});
|
|
2325
|
-
}));
|
|
2326
|
-
}
|
|
2327
|
-
_openFilterPopup() {
|
|
2328
|
-
const e = this._sheetsFilterPanelService.filterModel;
|
|
2329
|
-
if (!e)
|
|
2330
|
-
throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");
|
|
2331
|
-
const r = e.getRange(), s = this._sheetsFilterPanelService.col, { startRow: n } = r;
|
|
2332
|
-
this._popupDisposable = this._sheetCanvasPopupService.attachPopupToCell(n, s, {
|
|
2333
|
-
componentKey: wt,
|
|
2334
|
-
direction: "horizontal",
|
|
2335
|
-
onClickOutside: () => this._commandService.syncExecuteCommand(Ne.id),
|
|
2336
|
-
offset: [5, 0]
|
|
2337
|
-
});
|
|
2338
|
-
}
|
|
2339
|
-
_closeFilterPopup() {
|
|
2340
|
-
var e;
|
|
2341
|
-
(e = this._popupDisposable) == null || e.dispose(), this._popupDisposable = null;
|
|
2342
|
-
}
|
|
2343
|
-
};
|
|
2344
|
-
De = ls([
|
|
2345
|
-
$(0, T(re)),
|
|
2346
|
-
$(1, T(Br)),
|
|
2347
|
-
$(2, T(q)),
|
|
2348
|
-
$(3, T(Mr)),
|
|
2349
|
-
$(4, T(X)),
|
|
2350
|
-
$(5, T(G)),
|
|
2351
|
-
$(6, Wr),
|
|
2352
|
-
$(7, j),
|
|
2353
|
-
$(8, Vr),
|
|
2354
|
-
$(9, Ve),
|
|
2355
|
-
$(10, Qt),
|
|
2356
|
-
$(11, T(Vt)),
|
|
2357
|
-
$(12, Gt)
|
|
2358
|
-
], De);
|
|
2359
|
-
var as = Object.defineProperty, cs = Object.getOwnPropertyDescriptor, us = (t, e, r) => e in t ? as(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, hs = (t, e, r, s) => {
|
|
2360
|
-
for (var n = s > 1 ? void 0 : s ? cs(e, r) : e, a = t.length - 1, i; a >= 0; a--)
|
|
2361
|
-
(i = t[a]) && (n = i(n) || n);
|
|
2362
|
-
return n;
|
|
2363
|
-
}, et = (t, e) => (r, s) => e(r, s, t), je = (t, e, r) => us(t, typeof e != "symbol" ? e + "" : e, r);
|
|
2364
|
-
let me = class extends ot {
|
|
2365
|
-
constructor(t = He, e, r, s) {
|
|
2366
|
-
super(), this._config = t, this._injector = e, this._configService = r, this._rpcChannelService = s;
|
|
2367
|
-
const { menu: n, ...a } = Bt(
|
|
2368
|
-
{},
|
|
2369
|
-
He,
|
|
2370
|
-
this._config
|
|
2371
|
-
);
|
|
2372
|
-
n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(tr, a);
|
|
2373
|
-
}
|
|
2374
|
-
onStarting() {
|
|
2375
|
-
vr(this._injector, [
|
|
2376
|
-
[q],
|
|
2377
|
-
[he],
|
|
2378
|
-
[De]
|
|
2379
|
-
]), this._config.useRemoteFilterValuesGenerator && this._rpcChannelService && this._injector.add([Le, {
|
|
2380
|
-
useFactory: () => li(
|
|
2381
|
-
this._rpcChannelService.requestChannel(ft)
|
|
2382
|
-
)
|
|
2383
|
-
}]);
|
|
2384
|
-
}
|
|
2385
|
-
onReady() {
|
|
2386
|
-
St(this._injector, [
|
|
2387
|
-
[he]
|
|
2388
|
-
]);
|
|
2389
|
-
}
|
|
2390
|
-
onRendered() {
|
|
2391
|
-
St(this._injector, [
|
|
2392
|
-
[De]
|
|
2393
|
-
]);
|
|
2394
|
-
}
|
|
2395
|
-
};
|
|
2396
|
-
je(me, "type", ie.UNIVER_SHEET);
|
|
2397
|
-
je(me, "pluginName", "SHEET_FILTER_UI_PLUGIN");
|
|
2398
|
-
je(me, "packageName", ue.name);
|
|
2399
|
-
je(me, "version", ue.version);
|
|
2400
|
-
me = hs([
|
|
2401
|
-
Ht(Wt),
|
|
2402
|
-
et(1, T(re)),
|
|
2403
|
-
et(2, Dt),
|
|
2404
|
-
et(3, pr(Zt))
|
|
2405
|
-
], me);
|
|
2406
|
-
var ds = Object.getOwnPropertyDescriptor, ms = (t, e, r, s) => {
|
|
2407
|
-
for (var n = s > 1 ? void 0 : s ? ds(e, r) : e, a = t.length - 1, i; a >= 0; a--)
|
|
2408
|
-
(i = t[a]) && (n = i(n) || n);
|
|
2409
|
-
return n;
|
|
2410
|
-
}, $t = (t, e) => (r, s) => e(r, s, t), le;
|
|
2411
|
-
let Lt = (le = class extends ot {
|
|
2412
|
-
constructor(t, e, r) {
|
|
2413
|
-
super(), this._config = t, this._injector = e, this._rpcChannelService = r;
|
|
2414
|
-
}
|
|
2415
|
-
onStarting() {
|
|
2416
|
-
[
|
|
2417
|
-
[Le, { useClass: rt }]
|
|
2418
|
-
].forEach((t) => this._injector.add(t));
|
|
2419
|
-
}
|
|
2420
|
-
onReady() {
|
|
2421
|
-
this._rpcChannelService.registerChannel(
|
|
2422
|
-
ft,
|
|
2423
|
-
ai(this._injector.get(Le))
|
|
2424
|
-
);
|
|
2425
|
-
}
|
|
2426
|
-
}, v(le, "type", ie.UNIVER_SHEET), v(le, "pluginName", "SHEET_FILTER_UI_WORKER_PLUGIN"), v(le, "packageName", ue.name), v(le, "version", ue.version), le);
|
|
2427
|
-
Lt = ms([
|
|
2428
|
-
$t(1, T(re)),
|
|
2429
|
-
$t(2, Zt)
|
|
2430
|
-
], Lt);
|
|
2431
|
-
export {
|
|
2432
|
-
er as ChangeFilterByOperation,
|
|
2433
|
-
Ne as CloseFilterPanelOperation,
|
|
2434
|
-
ke as OpenFilterPanelOperation,
|
|
2435
|
-
de as UniverSheetsFilterMobileUIPlugin,
|
|
2436
|
-
me as UniverSheetsFilterUIPlugin,
|
|
2437
|
-
Lt as UniverSheetsFilterUIWorkerPlugin
|
|
2438
|
-
};
|
|
57
|
+
`,attachRender:e=>z(`div`,{className:`
|
|
58
|
+
univer-ml-1 univer-flex univer-h-5 univer-flex-1 univer-cursor-pointer
|
|
59
|
+
univer-items-center univer-justify-between univer-text-sm univer-text-primary-500
|
|
60
|
+
`,children:[R(`span`,{"data-u-comp":`sheets-filter-panel-values-item-count`,className:`
|
|
61
|
+
univer-text-gray-400
|
|
62
|
+
dark:!univer-text-gray-500
|
|
63
|
+
`,children:`(${e.count})`}),R(`a`,{className:`
|
|
64
|
+
univer-box-border univer-hidden univer-h-4 univer-whitespace-nowrap univer-px-1.5
|
|
65
|
+
`,onClick:()=>{let n=[];e.children?e.children.forEach(e=>{e.children?e.children.forEach(e=>{n.push(e.key)}):n.push(e.key)}):n.push(e.key),t.onFilterOnly(n)},children:a})]})})})]})]})}function Cn(){let e=k(pe);if(!A(e.visible$,void 0,!0))return null;let t=k(p),n=k(Ne),r=A(e.enabled$,void 0,!0);return z(`div`,{className:`
|
|
66
|
+
univer-mt-2 univer-flex univer-items-center univer-justify-between univer-text-sm univer-text-gray-900
|
|
67
|
+
dark:!univer-text-gray-200
|
|
68
|
+
`,children:[z(`div`,{className:`univer-flex univer-items-center univer-gap-1`,children:[R(`span`,{children:t.t(`sheets-filter.sync.title`)}),R(St,{title:r?t.t(`sheets-filter.sync.statusTips.off`):t.t(`sheets-filter.sync.statusTips.on`),asChild:!0,children:R(kt,{className:`univer-block`})})]}),R(xt,{defaultChecked:r,onChange:r=>{let i=r?t.t(`sheets-filter.sync.switchTips.on`):t.t(`sheets-filter.sync.switchTips.off`);e.setEnabled(r),n.show({content:i,type:gt.Success,duration:2e3})}})]})}function wn(){var e;let t=k(J),n=k(p),r=k(a),i=A(t.filterBy$,void 0,!0),o=A(t.filterByModel$,void 0,!1),s=A(()=>(o==null?void 0:o.canApply$)||I(!1),void 0,!1,[o]),c=Tn(n),l=!A(t.hasCriteria$),u=L(e=>{r.executeCommand(tn.id,{filterBy:e})},[r]),d=L(async()=>{await(o==null?void 0:o.clear()),r.executeCommand(Y.id)},[o,r]),f=L(()=>{r.executeCommand(Y.id)},[r]),m=L(async()=>{await(o==null?void 0:o.apply()),r.executeCommand(Y.id)},[o,r]),h=(e=k(O).activeFilterModel)==null?void 0:e.getRange(),g=t.col,_=Be(Ce.FILTER_PANEL_EMBED_POINT);return z(`div`,{"data-u-comp":`sheets-filter-panel`,className:`
|
|
69
|
+
univer-box-border univer-flex univer-max-h-[500px] univer-w-[400px] univer-flex-col univer-rounded-lg
|
|
70
|
+
univer-bg-white univer-p-4 univer-shadow-lg
|
|
71
|
+
dark:!univer-border-gray-600 dark:!univer-bg-gray-700
|
|
72
|
+
`,children:[R(ke,{components:_,sharedProps:{range:h,colIndex:g,onClose:f}}),R(`div`,{className:`univer-mb-1 univer-flex-shrink-0 univer-flex-grow-0`,children:R(yt,{value:i,items:c,onChange:e=>u(e)})}),o?R(`div`,{"data-u-comp":`sheets-filter-panel-content`,className:`univer-flex-shrink univer-flex-grow univer-pt-2`,children:i===E.VALUES?R(Sn,{model:o}):i===E.COLORS?R(_n,{model:o}):R(yn,{model:o})}):R(`div`,{className:`univer-flex-1`}),R(Cn,{}),z(`div`,{"data-u-comp":`sheets-filter-panel-footer`,className:`
|
|
73
|
+
univer-mt-4 univer-inline-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-nowrap
|
|
74
|
+
univer-justify-between univer-overflow-hidden
|
|
75
|
+
`,children:[R(pt,{variant:`link`,onClick:d,disabled:l,children:n.t(`sheets-filter.panel.clear-filter`)}),z(`span`,{className:`univer-flex univer-gap-2`,children:[R(pt,{variant:`default`,onClick:f,children:n.t(`sheets-filter.panel.cancel`)}),R(pt,{disabled:!s,variant:`primary`,onClick:m,children:n.t(`sheets-filter.panel.confirm`)})]})]})]})}function Tn(e){return jt(()=>[{label:e.t(`sheets-filter.panel.by-values`),value:E.VALUES},{label:e.t(`sheets-filter.panel.by-colors`),value:E.COLORS},{label:e.t(`sheets-filter.panel.by-conditions`),value:E.CONDITIONS}],[e.getCurrentLocale(),e])}const En={id:me.id,binding:Fe.L|Le.CTRL_COMMAND|Le.SHIFT,description:`sheets-filter.shortcut.smart-toggle-filter`,preconditions:Oe,group:`4_sheet-edit`},Dn=`FILTER_PANEL_POPUP`;let On=class extends fn{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f){super(f,d),this._injector=e,this._componentManager=t,this._sheetsFilterPanelService=n,this._sheetCanvasPopupService=r,this._sheetsFilterService=i,this._localeService=a,this._shortcutService=o,this._commandService=s,this._menuManagerService=c,this._contextService=l,this._messageService=u,q(this,`_popupDisposable`,void 0),this._initCommands(),this._initShortcuts(),this._initMenuItems(),this._initUI()}dispose(){super.dispose(),this._closeFilterPopup()}_initShortcuts(){[En].forEach(e=>{this.disposeWithMe(this._shortcutService.registerShortcut(e))})}_initCommands(){[me,ce,ue,D,ie,oe,tn,en,Y].forEach(e=>{this.disposeWithMe(this._commandService.registerCommand(e))})}_initMenuItems(){this._menuManagerService.mergeMenu(gn)}_initUI(){[[Dn,wn],[`FilterIcon`,Ot]].forEach(([e,t])=>{this.disposeWithMe(this._componentManager.register(e,t))}),this.disposeWithMe(this._contextService.subscribeContextValue$($t).pipe(nt()).subscribe(e=>{e?this._openFilterPopup():this._closeFilterPopup()})),this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe(e=>{e&&this._messageService.show({type:gt.Error,content:this._localeService.t(e)})}))}_openFilterPopup(){let e=this._sheetsFilterPanelService.filterModel;if(!e)throw Error(`[SheetsFilterUIController]: no filter model when opening filter popup!`);let t=e.getRange(),n=this._sheetsFilterPanelService.col,{startRow:r}=t;this._popupDisposable=this._sheetCanvasPopupService.attachPopupToCell(r,n,{componentKey:Dn,direction:`horizontal`,onClickOutside:()=>this._commandService.syncExecuteCommand(Y.id),offset:[5,0]})}_closeFilterPopup(){var e;(e=this._popupDisposable)==null||e.dispose(),this._popupDisposable=null}};On=G([W(0,u(d)),W(1,u(Ae)),W(2,u(J)),W(3,u(be)),W(4,u(O)),W(5,u(p)),W(6,Pe),W(7,a),W(8,Me),W(9,s),W(10,Ne),W(11,u(Se)),W(12,He)],On);let Q=class extends h{constructor(e=on,t,n,r){super(),this._config=e,this._injector=t,this._configService=n,this._rpcChannelService=r;let{menu:i,...a}=w({},on,this._config);i&&this._configService.setConfig(`menu`,i,{merge:!0}),this._configService.setConfig(an,a)}onStarting(){ne(this._injector,[[J],[X],[On]]),this._config.useRemoteFilterValuesGenerator&&this._rpcChannelService&&this._injector.add([Ft,{useFactory:()=>ft(this._rpcChannelService.requestChannel(Pt))}])}onReady(){re(this._injector,[[X]])}onRendered(){re(this._injector,[[On]])}};q(Q,`type`,b.UNIVER_SHEET),q(Q,`pluginName`,`SHEET_FILTER_UI_PLUGIN`),q(Q,`packageName`,nn),q(Q,`version`,rn),Q=G([r(he),W(1,u(d)),W(2,o),W(3,m(ut))],Q);let $=class extends h{constructor(e,t,n){super(),this._config=e,this._injector=t,this._rpcChannelService=n}onStarting(){[[Ft,{useClass:It}]].forEach(e=>this._injector.add(e))}onReady(){this._rpcChannelService.registerChannel(Pt,dt(this._injector.get(Ft)))}};q($,`type`,b.UNIVER_SHEET),q($,`pluginName`,`SHEET_FILTER_UI_WORKER_PLUGIN`),q($,`packageName`,nn),q($,`version`,rn),$=G([W(1,u(d)),W(2,ut)],$);export{tn as ChangeFilterByOperation,Y as CloseFilterPanelOperation,en as OpenFilterPanelOperation,Z as UniverSheetsFilterMobileUIPlugin,Q as UniverSheetsFilterUIPlugin,$ as UniverSheetsFilterUIWorkerPlugin};
|