@stackone/malachite 2.30.0 → 2.31.1
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/CommandPalette.js +60 -57
- package/dist/components/CommandPalette.js.map +1 -1
- package/dist/components/Table/Table.js +691 -669
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/TruncatedTooltip.js +12 -8
- package/dist/components/TruncatedTooltip.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/tailwind.css.js +1 -1
- package/package.json +1 -1
|
@@ -1,83 +1,90 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useVirtualizer as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { FOCUS_RING_INSET as
|
|
11
|
-
import { isFromInteractiveDescendant as
|
|
12
|
-
import { FOREGROUND_RESET as
|
|
13
|
-
import
|
|
14
|
-
const
|
|
1
|
+
import { jsx as n, jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import { useVirtualizer as Dt } from "@tanstack/react-virtual";
|
|
3
|
+
import me, { useState as V, useRef as A, useCallback as We, useId as Tt, useEffect as ee, useMemo as tt, useLayoutEffect as dt } from "react";
|
|
4
|
+
import ct from "../CustomIcons/CaretDownIcon.js";
|
|
5
|
+
import Ot from "../CustomIcons/CaretUpIcon.js";
|
|
6
|
+
import zt from "../CustomIcons/InfoIcon.js";
|
|
7
|
+
import Lt from "../CustomIcons/WarningTriangleIcon.js";
|
|
8
|
+
import Mt from "../Tooltip.js";
|
|
9
|
+
import Wt from "../TruncatedTooltip.js";
|
|
10
|
+
import { FOCUS_RING_INSET as nt, FOCUS_RING_INSET_OVERLAY as Ft } from "../focusRing.js";
|
|
11
|
+
import { isFromInteractiveDescendant as rt, activateOnEnterOrSpace as Bt } from "../keyboardActivation.js";
|
|
12
|
+
import { FOREGROUND_RESET as Fe, SELECTED_ROW_ACCENT as ft, SELECTED_TEXT_CONTEXT as ht, SELECTED_ROW_FOREGROUND as ut, SELECTED_ROW_BACKGROUND as Ae } from "../selectedRow.js";
|
|
13
|
+
import it from "./TablePagination.js";
|
|
14
|
+
const pt = 160, At = (e, r) => e.length === r.length && e.every((a, c) => a === r[c]), lt = "\0", jt = (e, r, a) => {
|
|
15
15
|
if (typeof e != "object" || e === null)
|
|
16
|
-
return `${
|
|
17
|
-
const c =
|
|
16
|
+
return `${lt}i${a}`;
|
|
17
|
+
const c = r.ids.get(e);
|
|
18
18
|
if (c !== void 0)
|
|
19
19
|
return c;
|
|
20
|
-
const R = `${
|
|
21
|
-
return
|
|
22
|
-
},
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
}),
|
|
20
|
+
const R = `${lt}${r.next++}`;
|
|
21
|
+
return r.ids.set(e, R), R;
|
|
22
|
+
}, Ut = (e, r, a) => typeof r == "function" ? e.map((c) => r(c)) : e.map((c, R) => {
|
|
23
|
+
const h = c[r];
|
|
24
|
+
return h == null ? jt(c, a, R) : String(h);
|
|
25
|
+
}), $e = (e) => {
|
|
26
26
|
if (typeof e == "number")
|
|
27
27
|
return e;
|
|
28
28
|
if (typeof e == "string") {
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
return Number(
|
|
29
|
+
const r = e.trim().match(/^(\d+(?:\.\d+)?)px$/);
|
|
30
|
+
if (r)
|
|
31
|
+
return Number(r[1]);
|
|
32
32
|
}
|
|
33
|
-
},
|
|
34
|
-
const
|
|
35
|
-
return !(e.title === "" || e.title == null) &&
|
|
36
|
-
},
|
|
37
|
-
const c =
|
|
38
|
-
return c !== void 0 ?
|
|
39
|
-
}, 0),
|
|
40
|
-
const
|
|
41
|
-
(
|
|
42
|
-
const
|
|
43
|
-
return !(
|
|
33
|
+
}, je = (e) => {
|
|
34
|
+
const r = $e(e.width);
|
|
35
|
+
return !(e.title === "" || e.title == null) && r !== void 0 && typeof e.minWidth == "number" && e.minWidth < r ? e.minWidth : void 0;
|
|
36
|
+
}, Pt = (e) => e.reduce((r, a) => {
|
|
37
|
+
const c = je(a) ?? $e(a.width);
|
|
38
|
+
return c !== void 0 ? r + c : typeof a.minWidth == "number" ? r + a.minWidth : r + pt;
|
|
39
|
+
}, 0), Ht = (e) => (e.title === "" || e.title == null) && $e(e.width) !== void 0, Gt = (e) => {
|
|
40
|
+
const r = [...e].reverse().findIndex((h) => !Ht(h)), a = r === -1 ? 0 : e.length - r, c = /* @__PURE__ */ new Map(), R = e.reduceRight(
|
|
41
|
+
(h, k, v) => {
|
|
42
|
+
const u = je(k) ?? $e(k.width);
|
|
43
|
+
return !(k.fixed === "right" || v >= a) || u === void 0 ? h : (c.set(k.key, h.right), { right: h.right + u, edge: k.key });
|
|
44
44
|
},
|
|
45
45
|
{ right: 0, edge: void 0 }
|
|
46
46
|
);
|
|
47
|
-
return { offsets: c, edgeKey: R.edge };
|
|
48
|
-
},
|
|
47
|
+
return { offsets: c, edgeKey: R.edge, extent: R.right };
|
|
48
|
+
}, Jt = { overflowX: "auto", scrollbarWidth: "none" }, Yt = {
|
|
49
49
|
position: "sticky",
|
|
50
50
|
left: 0,
|
|
51
51
|
width: "100%"
|
|
52
|
-
},
|
|
52
|
+
}, qt = { offsets: /* @__PURE__ */ new Map(), edgeKey: void 0, extent: 0 }, Be = (e) => `color-mix(in srgb, var(--malachite-card-shadow, rgba(0, 0, 0, 0.1)) ${e}%, transparent)`, Qt = {
|
|
53
|
+
position: "absolute",
|
|
54
|
+
top: 0,
|
|
55
|
+
bottom: 0,
|
|
56
|
+
right: 0,
|
|
57
|
+
width: 24,
|
|
58
|
+
pointerEvents: "none",
|
|
59
|
+
backgroundImage: `linear-gradient(to left, ${Be(45)}, ${Be(18)} 30%, ${Be(5)} 65%, transparent)`
|
|
60
|
+
}, Vt = (e, r) => e === void 0 ? {} : {
|
|
53
61
|
position: "sticky",
|
|
54
62
|
right: e,
|
|
55
63
|
zIndex: 1,
|
|
56
64
|
height: "auto",
|
|
57
|
-
...
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (!e && !n)
|
|
65
|
+
...r === "row" ? { backgroundColor: "inherit", backgroundImage: "inherit" } : { backgroundColor: r }
|
|
66
|
+
}, at = (e) => `linear-gradient(${e}, ${e})`, Zt = (e, r) => {
|
|
67
|
+
if (!e && !r)
|
|
61
68
|
return {};
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
e ?
|
|
65
|
-
].filter(
|
|
69
|
+
const a = [
|
|
70
|
+
r ? at(Ae) : void 0,
|
|
71
|
+
e ? at(`var(--malachite-table-row-variant-${e}-background)`) : void 0
|
|
72
|
+
].filter(Ue);
|
|
66
73
|
return {
|
|
67
74
|
backgroundColor: e ? "var(--malachite-table-background, #f7f7f7)" : "var(--malachite-table-row-background, #fff)",
|
|
68
|
-
backgroundImage:
|
|
75
|
+
backgroundImage: a.join(", ")
|
|
69
76
|
};
|
|
70
|
-
},
|
|
77
|
+
}, Ue = (e) => typeof e == "string", se = (e) => ({
|
|
71
78
|
small: "text-[length:var(--malachite-font-size-small)]",
|
|
72
79
|
medium: "text-[length:var(--malachite-font-size-medium)]",
|
|
73
80
|
large: "text-[length:var(--malachite-font-size-large)]"
|
|
74
|
-
})[e],
|
|
81
|
+
})[e], st = {
|
|
75
82
|
borderBottom: "1px solid var(--malachite-card-border, #e8e8e8)"
|
|
76
|
-
},
|
|
77
|
-
e &&
|
|
78
|
-
},
|
|
79
|
-
const e =
|
|
80
|
-
return /* @__PURE__ */
|
|
83
|
+
}, ot = (e, r) => {
|
|
84
|
+
e && r && r.scrollLeft !== e.scrollLeft && (r.scrollLeft = e.scrollLeft);
|
|
85
|
+
}, Xt = 56, Kt = 44, en = 8, tn = 10, le = 8, nn = "var(--malachite-radius-xl, 12px)", ae = 4, rn = "--malachite-ctx-table-surround", ln = () => {
|
|
86
|
+
const e = nn, r = `var(${rn}, var(--malachite-card-background, #ffffff))`;
|
|
87
|
+
return /* @__PURE__ */ n(
|
|
81
88
|
"div",
|
|
82
89
|
{
|
|
83
90
|
"aria-hidden": "true",
|
|
@@ -89,751 +96,766 @@ const ft = 160, Bt = (e, n) => e.length === n.length && e.every((s, c) => s ===
|
|
|
89
96
|
height: e,
|
|
90
97
|
pointerEvents: "none",
|
|
91
98
|
background: [
|
|
92
|
-
`radial-gradient(circle ${e} at ${e} ${e}, transparent calc(${e} - 0.5px), ${
|
|
93
|
-
`radial-gradient(circle ${e} at 0 ${e}, transparent calc(${e} - 0.5px), ${
|
|
99
|
+
`radial-gradient(circle ${e} at ${e} ${e}, transparent calc(${e} - 0.5px), ${r} ${e}) top left / ${e} ${e} no-repeat`,
|
|
100
|
+
`radial-gradient(circle ${e} at 0 ${e}, transparent calc(${e} - 0.5px), ${r} ${e}) top right / ${e} ${e} no-repeat`
|
|
94
101
|
].join(", ")
|
|
95
102
|
}
|
|
96
103
|
}
|
|
97
104
|
);
|
|
98
|
-
},
|
|
105
|
+
}, an = ({
|
|
99
106
|
records: e,
|
|
100
|
-
startIndex:
|
|
101
|
-
scrollElement:
|
|
107
|
+
startIndex: r,
|
|
108
|
+
scrollElement: a,
|
|
102
109
|
estimateRowHeight: c,
|
|
103
110
|
style: R,
|
|
104
|
-
renderRow:
|
|
105
|
-
registerHandle:
|
|
106
|
-
cardKey:
|
|
107
|
-
rovingIndex:
|
|
111
|
+
renderRow: h,
|
|
112
|
+
registerHandle: k,
|
|
113
|
+
cardKey: v,
|
|
114
|
+
rovingIndex: u
|
|
108
115
|
}) => {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
if (!
|
|
116
|
+
const D = A(null), [T, M] = V(0);
|
|
117
|
+
dt(() => {
|
|
118
|
+
const E = D.current;
|
|
119
|
+
if (!E || !a)
|
|
113
120
|
return;
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
|
|
121
|
+
const O = () => {
|
|
122
|
+
const f = E.getBoundingClientRect().top - a.getBoundingClientRect().top + a.scrollTop;
|
|
123
|
+
M((J) => Math.abs(J - f) < 1 ? J : f);
|
|
117
124
|
};
|
|
118
|
-
if (
|
|
125
|
+
if (O(), typeof ResizeObserver > "u")
|
|
119
126
|
return;
|
|
120
|
-
const
|
|
121
|
-
let W =
|
|
122
|
-
for (; W && W !==
|
|
123
|
-
let
|
|
124
|
-
for (;
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
if (
|
|
128
|
-
W =
|
|
127
|
+
const ne = new ResizeObserver(O);
|
|
128
|
+
let W = E;
|
|
129
|
+
for (; W && W !== a; ) {
|
|
130
|
+
let f = W.previousElementSibling;
|
|
131
|
+
for (; f; )
|
|
132
|
+
ne.observe(f), f = f.previousElementSibling;
|
|
133
|
+
const J = W.parentElement;
|
|
134
|
+
if (J)
|
|
135
|
+
W = J;
|
|
129
136
|
else {
|
|
130
|
-
const
|
|
131
|
-
W =
|
|
137
|
+
const X = W.getRootNode();
|
|
138
|
+
W = X instanceof ShadowRoot ? X.host : null;
|
|
132
139
|
}
|
|
133
140
|
}
|
|
134
|
-
return () =>
|
|
135
|
-
}, [
|
|
136
|
-
const
|
|
141
|
+
return () => ne.disconnect();
|
|
142
|
+
}, [a, e.length, r]);
|
|
143
|
+
const I = Dt({
|
|
137
144
|
count: e.length,
|
|
138
145
|
// State, not a ref: an ancestor's ref is not attached when this child's layout effects
|
|
139
146
|
// run, so a ref would leave the virtualizer without a scroll element.
|
|
140
|
-
getScrollElement: () =>
|
|
147
|
+
getScrollElement: () => a,
|
|
141
148
|
estimateSize: () => c,
|
|
142
|
-
overscan:
|
|
143
|
-
scrollMargin:
|
|
149
|
+
overscan: en,
|
|
150
|
+
scrollMargin: T
|
|
144
151
|
});
|
|
145
|
-
|
|
146
|
-
if (
|
|
147
|
-
return
|
|
148
|
-
startIndex:
|
|
152
|
+
ee(() => {
|
|
153
|
+
if (k)
|
|
154
|
+
return k(v, {
|
|
155
|
+
startIndex: r,
|
|
149
156
|
count: e.length,
|
|
150
|
-
scrollToIndex: (
|
|
151
|
-
}), () =>
|
|
152
|
-
}, [
|
|
153
|
-
const
|
|
154
|
-
Math.max(
|
|
155
|
-
|
|
156
|
-
) :
|
|
157
|
-
return /* @__PURE__ */
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
(
|
|
161
|
-
e[
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
{ measureRef:
|
|
166
|
-
|
|
157
|
+
scrollToIndex: (E) => I.scrollToIndex(E, { align: "center" })
|
|
158
|
+
}), () => k(v, null);
|
|
159
|
+
}, [k, v, r, e.length, I]);
|
|
160
|
+
const C = I.getVirtualItems(), te = I.getTotalSize(), G = u >= r && u < r + e.length && C.length > 0 ? Math.min(
|
|
161
|
+
Math.max(u, r + C[0].index),
|
|
162
|
+
r + C[C.length - 1].index
|
|
163
|
+
) : u, j = C.length > 0 ? C[0].start - T : 0, U = C.length > 0 ? te - (C[C.length - 1].end - T) : 0;
|
|
164
|
+
return /* @__PURE__ */ S("div", { ref: D, className: "flex flex-col w-full", style: R, children: [
|
|
165
|
+
j > 0 && /* @__PURE__ */ n("div", { "aria-hidden": "true", style: { height: j, flexShrink: 0 } }),
|
|
166
|
+
C.map(
|
|
167
|
+
(E) => h(
|
|
168
|
+
e[E.index],
|
|
169
|
+
r + E.index,
|
|
170
|
+
E.index === e.length - 1,
|
|
171
|
+
E.index === 0,
|
|
172
|
+
{ measureRef: I.measureElement, index: E.index },
|
|
173
|
+
G
|
|
167
174
|
)
|
|
168
175
|
),
|
|
169
|
-
|
|
176
|
+
U > 0 && /* @__PURE__ */ n("div", { "aria-hidden": "true", style: { height: U, flexShrink: 0 } })
|
|
170
177
|
] });
|
|
171
|
-
},
|
|
172
|
-
const
|
|
173
|
-
return typeof e == "number" ? `${Math.max(0, e -
|
|
174
|
-
},
|
|
175
|
-
const
|
|
176
|
-
if (
|
|
178
|
+
}, sn = (e, r) => {
|
|
179
|
+
const a = r ? Xt : 0;
|
|
180
|
+
return typeof e == "number" ? `${Math.max(0, e - a)}px` : `calc(${e} - ${a}px)`;
|
|
181
|
+
}, oe = (e) => {
|
|
182
|
+
const r = e.width;
|
|
183
|
+
if (r == null)
|
|
177
184
|
return {};
|
|
178
|
-
const
|
|
179
|
-
return c === void 0 ? { flexBasis:
|
|
180
|
-
},
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
185
|
+
const a = typeof r == "number" ? `${r}px` : r, c = je(e);
|
|
186
|
+
return c === void 0 ? { flexBasis: a, maxWidth: a } : { flexBasis: a, maxWidth: a, minWidth: c, flexShrink: 1 };
|
|
187
|
+
}, Pe = (e) => {
|
|
188
|
+
const r = e.width;
|
|
189
|
+
if (r == null)
|
|
183
190
|
return {};
|
|
184
|
-
const
|
|
185
|
-
return { width:
|
|
186
|
-
},
|
|
187
|
-
|
|
191
|
+
const a = typeof r == "number" ? `${r}px` : r;
|
|
192
|
+
return { width: a, flexBasis: a };
|
|
193
|
+
}, on = (e) => e === "asc" ? "ascending" : e === "desc" ? "descending" : "none", Z = (e) => e === "center" ? "justify-center" : e === "right" ? "justify-end" : "justify-start", dn = (e) => e === "center" ? "justify-center" : e === "right" ? "justify-end" : "justify-between", de = (e) => e === "center" ? "text-center" : e === "right" ? "text-right" : "text-left", gt = (e) => e ? Z(e) : "justify-end", ye = ({ info: e }) => /* @__PURE__ */ n(Mt, { text: e, placement: "top", children: /* @__PURE__ */ n(
|
|
194
|
+
zt,
|
|
188
195
|
{
|
|
189
196
|
size: 13,
|
|
190
197
|
className: "shrink-0 text-[var(--malachite-text-secondary,#bbb)]"
|
|
191
198
|
}
|
|
192
|
-
) }),
|
|
199
|
+
) }), bt = (e, r) => ({
|
|
193
200
|
type: "button",
|
|
194
|
-
onClick:
|
|
201
|
+
onClick: r,
|
|
195
202
|
"aria-label": typeof e == "string" ? `Sort by ${e}` : "Sort column"
|
|
196
|
-
}),
|
|
203
|
+
}), cn = ({
|
|
197
204
|
column: e,
|
|
198
|
-
record:
|
|
199
|
-
index:
|
|
205
|
+
record: r,
|
|
206
|
+
index: a,
|
|
200
207
|
size: c,
|
|
201
208
|
paddingYClass: R,
|
|
202
|
-
bordered:
|
|
203
|
-
isFirstRow:
|
|
204
|
-
isLastRow:
|
|
205
|
-
isFirstColumn:
|
|
206
|
-
isLastColumn:
|
|
207
|
-
variantBackground:
|
|
208
|
-
showSelectedAccent:
|
|
209
|
-
isSelected:
|
|
209
|
+
bordered: h,
|
|
210
|
+
isFirstRow: k,
|
|
211
|
+
isLastRow: v,
|
|
212
|
+
isFirstColumn: u,
|
|
213
|
+
isLastColumn: D,
|
|
214
|
+
variantBackground: T,
|
|
215
|
+
showSelectedAccent: M,
|
|
216
|
+
isSelected: I
|
|
210
217
|
}) => {
|
|
211
|
-
const
|
|
212
|
-
return /* @__PURE__ */
|
|
218
|
+
const C = r[e.dataIndex], te = e.render ? e.render(C, r, a) : C == null ? "" : String(C), q = e.ellipsis && Ue(C) ? C : void 0;
|
|
219
|
+
return /* @__PURE__ */ n(
|
|
213
220
|
"td",
|
|
214
221
|
{
|
|
215
222
|
className: `
|
|
216
|
-
table-cell px-4 ${R} ${
|
|
223
|
+
table-cell px-4 ${R} ${se(c)}
|
|
217
224
|
${e.ellipsis ? "truncate overflow-hidden whitespace-nowrap" : ""}
|
|
218
|
-
${
|
|
219
|
-
${
|
|
220
|
-
${
|
|
221
|
-
${
|
|
222
|
-
${
|
|
223
|
-
${
|
|
224
|
-
${
|
|
225
|
-
${
|
|
226
|
-
${
|
|
225
|
+
${h ? "table-cell-bordered" : ""}
|
|
226
|
+
${h && k ? "table-cell-bordered-top" : ""}
|
|
227
|
+
${h && u ? "table-cell-bordered-left" : ""}
|
|
228
|
+
${h && D ? "table-cell-bordered-right" : ""}
|
|
229
|
+
${h && u && k ? "rounded-tl-lg" : ""}
|
|
230
|
+
${h && D && k ? "rounded-tr-lg" : ""}
|
|
231
|
+
${h && u && v ? "rounded-bl-lg" : ""}
|
|
232
|
+
${h && D && v ? "rounded-br-lg" : ""}
|
|
233
|
+
${de(e.align)}
|
|
227
234
|
`,
|
|
228
235
|
style: {
|
|
229
236
|
width: e.width,
|
|
230
|
-
backgroundColor:
|
|
237
|
+
backgroundColor: T ?? // Mirror the row's background, or the tint composites over the wrong opaque
|
|
231
238
|
// base — they differ in dark mode.
|
|
232
|
-
(
|
|
239
|
+
(I ? h ? "var(--malachite-table-borderedRow-background, #fff)" : "var(--malachite-table-row-background, #fff)" : void 0),
|
|
233
240
|
// Its own layer, so the tint composites over the cell instead of replacing it.
|
|
234
|
-
backgroundImage:
|
|
241
|
+
backgroundImage: I ? `linear-gradient(${Ae}, ${Ae})` : void 0,
|
|
235
242
|
// Content pinning its own colour follows via the channel below.
|
|
236
|
-
color:
|
|
237
|
-
...
|
|
243
|
+
color: I ? ut : "var(--malachite-table-row-foreground)",
|
|
244
|
+
...I ? ht : {},
|
|
238
245
|
// Inset box-shadow, not `ring-*`: --tw-ring-* silently doesn't paint in a shadow root.
|
|
239
|
-
boxShadow:
|
|
240
|
-
borderBottom:
|
|
246
|
+
boxShadow: M ? `inset 2px 0 0 ${ft}` : void 0,
|
|
247
|
+
borderBottom: h ? void 0 : v ? "none" : "1px solid var(--malachite-table-row-border)"
|
|
241
248
|
},
|
|
242
|
-
title:
|
|
243
|
-
children:
|
|
249
|
+
title: q,
|
|
250
|
+
children: te
|
|
244
251
|
}
|
|
245
252
|
);
|
|
246
|
-
},
|
|
253
|
+
}, fn = ({
|
|
247
254
|
column: e,
|
|
248
|
-
sortDirection:
|
|
249
|
-
onSort:
|
|
255
|
+
sortDirection: r,
|
|
256
|
+
onSort: a,
|
|
250
257
|
cellStyle: c
|
|
251
258
|
}) => {
|
|
252
|
-
const R = !!e.sorter,
|
|
253
|
-
if (
|
|
254
|
-
return /* @__PURE__ */
|
|
259
|
+
const R = !!e.sorter, h = e.title === "" || e.title == null;
|
|
260
|
+
if (h && e.width !== void 0)
|
|
261
|
+
return /* @__PURE__ */ n(
|
|
255
262
|
"div",
|
|
256
263
|
{
|
|
257
264
|
className: "h-full shrink-0",
|
|
258
265
|
style: {
|
|
259
|
-
...
|
|
266
|
+
...Pe(e),
|
|
260
267
|
...c
|
|
261
268
|
}
|
|
262
269
|
}
|
|
263
270
|
);
|
|
264
|
-
if (
|
|
265
|
-
return /* @__PURE__ */
|
|
271
|
+
if (h)
|
|
272
|
+
return /* @__PURE__ */ n(
|
|
266
273
|
"div",
|
|
267
274
|
{
|
|
268
275
|
className: "flex flex-[1_0_0] h-full min-w-0",
|
|
269
276
|
style: {
|
|
270
|
-
...
|
|
277
|
+
...oe(e),
|
|
271
278
|
...c
|
|
272
279
|
}
|
|
273
280
|
}
|
|
274
281
|
);
|
|
275
|
-
const
|
|
276
|
-
|
|
282
|
+
const v = typeof e.title == "string" ? /* @__PURE__ */ n("p", { className: "font-medium text-[13px] text-[#0a0a0a] tracking-[0.13px] whitespace-nowrap truncate", children: e.title }) : e.title, u = /* @__PURE__ */ n(
|
|
283
|
+
ct,
|
|
277
284
|
{
|
|
278
285
|
size: 13,
|
|
279
|
-
className: `shrink-0 transition-transform ${
|
|
286
|
+
className: `shrink-0 transition-transform ${r ? "text-[#0a0a0a]" : "text-[#bbb]"} ${r === "asc" ? "rotate-180" : ""}`
|
|
280
287
|
}
|
|
281
288
|
);
|
|
282
|
-
return R ? /* @__PURE__ */
|
|
289
|
+
return R ? /* @__PURE__ */ n(
|
|
283
290
|
"div",
|
|
284
291
|
{
|
|
285
292
|
className: "flex flex-[1_0_0] min-w-0 overflow-hidden",
|
|
286
|
-
style: { ...
|
|
287
|
-
children: /* @__PURE__ */
|
|
293
|
+
style: { ...oe(e), ...c },
|
|
294
|
+
children: /* @__PURE__ */ S(
|
|
288
295
|
"button",
|
|
289
296
|
{
|
|
290
|
-
...
|
|
291
|
-
className: `flex flex-1 items-center ${
|
|
297
|
+
...bt(e.title, a),
|
|
298
|
+
className: `flex flex-1 items-center ${dn(e.align)} gap-1 min-w-0 px-4 py-3 cursor-pointer appearance-none bg-transparent border-0 ${de(e.align)}`,
|
|
292
299
|
children: [
|
|
293
|
-
/* @__PURE__ */
|
|
294
|
-
|
|
295
|
-
e.info && /* @__PURE__ */
|
|
300
|
+
/* @__PURE__ */ S("div", { className: "flex items-center gap-1 min-w-0", children: [
|
|
301
|
+
v,
|
|
302
|
+
e.info && /* @__PURE__ */ n(ye, { info: e.info })
|
|
296
303
|
] }),
|
|
297
|
-
|
|
304
|
+
u
|
|
298
305
|
]
|
|
299
306
|
}
|
|
300
307
|
)
|
|
301
308
|
}
|
|
302
|
-
) : /* @__PURE__ */
|
|
309
|
+
) : /* @__PURE__ */ n(
|
|
303
310
|
"div",
|
|
304
311
|
{
|
|
305
|
-
className: `flex flex-[1_0_0] items-center ${
|
|
312
|
+
className: `flex flex-[1_0_0] items-center ${Z(e.align)} min-w-0 overflow-hidden px-4 py-3`,
|
|
306
313
|
style: {
|
|
307
|
-
...
|
|
314
|
+
...oe(e),
|
|
308
315
|
...c
|
|
309
316
|
},
|
|
310
|
-
children: /* @__PURE__ */
|
|
311
|
-
|
|
312
|
-
e.info && /* @__PURE__ */
|
|
317
|
+
children: /* @__PURE__ */ S("div", { className: "flex items-center gap-1 min-w-0", children: [
|
|
318
|
+
v,
|
|
319
|
+
e.info && /* @__PURE__ */ n(ye, { info: e.info })
|
|
313
320
|
] })
|
|
314
321
|
}
|
|
315
322
|
);
|
|
316
|
-
},
|
|
323
|
+
}, hn = ({
|
|
317
324
|
column: e,
|
|
318
|
-
record:
|
|
319
|
-
index:
|
|
325
|
+
record: r,
|
|
326
|
+
index: a,
|
|
320
327
|
size: c,
|
|
321
328
|
paddingYClass: R,
|
|
322
|
-
isSelected:
|
|
323
|
-
cellStyle:
|
|
329
|
+
isSelected: h = !1,
|
|
330
|
+
cellStyle: k
|
|
324
331
|
}) => {
|
|
325
|
-
const
|
|
326
|
-
color:
|
|
327
|
-
...
|
|
332
|
+
const v = r[e.dataIndex], u = e.render ? e.render(v, r, a) : v == null ? "" : String(v), T = (e.title === "" || e.title == null) && e.width !== void 0, M = Ue(v) && v.length > 0, I = h ? {
|
|
333
|
+
color: ut,
|
|
334
|
+
...ht
|
|
328
335
|
} : {};
|
|
329
|
-
if (
|
|
330
|
-
return /* @__PURE__ */
|
|
336
|
+
if (T)
|
|
337
|
+
return /* @__PURE__ */ n(
|
|
331
338
|
"div",
|
|
332
339
|
{
|
|
333
|
-
className: `flex items-center ${
|
|
340
|
+
className: `flex items-center ${gt(e.align)} shrink-0 overflow-hidden px-4 ${R}`,
|
|
334
341
|
style: {
|
|
335
|
-
...
|
|
336
|
-
...
|
|
337
|
-
...
|
|
342
|
+
...Pe(e),
|
|
343
|
+
...I,
|
|
344
|
+
...k
|
|
338
345
|
},
|
|
339
|
-
children:
|
|
346
|
+
children: u
|
|
340
347
|
}
|
|
341
348
|
);
|
|
342
|
-
const
|
|
343
|
-
return /* @__PURE__ */
|
|
349
|
+
const C = !e.render && M ? /* @__PURE__ */ n(Wt, { text: v, children: u }) : u;
|
|
350
|
+
return /* @__PURE__ */ n(
|
|
344
351
|
"div",
|
|
345
352
|
{
|
|
346
|
-
className: `flex flex-[1_0_0] items-center min-w-0 overflow-hidden px-4 ${R} ${
|
|
353
|
+
className: `flex flex-[1_0_0] items-center min-w-0 overflow-hidden px-4 ${R} ${se(c)} ${Z(e.align)}`,
|
|
347
354
|
style: {
|
|
348
|
-
...
|
|
349
|
-
...
|
|
350
|
-
...
|
|
355
|
+
...oe(e),
|
|
356
|
+
...I,
|
|
357
|
+
...k
|
|
351
358
|
},
|
|
352
|
-
children:
|
|
359
|
+
children: C
|
|
353
360
|
}
|
|
354
361
|
);
|
|
355
|
-
},
|
|
362
|
+
}, Cn = ({
|
|
356
363
|
columns: e,
|
|
357
|
-
data:
|
|
358
|
-
loading:
|
|
364
|
+
data: r,
|
|
365
|
+
loading: a = !1,
|
|
359
366
|
error: c = !1,
|
|
360
367
|
errorTitle: R = "Data unavailable",
|
|
361
|
-
errorSubTitle:
|
|
362
|
-
emptyTitle:
|
|
363
|
-
emptySubTitle:
|
|
364
|
-
bordered:
|
|
365
|
-
showHeader:
|
|
366
|
-
rowKey:
|
|
367
|
-
scrollHeight:
|
|
368
|
-
size:
|
|
369
|
-
rowDensity:
|
|
370
|
-
layout:
|
|
371
|
-
headerVariant:
|
|
372
|
-
rowClassName:
|
|
373
|
-
rowVariant:
|
|
374
|
-
onRow:
|
|
375
|
-
onClickRow:
|
|
376
|
-
selectedRowKey:
|
|
377
|
-
scrollSelectedIntoView:
|
|
368
|
+
errorSubTitle: h = "There was an issue retrieving the data. Please try again.",
|
|
369
|
+
emptyTitle: k = "No data",
|
|
370
|
+
emptySubTitle: v = "",
|
|
371
|
+
bordered: u = !1,
|
|
372
|
+
showHeader: D = !0,
|
|
373
|
+
rowKey: T = "key",
|
|
374
|
+
scrollHeight: M,
|
|
375
|
+
size: I = "small",
|
|
376
|
+
rowDensity: C = "default",
|
|
377
|
+
layout: te = "auto",
|
|
378
|
+
headerVariant: q = "inline",
|
|
379
|
+
rowClassName: G,
|
|
380
|
+
rowVariant: j,
|
|
381
|
+
onRow: U,
|
|
382
|
+
onClickRow: E,
|
|
383
|
+
selectedRowKey: O,
|
|
384
|
+
scrollSelectedIntoView: ne = !0,
|
|
378
385
|
rowSelection: W,
|
|
379
|
-
pagination:
|
|
380
|
-
className:
|
|
381
|
-
style:
|
|
382
|
-
stickyHeaderTop:
|
|
383
|
-
scrollX:
|
|
384
|
-
rowSection:
|
|
385
|
-
renderSectionDivider:
|
|
386
|
-
onVisibleOrderChange:
|
|
387
|
-
virtual:
|
|
388
|
-
virtualRowHeightEstimate:
|
|
389
|
-
virtualScrollElement:
|
|
386
|
+
pagination: f,
|
|
387
|
+
className: J = "",
|
|
388
|
+
style: X,
|
|
389
|
+
stickyHeaderTop: Se,
|
|
390
|
+
scrollX: P = !1,
|
|
391
|
+
rowSection: ke,
|
|
392
|
+
renderSectionDivider: we,
|
|
393
|
+
onVisibleOrderChange: Ne,
|
|
394
|
+
virtual: vt = !1,
|
|
395
|
+
virtualRowHeightEstimate: xt,
|
|
396
|
+
virtualScrollElement: ce = null
|
|
390
397
|
}) => {
|
|
391
|
-
const
|
|
398
|
+
const re = C === "compact" ? "py-1.5" : "py-3", [_, mt] = V(null), He = A(null), Ce = A(null), ie = A(null), Ee = A(null), Re = A(/* @__PURE__ */ new Map()), yt = We(
|
|
392
399
|
(t, i) => {
|
|
393
|
-
i ?
|
|
400
|
+
i ? Re.current.set(t, i) : Re.current.delete(t);
|
|
394
401
|
},
|
|
395
402
|
[]
|
|
396
|
-
),
|
|
397
|
-
|
|
398
|
-
}, []),
|
|
399
|
-
const t =
|
|
400
|
-
|
|
403
|
+
), Q = Tt(), [$t, Ie] = V(0), Y = vt && q === "detached", St = xt ?? Kt, [fe, kt] = V(null), wt = We((t) => {
|
|
404
|
+
ie.current = t, t && kt((i) => i === t ? i : t);
|
|
405
|
+
}, []), _e = Y ? ce ?? fe : null, Ge = P ? Pt(e) : 0, he = P && q === "detached" ? Gt(e) : qt, ue = he.edgeKey !== void 0, [Nt, Je] = V(!1), [Ct, Ye] = V(0), pe = We(() => {
|
|
406
|
+
const t = ie.current;
|
|
407
|
+
Je(
|
|
401
408
|
t !== null && t.scrollLeft + t.clientWidth < t.scrollWidth - 1
|
|
402
|
-
),
|
|
409
|
+
), Ye(t === null ? 0 : t.offsetWidth - t.clientWidth);
|
|
403
410
|
}, []);
|
|
404
|
-
|
|
405
|
-
if (!
|
|
406
|
-
|
|
411
|
+
ee(() => {
|
|
412
|
+
if (!ue || !fe) {
|
|
413
|
+
Je(!1), Ye(0);
|
|
407
414
|
return;
|
|
408
415
|
}
|
|
409
|
-
if (
|
|
416
|
+
if (pe(), typeof ResizeObserver > "u")
|
|
410
417
|
return;
|
|
411
|
-
const t = new ResizeObserver(
|
|
412
|
-
return t.observe(
|
|
413
|
-
}, [
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
const t =
|
|
417
|
-
if (!t || !
|
|
418
|
-
|
|
418
|
+
const t = new ResizeObserver(pe);
|
|
419
|
+
return t.observe(fe), () => t.disconnect();
|
|
420
|
+
}, [ue, fe, Ge, pe]);
|
|
421
|
+
const De = !(Y && ce), H = q === "detached" && Se !== void 0 && D && !M && (!Y || !De), qe = O != null, [Te, Qe] = V(0);
|
|
422
|
+
ee(() => {
|
|
423
|
+
const t = He.current;
|
|
424
|
+
if (!t || !H || !qe || typeof ResizeObserver > "u") {
|
|
425
|
+
Qe(0);
|
|
419
426
|
return;
|
|
420
427
|
}
|
|
421
|
-
const i = new ResizeObserver((
|
|
422
|
-
var
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
(
|
|
428
|
+
const i = new ResizeObserver((p) => {
|
|
429
|
+
var g, m;
|
|
430
|
+
const s = p[0], x = ((m = (g = s == null ? void 0 : s.borderBoxSize) == null ? void 0 : g[0]) == null ? void 0 : m.blockSize) ?? (s == null ? void 0 : s.contentRect.height) ?? 0;
|
|
431
|
+
Qe(
|
|
432
|
+
(w) => Math.abs(w - x) < 1 ? w : x
|
|
426
433
|
);
|
|
427
434
|
});
|
|
428
435
|
return i.observe(t), () => i.disconnect();
|
|
429
|
-
}, [
|
|
430
|
-
const
|
|
431
|
-
const t = (
|
|
432
|
-
if (!_) return
|
|
433
|
-
const
|
|
434
|
-
if (!
|
|
435
|
-
if (typeof
|
|
436
|
-
const
|
|
437
|
-
return _.direction === "asc" ?
|
|
436
|
+
}, [H, qe]);
|
|
437
|
+
const Et = H ? (Se ?? 0) + Te : void 0, { sortedData: z, sectionDividers: Oe } = tt(() => {
|
|
438
|
+
const t = (g) => {
|
|
439
|
+
if (!_) return g;
|
|
440
|
+
const m = e.find((o) => o.key === _.key);
|
|
441
|
+
if (!m) return g;
|
|
442
|
+
if (typeof m.sorter == "function") {
|
|
443
|
+
const o = [...g].sort(m.sorter);
|
|
444
|
+
return _.direction === "asc" ? o : o.reverse();
|
|
438
445
|
}
|
|
439
|
-
const
|
|
440
|
-
return [...
|
|
441
|
-
const
|
|
442
|
-
return
|
|
446
|
+
const w = m.dataIndex ?? _.key;
|
|
447
|
+
return [...g].sort((o, d) => {
|
|
448
|
+
const l = o[w], $ = d[w];
|
|
449
|
+
return l < $ ? _.direction === "asc" ? -1 : 1 : l > $ ? _.direction === "asc" ? 1 : -1 : 0;
|
|
443
450
|
});
|
|
444
451
|
};
|
|
445
|
-
if (!
|
|
452
|
+
if (!ke)
|
|
446
453
|
return {
|
|
447
|
-
sortedData: t(
|
|
454
|
+
sortedData: t(r),
|
|
448
455
|
sectionDividers: /* @__PURE__ */ new Map()
|
|
449
456
|
};
|
|
450
|
-
const i = [],
|
|
451
|
-
for (const
|
|
452
|
-
const
|
|
453
|
-
let
|
|
454
|
-
|
|
457
|
+
const i = [], p = /* @__PURE__ */ new Map();
|
|
458
|
+
for (const g of r) {
|
|
459
|
+
const m = ke(g);
|
|
460
|
+
let w = p.get(m);
|
|
461
|
+
w === void 0 && (w = i.length, p.set(m, w), i.push({ key: m, records: [] })), i[w].records.push(g);
|
|
455
462
|
}
|
|
456
|
-
const
|
|
457
|
-
for (const
|
|
458
|
-
const
|
|
459
|
-
|
|
463
|
+
const s = [], x = /* @__PURE__ */ new Map();
|
|
464
|
+
for (const g of i) {
|
|
465
|
+
const m = t(g.records);
|
|
466
|
+
x.set(s.length, { key: g.key, records: m }), s.push(...m);
|
|
460
467
|
}
|
|
461
|
-
return { sortedData:
|
|
462
|
-
}, [
|
|
463
|
-
|
|
464
|
-
},
|
|
465
|
-
|
|
466
|
-
if (
|
|
468
|
+
return { sortedData: s, sectionDividers: x };
|
|
469
|
+
}, [r, _, e, ke]), Ve = (t) => {
|
|
470
|
+
mt((i) => (i == null ? void 0 : i.key) === t ? i.direction === "asc" ? { key: t, direction: "desc" } : null : { key: t, direction: "asc" });
|
|
471
|
+
}, ze = (t, i) => typeof T == "function" ? T(t) : String(t[T] ?? i), Ze = typeof T == "function" ? null : T, Xe = A(void 0), ge = A(void 0);
|
|
472
|
+
ee(() => {
|
|
473
|
+
if (!Ne)
|
|
467
474
|
return;
|
|
468
|
-
|
|
469
|
-
const t =
|
|
470
|
-
i &&
|
|
471
|
-
}, [
|
|
472
|
-
const
|
|
473
|
-
if (
|
|
475
|
+
ge.current ?? (ge.current = { ids: /* @__PURE__ */ new WeakMap(), next: 0 });
|
|
476
|
+
const t = Ut(z, T, ge.current), i = Xe.current;
|
|
477
|
+
i && At(i, t) || (Xe.current = t, Ne(z));
|
|
478
|
+
}, [z, Ze, Ne]);
|
|
479
|
+
const K = Math.min($t, Math.max(0, z.length - 1)), L = tt(() => {
|
|
480
|
+
if (O == null)
|
|
474
481
|
return -1;
|
|
475
|
-
const t = String(
|
|
476
|
-
return
|
|
477
|
-
}, [
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
}, [
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
if (
|
|
484
|
-
|
|
482
|
+
const t = String(O);
|
|
483
|
+
return z.findIndex((i, p) => ze(i, p) === t);
|
|
484
|
+
}, [O, z, Ze]);
|
|
485
|
+
ee(() => {
|
|
486
|
+
L >= 0 && Ie(L);
|
|
487
|
+
}, [L]);
|
|
488
|
+
const Le = A(void 0);
|
|
489
|
+
ee(() => {
|
|
490
|
+
if (O == null) {
|
|
491
|
+
Le.current = void 0;
|
|
485
492
|
return;
|
|
486
493
|
}
|
|
487
|
-
if (!
|
|
494
|
+
if (!ne || L < 0)
|
|
488
495
|
return;
|
|
489
|
-
const t =
|
|
490
|
-
if (t && t.key ===
|
|
496
|
+
const t = Le.current;
|
|
497
|
+
if (t && t.key === O && t.index === L || a || c || Y && !_e)
|
|
491
498
|
return;
|
|
492
|
-
const i =
|
|
499
|
+
const i = Ee.current;
|
|
493
500
|
if (!i)
|
|
494
501
|
return;
|
|
495
|
-
const
|
|
496
|
-
`[data-table-id="${
|
|
497
|
-
),
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
},
|
|
501
|
-
if (
|
|
502
|
-
|
|
502
|
+
const p = H && Te === 0, s = (l) => i.querySelector(
|
|
503
|
+
`[data-table-id="${Q}"][data-row-index="${l}"]`
|
|
504
|
+
), x = (l) => {
|
|
505
|
+
const $ = ie.current, b = ce, F = $ == null ? void 0 : $.scrollLeft, B = b == null ? void 0 : b.scrollLeft;
|
|
506
|
+
l.scrollIntoView({ block: "nearest", inline: "nearest" }), $ && F !== void 0 && ($.scrollLeft = F), b && B !== void 0 && (b.scrollLeft = B), p || (Le.current = { key: O, index: L });
|
|
507
|
+
}, g = s(L);
|
|
508
|
+
if (g) {
|
|
509
|
+
x(g);
|
|
503
510
|
return;
|
|
504
511
|
}
|
|
505
|
-
if (!
|
|
512
|
+
if (!Y)
|
|
506
513
|
return;
|
|
507
|
-
const
|
|
508
|
-
(
|
|
514
|
+
const m = [...Re.current.values()].find(
|
|
515
|
+
(l) => L >= l.startIndex && L < l.startIndex + l.count
|
|
509
516
|
);
|
|
510
|
-
if (!
|
|
517
|
+
if (!m)
|
|
511
518
|
return;
|
|
512
|
-
|
|
513
|
-
let
|
|
519
|
+
m.scrollToIndex(L - m.startIndex);
|
|
520
|
+
let w = 0, o = 0;
|
|
514
521
|
const d = () => {
|
|
515
|
-
const
|
|
516
|
-
if (
|
|
517
|
-
|
|
522
|
+
const l = s(L);
|
|
523
|
+
if (l) {
|
|
524
|
+
x(l);
|
|
518
525
|
return;
|
|
519
526
|
}
|
|
520
|
-
++
|
|
527
|
+
++o < tn && (w = requestAnimationFrame(d));
|
|
521
528
|
};
|
|
522
|
-
return
|
|
529
|
+
return w = requestAnimationFrame(d), () => cancelAnimationFrame(w);
|
|
523
530
|
}, [
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
531
|
+
O,
|
|
532
|
+
L,
|
|
533
|
+
Y,
|
|
534
|
+
_e,
|
|
535
|
+
ce,
|
|
536
|
+
H,
|
|
537
|
+
Te,
|
|
538
|
+
a,
|
|
532
539
|
c,
|
|
533
|
-
|
|
534
|
-
|
|
540
|
+
Q,
|
|
541
|
+
ne
|
|
535
542
|
]);
|
|
536
|
-
const
|
|
537
|
-
|
|
543
|
+
const Me = A(null), Ke = (t, i) => {
|
|
544
|
+
Me.current = t, Ie(Math.min(Math.max(0, i), z.length - 1));
|
|
538
545
|
};
|
|
539
|
-
|
|
540
|
-
const t =
|
|
546
|
+
dt(() => {
|
|
547
|
+
const t = Me.current;
|
|
541
548
|
if (!t)
|
|
542
549
|
return;
|
|
543
|
-
|
|
544
|
-
const i = t.getRootNode(),
|
|
545
|
-
`[data-table-id="${
|
|
546
|
-
))(
|
|
547
|
-
if (
|
|
548
|
-
|
|
550
|
+
Me.current = null;
|
|
551
|
+
const i = t.getRootNode(), s = ((m) => i.querySelector(
|
|
552
|
+
`[data-table-id="${Q}"][data-row-index="${m}"]`
|
|
553
|
+
))(K);
|
|
554
|
+
if (s) {
|
|
555
|
+
s.focus();
|
|
549
556
|
return;
|
|
550
557
|
}
|
|
551
|
-
const
|
|
552
|
-
`[data-table-id="${
|
|
553
|
-
),
|
|
554
|
-
|
|
555
|
-
}, [
|
|
556
|
-
const
|
|
557
|
-
const
|
|
558
|
-
if (
|
|
559
|
-
|
|
558
|
+
const x = i.querySelectorAll(
|
|
559
|
+
`[data-table-id="${Q}"][data-row-index]`
|
|
560
|
+
), g = K > 0 ? x[x.length - 1] : x[0];
|
|
561
|
+
g && (Ie(Number(g.dataset.rowIndex)), g.focus());
|
|
562
|
+
}, [K, Q]);
|
|
563
|
+
const et = (t, i) => (p) => {
|
|
564
|
+
const s = { ArrowDown: 1, ArrowUp: -1 }[p.key];
|
|
565
|
+
if (s !== void 0) {
|
|
566
|
+
p.preventDefault(), Ke(p.currentTarget, t + s);
|
|
560
567
|
return;
|
|
561
568
|
}
|
|
562
|
-
if (!
|
|
563
|
-
|
|
569
|
+
if (!Y && (p.key === "Home" || p.key === "End")) {
|
|
570
|
+
p.preventDefault(), Ke(p.currentTarget, p.key === "Home" ? 0 : z.length - 1);
|
|
564
571
|
return;
|
|
565
572
|
}
|
|
566
|
-
i &&
|
|
573
|
+
i && Bt(p, i, "enter");
|
|
567
574
|
};
|
|
568
|
-
if (
|
|
569
|
-
const t =
|
|
570
|
-
...
|
|
571
|
-
...
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
575
|
+
if (q === "detached") {
|
|
576
|
+
const t = P ? { minWidth: Ge } : {}, i = (o, d) => ({
|
|
577
|
+
...P && o.width === void 0 ? { minWidth: o.minWidth ?? pt } : {},
|
|
578
|
+
...Vt(he.offsets.get(o.key), d)
|
|
579
|
+
}), p = (o) => o.key === he.edgeKey && Nt ? /* @__PURE__ */ n(
|
|
580
|
+
"span",
|
|
581
|
+
{
|
|
582
|
+
"aria-hidden": "true",
|
|
583
|
+
className: "shrink-0",
|
|
584
|
+
style: {
|
|
585
|
+
position: "sticky",
|
|
586
|
+
right: he.extent,
|
|
587
|
+
zIndex: 1
|
|
588
|
+
},
|
|
589
|
+
children: /* @__PURE__ */ n("span", { style: Qt })
|
|
590
|
+
}
|
|
591
|
+
) : null, s = H ? "var(--malachite-table-header-background, #f7f7f7)" : "var(--malachite-table-background, #f7f7f7)", x = {
|
|
578
592
|
border: "1px solid var(--malachite-card-border, #e8e8e8)",
|
|
579
|
-
borderRadius:
|
|
593
|
+
borderRadius: le,
|
|
580
594
|
overflow: "clip",
|
|
581
595
|
flexShrink: 0,
|
|
582
596
|
...t
|
|
583
|
-
},
|
|
584
|
-
const B =
|
|
597
|
+
}, g = (o, d, l = !1, $ = !1, b, F = K) => {
|
|
598
|
+
const B = ze(o, d), y = (U == null ? void 0 : U(o, d)) || {}, It = j == null ? void 0 : j(o, d), be = d === L, ve = E || y.onClick ? () => {
|
|
585
599
|
var N;
|
|
586
|
-
|
|
587
|
-
} : void 0,
|
|
588
|
-
return /* @__PURE__ */
|
|
600
|
+
E == null || E(o, d), (N = y.onClick) == null || N.call(y, o, d);
|
|
601
|
+
} : void 0, xe = !!ve, _t = l ? {} : st;
|
|
602
|
+
return /* @__PURE__ */ S(
|
|
589
603
|
"div",
|
|
590
604
|
{
|
|
591
|
-
ref:
|
|
592
|
-
"data-index":
|
|
593
|
-
"data-table-id":
|
|
594
|
-
"data-row-index":
|
|
595
|
-
"aria-current":
|
|
596
|
-
tabIndex:
|
|
597
|
-
onKeyDown:
|
|
605
|
+
ref: b == null ? void 0 : b.measureRef,
|
|
606
|
+
"data-index": b == null ? void 0 : b.index,
|
|
607
|
+
"data-table-id": Q,
|
|
608
|
+
"data-row-index": d,
|
|
609
|
+
"aria-current": be ? "true" : void 0,
|
|
610
|
+
tabIndex: xe ? d === F ? 0 : -1 : void 0,
|
|
611
|
+
onKeyDown: xe ? et(d, ve) : void 0,
|
|
598
612
|
className: `
|
|
599
613
|
group bg-[var(--malachite-table-row-background,#fff)] flex min-h-10 items-stretch relative w-full
|
|
600
|
-
${
|
|
601
|
-
${(
|
|
614
|
+
${xe ? `cursor-pointer hover:bg-[var(--malachite-table-row-hover-background,#fafafa)] ${nt}` : ""}
|
|
615
|
+
${(G == null ? void 0 : G(o, d)) || ""}
|
|
602
616
|
`,
|
|
603
617
|
style: {
|
|
604
|
-
...
|
|
618
|
+
..._t,
|
|
605
619
|
...t,
|
|
606
|
-
scrollMarginTop:
|
|
620
|
+
scrollMarginTop: Et,
|
|
607
621
|
// Echo the card's clip, or it cuts the accent bar's end into a stub.
|
|
608
|
-
|
|
609
|
-
borderTopLeftRadius:
|
|
610
|
-
borderTopRightRadius:
|
|
622
|
+
...$ ? {
|
|
623
|
+
borderTopLeftRadius: le,
|
|
624
|
+
borderTopRightRadius: le
|
|
611
625
|
} : {},
|
|
612
|
-
...
|
|
613
|
-
borderBottomLeftRadius:
|
|
614
|
-
borderBottomRightRadius:
|
|
626
|
+
...l ? {
|
|
627
|
+
borderBottomLeftRadius: le,
|
|
628
|
+
borderBottomRightRadius: le
|
|
615
629
|
} : {},
|
|
616
630
|
// Set unconditionally it would beat `hover:bg-*` on every row.
|
|
617
|
-
...
|
|
618
|
-
...
|
|
631
|
+
...Zt(It, be),
|
|
632
|
+
...be ? {
|
|
619
633
|
// Inset box-shadow, not `ring-*` — see the classic cell.
|
|
620
|
-
boxShadow: `inset 2px 0 0 ${
|
|
634
|
+
boxShadow: `inset 2px 0 0 ${ft}`
|
|
621
635
|
} : {}
|
|
622
636
|
},
|
|
623
|
-
onClick:
|
|
624
|
-
|
|
637
|
+
onClick: ve ? (N) => {
|
|
638
|
+
rt(N) || ve();
|
|
625
639
|
} : void 0,
|
|
626
|
-
onDoubleClick:
|
|
640
|
+
onDoubleClick: y.onDoubleClick ? () => {
|
|
627
641
|
var N;
|
|
628
|
-
return (N =
|
|
642
|
+
return (N = y.onDoubleClick) == null ? void 0 : N.call(y, o, d);
|
|
629
643
|
} : void 0,
|
|
630
|
-
onContextMenu:
|
|
644
|
+
onContextMenu: y.onContextMenu ? () => {
|
|
631
645
|
var N;
|
|
632
|
-
return (N =
|
|
646
|
+
return (N = y.onContextMenu) == null ? void 0 : N.call(y, o, d);
|
|
633
647
|
} : void 0,
|
|
634
|
-
onMouseEnter:
|
|
648
|
+
onMouseEnter: y.onMouseEnter ? () => {
|
|
635
649
|
var N;
|
|
636
|
-
return (N =
|
|
650
|
+
return (N = y.onMouseEnter) == null ? void 0 : N.call(y, o, d);
|
|
637
651
|
} : void 0,
|
|
638
|
-
onMouseLeave:
|
|
652
|
+
onMouseLeave: y.onMouseLeave ? () => {
|
|
639
653
|
var N;
|
|
640
|
-
return (N =
|
|
654
|
+
return (N = y.onMouseLeave) == null ? void 0 : N.call(y, o, d);
|
|
641
655
|
} : void 0,
|
|
642
656
|
children: [
|
|
643
|
-
e.map((N) => /* @__PURE__ */
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
+
e.map((N) => /* @__PURE__ */ S(me.Fragment, { children: [
|
|
658
|
+
p(N),
|
|
659
|
+
/* @__PURE__ */ n(
|
|
660
|
+
hn,
|
|
661
|
+
{
|
|
662
|
+
column: N,
|
|
663
|
+
record: o,
|
|
664
|
+
paddingYClass: re,
|
|
665
|
+
index: d,
|
|
666
|
+
size: I,
|
|
667
|
+
isSelected: be,
|
|
668
|
+
cellStyle: i(N, "row")
|
|
669
|
+
}
|
|
670
|
+
)
|
|
671
|
+
] }, N.key)),
|
|
672
|
+
xe && ue ? /* @__PURE__ */ n("span", { "aria-hidden": "true", className: Ft }) : null
|
|
657
673
|
]
|
|
658
674
|
},
|
|
659
675
|
B
|
|
660
676
|
);
|
|
661
|
-
}, m = (
|
|
677
|
+
}, m = (o, d = !1) => /* @__PURE__ */ n(
|
|
662
678
|
"div",
|
|
663
679
|
{
|
|
664
680
|
className: "bg-white flex min-h-10 items-stretch w-full",
|
|
665
|
-
style: { ...
|
|
666
|
-
children: e.map((
|
|
667
|
-
"
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
{
|
|
694
|
-
column: l,
|
|
695
|
-
sortDirection: (_ == null ? void 0 : _.key) === l.key ? _.direction : null,
|
|
696
|
-
onSort: l.sorter ? () => Ye(l.key) : void 0,
|
|
697
|
-
cellStyle: i(l, v)
|
|
681
|
+
style: { ...d ? {} : st, ...t },
|
|
682
|
+
children: e.map((l) => {
|
|
683
|
+
const F = (l.title === "" || l.title == null) && l.width !== void 0 ? /* @__PURE__ */ n(
|
|
684
|
+
"div",
|
|
685
|
+
{
|
|
686
|
+
className: `flex items-center ${gt(l.align)} shrink-0 overflow-clip px-4 ${re}`,
|
|
687
|
+
style: {
|
|
688
|
+
...Pe(l),
|
|
689
|
+
...i(l, "row")
|
|
690
|
+
},
|
|
691
|
+
children: /* @__PURE__ */ n("div", { className: "h-3 bg-gray-200 rounded animate-pulse w-2/5" })
|
|
692
|
+
}
|
|
693
|
+
) : /* @__PURE__ */ n(
|
|
694
|
+
"div",
|
|
695
|
+
{
|
|
696
|
+
className: `flex flex-[1_0_0] items-center ${Z(l.align)} min-w-0 overflow-clip px-4 ${re}`,
|
|
697
|
+
style: {
|
|
698
|
+
...oe(l),
|
|
699
|
+
...i(l, "row")
|
|
700
|
+
},
|
|
701
|
+
children: /* @__PURE__ */ n("div", { className: "h-3 bg-gray-200 rounded animate-pulse w-3/5" })
|
|
702
|
+
}
|
|
703
|
+
);
|
|
704
|
+
return /* @__PURE__ */ S(me.Fragment, { children: [
|
|
705
|
+
p(l),
|
|
706
|
+
F
|
|
707
|
+
] }, l.key);
|
|
708
|
+
})
|
|
698
709
|
},
|
|
699
|
-
|
|
700
|
-
)
|
|
701
|
-
|
|
710
|
+
`skeleton-${o}`
|
|
711
|
+
), w = D ? /* @__PURE__ */ n("div", { className: "flex min-h-10 items-stretch w-full", style: t, children: e.map((o) => /* @__PURE__ */ S(me.Fragment, { children: [
|
|
712
|
+
p(o),
|
|
713
|
+
/* @__PURE__ */ n(
|
|
714
|
+
fn,
|
|
715
|
+
{
|
|
716
|
+
column: o,
|
|
717
|
+
sortDirection: (_ == null ? void 0 : _.key) === o.key ? _.direction : null,
|
|
718
|
+
onSort: o.sorter ? () => Ve(o.key) : void 0,
|
|
719
|
+
cellStyle: i(o, s)
|
|
720
|
+
}
|
|
721
|
+
)
|
|
722
|
+
] }, o.key)) }) : null;
|
|
723
|
+
return /* @__PURE__ */ S(
|
|
702
724
|
"div",
|
|
703
725
|
{
|
|
704
|
-
ref:
|
|
705
|
-
className: `w-full ${
|
|
706
|
-
style: { ...
|
|
726
|
+
ref: Ee,
|
|
727
|
+
className: `w-full ${J}`,
|
|
728
|
+
style: { ...Fe, ...X },
|
|
707
729
|
children: [
|
|
708
|
-
/* @__PURE__ */
|
|
730
|
+
/* @__PURE__ */ S(
|
|
709
731
|
"div",
|
|
710
732
|
{
|
|
711
|
-
className: `bg-[var(--malachite-table-background,#f7f7f7)] flex flex-col items-start ${
|
|
733
|
+
className: `bg-[var(--malachite-table-background,#f7f7f7)] flex flex-col items-start ${H ? "" : "overflow-clip"} p-[4px] relative rounded-xl w-full`,
|
|
712
734
|
children: [
|
|
713
|
-
|
|
735
|
+
D && /* @__PURE__ */ S(
|
|
714
736
|
"div",
|
|
715
737
|
{
|
|
716
|
-
ref:
|
|
738
|
+
ref: He,
|
|
717
739
|
style: {
|
|
718
|
-
...
|
|
740
|
+
...H ? {
|
|
719
741
|
position: "sticky",
|
|
720
|
-
top:
|
|
742
|
+
top: Se,
|
|
721
743
|
zIndex: 8,
|
|
722
744
|
backgroundColor: "var(--malachite-table-header-background, #f7f7f7)",
|
|
723
|
-
marginInline: -
|
|
724
|
-
width: `calc(100% + ${
|
|
725
|
-
paddingInline:
|
|
745
|
+
marginInline: -ae,
|
|
746
|
+
width: `calc(100% + ${ae * 2}px)`,
|
|
747
|
+
paddingInline: ae,
|
|
726
748
|
// Vertically too, or the card's top frame sits above
|
|
727
749
|
// the docked header and rows scroll through it.
|
|
728
|
-
marginTop: -
|
|
729
|
-
paddingTop:
|
|
750
|
+
marginTop: -ae,
|
|
751
|
+
paddingTop: ae
|
|
730
752
|
} : { width: "100%" }
|
|
731
753
|
},
|
|
732
754
|
children: [
|
|
733
|
-
|
|
734
|
-
/* @__PURE__ */
|
|
755
|
+
H && /* @__PURE__ */ n(ln, {}),
|
|
756
|
+
/* @__PURE__ */ n(
|
|
735
757
|
"div",
|
|
736
758
|
{
|
|
737
|
-
ref:
|
|
738
|
-
onScroll:
|
|
739
|
-
|
|
740
|
-
|
|
759
|
+
ref: Ce,
|
|
760
|
+
onScroll: P ? () => ot(
|
|
761
|
+
Ce.current,
|
|
762
|
+
ie.current
|
|
741
763
|
) : void 0,
|
|
742
|
-
style:
|
|
743
|
-
...
|
|
744
|
-
paddingRight:
|
|
764
|
+
style: P ? {
|
|
765
|
+
...Jt,
|
|
766
|
+
paddingRight: Ct
|
|
745
767
|
} : void 0,
|
|
746
|
-
children:
|
|
768
|
+
children: w
|
|
747
769
|
}
|
|
748
770
|
)
|
|
749
771
|
]
|
|
750
772
|
}
|
|
751
773
|
),
|
|
752
|
-
/* @__PURE__ */
|
|
774
|
+
/* @__PURE__ */ n(
|
|
753
775
|
"div",
|
|
754
776
|
{
|
|
755
|
-
ref:
|
|
756
|
-
onScroll:
|
|
757
|
-
|
|
777
|
+
ref: wt,
|
|
778
|
+
onScroll: P ? () => {
|
|
779
|
+
ot(ie.current, Ce.current), ue && pe();
|
|
758
780
|
} : void 0,
|
|
759
|
-
className: `flex flex-col items-start ${
|
|
781
|
+
className: `flex flex-col items-start ${P ? "overflow-x-auto" : "overflow-x-clip"} ${De ? "overflow-y-auto" : "overflow-y-visible"} w-full`,
|
|
760
782
|
style: {
|
|
761
783
|
// Firefox + modern Chromium only; older Webkit keeps its default.
|
|
762
784
|
scrollbarWidth: "thin",
|
|
763
785
|
scrollbarColor: "var(--malachite-text-placeholder, rgb(187, 187, 187)) transparent",
|
|
764
786
|
// With an external virtual scroller the body is overflow-visible and
|
|
765
787
|
// a bounded box would overlap content below it.
|
|
766
|
-
...
|
|
767
|
-
maxHeight:
|
|
768
|
-
|
|
769
|
-
!!
|
|
788
|
+
...M && De ? {
|
|
789
|
+
maxHeight: sn(
|
|
790
|
+
M,
|
|
791
|
+
!!f
|
|
770
792
|
)
|
|
771
793
|
} : {}
|
|
772
794
|
},
|
|
773
|
-
children: c ? /* @__PURE__ */
|
|
774
|
-
/* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
776
|
-
] }) }) :
|
|
777
|
-
const
|
|
778
|
-
return Array.from({ length:
|
|
779
|
-
(
|
|
795
|
+
children: c ? /* @__PURE__ */ n("div", { className: "flex flex-col w-full", style: x, children: /* @__PURE__ */ S("div", { className: "flex flex-col items-center justify-center bg-white w-full py-12", children: [
|
|
796
|
+
/* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium mb-1", children: R }),
|
|
797
|
+
/* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[13px]", children: h })
|
|
798
|
+
] }) }) : a ? /* @__PURE__ */ n("div", { className: "flex flex-col w-full", style: x, children: (() => {
|
|
799
|
+
const o = f != null && f.pageSize ? Math.min(f.pageSize, 10) : 5;
|
|
800
|
+
return Array.from({ length: o }).map(
|
|
801
|
+
(d, l) => m(l, l === o - 1)
|
|
780
802
|
);
|
|
781
|
-
})() }) :
|
|
782
|
-
/* @__PURE__ */
|
|
783
|
-
|
|
803
|
+
})() }) : z.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col w-full", style: x, children: /* @__PURE__ */ S("div", { className: "flex flex-col items-center justify-center bg-white w-full py-12", children: [
|
|
804
|
+
/* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium", children: k }),
|
|
805
|
+
v && /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[13px] mt-1", children: v })
|
|
784
806
|
] }) }) : (() => {
|
|
785
|
-
const
|
|
786
|
-
|
|
807
|
+
const o = (l, $, b) => Y ? /* @__PURE__ */ n(
|
|
808
|
+
an,
|
|
787
809
|
{
|
|
788
|
-
cardKey:
|
|
789
|
-
records:
|
|
790
|
-
startIndex:
|
|
791
|
-
scrollElement:
|
|
792
|
-
estimateRowHeight:
|
|
793
|
-
style:
|
|
794
|
-
renderRow:
|
|
795
|
-
registerHandle:
|
|
796
|
-
rovingIndex:
|
|
810
|
+
cardKey: b,
|
|
811
|
+
records: l,
|
|
812
|
+
startIndex: $,
|
|
813
|
+
scrollElement: _e,
|
|
814
|
+
estimateRowHeight: St,
|
|
815
|
+
style: x,
|
|
816
|
+
renderRow: g,
|
|
817
|
+
registerHandle: yt,
|
|
818
|
+
rovingIndex: K
|
|
797
819
|
},
|
|
798
|
-
`section-card-${
|
|
799
|
-
) : /* @__PURE__ */
|
|
820
|
+
`section-card-${b}`
|
|
821
|
+
) : /* @__PURE__ */ n(
|
|
800
822
|
"div",
|
|
801
823
|
{
|
|
802
824
|
className: "flex flex-col w-full",
|
|
803
|
-
style:
|
|
804
|
-
children:
|
|
805
|
-
(
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
B ===
|
|
825
|
+
style: x,
|
|
826
|
+
children: l.map(
|
|
827
|
+
(F, B) => g(
|
|
828
|
+
F,
|
|
829
|
+
$ + B,
|
|
830
|
+
B === l.length - 1,
|
|
809
831
|
B === 0
|
|
810
832
|
)
|
|
811
833
|
)
|
|
812
834
|
},
|
|
813
|
-
`section-card-${
|
|
835
|
+
`section-card-${b}`
|
|
814
836
|
);
|
|
815
|
-
if (
|
|
816
|
-
return
|
|
817
|
-
const
|
|
818
|
-
return
|
|
819
|
-
const
|
|
820
|
-
if (!
|
|
837
|
+
if (Oe.size === 0)
|
|
838
|
+
return o(z, 0, "all");
|
|
839
|
+
const d = [...Oe.keys()].sort((l, $) => l - $);
|
|
840
|
+
return d.map((l, $) => {
|
|
841
|
+
const b = Oe.get(l);
|
|
842
|
+
if (!b)
|
|
821
843
|
return null;
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
|
|
844
|
+
const F = $ + 1 < d.length ? d[$ + 1] : z.length, B = z.slice(l, F), y = we == null ? void 0 : we(
|
|
845
|
+
b.key,
|
|
846
|
+
b.records
|
|
825
847
|
);
|
|
826
|
-
return /* @__PURE__ */
|
|
827
|
-
|
|
848
|
+
return /* @__PURE__ */ S(me.Fragment, { children: [
|
|
849
|
+
y != null ? /* @__PURE__ */ n(
|
|
828
850
|
"div",
|
|
829
851
|
{
|
|
830
852
|
className: "table-section-divider",
|
|
831
|
-
style:
|
|
832
|
-
children:
|
|
853
|
+
style: P ? Yt : void 0,
|
|
854
|
+
children: y
|
|
833
855
|
}
|
|
834
856
|
) : null,
|
|
835
|
-
|
|
836
|
-
] }, `section-${
|
|
857
|
+
o(B, l, b.key)
|
|
858
|
+
] }, `section-${b.key}`);
|
|
837
859
|
});
|
|
838
860
|
})()
|
|
839
861
|
}
|
|
@@ -841,229 +863,229 @@ const ft = 160, Bt = (e, n) => e.length === n.length && e.every((s, c) => s ===
|
|
|
841
863
|
]
|
|
842
864
|
}
|
|
843
865
|
),
|
|
844
|
-
|
|
845
|
-
|
|
866
|
+
f && !a && /* @__PURE__ */ n(
|
|
867
|
+
it,
|
|
846
868
|
{
|
|
847
|
-
current:
|
|
848
|
-
pageSize:
|
|
849
|
-
total:
|
|
850
|
-
showSizeChanger:
|
|
851
|
-
showQuickJumper:
|
|
852
|
-
showTotal:
|
|
853
|
-
pageSizeOptions:
|
|
854
|
-
onChange:
|
|
855
|
-
onShowSizeChange:
|
|
869
|
+
current: f.current ?? 1,
|
|
870
|
+
pageSize: f.pageSize ?? 10,
|
|
871
|
+
total: f.total ?? 0,
|
|
872
|
+
showSizeChanger: f.showSizeChanger,
|
|
873
|
+
showQuickJumper: f.showQuickJumper,
|
|
874
|
+
showTotal: f.showTotal,
|
|
875
|
+
pageSizeOptions: f.pageSizeOptions,
|
|
876
|
+
onChange: f.onChange,
|
|
877
|
+
onShowSizeChange: f.onShowSizeChange
|
|
856
878
|
}
|
|
857
879
|
)
|
|
858
880
|
]
|
|
859
881
|
}
|
|
860
882
|
);
|
|
861
883
|
}
|
|
862
|
-
const
|
|
863
|
-
const i = t.sorter,
|
|
864
|
-
/* @__PURE__ */
|
|
865
|
-
t.info && /* @__PURE__ */
|
|
866
|
-
i && /* @__PURE__ */
|
|
867
|
-
/* @__PURE__ */
|
|
868
|
-
|
|
884
|
+
const Rt = (t) => {
|
|
885
|
+
const i = t.sorter, s = (_ == null ? void 0 : _.key) === t.key ? _ == null ? void 0 : _.direction : null, x = /* @__PURE__ */ S("div", { className: `flex items-center gap-2 ${Z(t.align)}`, children: [
|
|
886
|
+
/* @__PURE__ */ n("span", { children: t.title }),
|
|
887
|
+
t.info && /* @__PURE__ */ n(ye, { info: t.info }),
|
|
888
|
+
i && /* @__PURE__ */ S("div", { className: "flex flex-col", children: [
|
|
889
|
+
/* @__PURE__ */ n(
|
|
890
|
+
Ot,
|
|
869
891
|
{
|
|
870
892
|
size: 12,
|
|
871
|
-
className:
|
|
893
|
+
className: s === "asc" ? "text-blue-600" : "text-gray-400"
|
|
872
894
|
}
|
|
873
895
|
),
|
|
874
|
-
/* @__PURE__ */
|
|
875
|
-
|
|
896
|
+
/* @__PURE__ */ n(
|
|
897
|
+
ct,
|
|
876
898
|
{
|
|
877
899
|
size: 12,
|
|
878
|
-
className: `-mt-1 ${
|
|
900
|
+
className: `-mt-1 ${s === "desc" ? "text-blue-600" : "text-gray-400"}`
|
|
879
901
|
}
|
|
880
902
|
)
|
|
881
903
|
] })
|
|
882
904
|
] });
|
|
883
|
-
return /* @__PURE__ */
|
|
905
|
+
return /* @__PURE__ */ n(
|
|
884
906
|
"th",
|
|
885
907
|
{
|
|
886
908
|
className: `
|
|
887
909
|
table-header table-cell px-4 py-3 font-semibold border-0 first:rounded-tl-lg last:rounded-tr-lg
|
|
888
|
-
${
|
|
889
|
-
${
|
|
910
|
+
${se(I)}
|
|
911
|
+
${de(t.align)}
|
|
890
912
|
`,
|
|
891
913
|
style: { width: t.width },
|
|
892
|
-
"aria-sort": i ?
|
|
893
|
-
children: i ? /* @__PURE__ */
|
|
914
|
+
"aria-sort": i ? on(s) : void 0,
|
|
915
|
+
children: i ? /* @__PURE__ */ n(
|
|
894
916
|
"button",
|
|
895
917
|
{
|
|
896
|
-
...
|
|
897
|
-
className: `flex w-full items-center ${
|
|
898
|
-
children:
|
|
918
|
+
...bt(t.title, () => Ve(t.key)),
|
|
919
|
+
className: `flex w-full items-center ${Z(t.align)} cursor-pointer hover:opacity-80 appearance-none bg-transparent border-0 p-0 font-semibold text-inherit ${de(t.align)}`,
|
|
920
|
+
children: x
|
|
899
921
|
}
|
|
900
|
-
) :
|
|
922
|
+
) : x
|
|
901
923
|
},
|
|
902
924
|
t.key
|
|
903
925
|
);
|
|
904
926
|
};
|
|
905
|
-
return c ? /* @__PURE__ */
|
|
927
|
+
return c ? /* @__PURE__ */ n("div", { className: "w-full", style: { ...Fe, ...X }, children: /* @__PURE__ */ n(
|
|
906
928
|
"div",
|
|
907
929
|
{
|
|
908
930
|
className: "overflow-x-auto",
|
|
909
931
|
style: {
|
|
910
|
-
...
|
|
932
|
+
...M ? { maxHeight: M } : {}
|
|
911
933
|
},
|
|
912
|
-
children: /* @__PURE__ */
|
|
913
|
-
|
|
934
|
+
children: /* @__PURE__ */ S("table", { className: "w-full border-collapse rounded-lg overflow-hidden", children: [
|
|
935
|
+
D && /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ n("tr", { children: e.map((t) => /* @__PURE__ */ n(
|
|
914
936
|
"th",
|
|
915
937
|
{
|
|
916
938
|
className: `
|
|
917
939
|
table-header table-cell px-4 py-3 font-semibold border-0 first:rounded-tl-lg last:rounded-tr-lg
|
|
918
|
-
${
|
|
919
|
-
${
|
|
920
|
-
${
|
|
921
|
-
${
|
|
922
|
-
${
|
|
940
|
+
${u ? "table-cell-bordered table-cell-bordered-top" : ""}
|
|
941
|
+
${u && t === e[0] ? "table-cell-bordered-left" : ""}
|
|
942
|
+
${u && t === e[e.length - 1] ? "table-cell-bordered-right" : ""}
|
|
943
|
+
${se(I)}
|
|
944
|
+
${de(t.align)}
|
|
923
945
|
`,
|
|
924
946
|
style: { width: t.width },
|
|
925
|
-
children: /* @__PURE__ */
|
|
947
|
+
children: /* @__PURE__ */ S(
|
|
926
948
|
"div",
|
|
927
949
|
{
|
|
928
|
-
className: `flex items-center gap-2 ${
|
|
950
|
+
className: `flex items-center gap-2 ${Z(t.align)}`,
|
|
929
951
|
children: [
|
|
930
|
-
/* @__PURE__ */
|
|
931
|
-
t.info && /* @__PURE__ */
|
|
952
|
+
/* @__PURE__ */ n("span", { children: t.title }),
|
|
953
|
+
t.info && /* @__PURE__ */ n(ye, { info: t.info })
|
|
932
954
|
]
|
|
933
955
|
}
|
|
934
956
|
)
|
|
935
957
|
},
|
|
936
958
|
t.key
|
|
937
959
|
)) }) }),
|
|
938
|
-
/* @__PURE__ */
|
|
960
|
+
/* @__PURE__ */ n("tbody", { children: /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n(
|
|
939
961
|
"td",
|
|
940
962
|
{
|
|
941
963
|
colSpan: e.length + (W ? 1 : 0),
|
|
942
964
|
className: "px-4 py-12 text-center",
|
|
943
|
-
children: /* @__PURE__ */
|
|
944
|
-
/* @__PURE__ */
|
|
945
|
-
/* @__PURE__ */
|
|
946
|
-
/* @__PURE__ */
|
|
965
|
+
children: /* @__PURE__ */ S("div", { className: "flex flex-col items-center justify-center", children: [
|
|
966
|
+
/* @__PURE__ */ n("div", { className: "table-error-icon w-12 h-12 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ n(Lt, { size: 24 }) }),
|
|
967
|
+
/* @__PURE__ */ n("div", { className: "table-error-title text-lg font-semibold mb-2", children: R }),
|
|
968
|
+
/* @__PURE__ */ n("div", { className: "table-error-subtitle text-sm", children: h })
|
|
947
969
|
] })
|
|
948
970
|
}
|
|
949
971
|
) }) })
|
|
950
972
|
] })
|
|
951
973
|
}
|
|
952
|
-
) }) : /* @__PURE__ */
|
|
974
|
+
) }) : /* @__PURE__ */ S(
|
|
953
975
|
"div",
|
|
954
976
|
{
|
|
955
|
-
ref:
|
|
956
|
-
className: `w-full ${
|
|
957
|
-
style: { ...
|
|
977
|
+
ref: Ee,
|
|
978
|
+
className: `w-full ${J}`,
|
|
979
|
+
style: { ...Fe, ...X },
|
|
958
980
|
children: [
|
|
959
|
-
/* @__PURE__ */
|
|
981
|
+
/* @__PURE__ */ n(
|
|
960
982
|
"div",
|
|
961
983
|
{
|
|
962
|
-
className: `overflow-hidden rounded-lg ${
|
|
963
|
-
"data-bordered":
|
|
964
|
-
children: /* @__PURE__ */
|
|
984
|
+
className: `overflow-hidden rounded-lg ${u ? "table-bordered-container" : "table-container-border"}`,
|
|
985
|
+
"data-bordered": u ? "true" : "false",
|
|
986
|
+
children: /* @__PURE__ */ n(
|
|
965
987
|
"div",
|
|
966
988
|
{
|
|
967
989
|
className: "overflow-x-auto",
|
|
968
990
|
style: {
|
|
969
|
-
...
|
|
991
|
+
...M ? { maxHeight: M } : {}
|
|
970
992
|
},
|
|
971
|
-
children: /* @__PURE__ */
|
|
993
|
+
children: /* @__PURE__ */ S(
|
|
972
994
|
"table",
|
|
973
995
|
{
|
|
974
|
-
className: `w-full ${
|
|
996
|
+
className: `w-full ${te === "fixed" || e.some((t) => t.width) ? "table-fixed" : "table-auto"} ${u ? "border-separate table-bordered" : "border-collapse"} rounded-lg overflow-hidden`,
|
|
975
997
|
style: { borderSpacing: "0" },
|
|
976
998
|
children: [
|
|
977
|
-
|
|
978
|
-
/* @__PURE__ */
|
|
999
|
+
D && /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ n("tr", { children: e.map((t) => Rt(t)) }) }),
|
|
1000
|
+
/* @__PURE__ */ n("tbody", { children: a ? Array.from({ length: 5 }).map((t, i) => /* @__PURE__ */ n(
|
|
979
1001
|
"tr",
|
|
980
1002
|
{
|
|
981
|
-
className: `table-row ${
|
|
982
|
-
children: e.map((
|
|
1003
|
+
className: `table-row ${u ? "table-row-bordered" : ""}`,
|
|
1004
|
+
children: e.map((p) => /* @__PURE__ */ n(
|
|
983
1005
|
"td",
|
|
984
1006
|
{
|
|
985
|
-
className: `table-cell px-4 ${
|
|
986
|
-
style: { width:
|
|
987
|
-
children: /* @__PURE__ */
|
|
1007
|
+
className: `table-cell px-4 ${re} text-left ${se(I)}`,
|
|
1008
|
+
style: { width: p.width },
|
|
1009
|
+
children: /* @__PURE__ */ n("div", { className: "h-4 bg-gray-200 rounded animate-pulse" })
|
|
988
1010
|
},
|
|
989
|
-
|
|
1011
|
+
p.key
|
|
990
1012
|
))
|
|
991
1013
|
},
|
|
992
1014
|
i
|
|
993
|
-
)) :
|
|
1015
|
+
)) : z.length === 0 ? /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n(
|
|
994
1016
|
"td",
|
|
995
1017
|
{
|
|
996
1018
|
colSpan: e.length + (W ? 1 : 0),
|
|
997
1019
|
className: "px-4 py-12 text-center",
|
|
998
|
-
children: /* @__PURE__ */
|
|
999
|
-
/* @__PURE__ */
|
|
1000
|
-
|
|
1020
|
+
children: /* @__PURE__ */ S("div", { className: "flex flex-col items-center justify-center", children: [
|
|
1021
|
+
/* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium", children: k }),
|
|
1022
|
+
v && /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[13px] mt-1", children: v })
|
|
1001
1023
|
] })
|
|
1002
1024
|
}
|
|
1003
|
-
) }) :
|
|
1004
|
-
const
|
|
1005
|
-
var
|
|
1006
|
-
|
|
1025
|
+
) }) : z.map((t, i) => {
|
|
1026
|
+
const p = ze(t, i), s = (U == null ? void 0 : U(t, i)) || {}, x = j == null ? void 0 : j(t, i), g = i === 0, m = i === r.length - 1, w = i === L, o = x ? `var(--malachite-table-row-variant-${x}-background)` : void 0, d = E || s.onClick ? () => {
|
|
1027
|
+
var l;
|
|
1028
|
+
E == null || E(t, i), (l = s.onClick) == null || l.call(s, t, i);
|
|
1007
1029
|
} : void 0;
|
|
1008
1030
|
return (
|
|
1009
1031
|
// Keeps `row` semantics: `role="button"` would strip the table
|
|
1010
1032
|
// structure from screen readers.
|
|
1011
|
-
/* @__PURE__ */
|
|
1033
|
+
/* @__PURE__ */ n(
|
|
1012
1034
|
"tr",
|
|
1013
1035
|
{
|
|
1014
|
-
"data-table-id":
|
|
1036
|
+
"data-table-id": Q,
|
|
1015
1037
|
"data-row-index": i,
|
|
1016
|
-
"aria-current":
|
|
1017
|
-
tabIndex: d ? i ===
|
|
1018
|
-
onKeyDown: d ?
|
|
1038
|
+
"aria-current": w ? "true" : void 0,
|
|
1039
|
+
tabIndex: d ? i === K ? 0 : -1 : void 0,
|
|
1040
|
+
onKeyDown: d ? et(i, d) : void 0,
|
|
1019
1041
|
className: `
|
|
1020
|
-
${
|
|
1021
|
-
${(
|
|
1022
|
-
${d ? `cursor-pointer ${
|
|
1042
|
+
${u ? "table-row-bordered" : `table-row ${w ? "" : "hover:opacity-80"}`}
|
|
1043
|
+
${(G == null ? void 0 : G(t, i)) || ""}
|
|
1044
|
+
${d ? `cursor-pointer ${nt}` : ""}
|
|
1023
1045
|
`,
|
|
1024
|
-
onClick: d ? (
|
|
1025
|
-
|
|
1046
|
+
onClick: d ? (l) => {
|
|
1047
|
+
rt(l) || d();
|
|
1026
1048
|
} : void 0,
|
|
1027
|
-
onDoubleClick:
|
|
1028
|
-
var
|
|
1029
|
-
return (
|
|
1049
|
+
onDoubleClick: s.onDoubleClick ? () => {
|
|
1050
|
+
var l;
|
|
1051
|
+
return (l = s.onDoubleClick) == null ? void 0 : l.call(s, t, i);
|
|
1030
1052
|
} : void 0,
|
|
1031
|
-
onContextMenu:
|
|
1032
|
-
var
|
|
1033
|
-
return (
|
|
1053
|
+
onContextMenu: s.onContextMenu ? () => {
|
|
1054
|
+
var l;
|
|
1055
|
+
return (l = s.onContextMenu) == null ? void 0 : l.call(s, t, i);
|
|
1034
1056
|
} : void 0,
|
|
1035
|
-
onMouseEnter:
|
|
1036
|
-
var
|
|
1037
|
-
return (
|
|
1057
|
+
onMouseEnter: s.onMouseEnter ? () => {
|
|
1058
|
+
var l;
|
|
1059
|
+
return (l = s.onMouseEnter) == null ? void 0 : l.call(s, t, i);
|
|
1038
1060
|
} : void 0,
|
|
1039
|
-
onMouseLeave:
|
|
1040
|
-
var
|
|
1041
|
-
return (
|
|
1061
|
+
onMouseLeave: s.onMouseLeave ? () => {
|
|
1062
|
+
var l;
|
|
1063
|
+
return (l = s.onMouseLeave) == null ? void 0 : l.call(s, t, i);
|
|
1042
1064
|
} : void 0,
|
|
1043
|
-
children: e.map((
|
|
1044
|
-
const
|
|
1045
|
-
return /* @__PURE__ */
|
|
1046
|
-
|
|
1065
|
+
children: e.map((l) => {
|
|
1066
|
+
const $ = l === e[0], b = l === e[e.length - 1];
|
|
1067
|
+
return /* @__PURE__ */ n(
|
|
1068
|
+
cn,
|
|
1047
1069
|
{
|
|
1048
|
-
column:
|
|
1070
|
+
column: l,
|
|
1049
1071
|
record: t,
|
|
1050
1072
|
index: i,
|
|
1051
|
-
size:
|
|
1052
|
-
paddingYClass:
|
|
1053
|
-
bordered:
|
|
1054
|
-
isFirstRow:
|
|
1055
|
-
isLastRow:
|
|
1056
|
-
isFirstColumn:
|
|
1057
|
-
isLastColumn:
|
|
1058
|
-
variantBackground:
|
|
1059
|
-
isSelected:
|
|
1060
|
-
showSelectedAccent:
|
|
1073
|
+
size: I,
|
|
1074
|
+
paddingYClass: re,
|
|
1075
|
+
bordered: u,
|
|
1076
|
+
isFirstRow: g,
|
|
1077
|
+
isLastRow: m,
|
|
1078
|
+
isFirstColumn: $,
|
|
1079
|
+
isLastColumn: b,
|
|
1080
|
+
variantBackground: o,
|
|
1081
|
+
isSelected: w,
|
|
1082
|
+
showSelectedAccent: w && $
|
|
1061
1083
|
},
|
|
1062
|
-
|
|
1084
|
+
l.key
|
|
1063
1085
|
);
|
|
1064
1086
|
})
|
|
1065
1087
|
},
|
|
1066
|
-
|
|
1088
|
+
p
|
|
1067
1089
|
)
|
|
1068
1090
|
);
|
|
1069
1091
|
}) })
|
|
@@ -1074,18 +1096,18 @@ const ft = 160, Bt = (e, n) => e.length === n.length && e.every((s, c) => s ===
|
|
|
1074
1096
|
)
|
|
1075
1097
|
}
|
|
1076
1098
|
),
|
|
1077
|
-
|
|
1078
|
-
|
|
1099
|
+
f && !a && /* @__PURE__ */ n(
|
|
1100
|
+
it,
|
|
1079
1101
|
{
|
|
1080
|
-
current:
|
|
1081
|
-
pageSize:
|
|
1082
|
-
total:
|
|
1083
|
-
showSizeChanger:
|
|
1084
|
-
showQuickJumper:
|
|
1085
|
-
showTotal:
|
|
1086
|
-
pageSizeOptions:
|
|
1087
|
-
onChange:
|
|
1088
|
-
onShowSizeChange:
|
|
1102
|
+
current: f.current ?? 1,
|
|
1103
|
+
pageSize: f.pageSize ?? 10,
|
|
1104
|
+
total: f.total ?? 0,
|
|
1105
|
+
showSizeChanger: f.showSizeChanger,
|
|
1106
|
+
showQuickJumper: f.showQuickJumper,
|
|
1107
|
+
showTotal: f.showTotal,
|
|
1108
|
+
pageSizeOptions: f.pageSizeOptions,
|
|
1109
|
+
onChange: f.onChange,
|
|
1110
|
+
onShowSizeChange: f.onShowSizeChange
|
|
1089
1111
|
}
|
|
1090
1112
|
)
|
|
1091
1113
|
]
|
|
@@ -1093,6 +1115,6 @@ const ft = 160, Bt = (e, n) => e.length === n.length && e.every((s, c) => s ===
|
|
|
1093
1115
|
);
|
|
1094
1116
|
};
|
|
1095
1117
|
export {
|
|
1096
|
-
|
|
1118
|
+
Cn as default
|
|
1097
1119
|
};
|
|
1098
1120
|
//# sourceMappingURL=Table.js.map
|