@trsys-tech/matrix-library 1.1.8-alpha.2 → 1.1.8-alpha.4
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/components/data-table/DataTable.d.ts.map +1 -1
- package/dist/components/data-table/DataTable.types.d.ts +3 -3
- package/dist/components/data-table/DataTable.types.d.ts.map +1 -1
- package/dist/components/data-table/DataTableAlignment.d.ts.map +1 -1
- package/dist/components/data-table/DataTableContent.d.ts.map +1 -1
- package/dist/components/data-table/DataTableContext.d.ts +1 -0
- package/dist/components/data-table/DataTableContext.d.ts.map +1 -1
- package/dist/components/data-table/DataTableHeader.d.ts.map +1 -1
- package/dist/components/data-table/DataTableRowView.d.ts.map +1 -1
- package/dist/datatable.es.js +10 -13
- package/dist/datatable.es.js.map +1 -1
- package/dist/datatablealignment.es.js +5 -5
- package/dist/datatablealignment.es.js.map +1 -1
- package/dist/datatablecontent.es.js +297 -282
- package/dist/datatablecontent.es.js.map +1 -1
- package/dist/datatablecontext.es.js.map +1 -1
- package/dist/datatableheader.es.js +61 -53
- package/dist/datatableheader.es.js.map +1 -1
- package/dist/datatablerowview.es.js +33 -34
- package/dist/datatablerowview.es.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,376 +1,391 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { DragDropProvider as
|
|
4
|
-
import { useVirtualizer as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { useDataTable as
|
|
8
|
-
import { dataTableColumnSensors as
|
|
9
|
-
import { getActiveDataTableCell as
|
|
10
|
-
import { useDataTableInstance as
|
|
11
|
-
import { DataTableHeader as
|
|
12
|
-
import { DataTablePagination as
|
|
13
|
-
import { DataTableRowView as
|
|
14
|
-
import { useDataTableColumnDrag as
|
|
15
|
-
import { useDataTableMotion as
|
|
1
|
+
import { jsxs as C, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { DragDropProvider as ye, DragOverlay as ve } from "@dnd-kit/react";
|
|
4
|
+
import { useVirtualizer as Ie } from "@tanstack/react-virtual";
|
|
5
|
+
import { cn as kt } from "./utils.es.js";
|
|
6
|
+
import { Button as Et } from "./button.es.js";
|
|
7
|
+
import { useDataTable as Re, DataTableAlignmentContext as Ce } from "./datatablecontext.es.js";
|
|
8
|
+
import { dataTableColumnSensors as Se } from "./datatablecolumndrag.es.js";
|
|
9
|
+
import { getActiveDataTableCell as ke } from "./datatablemodel.es.js";
|
|
10
|
+
import { useDataTableInstance as Ee } from "./usedatatableinstance.es.js";
|
|
11
|
+
import { DataTableHeader as _e } from "./datatableheader.es.js";
|
|
12
|
+
import { DataTablePagination as Pe } from "./datatablepagination.es.js";
|
|
13
|
+
import { DataTableRowView as De } from "./datatablerowview.es.js";
|
|
14
|
+
import { useDataTableColumnDrag as ze } from "./usedatatablecolumndrag.es.js";
|
|
15
|
+
import { useDataTableMotion as Le } from "./usedatatablemotion.es.js";
|
|
16
16
|
import { useDataTableApi as Te } from "./usedatatableapi.es.js";
|
|
17
|
-
const
|
|
18
|
-
function
|
|
19
|
-
rowData:
|
|
20
|
-
columnDefs:
|
|
21
|
-
defaultColDef:
|
|
22
|
-
getRowId:
|
|
17
|
+
const _t = [], Ae = {};
|
|
18
|
+
function Ne({
|
|
19
|
+
rowData: Pt,
|
|
20
|
+
columnDefs: H,
|
|
21
|
+
defaultColDef: Dt = Ae,
|
|
22
|
+
getRowId: zt,
|
|
23
23
|
onReady: et,
|
|
24
|
-
rowSelection:
|
|
25
|
-
renderSubComponent:
|
|
26
|
-
getRowCanExpand:
|
|
27
|
-
onSelectionChanged:
|
|
24
|
+
rowSelection: h,
|
|
25
|
+
renderSubComponent: T,
|
|
26
|
+
getRowCanExpand: Lt,
|
|
27
|
+
onSelectionChanged: rt,
|
|
28
28
|
quickFilterText: Tt,
|
|
29
29
|
onQuickFilterTextChange: At,
|
|
30
|
-
externalFilter:
|
|
31
|
-
loading:
|
|
32
|
-
emptyContent:
|
|
33
|
-
loadingContent:
|
|
34
|
-
rowHeight:
|
|
35
|
-
headerHeight:
|
|
36
|
-
getRowClass:
|
|
37
|
-
rowClassRules:
|
|
38
|
-
pinnedTopRowData:
|
|
39
|
-
pinnedBottomRowData:
|
|
40
|
-
pagination:
|
|
41
|
-
paginationPageSize:
|
|
42
|
-
paginationPageSizeSelector:
|
|
43
|
-
virtualize:
|
|
44
|
-
overscan:
|
|
45
|
-
domLayout:
|
|
46
|
-
suppressHorizontalScroll:
|
|
30
|
+
externalFilter: Nt,
|
|
31
|
+
loading: A = !1,
|
|
32
|
+
emptyContent: jt = "No rows to display",
|
|
33
|
+
loadingContent: Mt = "Loading…",
|
|
34
|
+
rowHeight: O = 40,
|
|
35
|
+
headerHeight: Vt = 40,
|
|
36
|
+
getRowClass: Wt,
|
|
37
|
+
rowClassRules: Ft,
|
|
38
|
+
pinnedTopRowData: P = _t,
|
|
39
|
+
pinnedBottomRowData: N = _t,
|
|
40
|
+
pagination: j = !1,
|
|
41
|
+
paginationPageSize: $t = 25,
|
|
42
|
+
paginationPageSizeSelector: Ht = [10, 25, 50, 100],
|
|
43
|
+
virtualize: Ot = !0,
|
|
44
|
+
overscan: Jt = 8,
|
|
45
|
+
domLayout: nt = "normal",
|
|
46
|
+
suppressHorizontalScroll: Kt = !1,
|
|
47
47
|
editType: st = "cell",
|
|
48
|
-
suppressClickEdit:
|
|
48
|
+
suppressClickEdit: Ut = !1,
|
|
49
49
|
readOnlyEdit: ot = !1,
|
|
50
50
|
validateRow: it,
|
|
51
51
|
onEditCommit: lt,
|
|
52
52
|
onEditRequest: at,
|
|
53
53
|
onEditCancel: ct,
|
|
54
|
-
onRowClick:
|
|
55
|
-
tableOptions:
|
|
56
|
-
containerStyle:
|
|
57
|
-
className:
|
|
58
|
-
style:
|
|
54
|
+
onRowClick: Xt,
|
|
55
|
+
tableOptions: D,
|
|
56
|
+
containerStyle: J,
|
|
57
|
+
className: Bt,
|
|
58
|
+
style: Yt,
|
|
59
59
|
...dt
|
|
60
|
-
},
|
|
60
|
+
}, Gt) {
|
|
61
61
|
"use no memo";
|
|
62
|
-
const { setApi:
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
}, []),
|
|
67
|
-
rowData:
|
|
68
|
-
columnDefs:
|
|
69
|
-
defaultColDef:
|
|
70
|
-
getRowId:
|
|
71
|
-
paginationPageSize:
|
|
72
|
-
tableOptions:
|
|
73
|
-
externalFilter:
|
|
74
|
-
rowSelection:
|
|
75
|
-
pagination:
|
|
76
|
-
renderSubComponent:
|
|
77
|
-
getRowCanExpand:
|
|
62
|
+
const { setApi: K, search: Qt, hasSearch: Zt, setSearch: qt, setCounts: mt } = Re(), x = n.useContext(Ce), te = n.useId(), g = n.useRef(null), ut = n.useRef(null), U = n.useRef(null), X = n.useRef(null), [ft, ee] = n.useState(0), [re, ne] = n.useState(!1), [B, se] = n.useState(null), [oe, ie] = n.useState(null), [le, gt] = n.useState({}), [z, ae] = n.useState(null), [ce] = n.useState(() => D?.initialState?.globalFilter ?? ""), b = n.useRef(z), pt = n.useRef({ columnDefs: H, validateRow: it, readOnlyEdit: ot, onEditCommit: lt, onEditRequest: at, onEditCancel: ct });
|
|
63
|
+
pt.current = { columnDefs: H, validateRow: it, readOnlyEdit: ot, onEditCommit: lt, onEditRequest: at, onEditCancel: ct };
|
|
64
|
+
const ht = n.useCallback((t) => {
|
|
65
|
+
b.current = t, ae(t);
|
|
66
|
+
}, []), s = re || nt === "print", xt = s || nt === "autoHeight", de = Tt ?? D?.state?.globalFilter ?? (Zt ? Qt : ce), M = !!h && h.checkboxes !== !1 && !s, V = !!T && !s, Y = V ? 44 : 0, G = (M ? 44 : 0) + Y, { table: a, definitionsById: S, sourcesById: w, data: me, rowIndices: W, resolveId: bt } = Ee({
|
|
67
|
+
rowData: Pt,
|
|
68
|
+
columnDefs: H,
|
|
69
|
+
defaultColDef: Dt,
|
|
70
|
+
getRowId: zt,
|
|
71
|
+
paginationPageSize: $t,
|
|
72
|
+
tableOptions: D,
|
|
73
|
+
externalFilter: Nt,
|
|
74
|
+
rowSelection: h,
|
|
75
|
+
pagination: j,
|
|
76
|
+
renderSubComponent: T,
|
|
77
|
+
getRowCanExpand: Lt,
|
|
78
78
|
onQuickFilterTextChange: At,
|
|
79
|
-
patches:
|
|
80
|
-
alignment:
|
|
81
|
-
isPrinting:
|
|
82
|
-
viewportWidth:
|
|
79
|
+
patches: le,
|
|
80
|
+
alignment: x,
|
|
81
|
+
isPrinting: s,
|
|
82
|
+
viewportWidth: ft,
|
|
83
83
|
selectionWidth: G,
|
|
84
|
-
searchText:
|
|
85
|
-
setSearch:
|
|
86
|
-
}),
|
|
87
|
-
(t) => t.id !== "__external" && (!
|
|
84
|
+
searchText: de,
|
|
85
|
+
setSearch: qt
|
|
86
|
+
}), c = [...a.getStartVisibleLeafColumns(), ...a.getCenterVisibleLeafColumns(), ...a.getEndVisibleLeafColumns()].filter(
|
|
87
|
+
(t) => t.id !== "__external" && (!s || !S.get(t.id)?.hideInPrint)
|
|
88
88
|
);
|
|
89
|
-
if (
|
|
90
|
-
const t =
|
|
91
|
-
t >= 0 && e >= 0 &&
|
|
89
|
+
if (B) {
|
|
90
|
+
const t = c.findIndex((r) => r.id === B.sourceId), e = c.findIndex((r) => r.id === B.targetId);
|
|
91
|
+
t >= 0 && e >= 0 && c.splice(e, 0, c.splice(t, 1)[0]);
|
|
92
92
|
}
|
|
93
|
-
const
|
|
94
|
-
count:
|
|
95
|
-
getScrollElement: () =>
|
|
96
|
-
estimateSize: () =>
|
|
97
|
-
getItemKey: (t) =>
|
|
98
|
-
overscan:
|
|
99
|
-
scrollMargin:
|
|
100
|
-
enabled:
|
|
93
|
+
const L = new Map(c.map((t) => [t.id, t.getSize()])), Q = G + c.reduce((t, e) => t + L.get(e.id), 0), p = a.getTopRows(), y = a.getBottomRows(), wt = new Set([...p, ...y].map((t) => t.id)), m = (s ? a.getPrePaginatedRowModel().rows : a.getRowModel().rows).filter((t) => !wt.has(t.id)), Z = (t) => !!T && t.getCanExpand() && t.getIsExpanded(), ue = [...p, ...m, ...y].some(Z), k = Ot && !xt && !ue, yt = (p.length + P.length) * O, F = Ie({
|
|
94
|
+
count: m.length,
|
|
95
|
+
getScrollElement: () => g.current,
|
|
96
|
+
estimateSize: () => O,
|
|
97
|
+
getItemKey: (t) => m[t].id,
|
|
98
|
+
overscan: Jt,
|
|
99
|
+
scrollMargin: yt,
|
|
100
|
+
enabled: k,
|
|
101
101
|
useFlushSync: !1
|
|
102
|
-
}), I =
|
|
103
|
-
table:
|
|
104
|
-
definitionsById:
|
|
105
|
-
centerRows:
|
|
106
|
-
virtualizer:
|
|
107
|
-
resolveId:
|
|
108
|
-
rowIndices:
|
|
109
|
-
sourcesById:
|
|
110
|
-
useVirtualRows:
|
|
111
|
-
pagination:
|
|
112
|
-
serverPagination:
|
|
102
|
+
}), I = n.useRef({
|
|
103
|
+
table: a,
|
|
104
|
+
definitionsById: S,
|
|
105
|
+
centerRows: m,
|
|
106
|
+
virtualizer: F,
|
|
107
|
+
resolveId: bt,
|
|
108
|
+
rowIndices: W,
|
|
109
|
+
sourcesById: w,
|
|
110
|
+
useVirtualRows: k,
|
|
111
|
+
pagination: j,
|
|
112
|
+
serverPagination: D?.manualPagination === !0
|
|
113
113
|
});
|
|
114
114
|
I.current = {
|
|
115
|
-
table:
|
|
116
|
-
definitionsById:
|
|
117
|
-
centerRows:
|
|
118
|
-
virtualizer:
|
|
119
|
-
resolveId:
|
|
120
|
-
rowIndices:
|
|
121
|
-
sourcesById:
|
|
122
|
-
useVirtualRows:
|
|
123
|
-
pagination:
|
|
124
|
-
serverPagination:
|
|
115
|
+
table: a,
|
|
116
|
+
definitionsById: S,
|
|
117
|
+
centerRows: m,
|
|
118
|
+
virtualizer: F,
|
|
119
|
+
resolveId: bt,
|
|
120
|
+
rowIndices: W,
|
|
121
|
+
sourcesById: w,
|
|
122
|
+
useVirtualRows: k,
|
|
123
|
+
pagination: j,
|
|
124
|
+
serverPagination: D?.manualPagination === !0
|
|
125
125
|
};
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}, [
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
const t = I.current.table, e = t.getSelectedRowModel().rows.map((
|
|
135
|
-
|
|
136
|
-
}, [
|
|
137
|
-
const t = I.current.table, e = t.getSelectedRowIds().length,
|
|
126
|
+
const fe = ze({ runtime: I, viewportRef: g, contentRef: X, setColumnDrag: se }), o = Te({ runtime: I, editRef: b, configRef: pt, updateEdit: ht, setPatches: gt, contentRef: X, viewportRef: g, setPrinting: ne });
|
|
127
|
+
n.useImperativeHandle(Gt, () => o, [o]), n.useEffect(() => (K(o), () => K((t) => t === o ? null : t)), [o, K]);
|
|
128
|
+
const vt = n.useRef(et);
|
|
129
|
+
vt.current = et, n.useEffect(() => {
|
|
130
|
+
vt.current?.(o);
|
|
131
|
+
}, [o]);
|
|
132
|
+
const It = n.useRef(rt);
|
|
133
|
+
It.current = rt, n.useEffect(() => {
|
|
134
|
+
const t = I.current.table, e = t.getSelectedRowModel().rows.map((r) => r.original);
|
|
135
|
+
It.current?.(e, t.getSelectedRowIds());
|
|
136
|
+
}, [a.state.rowSelection, me]), n.useEffect(() => {
|
|
137
|
+
const t = I.current.table, e = t.getSelectedRowIds().length, r = (t.state.rowPinning.top?.length ?? 0) + (t.state.rowPinning.bottom?.length ?? 0);
|
|
138
138
|
mt(
|
|
139
|
-
(i) => i.selectedCount === e && i.pinnedCount ===
|
|
139
|
+
(i) => i.selectedCount === e && i.pinnedCount === r ? i : { selectedCount: e, pinnedCount: r }
|
|
140
140
|
);
|
|
141
|
-
}, [
|
|
142
|
-
const t =
|
|
141
|
+
}, [a.state.rowSelection, a.state.rowPinning, mt]), n.useEffect(() => {
|
|
142
|
+
const t = g.current;
|
|
143
143
|
if (!t) return;
|
|
144
|
-
const e = () =>
|
|
144
|
+
const e = () => ee(t.clientWidth);
|
|
145
145
|
e();
|
|
146
|
-
const
|
|
147
|
-
return
|
|
148
|
-
}, []),
|
|
149
|
-
const t =
|
|
146
|
+
const r = new ResizeObserver(e);
|
|
147
|
+
return r.observe(t), () => r.disconnect();
|
|
148
|
+
}, []), n.useEffect(() => {
|
|
149
|
+
const t = g.current, e = x?.viewports.current;
|
|
150
150
|
if (!(!t || !e))
|
|
151
151
|
return e.add(t), () => {
|
|
152
152
|
e.delete(t);
|
|
153
153
|
};
|
|
154
|
-
}, [
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
return
|
|
154
|
+
}, [x?.viewports]), n.useEffect(() => {
|
|
155
|
+
b.current && w.get(b.current.rowId) !== b.current.source && o.stopEditing(!0), gt((e) => {
|
|
156
|
+
const r = Object.entries(e).filter(([i, l]) => w.get(i) === l.source);
|
|
157
|
+
return r.length === Object.keys(e).length ? e : Object.fromEntries(r);
|
|
158
158
|
});
|
|
159
159
|
const t = I.current.table;
|
|
160
160
|
if (!I.current.serverPagination) {
|
|
161
|
-
const e = t.atoms.rowSelection.get(),
|
|
162
|
-
|
|
163
|
-
const i = t.atoms.rowPinning.get(),
|
|
164
|
-
(
|
|
161
|
+
const e = t.atoms.rowSelection.get(), r = Object.entries(e).filter(([u]) => w.has(u));
|
|
162
|
+
r.length !== Object.keys(e).length && t.setRowSelection(Object.fromEntries(r));
|
|
163
|
+
const i = t.atoms.rowPinning.get(), l = i.top?.filter((u) => w.has(u)), v = i.bottom?.filter((u) => w.has(u));
|
|
164
|
+
(l?.length !== i.top?.length || v?.length !== i.bottom?.length) && t.setRowPinning({ top: l, bottom: v });
|
|
165
165
|
}
|
|
166
|
-
}, [
|
|
167
|
-
const
|
|
168
|
-
...
|
|
169
|
-
...
|
|
170
|
-
...
|
|
171
|
-
...
|
|
172
|
-
...
|
|
173
|
-
],
|
|
166
|
+
}, [w, o]);
|
|
167
|
+
const $ = [...p, ...m, ...y], q = [
|
|
168
|
+
...P.map((t, e) => `__summary_top_${e}`),
|
|
169
|
+
...p.map((t) => t.id),
|
|
170
|
+
...m.map((t) => t.id),
|
|
171
|
+
...y.map((t) => t.id),
|
|
172
|
+
...N.map((t, e) => `__summary_bottom_${e}`)
|
|
173
|
+
], ge = new Set($.filter(Z).map((t) => t.id));
|
|
174
174
|
let tt = 0;
|
|
175
|
-
const
|
|
175
|
+
const pe = new Map(
|
|
176
176
|
q.map((t) => {
|
|
177
177
|
const e = tt;
|
|
178
|
-
return tt +=
|
|
178
|
+
return tt += ge.has(t) ? 2 : 1, [t, e];
|
|
179
179
|
})
|
|
180
|
-
),
|
|
181
|
-
...q.slice(0,
|
|
182
|
-
...
|
|
183
|
-
...
|
|
184
|
-
...
|
|
185
|
-
] : q,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
180
|
+
), Rt = k ? F.getVirtualItems() : [], he = k ? [
|
|
181
|
+
...q.slice(0, P.length + p.length),
|
|
182
|
+
...Rt.map((t) => m[t.index].id),
|
|
183
|
+
...y.map((t) => t.id),
|
|
184
|
+
...N.map((t, e) => `__summary_bottom_${e}`)
|
|
185
|
+
] : q, xe = ke(
|
|
186
|
+
oe,
|
|
187
|
+
he,
|
|
188
|
+
c.map((t) => t.id)
|
|
189
189
|
);
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
const
|
|
190
|
+
Le(g, JSON.stringify(m.map((t) => t.id)), JSON.stringify(c.map((t) => t.id)), s);
|
|
191
|
+
const Ct = (t, e = !1) => {
|
|
192
|
+
const r = s ? !1 : t.getIsPinned(), i = c.filter((f) => f.getIsPinned() === r), l = i.findIndex((f) => f.id === t.id), v = i.slice(0, l).reduce((f, _) => f + L.get(_.id), G), u = i.slice(l + 1).reduce((f, _) => f + L.get(_.id), 0);
|
|
193
193
|
return {
|
|
194
|
-
width:
|
|
194
|
+
width: L.get(t.id),
|
|
195
195
|
flexShrink: 0,
|
|
196
|
-
position:
|
|
197
|
-
insetInlineStart:
|
|
198
|
-
insetInlineEnd:
|
|
199
|
-
zIndex:
|
|
200
|
-
background:
|
|
196
|
+
position: r ? "sticky" : "relative",
|
|
197
|
+
insetInlineStart: r === "start" ? v : void 0,
|
|
198
|
+
insetInlineEnd: r === "end" ? u : void 0,
|
|
199
|
+
zIndex: r ? 2 : void 0,
|
|
200
|
+
background: r ? e ? "oklch(var(--mtx-primary-50))" : "inherit" : void 0
|
|
201
201
|
};
|
|
202
|
-
},
|
|
202
|
+
}, be = (t, e, r) => {
|
|
203
203
|
if (t.defaultPrevented) return;
|
|
204
|
-
if (t.key === "Escape" &&
|
|
205
|
-
t.preventDefault(),
|
|
204
|
+
if (t.key === "Escape" && b.current) {
|
|
205
|
+
t.preventDefault(), o.stopEditing(!0);
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
|
-
if (t.key === "Enter" &&
|
|
208
|
+
if (t.key === "Enter" && b.current) {
|
|
209
209
|
if (t.target.closest("button,select,textarea,[contenteditable=true],[role=combobox],[role=listbox]")) return;
|
|
210
|
-
t.preventDefault(),
|
|
210
|
+
t.preventDefault(), o.stopEditing();
|
|
211
211
|
return;
|
|
212
212
|
}
|
|
213
213
|
if (t.target.closest("input,select,textarea,button,[contenteditable=true]")) return;
|
|
214
214
|
if (t.key === "Enter" || t.key === "F2") {
|
|
215
|
-
t.preventDefault(), st === "fullRow" ?
|
|
215
|
+
t.preventDefault(), st === "fullRow" ? o.startEditingRow(e.id) : o.startEditingCell({ rowId: e.id, columnId: r.id });
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
|
-
const
|
|
219
|
-
if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t.key) &&
|
|
218
|
+
const l = $.findIndex((R) => R.id === e.id), v = c.findIndex((R) => R.id === r.id), u = t.key === "ArrowDown" ? l + 1 : t.key === "ArrowUp" ? l - 1 : l, f = getComputedStyle(t.currentTarget).direction === "rtl" ? -1 : 1, _ = t.key === "ArrowRight" ? v + f : t.key === "ArrowLeft" ? v - f : v;
|
|
219
|
+
if (["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].includes(t.key) && $[u] && c[_]) {
|
|
220
220
|
t.preventDefault();
|
|
221
|
-
const
|
|
222
|
-
|
|
221
|
+
const R = $[u];
|
|
222
|
+
wt.has(R.id) || o.scrollToRow(R.id), o.focusCell(R.id, c[_].id);
|
|
223
223
|
}
|
|
224
|
-
},
|
|
225
|
-
|
|
224
|
+
}, E = (t, e, r, i, l) => /* @__PURE__ */ d(
|
|
225
|
+
De,
|
|
226
226
|
{
|
|
227
227
|
data: t,
|
|
228
228
|
rowId: e,
|
|
229
|
-
index:
|
|
229
|
+
index: r,
|
|
230
230
|
row: i,
|
|
231
|
-
pinned:
|
|
232
|
-
edit:
|
|
233
|
-
editRef:
|
|
234
|
-
updateEdit:
|
|
235
|
-
api:
|
|
236
|
-
table:
|
|
237
|
-
detailId:
|
|
238
|
-
displayedIndices:
|
|
239
|
-
rowSelection:
|
|
240
|
-
rowHeight:
|
|
231
|
+
pinned: l,
|
|
232
|
+
edit: z,
|
|
233
|
+
editRef: b,
|
|
234
|
+
updateEdit: ht,
|
|
235
|
+
api: o,
|
|
236
|
+
table: a,
|
|
237
|
+
detailId: te,
|
|
238
|
+
displayedIndices: pe,
|
|
239
|
+
rowSelection: h,
|
|
240
|
+
rowHeight: O,
|
|
241
241
|
totalWidth: Q,
|
|
242
|
-
getRowClass:
|
|
243
|
-
rowClassRules:
|
|
244
|
-
onRowClick:
|
|
245
|
-
showExpanders:
|
|
242
|
+
getRowClass: Wt,
|
|
243
|
+
rowClassRules: Ft,
|
|
244
|
+
onRowClick: Xt,
|
|
245
|
+
showExpanders: V,
|
|
246
246
|
expanderWidth: Y,
|
|
247
|
-
showCheckboxes:
|
|
248
|
-
visibleColumns:
|
|
249
|
-
definitionsById:
|
|
250
|
-
activeCell:
|
|
251
|
-
setFocusedCell:
|
|
252
|
-
columnStyle:
|
|
253
|
-
handleCellKeyDown:
|
|
254
|
-
suppressClickEdit:
|
|
247
|
+
showCheckboxes: M,
|
|
248
|
+
visibleColumns: c,
|
|
249
|
+
definitionsById: S,
|
|
250
|
+
activeCell: xe,
|
|
251
|
+
setFocusedCell: ie,
|
|
252
|
+
columnStyle: Ct,
|
|
253
|
+
handleCellKeyDown: be,
|
|
254
|
+
suppressClickEdit: Ut,
|
|
255
255
|
editType: st,
|
|
256
|
-
renderSubComponent:
|
|
256
|
+
renderSubComponent: T,
|
|
257
257
|
isDetailExpanded: Z
|
|
258
258
|
},
|
|
259
259
|
e
|
|
260
|
-
),
|
|
261
|
-
return /* @__PURE__ */
|
|
262
|
-
/* @__PURE__ */
|
|
263
|
-
const e =
|
|
264
|
-
return /* @__PURE__ */
|
|
260
|
+
), St = (h?.selectAll === "all" ? a.getCoreRowModel() : h?.selectAll === "currentPage" ? a.getRowModel() : a.getFilteredRowModel()).rows.filter((t) => t.getCanSelect()), we = St.filter((t) => t.getIsSelected()).length;
|
|
261
|
+
return /* @__PURE__ */ C(ye, { sensors: Se, ...fe, children: [
|
|
262
|
+
/* @__PURE__ */ d(ve, { dropAnimation: null, style: { position: "fixed", pointerEvents: "none" }, children: (t) => {
|
|
263
|
+
const e = S.get(t.data.columnId);
|
|
264
|
+
return /* @__PURE__ */ d("div", { className: "mtx-rounded-sm mtx-border mtx-border-gray-200 mtx-bg-primary-50 mtx-px-3 mtx-py-2 mtx-text-xs mtx-font-bold mtx-shadow-md", children: e?.headerName ?? t.data.columnId });
|
|
265
265
|
} }),
|
|
266
|
-
/* @__PURE__ */
|
|
266
|
+
/* @__PURE__ */ C(
|
|
267
267
|
"div",
|
|
268
268
|
{
|
|
269
|
-
ref:
|
|
269
|
+
ref: X,
|
|
270
270
|
"data-data-table-content": "",
|
|
271
|
-
"data-print-layout":
|
|
272
|
-
className:
|
|
273
|
-
style:
|
|
271
|
+
"data-print-layout": s || void 0,
|
|
272
|
+
className: kt("mtx-relative mtx-flex mtx-min-h-0 mtx-flex-1 mtx-flex-col mtx-rounded-b-lg", Bt),
|
|
273
|
+
style: Yt,
|
|
274
274
|
...dt,
|
|
275
275
|
children: [
|
|
276
|
-
|
|
277
|
-
/* @__PURE__ */
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
|
|
276
|
+
z && /* @__PURE__ */ C("div", { "data-print-hidden": "", className: "mtx-flex mtx-shrink-0 mtx-items-center mtx-gap-2 mtx-border-b mtx-border-gray-200 mtx-p-2", children: [
|
|
277
|
+
/* @__PURE__ */ d(Et, { type: "button", size: "sm", onClick: () => o.stopEditing(), children: "Save" }),
|
|
278
|
+
/* @__PURE__ */ d(Et, { type: "button", size: "sm", variant: "text", onClick: () => o.stopEditing(!0), children: "Cancel" }),
|
|
279
|
+
z.errors.length > 0 && /* @__PURE__ */ d("span", { role: "alert", className: "mtx-text-danger", children: z.errors.join(". ") })
|
|
280
280
|
] }),
|
|
281
|
-
/* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ C(
|
|
282
282
|
"div",
|
|
283
283
|
{
|
|
284
|
-
ref: y,
|
|
285
|
-
"data-data-table-viewport": "",
|
|
286
284
|
role: "grid",
|
|
287
285
|
"aria-label": dt["aria-label"] ?? "Data table",
|
|
288
|
-
"aria-busy":
|
|
286
|
+
"aria-busy": A,
|
|
289
287
|
"aria-rowcount": tt + 1,
|
|
290
|
-
"aria-colcount":
|
|
291
|
-
"aria-multiselectable":
|
|
292
|
-
className: "mtx-
|
|
293
|
-
style: {
|
|
294
|
-
...U,
|
|
295
|
-
overflow: pt ? "visible" : U?.overflow ?? "auto",
|
|
296
|
-
overflowX: l ? "visible" : Ot ? "hidden" : U?.overflowX
|
|
297
|
-
},
|
|
298
|
-
onScroll: (t) => {
|
|
299
|
-
if (D && !l)
|
|
300
|
-
for (const e of D.viewports.current)
|
|
301
|
-
e !== t.currentTarget && e.scrollLeft !== t.currentTarget.scrollLeft && (e.scrollLeft = t.currentTarget.scrollLeft);
|
|
302
|
-
},
|
|
288
|
+
"aria-colcount": c.length + (M ? 1 : 0) + (V ? 1 : 0),
|
|
289
|
+
"aria-multiselectable": h?.mode === "multiRow" || void 0,
|
|
290
|
+
className: "mtx-flex mtx-min-h-0 mtx-flex-1 mtx-flex-col",
|
|
303
291
|
children: [
|
|
304
|
-
/* @__PURE__ */
|
|
305
|
-
|
|
292
|
+
/* @__PURE__ */ d("div", { className: "mtx-shrink-0 mtx-bg-primary-50", children: /* @__PURE__ */ d(
|
|
293
|
+
"div",
|
|
306
294
|
{
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
295
|
+
ref: ut,
|
|
296
|
+
style: { overflow: s ? "visible" : "hidden", width: s ? "100%" : ft || "100%" },
|
|
297
|
+
onScroll: (t) => {
|
|
298
|
+
const e = U.current === t.currentTarget.scrollLeft;
|
|
299
|
+
U.current = null, !e && !s && g.current && (g.current.scrollLeft = t.currentTarget.scrollLeft);
|
|
300
|
+
},
|
|
301
|
+
children: /* @__PURE__ */ d(
|
|
302
|
+
_e,
|
|
303
|
+
{
|
|
304
|
+
table: a,
|
|
305
|
+
api: o,
|
|
306
|
+
headerHeight: Vt,
|
|
307
|
+
totalWidth: Q,
|
|
308
|
+
isPrinting: s,
|
|
309
|
+
showExpanders: V,
|
|
310
|
+
expanderWidth: Y,
|
|
311
|
+
showCheckboxes: M,
|
|
312
|
+
rowSelection: h,
|
|
313
|
+
selectionRows: St,
|
|
314
|
+
selectedInScope: we,
|
|
315
|
+
visibleColumns: c,
|
|
316
|
+
definitionsById: S,
|
|
317
|
+
columnStyle: Ct,
|
|
318
|
+
widths: L
|
|
319
|
+
}
|
|
320
|
+
)
|
|
322
321
|
}
|
|
323
|
-
),
|
|
324
|
-
|
|
322
|
+
) }),
|
|
323
|
+
/* @__PURE__ */ C(
|
|
325
324
|
"div",
|
|
326
325
|
{
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
326
|
+
ref: g,
|
|
327
|
+
"data-data-table-viewport": "",
|
|
328
|
+
className: "mtx-relative mtx-min-h-0 mtx-flex-1 mtx-rounded-b-lg",
|
|
329
|
+
style: {
|
|
330
|
+
...J,
|
|
331
|
+
overflow: xt ? "visible" : J?.overflow ?? "auto",
|
|
332
|
+
overflowX: s ? "visible" : Kt ? "hidden" : J?.overflowX
|
|
333
|
+
},
|
|
334
|
+
onScroll: (t) => {
|
|
335
|
+
const e = t.currentTarget, r = ut.current;
|
|
336
|
+
r && r.scrollLeft !== e.scrollLeft && (r.scrollLeft = e.scrollLeft, U.current = r.scrollLeft);
|
|
337
|
+
const i = x?.synchronizedScrolls.current.get(e) === e.scrollLeft;
|
|
338
|
+
if (x?.synchronizedScrolls.current.delete(e), x && !s && !i)
|
|
339
|
+
for (const l of x.viewports.current)
|
|
340
|
+
l !== e && l.scrollLeft !== e.scrollLeft && (l.scrollLeft = e.scrollLeft, x.synchronizedScrolls.current.set(l, l.scrollLeft));
|
|
341
|
+
},
|
|
330
342
|
children: [
|
|
331
|
-
|
|
332
|
-
|
|
343
|
+
(p.length > 0 || P.length > 0) && /* @__PURE__ */ C(
|
|
344
|
+
"div",
|
|
345
|
+
{
|
|
346
|
+
role: "rowgroup",
|
|
347
|
+
className: "mtx-sticky mtx-z-20",
|
|
348
|
+
style: { top: s ? void 0 : 0, position: s ? "relative" : "sticky" },
|
|
349
|
+
children: [
|
|
350
|
+
P.map((t, e) => E(t, `__summary_top_${e}`, e, void 0, "top")),
|
|
351
|
+
p.map((t) => E(t.original, t.id, t.index, t, "top"))
|
|
352
|
+
]
|
|
353
|
+
}
|
|
354
|
+
),
|
|
355
|
+
/* @__PURE__ */ d("div", { role: "rowgroup", children: k ? /* @__PURE__ */ d("div", { style: { height: F.getTotalSize(), position: "relative", width: Q, minWidth: "100%" }, children: Rt.map((t) => {
|
|
356
|
+
const e = m[t.index];
|
|
357
|
+
return /* @__PURE__ */ d("div", { style: { position: "absolute", top: 0, width: "100%", transform: `translateY(${t.start - yt}px)` }, children: E(e.original, e.id, W.get(e.original) ?? e.index, e) }, e.id);
|
|
358
|
+
}) }) : m.map((t) => E(t.original, t.id, W.get(t.original) ?? t.index, t)) }),
|
|
359
|
+
(y.length > 0 || N.length > 0) && /* @__PURE__ */ C("div", { role: "rowgroup", className: "mtx-sticky mtx-bottom-0 mtx-z-20", style: { position: s ? "relative" : "sticky" }, children: [
|
|
360
|
+
y.map((t) => E(t.original, t.id, t.index, t, "bottom")),
|
|
361
|
+
N.map((t, e) => E(t, `__summary_bottom_${e}`, e, void 0, "bottom"))
|
|
362
|
+
] }),
|
|
363
|
+
(A || !m.length && !p.length && !y.length) && /* @__PURE__ */ d(
|
|
364
|
+
"div",
|
|
365
|
+
{
|
|
366
|
+
role: "status",
|
|
367
|
+
className: kt(
|
|
368
|
+
"mtx-flex mtx-items-center mtx-justify-center mtx-p-6 mtx-text-text-300",
|
|
369
|
+
A && "mtx-absolute mtx-top-0 mtx-start-0 mtx-z-50 mtx-h-full mtx-w-full mtx-bg-gray-100/25"
|
|
370
|
+
),
|
|
371
|
+
children: A ? Mt : jt
|
|
372
|
+
}
|
|
373
|
+
)
|
|
333
374
|
]
|
|
334
375
|
}
|
|
335
|
-
),
|
|
336
|
-
/* @__PURE__ */ m("div", { role: "rowgroup", children: C ? /* @__PURE__ */ m("div", { style: { height: $.getTotalSize(), position: "relative", width: Q, minWidth: "100%" }, children: It.map((t) => {
|
|
337
|
-
const e = d[t.index];
|
|
338
|
-
return /* @__PURE__ */ m(
|
|
339
|
-
"div",
|
|
340
|
-
{
|
|
341
|
-
style: { position: "absolute", top: 0, width: "100%", transform: `translateY(${t.start - j - bt}px)` },
|
|
342
|
-
children: k(e.original, e.id, F.get(e.original) ?? e.index, e)
|
|
343
|
-
},
|
|
344
|
-
e.id
|
|
345
|
-
);
|
|
346
|
-
}) }) : d.map((t) => k(t.original, t.id, F.get(t.original) ?? t.index, t)) }),
|
|
347
|
-
(b.length > 0 || M.length > 0) && /* @__PURE__ */ S("div", { role: "rowgroup", className: "mtx-sticky mtx-bottom-0 mtx-z-20", style: { position: l ? "relative" : "sticky" }, children: [
|
|
348
|
-
b.map((t) => k(t.original, t.id, t.index, t, "bottom")),
|
|
349
|
-
M.map((t, e) => k(t, `__summary_bottom_${e}`, e, void 0, "bottom"))
|
|
350
|
-
] }),
|
|
351
|
-
(N || !d.length && !g.length && !b.length) && /* @__PURE__ */ m(
|
|
352
|
-
"div",
|
|
353
|
-
{
|
|
354
|
-
role: "status",
|
|
355
|
-
className: Ct(
|
|
356
|
-
"mtx-flex mtx-items-center mtx-justify-center mtx-p-6 mtx-text-text-300",
|
|
357
|
-
N && "mtx-absolute mtx-top-0 mtx-start-0 mtx-z-50 mtx-h-full mtx-w-full mtx-bg-gray-100/25"
|
|
358
|
-
),
|
|
359
|
-
children: N ? jt : Nt
|
|
360
|
-
}
|
|
361
376
|
)
|
|
362
377
|
]
|
|
363
378
|
}
|
|
364
379
|
),
|
|
365
|
-
|
|
380
|
+
j && !s && /* @__PURE__ */ d(Pe, { table: a, paginationPageSizeSelector: Ht })
|
|
366
381
|
]
|
|
367
382
|
}
|
|
368
383
|
)
|
|
369
384
|
] });
|
|
370
385
|
}
|
|
371
|
-
const
|
|
372
|
-
|
|
386
|
+
const je = n.forwardRef(Ne);
|
|
387
|
+
je.displayName = "DataTableContent";
|
|
373
388
|
export {
|
|
374
|
-
|
|
389
|
+
je as DataTableContent
|
|
375
390
|
};
|
|
376
391
|
//# sourceMappingURL=datatablecontent.es.js.map
|