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