asterui 0.12.58 → 0.12.59
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/components/Autocomplete.js +1 -1
- package/dist/components/Autocomplete.js.map +1 -1
- package/dist/components/Button.js +1 -1
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Checkbox.js +1 -1
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/ColorPicker.js +1 -1
- package/dist/components/ColorPicker.js.map +1 -1
- package/dist/components/CopyButton.js +1 -1
- package/dist/components/CopyButton.js.map +1 -1
- package/dist/components/Countdown.js +1 -1
- package/dist/components/Countdown.js.map +1 -1
- package/dist/components/DatePicker.js +1 -1
- package/dist/components/DatePicker.js.map +1 -1
- package/dist/components/Dock.js +1 -1
- package/dist/components/Dock.js.map +1 -1
- package/dist/components/Empty.js +1 -1
- package/dist/components/Empty.js.map +1 -1
- package/dist/components/FileInput.js +1 -1
- package/dist/components/FileInput.js.map +1 -1
- package/dist/components/Filter.js +1 -1
- package/dist/components/Filter.js.map +1 -1
- package/dist/components/Form.js +1 -1
- package/dist/components/Form.js.map +1 -1
- package/dist/components/Input.js +1 -1
- package/dist/components/Input.js.map +1 -1
- package/dist/components/InputNumber.js +1 -1
- package/dist/components/InputNumber.js.map +1 -1
- package/dist/components/List.js +1 -1
- package/dist/components/List.js.map +1 -1
- package/dist/components/Loading.js +1 -1
- package/dist/components/Loading.js.map +1 -1
- package/dist/components/Modal.js +1 -1
- package/dist/components/Modal.js.map +1 -1
- package/dist/components/OTPInput.js +1 -1
- package/dist/components/OTPInput.js.map +1 -1
- package/dist/components/Pagination.js +1 -1
- package/dist/components/Pagination.js.map +1 -1
- package/dist/components/Popconfirm.js +1 -1
- package/dist/components/Popconfirm.js.map +1 -1
- package/dist/components/Radio.js +1 -1
- package/dist/components/Radio.js.map +1 -1
- package/dist/components/Range.js +1 -1
- package/dist/components/Range.js.map +1 -1
- package/dist/components/Rating.js +1 -1
- package/dist/components/Rating.js.map +1 -1
- package/dist/components/RichTextEditor.js +1 -1
- package/dist/components/RichTextEditor.js.map +1 -1
- package/dist/components/Segmented.js +1 -1
- package/dist/components/Segmented.js.map +1 -1
- package/dist/components/Select.js +1 -1
- package/dist/components/Select.js.map +1 -1
- package/dist/components/Table.d.ts +19 -0
- package/dist/components/Table.js +348 -310
- package/dist/components/Table.js.map +1 -1
- package/dist/components/Tabs.js +1 -1
- package/dist/components/Tabs.js.map +1 -1
- package/dist/components/Textarea.js +1 -1
- package/dist/components/Textarea.js.map +1 -1
- package/dist/components/ThemeController.js +1 -1
- package/dist/components/ThemeController.js.map +1 -1
- package/dist/components/TimePicker.js +1 -1
- package/dist/components/TimePicker.js.map +1 -1
- package/dist/components/Toggle.js +1 -1
- package/dist/components/Toggle.js.map +1 -1
- package/dist/hooks/useTheme.d.ts +1 -1
- package/dist/hooks/useTheme.js +1 -1
- package/dist/hooks/useTheme.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/providers/ConfigProvider.js.map +1 -0
- package/dist/providers/ThemeProvider.js.map +1 -0
- package/package.json +1 -1
- package/dist/components/ConfigProvider.js.map +0 -1
- package/dist/components/ThemeProvider.js.map +0 -1
- /package/dist/{components → providers}/ConfigProvider.d.ts +0 -0
- /package/dist/{components → providers}/ConfigProvider.js +0 -0
- /package/dist/{components → providers}/ThemeProvider.d.ts +0 -0
- /package/dist/{components → providers}/ThemeProvider.js +0 -0
package/dist/components/Table.js
CHANGED
|
@@ -1,82 +1,97 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as a, jsxs as x } from "react/jsx-runtime";
|
|
2
|
+
import bt, { forwardRef as yt, useState as j, useMemo as G, useCallback as z, useId as mt } from "react";
|
|
3
|
+
import { useConfig as xt } from "../providers/ConfigProvider.js";
|
|
4
|
+
const gt = "table", $t = "table-xs", vt = "table-sm", kt = "table-md", Ct = "table-lg", Nt = "table-xl", wt = "table-zebra", St = "table-pin-rows", Rt = "table-pin-cols", Et = "dropdown", zt = "dropdown-end", Kt = "dropdown-content", D = "btn", be = "btn-ghost", ye = "btn-xs", ue = "btn-sm", Tt = "btn-square", It = "btn-active", Pt = "menu", me = "checkbox", De = "checkbox-xs", jt = "checkbox-sm", Bt = "checkbox-md", Be = "checkbox-lg", xe = "checkbox-primary", Lt = "radio", Ft = "radio-xs", Dt = "radio-sm", Ot = "radio-md", Le = "radio-lg", At = "radio-primary", Mt = "divider", Vt = "loading", Wt = "loading-spinner", Xt = "loading-lg", Jt = "join", pe = "join-item", Gt = "select", qt = "select-sm", Qt = "select-bordered", Ht = "input", Yt = "input-sm", Zt = "input-bordered", _t = {
|
|
5
|
+
xs: $t,
|
|
6
|
+
sm: vt,
|
|
7
|
+
md: kt,
|
|
8
|
+
lg: Ct,
|
|
9
|
+
xl: Nt
|
|
10
|
+
}, Fe = {
|
|
11
|
+
xs: De,
|
|
12
|
+
sm: jt,
|
|
13
|
+
md: Bt,
|
|
14
|
+
lg: Be,
|
|
15
|
+
xl: Be
|
|
16
|
+
// DaisyUI max is lg
|
|
17
|
+
}, Ut = {
|
|
18
|
+
xs: Ft,
|
|
19
|
+
sm: Dt,
|
|
20
|
+
md: Ot,
|
|
21
|
+
lg: Le,
|
|
22
|
+
xl: Le
|
|
23
|
+
// DaisyUI max is lg
|
|
9
24
|
};
|
|
10
|
-
function
|
|
11
|
-
filters:
|
|
25
|
+
function es({
|
|
26
|
+
filters: c,
|
|
12
27
|
selectedValues: v,
|
|
13
|
-
onChange:
|
|
14
|
-
locale:
|
|
15
|
-
testId:
|
|
28
|
+
onChange: k,
|
|
29
|
+
locale: se,
|
|
30
|
+
testId: B
|
|
16
31
|
}) {
|
|
17
|
-
const [
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
32
|
+
const [O, A] = j(!1), q = mt(), Q = (n) => {
|
|
33
|
+
const f = v.includes(n) ? v.filter((N) => N !== n) : [...v, n];
|
|
34
|
+
k(f);
|
|
35
|
+
}, ae = () => {
|
|
36
|
+
k([]), A(!1);
|
|
37
|
+
}, l = (n) => {
|
|
38
|
+
n.key === "Escape" && A(!1);
|
|
24
39
|
};
|
|
25
|
-
return /* @__PURE__ */
|
|
40
|
+
return /* @__PURE__ */ x("div", { className: `${Et} ${zt}`, onKeyDown: l, children: [
|
|
26
41
|
/* @__PURE__ */ a(
|
|
27
42
|
"button",
|
|
28
43
|
{
|
|
29
44
|
type: "button",
|
|
30
|
-
className: `${
|
|
31
|
-
onClick: () =>
|
|
45
|
+
className: `${D} ${be} ${ye} ${v.length > 0 ? "text-primary" : ""}`,
|
|
46
|
+
onClick: () => A(!O),
|
|
32
47
|
"aria-label": "Filter column",
|
|
33
|
-
"aria-expanded":
|
|
48
|
+
"aria-expanded": O,
|
|
34
49
|
"aria-haspopup": "listbox",
|
|
35
|
-
"aria-controls":
|
|
36
|
-
"data-testid": `${
|
|
50
|
+
"aria-controls": q,
|
|
51
|
+
"data-testid": `${B}-filter-button`,
|
|
37
52
|
children: /* @__PURE__ */ a("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" }) })
|
|
38
53
|
}
|
|
39
54
|
),
|
|
40
|
-
|
|
55
|
+
O && /* @__PURE__ */ x(
|
|
41
56
|
"div",
|
|
42
57
|
{
|
|
43
|
-
id:
|
|
58
|
+
id: q,
|
|
44
59
|
role: "listbox",
|
|
45
60
|
"aria-multiselectable": "true",
|
|
46
|
-
className: `${
|
|
47
|
-
"data-testid": `${
|
|
61
|
+
className: `${Kt} z-[1] ${Pt} p-2 shadow bg-base-100 rounded-box w-52 border border-base-content/10`,
|
|
62
|
+
"data-testid": `${B}-filter-dropdown`,
|
|
48
63
|
children: [
|
|
49
|
-
/* @__PURE__ */ a("div", { className: "space-y-2", children:
|
|
64
|
+
/* @__PURE__ */ a("div", { className: "space-y-2", children: c.map((n) => /* @__PURE__ */ x(
|
|
50
65
|
"label",
|
|
51
66
|
{
|
|
52
67
|
className: "flex items-center gap-2 cursor-pointer p-2 hover:bg-base-200 rounded",
|
|
53
68
|
role: "option",
|
|
54
|
-
"aria-selected": v.includes(
|
|
69
|
+
"aria-selected": v.includes(n.value),
|
|
55
70
|
children: [
|
|
56
71
|
/* @__PURE__ */ a(
|
|
57
72
|
"input",
|
|
58
73
|
{
|
|
59
74
|
type: "checkbox",
|
|
60
|
-
className: `${
|
|
61
|
-
checked: v.includes(
|
|
62
|
-
onChange: () =>
|
|
63
|
-
"data-testid": `${
|
|
75
|
+
className: `${me} ${De} ${xe}`,
|
|
76
|
+
checked: v.includes(n.value),
|
|
77
|
+
onChange: () => Q(n.value),
|
|
78
|
+
"data-testid": `${B}-filter-${String(n.value)}`
|
|
64
79
|
}
|
|
65
80
|
),
|
|
66
|
-
/* @__PURE__ */ a("span", { className: "text-sm", children:
|
|
81
|
+
/* @__PURE__ */ a("span", { className: "text-sm", children: n.text })
|
|
67
82
|
]
|
|
68
83
|
},
|
|
69
|
-
String(
|
|
84
|
+
String(n.value)
|
|
70
85
|
)) }),
|
|
71
|
-
/* @__PURE__ */ a("div", { className: `${
|
|
86
|
+
/* @__PURE__ */ a("div", { className: `${Mt} my-1` }),
|
|
72
87
|
/* @__PURE__ */ a(
|
|
73
88
|
"button",
|
|
74
89
|
{
|
|
75
90
|
type: "button",
|
|
76
|
-
className: `${
|
|
77
|
-
onClick:
|
|
78
|
-
"data-testid": `${
|
|
79
|
-
children:
|
|
91
|
+
className: `${D} ${be} ${ye} w-full`,
|
|
92
|
+
onClick: ae,
|
|
93
|
+
"data-testid": `${B}-filter-reset`,
|
|
94
|
+
children: se?.filterReset ?? "Clear"
|
|
80
95
|
}
|
|
81
96
|
)
|
|
82
97
|
]
|
|
@@ -84,21 +99,21 @@ function Pt({
|
|
|
84
99
|
)
|
|
85
100
|
] });
|
|
86
101
|
}
|
|
87
|
-
function
|
|
102
|
+
function ts({ expanded: c, onExpand: v }) {
|
|
88
103
|
return /* @__PURE__ */ a(
|
|
89
104
|
"button",
|
|
90
105
|
{
|
|
91
106
|
type: "button",
|
|
92
|
-
className: `${
|
|
93
|
-
onClick: (
|
|
94
|
-
|
|
107
|
+
className: `${D} ${be} ${ye} ${Tt}`,
|
|
108
|
+
onClick: (k) => {
|
|
109
|
+
k.stopPropagation(), v();
|
|
95
110
|
},
|
|
96
|
-
"aria-label":
|
|
97
|
-
"aria-expanded":
|
|
111
|
+
"aria-label": c ? "Collapse row" : "Expand row",
|
|
112
|
+
"aria-expanded": c,
|
|
98
113
|
children: /* @__PURE__ */ a(
|
|
99
114
|
"svg",
|
|
100
115
|
{
|
|
101
|
-
className: `w-4 h-4 transition-transform ${
|
|
116
|
+
className: `w-4 h-4 transition-transform ${c ? "rotate-90" : ""}`,
|
|
102
117
|
fill: "none",
|
|
103
118
|
stroke: "currentColor",
|
|
104
119
|
viewBox: "0 0 24 24",
|
|
@@ -109,180 +124,193 @@ function It({ expanded: i, onExpand: v }) {
|
|
|
109
124
|
}
|
|
110
125
|
);
|
|
111
126
|
}
|
|
112
|
-
function
|
|
113
|
-
columns:
|
|
127
|
+
function ss({
|
|
128
|
+
columns: c,
|
|
114
129
|
dataSource: v,
|
|
115
|
-
rowKey:
|
|
116
|
-
loading:
|
|
117
|
-
size:
|
|
118
|
-
bordered:
|
|
119
|
-
hoverable:
|
|
120
|
-
striped:
|
|
121
|
-
pinRows:
|
|
122
|
-
pinCols:
|
|
123
|
-
pagination:
|
|
124
|
-
rowSelection:
|
|
125
|
-
expandable:
|
|
126
|
-
scroll:
|
|
127
|
-
className:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
130
|
+
rowKey: k = "id",
|
|
131
|
+
loading: se = !1,
|
|
132
|
+
size: B,
|
|
133
|
+
bordered: O = !1,
|
|
134
|
+
hoverable: A = !0,
|
|
135
|
+
striped: q = !1,
|
|
136
|
+
pinRows: Q = !1,
|
|
137
|
+
pinCols: ae = !1,
|
|
138
|
+
pagination: l,
|
|
139
|
+
rowSelection: n,
|
|
140
|
+
expandable: f,
|
|
141
|
+
scroll: N,
|
|
142
|
+
className: Oe = "",
|
|
143
|
+
showHeader: Ae = !0,
|
|
144
|
+
rowClassName: ne,
|
|
145
|
+
onRow: Me,
|
|
146
|
+
onHeaderRow: Ve,
|
|
147
|
+
onChange: K,
|
|
148
|
+
onSortChange: ge,
|
|
149
|
+
onFilterChange: $e,
|
|
150
|
+
locale: M,
|
|
151
|
+
title: ve,
|
|
152
|
+
footer: ke,
|
|
153
|
+
summary: Ce,
|
|
154
|
+
"data-testid": We,
|
|
155
|
+
"aria-label": Xe,
|
|
156
|
+
...Je
|
|
157
|
+
}, Ge) {
|
|
158
|
+
const { componentSize: qe, locale: V } = xt(), H = B ?? qe ?? "md", oe = {
|
|
159
|
+
emptyText: M?.emptyText ?? V?.Table?.emptyText ?? "No data",
|
|
160
|
+
filterConfirm: M?.filterConfirm ?? V?.Table?.filterConfirm ?? "OK",
|
|
161
|
+
filterReset: M?.filterReset ?? V?.Table?.filterReset ?? "Reset",
|
|
162
|
+
selectAll: M?.selectAll ?? V?.Table?.selectAll ?? "Select all",
|
|
163
|
+
selectInvert: M?.selectInvert ?? V?.Table?.selectInvert ?? "Invert selection"
|
|
164
|
+
}, p = We ?? "table", Qe = 10, [R, Y] = j(
|
|
165
|
+
l !== !1 && l?.current ? l.current : 1
|
|
166
|
+
), [He, Ye] = j(
|
|
167
|
+
l !== !1 && l?.pageSize ? l.pageSize : Qe
|
|
168
|
+
), w = l !== !1 && l?.pageSize !== void 0 ? l.pageSize : He, [Ne, Ze] = j(() => {
|
|
169
|
+
const e = c.find((s) => s.sortOrder !== void 0);
|
|
143
170
|
if (e)
|
|
144
171
|
return {
|
|
145
172
|
columnKey: e.key,
|
|
146
173
|
order: e.sortOrder ?? null
|
|
147
174
|
};
|
|
148
|
-
const t =
|
|
175
|
+
const t = c.find((s) => s.defaultSortOrder);
|
|
149
176
|
return {
|
|
150
177
|
columnKey: t?.key || null,
|
|
151
178
|
order: t?.defaultSortOrder || null
|
|
152
179
|
};
|
|
153
|
-
}), [
|
|
180
|
+
}), [we, _e] = j(() => {
|
|
154
181
|
const e = {};
|
|
155
|
-
return
|
|
182
|
+
return c.forEach((t) => {
|
|
156
183
|
t.filteredValue !== void 0 ? e[t.key] = t.filteredValue : t.defaultFilteredValue && (e[t.key] = t.defaultFilteredValue);
|
|
157
184
|
}), e;
|
|
158
|
-
}), [
|
|
159
|
-
|
|
160
|
-
), [
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
185
|
+
}), [Ue, re] = j(
|
|
186
|
+
n?.selectedRowKeys || []
|
|
187
|
+
), [et, tt] = j(() => f?.expandedRowKeys ? f.expandedRowKeys : f?.defaultExpandedRowKeys ? f.defaultExpandedRowKeys : f?.defaultExpandAllRows ? v.map((e, t) => {
|
|
188
|
+
if (typeof k == "function") return k(e);
|
|
189
|
+
const s = e[k];
|
|
190
|
+
return String(s !== void 0 ? s : t);
|
|
191
|
+
}) : []), Z = c.some((e) => e.sortOrder !== void 0), _ = c.some((e) => e.filteredValue !== void 0), le = f?.expandedRowKeys !== void 0, L = n?.selectedRowKeys !== void 0, b = G(() => {
|
|
192
|
+
if (Z) {
|
|
193
|
+
const e = c.find((t) => t.sortOrder !== void 0 && t.sortOrder !== null);
|
|
165
194
|
return {
|
|
166
195
|
columnKey: e?.key ?? null,
|
|
167
196
|
order: e?.sortOrder ?? null
|
|
168
197
|
};
|
|
169
198
|
}
|
|
170
|
-
return
|
|
171
|
-
}, [
|
|
172
|
-
if (
|
|
199
|
+
return Ne;
|
|
200
|
+
}, [Z, c, Ne]), T = G(() => {
|
|
201
|
+
if (_) {
|
|
173
202
|
const e = {};
|
|
174
|
-
return
|
|
203
|
+
return c.forEach((t) => {
|
|
175
204
|
t.filteredValue !== void 0 && (e[t.key] = t.filteredValue);
|
|
176
205
|
}), e;
|
|
177
206
|
}
|
|
178
|
-
return
|
|
179
|
-
}, [
|
|
180
|
-
if (typeof
|
|
181
|
-
return
|
|
182
|
-
const s = e[
|
|
207
|
+
return we;
|
|
208
|
+
}, [_, c, we]), F = L ? n.selectedRowKeys : Ue, W = le ? f.expandedRowKeys : et, U = l !== !1, y = G(() => c.filter((e) => !e.hidden), [c]), E = z((e, t) => {
|
|
209
|
+
if (typeof k == "function")
|
|
210
|
+
return k(e);
|
|
211
|
+
const s = e[k];
|
|
183
212
|
return String(s !== void 0 ? s : t);
|
|
184
|
-
}, [
|
|
213
|
+
}, [k]), ee = G(() => {
|
|
185
214
|
let e = [...v];
|
|
186
|
-
return Object.entries(
|
|
215
|
+
return Object.entries(T).forEach(([t, s]) => {
|
|
187
216
|
if (s && s.length > 0) {
|
|
188
|
-
const r =
|
|
217
|
+
const r = c.find((o) => o.key === t);
|
|
189
218
|
r?.onFilter && (e = e.filter(
|
|
190
|
-
(
|
|
219
|
+
(o) => s.some((i) => r.onFilter(i, o))
|
|
191
220
|
));
|
|
192
221
|
}
|
|
193
222
|
}), e;
|
|
194
|
-
}, [v,
|
|
195
|
-
if (!
|
|
196
|
-
return
|
|
197
|
-
const e =
|
|
223
|
+
}, [v, T, c]), C = G(() => {
|
|
224
|
+
if (!b.columnKey || !b.order)
|
|
225
|
+
return ee;
|
|
226
|
+
const e = c.find((s) => s.key === b.columnKey);
|
|
198
227
|
if (!e?.sorter)
|
|
199
|
-
return
|
|
200
|
-
const t = [...
|
|
228
|
+
return ee;
|
|
229
|
+
const t = [...ee];
|
|
201
230
|
return t.sort((s, r) => {
|
|
202
|
-
let
|
|
231
|
+
let o = 0;
|
|
203
232
|
if (typeof e.sorter == "function")
|
|
204
|
-
|
|
233
|
+
o = e.sorter(s, r);
|
|
205
234
|
else if (e.dataIndex) {
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
208
|
-
if (
|
|
209
|
-
|
|
235
|
+
const i = s[e.dataIndex], u = r[e.dataIndex];
|
|
236
|
+
if (i == null) return 1;
|
|
237
|
+
if (u == null) return -1;
|
|
238
|
+
i < u && (o = -1), i > u && (o = 1);
|
|
210
239
|
}
|
|
211
|
-
return
|
|
240
|
+
return b.order === "ascend" ? o : -o;
|
|
212
241
|
}), t;
|
|
213
|
-
}, [
|
|
214
|
-
if (
|
|
242
|
+
}, [ee, b, c]), I = l !== !1 && l?.total !== void 0 ? l.total : C.length, P = Math.ceil(I / w), ie = (R - 1) * w, Se = ie + w, S = U ? C.slice(ie, Se) : C, te = z((e) => {
|
|
243
|
+
if (Y(e), l !== !1 && l?.onChange && l.onChange(e, w), K) {
|
|
215
244
|
const t = {
|
|
216
|
-
column:
|
|
217
|
-
order:
|
|
218
|
-
field:
|
|
245
|
+
column: c.find((s) => s.key === b.columnKey),
|
|
246
|
+
order: b.order,
|
|
247
|
+
field: b.columnKey ?? void 0
|
|
219
248
|
};
|
|
220
|
-
|
|
221
|
-
{ current: e, pageSize: w, total:
|
|
222
|
-
|
|
249
|
+
K(
|
|
250
|
+
{ current: e, pageSize: w, total: I },
|
|
251
|
+
T,
|
|
223
252
|
t,
|
|
224
|
-
{ currentDataSource:
|
|
253
|
+
{ currentDataSource: C, action: "paginate" }
|
|
225
254
|
);
|
|
226
255
|
}
|
|
227
|
-
}, [
|
|
228
|
-
|
|
229
|
-
}, [
|
|
230
|
-
const t =
|
|
256
|
+
}, [l, w, K, c, b, T, C, I]), st = z((e) => {
|
|
257
|
+
Ye(e), Y(1), l !== !1 && l?.onShowSizeChange && l.onShowSizeChange(1, e), l !== !1 && l?.onChange && l.onChange(1, e);
|
|
258
|
+
}, [l]), Re = z((e) => {
|
|
259
|
+
const t = c.find((o) => o.key === e);
|
|
231
260
|
let s = "ascend";
|
|
232
|
-
|
|
261
|
+
b.columnKey === e && (b.order === "ascend" ? s = "descend" : b.order === "descend" && (s = null)), Z || Ze({ columnKey: s ? e : null, order: s }), Y(1);
|
|
233
262
|
const r = {
|
|
234
263
|
column: t,
|
|
235
264
|
order: s,
|
|
236
265
|
field: e
|
|
237
266
|
};
|
|
238
|
-
|
|
239
|
-
{ current: 1, pageSize: w, total:
|
|
240
|
-
|
|
267
|
+
ge?.(r), K && K(
|
|
268
|
+
{ current: 1, pageSize: w, total: I },
|
|
269
|
+
T,
|
|
241
270
|
r,
|
|
242
|
-
{ currentDataSource:
|
|
271
|
+
{ currentDataSource: C, action: "sort" }
|
|
243
272
|
);
|
|
244
|
-
}, [
|
|
273
|
+
}, [c, b, Z, w, I, T, C, ge, K]), at = z((e, t) => {
|
|
245
274
|
const s = {
|
|
246
|
-
...
|
|
275
|
+
...T,
|
|
247
276
|
[e]: t
|
|
248
277
|
};
|
|
249
|
-
if (
|
|
278
|
+
if (_ || _e(s), Y(1), $e?.(s), K) {
|
|
250
279
|
const r = {
|
|
251
|
-
column:
|
|
252
|
-
order:
|
|
253
|
-
field:
|
|
280
|
+
column: c.find((o) => o.key === b.columnKey),
|
|
281
|
+
order: b.order,
|
|
282
|
+
field: b.columnKey ?? void 0
|
|
254
283
|
};
|
|
255
|
-
|
|
256
|
-
{ current: 1, pageSize: w, total:
|
|
284
|
+
K(
|
|
285
|
+
{ current: 1, pageSize: w, total: I },
|
|
257
286
|
s,
|
|
258
287
|
r,
|
|
259
|
-
{ currentDataSource:
|
|
288
|
+
{ currentDataSource: C, action: "filter" }
|
|
260
289
|
);
|
|
261
290
|
}
|
|
262
|
-
}, [
|
|
263
|
-
const t = e ?
|
|
264
|
-
if (
|
|
265
|
-
const s = e ?
|
|
266
|
-
|
|
291
|
+
}, [T, _, c, b, w, I, C, $e, K]), nt = z((e) => {
|
|
292
|
+
const t = e ? S.map((s, r) => E(s, r)) : [];
|
|
293
|
+
if (L || re(t), n?.onChange) {
|
|
294
|
+
const s = e ? S : [];
|
|
295
|
+
n.onChange(t, s);
|
|
267
296
|
}
|
|
268
|
-
}, [
|
|
269
|
-
const
|
|
270
|
-
if (
|
|
271
|
-
const o = s ? [
|
|
272
|
-
|
|
297
|
+
}, [S, E, L, n]), ot = z((e, t, s, r) => {
|
|
298
|
+
const o = E(e, t);
|
|
299
|
+
if (n?.type === "radio") {
|
|
300
|
+
const d = s ? [o] : [], h = s ? [e] : [];
|
|
301
|
+
L || re(d), n?.onSelect?.(e, s, h, r), n?.onChange?.(d, h);
|
|
273
302
|
return;
|
|
274
303
|
}
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}, [S, M, se, y]), We = N((e, t, s) => {
|
|
304
|
+
const i = s ? [...F, o] : F.filter((d) => d !== o);
|
|
305
|
+
L || re(i);
|
|
306
|
+
const u = C.filter(
|
|
307
|
+
(d, h) => i.includes(E(d, h))
|
|
308
|
+
);
|
|
309
|
+
n?.onSelect?.(e, s, u, r), n?.onChange?.(i, u);
|
|
310
|
+
}, [E, n, L, F, C]), de = z((e, t) => {
|
|
311
|
+
const s = E(e, t), r = W.includes(s), o = r ? W.filter((i) => i !== s) : [...W, s];
|
|
312
|
+
le || tt(o), f?.onExpand?.(!r, e), f?.onExpandedRowsChange?.(o);
|
|
313
|
+
}, [E, W, le, f]), rt = z((e, t, s) => {
|
|
286
314
|
if (e.render)
|
|
287
315
|
return e.render(
|
|
288
316
|
e.dataIndex ? t[e.dataIndex] : void 0,
|
|
@@ -294,131 +322,131 @@ function jt({
|
|
|
294
322
|
return r != null ? String(r) : "";
|
|
295
323
|
}
|
|
296
324
|
return "";
|
|
297
|
-
}, []),
|
|
298
|
-
const s =
|
|
325
|
+
}, []), Ee = (e) => e === "center" ? "text-center" : e === "right" ? "text-right" : "text-left", ze = z((e, t = !1) => {
|
|
326
|
+
const s = y[e];
|
|
299
327
|
if (!s?.fixed) return { className: "" };
|
|
300
328
|
const r = ["sticky", "bg-base-100"];
|
|
301
|
-
let
|
|
302
|
-
const
|
|
329
|
+
let o = 0;
|
|
330
|
+
const i = {
|
|
303
331
|
boxSizing: "border-box"
|
|
304
332
|
};
|
|
305
333
|
if (s.fixed === "left") {
|
|
306
|
-
for (let
|
|
307
|
-
if (
|
|
308
|
-
const
|
|
309
|
-
isNaN(
|
|
334
|
+
for (let d = 0; d < e; d++)
|
|
335
|
+
if (y[d].fixed === "left" && y[d].width) {
|
|
336
|
+
const h = y[d].width, m = typeof h == "number" ? h : parseInt(String(h));
|
|
337
|
+
isNaN(m) || (o += m);
|
|
310
338
|
}
|
|
311
|
-
|
|
312
|
-
let
|
|
313
|
-
for (let
|
|
314
|
-
if (
|
|
315
|
-
|
|
339
|
+
o === 0 ? r.push("left-0") : i.left = `${o}px`, r.push(t ? "z-30" : "z-20");
|
|
340
|
+
let u = -1;
|
|
341
|
+
for (let d = y.length - 1; d >= 0; d--)
|
|
342
|
+
if (y[d].fixed === "left") {
|
|
343
|
+
u = d;
|
|
316
344
|
break;
|
|
317
345
|
}
|
|
318
|
-
e ===
|
|
346
|
+
e === u && (i.boxShadow = "2px 0 4px rgba(0, 0, 0, 0.1)");
|
|
319
347
|
}
|
|
320
348
|
if (s.fixed === "right") {
|
|
321
|
-
for (let
|
|
322
|
-
if (
|
|
323
|
-
const
|
|
324
|
-
isNaN(
|
|
349
|
+
for (let d = e + 1; d < y.length; d++)
|
|
350
|
+
if (y[d].fixed === "right" && y[d].width) {
|
|
351
|
+
const h = y[d].width, m = typeof h == "number" ? h : parseInt(String(h));
|
|
352
|
+
isNaN(m) || (o += m);
|
|
325
353
|
}
|
|
326
|
-
|
|
354
|
+
o === 0 ? r.push("right-0") : i.right = `${o}px`, r.push(t ? "z-30" : "z-20"), e === y.findIndex((d) => d.fixed === "right") && (i.boxShadow = "-2px 0 4px rgba(0, 0, 0, 0.1)");
|
|
327
355
|
}
|
|
328
356
|
return {
|
|
329
357
|
className: r.filter(Boolean).join(" "),
|
|
330
|
-
style: Object.keys(
|
|
358
|
+
style: Object.keys(i).length > 0 ? i : void 0
|
|
331
359
|
};
|
|
332
|
-
}, [
|
|
333
|
-
|
|
360
|
+
}, [y]), lt = [
|
|
361
|
+
gt,
|
|
334
362
|
"bg-base-100",
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
].filter(Boolean).join(" "),
|
|
341
|
-
|
|
342
|
-
const
|
|
343
|
-
(!
|
|
344
|
-
|
|
363
|
+
_t[H],
|
|
364
|
+
q && wt,
|
|
365
|
+
Q && St,
|
|
366
|
+
ae && Rt,
|
|
367
|
+
Oe
|
|
368
|
+
].filter(Boolean).join(" "), it = y.some((e) => e.fixed), Ke = f !== void 0, X = Ke && f?.showExpandColumn !== !1, J = {};
|
|
369
|
+
N?.x && (J.overflowX = "auto", J.maxWidth = typeof N.x == "number" ? `${N.x}px` : N.x), N?.y && (J.overflowY = "auto", J.maxHeight = typeof N.y == "number" ? `${N.y}px` : N.y);
|
|
370
|
+
const dt = [
|
|
371
|
+
(!Q || it || N?.x) && "overflow-x-auto",
|
|
372
|
+
O && "rounded-box border border-base-content/5 bg-base-100"
|
|
345
373
|
].filter(Boolean).join(" ");
|
|
346
|
-
if (
|
|
347
|
-
return /* @__PURE__ */ a("div", { className: "flex justify-center items-center p-8", "data-testid": `${p}-loading`, children: /* @__PURE__ */ a("span", { className: `${
|
|
348
|
-
const
|
|
349
|
-
if (!
|
|
350
|
-
const e =
|
|
351
|
-
return /* @__PURE__ */
|
|
352
|
-
|
|
374
|
+
if (se)
|
|
375
|
+
return /* @__PURE__ */ a("div", { className: "flex justify-center items-center p-8", "data-testid": `${p}-loading`, children: /* @__PURE__ */ a("span", { className: `${Vt} ${Wt} ${Xt}`, "aria-label": "Loading" }) });
|
|
376
|
+
const Te = S.length > 0 && S.every((e, t) => F.includes(E(e, t))), ct = S.some((e, t) => F.includes(E(e, t))), ft = oe?.emptyText ?? "No data", Ie = (n ? 1 : 0) + (X ? 1 : 0), Pe = () => {
|
|
377
|
+
if (!U || P <= 1 || typeof l == "boolean") return null;
|
|
378
|
+
const e = l ?? {}, t = e.position ?? "bottomRight", s = e.showSizeChanger, r = e.showQuickJumper, o = e.showTotal, i = e.pageSizeOptions ?? [10, 20, 50, 100], u = t.includes("Left") ? "justify-start" : t.includes("Center") ? "justify-center" : "justify-end";
|
|
379
|
+
return /* @__PURE__ */ x("div", { className: `flex items-center gap-4 ${u}`, "data-testid": `${p}-pagination`, children: [
|
|
380
|
+
o && /* @__PURE__ */ a("span", { className: "text-sm text-base-content/70", children: o(I, [ie + 1, Math.min(Se, I)]) }),
|
|
353
381
|
s && /* @__PURE__ */ a(
|
|
354
382
|
"select",
|
|
355
383
|
{
|
|
356
|
-
className: `${
|
|
384
|
+
className: `${Gt} ${qt} ${Qt}`,
|
|
357
385
|
value: w,
|
|
358
|
-
onChange: (
|
|
386
|
+
onChange: (h) => st(Number(h.target.value)),
|
|
359
387
|
"aria-label": "Page size",
|
|
360
388
|
"data-testid": `${p}-page-size`,
|
|
361
|
-
children:
|
|
362
|
-
|
|
389
|
+
children: i.map((h) => /* @__PURE__ */ x("option", { value: h, children: [
|
|
390
|
+
h,
|
|
363
391
|
" / page"
|
|
364
|
-
] },
|
|
392
|
+
] }, h))
|
|
365
393
|
}
|
|
366
394
|
),
|
|
367
|
-
/* @__PURE__ */
|
|
395
|
+
/* @__PURE__ */ x("div", { className: Jt, children: [
|
|
368
396
|
/* @__PURE__ */ a(
|
|
369
397
|
"button",
|
|
370
398
|
{
|
|
371
399
|
type: "button",
|
|
372
|
-
className: `${
|
|
373
|
-
onClick: () =>
|
|
374
|
-
disabled:
|
|
400
|
+
className: `${pe} ${D} ${ue}`,
|
|
401
|
+
onClick: () => te(R - 1),
|
|
402
|
+
disabled: R === 1,
|
|
375
403
|
"aria-label": "Previous page",
|
|
376
404
|
"data-testid": `${p}-prev`,
|
|
377
405
|
children: "«"
|
|
378
406
|
}
|
|
379
407
|
),
|
|
380
|
-
Array.from({ length: Math.min(P, 7) }, (
|
|
381
|
-
let
|
|
382
|
-
return P <= 7 ||
|
|
408
|
+
Array.from({ length: Math.min(P, 7) }, (h, m) => {
|
|
409
|
+
let g;
|
|
410
|
+
return P <= 7 || R <= 4 ? g = m + 1 : R >= P - 3 ? g = P - 6 + m : g = R - 3 + m, /* @__PURE__ */ a(
|
|
383
411
|
"button",
|
|
384
412
|
{
|
|
385
413
|
type: "button",
|
|
386
|
-
className: `${
|
|
387
|
-
onClick: () =>
|
|
388
|
-
"aria-label": `Page ${
|
|
389
|
-
"aria-current":
|
|
390
|
-
"data-testid": `${p}-page-${
|
|
391
|
-
children:
|
|
414
|
+
className: `${pe} ${D} ${ue} ${R === g ? It : ""}`,
|
|
415
|
+
onClick: () => te(g),
|
|
416
|
+
"aria-label": `Page ${g}`,
|
|
417
|
+
"aria-current": R === g ? "page" : void 0,
|
|
418
|
+
"data-testid": `${p}-page-${g}`,
|
|
419
|
+
children: g
|
|
392
420
|
},
|
|
393
|
-
|
|
421
|
+
g
|
|
394
422
|
);
|
|
395
423
|
}),
|
|
396
424
|
/* @__PURE__ */ a(
|
|
397
425
|
"button",
|
|
398
426
|
{
|
|
399
427
|
type: "button",
|
|
400
|
-
className: `${
|
|
401
|
-
onClick: () =>
|
|
402
|
-
disabled:
|
|
428
|
+
className: `${pe} ${D} ${ue}`,
|
|
429
|
+
onClick: () => te(R + 1),
|
|
430
|
+
disabled: R === P,
|
|
403
431
|
"aria-label": "Next page",
|
|
404
432
|
"data-testid": `${p}-next`,
|
|
405
433
|
children: "»"
|
|
406
434
|
}
|
|
407
435
|
)
|
|
408
436
|
] }),
|
|
409
|
-
r && /* @__PURE__ */
|
|
437
|
+
r && /* @__PURE__ */ x("div", { className: "flex items-center gap-2", children: [
|
|
410
438
|
/* @__PURE__ */ a("span", { className: "text-sm", children: "Go to" }),
|
|
411
439
|
/* @__PURE__ */ a(
|
|
412
440
|
"input",
|
|
413
441
|
{
|
|
414
442
|
type: "number",
|
|
415
|
-
className: `${
|
|
443
|
+
className: `${Ht} ${Yt} ${Zt} w-16`,
|
|
416
444
|
min: 1,
|
|
417
445
|
max: P,
|
|
418
|
-
onKeyDown: (
|
|
419
|
-
if (
|
|
420
|
-
const
|
|
421
|
-
|
|
446
|
+
onKeyDown: (h) => {
|
|
447
|
+
if (h.key === "Enter") {
|
|
448
|
+
const m = parseInt(h.target.value);
|
|
449
|
+
m >= 1 && m <= P && te(m);
|
|
422
450
|
}
|
|
423
451
|
},
|
|
424
452
|
"aria-label": "Go to page",
|
|
@@ -427,65 +455,68 @@ function jt({
|
|
|
427
455
|
)
|
|
428
456
|
] })
|
|
429
457
|
] });
|
|
430
|
-
},
|
|
431
|
-
return /* @__PURE__ */
|
|
432
|
-
|
|
433
|
-
|
|
458
|
+
}, ce = l && typeof l != "boolean" ? l.position : void 0, ht = U && ce?.startsWith("top") ? Pe() : null, ut = U && (!ce || ce.startsWith("bottom")) ? Pe() : null;
|
|
459
|
+
return /* @__PURE__ */ x("div", { className: "space-y-4", "data-testid": p, ...Je, children: [
|
|
460
|
+
ve && /* @__PURE__ */ a("div", { className: "text-lg font-semibold", "data-testid": `${p}-title`, children: ve(S) }),
|
|
461
|
+
ht,
|
|
462
|
+
/* @__PURE__ */ a("div", { className: dt, style: J, children: /* @__PURE__ */ x(
|
|
434
463
|
"table",
|
|
435
464
|
{
|
|
436
|
-
ref:
|
|
437
|
-
className:
|
|
465
|
+
ref: Ge,
|
|
466
|
+
className: lt,
|
|
438
467
|
style: { borderCollapse: "separate", borderSpacing: 0, tableLayout: "fixed" },
|
|
439
468
|
role: "grid",
|
|
440
|
-
"aria-label":
|
|
441
|
-
"aria-rowcount":
|
|
469
|
+
"aria-label": Xe,
|
|
470
|
+
"aria-rowcount": C.length,
|
|
442
471
|
"data-testid": `${p}-table`,
|
|
443
472
|
children: [
|
|
444
|
-
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */
|
|
445
|
-
|
|
446
|
-
|
|
473
|
+
Ae && /* @__PURE__ */ a("thead", { children: /* @__PURE__ */ x("tr", { role: "row", ...Ve?.(y) || {}, children: [
|
|
474
|
+
X && /* @__PURE__ */ a("th", { style: { width: f?.columnWidth ?? 50 }, className: "sticky left-0 z-20 bg-base-100", role: "columnheader", children: f?.columnTitle ?? /* @__PURE__ */ a("span", { className: "sr-only", children: "Expand" }) }),
|
|
475
|
+
n && /* @__PURE__ */ a(
|
|
447
476
|
"th",
|
|
448
477
|
{
|
|
449
|
-
style: { width: 50 },
|
|
450
|
-
className:
|
|
478
|
+
style: { width: n.columnWidth ?? 50 },
|
|
479
|
+
className: `${n.fixed !== !1 ? "sticky" : ""} ${n.fixed !== !1 && !X ? "left-0" : ""} z-20 bg-base-100`,
|
|
451
480
|
role: "columnheader",
|
|
452
|
-
children:
|
|
481
|
+
children: n.columnTitle !== void 0 ? n.columnTitle : n.type !== "radio" && !n.hideSelectAll ? /* @__PURE__ */ a(
|
|
453
482
|
"input",
|
|
454
483
|
{
|
|
455
484
|
type: "checkbox",
|
|
456
|
-
className: `${
|
|
457
|
-
checked:
|
|
485
|
+
className: `${me} ${Fe[H]} ${xe}`,
|
|
486
|
+
checked: Te,
|
|
458
487
|
ref: (e) => {
|
|
459
|
-
e && (e.indeterminate =
|
|
488
|
+
e && (e.indeterminate = ct && !Te);
|
|
460
489
|
},
|
|
461
|
-
onChange: (e) =>
|
|
462
|
-
"aria-label":
|
|
490
|
+
onChange: (e) => nt(e.target.checked),
|
|
491
|
+
"aria-label": oe?.selectAll ?? "Select all rows",
|
|
463
492
|
"data-testid": `${p}-select-all`
|
|
464
493
|
}
|
|
465
|
-
)
|
|
494
|
+
) : null
|
|
466
495
|
}
|
|
467
496
|
),
|
|
468
|
-
|
|
469
|
-
const s =
|
|
497
|
+
y.map((e, t) => {
|
|
498
|
+
const s = ze(t, !0), o = b.columnKey === e.key ? b.order : null, i = e.onHeaderCell?.(e) || {};
|
|
470
499
|
return /* @__PURE__ */ a(
|
|
471
500
|
"th",
|
|
472
501
|
{
|
|
473
|
-
|
|
502
|
+
...i,
|
|
503
|
+
className: [Ee(e.align), s.className, e.className, i.className].filter(Boolean).join(" "),
|
|
474
504
|
style: {
|
|
475
505
|
...e.width ? { width: e.width } : {},
|
|
476
|
-
...s.style
|
|
506
|
+
...s.style,
|
|
507
|
+
...i.style
|
|
477
508
|
},
|
|
478
509
|
role: "columnheader",
|
|
479
|
-
"aria-sort":
|
|
510
|
+
"aria-sort": o === "ascend" ? "ascending" : o === "descend" ? "descending" : void 0,
|
|
480
511
|
"data-testid": `${p}-header-${e.key}`,
|
|
481
|
-
children: /* @__PURE__ */
|
|
512
|
+
children: /* @__PURE__ */ x("div", { className: "flex items-center gap-2", children: [
|
|
482
513
|
/* @__PURE__ */ a(
|
|
483
514
|
"span",
|
|
484
515
|
{
|
|
485
516
|
className: e.sorter ? "cursor-pointer select-none hover:text-primary" : "",
|
|
486
|
-
onClick: () => e.sorter &&
|
|
487
|
-
onKeyDown: (
|
|
488
|
-
e.sorter && (
|
|
517
|
+
onClick: () => e.sorter && Re(e.key),
|
|
518
|
+
onKeyDown: (u) => {
|
|
519
|
+
e.sorter && (u.key === "Enter" || u.key === " ") && (u.preventDefault(), Re(e.key));
|
|
489
520
|
},
|
|
490
521
|
tabIndex: e.sorter ? 0 : void 0,
|
|
491
522
|
role: e.sorter ? "button" : void 0,
|
|
@@ -493,11 +524,11 @@ function jt({
|
|
|
493
524
|
children: e.title
|
|
494
525
|
}
|
|
495
526
|
),
|
|
496
|
-
e.sorter && /* @__PURE__ */
|
|
527
|
+
e.sorter && /* @__PURE__ */ x("div", { className: "flex flex-col", "aria-hidden": "true", children: [
|
|
497
528
|
/* @__PURE__ */ a(
|
|
498
529
|
"svg",
|
|
499
530
|
{
|
|
500
|
-
className: `w-3 h-3 ${
|
|
531
|
+
className: `w-3 h-3 ${o === "ascend" ? "text-primary" : "text-base-content/30"}`,
|
|
501
532
|
fill: "currentColor",
|
|
502
533
|
viewBox: "0 0 20 20",
|
|
503
534
|
children: /* @__PURE__ */ a("path", { d: "M5.293 9.707a1 1 0 010-1.414l4-4a1 1 0 011.414 0l4 4a1 1 0 01-1.414 1.414L11 7.414V15a1 1 0 11-2 0V7.414L6.707 9.707a1 1 0 01-1.414 0z" })
|
|
@@ -506,7 +537,7 @@ function jt({
|
|
|
506
537
|
/* @__PURE__ */ a(
|
|
507
538
|
"svg",
|
|
508
539
|
{
|
|
509
|
-
className: `w-3 h-3 -mt-1 ${
|
|
540
|
+
className: `w-3 h-3 -mt-1 ${o === "descend" ? "text-primary" : "text-base-content/30"}`,
|
|
510
541
|
fill: "currentColor",
|
|
511
542
|
viewBox: "0 0 20 20",
|
|
512
543
|
children: /* @__PURE__ */ a("path", { d: "M14.707 10.293a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 111.414-1.414L9 12.586V5a1 1 0 012 0v7.586l2.293-2.293a1 1 0 011.414 0z" })
|
|
@@ -514,12 +545,12 @@ function jt({
|
|
|
514
545
|
)
|
|
515
546
|
] }),
|
|
516
547
|
e.filters && /* @__PURE__ */ a(
|
|
517
|
-
|
|
548
|
+
es,
|
|
518
549
|
{
|
|
519
550
|
filters: e.filters,
|
|
520
|
-
selectedValues:
|
|
521
|
-
onChange: (
|
|
522
|
-
locale:
|
|
551
|
+
selectedValues: T[e.key] || [],
|
|
552
|
+
onChange: (u) => at(e.key, u),
|
|
553
|
+
locale: oe,
|
|
523
554
|
testId: `${p}-${e.key}`
|
|
524
555
|
}
|
|
525
556
|
)
|
|
@@ -529,109 +560,116 @@ function jt({
|
|
|
529
560
|
);
|
|
530
561
|
})
|
|
531
562
|
] }) }),
|
|
532
|
-
/* @__PURE__ */ a("tbody", { children:
|
|
563
|
+
/* @__PURE__ */ a("tbody", { children: S.length === 0 ? /* @__PURE__ */ a("tr", { role: "row", children: /* @__PURE__ */ a(
|
|
533
564
|
"td",
|
|
534
565
|
{
|
|
535
|
-
colSpan:
|
|
566
|
+
colSpan: y.length + Ie,
|
|
536
567
|
className: "text-center py-8 text-base-content/50",
|
|
537
568
|
role: "gridcell",
|
|
538
569
|
"data-testid": `${p}-empty`,
|
|
539
|
-
children:
|
|
570
|
+
children: ft
|
|
540
571
|
}
|
|
541
|
-
) }) :
|
|
542
|
-
const s =
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
572
|
+
) }) : S.map((e, t) => {
|
|
573
|
+
const s = Me?.(e, t) || {}, r = E(e, t), o = F.includes(r), i = W.includes(r), u = f?.rowExpandable ? f.rowExpandable(e) : !0, d = typeof ne == "function" ? ne(e, t) : ne, h = [
|
|
574
|
+
A && "hover:bg-base-200",
|
|
575
|
+
o && "bg-primary/10",
|
|
576
|
+
d
|
|
577
|
+
].filter(Boolean).join(" "), m = n?.getCheckboxProps?.(e) || {}, g = ($) => {
|
|
578
|
+
s.onClick?.($), f?.expandRowByClick && u && de(e, t);
|
|
547
579
|
};
|
|
548
|
-
return /* @__PURE__ */
|
|
549
|
-
/* @__PURE__ */
|
|
580
|
+
return /* @__PURE__ */ x(bt.Fragment, { children: [
|
|
581
|
+
/* @__PURE__ */ x(
|
|
550
582
|
"tr",
|
|
551
583
|
{
|
|
552
|
-
className:
|
|
584
|
+
className: h,
|
|
553
585
|
role: "row",
|
|
554
|
-
"aria-selected":
|
|
586
|
+
"aria-selected": o,
|
|
555
587
|
"data-testid": `${p}-row-${t}`,
|
|
556
|
-
"data-state":
|
|
588
|
+
"data-state": o ? "selected" : void 0,
|
|
557
589
|
...s,
|
|
558
590
|
onClick: g,
|
|
559
591
|
children: [
|
|
560
|
-
|
|
561
|
-
expanded:
|
|
562
|
-
onExpand: () =>
|
|
592
|
+
X && /* @__PURE__ */ a("td", { className: "sticky left-0 z-10 bg-base-100", role: "gridcell", children: u && (f.expandIcon ? f.expandIcon({
|
|
593
|
+
expanded: i,
|
|
594
|
+
onExpand: () => de(e, t),
|
|
563
595
|
record: e
|
|
564
596
|
}) : /* @__PURE__ */ a(
|
|
565
|
-
|
|
597
|
+
ts,
|
|
566
598
|
{
|
|
567
|
-
expanded:
|
|
568
|
-
onExpand: () =>
|
|
599
|
+
expanded: i,
|
|
600
|
+
onExpand: () => de(e, t)
|
|
569
601
|
}
|
|
570
602
|
)) }),
|
|
571
|
-
|
|
603
|
+
n && /* @__PURE__ */ a(
|
|
572
604
|
"td",
|
|
573
605
|
{
|
|
574
|
-
className:
|
|
606
|
+
className: `${n.fixed !== !1 ? "sticky" : ""} ${n.fixed !== !1 && !X ? "left-0" : ""} z-10 bg-base-100`,
|
|
575
607
|
role: "gridcell",
|
|
576
608
|
children: /* @__PURE__ */ a(
|
|
577
609
|
"input",
|
|
578
610
|
{
|
|
579
|
-
type:
|
|
580
|
-
className:
|
|
581
|
-
checked:
|
|
582
|
-
onChange: (
|
|
611
|
+
type: n.type === "radio" ? "radio" : "checkbox",
|
|
612
|
+
className: n.type === "radio" ? `${Lt} ${Ut[H]} ${At}` : `${me} ${Fe[H]} ${xe}`,
|
|
613
|
+
checked: o,
|
|
614
|
+
onChange: ($) => ot(e, t, $.target.checked, $.nativeEvent),
|
|
583
615
|
"aria-label": `Select row ${t + 1}`,
|
|
584
616
|
"data-testid": `${p}-row-${t}-select`,
|
|
585
|
-
...
|
|
617
|
+
...m
|
|
586
618
|
}
|
|
587
619
|
)
|
|
588
620
|
}
|
|
589
621
|
),
|
|
590
|
-
|
|
591
|
-
const
|
|
622
|
+
y.map(($, pt) => {
|
|
623
|
+
const je = ze(pt, !1), fe = rt($, e, t), he = $.onCell?.(e, t) || {};
|
|
592
624
|
return /* @__PURE__ */ a(
|
|
593
625
|
"td",
|
|
594
626
|
{
|
|
595
|
-
|
|
596
|
-
|
|
627
|
+
...he,
|
|
628
|
+
className: [Ee($.align), je.className, $.ellipsis ? "truncate max-w-0" : "", $.className, he.className].filter(Boolean).join(" "),
|
|
629
|
+
style: { ...je.style, ...he.style },
|
|
597
630
|
role: "gridcell",
|
|
598
|
-
title:
|
|
599
|
-
"data-testid": `${p}-row-${t}-${
|
|
600
|
-
children:
|
|
631
|
+
title: $.ellipsis && typeof fe == "string" ? fe : void 0,
|
|
632
|
+
"data-testid": `${p}-row-${t}-${$.key}`,
|
|
633
|
+
children: fe
|
|
601
634
|
},
|
|
602
|
-
|
|
635
|
+
$.key
|
|
603
636
|
);
|
|
604
637
|
})
|
|
605
638
|
]
|
|
606
639
|
}
|
|
607
640
|
),
|
|
608
|
-
|
|
641
|
+
Ke && i && /* @__PURE__ */ a(
|
|
609
642
|
"tr",
|
|
610
643
|
{
|
|
611
|
-
className:
|
|
644
|
+
className: [
|
|
645
|
+
"bg-base-200/50",
|
|
646
|
+
typeof f.expandedRowClassName == "function" ? f.expandedRowClassName(e, t, i) : f.expandedRowClassName
|
|
647
|
+
].filter(Boolean).join(" "),
|
|
612
648
|
role: "row",
|
|
613
649
|
"data-testid": `${p}-row-${t}-expanded`,
|
|
614
650
|
children: /* @__PURE__ */ a(
|
|
615
651
|
"td",
|
|
616
652
|
{
|
|
617
|
-
colSpan:
|
|
653
|
+
colSpan: y.length + Ie,
|
|
618
654
|
className: "p-4",
|
|
619
655
|
role: "gridcell",
|
|
620
|
-
children:
|
|
656
|
+
children: f.expandedRowRender(e, t, i)
|
|
621
657
|
}
|
|
622
658
|
)
|
|
623
659
|
}
|
|
624
660
|
)
|
|
625
661
|
] }, r);
|
|
626
|
-
}) })
|
|
662
|
+
}) }),
|
|
663
|
+
Ce && /* @__PURE__ */ a("tfoot", { "data-testid": `${p}-summary`, children: Ce(S) })
|
|
627
664
|
]
|
|
628
665
|
}
|
|
629
666
|
) }),
|
|
630
|
-
|
|
667
|
+
ut,
|
|
668
|
+
ke && /* @__PURE__ */ a("div", { className: "text-sm text-base-content/70", "data-testid": `${p}-footer`, children: ke(S) })
|
|
631
669
|
] });
|
|
632
670
|
}
|
|
633
|
-
const
|
|
671
|
+
const rs = yt(ss);
|
|
634
672
|
export {
|
|
635
|
-
|
|
673
|
+
rs as Table
|
|
636
674
|
};
|
|
637
675
|
//# sourceMappingURL=Table.js.map
|