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