@stackone/malachite 2.94.0 → 2.94.1
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.
|
@@ -18,17 +18,17 @@ import { FOREGROUND_RESET as je, SELECTED_ROW_ACCENT as wt, SELECTED_TEXT_CONTEX
|
|
|
18
18
|
import dn from "./TablePagination.js";
|
|
19
19
|
import { paginationPlacement as cn } from "./paginationPlacement.js";
|
|
20
20
|
import { useFillHeight as fn } from "./useFillHeight.js";
|
|
21
|
-
const Ct = 160, hn = (e, n) => e.length === n.length && e.every((
|
|
21
|
+
const Ct = 160, hn = (e, n) => e.length === n.length && e.every((a, c) => a === n[c]), mt = "\0", un = (e, n, a) => {
|
|
22
22
|
if (typeof e != "object" || e === null)
|
|
23
|
-
return `${mt}i${
|
|
23
|
+
return `${mt}i${a}`;
|
|
24
24
|
const c = n.ids.get(e);
|
|
25
25
|
if (c !== void 0)
|
|
26
26
|
return c;
|
|
27
27
|
const w = `${mt}${n.next++}`;
|
|
28
28
|
return n.ids.set(e, w), w;
|
|
29
|
-
}, pn = (e, n,
|
|
29
|
+
}, pn = (e, n, a) => typeof n == "function" ? e.map((c) => n(c)) : e.map((c, w) => {
|
|
30
30
|
const u = c[n];
|
|
31
|
-
return u == null ? un(c,
|
|
31
|
+
return u == null ? un(c, a, w) : String(u);
|
|
32
32
|
}), we = (e) => {
|
|
33
33
|
if (typeof e == "number")
|
|
34
34
|
return e;
|
|
@@ -40,14 +40,14 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
40
40
|
}, Ve = (e) => {
|
|
41
41
|
const n = we(e.width);
|
|
42
42
|
return !(e.title === "" || e.title == null) && n !== void 0 && typeof e.minWidth == "number" && e.minWidth < n ? e.minWidth : void 0;
|
|
43
|
-
}, gn = (e) => e.reduce((n,
|
|
44
|
-
const c = Ve(
|
|
45
|
-
return c !== void 0 ? n + c : typeof
|
|
43
|
+
}, gn = (e) => e.reduce((n, a) => {
|
|
44
|
+
const c = Ve(a) ?? we(a.width);
|
|
45
|
+
return c !== void 0 ? n + c : typeof a.minWidth == "number" ? n + a.minWidth : n + Ct;
|
|
46
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)),
|
|
47
|
+
const n = [...e].reverse().findIndex((u) => !vn(u)), a = n === -1 ? 0 : e.length - n, c = /* @__PURE__ */ new Map(), w = e.reduceRight(
|
|
48
48
|
(u, y, b) => {
|
|
49
49
|
const p = Ve(y) ?? we(y.width);
|
|
50
|
-
return !(y.fixed === "right" || b >=
|
|
50
|
+
return !(y.fixed === "right" || b >= a) || p === void 0 ? u : (c.set(y.key, u.right), { right: u.right + p, edge: y.key });
|
|
51
51
|
},
|
|
52
52
|
{ right: 0, edge: void 0 }
|
|
53
53
|
);
|
|
@@ -73,13 +73,13 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
73
73
|
}, yt = (e) => `linear-gradient(${e}, ${e})`, $n = (e, n) => {
|
|
74
74
|
if (!e && !n)
|
|
75
75
|
return {};
|
|
76
|
-
const
|
|
76
|
+
const a = [
|
|
77
77
|
n ? yt(qe) : void 0,
|
|
78
78
|
e ? yt(`var(--malachite-table-row-variant-${e}-background)`) : void 0
|
|
79
79
|
].filter(Ze);
|
|
80
80
|
return {
|
|
81
81
|
backgroundColor: e ? "var(--malachite-table-background, #f7f7f7)" : "var(--malachite-table-row-background, #fff)",
|
|
82
|
-
backgroundImage:
|
|
82
|
+
backgroundImage: a.join(", ")
|
|
83
83
|
};
|
|
84
84
|
}, Ze = (e) => typeof e == "string", Nn = {
|
|
85
85
|
default: 40,
|
|
@@ -101,7 +101,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
101
101
|
), On = ({
|
|
102
102
|
records: e,
|
|
103
103
|
startIndex: n,
|
|
104
|
-
scrollElement:
|
|
104
|
+
scrollElement: a,
|
|
105
105
|
estimateRowHeight: c,
|
|
106
106
|
style: w,
|
|
107
107
|
renderRow: u,
|
|
@@ -111,18 +111,18 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
111
111
|
}) => {
|
|
112
112
|
const D = H(null), [M, L] = J(0);
|
|
113
113
|
$t(() => {
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
114
|
+
const _ = D.current;
|
|
115
|
+
if (!_ || !a)
|
|
116
116
|
return;
|
|
117
117
|
const U = () => {
|
|
118
|
-
const R =
|
|
118
|
+
const R = _.getBoundingClientRect().top - a.getBoundingClientRect().top + a.scrollTop;
|
|
119
119
|
L((Y) => Math.abs(Y - R) < 1 ? Y : R);
|
|
120
120
|
};
|
|
121
121
|
if (U(), typeof ResizeObserver > "u")
|
|
122
122
|
return;
|
|
123
123
|
const j = new ResizeObserver(U);
|
|
124
|
-
let T =
|
|
125
|
-
for (; T && T !==
|
|
124
|
+
let T = _;
|
|
125
|
+
for (; T && T !== a; ) {
|
|
126
126
|
let R = T.previousElementSibling;
|
|
127
127
|
for (; R; )
|
|
128
128
|
j.observe(R), R = R.previousElementSibling;
|
|
@@ -135,12 +135,12 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
return () => j.disconnect();
|
|
138
|
-
}, [
|
|
138
|
+
}, [a, e.length, n]);
|
|
139
139
|
const E = qt({
|
|
140
140
|
count: e.length,
|
|
141
141
|
// State, not a ref: an ancestor's ref is not attached when this child's layout effects
|
|
142
142
|
// run, so a ref would leave the virtualizer without a scroll element.
|
|
143
|
-
getScrollElement: () =>
|
|
143
|
+
getScrollElement: () => a,
|
|
144
144
|
estimateSize: () => c,
|
|
145
145
|
overscan: Rn,
|
|
146
146
|
scrollMargin: M
|
|
@@ -150,7 +150,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
150
150
|
return y(b, {
|
|
151
151
|
startIndex: n,
|
|
152
152
|
count: e.length,
|
|
153
|
-
scrollToIndex: (
|
|
153
|
+
scrollToIndex: (_) => E.scrollToIndex(_, { align: "center" })
|
|
154
154
|
}), () => y(b, null);
|
|
155
155
|
}, [y, b, n, e.length, E]);
|
|
156
156
|
const S = E.getVirtualItems(), ne = E.getTotalSize(), re = p >= n && p < n + e.length && S.length > 0 ? Math.min(
|
|
@@ -160,34 +160,34 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
160
160
|
return /* @__PURE__ */ m("div", { ref: D, className: "flex flex-col w-full", style: w, children: [
|
|
161
161
|
X > 0 && /* @__PURE__ */ r("div", { "aria-hidden": "true", style: { height: X, flexShrink: 0 } }),
|
|
162
162
|
S.map(
|
|
163
|
-
(
|
|
164
|
-
e[
|
|
165
|
-
n +
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
{ measureRef: E.measureElement, index:
|
|
163
|
+
(_) => u(
|
|
164
|
+
e[_.index],
|
|
165
|
+
n + _.index,
|
|
166
|
+
_.index === e.length - 1,
|
|
167
|
+
_.index === 0,
|
|
168
|
+
{ measureRef: E.measureElement, index: _.index },
|
|
169
169
|
re
|
|
170
170
|
)
|
|
171
171
|
),
|
|
172
172
|
K > 0 && /* @__PURE__ */ r("div", { "aria-hidden": "true", style: { height: K, flexShrink: 0 } })
|
|
173
173
|
] });
|
|
174
174
|
}, Tn = (e, n) => {
|
|
175
|
-
const
|
|
176
|
-
return typeof e == "number" ? `${Math.max(0, e -
|
|
175
|
+
const a = n ? wn : 0;
|
|
176
|
+
return typeof e == "number" ? `${Math.max(0, e - a)}px` : `calc(${e} - ${a}px)`;
|
|
177
177
|
}, fe = (e) => {
|
|
178
178
|
const n = e.width;
|
|
179
179
|
if (n == null)
|
|
180
180
|
return {};
|
|
181
|
-
const
|
|
182
|
-
return c === void 0 ? { flexBasis:
|
|
181
|
+
const a = typeof n == "number" ? `${n}px` : n, c = Ve(e);
|
|
182
|
+
return c === void 0 ? { flexBasis: a, maxWidth: a } : { flexBasis: a, maxWidth: a, minWidth: c, flexShrink: 1 };
|
|
183
183
|
}, Xe = (e) => {
|
|
184
184
|
const n = e.width;
|
|
185
185
|
if (n == null)
|
|
186
186
|
return {};
|
|
187
|
-
const
|
|
188
|
-
return { width:
|
|
187
|
+
const a = typeof n == "number" ? `${n}px` : n;
|
|
188
|
+
return { width: a, flexBasis: a };
|
|
189
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((
|
|
190
|
+
const n = e.find((a) => a.sorter && a.defaultSortOrder);
|
|
191
191
|
return n != null && n.defaultSortOrder ? { key: n.key, direction: Ln[n.defaultSortOrder] } : null;
|
|
192
192
|
}, It = (e, n) => ({
|
|
193
193
|
type: "button",
|
|
@@ -196,7 +196,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
196
196
|
}), zn = ({
|
|
197
197
|
column: e,
|
|
198
198
|
record: n,
|
|
199
|
-
index:
|
|
199
|
+
index: a,
|
|
200
200
|
size: c,
|
|
201
201
|
paddingYClass: w,
|
|
202
202
|
bordered: u,
|
|
@@ -208,7 +208,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
208
208
|
showSelectedAccent: L,
|
|
209
209
|
isSelected: E
|
|
210
210
|
}) => {
|
|
211
|
-
const S = n[e.dataIndex], ne = e.render ? e.render(S, n,
|
|
211
|
+
const S = n[e.dataIndex], ne = e.render ? e.render(S, n, a) : S == null ? "" : String(S), P = e.ellipsis && Ze(S) ? S : void 0;
|
|
212
212
|
return /* @__PURE__ */ r(
|
|
213
213
|
"td",
|
|
214
214
|
{
|
|
@@ -246,7 +246,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
246
246
|
}, Fn = ({
|
|
247
247
|
column: e,
|
|
248
248
|
sortDirection: n,
|
|
249
|
-
onSort:
|
|
249
|
+
onSort: a,
|
|
250
250
|
cellStyle: c
|
|
251
251
|
}) => {
|
|
252
252
|
const w = !!e.sorter, u = e.title === "" || e.title == null;
|
|
@@ -287,7 +287,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
287
287
|
children: /* @__PURE__ */ m(
|
|
288
288
|
"button",
|
|
289
289
|
{
|
|
290
|
-
...It(e.title,
|
|
290
|
+
...It(e.title, a),
|
|
291
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)}`,
|
|
292
292
|
children: [
|
|
293
293
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-1 min-w-0", children: [
|
|
@@ -313,16 +313,16 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
313
313
|
] })
|
|
314
314
|
}
|
|
315
315
|
);
|
|
316
|
-
},
|
|
316
|
+
}, Bn = ({
|
|
317
317
|
column: e,
|
|
318
318
|
record: n,
|
|
319
|
-
index:
|
|
319
|
+
index: a,
|
|
320
320
|
size: c,
|
|
321
321
|
paddingYClass: w,
|
|
322
322
|
isSelected: u = !1,
|
|
323
323
|
cellStyle: y
|
|
324
324
|
}) => {
|
|
325
|
-
const b = n[e.dataIndex], p = e.render ? e.render(b, n,
|
|
325
|
+
const b = n[e.dataIndex], p = e.render ? e.render(b, n, a) : b == null ? "" : String(b), M = (e.title === "" || e.title == null) && e.width !== void 0, L = Ze(b) && b.length > 0, E = u ? {
|
|
326
326
|
color: Rt,
|
|
327
327
|
...Et
|
|
328
328
|
} : {};
|
|
@@ -355,7 +355,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
355
355
|
}, ar = ({
|
|
356
356
|
columns: e,
|
|
357
357
|
data: n,
|
|
358
|
-
loading:
|
|
358
|
+
loading: a = !1,
|
|
359
359
|
error: c = !1,
|
|
360
360
|
errorTitle: w = "Data unavailable",
|
|
361
361
|
errorSubTitle: u = "There was an issue retrieving the data. Please try again.",
|
|
@@ -372,14 +372,14 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
372
372
|
title: re,
|
|
373
373
|
subtitle: X,
|
|
374
374
|
extra: K,
|
|
375
|
-
rowClassName:
|
|
375
|
+
rowClassName: _,
|
|
376
376
|
rowVariant: U,
|
|
377
377
|
onRow: j,
|
|
378
378
|
onClickRow: T,
|
|
379
379
|
selectedRowKey: R,
|
|
380
380
|
scrollSelectedIntoView: Y = !0,
|
|
381
381
|
rowSelection: ie,
|
|
382
|
-
pagination:
|
|
382
|
+
pagination: C,
|
|
383
383
|
className: Ke = "",
|
|
384
384
|
style: Ee,
|
|
385
385
|
stickyHeaderTop: Re,
|
|
@@ -398,10 +398,12 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
398
398
|
[]
|
|
399
399
|
), Q = Jt(), [Lt, Me] = J(0), q = Ot && P === "detached", Wt = Tt ?? En, [oe, zt] = J(null), Ft = Ue((t) => {
|
|
400
400
|
ae.current = t, t && zt((i) => i === t ? i : t);
|
|
401
|
-
}, []), Le = q ? ue ?? oe : null, [
|
|
402
|
-
P === "detached" ? oe :
|
|
403
|
-
pe
|
|
404
|
-
|
|
401
|
+
}, []), Le = q ? ue ?? oe : null, [Bt, nt] = J(null), pe = L === "fill", rt = fn(
|
|
402
|
+
P === "detached" ? oe : Bt,
|
|
403
|
+
pe,
|
|
404
|
+
// The pager is only drawn once loaded, and takes its height out of the room.
|
|
405
|
+
!!C && !a
|
|
406
|
+
), 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, [At, lt] = J(!1), [Ht, at] = J(0), be = Ue(() => {
|
|
405
407
|
const t = ae.current;
|
|
406
408
|
lt(
|
|
407
409
|
t !== null && t.scrollLeft + t.clientWidth < t.scrollWidth - 1
|
|
@@ -417,23 +419,23 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
417
419
|
const t = new ResizeObserver(be);
|
|
418
420
|
return t.observe(oe), () => t.disconnect();
|
|
419
421
|
}, [ve, oe, it, be]);
|
|
420
|
-
const ze = !(q && ue),
|
|
422
|
+
const ze = !(q && ue), B = P === "detached" && Re !== void 0 && D && !L && (!q || !ze), ot = R != null, [Fe, st] = J(0);
|
|
421
423
|
te(() => {
|
|
422
424
|
const t = tt.current;
|
|
423
|
-
if (!t || !
|
|
425
|
+
if (!t || !B || !ot || typeof ResizeObserver > "u") {
|
|
424
426
|
st(0);
|
|
425
427
|
return;
|
|
426
428
|
}
|
|
427
429
|
const i = new ResizeObserver((f) => {
|
|
428
430
|
var h, v;
|
|
429
|
-
const
|
|
431
|
+
const o = f[0], g = ((v = (h = o == null ? void 0 : o.borderBoxSize) == null ? void 0 : h[0]) == null ? void 0 : v.blockSize) ?? (o == null ? void 0 : o.contentRect.height) ?? 0;
|
|
430
432
|
st(
|
|
431
433
|
(k) => Math.abs(k - g) < 1 ? k : g
|
|
432
434
|
);
|
|
433
435
|
});
|
|
434
436
|
return i.observe(t), () => i.disconnect();
|
|
435
|
-
}, [
|
|
436
|
-
const Pt =
|
|
437
|
+
}, [B, ot]);
|
|
438
|
+
const Pt = B ? (Re ?? 0) + Fe : void 0, { sortedData: W, sectionDividers: Be } = gt(() => {
|
|
437
439
|
const t = (h) => {
|
|
438
440
|
if (!O) return h;
|
|
439
441
|
const v = e.find((F) => F.key === O.key);
|
|
@@ -459,18 +461,18 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
459
461
|
let k = f.get(v);
|
|
460
462
|
k === void 0 && (k = i.length, f.set(v, k), i.push({ key: v, records: [] })), i[k].records.push(h);
|
|
461
463
|
}
|
|
462
|
-
const
|
|
464
|
+
const o = [], g = /* @__PURE__ */ new Map();
|
|
463
465
|
for (const h of i) {
|
|
464
466
|
const v = t(h.records);
|
|
465
|
-
g.set(
|
|
467
|
+
g.set(o.length, { key: h.key, records: v }), o.push(...v);
|
|
466
468
|
}
|
|
467
|
-
return { sortedData:
|
|
469
|
+
return { sortedData: o, sectionDividers: g };
|
|
468
470
|
}, [n, O, e, Ce]), Ut = (t) => {
|
|
469
471
|
Dt((i) => (i == null ? void 0 : i.key) === t ? i.direction === "asc" ? { key: t, direction: "desc" } : null : { key: t, direction: "asc" });
|
|
470
472
|
}, dt = (t, i) => (f) => {
|
|
471
|
-
var
|
|
472
|
-
Ut(t.key), (h = (g = (
|
|
473
|
-
},
|
|
473
|
+
var o, g, h;
|
|
474
|
+
Ut(t.key), (h = (g = (o = t.onHeaderCell) == null ? void 0 : o.call(t, t, i)) == null ? void 0 : g.onClick) == null || h.call(g, f);
|
|
475
|
+
}, Ae = (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);
|
|
474
476
|
te(() => {
|
|
475
477
|
if (!Ie)
|
|
476
478
|
return;
|
|
@@ -482,7 +484,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
482
484
|
if (R == null)
|
|
483
485
|
return -1;
|
|
484
486
|
const t = String(R);
|
|
485
|
-
return W.findIndex((i, f) =>
|
|
487
|
+
return W.findIndex((i, f) => Ae(i, f) === t);
|
|
486
488
|
}, [R, W, ct]);
|
|
487
489
|
te(() => {
|
|
488
490
|
z >= 0 && Me(z);
|
|
@@ -496,17 +498,17 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
496
498
|
if (!Y || z < 0)
|
|
497
499
|
return;
|
|
498
500
|
const t = He.current;
|
|
499
|
-
if (t && t.key === R && t.index === z ||
|
|
501
|
+
if (t && t.key === R && t.index === z || a || c || q && !Le)
|
|
500
502
|
return;
|
|
501
503
|
const i = Te.current;
|
|
502
504
|
if (!i)
|
|
503
505
|
return;
|
|
504
|
-
const f =
|
|
506
|
+
const f = B && Fe === 0, o = (l) => i.querySelector(
|
|
505
507
|
`[data-table-id="${Q}"][data-row-index="${l}"]`
|
|
506
508
|
), g = (l) => {
|
|
507
|
-
const d = ae.current, I = ue, N = d == null ? void 0 : d.scrollLeft,
|
|
508
|
-
l.scrollIntoView({ block: "nearest", inline: "nearest" }), d && N !== void 0 && (d.scrollLeft = N), I &&
|
|
509
|
-
}, h =
|
|
509
|
+
const d = ae.current, I = ue, N = d == null ? void 0 : d.scrollLeft, A = I == null ? void 0 : I.scrollLeft;
|
|
510
|
+
l.scrollIntoView({ block: "nearest", inline: "nearest" }), d && N !== void 0 && (d.scrollLeft = N), I && A !== void 0 && (I.scrollLeft = A), f || (He.current = { key: R, index: z });
|
|
511
|
+
}, h = o(z);
|
|
510
512
|
if (h) {
|
|
511
513
|
g(h);
|
|
512
514
|
return;
|
|
@@ -521,7 +523,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
521
523
|
v.scrollToIndex(z - v.startIndex);
|
|
522
524
|
let k = 0, F = 0;
|
|
523
525
|
const s = () => {
|
|
524
|
-
const l =
|
|
526
|
+
const l = o(z);
|
|
525
527
|
if (l) {
|
|
526
528
|
g(l);
|
|
527
529
|
return;
|
|
@@ -535,9 +537,9 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
535
537
|
q,
|
|
536
538
|
Le,
|
|
537
539
|
ue,
|
|
538
|
-
|
|
540
|
+
B,
|
|
539
541
|
Fe,
|
|
540
|
-
|
|
542
|
+
a,
|
|
541
543
|
c,
|
|
542
544
|
Q,
|
|
543
545
|
Y
|
|
@@ -550,11 +552,11 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
550
552
|
if (!t)
|
|
551
553
|
return;
|
|
552
554
|
Pe.current = null;
|
|
553
|
-
const i = t.getRootNode(),
|
|
555
|
+
const i = t.getRootNode(), o = ((v) => i.querySelector(
|
|
554
556
|
`[data-table-id="${Q}"][data-row-index="${v}"]`
|
|
555
557
|
))(ee);
|
|
556
|
-
if (
|
|
557
|
-
|
|
558
|
+
if (o) {
|
|
559
|
+
o.focus();
|
|
558
560
|
return;
|
|
559
561
|
}
|
|
560
562
|
const g = i.querySelectorAll(
|
|
@@ -563,9 +565,9 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
563
565
|
h && (Me(Number(h.dataset.rowIndex)), h.focus());
|
|
564
566
|
}, [ee, Q]);
|
|
565
567
|
const ut = (t, i) => (f) => {
|
|
566
|
-
const
|
|
567
|
-
if (
|
|
568
|
-
f.preventDefault(), ht(f.currentTarget, t +
|
|
568
|
+
const o = { ArrowDown: 1, ArrowUp: -1 }[f.key];
|
|
569
|
+
if (o !== void 0) {
|
|
570
|
+
f.preventDefault(), ht(f.currentTarget, t + o);
|
|
569
571
|
return;
|
|
570
572
|
}
|
|
571
573
|
if (!q && (f.key === "Home" || f.key === "End")) {
|
|
@@ -578,18 +580,18 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
578
580
|
"table-title-inline",
|
|
579
581
|
'Table `title`, `subtitle` and `extra` draw only on the detached header. Pass `headerVariant="detached"` or leave them out.'
|
|
580
582
|
);
|
|
581
|
-
const pt = cn(
|
|
583
|
+
const pt = cn(C == null ? void 0 : C.position), me = (t) => C && !a && pt[t] ? /* @__PURE__ */ r(
|
|
582
584
|
dn,
|
|
583
585
|
{
|
|
584
|
-
current:
|
|
585
|
-
pageSize:
|
|
586
|
-
total:
|
|
587
|
-
showSizeChanger:
|
|
588
|
-
showQuickJumper:
|
|
589
|
-
showTotal:
|
|
590
|
-
pageSizeOptions:
|
|
591
|
-
onChange:
|
|
592
|
-
onShowSizeChange:
|
|
586
|
+
current: C.current ?? 1,
|
|
587
|
+
pageSize: C.pageSize ?? 10,
|
|
588
|
+
total: C.total ?? 0,
|
|
589
|
+
showSizeChanger: C.showSizeChanger,
|
|
590
|
+
showQuickJumper: C.showQuickJumper,
|
|
591
|
+
showTotal: C.showTotal,
|
|
592
|
+
pageSizeOptions: C.pageSizeOptions,
|
|
593
|
+
onChange: C.onChange,
|
|
594
|
+
onShowSizeChange: C.onShowSizeChange,
|
|
593
595
|
edge: t,
|
|
594
596
|
align: pt[t]
|
|
595
597
|
}
|
|
@@ -598,7 +600,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
598
600
|
const t = G ? { minWidth: it } : {}, i = (s, l) => ({
|
|
599
601
|
...G && s.width === void 0 ? { minWidth: s.minWidth ?? Ct } : {},
|
|
600
602
|
...kn(ge.offsets.get(s.key), l)
|
|
601
|
-
}), f = (s) => s.key === ge.edgeKey &&
|
|
603
|
+
}), f = (s) => s.key === ge.edgeKey && At ? /* @__PURE__ */ r(
|
|
602
604
|
"span",
|
|
603
605
|
{
|
|
604
606
|
"aria-hidden": "true",
|
|
@@ -610,14 +612,14 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
610
612
|
},
|
|
611
613
|
children: /* @__PURE__ */ r("span", { style: Sn })
|
|
612
614
|
}
|
|
613
|
-
) : null,
|
|
615
|
+
) : null, o = bt({ title: re, subtitle: X, extra: K }) ? /* @__PURE__ */ r(Xt, { title: re, subtitle: X, extra: K }) : null, g = B ? Ye : "var(--malachite-table-background, #f7f7f7)", h = {
|
|
614
616
|
border: an,
|
|
615
617
|
borderRadius: de,
|
|
616
618
|
overflow: "clip",
|
|
617
619
|
flexShrink: 0,
|
|
618
620
|
...t
|
|
619
|
-
}, v = (s, l, d = !1, I = !1, N,
|
|
620
|
-
const V =
|
|
621
|
+
}, v = (s, l, d = !1, I = !1, N, A = ee) => {
|
|
622
|
+
const V = Ae(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
623
|
var $;
|
|
622
624
|
T == null || T(s, l), ($ = x.onClick) == null || $.call(x, s, l);
|
|
623
625
|
} : void 0, ke = !!Se, Yt = d ? {} : St;
|
|
@@ -629,12 +631,12 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
629
631
|
"data-table-id": Q,
|
|
630
632
|
"data-row-index": l,
|
|
631
633
|
"aria-current": ye ? "true" : void 0,
|
|
632
|
-
tabIndex: ke ? l ===
|
|
634
|
+
tabIndex: ke ? l === A ? 0 : -1 : void 0,
|
|
633
635
|
onKeyDown: ke ? ut(l, Se) : void 0,
|
|
634
636
|
className: `
|
|
635
637
|
group bg-[var(--malachite-table-row-background,#fff)] flex items-stretch relative w-full
|
|
636
638
|
${ke ? `cursor-pointer hover:bg-[var(--malachite-table-row-hover-background,#fafafa)] ${vt}` : ""}
|
|
637
|
-
${(
|
|
639
|
+
${(_ == null ? void 0 : _(s, l)) || ""}
|
|
638
640
|
`,
|
|
639
641
|
style: {
|
|
640
642
|
...Yt,
|
|
@@ -680,7 +682,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
680
682
|
e.map(($) => /* @__PURE__ */ m($e.Fragment, { children: [
|
|
681
683
|
f($),
|
|
682
684
|
/* @__PURE__ */ r(
|
|
683
|
-
|
|
685
|
+
Bn,
|
|
684
686
|
{
|
|
685
687
|
column: $,
|
|
686
688
|
record: s,
|
|
@@ -707,7 +709,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
707
709
|
minHeight: et
|
|
708
710
|
},
|
|
709
711
|
children: e.map((d) => {
|
|
710
|
-
const
|
|
712
|
+
const A = (d.title === "" || d.title == null) && d.width !== void 0 ? /* @__PURE__ */ r(
|
|
711
713
|
"div",
|
|
712
714
|
{
|
|
713
715
|
className: `flex items-center ${_t(d.align)} shrink-0 overflow-clip px-4 ${le}`,
|
|
@@ -730,7 +732,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
730
732
|
);
|
|
731
733
|
return /* @__PURE__ */ m($e.Fragment, { children: [
|
|
732
734
|
f(d),
|
|
733
|
-
|
|
735
|
+
A
|
|
734
736
|
] }, d.key);
|
|
735
737
|
})
|
|
736
738
|
},
|
|
@@ -758,22 +760,22 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
758
760
|
/* @__PURE__ */ m(
|
|
759
761
|
"div",
|
|
760
762
|
{
|
|
761
|
-
className: `${ln} flex flex-col items-start ${
|
|
763
|
+
className: `${ln} flex flex-col items-start ${B ? "" : "overflow-clip"} relative w-full`,
|
|
762
764
|
children: [
|
|
763
|
-
!D &&
|
|
765
|
+
!D && o,
|
|
764
766
|
D && /* @__PURE__ */ m(
|
|
765
767
|
"div",
|
|
766
768
|
{
|
|
767
769
|
ref: tt,
|
|
768
770
|
style: {
|
|
769
|
-
...
|
|
771
|
+
...B ? {
|
|
770
772
|
position: "sticky",
|
|
771
773
|
top: Re,
|
|
772
774
|
zIndex: 8,
|
|
773
775
|
// A title row sits on the frame, as a framed Card's
|
|
774
776
|
// does; the header colour goes behind the column
|
|
775
777
|
// headers alone.
|
|
776
|
-
backgroundColor:
|
|
778
|
+
backgroundColor: o ? "var(--malachite-table-background, #f7f7f7)" : Ye,
|
|
777
779
|
marginInline: -se,
|
|
778
780
|
width: `calc(100% + ${se * 2}px)`,
|
|
779
781
|
paddingInline: se,
|
|
@@ -784,8 +786,8 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
784
786
|
} : { width: "100%" }
|
|
785
787
|
},
|
|
786
788
|
children: [
|
|
787
|
-
|
|
788
|
-
|
|
789
|
+
B && /* @__PURE__ */ r(In, {}),
|
|
790
|
+
o,
|
|
789
791
|
/* @__PURE__ */ r(
|
|
790
792
|
"div",
|
|
791
793
|
{
|
|
@@ -799,7 +801,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
799
801
|
...xn,
|
|
800
802
|
paddingRight: Ht
|
|
801
803
|
} : {},
|
|
802
|
-
...
|
|
804
|
+
...B && o ? { backgroundColor: Ye } : {}
|
|
803
805
|
},
|
|
804
806
|
children: F
|
|
805
807
|
}
|
|
@@ -822,14 +824,14 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
822
824
|
// With an external virtual scroller the body is overflow-visible and
|
|
823
825
|
// a bounded box would overlap content below it.
|
|
824
826
|
...L && ze ? {
|
|
825
|
-
maxHeight: pe ? We : Tn(L, !!
|
|
827
|
+
maxHeight: pe ? We : Tn(L, !!C)
|
|
826
828
|
} : {}
|
|
827
829
|
},
|
|
828
830
|
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
831
|
/* @__PURE__ */ r("div", { className: "text-[var(--malachite-text-secondary)] text-[14px] font-medium mb-1", children: w }),
|
|
830
832
|
/* @__PURE__ */ r("div", { className: "text-[var(--malachite-text-secondary)] text-[13px]", children: u })
|
|
831
|
-
] }) }) :
|
|
832
|
-
const s =
|
|
833
|
+
] }) }) : a ? /* @__PURE__ */ r("div", { className: "flex flex-col w-full", style: h, children: (() => {
|
|
834
|
+
const s = C != null && C.pageSize ? Math.min(C.pageSize, 10) : 5;
|
|
833
835
|
return Array.from({ length: s }).map(
|
|
834
836
|
(l, d) => k(d, d === s - 1)
|
|
835
837
|
);
|
|
@@ -857,8 +859,8 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
857
859
|
className: "flex flex-col w-full",
|
|
858
860
|
style: h,
|
|
859
861
|
children: d.map(
|
|
860
|
-
(
|
|
861
|
-
|
|
862
|
+
(A, V) => v(
|
|
863
|
+
A,
|
|
862
864
|
I + V,
|
|
863
865
|
V === d.length - 1,
|
|
864
866
|
V === 0
|
|
@@ -867,14 +869,14 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
867
869
|
},
|
|
868
870
|
`section-card-${N}`
|
|
869
871
|
);
|
|
870
|
-
if (
|
|
872
|
+
if (Be.size === 0)
|
|
871
873
|
return s(W, 0, "all");
|
|
872
|
-
const l = [...
|
|
874
|
+
const l = [...Be.keys()].sort((d, I) => d - I);
|
|
873
875
|
return l.map((d, I) => {
|
|
874
|
-
const N =
|
|
876
|
+
const N = Be.get(d);
|
|
875
877
|
if (!N)
|
|
876
878
|
return null;
|
|
877
|
-
const
|
|
879
|
+
const A = I + 1 < l.length ? l[I + 1] : W.length, V = W.slice(d, A), x = _e == null ? void 0 : _e(
|
|
878
880
|
N.key,
|
|
879
881
|
N.records
|
|
880
882
|
);
|
|
@@ -1020,7 +1022,7 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
1020
1022
|
style: { borderSpacing: "0" },
|
|
1021
1023
|
children: [
|
|
1022
1024
|
D && /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ r("tr", { children: e.map((t, i) => jt(t, i)) }) }),
|
|
1023
|
-
/* @__PURE__ */ r("tbody", { children:
|
|
1025
|
+
/* @__PURE__ */ r("tbody", { children: a ? Array.from({ length: 5 }).map((t, i) => /* @__PURE__ */ r(
|
|
1024
1026
|
"tr",
|
|
1025
1027
|
{
|
|
1026
1028
|
className: `table-row ${p ? "table-row-bordered" : ""}`,
|
|
@@ -1046,9 +1048,9 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
1046
1048
|
] })
|
|
1047
1049
|
}
|
|
1048
1050
|
) }) : W.map((t, i) => {
|
|
1049
|
-
const f =
|
|
1051
|
+
const f = Ae(t, i), o = (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 || o.onClick ? () => {
|
|
1050
1052
|
var l;
|
|
1051
|
-
T == null || T(t, i), (l =
|
|
1053
|
+
T == null || T(t, i), (l = o.onClick) == null || l.call(o, t, i);
|
|
1052
1054
|
} : void 0;
|
|
1053
1055
|
return (
|
|
1054
1056
|
// Keeps `row` semantics: `role="button"` would strip the table
|
|
@@ -1063,27 +1065,27 @@ const Ct = 160, hn = (e, n) => e.length === n.length && e.every((o, c) => o ===
|
|
|
1063
1065
|
onKeyDown: s ? ut(i, s) : void 0,
|
|
1064
1066
|
className: `
|
|
1065
1067
|
${p ? "table-row-bordered" : `table-row ${k ? "" : "hover:opacity-80"}`}
|
|
1066
|
-
${(
|
|
1068
|
+
${(_ == null ? void 0 : _(t, i)) || ""}
|
|
1067
1069
|
${s ? `cursor-pointer ${vt}` : ""}
|
|
1068
1070
|
`,
|
|
1069
1071
|
onClick: s ? (l) => {
|
|
1070
1072
|
xt(l) || s();
|
|
1071
1073
|
} : void 0,
|
|
1072
|
-
onDoubleClick:
|
|
1074
|
+
onDoubleClick: o.onDoubleClick ? () => {
|
|
1073
1075
|
var l;
|
|
1074
|
-
return (l =
|
|
1076
|
+
return (l = o.onDoubleClick) == null ? void 0 : l.call(o, t, i);
|
|
1075
1077
|
} : void 0,
|
|
1076
|
-
onContextMenu:
|
|
1078
|
+
onContextMenu: o.onContextMenu ? () => {
|
|
1077
1079
|
var l;
|
|
1078
|
-
return (l =
|
|
1080
|
+
return (l = o.onContextMenu) == null ? void 0 : l.call(o, t, i);
|
|
1079
1081
|
} : void 0,
|
|
1080
|
-
onMouseEnter:
|
|
1082
|
+
onMouseEnter: o.onMouseEnter ? () => {
|
|
1081
1083
|
var l;
|
|
1082
|
-
return (l =
|
|
1084
|
+
return (l = o.onMouseEnter) == null ? void 0 : l.call(o, t, i);
|
|
1083
1085
|
} : void 0,
|
|
1084
|
-
onMouseLeave:
|
|
1086
|
+
onMouseLeave: o.onMouseLeave ? () => {
|
|
1085
1087
|
var l;
|
|
1086
|
-
return (l =
|
|
1088
|
+
return (l = o.onMouseLeave) == null ? void 0 : l.call(o, t, i);
|
|
1087
1089
|
} : void 0,
|
|
1088
1090
|
children: e.map((l) => {
|
|
1089
1091
|
const d = l === e[0], I = l === e[e.length - 1];
|