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