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