@univerjs/sheets-filter-ui 0.6.7 → 0.6.9
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 +4 -2
- package/lib/es/index.js +279 -272
- package/lib/index.css +1 -1
- package/lib/index.js +1880 -0
- package/lib/locale/en-US.js +70 -0
- package/lib/locale/fa-IR.js +70 -0
- package/lib/locale/fr-FR.js +70 -0
- package/lib/locale/ru-RU.js +70 -0
- package/lib/locale/vi-VN.js +70 -0
- package/lib/locale/zh-CN.js +70 -0
- package/lib/locale/zh-TW.js +70 -0
- package/lib/umd/index.js +4 -2
- package/package.json +13 -13
package/lib/index.js
ADDED
|
@@ -0,0 +1,1880 @@
|
|
|
1
|
+
var jt = Object.defineProperty;
|
|
2
|
+
var Yt = (t, e, r) => e in t ? jt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var f = (t, e, r) => Yt(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { BooleanNumber as st, createIdentifier as gt, Inject as E, LocaleService as X, IUniverInstanceService as je, ILogService as qt, extractPureTextFromCell as Kt, numfmt as it, Disposable as pe, Injector as Z, Quantity as vt, Tools as Fe, ICommandService as Q, CommandType as Me, IContextService as $e, UniverInstanceType as z, ThemeService as St, RxDisposable as Et, fromCallback as Xt, InterceptorEffectEnum as Zt, DependentOn as Tt, IConfigService as Ft, Optional as zt, Plugin as Ye, merge as Ct } from "@univerjs/core";
|
|
5
|
+
import { IRPCChannelService as Nt, toModule as Jt, fromModule as er } from "@univerjs/rpc";
|
|
6
|
+
import { CustomFilterOperator as u, SetSheetsFilterCriteriaCommand as se, SheetsFilterService as G, SmartToggleSheetsFilterCommand as fe, ReCalcSheetsFilterCommand as qe, ClearSheetsFilterCriteriaCommand as Ke, FILTER_MUTATIONS as tr, SetSheetsFilterRangeMutation as rr, SetSheetsFilterCriteriaMutation as sr, RemoveSheetsFilterMutation as ir, ReCalcSheetsFilterMutation as nr, RemoveSheetFilterCommand as or, SetSheetFilterRangeCommand as ar, UniverSheetsFilterPlugin as Pt } from "@univerjs/sheets-filter";
|
|
7
|
+
import { RefRangeService as lr, SheetPermissionCheckController as cr, SheetsSelectionsService as ur, getSheetCommandTarget as hr, WorksheetFilterPermission as le, WorksheetViewPermission as ce, RangeProtectionPermissionViewPoint as ue, expandToContinuousRange as mr, SheetInterceptorService as dr, SetRangeValuesMutation as pr, INTERCEPTOR_POINT as fr } from "@univerjs/sheets";
|
|
8
|
+
import { ILayoutService as _r, useDependency as re, useObservable as W, useComponentsOfPart as gr, ComponentContainer as vr, getMenuHiddenObservable as Xe, MenuItemType as Ze, RibbonStartGroup as Sr, KeyCode as Er, MetaKeys as nt, ComponentManager as Tr, IShortcutService as Fr, IMenuManagerService as Cr, IMessageService as Nr } from "@univerjs/ui";
|
|
9
|
+
import { SetCellEditVisibleOperation as Pr, SheetsUIPart as yr, getObservableWithExclusiveRange$ as Or, getCurrentRangeDisable$ as Ir, SheetSkeletonManagerService as Rr, ISheetSelectionRenderService as Ar, SelectionControl as br, attachSelectionWithCoord as Lr, getCoordByCell as Mr, SheetsRenderService as yt, whenSheetEditorFocused as $r, SheetCanvasPopManagerService as wr } from "@univerjs/sheets-ui";
|
|
10
|
+
import { BehaviorSubject as K, ReplaySubject as Ur, Subject as Hr, merge as Dr, combineLatest as kr, throttleTime as Ot, startWith as It, map as ie, shareReplay as Br, of as _e, switchMap as ze, filter as Vr, takeUntil as Wr, distinctUntilChanged as xr } from "rxjs";
|
|
11
|
+
import { Select as ot, RadioGroup as Qr, Radio as at, Input as Rt, Checkbox as Gr, Tree as jr, Segmented as Yr, Button as He, MessageType as qr } from "@univerjs/design";
|
|
12
|
+
import { Rect as lt, Shape as Kr, IRenderManagerService as At } from "@univerjs/engine-render";
|
|
13
|
+
import { jsx as S, jsxs as L, Fragment as ct } from "react/jsx-runtime";
|
|
14
|
+
import { forwardRef as bt, useRef as Xr, createElement as Lt, useCallback as k, useMemo as Je } from "react";
|
|
15
|
+
const Mt = "sheets-filter-ui.config", Ce = {};
|
|
16
|
+
var C = /* @__PURE__ */ ((t) => (t[t.FIRST = 0] = "FIRST", t[t.SECOND = 1] = "SECOND", t))(C || {}), _ = /* @__PURE__ */ ((t) => (t.NONE = "none", t.STARTS_WITH = "startsWith", t.DOES_NOT_START_WITH = "doesNotStartWith", t.ENDS_WITH = "endsWith", t.DOES_NOT_END_WITH = "doesNotEndWith", t.CONTAINS = "contains", t.DOES_NOT_CONTAIN = "doesNotContain", t.EQUALS = "equals", t.NOT_EQUALS = "notEquals", t.EMPTY = "empty", t.NOT_EMPTY = "notEmpty", t.BETWEEN = "between", t.NOT_BETWEEN = "notBetween", t.CUSTOM = "custom", t))(_ || {}), m;
|
|
17
|
+
((t) => {
|
|
18
|
+
t.NONE = {
|
|
19
|
+
label: "sheets-filter.conditions.none",
|
|
20
|
+
operator: _.NONE,
|
|
21
|
+
order: C.SECOND,
|
|
22
|
+
numOfParameters: 0,
|
|
23
|
+
getDefaultFormParams: () => {
|
|
24
|
+
throw new Error("[FilterConditionItems.NONE]: should not have initial form params!");
|
|
25
|
+
},
|
|
26
|
+
testMappingParams: (s) => s.operator1 === _.NONE,
|
|
27
|
+
mapToFilterColumn: () => null,
|
|
28
|
+
testMappingFilterColumn: (s) => !s.customFilters && !s.filters ? {} : !1
|
|
29
|
+
}, t.EMPTY = {
|
|
30
|
+
label: "sheets-filter.conditions.empty",
|
|
31
|
+
operator: _.EMPTY,
|
|
32
|
+
order: C.SECOND,
|
|
33
|
+
numOfParameters: 0,
|
|
34
|
+
getDefaultFormParams: () => {
|
|
35
|
+
throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!");
|
|
36
|
+
},
|
|
37
|
+
testMappingParams: ({ operator1: s }) => s === _.EMPTY,
|
|
38
|
+
mapToFilterColumn: () => ({ customFilters: { customFilters: [{ val: "" }] } }),
|
|
39
|
+
testMappingFilterColumn: (s) => {
|
|
40
|
+
var c;
|
|
41
|
+
if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
|
|
42
|
+
return !1;
|
|
43
|
+
const o = s.customFilters.customFilters[0];
|
|
44
|
+
return o.val === "" && o.operator === void 0 ? { operator1: _.EMPTY } : !1;
|
|
45
|
+
}
|
|
46
|
+
}, t.NOT_EMPTY = {
|
|
47
|
+
label: "sheets-filter.conditions.not-empty",
|
|
48
|
+
operator: _.NOT_EMPTY,
|
|
49
|
+
order: C.SECOND,
|
|
50
|
+
numOfParameters: 0,
|
|
51
|
+
getDefaultFormParams: () => {
|
|
52
|
+
throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!");
|
|
53
|
+
},
|
|
54
|
+
testMappingParams: ({ operator1: s }) => s === _.NOT_EMPTY,
|
|
55
|
+
mapToFilterColumn: () => ({ customFilters: { customFilters: [{ val: "", operator: u.NOT_EQUALS }] } }),
|
|
56
|
+
testMappingFilterColumn: (s) => {
|
|
57
|
+
var c;
|
|
58
|
+
if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
|
|
59
|
+
return !1;
|
|
60
|
+
const o = s.customFilters.customFilters[0];
|
|
61
|
+
return o.val === " " && o.operator === u.NOT_EQUALS ? { operator1: _.NOT_EMPTY } : !1;
|
|
62
|
+
}
|
|
63
|
+
}, t.TEXT_CONTAINS = {
|
|
64
|
+
label: "sheets-filter.conditions.text-contains",
|
|
65
|
+
operator: _.CONTAINS,
|
|
66
|
+
order: C.FIRST,
|
|
67
|
+
numOfParameters: 1,
|
|
68
|
+
getDefaultFormParams: () => ({ operator1: _.CONTAINS, val1: "" }),
|
|
69
|
+
testMappingParams: (s) => {
|
|
70
|
+
const [o] = M(s);
|
|
71
|
+
return o === _.CONTAINS;
|
|
72
|
+
},
|
|
73
|
+
mapToFilterColumn: (s) => {
|
|
74
|
+
const { val1: o } = s;
|
|
75
|
+
return o === "" ? null : {
|
|
76
|
+
customFilters: { customFilters: [{ val: `*${o}*` }] }
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
testMappingFilterColumn: (s) => {
|
|
80
|
+
var c;
|
|
81
|
+
if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
|
|
82
|
+
return !1;
|
|
83
|
+
const o = s.customFilters.customFilters[0], a = o.val.toString();
|
|
84
|
+
return !o.operator && a.startsWith("*") && a.endsWith("*") ? { operator1: _.CONTAINS, val1: a.slice(1, -1) } : !1;
|
|
85
|
+
}
|
|
86
|
+
}, t.DOES_NOT_CONTAIN = {
|
|
87
|
+
label: "sheets-filter.conditions.does-not-contain",
|
|
88
|
+
operator: _.DOES_NOT_CONTAIN,
|
|
89
|
+
order: C.FIRST,
|
|
90
|
+
numOfParameters: 1,
|
|
91
|
+
getDefaultFormParams: () => ({ operator1: _.DOES_NOT_CONTAIN, val1: "" }),
|
|
92
|
+
mapToFilterColumn: (s) => ({
|
|
93
|
+
customFilters: { customFilters: [{ val: `*${s.val1}*`, operator: u.NOT_EQUALS }] }
|
|
94
|
+
}),
|
|
95
|
+
testMappingParams: (s) => {
|
|
96
|
+
const [o] = M(s);
|
|
97
|
+
return o === _.DOES_NOT_CONTAIN;
|
|
98
|
+
},
|
|
99
|
+
testMappingFilterColumn: (s) => {
|
|
100
|
+
var c;
|
|
101
|
+
if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
|
|
102
|
+
return !1;
|
|
103
|
+
const o = s.customFilters.customFilters[0], a = o.val.toString();
|
|
104
|
+
return o.operator === u.NOT_EQUALS && a.startsWith("*") && a.endsWith("*") ? { operator1: _.DOES_NOT_CONTAIN, val1: a.slice(1, -1) } : !1;
|
|
105
|
+
}
|
|
106
|
+
}, t.STARTS_WITH = {
|
|
107
|
+
label: "sheets-filter.conditions.starts-with",
|
|
108
|
+
operator: _.STARTS_WITH,
|
|
109
|
+
order: C.FIRST,
|
|
110
|
+
numOfParameters: 1,
|
|
111
|
+
getDefaultFormParams: () => ({ operator1: _.STARTS_WITH, val1: "" }),
|
|
112
|
+
mapToFilterColumn: (s) => ({
|
|
113
|
+
customFilters: { customFilters: [{ val: `${s.val1}*` }] }
|
|
114
|
+
}),
|
|
115
|
+
testMappingParams: (s) => {
|
|
116
|
+
const [o] = M(s);
|
|
117
|
+
return o === _.STARTS_WITH;
|
|
118
|
+
},
|
|
119
|
+
testMappingFilterColumn: (s) => {
|
|
120
|
+
var c;
|
|
121
|
+
if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
|
|
122
|
+
return !1;
|
|
123
|
+
const o = s.customFilters.customFilters[0], a = o.val.toString();
|
|
124
|
+
return !o.operator && a.endsWith("*") && !a.startsWith("*") ? { operator1: _.STARTS_WITH, val1: a.slice(0, -1) } : !1;
|
|
125
|
+
}
|
|
126
|
+
}, t.ENDS_WITH = {
|
|
127
|
+
label: "sheets-filter.conditions.ends-with",
|
|
128
|
+
operator: _.ENDS_WITH,
|
|
129
|
+
order: C.FIRST,
|
|
130
|
+
numOfParameters: 1,
|
|
131
|
+
getDefaultFormParams: () => ({ operator1: _.ENDS_WITH, val1: "" }),
|
|
132
|
+
mapToFilterColumn: (s) => ({
|
|
133
|
+
customFilters: { customFilters: [{ val: `*${s.val1}` }] }
|
|
134
|
+
}),
|
|
135
|
+
testMappingParams: (s) => {
|
|
136
|
+
const [o] = M(s);
|
|
137
|
+
return o === _.ENDS_WITH;
|
|
138
|
+
},
|
|
139
|
+
testMappingFilterColumn: (s) => {
|
|
140
|
+
var c;
|
|
141
|
+
if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 1)
|
|
142
|
+
return !1;
|
|
143
|
+
const o = s.customFilters.customFilters[0], a = o.val.toString();
|
|
144
|
+
return !o.operator && a.startsWith("*") && !a.endsWith("*") ? { operator1: _.ENDS_WITH, val1: a.slice(1) } : !1;
|
|
145
|
+
}
|
|
146
|
+
}, t.EQUALS = {
|
|
147
|
+
label: "sheets-filter.conditions.equals",
|
|
148
|
+
operator: _.EQUALS,
|
|
149
|
+
order: C.FIRST,
|
|
150
|
+
numOfParameters: 1,
|
|
151
|
+
getDefaultFormParams: () => ({ operator1: _.EQUALS, val1: "" }),
|
|
152
|
+
testMappingParams: (s) => {
|
|
153
|
+
const [o] = M(s);
|
|
154
|
+
return o === _.EQUALS;
|
|
155
|
+
},
|
|
156
|
+
mapToFilterColumn: (s) => {
|
|
157
|
+
const { val1: o } = s;
|
|
158
|
+
return o === "" ? null : {
|
|
159
|
+
customFilters: { customFilters: [{ val: o }] }
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
testMappingFilterColumn: (s) => {
|
|
163
|
+
var o, a, c;
|
|
164
|
+
return ((a = (o = s.filters) == null ? void 0 : o.filters) == null ? void 0 : a.length) === 1 ? { operator1: _.EQUALS, val1: "" } : ((c = s.customFilters) == null ? void 0 : c.customFilters.length) === 1 && !s.customFilters.customFilters[0].operator ? { operator1: _.EQUALS, val1: s.customFilters.customFilters[0].val.toString() } : !1;
|
|
165
|
+
}
|
|
166
|
+
}, t.GREATER_THAN = {
|
|
167
|
+
label: "sheets-filter.conditions.greater-than",
|
|
168
|
+
operator: u.GREATER_THAN,
|
|
169
|
+
numOfParameters: 1,
|
|
170
|
+
order: C.FIRST,
|
|
171
|
+
getDefaultFormParams: () => ({ operator1: u.GREATER_THAN, val1: "" }),
|
|
172
|
+
mapToFilterColumn: (s) => ({
|
|
173
|
+
customFilters: { customFilters: [{ val: s.val1, operator: u.GREATER_THAN }] }
|
|
174
|
+
}),
|
|
175
|
+
testMappingParams: (s) => {
|
|
176
|
+
const [o] = M(s);
|
|
177
|
+
return o === u.GREATER_THAN;
|
|
178
|
+
},
|
|
179
|
+
testMappingFilterColumn: (s) => {
|
|
180
|
+
var a;
|
|
181
|
+
if (((a = s.customFilters) == null ? void 0 : a.customFilters.length) !== 1)
|
|
182
|
+
return !1;
|
|
183
|
+
const o = s.customFilters.customFilters[0];
|
|
184
|
+
return o.operator !== u.GREATER_THAN ? !1 : { operator1: u.GREATER_THAN, val1: o.val.toString() };
|
|
185
|
+
}
|
|
186
|
+
}, t.GREATER_THAN_OR_EQUAL = {
|
|
187
|
+
label: "sheets-filter.conditions.greater-than-or-equal",
|
|
188
|
+
operator: u.GREATER_THAN_OR_EQUAL,
|
|
189
|
+
numOfParameters: 1,
|
|
190
|
+
order: C.FIRST,
|
|
191
|
+
getDefaultFormParams: () => ({ operator1: u.GREATER_THAN_OR_EQUAL, val1: "" }),
|
|
192
|
+
testMappingParams: (s) => {
|
|
193
|
+
const [o] = M(s);
|
|
194
|
+
return o === u.GREATER_THAN_OR_EQUAL;
|
|
195
|
+
},
|
|
196
|
+
mapToFilterColumn: (s) => ({
|
|
197
|
+
customFilters: { customFilters: [{ val: s.val1, operator: u.GREATER_THAN_OR_EQUAL }] }
|
|
198
|
+
}),
|
|
199
|
+
testMappingFilterColumn: (s) => {
|
|
200
|
+
var a;
|
|
201
|
+
if (((a = s.customFilters) == null ? void 0 : a.customFilters.length) !== 1)
|
|
202
|
+
return !1;
|
|
203
|
+
const o = s.customFilters.customFilters[0];
|
|
204
|
+
return o.operator !== u.GREATER_THAN_OR_EQUAL ? !1 : { operator1: u.GREATER_THAN_OR_EQUAL, val1: o.val.toString() };
|
|
205
|
+
}
|
|
206
|
+
}, t.LESS_THAN = {
|
|
207
|
+
label: "sheets-filter.conditions.less-than",
|
|
208
|
+
operator: u.LESS_THAN,
|
|
209
|
+
numOfParameters: 1,
|
|
210
|
+
order: C.FIRST,
|
|
211
|
+
getDefaultFormParams: () => ({ operator1: u.LESS_THAN, val1: "" }),
|
|
212
|
+
testMappingParams: (s) => {
|
|
213
|
+
const [o] = M(s);
|
|
214
|
+
return o === u.LESS_THAN;
|
|
215
|
+
},
|
|
216
|
+
mapToFilterColumn: (s) => ({
|
|
217
|
+
customFilters: { customFilters: [{ val: s.val1, operator: u.LESS_THAN }] }
|
|
218
|
+
}),
|
|
219
|
+
testMappingFilterColumn: (s) => {
|
|
220
|
+
var a;
|
|
221
|
+
if (((a = s.customFilters) == null ? void 0 : a.customFilters.length) !== 1)
|
|
222
|
+
return !1;
|
|
223
|
+
const o = s.customFilters.customFilters[0];
|
|
224
|
+
return o.operator !== u.LESS_THAN ? !1 : { operator1: u.LESS_THAN, val1: o.val.toString() };
|
|
225
|
+
}
|
|
226
|
+
}, t.LESS_THAN_OR_EQUAL = {
|
|
227
|
+
label: "sheets-filter.conditions.less-than-or-equal",
|
|
228
|
+
operator: u.LESS_THAN_OR_EQUAL,
|
|
229
|
+
numOfParameters: 1,
|
|
230
|
+
order: C.FIRST,
|
|
231
|
+
getDefaultFormParams: () => ({ operator1: u.LESS_THAN_OR_EQUAL, val1: "" }),
|
|
232
|
+
testMappingParams: (s) => {
|
|
233
|
+
const [o] = M(s);
|
|
234
|
+
return o === u.LESS_THAN_OR_EQUAL;
|
|
235
|
+
},
|
|
236
|
+
mapToFilterColumn: (s) => ({
|
|
237
|
+
customFilters: { customFilters: [{ val: s.val1, operator: u.LESS_THAN_OR_EQUAL }] }
|
|
238
|
+
}),
|
|
239
|
+
testMappingFilterColumn: (s) => {
|
|
240
|
+
var a;
|
|
241
|
+
if (((a = s.customFilters) == null ? void 0 : a.customFilters.length) !== 1)
|
|
242
|
+
return !1;
|
|
243
|
+
const o = s.customFilters.customFilters[0];
|
|
244
|
+
return o.operator !== u.LESS_THAN_OR_EQUAL ? !1 : { operator1: u.LESS_THAN_OR_EQUAL, val1: o.val.toString() };
|
|
245
|
+
}
|
|
246
|
+
}, t.EQUAL = {
|
|
247
|
+
label: "sheets-filter.conditions.equal",
|
|
248
|
+
operator: u.EQUAL,
|
|
249
|
+
numOfParameters: 1,
|
|
250
|
+
order: C.FIRST,
|
|
251
|
+
getDefaultFormParams: () => ({ operator1: u.EQUAL, val1: "" }),
|
|
252
|
+
testMappingParams: (s) => {
|
|
253
|
+
const [o] = M(s);
|
|
254
|
+
return o === u.EQUAL;
|
|
255
|
+
},
|
|
256
|
+
mapToFilterColumn: (s) => ({
|
|
257
|
+
customFilters: { customFilters: [{ val: s.val1, operator: u.EQUAL }] }
|
|
258
|
+
}),
|
|
259
|
+
testMappingFilterColumn: (s) => {
|
|
260
|
+
var a;
|
|
261
|
+
if (((a = s.customFilters) == null ? void 0 : a.customFilters.length) !== 1)
|
|
262
|
+
return !1;
|
|
263
|
+
const o = s.customFilters.customFilters[0];
|
|
264
|
+
return o.operator !== u.EQUAL ? !1 : { operator1: u.EQUAL, val1: o.val.toString() };
|
|
265
|
+
}
|
|
266
|
+
}, t.NOT_EQUAL = {
|
|
267
|
+
label: "sheets-filter.conditions.not-equal",
|
|
268
|
+
operator: u.NOT_EQUALS,
|
|
269
|
+
numOfParameters: 1,
|
|
270
|
+
order: C.FIRST,
|
|
271
|
+
getDefaultFormParams: () => ({ operator1: u.NOT_EQUALS, val1: "" }),
|
|
272
|
+
testMappingParams: (s) => {
|
|
273
|
+
const [o] = M(s);
|
|
274
|
+
return o === u.NOT_EQUALS;
|
|
275
|
+
},
|
|
276
|
+
mapToFilterColumn: (s) => ({
|
|
277
|
+
customFilters: { customFilters: [{ val: s.val1, operator: u.NOT_EQUALS }] }
|
|
278
|
+
}),
|
|
279
|
+
testMappingFilterColumn: (s) => {
|
|
280
|
+
var a;
|
|
281
|
+
if (((a = s.customFilters) == null ? void 0 : a.customFilters.length) !== 1)
|
|
282
|
+
return !1;
|
|
283
|
+
const o = s.customFilters.customFilters[0];
|
|
284
|
+
return o.operator !== u.NOT_EQUALS ? !1 : { operator1: u.NOT_EQUALS, val1: o.val.toString() };
|
|
285
|
+
}
|
|
286
|
+
}, t.BETWEEN = {
|
|
287
|
+
label: "sheets-filter.conditions.between",
|
|
288
|
+
operator: _.BETWEEN,
|
|
289
|
+
order: C.SECOND,
|
|
290
|
+
numOfParameters: 2,
|
|
291
|
+
getDefaultFormParams: () => ({
|
|
292
|
+
and: !0,
|
|
293
|
+
operator1: u.GREATER_THAN_OR_EQUAL,
|
|
294
|
+
val1: "",
|
|
295
|
+
operator2: u.LESS_THAN_OR_EQUAL,
|
|
296
|
+
val2: ""
|
|
297
|
+
}),
|
|
298
|
+
testMappingParams: (s) => {
|
|
299
|
+
const { and: o, operator1: a, operator2: c } = s;
|
|
300
|
+
if (!o) return !1;
|
|
301
|
+
const h = [a, c];
|
|
302
|
+
return h.includes(u.GREATER_THAN_OR_EQUAL) && h.includes(u.LESS_THAN_OR_EQUAL);
|
|
303
|
+
},
|
|
304
|
+
mapToFilterColumn: (s) => {
|
|
305
|
+
const { val1: o, val2: a, operator1: c } = s, h = c === u.GREATER_THAN_OR_EQUAL;
|
|
306
|
+
return {
|
|
307
|
+
customFilters: {
|
|
308
|
+
and: st.TRUE,
|
|
309
|
+
customFilters: [
|
|
310
|
+
{ val: h ? o : a, operator: u.GREATER_THAN_OR_EQUAL },
|
|
311
|
+
{ val: h ? a : o, operator: u.LESS_THAN_OR_EQUAL }
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
},
|
|
316
|
+
testMappingFilterColumn: (s) => {
|
|
317
|
+
var c;
|
|
318
|
+
if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 2)
|
|
319
|
+
return !1;
|
|
320
|
+
const [o, a] = s.customFilters.customFilters;
|
|
321
|
+
return o.operator === u.GREATER_THAN_OR_EQUAL && a.operator === u.LESS_THAN_OR_EQUAL && s.customFilters.and ? {
|
|
322
|
+
and: !0,
|
|
323
|
+
operator1: u.GREATER_THAN_OR_EQUAL,
|
|
324
|
+
val1: o.val.toString(),
|
|
325
|
+
operator2: u.LESS_THAN_OR_EQUAL,
|
|
326
|
+
val2: a.val.toString()
|
|
327
|
+
} : a.operator === u.GREATER_THAN_OR_EQUAL && o.operator === u.LESS_THAN_OR_EQUAL && s.customFilters.and ? {
|
|
328
|
+
and: !0,
|
|
329
|
+
operator1: u.GREATER_THAN_OR_EQUAL,
|
|
330
|
+
val1: a.val.toString(),
|
|
331
|
+
operator2: u.LESS_THAN_OR_EQUAL,
|
|
332
|
+
val2: o.val.toLocaleString()
|
|
333
|
+
} : !1;
|
|
334
|
+
}
|
|
335
|
+
}, t.NOT_BETWEEN = {
|
|
336
|
+
label: "sheets-filter.conditions.not-between",
|
|
337
|
+
operator: _.NOT_BETWEEN,
|
|
338
|
+
order: C.SECOND,
|
|
339
|
+
numOfParameters: 2,
|
|
340
|
+
getDefaultFormParams: () => ({
|
|
341
|
+
operator1: u.LESS_THAN,
|
|
342
|
+
val1: "",
|
|
343
|
+
operator2: u.GREATER_THAN,
|
|
344
|
+
val2: ""
|
|
345
|
+
}),
|
|
346
|
+
testMappingParams: (s) => {
|
|
347
|
+
const { and: o, operator1: a, operator2: c } = s;
|
|
348
|
+
if (o) return !1;
|
|
349
|
+
const h = [a, c];
|
|
350
|
+
return h.includes(u.GREATER_THAN) && h.includes(u.LESS_THAN);
|
|
351
|
+
},
|
|
352
|
+
mapToFilterColumn: (s) => {
|
|
353
|
+
const { val1: o, val2: a, operator1: c } = s, h = c === u.GREATER_THAN;
|
|
354
|
+
return {
|
|
355
|
+
customFilters: {
|
|
356
|
+
customFilters: [
|
|
357
|
+
{ val: h ? o : a, operator: u.GREATER_THAN },
|
|
358
|
+
{ val: h ? a : o, operator: u.LESS_THAN }
|
|
359
|
+
]
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
},
|
|
363
|
+
testMappingFilterColumn: (s) => {
|
|
364
|
+
var c;
|
|
365
|
+
if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 2)
|
|
366
|
+
return !1;
|
|
367
|
+
const [o, a] = s.customFilters.customFilters;
|
|
368
|
+
return o.operator === u.LESS_THAN && a.operator === u.GREATER_THAN && !s.customFilters.and ? {
|
|
369
|
+
operator1: u.LESS_THAN,
|
|
370
|
+
val1: o.val.toString(),
|
|
371
|
+
operator2: u.GREATER_THAN,
|
|
372
|
+
val2: a.val.toString()
|
|
373
|
+
} : a.operator === u.LESS_THAN && o.operator === u.GREATER_THAN && !s.customFilters.and ? {
|
|
374
|
+
operator1: u.GREATER_THAN,
|
|
375
|
+
val1: a.val.toString(),
|
|
376
|
+
operator2: u.LESS_THAN,
|
|
377
|
+
val2: o.val.toLocaleString()
|
|
378
|
+
} : !1;
|
|
379
|
+
}
|
|
380
|
+
}, t.CUSTOM = {
|
|
381
|
+
label: "sheets-filter.conditions.custom",
|
|
382
|
+
operator: _.CUSTOM,
|
|
383
|
+
order: C.SECOND,
|
|
384
|
+
numOfParameters: 2,
|
|
385
|
+
getDefaultFormParams: () => ({
|
|
386
|
+
operator1: _.NONE,
|
|
387
|
+
val1: "",
|
|
388
|
+
operator2: _.NONE,
|
|
389
|
+
val2: ""
|
|
390
|
+
}),
|
|
391
|
+
testMappingParams: () => !0,
|
|
392
|
+
mapToFilterColumn: (s) => {
|
|
393
|
+
const { and: o, val1: a, val2: c, operator1: h, operator2: d } = s;
|
|
394
|
+
function v(I, y) {
|
|
395
|
+
for (const $ of t.ALL_CONDITIONS)
|
|
396
|
+
if ($.operator === I)
|
|
397
|
+
return $.mapToFilterColumn({ val1: y, operator1: I });
|
|
398
|
+
}
|
|
399
|
+
const p = !h || h === t.NONE.operator, T = !d || d === t.NONE.operator;
|
|
400
|
+
if (p && T)
|
|
401
|
+
return t.NONE.mapToFilterColumn({});
|
|
402
|
+
if (p)
|
|
403
|
+
return v(d, c);
|
|
404
|
+
if (T)
|
|
405
|
+
return v(h, a);
|
|
406
|
+
const g = v(h, a), N = v(d, c), F = {
|
|
407
|
+
customFilters: [
|
|
408
|
+
g.customFilters.customFilters[0],
|
|
409
|
+
N.customFilters.customFilters[0]
|
|
410
|
+
]
|
|
411
|
+
};
|
|
412
|
+
return o && (F.and = st.TRUE), { customFilters: F };
|
|
413
|
+
},
|
|
414
|
+
testMappingFilterColumn: (s) => {
|
|
415
|
+
var c;
|
|
416
|
+
if (((c = s.customFilters) == null ? void 0 : c.customFilters.length) !== 2)
|
|
417
|
+
return !1;
|
|
418
|
+
const o = s.customFilters.customFilters.map((h) => l({ customFilters: { customFilters: [h] } })), a = {
|
|
419
|
+
operator1: o[0][0].operator,
|
|
420
|
+
val1: o[0][1].val1,
|
|
421
|
+
operator2: o[1][0].operator,
|
|
422
|
+
val2: o[1][1].val1
|
|
423
|
+
};
|
|
424
|
+
return s.customFilters.and && (a.and = !0), a;
|
|
425
|
+
}
|
|
426
|
+
}, t.ALL_CONDITIONS = [
|
|
427
|
+
// ------------------------------
|
|
428
|
+
t.NONE,
|
|
429
|
+
// ------------------------------
|
|
430
|
+
t.EMPTY,
|
|
431
|
+
t.NOT_EMPTY,
|
|
432
|
+
// ------------------------------
|
|
433
|
+
t.TEXT_CONTAINS,
|
|
434
|
+
t.DOES_NOT_CONTAIN,
|
|
435
|
+
t.STARTS_WITH,
|
|
436
|
+
t.ENDS_WITH,
|
|
437
|
+
t.EQUALS,
|
|
438
|
+
// ------------------------------
|
|
439
|
+
t.GREATER_THAN,
|
|
440
|
+
t.GREATER_THAN_OR_EQUAL,
|
|
441
|
+
t.LESS_THAN,
|
|
442
|
+
t.LESS_THAN_OR_EQUAL,
|
|
443
|
+
t.EQUAL,
|
|
444
|
+
t.NOT_EQUAL,
|
|
445
|
+
t.BETWEEN,
|
|
446
|
+
t.NOT_BETWEEN,
|
|
447
|
+
// ------------------------------
|
|
448
|
+
t.CUSTOM
|
|
449
|
+
];
|
|
450
|
+
function e(s) {
|
|
451
|
+
const o = t.ALL_CONDITIONS.find((a) => a.operator === s);
|
|
452
|
+
if (!o)
|
|
453
|
+
throw new Error(`[SheetsFilter]: no condition item found for operator: ${s}`);
|
|
454
|
+
return o;
|
|
455
|
+
}
|
|
456
|
+
t.getItemByOperator = e;
|
|
457
|
+
function r(s, o) {
|
|
458
|
+
for (const a of t.ALL_CONDITIONS.filter((c) => c.numOfParameters === o))
|
|
459
|
+
if (a.numOfParameters !== 0 && a.testMappingParams(s))
|
|
460
|
+
return a;
|
|
461
|
+
for (const a of t.ALL_CONDITIONS)
|
|
462
|
+
if (a.testMappingParams(s))
|
|
463
|
+
return a;
|
|
464
|
+
throw new Error("[SheetsFilter]: no condition item can be mapped from the filter map params!");
|
|
465
|
+
}
|
|
466
|
+
t.testMappingParams = r;
|
|
467
|
+
function i(s) {
|
|
468
|
+
const o = t.ALL_CONDITIONS.find((a) => a.operator === s);
|
|
469
|
+
return (o == null ? void 0 : o.numOfParameters) === 0 ? { operator1: o.operator } : o.getDefaultFormParams();
|
|
470
|
+
}
|
|
471
|
+
t.getInitialFormParams = i;
|
|
472
|
+
function n(s, o) {
|
|
473
|
+
return s.mapToFilterColumn(o);
|
|
474
|
+
}
|
|
475
|
+
t.mapToFilterColumn = n;
|
|
476
|
+
function l(s) {
|
|
477
|
+
if (!s)
|
|
478
|
+
return [t.NONE, {}];
|
|
479
|
+
for (const o of t.ALL_CONDITIONS) {
|
|
480
|
+
const a = o.testMappingFilterColumn(s);
|
|
481
|
+
if (a)
|
|
482
|
+
return [o, a];
|
|
483
|
+
}
|
|
484
|
+
return [t.NONE, {}];
|
|
485
|
+
}
|
|
486
|
+
t.testMappingFilterColumn = l;
|
|
487
|
+
})(m || (m = {}));
|
|
488
|
+
function M(t) {
|
|
489
|
+
const { operator1: e, operator2: r, val1: i, val2: n } = t;
|
|
490
|
+
if (e && r)
|
|
491
|
+
throw new Error("Both operator1 and operator2 are set!");
|
|
492
|
+
if (!e && !r)
|
|
493
|
+
throw new Error("Neither operator1 and operator2 and both not set!");
|
|
494
|
+
return e ? [e, i] : [r, n];
|
|
495
|
+
}
|
|
496
|
+
function Ve(t) {
|
|
497
|
+
const e = [], r = [];
|
|
498
|
+
let i = 0, n = 0;
|
|
499
|
+
function l(s) {
|
|
500
|
+
s.leaf && (s.checked ? (e.push(s), i += s.count) : (r.push(s), n += s.count)), s.children && s.children.forEach(l);
|
|
501
|
+
}
|
|
502
|
+
return t.forEach(l), {
|
|
503
|
+
checkedItems: e,
|
|
504
|
+
uncheckedItems: r,
|
|
505
|
+
checked: i,
|
|
506
|
+
unchecked: n
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
var Zr = Object.getOwnPropertyDescriptor, zr = (t, e, r, i) => {
|
|
510
|
+
for (var n = i > 1 ? void 0 : i ? Zr(e, r) : e, l = t.length - 1, s; l >= 0; l--)
|
|
511
|
+
(s = t[l]) && (n = s(n) || n);
|
|
512
|
+
return n;
|
|
513
|
+
}, De = (t, e) => (r, i) => e(r, i, t);
|
|
514
|
+
const et = "sheets-filter.generate-filter-values.service", Ne = gt(et), Jr = ["yyyy-mm-dd", "yyyy-mm-dd;@", "yyyy/mm/dd;@", "yyyy/mm/dd hh:mm", "yyyy-m-d am/pm h:mm", "yyyy-MM-dd", "yyyy/MM/dd", "yyyy/mm/dd", 'yyyy"年"MM"月"dd"日"', "MM-dd", 'M"月"d"日"', "MM-dd A/P hh:mm"];
|
|
515
|
+
let We = class extends pe {
|
|
516
|
+
constructor(t, e, r) {
|
|
517
|
+
super(), this._localeService = t, this._univerInstanceService = e, this._logService = r;
|
|
518
|
+
}
|
|
519
|
+
async getFilterValues(t) {
|
|
520
|
+
var h;
|
|
521
|
+
const { unitId: e, subUnitId: r, filteredOutRowsByOtherColumns: i, filters: n, blankChecked: l, iterateRange: s, alreadyChecked: o } = t, a = this._univerInstanceService.getUnit(e), c = (h = this._univerInstanceService.getUnit(e)) == null ? void 0 : h.getSheetBySheetId(r);
|
|
522
|
+
return !a || !c ? [] : (this._logService.debug("[SheetsGenerateFilterValuesService]", "getFilterValues for", { unitId: e, subUnitId: r }), $t(n, this._localeService, s, c, new Set(i), new Set(o.map(String)), l, a.getStyles()));
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
We = zr([
|
|
526
|
+
De(0, E(X)),
|
|
527
|
+
De(1, je),
|
|
528
|
+
De(2, qt)
|
|
529
|
+
], We);
|
|
530
|
+
function $t(t, e, r, i, n, l, s, o) {
|
|
531
|
+
var g, N, F, I, y, $, w, ge, ve;
|
|
532
|
+
const a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), h = "yyyy-mm-dd", d = new Set(Jr), v = "empty";
|
|
533
|
+
let p = 0;
|
|
534
|
+
for (const R of i.iterateByColumn(r, !1, !1)) {
|
|
535
|
+
const { row: xt, rowSpan: rt = 1 } = R;
|
|
536
|
+
let J = 0;
|
|
537
|
+
for (; J < rt; ) {
|
|
538
|
+
const Qt = xt + J;
|
|
539
|
+
if (n.has(Qt)) {
|
|
540
|
+
J++;
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
const j = R != null && R.value ? Kt(R.value) : "";
|
|
544
|
+
if (!j) {
|
|
545
|
+
p += 1, J += rt;
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
548
|
+
const Se = (g = R.value) != null && g.v && !R.value.p ? (I = (F = o.get((N = R.value) == null ? void 0 : N.s)) == null ? void 0 : F.n) == null ? void 0 : I.pattern : "", Gt = Se && it.isDate(Se);
|
|
549
|
+
if (Se && Gt && d.has(Se)) {
|
|
550
|
+
const B = (y = i.getCellRaw(R.row, R.col)) == null ? void 0 : y.v;
|
|
551
|
+
if (!B) {
|
|
552
|
+
J++;
|
|
553
|
+
continue;
|
|
554
|
+
}
|
|
555
|
+
const ee = it.format(h, B), [P, U, ae] = ee.split("-").map(Number);
|
|
556
|
+
let Y = a.get(`${P}`);
|
|
557
|
+
Y || (Y = {
|
|
558
|
+
title: `${P}`,
|
|
559
|
+
key: `${P}`,
|
|
560
|
+
children: [],
|
|
561
|
+
count: 0,
|
|
562
|
+
leaf: !1,
|
|
563
|
+
checked: !1
|
|
564
|
+
}, a.set(`${P}`, Y), c.set(`${P}`, [`${P}`]));
|
|
565
|
+
let H = ($ = Y.children) == null ? void 0 : $.find((Ue) => Ue.key === `${P}-${U}`);
|
|
566
|
+
H || (H = {
|
|
567
|
+
title: e.t(`sheets-filter.date.${U}`),
|
|
568
|
+
key: `${P}-${U}`,
|
|
569
|
+
children: [],
|
|
570
|
+
count: 0,
|
|
571
|
+
leaf: !1,
|
|
572
|
+
checked: !1
|
|
573
|
+
}, (w = Y.children) == null || w.push(H), c.set(`${P}-${U}`, [`${P}`, `${P}-${U}`]));
|
|
574
|
+
const we = (ge = H == null ? void 0 : H.children) == null ? void 0 : ge.find((Ue) => Ue.key === `${P}-${U}-${ae}`);
|
|
575
|
+
we ? (we.originValues.add(j), we.count++, H.count++, Y.count++) : ((ve = H.children) == null || ve.push({
|
|
576
|
+
title: `${ae}`,
|
|
577
|
+
key: `${P}-${U}-${ae}`,
|
|
578
|
+
count: 1,
|
|
579
|
+
originValues: /* @__PURE__ */ new Set([j]),
|
|
580
|
+
leaf: !0,
|
|
581
|
+
checked: l.size ? l.has(j) : !s
|
|
582
|
+
}), H.count++, Y.count++, c.set(`${P}-${U}-${ae}`, [`${P}`, `${P}-${U}`, `${P}-${U}-${ae}`]));
|
|
583
|
+
} else {
|
|
584
|
+
const B = j;
|
|
585
|
+
let ee = a.get(B);
|
|
586
|
+
ee ? ee.count++ : (ee = {
|
|
587
|
+
title: j,
|
|
588
|
+
leaf: !0,
|
|
589
|
+
checked: l.size ? l.has(j) : !s,
|
|
590
|
+
key: B,
|
|
591
|
+
count: 1
|
|
592
|
+
}, a.set(B, ee), c.set(B, [B]));
|
|
593
|
+
}
|
|
594
|
+
J++;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
const T = t ? s : !0;
|
|
598
|
+
if (p > 0) {
|
|
599
|
+
const R = {
|
|
600
|
+
title: e.t("sheets-filter.panel.empty"),
|
|
601
|
+
count: p,
|
|
602
|
+
leaf: !0,
|
|
603
|
+
checked: T,
|
|
604
|
+
key: v
|
|
605
|
+
};
|
|
606
|
+
a.set("empty", R), c.set("empty", [v]);
|
|
607
|
+
}
|
|
608
|
+
return {
|
|
609
|
+
filterTreeItems: es(Array.from(a.values())),
|
|
610
|
+
filterTreeMapCache: c
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
function es(t) {
|
|
614
|
+
return Array.from(t).sort((e, r) => e.children && !r.children ? -1 : !e.children && r.children ? 1 : ts(e.title, r.title)).map((e) => (e.children && e.children.sort((r, i) => {
|
|
615
|
+
const n = Number.parseInt(r.key.split("-")[1], 10), l = Number.parseInt(i.key.split("-")[1], 10);
|
|
616
|
+
return n - l;
|
|
617
|
+
}).forEach((r) => {
|
|
618
|
+
r.children && r.children.sort((i, n) => {
|
|
619
|
+
const l = Number.parseInt(i.key.split("-")[2], 10), s = Number.parseInt(n.key.split("-")[2], 10);
|
|
620
|
+
return l - s;
|
|
621
|
+
});
|
|
622
|
+
}), e));
|
|
623
|
+
}
|
|
624
|
+
const ut = (t) => !Number.isNaN(Number(t)) && !Number.isNaN(Number.parseFloat(t));
|
|
625
|
+
function ts(t, e) {
|
|
626
|
+
const r = ut(t), i = ut(e);
|
|
627
|
+
return r && i ? Number.parseFloat(t) - Number.parseFloat(e) : r && !i ? -1 : !r && i ? 1 : t.localeCompare(e);
|
|
628
|
+
}
|
|
629
|
+
function xe(t, e) {
|
|
630
|
+
for (const r of t) {
|
|
631
|
+
if (r.key === e)
|
|
632
|
+
return r;
|
|
633
|
+
if (r.children) {
|
|
634
|
+
const i = xe(r.children, e);
|
|
635
|
+
if (i)
|
|
636
|
+
return i;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
return null;
|
|
640
|
+
}
|
|
641
|
+
function wt(t) {
|
|
642
|
+
return t.leaf ? t.checked : t.children ? t.children.every((e) => wt(e)) : !0;
|
|
643
|
+
}
|
|
644
|
+
function he(t, e) {
|
|
645
|
+
t.leaf && (e !== void 0 ? t.checked = e : t.checked = !t.checked), t.children && t.children.forEach((r) => he(r, e));
|
|
646
|
+
}
|
|
647
|
+
function Ut(t, e) {
|
|
648
|
+
const r = [];
|
|
649
|
+
return t.forEach((i) => {
|
|
650
|
+
const n = i.originValues ? e.some(
|
|
651
|
+
(o) => Array.from(i.originValues).some(
|
|
652
|
+
(a) => a.toLowerCase().includes(o.toLowerCase())
|
|
653
|
+
)
|
|
654
|
+
) : !1, l = !n && e.some(
|
|
655
|
+
(o) => i.title.toLowerCase().includes(o.toLowerCase())
|
|
656
|
+
);
|
|
657
|
+
if (n || l)
|
|
658
|
+
r.push({ ...i });
|
|
659
|
+
else if (i.children) {
|
|
660
|
+
const o = Ut(i.children, e);
|
|
661
|
+
if (o.length > 0) {
|
|
662
|
+
const a = o.reduce((c, h) => c + h.count, 0);
|
|
663
|
+
r.push({ ...i, count: a, children: o });
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}), r;
|
|
667
|
+
}
|
|
668
|
+
var rs = Object.getOwnPropertyDescriptor, tt = (t, e, r, i) => {
|
|
669
|
+
for (var n = i > 1 ? void 0 : i ? rs(e, r) : e, l = t.length - 1, s; l >= 0; l--)
|
|
670
|
+
(s = t[l]) && (n = s(n) || n);
|
|
671
|
+
return n;
|
|
672
|
+
}, Pe = (t, e) => (r, i) => e(r, i, t), ye = /* @__PURE__ */ ((t) => (t[t.VALUES = 0] = "VALUES", t[t.CONDITIONS = 1] = "CONDITIONS", t))(ye || {});
|
|
673
|
+
gt("sheets-filter-ui.sheets-filter-panel.service");
|
|
674
|
+
let x = class extends pe {
|
|
675
|
+
constructor(e, r) {
|
|
676
|
+
super();
|
|
677
|
+
f(this, "_filterBy$", new K(
|
|
678
|
+
0
|
|
679
|
+
/* VALUES */
|
|
680
|
+
));
|
|
681
|
+
f(this, "filterBy$", this._filterBy$.asObservable());
|
|
682
|
+
f(this, "_filterByModel$", new Ur(1));
|
|
683
|
+
f(this, "filterByModel$", this._filterByModel$.asObservable());
|
|
684
|
+
f(this, "_filterByModel", null);
|
|
685
|
+
f(this, "_hasCriteria$", new K(!1));
|
|
686
|
+
f(this, "hasCriteria$", this._hasCriteria$.asObservable());
|
|
687
|
+
f(this, "_filterModel", null);
|
|
688
|
+
f(this, "_col$", new K(-1));
|
|
689
|
+
f(this, "col$", this._col$.asObservable());
|
|
690
|
+
f(this, "_filterHeaderListener", null);
|
|
691
|
+
this._injector = e, this._refRangeService = r;
|
|
692
|
+
}
|
|
693
|
+
get filterBy() {
|
|
694
|
+
return this._filterBy$.getValue();
|
|
695
|
+
}
|
|
696
|
+
get filterByModel() {
|
|
697
|
+
return this._filterByModel;
|
|
698
|
+
}
|
|
699
|
+
set filterByModel(e) {
|
|
700
|
+
this._filterByModel = e, this._filterByModel$.next(e);
|
|
701
|
+
}
|
|
702
|
+
get filterModel() {
|
|
703
|
+
return this._filterModel;
|
|
704
|
+
}
|
|
705
|
+
get col() {
|
|
706
|
+
return this._col$.getValue();
|
|
707
|
+
}
|
|
708
|
+
dispose() {
|
|
709
|
+
this._filterBy$.complete(), this._filterByModel$.complete(), this._hasCriteria$.complete();
|
|
710
|
+
}
|
|
711
|
+
setupCol(e, r) {
|
|
712
|
+
this.terminate(), this._filterModel = e, this._col$.next(r);
|
|
713
|
+
const i = e.getFilterColumn(r);
|
|
714
|
+
if (i) {
|
|
715
|
+
const n = i.getColumnData();
|
|
716
|
+
if (n.customFilters) {
|
|
717
|
+
this._hasCriteria$.next(!0), this._setupByConditions(e, r);
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
if (n.filters) {
|
|
721
|
+
this._hasCriteria$.next(!0), this._setupByValues(e, r);
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
this._hasCriteria$.next(!1), this._setupByValues(e, r);
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
this._hasCriteria$.next(!1), this._setupByValues(e, r);
|
|
728
|
+
}
|
|
729
|
+
changeFilterBy(e) {
|
|
730
|
+
return !this._filterModel || this.col === -1 ? !1 : (e === 0 ? this._setupByValues(this._filterModel, this.col) : this._setupByConditions(this._filterModel, this.col), !0);
|
|
731
|
+
}
|
|
732
|
+
terminate() {
|
|
733
|
+
return this._filterModel = null, this._col$.next(-1), this._disposeFilterHeaderChangeListener(), !0;
|
|
734
|
+
}
|
|
735
|
+
_disposeFilterHeaderChangeListener() {
|
|
736
|
+
var e;
|
|
737
|
+
(e = this._filterHeaderListener) == null || e.dispose(), this._filterHeaderListener = null;
|
|
738
|
+
}
|
|
739
|
+
_listenToFilterHeaderChange(e, r) {
|
|
740
|
+
this._disposeFilterHeaderChangeListener();
|
|
741
|
+
const i = e.unitId, n = e.subUnitId, l = e.getRange(), s = {
|
|
742
|
+
startColumn: r,
|
|
743
|
+
startRow: l.startRow,
|
|
744
|
+
endRow: l.startRow,
|
|
745
|
+
endColumn: r
|
|
746
|
+
};
|
|
747
|
+
this._filterHeaderListener = this._refRangeService.watchRange(i, n, s, (o, a) => {
|
|
748
|
+
if (!a)
|
|
749
|
+
this.terminate();
|
|
750
|
+
else {
|
|
751
|
+
const c = a.startColumn - o.startColumn;
|
|
752
|
+
c !== 0 && this._filterByModel.deltaCol(c);
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
async _setupByValues(e, r) {
|
|
757
|
+
this._disposePreviousModel();
|
|
758
|
+
const i = e.getRange();
|
|
759
|
+
if (i.startRow === i.endRow) return !1;
|
|
760
|
+
const n = await Ie.fromFilterColumn(
|
|
761
|
+
this._injector,
|
|
762
|
+
e,
|
|
763
|
+
r
|
|
764
|
+
);
|
|
765
|
+
return this.filterByModel = n, this._filterBy$.next(
|
|
766
|
+
0
|
|
767
|
+
/* VALUES */
|
|
768
|
+
), this._listenToFilterHeaderChange(e, r), !0;
|
|
769
|
+
}
|
|
770
|
+
_setupByConditions(e, r) {
|
|
771
|
+
this._disposePreviousModel();
|
|
772
|
+
const i = e.getRange();
|
|
773
|
+
if (i.startRow === i.endRow) return !1;
|
|
774
|
+
const n = Oe.fromFilterColumn(
|
|
775
|
+
this._injector,
|
|
776
|
+
e,
|
|
777
|
+
r,
|
|
778
|
+
e.getFilterColumn(r)
|
|
779
|
+
);
|
|
780
|
+
return this.filterByModel = n, this._filterBy$.next(
|
|
781
|
+
1
|
|
782
|
+
/* CONDITIONS */
|
|
783
|
+
), this._listenToFilterHeaderChange(e, r), !0;
|
|
784
|
+
}
|
|
785
|
+
_disposePreviousModel() {
|
|
786
|
+
var e;
|
|
787
|
+
(e = this._filterByModel) == null || e.dispose(), this.filterByModel = null;
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
x = tt([
|
|
791
|
+
Pe(0, E(Z)),
|
|
792
|
+
Pe(1, E(lr))
|
|
793
|
+
], x);
|
|
794
|
+
let Oe = class extends pe {
|
|
795
|
+
constructor(e, r, i, n, l) {
|
|
796
|
+
super();
|
|
797
|
+
f(this, "canApply$", _e(!0));
|
|
798
|
+
f(this, "_conditionItem$");
|
|
799
|
+
f(this, "conditionItem$");
|
|
800
|
+
f(this, "_filterConditionFormParams$");
|
|
801
|
+
f(this, "filterConditionFormParams$");
|
|
802
|
+
this._filterModel = e, this.col = r, this._commandService = l, this._conditionItem$ = new K(i), this.conditionItem$ = this._conditionItem$.asObservable(), this._filterConditionFormParams$ = new K(n), this.filterConditionFormParams$ = this._filterConditionFormParams$.asObservable();
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Create a model with targeting filter column. If there is not a filter column, the model would be created with
|
|
806
|
+
* default values.
|
|
807
|
+
*
|
|
808
|
+
* @param injector
|
|
809
|
+
* @param filterModel
|
|
810
|
+
* @param col
|
|
811
|
+
* @param filterColumn
|
|
812
|
+
*
|
|
813
|
+
* @returns the model to control the panel's state
|
|
814
|
+
*/
|
|
815
|
+
static fromFilterColumn(e, r, i, n) {
|
|
816
|
+
const [l, s] = m.testMappingFilterColumn(n == null ? void 0 : n.getColumnData());
|
|
817
|
+
return e.createInstance(Oe, r, i, l, s);
|
|
818
|
+
}
|
|
819
|
+
get conditionItem() {
|
|
820
|
+
return this._conditionItem$.getValue();
|
|
821
|
+
}
|
|
822
|
+
get filterConditionFormParams() {
|
|
823
|
+
return this._filterConditionFormParams$.getValue();
|
|
824
|
+
}
|
|
825
|
+
dispose() {
|
|
826
|
+
super.dispose(), this._conditionItem$.complete(), this._filterConditionFormParams$.complete();
|
|
827
|
+
}
|
|
828
|
+
deltaCol(e) {
|
|
829
|
+
this.col += e;
|
|
830
|
+
}
|
|
831
|
+
clear() {
|
|
832
|
+
return this._disposed ? Promise.resolve(!1) : this._commandService.executeCommand(se.id, {
|
|
833
|
+
unitId: this._filterModel.unitId,
|
|
834
|
+
subUnitId: this._filterModel.subUnitId,
|
|
835
|
+
col: this.col,
|
|
836
|
+
criteria: null
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
/**
|
|
840
|
+
* Apply the filter condition to the target filter column.
|
|
841
|
+
*/
|
|
842
|
+
async apply() {
|
|
843
|
+
if (this._disposed) return !1;
|
|
844
|
+
const e = m.mapToFilterColumn(this.conditionItem, this.filterConditionFormParams);
|
|
845
|
+
return this._commandService.executeCommand(se.id, {
|
|
846
|
+
unitId: this._filterModel.unitId,
|
|
847
|
+
subUnitId: this._filterModel.subUnitId,
|
|
848
|
+
col: this.col,
|
|
849
|
+
criteria: e
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* This method would be called when user changes the primary condition. The model would load the corresponding
|
|
854
|
+
* `IFilterConditionFormParams` and load default condition form params.
|
|
855
|
+
*/
|
|
856
|
+
onPrimaryConditionChange(e) {
|
|
857
|
+
const r = m.ALL_CONDITIONS.find((i) => i.operator === e);
|
|
858
|
+
if (!r)
|
|
859
|
+
throw new Error(`[ByConditionsModel]: condition item not found for operator: ${e}!`);
|
|
860
|
+
this._conditionItem$.next(r), this._filterConditionFormParams$.next(m.getInitialFormParams(e));
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* This method would be called when user changes the primary conditions, the input values or "AND" "OR" ratio.
|
|
864
|
+
* If the primary conditions or the ratio is changed, the method would load the corresponding `IFilterCondition`.
|
|
865
|
+
*
|
|
866
|
+
* When the panel call this method, it only has to pass the changed keys.
|
|
867
|
+
*
|
|
868
|
+
* @param params
|
|
869
|
+
*/
|
|
870
|
+
onConditionFormChange(e) {
|
|
871
|
+
const r = { ...this.filterConditionFormParams, ...e };
|
|
872
|
+
if (r.and !== !0 && delete r.and, typeof e.and < "u" || typeof e.operator1 < "u" || typeof e.operator2 < "u") {
|
|
873
|
+
const i = m.testMappingParams(r, this.conditionItem.numOfParameters);
|
|
874
|
+
this._conditionItem$.next(i);
|
|
875
|
+
}
|
|
876
|
+
this._filterConditionFormParams$.next(r);
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
Oe = tt([
|
|
880
|
+
Pe(4, Q)
|
|
881
|
+
], Oe);
|
|
882
|
+
let Ie = class extends pe {
|
|
883
|
+
constructor(e, r, i, n, l) {
|
|
884
|
+
super();
|
|
885
|
+
f(this, "_rawFilterItems$");
|
|
886
|
+
f(this, "rawFilterItems$");
|
|
887
|
+
f(this, "filterItems$");
|
|
888
|
+
f(this, "_filterItems", []);
|
|
889
|
+
f(this, "_treeMapCache");
|
|
890
|
+
f(this, "canApply$");
|
|
891
|
+
f(this, "_manuallyUpdateFilterItems$");
|
|
892
|
+
f(this, "_searchString$");
|
|
893
|
+
f(this, "searchString$");
|
|
894
|
+
this._filterModel = e, this.col = r, this._commandService = l, this._treeMapCache = n, this._searchString$ = new K(""), this.searchString$ = this._searchString$.asObservable(), this._rawFilterItems$ = new K(i), this.rawFilterItems$ = this._rawFilterItems$.asObservable(), this._manuallyUpdateFilterItems$ = new Hr(), this.filterItems$ = Dr(
|
|
895
|
+
kr([
|
|
896
|
+
this._searchString$.pipe(
|
|
897
|
+
Ot(500, void 0, { leading: !0, trailing: !0 }),
|
|
898
|
+
It(void 0)
|
|
899
|
+
),
|
|
900
|
+
this._rawFilterItems$
|
|
901
|
+
]).pipe(
|
|
902
|
+
ie(([s, o]) => {
|
|
903
|
+
if (!s) return o;
|
|
904
|
+
const c = s.toLowerCase().split(/\s+/).filter((h) => !!h);
|
|
905
|
+
return Ut(o, c);
|
|
906
|
+
})
|
|
907
|
+
),
|
|
908
|
+
this._manuallyUpdateFilterItems$
|
|
909
|
+
).pipe(Br(1)), this.canApply$ = this.filterItems$.pipe(ie((s) => Ve(s).checked > 0)), this.disposeWithMe(this.filterItems$.subscribe((s) => this._filterItems = s));
|
|
910
|
+
}
|
|
911
|
+
/**
|
|
912
|
+
* Create a model with targeting filter column. If there is not a filter column, the model would be created with
|
|
913
|
+
* default values.
|
|
914
|
+
*
|
|
915
|
+
* @param injector
|
|
916
|
+
* @param filterModel
|
|
917
|
+
* @param col
|
|
918
|
+
*
|
|
919
|
+
* @returns the model to control the panel's state
|
|
920
|
+
*/
|
|
921
|
+
static async fromFilterColumn(e, r, i) {
|
|
922
|
+
var $;
|
|
923
|
+
const n = e.get(je), l = e.get(X), s = e.get(Ne, vt.OPTIONAL), { unitId: o, subUnitId: a } = r, c = n.getUniverSheetInstance(o);
|
|
924
|
+
if (!c) throw new Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${o}!`);
|
|
925
|
+
const h = c == null ? void 0 : c.getSheetBySheetId(a);
|
|
926
|
+
if (!h) throw new Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${o} and subUnitId: ${a}!`);
|
|
927
|
+
const d = r.getRange(), v = i, p = ($ = r.getFilterColumn(i)) == null ? void 0 : $.getColumnData().filters, T = new Set(p == null ? void 0 : p.filters), g = !!(p && p.blank), N = r.getFilteredOutRowsExceptCol(i), F = { ...d, startRow: d.startRow + 1, startColumn: v, endColumn: v };
|
|
928
|
+
let I, y;
|
|
929
|
+
if (s) {
|
|
930
|
+
const w = await s.getFilterValues({
|
|
931
|
+
unitId: o,
|
|
932
|
+
subUnitId: a,
|
|
933
|
+
filteredOutRowsByOtherColumns: Array.from(N),
|
|
934
|
+
filters: !!p,
|
|
935
|
+
blankChecked: g,
|
|
936
|
+
iterateRange: F,
|
|
937
|
+
alreadyChecked: Array.from(T)
|
|
938
|
+
});
|
|
939
|
+
I = w.filterTreeItems, y = w.filterTreeMapCache;
|
|
940
|
+
} else {
|
|
941
|
+
const w = $t(!!p, l, F, h, N, T, g, c.getStyles());
|
|
942
|
+
I = w.filterTreeItems, y = w.filterTreeMapCache;
|
|
943
|
+
}
|
|
944
|
+
return e.createInstance(Ie, r, i, I, y);
|
|
945
|
+
}
|
|
946
|
+
get rawFilterItems() {
|
|
947
|
+
return this._rawFilterItems$.getValue();
|
|
948
|
+
}
|
|
949
|
+
get filterItems() {
|
|
950
|
+
return this._filterItems;
|
|
951
|
+
}
|
|
952
|
+
get treeMapCache() {
|
|
953
|
+
return this._treeMapCache;
|
|
954
|
+
}
|
|
955
|
+
dispose() {
|
|
956
|
+
this._rawFilterItems$.complete(), this._searchString$.complete();
|
|
957
|
+
}
|
|
958
|
+
deltaCol(e) {
|
|
959
|
+
this.col += e;
|
|
960
|
+
}
|
|
961
|
+
setSearchString(e) {
|
|
962
|
+
this._searchString$.next(e);
|
|
963
|
+
}
|
|
964
|
+
onCheckAllToggled(e) {
|
|
965
|
+
const r = Fe.deepClone(this._filterItems);
|
|
966
|
+
r.forEach((i) => he(i, e)), this._manuallyUpdateFilterItems(r);
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Toggle a filter item.
|
|
970
|
+
*/
|
|
971
|
+
onFilterCheckToggled(e) {
|
|
972
|
+
const r = Fe.deepClone(this._filterItems), i = xe(r, e.key);
|
|
973
|
+
if (!i)
|
|
974
|
+
return;
|
|
975
|
+
const n = wt(i);
|
|
976
|
+
he(i, !n), this._manuallyUpdateFilterItems(r);
|
|
977
|
+
}
|
|
978
|
+
onFilterOnly(e) {
|
|
979
|
+
const r = Fe.deepClone(this._filterItems);
|
|
980
|
+
r.forEach((i) => he(i, !1)), e.forEach((i) => {
|
|
981
|
+
const n = xe(r, i);
|
|
982
|
+
n && he(n, !0);
|
|
983
|
+
}), this._manuallyUpdateFilterItems(r);
|
|
984
|
+
}
|
|
985
|
+
_manuallyUpdateFilterItems(e) {
|
|
986
|
+
this._manuallyUpdateFilterItems$.next(e);
|
|
987
|
+
}
|
|
988
|
+
// expose method here to let the panel change filter items
|
|
989
|
+
// #region ByValuesModel apply methods
|
|
990
|
+
clear() {
|
|
991
|
+
return this._disposed ? Promise.resolve(!1) : this._commandService.executeCommand(se.id, {
|
|
992
|
+
unitId: this._filterModel.unitId,
|
|
993
|
+
subUnitId: this._filterModel.subUnitId,
|
|
994
|
+
col: this.col,
|
|
995
|
+
criteria: null
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Apply the filter condition to the target filter column.
|
|
1000
|
+
*/
|
|
1001
|
+
async apply() {
|
|
1002
|
+
if (this._disposed)
|
|
1003
|
+
return !1;
|
|
1004
|
+
const e = Ve(this._filterItems), { checked: r, checkedItems: i } = e, n = this.rawFilterItems;
|
|
1005
|
+
let l = 0;
|
|
1006
|
+
for (const c of n)
|
|
1007
|
+
l += c.count;
|
|
1008
|
+
const s = r === 0, o = e.checked === l, a = { colId: this.col };
|
|
1009
|
+
if (s)
|
|
1010
|
+
throw new Error("[ByValuesModel]: no checked items!");
|
|
1011
|
+
if (o)
|
|
1012
|
+
return this._commandService.executeCommand(se.id, {
|
|
1013
|
+
unitId: this._filterModel.unitId,
|
|
1014
|
+
subUnitId: this._filterModel.subUnitId,
|
|
1015
|
+
col: this.col,
|
|
1016
|
+
criteria: null
|
|
1017
|
+
});
|
|
1018
|
+
{
|
|
1019
|
+
a.filters = {};
|
|
1020
|
+
const c = i.filter((d) => d.key !== "empty");
|
|
1021
|
+
c.length > 0 && (a.filters = {
|
|
1022
|
+
filters: c.flatMap((d) => d.originValues ? Array.from(d.originValues) : [d.title])
|
|
1023
|
+
}), c.length !== i.length && (a.filters.blank = !0);
|
|
1024
|
+
}
|
|
1025
|
+
return this._commandService.executeCommand(se.id, {
|
|
1026
|
+
unitId: this._filterModel.unitId,
|
|
1027
|
+
subUnitId: this._filterModel.subUnitId,
|
|
1028
|
+
col: this.col,
|
|
1029
|
+
criteria: a
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
// #endregion
|
|
1033
|
+
};
|
|
1034
|
+
Ie = tt([
|
|
1035
|
+
Pe(4, Q)
|
|
1036
|
+
], Ie);
|
|
1037
|
+
const ne = "FILTER_PANEL_OPENED", Re = {
|
|
1038
|
+
id: "sheet.operation.open-filter-panel",
|
|
1039
|
+
type: Me.OPERATION,
|
|
1040
|
+
handler: (t, e) => {
|
|
1041
|
+
const r = t.get($e), i = t.get(G), n = t.get(x);
|
|
1042
|
+
t.get(Q).syncExecuteCommand(Pr.id, { visible: !1 });
|
|
1043
|
+
const { unitId: s, subUnitId: o, col: a } = e, c = i.getFilterModel(s, o);
|
|
1044
|
+
return c ? (n.setupCol(c, a), r.getContextValue(ne) || r.setContextValue(ne, !0), !0) : !1;
|
|
1045
|
+
}
|
|
1046
|
+
}, me = {
|
|
1047
|
+
id: "sheet.operation.close-filter-panel",
|
|
1048
|
+
type: Me.OPERATION,
|
|
1049
|
+
handler: (t) => {
|
|
1050
|
+
const e = t.get($e), r = t.get(x), i = t.get(_r, vt.OPTIONAL);
|
|
1051
|
+
return e.getContextValue(ne) ? (e.setContextValue(ne, !1), i == null || i.focus(), r.terminate()) : !1;
|
|
1052
|
+
}
|
|
1053
|
+
}, Ht = {
|
|
1054
|
+
id: "sheet.operation.apply-filter",
|
|
1055
|
+
type: Me.OPERATION,
|
|
1056
|
+
handler: (t, e) => {
|
|
1057
|
+
const { filterBy: r } = e;
|
|
1058
|
+
return t.get(x).changeFilterBy(r);
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
var ss = Object.getOwnPropertyDescriptor, is = (t, e, r, i) => {
|
|
1062
|
+
for (var n = i > 1 ? void 0 : i ? ss(e, r) : e, l = t.length - 1, s; l >= 0; l--)
|
|
1063
|
+
(s = t[l]) && (n = s(n) || n);
|
|
1064
|
+
return n;
|
|
1065
|
+
}, te = (t, e) => (r, i) => e(r, i, t);
|
|
1066
|
+
let oe = class extends pe {
|
|
1067
|
+
constructor(t, e, r, i, n, l) {
|
|
1068
|
+
super(), this._sheetsFilterService = t, this._localeService = e, this._commandService = r, this._sheetPermissionCheckPermission = i, this._injector = n, this._sheetsSelectionService = l, this._commandExecutedListener();
|
|
1069
|
+
}
|
|
1070
|
+
_commandExecutedListener() {
|
|
1071
|
+
this.disposeWithMe(
|
|
1072
|
+
this._commandService.beforeCommandExecuted((t) => {
|
|
1073
|
+
var e, r, i;
|
|
1074
|
+
if (t.id === fe.id) {
|
|
1075
|
+
const n = this._injector.get(je), l = hr(n);
|
|
1076
|
+
if (!l) return;
|
|
1077
|
+
const { unitId: s, subUnitId: o, worksheet: a } = l, c = (e = this._sheetsFilterService.getFilterModel(s, o)) == null ? void 0 : e.getRange();
|
|
1078
|
+
let h;
|
|
1079
|
+
if (c)
|
|
1080
|
+
h = this._sheetPermissionCheckPermission.permissionCheckWithRanges({
|
|
1081
|
+
rangeTypes: [ue],
|
|
1082
|
+
worksheetTypes: [le, ce]
|
|
1083
|
+
}, [c]);
|
|
1084
|
+
else {
|
|
1085
|
+
const d = (r = this._sheetsSelectionService.getCurrentLastSelection()) == null ? void 0 : r.range;
|
|
1086
|
+
if (d) {
|
|
1087
|
+
let v = { ...d };
|
|
1088
|
+
v = d.startColumn === d.endColumn && d.startRow === d.endRow ? mr(v, { left: !0, right: !0, up: !0, down: !0 }, a) : v, h = this._sheetPermissionCheckPermission.permissionCheckWithRanges({
|
|
1089
|
+
rangeTypes: [ue],
|
|
1090
|
+
worksheetTypes: [ce, le]
|
|
1091
|
+
}, [v], s, o);
|
|
1092
|
+
} else
|
|
1093
|
+
h = this._sheetPermissionCheckPermission.permissionCheckWithoutRange({
|
|
1094
|
+
rangeTypes: [ue],
|
|
1095
|
+
worksheetTypes: [ce, le]
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
h || this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr"));
|
|
1099
|
+
}
|
|
1100
|
+
if (t.id === Re.id) {
|
|
1101
|
+
const n = t.params, { unitId: l, subUnitId: s } = n, o = (i = this._sheetsFilterService.getFilterModel(l, s)) == null ? void 0 : i.getRange(), a = Fe.deepClone(o);
|
|
1102
|
+
a && (a.startColumn = n.col, a.endColumn = n.col, this._sheetPermissionCheckPermission.permissionCheckWithRanges({
|
|
1103
|
+
rangeTypes: [ue],
|
|
1104
|
+
worksheetTypes: [le, ce]
|
|
1105
|
+
}, [a]) || this._sheetPermissionCheckPermission.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.filterErr")));
|
|
1106
|
+
}
|
|
1107
|
+
})
|
|
1108
|
+
);
|
|
1109
|
+
}
|
|
1110
|
+
};
|
|
1111
|
+
oe = is([
|
|
1112
|
+
te(0, E(G)),
|
|
1113
|
+
te(1, E(X)),
|
|
1114
|
+
te(2, Q),
|
|
1115
|
+
te(3, E(cr)),
|
|
1116
|
+
te(4, E(Z)),
|
|
1117
|
+
te(5, E(ur))
|
|
1118
|
+
], oe);
|
|
1119
|
+
var b = function() {
|
|
1120
|
+
return b = Object.assign || function(t) {
|
|
1121
|
+
for (var e, r = 1, i = arguments.length; r < i; r++) {
|
|
1122
|
+
e = arguments[r];
|
|
1123
|
+
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]);
|
|
1124
|
+
}
|
|
1125
|
+
return t;
|
|
1126
|
+
}, b.apply(this, arguments);
|
|
1127
|
+
}, ns = function(t, e) {
|
|
1128
|
+
var r = {};
|
|
1129
|
+
for (var i in t) Object.prototype.hasOwnProperty.call(t, i) && e.indexOf(i) < 0 && (r[i] = t[i]);
|
|
1130
|
+
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
1131
|
+
for (var n = 0, i = Object.getOwnPropertySymbols(t); n < i.length; n++)
|
|
1132
|
+
e.indexOf(i[n]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[n]) && (r[i[n]] = t[i[n]]);
|
|
1133
|
+
return r;
|
|
1134
|
+
}, Dt = bt(function(t, e) {
|
|
1135
|
+
var r = t.icon, i = t.id, n = t.className, l = t.extend, s = ns(t, ["icon", "id", "className", "extend"]), o = "univerjs-icon univerjs-icon-".concat(i, " ").concat(n || "").trim(), a = Xr("_".concat(ls()));
|
|
1136
|
+
return kt(r, "".concat(i), { defIds: r.defIds, idSuffix: a.current }, b({ ref: e, className: o }, s), l);
|
|
1137
|
+
});
|
|
1138
|
+
function kt(t, e, r, i, n) {
|
|
1139
|
+
return Lt(t.tag, b(b({ key: e }, os(t, r, n)), i), (as(t, r).children || []).map(function(l, s) {
|
|
1140
|
+
return kt(l, "".concat(e, "-").concat(t.tag, "-").concat(s), r, void 0, n);
|
|
1141
|
+
}));
|
|
1142
|
+
}
|
|
1143
|
+
function os(t, e, r) {
|
|
1144
|
+
var i = b({}, t.attrs);
|
|
1145
|
+
r != null && r.colorChannel1 && i.fill === "colorChannel1" && (i.fill = r.colorChannel1), t.tag === "mask" && i.id && (i.id = i.id + e.idSuffix), Object.entries(i).forEach(function(l) {
|
|
1146
|
+
var s = l[0], o = l[1];
|
|
1147
|
+
s === "mask" && typeof o == "string" && (i[s] = o.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
1148
|
+
});
|
|
1149
|
+
var n = e.defIds;
|
|
1150
|
+
return !n || n.length === 0 || (t.tag === "use" && i["xlink:href"] && (i["xlink:href"] = i["xlink:href"] + e.idSuffix), Object.entries(i).forEach(function(l) {
|
|
1151
|
+
var s = l[0], o = l[1];
|
|
1152
|
+
typeof o == "string" && (i[s] = o.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
|
|
1153
|
+
})), i;
|
|
1154
|
+
}
|
|
1155
|
+
function as(t, e) {
|
|
1156
|
+
var r, i = e.defIds;
|
|
1157
|
+
return !i || i.length === 0 ? t : t.tag === "defs" && (!((r = t.children) === null || r === void 0) && r.length) ? b(b({}, t), { children: t.children.map(function(n) {
|
|
1158
|
+
return typeof n.attrs.id == "string" && i && i.indexOf(n.attrs.id) > -1 ? b(b({}, n), { attrs: b(b({}, n.attrs), { id: n.attrs.id + e.idSuffix }) }) : n;
|
|
1159
|
+
}) }) : t;
|
|
1160
|
+
}
|
|
1161
|
+
function ls() {
|
|
1162
|
+
return Math.random().toString(36).substring(2, 8);
|
|
1163
|
+
}
|
|
1164
|
+
Dt.displayName = "UniverIcon";
|
|
1165
|
+
var cs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", 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", fillRule: "evenodd", clipRule: "evenodd" } }] }, Bt = bt(function(t, e) {
|
|
1166
|
+
return Lt(Dt, Object.assign({}, t, {
|
|
1167
|
+
id: "filter-single",
|
|
1168
|
+
ref: e,
|
|
1169
|
+
icon: cs
|
|
1170
|
+
}));
|
|
1171
|
+
});
|
|
1172
|
+
Bt.displayName = "FilterSingle";
|
|
1173
|
+
const us = "univer-sheets-filter-panel", hs = "univer-sheets-filter-panel-header", ms = "univer-sheets-filter-panel-content", ds = "univer-sheets-filter-panel-values-container", ps = "univer-sheets-filter-panel-values-virtual", fs = "univer-sheets-filter-panel-values-item", _s = "univer-sheets-filter-panel-values-item-inner", gs = "univer-sheets-filter-panel-values-item-count", vs = "univer-sheets-filter-panel-values-item-text", Ss = "univer-sheets-filter-panel-conditions-container", Es = "univer-sheets-filter-panel-conditions-container-inner", Ts = "univer-sheets-filter-panel-conditions-desc", Fs = "univer-sheets-filter-panel-footer", Cs = "univer-sheets-filter-panel-footer-primary-buttons", O = {
|
|
1174
|
+
sheetsFilterPanel: us,
|
|
1175
|
+
sheetsFilterPanelHeader: hs,
|
|
1176
|
+
sheetsFilterPanelContent: ms,
|
|
1177
|
+
sheetsFilterPanelValuesContainer: ds,
|
|
1178
|
+
sheetsFilterPanelValuesVirtual: ps,
|
|
1179
|
+
sheetsFilterPanelValuesItem: fs,
|
|
1180
|
+
sheetsFilterPanelValuesItemInner: _s,
|
|
1181
|
+
sheetsFilterPanelValuesItemCount: gs,
|
|
1182
|
+
sheetsFilterPanelValuesItemText: vs,
|
|
1183
|
+
sheetsFilterPanelConditionsContainer: Ss,
|
|
1184
|
+
sheetsFilterPanelConditionsContainerInner: Es,
|
|
1185
|
+
sheetsFilterPanelConditionsDesc: Ts,
|
|
1186
|
+
sheetsFilterPanelFooter: Fs,
|
|
1187
|
+
sheetsFilterPanelFooterPrimaryButtons: Cs
|
|
1188
|
+
};
|
|
1189
|
+
function Ns(t) {
|
|
1190
|
+
var p, T;
|
|
1191
|
+
const { model: e } = t, r = re(X), i = W(e.conditionItem$, void 0), n = W(e.filterConditionFormParams$, void 0), l = n != null && n.and ? "AND" : "OR", s = k((g) => {
|
|
1192
|
+
e.onConditionFormChange({ and: g === "AND" });
|
|
1193
|
+
}, [e]), o = Ps(r), a = k((g) => {
|
|
1194
|
+
e.onPrimaryConditionChange(g);
|
|
1195
|
+
}, [e]), c = ys(r), h = k((g) => {
|
|
1196
|
+
e.onConditionFormChange(g);
|
|
1197
|
+
}, [e]), d = r.t("sheets-filter.panel.input-values-placeholder");
|
|
1198
|
+
function v(g, N, F) {
|
|
1199
|
+
const I = m.getItemByOperator(g).numOfParameters === 1;
|
|
1200
|
+
return /* @__PURE__ */ L(ct, { children: [
|
|
1201
|
+
F === "operator2" && /* @__PURE__ */ L(Qr, { value: l, onChange: s, children: [
|
|
1202
|
+
/* @__PURE__ */ S(at, { value: "AND", children: r.t("sheets-filter.panel.and") }),
|
|
1203
|
+
/* @__PURE__ */ S(at, { value: "OR", children: r.t("sheets-filter.panel.or") })
|
|
1204
|
+
] }),
|
|
1205
|
+
/* @__PURE__ */ S(ot, { value: g, options: c, onChange: (y) => h({ [F]: y }) }),
|
|
1206
|
+
I && /* @__PURE__ */ S("div", { children: /* @__PURE__ */ S(Rt, { value: N, placeholder: d, onChange: (y) => h({ [F === "operator1" ? "val1" : "val2"]: y }) }) })
|
|
1207
|
+
] });
|
|
1208
|
+
}
|
|
1209
|
+
return /* @__PURE__ */ S("div", { className: O.sheetsFilterPanelConditionsContainer, children: i && n && /* @__PURE__ */ L(ct, { children: [
|
|
1210
|
+
/* @__PURE__ */ S(ot, { value: i.operator, options: o, onChange: a }),
|
|
1211
|
+
m.getItemByOperator(i.operator).numOfParameters !== 0 ? /* @__PURE__ */ L("div", { className: O.sheetsFilterPanelConditionsContainerInner, children: [
|
|
1212
|
+
i.numOfParameters >= 1 && v(n.operator1, (p = n.val1) != null ? p : "", "operator1"),
|
|
1213
|
+
i.numOfParameters >= 2 && v(n.operator2, (T = n.val2) != null ? T : "", "operator2"),
|
|
1214
|
+
/* @__PURE__ */ L("div", { className: O.sheetsFilterPanelConditionsDesc, children: [
|
|
1215
|
+
r.t("sheets-filter.panel.?"),
|
|
1216
|
+
/* @__PURE__ */ S("br", {}),
|
|
1217
|
+
r.t("sheets-filter.panel.*")
|
|
1218
|
+
] })
|
|
1219
|
+
] }) : null
|
|
1220
|
+
] }) });
|
|
1221
|
+
}
|
|
1222
|
+
function Ps(t) {
|
|
1223
|
+
const e = t.getCurrentLocale();
|
|
1224
|
+
return Je(
|
|
1225
|
+
() => [
|
|
1226
|
+
{
|
|
1227
|
+
options: [
|
|
1228
|
+
{ label: t.t(m.NONE.label), value: m.NONE.operator }
|
|
1229
|
+
]
|
|
1230
|
+
},
|
|
1231
|
+
{
|
|
1232
|
+
options: [
|
|
1233
|
+
{ label: t.t(m.EMPTY.label), value: m.EMPTY.operator },
|
|
1234
|
+
{ label: t.t(m.NOT_EMPTY.label), value: m.NOT_EMPTY.operator }
|
|
1235
|
+
]
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
options: [
|
|
1239
|
+
{ label: t.t(m.TEXT_CONTAINS.label), value: m.TEXT_CONTAINS.operator },
|
|
1240
|
+
{ label: t.t(m.DOES_NOT_CONTAIN.label), value: m.DOES_NOT_CONTAIN.operator },
|
|
1241
|
+
{ label: t.t(m.STARTS_WITH.label), value: m.STARTS_WITH.operator },
|
|
1242
|
+
{ label: t.t(m.ENDS_WITH.label), value: m.ENDS_WITH.operator },
|
|
1243
|
+
{ label: t.t(m.EQUALS.label), value: m.EQUALS.operator }
|
|
1244
|
+
]
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
options: [
|
|
1248
|
+
{ label: t.t(m.GREATER_THAN.label), value: m.GREATER_THAN.operator },
|
|
1249
|
+
{ label: t.t(m.GREATER_THAN_OR_EQUAL.label), value: m.GREATER_THAN_OR_EQUAL.operator },
|
|
1250
|
+
{ label: t.t(m.LESS_THAN.label), value: m.LESS_THAN.operator },
|
|
1251
|
+
{ label: t.t(m.LESS_THAN_OR_EQUAL.label), value: m.LESS_THAN_OR_EQUAL.operator },
|
|
1252
|
+
{ label: t.t(m.EQUAL.label), value: m.EQUAL.operator },
|
|
1253
|
+
{ label: t.t(m.NOT_EQUAL.label), value: m.NOT_EQUAL.operator },
|
|
1254
|
+
{ label: t.t(m.BETWEEN.label), value: m.BETWEEN.operator },
|
|
1255
|
+
{ label: t.t(m.NOT_BETWEEN.label), value: m.NOT_BETWEEN.operator }
|
|
1256
|
+
]
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
options: [
|
|
1260
|
+
{ label: t.t(m.CUSTOM.label), value: m.CUSTOM.operator }
|
|
1261
|
+
]
|
|
1262
|
+
}
|
|
1263
|
+
],
|
|
1264
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1265
|
+
[e, t]
|
|
1266
|
+
);
|
|
1267
|
+
}
|
|
1268
|
+
function ys(t) {
|
|
1269
|
+
const e = t.getCurrentLocale();
|
|
1270
|
+
return Je(
|
|
1271
|
+
() => m.ALL_CONDITIONS.filter((r) => r.numOfParameters !== 2).map((r) => ({ label: t.t(r.label), value: r.operator })),
|
|
1272
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1273
|
+
[e, t]
|
|
1274
|
+
);
|
|
1275
|
+
}
|
|
1276
|
+
function Os(t) {
|
|
1277
|
+
const { model: e } = t, r = re(X), i = W(e.searchString$, "", !0), n = W(e.filterItems$, void 0, !0), l = r.t("sheets-filter.panel.filter-only"), s = Ve(n), o = s.checked > 0 && s.unchecked === 0, a = s.checked > 0 && s.unchecked > 0, c = e.treeMapCache, h = k(() => {
|
|
1278
|
+
e.onCheckAllToggled(!o);
|
|
1279
|
+
}, [e, o]), d = k((p) => {
|
|
1280
|
+
e.setSearchString(p);
|
|
1281
|
+
}, [e]);
|
|
1282
|
+
function v(p) {
|
|
1283
|
+
let T = [];
|
|
1284
|
+
return p.forEach((g) => {
|
|
1285
|
+
g.checked && T.push(g.key), g.children && (T = T.concat(v(g.children)));
|
|
1286
|
+
}), T;
|
|
1287
|
+
}
|
|
1288
|
+
return /* @__PURE__ */ L("div", { className: O.sheetsFilterPanelValuesContainer, children: [
|
|
1289
|
+
/* @__PURE__ */ S(
|
|
1290
|
+
Rt,
|
|
1291
|
+
{
|
|
1292
|
+
autoFocus: !0,
|
|
1293
|
+
value: i,
|
|
1294
|
+
placeholder: r.t("sheets-filter.panel.search-placeholder"),
|
|
1295
|
+
onChange: d
|
|
1296
|
+
}
|
|
1297
|
+
),
|
|
1298
|
+
/* @__PURE__ */ L(
|
|
1299
|
+
"div",
|
|
1300
|
+
{
|
|
1301
|
+
className: `
|
|
1302
|
+
univer-mt-2 univer-box-border univer-flex univer-flex-grow univer-flex-col univer-overflow-hidden
|
|
1303
|
+
univer-rounded-md univer-border univer-border-solid univer-border-gray-200 univer-px-2 univer-py-2.5
|
|
1304
|
+
`,
|
|
1305
|
+
children: [
|
|
1306
|
+
/* @__PURE__ */ S("div", { className: O.sheetsFilterPanelValuesItem, children: /* @__PURE__ */ L("div", { className: O.sheetsFilterPanelValuesItemInner, children: [
|
|
1307
|
+
/* @__PURE__ */ S(
|
|
1308
|
+
Gr,
|
|
1309
|
+
{
|
|
1310
|
+
indeterminate: a,
|
|
1311
|
+
disabled: n.length === 0,
|
|
1312
|
+
checked: o,
|
|
1313
|
+
onChange: h
|
|
1314
|
+
}
|
|
1315
|
+
),
|
|
1316
|
+
/* @__PURE__ */ S("span", { className: O.sheetsFilterPanelValuesItemText, children: `${r.t("sheets-filter.panel.select-all")}` }),
|
|
1317
|
+
/* @__PURE__ */ S("span", { className: O.sheetsFilterPanelValuesItemCount, children: `(${s.checked}/${s.checked + s.unchecked})` })
|
|
1318
|
+
] }) }),
|
|
1319
|
+
/* @__PURE__ */ S("div", { className: O.sheetsFilterPanelValuesVirtual, children: /* @__PURE__ */ S(
|
|
1320
|
+
jr,
|
|
1321
|
+
{
|
|
1322
|
+
data: n,
|
|
1323
|
+
defaultExpandAll: !1,
|
|
1324
|
+
valueGroup: v(n),
|
|
1325
|
+
height: 180,
|
|
1326
|
+
onChange: (p) => {
|
|
1327
|
+
e.onFilterCheckToggled(p);
|
|
1328
|
+
},
|
|
1329
|
+
defaultCache: c,
|
|
1330
|
+
itemHeight: 28,
|
|
1331
|
+
treeNodeClassName: `
|
|
1332
|
+
univer-pr-2 univer-border-box univer-max-w-[245px] univer-rounded-md
|
|
1333
|
+
[&:hover_a]:univer-inline-block
|
|
1334
|
+
hover:univer-bg-gray-50 univer-h-full
|
|
1335
|
+
`,
|
|
1336
|
+
attachRender: (p) => /* @__PURE__ */ L(
|
|
1337
|
+
"div",
|
|
1338
|
+
{
|
|
1339
|
+
className: `
|
|
1340
|
+
univer-ml-1 univer-flex univer-h-5 univer-flex-1 univer-cursor-pointer
|
|
1341
|
+
univer-items-center univer-justify-between univer-text-[13px] univer-text-primary-500
|
|
1342
|
+
`,
|
|
1343
|
+
children: [
|
|
1344
|
+
/* @__PURE__ */ S("span", { className: O.sheetsFilterPanelValuesItemCount, children: `(${p.count})` }),
|
|
1345
|
+
/* @__PURE__ */ S(
|
|
1346
|
+
"a",
|
|
1347
|
+
{
|
|
1348
|
+
className: `
|
|
1349
|
+
univer-box-border univer-hidden univer-h-4 univer-whitespace-nowrap univer-px-1.5
|
|
1350
|
+
`,
|
|
1351
|
+
onClick: () => {
|
|
1352
|
+
const T = [];
|
|
1353
|
+
p.children ? p.children.forEach((g) => {
|
|
1354
|
+
g.children ? g.children.forEach((N) => {
|
|
1355
|
+
T.push(N.key);
|
|
1356
|
+
}) : T.push(g.key);
|
|
1357
|
+
}) : T.push(p.key), e.onFilterOnly(T);
|
|
1358
|
+
},
|
|
1359
|
+
children: l
|
|
1360
|
+
}
|
|
1361
|
+
)
|
|
1362
|
+
]
|
|
1363
|
+
}
|
|
1364
|
+
)
|
|
1365
|
+
}
|
|
1366
|
+
) })
|
|
1367
|
+
]
|
|
1368
|
+
}
|
|
1369
|
+
)
|
|
1370
|
+
] });
|
|
1371
|
+
}
|
|
1372
|
+
function Is() {
|
|
1373
|
+
var N;
|
|
1374
|
+
const t = re(x), e = re(X), r = re(Q), i = W(t.filterBy$, void 0, !0), n = W(t.filterByModel$, void 0, !1), l = W(() => (n == null ? void 0 : n.canApply$) || _e(!1), void 0, !1, [n]), s = Rs(e), o = !W(t.hasCriteria$), a = k((F) => {
|
|
1375
|
+
r.executeCommand(Ht.id, { filterBy: F });
|
|
1376
|
+
}, [r]), c = k(async () => {
|
|
1377
|
+
await (n == null ? void 0 : n.clear()), r.executeCommand(me.id);
|
|
1378
|
+
}, [n, r]), h = k(() => {
|
|
1379
|
+
r.executeCommand(me.id);
|
|
1380
|
+
}, [r]), d = k(async () => {
|
|
1381
|
+
await (n == null ? void 0 : n.apply()), r.executeCommand(me.id);
|
|
1382
|
+
}, [n, r]), p = (N = re(G).activeFilterModel) == null ? void 0 : N.getRange(), T = t.col, g = gr(yr.FILTER_PANEL_EMBED_POINT);
|
|
1383
|
+
return /* @__PURE__ */ L("div", { className: O.sheetsFilterPanel, children: [
|
|
1384
|
+
/* @__PURE__ */ S(
|
|
1385
|
+
vr,
|
|
1386
|
+
{
|
|
1387
|
+
components: g,
|
|
1388
|
+
sharedProps: { range: p, colIndex: T, onClose: h }
|
|
1389
|
+
}
|
|
1390
|
+
),
|
|
1391
|
+
/* @__PURE__ */ S("div", { className: O.sheetsFilterPanelHeader, children: /* @__PURE__ */ S(
|
|
1392
|
+
Yr,
|
|
1393
|
+
{
|
|
1394
|
+
value: i,
|
|
1395
|
+
items: s,
|
|
1396
|
+
onChange: (F) => a(F)
|
|
1397
|
+
}
|
|
1398
|
+
) }),
|
|
1399
|
+
n ? /* @__PURE__ */ S("div", { className: O.sheetsFilterPanelContent, children: i === ye.VALUES ? /* @__PURE__ */ S(Os, { model: n }) : /* @__PURE__ */ S(Ns, { model: n }) }) : /* @__PURE__ */ S("div", { style: { flex: 1 } }),
|
|
1400
|
+
/* @__PURE__ */ L("div", { className: O.sheetsFilterPanelFooter, children: [
|
|
1401
|
+
/* @__PURE__ */ S(He, { type: "link", onClick: c, disabled: o, children: e.t("sheets-filter.panel.clear-filter") }),
|
|
1402
|
+
/* @__PURE__ */ L("span", { className: O.sheetsFilterPanelFooterPrimaryButtons, children: [
|
|
1403
|
+
/* @__PURE__ */ S(He, { type: "default", onClick: h, children: e.t("sheets-filter.panel.cancel") }),
|
|
1404
|
+
/* @__PURE__ */ S(He, { disabled: !l, type: "primary", onClick: d, children: e.t("sheets-filter.panel.confirm") })
|
|
1405
|
+
] })
|
|
1406
|
+
] })
|
|
1407
|
+
] });
|
|
1408
|
+
}
|
|
1409
|
+
function Rs(t) {
|
|
1410
|
+
const e = t.getCurrentLocale();
|
|
1411
|
+
return Je(() => [
|
|
1412
|
+
{ label: t.t("sheets-filter.panel.by-values"), value: ye.VALUES },
|
|
1413
|
+
{ label: t.t("sheets-filter.panel.by-conditions"), value: ye.CONDITIONS }
|
|
1414
|
+
], [e, t]);
|
|
1415
|
+
}
|
|
1416
|
+
function As(t) {
|
|
1417
|
+
const e = t.get(G);
|
|
1418
|
+
return {
|
|
1419
|
+
id: fe.id,
|
|
1420
|
+
type: Ze.BUTTON_SELECTOR,
|
|
1421
|
+
icon: "FilterSingle",
|
|
1422
|
+
tooltip: "sheets-filter.toolbar.smart-toggle-filter-tooltip",
|
|
1423
|
+
hidden$: Xe(t, z.UNIVER_SHEET),
|
|
1424
|
+
activated$: e.activeFilterModel$.pipe(ie((r) => !!r)),
|
|
1425
|
+
disabled$: Or(t, Ir(t, { worksheetTypes: [le, ce], rangeTypes: [ue] }))
|
|
1426
|
+
};
|
|
1427
|
+
}
|
|
1428
|
+
function bs(t) {
|
|
1429
|
+
const e = t.get(G);
|
|
1430
|
+
return {
|
|
1431
|
+
id: Ke.id,
|
|
1432
|
+
type: Ze.BUTTON,
|
|
1433
|
+
title: "sheets-filter.toolbar.clear-filter-criteria",
|
|
1434
|
+
hidden$: Xe(t, z.UNIVER_SHEET),
|
|
1435
|
+
disabled$: e.activeFilterModel$.pipe(ze((r) => {
|
|
1436
|
+
var i;
|
|
1437
|
+
return (i = r == null ? void 0 : r.hasCriteria$.pipe(ie((n) => !n))) != null ? i : _e(!0);
|
|
1438
|
+
}))
|
|
1439
|
+
};
|
|
1440
|
+
}
|
|
1441
|
+
function Ls(t) {
|
|
1442
|
+
const e = t.get(G);
|
|
1443
|
+
return {
|
|
1444
|
+
id: qe.id,
|
|
1445
|
+
type: Ze.BUTTON,
|
|
1446
|
+
title: "sheets-filter.toolbar.re-calc-filter-conditions",
|
|
1447
|
+
hidden$: Xe(t, z.UNIVER_SHEET),
|
|
1448
|
+
disabled$: e.activeFilterModel$.pipe(ze((r) => {
|
|
1449
|
+
var i;
|
|
1450
|
+
return (i = r == null ? void 0 : r.hasCriteria$.pipe(ie((n) => !n))) != null ? i : _e(!0);
|
|
1451
|
+
}))
|
|
1452
|
+
};
|
|
1453
|
+
}
|
|
1454
|
+
const Ms = {
|
|
1455
|
+
[Sr.FORMULAS_INSERT]: {
|
|
1456
|
+
[fe.id]: {
|
|
1457
|
+
order: 10,
|
|
1458
|
+
menuItemFactory: As,
|
|
1459
|
+
[Ke.id]: {
|
|
1460
|
+
order: 0,
|
|
1461
|
+
menuItemFactory: bs
|
|
1462
|
+
},
|
|
1463
|
+
[qe.id]: {
|
|
1464
|
+
order: 1,
|
|
1465
|
+
menuItemFactory: Ls
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
}, V = 16, $s = 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");
|
|
1470
|
+
class ht {
|
|
1471
|
+
static drawNoCriteria(e, r, i, n) {
|
|
1472
|
+
e.save(), lt.drawWith(e, {
|
|
1473
|
+
radius: 2,
|
|
1474
|
+
width: V,
|
|
1475
|
+
height: V,
|
|
1476
|
+
fill: n
|
|
1477
|
+
}), e.lineCap = "square", e.strokeStyle = i, e.scale(r / V, r / V), 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();
|
|
1478
|
+
}
|
|
1479
|
+
static drawHasCriteria(e, r, i, n) {
|
|
1480
|
+
e.save(), lt.drawWith(e, {
|
|
1481
|
+
radius: 2,
|
|
1482
|
+
width: V,
|
|
1483
|
+
height: V,
|
|
1484
|
+
fill: n
|
|
1485
|
+
}), e.scale(r / V, r / V), e.fillStyle = i, e.fill($s), e.restore();
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
var ws = Object.getOwnPropertyDescriptor, Us = (t, e, r, i) => {
|
|
1489
|
+
for (var n = i > 1 ? void 0 : i ? ws(e, r) : e, l = t.length - 1, s; l >= 0; l--)
|
|
1490
|
+
(s = t[l]) && (n = s(n) || n);
|
|
1491
|
+
return n;
|
|
1492
|
+
}, ke = (t, e) => (r, i) => e(r, i, t);
|
|
1493
|
+
const D = 16, Ee = 1;
|
|
1494
|
+
let Qe = class extends Kr {
|
|
1495
|
+
constructor(e, r, i, n, l) {
|
|
1496
|
+
super(e, r);
|
|
1497
|
+
f(this, "_cellWidth", 0);
|
|
1498
|
+
f(this, "_cellHeight", 0);
|
|
1499
|
+
f(this, "_filterParams");
|
|
1500
|
+
f(this, "_hovered", !1);
|
|
1501
|
+
this._contextService = i, this._commandService = n, this._themeService = l, this.setShapeProps(r), this.onPointerDown$.subscribeEvent((s) => this.onPointerDown(s)), this.onPointerEnter$.subscribeEvent(() => this.onPointerEnter()), this.onPointerLeave$.subscribeEvent(() => this.onPointerLeave());
|
|
1502
|
+
}
|
|
1503
|
+
setShapeProps(e) {
|
|
1504
|
+
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({
|
|
1505
|
+
width: e.width,
|
|
1506
|
+
height: e.height
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
_draw(e) {
|
|
1510
|
+
const r = this._cellHeight, i = this._cellWidth, n = D - i, l = D - r;
|
|
1511
|
+
e.save();
|
|
1512
|
+
const s = new Path2D();
|
|
1513
|
+
s.rect(n, l, i, r), e.clip(s);
|
|
1514
|
+
const { hasCriteria: o } = this._filterParams, a = this._themeService.getCurrentTheme().primaryColor, c = this._hovered ? this._themeService.getCurrentTheme().grey50 : "rgba(255, 255, 255, 1.0)";
|
|
1515
|
+
o ? ht.drawHasCriteria(e, D, a, c) : ht.drawNoCriteria(e, D, a, c), e.restore();
|
|
1516
|
+
}
|
|
1517
|
+
onPointerDown(e) {
|
|
1518
|
+
if (e.button === 2)
|
|
1519
|
+
return;
|
|
1520
|
+
const { col: r, unitId: i, subUnitId: n } = this._filterParams;
|
|
1521
|
+
this._contextService.getContextValue(ne) || !this._commandService.hasCommand(Re.id) || setTimeout(() => {
|
|
1522
|
+
this._commandService.executeCommand(Re.id, {
|
|
1523
|
+
unitId: i,
|
|
1524
|
+
subUnitId: n,
|
|
1525
|
+
col: r
|
|
1526
|
+
});
|
|
1527
|
+
}, 200);
|
|
1528
|
+
}
|
|
1529
|
+
onPointerEnter() {
|
|
1530
|
+
this._hovered = !0, this.makeDirty(!0);
|
|
1531
|
+
}
|
|
1532
|
+
onPointerLeave() {
|
|
1533
|
+
this._hovered = !1, this.makeDirty(!0);
|
|
1534
|
+
}
|
|
1535
|
+
};
|
|
1536
|
+
Qe = Us([
|
|
1537
|
+
ke(2, $e),
|
|
1538
|
+
ke(3, Q),
|
|
1539
|
+
ke(4, E(St))
|
|
1540
|
+
], Qe);
|
|
1541
|
+
var Hs = Object.getOwnPropertyDescriptor, Ds = (t, e, r, i) => {
|
|
1542
|
+
for (var n = i > 1 ? void 0 : i ? Hs(e, r) : e, l = t.length - 1, s; l >= 0; l--)
|
|
1543
|
+
(s = t[l]) && (n = s(n) || n);
|
|
1544
|
+
return n;
|
|
1545
|
+
}, q = (t, e) => (r, i) => e(r, i, t);
|
|
1546
|
+
const ks = 1e3, Bs = 5e3;
|
|
1547
|
+
let Ge = class extends Et {
|
|
1548
|
+
constructor(e, r, i, n, l, s, o, a) {
|
|
1549
|
+
super();
|
|
1550
|
+
f(this, "_filterRangeShape", null);
|
|
1551
|
+
f(this, "_buttonRenderDisposable", null);
|
|
1552
|
+
f(this, "_filterButtonShapes", []);
|
|
1553
|
+
this._context = e, this._injector = r, this._sheetSkeletonManagerService = i, this._sheetsFilterService = n, this._themeService = l, this._sheetInterceptorService = s, this._commandService = o, this._selectionRenderService = a, this._initRenderer();
|
|
1554
|
+
}
|
|
1555
|
+
dispose() {
|
|
1556
|
+
super.dispose(), this._disposeRendering();
|
|
1557
|
+
}
|
|
1558
|
+
_initRenderer() {
|
|
1559
|
+
this._sheetSkeletonManagerService.currentSkeleton$.pipe(
|
|
1560
|
+
ze((e) => {
|
|
1561
|
+
var o, a;
|
|
1562
|
+
if (!e) return _e(null);
|
|
1563
|
+
const { unit: r, unitId: i } = this._context, n = ((o = r.getActiveSheet()) == null ? void 0 : o.getSheetId()) || "", l = (a = this._sheetsFilterService.getFilterModel(i, n)) != null ? a : void 0, s = () => ({
|
|
1564
|
+
unitId: i,
|
|
1565
|
+
worksheetId: n,
|
|
1566
|
+
filterModel: l,
|
|
1567
|
+
range: l == null ? void 0 : l.getRange(),
|
|
1568
|
+
skeleton: e.skeleton
|
|
1569
|
+
});
|
|
1570
|
+
return Xt(this._commandService.onCommandExecuted.bind(this._commandService)).pipe(
|
|
1571
|
+
Vr(
|
|
1572
|
+
([c]) => {
|
|
1573
|
+
var h;
|
|
1574
|
+
return c.type === Me.MUTATION && ((h = c.params) == null ? void 0 : h.unitId) === r.getUnitId() && (tr.has(c.id) || c.id === pr.id);
|
|
1575
|
+
}
|
|
1576
|
+
),
|
|
1577
|
+
Ot(20, void 0, { leading: !1, trailing: !0 }),
|
|
1578
|
+
ie(s),
|
|
1579
|
+
It(s())
|
|
1580
|
+
// must trigger once
|
|
1581
|
+
);
|
|
1582
|
+
}),
|
|
1583
|
+
Wr(this.dispose$)
|
|
1584
|
+
).subscribe((e) => {
|
|
1585
|
+
this._disposeRendering(), !(!e || !e.range) && (this._renderRange(e.range, e.skeleton), this._renderButtons(e));
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
_renderRange(e, r) {
|
|
1589
|
+
const { scene: i } = this._context, { rowHeaderWidth: n, columnHeaderHeight: l } = r, s = this._filterRangeShape = new br(
|
|
1590
|
+
i,
|
|
1591
|
+
ks,
|
|
1592
|
+
this._themeService,
|
|
1593
|
+
{
|
|
1594
|
+
rowHeaderWidth: n,
|
|
1595
|
+
columnHeaderHeight: l,
|
|
1596
|
+
enableAutoFill: !1,
|
|
1597
|
+
highlightHeader: !1
|
|
1598
|
+
}
|
|
1599
|
+
), a = Lr({
|
|
1600
|
+
range: e,
|
|
1601
|
+
primary: null,
|
|
1602
|
+
style: { fill: "rgba(0, 0, 0, 0.0)" }
|
|
1603
|
+
}, r);
|
|
1604
|
+
s.updateRangeBySelectionWithCoord(a), s.setEvent(!1), i.makeDirty(!0);
|
|
1605
|
+
}
|
|
1606
|
+
_renderButtons(e) {
|
|
1607
|
+
const { range: r, filterModel: i, unitId: n, skeleton: l, worksheetId: s } = e, { scene: o } = this._context;
|
|
1608
|
+
this._interceptCellContent(n, s, e.range);
|
|
1609
|
+
const { startColumn: a, endColumn: c, startRow: h } = r;
|
|
1610
|
+
for (let d = a; d <= c; d++) {
|
|
1611
|
+
const v = `sheets-filter-button-${d}`, p = Mr(h, d, o, l), { startX: T, startY: g, endX: N, endY: F } = p, I = N - T, y = F - g;
|
|
1612
|
+
if (y <= Ee || I <= Ee)
|
|
1613
|
+
continue;
|
|
1614
|
+
const $ = !!i.getFilterColumn(d), w = N - D - Ee, ge = F - D - Ee, ve = {
|
|
1615
|
+
left: w,
|
|
1616
|
+
top: ge,
|
|
1617
|
+
height: D,
|
|
1618
|
+
width: D,
|
|
1619
|
+
zIndex: Bs,
|
|
1620
|
+
cellHeight: y,
|
|
1621
|
+
cellWidth: I,
|
|
1622
|
+
filterParams: { unitId: n, subUnitId: s, col: d, hasCriteria: $ }
|
|
1623
|
+
}, R = this._injector.createInstance(Qe, v, ve);
|
|
1624
|
+
this._filterButtonShapes.push(R);
|
|
1625
|
+
}
|
|
1626
|
+
o.addObjects(this._filterButtonShapes), o.makeDirty();
|
|
1627
|
+
}
|
|
1628
|
+
_interceptCellContent(e, r, i) {
|
|
1629
|
+
const { startRow: n, startColumn: l, endColumn: s } = i;
|
|
1630
|
+
this._buttonRenderDisposable = this._sheetInterceptorService.intercept(fr.CELL_CONTENT, {
|
|
1631
|
+
effect: Zt.Style,
|
|
1632
|
+
handler: (o, a, c) => {
|
|
1633
|
+
const { row: h, col: d, unitId: v, subUnitId: p } = a;
|
|
1634
|
+
return v !== e || p !== r || h !== n || d < l || d > s ? c(o) : c({
|
|
1635
|
+
...o,
|
|
1636
|
+
fontRenderExtension: {
|
|
1637
|
+
...o == null ? void 0 : o.fontRenderExtension,
|
|
1638
|
+
rightOffset: D
|
|
1639
|
+
}
|
|
1640
|
+
});
|
|
1641
|
+
},
|
|
1642
|
+
priority: 10
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
_disposeRendering() {
|
|
1646
|
+
var e, r;
|
|
1647
|
+
(e = this._filterRangeShape) == null || e.dispose(), this._filterButtonShapes.forEach((i) => i.dispose()), (r = this._buttonRenderDisposable) == null || r.dispose(), this._filterRangeShape = null, this._buttonRenderDisposable = null, this._filterButtonShapes = [];
|
|
1648
|
+
}
|
|
1649
|
+
};
|
|
1650
|
+
Ge = Ds([
|
|
1651
|
+
q(1, E(Z)),
|
|
1652
|
+
q(2, E(Rr)),
|
|
1653
|
+
q(3, E(G)),
|
|
1654
|
+
q(4, E(St)),
|
|
1655
|
+
q(5, E(dr)),
|
|
1656
|
+
q(6, Q),
|
|
1657
|
+
q(7, Ar)
|
|
1658
|
+
], Ge);
|
|
1659
|
+
var Vs = Object.getOwnPropertyDescriptor, Ws = (t, e, r, i) => {
|
|
1660
|
+
for (var n = i > 1 ? void 0 : i ? Vs(e, r) : e, l = t.length - 1, s; l >= 0; l--)
|
|
1661
|
+
(s = t[l]) && (n = s(n) || n);
|
|
1662
|
+
return n;
|
|
1663
|
+
}, mt = (t, e) => (r, i) => e(r, i, t);
|
|
1664
|
+
let de = class extends Et {
|
|
1665
|
+
constructor(t, e) {
|
|
1666
|
+
super(), this._renderManagerService = t, this._sheetsRenderService = e, [
|
|
1667
|
+
rr,
|
|
1668
|
+
sr,
|
|
1669
|
+
ir,
|
|
1670
|
+
nr
|
|
1671
|
+
].forEach((r) => this.disposeWithMe(this._sheetsRenderService.registerSkeletonChangingMutations(r.id))), this.disposeWithMe(this._renderManagerService.registerRenderModule(
|
|
1672
|
+
z.UNIVER_SHEET,
|
|
1673
|
+
[Ge]
|
|
1674
|
+
));
|
|
1675
|
+
}
|
|
1676
|
+
};
|
|
1677
|
+
de = Ws([
|
|
1678
|
+
mt(0, At),
|
|
1679
|
+
mt(1, E(yt))
|
|
1680
|
+
], de);
|
|
1681
|
+
const xs = {
|
|
1682
|
+
id: fe.id,
|
|
1683
|
+
binding: Er.L | nt.CTRL_COMMAND | nt.SHIFT,
|
|
1684
|
+
description: "sheets-filter.shortcut.smart-toggle-filter",
|
|
1685
|
+
preconditions: $r,
|
|
1686
|
+
group: "4_sheet-edit"
|
|
1687
|
+
};
|
|
1688
|
+
var Qs = Object.getOwnPropertyDescriptor, Gs = (t, e, r, i) => {
|
|
1689
|
+
for (var n = i > 1 ? void 0 : i ? Qs(e, r) : e, l = t.length - 1, s; l >= 0; l--)
|
|
1690
|
+
(s = t[l]) && (n = s(n) || n);
|
|
1691
|
+
return n;
|
|
1692
|
+
}, A = (t, e) => (r, i) => e(r, i, t);
|
|
1693
|
+
const dt = "FILTER_PANEL_POPUP";
|
|
1694
|
+
let Ae = class extends de {
|
|
1695
|
+
constructor(e, r, i, n, l, s, o, a, c, h, d, v, p) {
|
|
1696
|
+
super(p, v);
|
|
1697
|
+
f(this, "_popupDisposable");
|
|
1698
|
+
this._injector = e, this._componentManager = r, this._sheetsFilterPanelService = i, this._sheetCanvasPopupService = n, this._sheetsFilterService = l, this._localeService = s, this._shortcutService = o, this._commandService = a, this._menuManagerService = c, this._contextService = h, this._messageService = d, this._initCommands(), this._initShortcuts(), this._initMenuItems(), this._initUI();
|
|
1699
|
+
}
|
|
1700
|
+
dispose() {
|
|
1701
|
+
super.dispose(), this._closeFilterPopup();
|
|
1702
|
+
}
|
|
1703
|
+
_initShortcuts() {
|
|
1704
|
+
[
|
|
1705
|
+
xs
|
|
1706
|
+
].forEach((e) => {
|
|
1707
|
+
this.disposeWithMe(this._shortcutService.registerShortcut(e));
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1710
|
+
_initCommands() {
|
|
1711
|
+
[
|
|
1712
|
+
fe,
|
|
1713
|
+
or,
|
|
1714
|
+
ar,
|
|
1715
|
+
se,
|
|
1716
|
+
Ke,
|
|
1717
|
+
qe,
|
|
1718
|
+
Ht,
|
|
1719
|
+
Re,
|
|
1720
|
+
me
|
|
1721
|
+
].forEach((e) => {
|
|
1722
|
+
this.disposeWithMe(this._commandService.registerCommand(e));
|
|
1723
|
+
});
|
|
1724
|
+
}
|
|
1725
|
+
_initMenuItems() {
|
|
1726
|
+
this._menuManagerService.mergeMenu(Ms);
|
|
1727
|
+
}
|
|
1728
|
+
_initUI() {
|
|
1729
|
+
this.disposeWithMe(this._componentManager.register(dt, Is)), this.disposeWithMe(this._componentManager.register("FilterSingle", Bt)), this.disposeWithMe(this._contextService.subscribeContextValue$(ne).pipe(xr()).subscribe((e) => {
|
|
1730
|
+
e ? this._openFilterPopup() : this._closeFilterPopup();
|
|
1731
|
+
})), this.disposeWithMe(this._sheetsFilterService.errorMsg$.subscribe((e) => {
|
|
1732
|
+
e && this._messageService.show({
|
|
1733
|
+
type: qr.Error,
|
|
1734
|
+
content: this._localeService.t(e)
|
|
1735
|
+
});
|
|
1736
|
+
}));
|
|
1737
|
+
}
|
|
1738
|
+
_openFilterPopup() {
|
|
1739
|
+
const e = this._sheetsFilterPanelService.filterModel;
|
|
1740
|
+
if (!e)
|
|
1741
|
+
throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");
|
|
1742
|
+
const r = e.getRange(), i = this._sheetsFilterPanelService.col, { startRow: n } = r;
|
|
1743
|
+
this._popupDisposable = this._sheetCanvasPopupService.attachPopupToCell(n, i, {
|
|
1744
|
+
componentKey: dt,
|
|
1745
|
+
direction: "horizontal",
|
|
1746
|
+
onClickOutside: () => this._commandService.syncExecuteCommand(me.id),
|
|
1747
|
+
offset: [5, 0]
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
_closeFilterPopup() {
|
|
1751
|
+
var e;
|
|
1752
|
+
(e = this._popupDisposable) == null || e.dispose(), this._popupDisposable = null;
|
|
1753
|
+
}
|
|
1754
|
+
};
|
|
1755
|
+
Ae = Gs([
|
|
1756
|
+
A(0, E(Z)),
|
|
1757
|
+
A(1, E(Tr)),
|
|
1758
|
+
A(2, E(x)),
|
|
1759
|
+
A(3, E(wr)),
|
|
1760
|
+
A(4, E(G)),
|
|
1761
|
+
A(5, E(X)),
|
|
1762
|
+
A(6, Fr),
|
|
1763
|
+
A(7, Q),
|
|
1764
|
+
A(8, Cr),
|
|
1765
|
+
A(9, $e),
|
|
1766
|
+
A(10, Nr),
|
|
1767
|
+
A(11, E(yt)),
|
|
1768
|
+
A(12, At)
|
|
1769
|
+
], Ae);
|
|
1770
|
+
var js = Object.defineProperty, Ys = Object.getOwnPropertyDescriptor, qs = (t, e, r) => e in t ? js(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Ks = (t, e, r, i) => {
|
|
1771
|
+
for (var n = i > 1 ? void 0 : i ? Ys(e, r) : e, l = t.length - 1, s; l >= 0; l--)
|
|
1772
|
+
(s = t[l]) && (n = s(n) || n);
|
|
1773
|
+
return n;
|
|
1774
|
+
}, Be = (t, e) => (r, i) => e(r, i, t), Vt = (t, e, r) => qs(t, typeof e != "symbol" ? e + "" : e, r);
|
|
1775
|
+
const Xs = "SHEET_FILTER_UI_PLUGIN";
|
|
1776
|
+
let be = class extends Ye {
|
|
1777
|
+
constructor(t = Ce, e, r, i) {
|
|
1778
|
+
super(), this._config = t, this._injector = e, this._configService = r, this._rpcChannelService = i;
|
|
1779
|
+
const { menu: n, ...l } = Ct(
|
|
1780
|
+
{},
|
|
1781
|
+
Ce,
|
|
1782
|
+
this._config
|
|
1783
|
+
);
|
|
1784
|
+
n && this._configService.setConfig("menu", n, { merge: !0 }), this._configService.setConfig(Mt, l);
|
|
1785
|
+
}
|
|
1786
|
+
onStarting() {
|
|
1787
|
+
[
|
|
1788
|
+
[x],
|
|
1789
|
+
[oe],
|
|
1790
|
+
[Ae]
|
|
1791
|
+
].forEach((t) => this._injector.add(t)), this._config.useRemoteFilterValuesGenerator && this._rpcChannelService && this._injector.add([Ne, {
|
|
1792
|
+
useFactory: () => Jt(
|
|
1793
|
+
this._rpcChannelService.requestChannel(et)
|
|
1794
|
+
)
|
|
1795
|
+
}]);
|
|
1796
|
+
}
|
|
1797
|
+
onReady() {
|
|
1798
|
+
this._injector.get(oe);
|
|
1799
|
+
}
|
|
1800
|
+
onRendered() {
|
|
1801
|
+
this._injector.get(Ae);
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
Vt(be, "type", z.UNIVER_SHEET);
|
|
1805
|
+
Vt(be, "pluginName", Xs);
|
|
1806
|
+
be = Ks([
|
|
1807
|
+
Tt(Pt),
|
|
1808
|
+
Be(1, E(Z)),
|
|
1809
|
+
Be(2, Ft),
|
|
1810
|
+
Be(3, zt(Nt))
|
|
1811
|
+
], be);
|
|
1812
|
+
var Zs = Object.defineProperty, zs = Object.getOwnPropertyDescriptor, Js = (t, e, r) => e in t ? Zs(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ei = (t, e, r, i) => {
|
|
1813
|
+
for (var n = i > 1 ? void 0 : i ? zs(e, r) : e, l = t.length - 1, s; l >= 0; l--)
|
|
1814
|
+
(s = t[l]) && (n = s(n) || n);
|
|
1815
|
+
return n;
|
|
1816
|
+
}, pt = (t, e) => (r, i) => e(r, i, t), Wt = (t, e, r) => Js(t, typeof e != "symbol" ? e + "" : e, r);
|
|
1817
|
+
const ti = "SHEET_FILTER_UI_PLUGIN";
|
|
1818
|
+
let Le = class extends Ye {
|
|
1819
|
+
constructor(t = Ce, e, r) {
|
|
1820
|
+
super(), this._config = t, this._injector = e, this._configService = r;
|
|
1821
|
+
const { menu: i, ...n } = Ct(
|
|
1822
|
+
{},
|
|
1823
|
+
Ce,
|
|
1824
|
+
this._config
|
|
1825
|
+
);
|
|
1826
|
+
i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(Mt, n);
|
|
1827
|
+
}
|
|
1828
|
+
onStarting() {
|
|
1829
|
+
[
|
|
1830
|
+
[oe],
|
|
1831
|
+
[de]
|
|
1832
|
+
].forEach((t) => this._injector.add(t));
|
|
1833
|
+
}
|
|
1834
|
+
onReady() {
|
|
1835
|
+
this._injector.get(oe);
|
|
1836
|
+
}
|
|
1837
|
+
onRendered() {
|
|
1838
|
+
this._injector.get(de);
|
|
1839
|
+
}
|
|
1840
|
+
};
|
|
1841
|
+
Wt(Le, "type", z.UNIVER_SHEET);
|
|
1842
|
+
Wt(Le, "pluginName", ti);
|
|
1843
|
+
Le = ei([
|
|
1844
|
+
Tt(Pt),
|
|
1845
|
+
pt(1, E(Z)),
|
|
1846
|
+
pt(2, Ft)
|
|
1847
|
+
], Le);
|
|
1848
|
+
var ri = Object.getOwnPropertyDescriptor, si = (t, e, r, i) => {
|
|
1849
|
+
for (var n = i > 1 ? void 0 : i ? ri(e, r) : e, l = t.length - 1, s; l >= 0; l--)
|
|
1850
|
+
(s = t[l]) && (n = s(n) || n);
|
|
1851
|
+
return n;
|
|
1852
|
+
}, ft = (t, e) => (r, i) => e(r, i, t), Te;
|
|
1853
|
+
let _t = (Te = class extends Ye {
|
|
1854
|
+
constructor(t, e, r) {
|
|
1855
|
+
super(), this._config = t, this._injector = e, this._rpcChannelService = r;
|
|
1856
|
+
}
|
|
1857
|
+
onStarting() {
|
|
1858
|
+
[
|
|
1859
|
+
[Ne, { useClass: We }]
|
|
1860
|
+
].forEach((t) => this._injector.add(t));
|
|
1861
|
+
}
|
|
1862
|
+
onReady() {
|
|
1863
|
+
this._rpcChannelService.registerChannel(
|
|
1864
|
+
et,
|
|
1865
|
+
er(this._injector.get(Ne))
|
|
1866
|
+
);
|
|
1867
|
+
}
|
|
1868
|
+
}, f(Te, "type", z.UNIVER_SHEET), f(Te, "pluginName", "SHEET_FILTER_UI_WORKER_PLUGIN"), Te);
|
|
1869
|
+
_t = si([
|
|
1870
|
+
ft(1, E(Z)),
|
|
1871
|
+
ft(2, Nt)
|
|
1872
|
+
], _t);
|
|
1873
|
+
export {
|
|
1874
|
+
Ht as ChangeFilterByOperation,
|
|
1875
|
+
me as CloseFilterPanelOperation,
|
|
1876
|
+
Re as OpenFilterPanelOperation,
|
|
1877
|
+
Le as UniverSheetsFilterMobileUIPlugin,
|
|
1878
|
+
be as UniverSheetsFilterUIPlugin,
|
|
1879
|
+
_t as UniverSheetsFilterUIWorkerPlugin
|
|
1880
|
+
};
|