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