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