@ishibashi0112/spreadsheet-grid 1.2.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API_REFERENCE.md +74 -28
- package/README.md +6 -6
- package/dist/CellEditorLayer.d.ts +2 -1
- package/dist/ColumnFilterPopover-BkvL8LdP.js +1062 -0
- package/dist/ColumnFilterPopover-cNVxOkoI.cjs +1 -0
- package/dist/editors/CustomCellEditor.d.ts +3 -2
- package/dist/editors/DateCellEditor.d.ts +2 -1
- package/dist/editors/NumberCellEditor.d.ts +2 -1
- package/dist/editors/SelectCellEditor.d.ts +5 -2
- package/dist/editors/TextCellEditor.d.ts +2 -1
- package/dist/hooks/useGridEditController.d.ts +1 -0
- package/dist/hooks/useGridTooltip.d.ts +3 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +2758 -2790
- package/dist/lite/ColumnFilterPopover-BXsxUZ-l.cjs +1 -0
- package/dist/lite/ColumnFilterPopover-DGBKLT_x.js +1063 -0
- package/dist/lite/contextMenu-C_EUynb4.cjs +1 -0
- package/dist/lite/contextMenu-Cb9KT0FS.js +109 -0
- package/dist/lite/createSpreadsheetGrid-CJinhQgY.js +4353 -0
- package/dist/lite/createSpreadsheetGrid-CQDpzjaZ.cjs +6 -0
- package/dist/lite/createSpreadsheetGrid.cjs +1 -1
- package/dist/lite/createSpreadsheetGrid.js +1 -1
- package/dist/lite/features/contextMenu.cjs +1 -1
- package/dist/lite/features/contextMenu.js +1 -1
- package/dist/lite/features/fillHandle.cjs +1 -1
- package/dist/lite/features/fillHandle.js +1 -1
- package/dist/lite/features/filtering.cjs +1 -1
- package/dist/lite/features/filtering.js +1 -1
- package/dist/lite/features/rowDrag.cjs +1 -1
- package/dist/lite/features/rowDrag.js +1 -1
- package/dist/lite/features/standard.cjs +1 -1
- package/dist/lite/features/standard.js +2 -2
- package/dist/lite/features/toolPanel.cjs +1 -1
- package/dist/lite/features/toolPanel.js +1 -1
- package/dist/lite/fillHandle-4pow6QTn.cjs +1 -0
- package/dist/lite/{fillHandle-CzA_uxgV.js → fillHandle-pS7c7vQ2.js} +30 -29
- package/dist/lite/{filtering-ReroATyh.js → filtering-BGPDN-wq.js} +2 -2
- package/dist/lite/{filtering-DDIQnB3a.cjs → filtering-BKaFSWIN.cjs} +1 -1
- package/dist/lite/{lazyPopups-C7Y7Kx8w.js → lazyPopups-CeNdPYJh.js} +1 -1
- package/dist/lite/{lazyPopups-B0DhlAYW.cjs → lazyPopups-Czv43vuQ.cjs} +1 -1
- package/dist/lite/rowDrag-Bb1xlVXa.cjs +1 -0
- package/dist/lite/rowDrag-Dvg4JlGR.js +115 -0
- package/dist/lite/{toolPanel-H94h6g2U.cjs → toolPanel-BVq7WR1O.cjs} +1 -1
- package/dist/lite/{toolPanel-DXG3w8Zp.js → toolPanel-CsBenuFQ.js} +1 -1
- package/dist/lite/toolPanelViews-8HccPGgN.cjs +1 -0
- package/dist/lite/{toolPanelViews-DwUa6rm1.js → toolPanelViews-uCxtFwWO.js} +139 -138
- package/dist/lite.cjs +1 -1
- package/dist/lite.js +7 -7
- package/dist/style.css +1 -1
- package/dist/style.layer.css +1 -1
- package/dist/toolPanelViews-BJi7W0Tz.cjs +1 -0
- package/dist/{toolPanelViews-DCpqVIEd.js → toolPanelViews-Dsp5WVVa.js} +139 -138
- package/dist/view/DetailToggleButton.d.ts +2 -1
- package/package.json +2 -2
- package/skills/spreadsheet-grid/SKILL.md +2 -2
- package/dist/ColumnFilterPopover-BEZ0T7Qo.cjs +0 -1
- package/dist/ColumnFilterPopover-CnocXZZn.js +0 -1056
- package/dist/lite/ColumnFilterPopover-BUCdIETo.cjs +0 -1
- package/dist/lite/ColumnFilterPopover-ulqfKfmD.js +0 -1056
- package/dist/lite/contextMenu-B6cpSlFr.js +0 -168
- package/dist/lite/contextMenu-VLz_wVlY.cjs +0 -1
- package/dist/lite/createSpreadsheetGrid-BxaYty_c.js +0 -4290
- package/dist/lite/createSpreadsheetGrid-CfUnI6Xl.cjs +0 -6
- package/dist/lite/fillHandle-CHJESnrk.cjs +0 -1
- package/dist/lite/rowDrag-D17wXvSj.cjs +0 -1
- package/dist/lite/rowDrag-WVJUKKL8.js +0 -157
- package/dist/lite/toolPanelViews-C4qswcP_.cjs +0 -1
- package/dist/toolPanelViews-CKKThiAQ.cjs +0 -1
|
@@ -1,1056 +0,0 @@
|
|
|
1
|
-
import { c as e, s as t } from "./useGridLocaleText-Drud4qg0.js";
|
|
2
|
-
import { t as n } from "./useVirtualizerCore-C1k6Aw8p.js";
|
|
3
|
-
import { t as r } from "./usePopupLocaleText-DJN10Asc.js";
|
|
4
|
-
import { useDeferredValue as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
5
|
-
import { cx as l } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/cx";
|
|
6
|
-
import { createPortal as u } from "react-dom";
|
|
7
|
-
import { isEscapePreventedInside as d } from "@ishibashi0112/spreadsheet-grid-core/internal/controllers/escapeClaimController";
|
|
8
|
-
import { isImeComposingKeyEvent as f } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/domGuards";
|
|
9
|
-
import { formatLocaleText as p } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeText";
|
|
10
|
-
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
11
|
-
import { toDateKey as _ } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/filtering";
|
|
12
|
-
import { normalizeDateFilterPresets as v } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/dateFilterPresets";
|
|
13
|
-
import { DEFAULT_FILTER_LOCALE_TEXT as y } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/localeTextFilters";
|
|
14
|
-
import { resolveFocusWrapTarget as b } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/focusCycle";
|
|
15
|
-
import { filterSetOptionsBySearch as x, resolveSetFilterEnterAction as S } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/setFilterSearch";
|
|
16
|
-
import { isSetValueSelected as C } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/setFilterSelection";
|
|
17
|
-
import { DEFAULT_NUMBER_FILTER_DRAFT as w, NUMBER_FILTER_OPERATOR_OPTIONS as T, buildParsedNumberFilterFromDraft as E, filterOptionsByNumberCondition as D, numberFilterOperandCount as O } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/numberFilterCondition";
|
|
18
|
-
import { DEFAULT_TEXT_FILTER_DRAFT as k, TEXT_FILTER_OPERATOR_OPTIONS as A, buildParsedTextFilterFromDraft as j, filterOptionsByTextCondition as M, textFilterOperandCount as N } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/textFilterCondition";
|
|
19
|
-
import { DATE_FILTER_OPERATOR_OPTIONS as P, DEFAULT_DATE_FILTER_DRAFT as F, buildParsedDateFilterFromDraft as I, dateFilterOperandCount as L, filterOptionsByDateCondition as R, normalizeFilterDateInputValue as z } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/dateFilterCondition";
|
|
20
|
-
import { buildCalendarDayCells as B, buildYearGrid as ee, formatFilterDateDisplay as V, yearGridStart as H } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/datePickerCalendar";
|
|
21
|
-
import { buildDateTreeRows as U } from "@ishibashi0112/spreadsheet-grid-core/internal/logic/dateFilterTree";
|
|
22
|
-
//#region src/view/FilterDateField.tsx
|
|
23
|
-
function W({ value: e, onCommit: t, ariaLabel: n, inputRef: i, onRequestClose: o, align: u = "left" }) {
|
|
24
|
-
let d = r(), [v, y] = c(null), [b, x] = c(!1), [S, C] = c(!1), [w, T] = c("days"), [E, D] = c(() => (/* @__PURE__ */ new Date()).getFullYear()), [O, k] = c(() => (/* @__PURE__ */ new Date()).getMonth()), A = s(null), j = v ?? V(e), M = _(/* @__PURE__ */ new Date()) ?? "", N = () => {
|
|
25
|
-
if (v === null) return;
|
|
26
|
-
let e = v.trim();
|
|
27
|
-
if (e === "") {
|
|
28
|
-
t(""), y(null), x(!1);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
let n = _(e);
|
|
32
|
-
if (n === null) {
|
|
33
|
-
x(!0);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
t(n), y(null), x(!1);
|
|
37
|
-
}, P = () => {
|
|
38
|
-
let [t, n] = (e === "" ? M : e).split("-");
|
|
39
|
-
D(Number(t)), k(Number(n) - 1), T("days"), C(!0);
|
|
40
|
-
}, F = () => {
|
|
41
|
-
C(!1);
|
|
42
|
-
}, I = (e) => {
|
|
43
|
-
t(e), y(null), x(!1), F();
|
|
44
|
-
};
|
|
45
|
-
a(() => {
|
|
46
|
-
if (!S) return;
|
|
47
|
-
let e = (e) => {
|
|
48
|
-
let t = e.target;
|
|
49
|
-
t && A.current?.contains(t) || C(!1);
|
|
50
|
-
};
|
|
51
|
-
return document.addEventListener("pointerdown", e, !0), () => {
|
|
52
|
-
document.removeEventListener("pointerdown", e, !0);
|
|
53
|
-
};
|
|
54
|
-
}, [S]);
|
|
55
|
-
let L = (e) => {
|
|
56
|
-
if (e.stopPropagation(), e.key === "Enter") {
|
|
57
|
-
if (f(e.nativeEvent)) return;
|
|
58
|
-
e.preventDefault(), N(), F();
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (e.key === "Escape") {
|
|
62
|
-
if (e.preventDefault(), S) {
|
|
63
|
-
F();
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
o();
|
|
67
|
-
}
|
|
68
|
-
}, R = (e) => ({
|
|
69
|
-
onPointerDown: (t) => {
|
|
70
|
-
t.preventDefault(), t.stopPropagation(), e();
|
|
71
|
-
},
|
|
72
|
-
onKeyDown: (t) => {
|
|
73
|
-
if (t.stopPropagation(), t.key === "Enter" || t.key === " ") {
|
|
74
|
-
t.preventDefault(), e();
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (t.key === "Escape") {
|
|
78
|
-
if (t.preventDefault(), S) {
|
|
79
|
-
F(), t.currentTarget.closest(".ssg-dp-root")?.querySelector(".ssg-dp-input")?.focus();
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
o();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}), z = (e) => {
|
|
86
|
-
if (w === "days") {
|
|
87
|
-
let t = new Date(E, O + e, 1);
|
|
88
|
-
D(t.getFullYear()), k(t.getMonth());
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
if (w === "months") {
|
|
92
|
-
D((t) => t + e);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
D((t) => t + e * 12);
|
|
96
|
-
}, U = () => {
|
|
97
|
-
T((e) => e === "days" ? "months" : "years");
|
|
98
|
-
}, W = () => {
|
|
99
|
-
T((e) => e === "years" ? "months" : "days");
|
|
100
|
-
}, G = w === "days" ? p(d.calendarTitle, {
|
|
101
|
-
year: E,
|
|
102
|
-
month: O + 1
|
|
103
|
-
}) : w === "months" ? p(d.calendarYear, { year: E }) : `${H(E)} – ${H(E) + 11}`;
|
|
104
|
-
return /* @__PURE__ */ g("div", {
|
|
105
|
-
ref: A,
|
|
106
|
-
className: "ssg-dp-root",
|
|
107
|
-
children: [/* @__PURE__ */ g("div", {
|
|
108
|
-
className: l("ssg-dp-field", S && "ssg-dp-field--open", b && "ssg-dp-field--invalid"),
|
|
109
|
-
children: [/* @__PURE__ */ h("input", {
|
|
110
|
-
ref: i,
|
|
111
|
-
type: "text",
|
|
112
|
-
inputMode: "numeric",
|
|
113
|
-
value: j,
|
|
114
|
-
placeholder: "yyyy/mm/dd",
|
|
115
|
-
"aria-label": n,
|
|
116
|
-
"aria-invalid": b || void 0,
|
|
117
|
-
className: "ssg-dp-input",
|
|
118
|
-
onChange: (e) => {
|
|
119
|
-
y(e.target.value), x(!1);
|
|
120
|
-
},
|
|
121
|
-
onKeyDown: L,
|
|
122
|
-
onBlur: N
|
|
123
|
-
}), /* @__PURE__ */ h("button", {
|
|
124
|
-
type: "button",
|
|
125
|
-
className: "ssg-dp-cal-btn",
|
|
126
|
-
"aria-label": S ? d.calendarClose : d.calendarOpen,
|
|
127
|
-
...R(() => {
|
|
128
|
-
S ? F() : P();
|
|
129
|
-
}),
|
|
130
|
-
children: /* @__PURE__ */ g("svg", {
|
|
131
|
-
width: "12",
|
|
132
|
-
height: "12",
|
|
133
|
-
viewBox: "0 0 16 16",
|
|
134
|
-
"aria-hidden": "true",
|
|
135
|
-
children: [
|
|
136
|
-
/* @__PURE__ */ h("rect", {
|
|
137
|
-
x: "1.5",
|
|
138
|
-
y: "2.5",
|
|
139
|
-
width: "13",
|
|
140
|
-
height: "12",
|
|
141
|
-
rx: "1.5",
|
|
142
|
-
fill: "none",
|
|
143
|
-
stroke: "currentColor"
|
|
144
|
-
}),
|
|
145
|
-
/* @__PURE__ */ h("line", {
|
|
146
|
-
x1: "1.5",
|
|
147
|
-
y1: "6",
|
|
148
|
-
x2: "14.5",
|
|
149
|
-
y2: "6",
|
|
150
|
-
stroke: "currentColor"
|
|
151
|
-
}),
|
|
152
|
-
/* @__PURE__ */ h("line", {
|
|
153
|
-
x1: "5",
|
|
154
|
-
y1: "1",
|
|
155
|
-
x2: "5",
|
|
156
|
-
y2: "4",
|
|
157
|
-
stroke: "currentColor"
|
|
158
|
-
}),
|
|
159
|
-
/* @__PURE__ */ h("line", {
|
|
160
|
-
x1: "11",
|
|
161
|
-
y1: "1",
|
|
162
|
-
x2: "11",
|
|
163
|
-
y2: "4",
|
|
164
|
-
stroke: "currentColor"
|
|
165
|
-
})
|
|
166
|
-
]
|
|
167
|
-
})
|
|
168
|
-
})]
|
|
169
|
-
}), S && /* @__PURE__ */ g("div", {
|
|
170
|
-
className: l("ssg-dp-panel", u === "right" && "ssg-dp-panel--right"),
|
|
171
|
-
children: [
|
|
172
|
-
/* @__PURE__ */ g("div", {
|
|
173
|
-
className: "ssg-dp-nav",
|
|
174
|
-
children: [
|
|
175
|
-
/* @__PURE__ */ h("button", {
|
|
176
|
-
type: "button",
|
|
177
|
-
className: "ssg-dp-nav-btn",
|
|
178
|
-
"aria-label": d.calendarPrevious,
|
|
179
|
-
...R(() => z(-1)),
|
|
180
|
-
children: "‹"
|
|
181
|
-
}),
|
|
182
|
-
/* @__PURE__ */ h("button", {
|
|
183
|
-
type: "button",
|
|
184
|
-
className: "ssg-dp-nav-title",
|
|
185
|
-
disabled: w === "years",
|
|
186
|
-
"aria-label": d.calendarChangeView,
|
|
187
|
-
...R(U),
|
|
188
|
-
children: G
|
|
189
|
-
}),
|
|
190
|
-
/* @__PURE__ */ h("button", {
|
|
191
|
-
type: "button",
|
|
192
|
-
className: "ssg-dp-nav-btn",
|
|
193
|
-
"aria-label": d.calendarNext,
|
|
194
|
-
...R(() => z(1)),
|
|
195
|
-
children: "›"
|
|
196
|
-
})
|
|
197
|
-
]
|
|
198
|
-
}),
|
|
199
|
-
w === "days" && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
|
|
200
|
-
className: "ssg-dp-dow",
|
|
201
|
-
children: d.calendarWeekdays.map((e, t) => /* @__PURE__ */ h("span", {
|
|
202
|
-
className: l(t === 0 && "ssg-dp-dow--sun", t === 6 && "ssg-dp-dow--sat"),
|
|
203
|
-
children: e
|
|
204
|
-
}, t))
|
|
205
|
-
}), /* @__PURE__ */ h("div", {
|
|
206
|
-
className: "ssg-dp-days",
|
|
207
|
-
children: B(E, O).map((t) => /* @__PURE__ */ h("button", {
|
|
208
|
-
type: "button",
|
|
209
|
-
className: l("ssg-dp-day", !t.inCurrentMonth && "ssg-dp-day--out", t.key === M && "ssg-dp-day--today", t.key === e && "ssg-dp-day--selected"),
|
|
210
|
-
"aria-label": t.key,
|
|
211
|
-
...R(() => I(t.key)),
|
|
212
|
-
children: t.day
|
|
213
|
-
}, t.key))
|
|
214
|
-
})] }),
|
|
215
|
-
w === "months" && /* @__PURE__ */ h("div", {
|
|
216
|
-
className: "ssg-dp-grid",
|
|
217
|
-
children: d.calendarMonths.map((e, t) => /* @__PURE__ */ h("button", {
|
|
218
|
-
type: "button",
|
|
219
|
-
className: l("ssg-dp-cell", t === O && "ssg-dp-cell--selected"),
|
|
220
|
-
...R(() => {
|
|
221
|
-
k(t), T("days");
|
|
222
|
-
}),
|
|
223
|
-
children: e
|
|
224
|
-
}, t))
|
|
225
|
-
}),
|
|
226
|
-
w === "years" && /* @__PURE__ */ h("div", {
|
|
227
|
-
className: "ssg-dp-grid",
|
|
228
|
-
children: ee(E).map((e) => /* @__PURE__ */ h("button", {
|
|
229
|
-
type: "button",
|
|
230
|
-
className: l("ssg-dp-cell", e === E && "ssg-dp-cell--selected"),
|
|
231
|
-
...R(() => {
|
|
232
|
-
D(e), T("months");
|
|
233
|
-
}),
|
|
234
|
-
children: e
|
|
235
|
-
}, e))
|
|
236
|
-
}),
|
|
237
|
-
/* @__PURE__ */ g("div", {
|
|
238
|
-
className: "ssg-dp-foot",
|
|
239
|
-
children: [
|
|
240
|
-
w !== "days" && /* @__PURE__ */ h("button", {
|
|
241
|
-
type: "button",
|
|
242
|
-
className: "ssg-dp-foot-btn",
|
|
243
|
-
...R(W),
|
|
244
|
-
children: d.calendarBack
|
|
245
|
-
}),
|
|
246
|
-
/* @__PURE__ */ h("button", {
|
|
247
|
-
type: "button",
|
|
248
|
-
className: "ssg-dp-foot-btn",
|
|
249
|
-
...R(() => I(M)),
|
|
250
|
-
children: d.calendarToday
|
|
251
|
-
}),
|
|
252
|
-
/* @__PURE__ */ h("button", {
|
|
253
|
-
type: "button",
|
|
254
|
-
className: "ssg-dp-foot-btn ssg-dp-foot-btn--muted",
|
|
255
|
-
...R(() => I("")),
|
|
256
|
-
children: d.clear
|
|
257
|
-
})
|
|
258
|
-
]
|
|
259
|
-
})
|
|
260
|
-
]
|
|
261
|
-
})]
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
//#endregion
|
|
265
|
-
//#region src/view/ColumnFilterPopover.tsx
|
|
266
|
-
var G = 24, te = 40, ne = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches ? te : G, K = (e, t, n) => e === "" && t === y.blank ? n : t, q = (e, t) => t === y.blank ? e : e.map((e) => e.value === "" && e.label === y.blank ? {
|
|
267
|
-
...e,
|
|
268
|
-
label: t
|
|
269
|
-
} : e);
|
|
270
|
-
function re({ options: e, setSelection: t, searchInputRef: a, onValueToggle: l, onSelectAllChange: u, onReplaceSelection: d, onRequestClose: _, isServerSide: v, selectAllUsesExplicitScope: y = !1, truncated: b = !1 }) {
|
|
271
|
-
let w = r(), [T, E] = c(""), D = i(T), O = o(() => q(e, w.blank), [e, w.blank]), k = o(() => x(O, D), [O, D]), A = D.trim().length > 0, j = s(null), [M] = c(ne), N = n({
|
|
272
|
-
count: k.length,
|
|
273
|
-
getScrollElement: () => j.current,
|
|
274
|
-
estimateSize: () => M,
|
|
275
|
-
overscan: 10
|
|
276
|
-
}), P = o(() => {
|
|
277
|
-
if (t === null) return k.length;
|
|
278
|
-
let e = 0;
|
|
279
|
-
for (let n of k) C(t, n.value) && (e += 1);
|
|
280
|
-
return e;
|
|
281
|
-
}, [t, k]), F = k.length > 0 && P === k.length, I = P > 0 && !F, L = o(() => new Set(e.map((e) => e.value)), [e]), R = o(() => {
|
|
282
|
-
if (t === null) return e.length;
|
|
283
|
-
let n = 0;
|
|
284
|
-
for (let e of t.values) L.has(e) && (n += 1);
|
|
285
|
-
return t.mode === "include" ? n : e.length - n;
|
|
286
|
-
}, [
|
|
287
|
-
t,
|
|
288
|
-
L,
|
|
289
|
-
e.length
|
|
290
|
-
]);
|
|
291
|
-
return /* @__PURE__ */ g(m, { children: [
|
|
292
|
-
/* @__PURE__ */ h("input", {
|
|
293
|
-
ref: a,
|
|
294
|
-
type: "text",
|
|
295
|
-
value: T,
|
|
296
|
-
onChange: (e) => E(e.target.value),
|
|
297
|
-
onKeyDown: (e) => {
|
|
298
|
-
if (e.stopPropagation(), e.key === "Escape" && (e.preventDefault(), _()), e.key === "Enter") {
|
|
299
|
-
if (f(e.nativeEvent)) return;
|
|
300
|
-
e.preventDefault();
|
|
301
|
-
let t = S(O, T);
|
|
302
|
-
if (t.kind === "none") return;
|
|
303
|
-
t.kind === "replace" && d(t.values), _();
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
|
-
placeholder: w.filterSearchPlaceholder,
|
|
307
|
-
"aria-label": w.filterSearchPlaceholder,
|
|
308
|
-
className: "ssg-filter-input"
|
|
309
|
-
}),
|
|
310
|
-
/* @__PURE__ */ g("label", {
|
|
311
|
-
className: "ssg-filter-selectall",
|
|
312
|
-
children: [/* @__PURE__ */ h("input", {
|
|
313
|
-
type: "checkbox",
|
|
314
|
-
checked: F,
|
|
315
|
-
ref: (e) => {
|
|
316
|
-
e && (e.indeterminate = I);
|
|
317
|
-
},
|
|
318
|
-
onChange: () => {
|
|
319
|
-
u(A || y ? k.map((e) => e.value) : "all", !F);
|
|
320
|
-
}
|
|
321
|
-
}), /* @__PURE__ */ h("span", {
|
|
322
|
-
className: "ssg-filter-selectall-label",
|
|
323
|
-
children: A ? w.filterSelectAllResults : w.filterSelectAll
|
|
324
|
-
})]
|
|
325
|
-
}),
|
|
326
|
-
/* @__PURE__ */ h("div", {
|
|
327
|
-
ref: j,
|
|
328
|
-
className: "ssg-filter-list",
|
|
329
|
-
children: k.length === 0 ? /* @__PURE__ */ h("div", {
|
|
330
|
-
className: "ssg-filter-empty",
|
|
331
|
-
children: e.length === 0 ? v ? w.filterNoOptionsSource : w.noOptions : w.filterNoMatches
|
|
332
|
-
}) : /* @__PURE__ */ h("div", {
|
|
333
|
-
className: "ssg-filter-virt",
|
|
334
|
-
style: { height: N.getTotalSize() },
|
|
335
|
-
children: N.getVirtualItems().map((e) => {
|
|
336
|
-
let n = k[e.index];
|
|
337
|
-
if (!n) return null;
|
|
338
|
-
let r = C(t, n.value);
|
|
339
|
-
return /* @__PURE__ */ g("label", {
|
|
340
|
-
className: "ssg-filter-option",
|
|
341
|
-
style: {
|
|
342
|
-
transform: `translateY(${e.start}px)`,
|
|
343
|
-
height: e.size
|
|
344
|
-
},
|
|
345
|
-
children: [/* @__PURE__ */ h("input", {
|
|
346
|
-
type: "checkbox",
|
|
347
|
-
checked: r,
|
|
348
|
-
onChange: () => l(n.value)
|
|
349
|
-
}), /* @__PURE__ */ h("span", {
|
|
350
|
-
className: "ssg-filter-option-label",
|
|
351
|
-
children: K(n.value, n.label, w.blank)
|
|
352
|
-
})]
|
|
353
|
-
}, n.value);
|
|
354
|
-
})
|
|
355
|
-
})
|
|
356
|
-
}),
|
|
357
|
-
/* @__PURE__ */ g("div", {
|
|
358
|
-
className: "ssg-filter-meta",
|
|
359
|
-
children: [
|
|
360
|
-
p(w.filterSelectedCount, {
|
|
361
|
-
selected: R,
|
|
362
|
-
total: e.length
|
|
363
|
-
}),
|
|
364
|
-
A ? p(w.filterShownCount, { count: k.length }) : "",
|
|
365
|
-
b && /* @__PURE__ */ h(ue, {})
|
|
366
|
-
]
|
|
367
|
-
})
|
|
368
|
-
] });
|
|
369
|
-
}
|
|
370
|
-
var J = (e) => {
|
|
371
|
-
e.key !== "Escape" && e.stopPropagation();
|
|
372
|
-
}, ie = (e) => e.nativeEvent.isComposing === !0, Y = (e, t, n) => {
|
|
373
|
-
if (ie(n)) {
|
|
374
|
-
e(t, { commit: !1 });
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
e(t);
|
|
378
|
-
};
|
|
379
|
-
function ae({ draft: e, valueInputRef: t, onDraftChange: n, onKeyDown: i }) {
|
|
380
|
-
let a = r(), o = O(e.operator);
|
|
381
|
-
return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("select", {
|
|
382
|
-
value: e.operator,
|
|
383
|
-
onChange: (t) => n({
|
|
384
|
-
...e,
|
|
385
|
-
operator: t.target.value
|
|
386
|
-
}),
|
|
387
|
-
onKeyDown: i,
|
|
388
|
-
className: "ssg-filter-select",
|
|
389
|
-
"aria-label": a.filterOperator,
|
|
390
|
-
children: T.map((e) => /* @__PURE__ */ h("option", {
|
|
391
|
-
value: e.value,
|
|
392
|
-
children: a[e.labelKey]
|
|
393
|
-
}, e.value))
|
|
394
|
-
}), o > 0 ? /* @__PURE__ */ g("div", {
|
|
395
|
-
className: "ssg-filter-cond-values",
|
|
396
|
-
children: [/* @__PURE__ */ h("input", {
|
|
397
|
-
ref: t,
|
|
398
|
-
type: "text",
|
|
399
|
-
inputMode: "decimal",
|
|
400
|
-
value: e.value1,
|
|
401
|
-
onChange: (t) => Y(n, {
|
|
402
|
-
...e,
|
|
403
|
-
value1: t.target.value
|
|
404
|
-
}, t),
|
|
405
|
-
onCompositionEnd: (t) => n({
|
|
406
|
-
...e,
|
|
407
|
-
value1: t.currentTarget.value
|
|
408
|
-
}),
|
|
409
|
-
onKeyDown: i,
|
|
410
|
-
placeholder: o === 2 ? a.filterMin : a.filterValuePlaceholder,
|
|
411
|
-
className: "ssg-filter-input",
|
|
412
|
-
"aria-label": o === 2 ? a.filterMin : a.filterValue
|
|
413
|
-
}), o === 2 && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
|
|
414
|
-
className: "ssg-filter-cond-tilde",
|
|
415
|
-
children: a.filterRangeSeparator
|
|
416
|
-
}), /* @__PURE__ */ h("input", {
|
|
417
|
-
type: "text",
|
|
418
|
-
inputMode: "decimal",
|
|
419
|
-
value: e.value2,
|
|
420
|
-
onChange: (t) => Y(n, {
|
|
421
|
-
...e,
|
|
422
|
-
value2: t.target.value
|
|
423
|
-
}, t),
|
|
424
|
-
onCompositionEnd: (t) => n({
|
|
425
|
-
...e,
|
|
426
|
-
value2: t.currentTarget.value
|
|
427
|
-
}),
|
|
428
|
-
onKeyDown: i,
|
|
429
|
-
placeholder: a.filterMax,
|
|
430
|
-
className: "ssg-filter-input",
|
|
431
|
-
"aria-label": a.filterMax
|
|
432
|
-
})] })]
|
|
433
|
-
}) : /* @__PURE__ */ h("div", {
|
|
434
|
-
className: "ssg-filter-meta",
|
|
435
|
-
children: a.filterNoValue
|
|
436
|
-
})] });
|
|
437
|
-
}
|
|
438
|
-
function oe({ draft: e, valueInputRef: t, onDraftChange: n, onKeyDown: i }) {
|
|
439
|
-
let a = r(), o = N(e.operator);
|
|
440
|
-
return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("select", {
|
|
441
|
-
value: e.operator,
|
|
442
|
-
onChange: (t) => n({
|
|
443
|
-
...e,
|
|
444
|
-
operator: t.target.value
|
|
445
|
-
}),
|
|
446
|
-
onKeyDown: i,
|
|
447
|
-
className: "ssg-filter-select",
|
|
448
|
-
"aria-label": a.filterOperator,
|
|
449
|
-
children: A.map((e) => /* @__PURE__ */ h("option", {
|
|
450
|
-
value: e.value,
|
|
451
|
-
children: a[e.labelKey]
|
|
452
|
-
}, e.value))
|
|
453
|
-
}), o > 0 ? /* @__PURE__ */ h("div", {
|
|
454
|
-
className: "ssg-filter-cond-values",
|
|
455
|
-
children: /* @__PURE__ */ h("input", {
|
|
456
|
-
ref: t,
|
|
457
|
-
type: "text",
|
|
458
|
-
value: e.value,
|
|
459
|
-
onChange: (t) => Y(n, {
|
|
460
|
-
...e,
|
|
461
|
-
value: t.target.value
|
|
462
|
-
}, t),
|
|
463
|
-
onCompositionEnd: (t) => n({
|
|
464
|
-
...e,
|
|
465
|
-
value: t.currentTarget.value
|
|
466
|
-
}),
|
|
467
|
-
onKeyDown: i,
|
|
468
|
-
placeholder: a.filterValuePlaceholder,
|
|
469
|
-
className: "ssg-filter-input",
|
|
470
|
-
"aria-label": a.filterValue
|
|
471
|
-
})
|
|
472
|
-
}) : /* @__PURE__ */ h("div", {
|
|
473
|
-
className: "ssg-filter-meta",
|
|
474
|
-
children: a.filterNoValue
|
|
475
|
-
})] });
|
|
476
|
-
}
|
|
477
|
-
function se({ draft: e, valueInputRef: t, onDraftChange: n, onKeyDown: i, presets: a, renderDateInput: o, onRequestClose: s }) {
|
|
478
|
-
let c = r(), u = e.preset === null ? L(e.operator) : 0, d = (t, r) => {
|
|
479
|
-
n({
|
|
480
|
-
...e,
|
|
481
|
-
[t]: z(r),
|
|
482
|
-
preset: null
|
|
483
|
-
});
|
|
484
|
-
};
|
|
485
|
-
return /* @__PURE__ */ g(m, { children: [
|
|
486
|
-
/* @__PURE__ */ h("select", {
|
|
487
|
-
value: e.operator,
|
|
488
|
-
onChange: (t) => n({
|
|
489
|
-
...e,
|
|
490
|
-
operator: t.target.value,
|
|
491
|
-
preset: null
|
|
492
|
-
}),
|
|
493
|
-
onKeyDown: i,
|
|
494
|
-
className: "ssg-filter-select",
|
|
495
|
-
"aria-label": c.filterOperator,
|
|
496
|
-
children: P.map((e) => /* @__PURE__ */ h("option", {
|
|
497
|
-
value: e.value,
|
|
498
|
-
children: c[e.labelKey]
|
|
499
|
-
}, e.value))
|
|
500
|
-
}),
|
|
501
|
-
u > 0 ? /* @__PURE__ */ g("div", {
|
|
502
|
-
className: "ssg-filter-cond-values",
|
|
503
|
-
children: [o ? o({
|
|
504
|
-
value: e.value1,
|
|
505
|
-
onChange: (e) => d("value1", e),
|
|
506
|
-
ariaLabel: u === 2 ? c.filterStartDate : c.filterDate,
|
|
507
|
-
slot: u === 2 ? "from" : "single"
|
|
508
|
-
}) : /* @__PURE__ */ h(W, {
|
|
509
|
-
value: e.value1,
|
|
510
|
-
onCommit: (t) => n({
|
|
511
|
-
...e,
|
|
512
|
-
value1: t,
|
|
513
|
-
preset: null
|
|
514
|
-
}),
|
|
515
|
-
ariaLabel: u === 2 ? c.filterStartDate : c.filterDate,
|
|
516
|
-
inputRef: t,
|
|
517
|
-
onRequestClose: s
|
|
518
|
-
}), u === 2 && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("span", {
|
|
519
|
-
className: "ssg-filter-cond-tilde",
|
|
520
|
-
children: c.filterRangeSeparator
|
|
521
|
-
}), o ? o({
|
|
522
|
-
value: e.value2,
|
|
523
|
-
onChange: (e) => d("value2", e),
|
|
524
|
-
ariaLabel: c.filterEndDate,
|
|
525
|
-
slot: "to"
|
|
526
|
-
}) : /* @__PURE__ */ h(W, {
|
|
527
|
-
value: e.value2,
|
|
528
|
-
onCommit: (t) => n({
|
|
529
|
-
...e,
|
|
530
|
-
value2: t,
|
|
531
|
-
preset: null
|
|
532
|
-
}),
|
|
533
|
-
ariaLabel: c.filterEndDate,
|
|
534
|
-
onRequestClose: s,
|
|
535
|
-
align: "right"
|
|
536
|
-
})] })]
|
|
537
|
-
}) : e.preset === null ? /* @__PURE__ */ h("div", {
|
|
538
|
-
className: "ssg-filter-meta",
|
|
539
|
-
children: c.filterNoValue
|
|
540
|
-
}) : null,
|
|
541
|
-
a.length > 0 && /* @__PURE__ */ h("div", {
|
|
542
|
-
className: "ssg-filter-presets",
|
|
543
|
-
children: a.map((t) => /* @__PURE__ */ h("button", {
|
|
544
|
-
type: "button",
|
|
545
|
-
onPointerDown: (r) => {
|
|
546
|
-
r.preventDefault(), r.stopPropagation(), n({
|
|
547
|
-
...e,
|
|
548
|
-
preset: e.preset === t.id ? null : t.id
|
|
549
|
-
});
|
|
550
|
-
},
|
|
551
|
-
onKeyDown: (r) => {
|
|
552
|
-
J(r), (r.key === "Enter" || r.key === " ") && (r.preventDefault(), n({
|
|
553
|
-
...e,
|
|
554
|
-
preset: e.preset === t.id ? null : t.id
|
|
555
|
-
}));
|
|
556
|
-
},
|
|
557
|
-
className: l("ssg-filter-preset-chip", e.preset === t.id && "ssg-filter-preset-chip--active"),
|
|
558
|
-
children: t.label
|
|
559
|
-
}, t.id))
|
|
560
|
-
})
|
|
561
|
-
] });
|
|
562
|
-
}
|
|
563
|
-
function ce({ options: e, setSelection: t, searchInputRef: a, onValueToggle: l, onSelectAllChange: u, onReplaceSelection: d, onRequestClose: _, isServerSide: v, truncated: y = !1 }) {
|
|
564
|
-
let b = r(), [w, T] = c(""), E = i(w), [D, O] = c(() => /* @__PURE__ */ new Set()), k = E.trim().length > 0, A = o(() => q(e, b.blank), [e, b.blank]), j = o(() => x(A, E), [A, E]), M = o(() => U(e, D, b), [
|
|
565
|
-
e,
|
|
566
|
-
D,
|
|
567
|
-
b
|
|
568
|
-
]), N = s(null), P = k ? j.length : M.length, [F] = c(ne), I = n({
|
|
569
|
-
count: P,
|
|
570
|
-
getScrollElement: () => N.current,
|
|
571
|
-
estimateSize: () => F,
|
|
572
|
-
overscan: 10
|
|
573
|
-
}), L = o(() => (k ? j : e).map((e) => e.value), [
|
|
574
|
-
k,
|
|
575
|
-
j,
|
|
576
|
-
e
|
|
577
|
-
]), R = o(() => {
|
|
578
|
-
let e = 0;
|
|
579
|
-
for (let n of L) C(t, n) && (e += 1);
|
|
580
|
-
return e;
|
|
581
|
-
}, [L, t]), z = L.length > 0 && R === L.length, B = R > 0 && !z, ee = o(() => new Set(e.map((e) => e.value)), [e]), V = o(() => {
|
|
582
|
-
if (t === null) return e.length;
|
|
583
|
-
let n = 0;
|
|
584
|
-
for (let e of t.values) ee.has(e) && (n += 1);
|
|
585
|
-
return t.mode === "include" ? n : e.length - n;
|
|
586
|
-
}, [
|
|
587
|
-
t,
|
|
588
|
-
ee,
|
|
589
|
-
e.length
|
|
590
|
-
]), H = (e) => {
|
|
591
|
-
O((t) => {
|
|
592
|
-
let n = new Set(t);
|
|
593
|
-
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
594
|
-
});
|
|
595
|
-
}, W = (e) => {
|
|
596
|
-
let n = 0;
|
|
597
|
-
for (let r of e) C(t, r) && (n += 1);
|
|
598
|
-
return n;
|
|
599
|
-
}, G = (e) => {
|
|
600
|
-
if (e.type === "leaf") {
|
|
601
|
-
l(e.key);
|
|
602
|
-
return;
|
|
603
|
-
}
|
|
604
|
-
let t = e.leafKeys.length > 0 && W(e.leafKeys) === e.leafKeys.length;
|
|
605
|
-
u(e.leafKeys, !t);
|
|
606
|
-
}, te = (e) => {
|
|
607
|
-
let t = W(e.leafKeys), n = e.leafKeys.length > 0 && t === e.leafKeys.length, r = t > 0 && !n;
|
|
608
|
-
return /* @__PURE__ */ g(m, { children: [
|
|
609
|
-
e.type === "group" ? /* @__PURE__ */ h("button", {
|
|
610
|
-
type: "button",
|
|
611
|
-
onPointerDown: (t) => {
|
|
612
|
-
t.preventDefault(), t.stopPropagation(), H(e.key);
|
|
613
|
-
},
|
|
614
|
-
onKeyDown: (t) => {
|
|
615
|
-
J(t), (t.key === "Enter" || t.key === " ") && (t.preventDefault(), H(e.key));
|
|
616
|
-
},
|
|
617
|
-
className: "ssg-filter-tree-toggle",
|
|
618
|
-
"aria-label": e.expanded ? b.treeCollapse : b.treeExpand,
|
|
619
|
-
children: e.expanded ? "▾" : "▸"
|
|
620
|
-
}) : /* @__PURE__ */ h("span", { className: "ssg-filter-tree-toggle ssg-filter-tree-toggle--placeholder" }),
|
|
621
|
-
/* @__PURE__ */ h("input", {
|
|
622
|
-
type: "checkbox",
|
|
623
|
-
checked: n,
|
|
624
|
-
ref: (e) => {
|
|
625
|
-
e && (e.indeterminate = r);
|
|
626
|
-
},
|
|
627
|
-
"aria-label": K(e.key, e.label, b.blank),
|
|
628
|
-
onChange: () => G(e)
|
|
629
|
-
}),
|
|
630
|
-
/* @__PURE__ */ h("span", {
|
|
631
|
-
className: "ssg-filter-option-label",
|
|
632
|
-
children: K(e.key, e.label, b.blank)
|
|
633
|
-
})
|
|
634
|
-
] });
|
|
635
|
-
};
|
|
636
|
-
return /* @__PURE__ */ g(m, { children: [
|
|
637
|
-
/* @__PURE__ */ h("input", {
|
|
638
|
-
ref: a,
|
|
639
|
-
type: "text",
|
|
640
|
-
value: w,
|
|
641
|
-
onChange: (e) => T(e.target.value),
|
|
642
|
-
onKeyDown: (e) => {
|
|
643
|
-
if (e.stopPropagation(), e.key === "Escape" && (e.preventDefault(), _()), e.key === "Enter") {
|
|
644
|
-
if (f(e.nativeEvent)) return;
|
|
645
|
-
e.preventDefault();
|
|
646
|
-
let t = S(A, w);
|
|
647
|
-
if (t.kind === "none") return;
|
|
648
|
-
t.kind === "replace" && d(t.values), _();
|
|
649
|
-
}
|
|
650
|
-
},
|
|
651
|
-
placeholder: b.filterSearchPlaceholder,
|
|
652
|
-
"aria-label": b.filterSearchPlaceholder,
|
|
653
|
-
className: "ssg-filter-input"
|
|
654
|
-
}),
|
|
655
|
-
/* @__PURE__ */ g("label", {
|
|
656
|
-
className: "ssg-filter-selectall",
|
|
657
|
-
children: [/* @__PURE__ */ h("input", {
|
|
658
|
-
type: "checkbox",
|
|
659
|
-
checked: z,
|
|
660
|
-
ref: (e) => {
|
|
661
|
-
e && (e.indeterminate = B);
|
|
662
|
-
},
|
|
663
|
-
onChange: () => u(L, !z)
|
|
664
|
-
}), /* @__PURE__ */ h("span", {
|
|
665
|
-
className: "ssg-filter-selectall-label",
|
|
666
|
-
children: k ? b.filterSelectAllResults : b.filterSelectAll
|
|
667
|
-
})]
|
|
668
|
-
}),
|
|
669
|
-
/* @__PURE__ */ h("div", {
|
|
670
|
-
ref: N,
|
|
671
|
-
className: "ssg-filter-list",
|
|
672
|
-
children: P === 0 ? /* @__PURE__ */ h("div", {
|
|
673
|
-
className: "ssg-filter-empty",
|
|
674
|
-
children: e.length === 0 ? v ? b.filterNoOptionsSource : b.noOptions : b.filterNoMatches
|
|
675
|
-
}) : /* @__PURE__ */ h("div", {
|
|
676
|
-
className: "ssg-filter-virt",
|
|
677
|
-
style: { height: I.getTotalSize() },
|
|
678
|
-
children: I.getVirtualItems().map((e) => {
|
|
679
|
-
if (k) {
|
|
680
|
-
let n = j[e.index];
|
|
681
|
-
return n ? /* @__PURE__ */ g("label", {
|
|
682
|
-
className: "ssg-filter-option",
|
|
683
|
-
style: {
|
|
684
|
-
transform: `translateY(${e.start}px)`,
|
|
685
|
-
height: e.size
|
|
686
|
-
},
|
|
687
|
-
children: [/* @__PURE__ */ h("input", {
|
|
688
|
-
type: "checkbox",
|
|
689
|
-
checked: C(t, n.value),
|
|
690
|
-
onChange: () => l(n.value)
|
|
691
|
-
}), /* @__PURE__ */ h("span", {
|
|
692
|
-
className: "ssg-filter-option-label",
|
|
693
|
-
children: K(n.value, n.label, b.blank)
|
|
694
|
-
})]
|
|
695
|
-
}, n.value) : null;
|
|
696
|
-
}
|
|
697
|
-
let n = M[e.index];
|
|
698
|
-
return n ? /* @__PURE__ */ h("div", {
|
|
699
|
-
className: "ssg-filter-option",
|
|
700
|
-
style: {
|
|
701
|
-
transform: `translateY(${e.start}px)`,
|
|
702
|
-
height: e.size,
|
|
703
|
-
paddingLeft: 8 + n.depth * 16
|
|
704
|
-
},
|
|
705
|
-
onClick: (e) => {
|
|
706
|
-
e.target.closest("button, input") || G(n);
|
|
707
|
-
},
|
|
708
|
-
children: te(n)
|
|
709
|
-
}, n.key) : null;
|
|
710
|
-
})
|
|
711
|
-
})
|
|
712
|
-
}),
|
|
713
|
-
/* @__PURE__ */ g("div", {
|
|
714
|
-
className: "ssg-filter-meta",
|
|
715
|
-
children: [
|
|
716
|
-
p(b.filterSelectedCount, {
|
|
717
|
-
selected: V,
|
|
718
|
-
total: e.length
|
|
719
|
-
}),
|
|
720
|
-
k ? p(b.filterShownCount, { count: j.length }) : "",
|
|
721
|
-
y && /* @__PURE__ */ h(ue, {})
|
|
722
|
-
]
|
|
723
|
-
})
|
|
724
|
-
] });
|
|
725
|
-
}
|
|
726
|
-
function le({ status: e, errorMessage: t, onRetry: n }) {
|
|
727
|
-
let i = r();
|
|
728
|
-
return e === "loading" ? /* @__PURE__ */ h("div", {
|
|
729
|
-
className: "ssg-filter-collecting",
|
|
730
|
-
children: i.filterOptionsLoading
|
|
731
|
-
}) : /* @__PURE__ */ g("div", {
|
|
732
|
-
className: "ssg-filter-error",
|
|
733
|
-
role: "alert",
|
|
734
|
-
children: [
|
|
735
|
-
/* @__PURE__ */ h("div", { children: i.filterOptionsFailed }),
|
|
736
|
-
t ? /* @__PURE__ */ h("div", {
|
|
737
|
-
className: "ssg-filter-error-detail",
|
|
738
|
-
title: t,
|
|
739
|
-
children: t
|
|
740
|
-
}) : null,
|
|
741
|
-
n ? /* @__PURE__ */ h("button", {
|
|
742
|
-
type: "button",
|
|
743
|
-
onPointerDown: (e) => {
|
|
744
|
-
e.preventDefault(), e.stopPropagation(), n();
|
|
745
|
-
},
|
|
746
|
-
onKeyDown: (e) => {
|
|
747
|
-
J(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), n());
|
|
748
|
-
},
|
|
749
|
-
className: "ssg-filter-btn-secondary",
|
|
750
|
-
children: i.retry
|
|
751
|
-
}) : null
|
|
752
|
-
]
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
function ue() {
|
|
756
|
-
return /* @__PURE__ */ h("span", {
|
|
757
|
-
className: "ssg-filter-truncated",
|
|
758
|
-
children: r().filterOptionsTruncated
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
function de({ conditionEditor: e, conditionActive: t, onConditionClear: n, options: i, setSelection: a, onSelectionClear: o, summaryText: s, children: c, optionsMeta: l }) {
|
|
762
|
-
let u = r();
|
|
763
|
-
return /* @__PURE__ */ g(m, { children: [
|
|
764
|
-
/* @__PURE__ */ g("div", {
|
|
765
|
-
className: "ssg-filter-sec-head",
|
|
766
|
-
children: [/* @__PURE__ */ h("span", {
|
|
767
|
-
className: "ssg-filter-sec-label",
|
|
768
|
-
children: u.filterConditionSection
|
|
769
|
-
}), /* @__PURE__ */ h("button", {
|
|
770
|
-
type: "button",
|
|
771
|
-
onPointerDown: (e) => {
|
|
772
|
-
e.preventDefault(), e.stopPropagation(), n();
|
|
773
|
-
},
|
|
774
|
-
onKeyDown: (e) => {
|
|
775
|
-
J(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), n());
|
|
776
|
-
},
|
|
777
|
-
className: "ssg-filter-sec-clear",
|
|
778
|
-
disabled: !t,
|
|
779
|
-
children: u.clear
|
|
780
|
-
})]
|
|
781
|
-
}),
|
|
782
|
-
e,
|
|
783
|
-
/* @__PURE__ */ h("div", { className: "ssg-filter-sep" }),
|
|
784
|
-
/* @__PURE__ */ g("div", {
|
|
785
|
-
className: "ssg-filter-sec-head",
|
|
786
|
-
children: [
|
|
787
|
-
/* @__PURE__ */ h("span", {
|
|
788
|
-
className: "ssg-filter-sec-label",
|
|
789
|
-
children: u.filterValuesSection
|
|
790
|
-
}),
|
|
791
|
-
/* @__PURE__ */ h("span", {
|
|
792
|
-
className: "ssg-filter-sec-meta",
|
|
793
|
-
children: l ?? p(t ? u.filterMatchCount : u.filterTotalCount, { count: i.length })
|
|
794
|
-
}),
|
|
795
|
-
/* @__PURE__ */ h("button", {
|
|
796
|
-
type: "button",
|
|
797
|
-
onPointerDown: (e) => {
|
|
798
|
-
e.preventDefault(), e.stopPropagation(), o();
|
|
799
|
-
},
|
|
800
|
-
onKeyDown: (e) => {
|
|
801
|
-
J(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), o());
|
|
802
|
-
},
|
|
803
|
-
className: "ssg-filter-sec-clear",
|
|
804
|
-
disabled: a === null,
|
|
805
|
-
children: u.clear
|
|
806
|
-
})
|
|
807
|
-
]
|
|
808
|
-
}),
|
|
809
|
-
c,
|
|
810
|
-
/* @__PURE__ */ g("div", {
|
|
811
|
-
className: "ssg-filter-summary",
|
|
812
|
-
children: ["🔽 ", s]
|
|
813
|
-
})
|
|
814
|
-
] });
|
|
815
|
-
}
|
|
816
|
-
function fe({ isOpen: n, themeClassName: i, popoverSlot: a, title: o, filterType: _, draftValue: y, numberConditionDraft: x, onNumberConditionDraftChange: S, textConditionDraft: C, onTextConditionDraftChange: T, dateConditionDraft: O, onDateConditionDraftChange: A, datePresets: N, renderDateInput: P, onComboConditionClear: L, onComboSelectionClear: z, comboSummaryText: B, currentValueText: ee, layout: V, selectOptions: H, optionsStatus: U, optionsProgress: W, optionsTruncated: G = !1, optionsErrorMessage: te, onOptionsRetry: ne, setSelection: q, popoverRef: ie, textInputRef: Y, selectRef: fe, onRequestClose: X, onDraftChange: pe, onApply: Z, onClear: me, onSetValueToggle: he, onSetSelectAllChange: ge, onSetClear: _e, onSetReplaceSelection: ve, isServerSide: ye = !1 }) {
|
|
817
|
-
let Q = r(), be = s(null), [xe] = c(() => /* @__PURE__ */ new Date());
|
|
818
|
-
e(ie, n && V !== null, i, { layout: V });
|
|
819
|
-
let Se = t(n && V !== null);
|
|
820
|
-
if (typeof document > "u" || !n || !V || !Se) return null;
|
|
821
|
-
let Ce = {
|
|
822
|
-
top: V.top,
|
|
823
|
-
left: V.left,
|
|
824
|
-
width: V.width,
|
|
825
|
-
maxHeight: V.maxHeight
|
|
826
|
-
}, we = (e) => {
|
|
827
|
-
e.stopPropagation(), e.key === "Escape" && !d(e.nativeEvent) && !f(e.nativeEvent) && (e.preventDefault(), X());
|
|
828
|
-
}, Te = (e) => {
|
|
829
|
-
if (e.key !== "Tab" || e.altKey || e.ctrlKey || e.metaKey || f(e.nativeEvent)) return;
|
|
830
|
-
let t = b(e.currentTarget, e.target instanceof Element ? e.target : null, e.shiftKey);
|
|
831
|
-
t !== null && (e.preventDefault(), t.focus());
|
|
832
|
-
}, Ee = (e) => {
|
|
833
|
-
e.stopPropagation();
|
|
834
|
-
}, De = _ === "set", Oe = _ === "numberSet", ke = _ === "textSet", Ae = _ === "dateSet", je = Oe || ke || Ae, Me = De || je, Ne = U === "loading" || U === "error", Pe = x ?? w, Fe = C ?? k, Ie = O ?? F, Le = N ?? v(void 0, Q), Re = Oe ? E(Pe) : null, ze = ke ? j(Fe) : null, Be = Ae ? I(Ie) : null, Ve = Re !== null || ze !== null || Be !== null, $ = Oe ? D(H, Re) : ke ? M(H, ze) : Ae ? R(H, Be, xe, Le) : H, He = (e) => {
|
|
835
|
-
if (e.stopPropagation(), !f(e.nativeEvent)) {
|
|
836
|
-
if (e.key === "Enter") {
|
|
837
|
-
e.preventDefault(), Z();
|
|
838
|
-
return;
|
|
839
|
-
}
|
|
840
|
-
e.key === "Escape" && (e.preventDefault(), X());
|
|
841
|
-
}
|
|
842
|
-
}, Ue = Oe ? /* @__PURE__ */ h(ae, {
|
|
843
|
-
draft: Pe,
|
|
844
|
-
valueInputRef: Y,
|
|
845
|
-
onDraftChange: S,
|
|
846
|
-
onKeyDown: He
|
|
847
|
-
}) : ke ? /* @__PURE__ */ h(oe, {
|
|
848
|
-
draft: Fe,
|
|
849
|
-
valueInputRef: Y,
|
|
850
|
-
onDraftChange: T,
|
|
851
|
-
onKeyDown: He
|
|
852
|
-
}) : /* @__PURE__ */ h(se, {
|
|
853
|
-
draft: Ie,
|
|
854
|
-
valueInputRef: Y,
|
|
855
|
-
onDraftChange: A,
|
|
856
|
-
onKeyDown: He,
|
|
857
|
-
presets: Le,
|
|
858
|
-
renderDateInput: P,
|
|
859
|
-
onRequestClose: X
|
|
860
|
-
});
|
|
861
|
-
return u(/* @__PURE__ */ g("div", {
|
|
862
|
-
ref: ie,
|
|
863
|
-
onPointerDown: Ee,
|
|
864
|
-
onKeyDown: we,
|
|
865
|
-
onKeyDownCapture: Te,
|
|
866
|
-
onPasteCapture: (e) => {
|
|
867
|
-
e.stopPropagation();
|
|
868
|
-
},
|
|
869
|
-
className: l("ssg-filter-popover", i, a?.className),
|
|
870
|
-
style: {
|
|
871
|
-
...a?.style,
|
|
872
|
-
...Ce
|
|
873
|
-
},
|
|
874
|
-
role: "dialog",
|
|
875
|
-
"aria-label": p(Q.filterTitle, { column: o }),
|
|
876
|
-
tabIndex: -1,
|
|
877
|
-
children: [
|
|
878
|
-
/* @__PURE__ */ h("div", {
|
|
879
|
-
className: "ssg-filter-title",
|
|
880
|
-
children: p(Q.filterTitle, { column: o })
|
|
881
|
-
}),
|
|
882
|
-
(Me || _ === "select") && U === "collecting" ? je ? /* @__PURE__ */ h(de, {
|
|
883
|
-
conditionEditor: Ue,
|
|
884
|
-
conditionActive: Ve,
|
|
885
|
-
onConditionClear: L,
|
|
886
|
-
options: $,
|
|
887
|
-
setSelection: q,
|
|
888
|
-
onSelectionClear: z,
|
|
889
|
-
summaryText: B,
|
|
890
|
-
optionsMeta: Q.filterOptionsLoadingShort,
|
|
891
|
-
children: /* @__PURE__ */ h("div", {
|
|
892
|
-
className: "ssg-filter-collecting",
|
|
893
|
-
children: p(Q.filterCollecting, { percent: Math.round(W * 100) })
|
|
894
|
-
})
|
|
895
|
-
}) : /* @__PURE__ */ h("div", {
|
|
896
|
-
className: "ssg-filter-collecting",
|
|
897
|
-
children: p(Q.filterCollecting, { percent: Math.round(W * 100) })
|
|
898
|
-
}) : (Me || _ === "select") && Ne ? je ? /* @__PURE__ */ h(de, {
|
|
899
|
-
conditionEditor: Ue,
|
|
900
|
-
conditionActive: Ve,
|
|
901
|
-
onConditionClear: L,
|
|
902
|
-
options: $,
|
|
903
|
-
setSelection: q,
|
|
904
|
-
onSelectionClear: z,
|
|
905
|
-
summaryText: B,
|
|
906
|
-
optionsMeta: U === "loading" ? Q.filterOptionsLoadingShort : Q.filterOptionsFailedShort,
|
|
907
|
-
children: /* @__PURE__ */ h(le, {
|
|
908
|
-
status: U === "loading" ? "loading" : "error",
|
|
909
|
-
errorMessage: te,
|
|
910
|
-
onRetry: ne
|
|
911
|
-
})
|
|
912
|
-
}) : /* @__PURE__ */ h(le, {
|
|
913
|
-
status: U === "loading" ? "loading" : "error",
|
|
914
|
-
errorMessage: te,
|
|
915
|
-
onRetry: ne
|
|
916
|
-
}) : je ? /* @__PURE__ */ h(de, {
|
|
917
|
-
conditionEditor: Ue,
|
|
918
|
-
conditionActive: Ve,
|
|
919
|
-
onConditionClear: L,
|
|
920
|
-
options: $,
|
|
921
|
-
setSelection: q,
|
|
922
|
-
onSelectionClear: z,
|
|
923
|
-
summaryText: B,
|
|
924
|
-
children: Ae ? /* @__PURE__ */ h(ce, {
|
|
925
|
-
options: $,
|
|
926
|
-
setSelection: q,
|
|
927
|
-
searchInputRef: be,
|
|
928
|
-
onValueToggle: he,
|
|
929
|
-
onSelectAllChange: ge,
|
|
930
|
-
onReplaceSelection: ve,
|
|
931
|
-
onRequestClose: X,
|
|
932
|
-
isServerSide: ye,
|
|
933
|
-
truncated: G
|
|
934
|
-
}) : /* @__PURE__ */ h(re, {
|
|
935
|
-
options: $,
|
|
936
|
-
setSelection: q,
|
|
937
|
-
searchInputRef: be,
|
|
938
|
-
onValueToggle: he,
|
|
939
|
-
onSelectAllChange: ge,
|
|
940
|
-
onReplaceSelection: ve,
|
|
941
|
-
onRequestClose: X,
|
|
942
|
-
isServerSide: ye,
|
|
943
|
-
selectAllUsesExplicitScope: !0,
|
|
944
|
-
truncated: G
|
|
945
|
-
})
|
|
946
|
-
}) : De ? /* @__PURE__ */ h(re, {
|
|
947
|
-
options: H,
|
|
948
|
-
setSelection: q,
|
|
949
|
-
searchInputRef: Y,
|
|
950
|
-
onValueToggle: he,
|
|
951
|
-
onSelectAllChange: ge,
|
|
952
|
-
onReplaceSelection: ve,
|
|
953
|
-
onRequestClose: X,
|
|
954
|
-
isServerSide: ye,
|
|
955
|
-
truncated: G
|
|
956
|
-
}) : _ === "number" ? /* @__PURE__ */ h(m, { children: /* @__PURE__ */ h(ae, {
|
|
957
|
-
draft: Pe,
|
|
958
|
-
valueInputRef: Y,
|
|
959
|
-
onDraftChange: S,
|
|
960
|
-
onKeyDown: He
|
|
961
|
-
}) }) : _ === "select" ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("select", {
|
|
962
|
-
ref: fe,
|
|
963
|
-
value: y,
|
|
964
|
-
onChange: (e) => pe(e.target.value),
|
|
965
|
-
onKeyDown: (e) => {
|
|
966
|
-
if (e.stopPropagation(), e.key === "Enter") {
|
|
967
|
-
e.preventDefault(), Z();
|
|
968
|
-
return;
|
|
969
|
-
}
|
|
970
|
-
e.key === "Escape" && (e.preventDefault(), X());
|
|
971
|
-
},
|
|
972
|
-
className: "ssg-filter-select",
|
|
973
|
-
children: [/* @__PURE__ */ h("option", {
|
|
974
|
-
value: "",
|
|
975
|
-
children: Q.filterAll
|
|
976
|
-
}), H.map((e) => /* @__PURE__ */ h("option", {
|
|
977
|
-
value: e.value,
|
|
978
|
-
children: K(e.value, e.label, Q.blank)
|
|
979
|
-
}, `${o}-${e.value}`))]
|
|
980
|
-
}), /* @__PURE__ */ g("div", {
|
|
981
|
-
className: "ssg-filter-meta",
|
|
982
|
-
children: [p(Q.filterOptionCount, { count: H.length }), G && /* @__PURE__ */ h(ue, {})]
|
|
983
|
-
})] }) : /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("input", {
|
|
984
|
-
ref: Y,
|
|
985
|
-
type: "text",
|
|
986
|
-
value: y,
|
|
987
|
-
onChange: (e) => pe(e.target.value),
|
|
988
|
-
onKeyDown: (e) => {
|
|
989
|
-
if (e.stopPropagation(), !f(e.nativeEvent)) {
|
|
990
|
-
if (e.key === "Enter") {
|
|
991
|
-
e.preventDefault(), Z();
|
|
992
|
-
return;
|
|
993
|
-
}
|
|
994
|
-
e.key === "Escape" && (e.preventDefault(), X());
|
|
995
|
-
}
|
|
996
|
-
},
|
|
997
|
-
placeholder: Q.filterTextPlaceholder,
|
|
998
|
-
"aria-label": Q.filterTextPlaceholder,
|
|
999
|
-
className: "ssg-filter-input"
|
|
1000
|
-
}), /* @__PURE__ */ h("div", {
|
|
1001
|
-
className: "ssg-filter-meta ssg-filter-meta--ellipsis",
|
|
1002
|
-
children: Q.filterTextHint
|
|
1003
|
-
})] }),
|
|
1004
|
-
!Me && /* @__PURE__ */ h("div", {
|
|
1005
|
-
className: "ssg-filter-meta ssg-filter-meta--ellipsis",
|
|
1006
|
-
children: p(Q.filterCurrentValue, { value: ee })
|
|
1007
|
-
}),
|
|
1008
|
-
/* @__PURE__ */ h("div", {
|
|
1009
|
-
className: "ssg-filter-footer",
|
|
1010
|
-
children: Me ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("button", {
|
|
1011
|
-
type: "button",
|
|
1012
|
-
onPointerDown: (e) => {
|
|
1013
|
-
e.preventDefault(), e.stopPropagation(), _e();
|
|
1014
|
-
},
|
|
1015
|
-
onKeyDown: (e) => {
|
|
1016
|
-
J(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), _e());
|
|
1017
|
-
},
|
|
1018
|
-
className: "ssg-filter-btn-secondary",
|
|
1019
|
-
children: Q.clear
|
|
1020
|
-
}), /* @__PURE__ */ h("button", {
|
|
1021
|
-
type: "button",
|
|
1022
|
-
onPointerDown: (e) => {
|
|
1023
|
-
e.preventDefault(), e.stopPropagation(), X();
|
|
1024
|
-
},
|
|
1025
|
-
onKeyDown: (e) => {
|
|
1026
|
-
J(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), X());
|
|
1027
|
-
},
|
|
1028
|
-
className: "ssg-filter-btn-primary",
|
|
1029
|
-
children: Q.close
|
|
1030
|
-
})] }) : /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("button", {
|
|
1031
|
-
type: "button",
|
|
1032
|
-
onPointerDown: (e) => {
|
|
1033
|
-
e.preventDefault(), e.stopPropagation(), me();
|
|
1034
|
-
},
|
|
1035
|
-
onKeyDown: (e) => {
|
|
1036
|
-
J(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), me());
|
|
1037
|
-
},
|
|
1038
|
-
className: "ssg-filter-btn-secondary",
|
|
1039
|
-
children: Q.clear
|
|
1040
|
-
}), /* @__PURE__ */ h("button", {
|
|
1041
|
-
type: "button",
|
|
1042
|
-
onPointerDown: (e) => {
|
|
1043
|
-
e.preventDefault(), e.stopPropagation(), Z();
|
|
1044
|
-
},
|
|
1045
|
-
onKeyDown: (e) => {
|
|
1046
|
-
J(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), Z());
|
|
1047
|
-
},
|
|
1048
|
-
className: "ssg-filter-btn-primary",
|
|
1049
|
-
children: Q.apply
|
|
1050
|
-
})] })
|
|
1051
|
-
})
|
|
1052
|
-
]
|
|
1053
|
-
}), Se);
|
|
1054
|
-
}
|
|
1055
|
-
//#endregion
|
|
1056
|
-
export { fe as ColumnFilterPopover, fe as default };
|