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