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