@ishibashi0112/spreadsheet-grid 1.0.1 → 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 +53 -46
- package/README.md +4 -4
- package/dist/{ColumnFilterPopover-VHTWLyQ7.cjs → ColumnFilterPopover-BEeU4H00.cjs} +1 -1
- package/dist/{ColumnFilterPopover-xCX4O5Pb.js → ColumnFilterPopover-CTJGE2vR.js} +164 -146
- 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 +2 -1
- package/dist/editors/editorVisibleBounds.d.ts +10 -0
- package/dist/features/types.d.ts +33 -33
- package/dist/hooks/useGridLocaleText.d.ts +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.js +2924 -2676
- package/dist/lite/{ColumnFilterPopover-Dusx2AfV.cjs → ColumnFilterPopover-B0Ry9U-4.cjs} +1 -1
- package/dist/lite/{ColumnFilterPopover-BNzAJgCT.js → ColumnFilterPopover-D87ZPNhR.js} +155 -137
- 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/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 +2 -2
- 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-DbZ9rUbb.js → lazyPopups-CoX4Zxvb.js} +1 -1
- package/dist/lite/{lazyPopups-BQZ_tQmx.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-CS_VR9ev.js → selectionAggregates-DoHetiAE.js} +15 -23
- package/dist/lite/{selectionAggregates-CP0_LaAu.cjs → selectionAggregates-DuSb6U5D.cjs} +1 -1
- package/dist/lite/{toolPanel-RciyWlun.cjs → toolPanel-BkdryfVw.cjs} +1 -1
- package/dist/lite/{toolPanel-DZ6JUS79.js → toolPanel-DcQrkZzk.js} +1 -1
- package/dist/lite/toolPanelViews-B-QP_ZDZ.cjs +1 -0
- package/dist/lite/{toolPanelViews-DYrngzT1.js → toolPanelViews-Dllz41nc.js} +3 -1
- package/dist/lite.cjs +1 -1
- package/dist/lite.js +7 -7
- package/dist/model/gridTypes.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/style.layer.css +1 -1
- package/dist/{toolPanelViews-C7C1j-ss.js → toolPanelViews-DwlD9m4j.js} +3 -1
- 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 +2 -2
- package/dist/lite/createSpreadsheetGrid-BsuvhGwN.cjs +0 -7
- package/dist/lite/createSpreadsheetGrid-CcUZV9Nl.js +0 -4383
- package/dist/lite/filtering-BJD9TbJf.js +0 -387
- package/dist/lite/filtering-CTgteY8F.cjs +0 -1
- package/dist/lite/labelRow-JKoR6wHG.cjs +0 -1
- package/dist/lite/rowDrag-BJzh34bd.cjs +0 -1
- package/dist/lite/toolPanelViews-DgY7fFl7.cjs +0 -1
- package/dist/toolPanelViews-BdtqSCJ6.cjs +0 -1
|
@@ -17,11 +17,11 @@ import { isSetValueSelected as S } from "@ishibashi0112/spreadsheet-grid-core/in
|
|
|
17
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
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
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
|
|
21
|
-
import { buildDateTreeRows as
|
|
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
22
|
//#region src/view/FilterDateField.tsx
|
|
23
|
-
function
|
|
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 ??
|
|
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
25
|
if (v === null) return;
|
|
26
26
|
let e = v.trim();
|
|
27
27
|
if (e === "") {
|
|
@@ -82,7 +82,7 @@ function W({ value: e, onCommit: t, ariaLabel: r, inputRef: a, onRequestClose: l
|
|
|
82
82
|
l();
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
}),
|
|
85
|
+
}), H = (e) => {
|
|
86
86
|
if (w === "days") {
|
|
87
87
|
let t = new Date(E, O + e, 1);
|
|
88
88
|
D(t.getFullYear()), k(t.getMonth());
|
|
@@ -93,14 +93,14 @@ function W({ value: e, onCommit: t, ariaLabel: r, inputRef: a, onRequestClose: l
|
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
D((t) => t + e * 12);
|
|
96
|
-
},
|
|
96
|
+
}, U = () => {
|
|
97
97
|
T((e) => e === "days" ? "months" : "years");
|
|
98
|
-
},
|
|
98
|
+
}, W = () => {
|
|
99
99
|
T((e) => e === "years" ? "months" : "days");
|
|
100
|
-
},
|
|
100
|
+
}, G = w === "days" ? f(_.calendarTitle, {
|
|
101
101
|
year: E,
|
|
102
102
|
month: O + 1
|
|
103
|
-
}) : w === "months" ? f(_.calendarYear, { year: E }) : `${
|
|
103
|
+
}) : w === "months" ? f(_.calendarYear, { year: E }) : `${V(E)} – ${V(E) + 11}`;
|
|
104
104
|
return /* @__PURE__ */ h("div", {
|
|
105
105
|
ref: A,
|
|
106
106
|
className: "ssg-dp-root",
|
|
@@ -176,7 +176,7 @@ function W({ value: e, onCommit: t, ariaLabel: r, inputRef: a, onRequestClose: l
|
|
|
176
176
|
type: "button",
|
|
177
177
|
className: "ssg-dp-nav-btn",
|
|
178
178
|
"aria-label": _.calendarPrevious,
|
|
179
|
-
...R(() =>
|
|
179
|
+
...R(() => H(-1)),
|
|
180
180
|
children: "‹"
|
|
181
181
|
}),
|
|
182
182
|
/* @__PURE__ */ m("button", {
|
|
@@ -184,14 +184,14 @@ function W({ value: e, onCommit: t, ariaLabel: r, inputRef: a, onRequestClose: l
|
|
|
184
184
|
className: "ssg-dp-nav-title",
|
|
185
185
|
disabled: w === "years",
|
|
186
186
|
"aria-label": _.calendarChangeView,
|
|
187
|
-
...R(
|
|
188
|
-
children:
|
|
187
|
+
...R(U),
|
|
188
|
+
children: G
|
|
189
189
|
}),
|
|
190
190
|
/* @__PURE__ */ m("button", {
|
|
191
191
|
type: "button",
|
|
192
192
|
className: "ssg-dp-nav-btn",
|
|
193
193
|
"aria-label": _.calendarNext,
|
|
194
|
-
...R(() =>
|
|
194
|
+
...R(() => H(1)),
|
|
195
195
|
children: "›"
|
|
196
196
|
})
|
|
197
197
|
]
|
|
@@ -225,7 +225,7 @@ function W({ value: e, onCommit: t, ariaLabel: r, inputRef: a, onRequestClose: l
|
|
|
225
225
|
}),
|
|
226
226
|
w === "years" && /* @__PURE__ */ m("div", {
|
|
227
227
|
className: "ssg-dp-grid",
|
|
228
|
-
children:
|
|
228
|
+
children: ee(E).map((e) => /* @__PURE__ */ m("button", {
|
|
229
229
|
type: "button",
|
|
230
230
|
className: c("ssg-dp-cell", e === E && "ssg-dp-cell--selected"),
|
|
231
231
|
...R(() => {
|
|
@@ -240,7 +240,7 @@ function W({ value: e, onCommit: t, ariaLabel: r, inputRef: a, onRequestClose: l
|
|
|
240
240
|
w !== "days" && /* @__PURE__ */ m("button", {
|
|
241
241
|
type: "button",
|
|
242
242
|
className: "ssg-dp-foot-btn",
|
|
243
|
-
...R(
|
|
243
|
+
...R(W),
|
|
244
244
|
children: _.calendarBack
|
|
245
245
|
}),
|
|
246
246
|
/* @__PURE__ */ m("button", {
|
|
@@ -263,15 +263,15 @@ function W({ value: e, onCommit: t, ariaLabel: r, inputRef: a, onRequestClose: l
|
|
|
263
263
|
}
|
|
264
264
|
//#endregion
|
|
265
265
|
//#region src/view/ColumnFilterPopover.tsx
|
|
266
|
-
var
|
|
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
267
|
...e,
|
|
268
268
|
label: t
|
|
269
269
|
} : e);
|
|
270
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(() =>
|
|
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
272
|
count: k.length,
|
|
273
273
|
getScrollElement: () => j.current,
|
|
274
|
-
estimateSize: () =>
|
|
274
|
+
estimateSize: () => W,
|
|
275
275
|
overscan: 10
|
|
276
276
|
}), N = a(() => {
|
|
277
277
|
if (i === null) return k.length;
|
|
@@ -348,7 +348,7 @@ function te({ options: e, setSelection: i, searchInputRef: c, onValueToggle: l,
|
|
|
348
348
|
onChange: () => l(t.value)
|
|
349
349
|
}), /* @__PURE__ */ m("span", {
|
|
350
350
|
className: "ssg-filter-option-label",
|
|
351
|
-
children:
|
|
351
|
+
children: G(t.value, t.label, w.blank)
|
|
352
352
|
})]
|
|
353
353
|
}, t.value);
|
|
354
354
|
})
|
|
@@ -505,7 +505,7 @@ function ae({ draft: e, valueInputRef: t, onDraftChange: r, onKeyDown: i, preset
|
|
|
505
505
|
onChange: (e) => d("value1", e),
|
|
506
506
|
ariaLabel: u === 2 ? l.filterStartDate : l.filterDate,
|
|
507
507
|
slot: u === 2 ? "from" : "single"
|
|
508
|
-
}) : /* @__PURE__ */ m(
|
|
508
|
+
}) : /* @__PURE__ */ m(U, {
|
|
509
509
|
value: e.value1,
|
|
510
510
|
onCommit: (t) => r({
|
|
511
511
|
...e,
|
|
@@ -523,7 +523,7 @@ function ae({ draft: e, valueInputRef: t, onDraftChange: r, onKeyDown: i, preset
|
|
|
523
523
|
onChange: (e) => d("value2", e),
|
|
524
524
|
ariaLabel: l.filterEndDate,
|
|
525
525
|
slot: "to"
|
|
526
|
-
}) : /* @__PURE__ */ m(
|
|
526
|
+
}) : /* @__PURE__ */ m(U, {
|
|
527
527
|
value: e.value2,
|
|
528
528
|
onCommit: (t) => r({
|
|
529
529
|
...e,
|
|
@@ -561,14 +561,14 @@ function ae({ draft: e, valueInputRef: t, onDraftChange: r, onKeyDown: i, preset
|
|
|
561
561
|
] });
|
|
562
562
|
}
|
|
563
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(() =>
|
|
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
565
|
e,
|
|
566
566
|
D,
|
|
567
567
|
C
|
|
568
568
|
]), N = o(null), P = k ? j.length : M.length, F = t({
|
|
569
569
|
count: P,
|
|
570
570
|
getScrollElement: () => N.current,
|
|
571
|
-
estimateSize: () =>
|
|
571
|
+
estimateSize: () => W,
|
|
572
572
|
overscan: 10
|
|
573
573
|
}), I = a(() => (k ? j : e).map((e) => e.value), [
|
|
574
574
|
k,
|
|
@@ -578,34 +578,41 @@ function oe({ options: e, setSelection: i, searchInputRef: c, onValueToggle: l,
|
|
|
578
578
|
let e = 0;
|
|
579
579
|
for (let t of I) S(i, t) && (e += 1);
|
|
580
580
|
return e;
|
|
581
|
-
}, [I, i]), R = I.length > 0 && L === I.length, z = L > 0 && !R,
|
|
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
582
|
if (i === null) return e.length;
|
|
583
583
|
let t = 0;
|
|
584
|
-
for (let e of i.values)
|
|
584
|
+
for (let e of i.values) ee.has(e) && (t += 1);
|
|
585
585
|
return i.mode === "include" ? t : e.length - t;
|
|
586
586
|
}, [
|
|
587
587
|
i,
|
|
588
|
-
|
|
588
|
+
ee,
|
|
589
589
|
e.length
|
|
590
|
-
]),
|
|
590
|
+
]), V = (e) => {
|
|
591
591
|
O((t) => {
|
|
592
592
|
let n = new Set(t);
|
|
593
593
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
594
594
|
});
|
|
595
|
-
},
|
|
595
|
+
}, U = (e) => {
|
|
596
596
|
let t = 0;
|
|
597
597
|
for (let n of e) S(i, n) && (t += 1);
|
|
598
598
|
return t;
|
|
599
599
|
}, te = (e) => {
|
|
600
|
-
|
|
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;
|
|
601
608
|
return /* @__PURE__ */ h(p, { children: [
|
|
602
609
|
e.type === "group" ? /* @__PURE__ */ m("button", {
|
|
603
610
|
type: "button",
|
|
604
611
|
onPointerDown: (t) => {
|
|
605
|
-
t.preventDefault(), t.stopPropagation(),
|
|
612
|
+
t.preventDefault(), t.stopPropagation(), V(e.key);
|
|
606
613
|
},
|
|
607
614
|
onKeyDown: (t) => {
|
|
608
|
-
q(t), (t.key === "Enter" || t.key === " ") && (t.preventDefault(),
|
|
615
|
+
q(t), (t.key === "Enter" || t.key === " ") && (t.preventDefault(), V(e.key));
|
|
609
616
|
},
|
|
610
617
|
className: "ssg-filter-tree-toggle",
|
|
611
618
|
"aria-label": e.expanded ? C.treeCollapse : C.treeExpand,
|
|
@@ -617,18 +624,12 @@ function oe({ options: e, setSelection: i, searchInputRef: c, onValueToggle: l,
|
|
|
617
624
|
ref: (e) => {
|
|
618
625
|
e && (e.indeterminate = r);
|
|
619
626
|
},
|
|
620
|
-
"aria-label":
|
|
621
|
-
onChange: () =>
|
|
622
|
-
if (e.type === "leaf") {
|
|
623
|
-
l(e.key);
|
|
624
|
-
return;
|
|
625
|
-
}
|
|
626
|
-
u(e.leafKeys, !n);
|
|
627
|
-
}
|
|
627
|
+
"aria-label": G(e.key, e.label, C.blank),
|
|
628
|
+
onChange: () => te(e)
|
|
628
629
|
}),
|
|
629
630
|
/* @__PURE__ */ m("span", {
|
|
630
631
|
className: "ssg-filter-option-label",
|
|
631
|
-
children:
|
|
632
|
+
children: G(e.key, e.label, C.blank)
|
|
632
633
|
})
|
|
633
634
|
] });
|
|
634
635
|
};
|
|
@@ -689,7 +690,7 @@ function oe({ options: e, setSelection: i, searchInputRef: c, onValueToggle: l,
|
|
|
689
690
|
onChange: () => l(t.value)
|
|
690
691
|
}), /* @__PURE__ */ m("span", {
|
|
691
692
|
className: "ssg-filter-option-label",
|
|
692
|
-
children:
|
|
693
|
+
children: G(t.value, t.label, C.blank)
|
|
693
694
|
})]
|
|
694
695
|
}, t.value) : null;
|
|
695
696
|
}
|
|
@@ -701,7 +702,10 @@ function oe({ options: e, setSelection: i, searchInputRef: c, onValueToggle: l,
|
|
|
701
702
|
height: e.size,
|
|
702
703
|
paddingLeft: 8 + t.depth * 16
|
|
703
704
|
},
|
|
704
|
-
|
|
705
|
+
onClick: (e) => {
|
|
706
|
+
e.target.closest("button, input") || te(t);
|
|
707
|
+
},
|
|
708
|
+
children: ne(t)
|
|
705
709
|
}, t.key) : null;
|
|
706
710
|
})
|
|
707
711
|
})
|
|
@@ -710,7 +714,7 @@ function oe({ options: e, setSelection: i, searchInputRef: c, onValueToggle: l,
|
|
|
710
714
|
className: "ssg-filter-meta",
|
|
711
715
|
children: [
|
|
712
716
|
f(C.filterSelectedCount, {
|
|
713
|
-
selected:
|
|
717
|
+
selected: B,
|
|
714
718
|
total: e.length
|
|
715
719
|
}),
|
|
716
720
|
k ? f(C.filterShownCount, { count: j.length }) : "",
|
|
@@ -809,228 +813,242 @@ function le({ conditionEditor: e, conditionActive: t, onConditionClear: r, optio
|
|
|
809
813
|
})
|
|
810
814
|
] });
|
|
811
815
|
}
|
|
812
|
-
function
|
|
813
|
-
let
|
|
814
|
-
if (e(
|
|
815
|
-
let
|
|
816
|
-
top:
|
|
817
|
-
left:
|
|
818
|
-
width:
|
|
819
|
-
maxHeight:
|
|
820
|
-
}, xe = (e) => {
|
|
821
|
-
e.stopPropagation(), e.key === "Escape" && !u(e.nativeEvent) && !d(e.nativeEvent) && (e.preventDefault(), Z());
|
|
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
|
|
822
824
|
}, Se = (e) => {
|
|
825
|
+
e.stopPropagation(), e.key === "Escape" && !u(e.nativeEvent) && !d(e.nativeEvent) && (e.preventDefault(), X());
|
|
826
|
+
}, Ce = (e) => {
|
|
823
827
|
if (e.key !== "Tab" || e.altKey || e.ctrlKey || e.metaKey || d(e.nativeEvent)) return;
|
|
824
828
|
let t = y(e.currentTarget, e.target instanceof Element ? e.target : null, e.shiftKey);
|
|
825
829
|
t !== null && (e.preventDefault(), t.focus());
|
|
826
|
-
},
|
|
830
|
+
}, we = (e) => {
|
|
827
831
|
e.stopPropagation();
|
|
828
|
-
},
|
|
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) => {
|
|
829
833
|
if (e.stopPropagation(), !d(e.nativeEvent)) {
|
|
830
834
|
if (e.key === "Enter") {
|
|
831
|
-
e.preventDefault(),
|
|
835
|
+
e.preventDefault(), Z();
|
|
832
836
|
return;
|
|
833
837
|
}
|
|
834
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
838
|
+
e.key === "Escape" && (e.preventDefault(), X());
|
|
835
839
|
}
|
|
836
|
-
}, Ve =
|
|
837
|
-
draft:
|
|
838
|
-
valueInputRef:
|
|
840
|
+
}, Ve = Ee ? /* @__PURE__ */ m(re, {
|
|
841
|
+
draft: Me,
|
|
842
|
+
valueInputRef: Y,
|
|
839
843
|
onDraftChange: x,
|
|
840
844
|
onKeyDown: Be
|
|
841
|
-
}) :
|
|
842
|
-
draft:
|
|
843
|
-
valueInputRef:
|
|
845
|
+
}) : De ? /* @__PURE__ */ m(ie, {
|
|
846
|
+
draft: Ne,
|
|
847
|
+
valueInputRef: Y,
|
|
844
848
|
onDraftChange: w,
|
|
845
849
|
onKeyDown: Be
|
|
846
850
|
}) : /* @__PURE__ */ m(ae, {
|
|
847
|
-
draft:
|
|
848
|
-
valueInputRef:
|
|
851
|
+
draft: Pe,
|
|
852
|
+
valueInputRef: Y,
|
|
849
853
|
onDraftChange: k,
|
|
850
854
|
onKeyDown: Be,
|
|
851
|
-
presets:
|
|
855
|
+
presets: Fe,
|
|
852
856
|
renderDateInput: N,
|
|
853
|
-
onRequestClose:
|
|
857
|
+
onRequestClose: X
|
|
854
858
|
});
|
|
855
859
|
return l(/* @__PURE__ */ h("div", {
|
|
856
|
-
ref:
|
|
857
|
-
onPointerDown:
|
|
858
|
-
onKeyDown:
|
|
859
|
-
onKeyDownCapture:
|
|
860
|
+
ref: ue,
|
|
861
|
+
onPointerDown: we,
|
|
862
|
+
onKeyDown: Se,
|
|
863
|
+
onKeyDownCapture: Ce,
|
|
860
864
|
onPasteCapture: (e) => {
|
|
861
865
|
e.stopPropagation();
|
|
862
866
|
},
|
|
863
867
|
className: c("ssg-filter-popover", r, i?.className),
|
|
864
868
|
style: {
|
|
865
869
|
...i?.style,
|
|
866
|
-
...
|
|
870
|
+
...xe
|
|
867
871
|
},
|
|
868
872
|
role: "dialog",
|
|
869
|
-
"aria-label": f(
|
|
873
|
+
"aria-label": f(Q.filterTitle, { column: a }),
|
|
874
|
+
tabIndex: -1,
|
|
870
875
|
children: [
|
|
871
876
|
/* @__PURE__ */ m("div", {
|
|
872
877
|
className: "ssg-filter-title",
|
|
873
|
-
children: f(
|
|
878
|
+
children: f(Q.filterTitle, { column: a })
|
|
874
879
|
}),
|
|
875
|
-
(
|
|
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", {
|
|
876
894
|
className: "ssg-filter-collecting",
|
|
877
|
-
children: f(
|
|
878
|
-
}) : (
|
|
895
|
+
children: f(Q.filterCollecting, { percent: Math.round(U * 100) })
|
|
896
|
+
}) : (Ae || g === "select") && je ? ke ? /* @__PURE__ */ m(le, {
|
|
879
897
|
conditionEditor: Ve,
|
|
880
|
-
conditionActive:
|
|
898
|
+
conditionActive: ze,
|
|
881
899
|
onConditionClear: I,
|
|
882
|
-
options:
|
|
900
|
+
options: $,
|
|
883
901
|
setSelection: J,
|
|
884
902
|
onSelectionClear: R,
|
|
885
903
|
summaryText: z,
|
|
886
|
-
optionsMeta:
|
|
904
|
+
optionsMeta: H === "loading" ? Q.filterOptionsLoadingShort : Q.filterOptionsFailedShort,
|
|
887
905
|
children: /* @__PURE__ */ m(se, {
|
|
888
|
-
status:
|
|
889
|
-
errorMessage:
|
|
906
|
+
status: H === "loading" ? "loading" : "error",
|
|
907
|
+
errorMessage: K,
|
|
890
908
|
onRetry: ne
|
|
891
909
|
})
|
|
892
910
|
}) : /* @__PURE__ */ m(se, {
|
|
893
|
-
status:
|
|
894
|
-
errorMessage:
|
|
911
|
+
status: H === "loading" ? "loading" : "error",
|
|
912
|
+
errorMessage: K,
|
|
895
913
|
onRetry: ne
|
|
896
|
-
}) :
|
|
914
|
+
}) : ke ? /* @__PURE__ */ m(le, {
|
|
897
915
|
conditionEditor: Ve,
|
|
898
|
-
conditionActive:
|
|
916
|
+
conditionActive: ze,
|
|
899
917
|
onConditionClear: I,
|
|
900
|
-
options:
|
|
918
|
+
options: $,
|
|
901
919
|
setSelection: J,
|
|
902
920
|
onSelectionClear: R,
|
|
903
921
|
summaryText: z,
|
|
904
|
-
children:
|
|
905
|
-
options:
|
|
922
|
+
children: Oe ? /* @__PURE__ */ m(oe, {
|
|
923
|
+
options: $,
|
|
906
924
|
setSelection: J,
|
|
907
|
-
searchInputRef:
|
|
908
|
-
onValueToggle:
|
|
909
|
-
onSelectAllChange:
|
|
910
|
-
onReplaceSelection:
|
|
911
|
-
onRequestClose:
|
|
912
|
-
isServerSide:
|
|
913
|
-
truncated:
|
|
925
|
+
searchInputRef: ye,
|
|
926
|
+
onValueToggle: me,
|
|
927
|
+
onSelectAllChange: he,
|
|
928
|
+
onReplaceSelection: _e,
|
|
929
|
+
onRequestClose: X,
|
|
930
|
+
isServerSide: ve,
|
|
931
|
+
truncated: W
|
|
914
932
|
}) : /* @__PURE__ */ m(te, {
|
|
915
|
-
options:
|
|
933
|
+
options: $,
|
|
916
934
|
setSelection: J,
|
|
917
|
-
searchInputRef:
|
|
918
|
-
onValueToggle:
|
|
919
|
-
onSelectAllChange:
|
|
920
|
-
onReplaceSelection:
|
|
921
|
-
onRequestClose:
|
|
922
|
-
isServerSide:
|
|
935
|
+
searchInputRef: ye,
|
|
936
|
+
onValueToggle: me,
|
|
937
|
+
onSelectAllChange: he,
|
|
938
|
+
onReplaceSelection: _e,
|
|
939
|
+
onRequestClose: X,
|
|
940
|
+
isServerSide: ve,
|
|
923
941
|
selectAllUsesExplicitScope: !0,
|
|
924
|
-
truncated:
|
|
942
|
+
truncated: W
|
|
925
943
|
})
|
|
926
|
-
}) :
|
|
927
|
-
options:
|
|
944
|
+
}) : Te ? /* @__PURE__ */ m(te, {
|
|
945
|
+
options: V,
|
|
928
946
|
setSelection: J,
|
|
929
|
-
searchInputRef:
|
|
930
|
-
onValueToggle:
|
|
931
|
-
onSelectAllChange:
|
|
932
|
-
onReplaceSelection:
|
|
933
|
-
onRequestClose:
|
|
934
|
-
isServerSide:
|
|
935
|
-
truncated:
|
|
947
|
+
searchInputRef: Y,
|
|
948
|
+
onValueToggle: me,
|
|
949
|
+
onSelectAllChange: he,
|
|
950
|
+
onReplaceSelection: _e,
|
|
951
|
+
onRequestClose: X,
|
|
952
|
+
isServerSide: ve,
|
|
953
|
+
truncated: W
|
|
936
954
|
}) : g === "number" ? /* @__PURE__ */ m(p, { children: /* @__PURE__ */ m(re, {
|
|
937
|
-
draft:
|
|
938
|
-
valueInputRef:
|
|
955
|
+
draft: Me,
|
|
956
|
+
valueInputRef: Y,
|
|
939
957
|
onDraftChange: x,
|
|
940
958
|
onKeyDown: Be
|
|
941
959
|
}) }) : g === "select" ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ h("select", {
|
|
942
|
-
ref:
|
|
960
|
+
ref: de,
|
|
943
961
|
value: v,
|
|
944
|
-
onChange: (e) =>
|
|
962
|
+
onChange: (e) => fe(e.target.value),
|
|
945
963
|
onKeyDown: (e) => {
|
|
946
964
|
if (e.stopPropagation(), e.key === "Enter") {
|
|
947
|
-
e.preventDefault(),
|
|
965
|
+
e.preventDefault(), Z();
|
|
948
966
|
return;
|
|
949
967
|
}
|
|
950
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
968
|
+
e.key === "Escape" && (e.preventDefault(), X());
|
|
951
969
|
},
|
|
952
970
|
className: "ssg-filter-select",
|
|
953
971
|
children: [/* @__PURE__ */ m("option", {
|
|
954
972
|
value: "",
|
|
955
|
-
children:
|
|
956
|
-
}),
|
|
973
|
+
children: Q.filterAll
|
|
974
|
+
}), V.map((e) => /* @__PURE__ */ m("option", {
|
|
957
975
|
value: e.value,
|
|
958
|
-
children:
|
|
976
|
+
children: G(e.value, e.label, Q.blank)
|
|
959
977
|
}, `${a}-${e.value}`))]
|
|
960
978
|
}), /* @__PURE__ */ h("div", {
|
|
961
979
|
className: "ssg-filter-meta",
|
|
962
|
-
children: [f(
|
|
980
|
+
children: [f(Q.filterOptionCount, { count: V.length }), W && /* @__PURE__ */ m(ce, {})]
|
|
963
981
|
})] }) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("input", {
|
|
964
|
-
ref:
|
|
982
|
+
ref: Y,
|
|
965
983
|
type: "text",
|
|
966
984
|
value: v,
|
|
967
|
-
onChange: (e) =>
|
|
985
|
+
onChange: (e) => fe(e.target.value),
|
|
968
986
|
onKeyDown: (e) => {
|
|
969
987
|
if (e.stopPropagation(), !d(e.nativeEvent)) {
|
|
970
988
|
if (e.key === "Enter") {
|
|
971
|
-
e.preventDefault(),
|
|
989
|
+
e.preventDefault(), Z();
|
|
972
990
|
return;
|
|
973
991
|
}
|
|
974
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
992
|
+
e.key === "Escape" && (e.preventDefault(), X());
|
|
975
993
|
}
|
|
976
994
|
},
|
|
977
|
-
placeholder:
|
|
978
|
-
"aria-label":
|
|
995
|
+
placeholder: Q.filterTextPlaceholder,
|
|
996
|
+
"aria-label": Q.filterTextPlaceholder,
|
|
979
997
|
className: "ssg-filter-input"
|
|
980
998
|
}), /* @__PURE__ */ m("div", {
|
|
981
999
|
className: "ssg-filter-meta ssg-filter-meta--ellipsis",
|
|
982
|
-
children:
|
|
1000
|
+
children: Q.filterTextHint
|
|
983
1001
|
})] }),
|
|
984
|
-
!
|
|
1002
|
+
!Ae && /* @__PURE__ */ m("div", {
|
|
985
1003
|
className: "ssg-filter-meta ssg-filter-meta--ellipsis",
|
|
986
|
-
children: f(
|
|
1004
|
+
children: f(Q.filterCurrentValue, { value: ee })
|
|
987
1005
|
}),
|
|
988
1006
|
/* @__PURE__ */ m("div", {
|
|
989
1007
|
className: "ssg-filter-footer",
|
|
990
|
-
children:
|
|
1008
|
+
children: Ae ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("button", {
|
|
991
1009
|
type: "button",
|
|
992
1010
|
onPointerDown: (e) => {
|
|
993
|
-
e.preventDefault(), e.stopPropagation(),
|
|
1011
|
+
e.preventDefault(), e.stopPropagation(), ge();
|
|
994
1012
|
},
|
|
995
1013
|
onKeyDown: (e) => {
|
|
996
|
-
q(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
1014
|
+
q(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), ge());
|
|
997
1015
|
},
|
|
998
1016
|
className: "ssg-filter-btn-secondary",
|
|
999
|
-
children:
|
|
1017
|
+
children: Q.clear
|
|
1000
1018
|
}), /* @__PURE__ */ m("button", {
|
|
1001
1019
|
type: "button",
|
|
1002
1020
|
onPointerDown: (e) => {
|
|
1003
|
-
e.preventDefault(), e.stopPropagation(),
|
|
1021
|
+
e.preventDefault(), e.stopPropagation(), X();
|
|
1004
1022
|
},
|
|
1005
1023
|
onKeyDown: (e) => {
|
|
1006
|
-
q(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
1024
|
+
q(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), X());
|
|
1007
1025
|
},
|
|
1008
1026
|
className: "ssg-filter-btn-primary",
|
|
1009
|
-
children:
|
|
1027
|
+
children: Q.close
|
|
1010
1028
|
})] }) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("button", {
|
|
1011
1029
|
type: "button",
|
|
1012
1030
|
onPointerDown: (e) => {
|
|
1013
|
-
e.preventDefault(), e.stopPropagation(),
|
|
1031
|
+
e.preventDefault(), e.stopPropagation(), pe();
|
|
1014
1032
|
},
|
|
1015
1033
|
onKeyDown: (e) => {
|
|
1016
|
-
q(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
1034
|
+
q(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), pe());
|
|
1017
1035
|
},
|
|
1018
1036
|
className: "ssg-filter-btn-secondary",
|
|
1019
|
-
children:
|
|
1037
|
+
children: Q.clear
|
|
1020
1038
|
}), /* @__PURE__ */ m("button", {
|
|
1021
1039
|
type: "button",
|
|
1022
1040
|
onPointerDown: (e) => {
|
|
1023
|
-
e.preventDefault(), e.stopPropagation(),
|
|
1041
|
+
e.preventDefault(), e.stopPropagation(), Z();
|
|
1024
1042
|
},
|
|
1025
1043
|
onKeyDown: (e) => {
|
|
1026
|
-
q(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
1044
|
+
q(e), (e.key === "Enter" || e.key === " ") && (e.preventDefault(), Z());
|
|
1027
1045
|
},
|
|
1028
1046
|
className: "ssg-filter-btn-primary",
|
|
1029
|
-
children:
|
|
1047
|
+
children: Q.apply
|
|
1030
1048
|
})] })
|
|
1031
1049
|
})
|
|
1032
1050
|
]
|
|
1033
1051
|
}), document.body);
|
|
1034
1052
|
}
|
|
1035
1053
|
//#endregion
|
|
1036
|
-
export {
|
|
1054
|
+
export { ue as ColumnFilterPopover, ue as default };
|
package/dist/ai/GridAskBar.d.ts
CHANGED
|
@@ -2,15 +2,15 @@ import type { GridTheme } from '../model/gridTypes.js';
|
|
|
2
2
|
import { type UseGridAskOptions } from './useGridAsk.js';
|
|
3
3
|
export type GridAskBarProps<T> = UseGridAskOptions<T> & {
|
|
4
4
|
/** 入力欄の下に出す例の文(押すとその文で聞く)。 */
|
|
5
|
-
examples?: readonly string[];
|
|
5
|
+
examples?: readonly string[] | undefined;
|
|
6
6
|
/** 入力欄のプレースホルダー(既定は文言の `placeholder`)。 */
|
|
7
|
-
placeholder?: string;
|
|
7
|
+
placeholder?: string | undefined;
|
|
8
8
|
/** 入力欄のラベル(読み上げ用。既定は文言の `label`)。 */
|
|
9
|
-
label?: string;
|
|
9
|
+
label?: string | undefined;
|
|
10
10
|
/** バーの root に足すクラス。 */
|
|
11
|
-
className?: string;
|
|
11
|
+
className?: string | undefined;
|
|
12
12
|
/** 配色(グリッドの `theme` と同じ値を渡す)。 */
|
|
13
|
-
theme?: GridTheme;
|
|
13
|
+
theme?: GridTheme | undefined;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* ことばで絞り込み・並べ替えをする入力欄です(グリッドの上に置く)。AI は利用側の `ask` で呼びます。
|
package/dist/ai/useGridAsk.d.ts
CHANGED
|
@@ -30,21 +30,21 @@ export type UseGridAskOptions<T> = {
|
|
|
30
30
|
/** AI に聞く関数。 */
|
|
31
31
|
ask: GridAsk;
|
|
32
32
|
/** 列ごとの補足(単位や値の書き方)。`false` でその列を AI に見せない。 */
|
|
33
|
-
columnHints?: Readonly<Record<string, string | false
|
|
33
|
+
columnHints?: Readonly<Record<string, string | false>> | undefined;
|
|
34
34
|
/** 列の条件(フィルター)を変えてよいか(既定 true)。 */
|
|
35
|
-
allowFilter?: boolean;
|
|
35
|
+
allowFilter?: boolean | undefined;
|
|
36
36
|
/** 並びを変えてよいか(既定 true)。 */
|
|
37
|
-
allowSort?: boolean;
|
|
37
|
+
allowSort?: boolean | undefined;
|
|
38
38
|
/** グローバル検索の文字を変えてよいか(既定 true)。 */
|
|
39
|
-
allowSearch?: boolean;
|
|
39
|
+
allowSearch?: boolean | undefined;
|
|
40
40
|
/** 列を隠す・見せるのを許す(既定 false。グリッドに onColumnsChange を渡しているときに付ける)。 */
|
|
41
|
-
allowColumnVisibility?: boolean;
|
|
41
|
+
allowColumnVisibility?: boolean | undefined;
|
|
42
42
|
/** 反映したあとに呼ぶ。 */
|
|
43
|
-
onApply?: (event: GridAskApplyEvent) => void;
|
|
43
|
+
onApply?: ((event: GridAskApplyEvent) => void) | undefined;
|
|
44
44
|
/** ask が失敗したとき(throw / reject)に呼ぶ。止めたときは呼ばない。 */
|
|
45
|
-
onError?: (error: unknown) => void;
|
|
45
|
+
onError?: ((error: unknown) => void) | undefined;
|
|
46
46
|
/** 文言(既定は日本語。英語は `gridAskLocaleTextEn`。一部だけ渡すと残りは既定)。 */
|
|
47
|
-
localeText?: Partial<GridAskLocaleText
|
|
47
|
+
localeText?: Partial<GridAskLocaleText> | undefined;
|
|
48
48
|
};
|
|
49
49
|
/** 最後の頼みの結果です。 */
|
|
50
50
|
export type GridAskSession = {
|