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