comins-table 0.1.1 → 0.1.2
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/CHANGELOG.md +8 -0
- package/README.md +12 -7
- package/dist/core.d.ts +46 -46
- package/dist/core.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +638 -565
- package/dist/index.js.map +1 -1
- package/dist/summary.d.ts +17 -1
- package/dist/summary.d.ts.map +1 -1
- package/dist/tree.d.ts +5 -2
- package/dist/tree.d.ts.map +1 -1
- package/package.json +12 -8
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { addCominsRows as e, applyCominsColumnLayout as t, clearCominsCellRange as n, clearCominsSelection as r, clearCominsSortState as i, copyCominsCell as a, copyCominsCellRange as o, copyCominsRow as s, createCominsTableState as c, deleteCominsRows as l, exportCominsRowsToCsv as u, exportCominsRowsToJson as d, fillCominsCellRange as f, formatCominsCellValue as p, getCominsCellClassName as m, getCominsCellStyle as h, getCominsCellValue as g, getCominsHeaderRows as _, getCominsPageRows as v, getCominsSelectedCellRange as y, getCominsSortedRowIndexes as b, getCominsVirtualRows as x, getCominsVisibleColumns as S, isCominsCellDisabled as
|
|
2
|
-
import { Fragment as
|
|
1
|
+
import { addCominsRows as e, applyCominsColumnLayout as t, clearCominsCellRange as n, clearCominsSelection as r, clearCominsSortState as i, copyCominsCell as a, copyCominsCellRange as o, copyCominsRow as s, createCominsTableState as c, deleteCominsRows as l, exportCominsRowsToCsv as u, exportCominsRowsToJson as d, fillCominsCellRange as f, formatCominsCellValue as p, getCominsCellClassName as m, getCominsCellStyle as h, getCominsCellValue as g, getCominsHeaderRows as _, getCominsPageRows as v, getCominsSelectedCellRange as y, getCominsSortedRowIndexes as b, getCominsVirtualRows as x, getCominsVisibleColumns as S, isCominsCellDisabled as C, isCominsCellInSelectedRange as w, isCominsCellSelected as T, isCominsRowSelected as ee, moveCominsColumn as te, moveCominsColumnGroup as E, moveCominsRow as D, pasteCominsCell as ne, pasteCominsCellRange as re, pasteCominsRow as ie, queryCominsRows as ae, replaceCominsRows as oe, selectCell as se, selectCellRange as ce, selectRow as O, selectRows as le, serializeCominsColumnLayout as ue, setCominsColumnGroupHidden as de, setCominsColumnGroupWidth as fe, setCominsColumnHidden as pe, setCominsColumnWidth as me, setCominsHeaderVisible as he, setCominsPagination as ge, setCominsSortState as _e, setCominsTableTheme as ve, sortCominsRows as ye, updateCominsRows as be } from "./core.js";
|
|
2
|
+
import { Fragment as xe, createContext as Se, createElement as Ce, forwardRef as we, useContext as Te, useEffect as k, useId as Ee, useImperativeHandle as De, useLayoutEffect as Oe, useMemo as A, useRef as j, useState as M } from "react";
|
|
3
3
|
import { jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
4
4
|
//#region node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs
|
|
5
5
|
var ke = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), Ae = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), je = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), Me = (e) => {
|
|
@@ -18,9 +18,9 @@ var ke = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e)
|
|
|
18
18
|
}, Ne = (e) => {
|
|
19
19
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
20
20
|
return !1;
|
|
21
|
-
}, I =
|
|
21
|
+
}, I = Se({}), Pe = () => Te(I), Fe = we(({ color: e, size: t, strokeWidth: n, absoluteStrokeWidth: r, className: i = "", children: a, iconNode: o, ...s }, c) => {
|
|
22
22
|
let { size: l = 24, strokeWidth: u = 2, absoluteStrokeWidth: d = !1, color: f = "currentColor", className: p = "" } = Pe() ?? {}, m = r ?? d ? Number(n ?? u) * 24 / Number(t ?? l) : n ?? u;
|
|
23
|
-
return
|
|
23
|
+
return Ce("svg", {
|
|
24
24
|
ref: c,
|
|
25
25
|
...F,
|
|
26
26
|
width: t ?? l ?? F.width,
|
|
@@ -30,9 +30,9 @@ var ke = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e)
|
|
|
30
30
|
className: ke("lucide", p, i),
|
|
31
31
|
...!a && !Ne(s) && { "aria-hidden": "true" },
|
|
32
32
|
...s
|
|
33
|
-
}, [...o.map(([e, t]) =>
|
|
33
|
+
}, [...o.map(([e, t]) => Ce(e, t)), ...Array.isArray(a) ? a : [a]]);
|
|
34
34
|
}), Ie = ((e, t) => {
|
|
35
|
-
let n =
|
|
35
|
+
let n = we(({ className: n, ...r }, i) => Ce(Fe, {
|
|
36
36
|
ref: i,
|
|
37
37
|
iconNode: t,
|
|
38
38
|
className: ke(`lucide-${Ae(Me(e))}`, `lucide-${e}`, n),
|
|
@@ -54,35 +54,35 @@ function L(...e) {
|
|
|
54
54
|
function R(e, t) {
|
|
55
55
|
return typeof e == "function" ? e(t) : e ?? {};
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function z(e, t) {
|
|
58
58
|
return typeof e == "function" ? e(t) : e;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function Le(e, t) {
|
|
61
61
|
return typeof e == "function" ? e(t) : e;
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function B(e, t) {
|
|
64
64
|
return typeof e == "function" ? e(t) : e;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map(
|
|
66
|
+
function V(e) {
|
|
67
|
+
return typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map(V).join(" ") : "";
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function Re(e) {
|
|
70
70
|
return e.type !== "divider" && e.type !== "label";
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function ze(e, t) {
|
|
73
73
|
return !!(e && t instanceof Node && e.contains(t));
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function H(e) {
|
|
76
76
|
e.stopPropagation();
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function U(e) {
|
|
79
79
|
e.preventDefault(), e.stopPropagation();
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Be(e) {
|
|
82
82
|
return e == null ? "" : String(e);
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
let n = R(e.props, t), { defaultValue: r, onBlur: i, onChange: a, onClick: o, onKeyDown: s, onMouseDown: c, onPointerDown: l, value: u, ...d } = n, f =
|
|
84
|
+
function Ve({ component: e, payload: t }) {
|
|
85
|
+
let n = R(e.props, t), { defaultValue: r, onBlur: i, onChange: a, onClick: o, onKeyDown: s, onMouseDown: c, onPointerDown: l, value: u, ...d } = n, f = Be(u ?? r), [p, m] = M(f), h = j(f);
|
|
86
86
|
k(() => {
|
|
87
87
|
m(f), h.current = f;
|
|
88
88
|
}, [f]);
|
|
@@ -100,27 +100,27 @@ function He({ component: e, payload: t }) {
|
|
|
100
100
|
...d,
|
|
101
101
|
className: L("comins-table__component", "comins-table__component-input", n.className),
|
|
102
102
|
onBlur: (e) => {
|
|
103
|
-
i?.(e),
|
|
103
|
+
i?.(e), H(e), g(e);
|
|
104
104
|
},
|
|
105
105
|
onChange: (e) => {
|
|
106
|
-
|
|
106
|
+
H(e), m(e.currentTarget.value);
|
|
107
107
|
},
|
|
108
108
|
onClick: (e) => {
|
|
109
|
-
o?.(e),
|
|
109
|
+
o?.(e), H(e);
|
|
110
110
|
},
|
|
111
111
|
onKeyDown: (e) => {
|
|
112
|
-
s?.(e),
|
|
112
|
+
s?.(e), H(e), e.key === "Enter" && (e.preventDefault(), g(e), e.currentTarget.blur());
|
|
113
113
|
},
|
|
114
114
|
onMouseDown: (e) => {
|
|
115
|
-
c?.(e),
|
|
115
|
+
c?.(e), H(e);
|
|
116
116
|
},
|
|
117
117
|
onPointerDown: (e) => {
|
|
118
|
-
l?.(e),
|
|
118
|
+
l?.(e), H(e);
|
|
119
119
|
},
|
|
120
120
|
value: p
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function He({ component: e, payload: t }) {
|
|
124
124
|
let n = R(e.props, t), { checked: r, defaultChecked: i, onChange: a, onClick: o, onKeyDown: s, onMouseDown: c, onPointerDown: l, style: u, ...d } = n, [f, p] = M(!!(r ?? i));
|
|
125
125
|
return k(() => {
|
|
126
126
|
r !== void 0 && p(!!r);
|
|
@@ -129,22 +129,22 @@ function Ue({ component: e, payload: t }) {
|
|
|
129
129
|
checked: f,
|
|
130
130
|
className: L("comins-table__component", "comins-table__component-checkbox", n.className),
|
|
131
131
|
onClick: (e) => {
|
|
132
|
-
o?.(e),
|
|
132
|
+
o?.(e), H(e);
|
|
133
133
|
},
|
|
134
134
|
onChange: (n) => {
|
|
135
|
-
a?.(n),
|
|
135
|
+
a?.(n), H(n), p(n.currentTarget.checked), e.onCheckedChange?.({
|
|
136
136
|
...t,
|
|
137
137
|
checked: n.currentTarget.checked
|
|
138
138
|
});
|
|
139
139
|
},
|
|
140
140
|
onKeyDown: (e) => {
|
|
141
|
-
s?.(e),
|
|
141
|
+
s?.(e), H(e);
|
|
142
142
|
},
|
|
143
143
|
onMouseDown: (e) => {
|
|
144
|
-
c?.(e),
|
|
144
|
+
c?.(e), H(e);
|
|
145
145
|
},
|
|
146
146
|
onPointerDown: (e) => {
|
|
147
|
-
l?.(e),
|
|
147
|
+
l?.(e), H(e);
|
|
148
148
|
},
|
|
149
149
|
style: {
|
|
150
150
|
height: 20,
|
|
@@ -154,7 +154,7 @@ function Ue({ component: e, payload: t }) {
|
|
|
154
154
|
type: "checkbox"
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function W({ component: e, payload: t }) {
|
|
158
158
|
let { checked: n, ...r } = R(e.props, t), { onClick: i, onKeyDown: a, onMouseDown: o, onPointerDown: s, ...c } = r, [l, u] = M(!!n);
|
|
159
159
|
k(() => {
|
|
160
160
|
n !== void 0 && u(!!n);
|
|
@@ -165,7 +165,7 @@ function U({ component: e, payload: t }) {
|
|
|
165
165
|
"aria-pressed": l,
|
|
166
166
|
className: L("comins-table__component", "comins-table__component-toggle", r.className),
|
|
167
167
|
onClick: (n) => {
|
|
168
|
-
i?.(n),
|
|
168
|
+
i?.(n), H(n);
|
|
169
169
|
let r = !l;
|
|
170
170
|
u(r), e.onCheckedChange?.({
|
|
171
171
|
...t,
|
|
@@ -173,24 +173,24 @@ function U({ component: e, payload: t }) {
|
|
|
173
173
|
});
|
|
174
174
|
},
|
|
175
175
|
onKeyDown: (e) => {
|
|
176
|
-
a?.(e),
|
|
176
|
+
a?.(e), H(e);
|
|
177
177
|
},
|
|
178
178
|
onMouseDown: (e) => {
|
|
179
|
-
o?.(e),
|
|
179
|
+
o?.(e), H(e);
|
|
180
180
|
},
|
|
181
181
|
onPointerDown: (e) => {
|
|
182
|
-
s?.(e),
|
|
182
|
+
s?.(e), H(e);
|
|
183
183
|
},
|
|
184
184
|
type: r.type ?? "button",
|
|
185
185
|
children: d
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function Ue({ component: e, payload: t }) {
|
|
189
189
|
let [n, r] = M(!1), i = Ee(), a = j(null), o = j(null), [s, c] = M({
|
|
190
190
|
left: 0,
|
|
191
191
|
position: "fixed",
|
|
192
192
|
top: 0
|
|
193
|
-
}), l = R(e.props, t), u = A(() =>
|
|
193
|
+
}), l = R(e.props, t), u = A(() => Le(e.items, t), [e.items, t]), d = () => {
|
|
194
194
|
let e = a.current;
|
|
195
195
|
if (!e || typeof window > "u") return;
|
|
196
196
|
let t = e.getBoundingClientRect(), n = Math.max(o.current?.offsetWidth ?? 136, 136);
|
|
@@ -214,7 +214,7 @@ function We({ component: e, payload: t }) {
|
|
|
214
214
|
k(() => {
|
|
215
215
|
if (!n) return;
|
|
216
216
|
let e = (e) => {
|
|
217
|
-
|
|
217
|
+
ze(a.current, e.target) || ze(o.current, e.target) || f(!1, e);
|
|
218
218
|
}, t = (e) => {
|
|
219
219
|
e.key === "Escape" && (f(!1, e), a.current?.focus());
|
|
220
220
|
};
|
|
@@ -245,16 +245,16 @@ function We({ component: e, payload: t }) {
|
|
|
245
245
|
className: "comins-table__component-menu-item",
|
|
246
246
|
disabled: n.disabled,
|
|
247
247
|
onClick: (r) => {
|
|
248
|
-
|
|
248
|
+
U(r), !(n.disabled || !Re(n)) && (f(!1, r), e.onSelect?.({
|
|
249
249
|
...t,
|
|
250
250
|
event: r,
|
|
251
251
|
item: n,
|
|
252
252
|
value: n.value
|
|
253
253
|
}));
|
|
254
254
|
},
|
|
255
|
-
onKeyDown:
|
|
256
|
-
onMouseDown:
|
|
257
|
-
onPointerDown:
|
|
255
|
+
onKeyDown: H,
|
|
256
|
+
onMouseDown: H,
|
|
257
|
+
onPointerDown: H,
|
|
258
258
|
role: "menuitem",
|
|
259
259
|
type: "button",
|
|
260
260
|
children: n.label
|
|
@@ -270,18 +270,18 @@ function We({ component: e, payload: t }) {
|
|
|
270
270
|
"aria-label": l["aria-label"] ?? "Header menu",
|
|
271
271
|
className: L("comins-table__component-menu-trigger", l.className),
|
|
272
272
|
onClick: (e) => {
|
|
273
|
-
|
|
273
|
+
U(e), f(!n, e);
|
|
274
274
|
},
|
|
275
275
|
onKeyDown: (e) => {
|
|
276
276
|
if (l.onKeyDown?.(e), e.key === "Escape" && n) {
|
|
277
|
-
|
|
277
|
+
U(e), f(!1, e);
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
|
-
|
|
280
|
+
H(e);
|
|
281
281
|
},
|
|
282
|
-
onMouseDown:
|
|
282
|
+
onMouseDown: H,
|
|
283
283
|
onPointerDown: (e) => {
|
|
284
|
-
l.onPointerDown?.(e),
|
|
284
|
+
l.onPointerDown?.(e), H(e);
|
|
285
285
|
},
|
|
286
286
|
ref: a,
|
|
287
287
|
type: l.type ?? "button",
|
|
@@ -289,47 +289,47 @@ function We({ component: e, payload: t }) {
|
|
|
289
289
|
}), p]
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
let { height: n, itemHeight: r, limit: i, more: a = !1, searchable: o = !1, style: s, ...c } = R(e.props, t), l = A(() =>
|
|
292
|
+
function We({ component: e, payload: t }) {
|
|
293
|
+
let { height: n, itemHeight: r, limit: i, more: a = !1, searchable: o = !1, style: s, ...c } = R(e.props, t), l = A(() => B(e.items, t), [e.items, t]), u = Math.max(1, Number(i ?? 5)), d = Math.max(1, Number(r ?? 28)), f = d * 5, p = n !== void 0 || s?.height !== void 0, [m, h] = M(""), [g, _] = M(!1), [v, y] = M(0), [b, x] = M(null), [S, C] = M(f), w = j(null), T = t.row.selected && t.selection.selectedRowCount === 1, ee = !!(o && T), te = !!(a && T), E = ee ? m : "";
|
|
294
294
|
k(() => {
|
|
295
295
|
_(!1), y(0);
|
|
296
296
|
}, [l.length, u]), Oe(() => {
|
|
297
|
-
let e =
|
|
297
|
+
let e = w.current;
|
|
298
298
|
if (!e) return;
|
|
299
299
|
let t = e.clientHeight > 0 ? e.clientHeight : f;
|
|
300
|
-
|
|
300
|
+
C(p ? t : Math.min(t, f));
|
|
301
301
|
}, [
|
|
302
302
|
f,
|
|
303
303
|
g,
|
|
304
|
-
|
|
304
|
+
E,
|
|
305
305
|
p
|
|
306
306
|
]), k(() => {
|
|
307
|
-
let e =
|
|
307
|
+
let e = w.current;
|
|
308
308
|
e && (e.scrollTop = 0, y(0));
|
|
309
|
-
}, [
|
|
310
|
-
if (
|
|
311
|
-
let e =
|
|
309
|
+
}, [E]), k(() => {
|
|
310
|
+
if (T) return;
|
|
311
|
+
let e = w.current;
|
|
312
312
|
e && (e.scrollTop = 0), _(!1), h(""), y(0);
|
|
313
|
-
}, [
|
|
314
|
-
let
|
|
315
|
-
let t =
|
|
313
|
+
}, [T]);
|
|
314
|
+
let D = A(() => {
|
|
315
|
+
let t = E.trim().toLowerCase();
|
|
316
316
|
return l.map((e, t) => ({
|
|
317
317
|
item: e,
|
|
318
318
|
itemIndex: t
|
|
319
319
|
})).filter(({ item: n, itemIndex: r }) => t ? e.searchFilter ? e.searchFilter({
|
|
320
320
|
item: n,
|
|
321
321
|
itemIndex: r,
|
|
322
|
-
value:
|
|
323
|
-
}) :
|
|
322
|
+
value: E
|
|
323
|
+
}) : V(n.label).toLowerCase().includes(t) : !0);
|
|
324
324
|
}, [
|
|
325
|
-
|
|
325
|
+
E,
|
|
326
326
|
e,
|
|
327
327
|
l
|
|
328
|
-
]),
|
|
328
|
+
]), ne = D.length > u, re = !!(T && (g || E.trim().length > 0 || !a && ne)), ie = ne && !re, ae = ee && !g ? 0 : 2, oe = Math.max(d, p ? S || f : Math.min(S || f, f)), se = Math.max(0, Math.floor(Math.max(0, v) / d) - ae), ce = Math.min(D.length, Math.ceil((Math.max(0, v) + oe) / d) + ae), O = re ? D.slice(se, ce) : D.slice(0, ne ? u : D.length), le = re ? se * d : 0, ue = re ? Math.max(0, D.length - ce) * d : 0, de = `${String(t.row.id)}-${t.column.id}`, fe = {
|
|
329
329
|
...s,
|
|
330
330
|
"--comins-table-virtual-list-item-height": `${d}px`,
|
|
331
331
|
height: n ?? s?.height ?? f
|
|
332
|
-
},
|
|
332
|
+
}, pe = (n, r, i) => {
|
|
333
333
|
n.disabled || (x(n.value), e.onClickItem?.({
|
|
334
334
|
...t,
|
|
335
335
|
event: i,
|
|
@@ -342,66 +342,66 @@ function Ge({ component: e, payload: t }) {
|
|
|
342
342
|
...c,
|
|
343
343
|
"aria-label": c["aria-label"] ?? "Virtual list",
|
|
344
344
|
className: L("comins-table__component", "comins-table__component-virtual-list", c.className),
|
|
345
|
-
"data-comins-virtual-list-expanded":
|
|
346
|
-
"data-comins-virtual-list-visible-count":
|
|
347
|
-
"data-testid": `virtual-list-${
|
|
345
|
+
"data-comins-virtual-list-expanded": re ? "true" : void 0,
|
|
346
|
+
"data-comins-virtual-list-visible-count": O.length,
|
|
347
|
+
"data-testid": `virtual-list-${de}`,
|
|
348
348
|
onClick: (e) => {
|
|
349
|
-
c.onClick?.(e),
|
|
349
|
+
c.onClick?.(e), H(e);
|
|
350
350
|
},
|
|
351
|
-
onKeyDown:
|
|
352
|
-
onMouseDown:
|
|
353
|
-
onContextMenu:
|
|
354
|
-
onDoubleClick:
|
|
355
|
-
onMouseUp:
|
|
356
|
-
onPointerUp:
|
|
357
|
-
onPointerMove:
|
|
358
|
-
onPointerEnter:
|
|
359
|
-
onMouseOver:
|
|
360
|
-
onMouseOut:
|
|
361
|
-
onPointerLeave:
|
|
362
|
-
onBlur:
|
|
363
|
-
onFocus:
|
|
364
|
-
onInput:
|
|
365
|
-
onChange:
|
|
366
|
-
onMouseMove:
|
|
367
|
-
onMouseEnter:
|
|
368
|
-
onMouseLeave:
|
|
369
|
-
onTouchStart:
|
|
370
|
-
onTouchMove:
|
|
371
|
-
onTouchEnd:
|
|
351
|
+
onKeyDown: H,
|
|
352
|
+
onMouseDown: H,
|
|
353
|
+
onContextMenu: H,
|
|
354
|
+
onDoubleClick: H,
|
|
355
|
+
onMouseUp: H,
|
|
356
|
+
onPointerUp: H,
|
|
357
|
+
onPointerMove: H,
|
|
358
|
+
onPointerEnter: H,
|
|
359
|
+
onMouseOver: H,
|
|
360
|
+
onMouseOut: H,
|
|
361
|
+
onPointerLeave: H,
|
|
362
|
+
onBlur: H,
|
|
363
|
+
onFocus: H,
|
|
364
|
+
onInput: H,
|
|
365
|
+
onChange: H,
|
|
366
|
+
onMouseMove: H,
|
|
367
|
+
onMouseEnter: H,
|
|
368
|
+
onMouseLeave: H,
|
|
369
|
+
onTouchStart: H,
|
|
370
|
+
onTouchMove: H,
|
|
371
|
+
onTouchEnd: H,
|
|
372
372
|
onWheel: (e) => {
|
|
373
|
-
c.onWheel?.(e),
|
|
373
|
+
c.onWheel?.(e), H(e);
|
|
374
374
|
},
|
|
375
375
|
onPointerDown: (e) => {
|
|
376
|
-
c.onPointerDown?.(e),
|
|
376
|
+
c.onPointerDown?.(e), H(e);
|
|
377
377
|
},
|
|
378
378
|
role: "listbox",
|
|
379
|
-
style:
|
|
379
|
+
style: fe,
|
|
380
380
|
children: [/* @__PURE__ */ P("div", {
|
|
381
381
|
className: "comins-table__component-virtual-list-items",
|
|
382
382
|
onScroll: (e) => {
|
|
383
|
-
|
|
383
|
+
H(e), y(e.currentTarget.scrollTop);
|
|
384
384
|
let t = e.currentTarget.clientHeight > 0 ? e.currentTarget.clientHeight : f;
|
|
385
|
-
|
|
385
|
+
C(p ? t : Math.min(t, f));
|
|
386
386
|
},
|
|
387
|
-
ref:
|
|
387
|
+
ref: w,
|
|
388
388
|
role: "presentation",
|
|
389
389
|
children: [
|
|
390
|
-
|
|
390
|
+
le > 0 ? /* @__PURE__ */ N("span", {
|
|
391
391
|
"aria-hidden": "true",
|
|
392
392
|
className: "comins-table__component-virtual-list-spacer",
|
|
393
|
-
style: { height:
|
|
393
|
+
style: { height: le }
|
|
394
394
|
}) : null,
|
|
395
|
-
|
|
395
|
+
O.map(({ item: n, itemIndex: r }) => /* @__PURE__ */ N("button", {
|
|
396
396
|
"aria-selected": b === n.value,
|
|
397
397
|
className: "comins-table__component-virtual-list-item",
|
|
398
398
|
"data-comins-virtual-list-item": "true",
|
|
399
399
|
disabled: n.disabled,
|
|
400
400
|
onClick: (e) => {
|
|
401
|
-
|
|
401
|
+
U(e), pe(n, r, e);
|
|
402
402
|
},
|
|
403
403
|
onContextMenu: (i) => {
|
|
404
|
-
|
|
404
|
+
H(i), !n.disabled && e.onContextMenuItem?.({
|
|
405
405
|
...t,
|
|
406
406
|
event: i,
|
|
407
407
|
item: n,
|
|
@@ -410,10 +410,10 @@ function Ge({ component: e, payload: t }) {
|
|
|
410
410
|
});
|
|
411
411
|
},
|
|
412
412
|
onKeyDown: (e) => {
|
|
413
|
-
|
|
413
|
+
H(e), (e.key === "Enter" || e.key === " " || e.key === "Spacebar") && (e.preventDefault(), pe(n, r, e));
|
|
414
414
|
},
|
|
415
|
-
onMouseDown:
|
|
416
|
-
onPointerDown:
|
|
415
|
+
onMouseDown: H,
|
|
416
|
+
onPointerDown: H,
|
|
417
417
|
role: "option",
|
|
418
418
|
type: "button",
|
|
419
419
|
children: /* @__PURE__ */ N("span", {
|
|
@@ -421,54 +421,54 @@ function Ge({ component: e, payload: t }) {
|
|
|
421
421
|
children: n.label
|
|
422
422
|
})
|
|
423
423
|
}, `${String(n.value)}-${r}`)),
|
|
424
|
-
|
|
424
|
+
ue > 0 ? /* @__PURE__ */ N("span", {
|
|
425
425
|
"aria-hidden": "true",
|
|
426
426
|
className: "comins-table__component-virtual-list-spacer",
|
|
427
|
-
style: { height:
|
|
427
|
+
style: { height: ue }
|
|
428
428
|
}) : null
|
|
429
429
|
]
|
|
430
430
|
}), /* @__PURE__ */ P("div", {
|
|
431
431
|
className: "comins-table__component-virtual-list-controls",
|
|
432
|
-
children: [
|
|
432
|
+
children: [ie ? te ? /* @__PURE__ */ N("button", {
|
|
433
433
|
"aria-label": "전체 목록 보기",
|
|
434
434
|
className: "comins-table__component-virtual-list-overflow comins-table__component-virtual-list-more",
|
|
435
|
-
"data-testid": `virtual-list-overflow-${
|
|
435
|
+
"data-testid": `virtual-list-overflow-${de}`,
|
|
436
436
|
onClick: (e) => {
|
|
437
|
-
|
|
437
|
+
U(e), _(!0);
|
|
438
438
|
},
|
|
439
|
-
onKeyDown:
|
|
440
|
-
onMouseDown:
|
|
441
|
-
onPointerDown:
|
|
439
|
+
onKeyDown: H,
|
|
440
|
+
onMouseDown: H,
|
|
441
|
+
onPointerDown: H,
|
|
442
442
|
type: "button",
|
|
443
443
|
children: "..."
|
|
444
444
|
}) : /* @__PURE__ */ N("span", {
|
|
445
445
|
"aria-hidden": "true",
|
|
446
446
|
className: "comins-table__component-virtual-list-overflow comins-table__component-virtual-list-more",
|
|
447
|
-
"data-testid": `virtual-list-overflow-${
|
|
447
|
+
"data-testid": `virtual-list-overflow-${de}`,
|
|
448
448
|
children: "..."
|
|
449
|
-
}) : null,
|
|
449
|
+
}) : null, ee ? /* @__PURE__ */ N("input", {
|
|
450
450
|
"aria-label": `${c["aria-label"] ?? "Virtual list"} 검색`,
|
|
451
451
|
className: "comins-table__component-virtual-list-search",
|
|
452
|
-
"data-testid": `virtual-list-search-${
|
|
452
|
+
"data-testid": `virtual-list-search-${de}`,
|
|
453
453
|
onChange: (e) => {
|
|
454
|
-
|
|
454
|
+
H(e), h(e.currentTarget.value);
|
|
455
455
|
},
|
|
456
|
-
onClick:
|
|
457
|
-
onKeyDown:
|
|
458
|
-
onMouseDown:
|
|
459
|
-
onPointerDown:
|
|
456
|
+
onClick: H,
|
|
457
|
+
onKeyDown: H,
|
|
458
|
+
onMouseDown: H,
|
|
459
|
+
onPointerDown: H,
|
|
460
460
|
placeholder: "검색",
|
|
461
461
|
value: m
|
|
462
462
|
}) : null]
|
|
463
463
|
})]
|
|
464
464
|
});
|
|
465
465
|
}
|
|
466
|
-
function
|
|
467
|
-
if (e.type === "menu") return /* @__PURE__ */ N(
|
|
466
|
+
function Ge(e, t) {
|
|
467
|
+
if (e.type === "menu") return /* @__PURE__ */ N(Ue, {
|
|
468
468
|
component: e,
|
|
469
469
|
payload: t
|
|
470
470
|
});
|
|
471
|
-
if (e.type === "virtual-list") return /* @__PURE__ */ N(
|
|
471
|
+
if (e.type === "virtual-list") return /* @__PURE__ */ N(We, {
|
|
472
472
|
component: e,
|
|
473
473
|
payload: t
|
|
474
474
|
});
|
|
@@ -478,53 +478,53 @@ function Ke(e, t) {
|
|
|
478
478
|
...s,
|
|
479
479
|
className: L("comins-table__component", "comins-table__component-button", n.className),
|
|
480
480
|
onClick: (n) => {
|
|
481
|
-
r?.(n),
|
|
481
|
+
r?.(n), H(n), e.onClick?.({
|
|
482
482
|
...t,
|
|
483
483
|
event: n
|
|
484
484
|
});
|
|
485
485
|
},
|
|
486
486
|
onKeyDown: (e) => {
|
|
487
|
-
i?.(e),
|
|
487
|
+
i?.(e), H(e);
|
|
488
488
|
},
|
|
489
489
|
onMouseDown: (e) => {
|
|
490
|
-
a?.(e),
|
|
490
|
+
a?.(e), H(e);
|
|
491
491
|
},
|
|
492
492
|
onPointerDown: (e) => {
|
|
493
|
-
o?.(e),
|
|
493
|
+
o?.(e), H(e);
|
|
494
494
|
},
|
|
495
495
|
type: n.type ?? "button"
|
|
496
496
|
});
|
|
497
497
|
}
|
|
498
|
-
if (e.type === "input") return /* @__PURE__ */ N(
|
|
498
|
+
if (e.type === "input") return /* @__PURE__ */ N(Ve, {
|
|
499
499
|
component: e,
|
|
500
500
|
payload: t
|
|
501
501
|
});
|
|
502
|
-
if (e.type === "checkbox") return /* @__PURE__ */ N(
|
|
502
|
+
if (e.type === "checkbox") return /* @__PURE__ */ N(He, {
|
|
503
503
|
component: e,
|
|
504
504
|
payload: t
|
|
505
505
|
});
|
|
506
506
|
if (e.type === "select") {
|
|
507
|
-
let n = R(e.props, t), r =
|
|
507
|
+
let n = R(e.props, t), r = z(e.options, t), { onChange: i, onClick: a, onKeyDown: o, onMouseDown: s, onPointerDown: c, ...l } = n;
|
|
508
508
|
return /* @__PURE__ */ N("select", {
|
|
509
509
|
...l,
|
|
510
510
|
className: L("comins-table__component", "comins-table__component-select", n.className),
|
|
511
511
|
onClick: (e) => {
|
|
512
|
-
a?.(e),
|
|
512
|
+
a?.(e), H(e);
|
|
513
513
|
},
|
|
514
514
|
onChange: (n) => {
|
|
515
|
-
i?.(n),
|
|
515
|
+
i?.(n), H(n), e.onValueChange?.({
|
|
516
516
|
...t,
|
|
517
517
|
value: n.currentTarget.value
|
|
518
518
|
});
|
|
519
519
|
},
|
|
520
520
|
onKeyDown: (e) => {
|
|
521
|
-
o?.(e),
|
|
521
|
+
o?.(e), H(e);
|
|
522
522
|
},
|
|
523
523
|
onMouseDown: (e) => {
|
|
524
|
-
s?.(e),
|
|
524
|
+
s?.(e), H(e);
|
|
525
525
|
},
|
|
526
526
|
onPointerDown: (e) => {
|
|
527
|
-
c?.(e),
|
|
527
|
+
c?.(e), H(e);
|
|
528
528
|
},
|
|
529
529
|
children: r.map((e) => /* @__PURE__ */ N("option", {
|
|
530
530
|
disabled: e.disabled,
|
|
@@ -534,40 +534,40 @@ function Ke(e, t) {
|
|
|
534
534
|
});
|
|
535
535
|
}
|
|
536
536
|
if (e.type === "radio") {
|
|
537
|
-
let n = R(e.props, t), r =
|
|
537
|
+
let n = R(e.props, t), r = z(e.options, t), i = n.value ?? ("value" in t ? t.value : void 0), a = "row" in t ? `${t.column.id}-${String(t.row.id)}-radio` : `${t.column.id}-header-radio`, { value: o, ...s } = n;
|
|
538
538
|
return /* @__PURE__ */ N("div", {
|
|
539
539
|
...s,
|
|
540
540
|
className: L("comins-table__component", "comins-table__component-radio", s.className),
|
|
541
541
|
onClick: (e) => {
|
|
542
|
-
s.onClick?.(e),
|
|
542
|
+
s.onClick?.(e), H(e);
|
|
543
543
|
},
|
|
544
544
|
onKeyDown: (e) => {
|
|
545
|
-
s.onKeyDown?.(e),
|
|
545
|
+
s.onKeyDown?.(e), H(e);
|
|
546
546
|
},
|
|
547
547
|
onMouseDown: (e) => {
|
|
548
|
-
s.onMouseDown?.(e),
|
|
548
|
+
s.onMouseDown?.(e), H(e);
|
|
549
549
|
},
|
|
550
550
|
onPointerDown: (e) => {
|
|
551
|
-
s.onPointerDown?.(e),
|
|
551
|
+
s.onPointerDown?.(e), H(e);
|
|
552
552
|
},
|
|
553
553
|
role: "radiogroup",
|
|
554
554
|
children: r.map((n) => /* @__PURE__ */ P("label", {
|
|
555
|
-
onClick:
|
|
556
|
-
onMouseDown:
|
|
555
|
+
onClick: H,
|
|
556
|
+
onMouseDown: H,
|
|
557
557
|
children: [/* @__PURE__ */ N("input", {
|
|
558
558
|
checked: i === void 0 ? void 0 : String(i) === String(n.value),
|
|
559
559
|
disabled: n.disabled,
|
|
560
560
|
name: a,
|
|
561
|
-
onClick:
|
|
561
|
+
onClick: H,
|
|
562
562
|
onChange: (r) => {
|
|
563
|
-
|
|
563
|
+
H(r), r.currentTarget.checked && e.onValueChange?.({
|
|
564
564
|
...t,
|
|
565
565
|
value: String(n.value)
|
|
566
566
|
});
|
|
567
567
|
},
|
|
568
|
-
onKeyDown:
|
|
569
|
-
onMouseDown:
|
|
570
|
-
onPointerDown:
|
|
568
|
+
onKeyDown: H,
|
|
569
|
+
onMouseDown: H,
|
|
570
|
+
onPointerDown: H,
|
|
571
571
|
style: {
|
|
572
572
|
height: 20,
|
|
573
573
|
width: 20
|
|
@@ -578,7 +578,7 @@ function Ke(e, t) {
|
|
|
578
578
|
}, String(n.value)))
|
|
579
579
|
});
|
|
580
580
|
}
|
|
581
|
-
if (e.type === "toggle") return /* @__PURE__ */ N(
|
|
581
|
+
if (e.type === "toggle") return /* @__PURE__ */ N(W, {
|
|
582
582
|
component: e,
|
|
583
583
|
payload: t
|
|
584
584
|
});
|
|
@@ -589,52 +589,57 @@ function Ke(e, t) {
|
|
|
589
589
|
"aria-valuemin": 0,
|
|
590
590
|
"aria-valuenow": r,
|
|
591
591
|
className: L("comins-table__component", "comins-table__component-progress", n.className),
|
|
592
|
-
onClick:
|
|
593
|
-
onKeyDown:
|
|
594
|
-
onMouseDown:
|
|
595
|
-
onPointerDown:
|
|
592
|
+
onClick: H,
|
|
593
|
+
onKeyDown: H,
|
|
594
|
+
onMouseDown: H,
|
|
595
|
+
onPointerDown: H,
|
|
596
596
|
role: "progressbar",
|
|
597
597
|
children: /* @__PURE__ */ N("span", { style: { width: `${a}%` } })
|
|
598
598
|
});
|
|
599
599
|
}
|
|
600
600
|
//#endregion
|
|
601
601
|
//#region src/summary.ts
|
|
602
|
-
function
|
|
602
|
+
function Ke(e, t) {
|
|
603
603
|
return t.split(".").reduce((e, t) => {
|
|
604
604
|
if (!(typeof e != "object" || !e)) return e[t];
|
|
605
605
|
}, e);
|
|
606
606
|
}
|
|
607
|
-
function
|
|
607
|
+
function qe(e) {
|
|
608
608
|
return e.filter((e) => typeof e == "number" && Number.isFinite(e));
|
|
609
609
|
}
|
|
610
|
-
function
|
|
610
|
+
function Je(e, t) {
|
|
611
611
|
if (e === "count") return t.length;
|
|
612
|
-
let n =
|
|
612
|
+
let n = qe(t);
|
|
613
613
|
return n.length === 0 ? null : e === "sum" ? n.reduce((e, t) => e + t, 0) : e === "avg" ? n.reduce((e, t) => e + t, 0) / n.length : e === "min" ? Math.min(...n) : Math.max(...n);
|
|
614
614
|
}
|
|
615
|
-
function
|
|
615
|
+
function Ye(e, t, n) {
|
|
616
616
|
return Object.entries(n.columns).reduce((n, [r, i]) => {
|
|
617
617
|
let a = t.find((e) => e.id === r);
|
|
618
618
|
if (!a || !i) return n;
|
|
619
|
-
let o = e.map((e) =>
|
|
620
|
-
|
|
619
|
+
let o = typeof i == "object" && i ? i : void 0, s = typeof i == "object" && i ? i.aggregate : i, c = e.map((e) => Ke(e, a.field)), l = typeof s == "function" ? s({
|
|
620
|
+
column: a,
|
|
621
|
+
rows: e,
|
|
622
|
+
values: c
|
|
623
|
+
}) : Je(s, c);
|
|
624
|
+
return n[r] = o?.format ? o.format({
|
|
621
625
|
column: a,
|
|
622
626
|
rows: e,
|
|
623
|
-
|
|
624
|
-
|
|
627
|
+
value: l,
|
|
628
|
+
values: c
|
|
629
|
+
}) : l, n;
|
|
625
630
|
}, {});
|
|
626
631
|
}
|
|
627
632
|
//#endregion
|
|
628
633
|
//#region src/tree.ts
|
|
629
|
-
function
|
|
634
|
+
function Xe(e) {
|
|
630
635
|
return e.join(".");
|
|
631
636
|
}
|
|
632
|
-
function
|
|
637
|
+
function G(e, t) {
|
|
633
638
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = 0, a = (e, o) => {
|
|
634
639
|
e.forEach((e, s) => {
|
|
635
640
|
let c = [...o, s], l = t(e.item, i);
|
|
636
641
|
if (i += 1, n.has(l)) throw Error(`Duplicate tree row id: ${String(l)}`);
|
|
637
|
-
n.set(l, c), r.set(
|
|
642
|
+
n.set(l, c), r.set(Xe(c), l), e.children?.length && a(e.children, c);
|
|
638
643
|
});
|
|
639
644
|
};
|
|
640
645
|
return a(e, []), {
|
|
@@ -642,56 +647,56 @@ function W(e, t) {
|
|
|
642
647
|
idByPath: r
|
|
643
648
|
};
|
|
644
649
|
}
|
|
645
|
-
function
|
|
650
|
+
function Ze(e, t, n) {
|
|
646
651
|
let [r, ...i] = t;
|
|
647
652
|
return r === void 0 ? [...e] : e.map((e, t) => t === r ? i.length === 0 ? n(e) : e.children ? {
|
|
648
653
|
...e,
|
|
649
|
-
children:
|
|
654
|
+
children: Ze(e.children, i, n)
|
|
650
655
|
} : e : e);
|
|
651
656
|
}
|
|
652
|
-
function
|
|
653
|
-
let
|
|
654
|
-
e.forEach((e,
|
|
655
|
-
let
|
|
656
|
-
|
|
657
|
+
function Qe(e, t, n = {}) {
|
|
658
|
+
let r = G(e, t), i = [], a = (e, t, o) => {
|
|
659
|
+
e.forEach((e, s) => {
|
|
660
|
+
let c = [...o, s], l = e.children ?? [], u = l.length > 0, d = e.expand ?? n.defaultExpandAll ?? !1, f = r.idByPath.get(Xe(c));
|
|
661
|
+
f !== void 0 && (i.push({
|
|
657
662
|
depth: t,
|
|
658
|
-
expanded:
|
|
659
|
-
hasChildren:
|
|
663
|
+
expanded: d,
|
|
664
|
+
hasChildren: u,
|
|
660
665
|
item: e.item,
|
|
661
|
-
path:
|
|
662
|
-
rowId:
|
|
663
|
-
}),
|
|
666
|
+
path: c,
|
|
667
|
+
rowId: f
|
|
668
|
+
}), u && d && a(l, t + 1, c));
|
|
664
669
|
});
|
|
665
670
|
};
|
|
666
|
-
return
|
|
671
|
+
return a(e, 0, []), i;
|
|
667
672
|
}
|
|
668
|
-
function
|
|
669
|
-
return e.flatMap((e) => e.children?.length ?
|
|
673
|
+
function $e(e) {
|
|
674
|
+
return e.flatMap((e) => e.children?.length ? $e(e.children) : [e.item]);
|
|
670
675
|
}
|
|
671
|
-
function
|
|
672
|
-
let
|
|
673
|
-
return
|
|
676
|
+
function et(e, t, n, r = {}) {
|
|
677
|
+
let i = G(e, n).byId.get(t);
|
|
678
|
+
return i ? Ze(e, i, (e) => ({
|
|
674
679
|
...e,
|
|
675
|
-
expand: e.expand
|
|
680
|
+
expand: !(e.expand ?? r.defaultExpandAll ?? !1)
|
|
676
681
|
})) : [...e];
|
|
677
682
|
}
|
|
678
|
-
function
|
|
679
|
-
let i =
|
|
680
|
-
return i ?
|
|
683
|
+
function tt(e, t, n, r) {
|
|
684
|
+
let i = G(e, n).byId.get(t);
|
|
685
|
+
return i ? Ze(e, i, (e) => ({
|
|
681
686
|
...e,
|
|
682
687
|
item: r(e.item)
|
|
683
688
|
})) : [...e];
|
|
684
689
|
}
|
|
685
|
-
function
|
|
690
|
+
function K(e, t) {
|
|
686
691
|
return [...e].sort((e, n) => t(e.item, n.item)).map((e) => ({
|
|
687
692
|
...e,
|
|
688
|
-
children: e.children ?
|
|
693
|
+
children: e.children ? K(e.children, t) : void 0
|
|
689
694
|
}));
|
|
690
695
|
}
|
|
691
696
|
//#endregion
|
|
692
697
|
//#region src/index.tsx
|
|
693
|
-
var
|
|
694
|
-
function
|
|
698
|
+
var nt = 50;
|
|
699
|
+
function rt(e, t, n, r, i) {
|
|
695
700
|
let a = Math.max(0, r), o = e?.length ?? t.length, s = Math.min(o, Math.max(a, i)), c = [];
|
|
696
701
|
for (let r = a; r < s; r += 1) {
|
|
697
702
|
let i = e?.[r] ?? r, a = t[i], o = n[i];
|
|
@@ -704,26 +709,26 @@ function it(e, t, n, r, i) {
|
|
|
704
709
|
}
|
|
705
710
|
return c;
|
|
706
711
|
}
|
|
707
|
-
function
|
|
712
|
+
function it(e) {
|
|
708
713
|
return !e || typeof e == "string" ? e : Object.entries(e).filter(([, e]) => e).map(([e]) => e).join(" ");
|
|
709
714
|
}
|
|
710
|
-
function
|
|
715
|
+
function q(e, t, n) {
|
|
711
716
|
return typeof e == "function" ? e(t, n) : e;
|
|
712
717
|
}
|
|
713
|
-
function
|
|
714
|
-
let r =
|
|
718
|
+
function at(e, t, n) {
|
|
719
|
+
let r = q(e?.disabled, t, n) === !0;
|
|
715
720
|
return {
|
|
716
|
-
className:
|
|
721
|
+
className: it(q(e?.className, t, n)),
|
|
717
722
|
disabled: r,
|
|
718
|
-
draggable: !r &&
|
|
719
|
-
style:
|
|
723
|
+
draggable: !r && q(e?.draggable, t, n) !== !1,
|
|
724
|
+
style: q(e?.style, t, n)
|
|
720
725
|
};
|
|
721
726
|
}
|
|
722
|
-
function
|
|
727
|
+
function ot(e) {
|
|
723
728
|
let t = e?.background ?? e?.backgroundColor;
|
|
724
729
|
return typeof t == "string" || typeof t == "number" ? t : void 0;
|
|
725
730
|
}
|
|
726
|
-
function
|
|
731
|
+
function st(e, t, n) {
|
|
727
732
|
let r = {
|
|
728
733
|
height: e,
|
|
729
734
|
...t
|
|
@@ -733,7 +738,7 @@ function ct(e, t, n) {
|
|
|
733
738
|
"--comins-table-row-custom-background": n
|
|
734
739
|
};
|
|
735
740
|
}
|
|
736
|
-
function
|
|
741
|
+
function ct(e) {
|
|
737
742
|
return {
|
|
738
743
|
data: e.row,
|
|
739
744
|
dataIndex: e.dataIndex,
|
|
@@ -741,7 +746,7 @@ function lt(e) {
|
|
|
741
746
|
index: e.visibleIndex
|
|
742
747
|
};
|
|
743
748
|
}
|
|
744
|
-
function
|
|
749
|
+
function lt(e, t) {
|
|
745
750
|
return {
|
|
746
751
|
definition: e,
|
|
747
752
|
field: e.field,
|
|
@@ -750,23 +755,23 @@ function ut(e, t) {
|
|
|
750
755
|
label: e.label
|
|
751
756
|
};
|
|
752
757
|
}
|
|
753
|
-
function
|
|
758
|
+
function ut(e, t) {
|
|
754
759
|
return {
|
|
755
760
|
event: e,
|
|
756
761
|
index: t.visibleIndex,
|
|
757
|
-
row:
|
|
762
|
+
row: ct(t)
|
|
758
763
|
};
|
|
759
764
|
}
|
|
760
|
-
function
|
|
765
|
+
function dt(e, t, n, r, i) {
|
|
761
766
|
return {
|
|
762
|
-
column:
|
|
767
|
+
column: lt(n, r),
|
|
763
768
|
event: e,
|
|
764
769
|
index: t.visibleIndex,
|
|
765
|
-
row:
|
|
770
|
+
row: ct(t),
|
|
766
771
|
value: i
|
|
767
772
|
};
|
|
768
773
|
}
|
|
769
|
-
function
|
|
774
|
+
function J(e, t) {
|
|
770
775
|
return {
|
|
771
776
|
definition: e,
|
|
772
777
|
field: e.field,
|
|
@@ -775,9 +780,9 @@ function q(e, t) {
|
|
|
775
780
|
label: e.label
|
|
776
781
|
};
|
|
777
782
|
}
|
|
778
|
-
function
|
|
783
|
+
function ft(e, t, n, r, i, a, o) {
|
|
779
784
|
return {
|
|
780
|
-
column:
|
|
785
|
+
column: J(i, a),
|
|
781
786
|
row: {
|
|
782
787
|
data: e.row,
|
|
783
788
|
dataIndex: e.dataIndex,
|
|
@@ -790,31 +795,31 @@ function pt(e, t, n, r, i, a, o) {
|
|
|
790
795
|
value: o
|
|
791
796
|
};
|
|
792
797
|
}
|
|
793
|
-
function
|
|
798
|
+
function pt(e, t) {
|
|
794
799
|
let n = e.cell?.props;
|
|
795
800
|
return typeof n == "function" ? n(t) : n;
|
|
796
801
|
}
|
|
797
|
-
function
|
|
802
|
+
function mt(e, t) {
|
|
798
803
|
return e === void 0 ? !0 : typeof e == "boolean" ? e : e(t);
|
|
799
804
|
}
|
|
800
|
-
function
|
|
801
|
-
return e?.disabled !== void 0 &&
|
|
805
|
+
function ht(e, t) {
|
|
806
|
+
return e?.disabled !== void 0 && mt(e.disabled, t) === !0;
|
|
802
807
|
}
|
|
803
|
-
function
|
|
808
|
+
function gt(e, t) {
|
|
804
809
|
let n = e?.className;
|
|
805
810
|
return typeof n == "function" ? n(t) : n;
|
|
806
811
|
}
|
|
807
|
-
function
|
|
812
|
+
function _t(e, t) {
|
|
808
813
|
let n = e?.style;
|
|
809
814
|
return typeof n == "function" ? n(t) : n;
|
|
810
815
|
}
|
|
811
|
-
function
|
|
816
|
+
function vt(e, t, n) {
|
|
812
817
|
return e.cell?.format ? e.cell.format(n) : t == null ? "" : String(t);
|
|
813
818
|
}
|
|
814
|
-
function
|
|
819
|
+
function yt(e, t, n) {
|
|
815
820
|
let r = e.columnState[t.id];
|
|
816
821
|
return {
|
|
817
|
-
column:
|
|
822
|
+
column: J(t, n),
|
|
818
823
|
layout: {
|
|
819
824
|
hidden: r?.hidden === !0 || t.hidden === !0,
|
|
820
825
|
width: r?.width ?? t.width
|
|
@@ -825,17 +830,17 @@ function bt(e, t, n) {
|
|
|
825
830
|
}
|
|
826
831
|
};
|
|
827
832
|
}
|
|
828
|
-
function
|
|
833
|
+
function bt(e) {
|
|
829
834
|
return "row" in e && "selection" in e;
|
|
830
835
|
}
|
|
831
|
-
function
|
|
832
|
-
return !
|
|
836
|
+
function xt(e, t) {
|
|
837
|
+
return !bt(t) || e.type !== "input" && e.type !== "select" || t.selection.selectedRowCount === 1 && t.row.selected;
|
|
833
838
|
}
|
|
834
|
-
function
|
|
835
|
-
return (e ?? []).filter((e) =>
|
|
839
|
+
function St(e, t) {
|
|
840
|
+
return (e ?? []).filter((e) => xt(e, t));
|
|
836
841
|
}
|
|
837
|
-
function
|
|
838
|
-
return
|
|
842
|
+
function Ct(e, t, n) {
|
|
843
|
+
return St(e, t).map((e, t) => ({
|
|
839
844
|
component: e,
|
|
840
845
|
index: t
|
|
841
846
|
})).filter(({ component: e }) => (e.direction ?? "left") === n).map(({ component: e, index: r }) => /* @__PURE__ */ N("span", {
|
|
@@ -843,14 +848,14 @@ function wt(e, t, n) {
|
|
|
843
848
|
"data-comins-component-align": e.align ?? "center",
|
|
844
849
|
"data-comins-component-direction": n,
|
|
845
850
|
"data-comins-component-id": e.id ?? `${e.type}-${r}`,
|
|
846
|
-
children:
|
|
851
|
+
children: Ge(e, t)
|
|
847
852
|
}, e.id ?? `${e.type}-${r}`));
|
|
848
853
|
}
|
|
849
|
-
function
|
|
854
|
+
function wt(e, t, n, r = {}) {
|
|
850
855
|
if (!t?.length) return e;
|
|
851
|
-
let i = r.showContent ?? !0, a =
|
|
856
|
+
let i = r.showContent ?? !0, a = St(t, n);
|
|
852
857
|
if (!a.length) return e;
|
|
853
|
-
let o =
|
|
858
|
+
let o = Ct(a, n, "left"), s = Ct(a, n, "right");
|
|
854
859
|
return i ? /* @__PURE__ */ P("span", {
|
|
855
860
|
className: "comins-table__component-layout",
|
|
856
861
|
children: [
|
|
@@ -879,48 +884,48 @@ function Tt(e, t, n, r = {}) {
|
|
|
879
884
|
})
|
|
880
885
|
});
|
|
881
886
|
}
|
|
882
|
-
function
|
|
883
|
-
return Math.max(
|
|
887
|
+
function Tt(e) {
|
|
888
|
+
return Math.max(nt, e.minWidth ?? nt);
|
|
884
889
|
}
|
|
885
|
-
function
|
|
890
|
+
function Y(e) {
|
|
886
891
|
return e.maxWidth ?? Infinity;
|
|
887
892
|
}
|
|
888
|
-
function
|
|
893
|
+
function Et(e, t) {
|
|
889
894
|
return e.columnState[t.id]?.width ?? t.width ?? 100;
|
|
890
895
|
}
|
|
891
|
-
function
|
|
896
|
+
function X(e, t, n) {
|
|
892
897
|
return Math.min(n, Math.max(t, e));
|
|
893
898
|
}
|
|
894
|
-
function
|
|
895
|
-
let r = t.map((t) =>
|
|
899
|
+
function Dt(e, t, n) {
|
|
900
|
+
let r = t.map((t) => X(Et(e, t), Tt(t), Y(t))), i = new Set(t.map((e, t) => t)), a = t.map(Tt), o = t.map(Y), s = X(n, a.reduce((e, t) => e + t, 0), o.reduce((e, t) => e + t, 0));
|
|
896
901
|
for (; i.size > 0;) {
|
|
897
902
|
let e = s - r.reduce((e, t) => e + t, 0);
|
|
898
903
|
if (Math.abs(e) < .001) break;
|
|
899
904
|
let t = [...i], n = t.reduce((e, t) => e + Math.max(r[t] ?? 0, 0), 0), c = !1;
|
|
900
905
|
for (let s of t) {
|
|
901
|
-
let l = r[s] ?? 0, u = l + e * (n > 0 ? l / n : 1 / t.length), d =
|
|
906
|
+
let l = r[s] ?? 0, u = l + e * (n > 0 ? l / n : 1 / t.length), d = X(u, a[s] ?? 0, o[s] ?? Infinity);
|
|
902
907
|
r[s] = d, Math.abs(d - u) > .001 && (i.delete(s), c = !0);
|
|
903
908
|
}
|
|
904
909
|
if (!c) break;
|
|
905
910
|
}
|
|
906
911
|
return r;
|
|
907
912
|
}
|
|
908
|
-
function
|
|
913
|
+
function Ot(e, t, n) {
|
|
909
914
|
let r = e.columnGroups.find((e) => e.children.includes(t));
|
|
910
|
-
if (!r || e.columnGroupState[r.id]?.hidden === !0) return
|
|
915
|
+
if (!r || e.columnGroupState[r.id]?.hidden === !0) return me(e, t, n);
|
|
911
916
|
let i = r.children.map((t) => e.columns.find((e) => e.id === t)).filter((e) => !!e).filter((t) => e.columnState[t.id]?.hidden !== !0), a = i.find((e) => e.id === t);
|
|
912
|
-
if (!a) return
|
|
917
|
+
if (!a) return me(e, t, n);
|
|
913
918
|
let o = i.filter((e) => e.id !== t);
|
|
914
919
|
if (o.length === 0) {
|
|
915
|
-
let r =
|
|
916
|
-
return
|
|
920
|
+
let r = Et(e, a);
|
|
921
|
+
return me(e, t, X(n, Tt(a), Math.min(Y(a), r)));
|
|
917
922
|
}
|
|
918
|
-
let s = i.reduce((t, n) => t +
|
|
923
|
+
let s = i.reduce((t, n) => t + Et(e, n), 0), c = o.reduce((e, t) => e + Tt(t), 0), l = o.reduce((e, t) => e + Y(t), 0), u = Math.max(Tt(a), s - l), d = X(n, u, Math.max(u, Math.min(Y(a), s - c))), f = Dt(e, o, s - d), p = me(e, t, d);
|
|
919
924
|
return o.forEach((e, t) => {
|
|
920
|
-
p =
|
|
925
|
+
p = me(p, e.id, f[t] ?? Et(p, e));
|
|
921
926
|
}), p;
|
|
922
927
|
}
|
|
923
|
-
function
|
|
928
|
+
function kt(e, t, n) {
|
|
924
929
|
if (!e || typeof e != "object") return e;
|
|
925
930
|
let r = t.split("."), [i] = r;
|
|
926
931
|
if (!i) return e;
|
|
@@ -934,7 +939,7 @@ function At(e, t, n) {
|
|
|
934
939
|
o[e] = a, n && (o = a);
|
|
935
940
|
}), o[r.at(-1)] = n, a;
|
|
936
941
|
}
|
|
937
|
-
function
|
|
942
|
+
function At(e, t) {
|
|
938
943
|
return e?.columnId === t ? e.direction === "asc" ? {
|
|
939
944
|
columnId: t,
|
|
940
945
|
direction: "desc"
|
|
@@ -943,79 +948,111 @@ function jt(e, t) {
|
|
|
943
948
|
direction: "asc"
|
|
944
949
|
};
|
|
945
950
|
}
|
|
946
|
-
function
|
|
951
|
+
function jt(e, t) {
|
|
947
952
|
return e?.columnId === t ? e.direction : "none";
|
|
948
953
|
}
|
|
949
|
-
function
|
|
954
|
+
function Mt(e, t) {
|
|
950
955
|
return e?.columnId === t ? e.direction === "asc" ? "ascending" : "descending" : "none";
|
|
951
956
|
}
|
|
952
|
-
function
|
|
957
|
+
function Nt(e, t) {
|
|
953
958
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
954
959
|
}
|
|
955
|
-
function
|
|
956
|
-
if (!
|
|
960
|
+
function Pt(e, t) {
|
|
961
|
+
if (!Nt(e.rowIds, t.rowIds)) return !1;
|
|
957
962
|
let n = new Set(t.columns.map((e) => e.id)), r = e.selection.cell, i = e.selection.range;
|
|
958
963
|
return !(r && !n.has(r.columnId) || i && (!n.has(i.anchor.columnId) || !n.has(i.focus.columnId)));
|
|
959
964
|
}
|
|
960
|
-
function
|
|
965
|
+
function Ft(e, t) {
|
|
961
966
|
return t.split(".").reduce((e, t) => {
|
|
962
967
|
if (!(typeof e != "object" || !e)) return e[t];
|
|
963
968
|
}, e);
|
|
964
969
|
}
|
|
965
|
-
function
|
|
970
|
+
function It(e, t) {
|
|
966
971
|
return typeof e == "number" && typeof t == "number" ? e - t : String(e ?? "").localeCompare(String(t ?? ""));
|
|
967
972
|
}
|
|
968
|
-
function
|
|
973
|
+
function Lt(e, t, n) {
|
|
969
974
|
if (!n) return e;
|
|
970
975
|
let r = t.find((e) => (e.id ?? e.field) === n.columnId);
|
|
971
|
-
return r?.sort ?
|
|
972
|
-
let i =
|
|
976
|
+
return r?.sort ? K(e, (e, t) => {
|
|
977
|
+
let i = Ft(e, r.field), a = Ft(t, r.field), o = typeof r.sort == "function" ? r.sort(i, a, e, t) : It(i, a);
|
|
973
978
|
return n.direction === "desc" ? o * -1 : o;
|
|
974
979
|
}) : e;
|
|
975
980
|
}
|
|
976
|
-
function
|
|
977
|
-
|
|
981
|
+
function Rt(e, t, n, r, i) {
|
|
982
|
+
if (t?.length === 0) return e;
|
|
983
|
+
let a = [], o = /* @__PURE__ */ new Map(), s = 0, c = (e, t) => {
|
|
984
|
+
e.forEach((e) => {
|
|
985
|
+
let n = r(e.item, s), i = !!e.children?.length;
|
|
986
|
+
s += 1, a.push({
|
|
987
|
+
ancestorIds: t,
|
|
988
|
+
hasChildren: i,
|
|
989
|
+
node: e,
|
|
990
|
+
rowId: n
|
|
991
|
+
}), o.set(e, n), e.children?.length && c(e.children, [...t, n]);
|
|
992
|
+
});
|
|
993
|
+
};
|
|
994
|
+
c(e, []);
|
|
995
|
+
let l = t ? new Set(t) : null, u = a.filter((e) => e.hasChildren && (!l || l.has(e.rowId))), d = new Set(u.map((e) => e.rowId)), f = new Map(a.map((e) => [e.rowId, e.node.expand ?? i])), p = /* @__PURE__ */ new Map();
|
|
996
|
+
if (u.forEach((e) => {
|
|
997
|
+
let t = !n || !l || e.ancestorIds.every((e) => f.get(e) === !0 || d.has(e)), r = e.node.expand ?? i;
|
|
998
|
+
t && r !== n && p.set(e.rowId, n);
|
|
999
|
+
}), p.size === 0) return e;
|
|
1000
|
+
let m = (e) => {
|
|
1001
|
+
let t = !1, n = e.map((e) => {
|
|
1002
|
+
let n = o.get(e), r = n === void 0 ? void 0 : p.get(n), i = e.children ? m(e.children) : e.children;
|
|
1003
|
+
return r === void 0 && i === e.children ? e : (t = !0, {
|
|
1004
|
+
...e,
|
|
1005
|
+
children: i,
|
|
1006
|
+
...r === void 0 ? {} : { expand: r }
|
|
1007
|
+
});
|
|
1008
|
+
});
|
|
1009
|
+
return t ? n : e;
|
|
1010
|
+
};
|
|
1011
|
+
return m(e);
|
|
1012
|
+
}
|
|
1013
|
+
function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroups: l, columns: u, data: d, "data-testid": f, emptyComponent: p, getRowId: m, hasMoreRows: h = !1, infiniteScroll: v = !1, infiniteScrollThreshold: y = 160, lazyLoad: x = !1, lazyLoadBatchSize: C = 30, lazyLoadMode: T = "append", lazyLoadThreshold: ee, loading: ae = !1, loadingComponent: oe, loadingMore: de = !1, onChangeColumnLayout: pe, onChangeData: he, onChangeSelection: ge, onChangeSort: ve, onClickCell: ye, onClickRow: Se, onContextMenuCell: we, onContextMenuRow: Te, onDoubleClickCell: Ee, onDoubleClickRow: Oe, onKeyDownCell: ke, onKeyDownRow: Ae, onLazyLoad: je, onLoadMore: Me, pagination: F, persistHeaderWhenEmpty: Ne = !0, rowHeight: I = 36, rowProps: Pe, showHeader: Fe = !0, skeletonRowCount: L, style: R, summary: z, theme: Le, treeContext: B, virtualized: V = !1 }, Re) {
|
|
1014
|
+
let ze = j(null), H = j(null), U = j(null), Be = j(null), Ve = j(null), He = j(null), W = j(null), Ue = j(null), We = j(null), Ge = j(null), Ke = j(0), qe = j(d), Je = j(void 0), Xe = j(null), G = j(null), Ze = j(null), Qe = j(null), $e = j(!1), et = j(null), tt = j(0), K = j(null), nt = j(null), q = j(null), [ct, lt] = M(0), [J, mt] = M(0), [bt, xt] = M(null), [Y, Et] = M(null), [X, Dt] = M(null), [Nt, Ft] = M(null), [It, Lt] = M(null), [Rt, zt] = M(d), [Bt, Vt] = M(void 0), [Ht, Ut] = M(null), [Wt, Gt] = M(null), [Kt, qt] = M(0), Jt = x ? Rt : d, [Z, Yt] = M(() => c({
|
|
978
1015
|
columnGroups: l,
|
|
979
1016
|
columns: u,
|
|
980
1017
|
getRowId: m,
|
|
981
1018
|
pagination: F,
|
|
982
|
-
rows:
|
|
1019
|
+
rows: Jt,
|
|
983
1020
|
showHeader: Fe,
|
|
984
|
-
theme:
|
|
985
|
-
})),
|
|
1021
|
+
theme: Le
|
|
1022
|
+
})), Xt = j(Z), Zt = j({
|
|
986
1023
|
columnGroups: l,
|
|
987
1024
|
columns: u,
|
|
988
|
-
data:
|
|
1025
|
+
data: Jt,
|
|
989
1026
|
getRowId: m,
|
|
990
1027
|
pagination: F,
|
|
991
1028
|
showHeader: Fe
|
|
992
|
-
}), Qt = Math.max(0, Math.floor(Number.isFinite(e) ? Number(e) : 10)), $t = Math.max(1, Math.floor(
|
|
993
|
-
if (!x ||
|
|
994
|
-
let t =
|
|
995
|
-
if (e === "scroll" &&
|
|
996
|
-
let n = new AbortController(), r =
|
|
997
|
-
|
|
1029
|
+
}), Qt = Math.max(0, Math.floor(Number.isFinite(e) ? Number(e) : 10)), $t = Math.max(1, Math.floor(C)), en = Math.max(0, Math.floor(ee ?? y)), tn = (e) => {
|
|
1030
|
+
if (!x || T !== "append" || !je || Ge.current) return;
|
|
1031
|
+
let t = Xt.current.rows.length;
|
|
1032
|
+
if (e === "scroll" && Je.current !== void 0 && t >= Je.current) return;
|
|
1033
|
+
let n = new AbortController(), r = Ke.current + 1, i = e === "scroll" ? t : 0;
|
|
1034
|
+
Ke.current = r, We.current?.abort(), We.current = n, Ge.current = e, e !== "scroll" && (tt.current = 0, qt(0), ze.current && (ze.current.scrollTop = 0)), Lt(e), je({
|
|
998
1035
|
limit: $t,
|
|
999
1036
|
offset: i,
|
|
1000
1037
|
reason: e,
|
|
1001
1038
|
signal: n.signal
|
|
1002
1039
|
}).then((t) => {
|
|
1003
|
-
if (n.signal.aborted ||
|
|
1004
|
-
let i = e === "scroll" ? [...
|
|
1005
|
-
|
|
1040
|
+
if (n.signal.aborted || Ke.current !== r) return;
|
|
1041
|
+
let i = e === "scroll" ? [...qe.current, ...t.rows] : [...t.rows];
|
|
1042
|
+
qe.current = i, Je.current = t.total, zt(i), Vt(t.total);
|
|
1006
1043
|
}).catch(() => {}).finally(() => {
|
|
1007
|
-
|
|
1044
|
+
Ke.current === r && (Ge.current = null, We.current = null, Lt(null));
|
|
1008
1045
|
});
|
|
1009
1046
|
};
|
|
1010
1047
|
k(() => {
|
|
1011
|
-
|
|
1012
|
-
}, [
|
|
1013
|
-
|
|
1014
|
-
}, [
|
|
1015
|
-
x || (
|
|
1048
|
+
qe.current = Rt;
|
|
1049
|
+
}, [Rt]), k(() => {
|
|
1050
|
+
Je.current = Bt;
|
|
1051
|
+
}, [Bt]), k(() => {
|
|
1052
|
+
x || (qe.current = d, zt(d), Je.current = void 0, Vt(void 0));
|
|
1016
1053
|
}, [d, x]), k(() => {
|
|
1017
1054
|
if (!(!x || !je)) return tn("initial"), () => {
|
|
1018
|
-
|
|
1055
|
+
Ke.current += 1, Ge.current = null, We.current?.abort(), We.current = null;
|
|
1019
1056
|
};
|
|
1020
1057
|
}, [
|
|
1021
1058
|
x,
|
|
@@ -1023,26 +1060,26 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1023
1060
|
$t
|
|
1024
1061
|
]), k(() => {
|
|
1025
1062
|
let e = Zt.current;
|
|
1026
|
-
e.columns === u && e.columnGroups === l && e.data ===
|
|
1063
|
+
e.columns === u && e.columnGroups === l && e.data === Jt && e.getRowId === m && e.pagination === F && e.showHeader === Fe || (Zt.current = {
|
|
1027
1064
|
columnGroups: l,
|
|
1028
1065
|
columns: u,
|
|
1029
|
-
data:
|
|
1066
|
+
data: Jt,
|
|
1030
1067
|
getRowId: m,
|
|
1031
1068
|
pagination: F,
|
|
1032
1069
|
showHeader: Fe
|
|
1033
|
-
},
|
|
1070
|
+
}, Yt((e) => {
|
|
1034
1071
|
let t = c({
|
|
1035
|
-
columnLayout:
|
|
1072
|
+
columnLayout: ue(e),
|
|
1036
1073
|
columnGroups: l,
|
|
1037
1074
|
columns: u,
|
|
1038
1075
|
getRowId: m,
|
|
1039
1076
|
pagination: F ?? e.pagination,
|
|
1040
|
-
rows:
|
|
1077
|
+
rows: Jt,
|
|
1041
1078
|
showHeader: Fe,
|
|
1042
1079
|
sort: e.sort,
|
|
1043
1080
|
theme: e.theme
|
|
1044
1081
|
});
|
|
1045
|
-
return
|
|
1082
|
+
return Pt(e, t) ? {
|
|
1046
1083
|
...t,
|
|
1047
1084
|
selection: e.selection
|
|
1048
1085
|
} : t;
|
|
@@ -1050,90 +1087,108 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1050
1087
|
}, [
|
|
1051
1088
|
l,
|
|
1052
1089
|
u,
|
|
1053
|
-
|
|
1090
|
+
Jt,
|
|
1054
1091
|
m,
|
|
1055
1092
|
F,
|
|
1056
1093
|
Fe
|
|
1057
1094
|
]), k(() => {
|
|
1058
|
-
|
|
1059
|
-
}, [
|
|
1060
|
-
|
|
1061
|
-
}, [
|
|
1062
|
-
|
|
1095
|
+
Xt.current = Z;
|
|
1096
|
+
}, [Z]), k(() => {
|
|
1097
|
+
Xe.current !== null && Xe.current !== Z.rows.length && (Xe.current = null);
|
|
1098
|
+
}, [Z.rows.length]), k(() => () => {
|
|
1099
|
+
nt.current !== null && window.cancelAnimationFrame(nt.current), K.current !== null && window.clearTimeout(K.current);
|
|
1063
1100
|
}, []), k(() => {
|
|
1064
|
-
let e =
|
|
1101
|
+
let e = ze.current;
|
|
1065
1102
|
if (!e || typeof ResizeObserver > "u") return;
|
|
1066
1103
|
let t = new ResizeObserver(([e]) => {
|
|
1067
|
-
e && (
|
|
1104
|
+
e && (lt(e.contentRect.height), mt(e.contentRect.width));
|
|
1068
1105
|
});
|
|
1069
1106
|
return t.observe(e), () => t.disconnect();
|
|
1070
1107
|
}, []);
|
|
1071
1108
|
let nn = (e, t, n = {}) => {
|
|
1072
|
-
t.rows !== e.rows &&
|
|
1109
|
+
t.rows !== e.rows && he?.(t.rows), t.selection !== e.selection && ge?.(t.selection), n.columnLayoutChanged && pe?.(ue(t)), (n.sortChanged || t.sort !== e.sort) && ve?.(t.sort);
|
|
1073
1110
|
}, Q = (e, t = {}) => {
|
|
1074
|
-
let n =
|
|
1075
|
-
|
|
1076
|
-
}, $ = A(() => S(
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1111
|
+
let n = Xt.current, r = typeof e == "function" ? e(n) : e;
|
|
1112
|
+
Xt.current = r, Yt(r), nn(n, r, t);
|
|
1113
|
+
}, $ = A(() => S(Z), [Z]), rn = A(() => _(Z), [Z]), an = A(() => z ? Ye(B?.summaryRows ?? Z.rows, $, z) : null, [
|
|
1114
|
+
Z.rows,
|
|
1115
|
+
z,
|
|
1116
|
+
B?.summaryRows,
|
|
1080
1117
|
$
|
|
1081
|
-
]), on = A(() =>
|
|
1082
|
-
if (
|
|
1083
|
-
|
|
1118
|
+
]), on = A(() => {
|
|
1119
|
+
if (!z) return [];
|
|
1120
|
+
let e = [], t = 0;
|
|
1121
|
+
for (; t < $.length;) {
|
|
1122
|
+
let n = $[t], r = z.columns[n.id], i = typeof r == "object" && r ? r : void 0, a = i?.colSpan, o = Math.min(typeof a == "number" && Number.isFinite(a) ? Math.max(1, Math.floor(a)) : 1, $.length - t);
|
|
1123
|
+
e.push({
|
|
1124
|
+
className: i?.className,
|
|
1125
|
+
colSpan: o,
|
|
1126
|
+
column: n,
|
|
1127
|
+
style: i?.style,
|
|
1128
|
+
value: an?.[n.id] ?? (e.length === 0 ? z.label : null)
|
|
1129
|
+
}), t += o;
|
|
1130
|
+
}
|
|
1131
|
+
return e;
|
|
1132
|
+
}, [
|
|
1133
|
+
z,
|
|
1134
|
+
an,
|
|
1135
|
+
$
|
|
1136
|
+
]), sn = A(() => B || !Z.sort ? null : b(Z), [Z, B]), cn = sn?.length ?? Z.rows.length, ln = Math.max(0, Z.pagination.pageIndex) * Math.max(1, Z.pagination.pageSize), un = A(() => {
|
|
1137
|
+
if (V) {
|
|
1138
|
+
let e = Math.max(1, I), t = ct || I * 12, n = cn * e, r = Math.min(n, 15e5), i = Math.max(0, n - t), a = Math.max(0, r - t), o = i > 0 && a > 0 ? i / a : 1, s = Math.min(i, Math.max(0, Kt) * o), c = Math.max(0, Math.floor(s / e) - Qt), l = Math.min(cn, Math.ceil((s + Math.max(0, t)) / e) + Qt), u = c * e, d = o > 0 ? u / o : u;
|
|
1084
1139
|
return {
|
|
1085
|
-
entries:
|
|
1140
|
+
entries: rt(sn, Z.rows, Z.rowIds, c, l),
|
|
1086
1141
|
renderOffset: d,
|
|
1087
1142
|
scrollHeight: r
|
|
1088
1143
|
};
|
|
1089
1144
|
}
|
|
1090
1145
|
return {
|
|
1091
|
-
entries:
|
|
1146
|
+
entries: rt(sn, Z.rows, Z.rowIds, ln, ln + Math.max(1, Z.pagination.pageSize)),
|
|
1092
1147
|
renderOffset: 0,
|
|
1093
1148
|
scrollHeight: 0
|
|
1094
1149
|
};
|
|
1095
1150
|
}, [
|
|
1096
|
-
|
|
1097
|
-
|
|
1151
|
+
ct,
|
|
1152
|
+
ln,
|
|
1098
1153
|
I,
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1154
|
+
Kt,
|
|
1155
|
+
sn,
|
|
1156
|
+
Z.pagination.pageSize,
|
|
1157
|
+
Z.rowIds,
|
|
1158
|
+
Z.rows,
|
|
1104
1159
|
Qt,
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
]),
|
|
1160
|
+
V,
|
|
1161
|
+
cn
|
|
1162
|
+
]), dn = Le ?? Z.theme, fn = dn.density === "compact" ? "text-[11px]" : dn.density === "spacious" ? "text-[13px]" : "text-[length:var(--comins-font-size-base,12px)]", pn = A(() => new Set(Z.selection.rowIds), [Z.selection.rowIds]), mn = A(() => {
|
|
1108
1163
|
let e = $.length;
|
|
1109
1164
|
if (e === 0) return [];
|
|
1110
|
-
let t = $.map((e) =>
|
|
1111
|
-
if (
|
|
1165
|
+
let t = $.map((e) => Z.columnState[e.id]?.width ?? e.width);
|
|
1166
|
+
if (J <= 0) {
|
|
1112
1167
|
let n = `${100 / e}%`;
|
|
1113
1168
|
return t.map((e) => e ?? n);
|
|
1114
1169
|
}
|
|
1115
1170
|
let n = 0;
|
|
1116
1171
|
for (let e of t) n += e ?? 0;
|
|
1117
|
-
let r = $.filter((e, n) => t[n] === void 0), i = r.length > 0 ? Math.max(0, (
|
|
1172
|
+
let r = $.filter((e, n) => t[n] === void 0), i = r.length > 0 ? Math.max(0, (J - n) / r.length) : 0;
|
|
1118
1173
|
return $.map((e, n) => {
|
|
1119
|
-
let r = t[n] ?? i, a =
|
|
1174
|
+
let r = t[n] ?? i, a = Tt(e), o = e.maxWidth ?? Infinity;
|
|
1120
1175
|
return Math.min(o, Math.max(a, r));
|
|
1121
1176
|
});
|
|
1122
1177
|
}, [
|
|
1123
|
-
|
|
1124
|
-
|
|
1178
|
+
J,
|
|
1179
|
+
Z.columnState,
|
|
1125
1180
|
$
|
|
1126
|
-
]),
|
|
1181
|
+
]), hn = A(() => {
|
|
1127
1182
|
let e = 0;
|
|
1128
|
-
for (let t of
|
|
1183
|
+
for (let t of mn) {
|
|
1129
1184
|
if (typeof t != "number") return;
|
|
1130
1185
|
e += t;
|
|
1131
1186
|
}
|
|
1132
1187
|
return e;
|
|
1133
|
-
}, [
|
|
1134
|
-
if (typeof
|
|
1135
|
-
}, [
|
|
1136
|
-
let r = (
|
|
1188
|
+
}, [mn]), gn = A(() => {
|
|
1189
|
+
if (typeof hn == "number") return Math.max(J, hn);
|
|
1190
|
+
}, [hn, J]), _n = typeof hn == "number" && J > 0 && hn > J + 1, vn = x ? x && (Bt === void 0 || cn < Bt) : h, yn = ae || It === "initial" || It === "refresh", bn = de || It === "scroll", xn = cn === 0, Sn = yn && xn, Cn = !yn && xn, wn = (v || x) && bn && vn && !xn, Tn = Math.max(1, Math.floor(L ?? Math.min(Math.max(1, Z.pagination.pageSize), 5))), En = (Sn ? Tn : +!!Cn) + +!!wn, Dn = (un.entries.length + En) * I, On = V ? 0 : Math.max(0, ct - Dn), kn = Z.showHeader && (Ne || !xn || yn), An = (e, t) => (e.ctrlKey || e.metaKey) && e.key.toLowerCase() === t, jn = (e) => un.entries[e], Mn = (e, t, n) => {
|
|
1191
|
+
let r = (B ? e.rows.map((e, t) => t) : b(e)).flatMap((t, n) => {
|
|
1137
1192
|
let r = e.rows[t], i = e.rowIds[t];
|
|
1138
1193
|
return r === void 0 || i === void 0 ? [] : [{
|
|
1139
1194
|
dataIndex: t,
|
|
@@ -1145,33 +1200,35 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1145
1200
|
if (i < 0 || a < 0) return [n];
|
|
1146
1201
|
let o = Math.min(i, a), s = Math.max(i, a);
|
|
1147
1202
|
return r.slice(o, s + 1).map((e) => e.rowId);
|
|
1148
|
-
},
|
|
1149
|
-
Q((n) =>
|
|
1150
|
-
},
|
|
1151
|
-
Q((t) =>
|
|
1152
|
-
let t =
|
|
1203
|
+
}, Nn = (e, t) => {
|
|
1204
|
+
Q((n) => le(n, Mn(n, e, t)));
|
|
1205
|
+
}, Pn = (e) => {
|
|
1206
|
+
Q((t) => le(t, e.flatMap((e) => {
|
|
1207
|
+
let t = jn(e);
|
|
1153
1208
|
return t ? [t.rowId] : [];
|
|
1154
1209
|
})));
|
|
1155
|
-
},
|
|
1156
|
-
if (
|
|
1157
|
-
|
|
1210
|
+
}, Fn = (e) => {
|
|
1211
|
+
if (q.current === e.id) {
|
|
1212
|
+
q.current = null;
|
|
1158
1213
|
return;
|
|
1159
1214
|
}
|
|
1160
|
-
e.sort && Q((t) =>
|
|
1161
|
-
},
|
|
1215
|
+
e.sort && Q((t) => _e(t, At(t.sort, e.id)), { sortChanged: !0 });
|
|
1216
|
+
}, In = (e, t) => {
|
|
1162
1217
|
let n = document.elementFromPoint(e, t)?.closest("[data-comins-column-id], [data-comins-column-group-id]");
|
|
1163
1218
|
if (!n) return null;
|
|
1164
1219
|
if (n.dataset.cominsColumnId) return n.dataset.cominsColumnId;
|
|
1165
1220
|
let r = n.dataset.cominsColumnGroupId;
|
|
1166
|
-
return (r ?
|
|
1221
|
+
return (r ? Xt.current.columnGroups.find((e) => e.id === r) : void 0)?.children.find((e) => $.some((t) => t.id === e)) ?? null;
|
|
1167
1222
|
};
|
|
1168
|
-
De(
|
|
1223
|
+
De(Re, () => ({
|
|
1169
1224
|
clearSort: () => Q((e) => i(e), { sortChanged: !0 }),
|
|
1170
|
-
|
|
1171
|
-
|
|
1225
|
+
expand: (e) => B?.onExpand(e),
|
|
1226
|
+
fold: (e) => B?.onFold(e),
|
|
1227
|
+
getColumnLayout: () => ue(Z),
|
|
1228
|
+
getSortState: () => Z.sort,
|
|
1172
1229
|
setColumnLayout: (e) => Q((n) => t(n, e), { columnLayoutChanged: !0 }),
|
|
1173
1230
|
setMoveTargetRow: (e, t) => Q((n) => {
|
|
1174
|
-
if (
|
|
1231
|
+
if (B) return n;
|
|
1175
1232
|
let r = b(n).flatMap((e) => {
|
|
1176
1233
|
let t = n.rowIds[e];
|
|
1177
1234
|
return t === void 0 ? [] : [t];
|
|
@@ -1190,24 +1247,24 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1190
1247
|
sort: null
|
|
1191
1248
|
} : n;
|
|
1192
1249
|
}, { sortChanged: !0 }),
|
|
1193
|
-
setSelectedRow: (e) =>
|
|
1194
|
-
setSelectedRows: (e) =>
|
|
1195
|
-
setSortState: (e) => Q((t) =>
|
|
1250
|
+
setSelectedRow: (e) => Pn([e]),
|
|
1251
|
+
setSelectedRows: (e) => Pn(e),
|
|
1252
|
+
setSortState: (e) => Q((t) => _e(t, e), { sortChanged: !0 })
|
|
1196
1253
|
}), [
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1254
|
+
un.entries,
|
|
1255
|
+
Z,
|
|
1256
|
+
B
|
|
1200
1257
|
]);
|
|
1201
|
-
let
|
|
1202
|
-
let e =
|
|
1203
|
-
e && window.clearTimeout(e.timer),
|
|
1204
|
-
},
|
|
1258
|
+
let Ln = () => {
|
|
1259
|
+
let e = W.current;
|
|
1260
|
+
e && window.clearTimeout(e.timer), W.current = null, xt(null), Et(null), Dt(null), Ft(null);
|
|
1261
|
+
}, Rn = (e, t) => {
|
|
1205
1262
|
if (e.button !== 0) return;
|
|
1206
1263
|
let n = (e, n, r) => {
|
|
1207
|
-
e.active = !0, e.cancelSort = !0,
|
|
1264
|
+
e.active = !0, e.cancelSort = !0, q.current = t.id, Dt({
|
|
1208
1265
|
x: n,
|
|
1209
1266
|
y: r
|
|
1210
|
-
}),
|
|
1267
|
+
}), Ft(t.id), Et(null), xt(t.id);
|
|
1211
1268
|
}, r = {
|
|
1212
1269
|
active: !1,
|
|
1213
1270
|
cancelSort: !1,
|
|
@@ -1218,44 +1275,44 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1218
1275
|
startX: e.clientX,
|
|
1219
1276
|
startY: e.clientY,
|
|
1220
1277
|
timer: window.setTimeout(() => {
|
|
1221
|
-
let e =
|
|
1278
|
+
let e = W.current;
|
|
1222
1279
|
!e || e.id !== t.id || e.kind !== "column" || e.movedBeforeLongPress || n(e, e.startX, e.startY);
|
|
1223
1280
|
}, 1e3)
|
|
1224
1281
|
}, i = (e) => {
|
|
1225
|
-
let r =
|
|
1282
|
+
let r = W.current;
|
|
1226
1283
|
if (!r || r.id !== t.id || r.kind !== "column") return;
|
|
1227
1284
|
let i = Math.hypot(e.clientX - r.startX, e.clientY - r.startY);
|
|
1228
1285
|
if (!r.active && performance.now() - r.startedAt >= 1e3 && !r.movedBeforeLongPress && n(r, e.clientX, e.clientY), !r.active && i > 4) {
|
|
1229
|
-
r.movedBeforeLongPress = !0, r.cancelSort = !0,
|
|
1286
|
+
r.movedBeforeLongPress = !0, r.cancelSort = !0, q.current = t.id, window.clearTimeout(r.timer);
|
|
1230
1287
|
return;
|
|
1231
1288
|
}
|
|
1232
|
-
r.active && (e.preventDefault(),
|
|
1289
|
+
r.active && (e.preventDefault(), Dt({
|
|
1233
1290
|
x: e.clientX,
|
|
1234
1291
|
y: e.clientY
|
|
1235
|
-
}),
|
|
1292
|
+
}), Ft(In(e.clientX, e.clientY)));
|
|
1236
1293
|
}, a = (e) => {
|
|
1237
|
-
let n =
|
|
1294
|
+
let n = W.current;
|
|
1238
1295
|
if (window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a), !n || n.id !== t.id || n.kind !== "column") {
|
|
1239
|
-
|
|
1296
|
+
Ln();
|
|
1240
1297
|
return;
|
|
1241
1298
|
}
|
|
1242
1299
|
if (window.clearTimeout(n.timer), n.active) {
|
|
1243
|
-
let n =
|
|
1300
|
+
let n = In(e.clientX, e.clientY);
|
|
1244
1301
|
if (n) {
|
|
1245
1302
|
let e = $.findIndex((e) => e.id === n);
|
|
1246
|
-
e >= 0 && Q((n) =>
|
|
1303
|
+
e >= 0 && Q((n) => te(n, t.id, e), { columnLayoutChanged: !0 });
|
|
1247
1304
|
}
|
|
1248
1305
|
}
|
|
1249
|
-
(n.cancelSort || n.active) && (
|
|
1306
|
+
(n.cancelSort || n.active) && (q.current = t.id), Ln();
|
|
1250
1307
|
};
|
|
1251
|
-
|
|
1252
|
-
},
|
|
1308
|
+
Ln(), W.current = r, window.addEventListener("pointermove", i), window.addEventListener("pointerup", a);
|
|
1309
|
+
}, zn = (e, t) => {
|
|
1253
1310
|
if (e.button !== 0) return;
|
|
1254
1311
|
let n = (e, n, r) => {
|
|
1255
|
-
e.active = !0, e.cancelSort = !0,
|
|
1312
|
+
e.active = !0, e.cancelSort = !0, Dt({
|
|
1256
1313
|
x: n,
|
|
1257
1314
|
y: r
|
|
1258
|
-
}),
|
|
1315
|
+
}), Ft(t.children[0] ?? null), xt(null), Et(t.id);
|
|
1259
1316
|
}, r = {
|
|
1260
1317
|
active: !1,
|
|
1261
1318
|
cancelSort: !1,
|
|
@@ -1266,109 +1323,109 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1266
1323
|
startX: e.clientX,
|
|
1267
1324
|
startY: e.clientY,
|
|
1268
1325
|
timer: window.setTimeout(() => {
|
|
1269
|
-
let e =
|
|
1326
|
+
let e = W.current;
|
|
1270
1327
|
!e || e.id !== t.id || e.kind !== "group" || e.movedBeforeLongPress || n(e, e.startX, e.startY);
|
|
1271
1328
|
}, 1e3)
|
|
1272
1329
|
}, i = (e) => {
|
|
1273
|
-
let r =
|
|
1330
|
+
let r = W.current;
|
|
1274
1331
|
if (!r || r.id !== t.id || r.kind !== "group") return;
|
|
1275
1332
|
let i = Math.hypot(e.clientX - r.startX, e.clientY - r.startY);
|
|
1276
1333
|
if (!r.active && performance.now() - r.startedAt >= 1e3 && !r.movedBeforeLongPress && n(r, e.clientX, e.clientY), !r.active && i > 4) {
|
|
1277
1334
|
r.movedBeforeLongPress = !0, r.cancelSort = !0, window.clearTimeout(r.timer);
|
|
1278
1335
|
return;
|
|
1279
1336
|
}
|
|
1280
|
-
r.active && (e.preventDefault(),
|
|
1337
|
+
r.active && (e.preventDefault(), Dt({
|
|
1281
1338
|
x: e.clientX,
|
|
1282
1339
|
y: e.clientY
|
|
1283
|
-
}),
|
|
1340
|
+
}), Ft(In(e.clientX, e.clientY)));
|
|
1284
1341
|
}, a = (e) => {
|
|
1285
|
-
let n =
|
|
1342
|
+
let n = W.current;
|
|
1286
1343
|
if (window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a), !n || n.id !== t.id || n.kind !== "group") {
|
|
1287
|
-
|
|
1344
|
+
Ln();
|
|
1288
1345
|
return;
|
|
1289
1346
|
}
|
|
1290
1347
|
if (window.clearTimeout(n.timer), n.active) {
|
|
1291
|
-
let n =
|
|
1348
|
+
let n = In(e.clientX, e.clientY);
|
|
1292
1349
|
if (n) {
|
|
1293
1350
|
let e = $.findIndex((e) => e.id === n);
|
|
1294
|
-
e >= 0 && Q((n) =>
|
|
1351
|
+
e >= 0 && Q((n) => E(n, t.id, e), { columnLayoutChanged: !0 });
|
|
1295
1352
|
}
|
|
1296
1353
|
}
|
|
1297
|
-
|
|
1354
|
+
Ln();
|
|
1298
1355
|
};
|
|
1299
|
-
|
|
1300
|
-
},
|
|
1301
|
-
if (e.shiftKey &&
|
|
1302
|
-
|
|
1356
|
+
Ln(), W.current = r, window.addEventListener("pointermove", i), window.addEventListener("pointerup", a);
|
|
1357
|
+
}, Bn = (e, t) => {
|
|
1358
|
+
if (e.shiftKey && G.current !== null) {
|
|
1359
|
+
Nn(G.current, t.rowId), G.current = t.rowId;
|
|
1303
1360
|
return;
|
|
1304
1361
|
}
|
|
1305
|
-
Q((n) =>
|
|
1362
|
+
Q((n) => O(n, t.rowId, {
|
|
1306
1363
|
multi: e.ctrlKey || e.metaKey,
|
|
1307
1364
|
toggle: e.ctrlKey || e.metaKey
|
|
1308
|
-
})),
|
|
1309
|
-
},
|
|
1365
|
+
})), G.current = t.rowId;
|
|
1366
|
+
}, Vn = (e, t, n) => {
|
|
1310
1367
|
if (n) {
|
|
1311
1368
|
e.preventDefault();
|
|
1312
1369
|
return;
|
|
1313
1370
|
}
|
|
1314
|
-
if (Ae?.(
|
|
1315
|
-
if (
|
|
1371
|
+
if (Ae?.(ut(e, t)), !(e.defaultPrevented || e.target !== e.currentTarget)) {
|
|
1372
|
+
if (B && (An(e, "c") || An(e, "v"))) {
|
|
1316
1373
|
e.preventDefault();
|
|
1317
1374
|
return;
|
|
1318
1375
|
}
|
|
1319
|
-
if (
|
|
1320
|
-
e.preventDefault(),
|
|
1376
|
+
if (An(e, "c")) {
|
|
1377
|
+
e.preventDefault(), He.current = s(Z, t.rowId);
|
|
1321
1378
|
return;
|
|
1322
1379
|
}
|
|
1323
|
-
|
|
1380
|
+
An(e, "v") && He.current && (e.preventDefault(), Q((e) => ie(e, He.current, {
|
|
1324
1381
|
mode: "insert-after",
|
|
1325
1382
|
targetRowId: t.rowId
|
|
1326
1383
|
})));
|
|
1327
1384
|
}
|
|
1328
|
-
},
|
|
1385
|
+
}, Hn = (e, t, n, r, i, s) => {
|
|
1329
1386
|
if (s) {
|
|
1330
1387
|
e.preventDefault(), e.stopPropagation();
|
|
1331
1388
|
return;
|
|
1332
1389
|
}
|
|
1333
|
-
if (ke?.(
|
|
1334
|
-
if (
|
|
1335
|
-
e.preventDefault(), e.stopPropagation(),
|
|
1390
|
+
if (ke?.(dt(e, t, n, r, g(Z, t.row, n.id))), !e.defaultPrevented) {
|
|
1391
|
+
if (An(e, "c")) {
|
|
1392
|
+
e.preventDefault(), e.stopPropagation(), Ve.current = Z.selection.range ? o(Z) : null, Be.current = Ve.current ? null : a(Z, i);
|
|
1336
1393
|
return;
|
|
1337
1394
|
}
|
|
1338
|
-
|
|
1395
|
+
An(e, "v") && (Ve.current || Be.current) && (e.preventDefault(), e.stopPropagation(), Q((e) => Ve.current ? re(e, i, Ve.current) : ne(e, i, Be.current)));
|
|
1339
1396
|
}
|
|
1340
|
-
},
|
|
1341
|
-
n && (r || e.button !== 0 || e.shiftKey || (
|
|
1342
|
-
},
|
|
1343
|
-
let n = document.elementFromPoint(e, t)?.closest("[data-comins-cell-column-id][data-comins-data-index]"), r = n?.dataset.cominsCellColumnId, i = n?.dataset.cominsDataIndex === void 0 ? NaN : Number(n.dataset.cominsDataIndex), a = Number.isInteger(i) ?
|
|
1397
|
+
}, Un = (e, t, r) => {
|
|
1398
|
+
n && (r || e.button !== 0 || e.shiftKey || (Ze.current = t, Qe.current = t, $e.current = !1));
|
|
1399
|
+
}, Wn = (e, t) => {
|
|
1400
|
+
let n = document.elementFromPoint(e, t)?.closest("[data-comins-cell-column-id][data-comins-data-index]"), r = n?.dataset.cominsCellColumnId, i = n?.dataset.cominsDataIndex === void 0 ? NaN : Number(n.dataset.cominsDataIndex), a = Number.isInteger(i) ? Z.rowIds[i] : void 0;
|
|
1344
1401
|
return r && a !== void 0 ? {
|
|
1345
1402
|
columnId: r,
|
|
1346
1403
|
rowId: a
|
|
1347
1404
|
} : null;
|
|
1348
|
-
},
|
|
1405
|
+
}, Gn = (e) => {
|
|
1349
1406
|
if (!n) return;
|
|
1350
|
-
let t =
|
|
1351
|
-
!t || t.rowId === e.rowId && t.columnId === e.columnId || (
|
|
1407
|
+
let t = Ze.current;
|
|
1408
|
+
!t || t.rowId === e.rowId && t.columnId === e.columnId || ($e.current = !0, Qe.current = e, Ue.current = t, Q((n) => ce(n, {
|
|
1352
1409
|
anchor: t,
|
|
1353
1410
|
focus: e
|
|
1354
1411
|
})));
|
|
1355
|
-
},
|
|
1356
|
-
n && (
|
|
1357
|
-
},
|
|
1358
|
-
if (
|
|
1412
|
+
}, Kn = () => {
|
|
1413
|
+
n && (Ze.current = null, Qe.current = null);
|
|
1414
|
+
}, qn = (e, t, n) => {
|
|
1415
|
+
if (Un(e, t, n), n || e.button !== 0 || e.shiftKey) return;
|
|
1359
1416
|
let r = (e) => {
|
|
1360
1417
|
if (e.buttons !== 1) return;
|
|
1361
|
-
let t =
|
|
1362
|
-
t &&
|
|
1418
|
+
let t = Wn(e.clientX, e.clientY);
|
|
1419
|
+
t && Gn(t);
|
|
1363
1420
|
}, i = () => {
|
|
1364
|
-
|
|
1421
|
+
Kn(), window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i);
|
|
1365
1422
|
};
|
|
1366
1423
|
e.preventDefault(), window.addEventListener("pointermove", r), window.addEventListener("pointerup", i);
|
|
1367
|
-
},
|
|
1424
|
+
}, Jn = (e, t, n, r) => {
|
|
1368
1425
|
if (n || !r || e.button !== 0) return;
|
|
1369
1426
|
e.preventDefault(), e.stopPropagation();
|
|
1370
1427
|
let i = t.rowId, a = (e) => {
|
|
1371
|
-
|
|
1428
|
+
et.current = e, Gt(e);
|
|
1372
1429
|
}, o = (e, t) => {
|
|
1373
1430
|
let n = document.elementFromPoint(e, t)?.closest("[data-comins-row-data-index]");
|
|
1374
1431
|
if (!n || n.dataset.cominsRowDataIndex === void 0) return;
|
|
@@ -1381,18 +1438,18 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1381
1438
|
e.buttons === 1 && o(e.clientX, e.clientY);
|
|
1382
1439
|
}, c = (e) => {
|
|
1383
1440
|
window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", c), o(e.clientX, e.clientY);
|
|
1384
|
-
let t =
|
|
1385
|
-
a(null), t !== void 0 && Q((e) =>
|
|
1441
|
+
let t = et.current?.targetDataIndex;
|
|
1442
|
+
a(null), t !== void 0 && Q((e) => D(e, i, t));
|
|
1386
1443
|
};
|
|
1387
1444
|
o(e.clientX, e.clientY), window.addEventListener("pointermove", s), window.addEventListener("pointerup", c);
|
|
1388
|
-
},
|
|
1445
|
+
}, Yn = bt ? $.find((e) => e.id === bt) : void 0, Xn = Y ? Z.columnGroups.find((e) => e.id === Y) : void 0, Zn = Yn?.label ?? Xn?.label, Qn = (e, t) => {
|
|
1389
1446
|
if (e.kind === "group") return /* @__PURE__ */ P("th", {
|
|
1390
|
-
className: ["comins-table__th comins-table__group-th px-3 py-2 text-left font-semibold",
|
|
1447
|
+
className: ["comins-table__th comins-table__group-th px-3 py-2 text-left font-semibold", Y === e.groupId ? "comins-column-moving" : void 0].filter(Boolean).join(" "),
|
|
1391
1448
|
colSpan: e.colSpan,
|
|
1392
|
-
"data-column-moving":
|
|
1449
|
+
"data-column-moving": Y === e.groupId ? "true" : void 0,
|
|
1393
1450
|
"data-comins-column-group-id": e.groupId,
|
|
1394
1451
|
"data-testid": `header-group-${e.groupId}`,
|
|
1395
|
-
onPointerDown: (t) =>
|
|
1452
|
+
onPointerDown: (t) => zn(t, e.group),
|
|
1396
1453
|
rowSpan: e.rowSpan,
|
|
1397
1454
|
scope: "colgroup",
|
|
1398
1455
|
children: [
|
|
@@ -1411,7 +1468,7 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1411
1468
|
/* @__PURE__ */ N("span", {
|
|
1412
1469
|
"aria-hidden": "true",
|
|
1413
1470
|
className: "comins-table__resize",
|
|
1414
|
-
"data-resizing":
|
|
1471
|
+
"data-resizing": Ht === e.groupId ? "true" : void 0,
|
|
1415
1472
|
"data-testid": `resize-group-${e.groupId}`,
|
|
1416
1473
|
onClick: (e) => e.stopPropagation(),
|
|
1417
1474
|
onPointerDown: (t) => {
|
|
@@ -1420,19 +1477,19 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1420
1477
|
for (let t of e.group.children) {
|
|
1421
1478
|
let e = $.find((e) => e.id === t);
|
|
1422
1479
|
if (!e) continue;
|
|
1423
|
-
let n = Array.from(
|
|
1480
|
+
let n = Array.from(U.current?.querySelectorAll("[data-comins-column-id]") ?? []).find((t) => t.dataset.cominsColumnId === e.id)?.getBoundingClientRect().width, r = Xt.current.columnState[e.id]?.width ?? e.width ?? 160;
|
|
1424
1481
|
i.set(e.id, n && Number.isFinite(n) ? n : r);
|
|
1425
1482
|
}
|
|
1426
1483
|
let a = [...i.values()].reduce((e, t) => e + t, 0), o = r && Number.isFinite(r) ? r : Math.max(1, a);
|
|
1427
|
-
|
|
1484
|
+
Ut(e.groupId);
|
|
1428
1485
|
let s = (t) => {
|
|
1429
1486
|
Q((r) => {
|
|
1430
1487
|
let a = r;
|
|
1431
|
-
for (let [e, t] of i) a =
|
|
1432
|
-
return
|
|
1488
|
+
for (let [e, t] of i) a = me(a, e, t);
|
|
1489
|
+
return fe(a, e.groupId, o + t.clientX - n);
|
|
1433
1490
|
}, { columnLayoutChanged: !0 });
|
|
1434
1491
|
}, c = () => {
|
|
1435
|
-
|
|
1492
|
+
Ut(null), window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", c);
|
|
1436
1493
|
};
|
|
1437
1494
|
window.addEventListener("pointermove", s), window.addEventListener("pointerup", c);
|
|
1438
1495
|
},
|
|
@@ -1440,31 +1497,31 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1440
1497
|
})
|
|
1441
1498
|
]
|
|
1442
1499
|
}, `group-${e.groupId}`);
|
|
1443
|
-
let n = e.column, r = $.findIndex((e) => e.id === n.id), i = r >= 0 ? r : t, a =
|
|
1500
|
+
let n = e.column, r = $.findIndex((e) => e.id === n.id), i = r >= 0 ? r : t, a = Z.columnState[n.id], o = n.header?.props ?? {}, s = jt(Z.sort, n.id), c = s === "asc" || s === "desc", l = [
|
|
1444
1501
|
"comins-table__th px-3 py-2 text-left font-semibold",
|
|
1445
|
-
|
|
1502
|
+
bt === n.id ? "comins-column-moving" : void 0,
|
|
1446
1503
|
o.className
|
|
1447
|
-
].filter(Boolean).join(" "), u =
|
|
1448
|
-
return /* @__PURE__ */
|
|
1504
|
+
].filter(Boolean).join(" "), u = yt(Z, n, i), d = n.header?.renderer ? n.header.renderer(u) : null, f = n.header?.renderer ? [] : Ct(n.header?.components, u, "left"), p = n.header?.renderer ? [] : Ct(n.header?.components, u, "right"), m = f.length > 0 || p.length > 0;
|
|
1505
|
+
return /* @__PURE__ */ Ce("th", {
|
|
1449
1506
|
...o,
|
|
1450
1507
|
className: l,
|
|
1451
1508
|
colSpan: e.colSpan,
|
|
1452
|
-
"data-column-drop-target":
|
|
1453
|
-
"data-column-moving":
|
|
1509
|
+
"data-column-drop-target": Nt === n.id ? "true" : void 0,
|
|
1510
|
+
"data-column-moving": bt === n.id ? "true" : void 0,
|
|
1454
1511
|
"data-comins-column-id": n.id,
|
|
1455
1512
|
"data-comins-column-index": i,
|
|
1456
|
-
"data-sort-direction":
|
|
1513
|
+
"data-sort-direction": Z.sort?.columnId === n.id ? Z.sort.direction : void 0,
|
|
1457
1514
|
"data-sortable": n.sort ? "true" : "false",
|
|
1458
1515
|
"data-testid": `header-${n.id}`,
|
|
1459
|
-
"aria-sort": n.sort ?
|
|
1516
|
+
"aria-sort": n.sort ? Mt(Z.sort, n.id) : void 0,
|
|
1460
1517
|
key: `column-${n.id}`,
|
|
1461
1518
|
onClick: (e) => {
|
|
1462
|
-
o.onClick?.(e), !(e.defaultPrevented || !n.sort) &&
|
|
1519
|
+
o.onClick?.(e), !(e.defaultPrevented || !n.sort) && Fn(n);
|
|
1463
1520
|
},
|
|
1464
1521
|
onKeyDown: (e) => {
|
|
1465
|
-
o.onKeyDown?.(e), !(e.defaultPrevented || !n.sort) && (e.key === "Enter" || e.key === " " || e.key === "Spacebar") && (e.preventDefault(),
|
|
1522
|
+
o.onKeyDown?.(e), !(e.defaultPrevented || !n.sort) && (e.key === "Enter" || e.key === " " || e.key === "Spacebar") && (e.preventDefault(), Fn(n));
|
|
1466
1523
|
},
|
|
1467
|
-
onPointerDown: (e) =>
|
|
1524
|
+
onPointerDown: (e) => Rn(e, n),
|
|
1468
1525
|
rowSpan: e.rowSpan,
|
|
1469
1526
|
scope: "col",
|
|
1470
1527
|
style: {
|
|
@@ -1512,102 +1569,102 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1512
1569
|
}), /* @__PURE__ */ N("span", {
|
|
1513
1570
|
"aria-hidden": "true",
|
|
1514
1571
|
className: "comins-table__resize",
|
|
1515
|
-
"data-resizing":
|
|
1572
|
+
"data-resizing": Ht === n.id ? "true" : void 0,
|
|
1516
1573
|
"data-testid": `resize-${n.id}`,
|
|
1517
1574
|
onClick: (e) => e.stopPropagation(),
|
|
1518
1575
|
onPointerDown: (e) => {
|
|
1519
1576
|
e.preventDefault(), e.stopPropagation();
|
|
1520
1577
|
let t = e.clientX, r = e.currentTarget.closest("th")?.getBoundingClientRect().width, i = /* @__PURE__ */ new Map();
|
|
1521
1578
|
for (let e of $) {
|
|
1522
|
-
let t = Array.from(
|
|
1579
|
+
let t = Array.from(U.current?.querySelectorAll("[data-comins-column-id]") ?? []).find((t) => t.dataset.cominsColumnId === e.id)?.getBoundingClientRect().width, n = Xt.current.columnState[e.id]?.width ?? e.width ?? 160;
|
|
1523
1580
|
i.set(e.id, t && Number.isFinite(t) ? t : n);
|
|
1524
1581
|
}
|
|
1525
1582
|
let o = i.get(n.id) ?? (r && Number.isFinite(r) ? r : a?.width ?? n.width ?? 160);
|
|
1526
|
-
|
|
1583
|
+
Ut(n.id);
|
|
1527
1584
|
let s = (e) => {
|
|
1528
1585
|
Q((r) => {
|
|
1529
1586
|
let a = r;
|
|
1530
|
-
for (let [e, t] of i) a =
|
|
1531
|
-
return
|
|
1587
|
+
for (let [e, t] of i) a = me(a, e, t);
|
|
1588
|
+
return Ot(a, n.id, Math.max(Tt(n), o + e.clientX - t));
|
|
1532
1589
|
}, { columnLayoutChanged: !0 });
|
|
1533
1590
|
}, c = () => {
|
|
1534
|
-
|
|
1591
|
+
Ut(null), window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", c);
|
|
1535
1592
|
};
|
|
1536
1593
|
window.addEventListener("pointermove", s), window.addEventListener("pointerup", c);
|
|
1537
1594
|
},
|
|
1538
1595
|
children: /* @__PURE__ */ N("span", { className: "comins-table__resize-line" })
|
|
1539
1596
|
}));
|
|
1540
|
-
},
|
|
1541
|
-
|
|
1542
|
-
let t =
|
|
1597
|
+
}, $n = () => /* @__PURE__ */ N("colgroup", { children: $.map((e, t) => /* @__PURE__ */ N("col", { style: { width: mn[t] } }, e.id)) }), er = () => {
|
|
1598
|
+
qt((e) => {
|
|
1599
|
+
let t = tt.current;
|
|
1543
1600
|
return Math.abs(e - t) > .5 ? t : e;
|
|
1544
1601
|
});
|
|
1545
|
-
},
|
|
1602
|
+
}, tr = (e) => {
|
|
1546
1603
|
if (x) {
|
|
1547
|
-
if (!je ||
|
|
1604
|
+
if (!je || Ge.current) return;
|
|
1548
1605
|
e.scrollHeight - e.scrollTop - e.clientHeight <= en && tn("scroll");
|
|
1549
1606
|
return;
|
|
1550
1607
|
}
|
|
1551
|
-
if (!v || !h ||
|
|
1608
|
+
if (!v || !h || de || !Me) return;
|
|
1552
1609
|
let t = Math.max(0, y);
|
|
1553
1610
|
if (e.scrollHeight - e.scrollTop - e.clientHeight > t) return;
|
|
1554
|
-
let n =
|
|
1555
|
-
|
|
1556
|
-
},
|
|
1611
|
+
let n = Xt.current.rows.length;
|
|
1612
|
+
Xe.current !== n && (Xe.current = n, Me());
|
|
1613
|
+
}, nr = (e) => {
|
|
1557
1614
|
let t = e.currentTarget;
|
|
1558
|
-
|
|
1559
|
-
|
|
1615
|
+
tt.current = t.scrollTop, tr(t), K.current !== null && (window.clearTimeout(K.current), K.current = null), nt.current === null && (nt.current = window.requestAnimationFrame(() => {
|
|
1616
|
+
nt.current = null, er();
|
|
1560
1617
|
}));
|
|
1561
1618
|
let n = Math.max(0, t.scrollLeft);
|
|
1562
|
-
if (
|
|
1563
|
-
let e = Math.max(0,
|
|
1564
|
-
n = Math.min(Math.min(e, r), n), Math.abs(t.scrollLeft - n) > .5 && (t.scrollLeft = n),
|
|
1619
|
+
if (U.current) {
|
|
1620
|
+
let e = Math.max(0, U.current.scrollWidth - U.current.clientWidth), r = Math.max(0, t.scrollWidth - t.clientWidth);
|
|
1621
|
+
n = Math.min(Math.min(e, r), n), Math.abs(t.scrollLeft - n) > .5 && (t.scrollLeft = n), U.current.scrollLeft = n;
|
|
1565
1622
|
}
|
|
1566
|
-
|
|
1623
|
+
H.current && (H.current.scrollLeft = n);
|
|
1567
1624
|
};
|
|
1568
1625
|
return /* @__PURE__ */ P("div", {
|
|
1569
1626
|
className: [
|
|
1570
1627
|
"comins-table comins-typography-base h-full w-full overflow-hidden",
|
|
1571
|
-
|
|
1572
|
-
|
|
1628
|
+
fn,
|
|
1629
|
+
dn.className,
|
|
1573
1630
|
r
|
|
1574
1631
|
].filter(Boolean).join(" "),
|
|
1575
|
-
"aria-busy":
|
|
1576
|
-
"data-loading":
|
|
1577
|
-
"data-show-header":
|
|
1632
|
+
"aria-busy": yn || bn ? "true" : void 0,
|
|
1633
|
+
"data-loading": yn || bn ? "true" : void 0,
|
|
1634
|
+
"data-show-header": kn ? "true" : void 0,
|
|
1578
1635
|
style: {
|
|
1579
|
-
...
|
|
1636
|
+
...dn.style,
|
|
1580
1637
|
...R
|
|
1581
1638
|
},
|
|
1582
1639
|
children: [
|
|
1583
|
-
|
|
1640
|
+
kn ? /* @__PURE__ */ N("div", {
|
|
1584
1641
|
className: "comins-table__header",
|
|
1585
|
-
ref:
|
|
1642
|
+
ref: U,
|
|
1586
1643
|
children: /* @__PURE__ */ P("table", {
|
|
1587
1644
|
className: "comins-table__table comins-table__header-table min-w-full table-fixed",
|
|
1588
|
-
style: { width:
|
|
1589
|
-
children: [
|
|
1645
|
+
style: { width: gn },
|
|
1646
|
+
children: [$n(), /* @__PURE__ */ N("thead", {
|
|
1590
1647
|
className: "comins-table__thead",
|
|
1591
|
-
children: rn.map((e, t) => /* @__PURE__ */ N("tr", { children: e.map((e, t) =>
|
|
1648
|
+
children: rn.map((e, t) => /* @__PURE__ */ N("tr", { children: e.map((e, t) => Qn(e, t)) }, `header-row-${t}`))
|
|
1592
1649
|
})]
|
|
1593
1650
|
})
|
|
1594
1651
|
}) : null,
|
|
1595
1652
|
/* @__PURE__ */ P("div", {
|
|
1596
1653
|
className: "comins-table__body-viewport",
|
|
1597
|
-
"data-horizontal-overflow":
|
|
1598
|
-
"data-virtualized":
|
|
1654
|
+
"data-horizontal-overflow": _n ? "true" : void 0,
|
|
1655
|
+
"data-virtualized": V ? "true" : void 0,
|
|
1599
1656
|
"data-testid": f,
|
|
1600
|
-
onScroll:
|
|
1601
|
-
ref:
|
|
1657
|
+
onScroll: nr,
|
|
1658
|
+
ref: ze,
|
|
1602
1659
|
children: [
|
|
1603
1660
|
/* @__PURE__ */ P("table", {
|
|
1604
|
-
className: ["comins-table__table comins-table__body-table min-w-full table-fixed",
|
|
1605
|
-
style:
|
|
1606
|
-
transform: `translate3d(0, ${
|
|
1607
|
-
width:
|
|
1608
|
-
} : { width:
|
|
1609
|
-
children: [
|
|
1610
|
-
|
|
1661
|
+
className: ["comins-table__table comins-table__body-table min-w-full table-fixed", V ? "comins-table__body-table--virtualized" : void 0].filter(Boolean).join(" "),
|
|
1662
|
+
style: V ? {
|
|
1663
|
+
transform: `translate3d(0, ${un.renderOffset}px, 0)`,
|
|
1664
|
+
width: gn
|
|
1665
|
+
} : { width: gn },
|
|
1666
|
+
children: [$n(), /* @__PURE__ */ P("tbody", { children: [
|
|
1667
|
+
Sn ? Array.from({ length: Tn }).map((e, t) => /* @__PURE__ */ N("tr", {
|
|
1611
1668
|
"aria-hidden": "true",
|
|
1612
1669
|
className: "comins-table__tr comins-table__skeleton-row",
|
|
1613
1670
|
"data-comins-row-parity": t % 2 == 0 ? "even" : "odd",
|
|
@@ -1623,7 +1680,7 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1623
1680
|
children: /* @__PURE__ */ N("span", { className: "comins-table__skeleton-block" })
|
|
1624
1681
|
})
|
|
1625
1682
|
}, `loading-skeleton-${t}`)) : null,
|
|
1626
|
-
|
|
1683
|
+
Cn ? /* @__PURE__ */ N("tr", {
|
|
1627
1684
|
className: "comins-table__tr comins-table__empty-state-row",
|
|
1628
1685
|
style: { height: I },
|
|
1629
1686
|
children: /* @__PURE__ */ N("td", {
|
|
@@ -1636,9 +1693,9 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1636
1693
|
})
|
|
1637
1694
|
})
|
|
1638
1695
|
}) : null,
|
|
1639
|
-
|
|
1640
|
-
let r =
|
|
1641
|
-
return /* @__PURE__ */ P(
|
|
1696
|
+
un.entries.map((e, t) => {
|
|
1697
|
+
let r = at(Pe, e.row, e.visibleIndex), i = pn.has(e.rowId), a = On === 0 && t === un.entries.length - 1, o = ot(r.style), s = V ? `virtual-row-slot-${t}` : String(e.rowId);
|
|
1698
|
+
return /* @__PURE__ */ P(xe, { children: [Wt?.targetDataIndex === e.dataIndex && Wt.sourceRowId !== e.rowId ? /* @__PURE__ */ N("tr", {
|
|
1642
1699
|
"aria-hidden": "true",
|
|
1643
1700
|
className: "comins-row-move-placeholder",
|
|
1644
1701
|
children: /* @__PURE__ */ N("td", {
|
|
@@ -1668,45 +1725,45 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1668
1725
|
t.preventDefault();
|
|
1669
1726
|
return;
|
|
1670
1727
|
}
|
|
1671
|
-
t.__cominsCellSelectionHandled ||
|
|
1728
|
+
t.__cominsCellSelectionHandled || Bn(t, e), Se?.(ut(t, e));
|
|
1672
1729
|
},
|
|
1673
1730
|
onContextMenu: (t) => {
|
|
1674
1731
|
if (r.disabled) {
|
|
1675
1732
|
t.preventDefault();
|
|
1676
1733
|
return;
|
|
1677
1734
|
}
|
|
1678
|
-
Q((t) =>
|
|
1735
|
+
Q((t) => O(t, e.rowId)), G.current = e.rowId, Te?.(ut(t, e));
|
|
1679
1736
|
},
|
|
1680
1737
|
onDoubleClick: (t) => {
|
|
1681
1738
|
if (r.disabled) {
|
|
1682
1739
|
t.preventDefault();
|
|
1683
1740
|
return;
|
|
1684
1741
|
}
|
|
1685
|
-
Oe?.(
|
|
1742
|
+
Oe?.(ut(t, e));
|
|
1686
1743
|
},
|
|
1687
|
-
onKeyDown: (t) =>
|
|
1688
|
-
style:
|
|
1744
|
+
onKeyDown: (t) => Vn(t, e, r.disabled),
|
|
1745
|
+
style: st(I, r.style, o),
|
|
1689
1746
|
tabIndex: r.disabled ? -1 : 0,
|
|
1690
1747
|
children: $.map((t, a) => {
|
|
1691
|
-
let o = g(
|
|
1748
|
+
let o = g(Z, e.row, t.id), s = {
|
|
1692
1749
|
columnId: t.id,
|
|
1693
1750
|
rowId: e.rowId
|
|
1694
|
-
}, c = n &&
|
|
1751
|
+
}, c = n && w(Z, s), l = n && Z.selection.cell?.rowId === e.rowId && Z.selection.cell.columnId === t.id, u = ft(e, r.disabled, i, Z.selection.rowIds.length, t, a, o), d = pt(t, u), f = r.disabled || ht(d, u), p = it(gt(d, u)), m = _t(d, u), h = !!t.cell?.components?.length, _ = vt(t, o, u), v = t.cell?.components?.map((e) => {
|
|
1695
1752
|
if (e.type !== "input") return e;
|
|
1696
1753
|
let t = e.onValueChange;
|
|
1697
1754
|
return {
|
|
1698
1755
|
...e,
|
|
1699
1756
|
onValueChange: (e) => {
|
|
1700
|
-
Q((t) =>
|
|
1757
|
+
Q((t) => be(t, [{
|
|
1701
1758
|
id: e.row.id,
|
|
1702
|
-
patch: (t) =>
|
|
1759
|
+
patch: (t) => kt(t, e.column.field, e.value)
|
|
1703
1760
|
}])), t?.(e);
|
|
1704
1761
|
}
|
|
1705
1762
|
};
|
|
1706
|
-
}), y =
|
|
1763
|
+
}), y = St(v, u), b = t.cell?.renderer ? t.cell.renderer(u) : h ? wt(_, v, u, { showContent: !1 }) : /* @__PURE__ */ N("span", {
|
|
1707
1764
|
className: "comins-table__cell-value",
|
|
1708
1765
|
children: _
|
|
1709
|
-
}), x = typeof t.cell?.tooltip == "function" ? t.cell.tooltip(u) : t.cell?.tooltip, S = a === 0 ?
|
|
1766
|
+
}), x = typeof t.cell?.tooltip == "function" ? t.cell.tooltip(u) : t.cell?.tooltip, S = a === 0 ? B?.entriesByRowId.get(e.rowId) : void 0, C = S ? /* @__PURE__ */ P("span", {
|
|
1710
1767
|
className: "comins-tree-cell-content",
|
|
1711
1768
|
style: { "--comins-tree-depth": S.depth },
|
|
1712
1769
|
children: [S.hasChildren ? /* @__PURE__ */ N("button", {
|
|
@@ -1715,7 +1772,7 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1715
1772
|
className: "comins-tree-expander",
|
|
1716
1773
|
"data-testid": `tree-expander-${String(e.rowId)}`,
|
|
1717
1774
|
onClick: (t) => {
|
|
1718
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1775
|
+
t.preventDefault(), t.stopPropagation(), B?.onToggle(e.rowId);
|
|
1719
1776
|
},
|
|
1720
1777
|
onMouseDown: (e) => e.stopPropagation(),
|
|
1721
1778
|
onPointerDown: (e) => e.stopPropagation(),
|
|
@@ -1746,29 +1803,29 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1746
1803
|
"data-testid": `cell-${String(e.rowId)}-${t.id}`,
|
|
1747
1804
|
draggable: !1,
|
|
1748
1805
|
onClick: (r) => {
|
|
1749
|
-
if (
|
|
1806
|
+
if (ye && r.stopPropagation(), f) {
|
|
1750
1807
|
r.preventDefault(), r.stopPropagation();
|
|
1751
1808
|
return;
|
|
1752
1809
|
}
|
|
1753
|
-
if (
|
|
1754
|
-
|
|
1810
|
+
if ($e.current) {
|
|
1811
|
+
$e.current = !1, r.__cominsCellSelectionHandled = !0;
|
|
1755
1812
|
return;
|
|
1756
1813
|
}
|
|
1757
|
-
let i = n ?
|
|
1814
|
+
let i = n ? Z.selection.cell ?? Ue.current : null;
|
|
1758
1815
|
if (r.shiftKey && i) {
|
|
1759
|
-
r.__cominsCellSelectionHandled = !0,
|
|
1816
|
+
r.__cominsCellSelectionHandled = !0, Ue.current = i, Q((t) => ce(G.current === null ? O(t, e.rowId) : le(t, Mn(t, G.current, e.rowId)), {
|
|
1760
1817
|
anchor: i,
|
|
1761
1818
|
focus: s
|
|
1762
|
-
})),
|
|
1819
|
+
})), G.current = e.rowId;
|
|
1763
1820
|
return;
|
|
1764
1821
|
}
|
|
1765
|
-
n && (
|
|
1766
|
-
let i =
|
|
1822
|
+
n && (Ue.current = s), Q((t) => {
|
|
1823
|
+
let i = O(t, e.rowId, {
|
|
1767
1824
|
multi: r.ctrlKey || r.metaKey,
|
|
1768
1825
|
toggle: r.ctrlKey || r.metaKey
|
|
1769
1826
|
});
|
|
1770
|
-
return n ?
|
|
1771
|
-
}), r.__cominsCellSelectionHandled = !0,
|
|
1827
|
+
return n ? se(i, s) : i;
|
|
1828
|
+
}), r.__cominsCellSelectionHandled = !0, G.current = e.rowId, ye?.(dt(r, e, t, a, o));
|
|
1772
1829
|
},
|
|
1773
1830
|
onContextMenu: (r) => {
|
|
1774
1831
|
if (f) {
|
|
@@ -1776,27 +1833,27 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1776
1833
|
return;
|
|
1777
1834
|
}
|
|
1778
1835
|
Q((t) => {
|
|
1779
|
-
let r =
|
|
1780
|
-
return n ?
|
|
1781
|
-
}),
|
|
1836
|
+
let r = O(t, e.rowId);
|
|
1837
|
+
return n ? se(r, s) : r;
|
|
1838
|
+
}), G.current = e.rowId, n && (Ue.current = s), we && (r.stopPropagation(), we(dt(r, e, t, a, o)));
|
|
1782
1839
|
},
|
|
1783
1840
|
onDoubleClick: (n) => {
|
|
1784
1841
|
if (Ee && n.stopPropagation(), f) {
|
|
1785
1842
|
n.preventDefault(), n.stopPropagation();
|
|
1786
1843
|
return;
|
|
1787
1844
|
}
|
|
1788
|
-
Ee?.(
|
|
1845
|
+
Ee?.(dt(n, e, t, a, o));
|
|
1789
1846
|
},
|
|
1790
|
-
onKeyDown: (n) =>
|
|
1791
|
-
onMouseDown: (e) =>
|
|
1792
|
-
onMouseOver: () =>
|
|
1793
|
-
onMouseUp:
|
|
1794
|
-
onPointerDown: (e) =>
|
|
1795
|
-
onPointerEnter: () =>
|
|
1847
|
+
onKeyDown: (n) => Hn(n, e, t, a, s, f),
|
|
1848
|
+
onMouseDown: (e) => Un(e, s, f),
|
|
1849
|
+
onMouseOver: () => Gn(s),
|
|
1850
|
+
onMouseUp: Kn,
|
|
1851
|
+
onPointerDown: (e) => qn(e, s, f),
|
|
1852
|
+
onPointerEnter: () => Gn(s),
|
|
1796
1853
|
onPointerMove: (e) => {
|
|
1797
|
-
e.buttons === 1 &&
|
|
1854
|
+
e.buttons === 1 && Gn(s);
|
|
1798
1855
|
},
|
|
1799
|
-
onPointerUp:
|
|
1856
|
+
onPointerUp: Kn,
|
|
1800
1857
|
style: {
|
|
1801
1858
|
height: I,
|
|
1802
1859
|
...m
|
|
@@ -1810,13 +1867,13 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1810
1867
|
draggable: !1,
|
|
1811
1868
|
onClick: (e) => e.stopPropagation(),
|
|
1812
1869
|
onMouseDown: (e) => e.stopPropagation(),
|
|
1813
|
-
onPointerDown: (t) =>
|
|
1814
|
-
}) : null,
|
|
1870
|
+
onPointerDown: (t) => Jn(t, e, r.disabled, r.draggable)
|
|
1871
|
+
}) : null, C]
|
|
1815
1872
|
}, t.id);
|
|
1816
1873
|
})
|
|
1817
1874
|
}, s)] }, s);
|
|
1818
1875
|
}),
|
|
1819
|
-
|
|
1876
|
+
wn ? /* @__PURE__ */ N("tr", {
|
|
1820
1877
|
className: "comins-table__tr comins-table__infinite-loading-row",
|
|
1821
1878
|
style: { height: I },
|
|
1822
1879
|
children: /* @__PURE__ */ P("td", {
|
|
@@ -1829,92 +1886,108 @@ function zt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1829
1886
|
}), /* @__PURE__ */ N("span", { children: "데이터를 불러오는 중입니다." })]
|
|
1830
1887
|
})
|
|
1831
1888
|
}) : null,
|
|
1832
|
-
|
|
1889
|
+
On > 0 ? /* @__PURE__ */ N("tr", {
|
|
1833
1890
|
"aria-hidden": "true",
|
|
1834
1891
|
className: "comins-table-empty-filler",
|
|
1835
1892
|
children: /* @__PURE__ */ N("td", {
|
|
1836
1893
|
colSpan: Math.max(1, $.length),
|
|
1837
1894
|
"data-testid": "table-empty-filler",
|
|
1838
|
-
style: { height:
|
|
1895
|
+
style: { height: On }
|
|
1839
1896
|
})
|
|
1840
1897
|
}) : null
|
|
1841
1898
|
] })]
|
|
1842
1899
|
}),
|
|
1843
|
-
|
|
1900
|
+
V ? /* @__PURE__ */ N("div", {
|
|
1844
1901
|
"aria-hidden": "true",
|
|
1845
1902
|
className: "comins-table__body-virtual-sizer",
|
|
1846
1903
|
style: {
|
|
1847
|
-
height:
|
|
1848
|
-
width:
|
|
1904
|
+
height: un.scrollHeight,
|
|
1905
|
+
width: gn
|
|
1849
1906
|
}
|
|
1850
1907
|
}) : null,
|
|
1851
|
-
|
|
1908
|
+
yn && !xn ? /* @__PURE__ */ P("div", {
|
|
1852
1909
|
className: "comins-table__loading-overlay",
|
|
1853
1910
|
"data-testid": "data-table-loading-overlay",
|
|
1854
1911
|
role: "status",
|
|
1855
|
-
style:
|
|
1912
|
+
style: Kt > 0 ? { transform: `translateY(${Kt}px)` } : void 0,
|
|
1856
1913
|
children: [/* @__PURE__ */ N("span", {
|
|
1857
1914
|
className: "comins-table__loading-spinner",
|
|
1858
1915
|
"data-testid": "data-table-loading-spinner"
|
|
1859
|
-
}), /* @__PURE__ */ N("span", { children:
|
|
1916
|
+
}), /* @__PURE__ */ N("span", { children: oe ?? "불러오는 중입니다." })]
|
|
1860
1917
|
}) : null
|
|
1861
1918
|
]
|
|
1862
1919
|
}),
|
|
1863
|
-
|
|
1920
|
+
z ? /* @__PURE__ */ N("div", {
|
|
1864
1921
|
"aria-label": "Table summary",
|
|
1865
1922
|
className: "comins-table__summary",
|
|
1866
|
-
ref:
|
|
1923
|
+
ref: H,
|
|
1867
1924
|
children: /* @__PURE__ */ P("table", {
|
|
1868
1925
|
className: "comins-table__table comins-table__summary-table min-w-full table-fixed",
|
|
1869
|
-
style: { width:
|
|
1870
|
-
children: [
|
|
1871
|
-
className: "comins-table__summary-row",
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
"
|
|
1875
|
-
|
|
1876
|
-
|
|
1926
|
+
style: { width: gn },
|
|
1927
|
+
children: [$n(), /* @__PURE__ */ N("tfoot", { children: /* @__PURE__ */ N("tr", {
|
|
1928
|
+
className: ["comins-table__summary-row", z.className].filter(Boolean).join(" "),
|
|
1929
|
+
style: z.style,
|
|
1930
|
+
children: on.map((e) => /* @__PURE__ */ N("td", {
|
|
1931
|
+
className: ["comins-table__summary-cell px-3 py-2", e.className].filter(Boolean).join(" "),
|
|
1932
|
+
colSpan: e.colSpan,
|
|
1933
|
+
"data-testid": `summary-cell-${e.column.id}`,
|
|
1934
|
+
style: e.style,
|
|
1935
|
+
children: e.value
|
|
1936
|
+
}, e.column.id))
|
|
1877
1937
|
}) })]
|
|
1878
1938
|
})
|
|
1879
1939
|
}) : null,
|
|
1880
|
-
|
|
1940
|
+
Zn && X ? /* @__PURE__ */ N("div", {
|
|
1881
1941
|
"aria-hidden": "true",
|
|
1882
1942
|
className: "comins-column-move-ghost",
|
|
1883
1943
|
"data-testid": "column-move-ghost",
|
|
1884
1944
|
style: {
|
|
1885
|
-
left:
|
|
1886
|
-
top:
|
|
1945
|
+
left: X.x + 12,
|
|
1946
|
+
top: X.y + 12
|
|
1887
1947
|
},
|
|
1888
|
-
children:
|
|
1948
|
+
children: Zn
|
|
1889
1949
|
}) : null
|
|
1890
1950
|
]
|
|
1891
1951
|
});
|
|
1892
1952
|
}
|
|
1893
|
-
function Bt({ data: e,
|
|
1894
|
-
let [
|
|
1953
|
+
function Bt({ data: e, defaultExpandAll: t = !0, getRowId: n, hasMoreRows: r, infiniteScroll: i, infiniteScrollThreshold: a, lazyLoad: o, lazyLoadBatchSize: s, lazyLoadMode: c, lazyLoadThreshold: l, loadingMore: u, onChangeData: d, onChangeSort: f, onLazyLoad: p, onLoadMore: m, rowProps: h, tree: g, ..._ }, v) {
|
|
1954
|
+
let y = j(t).current, [b, x] = M(null), S = A(() => Lt(e, _.columns, b), [
|
|
1895
1955
|
e,
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
]),
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1956
|
+
_.columns,
|
|
1957
|
+
b
|
|
1958
|
+
]), C = A(() => Qe(S, n, { defaultExpandAll: y }), [
|
|
1959
|
+
n,
|
|
1960
|
+
y,
|
|
1961
|
+
S
|
|
1962
|
+
]), w = A(() => new Map(C.map((e) => [e.rowId, e])), [C]), T = A(() => ({
|
|
1963
|
+
entriesByRowId: w,
|
|
1964
|
+
onExpand: (t) => {
|
|
1965
|
+
let r = Rt(e, t, !0, n, y);
|
|
1966
|
+
r !== e && d?.([...r]);
|
|
1967
|
+
},
|
|
1968
|
+
onFold: (t) => {
|
|
1969
|
+
let r = Rt(e, t, !1, n, y);
|
|
1970
|
+
r !== e && d?.([...r]);
|
|
1971
|
+
},
|
|
1972
|
+
onToggle: (t) => d?.(et(e, t, n, { defaultExpandAll: y })),
|
|
1973
|
+
summaryRows: $e(e)
|
|
1902
1974
|
}), [
|
|
1903
1975
|
e,
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1976
|
+
w,
|
|
1977
|
+
n,
|
|
1978
|
+
y,
|
|
1979
|
+
d
|
|
1980
|
+
]), ee = (t) => {
|
|
1908
1981
|
let r = e;
|
|
1909
|
-
|
|
1910
|
-
let i =
|
|
1911
|
-
i && i.item !== e && (r =
|
|
1912
|
-
}), r !== e &&
|
|
1982
|
+
t.forEach((e, t) => {
|
|
1983
|
+
let i = C[t];
|
|
1984
|
+
i && i.item !== e && (r = tt(r, i.rowId, n, () => e));
|
|
1985
|
+
}), r !== e && d?.([...r]);
|
|
1913
1986
|
};
|
|
1914
1987
|
return /* @__PURE__ */ N(Vt, {
|
|
1915
|
-
...
|
|
1916
|
-
data:
|
|
1917
|
-
getRowId:
|
|
1988
|
+
..._,
|
|
1989
|
+
data: C.map((e) => e.item),
|
|
1990
|
+
getRowId: n,
|
|
1918
1991
|
hasMoreRows: !1,
|
|
1919
1992
|
infiniteScroll: !1,
|
|
1920
1993
|
infiniteScrollThreshold: void 0,
|
|
@@ -1923,26 +1996,26 @@ function Bt({ data: e, getRowId: t, hasMoreRows: n, infiniteScroll: r, infiniteS
|
|
|
1923
1996
|
lazyLoadMode: void 0,
|
|
1924
1997
|
lazyLoadThreshold: void 0,
|
|
1925
1998
|
loadingMore: !1,
|
|
1926
|
-
onChangeData:
|
|
1999
|
+
onChangeData: ee,
|
|
1927
2000
|
onChangeSort: (e) => {
|
|
1928
|
-
|
|
2001
|
+
x(e), f?.(e);
|
|
1929
2002
|
},
|
|
1930
2003
|
onLazyLoad: void 0,
|
|
1931
2004
|
onLoadMore: void 0,
|
|
1932
2005
|
pagination: {
|
|
1933
2006
|
pageIndex: 0,
|
|
1934
|
-
pageSize: Math.max(1,
|
|
2007
|
+
pageSize: Math.max(1, C.length)
|
|
1935
2008
|
},
|
|
1936
2009
|
rowProps: {
|
|
1937
|
-
...
|
|
2010
|
+
...h,
|
|
1938
2011
|
draggable: !1
|
|
1939
2012
|
},
|
|
1940
2013
|
tree: !1,
|
|
1941
|
-
ref:
|
|
1942
|
-
treeContext:
|
|
2014
|
+
ref: v,
|
|
2015
|
+
treeContext: T
|
|
1943
2016
|
});
|
|
1944
2017
|
}
|
|
1945
|
-
var Vt =
|
|
2018
|
+
var Vt = we(zt), Ht = we(Bt);
|
|
1946
2019
|
function Ut(e, t) {
|
|
1947
2020
|
return e.tree ? /* @__PURE__ */ N(Ht, {
|
|
1948
2021
|
...e,
|
|
@@ -1952,8 +2025,8 @@ function Ut(e, t) {
|
|
|
1952
2025
|
ref: t
|
|
1953
2026
|
});
|
|
1954
2027
|
}
|
|
1955
|
-
var Wt =
|
|
2028
|
+
var Wt = we(Ut), Gt = "comins-table";
|
|
1956
2029
|
//#endregion
|
|
1957
|
-
export { Wt as CominsTable, e as addCominsRows, t as applyCominsColumnLayout, n as clearCominsCellRange, r as clearCominsSelection, i as clearCominsSortState, Gt as cominsTablePackage, a as copyCominsCell, o as copyCominsCellRange, s as copyCominsRow, c as createCominsTableState, l as deleteCominsRows, u as exportCominsRowsToCsv, d as exportCominsRowsToJson, f as fillCominsCellRange,
|
|
2030
|
+
export { Wt as CominsTable, e as addCominsRows, t as applyCominsColumnLayout, n as clearCominsCellRange, r as clearCominsSelection, i as clearCominsSortState, Gt as cominsTablePackage, a as copyCominsCell, o as copyCominsCellRange, s as copyCominsRow, c as createCominsTableState, l as deleteCominsRows, u as exportCominsRowsToCsv, d as exportCominsRowsToJson, f as fillCominsCellRange, Qe as flattenCominsTree, p as formatCominsCellValue, m as getCominsCellClassName, h as getCominsCellStyle, g as getCominsCellValue, _ as getCominsHeaderRows, v as getCominsPageRows, y as getCominsSelectedCellRange, b as getCominsSortedRowIndexes, Ye as getCominsSummaryValues, $e as getCominsTreeLeafItems, x as getCominsVirtualRows, S as getCominsVisibleColumns, C as isCominsCellDisabled, w as isCominsCellInSelectedRange, T as isCominsCellSelected, ee as isCominsRowSelected, te as moveCominsColumn, E as moveCominsColumnGroup, D as moveCominsRow, ne as pasteCominsCell, re as pasteCominsCellRange, ie as pasteCominsRow, ae as queryCominsRows, oe as replaceCominsRows, se as selectCell, ce as selectCellRange, O as selectRow, le as selectRows, ue as serializeCominsColumnLayout, de as setCominsColumnGroupHidden, fe as setCominsColumnGroupWidth, pe as setCominsColumnHidden, me as setCominsColumnWidth, he as setCominsHeaderVisible, ge as setCominsPagination, _e as setCominsSortState, ve as setCominsTableTheme, ye as sortCominsRows, K as sortCominsTreeSiblings, et as toggleCominsTreeNode, be as updateCominsRows, tt as updateCominsTreeItem };
|
|
1958
2031
|
|
|
1959
2032
|
//# sourceMappingURL=index.js.map
|