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