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