@stackone/malachite 2.88.1 → 2.88.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Table/Table.js +211 -203
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/theme.js +46 -45
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { jsx as n, jsxs as y } from "react/jsx-runtime";
|
|
2
|
-
import { useVirtualizer as
|
|
3
|
-
import Se, { useState as V, useRef as
|
|
4
|
-
import
|
|
2
|
+
import { useVirtualizer as Ht } from "@tanstack/react-virtual";
|
|
3
|
+
import Se, { useState as V, useRef as H, useCallback as Be, useId as Ut, useEffect as te, useMemo as dt, useLayoutEffect as xt } from "react";
|
|
4
|
+
import mt from "../CustomIcons/CaretDownIcon.js";
|
|
5
5
|
import Pt from "../CustomIcons/CaretUpIcon.js";
|
|
6
6
|
import jt from "../CustomIcons/InfoIcon.js";
|
|
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
|
-
const
|
|
7
|
+
import Gt from "../CustomIcons/WarningTriangleIcon.js";
|
|
8
|
+
import Yt from "../FrameHeader.js";
|
|
9
|
+
import Jt from "../PinnedCornerCap.js";
|
|
10
|
+
import qt from "../Tooltip.js";
|
|
11
|
+
import Qt from "../TruncatedTooltip.js";
|
|
12
|
+
import { devWarning as Vt } from "../devWarning.js";
|
|
13
|
+
import { FOCUS_RING_INSET as ct, FOCUS_RING_INSET_OVERLAY as Zt } from "../focusRing.js";
|
|
14
|
+
import { FRAME_CLASS as Xt, FRAME_PADDING as se, FRAME_SECTION_RADIUS as oe, FRAME_SECTION_BORDER as Kt, FRAME_RADIUS as er } from "../frameStyles.js";
|
|
15
|
+
import { hasHeaderContent as ft } from "../headerContent.js";
|
|
16
|
+
import { isFromInteractiveDescendant as ht, activateOnEnterOrSpace as tr } from "../keyboardActivation.js";
|
|
17
|
+
import { FOREGROUND_RESET as He, SELECTED_ROW_ACCENT as yt, SELECTED_TEXT_CONTEXT as St, SELECTED_ROW_FOREGROUND as kt, SELECTED_ROW_BACKGROUND as je } from "../selectedRow.js";
|
|
18
|
+
import ut from "./TablePagination.js";
|
|
19
|
+
const wt = 160, rr = (e, r) => e.length === r.length && e.every((l, c) => l === r[c]), pt = "\0", nr = (e, r, l) => {
|
|
20
20
|
if (typeof e != "object" || e === null)
|
|
21
|
-
return `${
|
|
21
|
+
return `${pt}i${l}`;
|
|
22
22
|
const c = r.ids.get(e);
|
|
23
23
|
if (c !== void 0)
|
|
24
24
|
return c;
|
|
25
|
-
const C = `${
|
|
25
|
+
const C = `${pt}${r.next++}`;
|
|
26
26
|
return r.ids.set(e, C), C;
|
|
27
|
-
},
|
|
27
|
+
}, ir = (e, r, l) => typeof r == "function" ? e.map((c) => r(c)) : e.map((c, C) => {
|
|
28
28
|
const u = c[r];
|
|
29
|
-
return u == null ?
|
|
29
|
+
return u == null ? nr(c, l, C) : String(u);
|
|
30
30
|
}), we = (e) => {
|
|
31
31
|
if (typeof e == "number")
|
|
32
32
|
return e;
|
|
@@ -38,11 +38,11 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
38
38
|
}, Je = (e) => {
|
|
39
39
|
const r = we(e.width);
|
|
40
40
|
return !(e.title === "" || e.title == null) && r !== void 0 && typeof e.minWidth == "number" && e.minWidth < r ? e.minWidth : void 0;
|
|
41
|
-
},
|
|
41
|
+
}, ar = (e) => e.reduce((r, l) => {
|
|
42
42
|
const c = Je(l) ?? we(l.width);
|
|
43
|
-
return c !== void 0 ? r + c : typeof l.minWidth == "number" ? r + l.minWidth : r +
|
|
44
|
-
}, 0),
|
|
45
|
-
const r = [...e].reverse().findIndex((u) => !
|
|
43
|
+
return c !== void 0 ? r + c : typeof l.minWidth == "number" ? r + l.minWidth : r + wt;
|
|
44
|
+
}, 0), lr = (e) => (e.title === "" || e.title == null) && we(e.width) !== void 0, sr = (e) => {
|
|
45
|
+
const r = [...e].reverse().findIndex((u) => !lr(u)), l = r === -1 ? 0 : e.length - r, c = /* @__PURE__ */ new Map(), C = e.reduceRight(
|
|
46
46
|
(u, S, x) => {
|
|
47
47
|
const p = Je(S) ?? we(S.width);
|
|
48
48
|
return !(S.fixed === "right" || x >= l) || p === void 0 ? u : (c.set(S.key, u.right), { right: u.right + p, edge: S.key });
|
|
@@ -50,50 +50,53 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
50
50
|
{ right: 0, edge: void 0 }
|
|
51
51
|
);
|
|
52
52
|
return { offsets: c, edgeKey: C.edge, extent: C.right };
|
|
53
|
-
},
|
|
53
|
+
}, or = { overflowX: "auto", scrollbarWidth: "none" }, dr = {
|
|
54
54
|
position: "sticky",
|
|
55
55
|
left: 0,
|
|
56
56
|
width: "100%"
|
|
57
|
-
},
|
|
57
|
+
}, cr = { offsets: /* @__PURE__ */ new Map(), edgeKey: void 0, extent: 0 }, Ue = (e) => `color-mix(in srgb, var(--malachite-card-shadow, rgba(0, 0, 0, 0.1)) ${e}%, transparent)`, fr = {
|
|
58
58
|
position: "absolute",
|
|
59
59
|
top: 0,
|
|
60
60
|
bottom: 0,
|
|
61
61
|
right: 0,
|
|
62
62
|
width: 24,
|
|
63
63
|
pointerEvents: "none",
|
|
64
|
-
backgroundImage: `linear-gradient(to left, ${
|
|
65
|
-
},
|
|
64
|
+
backgroundImage: `linear-gradient(to left, ${Ue(45)}, ${Ue(18)} 30%, ${Ue(5)} 65%, transparent)`
|
|
65
|
+
}, hr = (e, r) => e === void 0 ? {} : {
|
|
66
66
|
position: "sticky",
|
|
67
67
|
right: e,
|
|
68
68
|
zIndex: 1,
|
|
69
69
|
height: "auto",
|
|
70
70
|
...r === "row" ? { backgroundColor: "inherit", backgroundImage: "inherit" } : { backgroundColor: r }
|
|
71
|
-
},
|
|
71
|
+
}, gt = (e) => `linear-gradient(${e}, ${e})`, ur = (e, r) => {
|
|
72
72
|
if (!e && !r)
|
|
73
73
|
return {};
|
|
74
74
|
const l = [
|
|
75
|
-
r ?
|
|
76
|
-
e ?
|
|
75
|
+
r ? gt(je) : void 0,
|
|
76
|
+
e ? gt(`var(--malachite-table-row-variant-${e}-background)`) : void 0
|
|
77
77
|
].filter(qe);
|
|
78
78
|
return {
|
|
79
79
|
backgroundColor: e ? "var(--malachite-table-background, #f7f7f7)" : "var(--malachite-table-row-background, #fff)",
|
|
80
80
|
backgroundImage: l.join(", ")
|
|
81
81
|
};
|
|
82
|
-
}, qe = (e) => typeof e == "string",
|
|
82
|
+
}, qe = (e) => typeof e == "string", pr = {
|
|
83
|
+
default: 40,
|
|
84
|
+
compact: 30
|
|
85
|
+
}, Ge = "text-[var(--malachite-text-primary,#0a0a0a)]", Ye = "text-[var(--malachite-text-dimmed,#a1a1a1)]", de = (e) => ({
|
|
83
86
|
small: "text-[length:var(--malachite-font-size-small)]",
|
|
84
87
|
medium: "text-[length:var(--malachite-font-size-medium)]",
|
|
85
88
|
large: "text-[length:var(--malachite-font-size-large)]"
|
|
86
|
-
})[e],
|
|
89
|
+
})[e], vt = {
|
|
87
90
|
borderBottom: "1px solid var(--malachite-card-border, #e8e8e8)"
|
|
88
|
-
},
|
|
91
|
+
}, bt = (e, r) => {
|
|
89
92
|
e && r && r.scrollLeft !== e.scrollLeft && (r.scrollLeft = e.scrollLeft);
|
|
90
|
-
},
|
|
91
|
-
|
|
93
|
+
}, gr = 56, vr = 44, br = 8, xr = 10, mr = "--malachite-ctx-table-surround", Pe = "var(--malachite-table-header-background, #f7f7f7)", yr = () => /* @__PURE__ */ n(
|
|
94
|
+
Jt,
|
|
92
95
|
{
|
|
93
|
-
radius:
|
|
94
|
-
surround: `var(${
|
|
96
|
+
radius: er,
|
|
97
|
+
surround: `var(${mr}, var(--malachite-card-background, #ffffff))`
|
|
95
98
|
}
|
|
96
|
-
),
|
|
99
|
+
), Sr = ({
|
|
97
100
|
records: e,
|
|
98
101
|
startIndex: r,
|
|
99
102
|
scrollElement: l,
|
|
@@ -104,23 +107,23 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
104
107
|
cardKey: x,
|
|
105
108
|
rovingIndex: p
|
|
106
109
|
}) => {
|
|
107
|
-
const D =
|
|
108
|
-
|
|
110
|
+
const D = H(null), [M, W] = V(0);
|
|
111
|
+
xt(() => {
|
|
109
112
|
const _ = D.current;
|
|
110
113
|
if (!_ || !l)
|
|
111
114
|
return;
|
|
112
|
-
const
|
|
115
|
+
const U = () => {
|
|
113
116
|
const R = _.getBoundingClientRect().top - l.getBoundingClientRect().top + l.scrollTop;
|
|
114
117
|
W((Y) => Math.abs(Y - R) < 1 ? Y : R);
|
|
115
118
|
};
|
|
116
|
-
if (
|
|
119
|
+
if (U(), typeof ResizeObserver > "u")
|
|
117
120
|
return;
|
|
118
|
-
const
|
|
121
|
+
const P = new ResizeObserver(U);
|
|
119
122
|
let T = _;
|
|
120
123
|
for (; T && T !== l; ) {
|
|
121
124
|
let R = T.previousElementSibling;
|
|
122
125
|
for (; R; )
|
|
123
|
-
|
|
126
|
+
P.observe(R), R = R.previousElementSibling;
|
|
124
127
|
const Y = T.parentElement;
|
|
125
128
|
if (Y)
|
|
126
129
|
T = Y;
|
|
@@ -129,15 +132,15 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
129
132
|
T = ie instanceof ShadowRoot ? ie.host : null;
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
|
-
return () =>
|
|
135
|
+
return () => P.disconnect();
|
|
133
136
|
}, [l, e.length, r]);
|
|
134
|
-
const E =
|
|
137
|
+
const E = Ht({
|
|
135
138
|
count: e.length,
|
|
136
139
|
// State, not a ref: an ancestor's ref is not attached when this child's layout effects
|
|
137
140
|
// run, so a ref would leave the virtualizer without a scroll element.
|
|
138
141
|
getScrollElement: () => l,
|
|
139
142
|
estimateSize: () => c,
|
|
140
|
-
overscan:
|
|
143
|
+
overscan: br,
|
|
141
144
|
scrollMargin: M
|
|
142
145
|
});
|
|
143
146
|
te(() => {
|
|
@@ -148,13 +151,13 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
148
151
|
scrollToIndex: (_) => E.scrollToIndex(_, { align: "center" })
|
|
149
152
|
}), () => S(x, null);
|
|
150
153
|
}, [S, x, r, e.length, E]);
|
|
151
|
-
const
|
|
152
|
-
Math.max(p, r +
|
|
153
|
-
r +
|
|
154
|
-
) : p, X =
|
|
154
|
+
const k = E.getVirtualItems(), re = E.getTotalSize(), ne = p >= r && p < r + e.length && k.length > 0 ? Math.min(
|
|
155
|
+
Math.max(p, r + k[0].index),
|
|
156
|
+
r + k[k.length - 1].index
|
|
157
|
+
) : p, X = k.length > 0 ? k[0].start - M : 0, K = k.length > 0 ? re - (k[k.length - 1].end - M) : 0;
|
|
155
158
|
return /* @__PURE__ */ y("div", { ref: D, className: "flex flex-col w-full", style: C, children: [
|
|
156
159
|
X > 0 && /* @__PURE__ */ n("div", { "aria-hidden": "true", style: { height: X, flexShrink: 0 } }),
|
|
157
|
-
|
|
160
|
+
k.map(
|
|
158
161
|
(_) => u(
|
|
159
162
|
e[_.index],
|
|
160
163
|
r + _.index,
|
|
@@ -166,8 +169,8 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
166
169
|
),
|
|
167
170
|
K > 0 && /* @__PURE__ */ n("div", { "aria-hidden": "true", style: { height: K, flexShrink: 0 } })
|
|
168
171
|
] });
|
|
169
|
-
},
|
|
170
|
-
const l = r ?
|
|
172
|
+
}, kr = (e, r) => {
|
|
173
|
+
const l = r ? gr : 0;
|
|
171
174
|
return typeof e == "number" ? `${Math.max(0, e - l)}px` : `calc(${e} - ${l}px)`;
|
|
172
175
|
}, ce = (e) => {
|
|
173
176
|
const r = e.width;
|
|
@@ -181,14 +184,14 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
181
184
|
return {};
|
|
182
185
|
const l = typeof r == "number" ? `${r}px` : r;
|
|
183
186
|
return { width: l, flexBasis: l };
|
|
184
|
-
},
|
|
187
|
+
}, wr = (e) => e === "asc" ? "ascending" : e === "desc" ? "descending" : "none", Z = (e) => e === "center" ? "justify-center" : e === "right" ? "justify-end" : "justify-start", $r = (e) => e === "center" ? "justify-center" : e === "right" ? "justify-end" : "justify-between", fe = (e) => e === "center" ? "text-center" : e === "right" ? "text-right" : "text-left", $t = (e) => e ? Z(e) : "justify-end", ke = ({ info: e }) => /* @__PURE__ */ n(qt, { text: e, placement: "top", children: /* @__PURE__ */ n(jt, { size: 13, className: "shrink-0 text-[var(--malachite-text-secondary,#bbb)]" }) }), Nr = { ascend: "asc", descend: "desc" }, Cr = (e) => {
|
|
185
188
|
const r = e.find((l) => l.sorter && l.defaultSortOrder);
|
|
186
|
-
return r != null && r.defaultSortOrder ? { key: r.key, direction:
|
|
187
|
-
},
|
|
189
|
+
return r != null && r.defaultSortOrder ? { key: r.key, direction: Nr[r.defaultSortOrder] } : null;
|
|
190
|
+
}, Nt = (e, r) => ({
|
|
188
191
|
type: "button",
|
|
189
192
|
onClick: r,
|
|
190
193
|
"aria-label": typeof e == "string" ? `Sort by ${e}` : "Sort column"
|
|
191
|
-
}),
|
|
194
|
+
}), Er = ({
|
|
192
195
|
column: e,
|
|
193
196
|
record: r,
|
|
194
197
|
index: l,
|
|
@@ -203,7 +206,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
203
206
|
showSelectedAccent: W,
|
|
204
207
|
isSelected: E
|
|
205
208
|
}) => {
|
|
206
|
-
const
|
|
209
|
+
const k = r[e.dataIndex], re = e.render ? e.render(k, r, l) : k == null ? "" : String(k), G = e.ellipsis && qe(k) ? k : void 0;
|
|
207
210
|
return /* @__PURE__ */ n(
|
|
208
211
|
"td",
|
|
209
212
|
{
|
|
@@ -226,19 +229,19 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
226
229
|
// base — they differ in dark mode.
|
|
227
230
|
(E ? u ? "var(--malachite-table-borderedRow-background, #fff)" : "var(--malachite-table-row-background, #fff)" : void 0),
|
|
228
231
|
// Its own layer, so the tint composites over the cell instead of replacing it.
|
|
229
|
-
backgroundImage: E ? `linear-gradient(${
|
|
232
|
+
backgroundImage: E ? `linear-gradient(${je}, ${je})` : void 0,
|
|
230
233
|
// Content pinning its own colour follows via the channel below.
|
|
231
|
-
color: E ?
|
|
232
|
-
...E ?
|
|
234
|
+
color: E ? kt : "var(--malachite-table-row-foreground)",
|
|
235
|
+
...E ? St : {},
|
|
233
236
|
// Inset box-shadow, not `ring-*`: --tw-ring-* silently doesn't paint in a shadow root.
|
|
234
|
-
boxShadow: W ? `inset 2px 0 0 ${
|
|
237
|
+
boxShadow: W ? `inset 2px 0 0 ${yt}` : void 0,
|
|
235
238
|
borderBottom: u ? void 0 : x ? "none" : "1px solid var(--malachite-table-row-border)"
|
|
236
239
|
},
|
|
237
240
|
title: G,
|
|
238
241
|
children: re
|
|
239
242
|
}
|
|
240
243
|
);
|
|
241
|
-
},
|
|
244
|
+
}, Rr = ({
|
|
242
245
|
column: e,
|
|
243
246
|
sortDirection: r,
|
|
244
247
|
onSort: l,
|
|
@@ -268,7 +271,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
268
271
|
}
|
|
269
272
|
);
|
|
270
273
|
const x = typeof e.title == "string" ? /* @__PURE__ */ n("p", { className: "font-medium text-[13px] text-[var(--malachite-text-primary,#0a0a0a)] tracking-[0.13px] whitespace-nowrap truncate", children: e.title }) : e.title, p = /* @__PURE__ */ n(
|
|
271
|
-
|
|
274
|
+
mt,
|
|
272
275
|
{
|
|
273
276
|
size: 13,
|
|
274
277
|
className: `shrink-0 transition-transform ${r ? Ge : Ye} ${r === "asc" ? "rotate-180" : ""}`
|
|
@@ -282,8 +285,8 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
282
285
|
children: /* @__PURE__ */ y(
|
|
283
286
|
"button",
|
|
284
287
|
{
|
|
285
|
-
|
|
286
|
-
className: `flex flex-1 items-center ${
|
|
288
|
+
...Nt(e.title, l),
|
|
289
|
+
className: `flex flex-1 items-center ${$r(e.align)} gap-1 min-w-0 px-4 py-3 cursor-pointer appearance-none bg-transparent border-0 ${fe(e.align)}`,
|
|
287
290
|
children: [
|
|
288
291
|
/* @__PURE__ */ y("div", { className: "flex items-center gap-1 min-w-0", children: [
|
|
289
292
|
x,
|
|
@@ -308,7 +311,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
308
311
|
] })
|
|
309
312
|
}
|
|
310
313
|
);
|
|
311
|
-
},
|
|
314
|
+
}, _r = ({
|
|
312
315
|
column: e,
|
|
313
316
|
record: r,
|
|
314
317
|
index: l,
|
|
@@ -318,14 +321,14 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
318
321
|
cellStyle: S
|
|
319
322
|
}) => {
|
|
320
323
|
const x = r[e.dataIndex], p = e.render ? e.render(x, r, l) : x == null ? "" : String(x), M = (e.title === "" || e.title == null) && e.width !== void 0, W = qe(x) && x.length > 0, E = u ? {
|
|
321
|
-
color:
|
|
322
|
-
...
|
|
324
|
+
color: kt,
|
|
325
|
+
...St
|
|
323
326
|
} : {};
|
|
324
327
|
if (M)
|
|
325
328
|
return /* @__PURE__ */ n(
|
|
326
329
|
"div",
|
|
327
330
|
{
|
|
328
|
-
className: `flex items-center ${
|
|
331
|
+
className: `flex items-center ${$t(e.align)} shrink-0 overflow-hidden px-4 ${C}`,
|
|
329
332
|
style: {
|
|
330
333
|
...Qe(e),
|
|
331
334
|
...E,
|
|
@@ -334,7 +337,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
334
337
|
children: p
|
|
335
338
|
}
|
|
336
339
|
);
|
|
337
|
-
const
|
|
340
|
+
const k = !e.render && W ? /* @__PURE__ */ n(Qt, { text: x, children: p }) : p;
|
|
338
341
|
return /* @__PURE__ */ n(
|
|
339
342
|
"div",
|
|
340
343
|
{
|
|
@@ -344,10 +347,10 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
344
347
|
...E,
|
|
345
348
|
...S
|
|
346
349
|
},
|
|
347
|
-
children:
|
|
350
|
+
children: k
|
|
348
351
|
}
|
|
349
352
|
);
|
|
350
|
-
},
|
|
353
|
+
}, qr = ({
|
|
351
354
|
columns: e,
|
|
352
355
|
data: r,
|
|
353
356
|
loading: l = !1,
|
|
@@ -361,15 +364,15 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
361
364
|
rowKey: M = "key",
|
|
362
365
|
scrollHeight: W,
|
|
363
366
|
size: E = "small",
|
|
364
|
-
rowDensity:
|
|
367
|
+
rowDensity: k = "default",
|
|
365
368
|
layout: re = "auto",
|
|
366
369
|
headerVariant: G = "inline",
|
|
367
370
|
title: ne,
|
|
368
371
|
subtitle: X,
|
|
369
372
|
extra: K,
|
|
370
373
|
rowClassName: _,
|
|
371
|
-
rowVariant:
|
|
372
|
-
onRow:
|
|
374
|
+
rowVariant: U,
|
|
375
|
+
onRow: P,
|
|
373
376
|
onClickRow: T,
|
|
374
377
|
selectedRowKey: R,
|
|
375
378
|
scrollSelectedIntoView: Y = !0,
|
|
@@ -378,54 +381,54 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
378
381
|
className: Ve = "",
|
|
379
382
|
style: $e,
|
|
380
383
|
stickyHeaderTop: Ne,
|
|
381
|
-
scrollX:
|
|
384
|
+
scrollX: j = !1,
|
|
382
385
|
rowSection: Ce,
|
|
383
386
|
renderSectionDivider: Ee,
|
|
384
387
|
onVisibleOrderChange: Re,
|
|
385
|
-
virtual:
|
|
386
|
-
virtualRowHeightEstimate:
|
|
388
|
+
virtual: Ct = !1,
|
|
389
|
+
virtualRowHeightEstimate: Et,
|
|
387
390
|
virtualScrollElement: he = null
|
|
388
391
|
}) => {
|
|
389
|
-
const ae =
|
|
392
|
+
const ae = k === "compact" ? "py-1" : "py-3", Ze = pr[k], [O, Rt] = V(() => Cr(e)), Xe = H(null), _e = H(null), le = H(null), Ie = H(null), Oe = H(/* @__PURE__ */ new Map()), _t = Be(
|
|
390
393
|
(t, i) => {
|
|
391
394
|
i ? Oe.current.set(t, i) : Oe.current.delete(t);
|
|
392
395
|
},
|
|
393
396
|
[]
|
|
394
|
-
), q = Ut(), [
|
|
395
|
-
le.current = t, t &&
|
|
396
|
-
}, []), De = J ? he ?? ue : null,
|
|
397
|
+
), q = Ut(), [It, Te] = V(0), J = Ct && G === "detached", Ot = Et ?? vr, [ue, Tt] = V(null), Dt = Be((t) => {
|
|
398
|
+
le.current = t, t && Tt((i) => i === t ? i : t);
|
|
399
|
+
}, []), De = J ? he ?? ue : null, Ke = j ? ar(e) : 0, pe = j && G === "detached" ? sr(e) : cr, ge = pe.edgeKey !== void 0, [Mt, et] = V(!1), [zt, tt] = V(0), ve = Be(() => {
|
|
397
400
|
const t = le.current;
|
|
398
|
-
|
|
401
|
+
et(
|
|
399
402
|
t !== null && t.scrollLeft + t.clientWidth < t.scrollWidth - 1
|
|
400
|
-
),
|
|
403
|
+
), tt(t === null ? 0 : t.offsetWidth - t.clientWidth);
|
|
401
404
|
}, []);
|
|
402
405
|
te(() => {
|
|
403
406
|
if (!ge || !ue) {
|
|
404
|
-
|
|
407
|
+
et(!1), tt(0);
|
|
405
408
|
return;
|
|
406
409
|
}
|
|
407
410
|
if (ve(), typeof ResizeObserver > "u")
|
|
408
411
|
return;
|
|
409
412
|
const t = new ResizeObserver(ve);
|
|
410
413
|
return t.observe(ue), () => t.disconnect();
|
|
411
|
-
}, [ge, ue,
|
|
412
|
-
const Me = !(J && he), A = G === "detached" && Ne !== void 0 && D && !W && (!J || !Me),
|
|
414
|
+
}, [ge, ue, Ke, ve]);
|
|
415
|
+
const Me = !(J && he), A = G === "detached" && Ne !== void 0 && D && !W && (!J || !Me), rt = R != null, [ze, nt] = V(0);
|
|
413
416
|
te(() => {
|
|
414
|
-
const t =
|
|
415
|
-
if (!t || !A || !
|
|
416
|
-
|
|
417
|
+
const t = Xe.current;
|
|
418
|
+
if (!t || !A || !rt || typeof ResizeObserver > "u") {
|
|
419
|
+
nt(0);
|
|
417
420
|
return;
|
|
418
421
|
}
|
|
419
422
|
const i = new ResizeObserver((f) => {
|
|
420
423
|
var h, v;
|
|
421
424
|
const s = f[0], g = ((v = (h = s == null ? void 0 : s.borderBoxSize) == null ? void 0 : h[0]) == null ? void 0 : v.blockSize) ?? (s == null ? void 0 : s.contentRect.height) ?? 0;
|
|
422
|
-
|
|
423
|
-
(
|
|
425
|
+
nt(
|
|
426
|
+
(w) => Math.abs(w - g) < 1 ? w : g
|
|
424
427
|
);
|
|
425
428
|
});
|
|
426
429
|
return i.observe(t), () => i.disconnect();
|
|
427
|
-
}, [A,
|
|
428
|
-
const
|
|
430
|
+
}, [A, rt]);
|
|
431
|
+
const Lt = A ? (Ne ?? 0) + ze : void 0, { sortedData: z, sectionDividers: Le } = dt(() => {
|
|
429
432
|
const t = (h) => {
|
|
430
433
|
if (!O) return h;
|
|
431
434
|
const v = e.find((F) => F.key === O.key);
|
|
@@ -434,9 +437,9 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
434
437
|
const F = [...h].sort(v.sorter);
|
|
435
438
|
return O.direction === "asc" ? F : F.reverse();
|
|
436
439
|
}
|
|
437
|
-
const
|
|
440
|
+
const w = v.dataIndex ?? O.key;
|
|
438
441
|
return [...h].sort((F, o) => {
|
|
439
|
-
const a = F[
|
|
442
|
+
const a = F[w], d = o[w];
|
|
440
443
|
return a < d ? O.direction === "asc" ? -1 : 1 : a > d ? O.direction === "asc" ? 1 : -1 : 0;
|
|
441
444
|
});
|
|
442
445
|
};
|
|
@@ -448,8 +451,8 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
448
451
|
const i = [], f = /* @__PURE__ */ new Map();
|
|
449
452
|
for (const h of r) {
|
|
450
453
|
const v = Ce(h);
|
|
451
|
-
let
|
|
452
|
-
|
|
454
|
+
let w = f.get(v);
|
|
455
|
+
w === void 0 && (w = i.length, f.set(v, w), i.push({ key: v, records: [] })), i[w].records.push(h);
|
|
453
456
|
}
|
|
454
457
|
const s = [], g = /* @__PURE__ */ new Map();
|
|
455
458
|
for (const h of i) {
|
|
@@ -457,29 +460,29 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
457
460
|
g.set(s.length, { key: h.key, records: v }), s.push(...v);
|
|
458
461
|
}
|
|
459
462
|
return { sortedData: s, sectionDividers: g };
|
|
460
|
-
}, [r, O, e, Ce]),
|
|
461
|
-
|
|
462
|
-
},
|
|
463
|
+
}, [r, O, e, Ce]), Wt = (t) => {
|
|
464
|
+
Rt((i) => (i == null ? void 0 : i.key) === t ? i.direction === "asc" ? { key: t, direction: "desc" } : null : { key: t, direction: "asc" });
|
|
465
|
+
}, it = (t, i) => (f) => {
|
|
463
466
|
var s, g, h;
|
|
464
|
-
|
|
465
|
-
}, We = (t, i) => typeof M == "function" ? M(t) : String(t[M] ?? i),
|
|
467
|
+
Wt(t.key), (h = (g = (s = t.onHeaderCell) == null ? void 0 : s.call(t, t, i)) == null ? void 0 : g.onClick) == null || h.call(g, f);
|
|
468
|
+
}, We = (t, i) => typeof M == "function" ? M(t) : String(t[M] ?? i), at = typeof M == "function" ? null : M, lt = H(void 0), be = H(void 0);
|
|
466
469
|
te(() => {
|
|
467
470
|
if (!Re)
|
|
468
471
|
return;
|
|
469
472
|
be.current ?? (be.current = { ids: /* @__PURE__ */ new WeakMap(), next: 0 });
|
|
470
|
-
const t =
|
|
471
|
-
i &&
|
|
472
|
-
}, [z,
|
|
473
|
-
const ee = Math.min(
|
|
473
|
+
const t = ir(z, M, be.current), i = lt.current;
|
|
474
|
+
i && rr(i, t) || (lt.current = t, Re(z));
|
|
475
|
+
}, [z, at, Re]);
|
|
476
|
+
const ee = Math.min(It, Math.max(0, z.length - 1)), L = dt(() => {
|
|
474
477
|
if (R == null)
|
|
475
478
|
return -1;
|
|
476
479
|
const t = String(R);
|
|
477
480
|
return z.findIndex((i, f) => We(i, f) === t);
|
|
478
|
-
}, [R, z,
|
|
481
|
+
}, [R, z, at]);
|
|
479
482
|
te(() => {
|
|
480
483
|
L >= 0 && Te(L);
|
|
481
484
|
}, [L]);
|
|
482
|
-
const Fe =
|
|
485
|
+
const Fe = H(void 0);
|
|
483
486
|
te(() => {
|
|
484
487
|
if (R == null) {
|
|
485
488
|
Fe.current = void 0;
|
|
@@ -511,16 +514,16 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
511
514
|
if (!v)
|
|
512
515
|
return;
|
|
513
516
|
v.scrollToIndex(L - v.startIndex);
|
|
514
|
-
let
|
|
517
|
+
let w = 0, F = 0;
|
|
515
518
|
const o = () => {
|
|
516
519
|
const a = s(L);
|
|
517
520
|
if (a) {
|
|
518
521
|
g(a);
|
|
519
522
|
return;
|
|
520
523
|
}
|
|
521
|
-
++F <
|
|
524
|
+
++F < xr && (w = requestAnimationFrame(o));
|
|
522
525
|
};
|
|
523
|
-
return
|
|
526
|
+
return w = requestAnimationFrame(o), () => cancelAnimationFrame(w);
|
|
524
527
|
}, [
|
|
525
528
|
R,
|
|
526
529
|
L,
|
|
@@ -534,10 +537,10 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
534
537
|
q,
|
|
535
538
|
Y
|
|
536
539
|
]);
|
|
537
|
-
const Ae =
|
|
540
|
+
const Ae = H(null), st = (t, i) => {
|
|
538
541
|
Ae.current = t, Te(Math.min(Math.max(0, i), z.length - 1));
|
|
539
542
|
};
|
|
540
|
-
|
|
543
|
+
xt(() => {
|
|
541
544
|
const t = Ae.current;
|
|
542
545
|
if (!t)
|
|
543
546
|
return;
|
|
@@ -554,26 +557,26 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
554
557
|
), h = ee > 0 ? g[g.length - 1] : g[0];
|
|
555
558
|
h && (Te(Number(h.dataset.rowIndex)), h.focus());
|
|
556
559
|
}, [ee, q]);
|
|
557
|
-
const
|
|
560
|
+
const ot = (t, i) => (f) => {
|
|
558
561
|
const s = { ArrowDown: 1, ArrowUp: -1 }[f.key];
|
|
559
562
|
if (s !== void 0) {
|
|
560
|
-
f.preventDefault(),
|
|
563
|
+
f.preventDefault(), st(f.currentTarget, t + s);
|
|
561
564
|
return;
|
|
562
565
|
}
|
|
563
566
|
if (!J && (f.key === "Home" || f.key === "End")) {
|
|
564
|
-
f.preventDefault(),
|
|
567
|
+
f.preventDefault(), st(f.currentTarget, f.key === "Home" ? 0 : z.length - 1);
|
|
565
568
|
return;
|
|
566
569
|
}
|
|
567
|
-
i &&
|
|
570
|
+
i && tr(f, i, "enter");
|
|
568
571
|
};
|
|
569
|
-
if (G !== "detached" &&
|
|
572
|
+
if (G !== "detached" && ft({ title: ne, subtitle: X, extra: K }) && Vt(
|
|
570
573
|
"table-title-inline",
|
|
571
574
|
'Table `title`, `subtitle` and `extra` draw only on the detached header. Pass `headerVariant="detached"` or leave them out.'
|
|
572
575
|
), G === "detached") {
|
|
573
|
-
const t =
|
|
574
|
-
...
|
|
575
|
-
...
|
|
576
|
-
}), f = (o) => o.key === pe.edgeKey &&
|
|
576
|
+
const t = j ? { minWidth: Ke } : {}, i = (o, a) => ({
|
|
577
|
+
...j && o.width === void 0 ? { minWidth: o.minWidth ?? wt } : {},
|
|
578
|
+
...hr(pe.offsets.get(o.key), a)
|
|
579
|
+
}), f = (o) => o.key === pe.edgeKey && Mt ? /* @__PURE__ */ n(
|
|
577
580
|
"span",
|
|
578
581
|
{
|
|
579
582
|
"aria-hidden": "true",
|
|
@@ -583,19 +586,19 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
583
586
|
right: pe.extent,
|
|
584
587
|
zIndex: 1
|
|
585
588
|
},
|
|
586
|
-
children: /* @__PURE__ */ n("span", { style:
|
|
589
|
+
children: /* @__PURE__ */ n("span", { style: fr })
|
|
587
590
|
}
|
|
588
|
-
) : null, s =
|
|
589
|
-
border:
|
|
591
|
+
) : null, s = ft({ title: ne, subtitle: X, extra: K }) ? /* @__PURE__ */ n(Yt, { title: ne, subtitle: X, extra: K }) : null, g = A ? Pe : "var(--malachite-table-background, #f7f7f7)", h = {
|
|
592
|
+
border: Kt,
|
|
590
593
|
borderRadius: oe,
|
|
591
594
|
overflow: "clip",
|
|
592
595
|
flexShrink: 0,
|
|
593
596
|
...t
|
|
594
597
|
}, v = (o, a, d = !1, I = !1, N, B = ee) => {
|
|
595
|
-
const Q = We(o, a), m = (
|
|
596
|
-
var
|
|
597
|
-
T == null || T(o, a), (
|
|
598
|
-
} : void 0, ye = !!me,
|
|
598
|
+
const Q = We(o, a), m = (P == null ? void 0 : P(o, a)) || {}, At = U == null ? void 0 : U(o, a), xe = a === L, me = T || m.onClick ? () => {
|
|
599
|
+
var $;
|
|
600
|
+
T == null || T(o, a), ($ = m.onClick) == null || $.call(m, o, a);
|
|
601
|
+
} : void 0, ye = !!me, Bt = d ? {} : vt;
|
|
599
602
|
return /* @__PURE__ */ y(
|
|
600
603
|
"div",
|
|
601
604
|
{
|
|
@@ -605,16 +608,17 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
605
608
|
"data-row-index": a,
|
|
606
609
|
"aria-current": xe ? "true" : void 0,
|
|
607
610
|
tabIndex: ye ? a === B ? 0 : -1 : void 0,
|
|
608
|
-
onKeyDown: ye ?
|
|
611
|
+
onKeyDown: ye ? ot(a, me) : void 0,
|
|
609
612
|
className: `
|
|
610
|
-
group bg-[var(--malachite-table-row-background,#fff)] flex
|
|
611
|
-
${ye ? `cursor-pointer hover:bg-[var(--malachite-table-row-hover-background,#fafafa)] ${
|
|
613
|
+
group bg-[var(--malachite-table-row-background,#fff)] flex items-stretch relative w-full
|
|
614
|
+
${ye ? `cursor-pointer hover:bg-[var(--malachite-table-row-hover-background,#fafafa)] ${ct}` : ""}
|
|
612
615
|
${(_ == null ? void 0 : _(o, a)) || ""}
|
|
613
616
|
`,
|
|
614
617
|
style: {
|
|
615
|
-
...
|
|
618
|
+
...Bt,
|
|
616
619
|
...t,
|
|
617
|
-
|
|
620
|
+
minHeight: Ze,
|
|
621
|
+
scrollMarginTop: Lt,
|
|
618
622
|
// Echo the card's clip, or it cuts the accent bar's end into a stub.
|
|
619
623
|
...I ? {
|
|
620
624
|
borderTopLeftRadius: oe,
|
|
@@ -625,62 +629,66 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
625
629
|
borderBottomRightRadius: oe
|
|
626
630
|
} : {},
|
|
627
631
|
// Set unconditionally it would beat `hover:bg-*` on every row.
|
|
628
|
-
...
|
|
632
|
+
...ur(At, xe),
|
|
629
633
|
...xe ? {
|
|
630
634
|
// Inset box-shadow, not `ring-*` — see the classic cell.
|
|
631
|
-
boxShadow: `inset 2px 0 0 ${
|
|
635
|
+
boxShadow: `inset 2px 0 0 ${yt}`
|
|
632
636
|
} : {}
|
|
633
637
|
},
|
|
634
|
-
onClick: me ? (
|
|
635
|
-
|
|
638
|
+
onClick: me ? ($) => {
|
|
639
|
+
ht($) || me();
|
|
636
640
|
} : void 0,
|
|
637
641
|
onDoubleClick: m.onDoubleClick ? () => {
|
|
638
|
-
var
|
|
639
|
-
return (
|
|
642
|
+
var $;
|
|
643
|
+
return ($ = m.onDoubleClick) == null ? void 0 : $.call(m, o, a);
|
|
640
644
|
} : void 0,
|
|
641
645
|
onContextMenu: m.onContextMenu ? () => {
|
|
642
|
-
var
|
|
643
|
-
return (
|
|
646
|
+
var $;
|
|
647
|
+
return ($ = m.onContextMenu) == null ? void 0 : $.call(m, o, a);
|
|
644
648
|
} : void 0,
|
|
645
649
|
onMouseEnter: m.onMouseEnter ? () => {
|
|
646
|
-
var
|
|
647
|
-
return (
|
|
650
|
+
var $;
|
|
651
|
+
return ($ = m.onMouseEnter) == null ? void 0 : $.call(m, o, a);
|
|
648
652
|
} : void 0,
|
|
649
653
|
onMouseLeave: m.onMouseLeave ? () => {
|
|
650
|
-
var
|
|
651
|
-
return (
|
|
654
|
+
var $;
|
|
655
|
+
return ($ = m.onMouseLeave) == null ? void 0 : $.call(m, o, a);
|
|
652
656
|
} : void 0,
|
|
653
657
|
children: [
|
|
654
|
-
e.map((
|
|
655
|
-
f(
|
|
658
|
+
e.map(($) => /* @__PURE__ */ y(Se.Fragment, { children: [
|
|
659
|
+
f($),
|
|
656
660
|
/* @__PURE__ */ n(
|
|
657
|
-
|
|
661
|
+
_r,
|
|
658
662
|
{
|
|
659
|
-
column:
|
|
663
|
+
column: $,
|
|
660
664
|
record: o,
|
|
661
665
|
paddingYClass: ae,
|
|
662
666
|
index: a,
|
|
663
667
|
size: E,
|
|
664
668
|
isSelected: xe,
|
|
665
|
-
cellStyle: i(
|
|
669
|
+
cellStyle: i($, "row")
|
|
666
670
|
}
|
|
667
671
|
)
|
|
668
|
-
] },
|
|
669
|
-
ye && ge ? /* @__PURE__ */ n("span", { "aria-hidden": "true", className:
|
|
672
|
+
] }, $.key)),
|
|
673
|
+
ye && ge ? /* @__PURE__ */ n("span", { "aria-hidden": "true", className: Zt }) : null
|
|
670
674
|
]
|
|
671
675
|
},
|
|
672
676
|
Q
|
|
673
677
|
);
|
|
674
|
-
},
|
|
678
|
+
}, w = (o, a = !1) => /* @__PURE__ */ n(
|
|
675
679
|
"div",
|
|
676
680
|
{
|
|
677
|
-
className: "bg-[var(--malachite-table-row-background,#fff)] flex
|
|
678
|
-
style: {
|
|
681
|
+
className: "bg-[var(--malachite-table-row-background,#fff)] flex items-stretch w-full",
|
|
682
|
+
style: {
|
|
683
|
+
...a ? {} : vt,
|
|
684
|
+
...t,
|
|
685
|
+
minHeight: Ze
|
|
686
|
+
},
|
|
679
687
|
children: e.map((d) => {
|
|
680
688
|
const B = (d.title === "" || d.title == null) && d.width !== void 0 ? /* @__PURE__ */ n(
|
|
681
689
|
"div",
|
|
682
690
|
{
|
|
683
|
-
className: `flex items-center ${
|
|
691
|
+
className: `flex items-center ${$t(d.align)} shrink-0 overflow-clip px-4 ${ae}`,
|
|
684
692
|
style: {
|
|
685
693
|
...Qe(d),
|
|
686
694
|
...i(d, "row")
|
|
@@ -708,11 +716,11 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
708
716
|
), F = D ? /* @__PURE__ */ n("div", { className: "flex min-h-10 items-stretch w-full", style: t, children: e.map((o, a) => /* @__PURE__ */ y(Se.Fragment, { children: [
|
|
709
717
|
f(o),
|
|
710
718
|
/* @__PURE__ */ n(
|
|
711
|
-
|
|
719
|
+
Rr,
|
|
712
720
|
{
|
|
713
721
|
column: o,
|
|
714
722
|
sortDirection: (O == null ? void 0 : O.key) === o.key ? O.direction : null,
|
|
715
|
-
onSort: o.sorter ?
|
|
723
|
+
onSort: o.sorter ? it(o, a) : void 0,
|
|
716
724
|
cellStyle: i(o, g)
|
|
717
725
|
}
|
|
718
726
|
)
|
|
@@ -722,18 +730,18 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
722
730
|
{
|
|
723
731
|
ref: Ie,
|
|
724
732
|
className: `w-full ${Ve}`,
|
|
725
|
-
style: { ...
|
|
733
|
+
style: { ...He, ...$e },
|
|
726
734
|
children: [
|
|
727
735
|
/* @__PURE__ */ y(
|
|
728
736
|
"div",
|
|
729
737
|
{
|
|
730
|
-
className: `${
|
|
738
|
+
className: `${Xt} flex flex-col items-start ${A ? "" : "overflow-clip"} relative w-full`,
|
|
731
739
|
children: [
|
|
732
740
|
!D && s,
|
|
733
741
|
D && /* @__PURE__ */ y(
|
|
734
742
|
"div",
|
|
735
743
|
{
|
|
736
|
-
ref:
|
|
744
|
+
ref: Xe,
|
|
737
745
|
style: {
|
|
738
746
|
...A ? {
|
|
739
747
|
position: "sticky",
|
|
@@ -742,7 +750,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
742
750
|
// A title row sits on the frame, as a framed Card's
|
|
743
751
|
// does; the header colour goes behind the column
|
|
744
752
|
// headers alone.
|
|
745
|
-
backgroundColor: s ? "var(--malachite-table-background, #f7f7f7)" :
|
|
753
|
+
backgroundColor: s ? "var(--malachite-table-background, #f7f7f7)" : Pe,
|
|
746
754
|
marginInline: -se,
|
|
747
755
|
width: `calc(100% + ${se * 2}px)`,
|
|
748
756
|
paddingInline: se,
|
|
@@ -753,22 +761,22 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
753
761
|
} : { width: "100%" }
|
|
754
762
|
},
|
|
755
763
|
children: [
|
|
756
|
-
A && /* @__PURE__ */ n(
|
|
764
|
+
A && /* @__PURE__ */ n(yr, {}),
|
|
757
765
|
s,
|
|
758
766
|
/* @__PURE__ */ n(
|
|
759
767
|
"div",
|
|
760
768
|
{
|
|
761
769
|
ref: _e,
|
|
762
|
-
onScroll:
|
|
770
|
+
onScroll: j ? () => bt(
|
|
763
771
|
_e.current,
|
|
764
772
|
le.current
|
|
765
773
|
) : void 0,
|
|
766
774
|
style: {
|
|
767
|
-
...
|
|
768
|
-
...
|
|
769
|
-
paddingRight:
|
|
775
|
+
...j ? {
|
|
776
|
+
...or,
|
|
777
|
+
paddingRight: zt
|
|
770
778
|
} : {},
|
|
771
|
-
...A && s ? { backgroundColor:
|
|
779
|
+
...A && s ? { backgroundColor: Pe } : {}
|
|
772
780
|
},
|
|
773
781
|
children: F
|
|
774
782
|
}
|
|
@@ -779,11 +787,11 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
779
787
|
/* @__PURE__ */ n(
|
|
780
788
|
"div",
|
|
781
789
|
{
|
|
782
|
-
ref:
|
|
783
|
-
onScroll:
|
|
784
|
-
|
|
790
|
+
ref: Dt,
|
|
791
|
+
onScroll: j ? () => {
|
|
792
|
+
bt(le.current, _e.current), ge && ve();
|
|
785
793
|
} : void 0,
|
|
786
|
-
className: `flex flex-col items-start ${
|
|
794
|
+
className: `flex flex-col items-start ${j ? "overflow-x-auto" : "overflow-x-clip"} ${Me ? "overflow-y-auto" : "overflow-y-visible"} w-full`,
|
|
787
795
|
style: {
|
|
788
796
|
// Firefox + modern Chromium only; older Webkit keeps its default.
|
|
789
797
|
scrollbarWidth: "thin",
|
|
@@ -791,7 +799,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
791
799
|
// With an external virtual scroller the body is overflow-visible and
|
|
792
800
|
// a bounded box would overlap content below it.
|
|
793
801
|
...W && Me ? {
|
|
794
|
-
maxHeight:
|
|
802
|
+
maxHeight: kr(
|
|
795
803
|
W,
|
|
796
804
|
!!b
|
|
797
805
|
)
|
|
@@ -803,23 +811,23 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
803
811
|
] }) }) : l ? /* @__PURE__ */ n("div", { className: "flex flex-col w-full", style: h, children: (() => {
|
|
804
812
|
const o = b != null && b.pageSize ? Math.min(b.pageSize, 10) : 5;
|
|
805
813
|
return Array.from({ length: o }).map(
|
|
806
|
-
(a, d) =>
|
|
814
|
+
(a, d) => w(d, d === o - 1)
|
|
807
815
|
);
|
|
808
816
|
})() }) : z.length === 0 ? /* @__PURE__ */ n("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: [
|
|
809
817
|
/* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium", children: S }),
|
|
810
818
|
x && /* @__PURE__ */ n("div", { className: "text-[var(--malachite-text-secondary)] text-[13px] mt-1", children: x })
|
|
811
819
|
] }) }) : (() => {
|
|
812
820
|
const o = (d, I, N) => J ? /* @__PURE__ */ n(
|
|
813
|
-
|
|
821
|
+
Sr,
|
|
814
822
|
{
|
|
815
823
|
cardKey: N,
|
|
816
824
|
records: d,
|
|
817
825
|
startIndex: I,
|
|
818
826
|
scrollElement: De,
|
|
819
|
-
estimateRowHeight:
|
|
827
|
+
estimateRowHeight: Ot,
|
|
820
828
|
style: h,
|
|
821
829
|
renderRow: v,
|
|
822
|
-
registerHandle:
|
|
830
|
+
registerHandle: _t,
|
|
823
831
|
rovingIndex: ee
|
|
824
832
|
},
|
|
825
833
|
`section-card-${N}`
|
|
@@ -855,7 +863,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
855
863
|
"div",
|
|
856
864
|
{
|
|
857
865
|
className: "table-section-divider",
|
|
858
|
-
style:
|
|
866
|
+
style: j ? dr : void 0,
|
|
859
867
|
children: m
|
|
860
868
|
}
|
|
861
869
|
) : null,
|
|
@@ -869,7 +877,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
869
877
|
}
|
|
870
878
|
),
|
|
871
879
|
b && !l && /* @__PURE__ */ n(
|
|
872
|
-
|
|
880
|
+
ut,
|
|
873
881
|
{
|
|
874
882
|
current: b.current ?? 1,
|
|
875
883
|
pageSize: b.pageSize ?? 10,
|
|
@@ -886,7 +894,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
886
894
|
}
|
|
887
895
|
);
|
|
888
896
|
}
|
|
889
|
-
const
|
|
897
|
+
const Ft = (t, i) => {
|
|
890
898
|
const f = t.sorter, g = (O == null ? void 0 : O.key) === t.key ? O == null ? void 0 : O.direction : null, h = /* @__PURE__ */ y("div", { className: `flex items-center gap-2 ${Z(t.align)}`, children: [
|
|
891
899
|
/* @__PURE__ */ n("span", { children: t.title }),
|
|
892
900
|
t.info && /* @__PURE__ */ n(ke, { info: t.info }),
|
|
@@ -899,7 +907,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
899
907
|
}
|
|
900
908
|
),
|
|
901
909
|
/* @__PURE__ */ n(
|
|
902
|
-
|
|
910
|
+
mt,
|
|
903
911
|
{
|
|
904
912
|
size: 12,
|
|
905
913
|
className: `-mt-1 ${g === "desc" ? Ge : Ye}`
|
|
@@ -916,11 +924,11 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
916
924
|
${fe(t.align)}
|
|
917
925
|
`,
|
|
918
926
|
style: { width: t.width },
|
|
919
|
-
"aria-sort": f ?
|
|
927
|
+
"aria-sort": f ? wr(g) : void 0,
|
|
920
928
|
children: f ? /* @__PURE__ */ n(
|
|
921
929
|
"button",
|
|
922
930
|
{
|
|
923
|
-
|
|
931
|
+
...Nt(t.title, it(t, i)),
|
|
924
932
|
className: `flex w-full items-center ${Z(t.align)} cursor-pointer hover:opacity-80 appearance-none bg-transparent border-0 p-0 font-semibold text-inherit ${fe(t.align)}`,
|
|
925
933
|
children: h
|
|
926
934
|
}
|
|
@@ -929,7 +937,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
929
937
|
t.key
|
|
930
938
|
);
|
|
931
939
|
};
|
|
932
|
-
return c ? /* @__PURE__ */ n("div", { className: "w-full", style: { ...
|
|
940
|
+
return c ? /* @__PURE__ */ n("div", { className: "w-full", style: { ...He, ...$e }, children: /* @__PURE__ */ n(
|
|
933
941
|
"div",
|
|
934
942
|
{
|
|
935
943
|
className: "overflow-x-auto",
|
|
@@ -968,7 +976,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
968
976
|
colSpan: e.length + (ie ? 1 : 0),
|
|
969
977
|
className: "px-4 py-12 text-center",
|
|
970
978
|
children: /* @__PURE__ */ y("div", { className: "flex flex-col items-center justify-center", children: [
|
|
971
|
-
/* @__PURE__ */ n("div", { className: "table-error-icon w-12 h-12 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ n(
|
|
979
|
+
/* @__PURE__ */ n("div", { className: "table-error-icon w-12 h-12 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ n(Gt, { size: 24 }) }),
|
|
972
980
|
/* @__PURE__ */ n("div", { className: "table-error-title text-lg font-semibold mb-2", children: C }),
|
|
973
981
|
/* @__PURE__ */ n("div", { className: "table-error-subtitle text-sm", children: u })
|
|
974
982
|
] })
|
|
@@ -981,7 +989,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
981
989
|
{
|
|
982
990
|
ref: Ie,
|
|
983
991
|
className: `w-full ${Ve}`,
|
|
984
|
-
style: { ...
|
|
992
|
+
style: { ...He, ...$e },
|
|
985
993
|
children: [
|
|
986
994
|
/* @__PURE__ */ n(
|
|
987
995
|
"div",
|
|
@@ -1001,7 +1009,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
1001
1009
|
className: `w-full ${re === "fixed" || e.some((t) => t.width) ? "table-fixed" : "table-auto"} ${p ? "border-separate table-bordered" : "border-collapse"} rounded-lg overflow-hidden`,
|
|
1002
1010
|
style: { borderSpacing: "0" },
|
|
1003
1011
|
children: [
|
|
1004
|
-
D && /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ n("tr", { children: e.map((t, i) =>
|
|
1012
|
+
D && /* @__PURE__ */ n("thead", { children: /* @__PURE__ */ n("tr", { children: e.map((t, i) => Ft(t, i)) }) }),
|
|
1005
1013
|
/* @__PURE__ */ n("tbody", { children: l ? Array.from({ length: 5 }).map((t, i) => /* @__PURE__ */ n(
|
|
1006
1014
|
"tr",
|
|
1007
1015
|
{
|
|
@@ -1028,7 +1036,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
1028
1036
|
] })
|
|
1029
1037
|
}
|
|
1030
1038
|
) }) : z.map((t, i) => {
|
|
1031
|
-
const f = We(t, i), s = (
|
|
1039
|
+
const f = We(t, i), s = (P == null ? void 0 : P(t, i)) || {}, g = U == null ? void 0 : U(t, i), h = i === 0, v = i === r.length - 1, w = i === L, F = g ? `var(--malachite-table-row-variant-${g}-background)` : void 0, o = T || s.onClick ? () => {
|
|
1032
1040
|
var a;
|
|
1033
1041
|
T == null || T(t, i), (a = s.onClick) == null || a.call(s, t, i);
|
|
1034
1042
|
} : void 0;
|
|
@@ -1040,16 +1048,16 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
1040
1048
|
{
|
|
1041
1049
|
"data-table-id": q,
|
|
1042
1050
|
"data-row-index": i,
|
|
1043
|
-
"aria-current":
|
|
1051
|
+
"aria-current": w ? "true" : void 0,
|
|
1044
1052
|
tabIndex: o ? i === ee ? 0 : -1 : void 0,
|
|
1045
|
-
onKeyDown: o ?
|
|
1053
|
+
onKeyDown: o ? ot(i, o) : void 0,
|
|
1046
1054
|
className: `
|
|
1047
|
-
${p ? "table-row-bordered" : `table-row ${
|
|
1055
|
+
${p ? "table-row-bordered" : `table-row ${w ? "" : "hover:opacity-80"}`}
|
|
1048
1056
|
${(_ == null ? void 0 : _(t, i)) || ""}
|
|
1049
|
-
${o ? `cursor-pointer ${
|
|
1057
|
+
${o ? `cursor-pointer ${ct}` : ""}
|
|
1050
1058
|
`,
|
|
1051
1059
|
onClick: o ? (a) => {
|
|
1052
|
-
|
|
1060
|
+
ht(a) || o();
|
|
1053
1061
|
} : void 0,
|
|
1054
1062
|
onDoubleClick: s.onDoubleClick ? () => {
|
|
1055
1063
|
var a;
|
|
@@ -1070,7 +1078,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
1070
1078
|
children: e.map((a) => {
|
|
1071
1079
|
const d = a === e[0], I = a === e[e.length - 1];
|
|
1072
1080
|
return /* @__PURE__ */ n(
|
|
1073
|
-
|
|
1081
|
+
Er,
|
|
1074
1082
|
{
|
|
1075
1083
|
column: a,
|
|
1076
1084
|
record: t,
|
|
@@ -1083,8 +1091,8 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
1083
1091
|
isFirstColumn: d,
|
|
1084
1092
|
isLastColumn: I,
|
|
1085
1093
|
variantBackground: F,
|
|
1086
|
-
isSelected:
|
|
1087
|
-
showSelectedAccent:
|
|
1094
|
+
isSelected: w,
|
|
1095
|
+
showSelectedAccent: w && d
|
|
1088
1096
|
},
|
|
1089
1097
|
a.key
|
|
1090
1098
|
);
|
|
@@ -1102,7 +1110,7 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
1102
1110
|
}
|
|
1103
1111
|
),
|
|
1104
1112
|
b && !l && /* @__PURE__ */ n(
|
|
1105
|
-
|
|
1113
|
+
ut,
|
|
1106
1114
|
{
|
|
1107
1115
|
current: b.current ?? 1,
|
|
1108
1116
|
pageSize: b.pageSize ?? 10,
|
|
@@ -1120,6 +1128,6 @@ const kt = 160, tr = (e, r) => e.length === r.length && e.every((l, c) => l ===
|
|
|
1120
1128
|
);
|
|
1121
1129
|
};
|
|
1122
1130
|
export {
|
|
1123
|
-
|
|
1131
|
+
qr as default
|
|
1124
1132
|
};
|
|
1125
1133
|
//# sourceMappingURL=Table.js.map
|