@overdoser/react-toolkit 0.19.0 → 0.20.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/AGENTS.md +1 -1
- package/CHANGELOG.md +33 -0
- package/components/Table/Table.d.ts +41 -16
- package/components/Table/Table.js +256 -245
- package/components/Table/index.d.ts +1 -1
- package/components/Table/useTableSort.d.ts +1 -1
- package/components/ThemeToggle/ThemeToggle.d.ts +2 -0
- package/components/ThemeToggle/ThemeToggle.js +12 -11
- package/hooks/usePersistedState.js +40 -37
- package/hooks/useTheme.d.ts +2 -2
- package/hooks/useTheme.js +13 -15
- package/index.css +1 -1
- package/index.d.ts +1 -1
- package/index.layered.css +1 -1
- package/llms.txt +6 -6
- package/manifest.json +58 -10
- package/package.json +1 -1
- package/utils/themeScript.d.ts +2 -0
- package/utils/themeScript.js +6 -6
|
@@ -1,50 +1,56 @@
|
|
|
1
|
-
import { jsxs as v, jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as v, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as H, useCallback as y, useEffect as Je, useState as Se, useRef as V } from "react";
|
|
3
|
+
import c from "clsx";
|
|
4
4
|
import n from "./Table.module.scss.js";
|
|
5
|
-
import { useTableSort as
|
|
6
|
-
import { Loader as
|
|
7
|
-
import { Skeleton as
|
|
8
|
-
import { Checkbox as
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { useTableSort as Qe } from "./useTableSort.js";
|
|
6
|
+
import { Loader as Ye } from "../Loader/Loader.js";
|
|
7
|
+
import { Skeleton as Ze } from "../Skeleton/Skeleton.js";
|
|
8
|
+
import { Checkbox as ke } from "../inputs/Checkbox/Checkbox.js";
|
|
9
|
+
function _(s) {
|
|
10
|
+
return typeof s.key == "string";
|
|
11
|
+
}
|
|
12
|
+
function P(s) {
|
|
13
|
+
return _(s) ? s.key : s.id;
|
|
14
|
+
}
|
|
15
|
+
const ze = 'button, a, input, select, textarea, label, [role="button"], [role="checkbox"], [role="menuitem"], [contenteditable]';
|
|
16
|
+
function et({ direction: s, sortIndex: u }) {
|
|
11
17
|
return /* @__PURE__ */ v("span", { className: n.sortIndicator, "aria-hidden": "true", children: [
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
|
|
18
|
+
/* @__PURE__ */ a("span", { className: c(n.sortArrow, s === "asc" && n.sortArrowActive), children: "▲" }),
|
|
19
|
+
/* @__PURE__ */ a("span", { className: c(n.sortArrow, s === "desc" && n.sortArrowActive), children: "▼" }),
|
|
20
|
+
u !== void 0 && u >= 0 && /* @__PURE__ */ a("span", { className: n.sortIndex, children: u + 1 })
|
|
15
21
|
] });
|
|
16
22
|
}
|
|
17
|
-
function
|
|
18
|
-
page:
|
|
19
|
-
pageSize:
|
|
20
|
-
totalRows:
|
|
21
|
-
pageSizeOptions:
|
|
22
|
-
onPageChange:
|
|
23
|
-
paginatorClasses:
|
|
23
|
+
function tt({
|
|
24
|
+
page: s,
|
|
25
|
+
pageSize: u,
|
|
26
|
+
totalRows: K,
|
|
27
|
+
pageSizeOptions: D = [10, 25, 50, 100],
|
|
28
|
+
onPageChange: L,
|
|
29
|
+
paginatorClasses: q
|
|
24
30
|
}) {
|
|
25
|
-
const p = Math.max(1, Math.ceil(
|
|
31
|
+
const p = Math.max(1, Math.ceil(K / u)), Z = (s - 1) * u + 1, z = Math.min(s * u, K), ee = H(() => {
|
|
26
32
|
const i = [];
|
|
27
33
|
if (p <= 7)
|
|
28
|
-
for (let
|
|
34
|
+
for (let C = 1; C <= p; C++) i.push(C);
|
|
29
35
|
else {
|
|
30
|
-
i.push(1),
|
|
31
|
-
for (let
|
|
32
|
-
i.push(
|
|
33
|
-
|
|
36
|
+
i.push(1), s > 3 && i.push("ellipsis");
|
|
37
|
+
for (let C = Math.max(2, s - 1); C <= Math.min(p - 1, s + 1); C++)
|
|
38
|
+
i.push(C);
|
|
39
|
+
s < p - 2 && i.push("ellipsis"), i.push(p);
|
|
34
40
|
}
|
|
35
41
|
return i;
|
|
36
|
-
}, [
|
|
37
|
-
return /* @__PURE__ */ v("nav", { className:
|
|
42
|
+
}, [s, p]);
|
|
43
|
+
return /* @__PURE__ */ v("nav", { className: c(n.paginator, q?.paginator), "aria-label": "Table pagination", children: [
|
|
38
44
|
/* @__PURE__ */ v("div", { className: n.paginatorInfo, children: [
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
|
|
45
|
+
/* @__PURE__ */ a("span", { className: n.paginatorText, children: K > 0 ? `${Z}–${z} of ${K}` : "No results" }),
|
|
46
|
+
D.length > 1 && /* @__PURE__ */ a(
|
|
41
47
|
"select",
|
|
42
48
|
{
|
|
43
49
|
className: n.pageSizeSelect,
|
|
44
|
-
value:
|
|
45
|
-
onChange: (i) =>
|
|
50
|
+
value: u,
|
|
51
|
+
onChange: (i) => L(1, Number(i.target.value)),
|
|
46
52
|
"aria-label": "Rows per page",
|
|
47
|
-
children:
|
|
53
|
+
children: D.map((i) => /* @__PURE__ */ v("option", { value: i, children: [
|
|
48
54
|
i,
|
|
49
55
|
" / page"
|
|
50
56
|
] }, i))
|
|
@@ -52,38 +58,38 @@ function ze({
|
|
|
52
58
|
)
|
|
53
59
|
] }),
|
|
54
60
|
/* @__PURE__ */ v("div", { className: n.paginatorNav, children: [
|
|
55
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ a(
|
|
56
62
|
"button",
|
|
57
63
|
{
|
|
58
64
|
type: "button",
|
|
59
|
-
className:
|
|
60
|
-
disabled:
|
|
61
|
-
onClick: () =>
|
|
65
|
+
className: c(n.pageButton, q?.pageButton),
|
|
66
|
+
disabled: s <= 1,
|
|
67
|
+
onClick: () => L(s - 1, u),
|
|
62
68
|
"aria-label": "Previous page",
|
|
63
69
|
children: "‹"
|
|
64
70
|
}
|
|
65
71
|
),
|
|
66
|
-
|
|
67
|
-
(i,
|
|
72
|
+
ee.map(
|
|
73
|
+
(i, C) => i === "ellipsis" ? /* @__PURE__ */ a("span", { className: n.pageEllipsis, children: "…" }, `ellipsis-${C}`) : /* @__PURE__ */ a(
|
|
68
74
|
"button",
|
|
69
75
|
{
|
|
70
76
|
type: "button",
|
|
71
|
-
className:
|
|
72
|
-
onClick: () =>
|
|
77
|
+
className: c(n.pageButton, i === s && n.pageButtonActive, q?.pageButton),
|
|
78
|
+
onClick: () => L(i, u),
|
|
73
79
|
"aria-label": `Page ${i}`,
|
|
74
|
-
"aria-current": i ===
|
|
80
|
+
"aria-current": i === s ? "page" : void 0,
|
|
75
81
|
children: i
|
|
76
82
|
},
|
|
77
83
|
i
|
|
78
84
|
)
|
|
79
85
|
),
|
|
80
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ a(
|
|
81
87
|
"button",
|
|
82
88
|
{
|
|
83
89
|
type: "button",
|
|
84
|
-
className:
|
|
85
|
-
disabled:
|
|
86
|
-
onClick: () =>
|
|
90
|
+
className: c(n.pageButton, q?.pageButton),
|
|
91
|
+
disabled: s >= p,
|
|
92
|
+
onClick: () => L(s + 1, u),
|
|
87
93
|
"aria-label": "Next page",
|
|
88
94
|
children: "›"
|
|
89
95
|
}
|
|
@@ -91,163 +97,163 @@ function ze({
|
|
|
91
97
|
] })
|
|
92
98
|
] });
|
|
93
99
|
}
|
|
94
|
-
function
|
|
95
|
-
data:
|
|
96
|
-
columns:
|
|
97
|
-
sortConfig:
|
|
98
|
-
onSort:
|
|
99
|
-
multiSort:
|
|
100
|
-
scrollable:
|
|
100
|
+
function nt({
|
|
101
|
+
data: s,
|
|
102
|
+
columns: u,
|
|
103
|
+
sortConfig: K,
|
|
104
|
+
onSort: D,
|
|
105
|
+
multiSort: L = !0,
|
|
106
|
+
scrollable: q = !1,
|
|
101
107
|
dragScroll: p = !1,
|
|
102
|
-
striped:
|
|
103
|
-
hoverable:
|
|
104
|
-
compact:
|
|
108
|
+
striped: Z = !1,
|
|
109
|
+
hoverable: z = !1,
|
|
110
|
+
compact: ee = !1,
|
|
105
111
|
className: i,
|
|
106
|
-
style:
|
|
107
|
-
rowKey:
|
|
108
|
-
rowClassName:
|
|
109
|
-
rowStyle:
|
|
110
|
-
emptyMessage:
|
|
112
|
+
style: C,
|
|
113
|
+
rowKey: R,
|
|
114
|
+
rowClassName: te,
|
|
115
|
+
rowStyle: ne,
|
|
116
|
+
emptyMessage: xe = "No data",
|
|
111
117
|
pagination: A,
|
|
112
|
-
loading:
|
|
113
|
-
loadingRows:
|
|
118
|
+
loading: O = !1,
|
|
119
|
+
loadingRows: Ie = 3,
|
|
114
120
|
onRowClick: N,
|
|
115
121
|
selectable: m = !1,
|
|
116
|
-
selectedKeys:
|
|
117
|
-
defaultSelectedKeys:
|
|
118
|
-
onSelectionChange:
|
|
119
|
-
isRowSelectable:
|
|
120
|
-
bulkActions:
|
|
121
|
-
selectionLabel:
|
|
122
|
-
columnVisibility:
|
|
123
|
-
layout:
|
|
124
|
-
classes:
|
|
122
|
+
selectedKeys: ue,
|
|
123
|
+
defaultSelectedKeys: Me,
|
|
124
|
+
onSelectionChange: re,
|
|
125
|
+
isRowSelectable: le,
|
|
126
|
+
bulkActions: F,
|
|
127
|
+
selectionLabel: fe,
|
|
128
|
+
columnVisibility: ae,
|
|
129
|
+
layout: De = "auto",
|
|
130
|
+
classes: o
|
|
125
131
|
}) {
|
|
126
|
-
const
|
|
127
|
-
() =>
|
|
128
|
-
[
|
|
132
|
+
const W = D !== void 0, Te = q || p, U = H(
|
|
133
|
+
() => ae ? u.filter((e) => ae[P(e)] !== !1) : u,
|
|
134
|
+
[u, ae]
|
|
129
135
|
), {
|
|
130
|
-
sortedData:
|
|
131
|
-
sortConfig:
|
|
132
|
-
requestSort:
|
|
133
|
-
requestMultiSort:
|
|
134
|
-
} =
|
|
135
|
-
if (!A ||
|
|
136
|
+
sortedData: Ae,
|
|
137
|
+
sortConfig: Be,
|
|
138
|
+
requestSort: he,
|
|
139
|
+
requestMultiSort: pe
|
|
140
|
+
} = Qe(s, K), I = W ? K ?? [] : Be, T = W ? s : Ae, B = H(() => {
|
|
141
|
+
if (!A || W) return T;
|
|
136
142
|
const e = (A.page - 1) * A.pageSize;
|
|
137
|
-
return
|
|
138
|
-
}, [
|
|
143
|
+
return T.slice(e, e + A.pageSize);
|
|
144
|
+
}, [T, A, W]), we = A?.totalRows ?? T.length, M = y(
|
|
139
145
|
(e, t) => {
|
|
140
|
-
if (!
|
|
141
|
-
const r = e[
|
|
146
|
+
if (!R) return t;
|
|
147
|
+
const r = e[R];
|
|
142
148
|
return typeof r == "number" ? r : String(r);
|
|
143
149
|
},
|
|
144
|
-
[
|
|
150
|
+
[R]
|
|
145
151
|
);
|
|
146
|
-
|
|
147
|
-
m && !
|
|
152
|
+
Je(() => {
|
|
153
|
+
m && !R && console.error(
|
|
148
154
|
"Table: `selectable` needs `rowKey` so selections survive sorting and paging; falling back to the row index."
|
|
149
155
|
);
|
|
150
|
-
}, [m,
|
|
151
|
-
const [
|
|
152
|
-
() =>
|
|
153
|
-
),
|
|
156
|
+
}, [m, R]);
|
|
157
|
+
const [Ee, Pe] = Se(
|
|
158
|
+
() => Me ?? []
|
|
159
|
+
), se = ue !== void 0, d = se ? ue : Ee, G = H(() => new Set(d), [d]), ie = V(null), w = y(
|
|
154
160
|
(e) => {
|
|
155
|
-
if (
|
|
161
|
+
if (se || Pe(e), re) {
|
|
156
162
|
const t = new Set(e);
|
|
157
|
-
|
|
163
|
+
re(
|
|
158
164
|
e,
|
|
159
|
-
|
|
165
|
+
T.filter((r, f) => t.has(M(r, f)))
|
|
160
166
|
);
|
|
161
167
|
}
|
|
162
168
|
},
|
|
163
|
-
[re,
|
|
164
|
-
),
|
|
165
|
-
(e) =>
|
|
166
|
-
[
|
|
167
|
-
),
|
|
169
|
+
[se, re, T, M]
|
|
170
|
+
), j = y(
|
|
171
|
+
(e) => le ? le(e) !== !1 : !0,
|
|
172
|
+
[le]
|
|
173
|
+
), $ = H(
|
|
168
174
|
() => {
|
|
169
175
|
if (!m) return [];
|
|
170
176
|
const e = [];
|
|
171
|
-
return
|
|
172
|
-
|
|
177
|
+
return B.forEach((t, r) => {
|
|
178
|
+
j(t) && e.push(M(t, r));
|
|
173
179
|
}), e;
|
|
174
180
|
},
|
|
175
|
-
[m,
|
|
176
|
-
),
|
|
177
|
-
if (
|
|
178
|
-
const e = new Set(
|
|
179
|
-
|
|
181
|
+
[m, B, j, M]
|
|
182
|
+
), me = $.filter((e) => G.has(e)).length, J = $.length > 0 && me === $.length, Ke = me > 0 && !J, Le = y(() => {
|
|
183
|
+
if (J) {
|
|
184
|
+
const e = new Set($);
|
|
185
|
+
w(d.filter((t) => !e.has(t)));
|
|
180
186
|
} else {
|
|
181
187
|
const e = [...d], t = new Set(d);
|
|
182
|
-
for (const r of
|
|
183
|
-
|
|
188
|
+
for (const r of $) t.has(r) || e.push(r);
|
|
189
|
+
w(e);
|
|
184
190
|
}
|
|
185
|
-
}, [
|
|
191
|
+
}, [J, $, d, w]), Re = y(
|
|
186
192
|
(e, t, r) => {
|
|
187
|
-
const
|
|
188
|
-
let b = [
|
|
189
|
-
if (
|
|
190
|
-
const
|
|
191
|
-
if (
|
|
192
|
-
const [
|
|
193
|
+
const f = M(e, t), g = r.target.checked, S = r.nativeEvent.shiftKey === !0;
|
|
194
|
+
let b = [f];
|
|
195
|
+
if (S && ie.current !== null) {
|
|
196
|
+
const h = B.map((E, de) => M(E, de)), k = h.indexOf(ie.current), x = h.indexOf(f);
|
|
197
|
+
if (k >= 0 && x >= 0) {
|
|
198
|
+
const [E, de] = k < x ? [k, x] : [x, k];
|
|
193
199
|
b = [];
|
|
194
|
-
for (let
|
|
195
|
-
|
|
200
|
+
for (let Y = E; Y <= de; Y++)
|
|
201
|
+
j(B[Y]) && b.push(h[Y]);
|
|
196
202
|
}
|
|
197
203
|
}
|
|
198
|
-
|
|
199
|
-
const
|
|
204
|
+
ie.current = f;
|
|
205
|
+
const l = new Set(b);
|
|
200
206
|
if (g) {
|
|
201
|
-
const
|
|
202
|
-
for (const
|
|
203
|
-
|
|
207
|
+
const h = new Set(d), k = [...d];
|
|
208
|
+
for (const x of b) h.has(x) || k.push(x);
|
|
209
|
+
w(k);
|
|
204
210
|
} else
|
|
205
|
-
|
|
211
|
+
w(d.filter((h) => !l.has(h)));
|
|
206
212
|
},
|
|
207
|
-
[
|
|
208
|
-
),
|
|
209
|
-
() => m && d.length ?
|
|
210
|
-
[m, d.length,
|
|
211
|
-
),
|
|
213
|
+
[M, B, j, d, w]
|
|
214
|
+
), ge = y(() => w([]), [w]), $e = H(
|
|
215
|
+
() => m && d.length ? T.filter((e, t) => G.has(M(e, t))) : [],
|
|
216
|
+
[m, d.length, T, G, M]
|
|
217
|
+
), qe = y(
|
|
212
218
|
(e, t, r) => {
|
|
213
219
|
if (!N) return;
|
|
214
|
-
const g = r.target?.closest?.(
|
|
220
|
+
const g = r.target?.closest?.(ze);
|
|
215
221
|
g && g !== r.currentTarget && r.currentTarget.contains(g) || N(e, t, r);
|
|
216
222
|
},
|
|
217
223
|
[N]
|
|
218
|
-
),
|
|
224
|
+
), Oe = y(
|
|
219
225
|
(e, t, r) => {
|
|
220
226
|
!N || r.target !== r.currentTarget || (r.key === "Enter" || r.key === " ") && (r.preventDefault(), N(e, t, r));
|
|
221
227
|
},
|
|
222
228
|
[N]
|
|
223
|
-
),
|
|
229
|
+
), We = y(
|
|
224
230
|
(e, t, r) => {
|
|
225
|
-
const
|
|
226
|
-
if (
|
|
227
|
-
if (
|
|
228
|
-
const
|
|
231
|
+
const f = L && (t.ctrlKey || t.metaKey || t.shiftKey), g = r === "asc" ? "desc" : "asc";
|
|
232
|
+
if (W)
|
|
233
|
+
if (f) {
|
|
234
|
+
const S = I.findIndex((l) => l.key === e);
|
|
229
235
|
let b;
|
|
230
|
-
|
|
231
|
-
(
|
|
232
|
-
) : b =
|
|
236
|
+
S === -1 ? b = [...I, { key: e, direction: r }] : I[S].direction === r ? b = I.map(
|
|
237
|
+
(l, h) => h === S ? { key: e, direction: g } : l
|
|
238
|
+
) : b = I.filter((l, h) => h !== S), D(b);
|
|
233
239
|
} else {
|
|
234
|
-
const
|
|
235
|
-
|
|
240
|
+
const S = I.find((b) => b.key === e);
|
|
241
|
+
S ? S.direction === r ? D([{ key: e, direction: g }]) : D([]) : D([{ key: e, direction: r }]);
|
|
236
242
|
}
|
|
237
243
|
else
|
|
238
|
-
|
|
244
|
+
f ? pe(e, r) : he(e, r);
|
|
239
245
|
},
|
|
240
246
|
[
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
S,
|
|
247
|
+
W,
|
|
248
|
+
L,
|
|
244
249
|
I,
|
|
245
|
-
|
|
246
|
-
|
|
250
|
+
D,
|
|
251
|
+
he,
|
|
252
|
+
pe
|
|
247
253
|
]
|
|
248
|
-
),
|
|
249
|
-
const t =
|
|
250
|
-
t && (
|
|
254
|
+
), oe = V(null), X = V(null), Q = V(!1), [Xe, be] = Se(!1), He = y((e) => {
|
|
255
|
+
const t = oe.current;
|
|
256
|
+
t && (Q.current = !1, !(e.button !== 1 && e.button !== 2) && (t.scrollWidth <= t.clientWidth || (e.button === 1 && e.preventDefault(), X.current = {
|
|
251
257
|
pointerId: e.pointerId,
|
|
252
258
|
button: e.button,
|
|
253
259
|
startX: e.clientX,
|
|
@@ -255,142 +261,147 @@ function et({
|
|
|
255
261
|
downAt: performance.now(),
|
|
256
262
|
dragging: !1
|
|
257
263
|
})));
|
|
258
|
-
}, []),
|
|
259
|
-
const t =
|
|
264
|
+
}, []), _e = y((e) => {
|
|
265
|
+
const t = X.current, r = oe.current;
|
|
260
266
|
if (!t || !r || e.pointerId !== t.pointerId) return;
|
|
261
|
-
const
|
|
267
|
+
const f = e.clientX - t.startX;
|
|
262
268
|
if (!t.dragging) {
|
|
263
269
|
if (t.button === 2 && performance.now() - t.downAt > 200) {
|
|
264
|
-
|
|
270
|
+
X.current = null;
|
|
265
271
|
return;
|
|
266
272
|
}
|
|
267
|
-
if (Math.abs(
|
|
268
|
-
t.dragging = !0,
|
|
273
|
+
if (Math.abs(f) < 5) return;
|
|
274
|
+
t.dragging = !0, be(!0);
|
|
269
275
|
try {
|
|
270
276
|
r.setPointerCapture(t.pointerId);
|
|
271
277
|
} catch {
|
|
272
278
|
}
|
|
273
279
|
}
|
|
274
|
-
r.scrollLeft = t.startScrollLeft -
|
|
275
|
-
}, []),
|
|
276
|
-
const t =
|
|
277
|
-
!t || e.pointerId !== t.pointerId || (
|
|
278
|
-
}, []),
|
|
279
|
-
(
|
|
280
|
-
}, []),
|
|
281
|
-
if (
|
|
282
|
-
const t =
|
|
280
|
+
r.scrollLeft = t.startScrollLeft - f;
|
|
281
|
+
}, []), ye = y((e) => {
|
|
282
|
+
const t = X.current;
|
|
283
|
+
!t || e.pointerId !== t.pointerId || (X.current = null, t.dragging && (t.button === 2 && (Q.current = !0), be(!1)));
|
|
284
|
+
}, []), je = y((e) => {
|
|
285
|
+
(X.current?.dragging || Q.current) && (Q.current = !1, e.preventDefault());
|
|
286
|
+
}, []), ce = (e) => I.find((r) => r.key === e)?.direction, Ve = (e) => {
|
|
287
|
+
if (I.length <= 1) return;
|
|
288
|
+
const t = I.findIndex((r) => r.key === e);
|
|
283
289
|
return t >= 0 ? t : void 0;
|
|
284
|
-
},
|
|
285
|
-
|
|
286
|
-
const
|
|
290
|
+
}, ve = V(!1);
|
|
291
|
+
O && (ve.current = !0);
|
|
292
|
+
const Fe = U.length + (m ? 1 : 0), Ce = O && B.length === 0, Ue = m && d.length > 0, Ne = /* @__PURE__ */ v(
|
|
287
293
|
"table",
|
|
288
294
|
{
|
|
289
|
-
className:
|
|
295
|
+
className: c(
|
|
290
296
|
n.root,
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
297
|
+
Z && n.striped,
|
|
298
|
+
z && n.hoverable,
|
|
299
|
+
ee && n.compact,
|
|
300
|
+
De === "fixed" && n.layoutFixed,
|
|
301
|
+
o?.root,
|
|
296
302
|
i
|
|
297
303
|
),
|
|
298
|
-
style:
|
|
299
|
-
"aria-busy":
|
|
304
|
+
style: C,
|
|
305
|
+
"aria-busy": O || void 0,
|
|
300
306
|
children: [
|
|
301
|
-
/* @__PURE__ */
|
|
302
|
-
m && /* @__PURE__ */
|
|
307
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ v("tr", { children: [
|
|
308
|
+
m && /* @__PURE__ */ a(
|
|
303
309
|
"th",
|
|
304
310
|
{
|
|
305
|
-
className:
|
|
306
|
-
children: /* @__PURE__ */
|
|
307
|
-
|
|
311
|
+
className: c(n.headerCell, n.selectHeaderCell, o?.headerCell, o?.selectHeaderCell),
|
|
312
|
+
children: /* @__PURE__ */ a(
|
|
313
|
+
ke,
|
|
308
314
|
{
|
|
309
315
|
"aria-label": "Select all",
|
|
310
|
-
checked:
|
|
311
|
-
indeterminate:
|
|
312
|
-
disabled:
|
|
313
|
-
onChange:
|
|
316
|
+
checked: J,
|
|
317
|
+
indeterminate: Ke,
|
|
318
|
+
disabled: $.length === 0,
|
|
319
|
+
onChange: Le
|
|
314
320
|
}
|
|
315
321
|
)
|
|
316
322
|
}
|
|
317
323
|
),
|
|
318
|
-
|
|
324
|
+
U.map((e) => /* @__PURE__ */ v(
|
|
319
325
|
"th",
|
|
320
326
|
{
|
|
321
|
-
className:
|
|
327
|
+
className: c(
|
|
322
328
|
n.headerCell,
|
|
323
|
-
e.sortable && n.headerCellSortable,
|
|
329
|
+
_(e) && e.sortable && n.headerCellSortable,
|
|
324
330
|
e.sticky && n.headerCellSticky,
|
|
325
|
-
|
|
331
|
+
o?.headerCell
|
|
326
332
|
),
|
|
327
333
|
style: {
|
|
328
334
|
width: e.width,
|
|
329
335
|
textAlign: e.align
|
|
330
336
|
},
|
|
331
|
-
onClick: e.sortable ? (t) =>
|
|
332
|
-
"aria-sort": e.sortable ?
|
|
337
|
+
onClick: _(e) && e.sortable ? (t) => We(e.key, t, e.defaultSortDirection ?? "asc") : void 0,
|
|
338
|
+
"aria-sort": _(e) && e.sortable ? ce(P(e)) === "asc" ? "ascending" : ce(P(e)) === "desc" ? "descending" : "none" : void 0,
|
|
333
339
|
children: [
|
|
334
340
|
e.header,
|
|
335
|
-
e.sortable && /* @__PURE__ */
|
|
336
|
-
|
|
341
|
+
_(e) && e.sortable && /* @__PURE__ */ a(
|
|
342
|
+
et,
|
|
337
343
|
{
|
|
338
|
-
direction:
|
|
339
|
-
sortIndex:
|
|
344
|
+
direction: ce(P(e)),
|
|
345
|
+
sortIndex: Ve(P(e))
|
|
340
346
|
}
|
|
341
347
|
)
|
|
342
348
|
]
|
|
343
349
|
},
|
|
344
|
-
e
|
|
350
|
+
P(e)
|
|
345
351
|
))
|
|
346
352
|
] }) }),
|
|
347
|
-
/* @__PURE__ */
|
|
348
|
-
m && /* @__PURE__ */
|
|
349
|
-
|
|
350
|
-
] }, `loading-${t}`)) :
|
|
351
|
-
const r =
|
|
353
|
+
/* @__PURE__ */ a("tbody", { children: Ce ? Array.from({ length: Math.max(1, Ie) }, (e, t) => /* @__PURE__ */ v("tr", { className: c(n.row, n.loadingRow, o?.row, o?.loadingRow), "aria-hidden": "true", children: [
|
|
354
|
+
m && /* @__PURE__ */ a("td", { className: c(n.cell, n.selectCell, o?.cell) }),
|
|
355
|
+
U.map((r) => /* @__PURE__ */ a("td", { className: c(n.cell, o?.cell), children: /* @__PURE__ */ a(Ze, { variant: "text" }) }, P(r)))
|
|
356
|
+
] }, `loading-${t}`)) : B.length === 0 ? /* @__PURE__ */ a("tr", { className: n.emptyRow, children: /* @__PURE__ */ a("td", { className: c(n.emptyCell, o?.emptyCell), colSpan: Fe, children: xe }) }) : B.map((e, t) => {
|
|
357
|
+
const r = R ? String(e[R]) : t, f = m ? M(e, t) : null, g = f !== null && G.has(f), S = typeof te == "function" ? te(e, t) : te, b = typeof ne == "function" ? ne(e, t) : ne;
|
|
352
358
|
return /* @__PURE__ */ v(
|
|
353
359
|
"tr",
|
|
354
360
|
{
|
|
355
|
-
className:
|
|
361
|
+
className: c(
|
|
356
362
|
n.row,
|
|
357
363
|
N && n.rowClickable,
|
|
358
364
|
g && n.rowSelected,
|
|
359
|
-
|
|
360
|
-
N &&
|
|
361
|
-
g &&
|
|
362
|
-
|
|
365
|
+
o?.row,
|
|
366
|
+
N && o?.rowClickable,
|
|
367
|
+
g && o?.rowSelected,
|
|
368
|
+
S
|
|
363
369
|
),
|
|
364
370
|
style: b,
|
|
365
371
|
tabIndex: N ? 0 : void 0,
|
|
366
|
-
onClick: N ? (
|
|
367
|
-
onKeyDown: N ? (
|
|
372
|
+
onClick: N ? (l) => qe(e, t, l) : void 0,
|
|
373
|
+
onKeyDown: N ? (l) => Oe(e, t, l) : void 0,
|
|
368
374
|
"aria-selected": m ? g : void 0,
|
|
369
375
|
children: [
|
|
370
|
-
m && /* @__PURE__ */
|
|
371
|
-
|
|
376
|
+
m && /* @__PURE__ */ a("td", { className: c(n.cell, n.selectCell, o?.cell, o?.selectCell), children: /* @__PURE__ */ a(
|
|
377
|
+
ke,
|
|
372
378
|
{
|
|
373
379
|
"aria-label": "Select row",
|
|
374
380
|
checked: g,
|
|
375
|
-
disabled: !
|
|
376
|
-
onChange: (
|
|
381
|
+
disabled: !j(e),
|
|
382
|
+
onChange: (l) => Re(e, t, l)
|
|
377
383
|
}
|
|
378
384
|
) }),
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
385
|
+
U.map((l) => {
|
|
386
|
+
let h, k, x;
|
|
387
|
+
if (_(l)) {
|
|
388
|
+
const E = e[l.key];
|
|
389
|
+
k = typeof l.cellClassName == "function" ? l.cellClassName(E, e, t) : l.cellClassName, x = typeof l.cellStyle == "function" ? l.cellStyle(E, e, t) : l.cellStyle, h = l.render ? l.render(E, e, t) : E;
|
|
390
|
+
} else
|
|
391
|
+
k = typeof l.cellClassName == "function" ? l.cellClassName(e, t) : l.cellClassName, x = typeof l.cellStyle == "function" ? l.cellStyle(e, t) : l.cellStyle, h = l.render(e, t);
|
|
392
|
+
return /* @__PURE__ */ a(
|
|
382
393
|
"td",
|
|
383
394
|
{
|
|
384
|
-
className:
|
|
395
|
+
className: c(
|
|
385
396
|
n.cell,
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
397
|
+
l.sticky && n.cellSticky,
|
|
398
|
+
o?.cell,
|
|
399
|
+
k
|
|
389
400
|
),
|
|
390
|
-
style: { textAlign:
|
|
391
|
-
children:
|
|
401
|
+
style: { textAlign: l.align, ...x },
|
|
402
|
+
children: h
|
|
392
403
|
},
|
|
393
|
-
|
|
404
|
+
P(l)
|
|
394
405
|
);
|
|
395
406
|
})
|
|
396
407
|
]
|
|
@@ -400,46 +411,46 @@ function et({
|
|
|
400
411
|
}) })
|
|
401
412
|
]
|
|
402
413
|
}
|
|
403
|
-
),
|
|
414
|
+
), Ge = { selectedKeys: d, selectedRows: $e, clear: ge };
|
|
404
415
|
return /* @__PURE__ */ v(
|
|
405
416
|
"div",
|
|
406
417
|
{
|
|
407
|
-
ref:
|
|
408
|
-
className:
|
|
418
|
+
ref: oe,
|
|
419
|
+
className: c(
|
|
409
420
|
n.wrapper,
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
421
|
+
Te && n.scrollable,
|
|
422
|
+
Xe && n.dragging,
|
|
423
|
+
o?.wrapper
|
|
413
424
|
),
|
|
414
|
-
onPointerDown: p ?
|
|
415
|
-
onPointerMove: p ?
|
|
416
|
-
onPointerUp: p ?
|
|
417
|
-
onPointerCancel: p ?
|
|
418
|
-
onContextMenu: p ?
|
|
425
|
+
onPointerDown: p ? He : void 0,
|
|
426
|
+
onPointerMove: p ? _e : void 0,
|
|
427
|
+
onPointerUp: p ? ye : void 0,
|
|
428
|
+
onPointerCancel: p ? ye : void 0,
|
|
429
|
+
onContextMenu: p ? je : void 0,
|
|
419
430
|
children: [
|
|
420
|
-
|
|
421
|
-
/* @__PURE__ */
|
|
422
|
-
/* @__PURE__ */
|
|
423
|
-
|
|
431
|
+
Ue && /* @__PURE__ */ v("div", { className: c(n.bulkBar, o?.bulkBar), role: "region", "aria-label": "Selected rows", children: [
|
|
432
|
+
/* @__PURE__ */ a("span", { className: c(n.bulkLabel, o?.bulkLabel), children: fe ? fe(d.length) : `${d.length} selected` }),
|
|
433
|
+
/* @__PURE__ */ a("button", { type: "button", className: c(n.bulkClear, o?.bulkClear), onClick: ge, children: "Clear" }),
|
|
434
|
+
F !== void 0 && /* @__PURE__ */ a("div", { className: c(n.bulkActions, o?.bulkActions), children: typeof F == "function" ? F(Ge) : F })
|
|
424
435
|
] }),
|
|
425
|
-
|
|
436
|
+
O !== void 0 && (O || ve.current) ? (
|
|
426
437
|
// Once a consumer has used `loading`, keep the wrapper so toggling it
|
|
427
438
|
// doesn't remount the table (focus, scroll position).
|
|
428
|
-
/* @__PURE__ */
|
|
429
|
-
) :
|
|
430
|
-
A && /* @__PURE__ */
|
|
431
|
-
|
|
439
|
+
/* @__PURE__ */ a(Ye, { loading: O && !Ce, delay: 150, backdrop: "dim", classes: { root: n.loaderWrap }, children: Ne })
|
|
440
|
+
) : Ne,
|
|
441
|
+
A && /* @__PURE__ */ a(
|
|
442
|
+
tt,
|
|
432
443
|
{
|
|
433
444
|
...A,
|
|
434
|
-
totalRows:
|
|
435
|
-
paginatorClasses: { paginator:
|
|
445
|
+
totalRows: we,
|
|
446
|
+
paginatorClasses: { paginator: o?.paginator, pageButton: o?.pageButton }
|
|
436
447
|
}
|
|
437
448
|
)
|
|
438
449
|
]
|
|
439
450
|
}
|
|
440
451
|
);
|
|
441
452
|
}
|
|
442
|
-
const
|
|
453
|
+
const ut = nt;
|
|
443
454
|
export {
|
|
444
|
-
|
|
455
|
+
ut as Table
|
|
445
456
|
};
|