@pibit.ai/cure-design-system 0.3.28 → 0.3.33
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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -50
- package/dist/patterns/table/TableWrapper.d.ts +1 -1
- package/dist/patterns/table/TableWrapper.d.ts.map +1 -1
- package/dist/patterns/table/TableWrapper.js +881 -656
- package/dist/patterns/table/cellRangeSelection.d.ts +83 -0
- package/dist/patterns/table/cellRangeSelection.d.ts.map +1 -0
- package/dist/patterns/table/cellRangeSelection.js +162 -0
- package/dist/patterns/table/cellRangeSelection.test.d.ts +2 -0
- package/dist/patterns/table/cellRangeSelection.test.d.ts.map +1 -0
- package/dist/patterns/table/index.d.ts +2 -1
- package/dist/patterns/table/index.d.ts.map +1 -1
- package/dist/patterns/table/rowReorderDrag.d.ts +14 -1
- package/dist/patterns/table/rowReorderDrag.d.ts.map +1 -1
- package/dist/patterns/table/rowReorderDrag.js +106 -75
- package/dist/patterns/table/rowReorderDrag.test.d.ts +2 -0
- package/dist/patterns/table/rowReorderDrag.test.d.ts.map +1 -0
- package/dist/patterns/table/table.js +2 -2
- package/dist/patterns/table/types.d.ts +29 -0
- package/dist/patterns/table/types.d.ts.map +1 -1
- package/dist/styles/components.css +1 -1
- package/package.json +1 -1
|
@@ -1,559 +1,770 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { ChevronRight as
|
|
4
|
-
import { cx as
|
|
5
|
-
import { TableCard as
|
|
6
|
-
import { TablePagination as
|
|
7
|
-
import { getEffectiveAlignment as
|
|
8
|
-
import { findGridCell as
|
|
9
|
-
import { ROW_DRAG_THRESHOLD_PX as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
1
|
+
import { jsx as c, jsxs as _, Fragment as Mt } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Fr, useState as A, useRef as le, useCallback as v, useMemo as k, useEffect as B, useLayoutEffect as Gr } from "react";
|
|
3
|
+
import { ChevronRight as zr } from "@untitledui/icons";
|
|
4
|
+
import { cx as m } from "../../utils/cn.js";
|
|
5
|
+
import { TableCard as Yr, Table as g } from "./table.js";
|
|
6
|
+
import { TablePagination as Mr } from "./TablePagination.js";
|
|
7
|
+
import { getEffectiveAlignment as Ht, resolveColumnLabel as Ur, alignmentClass as Xr } from "./toolbar/tableToolbarHelpers.js";
|
|
8
|
+
import { findGridCell as $r, isWithinCellEditor as Te, getGridNeighbor as jr, getGridTabNeighbor as Br, focusGridCell as Ut, GridNavProvider as qr } from "./useGridKeyboardNavigation.js";
|
|
9
|
+
import { ROW_DRAG_THRESHOLD_PX as Ar, computeDropTarget as Kr, clipDropLineToScrollport as Hr, ROW_REORDER_ATTR as Xt, measureRowPreview as Jr, cloneRowForPreview as Vr, FloatingRowPreview as Qr, DropIndicatorLine as Zr, getRowDragScrollDelta as en, ROW_DRAG_SOURCE_STYLE as tn, ROW_SOURCE_INDEX_ATTR as rn } from "./rowReorderDrag.js";
|
|
10
|
+
import { selectionFromSingleCell as st, resolveCellCoordFromElement as Oe, resolveRowAnchorCoordFromTarget as nn, buildCellRangeRect as at, nextKeyboardCellSelection as on, CELL_RANGE_DRAG_THRESHOLD_PX as sn, hitTestGridCell as an, canStartCellRangeFromTarget as $t, getDragScrollDeltas as cn, getCellRangeVisualState as dn, cellRangeEdgeBoxShadow as ln } from "./cellRangeSelection.js";
|
|
11
|
+
import { BulkActionBar as un } from "./toolbar/BulkActionBar.js";
|
|
12
|
+
import { TableToolbar as fn } from "./toolbar/TableToolbar.js";
|
|
13
|
+
import { Checkbox as jt } from "../../primitives/checkbox/checkbox.js";
|
|
14
|
+
import { ColumnHeaderMenu as pn } from "./toolbar/ColumnHeaderMenu.js";
|
|
15
|
+
import { Button as hn } from "../../primitives/button/button.js";
|
|
16
|
+
import { SummaryFooterRow as yn } from "./toolbar/SummaryFooter.js";
|
|
17
|
+
import { RowActionsMenu as wn } from "./toolbar/RowActionsMenu.js";
|
|
18
|
+
import { Icon as gn } from "../../primitives/icon/icon.js";
|
|
19
|
+
import { ShimmerLine as mn } from "../../primitives/shimmer/shimmer.js";
|
|
20
|
+
const xn = 5, bn = "__all__", Bt = {
|
|
20
21
|
ArrowUp: "up",
|
|
21
22
|
ArrowDown: "down",
|
|
22
23
|
ArrowLeft: "left",
|
|
23
24
|
ArrowRight: "right"
|
|
24
|
-
},
|
|
25
|
-
function
|
|
26
|
-
return
|
|
25
|
+
}, ue = (i) => i.__rowId ?? i.id ?? i.rule_id ?? String(i);
|
|
26
|
+
function qt(i, d) {
|
|
27
|
+
return i === "all" ? new Set(d) : i ?? /* @__PURE__ */ new Set();
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
29
|
+
function Rn(i, d, u) {
|
|
30
|
+
return i ? i === "all" ? u.includes(d) : i.has(d) : !1;
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
32
|
+
function vn(i, d) {
|
|
33
|
+
return i ? i === "all" ? d.length : i.size : 0;
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
35
|
+
function kn(i, d) {
|
|
36
|
+
return d.length === 0 ? !1 : i === "all" ? !0 : d.every((u) => (i == null ? void 0 : i.has(u)) ?? !1);
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
return
|
|
38
|
+
function En(i, d) {
|
|
39
|
+
return i === "all" ? d.length > 0 : d.some((u) => (i == null ? void 0 : i.has(u)) ?? !1);
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
if (
|
|
42
|
-
return (
|
|
43
|
-
|
|
41
|
+
function In(i) {
|
|
42
|
+
if (i)
|
|
43
|
+
return (d) => {
|
|
44
|
+
i(d === "all" ? "all" : new Set([...d].map(String)));
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
-
var
|
|
48
|
-
return
|
|
47
|
+
function Ln(i) {
|
|
48
|
+
var d;
|
|
49
|
+
return i != null && i.length ? i.length > 1 ? !0 : ((d = i[0]) == null ? void 0 : d.key) !== bn : !1;
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
-
return
|
|
51
|
+
function At(i, d, u) {
|
|
52
|
+
return u ? Ht(u, d ?? /* @__PURE__ */ new Map()) : (d == null ? void 0 : d.get(i)) ?? "left";
|
|
52
53
|
}
|
|
53
|
-
const
|
|
54
|
-
if (!
|
|
55
|
-
const
|
|
56
|
-
return
|
|
57
|
-
},
|
|
58
|
-
width:
|
|
59
|
-
maxWidth:
|
|
60
|
-
minWidth:
|
|
61
|
-
}),
|
|
62
|
-
const
|
|
63
|
-
return
|
|
64
|
-
minWidth:
|
|
65
|
-
width:
|
|
66
|
-
maxWidth:
|
|
54
|
+
const lt = "300px", ct = (i) => {
|
|
55
|
+
if (!i) return 0;
|
|
56
|
+
const d = i.match(/^(\d+(?:\.\d+)?)px$/);
|
|
57
|
+
return d ? Number(d[1]) : 0;
|
|
58
|
+
}, fe = (i) => !!i.width || !!(i.maxWidth && i.sticky === "right"), dt = (i) => i.width ?? (i.maxWidth && i.sticky === "right" ? i.maxWidth : void 0), Nn = (i) => ({
|
|
59
|
+
width: i.width,
|
|
60
|
+
maxWidth: i.maxWidth ?? lt,
|
|
61
|
+
minWidth: i.minWidth ?? i.width
|
|
62
|
+
}), Kt = (i) => {
|
|
63
|
+
const d = dt(i);
|
|
64
|
+
return d ? {
|
|
65
|
+
minWidth: d,
|
|
66
|
+
width: d,
|
|
67
|
+
maxWidth: i.maxWidth ?? d
|
|
67
68
|
} : {
|
|
68
|
-
minWidth:
|
|
69
|
-
maxWidth:
|
|
69
|
+
minWidth: i.minWidth,
|
|
70
|
+
maxWidth: i.maxWidth ?? lt
|
|
70
71
|
};
|
|
71
|
-
},
|
|
72
|
+
}, Kn = Fr(
|
|
72
73
|
function({
|
|
73
|
-
data:
|
|
74
|
-
columns:
|
|
75
|
-
renderRowCell:
|
|
76
|
-
onRowClick:
|
|
77
|
-
onRowHover:
|
|
78
|
-
arialabel:
|
|
79
|
-
size:
|
|
80
|
-
allowDefaultRowClass:
|
|
81
|
-
centeredHeaders:
|
|
82
|
-
rootClassName:
|
|
83
|
-
removeBorders:
|
|
84
|
-
headerClassName:
|
|
85
|
-
isRowExpandable:
|
|
86
|
-
renderExpandedContent:
|
|
87
|
-
loading:
|
|
88
|
-
loadingRowCount:
|
|
89
|
-
renderHeaderCell:
|
|
90
|
-
tableClassName:
|
|
91
|
-
getRowClassName:
|
|
92
|
-
selectionMode:
|
|
93
|
-
selectedKeys:
|
|
94
|
-
onSelectionChange:
|
|
95
|
-
inlineSelection:
|
|
96
|
-
toolbar:
|
|
97
|
-
showToolbar:
|
|
98
|
-
toolbarTitle:
|
|
99
|
-
toolbarTrailing:
|
|
100
|
-
disableExtendedTools:
|
|
101
|
-
pagination:
|
|
102
|
-
showBorders:
|
|
103
|
-
emptyState:
|
|
104
|
-
editChrome:
|
|
105
|
-
showEditActions:
|
|
106
|
-
searchCollapsible:
|
|
107
|
-
isEditable:
|
|
108
|
-
toolbarSlot:
|
|
109
|
-
rowHeightClass:
|
|
110
|
-
groupedData:
|
|
111
|
-
showSummaryFooter:
|
|
112
|
-
summaryFooterProps:
|
|
113
|
-
bulkActionBar:
|
|
114
|
-
renderBulkActionBar:
|
|
115
|
-
onBulkDuplicate:
|
|
116
|
-
onBulkDelete:
|
|
117
|
-
bulkActionBusy:
|
|
118
|
-
columnAlignments:
|
|
119
|
-
onColumnHeaderAction:
|
|
120
|
-
showColumnHeaderMenu:
|
|
121
|
-
columnMenuCapabilities:
|
|
122
|
-
renderGroupHeader:
|
|
123
|
-
columnMenuSchema:
|
|
124
|
-
columnSchema:
|
|
125
|
-
labelMeta:
|
|
126
|
-
renderColumnHeaderMenuExtraItems:
|
|
127
|
-
fillWidth:
|
|
128
|
-
rowActions:
|
|
129
|
-
onCellActivate:
|
|
130
|
-
|
|
131
|
-
|
|
74
|
+
data: d,
|
|
75
|
+
columns: u,
|
|
76
|
+
renderRowCell: ut,
|
|
77
|
+
onRowClick: pe,
|
|
78
|
+
onRowHover: K,
|
|
79
|
+
arialabel: Jt,
|
|
80
|
+
size: ft = "sm",
|
|
81
|
+
allowDefaultRowClass: Vt = !1,
|
|
82
|
+
centeredHeaders: Qt = [],
|
|
83
|
+
rootClassName: Zt,
|
|
84
|
+
removeBorders: pt,
|
|
85
|
+
headerClassName: er,
|
|
86
|
+
isRowExpandable: ht,
|
|
87
|
+
renderExpandedContent: tr,
|
|
88
|
+
loading: X = !1,
|
|
89
|
+
loadingRowCount: yt = xn,
|
|
90
|
+
renderHeaderCell: Fe,
|
|
91
|
+
tableClassName: rr,
|
|
92
|
+
getRowClassName: Ge,
|
|
93
|
+
selectionMode: te = "none",
|
|
94
|
+
selectedKeys: C,
|
|
95
|
+
onSelectionChange: D,
|
|
96
|
+
inlineSelection: he = !1,
|
|
97
|
+
toolbar: R,
|
|
98
|
+
showToolbar: nr,
|
|
99
|
+
toolbarTitle: wt,
|
|
100
|
+
toolbarTrailing: gt,
|
|
101
|
+
disableExtendedTools: ze,
|
|
102
|
+
pagination: P,
|
|
103
|
+
showBorders: ye,
|
|
104
|
+
emptyState: mt,
|
|
105
|
+
editChrome: F,
|
|
106
|
+
showEditActions: or = !1,
|
|
107
|
+
searchCollapsible: xt,
|
|
108
|
+
isEditable: ir,
|
|
109
|
+
toolbarSlot: Ye,
|
|
110
|
+
rowHeightClass: bt,
|
|
111
|
+
groupedData: H,
|
|
112
|
+
showSummaryFooter: sr,
|
|
113
|
+
summaryFooterProps: Me,
|
|
114
|
+
bulkActionBar: we,
|
|
115
|
+
renderBulkActionBar: ge,
|
|
116
|
+
onBulkDuplicate: me,
|
|
117
|
+
onBulkDelete: xe,
|
|
118
|
+
bulkActionBusy: be,
|
|
119
|
+
columnAlignments: J,
|
|
120
|
+
onColumnHeaderAction: Re,
|
|
121
|
+
showColumnHeaderMenu: ar,
|
|
122
|
+
columnMenuCapabilities: cr,
|
|
123
|
+
renderGroupHeader: Rt,
|
|
124
|
+
columnMenuSchema: re,
|
|
125
|
+
columnSchema: ne,
|
|
126
|
+
labelMeta: dr,
|
|
127
|
+
renderColumnHeaderMenuExtraItems: lr,
|
|
128
|
+
fillWidth: L = !1,
|
|
129
|
+
rowActions: E,
|
|
130
|
+
onCellActivate: V,
|
|
131
|
+
cellSelection: y = null,
|
|
132
|
+
onCellSelectionChange: N,
|
|
133
|
+
onCopyCells: Ue,
|
|
134
|
+
onPasteCells: Xe,
|
|
135
|
+
onClearCells: $e
|
|
136
|
+
}, oe) {
|
|
137
|
+
const [ve, ur] = A(
|
|
132
138
|
() => /* @__PURE__ */ new Set()
|
|
133
|
-
), [
|
|
139
|
+
), [fr, vt] = A(
|
|
134
140
|
null
|
|
135
|
-
), [
|
|
136
|
-
|
|
137
|
-
}, []), [
|
|
138
|
-
() =>
|
|
139
|
-
[
|
|
140
|
-
),
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
return
|
|
141
|
+
), [f, pr] = A(null), G = le(null), je = le({ x: 0, y: 0 }), Q = v((e) => {
|
|
142
|
+
G.current = e, pr(e);
|
|
143
|
+
}, []), [q, kt] = A(null), [Z, hr] = A(null), h = typeof N == "function", $ = le(null), Be = le({ x: 0, y: 0 }), [ke, Et] = A(!1), Ee = te === "single" || te === "multiple", qe = !!E, z = Ee && !he, Ie = Ln(H), Ae = !!(E != null && E.onReorderRows) && (E == null ? void 0 : E.enableRowReorder) !== !1 && !Ie && !X, yr = k(() => re != null && re.length ? new Map(re.map((e) => [e.key, e])) : /* @__PURE__ */ new Map(), [re]), It = k(() => ne != null && ne.length ? new Map(ne.map((e) => [e.value, e])) : /* @__PURE__ */ new Map(), [ne]), Y = k(
|
|
144
|
+
() => u.map((e) => e.key),
|
|
145
|
+
[u]
|
|
146
|
+
), wr = v((e) => {
|
|
147
|
+
ur((r) => {
|
|
148
|
+
const t = new Set(r);
|
|
149
|
+
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
144
150
|
});
|
|
145
|
-
}, []),
|
|
146
|
-
id: `loading-${
|
|
147
|
-
})) :
|
|
148
|
-
const
|
|
149
|
-
if (
|
|
150
|
-
return
|
|
151
|
-
const
|
|
152
|
-
return
|
|
153
|
-
}), [
|
|
154
|
-
(e) =>
|
|
155
|
-
) :
|
|
156
|
-
() =>
|
|
157
|
-
[
|
|
158
|
-
),
|
|
159
|
-
if (!
|
|
160
|
-
const e =
|
|
161
|
-
(
|
|
151
|
+
}, []), Le = k(() => X ? Array.from({ length: yt }, (e, r) => ({
|
|
152
|
+
id: `loading-${r}`
|
|
153
|
+
})) : d.map((e) => {
|
|
154
|
+
const r = e;
|
|
155
|
+
if (r.__rowId != null)
|
|
156
|
+
return r;
|
|
157
|
+
const t = ue(r);
|
|
158
|
+
return r.id != null && String(r.id) === t ? r : { ...r, id: t };
|
|
159
|
+
}), [X, d, yt]), b = k(() => X ? [] : Ie && H ? H.flatMap(
|
|
160
|
+
(e) => ve.has(e.key) ? [] : e.rows.map((r) => ue(r))
|
|
161
|
+
) : Le.map((e) => ue(e)), [X, Ie, H, ve, Le]), ie = k(
|
|
162
|
+
() => qt(C, b),
|
|
163
|
+
[C, b]
|
|
164
|
+
), Ke = vn(C, b), He = Ke > 0, Lt = He && !!(we ?? ge ?? me ?? xe), se = k(() => {
|
|
165
|
+
if (!He) return;
|
|
166
|
+
const e = d.filter(
|
|
167
|
+
(r) => ie.has(ue(r))
|
|
162
168
|
);
|
|
163
169
|
return {
|
|
164
|
-
selectedKeys:
|
|
170
|
+
selectedKeys: ie,
|
|
165
171
|
selectedRows: e,
|
|
166
|
-
clearSelection: () =>
|
|
167
|
-
busy:
|
|
172
|
+
clearSelection: () => D == null ? void 0 : D(/* @__PURE__ */ new Set()),
|
|
173
|
+
busy: be
|
|
168
174
|
};
|
|
169
175
|
}, [
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
]),
|
|
176
|
-
if (
|
|
177
|
-
if (
|
|
178
|
-
if (
|
|
179
|
-
if (
|
|
180
|
-
return
|
|
181
|
-
if (
|
|
182
|
-
return /* @__PURE__ */
|
|
183
|
-
|
|
176
|
+
He,
|
|
177
|
+
ie,
|
|
178
|
+
d,
|
|
179
|
+
D,
|
|
180
|
+
be
|
|
181
|
+
]), Nt = k(() => {
|
|
182
|
+
if (Ye != null) return Ye;
|
|
183
|
+
if (Lt) {
|
|
184
|
+
if (we != null) return we;
|
|
185
|
+
if (ge && se)
|
|
186
|
+
return ge(se);
|
|
187
|
+
if (se && (me || xe))
|
|
188
|
+
return /* @__PURE__ */ c(
|
|
189
|
+
un,
|
|
184
190
|
{
|
|
185
|
-
count:
|
|
186
|
-
onDuplicate:
|
|
187
|
-
onDelete:
|
|
188
|
-
onClearSelection:
|
|
189
|
-
busy:
|
|
191
|
+
count: Ke,
|
|
192
|
+
onDuplicate: me,
|
|
193
|
+
onDelete: xe,
|
|
194
|
+
onClearSelection: se.clearSelection,
|
|
195
|
+
busy: be
|
|
190
196
|
}
|
|
191
197
|
);
|
|
192
198
|
}
|
|
193
|
-
return
|
|
194
|
-
|
|
199
|
+
return R ? /* @__PURE__ */ c(
|
|
200
|
+
fn,
|
|
195
201
|
{
|
|
196
|
-
sort:
|
|
197
|
-
filter:
|
|
198
|
-
search:
|
|
199
|
-
rowHeight:
|
|
200
|
-
hideFields:
|
|
201
|
-
align:
|
|
202
|
-
groupBy:
|
|
203
|
-
summary:
|
|
204
|
-
sortContent:
|
|
205
|
-
filterContent:
|
|
206
|
-
fallbackTitle:
|
|
207
|
-
trailing:
|
|
208
|
-
searchCollapsible:
|
|
209
|
-
disableExtendedTools:
|
|
210
|
-
undoRedo:
|
|
211
|
-
...
|
|
212
|
-
isDisabled:
|
|
202
|
+
sort: R.sort,
|
|
203
|
+
filter: R.filter,
|
|
204
|
+
search: R.search,
|
|
205
|
+
rowHeight: R.rowHeight,
|
|
206
|
+
hideFields: R.hideFields,
|
|
207
|
+
align: R.align,
|
|
208
|
+
groupBy: R.groupBy,
|
|
209
|
+
summary: R.summary,
|
|
210
|
+
sortContent: R.sortContent,
|
|
211
|
+
filterContent: R.filterContent,
|
|
212
|
+
fallbackTitle: wt,
|
|
213
|
+
trailing: gt,
|
|
214
|
+
searchCollapsible: xt,
|
|
215
|
+
disableExtendedTools: ze,
|
|
216
|
+
undoRedo: R.undoRedo ? {
|
|
217
|
+
...R.undoRedo,
|
|
218
|
+
isDisabled: R.undoRedo.isDisabled ?? ze
|
|
213
219
|
} : void 0
|
|
214
220
|
}
|
|
215
221
|
) : null;
|
|
216
222
|
}, [
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
J,
|
|
222
|
-
ie,
|
|
223
|
+
Ye,
|
|
224
|
+
Lt,
|
|
225
|
+
we,
|
|
226
|
+
ge,
|
|
223
227
|
se,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
228
|
+
me,
|
|
229
|
+
xe,
|
|
230
|
+
be,
|
|
231
|
+
Ke,
|
|
232
|
+
R,
|
|
233
|
+
wt,
|
|
234
|
+
gt,
|
|
235
|
+
xt,
|
|
236
|
+
ze
|
|
237
|
+
]), Dt = Nt != null && nr !== !1, Pt = !!P && (P == null ? void 0 : P.showPagination) !== !1, gr = Dt || Pt, Wt = !X && d.length === 0 && mt != null, S = !!(or && F), Je = !!(F != null && F.showFooterRow), W = ir ?? (S || Je || qe), mr = Wt && !(Je && F), ae = u.length + (z ? 1 : 0) + (S ? 1 : 0), xr = !!(sr && Me), I = ye ? "border-r border-secondary last:border-r-0" : void 0, j = k(() => {
|
|
238
|
+
if (!L) return null;
|
|
239
|
+
const e = u.reduce(
|
|
240
|
+
(o, n) => fe(n) ? o + ct(dt(n)) : o,
|
|
235
241
|
0
|
|
236
242
|
);
|
|
237
|
-
return { minTableWidth:
|
|
238
|
-
(
|
|
243
|
+
return { minTableWidth: u.filter(
|
|
244
|
+
(o) => !fe(o)
|
|
239
245
|
).reduce(
|
|
240
|
-
(
|
|
246
|
+
(o, n) => o + ct(n.minWidth),
|
|
241
247
|
0
|
|
242
248
|
) + e };
|
|
243
|
-
}, [
|
|
249
|
+
}, [u, L]), br = k(() => {
|
|
244
250
|
const e = /* @__PURE__ */ new Map();
|
|
245
|
-
return
|
|
251
|
+
return Re && u.forEach((r) => {
|
|
246
252
|
e.set(
|
|
247
|
-
|
|
248
|
-
(
|
|
253
|
+
r.key,
|
|
254
|
+
(t) => Re(r.key, t)
|
|
249
255
|
);
|
|
250
256
|
}), e;
|
|
251
|
-
}, [
|
|
252
|
-
(e,
|
|
253
|
-
var
|
|
254
|
-
let
|
|
255
|
-
if (
|
|
256
|
-
const
|
|
257
|
-
|
|
257
|
+
}, [u, Re]), x = le(null), [ce, _t] = A(null), Ve = v(
|
|
258
|
+
(e, r, t) => {
|
|
259
|
+
var s;
|
|
260
|
+
let o = t ?? null;
|
|
261
|
+
if (o == null) {
|
|
262
|
+
const l = (s = $r(
|
|
263
|
+
x.current,
|
|
258
264
|
e,
|
|
259
|
-
|
|
260
|
-
)) == null ? void 0 :
|
|
261
|
-
|
|
265
|
+
r
|
|
266
|
+
)) == null ? void 0 : s.getAttribute("data-grid-source-index"), p = l != null && l !== "" ? Number(l) : NaN;
|
|
267
|
+
o = Number.isNaN(p) ? null : p;
|
|
268
|
+
}
|
|
269
|
+
const n = {
|
|
270
|
+
rowId: e,
|
|
271
|
+
columnKey: r,
|
|
272
|
+
sourceIndex: o
|
|
273
|
+
};
|
|
274
|
+
if (h) {
|
|
275
|
+
N == null || N(st(n));
|
|
276
|
+
return;
|
|
262
277
|
}
|
|
263
|
-
|
|
278
|
+
kt(n);
|
|
279
|
+
},
|
|
280
|
+
[h, N]
|
|
281
|
+
), Ne = v(() => {
|
|
282
|
+
if (h) {
|
|
283
|
+
N == null || N(null);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
kt(null);
|
|
287
|
+
}, [h, N]), ee = h ? (y == null ? void 0 : y.focus) ?? null : q, M = v(
|
|
288
|
+
(e) => {
|
|
289
|
+
h && (N == null || N(e));
|
|
264
290
|
},
|
|
265
|
-
[]
|
|
266
|
-
),
|
|
291
|
+
[h, N]
|
|
292
|
+
), Rr = v(
|
|
267
293
|
(e) => {
|
|
268
|
-
var
|
|
269
|
-
const
|
|
270
|
-
if (e.key !== "Enter" && e.key !== "Tab" && e.key !== "Escape" && !
|
|
294
|
+
var de, T, Ce;
|
|
295
|
+
const r = e.key in Bt;
|
|
296
|
+
if (e.key !== "Enter" && e.key !== "Tab" && e.key !== "Escape" && e.key !== "Delete" && e.key !== "Backspace" && !r || Te(e.target)) return;
|
|
271
297
|
if (e.key === "Escape") {
|
|
272
|
-
if (!
|
|
273
|
-
e.preventDefault(), e.stopPropagation(),
|
|
298
|
+
if (!ee && !y) return;
|
|
299
|
+
e.preventDefault(), e.stopPropagation(), Ne(), (de = x.current) != null && de.contains(document.activeElement) && document.activeElement.blur();
|
|
274
300
|
return;
|
|
275
301
|
}
|
|
276
|
-
const
|
|
277
|
-
|
|
302
|
+
const t = (Ce = (T = e.target).closest) == null ? void 0 : Ce.call(
|
|
303
|
+
T,
|
|
278
304
|
"[data-grid-cell]"
|
|
279
|
-
),
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
305
|
+
), o = t ? Oe(t) : null, n = h && r && e.shiftKey && !ee && !o ? nn(e.target, x.current) : null, s = n != null && ie.has(n.rowId), l = ee ?? o ?? (s ? n : null);
|
|
306
|
+
if (!l) return;
|
|
307
|
+
if (e.key === "Delete" || e.key === "Backspace") {
|
|
308
|
+
if (!h || !y || !$e) return;
|
|
309
|
+
const O = at(
|
|
310
|
+
y,
|
|
311
|
+
b,
|
|
312
|
+
Y
|
|
313
|
+
);
|
|
314
|
+
if (!O) return;
|
|
315
|
+
e.preventDefault(), e.stopPropagation(), $e({ selection: y, rect: O, event: e.nativeEvent });
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
287
318
|
if (e.key === "Enter") {
|
|
288
|
-
if (!
|
|
289
|
-
e.preventDefault(), e.stopPropagation(),
|
|
290
|
-
rowId:
|
|
291
|
-
columnKey:
|
|
292
|
-
sourceIndex:
|
|
319
|
+
if (!V) return;
|
|
320
|
+
e.preventDefault(), e.stopPropagation(), V({
|
|
321
|
+
rowId: l.rowId,
|
|
322
|
+
columnKey: l.columnKey,
|
|
323
|
+
sourceIndex: l.sourceIndex
|
|
293
324
|
});
|
|
294
325
|
return;
|
|
295
326
|
}
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
) :
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
327
|
+
const p = h && e.shiftKey && r, w = r ? jr(
|
|
328
|
+
x.current,
|
|
329
|
+
b,
|
|
330
|
+
Y,
|
|
331
|
+
l.rowId,
|
|
332
|
+
l.columnKey,
|
|
333
|
+
Bt[e.key]
|
|
334
|
+
) : Br(
|
|
335
|
+
x.current,
|
|
336
|
+
b,
|
|
337
|
+
Y,
|
|
338
|
+
l.rowId,
|
|
339
|
+
l.columnKey,
|
|
309
340
|
!e.shiftKey
|
|
310
341
|
);
|
|
311
|
-
if (!
|
|
312
|
-
|
|
342
|
+
if (!w && !(p && !y)) {
|
|
343
|
+
r && (e.preventDefault(), e.stopPropagation());
|
|
313
344
|
return;
|
|
314
345
|
}
|
|
315
|
-
e.preventDefault(), e.stopPropagation()
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
346
|
+
e.preventDefault(), e.stopPropagation();
|
|
347
|
+
const it = w ? {
|
|
348
|
+
rowId: w.rowId,
|
|
349
|
+
columnKey: w.columnKey,
|
|
350
|
+
sourceIndex: w.sourceIndex
|
|
351
|
+
} : null, _e = s ? null : it;
|
|
352
|
+
if (h) {
|
|
353
|
+
const O = on(
|
|
354
|
+
l,
|
|
355
|
+
_e,
|
|
356
|
+
y,
|
|
357
|
+
p
|
|
358
|
+
);
|
|
359
|
+
O && O !== y && M(O);
|
|
360
|
+
} else w && Ve(w.rowId, w.columnKey, w.sourceIndex);
|
|
361
|
+
const Se = _e ?? l;
|
|
362
|
+
requestAnimationFrame(
|
|
363
|
+
() => Ut(
|
|
364
|
+
x.current,
|
|
365
|
+
Se.rowId,
|
|
366
|
+
Se.columnKey
|
|
320
367
|
)
|
|
321
368
|
);
|
|
322
369
|
},
|
|
323
|
-
[
|
|
370
|
+
[
|
|
371
|
+
ee,
|
|
372
|
+
b,
|
|
373
|
+
h,
|
|
374
|
+
y,
|
|
375
|
+
Ne,
|
|
376
|
+
Y,
|
|
377
|
+
M,
|
|
378
|
+
ie,
|
|
379
|
+
V,
|
|
380
|
+
$e,
|
|
381
|
+
Ve
|
|
382
|
+
]
|
|
324
383
|
);
|
|
325
|
-
|
|
326
|
-
if (!
|
|
327
|
-
const e = (
|
|
328
|
-
const
|
|
329
|
-
|
|
384
|
+
B(() => {
|
|
385
|
+
if (!W || !ee && !y) return;
|
|
386
|
+
const e = (r) => {
|
|
387
|
+
const t = x.current;
|
|
388
|
+
t && !t.contains(r.target) && Ne();
|
|
330
389
|
};
|
|
331
390
|
return document.addEventListener("pointerdown", e, !0), () => document.removeEventListener("pointerdown", e, !0);
|
|
332
|
-
}, [
|
|
333
|
-
const
|
|
391
|
+
}, [W, ee, y, Ne]);
|
|
392
|
+
const St = k(() => {
|
|
334
393
|
let e = 0;
|
|
335
|
-
return
|
|
336
|
-
|
|
394
|
+
return z && (e += 40), S && (e += 56), u.forEach((r) => {
|
|
395
|
+
fe(r) && (e += ct(dt(r)));
|
|
337
396
|
}), e;
|
|
338
|
-
}, [
|
|
339
|
-
() =>
|
|
340
|
-
[
|
|
341
|
-
),
|
|
342
|
-
if (!
|
|
343
|
-
const { minTableWidth: e } =
|
|
344
|
-
return
|
|
345
|
-
}, [
|
|
397
|
+
}, [u, S, z]), Qe = k(
|
|
398
|
+
() => u.filter((e) => !fe(e)).length,
|
|
399
|
+
[u]
|
|
400
|
+
), Ze = k(() => {
|
|
401
|
+
if (!L || !j) return null;
|
|
402
|
+
const { minTableWidth: e } = j;
|
|
403
|
+
return ce ? Math.max(ce, e) : e;
|
|
404
|
+
}, [ce, L, j]), et = !!(L && j && ce && ce < j.minTableWidth), tt = k(() => !Ze || Qe === 0 ? null : Math.max(
|
|
346
405
|
0,
|
|
347
|
-
(
|
|
348
|
-
), [
|
|
349
|
-
|
|
350
|
-
if (!
|
|
351
|
-
|
|
406
|
+
(Ze - St) / Qe
|
|
407
|
+
), [Ze, St, Qe]);
|
|
408
|
+
Gr(() => {
|
|
409
|
+
if (!L) {
|
|
410
|
+
_t(null);
|
|
352
411
|
return;
|
|
353
412
|
}
|
|
354
|
-
const e =
|
|
413
|
+
const e = x.current;
|
|
355
414
|
if (!e) return;
|
|
356
|
-
const
|
|
357
|
-
const
|
|
358
|
-
|
|
415
|
+
const r = () => {
|
|
416
|
+
const o = e.clientWidth;
|
|
417
|
+
o > 0 && _t((n) => n === o ? n : o);
|
|
359
418
|
};
|
|
360
|
-
|
|
361
|
-
const
|
|
362
|
-
return
|
|
363
|
-
|
|
419
|
+
r();
|
|
420
|
+
const t = new ResizeObserver(r);
|
|
421
|
+
return t.observe(e), () => {
|
|
422
|
+
t.disconnect();
|
|
364
423
|
};
|
|
365
424
|
}, [
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
425
|
+
u.length,
|
|
426
|
+
d.length,
|
|
427
|
+
L,
|
|
428
|
+
X,
|
|
429
|
+
S,
|
|
430
|
+
z
|
|
372
431
|
]);
|
|
373
|
-
const
|
|
374
|
-
(e) =>
|
|
375
|
-
width: `${
|
|
432
|
+
const rt = v(
|
|
433
|
+
(e) => L ? fe(e) ? Kt(e) : tt != null ? {
|
|
434
|
+
width: `${tt}px`,
|
|
376
435
|
minWidth: e.minWidth,
|
|
377
|
-
maxWidth: e.maxWidth ??
|
|
378
|
-
} :
|
|
379
|
-
[
|
|
380
|
-
),
|
|
381
|
-
if (!(!
|
|
382
|
-
return
|
|
383
|
-
width: `${
|
|
436
|
+
maxWidth: e.maxWidth ?? lt
|
|
437
|
+
} : Kt(e) : Nn(e),
|
|
438
|
+
[L, tt]
|
|
439
|
+
), vr = k(() => {
|
|
440
|
+
if (!(!L || !j))
|
|
441
|
+
return et ? {
|
|
442
|
+
width: `${j.minTableWidth}px`,
|
|
384
443
|
tableLayout: "fixed"
|
|
385
444
|
} : {
|
|
386
445
|
width: "100%",
|
|
387
446
|
tableLayout: "fixed"
|
|
388
447
|
};
|
|
389
|
-
}, [
|
|
448
|
+
}, [L, j, et]), kr = v(
|
|
390
449
|
(e) => {
|
|
391
|
-
|
|
450
|
+
x.current = e, typeof oe == "function" ? oe(e) : oe && (oe.current = e);
|
|
392
451
|
},
|
|
393
|
-
[
|
|
394
|
-
),
|
|
395
|
-
selectionMode:
|
|
396
|
-
selectedKeys:
|
|
397
|
-
onSelectionChange:
|
|
398
|
-
} : {},
|
|
399
|
-
const
|
|
400
|
-
return typeof
|
|
401
|
-
},
|
|
452
|
+
[oe]
|
|
453
|
+
), Er = Ee && he ? {
|
|
454
|
+
selectionMode: te,
|
|
455
|
+
selectedKeys: C === "all" ? "all" : C,
|
|
456
|
+
onSelectionChange: In(D)
|
|
457
|
+
} : {}, Ir = (e, r = 0) => {
|
|
458
|
+
const t = e.__sourceIndex;
|
|
459
|
+
return typeof t == "number" ? t : r;
|
|
460
|
+
}, De = v(
|
|
402
461
|
(e) => {
|
|
403
|
-
const
|
|
404
|
-
if (!t) return;
|
|
405
|
-
const { fromSourceIndex: r, toSourceIndex: a, item: i, active: d } = t;
|
|
406
|
-
Y(null), e && d && r !== a && (x != null && x.onReorderRows) && x.onReorderRows(r, a, i);
|
|
407
|
-
},
|
|
408
|
-
[x, Y]
|
|
409
|
-
), at = T(
|
|
410
|
-
(e, t) => {
|
|
411
|
-
const r = z.current;
|
|
462
|
+
const r = G.current;
|
|
412
463
|
if (!r) return;
|
|
413
|
-
const
|
|
414
|
-
|
|
415
|
-
|
|
464
|
+
const { fromSourceIndex: t, toSourceIndex: o, item: n, active: s } = r;
|
|
465
|
+
Q(null), e && s && t !== o && (E != null && E.onReorderRows) && E.onReorderRows(t, o, n);
|
|
466
|
+
},
|
|
467
|
+
[E, Q]
|
|
468
|
+
), Pe = v(
|
|
469
|
+
(e, r) => {
|
|
470
|
+
const t = G.current;
|
|
471
|
+
if (!t) return;
|
|
472
|
+
je.current = { x: e, y: r };
|
|
473
|
+
const o = e - t.startX, n = r - t.startY, s = Math.hypot(o, n), l = t.active || s >= Ar;
|
|
474
|
+
let p = {
|
|
475
|
+
...t,
|
|
416
476
|
currentX: e,
|
|
417
|
-
currentY:
|
|
418
|
-
active:
|
|
477
|
+
currentY: r,
|
|
478
|
+
active: l
|
|
419
479
|
};
|
|
420
|
-
if (
|
|
421
|
-
|
|
422
|
-
const
|
|
423
|
-
if (
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
480
|
+
if (l) {
|
|
481
|
+
t.active || vt(null);
|
|
482
|
+
const w = x.current;
|
|
483
|
+
if (w) {
|
|
484
|
+
const a = Kr(
|
|
485
|
+
w,
|
|
486
|
+
r,
|
|
487
|
+
t.fromSourceIndex,
|
|
488
|
+
t.rowId
|
|
429
489
|
);
|
|
430
|
-
|
|
431
|
-
...
|
|
432
|
-
toSourceIndex:
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
490
|
+
a && (p = {
|
|
491
|
+
...p,
|
|
492
|
+
toSourceIndex: a.toSourceIndex,
|
|
493
|
+
// Clip to scrollport so the line never draws over the header / outside the card.
|
|
494
|
+
dropLineY: Hr(
|
|
495
|
+
a.dropLineY,
|
|
496
|
+
w
|
|
497
|
+
),
|
|
498
|
+
dropLineLeft: a.dropLineLeft,
|
|
499
|
+
dropLineWidth: a.dropLineWidth
|
|
436
500
|
});
|
|
437
501
|
}
|
|
438
502
|
}
|
|
439
|
-
|
|
503
|
+
Q(p);
|
|
440
504
|
},
|
|
441
|
-
[
|
|
442
|
-
),
|
|
443
|
-
(e,
|
|
444
|
-
var
|
|
445
|
-
if (!
|
|
446
|
-
const
|
|
447
|
-
`tr[${
|
|
505
|
+
[Q]
|
|
506
|
+
), Lr = v(
|
|
507
|
+
(e, r, t, o) => {
|
|
508
|
+
var w, a;
|
|
509
|
+
if (!Ae || e.button !== 0) return;
|
|
510
|
+
const n = (w = x.current) == null ? void 0 : w.querySelector(
|
|
511
|
+
`tr[${Xt}="${CSS.escape(r)}"]`
|
|
448
512
|
);
|
|
449
|
-
if (!
|
|
513
|
+
if (!n) return;
|
|
450
514
|
e.preventDefault();
|
|
451
515
|
try {
|
|
452
516
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
453
517
|
} catch {
|
|
454
518
|
}
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
rowId:
|
|
458
|
-
fromSourceIndex:
|
|
459
|
-
item:
|
|
519
|
+
const s = Jr(n), l = Vr(n), p = ((a = n.closest("table")) == null ? void 0 : a.getBoundingClientRect()) ?? n.getBoundingClientRect();
|
|
520
|
+
je.current = { x: e.clientX, y: e.clientY }, Q({
|
|
521
|
+
rowId: r,
|
|
522
|
+
fromSourceIndex: t,
|
|
523
|
+
item: o,
|
|
460
524
|
pointerId: e.pointerId,
|
|
461
525
|
startX: e.clientX,
|
|
462
526
|
startY: e.clientY,
|
|
463
527
|
currentX: e.clientX,
|
|
464
528
|
currentY: e.clientY,
|
|
465
529
|
active: !1,
|
|
466
|
-
preview:
|
|
467
|
-
toSourceIndex:
|
|
530
|
+
preview: s,
|
|
531
|
+
toSourceIndex: t,
|
|
468
532
|
dropLineY: null,
|
|
469
|
-
dropLineLeft:
|
|
470
|
-
dropLineWidth:
|
|
471
|
-
rowClone:
|
|
533
|
+
dropLineLeft: p.left,
|
|
534
|
+
dropLineWidth: p.width,
|
|
535
|
+
rowClone: l
|
|
472
536
|
});
|
|
473
537
|
},
|
|
474
|
-
[
|
|
475
|
-
),
|
|
476
|
-
|
|
477
|
-
if (!
|
|
478
|
-
const e = (
|
|
479
|
-
var
|
|
480
|
-
|
|
481
|
-
},
|
|
482
|
-
var
|
|
483
|
-
|
|
484
|
-
},
|
|
485
|
-
var
|
|
486
|
-
|
|
487
|
-
},
|
|
488
|
-
|
|
538
|
+
[Ae, Q]
|
|
539
|
+
), Ct = f != null;
|
|
540
|
+
B(() => {
|
|
541
|
+
if (!Ct) return;
|
|
542
|
+
const e = (n) => {
|
|
543
|
+
var s;
|
|
544
|
+
n.pointerId === ((s = G.current) == null ? void 0 : s.pointerId) && Pe(n.clientX, n.clientY);
|
|
545
|
+
}, r = (n) => {
|
|
546
|
+
var s;
|
|
547
|
+
n.pointerId === ((s = G.current) == null ? void 0 : s.pointerId) && De(!0);
|
|
548
|
+
}, t = (n) => {
|
|
549
|
+
var s;
|
|
550
|
+
n.pointerId === ((s = G.current) == null ? void 0 : s.pointerId) && De(!1);
|
|
551
|
+
}, o = (n) => {
|
|
552
|
+
n.key === "Escape" && (n.preventDefault(), De(!1));
|
|
489
553
|
};
|
|
490
|
-
return window.addEventListener("pointermove", e), window.addEventListener("pointerup",
|
|
491
|
-
window.removeEventListener("pointermove", e), window.removeEventListener("pointerup",
|
|
554
|
+
return window.addEventListener("pointermove", e), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", t), window.addEventListener("keydown", o), () => {
|
|
555
|
+
window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", t), window.removeEventListener("keydown", o);
|
|
492
556
|
};
|
|
493
|
-
}, [
|
|
494
|
-
if (!(
|
|
495
|
-
const e = document.body.style.userSelect,
|
|
557
|
+
}, [Ct, De, Pe]), B(() => {
|
|
558
|
+
if (!(f != null && f.active)) return;
|
|
559
|
+
const e = document.body.style.userSelect, r = document.body.style.cursor;
|
|
496
560
|
return document.body.style.userSelect = "none", document.body.style.cursor = "grabbing", () => {
|
|
497
|
-
document.body.style.userSelect = e, document.body.style.cursor =
|
|
561
|
+
document.body.style.userSelect = e, document.body.style.cursor = r;
|
|
562
|
+
};
|
|
563
|
+
}, [f == null ? void 0 : f.active]), B(() => {
|
|
564
|
+
if (!(f != null && f.active)) return;
|
|
565
|
+
let e = 0;
|
|
566
|
+
const r = () => {
|
|
567
|
+
const t = G.current, o = x.current;
|
|
568
|
+
if (!(t != null && t.active) || !o) return;
|
|
569
|
+
const { x: n, y: s } = je.current, l = en(o, s);
|
|
570
|
+
l !== 0 && (o.scrollTop += l, Pe(n, s)), e = requestAnimationFrame(r);
|
|
498
571
|
};
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
572
|
+
return e = requestAnimationFrame(r), () => cancelAnimationFrame(e);
|
|
573
|
+
}, [f == null ? void 0 : f.active, Pe]);
|
|
574
|
+
const We = v(
|
|
575
|
+
(e, r) => {
|
|
576
|
+
const t = $.current, o = x.current;
|
|
577
|
+
if (!t || !o) return;
|
|
578
|
+
Be.current = { x: e, y: r };
|
|
579
|
+
const n = e - t.startX, s = r - t.startY, l = Math.hypot(n, s), p = t.active || l >= sn;
|
|
580
|
+
if (p && !t.active && (t.active = !0, Et(!0)), !p) return;
|
|
581
|
+
const w = an(o, e, r), a = w ? Oe(w) : null;
|
|
582
|
+
a && (t.focus = a, M({
|
|
583
|
+
anchor: t.anchor,
|
|
584
|
+
focus: a
|
|
585
|
+
}));
|
|
586
|
+
},
|
|
587
|
+
[M]
|
|
588
|
+
), nt = v((e) => {
|
|
589
|
+
const r = $.current;
|
|
590
|
+
$.current = null, Et(!1), r && requestAnimationFrame(
|
|
591
|
+
() => Ut(
|
|
592
|
+
x.current,
|
|
593
|
+
r.focus.rowId,
|
|
594
|
+
r.focus.columnKey
|
|
595
|
+
)
|
|
596
|
+
);
|
|
597
|
+
}, []), Nr = v(
|
|
598
|
+
(e) => {
|
|
599
|
+
if (!h || !W || !V || Te(e.target)) return;
|
|
600
|
+
const r = $t(
|
|
601
|
+
e.target,
|
|
602
|
+
x.current
|
|
603
|
+
);
|
|
604
|
+
if (!r) return;
|
|
605
|
+
const t = Oe(r);
|
|
606
|
+
t && (e.preventDefault(), e.stopPropagation(), M(st(t)), V({
|
|
607
|
+
rowId: t.rowId,
|
|
608
|
+
columnKey: t.columnKey,
|
|
609
|
+
sourceIndex: t.sourceIndex
|
|
610
|
+
}));
|
|
611
|
+
},
|
|
612
|
+
[h, M, W, V]
|
|
613
|
+
), Dr = v(
|
|
614
|
+
(e) => {
|
|
615
|
+
if (!h || !W || e.button !== 0 || G.current) return;
|
|
616
|
+
const r = $t(
|
|
617
|
+
e.target,
|
|
618
|
+
x.current
|
|
619
|
+
);
|
|
620
|
+
if (!r) return;
|
|
621
|
+
const t = Oe(r);
|
|
622
|
+
if (!t) return;
|
|
623
|
+
const o = e.shiftKey && y != null, n = o ? y.anchor : t;
|
|
624
|
+
Be.current = { x: e.clientX, y: e.clientY }, $.current = {
|
|
625
|
+
pointerId: e.pointerId,
|
|
626
|
+
startX: e.clientX,
|
|
627
|
+
startY: e.clientY,
|
|
628
|
+
active: !1,
|
|
629
|
+
anchor: n,
|
|
630
|
+
origin: t,
|
|
631
|
+
focus: t,
|
|
632
|
+
extend: o
|
|
633
|
+
}, M(o ? { anchor: n, focus: t } : st(t));
|
|
634
|
+
},
|
|
635
|
+
[h, y, M, W]
|
|
636
|
+
);
|
|
637
|
+
B(() => {
|
|
638
|
+
if (!h) return;
|
|
639
|
+
const e = (o) => {
|
|
640
|
+
const n = $.current;
|
|
641
|
+
!n || o.pointerId !== n.pointerId || (o.preventDefault(), We(o.clientX, o.clientY));
|
|
642
|
+
}, r = (o) => {
|
|
643
|
+
const n = $.current;
|
|
644
|
+
!n || o.pointerId !== n.pointerId || nt(!0);
|
|
645
|
+
}, t = (o) => {
|
|
646
|
+
const n = $.current;
|
|
647
|
+
!n || o.pointerId !== n.pointerId || nt(!1);
|
|
648
|
+
};
|
|
649
|
+
return window.addEventListener("pointermove", e), window.addEventListener("pointerup", r), window.addEventListener("pointercancel", t), () => {
|
|
650
|
+
window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", r), window.removeEventListener("pointercancel", t);
|
|
651
|
+
};
|
|
652
|
+
}, [h, nt, We]), B(() => {
|
|
653
|
+
if (!ke) return;
|
|
654
|
+
const e = document.body.style.userSelect;
|
|
655
|
+
return document.body.style.userSelect = "none", () => {
|
|
656
|
+
document.body.style.userSelect = e;
|
|
657
|
+
};
|
|
658
|
+
}, [ke]), B(() => {
|
|
659
|
+
if (!ke) return;
|
|
660
|
+
let e = 0;
|
|
661
|
+
const r = () => {
|
|
662
|
+
const t = $.current, o = x.current;
|
|
663
|
+
if (!(t != null && t.active) || !o) return;
|
|
664
|
+
const { x: n, y: s } = Be.current, { dx: l, dy: p } = cn(o, n, s);
|
|
665
|
+
(l !== 0 || p !== 0) && (l !== 0 && (o.scrollLeft += l), p !== 0 && (o.scrollTop += p), We(n, s)), e = requestAnimationFrame(r);
|
|
666
|
+
};
|
|
667
|
+
return e = requestAnimationFrame(r), () => cancelAnimationFrame(e);
|
|
668
|
+
}, [ke, We]), B(() => {
|
|
669
|
+
if (!h || !y) return;
|
|
670
|
+
const e = (t) => {
|
|
671
|
+
if (Te(t.target)) return;
|
|
672
|
+
const o = x.current;
|
|
673
|
+
if (!o) return;
|
|
674
|
+
const n = document.activeElement;
|
|
675
|
+
if (n && !o.contains(n) && t.target instanceof Node && !o.contains(t.target))
|
|
676
|
+
return;
|
|
677
|
+
const s = at(
|
|
678
|
+
y,
|
|
679
|
+
b,
|
|
680
|
+
Y
|
|
681
|
+
);
|
|
682
|
+
!s || !Ue || (t.preventDefault(), Ue({ selection: y, rect: s, event: t }));
|
|
683
|
+
}, r = (t) => {
|
|
684
|
+
var p;
|
|
685
|
+
if (Te(t.target)) return;
|
|
686
|
+
const o = x.current;
|
|
687
|
+
if (!o) return;
|
|
688
|
+
const n = document.activeElement;
|
|
689
|
+
if (n && !o.contains(n) && t.target instanceof Node && !o.contains(t.target))
|
|
690
|
+
return;
|
|
691
|
+
const s = at(
|
|
692
|
+
y,
|
|
693
|
+
b,
|
|
694
|
+
Y
|
|
695
|
+
);
|
|
696
|
+
if (!s || !Xe) return;
|
|
697
|
+
const l = ((p = t.clipboardData) == null ? void 0 : p.getData("text/plain")) ?? "";
|
|
698
|
+
t.preventDefault(), Xe({ selection: y, rect: s, text: l, event: t });
|
|
699
|
+
};
|
|
700
|
+
return document.addEventListener("copy", e), document.addEventListener("paste", r), () => {
|
|
701
|
+
document.removeEventListener("copy", e), document.removeEventListener("paste", r);
|
|
702
|
+
};
|
|
703
|
+
}, [
|
|
704
|
+
b,
|
|
705
|
+
h,
|
|
706
|
+
y,
|
|
707
|
+
Y,
|
|
708
|
+
Ue,
|
|
709
|
+
Xe
|
|
710
|
+
]);
|
|
711
|
+
const ot = Ee && kn(C, b), Pr = Ee && En(C, b), Wr = () => {
|
|
712
|
+
if (D) {
|
|
713
|
+
if (ot) {
|
|
714
|
+
D(/* @__PURE__ */ new Set());
|
|
504
715
|
return;
|
|
505
716
|
}
|
|
506
|
-
|
|
717
|
+
D("all");
|
|
507
718
|
}
|
|
508
|
-
},
|
|
509
|
-
if (!
|
|
510
|
-
if (
|
|
511
|
-
|
|
719
|
+
}, _r = (e, r) => {
|
|
720
|
+
if (!D) return;
|
|
721
|
+
if (te === "single") {
|
|
722
|
+
D(r ? /* @__PURE__ */ new Set([e]) : /* @__PURE__ */ new Set());
|
|
512
723
|
return;
|
|
513
724
|
}
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
},
|
|
517
|
-
const
|
|
518
|
-
return
|
|
519
|
-
|
|
725
|
+
const t = C === "all" ? new Set(b) : new Set(qt(C, b));
|
|
726
|
+
r ? t.add(e) : t.delete(e), D(t);
|
|
727
|
+
}, Sr = (e) => {
|
|
728
|
+
const r = ve.has(e.key);
|
|
729
|
+
return Rt ? /* @__PURE__ */ c(
|
|
730
|
+
g.Row,
|
|
520
731
|
{
|
|
521
732
|
id: `group-${e.key}`,
|
|
522
733
|
highlightSelectedRow: !1,
|
|
523
734
|
className: "bg-secondary_subtle hover:bg-secondary_subtle",
|
|
524
|
-
children: /* @__PURE__ */
|
|
735
|
+
children: /* @__PURE__ */ c(g.Cell, { colSpan: ae, className: m(I), children: Rt(e) })
|
|
525
736
|
},
|
|
526
737
|
`group-${e.key}`
|
|
527
|
-
) : /* @__PURE__ */
|
|
528
|
-
|
|
738
|
+
) : /* @__PURE__ */ c(
|
|
739
|
+
g.Row,
|
|
529
740
|
{
|
|
530
741
|
id: `group-${e.key}`,
|
|
531
742
|
highlightSelectedRow: !1,
|
|
532
743
|
className: "bg-secondary_subtle hover:bg-secondary_subtle",
|
|
533
|
-
children: /* @__PURE__ */
|
|
534
|
-
|
|
744
|
+
children: /* @__PURE__ */ c(
|
|
745
|
+
g.Cell,
|
|
535
746
|
{
|
|
536
|
-
colSpan:
|
|
537
|
-
className:
|
|
538
|
-
children: /* @__PURE__ */
|
|
747
|
+
colSpan: ae,
|
|
748
|
+
className: m("py-1.5", I),
|
|
749
|
+
children: /* @__PURE__ */ _(
|
|
539
750
|
"button",
|
|
540
751
|
{
|
|
541
752
|
type: "button",
|
|
542
753
|
className: "flex w-full items-center gap-2 px-2 text-left text-xs font-medium text-secondary",
|
|
543
|
-
onClick: () =>
|
|
544
|
-
"aria-expanded": !
|
|
754
|
+
onClick: () => wr(e.key),
|
|
755
|
+
"aria-expanded": !r,
|
|
545
756
|
children: [
|
|
546
|
-
/* @__PURE__ */
|
|
547
|
-
|
|
757
|
+
/* @__PURE__ */ c(
|
|
758
|
+
zr,
|
|
548
759
|
{
|
|
549
|
-
className:
|
|
760
|
+
className: m(
|
|
550
761
|
"size-4 shrink-0 text-fg-quaternary transition-transform",
|
|
551
|
-
!
|
|
762
|
+
!r && "rotate-90"
|
|
552
763
|
)
|
|
553
764
|
}
|
|
554
765
|
),
|
|
555
|
-
/* @__PURE__ */
|
|
556
|
-
/* @__PURE__ */
|
|
766
|
+
/* @__PURE__ */ c("span", { className: "truncate", children: e.label || "(Empty)" }),
|
|
767
|
+
/* @__PURE__ */ _("span", { className: "text-tertiary", children: [
|
|
557
768
|
"(",
|
|
558
769
|
e.rows.length,
|
|
559
770
|
")"
|
|
@@ -566,55 +777,56 @@ const Me = "300px", Ge = (n) => {
|
|
|
566
777
|
},
|
|
567
778
|
`group-${e.key}`
|
|
568
779
|
);
|
|
569
|
-
},
|
|
570
|
-
const
|
|
571
|
-
return /* @__PURE__ */
|
|
572
|
-
|
|
780
|
+
}, Tt = (e, r, t = 0) => {
|
|
781
|
+
const o = ht ? ht(e) : !1, n = ue(e), s = Ir(e, t), l = Rn(C, n, b), p = fr === n, w = (f == null ? void 0 : f.active) === !0 && f.rowId === n;
|
|
782
|
+
return /* @__PURE__ */ _(
|
|
783
|
+
g.Row,
|
|
573
784
|
{
|
|
574
785
|
onAction: () => {
|
|
575
|
-
var
|
|
576
|
-
(
|
|
786
|
+
var a;
|
|
787
|
+
(a = G.current) != null && a.active || pe == null || pe(e);
|
|
577
788
|
},
|
|
578
|
-
onMouseEnter: () =>
|
|
579
|
-
onMouseLeave: () =>
|
|
580
|
-
id:
|
|
789
|
+
onMouseEnter: () => K == null ? void 0 : K(e, !0),
|
|
790
|
+
onMouseLeave: () => K == null ? void 0 : K(e, !1),
|
|
791
|
+
id: n,
|
|
581
792
|
value: e,
|
|
582
|
-
columns:
|
|
583
|
-
expandedColSpan:
|
|
584
|
-
isExpandable:
|
|
585
|
-
highlightSelectedRow:
|
|
586
|
-
renderExpandedContent:
|
|
587
|
-
[
|
|
588
|
-
[
|
|
589
|
-
className:
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
ge == null ? void 0 : ge(e)
|
|
793
|
+
columns: u,
|
|
794
|
+
expandedColSpan: ae,
|
|
795
|
+
isExpandable: o,
|
|
796
|
+
highlightSelectedRow: he,
|
|
797
|
+
renderExpandedContent: o ? tr : void 0,
|
|
798
|
+
[Xt]: n,
|
|
799
|
+
[rn]: String(s),
|
|
800
|
+
className: m(
|
|
801
|
+
pe && "cursor-pointer",
|
|
802
|
+
Vt ? "prose" : "",
|
|
803
|
+
pt && "[&>td]:after:hidden",
|
|
804
|
+
qe && "group/rowactions",
|
|
805
|
+
p && "bg-utility-brand-25 hover:bg-utility-brand-25",
|
|
806
|
+
z && l && "bg-secondary",
|
|
807
|
+
bt,
|
|
808
|
+
Ge == null ? void 0 : Ge(e)
|
|
599
809
|
),
|
|
810
|
+
style: w ? tn : void 0,
|
|
600
811
|
children: [
|
|
601
|
-
|
|
602
|
-
|
|
812
|
+
z && /* @__PURE__ */ c(
|
|
813
|
+
g.Cell,
|
|
603
814
|
{
|
|
604
|
-
|
|
815
|
+
"data-grid-no-range": "",
|
|
816
|
+
className: m("relative w-10 text-center", I),
|
|
605
817
|
style: { minWidth: "40px", width: "40px" },
|
|
606
|
-
children: /* @__PURE__ */
|
|
818
|
+
children: /* @__PURE__ */ c(
|
|
607
819
|
"div",
|
|
608
820
|
{
|
|
609
821
|
className: "flex items-center justify-center",
|
|
610
|
-
onClick: (
|
|
611
|
-
onKeyDown: (
|
|
612
|
-
children: /* @__PURE__ */
|
|
613
|
-
|
|
822
|
+
onClick: (a) => a.stopPropagation(),
|
|
823
|
+
onKeyDown: (a) => a.stopPropagation(),
|
|
824
|
+
children: /* @__PURE__ */ c(
|
|
825
|
+
jt,
|
|
614
826
|
{
|
|
615
|
-
checked:
|
|
616
|
-
onCheckedChange: (
|
|
617
|
-
"aria-label": `Select row ${
|
|
827
|
+
checked: l,
|
|
828
|
+
onCheckedChange: (a) => _r(n, a === !0),
|
|
829
|
+
"aria-label": `Select row ${n}`,
|
|
618
830
|
className: "items-center justify-center"
|
|
619
831
|
}
|
|
620
832
|
)
|
|
@@ -622,203 +834,216 @@ const Me = "300px", Ge = (n) => {
|
|
|
622
834
|
)
|
|
623
835
|
}
|
|
624
836
|
),
|
|
625
|
-
|
|
626
|
-
const
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
),
|
|
631
|
-
|
|
632
|
-
|
|
837
|
+
u.map((a, it) => {
|
|
838
|
+
const _e = It.get(a.key), Se = At(
|
|
839
|
+
a.key,
|
|
840
|
+
J,
|
|
841
|
+
_e
|
|
842
|
+
), de = (Z == null ? void 0 : Z.rowId) === n && (Z == null ? void 0 : Z.columnKey) === a.key, T = h ? dn(
|
|
843
|
+
y,
|
|
844
|
+
n,
|
|
845
|
+
a.key,
|
|
846
|
+
b,
|
|
847
|
+
Y
|
|
848
|
+
) : null, Ce = !h && W && !de && (q == null ? void 0 : q.rowId) === n && (q == null ? void 0 : q.columnKey) === a.key, O = !!(T != null && T.inRange) && W && !de, zt = O && T ? ln(T.edges) : void 0, Or = rt(a);
|
|
849
|
+
return /* @__PURE__ */ c(
|
|
850
|
+
g.Cell,
|
|
633
851
|
{
|
|
634
|
-
sticky:
|
|
635
|
-
stickyOffset:
|
|
636
|
-
style:
|
|
852
|
+
sticky: a.sticky,
|
|
853
|
+
stickyOffset: a.stickyOffset,
|
|
854
|
+
style: {
|
|
855
|
+
...Or,
|
|
856
|
+
...zt ? { boxShadow: zt } : null
|
|
857
|
+
},
|
|
637
858
|
"data-grid-cell": "",
|
|
638
|
-
"data-grid-row-id":
|
|
639
|
-
"data-grid-col-key":
|
|
640
|
-
"data-grid-source-index":
|
|
641
|
-
className:
|
|
859
|
+
"data-grid-row-id": n,
|
|
860
|
+
"data-grid-col-key": a.key,
|
|
861
|
+
"data-grid-source-index": s,
|
|
862
|
+
className: m(
|
|
642
863
|
"relative overflow-x-hidden",
|
|
643
|
-
//
|
|
644
|
-
|
|
645
|
-
//
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
864
|
+
// Uncontrolled single-cell highlight (legacy).
|
|
865
|
+
Ce && "z-1 outline-hidden ring-2 ring-inset ring-brand after:opacity-0",
|
|
866
|
+
// Controlled range: fill all selected cells except the anchor; perimeter via boxShadow.
|
|
867
|
+
O && "z-1 outline-hidden after:opacity-0",
|
|
868
|
+
O && T && !T.isAnchor && "bg-utility-brand-25",
|
|
869
|
+
a.cellClassName,
|
|
870
|
+
Xr(Se),
|
|
871
|
+
I
|
|
651
872
|
),
|
|
652
873
|
children: (() => {
|
|
653
|
-
const
|
|
654
|
-
|
|
874
|
+
const Yt = it === 0 && (o || qe) ? /* @__PURE__ */ _("div", { className: "flex items-center", children: [
|
|
875
|
+
E && /* @__PURE__ */ c(
|
|
655
876
|
"div",
|
|
656
877
|
{
|
|
878
|
+
"data-grid-no-range": "",
|
|
657
879
|
className: "flex items-center justify-center",
|
|
658
|
-
onClick: (
|
|
659
|
-
onContextMenu: (
|
|
660
|
-
onKeyDown: (
|
|
661
|
-
children: /* @__PURE__ */
|
|
662
|
-
|
|
880
|
+
onClick: (U) => U.stopPropagation(),
|
|
881
|
+
onContextMenu: (U) => U.stopPropagation(),
|
|
882
|
+
onKeyDown: (U) => U.stopPropagation(),
|
|
883
|
+
children: /* @__PURE__ */ c(
|
|
884
|
+
wn,
|
|
663
885
|
{
|
|
664
|
-
config:
|
|
665
|
-
sourceRowIndex:
|
|
886
|
+
config: E,
|
|
887
|
+
sourceRowIndex: s,
|
|
666
888
|
item: e,
|
|
667
|
-
enableDrag:
|
|
668
|
-
isDragging:
|
|
669
|
-
onDragHandlePointerDown: (
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
889
|
+
enableDrag: Ae,
|
|
890
|
+
isDragging: w,
|
|
891
|
+
onDragHandlePointerDown: (U) => Lr(
|
|
892
|
+
U,
|
|
893
|
+
n,
|
|
894
|
+
s,
|
|
673
895
|
e
|
|
674
896
|
),
|
|
675
|
-
triggerClassName:
|
|
897
|
+
triggerClassName: m(
|
|
676
898
|
// Hover-reveal: hidden until row hover / focus / menu open / this row is the drag source.
|
|
677
899
|
// Do not force all handles visible while another row is dragging.
|
|
678
900
|
"transition-opacity group-hover/rowactions:opacity-100 focus-visible:opacity-100",
|
|
679
|
-
|
|
901
|
+
p || w ? "opacity-100" : "opacity-0"
|
|
680
902
|
),
|
|
681
|
-
onOpenChange: (
|
|
903
|
+
onOpenChange: (U) => vt(U ? n : null)
|
|
682
904
|
}
|
|
683
905
|
)
|
|
684
906
|
}
|
|
685
907
|
),
|
|
686
|
-
/* @__PURE__ */
|
|
687
|
-
] }) :
|
|
688
|
-
return
|
|
908
|
+
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: ut(a.key, e[a.key], e) })
|
|
909
|
+
] }) : ut(a.key, e[a.key], e);
|
|
910
|
+
return W ? /* @__PURE__ */ c(
|
|
689
911
|
"div",
|
|
690
912
|
{
|
|
691
913
|
"data-grid-focus": !0,
|
|
692
914
|
tabIndex: -1,
|
|
693
915
|
className: "outline-hidden",
|
|
694
|
-
children:
|
|
916
|
+
children: Yt
|
|
695
917
|
}
|
|
696
|
-
) :
|
|
918
|
+
) : Yt;
|
|
697
919
|
})()
|
|
698
920
|
},
|
|
699
|
-
|
|
921
|
+
a.key
|
|
700
922
|
);
|
|
701
923
|
}),
|
|
702
|
-
|
|
703
|
-
|
|
924
|
+
S && F && /* @__PURE__ */ c(
|
|
925
|
+
g.Cell,
|
|
704
926
|
{
|
|
705
|
-
|
|
927
|
+
"data-grid-no-range": "",
|
|
928
|
+
className: m("relative w-14 text-center", I),
|
|
706
929
|
style: { minWidth: "56px", width: "56px" },
|
|
707
|
-
children: /* @__PURE__ */
|
|
930
|
+
children: /* @__PURE__ */ c(
|
|
708
931
|
"button",
|
|
709
932
|
{
|
|
710
933
|
type: "button",
|
|
711
934
|
title: "Delete row",
|
|
712
935
|
"aria-label": "Delete row",
|
|
713
936
|
className: "inline-flex items-center justify-center rounded p-1 text-fg-quaternary hover:bg-secondary_subtle hover:text-fg-secondary",
|
|
714
|
-
onClick: (
|
|
715
|
-
|
|
937
|
+
onClick: (a) => {
|
|
938
|
+
a.stopPropagation(), F.onDeleteRow(s);
|
|
716
939
|
},
|
|
717
|
-
children: /* @__PURE__ */
|
|
940
|
+
children: /* @__PURE__ */ c(gn, { name: "Trash02", className: "size-3" })
|
|
718
941
|
}
|
|
719
942
|
)
|
|
720
943
|
}
|
|
721
944
|
)
|
|
722
945
|
]
|
|
723
946
|
},
|
|
724
|
-
|
|
947
|
+
n
|
|
725
948
|
);
|
|
726
|
-
},
|
|
727
|
-
|
|
949
|
+
}, Cr = (e) => /* @__PURE__ */ _(
|
|
950
|
+
g.Row,
|
|
728
951
|
{
|
|
729
952
|
id: String(e.id),
|
|
730
953
|
isExpandable: !1,
|
|
731
|
-
className:
|
|
954
|
+
className: m(pt && "[&>td]:after:hidden", bt),
|
|
732
955
|
children: [
|
|
733
|
-
|
|
734
|
-
|
|
956
|
+
z && /* @__PURE__ */ c(
|
|
957
|
+
g.Cell,
|
|
735
958
|
{
|
|
736
|
-
className:
|
|
959
|
+
className: m("relative w-10", I),
|
|
737
960
|
style: { minWidth: "40px", width: "40px" }
|
|
738
961
|
}
|
|
739
962
|
),
|
|
740
|
-
|
|
741
|
-
|
|
963
|
+
u.map((r) => /* @__PURE__ */ c(
|
|
964
|
+
g.Cell,
|
|
742
965
|
{
|
|
743
|
-
sticky:
|
|
744
|
-
stickyOffset:
|
|
745
|
-
style:
|
|
746
|
-
className:
|
|
966
|
+
sticky: r.sticky,
|
|
967
|
+
stickyOffset: r.stickyOffset,
|
|
968
|
+
style: rt(r),
|
|
969
|
+
className: m(
|
|
747
970
|
"overflow-x-hidden text-left",
|
|
748
|
-
|
|
749
|
-
|
|
971
|
+
r.cellClassName,
|
|
972
|
+
I
|
|
750
973
|
),
|
|
751
|
-
children: /* @__PURE__ */
|
|
974
|
+
children: /* @__PURE__ */ c(mn, { height: "14px", width: "75%", className: "rounded" })
|
|
752
975
|
},
|
|
753
|
-
|
|
976
|
+
r.key
|
|
754
977
|
)),
|
|
755
|
-
|
|
756
|
-
|
|
978
|
+
S && /* @__PURE__ */ c(
|
|
979
|
+
g.Cell,
|
|
757
980
|
{
|
|
758
|
-
className:
|
|
981
|
+
className: m("w-14", I),
|
|
759
982
|
style: { minWidth: "56px", width: "56px" }
|
|
760
983
|
}
|
|
761
984
|
)
|
|
762
985
|
]
|
|
763
986
|
},
|
|
764
987
|
String(e.id)
|
|
765
|
-
),
|
|
766
|
-
const
|
|
988
|
+
), Tr = () => X ? Le.map((e) => Cr(e)) : Ie && H ? H.flatMap((e) => {
|
|
989
|
+
const r = ve.has(e.key);
|
|
767
990
|
return [
|
|
768
|
-
|
|
769
|
-
...
|
|
770
|
-
(
|
|
991
|
+
Sr(e),
|
|
992
|
+
...r ? [] : e.rows.map(
|
|
993
|
+
(t, o) => Tt(t, void 0, o)
|
|
771
994
|
)
|
|
772
995
|
];
|
|
773
|
-
}) :
|
|
774
|
-
(e,
|
|
775
|
-
),
|
|
776
|
-
|
|
996
|
+
}) : Le.map(
|
|
997
|
+
(e, r) => Tt(e, void 0, r)
|
|
998
|
+
), Ot = /* @__PURE__ */ c(
|
|
999
|
+
Yr.Root,
|
|
777
1000
|
{
|
|
778
|
-
ref:
|
|
779
|
-
onKeyDownCapture:
|
|
780
|
-
|
|
1001
|
+
ref: kr,
|
|
1002
|
+
onKeyDownCapture: W ? Rr : void 0,
|
|
1003
|
+
onPointerDownCapture: h ? Dr : void 0,
|
|
1004
|
+
onDoubleClickCapture: h ? Nr : void 0,
|
|
1005
|
+
className: m(
|
|
781
1006
|
"w-full",
|
|
782
|
-
!
|
|
783
|
-
|
|
1007
|
+
!L || et ? "overflow-x-auto" : "overflow-x-hidden",
|
|
1008
|
+
ye && "border border-secondary rounded-xl",
|
|
784
1009
|
"[&_tr:hover>td]:!bg-secondary_subtle",
|
|
785
|
-
|
|
1010
|
+
Zt
|
|
786
1011
|
),
|
|
787
|
-
size:
|
|
788
|
-
children: /* @__PURE__ */
|
|
789
|
-
|
|
1012
|
+
size: ft,
|
|
1013
|
+
children: /* @__PURE__ */ _(
|
|
1014
|
+
g,
|
|
790
1015
|
{
|
|
791
|
-
"aria-label":
|
|
792
|
-
size:
|
|
793
|
-
isEditable:
|
|
794
|
-
inlineSelection:
|
|
795
|
-
className:
|
|
796
|
-
style:
|
|
797
|
-
...
|
|
1016
|
+
"aria-label": Jt,
|
|
1017
|
+
size: ft,
|
|
1018
|
+
isEditable: W,
|
|
1019
|
+
inlineSelection: he,
|
|
1020
|
+
className: m(L && "min-w-full", rr),
|
|
1021
|
+
style: vr,
|
|
1022
|
+
...Er,
|
|
798
1023
|
children: [
|
|
799
|
-
/* @__PURE__ */
|
|
800
|
-
|
|
1024
|
+
/* @__PURE__ */ _(
|
|
1025
|
+
g.Header,
|
|
801
1026
|
{
|
|
802
|
-
className:
|
|
803
|
-
"sticky top-0",
|
|
804
|
-
|
|
805
|
-
|
|
1027
|
+
className: m(
|
|
1028
|
+
"sticky top-0 z-20",
|
|
1029
|
+
ye && "[&>tr>th:first-child]:rounded-bl-none [&>tr>th:last-child]:rounded-br-none",
|
|
1030
|
+
er
|
|
806
1031
|
),
|
|
807
1032
|
children: [
|
|
808
|
-
|
|
809
|
-
|
|
1033
|
+
z && /* @__PURE__ */ c(
|
|
1034
|
+
g.Head,
|
|
810
1035
|
{
|
|
811
1036
|
label: "",
|
|
812
1037
|
allowsSorting: !1,
|
|
813
1038
|
isRowHeader: !1,
|
|
814
1039
|
style: { minWidth: "40px", width: "40px" },
|
|
815
|
-
className:
|
|
1040
|
+
className: m(I),
|
|
816
1041
|
headerCellClass: "justify-center",
|
|
817
|
-
children:
|
|
818
|
-
|
|
1042
|
+
children: te === "multiple" && D && /* @__PURE__ */ c("div", { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ c(
|
|
1043
|
+
jt,
|
|
819
1044
|
{
|
|
820
|
-
checked:
|
|
821
|
-
onCheckedChange: () =>
|
|
1045
|
+
checked: ot ? !0 : Pr && !ot ? "indeterminate" : !1,
|
|
1046
|
+
onCheckedChange: () => Wr(),
|
|
822
1047
|
"aria-label": "Select all rows",
|
|
823
1048
|
className: "items-center justify-center"
|
|
824
1049
|
}
|
|
@@ -826,111 +1051,111 @@ const Me = "300px", Ge = (n) => {
|
|
|
826
1051
|
},
|
|
827
1052
|
"selection"
|
|
828
1053
|
),
|
|
829
|
-
|
|
830
|
-
const
|
|
1054
|
+
u.map((e, r) => {
|
|
1055
|
+
const t = ar ? yr.get(e.key) : void 0, o = It.get(e.key), n = At(
|
|
831
1056
|
e.key,
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
),
|
|
835
|
-
return /* @__PURE__ */
|
|
836
|
-
|
|
1057
|
+
J,
|
|
1058
|
+
o
|
|
1059
|
+
), s = Qt.includes(e.key) || n === "center" ? "justify-center" : n === "right" ? "justify-end" : "";
|
|
1060
|
+
return /* @__PURE__ */ c(
|
|
1061
|
+
g.Head,
|
|
837
1062
|
{
|
|
838
1063
|
sticky: e.sticky,
|
|
839
1064
|
stickyOffset: e.stickyOffset,
|
|
840
1065
|
id: e.key,
|
|
841
1066
|
label: e.label,
|
|
842
|
-
isRowHeader:
|
|
1067
|
+
isRowHeader: r === 0,
|
|
843
1068
|
allowsSorting: e.allowsSorting,
|
|
844
|
-
headerCellClass: `${e.headerCellClass} ${
|
|
845
|
-
style:
|
|
846
|
-
className:
|
|
1069
|
+
headerCellClass: `${e.headerCellClass} ${s}`,
|
|
1070
|
+
style: rt(e),
|
|
1071
|
+
className: m(
|
|
847
1072
|
"overflow-hidden",
|
|
848
1073
|
e.headClassName,
|
|
849
|
-
|
|
1074
|
+
I
|
|
850
1075
|
),
|
|
851
|
-
headerAction:
|
|
852
|
-
|
|
1076
|
+
headerAction: t && Re ? /* @__PURE__ */ c(
|
|
1077
|
+
pn,
|
|
853
1078
|
{
|
|
854
|
-
column:
|
|
855
|
-
columnLabel:
|
|
856
|
-
currentAlignment:
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
) : (
|
|
860
|
-
capabilities:
|
|
861
|
-
hideDisabled:
|
|
862
|
-
onAction:
|
|
863
|
-
renderExtraItems:
|
|
1079
|
+
column: t,
|
|
1080
|
+
columnLabel: t.label ?? (o ? Ur(o, dr) : e.label),
|
|
1081
|
+
currentAlignment: o ? Ht(
|
|
1082
|
+
o,
|
|
1083
|
+
J ?? /* @__PURE__ */ new Map()
|
|
1084
|
+
) : (J == null ? void 0 : J.get(e.key)) ?? "left",
|
|
1085
|
+
capabilities: cr,
|
|
1086
|
+
hideDisabled: u.length <= 1,
|
|
1087
|
+
onAction: br.get(e.key),
|
|
1088
|
+
renderExtraItems: lr,
|
|
864
1089
|
showOnHeaderHover: !0
|
|
865
1090
|
}
|
|
866
1091
|
) : void 0,
|
|
867
|
-
children: (
|
|
1092
|
+
children: (Fe == null ? void 0 : Fe(e.key)) ?? null
|
|
868
1093
|
},
|
|
869
1094
|
e.key
|
|
870
1095
|
);
|
|
871
1096
|
}),
|
|
872
|
-
|
|
873
|
-
|
|
1097
|
+
S && /* @__PURE__ */ c(
|
|
1098
|
+
g.Head,
|
|
874
1099
|
{
|
|
875
1100
|
label: "",
|
|
876
1101
|
allowsSorting: !1,
|
|
877
1102
|
isRowHeader: !1,
|
|
878
1103
|
style: { minWidth: "56px", width: "56px" },
|
|
879
|
-
className:
|
|
1104
|
+
className: m(I)
|
|
880
1105
|
},
|
|
881
1106
|
"actions"
|
|
882
1107
|
)
|
|
883
1108
|
]
|
|
884
1109
|
}
|
|
885
1110
|
),
|
|
886
|
-
/* @__PURE__ */
|
|
887
|
-
!
|
|
888
|
-
|
|
889
|
-
|
|
1111
|
+
/* @__PURE__ */ _(g.Body, { children: [
|
|
1112
|
+
!Wt && Tr(),
|
|
1113
|
+
mr && /* @__PURE__ */ c(
|
|
1114
|
+
g.Row,
|
|
890
1115
|
{
|
|
891
1116
|
id: "empty-state",
|
|
892
1117
|
highlightSelectedRow: !1,
|
|
893
|
-
children: /* @__PURE__ */
|
|
894
|
-
|
|
1118
|
+
children: /* @__PURE__ */ c(
|
|
1119
|
+
g.Cell,
|
|
895
1120
|
{
|
|
896
|
-
colSpan:
|
|
897
|
-
className:
|
|
1121
|
+
colSpan: ae,
|
|
1122
|
+
className: m(
|
|
898
1123
|
"text-left text-placeholder_subtle border-b border-secondary py-3",
|
|
899
|
-
|
|
1124
|
+
I
|
|
900
1125
|
),
|
|
901
|
-
children:
|
|
1126
|
+
children: mt
|
|
902
1127
|
}
|
|
903
1128
|
)
|
|
904
1129
|
},
|
|
905
1130
|
"empty-state"
|
|
906
1131
|
),
|
|
907
|
-
|
|
908
|
-
|
|
1132
|
+
Je && F && /* @__PURE__ */ _(
|
|
1133
|
+
g.Row,
|
|
909
1134
|
{
|
|
910
1135
|
id: "add-row-footer",
|
|
911
1136
|
highlightSelectedRow: !1,
|
|
912
1137
|
children: [
|
|
913
|
-
/* @__PURE__ */
|
|
914
|
-
|
|
1138
|
+
/* @__PURE__ */ c(
|
|
1139
|
+
g.Cell,
|
|
915
1140
|
{
|
|
916
|
-
colSpan:
|
|
917
|
-
className:
|
|
918
|
-
children: /* @__PURE__ */
|
|
919
|
-
|
|
1141
|
+
colSpan: ae - (S ? 1 : 0),
|
|
1142
|
+
className: m(I),
|
|
1143
|
+
children: /* @__PURE__ */ c(
|
|
1144
|
+
hn,
|
|
920
1145
|
{
|
|
921
1146
|
color: "tertiary",
|
|
922
1147
|
className: "bg-secondary text-primary",
|
|
923
1148
|
size: "xs",
|
|
924
|
-
onClick:
|
|
1149
|
+
onClick: F.onAddRow,
|
|
925
1150
|
children: "+ Add Row"
|
|
926
1151
|
}
|
|
927
1152
|
)
|
|
928
1153
|
}
|
|
929
1154
|
),
|
|
930
|
-
|
|
931
|
-
|
|
1155
|
+
S && /* @__PURE__ */ c(
|
|
1156
|
+
g.Cell,
|
|
932
1157
|
{
|
|
933
|
-
className:
|
|
1158
|
+
className: m("w-14", I),
|
|
934
1159
|
style: { minWidth: "56px", width: "56px" }
|
|
935
1160
|
}
|
|
936
1161
|
)
|
|
@@ -938,13 +1163,13 @@ const Me = "300px", Ge = (n) => {
|
|
|
938
1163
|
},
|
|
939
1164
|
"add-row-footer"
|
|
940
1165
|
),
|
|
941
|
-
|
|
942
|
-
|
|
1166
|
+
xr && Me && /* @__PURE__ */ c(
|
|
1167
|
+
yn,
|
|
943
1168
|
{
|
|
944
|
-
...
|
|
945
|
-
hasActionsColumn:
|
|
946
|
-
hasSelectionColumn:
|
|
947
|
-
showBorders: !!
|
|
1169
|
+
...Me,
|
|
1170
|
+
hasActionsColumn: S,
|
|
1171
|
+
hasSelectionColumn: z,
|
|
1172
|
+
showBorders: !!ye
|
|
948
1173
|
}
|
|
949
1174
|
)
|
|
950
1175
|
] })
|
|
@@ -952,49 +1177,49 @@ const Me = "300px", Ge = (n) => {
|
|
|
952
1177
|
}
|
|
953
1178
|
)
|
|
954
1179
|
}
|
|
955
|
-
),
|
|
956
|
-
|
|
1180
|
+
), Ft = W ? /* @__PURE__ */ c(
|
|
1181
|
+
qr,
|
|
957
1182
|
{
|
|
958
|
-
rowIds:
|
|
959
|
-
columnKeys:
|
|
960
|
-
containerRef:
|
|
961
|
-
onSelectCell:
|
|
962
|
-
onEditingCellChange:
|
|
963
|
-
children:
|
|
1183
|
+
rowIds: b,
|
|
1184
|
+
columnKeys: Y,
|
|
1185
|
+
containerRef: x,
|
|
1186
|
+
onSelectCell: Ve,
|
|
1187
|
+
onEditingCellChange: hr,
|
|
1188
|
+
children: Ot
|
|
964
1189
|
}
|
|
965
|
-
) :
|
|
966
|
-
/* @__PURE__ */
|
|
967
|
-
|
|
968
|
-
|
|
1190
|
+
) : Ot, Gt = f != null && f.active ? /* @__PURE__ */ _(Mt, { children: [
|
|
1191
|
+
/* @__PURE__ */ c(Qr, { session: f }),
|
|
1192
|
+
f.dropLineY != null && /* @__PURE__ */ c(
|
|
1193
|
+
Zr,
|
|
969
1194
|
{
|
|
970
|
-
y:
|
|
971
|
-
left:
|
|
972
|
-
width:
|
|
1195
|
+
y: f.dropLineY,
|
|
1196
|
+
left: f.dropLineLeft,
|
|
1197
|
+
width: f.dropLineWidth
|
|
973
1198
|
}
|
|
974
1199
|
)
|
|
975
1200
|
] }) : null;
|
|
976
|
-
return
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1201
|
+
return gr ? /* @__PURE__ */ _("div", { className: "flex flex-col gap-3", children: [
|
|
1202
|
+
Dt && Nt,
|
|
1203
|
+
Ft,
|
|
1204
|
+
Pt && P && /* @__PURE__ */ c(
|
|
1205
|
+
Mr,
|
|
981
1206
|
{
|
|
982
|
-
currentPage:
|
|
983
|
-
pageSize:
|
|
984
|
-
totalPages:
|
|
985
|
-
totalItems:
|
|
986
|
-
onPageChange:
|
|
987
|
-
onPageSizeChange:
|
|
988
|
-
showPagination:
|
|
1207
|
+
currentPage: P.currentPage,
|
|
1208
|
+
pageSize: P.pageSize,
|
|
1209
|
+
totalPages: P.totalPages,
|
|
1210
|
+
totalItems: P.totalItems,
|
|
1211
|
+
onPageChange: P.onPageChange,
|
|
1212
|
+
onPageSizeChange: P.onPageSizeChange,
|
|
1213
|
+
showPagination: P.showPagination
|
|
989
1214
|
}
|
|
990
1215
|
),
|
|
991
|
-
|
|
992
|
-
] }) : /* @__PURE__ */
|
|
993
|
-
|
|
994
|
-
|
|
1216
|
+
Gt
|
|
1217
|
+
] }) : /* @__PURE__ */ _(Mt, { children: [
|
|
1218
|
+
Ft,
|
|
1219
|
+
Gt
|
|
995
1220
|
] });
|
|
996
1221
|
}
|
|
997
1222
|
);
|
|
998
1223
|
export {
|
|
999
|
-
|
|
1224
|
+
Kn as TableWrapper
|
|
1000
1225
|
};
|