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