@univerjs/sheets-filter-ui 0.1.8
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/LICENSE +176 -0
- package/README.md +34 -0
- package/lib/cjs/index.js +14 -0
- package/lib/es/index.js +3158 -0
- package/lib/index.css +1 -0
- package/lib/types/__testing__/data.d.ts +22 -0
- package/lib/types/commands/__tests__/sheets-filter.command.spec.d.ts +16 -0
- package/lib/types/commands/__tests__/sheets-filter.operation.spec.d.ts +16 -0
- package/lib/types/commands/sheets-filter.command.d.ts +25 -0
- package/lib/types/commands/sheets-filter.operation.d.ts +18 -0
- package/lib/types/controllers/__tests__/sheets-filter.menu.spec.d.ts +16 -0
- package/lib/types/controllers/sheets-filter-render.controller.d.ts +28 -0
- package/lib/types/controllers/sheets-filter-ui.controller.d.ts +29 -0
- package/lib/types/controllers/sheets-filter.menu.d.ts +6 -0
- package/lib/types/controllers/sheets-filter.shortcut.d.ts +3 -0
- package/lib/types/index.d.ts +18 -0
- package/lib/types/locale/en-US.d.ts +66 -0
- package/lib/types/locale/index.d.ts +17 -0
- package/lib/types/locale/zh-CN.d.ts +4 -0
- package/lib/types/models/__tests__/conditions.spec.d.ts +16 -0
- package/lib/types/models/conditions.d.ts +75 -0
- package/lib/types/models/extended-operators.d.ts +89 -0
- package/lib/types/models/utils.d.ts +8 -0
- package/lib/types/plugin.d.ts +11 -0
- package/lib/types/services/__tests__/sheets-filter-panel.service.spec.d.ts +16 -0
- package/lib/types/services/sheets-filter-panel.service.d.ts +186 -0
- package/lib/types/views/components/SheetsFilterByConditionsPanel.d.ts +9 -0
- package/lib/types/views/components/SheetsFilterByValuesPanel.d.ts +9 -0
- package/lib/types/views/components/SheetsFilterPanel.d.ts +8 -0
- package/lib/types/views/components/SheetsFilterPanel.stories.d.ts +15 -0
- package/lib/types/views/widgets/drawings.d.ts +7 -0
- package/lib/types/views/widgets/filter-button.shape.d.ts +33 -0
- package/lib/umd/index.js +14 -0
- package/package.json +91 -0
package/lib/es/index.js
ADDED
|
@@ -0,0 +1,3158 @@
|
|
|
1
|
+
var Xn = Object.defineProperty;
|
|
2
|
+
var Kn = (e, t, r) => t in e ? Xn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var C = (e, t, r) => (Kn(e, typeof t != "symbol" ? t + "" : t, r), r);
|
|
4
|
+
import { CommandType as Te, IUniverInstanceService as Tt, ICommandService as ce, IUndoRedoService as tr, UniverInstanceType as tt, LocaleService as We, sequenceExecute as Zn, BooleanNumber as Cr, Disposable as rr, extractPureTextFromCell as Jn, IContextService as Rt, RxDisposable as qr, OnLifecycle as Xr, LifecycleStages as Kr, ThemeService as Zr, fromCallback as ei, Plugin as ti } from "@univerjs/core";
|
|
5
|
+
import { Quantity as Jr, createIdentifier as ri, Inject as G, Injector as Ot } from "@wendellhu/redi";
|
|
6
|
+
import { IMessageService as ni, ILayoutService as ii, useObservable as Ee, KeyCode as oi, MetaKeys as Nr, MenuGroup as nr, MenuItemType as ir, MenuPosition as si, getMenuHiddenObservable as or, ComponentManager as ai, IShortcutService as li, IMenuService as ui } from "@univerjs/ui";
|
|
7
|
+
import { BehaviorSubject as Ne, ReplaySubject as ci, of as He, Subject as fi, merge as hi, combineLatest as di, throttleTime as en, startWith as tn, map as De, shareReplay as mi, switchMap as sr, distinctUntilChanged as vi, filter as pi, takeUntil as gi } from "rxjs";
|
|
8
|
+
import { expandToContinuousRange as _i, SetCellEditVisibleOperation as Si, whenSheetEditorFocused as Ei, SheetCanvasPopManagerService as yi, SelectionShape as bi, getCoordByCell as Ti, SheetSkeletonManagerService as Ri, SheetRenderController as Oi, ISelectionRenderService as Fi } from "@univerjs/sheets-ui";
|
|
9
|
+
import { MessageType as Ci, Select as Pr, RadioGroup as Ni, Radio as Ir, Input as rn, Checkbox as wr, Button as ct, Segmented as Pi } from "@univerjs/design";
|
|
10
|
+
import { SelectionManagerService as Ii, isSingleCellSelection as wi, RefRangeService as Ai, INTERCEPTOR_POINT as Mi, SheetInterceptorService as Li } from "@univerjs/sheets";
|
|
11
|
+
import { SheetsFilterService as he, RemoveSheetsFilterMutation as ft, SetSheetsFilterRangeMutation as ar, SetSheetsFilterCriteriaMutation as Ue, ReCalcSheetsFilterMutation as nn, CustomFilterOperator as v, FILTER_MUTATIONS as $i } from "@univerjs/sheets-filter";
|
|
12
|
+
import * as m from "react";
|
|
13
|
+
import R, { forwardRef as on, useRef as A, createElement as sn, useCallback as ae, useMemo as lr, useEffect as Hi, useState as Gt } from "react";
|
|
14
|
+
import { useDependency as Ke } from "@wendellhu/redi/react-bindings";
|
|
15
|
+
import Di, { flushSync as Ar } from "react-dom";
|
|
16
|
+
import { Rect as Mr, Shape as Ui, IRenderManagerService as xi } from "@univerjs/engine-render";
|
|
17
|
+
const ba = {
|
|
18
|
+
"sheets-filter": {
|
|
19
|
+
toolbar: {
|
|
20
|
+
"smart-toggle-filter-tooltip": "Toggle Filter",
|
|
21
|
+
"clear-filter-criteria": "Clear Filter Conditions",
|
|
22
|
+
"re-calc-filter-conditions": "Re-calc Filter Conditions"
|
|
23
|
+
},
|
|
24
|
+
command: {
|
|
25
|
+
"not-valid-filter-range": "The selected range only has one row and not valid for filter."
|
|
26
|
+
},
|
|
27
|
+
shortcut: {
|
|
28
|
+
"smart-toggle-filter": "Toggle Filter"
|
|
29
|
+
},
|
|
30
|
+
panel: {
|
|
31
|
+
"clear-filter": "Clear Filter",
|
|
32
|
+
cancel: "Cancel",
|
|
33
|
+
confirm: "Confirm",
|
|
34
|
+
"by-values": "By Values",
|
|
35
|
+
"by-conditions": "By Conditions",
|
|
36
|
+
"filter-only": "Filter Only",
|
|
37
|
+
"search-placeholder": "Use space to separate keywords",
|
|
38
|
+
"select-all": "Select All",
|
|
39
|
+
"input-values-placeholder": "Input Values",
|
|
40
|
+
and: "AND",
|
|
41
|
+
or: "OR",
|
|
42
|
+
empty: "(empty)",
|
|
43
|
+
"?": "Use “?” to represent a single character.",
|
|
44
|
+
"*": "Use “*” to represent multiple characters."
|
|
45
|
+
},
|
|
46
|
+
conditions: {
|
|
47
|
+
none: "None",
|
|
48
|
+
empty: "Is Empty",
|
|
49
|
+
"not-empty": "Is Not Empty",
|
|
50
|
+
"text-contains": "Text Contains",
|
|
51
|
+
"does-not-contain": "Text Does Not Contain",
|
|
52
|
+
"starts-with": "Text Starts With",
|
|
53
|
+
"ends-with": "Text Ends With",
|
|
54
|
+
equals: "Text Equals",
|
|
55
|
+
"greater-than": "Greater Than",
|
|
56
|
+
"greater-than-or-equal": "Greater Than Or Equal To",
|
|
57
|
+
"less-than": "Less Than",
|
|
58
|
+
"less-than-or-equal": "Less Than Or Equal To",
|
|
59
|
+
equal: "Equal",
|
|
60
|
+
"not-equal": "Not Equal",
|
|
61
|
+
between: "Between",
|
|
62
|
+
"not-between": "Not Between",
|
|
63
|
+
custom: "Custom"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}, Bi = {
|
|
67
|
+
"sheets-filter": {
|
|
68
|
+
toolbar: {
|
|
69
|
+
"smart-toggle-filter-tooltip": "筛选",
|
|
70
|
+
"clear-filter-criteria": "清除筛选条件",
|
|
71
|
+
"re-calc-filter-conditions": "重新计算"
|
|
72
|
+
},
|
|
73
|
+
command: {
|
|
74
|
+
"not-valid-filter-range": "选中的区域只有一行,无法进行筛选"
|
|
75
|
+
},
|
|
76
|
+
shortcut: {
|
|
77
|
+
"smart-toggle-filter": "切换筛选"
|
|
78
|
+
},
|
|
79
|
+
panel: {
|
|
80
|
+
"clear-filter": "清除筛选",
|
|
81
|
+
cancel: "取消",
|
|
82
|
+
confirm: "确认",
|
|
83
|
+
"by-values": "按值",
|
|
84
|
+
"by-conditions": "按条件",
|
|
85
|
+
"filter-only": "仅筛选",
|
|
86
|
+
"search-placeholder": "使用空格分隔关键字",
|
|
87
|
+
"select-all": "全选",
|
|
88
|
+
"input-values-placeholder": "请输入",
|
|
89
|
+
or: "或",
|
|
90
|
+
and: "和",
|
|
91
|
+
empty: "(空白)",
|
|
92
|
+
"?": "可用 ? 代表单个字符",
|
|
93
|
+
"*": "可用 * 代表任意多个字符"
|
|
94
|
+
},
|
|
95
|
+
conditions: {
|
|
96
|
+
none: "无",
|
|
97
|
+
empty: "为空",
|
|
98
|
+
"not-empty": "不为空",
|
|
99
|
+
"text-contains": "文本包含",
|
|
100
|
+
"does-not-contain": "文本不包含",
|
|
101
|
+
"starts-with": "文本开头",
|
|
102
|
+
"ends-with": "文本结尾",
|
|
103
|
+
equals: "文本相符",
|
|
104
|
+
"greater-than": "大于",
|
|
105
|
+
"greater-than-or-equal": "大于等于",
|
|
106
|
+
"less-than": "小于",
|
|
107
|
+
"less-than-or-equal": "小于等于",
|
|
108
|
+
equal: "等于",
|
|
109
|
+
"not-equal": "不等于",
|
|
110
|
+
between: "介于",
|
|
111
|
+
"not-between": "不介于",
|
|
112
|
+
custom: "自定义"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}, Wi = Bi;
|
|
116
|
+
var te = function() {
|
|
117
|
+
return te = Object.assign || function(e) {
|
|
118
|
+
for (var t, r = 1, n = arguments.length; r < n; r++) {
|
|
119
|
+
t = arguments[r];
|
|
120
|
+
for (var o in t)
|
|
121
|
+
Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
|
|
122
|
+
}
|
|
123
|
+
return e;
|
|
124
|
+
}, te.apply(this, arguments);
|
|
125
|
+
}, Vi = function(e, t) {
|
|
126
|
+
var r = {};
|
|
127
|
+
for (var n in e)
|
|
128
|
+
Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
|
|
129
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
130
|
+
for (var o = 0, n = Object.getOwnPropertySymbols(e); o < n.length; o++)
|
|
131
|
+
t.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[o]) && (r[n[o]] = e[n[o]]);
|
|
132
|
+
return r;
|
|
133
|
+
}, an = on(function(e, t) {
|
|
134
|
+
var r = e.icon, n = e.id, o = e.className, a = e.extend, i = Vi(e, ["icon", "id", "className", "extend"]), s = "univerjs-icon univerjs-icon-".concat(n, " ").concat(o || "").trim(), l = A("_".concat(zi()));
|
|
135
|
+
return ln(r, "".concat(n), { defIds: r.defIds, idSuffix: l.current }, te({ ref: t, className: s }, i), a);
|
|
136
|
+
});
|
|
137
|
+
function ln(e, t, r, n, o) {
|
|
138
|
+
return sn(e.tag, te(te({ key: t }, ji(e, r, o)), n), (ki(e, r).children || []).map(function(a, i) {
|
|
139
|
+
return ln(a, "".concat(t, "-").concat(e.tag, "-").concat(i), r, void 0, o);
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
function ji(e, t, r) {
|
|
143
|
+
var n = te({}, e.attrs);
|
|
144
|
+
r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1);
|
|
145
|
+
var o = t.defIds;
|
|
146
|
+
return !o || o.length === 0 || (e.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + t.idSuffix), Object.entries(n).forEach(function(a) {
|
|
147
|
+
var i = a[0], s = a[1];
|
|
148
|
+
typeof s == "string" && (n[i] = s.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
|
|
149
|
+
})), n;
|
|
150
|
+
}
|
|
151
|
+
function ki(e, t) {
|
|
152
|
+
var r, n = t.defIds;
|
|
153
|
+
return !n || n.length === 0 ? e : e.tag === "defs" && (!((r = e.children) === null || r === void 0) && r.length) ? te(te({}, e), { children: e.children.map(function(o) {
|
|
154
|
+
return typeof o.attrs.id == "string" && n && n.indexOf(o.attrs.id) > -1 ? te(te({}, o), { attrs: te(te({}, o.attrs), { id: o.attrs.id + t.idSuffix }) }) : o;
|
|
155
|
+
}) }) : e;
|
|
156
|
+
}
|
|
157
|
+
function zi() {
|
|
158
|
+
return Math.random().toString(36).substring(2, 8);
|
|
159
|
+
}
|
|
160
|
+
an.displayName = "UniverIcon";
|
|
161
|
+
var Qi = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { stroke: "currentColor", d: "M2 3L6.8 8.60593V12.8148L9.2 14V8.60593L14 3H2Z", strokeLinejoin: "round", strokeWidth: 1.33 } }] }, un = on(function(e, t) {
|
|
162
|
+
return sn(an, Object.assign({}, e, {
|
|
163
|
+
id: "filter-single",
|
|
164
|
+
ref: t,
|
|
165
|
+
icon: Qi
|
|
166
|
+
}));
|
|
167
|
+
});
|
|
168
|
+
un.displayName = "FilterSingle";
|
|
169
|
+
const rt = {
|
|
170
|
+
id: "sheet.command.smart-toggle-filter",
|
|
171
|
+
type: Te.COMMAND,
|
|
172
|
+
handler: async (e) => {
|
|
173
|
+
const t = e.get(Tt), r = e.get(he), n = e.get(ce), o = e.get(tr), a = t.getCurrentUnitForType(tt.UNIVER_SHEET), i = a == null ? void 0 : a.getActiveSheet();
|
|
174
|
+
if (!i || !a)
|
|
175
|
+
return !1;
|
|
176
|
+
const s = a.getUnitId(), l = i.getSheetId(), u = r.getFilterModel(s, l);
|
|
177
|
+
if (u) {
|
|
178
|
+
const p = u == null ? void 0 : u.serialize(), S = Gi(s, l, p), T = n.syncExecuteCommand(ft.id, { unitId: s, subUnitId: l });
|
|
179
|
+
return T && o.pushUndoRedo({
|
|
180
|
+
unitID: s,
|
|
181
|
+
undoMutations: S,
|
|
182
|
+
redoMutations: [{ id: ft.id, params: { unitId: s, subUnitId: l } }]
|
|
183
|
+
}), T;
|
|
184
|
+
}
|
|
185
|
+
const f = e.get(Ii).getLast();
|
|
186
|
+
if (!f)
|
|
187
|
+
return !1;
|
|
188
|
+
const d = f.range, h = wi(f) ? _i(d, { left: !0, right: !0, up: !0, down: !0 }, i) : d;
|
|
189
|
+
if (h.endRow === h.startRow) {
|
|
190
|
+
const p = e.get(ni, Jr.OPTIONAL), S = e.get(We);
|
|
191
|
+
return p == null || p.show({ type: Ci.Warning, content: S.t("sheets-filter.command.not-valid-filter-range") }), !1;
|
|
192
|
+
}
|
|
193
|
+
const g = { id: ar.id, params: { unitId: s, subUnitId: l, range: h } }, _ = n.syncExecuteCommand(g.id, g.params);
|
|
194
|
+
return _ && o.pushUndoRedo({
|
|
195
|
+
unitID: s,
|
|
196
|
+
undoMutations: [{ id: ft.id, params: { unitId: s, subUnitId: l } }],
|
|
197
|
+
redoMutations: [g]
|
|
198
|
+
}), _;
|
|
199
|
+
}
|
|
200
|
+
}, $e = {
|
|
201
|
+
id: "sheet.command.set-filter-criteria",
|
|
202
|
+
type: Te.COMMAND,
|
|
203
|
+
handler: async (e, t) => {
|
|
204
|
+
const r = e.get(he), n = e.get(ce), o = e.get(tr), { unitId: a, subUnitId: i, col: s, criteria: l } = t, u = r.getFilterModel(a, i);
|
|
205
|
+
if (!u)
|
|
206
|
+
return !1;
|
|
207
|
+
const c = u.getRange();
|
|
208
|
+
if (!c || s < c.startColumn || s > c.endColumn)
|
|
209
|
+
return !1;
|
|
210
|
+
const f = u.getFilterColumn(s), d = qi(a, i, s, f), h = {
|
|
211
|
+
id: Ue.id,
|
|
212
|
+
params: {
|
|
213
|
+
unitId: a,
|
|
214
|
+
subUnitId: i,
|
|
215
|
+
col: s,
|
|
216
|
+
criteria: l
|
|
217
|
+
}
|
|
218
|
+
}, g = n.syncExecuteCommand(h.id, h.params);
|
|
219
|
+
return g && o.pushUndoRedo({
|
|
220
|
+
unitID: a,
|
|
221
|
+
undoMutations: [d],
|
|
222
|
+
redoMutations: [h]
|
|
223
|
+
}), g;
|
|
224
|
+
}
|
|
225
|
+
}, cn = {
|
|
226
|
+
id: "sheet.command.clear-filter-criteria",
|
|
227
|
+
type: Te.COMMAND,
|
|
228
|
+
handler: (e) => {
|
|
229
|
+
const t = e.get(he), r = e.get(tr), n = e.get(ce), o = t.activeFilterModel;
|
|
230
|
+
if (!o)
|
|
231
|
+
return !1;
|
|
232
|
+
const { unitId: a, subUnitId: i } = o, s = o.serialize(), l = hn(a, i, s), u = Yi(a, i, s);
|
|
233
|
+
return Zn(u, n) && r.pushUndoRedo({
|
|
234
|
+
unitID: a,
|
|
235
|
+
undoMutations: l,
|
|
236
|
+
redoMutations: u
|
|
237
|
+
}), !0;
|
|
238
|
+
}
|
|
239
|
+
}, fn = {
|
|
240
|
+
id: "sheet.command.re-calc-filter",
|
|
241
|
+
type: Te.COMMAND,
|
|
242
|
+
handler: (e) => {
|
|
243
|
+
const t = e.get(he), r = e.get(ce), n = t.activeFilterModel;
|
|
244
|
+
if (!n)
|
|
245
|
+
return !1;
|
|
246
|
+
const { unitId: o, subUnitId: a } = n;
|
|
247
|
+
return r.executeCommand(nn.id, { unitId: o, subUnitId: a });
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
function Gi(e, t, r) {
|
|
251
|
+
const n = [], o = {
|
|
252
|
+
id: ar.id,
|
|
253
|
+
params: {
|
|
254
|
+
unitId: e,
|
|
255
|
+
subUnitId: t,
|
|
256
|
+
range: r.ref
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
return n.push(o), hn(e, t, r).forEach((i) => n.push(i)), n;
|
|
260
|
+
}
|
|
261
|
+
function hn(e, t, r) {
|
|
262
|
+
var o;
|
|
263
|
+
const n = [];
|
|
264
|
+
return (o = r.filterColumns) == null || o.forEach((a) => {
|
|
265
|
+
const i = {
|
|
266
|
+
id: Ue.id,
|
|
267
|
+
params: {
|
|
268
|
+
unitId: e,
|
|
269
|
+
subUnitId: t,
|
|
270
|
+
col: a.colId,
|
|
271
|
+
criteria: a
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
n.push(i);
|
|
275
|
+
}), n;
|
|
276
|
+
}
|
|
277
|
+
function Yi(e, t, r) {
|
|
278
|
+
var o;
|
|
279
|
+
const n = [];
|
|
280
|
+
return (o = r.filterColumns) == null || o.forEach((a) => {
|
|
281
|
+
const i = {
|
|
282
|
+
id: Ue.id,
|
|
283
|
+
params: {
|
|
284
|
+
unitId: e,
|
|
285
|
+
subUnitId: t,
|
|
286
|
+
col: a.colId,
|
|
287
|
+
criteria: null
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
n.push(i);
|
|
291
|
+
}), n;
|
|
292
|
+
}
|
|
293
|
+
function qi(e, t, r, n) {
|
|
294
|
+
if (!n)
|
|
295
|
+
return {
|
|
296
|
+
id: Ue.id,
|
|
297
|
+
params: {
|
|
298
|
+
unitId: e,
|
|
299
|
+
subUnitId: t,
|
|
300
|
+
col: r,
|
|
301
|
+
criteria: null
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
const o = n.serialize();
|
|
305
|
+
return {
|
|
306
|
+
id: Ue.id,
|
|
307
|
+
params: {
|
|
308
|
+
unitId: e,
|
|
309
|
+
subUnitId: t,
|
|
310
|
+
col: r,
|
|
311
|
+
criteria: o
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
var W = /* @__PURE__ */ ((e) => (e[e.FIRST = 0] = "FIRST", e[e.SECOND = 1] = "SECOND", e))(W || {}), N = /* @__PURE__ */ ((e) => (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))(N || {}), b;
|
|
316
|
+
((e) => {
|
|
317
|
+
e.NONE = {
|
|
318
|
+
label: "sheets-filter.conditions.none",
|
|
319
|
+
operator: N.NONE,
|
|
320
|
+
order: W.SECOND,
|
|
321
|
+
numOfParameters: 0,
|
|
322
|
+
getDefaultFormParams: () => {
|
|
323
|
+
throw new Error("[FilterConditionItems.NONE]: should not have initial form params!");
|
|
324
|
+
},
|
|
325
|
+
testMappingParams: (i) => i.operator1 === N.NONE,
|
|
326
|
+
mapToFilterColumn: () => null,
|
|
327
|
+
testMappingFilterColumn: (i) => !i.customFilters && !i.filters ? {} : !1
|
|
328
|
+
}, e.EMPTY = {
|
|
329
|
+
label: "sheets-filter.conditions.empty",
|
|
330
|
+
operator: N.EMPTY,
|
|
331
|
+
order: W.SECOND,
|
|
332
|
+
numOfParameters: 0,
|
|
333
|
+
getDefaultFormParams: () => {
|
|
334
|
+
throw new Error("[FilterConditionItems.EMPTY]: should not have initial form params!");
|
|
335
|
+
},
|
|
336
|
+
testMappingParams: ({ operator1: i }) => i === N.EMPTY,
|
|
337
|
+
mapToFilterColumn: () => ({ customFilters: { customFilters: [{ val: "" }] } }),
|
|
338
|
+
testMappingFilterColumn: (i) => {
|
|
339
|
+
var u;
|
|
340
|
+
if (((u = i.customFilters) == null ? void 0 : u.customFilters.length) !== 1)
|
|
341
|
+
return !1;
|
|
342
|
+
const s = i.customFilters.customFilters[0];
|
|
343
|
+
return s.val === "" && s.operator === void 0 ? { operator1: N.EMPTY } : !1;
|
|
344
|
+
}
|
|
345
|
+
}, e.NOT_EMPTY = {
|
|
346
|
+
label: "sheets-filter.conditions.not-empty",
|
|
347
|
+
operator: N.NOT_EMPTY,
|
|
348
|
+
order: W.SECOND,
|
|
349
|
+
numOfParameters: 0,
|
|
350
|
+
getDefaultFormParams: () => {
|
|
351
|
+
throw new Error("[FilterConditionItems.NOT_EMPTY]: should not have initial form params!");
|
|
352
|
+
},
|
|
353
|
+
testMappingParams: ({ operator1: i }) => i === N.NOT_EMPTY,
|
|
354
|
+
mapToFilterColumn: () => ({ customFilters: { customFilters: [{ val: " ", operator: v.NOT_EQUALS }] } }),
|
|
355
|
+
testMappingFilterColumn: (i) => {
|
|
356
|
+
var u;
|
|
357
|
+
if (((u = i.customFilters) == null ? void 0 : u.customFilters.length) !== 1)
|
|
358
|
+
return !1;
|
|
359
|
+
const s = i.customFilters.customFilters[0];
|
|
360
|
+
return s.val === " " && s.operator === v.NOT_EQUALS ? { operator1: N.NOT_EMPTY } : !1;
|
|
361
|
+
}
|
|
362
|
+
}, e.TEXT_CONTAINS = {
|
|
363
|
+
label: "sheets-filter.conditions.text-contains",
|
|
364
|
+
operator: N.CONTAINS,
|
|
365
|
+
order: W.FIRST,
|
|
366
|
+
numOfParameters: 1,
|
|
367
|
+
getDefaultFormParams: () => ({ operator1: N.CONTAINS, val1: "" }),
|
|
368
|
+
testMappingParams: (i) => {
|
|
369
|
+
const [s] = se(i);
|
|
370
|
+
return s === N.CONTAINS;
|
|
371
|
+
},
|
|
372
|
+
mapToFilterColumn: (i) => {
|
|
373
|
+
const { val1: s } = i;
|
|
374
|
+
return s === "" ? null : {
|
|
375
|
+
customFilters: { customFilters: [{ val: `*${s}*` }] }
|
|
376
|
+
};
|
|
377
|
+
},
|
|
378
|
+
testMappingFilterColumn: (i) => {
|
|
379
|
+
var u;
|
|
380
|
+
if (((u = i.customFilters) == null ? void 0 : u.customFilters.length) !== 1)
|
|
381
|
+
return !1;
|
|
382
|
+
const s = i.customFilters.customFilters[0], l = s.val.toString();
|
|
383
|
+
return !s.operator && l.startsWith("*") && l.endsWith("*") ? { operator1: N.CONTAINS, val1: l.slice(1, -1) } : !1;
|
|
384
|
+
}
|
|
385
|
+
}, e.DOES_NOT_CONTAIN = {
|
|
386
|
+
label: "sheets-filter.conditions.does-not-contain",
|
|
387
|
+
operator: N.DOES_NOT_CONTAIN,
|
|
388
|
+
order: W.FIRST,
|
|
389
|
+
numOfParameters: 1,
|
|
390
|
+
getDefaultFormParams: () => ({ operator1: N.DOES_NOT_CONTAIN, val1: "" }),
|
|
391
|
+
mapToFilterColumn: (i) => ({
|
|
392
|
+
customFilters: { customFilters: [{ val: `*${i.val1}*`, operator: v.NOT_EQUALS }] }
|
|
393
|
+
}),
|
|
394
|
+
testMappingParams: (i) => {
|
|
395
|
+
const [s] = se(i);
|
|
396
|
+
return s === N.DOES_NOT_CONTAIN;
|
|
397
|
+
},
|
|
398
|
+
testMappingFilterColumn: (i) => {
|
|
399
|
+
var u;
|
|
400
|
+
if (((u = i.customFilters) == null ? void 0 : u.customFilters.length) !== 1)
|
|
401
|
+
return !1;
|
|
402
|
+
const s = i.customFilters.customFilters[0], l = s.val.toString();
|
|
403
|
+
return s.operator === v.NOT_EQUALS && l.startsWith("*") && l.endsWith("*") ? { operator1: N.DOES_NOT_CONTAIN, val1: l.slice(1, -1) } : !1;
|
|
404
|
+
}
|
|
405
|
+
}, e.STARTS_WITH = {
|
|
406
|
+
label: "sheets-filter.conditions.starts-with",
|
|
407
|
+
operator: N.STARTS_WITH,
|
|
408
|
+
order: W.FIRST,
|
|
409
|
+
numOfParameters: 1,
|
|
410
|
+
getDefaultFormParams: () => ({ operator1: N.STARTS_WITH, val1: "" }),
|
|
411
|
+
mapToFilterColumn: (i) => ({
|
|
412
|
+
customFilters: { customFilters: [{ val: `${i.val1}*` }] }
|
|
413
|
+
}),
|
|
414
|
+
testMappingParams: (i) => {
|
|
415
|
+
const [s] = se(i);
|
|
416
|
+
return s === N.STARTS_WITH;
|
|
417
|
+
},
|
|
418
|
+
testMappingFilterColumn: (i) => {
|
|
419
|
+
var u;
|
|
420
|
+
if (((u = i.customFilters) == null ? void 0 : u.customFilters.length) !== 1)
|
|
421
|
+
return !1;
|
|
422
|
+
const s = i.customFilters.customFilters[0], l = s.val.toString();
|
|
423
|
+
return !s.operator && l.endsWith("*") && !l.startsWith("*") ? { operator1: N.STARTS_WITH, val1: l.slice(0, -1) } : !1;
|
|
424
|
+
}
|
|
425
|
+
}, e.ENDS_WITH = {
|
|
426
|
+
label: "sheets-filter.conditions.ends-with",
|
|
427
|
+
operator: N.ENDS_WITH,
|
|
428
|
+
order: W.FIRST,
|
|
429
|
+
numOfParameters: 1,
|
|
430
|
+
getDefaultFormParams: () => ({ operator1: N.ENDS_WITH, val1: "" }),
|
|
431
|
+
mapToFilterColumn: (i) => ({
|
|
432
|
+
customFilters: { customFilters: [{ val: `*${i.val1}` }] }
|
|
433
|
+
}),
|
|
434
|
+
testMappingParams: (i) => {
|
|
435
|
+
const [s] = se(i);
|
|
436
|
+
return s === N.ENDS_WITH;
|
|
437
|
+
},
|
|
438
|
+
testMappingFilterColumn: (i) => {
|
|
439
|
+
var u;
|
|
440
|
+
if (((u = i.customFilters) == null ? void 0 : u.customFilters.length) !== 1)
|
|
441
|
+
return !1;
|
|
442
|
+
const s = i.customFilters.customFilters[0], l = s.val.toString();
|
|
443
|
+
return !s.operator && l.startsWith("*") && !l.endsWith("*") ? { operator1: N.ENDS_WITH, val1: l.slice(1) } : !1;
|
|
444
|
+
}
|
|
445
|
+
}, e.EQUALS = {
|
|
446
|
+
label: "sheets-filter.conditions.equals",
|
|
447
|
+
operator: N.EQUALS,
|
|
448
|
+
order: W.FIRST,
|
|
449
|
+
numOfParameters: 1,
|
|
450
|
+
getDefaultFormParams: () => ({ operator1: N.EQUALS, val1: "" }),
|
|
451
|
+
testMappingParams: (i) => {
|
|
452
|
+
const [s] = se(i);
|
|
453
|
+
return s === N.EQUALS;
|
|
454
|
+
},
|
|
455
|
+
mapToFilterColumn: (i) => {
|
|
456
|
+
const { val1: s } = i;
|
|
457
|
+
return s === "" ? null : {
|
|
458
|
+
customFilters: { customFilters: [{ val: s }] }
|
|
459
|
+
};
|
|
460
|
+
},
|
|
461
|
+
testMappingFilterColumn: (i) => {
|
|
462
|
+
var s, l, u;
|
|
463
|
+
return ((l = (s = i.filters) == null ? void 0 : s.filters) == null ? void 0 : l.length) === 1 ? { operator1: N.EQUALS, val1: "" } : ((u = i.customFilters) == null ? void 0 : u.customFilters.length) === 1 && !i.customFilters.customFilters[0].operator ? { operator1: N.EQUALS, val1: i.customFilters.customFilters[0].val.toString() } : !1;
|
|
464
|
+
}
|
|
465
|
+
}, e.GREATER_THAN = {
|
|
466
|
+
label: "sheets-filter.conditions.greater-than",
|
|
467
|
+
operator: v.GREATER_THAN,
|
|
468
|
+
numOfParameters: 1,
|
|
469
|
+
order: W.FIRST,
|
|
470
|
+
getDefaultFormParams: () => ({ operator1: v.GREATER_THAN, val1: "" }),
|
|
471
|
+
mapToFilterColumn: (i) => ({
|
|
472
|
+
customFilters: { customFilters: [{ val: i.val1, operator: v.GREATER_THAN }] }
|
|
473
|
+
}),
|
|
474
|
+
testMappingParams: (i) => {
|
|
475
|
+
const [s] = se(i);
|
|
476
|
+
return s === v.GREATER_THAN;
|
|
477
|
+
},
|
|
478
|
+
testMappingFilterColumn: (i) => {
|
|
479
|
+
var l;
|
|
480
|
+
if (((l = i.customFilters) == null ? void 0 : l.customFilters.length) !== 1)
|
|
481
|
+
return !1;
|
|
482
|
+
const s = i.customFilters.customFilters[0];
|
|
483
|
+
return s.operator !== v.GREATER_THAN ? !1 : { operator1: v.GREATER_THAN, val1: s.val.toString() };
|
|
484
|
+
}
|
|
485
|
+
}, e.GREATER_THAN_OR_EQUAL = {
|
|
486
|
+
label: "sheets-filter.conditions.greater-than-or-equal",
|
|
487
|
+
operator: v.GREATER_THAN_OR_EQUAL,
|
|
488
|
+
numOfParameters: 1,
|
|
489
|
+
order: W.FIRST,
|
|
490
|
+
getDefaultFormParams: () => ({ operator1: v.GREATER_THAN_OR_EQUAL, val1: "" }),
|
|
491
|
+
testMappingParams: (i) => {
|
|
492
|
+
const [s] = se(i);
|
|
493
|
+
return s === v.GREATER_THAN_OR_EQUAL;
|
|
494
|
+
},
|
|
495
|
+
mapToFilterColumn: (i) => ({
|
|
496
|
+
customFilters: { customFilters: [{ val: i.val1, operator: v.GREATER_THAN_OR_EQUAL }] }
|
|
497
|
+
}),
|
|
498
|
+
testMappingFilterColumn: (i) => {
|
|
499
|
+
var l;
|
|
500
|
+
if (((l = i.customFilters) == null ? void 0 : l.customFilters.length) !== 1)
|
|
501
|
+
return !1;
|
|
502
|
+
const s = i.customFilters.customFilters[0];
|
|
503
|
+
return s.operator !== v.GREATER_THAN_OR_EQUAL ? !1 : { operator1: v.GREATER_THAN_OR_EQUAL, val1: s.val.toString() };
|
|
504
|
+
}
|
|
505
|
+
}, e.LESS_THAN = {
|
|
506
|
+
label: "sheets-filter.conditions.less-than",
|
|
507
|
+
operator: v.LESS_THAN,
|
|
508
|
+
numOfParameters: 1,
|
|
509
|
+
order: W.FIRST,
|
|
510
|
+
getDefaultFormParams: () => ({ operator1: v.LESS_THAN, val1: "" }),
|
|
511
|
+
testMappingParams: (i) => {
|
|
512
|
+
const [s] = se(i);
|
|
513
|
+
return s === v.LESS_THAN;
|
|
514
|
+
},
|
|
515
|
+
mapToFilterColumn: (i) => ({
|
|
516
|
+
customFilters: { customFilters: [{ val: i.val1, operator: v.LESS_THAN }] }
|
|
517
|
+
}),
|
|
518
|
+
testMappingFilterColumn: (i) => {
|
|
519
|
+
var l;
|
|
520
|
+
if (((l = i.customFilters) == null ? void 0 : l.customFilters.length) !== 1)
|
|
521
|
+
return !1;
|
|
522
|
+
const s = i.customFilters.customFilters[0];
|
|
523
|
+
return s.operator !== v.LESS_THAN ? !1 : { operator1: v.LESS_THAN, val1: s.val.toString() };
|
|
524
|
+
}
|
|
525
|
+
}, e.LESS_THAN_OR_EQUAL = {
|
|
526
|
+
label: "sheets-filter.conditions.less-than-or-equal",
|
|
527
|
+
operator: v.LESS_THAN_OR_EQUAL,
|
|
528
|
+
numOfParameters: 1,
|
|
529
|
+
order: W.FIRST,
|
|
530
|
+
getDefaultFormParams: () => ({ operator1: v.LESS_THAN_OR_EQUAL, val1: "" }),
|
|
531
|
+
testMappingParams: (i) => {
|
|
532
|
+
const [s] = se(i);
|
|
533
|
+
return s === v.LESS_THAN_OR_EQUAL;
|
|
534
|
+
},
|
|
535
|
+
mapToFilterColumn: (i) => ({
|
|
536
|
+
customFilters: { customFilters: [{ val: i.val1, operator: v.LESS_THAN_OR_EQUAL }] }
|
|
537
|
+
}),
|
|
538
|
+
testMappingFilterColumn: (i) => {
|
|
539
|
+
var l;
|
|
540
|
+
if (((l = i.customFilters) == null ? void 0 : l.customFilters.length) !== 1)
|
|
541
|
+
return !1;
|
|
542
|
+
const s = i.customFilters.customFilters[0];
|
|
543
|
+
return s.operator !== v.LESS_THAN_OR_EQUAL ? !1 : { operator1: v.LESS_THAN_OR_EQUAL, val1: s.val.toString() };
|
|
544
|
+
}
|
|
545
|
+
}, e.EQUAL = {
|
|
546
|
+
label: "sheets-filter.conditions.equal",
|
|
547
|
+
operator: v.EQUAL,
|
|
548
|
+
numOfParameters: 1,
|
|
549
|
+
order: W.FIRST,
|
|
550
|
+
getDefaultFormParams: () => ({ operator1: v.EQUAL, val1: "" }),
|
|
551
|
+
testMappingParams: (i) => {
|
|
552
|
+
const [s] = se(i);
|
|
553
|
+
return s === v.EQUAL;
|
|
554
|
+
},
|
|
555
|
+
mapToFilterColumn: (i) => ({
|
|
556
|
+
customFilters: { customFilters: [{ val: i.val1, operator: v.EQUAL }] }
|
|
557
|
+
}),
|
|
558
|
+
testMappingFilterColumn: (i) => {
|
|
559
|
+
var l;
|
|
560
|
+
if (((l = i.customFilters) == null ? void 0 : l.customFilters.length) !== 1)
|
|
561
|
+
return !1;
|
|
562
|
+
const s = i.customFilters.customFilters[0];
|
|
563
|
+
return s.operator !== v.EQUAL ? !1 : { operator1: v.EQUAL, val1: s.val.toString() };
|
|
564
|
+
}
|
|
565
|
+
}, e.NOT_EQUAL = {
|
|
566
|
+
label: "sheets-filter.conditions.not-equal",
|
|
567
|
+
operator: v.NOT_EQUALS,
|
|
568
|
+
numOfParameters: 1,
|
|
569
|
+
order: W.FIRST,
|
|
570
|
+
getDefaultFormParams: () => ({ operator1: v.NOT_EQUALS, val1: "" }),
|
|
571
|
+
testMappingParams: (i) => {
|
|
572
|
+
const [s] = se(i);
|
|
573
|
+
return s === v.NOT_EQUALS;
|
|
574
|
+
},
|
|
575
|
+
mapToFilterColumn: (i) => ({
|
|
576
|
+
customFilters: { customFilters: [{ val: i.val1, operator: v.NOT_EQUALS }] }
|
|
577
|
+
}),
|
|
578
|
+
testMappingFilterColumn: (i) => {
|
|
579
|
+
var l;
|
|
580
|
+
if (((l = i.customFilters) == null ? void 0 : l.customFilters.length) !== 1)
|
|
581
|
+
return !1;
|
|
582
|
+
const s = i.customFilters.customFilters[0];
|
|
583
|
+
return s.operator !== v.NOT_EQUALS ? !1 : { operator1: v.NOT_EQUALS, val1: s.val.toString() };
|
|
584
|
+
}
|
|
585
|
+
}, e.BETWEEN = {
|
|
586
|
+
label: "sheets-filter.conditions.between",
|
|
587
|
+
operator: N.BETWEEN,
|
|
588
|
+
order: W.SECOND,
|
|
589
|
+
numOfParameters: 2,
|
|
590
|
+
getDefaultFormParams: () => ({
|
|
591
|
+
and: !0,
|
|
592
|
+
operator1: v.GREATER_THAN_OR_EQUAL,
|
|
593
|
+
val1: "",
|
|
594
|
+
operator2: v.LESS_THAN_OR_EQUAL,
|
|
595
|
+
val2: ""
|
|
596
|
+
}),
|
|
597
|
+
testMappingParams: (i) => {
|
|
598
|
+
const { and: s, operator1: l, operator2: u } = i;
|
|
599
|
+
if (!s)
|
|
600
|
+
return !1;
|
|
601
|
+
const c = [l, u];
|
|
602
|
+
return c.includes(v.GREATER_THAN_OR_EQUAL) && c.includes(v.LESS_THAN_OR_EQUAL);
|
|
603
|
+
},
|
|
604
|
+
mapToFilterColumn: (i) => {
|
|
605
|
+
const { val1: s, val2: l, operator1: u } = i, c = u === v.GREATER_THAN_OR_EQUAL;
|
|
606
|
+
return {
|
|
607
|
+
customFilters: {
|
|
608
|
+
and: Cr.TRUE,
|
|
609
|
+
customFilters: [
|
|
610
|
+
{ val: c ? s : l, operator: v.GREATER_THAN_OR_EQUAL },
|
|
611
|
+
{ val: c ? l : s, operator: v.LESS_THAN_OR_EQUAL }
|
|
612
|
+
]
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
},
|
|
616
|
+
testMappingFilterColumn: (i) => {
|
|
617
|
+
var u;
|
|
618
|
+
if (((u = i.customFilters) == null ? void 0 : u.customFilters.length) !== 2)
|
|
619
|
+
return !1;
|
|
620
|
+
const [s, l] = i.customFilters.customFilters;
|
|
621
|
+
return s.operator === v.GREATER_THAN_OR_EQUAL && l.operator === v.LESS_THAN_OR_EQUAL && i.customFilters.and ? {
|
|
622
|
+
and: !0,
|
|
623
|
+
operator1: v.GREATER_THAN_OR_EQUAL,
|
|
624
|
+
val1: s.val.toString(),
|
|
625
|
+
operator2: v.LESS_THAN_OR_EQUAL,
|
|
626
|
+
val2: l.val.toString()
|
|
627
|
+
} : l.operator === v.GREATER_THAN_OR_EQUAL && s.operator === v.LESS_THAN_OR_EQUAL && i.customFilters.and ? {
|
|
628
|
+
and: !0,
|
|
629
|
+
operator1: v.GREATER_THAN_OR_EQUAL,
|
|
630
|
+
val1: l.val.toString(),
|
|
631
|
+
operator2: v.LESS_THAN_OR_EQUAL,
|
|
632
|
+
val2: s.val.toLocaleString()
|
|
633
|
+
} : !1;
|
|
634
|
+
}
|
|
635
|
+
}, e.NOT_BETWEEN = {
|
|
636
|
+
label: "sheets-filter.conditions.not-between",
|
|
637
|
+
operator: N.NOT_BETWEEN,
|
|
638
|
+
order: W.SECOND,
|
|
639
|
+
numOfParameters: 2,
|
|
640
|
+
getDefaultFormParams: () => ({
|
|
641
|
+
operator1: v.LESS_THAN,
|
|
642
|
+
val1: "",
|
|
643
|
+
operator2: v.GREATER_THAN,
|
|
644
|
+
val2: ""
|
|
645
|
+
}),
|
|
646
|
+
testMappingParams: (i) => {
|
|
647
|
+
const { and: s, operator1: l, operator2: u } = i;
|
|
648
|
+
if (s)
|
|
649
|
+
return !1;
|
|
650
|
+
const c = [l, u];
|
|
651
|
+
return c.includes(v.GREATER_THAN) && c.includes(v.LESS_THAN);
|
|
652
|
+
},
|
|
653
|
+
mapToFilterColumn: (i) => {
|
|
654
|
+
const { val1: s, val2: l, operator1: u } = i, c = u === v.GREATER_THAN;
|
|
655
|
+
return {
|
|
656
|
+
customFilters: {
|
|
657
|
+
customFilters: [
|
|
658
|
+
{ val: c ? s : l, operator: v.GREATER_THAN },
|
|
659
|
+
{ val: c ? l : s, operator: v.LESS_THAN }
|
|
660
|
+
]
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
},
|
|
664
|
+
testMappingFilterColumn: (i) => {
|
|
665
|
+
var u;
|
|
666
|
+
if (((u = i.customFilters) == null ? void 0 : u.customFilters.length) !== 2)
|
|
667
|
+
return !1;
|
|
668
|
+
const [s, l] = i.customFilters.customFilters;
|
|
669
|
+
return s.operator === v.LESS_THAN && l.operator === v.GREATER_THAN && !i.customFilters.and ? {
|
|
670
|
+
operator1: v.LESS_THAN,
|
|
671
|
+
val1: s.val.toString(),
|
|
672
|
+
operator2: v.GREATER_THAN,
|
|
673
|
+
val2: l.val.toString()
|
|
674
|
+
} : l.operator === v.LESS_THAN && s.operator === v.GREATER_THAN && !i.customFilters.and ? {
|
|
675
|
+
operator1: v.GREATER_THAN,
|
|
676
|
+
val1: l.val.toString(),
|
|
677
|
+
operator2: v.LESS_THAN,
|
|
678
|
+
val2: s.val.toLocaleString()
|
|
679
|
+
} : !1;
|
|
680
|
+
}
|
|
681
|
+
}, e.CUSTOM = {
|
|
682
|
+
label: "sheets-filter.conditions.custom",
|
|
683
|
+
operator: N.CUSTOM,
|
|
684
|
+
order: W.SECOND,
|
|
685
|
+
numOfParameters: 2,
|
|
686
|
+
getDefaultFormParams: () => ({
|
|
687
|
+
operator1: N.NONE,
|
|
688
|
+
val1: "",
|
|
689
|
+
operator2: N.NONE,
|
|
690
|
+
val2: ""
|
|
691
|
+
}),
|
|
692
|
+
testMappingParams: () => !0,
|
|
693
|
+
mapToFilterColumn: (i) => {
|
|
694
|
+
const { and: s, val1: l, val2: u, operator1: c, operator2: f } = i;
|
|
695
|
+
function d(T, I) {
|
|
696
|
+
for (const F of e.ALL_CONDITIONS)
|
|
697
|
+
if (F.operator === T)
|
|
698
|
+
return F.mapToFilterColumn({ val1: I, operator1: T });
|
|
699
|
+
}
|
|
700
|
+
const h = !c || c === e.NONE.operator, g = !f || f === e.NONE.operator;
|
|
701
|
+
if (h && g)
|
|
702
|
+
return e.NONE.mapToFilterColumn({});
|
|
703
|
+
if (h)
|
|
704
|
+
return d(f, u);
|
|
705
|
+
if (g)
|
|
706
|
+
return d(c, l);
|
|
707
|
+
const _ = d(c, l), p = d(f, u), S = {
|
|
708
|
+
customFilters: [
|
|
709
|
+
_.customFilters.customFilters[0],
|
|
710
|
+
p.customFilters.customFilters[0]
|
|
711
|
+
]
|
|
712
|
+
};
|
|
713
|
+
return s && (S.and = Cr.TRUE), { customFilters: S };
|
|
714
|
+
},
|
|
715
|
+
testMappingFilterColumn: (i) => {
|
|
716
|
+
var u;
|
|
717
|
+
if (((u = i.customFilters) == null ? void 0 : u.customFilters.length) !== 2)
|
|
718
|
+
return !1;
|
|
719
|
+
const s = i.customFilters.customFilters.map((c) => a({ customFilters: { customFilters: [c] } })), l = {
|
|
720
|
+
operator1: s[0][0].operator,
|
|
721
|
+
val1: s[0][1].val1,
|
|
722
|
+
operator2: s[1][0].operator,
|
|
723
|
+
val2: s[1][1].val1
|
|
724
|
+
};
|
|
725
|
+
return i.customFilters.and && (l.and = !0), l;
|
|
726
|
+
}
|
|
727
|
+
}, e.ALL_CONDITIONS = [
|
|
728
|
+
// ------------------------------
|
|
729
|
+
e.NONE,
|
|
730
|
+
// ------------------------------
|
|
731
|
+
e.EMPTY,
|
|
732
|
+
e.NOT_EMPTY,
|
|
733
|
+
// ------------------------------
|
|
734
|
+
e.TEXT_CONTAINS,
|
|
735
|
+
e.DOES_NOT_CONTAIN,
|
|
736
|
+
e.STARTS_WITH,
|
|
737
|
+
e.ENDS_WITH,
|
|
738
|
+
e.EQUALS,
|
|
739
|
+
// ------------------------------
|
|
740
|
+
e.GREATER_THAN,
|
|
741
|
+
e.GREATER_THAN_OR_EQUAL,
|
|
742
|
+
e.LESS_THAN,
|
|
743
|
+
e.LESS_THAN_OR_EQUAL,
|
|
744
|
+
e.EQUAL,
|
|
745
|
+
e.NOT_EQUAL,
|
|
746
|
+
e.BETWEEN,
|
|
747
|
+
e.NOT_BETWEEN,
|
|
748
|
+
// ------------------------------
|
|
749
|
+
e.CUSTOM
|
|
750
|
+
];
|
|
751
|
+
function t(i) {
|
|
752
|
+
const s = e.ALL_CONDITIONS.find((l) => l.operator === i);
|
|
753
|
+
if (!s)
|
|
754
|
+
throw new Error(`[SheetsFilter]: no condition item found for operator: ${i}`);
|
|
755
|
+
return s;
|
|
756
|
+
}
|
|
757
|
+
e.getItemByOperator = t;
|
|
758
|
+
function r(i, s) {
|
|
759
|
+
for (const l of e.ALL_CONDITIONS.filter((u) => u.numOfParameters === s))
|
|
760
|
+
if (l.numOfParameters !== 0 && l.testMappingParams(i))
|
|
761
|
+
return l;
|
|
762
|
+
for (const l of e.ALL_CONDITIONS)
|
|
763
|
+
if (l.testMappingParams(i))
|
|
764
|
+
return l;
|
|
765
|
+
throw new Error("[SheetsFilter]: no condition item can be mapped from the filter map params!");
|
|
766
|
+
}
|
|
767
|
+
e.testMappingParams = r;
|
|
768
|
+
function n(i) {
|
|
769
|
+
const s = e.ALL_CONDITIONS.find((l) => l.operator === i);
|
|
770
|
+
return (s == null ? void 0 : s.numOfParameters) === 0 ? { operator1: s.operator } : s.getDefaultFormParams();
|
|
771
|
+
}
|
|
772
|
+
e.getInitialFormParams = n;
|
|
773
|
+
function o(i, s) {
|
|
774
|
+
return i.mapToFilterColumn(s);
|
|
775
|
+
}
|
|
776
|
+
e.mapToFilterColumn = o;
|
|
777
|
+
function a(i) {
|
|
778
|
+
if (!i)
|
|
779
|
+
return [e.NONE, {}];
|
|
780
|
+
for (const s of e.ALL_CONDITIONS) {
|
|
781
|
+
const l = s.testMappingFilterColumn(i);
|
|
782
|
+
if (l)
|
|
783
|
+
return [s, l];
|
|
784
|
+
}
|
|
785
|
+
return [e.NONE, {}];
|
|
786
|
+
}
|
|
787
|
+
e.testMappingFilterColumn = a;
|
|
788
|
+
})(b || (b = {}));
|
|
789
|
+
function se(e) {
|
|
790
|
+
const { operator1: t, operator2: r, val1: n, val2: o } = e;
|
|
791
|
+
if (t && r)
|
|
792
|
+
throw new Error("Both operator1 and operator2 are set!");
|
|
793
|
+
if (!t && !r)
|
|
794
|
+
throw new Error("Neither operator1 and operator2 and both not set!");
|
|
795
|
+
return t ? [t, n] : [r, o];
|
|
796
|
+
}
|
|
797
|
+
function qt(e) {
|
|
798
|
+
const t = [], r = [];
|
|
799
|
+
for (const n of e)
|
|
800
|
+
n.checked ? t.push(n) : r.push(n);
|
|
801
|
+
return {
|
|
802
|
+
checkedItems: t,
|
|
803
|
+
uncheckedItems: r,
|
|
804
|
+
checked: t.length,
|
|
805
|
+
unchecked: r.length
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
var Xi = Object.defineProperty, Ki = Object.getOwnPropertyDescriptor, ur = (e, t, r, n) => {
|
|
809
|
+
for (var o = n > 1 ? void 0 : n ? Ki(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
810
|
+
(i = e[a]) && (o = (n ? i(t, r, o) : i(o)) || o);
|
|
811
|
+
return n && o && Xi(t, r, o), o;
|
|
812
|
+
}, Le = (e, t) => (r, n) => t(r, n, e), pt = /* @__PURE__ */ ((e) => (e[e.VALUES = 0] = "VALUES", e[e.CONDITIONS = 1] = "CONDITIONS", e))(pt || {});
|
|
813
|
+
ri("sheets-filter-ui.sheets-filter-panel.service");
|
|
814
|
+
let be = class extends rr {
|
|
815
|
+
constructor(t, r, n, o) {
|
|
816
|
+
super();
|
|
817
|
+
C(this, "_filterBy$", new Ne(
|
|
818
|
+
0
|
|
819
|
+
/* VALUES */
|
|
820
|
+
));
|
|
821
|
+
C(this, "filterBy$", this._filterBy$.asObservable());
|
|
822
|
+
C(this, "_filterByModel$", new ci(1));
|
|
823
|
+
C(this, "filterByModel$", this._filterByModel$.asObservable());
|
|
824
|
+
C(this, "_filterByModel", null);
|
|
825
|
+
C(this, "_hasCriteria$", new Ne(!1));
|
|
826
|
+
C(this, "hasCriteria$", this._hasCriteria$.asObservable());
|
|
827
|
+
C(this, "_filterModel", null);
|
|
828
|
+
C(this, "_col$", new Ne(-1));
|
|
829
|
+
C(this, "col$", this._col$.asObservable());
|
|
830
|
+
C(this, "_filterHeaderListener", null);
|
|
831
|
+
this._injector = t, this._sheetsFilterService = r, this._univerInstanceService = n, this._refRangeService = o;
|
|
832
|
+
}
|
|
833
|
+
get filterBy() {
|
|
834
|
+
return this._filterBy$.getValue();
|
|
835
|
+
}
|
|
836
|
+
get filterByModel() {
|
|
837
|
+
return this._filterByModel;
|
|
838
|
+
}
|
|
839
|
+
set filterByModel(t) {
|
|
840
|
+
this._filterByModel = t, this._filterByModel$.next(t);
|
|
841
|
+
}
|
|
842
|
+
get filterModel() {
|
|
843
|
+
return this._filterModel;
|
|
844
|
+
}
|
|
845
|
+
get col() {
|
|
846
|
+
return this._col$.getValue();
|
|
847
|
+
}
|
|
848
|
+
dispose() {
|
|
849
|
+
this._filterBy$.complete(), this._filterByModel$.complete(), this._hasCriteria$.complete();
|
|
850
|
+
}
|
|
851
|
+
setupCol(t, r) {
|
|
852
|
+
this.terminate(), this._filterModel = t, this._col$.next(r);
|
|
853
|
+
const n = t.getFilterColumn(r);
|
|
854
|
+
if (n) {
|
|
855
|
+
const o = n.getColumnData();
|
|
856
|
+
return o.customFilters ? (this._hasCriteria$.next(!0), this._setupByConditions(t, r)) : o.filters ? (this._hasCriteria$.next(!0), this._setupByValues(t, r)) : (this._hasCriteria$.next(!1), this._setupByValues(t, r));
|
|
857
|
+
}
|
|
858
|
+
return this._hasCriteria$.next(!1), this._setupByValues(t, r);
|
|
859
|
+
}
|
|
860
|
+
changeFilterBy(t) {
|
|
861
|
+
return !this._filterModel || this.col === -1 ? !1 : (t === 0 ? this._setupByValues(this._filterModel, this.col) : this._setupByConditions(this._filterModel, this.col), !0);
|
|
862
|
+
}
|
|
863
|
+
terminate() {
|
|
864
|
+
return this._filterModel = null, this._col$.next(-1), this._disposeFilterHeaderChangeListener(), !0;
|
|
865
|
+
}
|
|
866
|
+
_disposeFilterHeaderChangeListener() {
|
|
867
|
+
var t;
|
|
868
|
+
(t = this._filterHeaderListener) == null || t.dispose(), this._filterHeaderListener = null;
|
|
869
|
+
}
|
|
870
|
+
_listenToFilterHeaderChange(t, r) {
|
|
871
|
+
this._disposeFilterHeaderChangeListener();
|
|
872
|
+
const n = t.unitId, o = t.subUnitId, a = t.getRange(), i = {
|
|
873
|
+
startColumn: r,
|
|
874
|
+
startRow: a.startRow,
|
|
875
|
+
endRow: a.startRow,
|
|
876
|
+
endColumn: r
|
|
877
|
+
};
|
|
878
|
+
this._filterHeaderListener = this._refRangeService.watchRange(n, o, i, (s, l) => {
|
|
879
|
+
if (!l)
|
|
880
|
+
this.terminate();
|
|
881
|
+
else {
|
|
882
|
+
const u = l.startColumn - s.startColumn;
|
|
883
|
+
u !== 0 && this._filterByModel.deltaCol(u);
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
_setupByValues(t, r) {
|
|
888
|
+
this._disposePreviousModel();
|
|
889
|
+
const n = t.getRange();
|
|
890
|
+
if (n.startRow === n.endRow)
|
|
891
|
+
return !1;
|
|
892
|
+
const o = _t.fromFilterColumn(
|
|
893
|
+
this._injector,
|
|
894
|
+
t,
|
|
895
|
+
r
|
|
896
|
+
);
|
|
897
|
+
return this.filterByModel = o, this._filterBy$.next(
|
|
898
|
+
0
|
|
899
|
+
/* VALUES */
|
|
900
|
+
), this._listenToFilterHeaderChange(t, r), !0;
|
|
901
|
+
}
|
|
902
|
+
_setupByConditions(t, r) {
|
|
903
|
+
this._disposePreviousModel();
|
|
904
|
+
const n = t.getRange();
|
|
905
|
+
if (n.startRow === n.endRow)
|
|
906
|
+
return !1;
|
|
907
|
+
const o = gt.fromFilterColumn(
|
|
908
|
+
this._injector,
|
|
909
|
+
t,
|
|
910
|
+
r,
|
|
911
|
+
t.getFilterColumn(r)
|
|
912
|
+
);
|
|
913
|
+
return this.filterByModel = o, this._filterBy$.next(
|
|
914
|
+
1
|
|
915
|
+
/* CONDITIONS */
|
|
916
|
+
), this._listenToFilterHeaderChange(t, r), !0;
|
|
917
|
+
}
|
|
918
|
+
_disposePreviousModel() {
|
|
919
|
+
var t;
|
|
920
|
+
(t = this._filterByModel) == null || t.dispose(), this.filterByModel = null;
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
be = ur([
|
|
924
|
+
Le(0, G(Ot)),
|
|
925
|
+
Le(1, G(he)),
|
|
926
|
+
Le(2, Tt),
|
|
927
|
+
Le(3, G(Ai))
|
|
928
|
+
], be);
|
|
929
|
+
let gt = class extends rr {
|
|
930
|
+
constructor(t, r, n, o, a) {
|
|
931
|
+
super();
|
|
932
|
+
C(this, "canApply$", He(!0));
|
|
933
|
+
C(this, "_conditionItem$");
|
|
934
|
+
C(this, "conditionItem$");
|
|
935
|
+
C(this, "_filterConditionFormParams$");
|
|
936
|
+
C(this, "filterConditionFormParams$");
|
|
937
|
+
this._filterModel = t, this.col = r, this._commandService = a, this._conditionItem$ = new Ne(n), this.conditionItem$ = this._conditionItem$.asObservable(), this._filterConditionFormParams$ = new Ne(o), this.filterConditionFormParams$ = this._filterConditionFormParams$.asObservable();
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Create a model with targeting filter column. If there is not a filter column, the model would be created with
|
|
941
|
+
* default values.
|
|
942
|
+
*
|
|
943
|
+
* @param injector
|
|
944
|
+
* @param filterModel
|
|
945
|
+
* @param col
|
|
946
|
+
* @param filterColumn
|
|
947
|
+
*
|
|
948
|
+
* @returns the model to control the panel's state
|
|
949
|
+
*/
|
|
950
|
+
static fromFilterColumn(t, r, n, o) {
|
|
951
|
+
const [a, i] = b.testMappingFilterColumn(o == null ? void 0 : o.getColumnData());
|
|
952
|
+
return t.createInstance(gt, r, n, a, i);
|
|
953
|
+
}
|
|
954
|
+
get conditionItem() {
|
|
955
|
+
return this._conditionItem$.getValue();
|
|
956
|
+
}
|
|
957
|
+
get filterConditionFormParams() {
|
|
958
|
+
return this._filterConditionFormParams$.getValue();
|
|
959
|
+
}
|
|
960
|
+
dispose() {
|
|
961
|
+
super.dispose(), this._conditionItem$.complete(), this._filterConditionFormParams$.complete();
|
|
962
|
+
}
|
|
963
|
+
deltaCol(t) {
|
|
964
|
+
this.col += t;
|
|
965
|
+
}
|
|
966
|
+
clear() {
|
|
967
|
+
return this._disposed ? Promise.resolve(!1) : this._commandService.executeCommand($e.id, {
|
|
968
|
+
unitId: this._filterModel.unitId,
|
|
969
|
+
subUnitId: this._filterModel.subUnitId,
|
|
970
|
+
col: this.col,
|
|
971
|
+
criteria: null
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Apply the filter condition to the target filter column.
|
|
976
|
+
*/
|
|
977
|
+
async apply() {
|
|
978
|
+
if (this._disposed)
|
|
979
|
+
return !1;
|
|
980
|
+
const t = b.mapToFilterColumn(this.conditionItem, this.filterConditionFormParams);
|
|
981
|
+
return this._commandService.executeCommand($e.id, {
|
|
982
|
+
unitId: this._filterModel.unitId,
|
|
983
|
+
subUnitId: this._filterModel.subUnitId,
|
|
984
|
+
col: this.col,
|
|
985
|
+
criteria: t
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* This method would be called when user changes the primary condition. The model would load the corresponding
|
|
990
|
+
* `IFilterConditionFormParams` and load default condition form params.
|
|
991
|
+
*/
|
|
992
|
+
onPrimaryConditionChange(t) {
|
|
993
|
+
const r = b.ALL_CONDITIONS.find((n) => n.operator === t);
|
|
994
|
+
if (!r)
|
|
995
|
+
throw new Error(`[ByConditionsModel]: condition item not found for operator: ${t}!`);
|
|
996
|
+
this._conditionItem$.next(r), this._filterConditionFormParams$.next(b.getInitialFormParams(t));
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* This method would be called when user changes the primary conditions, the input values or "AND" "OR" ratio.
|
|
1000
|
+
* If the primary conditions or the ratio is changed, the method would load the corresponding `IFilterCondition`.
|
|
1001
|
+
*
|
|
1002
|
+
* When the panel call this method, it only has to pass the changed keys.
|
|
1003
|
+
*
|
|
1004
|
+
* @param params
|
|
1005
|
+
*/
|
|
1006
|
+
onConditionFormChange(t) {
|
|
1007
|
+
const r = { ...this.filterConditionFormParams, ...t };
|
|
1008
|
+
if (r.and !== !0 && delete r.and, typeof t.and < "u" || typeof t.operator1 < "u" || typeof t.operator2 < "u") {
|
|
1009
|
+
const n = b.testMappingParams(r, this.conditionItem.numOfParameters);
|
|
1010
|
+
this._conditionItem$.next(n);
|
|
1011
|
+
}
|
|
1012
|
+
this._filterConditionFormParams$.next(r);
|
|
1013
|
+
}
|
|
1014
|
+
};
|
|
1015
|
+
gt = ur([
|
|
1016
|
+
Le(4, ce)
|
|
1017
|
+
], gt);
|
|
1018
|
+
let _t = class extends rr {
|
|
1019
|
+
constructor(t, r, n, o) {
|
|
1020
|
+
super();
|
|
1021
|
+
C(this, "_rawFilterItems$");
|
|
1022
|
+
C(this, "rawFilterItems$");
|
|
1023
|
+
C(this, "filterItems$");
|
|
1024
|
+
C(this, "_filterItems", []);
|
|
1025
|
+
C(this, "canApply$");
|
|
1026
|
+
C(this, "_manuallyUpdateFilterItems$");
|
|
1027
|
+
C(this, "_searchString$");
|
|
1028
|
+
C(this, "searchString$");
|
|
1029
|
+
this._filterModel = t, this.col = r, this._commandService = o, this._searchString$ = new Ne(""), this.searchString$ = this._searchString$.asObservable(), this._rawFilterItems$ = new Ne(n), this.rawFilterItems$ = this._rawFilterItems$.asObservable(), this._manuallyUpdateFilterItems$ = new fi(), this.filterItems$ = hi(
|
|
1030
|
+
di([
|
|
1031
|
+
this._searchString$.pipe(
|
|
1032
|
+
en(500, void 0, { leading: !0, trailing: !0 }),
|
|
1033
|
+
tn(void 0)
|
|
1034
|
+
),
|
|
1035
|
+
this._rawFilterItems$
|
|
1036
|
+
]).pipe(
|
|
1037
|
+
De(([a, i]) => {
|
|
1038
|
+
if (!a)
|
|
1039
|
+
return i;
|
|
1040
|
+
const l = a.toLowerCase().split(/\s+/).filter((u) => !!u);
|
|
1041
|
+
return i.filter((u) => {
|
|
1042
|
+
const c = u.value.toLowerCase();
|
|
1043
|
+
return l.some((f) => c.includes(f));
|
|
1044
|
+
});
|
|
1045
|
+
})
|
|
1046
|
+
),
|
|
1047
|
+
this._manuallyUpdateFilterItems$
|
|
1048
|
+
).pipe(mi(1)), this.canApply$ = this.filterItems$.pipe(De((a) => qt(a).checked > 0)), this.disposeWithMe(this.filterItems$.subscribe((a) => this._filterItems = a));
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Create a model with targeting filter column. If there is not a filter column, the model would be created with
|
|
1052
|
+
* default values.
|
|
1053
|
+
*
|
|
1054
|
+
* @param injector
|
|
1055
|
+
* @param filterModel
|
|
1056
|
+
* @param col
|
|
1057
|
+
*
|
|
1058
|
+
* @returns the model to control the panel's state
|
|
1059
|
+
*/
|
|
1060
|
+
static fromFilterColumn(t, r, n) {
|
|
1061
|
+
var M;
|
|
1062
|
+
const o = t.get(Tt), a = t.get(We), { unitId: i, subUnitId: s } = r, l = o.getUniverSheetInstance(i);
|
|
1063
|
+
if (!l)
|
|
1064
|
+
throw new Error(`[ByValuesModel]: Workbook not found for filter model with unitId: ${i}!`);
|
|
1065
|
+
const u = l == null ? void 0 : l.getSheetBySheetId(s);
|
|
1066
|
+
if (!u)
|
|
1067
|
+
throw new Error(`[ByValuesModel]: Worksheet not found for filter model with unitId: ${i} and subUnitId: ${s}!`);
|
|
1068
|
+
const c = r.getRange(), f = n, d = (M = r.getFilterColumn(n)) == null ? void 0 : M.getColumnData().filters, h = !!(d && d.blank), g = { ...c, startRow: c.startRow + 1, startColumn: f, endColumn: f }, _ = [], p = {}, S = new Set(d == null ? void 0 : d.filters), T = r.getFilteredOutRowsExceptCol(n);
|
|
1069
|
+
let I = 0, F = 0;
|
|
1070
|
+
for (const O of u.iterateByColumn(g, !1, !1)) {
|
|
1071
|
+
const { row: L, rowSpan: U = 1 } = O;
|
|
1072
|
+
let B = 0;
|
|
1073
|
+
for (; B < U; ) {
|
|
1074
|
+
const X = L + B;
|
|
1075
|
+
if (T.has(X)) {
|
|
1076
|
+
B++;
|
|
1077
|
+
continue;
|
|
1078
|
+
}
|
|
1079
|
+
const k = O != null && O.value ? Jn(O.value) : "";
|
|
1080
|
+
if (!k) {
|
|
1081
|
+
F += 1, B += U;
|
|
1082
|
+
continue;
|
|
1083
|
+
}
|
|
1084
|
+
if (p[k])
|
|
1085
|
+
p[k].count++;
|
|
1086
|
+
else {
|
|
1087
|
+
const J = {
|
|
1088
|
+
value: k,
|
|
1089
|
+
checked: S.size ? S.has(k) : !h,
|
|
1090
|
+
count: 1,
|
|
1091
|
+
index: I,
|
|
1092
|
+
isEmpty: !1
|
|
1093
|
+
};
|
|
1094
|
+
p[k] = J, _.push(J);
|
|
1095
|
+
}
|
|
1096
|
+
B++;
|
|
1097
|
+
}
|
|
1098
|
+
I++;
|
|
1099
|
+
}
|
|
1100
|
+
const H = d ? h : !0;
|
|
1101
|
+
if (F > 0) {
|
|
1102
|
+
const O = {
|
|
1103
|
+
value: a.t("sheets-filter.panel.empty"),
|
|
1104
|
+
checked: H,
|
|
1105
|
+
count: F,
|
|
1106
|
+
index: I,
|
|
1107
|
+
isEmpty: !0
|
|
1108
|
+
};
|
|
1109
|
+
_.push(O);
|
|
1110
|
+
}
|
|
1111
|
+
return t.createInstance(_t, r, n, _);
|
|
1112
|
+
}
|
|
1113
|
+
get rawFilterItems() {
|
|
1114
|
+
return this._rawFilterItems$.getValue();
|
|
1115
|
+
}
|
|
1116
|
+
get filterItems() {
|
|
1117
|
+
return this._filterItems;
|
|
1118
|
+
}
|
|
1119
|
+
dispose() {
|
|
1120
|
+
this._rawFilterItems$.complete(), this._searchString$.complete();
|
|
1121
|
+
}
|
|
1122
|
+
deltaCol(t) {
|
|
1123
|
+
this.col += t;
|
|
1124
|
+
}
|
|
1125
|
+
setSearchString(t) {
|
|
1126
|
+
this._searchString$.next(t);
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Toggle a filter item.
|
|
1130
|
+
*/
|
|
1131
|
+
onFilterCheckToggled(t, r) {
|
|
1132
|
+
const n = this._filterItems.slice(), o = n.find((a) => a.index === t.index);
|
|
1133
|
+
o.checked = r, this._manuallyUpdateFilterItems(n);
|
|
1134
|
+
}
|
|
1135
|
+
onFilterOnly(t) {
|
|
1136
|
+
const r = this._filterItems.slice();
|
|
1137
|
+
r.forEach((n) => n.checked = n.index === t.index), this._manuallyUpdateFilterItems(r);
|
|
1138
|
+
}
|
|
1139
|
+
onCheckAllToggled(t) {
|
|
1140
|
+
const r = this._filterItems.slice();
|
|
1141
|
+
r.forEach((n) => n.checked = t), this._manuallyUpdateFilterItems(r);
|
|
1142
|
+
}
|
|
1143
|
+
_manuallyUpdateFilterItems(t) {
|
|
1144
|
+
this._manuallyUpdateFilterItems$.next(t);
|
|
1145
|
+
}
|
|
1146
|
+
// expose method here to let the panel change filter items
|
|
1147
|
+
// #region ByValuesModel apply methods
|
|
1148
|
+
clear() {
|
|
1149
|
+
return this._disposed ? Promise.resolve(!1) : this._commandService.executeCommand($e.id, {
|
|
1150
|
+
unitId: this._filterModel.unitId,
|
|
1151
|
+
subUnitId: this._filterModel.subUnitId,
|
|
1152
|
+
col: this.col,
|
|
1153
|
+
criteria: null
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Apply the filter condition to the target filter column.
|
|
1158
|
+
*/
|
|
1159
|
+
async apply() {
|
|
1160
|
+
if (this._disposed)
|
|
1161
|
+
return !1;
|
|
1162
|
+
const t = qt(this._filterItems), { checked: r, checkedItems: n } = t, o = this.rawFilterItems, a = r === 0, i = t.checked === o.length, s = { colId: this.col };
|
|
1163
|
+
if (a)
|
|
1164
|
+
throw new Error("[ByValuesModel]: no checked items!");
|
|
1165
|
+
if (i)
|
|
1166
|
+
return this._commandService.executeCommand($e.id, {
|
|
1167
|
+
unitId: this._filterModel.unitId,
|
|
1168
|
+
subUnitId: this._filterModel.subUnitId,
|
|
1169
|
+
col: this.col,
|
|
1170
|
+
criteria: null
|
|
1171
|
+
});
|
|
1172
|
+
{
|
|
1173
|
+
s.filters = {};
|
|
1174
|
+
const l = n.filter((c) => !c.isEmpty);
|
|
1175
|
+
l.length > 0 && (s.filters = { filters: l.map((c) => c.value) }), l.length !== n.length && (s.filters.blank = !0);
|
|
1176
|
+
}
|
|
1177
|
+
return this._commandService.executeCommand($e.id, {
|
|
1178
|
+
unitId: this._filterModel.unitId,
|
|
1179
|
+
subUnitId: this._filterModel.subUnitId,
|
|
1180
|
+
col: this.col,
|
|
1181
|
+
criteria: s
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
// #endregion
|
|
1185
|
+
};
|
|
1186
|
+
_t = ur([
|
|
1187
|
+
Le(3, ce)
|
|
1188
|
+
], _t);
|
|
1189
|
+
const xe = "FILTER_PANEL_OPENED", dn = {
|
|
1190
|
+
id: "sheet.operation.open-filter-panel",
|
|
1191
|
+
type: Te.OPERATION,
|
|
1192
|
+
handler: (e, t) => {
|
|
1193
|
+
const r = e.get(Rt), n = e.get(he), o = e.get(be);
|
|
1194
|
+
e.get(ce).syncExecuteCommand(Si.id, { visible: !1 });
|
|
1195
|
+
const { unitId: i, subUnitId: s, col: l } = t, u = n.getFilterModel(i, s);
|
|
1196
|
+
return !u || !o.setupCol(u, l) ? !1 : (r.getContextValue(xe) || r.setContextValue(xe, !0), !0);
|
|
1197
|
+
}
|
|
1198
|
+
}, Ze = {
|
|
1199
|
+
id: "sheet.operation.close-filter-panel",
|
|
1200
|
+
type: Te.OPERATION,
|
|
1201
|
+
handler: (e) => {
|
|
1202
|
+
const t = e.get(Rt), r = e.get(be), n = e.get(ii, Jr.OPTIONAL);
|
|
1203
|
+
return t.getContextValue(xe) ? (t.setContextValue(xe, !1), n == null || n.focus(), r.terminate()) : !1;
|
|
1204
|
+
}
|
|
1205
|
+
}, mn = {
|
|
1206
|
+
id: "sheet.operation.apply-filter",
|
|
1207
|
+
type: Te.OPERATION,
|
|
1208
|
+
handler: (e, t) => {
|
|
1209
|
+
const { filterBy: r } = t;
|
|
1210
|
+
return e.get(be).changeFilterBy(r);
|
|
1211
|
+
}
|
|
1212
|
+
}, Zi = "univer-sheets-filter-panel", Ji = "univer-sheets-filter-panel-header", eo = "univer-sheets-filter-panel-content", to = "univer-sheets-filter-panel-select-all", ro = "univer-sheets-filter-panel-select-all-count", no = "univer-sheets-filter-panel-values-container", io = "univer-input-affix-wrapper", oo = "univer-select", so = "univer-radio-group", ao = "univer-sheets-filter-panel-values-find", lo = "univer-sheets-filter-panel-values-list", uo = "univer-sheets-filter-panel-values-list-inner-container", co = "univer-sheets-filter-panel-values-virtual", fo = "univer-sheets-filter-panel-values-item", ho = "univer-sheets-filter-panel-values-item-inner", mo = "univer-sheets-filter-panel-values-item-count", vo = "univer-sheets-filter-panel-values-item-exclude-button", po = "univer-sheets-filter-panel-values-item-text", go = "univer-sheets-filter-panel-conditions-container", _o = "univer-sheets-filter-panel-conditions-container-inner", So = "univer-sheets-filter-panel-conditions-desc", Eo = "univer-sheets-filter-panel-footer", yo = "univer-sheets-filter-panel-footer-primary-buttons", bo = "univer-button", To = "univer-input", Ro = "univer-form-dual-column-layout", D = {
|
|
1213
|
+
sheetsFilterPanel: Zi,
|
|
1214
|
+
sheetsFilterPanelHeader: Ji,
|
|
1215
|
+
sheetsFilterPanelContent: eo,
|
|
1216
|
+
sheetsFilterPanelSelectAll: to,
|
|
1217
|
+
sheetsFilterPanelSelectAllCount: ro,
|
|
1218
|
+
sheetsFilterPanelValuesContainer: no,
|
|
1219
|
+
inputAffixWrapper: io,
|
|
1220
|
+
select: oo,
|
|
1221
|
+
radioGroup: so,
|
|
1222
|
+
sheetsFilterPanelValuesFind: ao,
|
|
1223
|
+
sheetsFilterPanelValuesList: lo,
|
|
1224
|
+
sheetsFilterPanelValuesListInnerContainer: uo,
|
|
1225
|
+
sheetsFilterPanelValuesVirtual: co,
|
|
1226
|
+
sheetsFilterPanelValuesItem: fo,
|
|
1227
|
+
sheetsFilterPanelValuesItemInner: ho,
|
|
1228
|
+
sheetsFilterPanelValuesItemCount: mo,
|
|
1229
|
+
sheetsFilterPanelValuesItemExcludeButton: vo,
|
|
1230
|
+
sheetsFilterPanelValuesItemText: po,
|
|
1231
|
+
sheetsFilterPanelConditionsContainer: go,
|
|
1232
|
+
sheetsFilterPanelConditionsContainerInner: _o,
|
|
1233
|
+
sheetsFilterPanelConditionsDesc: So,
|
|
1234
|
+
sheetsFilterPanelFooter: Eo,
|
|
1235
|
+
sheetsFilterPanelFooterPrimaryButtons: yo,
|
|
1236
|
+
button: bo,
|
|
1237
|
+
input: To,
|
|
1238
|
+
formDualColumnLayout: Ro
|
|
1239
|
+
};
|
|
1240
|
+
function Oo(e) {
|
|
1241
|
+
const { model: t } = e, r = Ke(We), n = Ee(t.conditionItem$, void 0, !0), o = Ee(t.filterConditionFormParams$, void 0, !0), { operator: a, numOfParameters: i } = n, { operator1: s, operator2: l, val1: u, val2: c, and: f } = o, d = f ? "AND" : "OR", h = ae((F) => {
|
|
1242
|
+
t.onConditionFormChange({ and: F === "AND" });
|
|
1243
|
+
}, [t]), g = Fo(r), _ = ae((F) => {
|
|
1244
|
+
t.onPrimaryConditionChange(F);
|
|
1245
|
+
}, [t]), p = Co(r), S = ae((F) => {
|
|
1246
|
+
t.onConditionFormChange(F);
|
|
1247
|
+
}, [t]), T = r.t("sheets-filter.panel.input-values-placeholder");
|
|
1248
|
+
function I(F, H, M) {
|
|
1249
|
+
const O = b.getItemByOperator(F).numOfParameters === 1;
|
|
1250
|
+
return /* @__PURE__ */ R.createElement(R.Fragment, null, M === "operator2" && /* @__PURE__ */ R.createElement(Ni, { value: d, onChange: h }, /* @__PURE__ */ R.createElement(Ir, { value: "AND" }, r.t("sheets-filter.panel.and")), /* @__PURE__ */ R.createElement(Ir, { value: "OR" }, r.t("sheets-filter.panel.or"))), /* @__PURE__ */ R.createElement(Pr, { value: F, options: p, onChange: (L) => S({ [M]: L }) }), O && /* @__PURE__ */ R.createElement(rn, { value: H, placeholder: T, onChange: (L) => S({ [M === "operator1" ? "val1" : "val2"]: L }) }));
|
|
1251
|
+
}
|
|
1252
|
+
return /* @__PURE__ */ R.createElement("div", { className: D.sheetsFilterPanelConditionsContainer }, /* @__PURE__ */ R.createElement(Pr, { value: a, options: g, onChange: _ }), b.getItemByOperator(a).numOfParameters !== 0 ? /* @__PURE__ */ R.createElement("div", { className: D.sheetsFilterPanelConditionsContainerInner }, i >= 1 && I(s, u != null ? u : "", "operator1"), i >= 2 && I(l, c != null ? c : "", "operator2"), /* @__PURE__ */ R.createElement("div", { className: D.sheetsFilterPanelConditionsDesc }, r.t("sheets-filter.panel.?"), /* @__PURE__ */ R.createElement("br", null), r.t("sheets-filter.panel.*"))) : null);
|
|
1253
|
+
}
|
|
1254
|
+
function Fo(e) {
|
|
1255
|
+
const t = e.getCurrentLocale();
|
|
1256
|
+
return lr(
|
|
1257
|
+
() => [
|
|
1258
|
+
{
|
|
1259
|
+
options: [
|
|
1260
|
+
{ label: e.t(b.NONE.label), value: b.NONE.operator }
|
|
1261
|
+
]
|
|
1262
|
+
},
|
|
1263
|
+
{
|
|
1264
|
+
options: [
|
|
1265
|
+
{ label: e.t(b.EMPTY.label), value: b.EMPTY.operator },
|
|
1266
|
+
{ label: e.t(b.NOT_EMPTY.label), value: b.NOT_EMPTY.operator }
|
|
1267
|
+
]
|
|
1268
|
+
},
|
|
1269
|
+
{
|
|
1270
|
+
options: [
|
|
1271
|
+
{ label: e.t(b.TEXT_CONTAINS.label), value: b.TEXT_CONTAINS.operator },
|
|
1272
|
+
{ label: e.t(b.DOES_NOT_CONTAIN.label), value: b.DOES_NOT_CONTAIN.operator },
|
|
1273
|
+
{ label: e.t(b.STARTS_WITH.label), value: b.STARTS_WITH.operator },
|
|
1274
|
+
{ label: e.t(b.ENDS_WITH.label), value: b.ENDS_WITH.operator },
|
|
1275
|
+
{ label: e.t(b.EQUALS.label), value: b.EQUALS.operator }
|
|
1276
|
+
]
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
options: [
|
|
1280
|
+
{ label: e.t(b.GREATER_THAN.label), value: b.GREATER_THAN.operator },
|
|
1281
|
+
{ label: e.t(b.GREATER_THAN_OR_EQUAL.label), value: b.GREATER_THAN_OR_EQUAL.operator },
|
|
1282
|
+
{ label: e.t(b.LESS_THAN.label), value: b.LESS_THAN.operator },
|
|
1283
|
+
{ label: e.t(b.LESS_THAN_OR_EQUAL.label), value: b.LESS_THAN_OR_EQUAL.operator },
|
|
1284
|
+
{ label: e.t(b.EQUAL.label), value: b.EQUAL.operator },
|
|
1285
|
+
{ label: e.t(b.NOT_EQUAL.label), value: b.NOT_EQUAL.operator },
|
|
1286
|
+
{ label: e.t(b.BETWEEN.label), value: b.BETWEEN.operator },
|
|
1287
|
+
{ label: e.t(b.NOT_BETWEEN.label), value: b.NOT_BETWEEN.operator }
|
|
1288
|
+
]
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
options: [
|
|
1292
|
+
{ label: e.t(b.CUSTOM.label), value: b.CUSTOM.operator }
|
|
1293
|
+
]
|
|
1294
|
+
}
|
|
1295
|
+
],
|
|
1296
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1297
|
+
[t, e]
|
|
1298
|
+
);
|
|
1299
|
+
}
|
|
1300
|
+
function Co(e) {
|
|
1301
|
+
const t = e.getCurrentLocale();
|
|
1302
|
+
return lr(
|
|
1303
|
+
() => b.ALL_CONDITIONS.filter((r) => r.numOfParameters !== 2).map((r) => ({ label: e.t(r.label), value: r.operator })),
|
|
1304
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1305
|
+
[t, e]
|
|
1306
|
+
);
|
|
1307
|
+
}
|
|
1308
|
+
function et() {
|
|
1309
|
+
return et = Object.assign ? Object.assign.bind() : function(e) {
|
|
1310
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
1311
|
+
var r = arguments[t];
|
|
1312
|
+
for (var n in r)
|
|
1313
|
+
Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
|
|
1314
|
+
}
|
|
1315
|
+
return e;
|
|
1316
|
+
}, et.apply(this, arguments);
|
|
1317
|
+
}
|
|
1318
|
+
function ue(e) {
|
|
1319
|
+
"@babel/helpers - typeof";
|
|
1320
|
+
return ue = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
1321
|
+
return typeof t;
|
|
1322
|
+
} : function(t) {
|
|
1323
|
+
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1324
|
+
}, ue(e);
|
|
1325
|
+
}
|
|
1326
|
+
function No(e, t) {
|
|
1327
|
+
if (ue(e) != "object" || !e)
|
|
1328
|
+
return e;
|
|
1329
|
+
var r = e[Symbol.toPrimitive];
|
|
1330
|
+
if (r !== void 0) {
|
|
1331
|
+
var n = r.call(e, t || "default");
|
|
1332
|
+
if (ue(n) != "object")
|
|
1333
|
+
return n;
|
|
1334
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1335
|
+
}
|
|
1336
|
+
return (t === "string" ? String : Number)(e);
|
|
1337
|
+
}
|
|
1338
|
+
function vn(e) {
|
|
1339
|
+
var t = No(e, "string");
|
|
1340
|
+
return ue(t) == "symbol" ? t : t + "";
|
|
1341
|
+
}
|
|
1342
|
+
function q(e, t, r) {
|
|
1343
|
+
return t = vn(t), t in e ? Object.defineProperty(e, t, {
|
|
1344
|
+
value: r,
|
|
1345
|
+
enumerable: !0,
|
|
1346
|
+
configurable: !0,
|
|
1347
|
+
writable: !0
|
|
1348
|
+
}) : e[t] = r, e;
|
|
1349
|
+
}
|
|
1350
|
+
function Lr(e, t) {
|
|
1351
|
+
var r = Object.keys(e);
|
|
1352
|
+
if (Object.getOwnPropertySymbols) {
|
|
1353
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
1354
|
+
t && (n = n.filter(function(o) {
|
|
1355
|
+
return Object.getOwnPropertyDescriptor(e, o).enumerable;
|
|
1356
|
+
})), r.push.apply(r, n);
|
|
1357
|
+
}
|
|
1358
|
+
return r;
|
|
1359
|
+
}
|
|
1360
|
+
function Z(e) {
|
|
1361
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
1362
|
+
var r = arguments[t] != null ? arguments[t] : {};
|
|
1363
|
+
t % 2 ? Lr(Object(r), !0).forEach(function(n) {
|
|
1364
|
+
q(e, n, r[n]);
|
|
1365
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Lr(Object(r)).forEach(function(n) {
|
|
1366
|
+
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1369
|
+
return e;
|
|
1370
|
+
}
|
|
1371
|
+
function Po(e) {
|
|
1372
|
+
if (Array.isArray(e))
|
|
1373
|
+
return e;
|
|
1374
|
+
}
|
|
1375
|
+
function Io(e, t) {
|
|
1376
|
+
var r = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
1377
|
+
if (r != null) {
|
|
1378
|
+
var n, o, a, i, s = [], l = !0, u = !1;
|
|
1379
|
+
try {
|
|
1380
|
+
if (a = (r = r.call(e)).next, t === 0) {
|
|
1381
|
+
if (Object(r) !== r)
|
|
1382
|
+
return;
|
|
1383
|
+
l = !1;
|
|
1384
|
+
} else
|
|
1385
|
+
for (; !(l = (n = a.call(r)).done) && (s.push(n.value), s.length !== t); l = !0)
|
|
1386
|
+
;
|
|
1387
|
+
} catch (c) {
|
|
1388
|
+
u = !0, o = c;
|
|
1389
|
+
} finally {
|
|
1390
|
+
try {
|
|
1391
|
+
if (!l && r.return != null && (i = r.return(), Object(i) !== i))
|
|
1392
|
+
return;
|
|
1393
|
+
} finally {
|
|
1394
|
+
if (u)
|
|
1395
|
+
throw o;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
return s;
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
function $r(e, t) {
|
|
1402
|
+
(t == null || t > e.length) && (t = e.length);
|
|
1403
|
+
for (var r = 0, n = new Array(t); r < t; r++)
|
|
1404
|
+
n[r] = e[r];
|
|
1405
|
+
return n;
|
|
1406
|
+
}
|
|
1407
|
+
function wo(e, t) {
|
|
1408
|
+
if (e) {
|
|
1409
|
+
if (typeof e == "string")
|
|
1410
|
+
return $r(e, t);
|
|
1411
|
+
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
1412
|
+
if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set")
|
|
1413
|
+
return Array.from(e);
|
|
1414
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
|
|
1415
|
+
return $r(e, t);
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
function Ao() {
|
|
1419
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1420
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1421
|
+
}
|
|
1422
|
+
function Q(e, t) {
|
|
1423
|
+
return Po(e) || Io(e, t) || wo(e, t) || Ao();
|
|
1424
|
+
}
|
|
1425
|
+
function Mo(e, t) {
|
|
1426
|
+
if (e == null)
|
|
1427
|
+
return {};
|
|
1428
|
+
var r = {}, n = Object.keys(e), o, a;
|
|
1429
|
+
for (a = 0; a < n.length; a++)
|
|
1430
|
+
o = n[a], !(t.indexOf(o) >= 0) && (r[o] = e[o]);
|
|
1431
|
+
return r;
|
|
1432
|
+
}
|
|
1433
|
+
function Lo(e, t) {
|
|
1434
|
+
if (e == null)
|
|
1435
|
+
return {};
|
|
1436
|
+
var r = Mo(e, t), n, o;
|
|
1437
|
+
if (Object.getOwnPropertySymbols) {
|
|
1438
|
+
var a = Object.getOwnPropertySymbols(e);
|
|
1439
|
+
for (o = 0; o < a.length; o++)
|
|
1440
|
+
n = a[o], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
|
|
1441
|
+
}
|
|
1442
|
+
return r;
|
|
1443
|
+
}
|
|
1444
|
+
function $o(e) {
|
|
1445
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
1446
|
+
}
|
|
1447
|
+
var pn = { exports: {} };
|
|
1448
|
+
/*!
|
|
1449
|
+
Copyright (c) 2018 Jed Watson.
|
|
1450
|
+
Licensed under the MIT License (MIT), see
|
|
1451
|
+
http://jedwatson.github.io/classnames
|
|
1452
|
+
*/
|
|
1453
|
+
(function(e) {
|
|
1454
|
+
(function() {
|
|
1455
|
+
var t = {}.hasOwnProperty;
|
|
1456
|
+
function r() {
|
|
1457
|
+
for (var a = "", i = 0; i < arguments.length; i++) {
|
|
1458
|
+
var s = arguments[i];
|
|
1459
|
+
s && (a = o(a, n(s)));
|
|
1460
|
+
}
|
|
1461
|
+
return a;
|
|
1462
|
+
}
|
|
1463
|
+
function n(a) {
|
|
1464
|
+
if (typeof a == "string" || typeof a == "number")
|
|
1465
|
+
return a;
|
|
1466
|
+
if (typeof a != "object")
|
|
1467
|
+
return "";
|
|
1468
|
+
if (Array.isArray(a))
|
|
1469
|
+
return r.apply(null, a);
|
|
1470
|
+
if (a.toString !== Object.prototype.toString && !a.toString.toString().includes("[native code]"))
|
|
1471
|
+
return a.toString();
|
|
1472
|
+
var i = "";
|
|
1473
|
+
for (var s in a)
|
|
1474
|
+
t.call(a, s) && a[s] && (i = o(i, s));
|
|
1475
|
+
return i;
|
|
1476
|
+
}
|
|
1477
|
+
function o(a, i) {
|
|
1478
|
+
return i ? a ? a + " " + i : a + i : a;
|
|
1479
|
+
}
|
|
1480
|
+
e.exports ? (r.default = r, e.exports = r) : window.classNames = r;
|
|
1481
|
+
})();
|
|
1482
|
+
})(pn);
|
|
1483
|
+
var Ho = pn.exports;
|
|
1484
|
+
const St = /* @__PURE__ */ $o(Ho);
|
|
1485
|
+
var gn = { exports: {} }, w = {};
|
|
1486
|
+
/**
|
|
1487
|
+
* @license React
|
|
1488
|
+
* react-is.production.min.js
|
|
1489
|
+
*
|
|
1490
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
1491
|
+
*
|
|
1492
|
+
* This source code is licensed under the MIT license found in the
|
|
1493
|
+
* LICENSE file in the root directory of this source tree.
|
|
1494
|
+
*/
|
|
1495
|
+
var cr = Symbol.for("react.element"), fr = Symbol.for("react.portal"), Ft = Symbol.for("react.fragment"), Ct = Symbol.for("react.strict_mode"), Nt = Symbol.for("react.profiler"), Pt = Symbol.for("react.provider"), It = Symbol.for("react.context"), Do = Symbol.for("react.server_context"), wt = Symbol.for("react.forward_ref"), At = Symbol.for("react.suspense"), Mt = Symbol.for("react.suspense_list"), Lt = Symbol.for("react.memo"), $t = Symbol.for("react.lazy"), Uo = Symbol.for("react.offscreen"), _n;
|
|
1496
|
+
_n = Symbol.for("react.module.reference");
|
|
1497
|
+
function re(e) {
|
|
1498
|
+
if (typeof e == "object" && e !== null) {
|
|
1499
|
+
var t = e.$$typeof;
|
|
1500
|
+
switch (t) {
|
|
1501
|
+
case cr:
|
|
1502
|
+
switch (e = e.type, e) {
|
|
1503
|
+
case Ft:
|
|
1504
|
+
case Nt:
|
|
1505
|
+
case Ct:
|
|
1506
|
+
case At:
|
|
1507
|
+
case Mt:
|
|
1508
|
+
return e;
|
|
1509
|
+
default:
|
|
1510
|
+
switch (e = e && e.$$typeof, e) {
|
|
1511
|
+
case Do:
|
|
1512
|
+
case It:
|
|
1513
|
+
case wt:
|
|
1514
|
+
case $t:
|
|
1515
|
+
case Lt:
|
|
1516
|
+
case Pt:
|
|
1517
|
+
return e;
|
|
1518
|
+
default:
|
|
1519
|
+
return t;
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
case fr:
|
|
1523
|
+
return t;
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
w.ContextConsumer = It;
|
|
1528
|
+
w.ContextProvider = Pt;
|
|
1529
|
+
w.Element = cr;
|
|
1530
|
+
w.ForwardRef = wt;
|
|
1531
|
+
w.Fragment = Ft;
|
|
1532
|
+
w.Lazy = $t;
|
|
1533
|
+
w.Memo = Lt;
|
|
1534
|
+
w.Portal = fr;
|
|
1535
|
+
w.Profiler = Nt;
|
|
1536
|
+
w.StrictMode = Ct;
|
|
1537
|
+
w.Suspense = At;
|
|
1538
|
+
w.SuspenseList = Mt;
|
|
1539
|
+
w.isAsyncMode = function() {
|
|
1540
|
+
return !1;
|
|
1541
|
+
};
|
|
1542
|
+
w.isConcurrentMode = function() {
|
|
1543
|
+
return !1;
|
|
1544
|
+
};
|
|
1545
|
+
w.isContextConsumer = function(e) {
|
|
1546
|
+
return re(e) === It;
|
|
1547
|
+
};
|
|
1548
|
+
w.isContextProvider = function(e) {
|
|
1549
|
+
return re(e) === Pt;
|
|
1550
|
+
};
|
|
1551
|
+
w.isElement = function(e) {
|
|
1552
|
+
return typeof e == "object" && e !== null && e.$$typeof === cr;
|
|
1553
|
+
};
|
|
1554
|
+
w.isForwardRef = function(e) {
|
|
1555
|
+
return re(e) === wt;
|
|
1556
|
+
};
|
|
1557
|
+
w.isFragment = function(e) {
|
|
1558
|
+
return re(e) === Ft;
|
|
1559
|
+
};
|
|
1560
|
+
w.isLazy = function(e) {
|
|
1561
|
+
return re(e) === $t;
|
|
1562
|
+
};
|
|
1563
|
+
w.isMemo = function(e) {
|
|
1564
|
+
return re(e) === Lt;
|
|
1565
|
+
};
|
|
1566
|
+
w.isPortal = function(e) {
|
|
1567
|
+
return re(e) === fr;
|
|
1568
|
+
};
|
|
1569
|
+
w.isProfiler = function(e) {
|
|
1570
|
+
return re(e) === Nt;
|
|
1571
|
+
};
|
|
1572
|
+
w.isStrictMode = function(e) {
|
|
1573
|
+
return re(e) === Ct;
|
|
1574
|
+
};
|
|
1575
|
+
w.isSuspense = function(e) {
|
|
1576
|
+
return re(e) === At;
|
|
1577
|
+
};
|
|
1578
|
+
w.isSuspenseList = function(e) {
|
|
1579
|
+
return re(e) === Mt;
|
|
1580
|
+
};
|
|
1581
|
+
w.isValidElementType = function(e) {
|
|
1582
|
+
return typeof e == "string" || typeof e == "function" || e === Ft || e === Nt || e === Ct || e === At || e === Mt || e === Uo || typeof e == "object" && e !== null && (e.$$typeof === $t || e.$$typeof === Lt || e.$$typeof === Pt || e.$$typeof === It || e.$$typeof === wt || e.$$typeof === _n || e.getModuleId !== void 0);
|
|
1583
|
+
};
|
|
1584
|
+
w.typeOf = re;
|
|
1585
|
+
gn.exports = w;
|
|
1586
|
+
var ht = gn.exports;
|
|
1587
|
+
function Xt(e) {
|
|
1588
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = [];
|
|
1589
|
+
return R.Children.forEach(e, function(n) {
|
|
1590
|
+
n == null && !t.keepEmpty || (Array.isArray(n) ? r = r.concat(Xt(n)) : ht.isFragment(n) && n.props ? r = r.concat(Xt(n.props.children, t)) : r.push(n));
|
|
1591
|
+
}), r;
|
|
1592
|
+
}
|
|
1593
|
+
function xo(e) {
|
|
1594
|
+
return e instanceof HTMLElement || e instanceof SVGElement;
|
|
1595
|
+
}
|
|
1596
|
+
function dt(e) {
|
|
1597
|
+
return xo(e) ? e : e instanceof R.Component ? Di.findDOMNode(e) : null;
|
|
1598
|
+
}
|
|
1599
|
+
function Bo(e, t, r) {
|
|
1600
|
+
var n = m.useRef({});
|
|
1601
|
+
return (!("value" in n.current) || r(n.current.condition, t)) && (n.current.value = e(), n.current.condition = t), n.current.value;
|
|
1602
|
+
}
|
|
1603
|
+
function Wo(e, t) {
|
|
1604
|
+
typeof e == "function" ? e(t) : ue(e) === "object" && e && "current" in e && (e.current = t);
|
|
1605
|
+
}
|
|
1606
|
+
function Vo() {
|
|
1607
|
+
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
|
|
1608
|
+
t[r] = arguments[r];
|
|
1609
|
+
var n = t.filter(function(o) {
|
|
1610
|
+
return o;
|
|
1611
|
+
});
|
|
1612
|
+
return n.length <= 1 ? n[0] : function(o) {
|
|
1613
|
+
t.forEach(function(a) {
|
|
1614
|
+
Wo(a, o);
|
|
1615
|
+
});
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
function jo() {
|
|
1619
|
+
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
|
|
1620
|
+
t[r] = arguments[r];
|
|
1621
|
+
return Bo(function() {
|
|
1622
|
+
return Vo.apply(void 0, t);
|
|
1623
|
+
}, t, function(n, o) {
|
|
1624
|
+
return n.length !== o.length || n.every(function(a, i) {
|
|
1625
|
+
return a !== o[i];
|
|
1626
|
+
});
|
|
1627
|
+
});
|
|
1628
|
+
}
|
|
1629
|
+
function ko(e) {
|
|
1630
|
+
var t, r, n = ht.isMemo(e) ? e.type.type : e.type;
|
|
1631
|
+
return !(typeof n == "function" && !((t = n.prototype) !== null && t !== void 0 && t.render) && n.$$typeof !== ht.ForwardRef || typeof e == "function" && !((r = e.prototype) !== null && r !== void 0 && r.render) && e.$$typeof !== ht.ForwardRef);
|
|
1632
|
+
}
|
|
1633
|
+
var Kt = /* @__PURE__ */ m.createContext(null);
|
|
1634
|
+
function zo(e) {
|
|
1635
|
+
var t = e.children, r = e.onBatchResize, n = m.useRef(0), o = m.useRef([]), a = m.useContext(Kt), i = m.useCallback(function(s, l, u) {
|
|
1636
|
+
n.current += 1;
|
|
1637
|
+
var c = n.current;
|
|
1638
|
+
o.current.push({
|
|
1639
|
+
size: s,
|
|
1640
|
+
element: l,
|
|
1641
|
+
data: u
|
|
1642
|
+
}), Promise.resolve().then(function() {
|
|
1643
|
+
c === n.current && (r == null || r(o.current), o.current = []);
|
|
1644
|
+
}), a == null || a(s, l, u);
|
|
1645
|
+
}, [r, a]);
|
|
1646
|
+
return /* @__PURE__ */ m.createElement(Kt.Provider, {
|
|
1647
|
+
value: i
|
|
1648
|
+
}, t);
|
|
1649
|
+
}
|
|
1650
|
+
var Sn = function() {
|
|
1651
|
+
if (typeof Map < "u")
|
|
1652
|
+
return Map;
|
|
1653
|
+
function e(t, r) {
|
|
1654
|
+
var n = -1;
|
|
1655
|
+
return t.some(function(o, a) {
|
|
1656
|
+
return o[0] === r ? (n = a, !0) : !1;
|
|
1657
|
+
}), n;
|
|
1658
|
+
}
|
|
1659
|
+
return (
|
|
1660
|
+
/** @class */
|
|
1661
|
+
function() {
|
|
1662
|
+
function t() {
|
|
1663
|
+
this.__entries__ = [];
|
|
1664
|
+
}
|
|
1665
|
+
return Object.defineProperty(t.prototype, "size", {
|
|
1666
|
+
/**
|
|
1667
|
+
* @returns {boolean}
|
|
1668
|
+
*/
|
|
1669
|
+
get: function() {
|
|
1670
|
+
return this.__entries__.length;
|
|
1671
|
+
},
|
|
1672
|
+
enumerable: !0,
|
|
1673
|
+
configurable: !0
|
|
1674
|
+
}), t.prototype.get = function(r) {
|
|
1675
|
+
var n = e(this.__entries__, r), o = this.__entries__[n];
|
|
1676
|
+
return o && o[1];
|
|
1677
|
+
}, t.prototype.set = function(r, n) {
|
|
1678
|
+
var o = e(this.__entries__, r);
|
|
1679
|
+
~o ? this.__entries__[o][1] = n : this.__entries__.push([r, n]);
|
|
1680
|
+
}, t.prototype.delete = function(r) {
|
|
1681
|
+
var n = this.__entries__, o = e(n, r);
|
|
1682
|
+
~o && n.splice(o, 1);
|
|
1683
|
+
}, t.prototype.has = function(r) {
|
|
1684
|
+
return !!~e(this.__entries__, r);
|
|
1685
|
+
}, t.prototype.clear = function() {
|
|
1686
|
+
this.__entries__.splice(0);
|
|
1687
|
+
}, t.prototype.forEach = function(r, n) {
|
|
1688
|
+
n === void 0 && (n = null);
|
|
1689
|
+
for (var o = 0, a = this.__entries__; o < a.length; o++) {
|
|
1690
|
+
var i = a[o];
|
|
1691
|
+
r.call(n, i[1], i[0]);
|
|
1692
|
+
}
|
|
1693
|
+
}, t;
|
|
1694
|
+
}()
|
|
1695
|
+
);
|
|
1696
|
+
}(), Zt = typeof window < "u" && typeof document < "u" && window.document === document, Et = function() {
|
|
1697
|
+
return typeof global < "u" && global.Math === Math ? global : typeof self < "u" && self.Math === Math ? self : typeof window < "u" && window.Math === Math ? window : Function("return this")();
|
|
1698
|
+
}(), Qo = function() {
|
|
1699
|
+
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(Et) : function(e) {
|
|
1700
|
+
return setTimeout(function() {
|
|
1701
|
+
return e(Date.now());
|
|
1702
|
+
}, 1e3 / 60);
|
|
1703
|
+
};
|
|
1704
|
+
}(), Go = 2;
|
|
1705
|
+
function Yo(e, t) {
|
|
1706
|
+
var r = !1, n = !1, o = 0;
|
|
1707
|
+
function a() {
|
|
1708
|
+
r && (r = !1, e()), n && s();
|
|
1709
|
+
}
|
|
1710
|
+
function i() {
|
|
1711
|
+
Qo(a);
|
|
1712
|
+
}
|
|
1713
|
+
function s() {
|
|
1714
|
+
var l = Date.now();
|
|
1715
|
+
if (r) {
|
|
1716
|
+
if (l - o < Go)
|
|
1717
|
+
return;
|
|
1718
|
+
n = !0;
|
|
1719
|
+
} else
|
|
1720
|
+
r = !0, n = !1, setTimeout(i, t);
|
|
1721
|
+
o = l;
|
|
1722
|
+
}
|
|
1723
|
+
return s;
|
|
1724
|
+
}
|
|
1725
|
+
var qo = 20, Xo = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], Ko = typeof MutationObserver < "u", Zo = (
|
|
1726
|
+
/** @class */
|
|
1727
|
+
function() {
|
|
1728
|
+
function e() {
|
|
1729
|
+
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = Yo(this.refresh.bind(this), qo);
|
|
1730
|
+
}
|
|
1731
|
+
return e.prototype.addObserver = function(t) {
|
|
1732
|
+
~this.observers_.indexOf(t) || this.observers_.push(t), this.connected_ || this.connect_();
|
|
1733
|
+
}, e.prototype.removeObserver = function(t) {
|
|
1734
|
+
var r = this.observers_, n = r.indexOf(t);
|
|
1735
|
+
~n && r.splice(n, 1), !r.length && this.connected_ && this.disconnect_();
|
|
1736
|
+
}, e.prototype.refresh = function() {
|
|
1737
|
+
var t = this.updateObservers_();
|
|
1738
|
+
t && this.refresh();
|
|
1739
|
+
}, e.prototype.updateObservers_ = function() {
|
|
1740
|
+
var t = this.observers_.filter(function(r) {
|
|
1741
|
+
return r.gatherActive(), r.hasActive();
|
|
1742
|
+
});
|
|
1743
|
+
return t.forEach(function(r) {
|
|
1744
|
+
return r.broadcastActive();
|
|
1745
|
+
}), t.length > 0;
|
|
1746
|
+
}, e.prototype.connect_ = function() {
|
|
1747
|
+
!Zt || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), Ko ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
|
|
1748
|
+
attributes: !0,
|
|
1749
|
+
childList: !0,
|
|
1750
|
+
characterData: !0,
|
|
1751
|
+
subtree: !0
|
|
1752
|
+
})) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0);
|
|
1753
|
+
}, e.prototype.disconnect_ = function() {
|
|
1754
|
+
!Zt || !this.connected_ || (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = !1, this.connected_ = !1);
|
|
1755
|
+
}, e.prototype.onTransitionEnd_ = function(t) {
|
|
1756
|
+
var r = t.propertyName, n = r === void 0 ? "" : r, o = Xo.some(function(a) {
|
|
1757
|
+
return !!~n.indexOf(a);
|
|
1758
|
+
});
|
|
1759
|
+
o && this.refresh();
|
|
1760
|
+
}, e.getInstance = function() {
|
|
1761
|
+
return this.instance_ || (this.instance_ = new e()), this.instance_;
|
|
1762
|
+
}, e.instance_ = null, e;
|
|
1763
|
+
}()
|
|
1764
|
+
), En = function(e, t) {
|
|
1765
|
+
for (var r = 0, n = Object.keys(t); r < n.length; r++) {
|
|
1766
|
+
var o = n[r];
|
|
1767
|
+
Object.defineProperty(e, o, {
|
|
1768
|
+
value: t[o],
|
|
1769
|
+
enumerable: !1,
|
|
1770
|
+
writable: !1,
|
|
1771
|
+
configurable: !0
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
return e;
|
|
1775
|
+
}, Be = function(e) {
|
|
1776
|
+
var t = e && e.ownerDocument && e.ownerDocument.defaultView;
|
|
1777
|
+
return t || Et;
|
|
1778
|
+
}, yn = Ht(0, 0, 0, 0);
|
|
1779
|
+
function yt(e) {
|
|
1780
|
+
return parseFloat(e) || 0;
|
|
1781
|
+
}
|
|
1782
|
+
function Hr(e) {
|
|
1783
|
+
for (var t = [], r = 1; r < arguments.length; r++)
|
|
1784
|
+
t[r - 1] = arguments[r];
|
|
1785
|
+
return t.reduce(function(n, o) {
|
|
1786
|
+
var a = e["border-" + o + "-width"];
|
|
1787
|
+
return n + yt(a);
|
|
1788
|
+
}, 0);
|
|
1789
|
+
}
|
|
1790
|
+
function Jo(e) {
|
|
1791
|
+
for (var t = ["top", "right", "bottom", "left"], r = {}, n = 0, o = t; n < o.length; n++) {
|
|
1792
|
+
var a = o[n], i = e["padding-" + a];
|
|
1793
|
+
r[a] = yt(i);
|
|
1794
|
+
}
|
|
1795
|
+
return r;
|
|
1796
|
+
}
|
|
1797
|
+
function es(e) {
|
|
1798
|
+
var t = e.getBBox();
|
|
1799
|
+
return Ht(0, 0, t.width, t.height);
|
|
1800
|
+
}
|
|
1801
|
+
function ts(e) {
|
|
1802
|
+
var t = e.clientWidth, r = e.clientHeight;
|
|
1803
|
+
if (!t && !r)
|
|
1804
|
+
return yn;
|
|
1805
|
+
var n = Be(e).getComputedStyle(e), o = Jo(n), a = o.left + o.right, i = o.top + o.bottom, s = yt(n.width), l = yt(n.height);
|
|
1806
|
+
if (n.boxSizing === "border-box" && (Math.round(s + a) !== t && (s -= Hr(n, "left", "right") + a), Math.round(l + i) !== r && (l -= Hr(n, "top", "bottom") + i)), !ns(e)) {
|
|
1807
|
+
var u = Math.round(s + a) - t, c = Math.round(l + i) - r;
|
|
1808
|
+
Math.abs(u) !== 1 && (s -= u), Math.abs(c) !== 1 && (l -= c);
|
|
1809
|
+
}
|
|
1810
|
+
return Ht(o.left, o.top, s, l);
|
|
1811
|
+
}
|
|
1812
|
+
var rs = /* @__PURE__ */ function() {
|
|
1813
|
+
return typeof SVGGraphicsElement < "u" ? function(e) {
|
|
1814
|
+
return e instanceof Be(e).SVGGraphicsElement;
|
|
1815
|
+
} : function(e) {
|
|
1816
|
+
return e instanceof Be(e).SVGElement && typeof e.getBBox == "function";
|
|
1817
|
+
};
|
|
1818
|
+
}();
|
|
1819
|
+
function ns(e) {
|
|
1820
|
+
return e === Be(e).document.documentElement;
|
|
1821
|
+
}
|
|
1822
|
+
function is(e) {
|
|
1823
|
+
return Zt ? rs(e) ? es(e) : ts(e) : yn;
|
|
1824
|
+
}
|
|
1825
|
+
function os(e) {
|
|
1826
|
+
var t = e.x, r = e.y, n = e.width, o = e.height, a = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, i = Object.create(a.prototype);
|
|
1827
|
+
return En(i, {
|
|
1828
|
+
x: t,
|
|
1829
|
+
y: r,
|
|
1830
|
+
width: n,
|
|
1831
|
+
height: o,
|
|
1832
|
+
top: r,
|
|
1833
|
+
right: t + n,
|
|
1834
|
+
bottom: o + r,
|
|
1835
|
+
left: t
|
|
1836
|
+
}), i;
|
|
1837
|
+
}
|
|
1838
|
+
function Ht(e, t, r, n) {
|
|
1839
|
+
return { x: e, y: t, width: r, height: n };
|
|
1840
|
+
}
|
|
1841
|
+
var ss = (
|
|
1842
|
+
/** @class */
|
|
1843
|
+
function() {
|
|
1844
|
+
function e(t) {
|
|
1845
|
+
this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = Ht(0, 0, 0, 0), this.target = t;
|
|
1846
|
+
}
|
|
1847
|
+
return e.prototype.isActive = function() {
|
|
1848
|
+
var t = is(this.target);
|
|
1849
|
+
return this.contentRect_ = t, t.width !== this.broadcastWidth || t.height !== this.broadcastHeight;
|
|
1850
|
+
}, e.prototype.broadcastRect = function() {
|
|
1851
|
+
var t = this.contentRect_;
|
|
1852
|
+
return this.broadcastWidth = t.width, this.broadcastHeight = t.height, t;
|
|
1853
|
+
}, e;
|
|
1854
|
+
}()
|
|
1855
|
+
), as = (
|
|
1856
|
+
/** @class */
|
|
1857
|
+
/* @__PURE__ */ function() {
|
|
1858
|
+
function e(t, r) {
|
|
1859
|
+
var n = os(r);
|
|
1860
|
+
En(this, { target: t, contentRect: n });
|
|
1861
|
+
}
|
|
1862
|
+
return e;
|
|
1863
|
+
}()
|
|
1864
|
+
), ls = (
|
|
1865
|
+
/** @class */
|
|
1866
|
+
function() {
|
|
1867
|
+
function e(t, r, n) {
|
|
1868
|
+
if (this.activeObservations_ = [], this.observations_ = new Sn(), typeof t != "function")
|
|
1869
|
+
throw new TypeError("The callback provided as parameter 1 is not a function.");
|
|
1870
|
+
this.callback_ = t, this.controller_ = r, this.callbackCtx_ = n;
|
|
1871
|
+
}
|
|
1872
|
+
return e.prototype.observe = function(t) {
|
|
1873
|
+
if (!arguments.length)
|
|
1874
|
+
throw new TypeError("1 argument required, but only 0 present.");
|
|
1875
|
+
if (!(typeof Element > "u" || !(Element instanceof Object))) {
|
|
1876
|
+
if (!(t instanceof Be(t).Element))
|
|
1877
|
+
throw new TypeError('parameter 1 is not of type "Element".');
|
|
1878
|
+
var r = this.observations_;
|
|
1879
|
+
r.has(t) || (r.set(t, new ss(t)), this.controller_.addObserver(this), this.controller_.refresh());
|
|
1880
|
+
}
|
|
1881
|
+
}, e.prototype.unobserve = function(t) {
|
|
1882
|
+
if (!arguments.length)
|
|
1883
|
+
throw new TypeError("1 argument required, but only 0 present.");
|
|
1884
|
+
if (!(typeof Element > "u" || !(Element instanceof Object))) {
|
|
1885
|
+
if (!(t instanceof Be(t).Element))
|
|
1886
|
+
throw new TypeError('parameter 1 is not of type "Element".');
|
|
1887
|
+
var r = this.observations_;
|
|
1888
|
+
r.has(t) && (r.delete(t), r.size || this.controller_.removeObserver(this));
|
|
1889
|
+
}
|
|
1890
|
+
}, e.prototype.disconnect = function() {
|
|
1891
|
+
this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this);
|
|
1892
|
+
}, e.prototype.gatherActive = function() {
|
|
1893
|
+
var t = this;
|
|
1894
|
+
this.clearActive(), this.observations_.forEach(function(r) {
|
|
1895
|
+
r.isActive() && t.activeObservations_.push(r);
|
|
1896
|
+
});
|
|
1897
|
+
}, e.prototype.broadcastActive = function() {
|
|
1898
|
+
if (this.hasActive()) {
|
|
1899
|
+
var t = this.callbackCtx_, r = this.activeObservations_.map(function(n) {
|
|
1900
|
+
return new as(n.target, n.broadcastRect());
|
|
1901
|
+
});
|
|
1902
|
+
this.callback_.call(t, r, t), this.clearActive();
|
|
1903
|
+
}
|
|
1904
|
+
}, e.prototype.clearActive = function() {
|
|
1905
|
+
this.activeObservations_.splice(0);
|
|
1906
|
+
}, e.prototype.hasActive = function() {
|
|
1907
|
+
return this.activeObservations_.length > 0;
|
|
1908
|
+
}, e;
|
|
1909
|
+
}()
|
|
1910
|
+
), bn = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new Sn(), Tn = (
|
|
1911
|
+
/** @class */
|
|
1912
|
+
/* @__PURE__ */ function() {
|
|
1913
|
+
function e(t) {
|
|
1914
|
+
if (!(this instanceof e))
|
|
1915
|
+
throw new TypeError("Cannot call a class as a function.");
|
|
1916
|
+
if (!arguments.length)
|
|
1917
|
+
throw new TypeError("1 argument required, but only 0 present.");
|
|
1918
|
+
var r = Zo.getInstance(), n = new ls(t, r, this);
|
|
1919
|
+
bn.set(this, n);
|
|
1920
|
+
}
|
|
1921
|
+
return e;
|
|
1922
|
+
}()
|
|
1923
|
+
);
|
|
1924
|
+
[
|
|
1925
|
+
"observe",
|
|
1926
|
+
"unobserve",
|
|
1927
|
+
"disconnect"
|
|
1928
|
+
].forEach(function(e) {
|
|
1929
|
+
Tn.prototype[e] = function() {
|
|
1930
|
+
var t;
|
|
1931
|
+
return (t = bn.get(this))[e].apply(t, arguments);
|
|
1932
|
+
};
|
|
1933
|
+
});
|
|
1934
|
+
var us = function() {
|
|
1935
|
+
return typeof Et.ResizeObserver < "u" ? Et.ResizeObserver : Tn;
|
|
1936
|
+
}(), ye = /* @__PURE__ */ new Map();
|
|
1937
|
+
function cs(e) {
|
|
1938
|
+
e.forEach(function(t) {
|
|
1939
|
+
var r, n = t.target;
|
|
1940
|
+
(r = ye.get(n)) === null || r === void 0 || r.forEach(function(o) {
|
|
1941
|
+
return o(n);
|
|
1942
|
+
});
|
|
1943
|
+
});
|
|
1944
|
+
}
|
|
1945
|
+
var Rn = new us(cs);
|
|
1946
|
+
function fs(e, t) {
|
|
1947
|
+
ye.has(e) || (ye.set(e, /* @__PURE__ */ new Set()), Rn.observe(e)), ye.get(e).add(t);
|
|
1948
|
+
}
|
|
1949
|
+
function hs(e, t) {
|
|
1950
|
+
ye.has(e) && (ye.get(e).delete(t), ye.get(e).size || (Rn.unobserve(e), ye.delete(e)));
|
|
1951
|
+
}
|
|
1952
|
+
function On(e, t) {
|
|
1953
|
+
if (!(e instanceof t))
|
|
1954
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1955
|
+
}
|
|
1956
|
+
function Dr(e, t) {
|
|
1957
|
+
for (var r = 0; r < t.length; r++) {
|
|
1958
|
+
var n = t[r];
|
|
1959
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, vn(n.key), n);
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
function Fn(e, t, r) {
|
|
1963
|
+
return t && Dr(e.prototype, t), r && Dr(e, r), Object.defineProperty(e, "prototype", {
|
|
1964
|
+
writable: !1
|
|
1965
|
+
}), e;
|
|
1966
|
+
}
|
|
1967
|
+
function Jt(e, t) {
|
|
1968
|
+
return Jt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, o) {
|
|
1969
|
+
return n.__proto__ = o, n;
|
|
1970
|
+
}, Jt(e, t);
|
|
1971
|
+
}
|
|
1972
|
+
function ds(e, t) {
|
|
1973
|
+
if (typeof t != "function" && t !== null)
|
|
1974
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
1975
|
+
e.prototype = Object.create(t && t.prototype, {
|
|
1976
|
+
constructor: {
|
|
1977
|
+
value: e,
|
|
1978
|
+
writable: !0,
|
|
1979
|
+
configurable: !0
|
|
1980
|
+
}
|
|
1981
|
+
}), Object.defineProperty(e, "prototype", {
|
|
1982
|
+
writable: !1
|
|
1983
|
+
}), t && Jt(e, t);
|
|
1984
|
+
}
|
|
1985
|
+
function bt(e) {
|
|
1986
|
+
return bt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(r) {
|
|
1987
|
+
return r.__proto__ || Object.getPrototypeOf(r);
|
|
1988
|
+
}, bt(e);
|
|
1989
|
+
}
|
|
1990
|
+
function Cn() {
|
|
1991
|
+
try {
|
|
1992
|
+
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
1993
|
+
}));
|
|
1994
|
+
} catch {
|
|
1995
|
+
}
|
|
1996
|
+
return (Cn = function() {
|
|
1997
|
+
return !!e;
|
|
1998
|
+
})();
|
|
1999
|
+
}
|
|
2000
|
+
function ms(e) {
|
|
2001
|
+
if (e === void 0)
|
|
2002
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
2003
|
+
return e;
|
|
2004
|
+
}
|
|
2005
|
+
function vs(e, t) {
|
|
2006
|
+
if (t && (ue(t) === "object" || typeof t == "function"))
|
|
2007
|
+
return t;
|
|
2008
|
+
if (t !== void 0)
|
|
2009
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
2010
|
+
return ms(e);
|
|
2011
|
+
}
|
|
2012
|
+
function ps(e) {
|
|
2013
|
+
var t = Cn();
|
|
2014
|
+
return function() {
|
|
2015
|
+
var n = bt(e), o;
|
|
2016
|
+
if (t) {
|
|
2017
|
+
var a = bt(this).constructor;
|
|
2018
|
+
o = Reflect.construct(n, arguments, a);
|
|
2019
|
+
} else
|
|
2020
|
+
o = n.apply(this, arguments);
|
|
2021
|
+
return vs(this, o);
|
|
2022
|
+
};
|
|
2023
|
+
}
|
|
2024
|
+
var gs = /* @__PURE__ */ function(e) {
|
|
2025
|
+
ds(r, e);
|
|
2026
|
+
var t = ps(r);
|
|
2027
|
+
function r() {
|
|
2028
|
+
return On(this, r), t.apply(this, arguments);
|
|
2029
|
+
}
|
|
2030
|
+
return Fn(r, [{
|
|
2031
|
+
key: "render",
|
|
2032
|
+
value: function() {
|
|
2033
|
+
return this.props.children;
|
|
2034
|
+
}
|
|
2035
|
+
}]), r;
|
|
2036
|
+
}(m.Component);
|
|
2037
|
+
function _s(e, t) {
|
|
2038
|
+
var r = e.children, n = e.disabled, o = m.useRef(null), a = m.useRef(null), i = m.useContext(Kt), s = typeof r == "function", l = s ? r(o) : r, u = m.useRef({
|
|
2039
|
+
width: -1,
|
|
2040
|
+
height: -1,
|
|
2041
|
+
offsetWidth: -1,
|
|
2042
|
+
offsetHeight: -1
|
|
2043
|
+
}), c = !s && /* @__PURE__ */ m.isValidElement(l) && ko(l), f = c ? l.ref : null, d = jo(f, o), h = function() {
|
|
2044
|
+
var S;
|
|
2045
|
+
return dt(o.current) || // Support `nativeElement` format
|
|
2046
|
+
(o.current && ue(o.current) === "object" ? dt((S = o.current) === null || S === void 0 ? void 0 : S.nativeElement) : null) || dt(a.current);
|
|
2047
|
+
};
|
|
2048
|
+
m.useImperativeHandle(t, function() {
|
|
2049
|
+
return h();
|
|
2050
|
+
});
|
|
2051
|
+
var g = m.useRef(e);
|
|
2052
|
+
g.current = e;
|
|
2053
|
+
var _ = m.useCallback(function(p) {
|
|
2054
|
+
var S = g.current, T = S.onResize, I = S.data, F = p.getBoundingClientRect(), H = F.width, M = F.height, O = p.offsetWidth, L = p.offsetHeight, U = Math.floor(H), B = Math.floor(M);
|
|
2055
|
+
if (u.current.width !== U || u.current.height !== B || u.current.offsetWidth !== O || u.current.offsetHeight !== L) {
|
|
2056
|
+
var X = {
|
|
2057
|
+
width: U,
|
|
2058
|
+
height: B,
|
|
2059
|
+
offsetWidth: O,
|
|
2060
|
+
offsetHeight: L
|
|
2061
|
+
};
|
|
2062
|
+
u.current = X;
|
|
2063
|
+
var k = O === Math.round(H) ? H : O, J = L === Math.round(M) ? M : L, z = Z(Z({}, X), {}, {
|
|
2064
|
+
offsetWidth: k,
|
|
2065
|
+
offsetHeight: J
|
|
2066
|
+
});
|
|
2067
|
+
i == null || i(z, p, I), T && Promise.resolve().then(function() {
|
|
2068
|
+
T(z, p);
|
|
2069
|
+
});
|
|
2070
|
+
}
|
|
2071
|
+
}, []);
|
|
2072
|
+
return m.useEffect(function() {
|
|
2073
|
+
var p = h();
|
|
2074
|
+
return p && !n && fs(p, _), function() {
|
|
2075
|
+
return hs(p, _);
|
|
2076
|
+
};
|
|
2077
|
+
}, [o.current, n]), /* @__PURE__ */ m.createElement(gs, {
|
|
2078
|
+
ref: a
|
|
2079
|
+
}, c ? /* @__PURE__ */ m.cloneElement(l, {
|
|
2080
|
+
ref: d
|
|
2081
|
+
}) : l);
|
|
2082
|
+
}
|
|
2083
|
+
var Ss = /* @__PURE__ */ m.forwardRef(_s), Es = "rc-observer-key";
|
|
2084
|
+
function ys(e, t) {
|
|
2085
|
+
var r = e.children, n = typeof r == "function" ? [r] : Xt(r);
|
|
2086
|
+
return n.map(function(o, a) {
|
|
2087
|
+
var i = (o == null ? void 0 : o.key) || "".concat(Es, "-").concat(a);
|
|
2088
|
+
return /* @__PURE__ */ m.createElement(Ss, et({}, e, {
|
|
2089
|
+
key: i,
|
|
2090
|
+
ref: a === 0 ? t : void 0
|
|
2091
|
+
}), o);
|
|
2092
|
+
});
|
|
2093
|
+
}
|
|
2094
|
+
var hr = /* @__PURE__ */ m.forwardRef(ys);
|
|
2095
|
+
hr.Collection = zo;
|
|
2096
|
+
var Nn = /* @__PURE__ */ m.forwardRef(function(e, t) {
|
|
2097
|
+
var r = e.height, n = e.offsetY, o = e.offsetX, a = e.children, i = e.prefixCls, s = e.onInnerResize, l = e.innerProps, u = e.rtl, c = e.extra, f = {}, d = {
|
|
2098
|
+
display: "flex",
|
|
2099
|
+
flexDirection: "column"
|
|
2100
|
+
};
|
|
2101
|
+
return n !== void 0 && (f = {
|
|
2102
|
+
height: r,
|
|
2103
|
+
position: "relative",
|
|
2104
|
+
overflow: "hidden"
|
|
2105
|
+
}, d = Z(Z({}, d), {}, q(q(q(q(q({
|
|
2106
|
+
transform: "translateY(".concat(n, "px)")
|
|
2107
|
+
}, u ? "marginRight" : "marginLeft", -o), "position", "absolute"), "left", 0), "right", 0), "top", 0))), /* @__PURE__ */ m.createElement("div", {
|
|
2108
|
+
style: f
|
|
2109
|
+
}, /* @__PURE__ */ m.createElement(hr, {
|
|
2110
|
+
onResize: function(g) {
|
|
2111
|
+
var _ = g.offsetHeight;
|
|
2112
|
+
_ && s && s();
|
|
2113
|
+
}
|
|
2114
|
+
}, /* @__PURE__ */ m.createElement("div", et({
|
|
2115
|
+
style: d,
|
|
2116
|
+
className: St(q({}, "".concat(i, "-holder-inner"), i)),
|
|
2117
|
+
ref: t
|
|
2118
|
+
}, l), a, c)));
|
|
2119
|
+
});
|
|
2120
|
+
Nn.displayName = "Filler";
|
|
2121
|
+
var Pn = function(t) {
|
|
2122
|
+
return +setTimeout(t, 16);
|
|
2123
|
+
}, In = function(t) {
|
|
2124
|
+
return clearTimeout(t);
|
|
2125
|
+
};
|
|
2126
|
+
typeof window < "u" && "requestAnimationFrame" in window && (Pn = function(t) {
|
|
2127
|
+
return window.requestAnimationFrame(t);
|
|
2128
|
+
}, In = function(t) {
|
|
2129
|
+
return window.cancelAnimationFrame(t);
|
|
2130
|
+
});
|
|
2131
|
+
var Ur = 0, dr = /* @__PURE__ */ new Map();
|
|
2132
|
+
function wn(e) {
|
|
2133
|
+
dr.delete(e);
|
|
2134
|
+
}
|
|
2135
|
+
var le = function(t) {
|
|
2136
|
+
var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
2137
|
+
Ur += 1;
|
|
2138
|
+
var n = Ur;
|
|
2139
|
+
function o(a) {
|
|
2140
|
+
if (a === 0)
|
|
2141
|
+
wn(n), t();
|
|
2142
|
+
else {
|
|
2143
|
+
var i = Pn(function() {
|
|
2144
|
+
o(a - 1);
|
|
2145
|
+
});
|
|
2146
|
+
dr.set(n, i);
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
return o(r), n;
|
|
2150
|
+
};
|
|
2151
|
+
le.cancel = function(e) {
|
|
2152
|
+
var t = dr.get(e);
|
|
2153
|
+
return wn(e), In(t);
|
|
2154
|
+
};
|
|
2155
|
+
function xr(e, t) {
|
|
2156
|
+
var r = "touches" in e ? e.touches[0] : e;
|
|
2157
|
+
return r[t ? "pageX" : "pageY"];
|
|
2158
|
+
}
|
|
2159
|
+
var Br = /* @__PURE__ */ m.forwardRef(function(e, t) {
|
|
2160
|
+
var r = e.prefixCls, n = e.rtl, o = e.scrollOffset, a = e.scrollRange, i = e.onStartMove, s = e.onStopMove, l = e.onScroll, u = e.horizontal, c = e.spinSize, f = e.containerSize, d = e.style, h = e.thumbStyle, g = m.useState(!1), _ = Q(g, 2), p = _[0], S = _[1], T = m.useState(null), I = Q(T, 2), F = I[0], H = I[1], M = m.useState(null), O = Q(M, 2), L = O[0], U = O[1], B = !n, X = m.useRef(), k = m.useRef(), J = m.useState(!1), z = Q(J, 2), Pe = z[0], K = z[1], Re = m.useRef(), ne = function() {
|
|
2161
|
+
clearTimeout(Re.current), K(!0), Re.current = setTimeout(function() {
|
|
2162
|
+
K(!1);
|
|
2163
|
+
}, 3e3);
|
|
2164
|
+
}, Y = a - f || 0, Ve = f - c || 0, $ = m.useMemo(function() {
|
|
2165
|
+
if (o === 0 || Y === 0)
|
|
2166
|
+
return 0;
|
|
2167
|
+
var V = o / Y;
|
|
2168
|
+
return V * Ve;
|
|
2169
|
+
}, [o, Y, Ve]), Oe = function(x) {
|
|
2170
|
+
x.stopPropagation(), x.preventDefault();
|
|
2171
|
+
}, Ie = m.useRef({
|
|
2172
|
+
top: $,
|
|
2173
|
+
dragging: p,
|
|
2174
|
+
pageY: F,
|
|
2175
|
+
startTop: L
|
|
2176
|
+
});
|
|
2177
|
+
Ie.current = {
|
|
2178
|
+
top: $,
|
|
2179
|
+
dragging: p,
|
|
2180
|
+
pageY: F,
|
|
2181
|
+
startTop: L
|
|
2182
|
+
};
|
|
2183
|
+
var je = function(x) {
|
|
2184
|
+
S(!0), H(xr(x, u)), U(Ie.current.top), i(), x.stopPropagation(), x.preventDefault();
|
|
2185
|
+
};
|
|
2186
|
+
m.useEffect(function() {
|
|
2187
|
+
var V = function(Qe) {
|
|
2188
|
+
Qe.preventDefault();
|
|
2189
|
+
}, x = X.current, de = k.current;
|
|
2190
|
+
return x.addEventListener("touchstart", V), de.addEventListener("touchstart", je), function() {
|
|
2191
|
+
x.removeEventListener("touchstart", V), de.removeEventListener("touchstart", je);
|
|
2192
|
+
};
|
|
2193
|
+
}, []);
|
|
2194
|
+
var ke = m.useRef();
|
|
2195
|
+
ke.current = Y;
|
|
2196
|
+
var ie = m.useRef();
|
|
2197
|
+
ie.current = Ve, m.useEffect(function() {
|
|
2198
|
+
if (p) {
|
|
2199
|
+
var V, x = function(Qe) {
|
|
2200
|
+
var we = Ie.current, nt = we.dragging, it = we.pageY, Dt = we.startTop;
|
|
2201
|
+
if (le.cancel(V), nt) {
|
|
2202
|
+
var Fe = xr(Qe, u) - it, Ae = Dt;
|
|
2203
|
+
!B && u ? Ae -= Fe : Ae += Fe;
|
|
2204
|
+
var ot = ke.current, st = ie.current, Ut = st ? Ae / st : 0, Ce = Math.ceil(Ut * ot);
|
|
2205
|
+
Ce = Math.max(Ce, 0), Ce = Math.min(Ce, ot), V = le(function() {
|
|
2206
|
+
l(Ce, u);
|
|
2207
|
+
});
|
|
2208
|
+
}
|
|
2209
|
+
}, de = function() {
|
|
2210
|
+
S(!1), s();
|
|
2211
|
+
};
|
|
2212
|
+
return window.addEventListener("mousemove", x), window.addEventListener("touchmove", x), window.addEventListener("mouseup", de), window.addEventListener("touchend", de), function() {
|
|
2213
|
+
window.removeEventListener("mousemove", x), window.removeEventListener("touchmove", x), window.removeEventListener("mouseup", de), window.removeEventListener("touchend", de), le.cancel(V);
|
|
2214
|
+
};
|
|
2215
|
+
}
|
|
2216
|
+
}, [p]), m.useEffect(function() {
|
|
2217
|
+
ne();
|
|
2218
|
+
}, [o]), m.useImperativeHandle(t, function() {
|
|
2219
|
+
return {
|
|
2220
|
+
delayHidden: ne
|
|
2221
|
+
};
|
|
2222
|
+
});
|
|
2223
|
+
var pe = "".concat(r, "-scrollbar"), ee = {
|
|
2224
|
+
position: "absolute",
|
|
2225
|
+
visibility: Pe ? null : "hidden"
|
|
2226
|
+
}, oe = {
|
|
2227
|
+
position: "absolute",
|
|
2228
|
+
background: "rgba(0, 0, 0, 0.5)",
|
|
2229
|
+
borderRadius: 99,
|
|
2230
|
+
cursor: "pointer",
|
|
2231
|
+
userSelect: "none"
|
|
2232
|
+
};
|
|
2233
|
+
return u ? (ee.height = 8, ee.left = 0, ee.right = 0, ee.bottom = 0, oe.height = "100%", oe.width = c, B ? oe.left = $ : oe.right = $) : (ee.width = 8, ee.top = 0, ee.bottom = 0, B ? ee.right = 0 : ee.left = 0, oe.width = "100%", oe.height = c, oe.top = $), /* @__PURE__ */ m.createElement("div", {
|
|
2234
|
+
ref: X,
|
|
2235
|
+
className: St(pe, q(q(q({}, "".concat(pe, "-horizontal"), u), "".concat(pe, "-vertical"), !u), "".concat(pe, "-visible"), Pe)),
|
|
2236
|
+
style: Z(Z({}, ee), d),
|
|
2237
|
+
onMouseDown: Oe,
|
|
2238
|
+
onMouseMove: ne
|
|
2239
|
+
}, /* @__PURE__ */ m.createElement("div", {
|
|
2240
|
+
ref: k,
|
|
2241
|
+
className: St("".concat(pe, "-thumb"), q({}, "".concat(pe, "-thumb-moving"), p)),
|
|
2242
|
+
style: Z(Z({}, oe), h),
|
|
2243
|
+
onMouseDown: je
|
|
2244
|
+
}));
|
|
2245
|
+
});
|
|
2246
|
+
function bs(e) {
|
|
2247
|
+
var t = e.children, r = e.setRef, n = m.useCallback(function(o) {
|
|
2248
|
+
r(o);
|
|
2249
|
+
}, []);
|
|
2250
|
+
return /* @__PURE__ */ m.cloneElement(t, {
|
|
2251
|
+
ref: n
|
|
2252
|
+
});
|
|
2253
|
+
}
|
|
2254
|
+
function Ts(e, t, r, n, o, a, i) {
|
|
2255
|
+
var s = i.getKey;
|
|
2256
|
+
return e.slice(t, r + 1).map(function(l, u) {
|
|
2257
|
+
var c = t + u, f = a(l, c, {
|
|
2258
|
+
style: {
|
|
2259
|
+
width: n
|
|
2260
|
+
}
|
|
2261
|
+
}), d = s(l);
|
|
2262
|
+
return /* @__PURE__ */ m.createElement(bs, {
|
|
2263
|
+
key: d,
|
|
2264
|
+
setRef: function(g) {
|
|
2265
|
+
return o(l, g);
|
|
2266
|
+
}
|
|
2267
|
+
}, f);
|
|
2268
|
+
});
|
|
2269
|
+
}
|
|
2270
|
+
var Rs = /* @__PURE__ */ function() {
|
|
2271
|
+
function e() {
|
|
2272
|
+
On(this, e), q(this, "maps", void 0), q(this, "id", 0), this.maps = /* @__PURE__ */ Object.create(null);
|
|
2273
|
+
}
|
|
2274
|
+
return Fn(e, [{
|
|
2275
|
+
key: "set",
|
|
2276
|
+
value: function(r, n) {
|
|
2277
|
+
this.maps[r] = n, this.id += 1;
|
|
2278
|
+
}
|
|
2279
|
+
}, {
|
|
2280
|
+
key: "get",
|
|
2281
|
+
value: function(r) {
|
|
2282
|
+
return this.maps[r];
|
|
2283
|
+
}
|
|
2284
|
+
}]), e;
|
|
2285
|
+
}();
|
|
2286
|
+
function Os(e, t, r) {
|
|
2287
|
+
var n = m.useState(0), o = Q(n, 2), a = o[0], i = o[1], s = A(/* @__PURE__ */ new Map()), l = A(new Rs()), u = A();
|
|
2288
|
+
function c() {
|
|
2289
|
+
le.cancel(u.current);
|
|
2290
|
+
}
|
|
2291
|
+
function f() {
|
|
2292
|
+
var h = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
|
|
2293
|
+
c();
|
|
2294
|
+
var g = function() {
|
|
2295
|
+
s.current.forEach(function(p, S) {
|
|
2296
|
+
if (p && p.offsetParent) {
|
|
2297
|
+
var T = dt(p), I = T.offsetHeight;
|
|
2298
|
+
l.current.get(S) !== I && l.current.set(S, T.offsetHeight);
|
|
2299
|
+
}
|
|
2300
|
+
}), i(function(p) {
|
|
2301
|
+
return p + 1;
|
|
2302
|
+
});
|
|
2303
|
+
};
|
|
2304
|
+
h ? g() : u.current = le(g);
|
|
2305
|
+
}
|
|
2306
|
+
function d(h, g) {
|
|
2307
|
+
var _ = e(h), p = s.current.get(_);
|
|
2308
|
+
g ? (s.current.set(_, g), f()) : s.current.delete(_), !p != !g && (g ? t == null || t(h) : r == null || r(h));
|
|
2309
|
+
}
|
|
2310
|
+
return Hi(function() {
|
|
2311
|
+
return c;
|
|
2312
|
+
}, []), [d, f, l.current, a];
|
|
2313
|
+
}
|
|
2314
|
+
function Fs() {
|
|
2315
|
+
return !!(typeof window < "u" && window.document && window.document.createElement);
|
|
2316
|
+
}
|
|
2317
|
+
var Wr = Fs() ? m.useLayoutEffect : m.useEffect, Je = function(t, r) {
|
|
2318
|
+
var n = m.useRef(!0);
|
|
2319
|
+
Wr(function() {
|
|
2320
|
+
return t(n.current);
|
|
2321
|
+
}, r), Wr(function() {
|
|
2322
|
+
return n.current = !1, function() {
|
|
2323
|
+
n.current = !0;
|
|
2324
|
+
};
|
|
2325
|
+
}, []);
|
|
2326
|
+
};
|
|
2327
|
+
function Vr(e) {
|
|
2328
|
+
var t = m.useRef();
|
|
2329
|
+
t.current = e;
|
|
2330
|
+
var r = m.useCallback(function() {
|
|
2331
|
+
for (var n, o = arguments.length, a = new Array(o), i = 0; i < o; i++)
|
|
2332
|
+
a[i] = arguments[i];
|
|
2333
|
+
return (n = t.current) === null || n === void 0 ? void 0 : n.call.apply(n, [t].concat(a));
|
|
2334
|
+
}, []);
|
|
2335
|
+
return r;
|
|
2336
|
+
}
|
|
2337
|
+
var Cs = 10;
|
|
2338
|
+
function Ns(e, t, r, n, o, a, i, s) {
|
|
2339
|
+
var l = m.useRef(), u = m.useState(null), c = Q(u, 2), f = c[0], d = c[1];
|
|
2340
|
+
return Je(function() {
|
|
2341
|
+
if (f && f.times < Cs) {
|
|
2342
|
+
if (!e.current) {
|
|
2343
|
+
d(function(Y) {
|
|
2344
|
+
return Z({}, Y);
|
|
2345
|
+
});
|
|
2346
|
+
return;
|
|
2347
|
+
}
|
|
2348
|
+
a();
|
|
2349
|
+
var h = f.targetAlign, g = f.originAlign, _ = f.index, p = f.offset, S = e.current.clientHeight, T = !1, I = h, F = null;
|
|
2350
|
+
if (S) {
|
|
2351
|
+
for (var H = h || g, M = 0, O = 0, L = 0, U = Math.min(t.length - 1, _), B = 0; B <= U; B += 1) {
|
|
2352
|
+
var X = o(t[B]);
|
|
2353
|
+
O = M;
|
|
2354
|
+
var k = r.get(X);
|
|
2355
|
+
L = O + (k === void 0 ? n : k), M = L;
|
|
2356
|
+
}
|
|
2357
|
+
for (var J = H === "top" ? p : S - p, z = U; z >= 0; z -= 1) {
|
|
2358
|
+
var Pe = o(t[z]), K = r.get(Pe);
|
|
2359
|
+
if (K === void 0) {
|
|
2360
|
+
T = !0;
|
|
2361
|
+
break;
|
|
2362
|
+
}
|
|
2363
|
+
if (J -= K, J <= 0)
|
|
2364
|
+
break;
|
|
2365
|
+
}
|
|
2366
|
+
switch (H) {
|
|
2367
|
+
case "top":
|
|
2368
|
+
F = O - p;
|
|
2369
|
+
break;
|
|
2370
|
+
case "bottom":
|
|
2371
|
+
F = L - S + p;
|
|
2372
|
+
break;
|
|
2373
|
+
default: {
|
|
2374
|
+
var Re = e.current.scrollTop, ne = Re + S;
|
|
2375
|
+
O < Re ? I = "top" : L > ne && (I = "bottom");
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
F !== null && i(F), F !== f.lastTop && (T = !0);
|
|
2379
|
+
}
|
|
2380
|
+
T && d(Z(Z({}, f), {}, {
|
|
2381
|
+
times: f.times + 1,
|
|
2382
|
+
targetAlign: I,
|
|
2383
|
+
lastTop: F
|
|
2384
|
+
}));
|
|
2385
|
+
}
|
|
2386
|
+
}, [f, e.current]), function(h) {
|
|
2387
|
+
if (h == null) {
|
|
2388
|
+
s();
|
|
2389
|
+
return;
|
|
2390
|
+
}
|
|
2391
|
+
if (le.cancel(l.current), typeof h == "number")
|
|
2392
|
+
i(h);
|
|
2393
|
+
else if (h && ue(h) === "object") {
|
|
2394
|
+
var g, _ = h.align;
|
|
2395
|
+
"index" in h ? g = h.index : g = t.findIndex(function(T) {
|
|
2396
|
+
return o(T) === h.key;
|
|
2397
|
+
});
|
|
2398
|
+
var p = h.offset, S = p === void 0 ? 0 : p;
|
|
2399
|
+
d({
|
|
2400
|
+
times: 0,
|
|
2401
|
+
index: g,
|
|
2402
|
+
offset: S,
|
|
2403
|
+
originAlign: _
|
|
2404
|
+
});
|
|
2405
|
+
}
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2408
|
+
function Ps(e, t, r) {
|
|
2409
|
+
var n = e.length, o = t.length, a, i;
|
|
2410
|
+
if (n === 0 && o === 0)
|
|
2411
|
+
return null;
|
|
2412
|
+
n < o ? (a = e, i = t) : (a = t, i = e);
|
|
2413
|
+
var s = {
|
|
2414
|
+
__EMPTY_ITEM__: !0
|
|
2415
|
+
};
|
|
2416
|
+
function l(g) {
|
|
2417
|
+
return g !== void 0 ? r(g) : s;
|
|
2418
|
+
}
|
|
2419
|
+
for (var u = null, c = Math.abs(n - o) !== 1, f = 0; f < i.length; f += 1) {
|
|
2420
|
+
var d = l(a[f]), h = l(i[f]);
|
|
2421
|
+
if (d !== h) {
|
|
2422
|
+
u = f, c = c || d !== l(i[f + 1]);
|
|
2423
|
+
break;
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
return u === null ? null : {
|
|
2427
|
+
index: u,
|
|
2428
|
+
multiple: c
|
|
2429
|
+
};
|
|
2430
|
+
}
|
|
2431
|
+
function Is(e, t, r) {
|
|
2432
|
+
var n = m.useState(e), o = Q(n, 2), a = o[0], i = o[1], s = m.useState(null), l = Q(s, 2), u = l[0], c = l[1];
|
|
2433
|
+
return m.useEffect(function() {
|
|
2434
|
+
var f = Ps(a || [], e || [], t);
|
|
2435
|
+
(f == null ? void 0 : f.index) !== void 0 && (r == null || r(f.index), c(e[f.index])), i(e);
|
|
2436
|
+
}, [e]), [u];
|
|
2437
|
+
}
|
|
2438
|
+
var jr = (typeof navigator > "u" ? "undefined" : ue(navigator)) === "object" && /Firefox/i.test(navigator.userAgent);
|
|
2439
|
+
const An = function(e, t) {
|
|
2440
|
+
var r = A(!1), n = A(null);
|
|
2441
|
+
function o() {
|
|
2442
|
+
clearTimeout(n.current), r.current = !0, n.current = setTimeout(function() {
|
|
2443
|
+
r.current = !1;
|
|
2444
|
+
}, 50);
|
|
2445
|
+
}
|
|
2446
|
+
var a = A({
|
|
2447
|
+
top: e,
|
|
2448
|
+
bottom: t
|
|
2449
|
+
});
|
|
2450
|
+
return a.current.top = e, a.current.bottom = t, function(i) {
|
|
2451
|
+
var s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, l = (
|
|
2452
|
+
// Pass origin wheel when on the top
|
|
2453
|
+
i < 0 && a.current.top || // Pass origin wheel when on the bottom
|
|
2454
|
+
i > 0 && a.current.bottom
|
|
2455
|
+
);
|
|
2456
|
+
return s && l ? (clearTimeout(n.current), r.current = !1) : (!l || r.current) && o(), !r.current && l;
|
|
2457
|
+
};
|
|
2458
|
+
};
|
|
2459
|
+
function ws(e, t, r, n, o) {
|
|
2460
|
+
var a = A(0), i = A(null), s = A(null), l = A(!1), u = An(t, r);
|
|
2461
|
+
function c(p, S) {
|
|
2462
|
+
le.cancel(i.current), a.current += S, s.current = S, !u(S) && (jr || p.preventDefault(), i.current = le(function() {
|
|
2463
|
+
var T = l.current ? 10 : 1;
|
|
2464
|
+
o(a.current * T), a.current = 0;
|
|
2465
|
+
}));
|
|
2466
|
+
}
|
|
2467
|
+
function f(p, S) {
|
|
2468
|
+
o(S, !0), jr || p.preventDefault();
|
|
2469
|
+
}
|
|
2470
|
+
var d = A(null), h = A(null);
|
|
2471
|
+
function g(p) {
|
|
2472
|
+
if (e) {
|
|
2473
|
+
le.cancel(h.current), h.current = le(function() {
|
|
2474
|
+
d.current = null;
|
|
2475
|
+
}, 2);
|
|
2476
|
+
var S = p.deltaX, T = p.deltaY, I = p.shiftKey, F = S, H = T;
|
|
2477
|
+
(d.current === "sx" || !d.current && I && T && !S) && (F = T, H = 0, d.current = "sx");
|
|
2478
|
+
var M = Math.abs(F), O = Math.abs(H);
|
|
2479
|
+
d.current === null && (d.current = n && M > O ? "x" : "y"), d.current === "y" ? c(p, H) : f(p, F);
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
function _(p) {
|
|
2483
|
+
e && (l.current = p.detail === s.current);
|
|
2484
|
+
}
|
|
2485
|
+
return [g, _];
|
|
2486
|
+
}
|
|
2487
|
+
var As = 14 / 15;
|
|
2488
|
+
function Ms(e, t, r) {
|
|
2489
|
+
var n = A(!1), o = A(0), a = A(null), i = A(null), s, l = function(d) {
|
|
2490
|
+
if (n.current) {
|
|
2491
|
+
var h = Math.ceil(d.touches[0].pageY), g = o.current - h;
|
|
2492
|
+
o.current = h, r(g) && d.preventDefault(), clearInterval(i.current), i.current = setInterval(function() {
|
|
2493
|
+
g *= As, (!r(g, !0) || Math.abs(g) <= 0.1) && clearInterval(i.current);
|
|
2494
|
+
}, 16);
|
|
2495
|
+
}
|
|
2496
|
+
}, u = function() {
|
|
2497
|
+
n.current = !1, s();
|
|
2498
|
+
}, c = function(d) {
|
|
2499
|
+
s(), d.touches.length === 1 && !n.current && (n.current = !0, o.current = Math.ceil(d.touches[0].pageY), a.current = d.target, a.current.addEventListener("touchmove", l), a.current.addEventListener("touchend", u));
|
|
2500
|
+
};
|
|
2501
|
+
s = function() {
|
|
2502
|
+
a.current && (a.current.removeEventListener("touchmove", l), a.current.removeEventListener("touchend", u));
|
|
2503
|
+
}, Je(function() {
|
|
2504
|
+
return e && t.current.addEventListener("touchstart", c), function() {
|
|
2505
|
+
var f;
|
|
2506
|
+
(f = t.current) === null || f === void 0 || f.removeEventListener("touchstart", c), s(), clearInterval(i.current);
|
|
2507
|
+
};
|
|
2508
|
+
}, [e]);
|
|
2509
|
+
}
|
|
2510
|
+
var Ls = 20;
|
|
2511
|
+
function kr() {
|
|
2512
|
+
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, r = e / t * e;
|
|
2513
|
+
return isNaN(r) && (r = 0), r = Math.max(r, Ls), Math.floor(r);
|
|
2514
|
+
}
|
|
2515
|
+
function $s(e, t, r, n) {
|
|
2516
|
+
var o = m.useMemo(function() {
|
|
2517
|
+
return [/* @__PURE__ */ new Map(), []];
|
|
2518
|
+
}, [e, r.id, n]), a = Q(o, 2), i = a[0], s = a[1], l = function(c) {
|
|
2519
|
+
var f = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : c, d = i.get(c), h = i.get(f);
|
|
2520
|
+
if (d === void 0 || h === void 0)
|
|
2521
|
+
for (var g = e.length, _ = s.length; _ < g; _ += 1) {
|
|
2522
|
+
var p, S = e[_], T = t(S);
|
|
2523
|
+
i.set(T, _);
|
|
2524
|
+
var I = (p = r.get(T)) !== null && p !== void 0 ? p : n;
|
|
2525
|
+
if (s[_] = (s[_ - 1] || 0) + I, T === c && (d = _), T === f && (h = _), d !== void 0 && h !== void 0)
|
|
2526
|
+
break;
|
|
2527
|
+
}
|
|
2528
|
+
return {
|
|
2529
|
+
top: s[d - 1] || 0,
|
|
2530
|
+
bottom: s[h]
|
|
2531
|
+
};
|
|
2532
|
+
};
|
|
2533
|
+
return l;
|
|
2534
|
+
}
|
|
2535
|
+
var Hs = ["prefixCls", "className", "height", "itemHeight", "fullHeight", "style", "data", "children", "itemKey", "virtual", "direction", "scrollWidth", "component", "onScroll", "onVirtualScroll", "onVisibleChange", "innerProps", "extraRender", "styles"], Ds = [], Us = {
|
|
2536
|
+
overflowY: "auto",
|
|
2537
|
+
overflowAnchor: "none"
|
|
2538
|
+
};
|
|
2539
|
+
function xs(e, t) {
|
|
2540
|
+
var r = e.prefixCls, n = r === void 0 ? "rc-virtual-list" : r, o = e.className, a = e.height, i = e.itemHeight, s = e.fullHeight, l = s === void 0 ? !0 : s, u = e.style, c = e.data, f = e.children, d = e.itemKey, h = e.virtual, g = e.direction, _ = e.scrollWidth, p = e.component, S = p === void 0 ? "div" : p, T = e.onScroll, I = e.onVirtualScroll, F = e.onVisibleChange, H = e.innerProps, M = e.extraRender, O = e.styles, L = Lo(e, Hs), U = m.useCallback(function(E) {
|
|
2541
|
+
return typeof d == "function" ? d(E) : E == null ? void 0 : E[d];
|
|
2542
|
+
}, [d]), B = Os(U, null, null), X = Q(B, 4), k = X[0], J = X[1], z = X[2], Pe = X[3], K = !!(h !== !1 && a && i), Re = m.useMemo(function() {
|
|
2543
|
+
return Object.values(z.maps).reduce(function(E, y) {
|
|
2544
|
+
return E + y;
|
|
2545
|
+
}, 0);
|
|
2546
|
+
}, [z.id, z.maps]), ne = K && c && (Math.max(i * c.length, Re) > a || !!_), Y = g === "rtl", Ve = St(n, q({}, "".concat(n, "-rtl"), Y), o), $ = c || Ds, Oe = A(), Ie = A(), je = Gt(0), ke = Q(je, 2), ie = ke[0], pe = ke[1], ee = Gt(0), oe = Q(ee, 2), V = oe[0], x = oe[1], de = Gt(!1), ze = Q(de, 2), Qe = ze[0], we = ze[1], nt = function() {
|
|
2547
|
+
we(!0);
|
|
2548
|
+
}, it = function() {
|
|
2549
|
+
we(!1);
|
|
2550
|
+
}, Dt = {
|
|
2551
|
+
getKey: U
|
|
2552
|
+
};
|
|
2553
|
+
function Fe(E) {
|
|
2554
|
+
pe(function(y) {
|
|
2555
|
+
var P;
|
|
2556
|
+
typeof E == "function" ? P = E(y) : P = E;
|
|
2557
|
+
var j = xn(P);
|
|
2558
|
+
return Oe.current.scrollTop = j, j;
|
|
2559
|
+
});
|
|
2560
|
+
}
|
|
2561
|
+
var Ae = A({
|
|
2562
|
+
start: 0,
|
|
2563
|
+
end: $.length
|
|
2564
|
+
}), ot = A(), st = Is($, U), Ut = Q(st, 1), Ce = Ut[0];
|
|
2565
|
+
ot.current = Ce;
|
|
2566
|
+
var at = m.useMemo(function() {
|
|
2567
|
+
if (!K)
|
|
2568
|
+
return {
|
|
2569
|
+
scrollHeight: void 0,
|
|
2570
|
+
start: 0,
|
|
2571
|
+
end: $.length - 1,
|
|
2572
|
+
offset: void 0
|
|
2573
|
+
};
|
|
2574
|
+
if (!ne) {
|
|
2575
|
+
var E;
|
|
2576
|
+
return {
|
|
2577
|
+
scrollHeight: ((E = Ie.current) === null || E === void 0 ? void 0 : E.offsetHeight) || 0,
|
|
2578
|
+
start: 0,
|
|
2579
|
+
end: $.length - 1,
|
|
2580
|
+
offset: void 0
|
|
2581
|
+
};
|
|
2582
|
+
}
|
|
2583
|
+
for (var y = 0, P, j, ge, Gn = $.length, Xe = 0; Xe < Gn; Xe += 1) {
|
|
2584
|
+
var Yn = $[Xe], qn = U(Yn), Fr = z.get(qn), Qt = y + (Fr === void 0 ? i : Fr);
|
|
2585
|
+
Qt >= ie && P === void 0 && (P = Xe, j = y), Qt > ie + a && ge === void 0 && (ge = Xe), y = Qt;
|
|
2586
|
+
}
|
|
2587
|
+
return P === void 0 && (P = 0, j = 0, ge = Math.ceil(a / i)), ge === void 0 && (ge = $.length - 1), ge = Math.min(ge + 1, $.length - 1), {
|
|
2588
|
+
scrollHeight: y,
|
|
2589
|
+
start: P,
|
|
2590
|
+
end: ge,
|
|
2591
|
+
offset: j
|
|
2592
|
+
};
|
|
2593
|
+
}, [ne, K, ie, $, Pe, a]), Me = at.scrollHeight, Ge = at.start, Ye = at.end, mr = at.offset;
|
|
2594
|
+
Ae.current.start = Ge, Ae.current.end = Ye;
|
|
2595
|
+
var Ln = m.useState({
|
|
2596
|
+
width: 0,
|
|
2597
|
+
height: a
|
|
2598
|
+
}), vr = Q(Ln, 2), me = vr[0], $n = vr[1], Hn = function(y) {
|
|
2599
|
+
$n({
|
|
2600
|
+
width: y.width || y.offsetWidth,
|
|
2601
|
+
height: y.height || y.offsetHeight
|
|
2602
|
+
});
|
|
2603
|
+
}, pr = A(), gr = A(), Dn = m.useMemo(function() {
|
|
2604
|
+
return kr(me.width, _);
|
|
2605
|
+
}, [me.width, _]), Un = m.useMemo(function() {
|
|
2606
|
+
return kr(me.height, Me);
|
|
2607
|
+
}, [me.height, Me]), xt = Me - a, Bt = A(xt);
|
|
2608
|
+
Bt.current = xt;
|
|
2609
|
+
function xn(E) {
|
|
2610
|
+
var y = E;
|
|
2611
|
+
return Number.isNaN(Bt.current) || (y = Math.min(y, Bt.current)), y = Math.max(y, 0), y;
|
|
2612
|
+
}
|
|
2613
|
+
var _r = ie <= 0, Sr = ie >= xt, Bn = An(_r, Sr), Wt = function() {
|
|
2614
|
+
return {
|
|
2615
|
+
x: Y ? -V : V,
|
|
2616
|
+
y: ie
|
|
2617
|
+
};
|
|
2618
|
+
}, Vt = A(Wt()), jt = Vr(function() {
|
|
2619
|
+
if (I) {
|
|
2620
|
+
var E = Wt();
|
|
2621
|
+
(Vt.current.x !== E.x || Vt.current.y !== E.y) && (I(E), Vt.current = E);
|
|
2622
|
+
}
|
|
2623
|
+
});
|
|
2624
|
+
function Er(E, y) {
|
|
2625
|
+
var P = E;
|
|
2626
|
+
y ? (Ar(function() {
|
|
2627
|
+
x(P);
|
|
2628
|
+
}), jt()) : Fe(P);
|
|
2629
|
+
}
|
|
2630
|
+
function Wn(E) {
|
|
2631
|
+
var y = E.currentTarget.scrollTop;
|
|
2632
|
+
y !== ie && Fe(y), T == null || T(E), jt();
|
|
2633
|
+
}
|
|
2634
|
+
var kt = function(y) {
|
|
2635
|
+
var P = y, j = _ ? _ - me.width : 0;
|
|
2636
|
+
return P = Math.max(P, 0), P = Math.min(P, j), P;
|
|
2637
|
+
}, Vn = Vr(function(E, y) {
|
|
2638
|
+
y ? (Ar(function() {
|
|
2639
|
+
x(function(P) {
|
|
2640
|
+
var j = P + (Y ? -E : E);
|
|
2641
|
+
return kt(j);
|
|
2642
|
+
});
|
|
2643
|
+
}), jt()) : Fe(function(P) {
|
|
2644
|
+
var j = P + E;
|
|
2645
|
+
return j;
|
|
2646
|
+
});
|
|
2647
|
+
}), jn = ws(K, _r, Sr, !!_, Vn), yr = Q(jn, 2), zt = yr[0], br = yr[1];
|
|
2648
|
+
Ms(K, Oe, function(E, y) {
|
|
2649
|
+
return Bn(E, y) ? !1 : (zt({
|
|
2650
|
+
preventDefault: function() {
|
|
2651
|
+
},
|
|
2652
|
+
deltaY: E
|
|
2653
|
+
}), !0);
|
|
2654
|
+
}), Je(function() {
|
|
2655
|
+
function E(P) {
|
|
2656
|
+
K && P.preventDefault();
|
|
2657
|
+
}
|
|
2658
|
+
var y = Oe.current;
|
|
2659
|
+
return y.addEventListener("wheel", zt), y.addEventListener("DOMMouseScroll", br), y.addEventListener("MozMousePixelScroll", E), function() {
|
|
2660
|
+
y.removeEventListener("wheel", zt), y.removeEventListener("DOMMouseScroll", br), y.removeEventListener("MozMousePixelScroll", E);
|
|
2661
|
+
};
|
|
2662
|
+
}, [K]), Je(function() {
|
|
2663
|
+
_ && x(function(E) {
|
|
2664
|
+
return kt(E);
|
|
2665
|
+
});
|
|
2666
|
+
}, [me.width, _]);
|
|
2667
|
+
var Tr = function() {
|
|
2668
|
+
var y, P;
|
|
2669
|
+
(y = pr.current) === null || y === void 0 || y.delayHidden(), (P = gr.current) === null || P === void 0 || P.delayHidden();
|
|
2670
|
+
}, Rr = Ns(Oe, $, z, i, U, function() {
|
|
2671
|
+
return J(!0);
|
|
2672
|
+
}, Fe, Tr);
|
|
2673
|
+
m.useImperativeHandle(t, function() {
|
|
2674
|
+
return {
|
|
2675
|
+
getScrollInfo: Wt,
|
|
2676
|
+
scrollTo: function(y) {
|
|
2677
|
+
function P(j) {
|
|
2678
|
+
return j && ue(j) === "object" && ("left" in j || "top" in j);
|
|
2679
|
+
}
|
|
2680
|
+
P(y) ? (y.left !== void 0 && x(kt(y.left)), Rr(y.top)) : Rr(y);
|
|
2681
|
+
}
|
|
2682
|
+
};
|
|
2683
|
+
}), Je(function() {
|
|
2684
|
+
if (F) {
|
|
2685
|
+
var E = $.slice(Ge, Ye + 1);
|
|
2686
|
+
F(E, $);
|
|
2687
|
+
}
|
|
2688
|
+
}, [Ge, Ye, $]);
|
|
2689
|
+
var kn = $s($, U, z, i), zn = M == null ? void 0 : M({
|
|
2690
|
+
start: Ge,
|
|
2691
|
+
end: Ye,
|
|
2692
|
+
virtual: ne,
|
|
2693
|
+
offsetX: V,
|
|
2694
|
+
offsetY: mr,
|
|
2695
|
+
rtl: Y,
|
|
2696
|
+
getSize: kn
|
|
2697
|
+
}), Qn = Ts($, Ge, Ye, _, k, f, Dt), qe = null;
|
|
2698
|
+
a && (qe = Z(q({}, l ? "height" : "maxHeight", a), Us), K && (qe.overflowY = "hidden", _ && (qe.overflowX = "hidden"), Qe && (qe.pointerEvents = "none")));
|
|
2699
|
+
var Or = {};
|
|
2700
|
+
return Y && (Or.dir = "rtl"), /* @__PURE__ */ m.createElement("div", et({
|
|
2701
|
+
style: Z(Z({}, u), {}, {
|
|
2702
|
+
position: "relative"
|
|
2703
|
+
}),
|
|
2704
|
+
className: Ve
|
|
2705
|
+
}, Or, L), /* @__PURE__ */ m.createElement(hr, {
|
|
2706
|
+
onResize: Hn
|
|
2707
|
+
}, /* @__PURE__ */ m.createElement(S, {
|
|
2708
|
+
className: "".concat(n, "-holder"),
|
|
2709
|
+
style: qe,
|
|
2710
|
+
ref: Oe,
|
|
2711
|
+
onScroll: Wn,
|
|
2712
|
+
onMouseEnter: Tr
|
|
2713
|
+
}, /* @__PURE__ */ m.createElement(Nn, {
|
|
2714
|
+
prefixCls: n,
|
|
2715
|
+
height: Me,
|
|
2716
|
+
offsetX: V,
|
|
2717
|
+
offsetY: mr,
|
|
2718
|
+
scrollWidth: _,
|
|
2719
|
+
onInnerResize: J,
|
|
2720
|
+
ref: Ie,
|
|
2721
|
+
innerProps: H,
|
|
2722
|
+
rtl: Y,
|
|
2723
|
+
extra: zn
|
|
2724
|
+
}, Qn))), ne && Me > a && /* @__PURE__ */ m.createElement(Br, {
|
|
2725
|
+
ref: pr,
|
|
2726
|
+
prefixCls: n,
|
|
2727
|
+
scrollOffset: ie,
|
|
2728
|
+
scrollRange: Me,
|
|
2729
|
+
rtl: Y,
|
|
2730
|
+
onScroll: Er,
|
|
2731
|
+
onStartMove: nt,
|
|
2732
|
+
onStopMove: it,
|
|
2733
|
+
spinSize: Un,
|
|
2734
|
+
containerSize: me.height,
|
|
2735
|
+
style: O == null ? void 0 : O.verticalScrollBar,
|
|
2736
|
+
thumbStyle: O == null ? void 0 : O.verticalScrollBarThumb
|
|
2737
|
+
}), ne && _ > me.width && /* @__PURE__ */ m.createElement(Br, {
|
|
2738
|
+
ref: gr,
|
|
2739
|
+
prefixCls: n,
|
|
2740
|
+
scrollOffset: V,
|
|
2741
|
+
scrollRange: _,
|
|
2742
|
+
rtl: Y,
|
|
2743
|
+
onScroll: Er,
|
|
2744
|
+
onStartMove: nt,
|
|
2745
|
+
onStopMove: it,
|
|
2746
|
+
spinSize: Dn,
|
|
2747
|
+
containerSize: me.width,
|
|
2748
|
+
horizontal: !0,
|
|
2749
|
+
style: O == null ? void 0 : O.horizontalScrollBar,
|
|
2750
|
+
thumbStyle: O == null ? void 0 : O.horizontalScrollBarThumb
|
|
2751
|
+
}));
|
|
2752
|
+
}
|
|
2753
|
+
var Mn = /* @__PURE__ */ m.forwardRef(xs);
|
|
2754
|
+
Mn.displayName = "List";
|
|
2755
|
+
function Bs(e) {
|
|
2756
|
+
const { model: t } = e, r = Ke(We), n = Ee(t.searchString$, "", !0), o = Ee(t.filterItems$, void 0, !0), a = r.t("sheets-filter.panel.filter-only"), i = qt(o), s = i.checked > 0 && i.unchecked === 0, l = i.checked > 0 && i.unchecked > 0, u = ae((h, g) => {
|
|
2757
|
+
t.onFilterCheckToggled(h, g);
|
|
2758
|
+
}, [t]), c = ae((h) => {
|
|
2759
|
+
t.onFilterOnly(h);
|
|
2760
|
+
}, [t]), f = ae(() => {
|
|
2761
|
+
t.onCheckAllToggled(!s);
|
|
2762
|
+
}, [t, s]), d = ae((h) => {
|
|
2763
|
+
t.setSearchString(h);
|
|
2764
|
+
}, [t]);
|
|
2765
|
+
return /* @__PURE__ */ R.createElement("div", { className: D.sheetsFilterPanelValuesContainer }, /* @__PURE__ */ R.createElement(rn, { value: n, placeholder: r.t("sheets-filter.panel.search-placeholder"), onChange: d }), /* @__PURE__ */ R.createElement("div", { className: D.sheetsFilterPanelValuesList }, /* @__PURE__ */ R.createElement("div", { className: D.sheetsFilterPanelValuesItem }, /* @__PURE__ */ R.createElement("div", { className: D.sheetsFilterPanelValuesItemInner }, /* @__PURE__ */ R.createElement(
|
|
2766
|
+
wr,
|
|
2767
|
+
{
|
|
2768
|
+
indeterminate: l,
|
|
2769
|
+
disabled: o.length === 0,
|
|
2770
|
+
checked: s,
|
|
2771
|
+
onChange: f
|
|
2772
|
+
}
|
|
2773
|
+
), /* @__PURE__ */ R.createElement("span", { className: D.sheetsFilterPanelValuesItemText }, `${r.t("sheets-filter.panel.select-all")}`), /* @__PURE__ */ R.createElement("span", { className: D.sheetsFilterPanelValuesItemCount }, `(${i.checked}/${i.checked + i.unchecked})`))), /* @__PURE__ */ R.createElement("div", { className: D.sheetsFilterPanelValuesVirtual }, /* @__PURE__ */ R.createElement(Mn, { style: { paddingRight: 8 }, data: o, height: 190, itemHeight: 32, itemKey: (h) => `${h.value}----${h.checked}` }, (h) => /* @__PURE__ */ R.createElement("div", { className: D.sheetsFilterPanelValuesItem }, /* @__PURE__ */ R.createElement("div", { className: D.sheetsFilterPanelValuesItemInner }, /* @__PURE__ */ R.createElement(wr, { checked: h.checked, onChange: () => u(h, !h.checked) }), /* @__PURE__ */ R.createElement("span", { className: D.sheetsFilterPanelValuesItemText }, h.value), /* @__PURE__ */ R.createElement("span", { className: D.sheetsFilterPanelValuesItemCount }, `(${h.count})`), /* @__PURE__ */ R.createElement(
|
|
2774
|
+
ct,
|
|
2775
|
+
{
|
|
2776
|
+
className: D.sheetsFilterPanelValuesItemExcludeButton,
|
|
2777
|
+
size: "small",
|
|
2778
|
+
type: "link",
|
|
2779
|
+
onClick: () => c(h)
|
|
2780
|
+
},
|
|
2781
|
+
a
|
|
2782
|
+
)))))));
|
|
2783
|
+
}
|
|
2784
|
+
function Ws() {
|
|
2785
|
+
const e = Ke(be), t = Ke(We), r = Ke(ce), n = Ee(e.filterBy$, void 0, !0), o = Ee(e.filterByModel$, void 0, !1), a = Ee(() => (o == null ? void 0 : o.canApply$) || He(!1), void 0, !1, [o]), i = Vs(t), s = !Ee(e.hasCriteria$), l = ae((d) => {
|
|
2786
|
+
r.executeCommand(mn.id, { filterBy: d });
|
|
2787
|
+
}, [r]), u = ae(async () => {
|
|
2788
|
+
await (o == null ? void 0 : o.clear()), r.executeCommand(Ze.id);
|
|
2789
|
+
}, [o, r]), c = ae(() => {
|
|
2790
|
+
r.executeCommand(Ze.id);
|
|
2791
|
+
}, [r]), f = ae(async () => {
|
|
2792
|
+
await (o == null ? void 0 : o.apply()), r.executeCommand(Ze.id);
|
|
2793
|
+
}, [o, r]);
|
|
2794
|
+
return /* @__PURE__ */ R.createElement("div", { className: D.sheetsFilterPanel }, /* @__PURE__ */ R.createElement("div", { className: D.sheetsFilterPanelHeader }, /* @__PURE__ */ R.createElement(Pi, { value: n, options: i, onChange: (d) => l(d) })), o ? /* @__PURE__ */ R.createElement("div", { className: D.sheetsFilterPanelContent }, n === pt.VALUES ? /* @__PURE__ */ R.createElement(Bs, { model: o }) : /* @__PURE__ */ R.createElement(Oo, { model: o })) : null, /* @__PURE__ */ R.createElement("div", { className: D.sheetsFilterPanelFooter }, /* @__PURE__ */ R.createElement(ct, { type: "link", onClick: u, disabled: s }, t.t("sheets-filter.panel.clear-filter")), /* @__PURE__ */ R.createElement("span", { className: D.sheetsFilterPanelFooterPrimaryButtons }, /* @__PURE__ */ R.createElement(ct, { type: "default", onClick: c }, t.t("sheets-filter.panel.cancel")), /* @__PURE__ */ R.createElement(ct, { disabled: !a, type: "primary", onClick: f }, t.t("sheets-filter.panel.confirm")))));
|
|
2795
|
+
}
|
|
2796
|
+
function Vs(e) {
|
|
2797
|
+
const t = e.getCurrentLocale();
|
|
2798
|
+
return lr(
|
|
2799
|
+
() => [
|
|
2800
|
+
{ label: e.t("sheets-filter.panel.by-values"), value: pt.VALUES },
|
|
2801
|
+
{ label: e.t("sheets-filter.panel.by-conditions"), value: pt.CONDITIONS }
|
|
2802
|
+
],
|
|
2803
|
+
[t, e]
|
|
2804
|
+
);
|
|
2805
|
+
}
|
|
2806
|
+
const js = {
|
|
2807
|
+
id: rt.id,
|
|
2808
|
+
binding: oi.L | Nr.CTRL_COMMAND | Nr.SHIFT,
|
|
2809
|
+
description: "sheets-filter.shortcut.smart-toggle-filter",
|
|
2810
|
+
preconditions: Ei,
|
|
2811
|
+
group: "4_sheet-edit"
|
|
2812
|
+
};
|
|
2813
|
+
function ks(e) {
|
|
2814
|
+
const t = e.get(he);
|
|
2815
|
+
return {
|
|
2816
|
+
id: rt.id,
|
|
2817
|
+
group: nr.TOOLBAR_FORMULAS_INSERT,
|
|
2818
|
+
type: ir.BUTTON_SELECTOR,
|
|
2819
|
+
icon: "FilterSingle",
|
|
2820
|
+
tooltip: "sheets-filter.toolbar.smart-toggle-filter-tooltip",
|
|
2821
|
+
positions: [si.TOOLBAR_START],
|
|
2822
|
+
hidden$: or(e, tt.UNIVER_SHEET),
|
|
2823
|
+
activated$: t.activeFilterModel$.pipe(De((r) => !!r))
|
|
2824
|
+
};
|
|
2825
|
+
}
|
|
2826
|
+
function zs(e) {
|
|
2827
|
+
const t = e.get(he);
|
|
2828
|
+
return {
|
|
2829
|
+
id: cn.id,
|
|
2830
|
+
group: nr.TOOLBAR_OTHERS,
|
|
2831
|
+
type: ir.BUTTON,
|
|
2832
|
+
title: "sheets-filter.toolbar.clear-filter-criteria",
|
|
2833
|
+
positions: [rt.id],
|
|
2834
|
+
hidden$: or(e, tt.UNIVER_SHEET),
|
|
2835
|
+
disabled$: t.activeFilterModel$.pipe(sr((r) => {
|
|
2836
|
+
var n;
|
|
2837
|
+
return (n = r == null ? void 0 : r.hasCriteria$.pipe(De((o) => !o))) != null ? n : He(!0);
|
|
2838
|
+
}))
|
|
2839
|
+
};
|
|
2840
|
+
}
|
|
2841
|
+
function Qs(e) {
|
|
2842
|
+
const t = e.get(he);
|
|
2843
|
+
return {
|
|
2844
|
+
id: fn.id,
|
|
2845
|
+
group: nr.TOOLBAR_OTHERS,
|
|
2846
|
+
type: ir.BUTTON,
|
|
2847
|
+
title: "sheets-filter.toolbar.re-calc-filter-conditions",
|
|
2848
|
+
positions: [rt.id],
|
|
2849
|
+
hidden$: or(e, tt.UNIVER_SHEET),
|
|
2850
|
+
disabled$: t.activeFilterModel$.pipe(sr((r) => {
|
|
2851
|
+
var n;
|
|
2852
|
+
return (n = r == null ? void 0 : r.hasCriteria$.pipe(De((o) => !o))) != null ? n : He(!0);
|
|
2853
|
+
}))
|
|
2854
|
+
};
|
|
2855
|
+
}
|
|
2856
|
+
var Gs = Object.defineProperty, Ys = Object.getOwnPropertyDescriptor, qs = (e, t, r, n) => {
|
|
2857
|
+
for (var o = n > 1 ? void 0 : n ? Ys(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
2858
|
+
(i = e[a]) && (o = (n ? i(t, r, o) : i(o)) || o);
|
|
2859
|
+
return n && o && Gs(t, r, o), o;
|
|
2860
|
+
}, _e = (e, t) => (r, n) => t(r, n, e);
|
|
2861
|
+
const zr = "FILTER_PANEL_POPUP";
|
|
2862
|
+
let mt = class extends qr {
|
|
2863
|
+
constructor(t, r, n, o, a, i, s, l) {
|
|
2864
|
+
super();
|
|
2865
|
+
C(this, "_popupDisposable");
|
|
2866
|
+
this._injector = t, this._componentManager = r, this._sheetsFilterPanelService = n, this._sheetCanvasPopupService = o, this._shortcutService = a, this._commandService = i, this._menuService = s, this._contextService = l, this._initCommands(), this._initShortcuts(), this._initMenuItems(), this._initUI();
|
|
2867
|
+
}
|
|
2868
|
+
dispose() {
|
|
2869
|
+
super.dispose(), this._closeFilterPopup();
|
|
2870
|
+
}
|
|
2871
|
+
_initShortcuts() {
|
|
2872
|
+
[
|
|
2873
|
+
js
|
|
2874
|
+
].forEach((t) => {
|
|
2875
|
+
this.disposeWithMe(this._shortcutService.registerShortcut(t));
|
|
2876
|
+
});
|
|
2877
|
+
}
|
|
2878
|
+
_initCommands() {
|
|
2879
|
+
[
|
|
2880
|
+
rt,
|
|
2881
|
+
$e,
|
|
2882
|
+
cn,
|
|
2883
|
+
fn,
|
|
2884
|
+
mn,
|
|
2885
|
+
dn,
|
|
2886
|
+
Ze
|
|
2887
|
+
].forEach((t) => {
|
|
2888
|
+
this.disposeWithMe(this._commandService.registerCommand(t));
|
|
2889
|
+
});
|
|
2890
|
+
}
|
|
2891
|
+
_initMenuItems() {
|
|
2892
|
+
[
|
|
2893
|
+
ks,
|
|
2894
|
+
zs,
|
|
2895
|
+
Qs
|
|
2896
|
+
].forEach((t) => {
|
|
2897
|
+
this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(t)));
|
|
2898
|
+
});
|
|
2899
|
+
}
|
|
2900
|
+
_initUI() {
|
|
2901
|
+
this.disposeWithMe(this._componentManager.register(zr, Ws)), this.disposeWithMe(this._componentManager.register("FilterSingle", un)), this.disposeWithMe(this._contextService.subscribeContextValue$(xe).pipe(vi()).subscribe((t) => {
|
|
2902
|
+
t ? this._openFilterPopup() : this._closeFilterPopup();
|
|
2903
|
+
}));
|
|
2904
|
+
}
|
|
2905
|
+
_openFilterPopup() {
|
|
2906
|
+
const t = this._sheetsFilterPanelService.filterModel;
|
|
2907
|
+
if (!t)
|
|
2908
|
+
throw new Error("[SheetsFilterUIController]: no filter model when opening filter popup!");
|
|
2909
|
+
const r = t.getRange(), n = this._sheetsFilterPanelService.col, { startRow: o } = r;
|
|
2910
|
+
this._popupDisposable = this._sheetCanvasPopupService.attachPopupToCell(o, n, {
|
|
2911
|
+
componentKey: zr,
|
|
2912
|
+
direction: "horizontal",
|
|
2913
|
+
closeOnSelfTarget: !0,
|
|
2914
|
+
onClickOutside: () => this._commandService.syncExecuteCommand(Ze.id)
|
|
2915
|
+
});
|
|
2916
|
+
}
|
|
2917
|
+
_closeFilterPopup() {
|
|
2918
|
+
var t;
|
|
2919
|
+
(t = this._popupDisposable) == null || t.dispose(), this._popupDisposable = null;
|
|
2920
|
+
}
|
|
2921
|
+
};
|
|
2922
|
+
mt = qs([
|
|
2923
|
+
Xr(Kr.Ready, mt),
|
|
2924
|
+
_e(0, G(Ot)),
|
|
2925
|
+
_e(1, G(ai)),
|
|
2926
|
+
_e(2, G(be)),
|
|
2927
|
+
_e(3, G(yi)),
|
|
2928
|
+
_e(4, li),
|
|
2929
|
+
_e(5, ce),
|
|
2930
|
+
_e(6, ui),
|
|
2931
|
+
_e(7, Rt)
|
|
2932
|
+
], mt);
|
|
2933
|
+
const Se = 16, Xs = 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");
|
|
2934
|
+
class Qr {
|
|
2935
|
+
static drawNoCriteria(t, r, n, o) {
|
|
2936
|
+
t.save(), Mr.drawWith(t, {
|
|
2937
|
+
radius: 2,
|
|
2938
|
+
width: Se,
|
|
2939
|
+
height: Se,
|
|
2940
|
+
fill: o
|
|
2941
|
+
}), t.lineCap = "square", t.strokeStyle = n, t.scale(r / Se, r / Se), t.beginPath(), t.lineWidth = 1, t.lineCap = "round", t.moveTo(3, 4), t.lineTo(13, 4), t.moveTo(4.5, 8), t.lineTo(11.5, 8), t.moveTo(6, 12), t.lineTo(10, 12), t.stroke(), t.restore();
|
|
2942
|
+
}
|
|
2943
|
+
static drawHasCriteria(t, r, n, o) {
|
|
2944
|
+
t.save(), Mr.drawWith(t, {
|
|
2945
|
+
radius: 2,
|
|
2946
|
+
width: Se,
|
|
2947
|
+
height: Se,
|
|
2948
|
+
fill: o
|
|
2949
|
+
}), t.scale(r / Se, r / Se), t.fillStyle = n, t.fill(Xs), t.restore();
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
var Ks = Object.defineProperty, Zs = Object.getOwnPropertyDescriptor, Js = (e, t, r, n) => {
|
|
2953
|
+
for (var o = n > 1 ? void 0 : n ? Zs(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
2954
|
+
(i = e[a]) && (o = (n ? i(t, r, o) : i(o)) || o);
|
|
2955
|
+
return n && o && Ks(t, r, o), o;
|
|
2956
|
+
}, Yt = (e, t) => (r, n) => t(r, n, e);
|
|
2957
|
+
const ve = 16, lt = 1;
|
|
2958
|
+
let er = class extends Ui {
|
|
2959
|
+
constructor(t, r, n, o, a) {
|
|
2960
|
+
super(t, r);
|
|
2961
|
+
C(this, "_cellWidth", 0);
|
|
2962
|
+
C(this, "_cellHeight", 0);
|
|
2963
|
+
C(this, "_filterParams");
|
|
2964
|
+
C(this, "_hovered", !1);
|
|
2965
|
+
this._contextService = n, this._commandService = o, this._themeService = a, this.setShapeProps(r), this.onPointerDownObserver.add((i) => this.onPointerDown(i)), this.onPointerEnterObserver.add(() => this.onPointerEnter()), this.onPointerLeaveObserver.add(() => this.onPointerLeave());
|
|
2966
|
+
}
|
|
2967
|
+
setShapeProps(t) {
|
|
2968
|
+
typeof t.cellHeight < "u" && (this._cellHeight = t.cellHeight), typeof t.cellWidth < "u" && (this._cellWidth = t.cellWidth), typeof t.filterParams < "u" && (this._filterParams = t.filterParams), this.transformByState({
|
|
2969
|
+
width: t.width,
|
|
2970
|
+
height: t.height
|
|
2971
|
+
});
|
|
2972
|
+
}
|
|
2973
|
+
_draw(t) {
|
|
2974
|
+
const r = this._cellHeight, n = this._cellWidth, o = ve - n, a = ve - r;
|
|
2975
|
+
t.save();
|
|
2976
|
+
const i = new Path2D();
|
|
2977
|
+
i.rect(o, a, n, r), t.clip(i);
|
|
2978
|
+
const { hasCriteria: s } = this._filterParams, l = this._themeService.getCurrentTheme().primaryColor, u = this._hovered ? this._themeService.getCurrentTheme().grey50 : "rgba(255, 255, 255, 1.0)";
|
|
2979
|
+
s ? Qr.drawHasCriteria(t, ve, l, u) : Qr.drawNoCriteria(t, ve, l, u), t.restore();
|
|
2980
|
+
}
|
|
2981
|
+
onPointerDown(t) {
|
|
2982
|
+
if (t.button === 2)
|
|
2983
|
+
return;
|
|
2984
|
+
const { col: r, unitId: n, subUnitId: o } = this._filterParams;
|
|
2985
|
+
this._contextService.getContextValue(xe) || setTimeout(() => {
|
|
2986
|
+
this._commandService.executeCommand(dn.id, {
|
|
2987
|
+
unitId: n,
|
|
2988
|
+
subUnitId: o,
|
|
2989
|
+
col: r
|
|
2990
|
+
});
|
|
2991
|
+
}, 200);
|
|
2992
|
+
}
|
|
2993
|
+
onPointerEnter() {
|
|
2994
|
+
this._hovered = !0, this.makeDirty(!0);
|
|
2995
|
+
}
|
|
2996
|
+
onPointerLeave() {
|
|
2997
|
+
this._hovered = !1, this.makeDirty(!0);
|
|
2998
|
+
}
|
|
2999
|
+
};
|
|
3000
|
+
er = Js([
|
|
3001
|
+
Yt(2, Rt),
|
|
3002
|
+
Yt(3, ce),
|
|
3003
|
+
Yt(4, G(Zr))
|
|
3004
|
+
], er);
|
|
3005
|
+
var ea = Object.defineProperty, ta = Object.getOwnPropertyDescriptor, ra = (e, t, r, n) => {
|
|
3006
|
+
for (var o = n > 1 ? void 0 : n ? ta(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
3007
|
+
(i = e[a]) && (o = (n ? i(t, r, o) : i(o)) || o);
|
|
3008
|
+
return n && o && ea(t, r, o), o;
|
|
3009
|
+
}, fe = (e, t) => (r, n) => t(r, n, e);
|
|
3010
|
+
const na = 1e3, ia = 5e3;
|
|
3011
|
+
let vt = class extends qr {
|
|
3012
|
+
constructor(t, r, n, o, a, i, s, l, u, c) {
|
|
3013
|
+
super();
|
|
3014
|
+
C(this, "_filterRangeShape", null);
|
|
3015
|
+
C(this, "_buttonRenderDisposable", null);
|
|
3016
|
+
C(this, "_filterButtonShapes", []);
|
|
3017
|
+
this._injector = t, this._sheetSkeletonManagerService = r, this._sheetsFilterService = n, this._themeService = o, this._sheetInterceptorService = a, this._sheetRenderController = i, this._commandService = s, this._univerInstanceService = l, this._renderManagerService = u, this._selectionRenderService = c, [
|
|
3018
|
+
ar,
|
|
3019
|
+
Ue,
|
|
3020
|
+
ft,
|
|
3021
|
+
nn
|
|
3022
|
+
].forEach((f) => this.disposeWithMe(this._sheetRenderController.registerSkeletonChangingMutations(f.id))), this._initRenderer();
|
|
3023
|
+
}
|
|
3024
|
+
_initRenderer() {
|
|
3025
|
+
this._sheetSkeletonManagerService.currentSkeleton$.pipe(
|
|
3026
|
+
sr((t) => {
|
|
3027
|
+
var s;
|
|
3028
|
+
if (!t)
|
|
3029
|
+
return He(null);
|
|
3030
|
+
const { unitId: r } = t, n = this._univerInstanceService.getUniverSheetInstance(r);
|
|
3031
|
+
if (!n)
|
|
3032
|
+
return He(null);
|
|
3033
|
+
const o = n.getActiveSheet().getSheetId(), a = (s = this._sheetsFilterService.getFilterModel(r, o)) != null ? s : void 0, i = () => ({
|
|
3034
|
+
unitId: r,
|
|
3035
|
+
worksheetId: o,
|
|
3036
|
+
filterModel: a,
|
|
3037
|
+
range: a == null ? void 0 : a.getRange(),
|
|
3038
|
+
skeleton: t.skeleton
|
|
3039
|
+
});
|
|
3040
|
+
return ei(this._commandService.onCommandExecuted).pipe(
|
|
3041
|
+
pi(
|
|
3042
|
+
([l]) => l.type === Te.MUTATION && l.params.unitId === n.getUnitId() && $i.has(l.id)
|
|
3043
|
+
),
|
|
3044
|
+
en(20, void 0, { leading: !1, trailing: !0 }),
|
|
3045
|
+
De(i),
|
|
3046
|
+
tn(i())
|
|
3047
|
+
// must trigger once
|
|
3048
|
+
);
|
|
3049
|
+
}),
|
|
3050
|
+
gi(this.dispose$)
|
|
3051
|
+
).subscribe((t) => {
|
|
3052
|
+
this._disposeRendering(), !(!t || !t.range) && (this._renderRange(t.unitId, t.range, t.skeleton), this._renderButtons(t));
|
|
3053
|
+
});
|
|
3054
|
+
}
|
|
3055
|
+
_renderRange(t, r, n) {
|
|
3056
|
+
const o = this._renderManagerService.getRenderById(t);
|
|
3057
|
+
if (!o)
|
|
3058
|
+
return;
|
|
3059
|
+
const { scene: a } = o, { rangeWithCoord: i, style: s } = this._selectionRenderService.convertSelectionRangeToData({
|
|
3060
|
+
range: r,
|
|
3061
|
+
primary: null,
|
|
3062
|
+
style: null
|
|
3063
|
+
}), { rowHeaderWidth: l, columnHeaderHeight: u } = n, c = this._filterRangeShape = new bi(a, na, !0, this._themeService);
|
|
3064
|
+
c.update(i, l, u, {
|
|
3065
|
+
hasAutoFill: !1,
|
|
3066
|
+
fill: "rgba(0, 0, 0, 0.0)",
|
|
3067
|
+
...s
|
|
3068
|
+
}), c.setEvent(!1), a.makeDirty(!0);
|
|
3069
|
+
}
|
|
3070
|
+
_renderButtons(t) {
|
|
3071
|
+
const { range: r, filterModel: n, unitId: o, skeleton: a, worksheetId: i } = t, s = this._renderManagerService.getRenderById(o);
|
|
3072
|
+
if (!s)
|
|
3073
|
+
return;
|
|
3074
|
+
const { scene: l } = s;
|
|
3075
|
+
this._interceptCellContent(t.range);
|
|
3076
|
+
const { startColumn: u, endColumn: c, startRow: f } = r;
|
|
3077
|
+
for (let d = u; d <= c; d++) {
|
|
3078
|
+
const h = `sheets-filter-button-${d}`, g = Ti(f, d, l, a), { startX: _, startY: p, endX: S, endY: T } = g, I = S - _, F = T - p;
|
|
3079
|
+
if (F <= lt || I <= lt)
|
|
3080
|
+
continue;
|
|
3081
|
+
const H = !!n.getFilterColumn(d), M = S - ve - lt, O = T - ve - lt, L = {
|
|
3082
|
+
left: M,
|
|
3083
|
+
top: O,
|
|
3084
|
+
height: ve,
|
|
3085
|
+
width: ve,
|
|
3086
|
+
cellHeight: F,
|
|
3087
|
+
cellWidth: I,
|
|
3088
|
+
filterParams: { unitId: o, subUnitId: i, col: d, hasCriteria: H }
|
|
3089
|
+
}, U = this._injector.createInstance(er, h, L);
|
|
3090
|
+
this._filterButtonShapes.push(U);
|
|
3091
|
+
}
|
|
3092
|
+
l.addObjects(this._filterButtonShapes, ia), l.makeDirty();
|
|
3093
|
+
}
|
|
3094
|
+
_interceptCellContent(t) {
|
|
3095
|
+
const { startRow: r, startColumn: n, endColumn: o } = t;
|
|
3096
|
+
this._buttonRenderDisposable = this._sheetInterceptorService.intercept(Mi.CELL_CONTENT, {
|
|
3097
|
+
handler: (a, i, s) => {
|
|
3098
|
+
const { row: l, col: u } = i;
|
|
3099
|
+
return l !== r || u < n || u > o ? s(a) : s({
|
|
3100
|
+
...a,
|
|
3101
|
+
// @ts-ignore
|
|
3102
|
+
fontRenderExtension: {
|
|
3103
|
+
// @ts-ignore
|
|
3104
|
+
...a == null ? void 0 : a.fontRenderExtension,
|
|
3105
|
+
rightOffset: ve
|
|
3106
|
+
}
|
|
3107
|
+
});
|
|
3108
|
+
}
|
|
3109
|
+
});
|
|
3110
|
+
}
|
|
3111
|
+
_disposeRendering() {
|
|
3112
|
+
var t, r;
|
|
3113
|
+
(t = this._filterRangeShape) == null || t.dispose(), this._filterButtonShapes.forEach((n) => n.dispose()), (r = this._buttonRenderDisposable) == null || r.dispose(), this._filterRangeShape = null, this._buttonRenderDisposable = null, this._filterButtonShapes = [];
|
|
3114
|
+
}
|
|
3115
|
+
};
|
|
3116
|
+
vt = ra([
|
|
3117
|
+
Xr(Kr.Ready, vt),
|
|
3118
|
+
fe(0, G(Ot)),
|
|
3119
|
+
fe(1, G(Ri)),
|
|
3120
|
+
fe(2, G(he)),
|
|
3121
|
+
fe(3, G(Zr)),
|
|
3122
|
+
fe(4, G(Li)),
|
|
3123
|
+
fe(5, G(Oi)),
|
|
3124
|
+
fe(6, ce),
|
|
3125
|
+
fe(7, Tt),
|
|
3126
|
+
fe(8, xi),
|
|
3127
|
+
fe(9, Fi)
|
|
3128
|
+
], vt);
|
|
3129
|
+
var oa = Object.defineProperty, sa = Object.getOwnPropertyDescriptor, aa = (e, t, r, n) => {
|
|
3130
|
+
for (var o = n > 1 ? void 0 : n ? sa(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
3131
|
+
(i = e[a]) && (o = (n ? i(t, r, o) : i(o)) || o);
|
|
3132
|
+
return n && o && oa(t, r, o), o;
|
|
3133
|
+
}, Gr = (e, t) => (r, n) => t(r, n, e);
|
|
3134
|
+
const la = "UNIVER_SHEETS_FILTER_UI_PLUGIN";
|
|
3135
|
+
var ut;
|
|
3136
|
+
let Yr = (ut = class extends ti {
|
|
3137
|
+
constructor(e, t, r) {
|
|
3138
|
+
super(), this._injector = t, this._localeService = r, this._localeService.load({
|
|
3139
|
+
zhCN: Wi
|
|
3140
|
+
});
|
|
3141
|
+
}
|
|
3142
|
+
onStarting(e) {
|
|
3143
|
+
[
|
|
3144
|
+
[be],
|
|
3145
|
+
[mt],
|
|
3146
|
+
[vt]
|
|
3147
|
+
].forEach((t) => e.add(t));
|
|
3148
|
+
}
|
|
3149
|
+
}, C(ut, "type", tt.UNIVER_SHEET), C(ut, "pluginName", la), ut);
|
|
3150
|
+
Yr = aa([
|
|
3151
|
+
Gr(1, G(Ot)),
|
|
3152
|
+
Gr(2, G(We))
|
|
3153
|
+
], Yr);
|
|
3154
|
+
export {
|
|
3155
|
+
Yr as UniverSheetsFilterUIPlugin,
|
|
3156
|
+
ba as enUS,
|
|
3157
|
+
Wi as zhCN
|
|
3158
|
+
};
|