@vjdesigns/vjdesigns-ui 2.5.0 → 3.0.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/dist/ai/llms-full.txt +9 -1
- package/dist/ai/registry.json +44 -1
- package/dist/components/data-display/DataGrid/DataGrid.cjs.js +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.d.ts +46 -1
- package/dist/components/data-display/DataGrid/DataGrid.mjs +266 -241
- package/dist/components/data-display/DataGrid/DataGrid.module.css.cjs.js +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.module.css.mjs +28 -26
- package/dist/components/forms/DatePicker/index.d.ts +1 -1
- package/dist/components/forms/SegmentedControl/SegmentedControl.module.css.cjs.js +1 -1
- package/dist/components/forms/SegmentedControl/SegmentedControl.module.css.mjs +1 -1
- package/dist/components/forms/TimePicker/TimePicker.cjs.js +1 -1
- package/dist/components/forms/TimePicker/TimePicker.mjs +57 -57
- package/dist/components/forms/TimePicker/index.d.ts +1 -0
- package/dist/i18n/en.cjs.js +1 -1
- package/dist/i18n/en.mjs +193 -2
- package/dist/i18n/types.d.ts +240 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +22 -22
- package/dist/locales/ar.cjs.js +1 -1
- package/dist/locales/ar.mjs +229 -2
- package/dist/locales/bn.cjs.js +1 -1
- package/dist/locales/bn.mjs +166 -2
- package/dist/locales/cs.cjs.js +1 -1
- package/dist/locales/cs.mjs +211 -2
- package/dist/locales/da.cjs.js +1 -1
- package/dist/locales/da.mjs +193 -2
- package/dist/locales/de.cjs.js +1 -1
- package/dist/locales/de.mjs +193 -2
- package/dist/locales/el.cjs.js +1 -1
- package/dist/locales/el.mjs +193 -2
- package/dist/locales/es.cjs.js +1 -1
- package/dist/locales/es.mjs +193 -2
- package/dist/locales/fa.cjs.js +1 -1
- package/dist/locales/fa.mjs +166 -2
- package/dist/locales/fi.cjs.js +1 -1
- package/dist/locales/fi.mjs +193 -2
- package/dist/locales/fr.cjs.js +1 -1
- package/dist/locales/fr.mjs +193 -2
- package/dist/locales/he.cjs.js +1 -1
- package/dist/locales/he.mjs +202 -2
- package/dist/locales/hi.cjs.js +1 -1
- package/dist/locales/hi.mjs +193 -2
- package/dist/locales/hu.cjs.js +1 -1
- package/dist/locales/hu.mjs +166 -2
- package/dist/locales/id.cjs.js +1 -1
- package/dist/locales/id.mjs +166 -2
- package/dist/locales/it.cjs.js +1 -1
- package/dist/locales/it.mjs +193 -2
- package/dist/locales/ja.cjs.js +1 -1
- package/dist/locales/ja.mjs +166 -2
- package/dist/locales/ko.cjs.js +1 -1
- package/dist/locales/ko.mjs +166 -2
- package/dist/locales/nb.cjs.js +1 -1
- package/dist/locales/nb.mjs +193 -2
- package/dist/locales/nl.cjs.js +1 -1
- package/dist/locales/nl.mjs +193 -2
- package/dist/locales/pl.cjs.js +1 -1
- package/dist/locales/pl.mjs +211 -2
- package/dist/locales/pt-BR.cjs.js +1 -1
- package/dist/locales/pt-BR.mjs +193 -2
- package/dist/locales/ro.cjs.js +1 -1
- package/dist/locales/ro.mjs +202 -2
- package/dist/locales/ru.cjs.js +1 -1
- package/dist/locales/ru.mjs +211 -2
- package/dist/locales/sv.cjs.js +1 -1
- package/dist/locales/sv.mjs +193 -2
- package/dist/locales/th.cjs.js +1 -1
- package/dist/locales/th.mjs +166 -2
- package/dist/locales/tr.cjs.js +1 -1
- package/dist/locales/tr.mjs +166 -2
- package/dist/locales/uk.cjs.js +1 -1
- package/dist/locales/uk.mjs +211 -2
- package/dist/locales/ur.cjs.js +1 -1
- package/dist/locales/ur.mjs +193 -2
- package/dist/locales/vi.cjs.js +1 -1
- package/dist/locales/vi.mjs +166 -2
- package/dist/locales/zh-Hans.cjs.js +1 -1
- package/dist/locales/zh-Hans.mjs +166 -2
- package/dist/locales/zh-Hant.cjs.js +1 -1
- package/dist/locales/zh-Hant.mjs +166 -2
- package/dist/vjdesigns-ui.css +1 -1
- package/package.json +103 -100
|
@@ -8,31 +8,31 @@ import { CheckBox as o } from "../../forms/CheckBox/CheckBox.mjs";
|
|
|
8
8
|
import { Spinner as s } from "../../feedback/Spinner/Spinner.mjs";
|
|
9
9
|
import { ScrollArea as c } from "../../layout/ScrollArea/ScrollArea.mjs";
|
|
10
10
|
import { Pagination as l } from "../../navigation/Pagination/Pagination.mjs";
|
|
11
|
-
import { ArrowDownIcon as u, ArrowUpIcon as
|
|
12
|
-
import { useLocale as
|
|
13
|
-
import { compareValues as
|
|
14
|
-
import
|
|
15
|
-
import { Fragment as
|
|
16
|
-
import { Fragment as
|
|
11
|
+
import { ArrowDownIcon as u, ArrowUpIcon as d, SortIcon as ee } from "../../primitives/Icon/icons.mjs";
|
|
12
|
+
import { useLocale as te } from "../../utilities/LocaleProvider/LocaleProvider.mjs";
|
|
13
|
+
import { compareValues as f, createSearchIndex as ne, filterRows as p, getCellValue as re, matchesWords as ie, searchWords as ae, sortIndices as oe, sortRows as m } from "./dataGridUtils.mjs";
|
|
14
|
+
import h from "./DataGrid.module.css.mjs";
|
|
15
|
+
import { Fragment as se, useDeferredValue as ce, useEffect as g, useId as le, useLayoutEffect as _, useMemo as v, useRef as y, useState as b } from "react";
|
|
16
|
+
import { Fragment as ue, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
17
17
|
// src/components/data-display/DataGrid/DataGrid.tsx
|
|
18
|
-
var
|
|
19
|
-
compact:
|
|
20
|
-
comfortable:
|
|
21
|
-
spacious:
|
|
22
|
-
},
|
|
23
|
-
plain:
|
|
24
|
-
striped:
|
|
25
|
-
outline:
|
|
26
|
-
},
|
|
27
|
-
start:
|
|
28
|
-
center:
|
|
29
|
-
end:
|
|
30
|
-
},
|
|
18
|
+
var de = {
|
|
19
|
+
compact: h.compact,
|
|
20
|
+
comfortable: h.comfortable,
|
|
21
|
+
spacious: h.spacious
|
|
22
|
+
}, fe = {
|
|
23
|
+
plain: h.plain,
|
|
24
|
+
striped: h.striped,
|
|
25
|
+
outline: h.outline
|
|
26
|
+
}, pe = {
|
|
27
|
+
start: h.alignStart,
|
|
28
|
+
center: h.alignCenter,
|
|
29
|
+
end: h.alignEnd
|
|
30
|
+
}, me = 10, he = 100, ge = 2e3, _e = {
|
|
31
31
|
compact: 37,
|
|
32
32
|
comfortable: 49,
|
|
33
33
|
spacious: 65
|
|
34
|
-
},
|
|
35
|
-
function
|
|
34
|
+
}, ve = "a[href],button:not([disabled]),input:not([disabled]):not([type='hidden']),select:not([disabled]),textarea:not([disabled]),[contenteditable='true'],[data-grid-widget]", C = (e) => Array.from(e.querySelectorAll(ve)), ye = `[data-cell], [data-cell] :is(${ve})`;
|
|
35
|
+
function be(e) {
|
|
36
36
|
return e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement ? !0 : e instanceof HTMLInputElement ? ![
|
|
37
37
|
"checkbox",
|
|
38
38
|
"radio",
|
|
@@ -44,92 +44,92 @@ function Se(e) {
|
|
|
44
44
|
"image"
|
|
45
45
|
].includes(e.type) : e.getAttribute("contenteditable") === "true";
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
let t =
|
|
49
|
-
return t.length === 1 && !
|
|
47
|
+
function xe(e) {
|
|
48
|
+
let t = C(e).filter((e) => !e.hasAttribute("data-grid-secondary"));
|
|
49
|
+
return t.length === 1 && !be(t[0]) ? t[0] : e;
|
|
50
50
|
}
|
|
51
|
-
var
|
|
51
|
+
var Se = (e) => {
|
|
52
52
|
let [t, n] = (e.getAttribute("data-cell") ?? "0:0").split(":").map(Number);
|
|
53
53
|
return [t, n];
|
|
54
|
-
},
|
|
55
|
-
function
|
|
56
|
-
let { messages: O, locale: k } =
|
|
54
|
+
}, Ce = (e) => typeof e == "number" ? `${e}px` : e, we = (e) => e.id;
|
|
55
|
+
function Te({ rows: f, columns: p, getRowId: m = we, getRowLabel: be, "aria-label": Te, "aria-labelledby": Ee, "aria-describedby": De, sort: Oe, defaultSort: ke, onSortChange: Ae, multiSort: je = !0, filter: Me, selectionMode: w = "none", selected: Ne, defaultSelected: Pe, onSelectedChange: Fe, isRowSelectable: Ie, pageSize: T, virtualize: Le = "auto", page: Re, defaultPage: ze = 1, onPageChange: Be, manual: E = !1, rowCount: Ve, onRowActivate: D, loading: He = !1, emptyState: Ue, density: We = "comfortable", variant: Ge = "outline", hoverable: Ke = !0, stickyHeader: qe = !0, maxHeight: Je, layout: Ye, tableStyle: Xe, treegrid: Ze = !1, getRowProps: Qe, renderRowDetail: $e, onRowsShown: et, onVisibleRangeChange: tt, className: nt, style: rt, ref: it }) {
|
|
56
|
+
let { messages: O, locale: k } = te(), A = O.dataGrid, j = y(null), at = le(), ot = `${at}-pages`, st = `${at}-name`, ct = t(j, it), [M, lt] = e({
|
|
57
57
|
value: Oe,
|
|
58
58
|
defaultValue: ke ?? [],
|
|
59
59
|
onChange: Ae
|
|
60
|
-
}), [N,
|
|
60
|
+
}), [N, ut] = e({
|
|
61
61
|
value: Ne,
|
|
62
62
|
defaultValue: Pe ?? [],
|
|
63
63
|
onChange: Fe
|
|
64
|
-
}), [
|
|
64
|
+
}), [dt, ft] = e({
|
|
65
65
|
value: Re,
|
|
66
66
|
defaultValue: ze,
|
|
67
67
|
onChange: Be
|
|
68
|
-
}), P =
|
|
68
|
+
}), P = v(() => E ? null : oe(f, M, p, k), [
|
|
69
69
|
E,
|
|
70
|
-
d,
|
|
71
|
-
M,
|
|
72
70
|
f,
|
|
71
|
+
M,
|
|
72
|
+
p,
|
|
73
73
|
k
|
|
74
|
-
]), F =
|
|
75
|
-
|
|
76
|
-
if (!
|
|
74
|
+
]), F = v(() => ne(f, p), [f, p]), I = Me ?? "", pt = ce(I), mt = Me !== void 0 && !E;
|
|
75
|
+
g(() => {
|
|
76
|
+
if (!mt || f.length < ge || typeof window > "u") return;
|
|
77
77
|
let e = window.requestIdleCallback ?? ((e) => window.setTimeout(() => e({
|
|
78
78
|
didTimeout: !1,
|
|
79
79
|
timeRemaining: () => 8
|
|
80
80
|
}), 50)), t = window.cancelIdleCallback ?? window.clearTimeout, n = 0, r = 0, i = (t) => {
|
|
81
|
-
for (; n <
|
|
82
|
-
n <
|
|
81
|
+
for (; n < f.length && t.timeRemaining() > 2;) for (let e = Math.min(f.length, n + 1e3); n < e; n++) F.text(n);
|
|
82
|
+
n < f.length && (r = e(i));
|
|
83
83
|
};
|
|
84
84
|
return r = e(i), () => t(r);
|
|
85
85
|
}, [
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
mt,
|
|
87
|
+
f,
|
|
88
88
|
F
|
|
89
89
|
]);
|
|
90
|
-
let L =
|
|
91
|
-
if (E || !P) return
|
|
92
|
-
let e =
|
|
93
|
-
if (e.length === 0) return P.map((e) =>
|
|
90
|
+
let L = v(() => {
|
|
91
|
+
if (E || !P) return f;
|
|
92
|
+
let e = ae(pt);
|
|
93
|
+
if (e.length === 0) return P.map((e) => f[e]);
|
|
94
94
|
let t = [];
|
|
95
|
-
for (let n of P)
|
|
95
|
+
for (let n of P) ie(F.text(n), e) && t.push(f[n]);
|
|
96
96
|
return t;
|
|
97
97
|
}, [
|
|
98
98
|
E,
|
|
99
99
|
P,
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
f,
|
|
101
|
+
pt,
|
|
102
102
|
F
|
|
103
|
-
]), R = E ? Ve ??
|
|
104
|
-
|
|
105
|
-
let e =
|
|
103
|
+
]), R = E ? Ve ?? f.length : L.length, ht = T ? Math.max(1, Math.ceil(R / T)) : 1, z = Math.min(Math.max(1, dt), ht), gt = T && !E ? (z - 1) * T : 0, B = T && !E ? L.slice(gt, gt + T) : L, V = T ? (z - 1) * T : 0, H = !$e && (Le === "auto" ? B.length > he : Le), _t = y(null), vt = y(null), [yt, bt] = b(0);
|
|
104
|
+
_(() => {
|
|
105
|
+
let e = vt.current;
|
|
106
106
|
if (!H || !e) return;
|
|
107
|
-
let t = () =>
|
|
107
|
+
let t = () => bt(e.offsetHeight);
|
|
108
108
|
if (t(), typeof ResizeObserver > "u") return;
|
|
109
109
|
let n = new ResizeObserver(t);
|
|
110
110
|
return n.observe(e), () => n.disconnect();
|
|
111
111
|
}, [H]);
|
|
112
112
|
let U = n({
|
|
113
113
|
count: H ? B.length : 0,
|
|
114
|
-
scrollElement:
|
|
115
|
-
estimateSize:
|
|
116
|
-
paddingStart:
|
|
114
|
+
scrollElement: _t,
|
|
115
|
+
estimateSize: _e[We],
|
|
116
|
+
paddingStart: yt,
|
|
117
117
|
overscan: 10,
|
|
118
118
|
initialCount: 30
|
|
119
|
-
}),
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
}), xt = Je ?? (H ? "70vh" : void 0), St = Ye ?? (H ? "fixed" : "auto"), W = `${I}|${JSON.stringify(M)}`, Ct = y(W);
|
|
120
|
+
g(() => {
|
|
121
|
+
Ct.current !== W && (Ct.current = W, T && z !== 1 && ft(1));
|
|
122
122
|
}, [
|
|
123
123
|
W,
|
|
124
124
|
T,
|
|
125
125
|
z,
|
|
126
|
-
|
|
126
|
+
ft
|
|
127
127
|
]);
|
|
128
|
-
let
|
|
129
|
-
|
|
130
|
-
if (
|
|
128
|
+
let wt = y(I);
|
|
129
|
+
g(() => {
|
|
130
|
+
if (wt.current === I) return;
|
|
131
131
|
let e = window.setTimeout(() => {
|
|
132
|
-
|
|
132
|
+
wt.current = I, a(R === 0 ? A.noResults : A.rowCount(R));
|
|
133
133
|
}, 600);
|
|
134
134
|
return () => window.clearTimeout(e);
|
|
135
135
|
}, [
|
|
@@ -137,35 +137,35 @@ function C({ rows: d, columns: f, getRowId: p = Te, getRowLabel: Se, "aria-label
|
|
|
137
137
|
R,
|
|
138
138
|
A
|
|
139
139
|
]);
|
|
140
|
-
let G = w === "multiple",
|
|
140
|
+
let G = w === "multiple", Tt = w !== "none", Et = +!!G, K = p.length + Et, Dt = p.find((e) => e.rowHeader) ?? p[0], Ot = (e) => be?.(e) ?? String((Dt && re(e, Dt)) ?? m(e)), kt = (e) => e.headerLabel ?? (typeof e.header == "string" ? e.header : e.key), q = v(() => new Set(N), [N]), At = (e) => Ie?.(e) ?? !0, J = v(() => L.filter((e) => Ie?.(e) ?? !0).map(m), [
|
|
141
141
|
L,
|
|
142
142
|
Ie,
|
|
143
|
-
|
|
144
|
-
]), Y =
|
|
143
|
+
m
|
|
144
|
+
]), Y = v(() => {
|
|
145
145
|
let e = 0;
|
|
146
146
|
for (let t of J) q.has(t) && e++;
|
|
147
147
|
return e;
|
|
148
|
-
}, [J, q]),
|
|
148
|
+
}, [J, q]), jt = J.length > 0 && Y === J.length, Mt = Y > 0 && !jt, Nt = y(null), Pt = y(!1), Ft = (e, t, n) => {
|
|
149
149
|
let r = B[e];
|
|
150
|
-
if (!r || !
|
|
151
|
-
let i =
|
|
150
|
+
if (!r || !At(r)) return;
|
|
151
|
+
let i = m(r);
|
|
152
152
|
if (w === "single") {
|
|
153
|
-
|
|
153
|
+
ut(q.has(i) && n !== !0 ? [] : [i]), Nt.current = e;
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
let a = n ?? !q.has(i), o =
|
|
156
|
+
let a = n ?? !q.has(i), o = Nt.current, s = [i];
|
|
157
157
|
if (t && o !== null && o !== e) {
|
|
158
158
|
let [t, n] = o < e ? [o, e] : [e, o];
|
|
159
|
-
s = B.slice(t, n + 1).filter(
|
|
159
|
+
s = B.slice(t, n + 1).filter(At).map(m);
|
|
160
160
|
}
|
|
161
161
|
let c = new Set(N);
|
|
162
162
|
for (let e of s) a ? c.add(e) : c.delete(e);
|
|
163
|
-
|
|
164
|
-
},
|
|
163
|
+
Nt.current = e, ut(Array.from(c));
|
|
164
|
+
}, It = (e) => {
|
|
165
165
|
let t = new Set(N);
|
|
166
166
|
for (let n of J) e ? t.add(n) : t.delete(n);
|
|
167
|
-
|
|
168
|
-
},
|
|
167
|
+
ut(Array.from(t));
|
|
168
|
+
}, Lt = (e, t) => {
|
|
169
169
|
let n = M.find((t) => t.key === e.key), r = n ? n.direction === "ascending" ? "descending" : null : "ascending", i;
|
|
170
170
|
i = t && je ? n ? r ? M.map((t) => t.key === e.key ? {
|
|
171
171
|
key: t.key,
|
|
@@ -176,66 +176,66 @@ function C({ rows: d, columns: f, getRowId: p = Te, getRowLabel: Se, "aria-label
|
|
|
176
176
|
}] : r ? [{
|
|
177
177
|
key: e.key,
|
|
178
178
|
direction: r
|
|
179
|
-
}] : [],
|
|
180
|
-
},
|
|
179
|
+
}] : [], lt(i), a(r ? A.sorted(kt(e), r === "ascending" ? A.ascending : A.descending) : A.sortCleared);
|
|
180
|
+
}, Rt = B.length, [zt, Bt] = b({
|
|
181
181
|
r: 0,
|
|
182
182
|
c: 0
|
|
183
|
-
}), X = Math.min(
|
|
184
|
-
|
|
183
|
+
}), X = Math.min(zt.r, Rt), Vt = Math.min(zt.c, K - 1), [Ht, Z] = b(!1), [Ut, Wt] = b(0), Gt = (e, t) => j.current?.querySelector(`[data-cell="${e}:${t}"]`) ?? null;
|
|
184
|
+
_(() => {
|
|
185
185
|
let e = j.current;
|
|
186
186
|
if (!e) return;
|
|
187
|
-
let t =
|
|
188
|
-
!t && X > 0 && (t = e.querySelector(`tbody [data-cell$=":${
|
|
187
|
+
let t = Gt(X, Vt);
|
|
188
|
+
!t && X > 0 && (t = e.querySelector(`tbody [data-cell$=":${Vt}"]`));
|
|
189
189
|
let n = /* @__PURE__ */ new Set();
|
|
190
190
|
if (t) {
|
|
191
|
-
if (
|
|
192
|
-
else n.add(
|
|
191
|
+
if (Ht) for (let e of C(t)) n.add(e);
|
|
192
|
+
else n.add(xe(t));
|
|
193
193
|
}
|
|
194
|
-
for (let t of e.querySelectorAll(
|
|
194
|
+
for (let t of e.querySelectorAll(ye)) {
|
|
195
195
|
let e = n.has(t) ? "0" : "-1";
|
|
196
196
|
t.getAttribute("tabindex") !== e && t.setAttribute("tabindex", e);
|
|
197
197
|
}
|
|
198
198
|
});
|
|
199
|
-
let
|
|
200
|
-
let e =
|
|
199
|
+
let Kt = y(!1), qt = () => {
|
|
200
|
+
let e = Gt(X, Vt);
|
|
201
201
|
if (!e) return !1;
|
|
202
|
-
let t =
|
|
202
|
+
let t = xe(e);
|
|
203
203
|
return t.focus({ preventScroll: !0 }), (t === e ? e : t).scrollIntoView?.({
|
|
204
204
|
block: "nearest",
|
|
205
205
|
inline: "nearest"
|
|
206
206
|
}), !0;
|
|
207
207
|
};
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}, [
|
|
211
|
-
|
|
208
|
+
_(() => {
|
|
209
|
+
Ut !== 0 && (Kt.current = !qt());
|
|
210
|
+
}, [Ut]), _(() => {
|
|
211
|
+
Kt.current && (qt() ? Kt.current = !1 : H && X > 0 && U.scrollToIndex(X - 1));
|
|
212
212
|
});
|
|
213
213
|
let Q = (e, t) => {
|
|
214
|
-
let n = Math.max(0, Math.min(e,
|
|
215
|
-
Z(!1),
|
|
214
|
+
let n = Math.max(0, Math.min(e, Rt));
|
|
215
|
+
Z(!1), Bt({
|
|
216
216
|
r: n,
|
|
217
217
|
c: Math.max(0, Math.min(t, K - 1))
|
|
218
|
-
}), H && n > 0 && U.scrollToIndex(n - 1),
|
|
219
|
-
},
|
|
218
|
+
}), H && n > 0 && U.scrollToIndex(n - 1), Wt((e) => e + 1);
|
|
219
|
+
}, Jt = (e) => {
|
|
220
220
|
let t = e.target, n = t.closest("[data-cell]");
|
|
221
221
|
if (!n || !j.current?.contains(n)) return;
|
|
222
|
-
let [r, i] =
|
|
223
|
-
(r !== X || i !==
|
|
222
|
+
let [r, i] = Se(n);
|
|
223
|
+
(r !== X || i !== Vt) && Bt({
|
|
224
224
|
r,
|
|
225
225
|
c: i
|
|
226
|
-
}), Z(t !== n && t !==
|
|
227
|
-
},
|
|
226
|
+
}), Z(t !== n && t !== xe(n));
|
|
227
|
+
}, Yt = (e) => {
|
|
228
228
|
let t = e.relatedTarget;
|
|
229
229
|
t && j.current?.contains(t) || Z(!1);
|
|
230
|
-
},
|
|
231
|
-
if (
|
|
230
|
+
}, Xt = (e) => {
|
|
231
|
+
if (Pt.current = e.shiftKey, e.defaultPrevented || e.nativeEvent.isComposing) return;
|
|
232
232
|
let t = e.target, n = t.closest("[data-cell]");
|
|
233
233
|
if (!n || !j.current?.contains(n)) return;
|
|
234
|
-
let [r, i] =
|
|
235
|
-
if (
|
|
234
|
+
let [r, i] = Se(n);
|
|
235
|
+
if (Ht || t !== n && t !== xe(n)) {
|
|
236
236
|
if (e.key === "Escape") e.preventDefault(), Z(!1), n.focus();
|
|
237
237
|
else if (e.key === "Tab") {
|
|
238
|
-
let r =
|
|
238
|
+
let r = C(n);
|
|
239
239
|
if (r.length === 0) return;
|
|
240
240
|
e.preventDefault(), r[(r.indexOf(t) + (e.shiftKey ? -1 : 1) + r.length) % r.length].focus();
|
|
241
241
|
}
|
|
@@ -259,116 +259,128 @@ function C({ rows: d, columns: f, getRowId: p = Te, getRowLabel: Se, "aria-label
|
|
|
259
259
|
e.preventDefault(), Q(o ? 0 : r, 0);
|
|
260
260
|
return;
|
|
261
261
|
case "End":
|
|
262
|
-
e.preventDefault(), Q(o ?
|
|
262
|
+
e.preventDefault(), Q(o ? Rt : r, K - 1);
|
|
263
263
|
return;
|
|
264
264
|
case "PageDown":
|
|
265
|
-
e.preventDefault(), Q(Math.max(1, r +
|
|
265
|
+
e.preventDefault(), Q(Math.max(1, r + me), i);
|
|
266
266
|
return;
|
|
267
267
|
case "PageUp":
|
|
268
|
-
e.preventDefault(), Q(Math.max(+(r > 0), r -
|
|
268
|
+
e.preventDefault(), Q(Math.max(+(r > 0), r - me), i);
|
|
269
269
|
return;
|
|
270
270
|
case "Enter":
|
|
271
271
|
case "F2": {
|
|
272
|
-
let r =
|
|
272
|
+
let r = C(n);
|
|
273
273
|
r.length > 0 && (t === n || e.key === "F2") ? (e.preventDefault(), Z(!0), r[0].focus()) : e.key === "Enter" && t === n && s && D && (e.preventDefault(), D(s));
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
276
|
case " ":
|
|
277
|
-
s &&
|
|
277
|
+
s && Tt && t === n && (e.preventDefault(), Ft(r - 1, e.shiftKey));
|
|
278
278
|
return;
|
|
279
|
-
default: o && e.key.toLowerCase() === "a" && G && (e.preventDefault(),
|
|
279
|
+
default: o && e.key.toLowerCase() === "a" && G && (e.preventDefault(), It(!jt));
|
|
280
280
|
}
|
|
281
|
-
},
|
|
282
|
-
if (e.target.closest(
|
|
281
|
+
}, Zt = v(() => new Intl.NumberFormat(k), [k]), Qt = v(() => new Intl.DateTimeFormat(k, { dateStyle: "medium" }), [k]), $t = (e) => e == null ? "" : typeof e == "number" ? Zt.format(e) : e instanceof Date ? Qt.format(e) : String(e), en = (e, t) => {
|
|
282
|
+
if (e.target.closest(ve)) return;
|
|
283
283
|
let n = B[t];
|
|
284
|
-
w === "single" &&
|
|
284
|
+
w === "single" && Ft(t, !1, !0), n && D && D(n);
|
|
285
285
|
}, $ = H ? r(U, X > 0 ? [X - 1] : []) : B.map((e, t) => ({
|
|
286
286
|
index: t,
|
|
287
287
|
start: 0,
|
|
288
288
|
end: 0,
|
|
289
289
|
size: 0
|
|
290
|
-
})),
|
|
291
|
-
|
|
292
|
-
|
|
290
|
+
})), tn = $[$.length - 1], nn = y({});
|
|
291
|
+
nn.current.fn = et, g(() => {
|
|
292
|
+
let e = nn.current, t = e.last;
|
|
293
|
+
t === B || t && t.length === B.length && t.every((e, t) => e === B[t]) || (e.last = B, e.fn?.(B));
|
|
294
|
+
});
|
|
295
|
+
let rn = H ? U.virtualItems : $, an = rn[0]?.index ?? 0, on = rn[rn.length - 1]?.index ?? -1, sn = y(tt);
|
|
296
|
+
sn.current = tt, g(() => {
|
|
297
|
+
sn.current?.({
|
|
298
|
+
start: an,
|
|
299
|
+
end: on
|
|
300
|
+
});
|
|
301
|
+
}, [an, on]);
|
|
302
|
+
let cn = H && tn ? U.totalSize - tn.end : 0, ln = M[0], un = !E && pt.trim() !== "", dn = !!T || G && Y > 0, fn = R === 0 ? 0 : V + 1, pn = Math.min(R, V + B.length);
|
|
303
|
+
return /* @__PURE__ */ S("div", {
|
|
304
|
+
className: i(h.frame, fe[Ge], de[We], Ke && h.hoverable, qe && h.sticky, nt),
|
|
293
305
|
style: H ? {
|
|
294
|
-
...
|
|
295
|
-
"--_head-h": `${
|
|
296
|
-
} :
|
|
306
|
+
...rt,
|
|
307
|
+
"--_head-h": `${yt}px`
|
|
308
|
+
} : rt,
|
|
297
309
|
children: [
|
|
298
|
-
/* @__PURE__ */
|
|
310
|
+
/* @__PURE__ */ x(c, {
|
|
299
311
|
scrollbars: "both",
|
|
300
|
-
maxHeight:
|
|
312
|
+
maxHeight: xt,
|
|
301
313
|
shadows: !1,
|
|
302
314
|
tabIndex: -1,
|
|
303
|
-
className:
|
|
304
|
-
viewportRef:
|
|
305
|
-
viewportClassName: H ?
|
|
306
|
-
children: /* @__PURE__ */
|
|
307
|
-
ref:
|
|
308
|
-
role: "grid",
|
|
309
|
-
className: i(
|
|
315
|
+
className: h.scroll,
|
|
316
|
+
viewportRef: _t,
|
|
317
|
+
viewportClassName: H ? h.virtualViewport : void 0,
|
|
318
|
+
children: /* @__PURE__ */ S("table", {
|
|
319
|
+
ref: ct,
|
|
320
|
+
role: Ze ? "treegrid" : "grid",
|
|
321
|
+
className: i(h.table, St === "fixed" && h.fixed),
|
|
310
322
|
style: Xe,
|
|
311
|
-
"aria-label":
|
|
323
|
+
"aria-label": Te,
|
|
312
324
|
"aria-labelledby": Ee,
|
|
313
325
|
"aria-describedby": De,
|
|
314
326
|
"aria-rowcount": R + 1,
|
|
315
327
|
"aria-colcount": K,
|
|
316
328
|
"aria-multiselectable": G || void 0,
|
|
317
329
|
"aria-busy": He || void 0,
|
|
318
|
-
onKeyDown:
|
|
319
|
-
onFocus:
|
|
320
|
-
onBlur:
|
|
330
|
+
onKeyDown: Xt,
|
|
331
|
+
onFocus: Jt,
|
|
332
|
+
onBlur: Yt,
|
|
321
333
|
onPointerDown: (e) => {
|
|
322
|
-
|
|
334
|
+
Pt.current = e.shiftKey;
|
|
323
335
|
},
|
|
324
|
-
children: [/* @__PURE__ */
|
|
325
|
-
ref:
|
|
326
|
-
className:
|
|
327
|
-
children: /* @__PURE__ */
|
|
336
|
+
children: [/* @__PURE__ */ x("thead", {
|
|
337
|
+
ref: vt,
|
|
338
|
+
className: h.head,
|
|
339
|
+
children: /* @__PURE__ */ S("tr", {
|
|
328
340
|
"aria-rowindex": 1,
|
|
329
|
-
children: [G && /* @__PURE__ */
|
|
341
|
+
children: [G && /* @__PURE__ */ x("th", {
|
|
330
342
|
role: "columnheader",
|
|
331
343
|
"data-cell": "0:0",
|
|
332
344
|
"data-select-column": "",
|
|
333
345
|
"aria-colindex": 1,
|
|
334
|
-
className: i(
|
|
335
|
-
children: /* @__PURE__ */
|
|
336
|
-
checked:
|
|
337
|
-
indeterminate:
|
|
346
|
+
className: i(h.cell, h.selectCell),
|
|
347
|
+
children: /* @__PURE__ */ x(o, {
|
|
348
|
+
checked: jt,
|
|
349
|
+
indeterminate: Mt,
|
|
338
350
|
disabled: J.length === 0,
|
|
339
|
-
onCheckedChange: (e) =>
|
|
351
|
+
onCheckedChange: (e) => It(Mt ? !0 : e),
|
|
340
352
|
"aria-label": O.table.selectAll
|
|
341
353
|
})
|
|
342
|
-
}),
|
|
343
|
-
let n = t +
|
|
344
|
-
return /* @__PURE__ */
|
|
354
|
+
}), p.map((e, t) => {
|
|
355
|
+
let n = t + Et, r = M.findIndex((t) => t.key === e.key), a = r >= 0 ? M[r].direction : null, o = a === "ascending" ? d : a === "descending" ? u : ee, s = e.align ?? (e.numeric ? "end" : "start");
|
|
356
|
+
return /* @__PURE__ */ S("th", {
|
|
345
357
|
role: "columnheader",
|
|
346
358
|
"data-cell": `0:${n}`,
|
|
347
359
|
"aria-colindex": n + 1,
|
|
348
360
|
scope: "col",
|
|
349
|
-
"aria-sort":
|
|
361
|
+
"aria-sort": ln?.key === e.key ? ln.direction : void 0,
|
|
350
362
|
"data-sorted": a ?? void 0,
|
|
351
|
-
className: i(
|
|
363
|
+
className: i(h.cell, h.headerCell, e.sortable && h.sortableCell, pe[s], e.numeric && h.numeric, e.headerEnd != null && h.hasHeaderEnd, e.className),
|
|
352
364
|
style: {
|
|
353
|
-
inlineSize:
|
|
354
|
-
minInlineSize:
|
|
365
|
+
inlineSize: Ce(e.width),
|
|
366
|
+
minInlineSize: Ce(e.minWidth),
|
|
355
367
|
...e.style
|
|
356
368
|
},
|
|
357
|
-
children: [e.sortable ? /* @__PURE__ */
|
|
369
|
+
children: [e.sortable ? /* @__PURE__ */ S("button", {
|
|
358
370
|
type: "button",
|
|
359
|
-
className:
|
|
360
|
-
onClick: (t) =>
|
|
361
|
-
children: [/* @__PURE__ */
|
|
362
|
-
className:
|
|
371
|
+
className: h.sortButton,
|
|
372
|
+
onClick: (t) => Lt(e, t.shiftKey || Pt.current),
|
|
373
|
+
children: [/* @__PURE__ */ x("span", {
|
|
374
|
+
className: h.sortLabel,
|
|
363
375
|
children: e.header
|
|
364
|
-
}), /* @__PURE__ */
|
|
365
|
-
className:
|
|
376
|
+
}), /* @__PURE__ */ S("span", {
|
|
377
|
+
className: h.sortIcon,
|
|
366
378
|
"aria-hidden": "true",
|
|
367
|
-
children: [/* @__PURE__ */
|
|
379
|
+
children: [/* @__PURE__ */ x(o, {
|
|
368
380
|
size: "sm",
|
|
369
381
|
strokeWidth: 2.5
|
|
370
|
-
}), M.length > 1 && r >= 0 && /* @__PURE__ */
|
|
371
|
-
className:
|
|
382
|
+
}), M.length > 1 && r >= 0 && /* @__PURE__ */ x("span", {
|
|
383
|
+
className: h.sortPriority,
|
|
372
384
|
children: r + 1
|
|
373
385
|
})]
|
|
374
386
|
})]
|
|
@@ -376,113 +388,126 @@ function C({ rows: d, columns: f, getRowId: p = Te, getRowLabel: Se, "aria-label
|
|
|
376
388
|
}, e.key);
|
|
377
389
|
})]
|
|
378
390
|
})
|
|
379
|
-
}), /* @__PURE__ */
|
|
380
|
-
className:
|
|
381
|
-
children: B.length === 0 ? /* @__PURE__ */
|
|
382
|
-
className:
|
|
383
|
-
children: /* @__PURE__ */
|
|
391
|
+
}), /* @__PURE__ */ x("tbody", {
|
|
392
|
+
className: h.body,
|
|
393
|
+
children: B.length === 0 ? /* @__PURE__ */ x("tr", {
|
|
394
|
+
className: h.emptyRow,
|
|
395
|
+
children: /* @__PURE__ */ x("td", {
|
|
384
396
|
role: "gridcell",
|
|
385
397
|
colSpan: K,
|
|
386
|
-
className: i(
|
|
387
|
-
children: He ? /* @__PURE__ */
|
|
388
|
-
className:
|
|
389
|
-
children: [/* @__PURE__ */
|
|
398
|
+
className: i(h.cell, h.emptyCell),
|
|
399
|
+
children: He ? /* @__PURE__ */ S("span", {
|
|
400
|
+
className: h.loadingInline,
|
|
401
|
+
children: [/* @__PURE__ */ x(s, {
|
|
390
402
|
size: "sm",
|
|
391
403
|
decorative: !0
|
|
392
404
|
}), O.table.loading]
|
|
393
|
-
}) : Ue ?? (
|
|
405
|
+
}) : Ue ?? (un ? A.noResults : A.empty)
|
|
394
406
|
})
|
|
395
|
-
}) : /* @__PURE__ */
|
|
396
|
-
let n = e.index, r = B[n], a =
|
|
397
|
-
return /* @__PURE__ */
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
"
|
|
415
|
-
|
|
416
|
-
"
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
407
|
+
}) : /* @__PURE__ */ S(ue, { children: [$.map((e, t) => {
|
|
408
|
+
let n = e.index, r = B[n], a = m(r), s = n + 1, c = q.has(a), l = Qe?.(r), u = $e?.(r), d = At(r), ee = H ? e.start - (t === 0 ? yt : $[t - 1].end) : 0;
|
|
409
|
+
return /* @__PURE__ */ S(se, { children: [
|
|
410
|
+
ee > .5 && /* @__PURE__ */ x("tr", {
|
|
411
|
+
"aria-hidden": "true",
|
|
412
|
+
className: h.spacer,
|
|
413
|
+
style: { blockSize: ee },
|
|
414
|
+
children: /* @__PURE__ */ x("td", { colSpan: K })
|
|
415
|
+
}),
|
|
416
|
+
/* @__PURE__ */ S("tr", {
|
|
417
|
+
ref: H ? U.measureElement : void 0,
|
|
418
|
+
"data-index": H ? n : void 0,
|
|
419
|
+
"data-even": (V + n) % 2 == 1 || void 0,
|
|
420
|
+
"aria-rowindex": V + n + 2,
|
|
421
|
+
"aria-selected": Tt && l?.selectable !== !1 ? c : void 0,
|
|
422
|
+
"aria-disabled": Tt && !d && l?.selectable !== !1 ? !0 : void 0,
|
|
423
|
+
"data-selected": c || void 0,
|
|
424
|
+
"aria-level": l?.level,
|
|
425
|
+
"aria-expanded": l?.expanded,
|
|
426
|
+
className: i(h.row, (D || w === "single") && h.clickable, l?.className),
|
|
427
|
+
onClick: (e) => en(e, n),
|
|
428
|
+
children: [G && /* @__PURE__ */ x("td", {
|
|
429
|
+
role: "gridcell",
|
|
430
|
+
"data-cell": `${s}:0`,
|
|
431
|
+
"data-select-column": "",
|
|
432
|
+
"aria-colindex": 1,
|
|
433
|
+
className: i(h.cell, h.selectCell),
|
|
434
|
+
children: l?.selectable !== !1 && /* @__PURE__ */ x(o, {
|
|
435
|
+
checked: c,
|
|
436
|
+
disabled: !d,
|
|
437
|
+
onCheckedChange: (e) => Ft(n, Pt.current, e),
|
|
438
|
+
"aria-label": O.table.selectRowNamed(Ot(r))
|
|
439
|
+
})
|
|
440
|
+
}), p.map((e, t) => {
|
|
441
|
+
let a = t + Et, o = re(r, e), l = e.cell ? e.cell(r, {
|
|
442
|
+
value: o,
|
|
443
|
+
rowIndex: gt + n,
|
|
444
|
+
selected: c
|
|
445
|
+
}) : $t(o), u = e.align ?? (e.numeric ? "end" : "start"), d = e.rowHeader ? "th" : "td";
|
|
446
|
+
return /* @__PURE__ */ x(d, {
|
|
447
|
+
role: e.rowHeader ? "rowheader" : "gridcell",
|
|
448
|
+
"data-cell": `${s}:${a}`,
|
|
449
|
+
"aria-colindex": a + 1,
|
|
450
|
+
scope: e.rowHeader ? "row" : void 0,
|
|
451
|
+
className: i(h.cell, e.rowHeader && h.rowHeader, pe[u], e.numeric && h.numeric, e.className),
|
|
452
|
+
style: e.style,
|
|
453
|
+
children: l
|
|
454
|
+
}, e.key);
|
|
455
|
+
})]
|
|
456
|
+
}),
|
|
457
|
+
u != null && u !== !1 && /* @__PURE__ */ x("tr", {
|
|
458
|
+
className: h.detailRow,
|
|
459
|
+
children: /* @__PURE__ */ x("td", {
|
|
460
|
+
colSpan: K,
|
|
461
|
+
className: i(h.cell, h.detailCell),
|
|
462
|
+
children: u
|
|
423
463
|
})
|
|
424
|
-
})
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
rowIndex: dt + n,
|
|
428
|
-
selected: c
|
|
429
|
-
}) : Jt(o), u = e.align ?? (e.numeric ? "end" : "start"), ee = e.rowHeader ? "th" : "td";
|
|
430
|
-
return /* @__PURE__ */ y(ee, {
|
|
431
|
-
role: e.rowHeader ? "rowheader" : "gridcell",
|
|
432
|
-
"data-cell": `${s}:${a}`,
|
|
433
|
-
"aria-colindex": a + 1,
|
|
434
|
-
scope: e.rowHeader ? "row" : void 0,
|
|
435
|
-
className: i(m.cell, e.rowHeader && m.rowHeader, he[u], e.numeric && m.numeric, e.className),
|
|
436
|
-
style: e.style,
|
|
437
|
-
children: l
|
|
438
|
-
}, e.key);
|
|
439
|
-
})]
|
|
440
|
-
})] }, a);
|
|
441
|
-
}), Zt > .5 && /* @__PURE__ */ y("tr", {
|
|
464
|
+
})
|
|
465
|
+
] }, a);
|
|
466
|
+
}), cn > .5 && /* @__PURE__ */ x("tr", {
|
|
442
467
|
"aria-hidden": "true",
|
|
443
|
-
className:
|
|
444
|
-
style: { blockSize:
|
|
445
|
-
children: /* @__PURE__ */
|
|
468
|
+
className: h.spacer,
|
|
469
|
+
style: { blockSize: cn },
|
|
470
|
+
children: /* @__PURE__ */ x("td", { colSpan: K })
|
|
446
471
|
})] })
|
|
447
472
|
})]
|
|
448
473
|
})
|
|
449
474
|
}),
|
|
450
|
-
He && B.length > 0 && /* @__PURE__ */
|
|
451
|
-
className:
|
|
452
|
-
children: /* @__PURE__ */
|
|
475
|
+
He && B.length > 0 && /* @__PURE__ */ x("div", {
|
|
476
|
+
className: h.loadingOverlay,
|
|
477
|
+
children: /* @__PURE__ */ x(s, { label: O.table.loading })
|
|
453
478
|
}),
|
|
454
|
-
/* @__PURE__ */
|
|
479
|
+
/* @__PURE__ */ x("span", {
|
|
455
480
|
hidden: !0,
|
|
456
|
-
id:
|
|
481
|
+
id: ot,
|
|
457
482
|
children: O.pagination.nav
|
|
458
483
|
}),
|
|
459
|
-
|
|
484
|
+
Te && !Ee && /* @__PURE__ */ x("span", {
|
|
460
485
|
hidden: !0,
|
|
461
|
-
id:
|
|
462
|
-
children:
|
|
486
|
+
id: st,
|
|
487
|
+
children: Te
|
|
463
488
|
}),
|
|
464
|
-
|
|
465
|
-
className:
|
|
466
|
-
children: [/* @__PURE__ */
|
|
489
|
+
dn && /* @__PURE__ */ S("div", {
|
|
490
|
+
className: h.footer,
|
|
491
|
+
children: [/* @__PURE__ */ x("span", {
|
|
467
492
|
role: "status",
|
|
468
|
-
className:
|
|
493
|
+
className: h.status,
|
|
469
494
|
children: G && Y > 0 ? A.selectedCount(Y) : null
|
|
470
|
-
}), T ? /* @__PURE__ */
|
|
471
|
-
className:
|
|
472
|
-
children: [/* @__PURE__ */
|
|
473
|
-
className:
|
|
474
|
-
children: A.range(
|
|
475
|
-
}),
|
|
495
|
+
}), T ? /* @__PURE__ */ S("div", {
|
|
496
|
+
className: h.paging,
|
|
497
|
+
children: [/* @__PURE__ */ x("span", {
|
|
498
|
+
className: h.range,
|
|
499
|
+
children: A.range(fn, pn, R)
|
|
500
|
+
}), ht > 1 && /* @__PURE__ */ x(l, {
|
|
476
501
|
size: "sm",
|
|
477
502
|
compact: !0,
|
|
478
|
-
pageCount:
|
|
503
|
+
pageCount: ht,
|
|
479
504
|
page: z,
|
|
480
|
-
onPageChange:
|
|
481
|
-
"aria-labelledby": `${
|
|
505
|
+
onPageChange: ft,
|
|
506
|
+
"aria-labelledby": `${ot} ${Ee ?? st}`
|
|
482
507
|
})]
|
|
483
508
|
}) : null]
|
|
484
509
|
})
|
|
485
510
|
]
|
|
486
511
|
});
|
|
487
512
|
}
|
|
488
|
-
export {
|
|
513
|
+
export { Te as DataGrid, f as compareValues, ne as createSearchIndex, p as filterRows, re as getCellValue, oe as sortIndices, m as sortRows };
|