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