@pibit.ai/cure-design-system 0.5.10 → 0.5.12
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/dist/patterns/table/rowReorderDrag.js +4 -4
- package/dist/patterns/table/toolbar/ColumnHeaderMenu.d.ts.map +1 -1
- package/dist/patterns/table/toolbar/ColumnHeaderMenu.js +160 -139
- package/dist/patterns/table-component/TableComponent.d.ts +1 -1
- package/dist/patterns/table-component/TableComponent.d.ts.map +1 -1
- package/dist/patterns/table-component/TableComponent.js +996 -580
- package/dist/patterns/table-component/columnReorderDrag.d.ts +41 -0
- package/dist/patterns/table-component/columnReorderDrag.d.ts.map +1 -0
- package/dist/patterns/table-component/columnReorderDrag.js +55 -0
- package/dist/patterns/table-component/columnReorderDrag.test.d.ts +2 -0
- package/dist/patterns/table-component/columnReorderDrag.test.d.ts.map +1 -0
- package/dist/patterns/table-component/types.d.ts +8 -0
- package/dist/patterns/table-component/types.d.ts.map +1 -1
- package/dist/styles/components.css +1 -1
- package/dist/styles/theme.css +1 -1
- package/package.json +1 -1
|
@@ -1,485 +1,861 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef 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
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { jsx as s, jsxs as x, Fragment as Bt } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as jt, useCallback as f, useMemo as M, useRef as S, useState as K, useLayoutEffect as Pt, useSyncExternalStore as or, useEffect as ir, Fragment as sr, useImperativeHandle as lr } from "react";
|
|
3
|
+
import { createPortal as nt } from "react-dom";
|
|
4
|
+
import { functionalUpdate as Yt, useTable as ar } from "@tanstack/react-table";
|
|
5
|
+
import { ArrowDown as cr, ChevronSelectorVertical as dr, ChevronRight as Wt } from "@untitledui/icons";
|
|
6
|
+
import { Checkbox as Ot } from "../../primitives/checkbox/checkbox.js";
|
|
7
|
+
import { ShimmerLine as ur } from "../../primitives/shimmer/shimmer.js";
|
|
8
|
+
import { cn as w } from "../../utils/cn.js";
|
|
9
|
+
import { selectionFromSingleCell as mr, getCellRangeVisualState as pr, cellRangeEdgeBoxShadow as fr } from "../table/cellRangeSelection.js";
|
|
10
|
+
import { useCellRangeSelection as gr } from "./useCellRangeSelection.js";
|
|
11
|
+
import { useRowReorderDrag as hr } from "./useRowReorderDrag.js";
|
|
12
|
+
import { GridNavProvider as br } from "../table/useGridKeyboardNavigation.js";
|
|
13
|
+
import { ROW_DRAG_SOURCE_STYLE as wr, ROW_SOURCE_INDEX_ATTR as xr, ROW_REORDER_ATTR as yr, FloatingRowPreview as vr, DropIndicatorLine as Cr } from "../table/rowReorderDrag.js";
|
|
14
|
+
import { buildTableComponentColumns as Sr } from "./buildTableColumns.js";
|
|
15
|
+
import { resolveColumnDropTarget as Ir, getRenderedColumnPreviewValues as Er, previewCellValue as Lr, getColumnDragViewport as Rr, COLUMN_REORDER_PARENT_ATTR as Nr, COLUMN_REORDER_ID_ATTR as Tr, getColumnDragScrollDelta as Dr, COLUMN_DRAG_THRESHOLD_PX as Mt } from "./columnReorderDrag.js";
|
|
16
|
+
import { HEADER_PADDING_CLASS as _r, ROW_HEIGHT_CLASS as kt, CELL_PADDING_CLASS as At } from "./rowMetrics.js";
|
|
17
|
+
import { tableComponentFeatures as zr } from "./tableFeatures.js";
|
|
18
|
+
import { TableZoomControl as Pr } from "../table/TableZoomControl.js";
|
|
19
|
+
import { useFitTableToViewport as Wr } from "../table/useFitTableToViewport.js";
|
|
20
|
+
import { useTableZoomState as Or } from "../table/useTableZoomState.js";
|
|
21
|
+
import { DEFAULT_TABLE_ZOOM_MIN as Mr, parsePxValue as De, DEFAULT_ZOOMABLE_COLUMN_MIN_WIDTH as Qe, supportsCssZoom as kr, computeFillBaseWidth as Ar, computeEffectiveTableWidth as Fr, computeFlexColumnWidth as Vr, getTableZoomFontSize as $r, computeNeedsHorizontalScroll as Hr, DEFAULT_COLUMN_MAX_WIDTH as Xr } from "../table/tableZoomLayout.js";
|
|
22
|
+
const Ur = 5, Br = 120, jr = 800, Yr = ({ preview: o }) => nt(
|
|
23
|
+
/* @__PURE__ */ x(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
"aria-hidden": !0,
|
|
27
|
+
"data-column-drag-preview": "",
|
|
28
|
+
className: "pointer-events-none fixed z-(--z-index-drag-overlay) overflow-hidden rounded-md bg-primary shadow-lg cursor-grabbing",
|
|
29
|
+
style: {
|
|
30
|
+
left: o.left + 12,
|
|
31
|
+
top: o.top + 12,
|
|
32
|
+
width: o.width,
|
|
33
|
+
height: o.height,
|
|
34
|
+
border: "1px solid var(--color-border-brand, var(--color-brand-500, #7f56d9))"
|
|
35
|
+
},
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ s("div", { className: "flex h-9 items-center truncate bg-secondary_subtle px-3 text-xs font-medium text-secondary", children: o.label }),
|
|
38
|
+
o.values.map((l, u) => /* @__PURE__ */ s(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
className: "flex h-9 items-center truncate border-t border-secondary px-3 text-xs text-secondary",
|
|
42
|
+
children: l
|
|
43
|
+
},
|
|
44
|
+
`${o.columnId}-${u}`
|
|
45
|
+
))
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
document.body
|
|
50
|
+
), Kr = ({
|
|
51
|
+
target: o
|
|
52
|
+
}) => nt(
|
|
53
|
+
/* @__PURE__ */ s(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
"aria-hidden": !0,
|
|
57
|
+
className: "pointer-events-none fixed z-(--z-index-drag-indicator) w-0.5 bg-brand-600",
|
|
58
|
+
style: {
|
|
59
|
+
left: o.lineLeft - 1,
|
|
60
|
+
top: o.lineTop,
|
|
61
|
+
height: o.lineHeight
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
document.body
|
|
66
|
+
), Zr = jt(
|
|
67
|
+
function(l, u) {
|
|
68
|
+
const y = S(null), I = S(null);
|
|
69
|
+
return lr(
|
|
70
|
+
u,
|
|
71
|
+
() => ({
|
|
72
|
+
show: (g, E) => {
|
|
73
|
+
const h = I.current, A = y.current;
|
|
74
|
+
!h || !A || (h.style.display = "", h.style.left = `${g.lineLeft}px`, h.style.top = `${g.top}px`, h.style.height = `${g.height}px`, h.style.opacity = E ? "1" : "0.7", A.style.display = E ? "" : "none", A.style.left = `${g.columnLeft}px`, A.style.top = `${g.top}px`, A.style.height = `${g.height}px`);
|
|
75
|
+
},
|
|
76
|
+
hide: () => {
|
|
77
|
+
I.current && (I.current.style.display = "none"), y.current && (y.current.style.display = "none");
|
|
78
|
+
}
|
|
79
|
+
}),
|
|
80
|
+
[]
|
|
81
|
+
), nt(
|
|
82
|
+
/* @__PURE__ */ x(Bt, { children: [
|
|
83
|
+
/* @__PURE__ */ s(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
ref: y,
|
|
87
|
+
"aria-hidden": !0,
|
|
88
|
+
className: "pointer-events-none fixed z-(--z-index-drag-indicator) w-px bg-border-secondary",
|
|
89
|
+
style: { display: "none" }
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ s(
|
|
93
|
+
"div",
|
|
94
|
+
{
|
|
95
|
+
ref: I,
|
|
96
|
+
"aria-hidden": !0,
|
|
97
|
+
"data-column-resize-guide": "",
|
|
98
|
+
className: "pointer-events-none fixed z-(--z-index-drag-indicator) w-px bg-brand-600",
|
|
99
|
+
style: { display: "none" }
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
] }),
|
|
103
|
+
document.body
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
), Gr = () => or(
|
|
107
|
+
() => () => {
|
|
108
|
+
},
|
|
109
|
+
() => !0,
|
|
110
|
+
() => !1
|
|
111
|
+
), qr = kr(), Jr = (o) => o === "center" ? "text-center" : o === "right" ? "text-right" : "text-left", Ft = (o) => o === "center" ? "justify-center" : o === "right" ? "justify-end" : "justify-start", Te = (o, l) => {
|
|
112
|
+
const u = o.__sourceIndex;
|
|
113
|
+
return typeof u == "number" ? u : Number.isFinite(l) ? l : null;
|
|
114
|
+
}, Vt = (o) => o instanceof HTMLElement && !!o.closest(
|
|
24
115
|
'button,a,input,textarea,select,[contenteditable]:not([contenteditable="false"]),[role="button"],[role="menuitem"]'
|
|
25
|
-
),
|
|
26
|
-
const [
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
(
|
|
30
|
-
var
|
|
31
|
-
const
|
|
32
|
-
|
|
116
|
+
), ne = (o, l, u) => {
|
|
117
|
+
const [y, I] = K(l), g = o ?? y, E = S(g), h = S(u);
|
|
118
|
+
E.current = g, h.current = u;
|
|
119
|
+
const A = f(
|
|
120
|
+
(_) => {
|
|
121
|
+
var z;
|
|
122
|
+
const V = Yt(_, E.current);
|
|
123
|
+
E.current = V, o === void 0 && I(V), (z = h.current) == null || z.call(h, V);
|
|
33
124
|
},
|
|
34
|
-
[
|
|
125
|
+
[o]
|
|
35
126
|
);
|
|
36
|
-
return [
|
|
37
|
-
},
|
|
38
|
-
if (!
|
|
39
|
-
const
|
|
127
|
+
return [g, A];
|
|
128
|
+
}, $t = (o, l) => {
|
|
129
|
+
if (!o) return;
|
|
130
|
+
const u = o.sticky ? {
|
|
40
131
|
position: "sticky",
|
|
41
|
-
[
|
|
132
|
+
[o.sticky]: o.stickyOffset ?? 0,
|
|
42
133
|
zIndex: l ? 30 : 20,
|
|
43
134
|
backgroundColor: l ? "var(--color-bg-secondary-subtle)" : "var(--color-bg-primary)",
|
|
44
|
-
boxShadow: l || !
|
|
135
|
+
boxShadow: l || !o.sticky ? void 0 : o.sticky === "right" ? "inset 2px 0 0 0 var(--color-border-tertiary)" : "inset -2px 0 0 0 var(--color-border-tertiary)"
|
|
45
136
|
} : {};
|
|
46
137
|
return {
|
|
47
|
-
width:
|
|
48
|
-
minWidth:
|
|
49
|
-
maxWidth:
|
|
50
|
-
...
|
|
138
|
+
width: o.width,
|
|
139
|
+
minWidth: o.minWidth ?? o.width ?? `${_e}px`,
|
|
140
|
+
maxWidth: o.maxWidth ?? Xr,
|
|
141
|
+
...u
|
|
51
142
|
};
|
|
52
|
-
},
|
|
53
|
-
if (
|
|
54
|
-
if (
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
143
|
+
}, _e = 120, Ht = (o) => {
|
|
144
|
+
if (typeof o == "number") return Number.isFinite(o) ? o : void 0;
|
|
145
|
+
if (typeof o != "string") return;
|
|
146
|
+
const l = o.trim().match(/^(\d+(?:\.\d+)?)px$/);
|
|
147
|
+
return l ? Number(l[1]) : void 0;
|
|
148
|
+
}, Qr = (o, l) => {
|
|
149
|
+
const u = Ht(o == null ? void 0 : o.minWidth) ?? l, y = Math.max(
|
|
150
|
+
u,
|
|
151
|
+
Ht(o == null ? void 0 : o.maxWidth) ?? jr
|
|
152
|
+
);
|
|
153
|
+
return { min: u, max: y };
|
|
154
|
+
}, et = (o, l, u) => {
|
|
155
|
+
const { min: y, max: I } = Qr(o, u);
|
|
156
|
+
return Math.round(Math.min(I, Math.max(y, l)));
|
|
157
|
+
}, Xt = (o, l) => {
|
|
158
|
+
if (!l) return;
|
|
159
|
+
const u = o[l];
|
|
160
|
+
return typeof u == "number" && Number.isFinite(u) ? u : void 0;
|
|
161
|
+
}, tt = (o) => !!(o.maxWidth && o.sticky === "right"), eo = (o, l = _e) => De(o.minWidth) || l, Ut = (o, l, u, y) => {
|
|
162
|
+
if (l === "multiple") return o;
|
|
163
|
+
if (o === !0) return y ? { [y]: !0 } : {};
|
|
164
|
+
const I = u && u !== !0 ? new Set(
|
|
165
|
+
Object.keys(u).filter((h) => u[h])
|
|
166
|
+
) : /* @__PURE__ */ new Set(), g = Object.keys(o).filter((h) => o[h]), E = g.find((h) => !I.has(h)) ?? g[0];
|
|
167
|
+
return E ? { [E]: !0 } : {};
|
|
59
168
|
};
|
|
60
|
-
function
|
|
61
|
-
data:
|
|
169
|
+
function to({
|
|
170
|
+
data: o,
|
|
62
171
|
columns: l,
|
|
63
|
-
getRowId:
|
|
64
|
-
ariaLabel:
|
|
65
|
-
headerGroups:
|
|
66
|
-
size:
|
|
67
|
-
loading:
|
|
68
|
-
loadingRowCount:
|
|
69
|
-
emptyState:
|
|
70
|
-
showBorders:
|
|
71
|
-
removeRowBorders:
|
|
72
|
-
fillWidth:
|
|
73
|
-
zoom:
|
|
74
|
-
zoomDisabled:
|
|
75
|
-
className:
|
|
76
|
-
rootClassName:
|
|
77
|
-
tableClassName:
|
|
78
|
-
headerClassName:
|
|
79
|
-
getRowClassName:
|
|
80
|
-
onRowClick:
|
|
81
|
-
onRowHover:
|
|
82
|
-
toolbar:
|
|
83
|
-
renderToolbar:
|
|
84
|
-
pagination:
|
|
85
|
-
summaryRow:
|
|
86
|
-
rowGroups:
|
|
87
|
-
renderGroupHeader:
|
|
88
|
-
collapsedGroupIds:
|
|
89
|
-
defaultCollapsedGroupIds:
|
|
90
|
-
onCollapsedGroupIdsChange:
|
|
91
|
-
enableSorting:
|
|
92
|
-
sorting:
|
|
93
|
-
defaultSorting:
|
|
94
|
-
onSortingChange:
|
|
95
|
-
columnVisibility:
|
|
96
|
-
defaultColumnVisibility:
|
|
97
|
-
onColumnVisibilityChange:
|
|
98
|
-
columnOrder:
|
|
99
|
-
defaultColumnOrder:
|
|
100
|
-
onColumnOrderChange:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
), [
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
), [
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
), [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
), [
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
),
|
|
145
|
-
|
|
146
|
-
|
|
172
|
+
getRowId: u,
|
|
173
|
+
ariaLabel: y,
|
|
174
|
+
headerGroups: I,
|
|
175
|
+
size: g = "xs",
|
|
176
|
+
loading: E = !1,
|
|
177
|
+
loadingRowCount: h = Ur,
|
|
178
|
+
emptyState: A = "No data found",
|
|
179
|
+
showBorders: _ = !1,
|
|
180
|
+
removeRowBorders: V = !1,
|
|
181
|
+
fillWidth: z = !1,
|
|
182
|
+
zoom: Kt,
|
|
183
|
+
zoomDisabled: Zt = !1,
|
|
184
|
+
className: rt,
|
|
185
|
+
rootClassName: Gt,
|
|
186
|
+
tableClassName: qt,
|
|
187
|
+
headerClassName: Jt,
|
|
188
|
+
getRowClassName: ze,
|
|
189
|
+
onRowClick: Pe,
|
|
190
|
+
onRowHover: ue,
|
|
191
|
+
toolbar: Qt,
|
|
192
|
+
renderToolbar: We,
|
|
193
|
+
pagination: ot,
|
|
194
|
+
summaryRow: en,
|
|
195
|
+
rowGroups: re,
|
|
196
|
+
renderGroupHeader: Oe,
|
|
197
|
+
collapsedGroupIds: tn,
|
|
198
|
+
defaultCollapsedGroupIds: nn = [],
|
|
199
|
+
onCollapsedGroupIdsChange: rn,
|
|
200
|
+
enableSorting: it = !1,
|
|
201
|
+
sorting: on,
|
|
202
|
+
defaultSorting: sn = [],
|
|
203
|
+
onSortingChange: ln,
|
|
204
|
+
columnVisibility: an,
|
|
205
|
+
defaultColumnVisibility: cn = {},
|
|
206
|
+
onColumnVisibilityChange: dn,
|
|
207
|
+
columnOrder: un,
|
|
208
|
+
defaultColumnOrder: mn = [],
|
|
209
|
+
onColumnOrderChange: pn,
|
|
210
|
+
enableColumnReorder: fn = !1,
|
|
211
|
+
enableColumnResize: gn = !1,
|
|
212
|
+
columnWidths: oe = {},
|
|
213
|
+
onColumnWidthsChange: me,
|
|
214
|
+
selectionMode: pe = "none",
|
|
215
|
+
rowSelection: hn,
|
|
216
|
+
defaultRowSelection: bn = {},
|
|
217
|
+
onRowSelectionChange: wn,
|
|
218
|
+
expanded: xn,
|
|
219
|
+
defaultExpanded: yn = {},
|
|
220
|
+
onExpandedChange: vn,
|
|
221
|
+
expansionMode: Me = "multiple",
|
|
222
|
+
getRowCanExpand: ke,
|
|
223
|
+
renderExpandedContent: fe,
|
|
224
|
+
onCellClick: Ae,
|
|
225
|
+
onCellDoubleClick: Fe,
|
|
226
|
+
onCellActivate: Z,
|
|
227
|
+
cellSelection: ge,
|
|
228
|
+
onCellSelectionChange: ie,
|
|
229
|
+
onCopyCells: Cn,
|
|
230
|
+
onPasteCells: Sn,
|
|
231
|
+
onClearCells: In,
|
|
232
|
+
onReorderRows: st,
|
|
233
|
+
enableRowReorder: En,
|
|
234
|
+
activateOnSingleClick: Ln
|
|
235
|
+
}, he) {
|
|
236
|
+
var _t;
|
|
237
|
+
const { zoomConfig: $, zoomPercent: se, setZoomPercent: lt } = Or(Kt), R = $ !== null && qr, H = R ? se / 100 : 1, be = R ? $r(se) : void 0, Rn = ($ == null ? void 0 : $.minZoom) ?? Mr, le = R ? De(Qe) : Br, [Nn, Tn] = ne(
|
|
238
|
+
on,
|
|
239
|
+
sn,
|
|
240
|
+
ln
|
|
241
|
+
), [Dn, _n] = ne(
|
|
242
|
+
an,
|
|
243
|
+
cn,
|
|
244
|
+
dn
|
|
245
|
+
), [zn, Ve] = ne(
|
|
246
|
+
un,
|
|
247
|
+
mn,
|
|
248
|
+
pn
|
|
249
|
+
), [Pn, Wn] = ne(
|
|
250
|
+
hn,
|
|
251
|
+
bn,
|
|
252
|
+
wn
|
|
253
|
+
), [On, at] = ne(
|
|
254
|
+
xn,
|
|
255
|
+
yn,
|
|
256
|
+
vn
|
|
257
|
+
), $e = o.length > 0 ? u(o[0], 0) : void 0, Mn = Ut(
|
|
258
|
+
On,
|
|
259
|
+
Me,
|
|
147
260
|
void 0,
|
|
148
|
-
|
|
149
|
-
),
|
|
150
|
-
(
|
|
151
|
-
|
|
152
|
-
(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
261
|
+
$e
|
|
262
|
+
), kn = f(
|
|
263
|
+
(t) => {
|
|
264
|
+
at(
|
|
265
|
+
(e) => Ut(
|
|
266
|
+
Yt(t, e),
|
|
267
|
+
Me,
|
|
268
|
+
e,
|
|
269
|
+
$e
|
|
157
270
|
)
|
|
158
271
|
);
|
|
159
272
|
},
|
|
160
|
-
[
|
|
161
|
-
), [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
),
|
|
166
|
-
() => new Set(
|
|
167
|
-
[
|
|
168
|
-
),
|
|
169
|
-
(
|
|
170
|
-
(
|
|
273
|
+
[Me, $e, at]
|
|
274
|
+
), [ct, dt] = ne(
|
|
275
|
+
tn,
|
|
276
|
+
nn,
|
|
277
|
+
rn
|
|
278
|
+
), He = M(
|
|
279
|
+
() => new Set(ct),
|
|
280
|
+
[ct]
|
|
281
|
+
), An = f(
|
|
282
|
+
(t) => dt(
|
|
283
|
+
(e) => e.includes(t) ? e.filter((r) => r !== t) : [...e, t]
|
|
171
284
|
),
|
|
172
|
-
[
|
|
173
|
-
),
|
|
174
|
-
containerRef:
|
|
175
|
-
zoomConfig:
|
|
176
|
-
zoomPercent:
|
|
177
|
-
setZoomPercent:
|
|
285
|
+
[dt]
|
|
286
|
+
), F = S(null), [ae, ut] = K(null), Fn = Wr({
|
|
287
|
+
containerRef: F,
|
|
288
|
+
zoomConfig: $,
|
|
289
|
+
zoomPercent: se,
|
|
290
|
+
setZoomPercent: lt
|
|
178
291
|
});
|
|
179
|
-
|
|
180
|
-
if (!
|
|
181
|
-
|
|
292
|
+
Pt(() => {
|
|
293
|
+
if (!z) {
|
|
294
|
+
ut(null);
|
|
182
295
|
return;
|
|
183
296
|
}
|
|
184
|
-
const
|
|
185
|
-
if (!
|
|
186
|
-
const
|
|
187
|
-
const n =
|
|
188
|
-
n > 0 &&
|
|
189
|
-
(
|
|
297
|
+
const t = F.current;
|
|
298
|
+
if (!t || typeof ResizeObserver > "u") return;
|
|
299
|
+
const e = () => {
|
|
300
|
+
const n = t.clientWidth;
|
|
301
|
+
n > 0 && ut(
|
|
302
|
+
(i) => i === n ? i : n
|
|
190
303
|
);
|
|
191
304
|
};
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
return
|
|
195
|
-
}, [
|
|
196
|
-
const
|
|
197
|
-
if (!
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
0
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
(
|
|
204
|
-
|
|
205
|
-
|
|
305
|
+
e();
|
|
306
|
+
const r = new ResizeObserver(e);
|
|
307
|
+
return r.observe(t), () => r.disconnect();
|
|
308
|
+
}, [z, l.length, o.length, E]);
|
|
309
|
+
const N = M(() => {
|
|
310
|
+
if (!z) return null;
|
|
311
|
+
const t = (i) => {
|
|
312
|
+
const a = Xt(oe, i.id);
|
|
313
|
+
return a === void 0 ? void 0 : et(i, a, le);
|
|
314
|
+
}, e = l.reduce((i, a) => {
|
|
315
|
+
const d = t(a);
|
|
316
|
+
return d !== void 0 ? i + d : tt(a) ? i + De(a.maxWidth) : i;
|
|
317
|
+
}, 0), r = l.filter(
|
|
318
|
+
(i) => t(i) === void 0 && !tt(i)
|
|
319
|
+
);
|
|
320
|
+
return { minTableWidth: r.reduce(
|
|
321
|
+
(i, a) => i + eo(
|
|
322
|
+
a,
|
|
323
|
+
R ? De(Qe) : _e
|
|
206
324
|
),
|
|
207
325
|
0
|
|
208
|
-
) + e, fixedTotal: e, flexibleCount:
|
|
209
|
-
}, [
|
|
210
|
-
() =>
|
|
211
|
-
[
|
|
212
|
-
),
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
),
|
|
217
|
-
() =>
|
|
218
|
-
[
|
|
219
|
-
),
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
), [
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
width:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
...
|
|
232
|
-
width:
|
|
233
|
-
minWidth:
|
|
326
|
+
) + e, fixedTotal: e, flexibleCount: r.length };
|
|
327
|
+
}, [z, l, oe, R, le]), Xe = M(
|
|
328
|
+
() => N ? Ar(ae, N.minTableWidth) : null,
|
|
329
|
+
[ae, N]
|
|
330
|
+
), Ue = Hr(
|
|
331
|
+
Xe,
|
|
332
|
+
ae,
|
|
333
|
+
H
|
|
334
|
+
), we = M(
|
|
335
|
+
() => Fr(Xe, ae, H),
|
|
336
|
+
[Xe, ae, H]
|
|
337
|
+
), mt = M(() => !N || N.flexibleCount === 0 ? null : Vr(
|
|
338
|
+
we,
|
|
339
|
+
N.fixedTotal,
|
|
340
|
+
N.flexibleCount
|
|
341
|
+
), [N, we]), xe = (t, e) => {
|
|
342
|
+
const r = Xt(oe, t == null ? void 0 : t.id);
|
|
343
|
+
if (r !== void 0) {
|
|
344
|
+
const i = `${et(t, r, le)}px`;
|
|
345
|
+
return { ...$t(t, e), width: i, minWidth: i, maxWidth: i };
|
|
346
|
+
}
|
|
347
|
+
const n = $t(t, e);
|
|
348
|
+
return !z || !t ? n : tt(t) ? {
|
|
349
|
+
...n,
|
|
350
|
+
width: t.maxWidth,
|
|
351
|
+
minWidth: t.maxWidth,
|
|
352
|
+
maxWidth: t.maxWidth
|
|
353
|
+
} : mt == null ? n : {
|
|
354
|
+
...n,
|
|
355
|
+
width: `${mt}px`,
|
|
356
|
+
minWidth: t.minWidth ?? (R ? Qe : `${_e}px`)
|
|
234
357
|
};
|
|
235
|
-
},
|
|
236
|
-
() => new Map(l.map((
|
|
358
|
+
}, ce = M(
|
|
359
|
+
() => new Map(l.map((t) => [t.id, t])),
|
|
237
360
|
[l]
|
|
238
|
-
),
|
|
239
|
-
() =>
|
|
240
|
-
[l,
|
|
241
|
-
),
|
|
242
|
-
features:
|
|
243
|
-
data:
|
|
244
|
-
columns:
|
|
245
|
-
getRowId:
|
|
246
|
-
enableSorting:
|
|
361
|
+
), Vn = M(
|
|
362
|
+
() => Sr(l, I),
|
|
363
|
+
[l, I]
|
|
364
|
+
), C = ar({
|
|
365
|
+
features: zr,
|
|
366
|
+
data: o,
|
|
367
|
+
columns: Vn,
|
|
368
|
+
getRowId: u,
|
|
369
|
+
enableSorting: it,
|
|
247
370
|
enableCellSpanning: !0,
|
|
248
|
-
enableRowSelection:
|
|
249
|
-
enableMultiRowSelection:
|
|
250
|
-
getRowCanExpand:
|
|
371
|
+
enableRowSelection: pe !== "none",
|
|
372
|
+
enableMultiRowSelection: pe === "multiple",
|
|
373
|
+
getRowCanExpand: ke && fe ? (t) => ke(t.original) : () => !1,
|
|
251
374
|
state: {
|
|
252
|
-
sorting:
|
|
253
|
-
columnVisibility:
|
|
254
|
-
columnOrder:
|
|
255
|
-
rowSelection:
|
|
256
|
-
expanded:
|
|
375
|
+
sorting: Nn,
|
|
376
|
+
columnVisibility: Dn,
|
|
377
|
+
columnOrder: zn,
|
|
378
|
+
rowSelection: Pn,
|
|
379
|
+
expanded: Mn
|
|
380
|
+
},
|
|
381
|
+
onSortingChange: Tn,
|
|
382
|
+
onColumnVisibilityChange: _n,
|
|
383
|
+
onColumnOrderChange: Ve,
|
|
384
|
+
onRowSelectionChange: Wn,
|
|
385
|
+
onExpandedChange: kn
|
|
386
|
+
}), [Be, pt] = K(null), [ft, gt] = K(null), [ht, je] = K(null), X = S(null), de = S(null), B = S(0), Ye = fn && l.length > 1, ye = gn && !!me, T = S(null), j = S(null), bt = S(oe);
|
|
387
|
+
bt.current = oe;
|
|
388
|
+
const [wt, xt] = K(null), G = S(null), k = S(null), $n = Gr(), Y = C.getRowModel().rows, q = f(() => {
|
|
389
|
+
var t;
|
|
390
|
+
(t = de.current) == null || t.call(de), de.current = null, B.current && (cancelAnimationFrame(B.current), B.current = 0);
|
|
391
|
+
}, []), yt = f(() => {
|
|
392
|
+
X.current = null, pt(null), gt(null), je(null);
|
|
393
|
+
}, []), vt = f(
|
|
394
|
+
(t, e, r) => {
|
|
395
|
+
if (t === e) return;
|
|
396
|
+
const n = C.getAllLeafColumns().map((p) => p.id), i = n.indexOf(t), a = n.indexOf(e);
|
|
397
|
+
if (i < 0 || a < 0) return;
|
|
398
|
+
const d = n.filter(
|
|
399
|
+
(p) => p !== t
|
|
400
|
+
), P = d.indexOf(e);
|
|
401
|
+
d.splice(
|
|
402
|
+
P + (r === "after" ? 1 : 0),
|
|
403
|
+
0,
|
|
404
|
+
t
|
|
405
|
+
), Ve(d);
|
|
406
|
+
},
|
|
407
|
+
[Ve, C]
|
|
408
|
+
), ve = f(
|
|
409
|
+
(t, e, r) => {
|
|
410
|
+
const n = Ir(t, e, r);
|
|
411
|
+
r.dropTarget = n, gt(n);
|
|
412
|
+
},
|
|
413
|
+
[]
|
|
414
|
+
), Ce = f(
|
|
415
|
+
(t) => {
|
|
416
|
+
const e = X.current, r = e == null ? void 0 : e.dropTarget, n = e == null ? void 0 : e.columnId, i = e == null ? void 0 : e.started;
|
|
417
|
+
q(), yt(), t && i && r && n && vt(n, r.columnId, r.position);
|
|
418
|
+
},
|
|
419
|
+
[
|
|
420
|
+
yt,
|
|
421
|
+
q,
|
|
422
|
+
vt
|
|
423
|
+
]
|
|
424
|
+
), Ct = f(() => {
|
|
425
|
+
if (B.current) return;
|
|
426
|
+
const t = () => {
|
|
427
|
+
var n;
|
|
428
|
+
const e = X.current;
|
|
429
|
+
if (!(e != null && e.started)) {
|
|
430
|
+
B.current = 0;
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
const r = (n = e.tableViewport) == null ? void 0 : n.scrollContainer;
|
|
434
|
+
if (r) {
|
|
435
|
+
const i = Dr(r, e.currentX);
|
|
436
|
+
i !== 0 && (r.scrollLeft += i, ve(e.currentX, e.currentY, e));
|
|
437
|
+
}
|
|
438
|
+
B.current = requestAnimationFrame(t);
|
|
439
|
+
};
|
|
440
|
+
B.current = requestAnimationFrame(t);
|
|
441
|
+
}, [ve]), St = f(
|
|
442
|
+
(t, e) => {
|
|
443
|
+
const r = Er(
|
|
444
|
+
F.current,
|
|
445
|
+
t,
|
|
446
|
+
e
|
|
447
|
+
);
|
|
448
|
+
return r.length > 0 ? r : C.getRowModel().rows.slice(0, e).map((n) => Lr(n.getValue(t)));
|
|
449
|
+
},
|
|
450
|
+
[C]
|
|
451
|
+
);
|
|
452
|
+
ir(
|
|
453
|
+
() => () => {
|
|
454
|
+
var t, e;
|
|
455
|
+
q(), (t = T.current) == null || t.call(T), T.current = null, (e = k.current) == null || e.call(k), k.current = null, j.current = null, X.current = null;
|
|
456
|
+
},
|
|
457
|
+
[q]
|
|
458
|
+
);
|
|
459
|
+
const J = f(
|
|
460
|
+
(t) => {
|
|
461
|
+
var a;
|
|
462
|
+
const e = t == null ? void 0 : t.getBoundingClientRect(), r = (a = F.current) == null ? void 0 : a.getBoundingClientRect();
|
|
463
|
+
if (!e || !r) return null;
|
|
464
|
+
const n = e.top, i = r.width > 0 ? Math.min(
|
|
465
|
+
Math.max(e.right, r.left),
|
|
466
|
+
r.right - 1
|
|
467
|
+
) : e.right;
|
|
468
|
+
return {
|
|
469
|
+
columnLeft: e.left,
|
|
470
|
+
lineLeft: i,
|
|
471
|
+
top: n,
|
|
472
|
+
height: Math.max(0, r.bottom - n)
|
|
473
|
+
};
|
|
474
|
+
},
|
|
475
|
+
[]
|
|
476
|
+
), It = f(
|
|
477
|
+
(t) => J(t.closest("th")),
|
|
478
|
+
[J]
|
|
479
|
+
), Et = f(() => {
|
|
480
|
+
const t = j.current, e = F.current;
|
|
481
|
+
if (!t || !e || e.scrollWidth <= e.clientWidth) return;
|
|
482
|
+
const r = t.getBoundingClientRect(), n = e.getBoundingClientRect(), i = r.right - n.right;
|
|
483
|
+
i > 0 && (e.scrollLeft += i);
|
|
484
|
+
}, []), Se = f(() => {
|
|
485
|
+
var e;
|
|
486
|
+
Et();
|
|
487
|
+
const t = J(j.current);
|
|
488
|
+
t && ((e = G.current) == null || e.show(t, !0));
|
|
489
|
+
}, [Et, J]), D = f(() => {
|
|
490
|
+
var t, e;
|
|
491
|
+
(t = k.current) == null || t.call(k), k.current = null, (e = G.current) == null || e.hide();
|
|
492
|
+
}, []), Lt = f(
|
|
493
|
+
(t) => {
|
|
494
|
+
var n;
|
|
495
|
+
if (j.current) return;
|
|
496
|
+
const e = It(t);
|
|
497
|
+
if (!e || ((n = G.current) == null || n.show(e, !1), k.current)) return;
|
|
498
|
+
const r = { capture: !0, passive: !0 };
|
|
499
|
+
window.addEventListener("scroll", D, r), window.addEventListener("wheel", D, r), window.addEventListener("touchmove", D, r), window.addEventListener("resize", D), k.current = () => {
|
|
500
|
+
window.removeEventListener("scroll", D, r), window.removeEventListener("wheel", D, r), window.removeEventListener("touchmove", D, r), window.removeEventListener("resize", D);
|
|
501
|
+
};
|
|
502
|
+
},
|
|
503
|
+
[It, D]
|
|
504
|
+
);
|
|
505
|
+
Pt(() => {
|
|
506
|
+
wt && Se();
|
|
507
|
+
});
|
|
508
|
+
const Hn = f(
|
|
509
|
+
(t, e) => {
|
|
510
|
+
var Ne, zt;
|
|
511
|
+
if (!ye || e.button !== 0 || !me)
|
|
512
|
+
return;
|
|
513
|
+
e.preventDefault(), e.stopPropagation(), (Ne = T.current) == null || Ne.call(T);
|
|
514
|
+
const r = e.currentTarget.closest("th");
|
|
515
|
+
if (!r) return;
|
|
516
|
+
const n = ce.get(t), i = r.getBoundingClientRect().width / H, a = e.clientX, d = e.pointerId, P = document.body.style.cursor, p = document.body.style.userSelect;
|
|
517
|
+
document.body.style.userSelect = "none";
|
|
518
|
+
const m = document.createElement("style");
|
|
519
|
+
m.textContent = "*, *::before, *::after { cursor: col-resize !important; }", document.head.appendChild(m), D(), j.current = r, xt(t);
|
|
520
|
+
const c = J(r);
|
|
521
|
+
c && ((zt = G.current) == null || zt.show(c, !0));
|
|
522
|
+
let b = null;
|
|
523
|
+
const W = () => {
|
|
524
|
+
var U, te;
|
|
525
|
+
(U = T.current) == null || U.call(T), T.current = null, j.current = null, xt(null), (te = G.current) == null || te.hide();
|
|
526
|
+
}, O = (U) => {
|
|
527
|
+
if (U.pointerId !== d) return;
|
|
528
|
+
U.preventDefault();
|
|
529
|
+
const te = et(
|
|
530
|
+
n,
|
|
531
|
+
i + (U.clientX - a) / H,
|
|
532
|
+
le
|
|
533
|
+
);
|
|
534
|
+
te !== b && (b = te, me({ ...bt.current, [t]: te }));
|
|
535
|
+
}, v = (U) => {
|
|
536
|
+
U.pointerId === d && W();
|
|
537
|
+
};
|
|
538
|
+
window.addEventListener("pointermove", O), window.addEventListener("pointerup", v), window.addEventListener("pointercancel", v), window.addEventListener("scroll", Se, !0), window.addEventListener("blur", W), T.current = () => {
|
|
539
|
+
window.removeEventListener("pointermove", O), window.removeEventListener("pointerup", v), window.removeEventListener("pointercancel", v), window.removeEventListener("scroll", Se, !0), window.removeEventListener("blur", W), m.remove(), document.body.style.cursor = P, document.body.style.userSelect = p;
|
|
540
|
+
};
|
|
257
541
|
},
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
542
|
+
[
|
|
543
|
+
ye,
|
|
544
|
+
ce,
|
|
545
|
+
D,
|
|
546
|
+
J,
|
|
547
|
+
me,
|
|
548
|
+
le,
|
|
549
|
+
Se,
|
|
550
|
+
H
|
|
551
|
+
]
|
|
552
|
+
), Xn = f(
|
|
553
|
+
(t, e, r) => {
|
|
554
|
+
if (Ye)
|
|
555
|
+
return {
|
|
556
|
+
[Tr]: t,
|
|
557
|
+
[Nr]: e,
|
|
558
|
+
onPointerDown: (n) => {
|
|
559
|
+
if (n.button !== 0 || n.target.closest(
|
|
560
|
+
"[data-column-reorder-ignore]"
|
|
561
|
+
))
|
|
562
|
+
return;
|
|
563
|
+
q();
|
|
564
|
+
const i = n.currentTarget.getBoundingClientRect();
|
|
565
|
+
X.current = {
|
|
566
|
+
columnId: t,
|
|
567
|
+
parentId: e,
|
|
568
|
+
label: r,
|
|
569
|
+
bounds: i,
|
|
570
|
+
tableViewport: Rr(n.currentTarget),
|
|
571
|
+
pointerId: n.pointerId,
|
|
572
|
+
startX: n.clientX,
|
|
573
|
+
startY: n.clientY,
|
|
574
|
+
currentX: n.clientX,
|
|
575
|
+
currentY: n.clientY,
|
|
576
|
+
started: !1,
|
|
577
|
+
dropTarget: null
|
|
578
|
+
};
|
|
579
|
+
try {
|
|
580
|
+
n.currentTarget.setPointerCapture(n.pointerId);
|
|
581
|
+
} catch {
|
|
582
|
+
}
|
|
583
|
+
const a = (m) => {
|
|
584
|
+
var W;
|
|
585
|
+
const c = X.current;
|
|
586
|
+
if (!c || c.pointerId !== m.pointerId) return;
|
|
587
|
+
c.currentX = m.clientX, c.currentY = m.clientY;
|
|
588
|
+
const b = Math.abs(m.clientX - c.startX) > Mt || Math.abs(m.clientY - c.startY) > Mt;
|
|
589
|
+
if (!(!c.started && !b)) {
|
|
590
|
+
if (m.preventDefault(), c.started)
|
|
591
|
+
je(
|
|
592
|
+
(O) => O && {
|
|
593
|
+
...O,
|
|
594
|
+
left: m.clientX,
|
|
595
|
+
top: m.clientY
|
|
596
|
+
}
|
|
597
|
+
);
|
|
598
|
+
else {
|
|
599
|
+
c.started = !0;
|
|
600
|
+
const O = ((W = c.tableViewport) == null ? void 0 : W.height) || c.bounds.height || 36, v = c.bounds.height || 36, Ne = Math.max(
|
|
601
|
+
1,
|
|
602
|
+
Math.ceil(
|
|
603
|
+
(O - v) / v
|
|
604
|
+
)
|
|
605
|
+
);
|
|
606
|
+
pt(c.columnId), je({
|
|
607
|
+
columnId: c.columnId,
|
|
608
|
+
label: c.label,
|
|
609
|
+
values: St(c.columnId, Ne),
|
|
610
|
+
left: m.clientX,
|
|
611
|
+
top: m.clientY,
|
|
612
|
+
width: c.bounds.width,
|
|
613
|
+
height: O
|
|
614
|
+
}), Ct();
|
|
615
|
+
}
|
|
616
|
+
ve(m.clientX, m.clientY, c);
|
|
617
|
+
}
|
|
618
|
+
}, d = (m) => {
|
|
619
|
+
const c = X.current;
|
|
620
|
+
!c || c.pointerId !== m.pointerId || Ce(!0);
|
|
621
|
+
}, P = (m) => {
|
|
622
|
+
const c = X.current;
|
|
623
|
+
!c || c.pointerId !== m.pointerId || Ce(!1);
|
|
624
|
+
}, p = () => Ce(!1);
|
|
625
|
+
window.addEventListener("pointermove", a), window.addEventListener("pointerup", d), window.addEventListener("pointercancel", P), window.addEventListener("blur", p), de.current = () => {
|
|
626
|
+
window.removeEventListener("pointermove", a), window.removeEventListener("pointerup", d), window.removeEventListener("pointercancel", P), window.removeEventListener("blur", p);
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
},
|
|
631
|
+
[
|
|
632
|
+
ve,
|
|
633
|
+
Ye,
|
|
634
|
+
q,
|
|
635
|
+
Ce,
|
|
636
|
+
St,
|
|
637
|
+
Ct
|
|
638
|
+
]
|
|
639
|
+
), Ie = pe !== "none", Un = !!(ke && fe), Bn = Ie ? 1 : 0, jn = C.getVisibleLeafColumns().length, Ee = Math.max(
|
|
640
|
+
jn + Bn,
|
|
265
641
|
1
|
|
266
|
-
),
|
|
267
|
-
|
|
642
|
+
), Yn = Math.max(C.getHeaderGroups().length, 1), Ke = R && $ ? /* @__PURE__ */ s(
|
|
643
|
+
Pr,
|
|
268
644
|
{
|
|
269
|
-
value:
|
|
270
|
-
minValue:
|
|
271
|
-
maxValue:
|
|
272
|
-
step:
|
|
273
|
-
onChange:
|
|
274
|
-
onFitToViewport:
|
|
275
|
-
isDisabled:
|
|
645
|
+
value: se,
|
|
646
|
+
minValue: Rn,
|
|
647
|
+
maxValue: $.maxZoom,
|
|
648
|
+
step: $.step,
|
|
649
|
+
onChange: lt,
|
|
650
|
+
onFitToViewport: Fn,
|
|
651
|
+
isDisabled: Zt
|
|
276
652
|
}
|
|
277
|
-
) : null,
|
|
278
|
-
const
|
|
279
|
-
zoom:
|
|
280
|
-
"--table-zoom-font-size":
|
|
653
|
+
) : null, Rt = We ? We({ zoomControl: Ke, zoomPercent: se }) : Qt, Nt = !We && Ke ? /* @__PURE__ */ s("div", { className: "flex justify-end", children: Ke }) : null, Kn = !!(Rt || Nt || ot), Zn = M(() => {
|
|
654
|
+
const t = R ? {
|
|
655
|
+
zoom: H,
|
|
656
|
+
"--table-zoom-font-size": be ? `${be}px` : void 0
|
|
281
657
|
} : void 0;
|
|
282
|
-
return !
|
|
283
|
-
...
|
|
658
|
+
return !z || !N ? R ? { ...t, width: "max-content", minWidth: "100%" } : void 0 : R ? {
|
|
659
|
+
...t,
|
|
284
660
|
tableLayout: "fixed",
|
|
285
|
-
width: `${
|
|
661
|
+
width: `${we ?? N.minTableWidth}px`
|
|
286
662
|
} : {
|
|
287
663
|
tableLayout: "fixed",
|
|
288
|
-
width:
|
|
664
|
+
width: Ue ? `${N.minTableWidth}px` : "100%"
|
|
289
665
|
};
|
|
290
666
|
}, [
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
]),
|
|
667
|
+
we,
|
|
668
|
+
z,
|
|
669
|
+
N,
|
|
670
|
+
Ue,
|
|
671
|
+
R,
|
|
672
|
+
H,
|
|
673
|
+
be
|
|
674
|
+
]), Gn = S(
|
|
299
675
|
null
|
|
300
|
-
), [
|
|
301
|
-
(
|
|
302
|
-
if (
|
|
303
|
-
const n =
|
|
304
|
-
n != null && n.anchor.rowId ===
|
|
305
|
-
|
|
306
|
-
rowId:
|
|
307
|
-
columnKey:
|
|
308
|
-
sourceIndex:
|
|
676
|
+
), [Q, qn] = K(null), Jn = !!Z, Qn = f(
|
|
677
|
+
(t, e, r) => {
|
|
678
|
+
if (Gn.current = { rowId: t, columnKey: e }, !ie) return;
|
|
679
|
+
const n = ge;
|
|
680
|
+
n != null && n.anchor.rowId === t && n.anchor.columnKey === e && n.focus.rowId === t && n.focus.columnKey === e || ie(
|
|
681
|
+
mr({
|
|
682
|
+
rowId: t,
|
|
683
|
+
columnKey: e,
|
|
684
|
+
sourceIndex: r ?? null
|
|
309
685
|
})
|
|
310
686
|
);
|
|
311
687
|
},
|
|
312
|
-
[
|
|
313
|
-
),
|
|
314
|
-
(
|
|
315
|
-
|
|
688
|
+
[ie, ge]
|
|
689
|
+
), er = f(
|
|
690
|
+
(t) => {
|
|
691
|
+
qn((e) => e === t || e && t && e.rowId === t.rowId && e.columnKey === t.columnKey ? e : t);
|
|
316
692
|
},
|
|
317
693
|
[]
|
|
318
|
-
),
|
|
319
|
-
enabled:
|
|
320
|
-
onReorderRows:
|
|
321
|
-
containerRef:
|
|
322
|
-
}),
|
|
323
|
-
(
|
|
694
|
+
), Le = !!st && En !== !1, L = hr({
|
|
695
|
+
enabled: Le,
|
|
696
|
+
onReorderRows: st,
|
|
697
|
+
containerRef: F
|
|
698
|
+
}), tr = f(
|
|
699
|
+
(t, e, r) => {
|
|
324
700
|
var n;
|
|
325
701
|
return {
|
|
326
|
-
row:
|
|
327
|
-
rowId:
|
|
328
|
-
columnId:
|
|
329
|
-
value:
|
|
330
|
-
rowIndex:
|
|
331
|
-
sourceIndex:
|
|
332
|
-
isRowDragging: ((n =
|
|
333
|
-
startRowDrag:
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
702
|
+
row: t.original,
|
|
703
|
+
rowId: t.id,
|
|
704
|
+
columnId: e,
|
|
705
|
+
value: r,
|
|
706
|
+
rowIndex: t.index,
|
|
707
|
+
sourceIndex: Te(t.original, t.index),
|
|
708
|
+
isRowDragging: ((n = L.session) == null ? void 0 : n.active) === !0 && L.session.rowId === t.id,
|
|
709
|
+
startRowDrag: Le ? (i) => L.startDrag(
|
|
710
|
+
i,
|
|
711
|
+
t.id,
|
|
712
|
+
Te(t.original, t.index) ?? t.index,
|
|
713
|
+
t.original
|
|
338
714
|
) : void 0
|
|
339
715
|
};
|
|
340
716
|
},
|
|
341
717
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
342
|
-
[
|
|
343
|
-
),
|
|
344
|
-
() =>
|
|
345
|
-
[
|
|
346
|
-
),
|
|
347
|
-
() =>
|
|
348
|
-
[
|
|
349
|
-
),
|
|
350
|
-
enabled:
|
|
351
|
-
selection:
|
|
352
|
-
onSelectionChange:
|
|
353
|
-
onCopyCells:
|
|
354
|
-
onPasteCells:
|
|
355
|
-
onClearCells:
|
|
356
|
-
onActivateCell:
|
|
357
|
-
const
|
|
358
|
-
|
|
359
|
-
row:
|
|
360
|
-
rowId:
|
|
361
|
-
columnId:
|
|
718
|
+
[Le, L.startDrag, L.session]
|
|
719
|
+
), Ze = Y.map((t) => t.id).join("\0"), Ge = M(
|
|
720
|
+
() => Ze ? Ze.split("\0") : [],
|
|
721
|
+
[Ze]
|
|
722
|
+
), qe = C.getVisibleLeafColumns().map((t) => t.id).join("\0"), Je = M(
|
|
723
|
+
() => qe ? qe.split("\0") : [],
|
|
724
|
+
[qe]
|
|
725
|
+
), ee = typeof ie == "function", Re = gr({
|
|
726
|
+
enabled: ee,
|
|
727
|
+
selection: ge,
|
|
728
|
+
onSelectionChange: ie,
|
|
729
|
+
onCopyCells: Cn,
|
|
730
|
+
onPasteCells: Sn,
|
|
731
|
+
onClearCells: In,
|
|
732
|
+
onActivateCell: Z ? (t) => {
|
|
733
|
+
const e = Y.find((r) => r.id === t.rowId);
|
|
734
|
+
e && Z({
|
|
735
|
+
row: e.original,
|
|
736
|
+
rowId: t.rowId,
|
|
737
|
+
columnId: t.columnKey,
|
|
362
738
|
value: void 0,
|
|
363
|
-
rowIndex:
|
|
364
|
-
sourceIndex:
|
|
739
|
+
rowIndex: e.index,
|
|
740
|
+
sourceIndex: t.sourceIndex ?? Te(e.original, e.index)
|
|
365
741
|
});
|
|
366
742
|
} : void 0,
|
|
367
|
-
activateOnSingleClick:
|
|
368
|
-
containerRef:
|
|
369
|
-
rowIds:
|
|
370
|
-
columnKeys:
|
|
371
|
-
}),
|
|
372
|
-
if (!(
|
|
373
|
-
const
|
|
374
|
-
for (const n of
|
|
375
|
-
const
|
|
376
|
-
|
|
743
|
+
activateOnSingleClick: Ln,
|
|
744
|
+
containerRef: F,
|
|
745
|
+
rowIds: Ge,
|
|
746
|
+
columnKeys: Je
|
|
747
|
+
}), nr = M(() => {
|
|
748
|
+
if (!(re != null && re.length)) return Y.map((n) => ({ kind: "row", row: n }));
|
|
749
|
+
const t = new Map(Y.map((n) => [n.id, n])), e = /* @__PURE__ */ new Set(), r = [];
|
|
750
|
+
for (const n of re) {
|
|
751
|
+
const i = n.rowIds.map((a) => t.get(a)).filter((a) => a !== void 0);
|
|
752
|
+
i.length !== 0 && (r.push({
|
|
377
753
|
kind: "group",
|
|
378
|
-
group: { id: n.id, label: n.label, rowCount:
|
|
379
|
-
}),
|
|
754
|
+
group: { id: n.id, label: n.label, rowCount: i.length }
|
|
755
|
+
}), i.forEach((a) => e.add(a.id)), !He.has(n.id) && i.forEach((a) => r.push({ kind: "row", row: a })));
|
|
380
756
|
}
|
|
381
|
-
for (const n of
|
|
382
|
-
|
|
383
|
-
return
|
|
384
|
-
}, [
|
|
385
|
-
const
|
|
386
|
-
return /* @__PURE__ */
|
|
757
|
+
for (const n of Y)
|
|
758
|
+
e.has(n.id) || r.push({ kind: "row", row: n });
|
|
759
|
+
return r;
|
|
760
|
+
}, [re, Y, He]), rr = (t) => {
|
|
761
|
+
const e = He.has(t.id), r = () => An(t.id);
|
|
762
|
+
return /* @__PURE__ */ s("tr", { className: "bg-secondary_subtle", children: /* @__PURE__ */ s(
|
|
387
763
|
"td",
|
|
388
764
|
{
|
|
389
|
-
colSpan:
|
|
390
|
-
className:
|
|
391
|
-
!
|
|
392
|
-
|
|
765
|
+
colSpan: Ee,
|
|
766
|
+
className: w(
|
|
767
|
+
!Oe && "py-1.5",
|
|
768
|
+
_ && "border-r border-secondary last:border-r-0"
|
|
393
769
|
),
|
|
394
|
-
children:
|
|
395
|
-
id:
|
|
396
|
-
label:
|
|
397
|
-
rowCount:
|
|
398
|
-
isCollapsed:
|
|
399
|
-
toggle:
|
|
400
|
-
}) : /* @__PURE__ */
|
|
770
|
+
children: Oe ? Oe({
|
|
771
|
+
id: t.id,
|
|
772
|
+
label: t.label,
|
|
773
|
+
rowCount: t.rowCount,
|
|
774
|
+
isCollapsed: e,
|
|
775
|
+
toggle: r
|
|
776
|
+
}) : /* @__PURE__ */ x(
|
|
401
777
|
"button",
|
|
402
778
|
{
|
|
403
779
|
type: "button",
|
|
404
780
|
className: "flex w-full items-center gap-2 px-2 text-left text-xs font-medium text-secondary",
|
|
405
|
-
onClick:
|
|
406
|
-
"aria-expanded": !
|
|
781
|
+
onClick: r,
|
|
782
|
+
"aria-expanded": !e,
|
|
407
783
|
children: [
|
|
408
|
-
/* @__PURE__ */
|
|
409
|
-
|
|
784
|
+
/* @__PURE__ */ s(
|
|
785
|
+
Wt,
|
|
410
786
|
{
|
|
411
|
-
className:
|
|
787
|
+
className: w(
|
|
412
788
|
"size-4 shrink-0 text-fg-quaternary transition-transform",
|
|
413
|
-
!
|
|
789
|
+
!e && "rotate-90"
|
|
414
790
|
)
|
|
415
791
|
}
|
|
416
792
|
),
|
|
417
|
-
/* @__PURE__ */
|
|
418
|
-
/* @__PURE__ */
|
|
793
|
+
/* @__PURE__ */ s("span", { className: "truncate", children: t.label || "(Empty)" }),
|
|
794
|
+
/* @__PURE__ */ x("span", { className: "text-tertiary", children: [
|
|
419
795
|
"(",
|
|
420
|
-
|
|
796
|
+
t.rowCount,
|
|
421
797
|
")"
|
|
422
798
|
] })
|
|
423
799
|
]
|
|
424
800
|
}
|
|
425
801
|
)
|
|
426
802
|
}
|
|
427
|
-
) }, `group-${
|
|
428
|
-
},
|
|
803
|
+
) }, `group-${t.id}`);
|
|
804
|
+
}, Tt = /* @__PURE__ */ x(
|
|
429
805
|
"div",
|
|
430
806
|
{
|
|
431
|
-
ref: (
|
|
432
|
-
|
|
807
|
+
ref: (t) => {
|
|
808
|
+
F.current = t, typeof he == "function" ? he(t) : he && (he.current = t);
|
|
433
809
|
},
|
|
434
|
-
onPointerDownCapture:
|
|
435
|
-
onKeyDownCapture:
|
|
436
|
-
onClickCapture:
|
|
437
|
-
onDoubleClickCapture:
|
|
438
|
-
className:
|
|
810
|
+
onPointerDownCapture: ee ? Re.onPointerDownCapture : void 0,
|
|
811
|
+
onKeyDownCapture: ee ? Re.onKeyDownCapture : void 0,
|
|
812
|
+
onClickCapture: ee ? Re.onClickCapture : void 0,
|
|
813
|
+
onDoubleClickCapture: ee ? Re.onDoubleClickCapture : void 0,
|
|
814
|
+
className: w(
|
|
439
815
|
"w-full rounded-lg bg-primary",
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
816
|
+
R || !z || Ue ? "overflow-x-auto" : "overflow-x-hidden",
|
|
817
|
+
_ && "rounded-xl border border-secondary",
|
|
818
|
+
Gt
|
|
443
819
|
),
|
|
444
820
|
children: [
|
|
445
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ x(
|
|
446
822
|
"table",
|
|
447
823
|
{
|
|
448
|
-
"aria-label":
|
|
449
|
-
"data-table-zoom-typography":
|
|
450
|
-
className:
|
|
824
|
+
"aria-label": y,
|
|
825
|
+
"data-table-zoom-typography": be !== void 0 ? "" : void 0,
|
|
826
|
+
className: w(
|
|
451
827
|
"w-full border-separate border-spacing-0 overflow-x-hidden",
|
|
452
|
-
|
|
828
|
+
qt
|
|
453
829
|
),
|
|
454
|
-
style:
|
|
830
|
+
style: Zn,
|
|
455
831
|
children: [
|
|
456
|
-
/* @__PURE__ */
|
|
832
|
+
/* @__PURE__ */ s(
|
|
457
833
|
"thead",
|
|
458
834
|
{
|
|
459
|
-
className:
|
|
835
|
+
className: w(
|
|
460
836
|
"sticky top-0 z-30 rounded-t-lg bg-secondary_subtle [&>tr>th]:h-9 [&>tr>th:first-child]:rounded-tl-lg [&>tr>th:last-child]:rounded-tr-lg",
|
|
461
|
-
|
|
462
|
-
|
|
837
|
+
_ && "[&>tr>th]:border-b [&>tr>th]:border-secondary [&>tr>th:first-child]:rounded-bl-none [&>tr>th:last-child]:rounded-br-none",
|
|
838
|
+
Jt
|
|
463
839
|
),
|
|
464
|
-
children:
|
|
465
|
-
|
|
840
|
+
children: C.getHeaderGroups().map((t, e) => /* @__PURE__ */ x("tr", { children: [
|
|
841
|
+
Ie && e === 0 ? /* @__PURE__ */ s(
|
|
466
842
|
"th",
|
|
467
843
|
{
|
|
468
|
-
rowSpan:
|
|
469
|
-
className:
|
|
844
|
+
rowSpan: Yn,
|
|
845
|
+
className: w(
|
|
470
846
|
"relative w-10 min-w-10 p-0 align-middle",
|
|
471
|
-
|
|
847
|
+
_ && "border-r border-secondary"
|
|
472
848
|
),
|
|
473
|
-
children:
|
|
849
|
+
children: pe === "multiple" ? /* @__PURE__ */ s(
|
|
474
850
|
"div",
|
|
475
851
|
{
|
|
476
852
|
className: "flex items-center justify-center",
|
|
477
|
-
onClick: (
|
|
478
|
-
children: /* @__PURE__ */
|
|
479
|
-
|
|
853
|
+
onClick: (r) => r.stopPropagation(),
|
|
854
|
+
children: /* @__PURE__ */ s(
|
|
855
|
+
Ot,
|
|
480
856
|
{
|
|
481
|
-
checked:
|
|
482
|
-
onCheckedChange: (
|
|
857
|
+
checked: C.getIsAllRowsSelected() ? !0 : C.getIsSomeRowsSelected() ? "indeterminate" : !1,
|
|
858
|
+
onCheckedChange: (r) => C.toggleAllRowsSelected(r === !0),
|
|
483
859
|
"aria-label": "Select all rows",
|
|
484
860
|
className: "items-center justify-center"
|
|
485
861
|
}
|
|
@@ -488,105 +864,141 @@ function Un({
|
|
|
488
864
|
) : null
|
|
489
865
|
}
|
|
490
866
|
) : null,
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
867
|
+
t.headers.map((r) => {
|
|
868
|
+
var c;
|
|
869
|
+
if (r.rowSpan === 0) return null;
|
|
870
|
+
const n = ce.get(r.column.id), i = r.column.getIsSorted(), a = it && !r.isPlaceholder && r.column.getCanSort(), d = Ye && !r.isPlaceholder && r.subHeaders.length === 0, P = ye && !r.isPlaceholder && r.subHeaders.length === 0 && !(n != null && n.sticky) && !(n != null && n.width), p = n != null && n.renderHeader ? n.renderHeader({
|
|
494
871
|
columnId: n.id,
|
|
495
872
|
label: n.header
|
|
496
|
-
}) :
|
|
497
|
-
return /* @__PURE__ */
|
|
873
|
+
}) : r.isPlaceholder ? null : C.FlexRender({ header: r }), m = a && !(n != null && n.renderHeader);
|
|
874
|
+
return /* @__PURE__ */ x(
|
|
498
875
|
"th",
|
|
499
876
|
{
|
|
500
|
-
colSpan:
|
|
501
|
-
rowSpan:
|
|
502
|
-
scope:
|
|
503
|
-
"aria-sort":
|
|
504
|
-
style:
|
|
505
|
-
|
|
877
|
+
colSpan: r.colSpan,
|
|
878
|
+
rowSpan: r.rowSpan,
|
|
879
|
+
scope: r.colSpan > 1 ? "colgroup" : "col",
|
|
880
|
+
"aria-sort": i === "asc" ? "ascending" : i === "desc" ? "descending" : void 0,
|
|
881
|
+
style: xe(n, !0),
|
|
882
|
+
...d ? Xn(
|
|
883
|
+
r.column.id,
|
|
884
|
+
((c = r.column.parent) == null ? void 0 : c.id) ?? "",
|
|
885
|
+
p
|
|
886
|
+
) : void 0,
|
|
887
|
+
className: w(
|
|
506
888
|
"relative overflow-hidden p-0 outline-hidden focus-within:z-1 focus-within:ring-2 focus-within:ring-focus-ring focus-within:ring-inset",
|
|
507
|
-
|
|
508
|
-
|
|
889
|
+
_r[g],
|
|
890
|
+
_ && "border-r border-secondary last:border-r-0",
|
|
891
|
+
d && "cursor-grab touch-none select-none active:cursor-grabbing",
|
|
892
|
+
wt === r.column.id && "select-none",
|
|
893
|
+
Be === r.column.id && "opacity-40 blur-[1.5px]",
|
|
509
894
|
n == null ? void 0 : n.headerClassName
|
|
510
895
|
),
|
|
511
|
-
children:
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
896
|
+
children: [
|
|
897
|
+
m ? /* @__PURE__ */ x(
|
|
898
|
+
"button",
|
|
899
|
+
{
|
|
900
|
+
type: "button",
|
|
901
|
+
className: w(
|
|
902
|
+
"flex w-full items-center gap-1 overflow-hidden rounded outline-none",
|
|
903
|
+
Ft(n == null ? void 0 : n.align)
|
|
904
|
+
),
|
|
905
|
+
onClick: r.column.getToggleSortingHandler(),
|
|
906
|
+
"aria-label": `Sort by ${String((n == null ? void 0 : n.header) ?? r.column.id)}`,
|
|
907
|
+
children: [
|
|
908
|
+
/* @__PURE__ */ s("span", { className: "overflow-hidden text-ellipsis whitespace-nowrap text-xs font-medium text-secondary", children: p }),
|
|
909
|
+
i ? /* @__PURE__ */ s(
|
|
910
|
+
cr,
|
|
911
|
+
{
|
|
912
|
+
className: w(
|
|
913
|
+
"size-3 shrink-0 stroke-[3px] text-fg-quaternary",
|
|
914
|
+
i === "asc" && "rotate-180"
|
|
915
|
+
)
|
|
916
|
+
}
|
|
917
|
+
) : /* @__PURE__ */ s(
|
|
918
|
+
dr,
|
|
919
|
+
{
|
|
920
|
+
size: 12,
|
|
921
|
+
strokeWidth: 3,
|
|
922
|
+
className: "shrink-0 text-fg-quaternary"
|
|
923
|
+
}
|
|
924
|
+
)
|
|
925
|
+
]
|
|
926
|
+
}
|
|
927
|
+
) : /* @__PURE__ */ s(
|
|
928
|
+
"div",
|
|
929
|
+
{
|
|
930
|
+
className: w(
|
|
931
|
+
"flex items-center gap-1 overflow-hidden",
|
|
932
|
+
a && "cursor-pointer",
|
|
933
|
+
Ft(n == null ? void 0 : n.align)
|
|
934
|
+
),
|
|
935
|
+
onClick: a ? r.column.getToggleSortingHandler() : void 0,
|
|
936
|
+
children: /* @__PURE__ */ s("div", { className: "flex items-center overflow-hidden text-ellipsis whitespace-nowrap text-xs font-medium text-secondary", children: p })
|
|
937
|
+
}
|
|
938
|
+
),
|
|
939
|
+
P ? /* @__PURE__ */ s(
|
|
940
|
+
"div",
|
|
941
|
+
{
|
|
942
|
+
role: "separator",
|
|
943
|
+
"aria-orientation": "vertical",
|
|
944
|
+
"aria-label": `Resize ${String((n == null ? void 0 : n.header) ?? r.column.id)} column`,
|
|
945
|
+
"data-column-reorder-ignore": "",
|
|
946
|
+
className: w(
|
|
947
|
+
// The header cell clips its overflow, so a handle that hung past the
|
|
948
|
+
// right edge to straddle the shared border would be cut off there (and
|
|
949
|
+
// on the last column would stick out of the table). Keep the whole hit
|
|
950
|
+
// area inside the cell, hugging the edge it resizes.
|
|
951
|
+
"absolute inset-y-0 right-0 z-10 w-3 cursor-col-resize touch-none"
|
|
952
|
+
),
|
|
953
|
+
onPointerDown: (b) => Hn(r.column.id, b),
|
|
954
|
+
onPointerEnter: (b) => Lt(b.currentTarget),
|
|
955
|
+
onPointerMove: (b) => Lt(b.currentTarget),
|
|
956
|
+
onPointerLeave: () => {
|
|
957
|
+
j.current || D();
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
) : null
|
|
961
|
+
]
|
|
551
962
|
},
|
|
552
|
-
|
|
963
|
+
r.id
|
|
553
964
|
);
|
|
554
965
|
})
|
|
555
|
-
] },
|
|
966
|
+
] }, t.id))
|
|
556
967
|
}
|
|
557
968
|
),
|
|
558
|
-
/* @__PURE__ */
|
|
559
|
-
|
|
969
|
+
/* @__PURE__ */ x("tbody", { children: [
|
|
970
|
+
E ? Array.from({ length: h }, (t, e) => /* @__PURE__ */ x(
|
|
560
971
|
"tr",
|
|
561
972
|
{
|
|
562
|
-
className:
|
|
973
|
+
className: kt[g],
|
|
563
974
|
"aria-hidden": "true",
|
|
564
975
|
children: [
|
|
565
|
-
|
|
976
|
+
Ie ? /* @__PURE__ */ s(
|
|
566
977
|
"td",
|
|
567
978
|
{
|
|
568
|
-
className:
|
|
979
|
+
className: w(
|
|
569
980
|
"w-10 min-w-10",
|
|
570
|
-
|
|
571
|
-
!
|
|
981
|
+
_ && "border-r border-secondary",
|
|
982
|
+
!V && "border-b border-tertiary"
|
|
572
983
|
)
|
|
573
984
|
}
|
|
574
985
|
) : null,
|
|
575
|
-
|
|
576
|
-
const n =
|
|
577
|
-
return /* @__PURE__ */
|
|
986
|
+
C.getVisibleLeafColumns().map((r) => {
|
|
987
|
+
const n = ce.get(r.id);
|
|
988
|
+
return /* @__PURE__ */ s(
|
|
578
989
|
"td",
|
|
579
990
|
{
|
|
580
|
-
style:
|
|
581
|
-
className:
|
|
991
|
+
style: xe(n, !1),
|
|
992
|
+
className: w(
|
|
582
993
|
"relative overflow-hidden text-secondary",
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
!
|
|
994
|
+
At[g],
|
|
995
|
+
_ && "border-r border-secondary last:border-r-0",
|
|
996
|
+
!V && "border-b border-tertiary",
|
|
997
|
+
Be === r.id && "opacity-40 blur-[1.5px]",
|
|
586
998
|
n == null ? void 0 : n.cellClassName
|
|
587
999
|
),
|
|
588
|
-
children: /* @__PURE__ */
|
|
589
|
-
|
|
1000
|
+
children: /* @__PURE__ */ s(
|
|
1001
|
+
ur,
|
|
590
1002
|
{
|
|
591
1003
|
height: "14px",
|
|
592
1004
|
width: "75%",
|
|
@@ -594,73 +1006,73 @@ function Un({
|
|
|
594
1006
|
}
|
|
595
1007
|
)
|
|
596
1008
|
},
|
|
597
|
-
|
|
1009
|
+
r.id
|
|
598
1010
|
);
|
|
599
1011
|
})
|
|
600
1012
|
]
|
|
601
1013
|
},
|
|
602
|
-
`loading-${
|
|
603
|
-
)) :
|
|
1014
|
+
`loading-${e}`
|
|
1015
|
+
)) : Y.length === 0 ? /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s(
|
|
604
1016
|
"td",
|
|
605
1017
|
{
|
|
606
|
-
colSpan:
|
|
1018
|
+
colSpan: Ee,
|
|
607
1019
|
className: "border-b border-secondary px-3 py-3 text-left text-xs text-placeholder_subtle",
|
|
608
|
-
children:
|
|
1020
|
+
children: A
|
|
609
1021
|
}
|
|
610
|
-
) }) :
|
|
611
|
-
var
|
|
612
|
-
if (
|
|
613
|
-
return
|
|
614
|
-
const
|
|
615
|
-
return /* @__PURE__ */
|
|
616
|
-
/* @__PURE__ */
|
|
1022
|
+
) }) : nr.map((t) => {
|
|
1023
|
+
var a;
|
|
1024
|
+
if (t.kind === "group")
|
|
1025
|
+
return rr(t.group);
|
|
1026
|
+
const e = t.row, r = Un && e.getCanExpand(), n = r && e.getIsExpanded(), i = e.getVisibleCells();
|
|
1027
|
+
return /* @__PURE__ */ x(sr, { children: [
|
|
1028
|
+
/* @__PURE__ */ x(
|
|
617
1029
|
"tr",
|
|
618
1030
|
{
|
|
619
|
-
...
|
|
620
|
-
[
|
|
621
|
-
[
|
|
622
|
-
|
|
1031
|
+
...Le ? {
|
|
1032
|
+
[yr]: e.id,
|
|
1033
|
+
[xr]: String(
|
|
1034
|
+
Te(e.original, e.index) ?? e.index
|
|
623
1035
|
)
|
|
624
1036
|
} : {},
|
|
625
|
-
style: (
|
|
626
|
-
className:
|
|
1037
|
+
style: (a = L.session) != null && a.active && L.session.rowId === e.id ? wr : void 0,
|
|
1038
|
+
className: w(
|
|
627
1039
|
// `focus-visible`, not `focus-within`: the ring marks the row itself being keyboard-focused.
|
|
628
1040
|
// `focus-within` also fires for anything inside it, so an open cell
|
|
629
1041
|
// editor outlined the entire row.
|
|
630
1042
|
"relative outline-focus-ring transition-colors hover:bg-secondary_subtle focus-visible:outline-2 focus-visible:-outline-offset-2",
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
1043
|
+
kt[g],
|
|
1044
|
+
e.getIsSelected() && "bg-secondary",
|
|
1045
|
+
Pe && "cursor-pointer",
|
|
1046
|
+
ze == null ? void 0 : ze(e.original)
|
|
635
1047
|
),
|
|
636
|
-
onClick: (
|
|
637
|
-
!
|
|
1048
|
+
onClick: (d) => {
|
|
1049
|
+
!Pe || Vt(d.target) || Pe(e.original);
|
|
638
1050
|
},
|
|
639
|
-
onMouseEnter:
|
|
640
|
-
onMouseLeave:
|
|
1051
|
+
onMouseEnter: ue ? () => ue(e.original, !0) : void 0,
|
|
1052
|
+
onMouseLeave: ue ? () => ue(e.original, !1) : void 0,
|
|
641
1053
|
children: [
|
|
642
|
-
|
|
1054
|
+
Ie ? /* @__PURE__ */ s(
|
|
643
1055
|
"td",
|
|
644
1056
|
{
|
|
645
|
-
className:
|
|
1057
|
+
className: w(
|
|
646
1058
|
"relative w-10 min-w-10 p-0 text-center",
|
|
647
|
-
|
|
1059
|
+
_ && "border-r border-secondary",
|
|
648
1060
|
// Matches the data cells, so the row separator
|
|
649
1061
|
// runs the full width of the table.
|
|
650
|
-
!
|
|
1062
|
+
!V && !n && "border-b border-tertiary"
|
|
651
1063
|
),
|
|
652
|
-
children: /* @__PURE__ */
|
|
1064
|
+
children: /* @__PURE__ */ s(
|
|
653
1065
|
"div",
|
|
654
1066
|
{
|
|
655
1067
|
className: "flex items-center justify-center",
|
|
656
|
-
onClick: (
|
|
657
|
-
onKeyDown: (
|
|
658
|
-
children: /* @__PURE__ */
|
|
659
|
-
|
|
1068
|
+
onClick: (d) => d.stopPropagation(),
|
|
1069
|
+
onKeyDown: (d) => d.stopPropagation(),
|
|
1070
|
+
children: /* @__PURE__ */ s(
|
|
1071
|
+
Ot,
|
|
660
1072
|
{
|
|
661
|
-
checked:
|
|
662
|
-
onCheckedChange: (
|
|
663
|
-
"aria-label": `Select row ${
|
|
1073
|
+
checked: e.getIsSelected(),
|
|
1074
|
+
onCheckedChange: (d) => e.toggleSelected(d === !0),
|
|
1075
|
+
"aria-label": `Select row ${e.id}`,
|
|
664
1076
|
className: "items-center justify-center"
|
|
665
1077
|
}
|
|
666
1078
|
)
|
|
@@ -668,39 +1080,39 @@ function Un({
|
|
|
668
1080
|
)
|
|
669
1081
|
}
|
|
670
1082
|
) : null,
|
|
671
|
-
|
|
672
|
-
if (
|
|
673
|
-
const
|
|
674
|
-
if (!
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
),
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
) : null,
|
|
686
|
-
return /* @__PURE__ */
|
|
1083
|
+
i.map((d, P) => {
|
|
1084
|
+
if (d.getIsCovered()) return null;
|
|
1085
|
+
const p = ce.get(d.column.id);
|
|
1086
|
+
if (!p) return null;
|
|
1087
|
+
const m = tr(
|
|
1088
|
+
e,
|
|
1089
|
+
p.id,
|
|
1090
|
+
d.getValue()
|
|
1091
|
+
), c = p.renderCell ? p.renderCell(m) : String(d.getValue() ?? ""), b = ee ? pr(
|
|
1092
|
+
ge,
|
|
1093
|
+
e.id,
|
|
1094
|
+
p.id,
|
|
1095
|
+
Ge,
|
|
1096
|
+
Je
|
|
1097
|
+
) : null, W = !!(b != null && b.inRange), O = (Q == null ? void 0 : Q.rowId) === e.id && (Q == null ? void 0 : Q.columnKey) === p.id;
|
|
1098
|
+
return /* @__PURE__ */ s(
|
|
687
1099
|
"td",
|
|
688
1100
|
{
|
|
689
|
-
colSpan:
|
|
690
|
-
rowSpan:
|
|
691
|
-
style:
|
|
692
|
-
...
|
|
693
|
-
boxShadow:
|
|
694
|
-
|
|
1101
|
+
colSpan: d.getColSpan(),
|
|
1102
|
+
rowSpan: d.getRowSpan(),
|
|
1103
|
+
style: W && b ? {
|
|
1104
|
+
...xe(p, !1),
|
|
1105
|
+
boxShadow: fr(
|
|
1106
|
+
b.edges
|
|
695
1107
|
)
|
|
696
|
-
} :
|
|
1108
|
+
} : xe(p, !1),
|
|
697
1109
|
"data-table-component-cell": "",
|
|
698
1110
|
"data-grid-cell": "",
|
|
699
|
-
"data-grid-row-id":
|
|
700
|
-
"data-grid-col-key":
|
|
701
|
-
"data-grid-source-index":
|
|
702
|
-
tabIndex:
|
|
703
|
-
className:
|
|
1111
|
+
"data-grid-row-id": e.id,
|
|
1112
|
+
"data-grid-col-key": p.id,
|
|
1113
|
+
"data-grid-source-index": m.sourceIndex ?? void 0,
|
|
1114
|
+
tabIndex: Z ? 0 : void 0,
|
|
1115
|
+
className: w(
|
|
704
1116
|
// `overflow-hidden`, never `overflow-x-hidden`: when `overflow-x` is not
|
|
705
1117
|
// `visible` the browser computes `overflow-y` to `auto`, turning
|
|
706
1118
|
// every cell into its own scroll container that swallows the
|
|
@@ -709,102 +1121,106 @@ function Un({
|
|
|
709
1121
|
// The cell holding an open editor must not clip it: a wrapped
|
|
710
1122
|
// multi-line value has to be visible, and the row only grows
|
|
711
1123
|
// around content the cell is allowed to show.
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
!
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
1124
|
+
O ? "z-1 overflow-visible" : "overflow-hidden",
|
|
1125
|
+
At[g],
|
|
1126
|
+
Jr(p.align),
|
|
1127
|
+
_ && "border-r border-secondary last:border-r-0",
|
|
1128
|
+
!V && !n && !W && "border-b border-tertiary",
|
|
1129
|
+
W && "z-1 outline-hidden",
|
|
1130
|
+
W && !(b != null && b.isAnchor) && "bg-utility-brand-25",
|
|
1131
|
+
p.cellClassName,
|
|
1132
|
+
Be === p.id && "opacity-40 blur-[1.5px]"
|
|
720
1133
|
),
|
|
721
|
-
onClick: (
|
|
722
|
-
|
|
1134
|
+
onClick: (v) => {
|
|
1135
|
+
Ae == null || Ae(m), P === 0 && r && Vt(v.target) && v.stopPropagation();
|
|
723
1136
|
},
|
|
724
|
-
onDoubleClick: () =>
|
|
725
|
-
onKeyDown: (
|
|
726
|
-
|
|
1137
|
+
onDoubleClick: () => Fe == null ? void 0 : Fe(m),
|
|
1138
|
+
onKeyDown: (v) => {
|
|
1139
|
+
v.key !== "Enter" || !Z || (v.preventDefault(), Z(m));
|
|
727
1140
|
},
|
|
728
|
-
children: /* @__PURE__ */
|
|
729
|
-
|
|
1141
|
+
children: /* @__PURE__ */ x("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1142
|
+
P === 0 && r ? /* @__PURE__ */ s(
|
|
730
1143
|
"button",
|
|
731
1144
|
{
|
|
732
1145
|
type: "button",
|
|
733
|
-
className:
|
|
1146
|
+
className: w(
|
|
734
1147
|
"-ml-1 flex shrink-0 cursor-pointer items-center justify-center rounded p-1 transition-transform duration-200 ease-in-out hover:bg-secondary_subtle",
|
|
735
1148
|
n && "rotate-90"
|
|
736
1149
|
),
|
|
737
1150
|
"aria-label": n ? "Collapse row" : "Expand row",
|
|
738
1151
|
"aria-expanded": n,
|
|
739
|
-
"aria-controls": `${
|
|
740
|
-
onClick: (
|
|
741
|
-
|
|
1152
|
+
"aria-controls": `${e.id}-detail`,
|
|
1153
|
+
onClick: (v) => {
|
|
1154
|
+
v.stopPropagation(), e.toggleExpanded();
|
|
742
1155
|
},
|
|
743
|
-
children: /* @__PURE__ */
|
|
1156
|
+
children: /* @__PURE__ */ s(Wt, { className: "size-4 text-fg-quaternary" })
|
|
744
1157
|
}
|
|
745
1158
|
) : null,
|
|
746
|
-
/* @__PURE__ */
|
|
1159
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: c })
|
|
747
1160
|
] })
|
|
748
1161
|
},
|
|
749
|
-
|
|
1162
|
+
d.id
|
|
750
1163
|
);
|
|
751
1164
|
})
|
|
752
1165
|
]
|
|
753
1166
|
}
|
|
754
1167
|
),
|
|
755
|
-
n &&
|
|
1168
|
+
n && fe ? /* @__PURE__ */ s(
|
|
756
1169
|
"tr",
|
|
757
1170
|
{
|
|
758
|
-
id: `${
|
|
1171
|
+
id: `${e.id}-detail`,
|
|
759
1172
|
className: "relative bg-secondary_subtle",
|
|
760
|
-
children: /* @__PURE__ */
|
|
761
|
-
row:
|
|
762
|
-
rowId:
|
|
763
|
-
colSpan:
|
|
764
|
-
collapse: () =>
|
|
1173
|
+
children: /* @__PURE__ */ s("td", { colSpan: Ee, className: "p-0", children: fe({
|
|
1174
|
+
row: e.original,
|
|
1175
|
+
rowId: e.id,
|
|
1176
|
+
colSpan: Ee,
|
|
1177
|
+
collapse: () => e.toggleExpanded(!1)
|
|
765
1178
|
}) })
|
|
766
1179
|
}
|
|
767
1180
|
) : null
|
|
768
|
-
] },
|
|
1181
|
+
] }, e.id);
|
|
769
1182
|
}),
|
|
770
|
-
!
|
|
1183
|
+
!E && en
|
|
771
1184
|
] })
|
|
772
1185
|
]
|
|
773
1186
|
}
|
|
774
1187
|
),
|
|
775
|
-
((
|
|
776
|
-
/* @__PURE__ */
|
|
777
|
-
|
|
778
|
-
|
|
1188
|
+
((_t = L.session) == null ? void 0 : _t.active) && /* @__PURE__ */ x(Bt, { children: [
|
|
1189
|
+
/* @__PURE__ */ s(vr, { session: L.session }),
|
|
1190
|
+
L.session.dropLineY !== null && /* @__PURE__ */ s(
|
|
1191
|
+
Cr,
|
|
779
1192
|
{
|
|
780
|
-
y:
|
|
781
|
-
left:
|
|
782
|
-
width:
|
|
1193
|
+
y: L.session.dropLineY,
|
|
1194
|
+
left: L.session.dropLineLeft,
|
|
1195
|
+
width: L.session.dropLineWidth
|
|
783
1196
|
}
|
|
784
1197
|
)
|
|
785
|
-
] })
|
|
1198
|
+
] }),
|
|
1199
|
+
ht && /* @__PURE__ */ s(Yr, { preview: ht }),
|
|
1200
|
+
ft && /* @__PURE__ */ s(Kr, { target: ft }),
|
|
1201
|
+
ye && $n && /* @__PURE__ */ s(Zr, { ref: G })
|
|
786
1202
|
]
|
|
787
1203
|
}
|
|
788
|
-
),
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
] }) : /* @__PURE__ */
|
|
794
|
-
return
|
|
795
|
-
|
|
1204
|
+
), Dt = Kn ? /* @__PURE__ */ x("div", { className: w("flex flex-col gap-3", rt), children: [
|
|
1205
|
+
Rt,
|
|
1206
|
+
Nt,
|
|
1207
|
+
Tt,
|
|
1208
|
+
ot
|
|
1209
|
+
] }) : /* @__PURE__ */ s("div", { className: rt, children: Tt });
|
|
1210
|
+
return Jn ? /* @__PURE__ */ s(
|
|
1211
|
+
br,
|
|
796
1212
|
{
|
|
797
|
-
rowIds:
|
|
798
|
-
columnKeys:
|
|
799
|
-
containerRef:
|
|
800
|
-
onSelectCell:
|
|
801
|
-
onEditingCellChange:
|
|
802
|
-
children:
|
|
1213
|
+
rowIds: Ge,
|
|
1214
|
+
columnKeys: Je,
|
|
1215
|
+
containerRef: F,
|
|
1216
|
+
onSelectCell: Qn,
|
|
1217
|
+
onEditingCellChange: er,
|
|
1218
|
+
children: Dt
|
|
803
1219
|
}
|
|
804
|
-
) :
|
|
1220
|
+
) : Dt;
|
|
805
1221
|
}
|
|
806
|
-
const
|
|
1222
|
+
const Io = jt(to);
|
|
807
1223
|
export {
|
|
808
|
-
|
|
809
|
-
|
|
1224
|
+
Io as TableComponent,
|
|
1225
|
+
Io as default
|
|
810
1226
|
};
|