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