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