comins-table 0.1.4 → 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 +8 -0
- package/README.md +1 -1
- package/THIRD_PARTY_NOTICES.md +71 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +771 -796
- package/dist/index.js.map +1 -1
- package/package.json +4 -6
- package/styles.css +29 -0
package/dist/index.js
CHANGED
|
@@ -1,52 +1,7 @@
|
|
|
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
|
|
2
|
-
import { Fragment as
|
|
3
|
-
import { jsx as
|
|
4
|
-
|
|
5
|
-
var Ne = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), Pe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Fe = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), Ie = (e) => {
|
|
6
|
-
let t = Fe(e);
|
|
7
|
-
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
8
|
-
}, M = {
|
|
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
|
-
}, Le = (e) => {
|
|
19
|
-
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
20
|
-
return !1;
|
|
21
|
-
}, Re = Ee({}), ze = () => ke(Re), N = Oe(({ 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 = "" } = ze() ?? {}, m = r ?? d ? Number(n ?? u) * 24 / Number(t ?? l) : n ?? u;
|
|
23
|
-
return De("svg", {
|
|
24
|
-
ref: c,
|
|
25
|
-
...M,
|
|
26
|
-
width: t ?? l ?? M.width,
|
|
27
|
-
height: t ?? l ?? M.height,
|
|
28
|
-
stroke: e ?? f,
|
|
29
|
-
strokeWidth: m,
|
|
30
|
-
className: Ne("lucide", p, i),
|
|
31
|
-
...!a && !Le(s) && { "aria-hidden": "true" },
|
|
32
|
-
...s
|
|
33
|
-
}, [...o.map(([e, t]) => De(e, t)), ...Array.isArray(a) ? a : [a]]);
|
|
34
|
-
}), Be = ((e, t) => {
|
|
35
|
-
let n = Oe(({ className: n, ...r }, i) => De(N, {
|
|
36
|
-
ref: i,
|
|
37
|
-
iconNode: t,
|
|
38
|
-
className: Ne(`lucide-${Pe(Ie(e))}`, `lucide-${e}`, n),
|
|
39
|
-
...r
|
|
40
|
-
}));
|
|
41
|
-
return n.displayName = Ie(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 Ve({ clientX: e, clientY: t, startX: n, startY: r }) {
|
|
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
|
+
import { jsx as M, jsxs as N } from "react/jsx-runtime";
|
|
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
|
}
|
|
@@ -58,36 +13,36 @@ function P(...e) {
|
|
|
58
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 = F(e.props, t), { defaultValue: r, onBlur: i, onChange: a, onClick: o, onKeyDown: s, onMouseDown: c, onPointerDown: l, value: u, ...d } = n, f =
|
|
90
|
-
|
|
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);
|
|
45
|
+
O(() => {
|
|
91
46
|
m(f), h.current = f;
|
|
92
47
|
}, [f]);
|
|
93
48
|
let g = (n) => {
|
|
@@ -100,55 +55,55 @@ function V({ component: e, payload: t }) {
|
|
|
100
55
|
value: p
|
|
101
56
|
}));
|
|
102
57
|
};
|
|
103
|
-
return /* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ M("input", {
|
|
104
59
|
...d,
|
|
105
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 = F(e.props, t), { checked: r, defaultChecked: i, onChange: a, onClick: o, onKeyDown: s, onMouseDown: c, onPointerDown: l, style: u, ...d } = n, [f, p] =
|
|
129
|
-
return
|
|
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));
|
|
84
|
+
return O(() => {
|
|
130
85
|
r !== void 0 && p(!!r);
|
|
131
|
-
}, [r]), /* @__PURE__ */
|
|
86
|
+
}, [r]), /* @__PURE__ */ M("input", {
|
|
132
87
|
...d,
|
|
133
88
|
checked: f,
|
|
134
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,18 +113,18 @@ function Ke({ component: e, payload: t }) {
|
|
|
158
113
|
type: "checkbox"
|
|
159
114
|
});
|
|
160
115
|
}
|
|
161
|
-
function
|
|
162
|
-
let { checked: n, ...r } = F(e.props, t), { onClick: i, onKeyDown: a, onMouseDown: o, onPointerDown: s, ...c } = r, [l, u] =
|
|
163
|
-
|
|
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);
|
|
118
|
+
O(() => {
|
|
164
119
|
n !== void 0 && u(!!n);
|
|
165
120
|
}, [n]);
|
|
166
121
|
let d = typeof r.children == "string" && (r.children === "ON" || r.children === "OFF") ? l ? "ON" : "OFF" : r.children;
|
|
167
|
-
return /* @__PURE__ */
|
|
122
|
+
return /* @__PURE__ */ M("button", {
|
|
168
123
|
...c,
|
|
169
124
|
"aria-pressed": l,
|
|
170
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 qe({ 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] =
|
|
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 = F(e.props, t), u =
|
|
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);
|
|
@@ -215,58 +170,58 @@ function Je({ component: e, payload: t }) {
|
|
|
215
170
|
open: i
|
|
216
171
|
}));
|
|
217
172
|
};
|
|
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
|
};
|
|
232
187
|
}, [n]);
|
|
233
|
-
let p = n ? /* @__PURE__ */
|
|
188
|
+
let p = n ? /* @__PURE__ */ M("span", {
|
|
234
189
|
"aria-label": "Header menu",
|
|
235
190
|
className: "comins-table__component-menu-popover",
|
|
236
191
|
id: i,
|
|
237
192
|
ref: o,
|
|
238
193
|
role: "menu",
|
|
239
194
|
style: s,
|
|
240
|
-
children: u.map((n, r) => n.type === "divider" ? /* @__PURE__ */
|
|
195
|
+
children: u.map((n, r) => n.type === "divider" ? /* @__PURE__ */ M("span", {
|
|
241
196
|
"aria-orientation": "horizontal",
|
|
242
197
|
className: "comins-table__component-menu-divider",
|
|
243
198
|
role: "separator"
|
|
244
|
-
}, `divider-${r}`) : n.type === "label" ? /* @__PURE__ */
|
|
199
|
+
}, `divider-${r}`) : n.type === "label" ? /* @__PURE__ */ M("span", {
|
|
245
200
|
className: "comins-table__component-menu-label",
|
|
246
201
|
role: "presentation",
|
|
247
202
|
children: n.label
|
|
248
|
-
}, `label-${r}`) : /* @__PURE__ */
|
|
203
|
+
}, `label-${r}`) : /* @__PURE__ */ M("button", {
|
|
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
|
|
265
220
|
}, `${String(n.value)}-${r}`))
|
|
266
221
|
}) : null;
|
|
267
|
-
return /* @__PURE__ */
|
|
222
|
+
return /* @__PURE__ */ N("span", {
|
|
268
223
|
className: "comins-table__component comins-table__component-menu",
|
|
269
|
-
children: [/* @__PURE__ */
|
|
224
|
+
children: [/* @__PURE__ */ M("button", {
|
|
270
225
|
...l,
|
|
271
226
|
"aria-controls": n ? i : void 0,
|
|
272
227
|
"aria-expanded": n,
|
|
@@ -274,18 +229,18 @@ function Je({ component: e, payload: t }) {
|
|
|
274
229
|
"aria-label": l["aria-label"] ?? "Header menu",
|
|
275
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,51 +248,51 @@ function Je({ 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 } = F(e.props, n), u =
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}, [u.length, d]),
|
|
301
|
-
let e =
|
|
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 : "";
|
|
253
|
+
O(() => {
|
|
254
|
+
v(!1), b(0);
|
|
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
|
-
|
|
308
|
-
|
|
262
|
+
_,
|
|
263
|
+
re,
|
|
309
264
|
m
|
|
310
|
-
]),
|
|
311
|
-
let e =
|
|
312
|
-
e && (e.scrollTop = 0,
|
|
313
|
-
}, [
|
|
314
|
-
if (
|
|
315
|
-
let e =
|
|
316
|
-
e && (e.scrollTop = 0),
|
|
317
|
-
}, [
|
|
318
|
-
let
|
|
319
|
-
let t =
|
|
265
|
+
]), O(() => {
|
|
266
|
+
let e = w.current;
|
|
267
|
+
e && (e.scrollTop = 0, b(0));
|
|
268
|
+
}, [re]), O(() => {
|
|
269
|
+
if (te) return;
|
|
270
|
+
let e = w.current;
|
|
271
|
+
e && (e.scrollTop = 0), v(!1), g(""), b(0);
|
|
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
|
-
]), ae =
|
|
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"
|
|
340
|
-
}) !== !1 && (
|
|
295
|
+
}) !== !1 && (ee(r.value), e.onClickItem?.({
|
|
341
296
|
...n,
|
|
342
297
|
event: a,
|
|
343
298
|
item: r,
|
|
@@ -345,70 +300,70 @@ function H({ component: e, interaction: t, payload: n }) {
|
|
|
345
300
|
value: r.value
|
|
346
301
|
}));
|
|
347
302
|
};
|
|
348
|
-
return /* @__PURE__ */
|
|
303
|
+
return /* @__PURE__ */ N("div", {
|
|
349
304
|
...l,
|
|
350
305
|
"aria-label": l["aria-label"] ?? "Virtual list",
|
|
351
306
|
className: P("comins-table__component", "comins-table__component-virtual-list", l.className),
|
|
352
|
-
"data-comins-virtual-list-expanded":
|
|
353
|
-
"data-comins-virtual-list-visible-count":
|
|
354
|
-
"data-testid": `virtual-list-${
|
|
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:
|
|
387
|
-
children: [/* @__PURE__ */
|
|
341
|
+
style: me,
|
|
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
|
-
|
|
403
|
-
"aria-selected":
|
|
357
|
+
E.map(({ item: t, itemIndex: r }) => /* @__PURE__ */ M("button", {
|
|
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,128 +372,128 @@ function H({ 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
|
-
children: /* @__PURE__ */
|
|
381
|
+
children: /* @__PURE__ */ M("span", {
|
|
427
382
|
className: "comins-table__component-virtual-list-item-label",
|
|
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
|
-
}), /* @__PURE__ */
|
|
392
|
+
}), /* @__PURE__ */ N("div", {
|
|
438
393
|
className: "comins-table__component-virtual-list-controls",
|
|
439
|
-
children: [o && ae ? /* @__PURE__ */
|
|
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
|
-
}) !== !1 &&
|
|
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__ */
|
|
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__ */
|
|
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
443
|
let n = F(e.props, t), { onClick: r, onKeyDown: i, onMouseDown: a, onPointerDown: o, ...s } = n;
|
|
489
|
-
return /* @__PURE__ */
|
|
444
|
+
return /* @__PURE__ */ M("button", {
|
|
490
445
|
...s,
|
|
491
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__ */
|
|
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__ */
|
|
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 = F(e.props, t), r =
|
|
520
|
-
return /* @__PURE__ */
|
|
474
|
+
let n = F(e.props, t), r = Ae(e.options, t), { onChange: i, onClick: a, onKeyDown: o, onMouseDown: s, onPointerDown: c, ...l } = n;
|
|
475
|
+
return /* @__PURE__ */ M("select", {
|
|
521
476
|
...l,
|
|
522
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
|
-
children: r.map((e) => /* @__PURE__ */
|
|
496
|
+
children: r.map((e) => /* @__PURE__ */ M("option", {
|
|
542
497
|
disabled: e.disabled,
|
|
543
498
|
value: String(e.value),
|
|
544
499
|
children: e.label
|
|
@@ -546,40 +501,40 @@ function Ye(e, t, n) {
|
|
|
546
501
|
});
|
|
547
502
|
}
|
|
548
503
|
if (e.type === "radio") {
|
|
549
|
-
let n = F(e.props, t), r =
|
|
550
|
-
return /* @__PURE__ */
|
|
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;
|
|
505
|
+
return /* @__PURE__ */ M("div", {
|
|
551
506
|
...s,
|
|
552
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
|
-
children: r.map((n) => /* @__PURE__ */
|
|
567
|
-
onClick:
|
|
568
|
-
onMouseDown:
|
|
569
|
-
children: [/* @__PURE__ */
|
|
521
|
+
children: r.map((n) => /* @__PURE__ */ N("label", {
|
|
522
|
+
onClick: I,
|
|
523
|
+
onMouseDown: I,
|
|
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 Ye(e, t, n) {
|
|
|
590
545
|
}, String(n.value)))
|
|
591
546
|
});
|
|
592
547
|
}
|
|
593
|
-
if (e.type === "toggle") return /* @__PURE__ */
|
|
548
|
+
if (e.type === "toggle") return /* @__PURE__ */ M(ze, {
|
|
594
549
|
component: e,
|
|
595
550
|
payload: t
|
|
596
551
|
});
|
|
597
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
|
-
return /* @__PURE__ */
|
|
553
|
+
return /* @__PURE__ */ M("div", {
|
|
599
554
|
...r,
|
|
600
555
|
"aria-valuemax": a,
|
|
601
556
|
"aria-valuemin": 0,
|
|
602
557
|
"aria-valuenow": i,
|
|
603
558
|
className: P("comins-table__component", "comins-table__component-progress", r.className),
|
|
604
|
-
onClick:
|
|
605
|
-
onKeyDown:
|
|
606
|
-
onMouseDown:
|
|
607
|
-
onPointerDown:
|
|
559
|
+
onClick: I,
|
|
560
|
+
onKeyDown: I,
|
|
561
|
+
onMouseDown: I,
|
|
562
|
+
onPointerDown: I,
|
|
608
563
|
role: "progressbar",
|
|
609
|
-
children: /* @__PURE__ */
|
|
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 $e(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 U(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 G(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 ot(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 ut(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 dt(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 q(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 mt(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,31 +762,31 @@ function ht(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], i =
|
|
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
|
|
@@ -844,102 +799,102 @@ function St(e, t, n) {
|
|
|
844
799
|
}
|
|
845
800
|
};
|
|
846
801
|
}
|
|
847
|
-
function
|
|
802
|
+
function pt(e) {
|
|
848
803
|
return "row" in e && "selection" in e;
|
|
849
804
|
}
|
|
850
|
-
function
|
|
851
|
-
return !
|
|
805
|
+
function K(e, t) {
|
|
806
|
+
return !pt(t) || e.type !== "input" && e.type !== "select" || t.selection.selectedRowCount === 1 && t.row.selected;
|
|
852
807
|
}
|
|
853
|
-
function
|
|
854
|
-
return (e ?? []).filter((e) =>
|
|
808
|
+
function mt(e, t) {
|
|
809
|
+
return (e ?? []).filter((e) => K(e, t));
|
|
855
810
|
}
|
|
856
|
-
function
|
|
857
|
-
return
|
|
811
|
+
function ht(e, t, n, r) {
|
|
812
|
+
return mt(e, t).map((e, t) => ({
|
|
858
813
|
component: e,
|
|
859
814
|
index: t
|
|
860
|
-
})).filter(({ component: e }) => (e.direction ?? "left") === n).map(({ component: e, index: i }) => /* @__PURE__ */
|
|
815
|
+
})).filter(({ component: e }) => (e.direction ?? "left") === n).map(({ component: e, index: i }) => /* @__PURE__ */ M("span", {
|
|
861
816
|
className: "comins-table__component-slot",
|
|
862
817
|
"data-comins-component-align": e.align ?? "center",
|
|
863
818
|
"data-comins-component-direction": n,
|
|
864
819
|
"data-comins-component-id": e.id ?? `${e.type}-${i}`,
|
|
865
|
-
children:
|
|
820
|
+
children: Ve(e, t, r)
|
|
866
821
|
}, e.id ?? `${e.type}-${i}`));
|
|
867
822
|
}
|
|
868
|
-
function
|
|
823
|
+
function gt(e, t, n, r = {}) {
|
|
869
824
|
if (!t?.length) return e;
|
|
870
|
-
let i = r.showContent ?? !0, a =
|
|
825
|
+
let i = r.showContent ?? !0, a = mt(t, n);
|
|
871
826
|
if (!a.length) return e;
|
|
872
|
-
let o =
|
|
873
|
-
return i ? /* @__PURE__ */
|
|
827
|
+
let o = ht(a, n, "left", r.interaction), s = ht(a, n, "right", r.interaction);
|
|
828
|
+
return i ? /* @__PURE__ */ N("span", {
|
|
874
829
|
className: "comins-table__component-layout",
|
|
875
830
|
children: [
|
|
876
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ M("span", {
|
|
877
832
|
className: "comins-table__component-group",
|
|
878
833
|
"data-comins-component-direction": "left",
|
|
879
834
|
children: o
|
|
880
835
|
}),
|
|
881
|
-
/* @__PURE__ */
|
|
836
|
+
/* @__PURE__ */ M("span", {
|
|
882
837
|
className: "comins-table__component-content",
|
|
883
838
|
children: e
|
|
884
839
|
}),
|
|
885
|
-
/* @__PURE__ */
|
|
840
|
+
/* @__PURE__ */ M("span", {
|
|
886
841
|
className: "comins-table__component-group",
|
|
887
842
|
"data-comins-component-direction": "right",
|
|
888
843
|
children: s
|
|
889
844
|
})
|
|
890
845
|
]
|
|
891
|
-
}) : /* @__PURE__ */
|
|
846
|
+
}) : /* @__PURE__ */ M("span", {
|
|
892
847
|
className: "comins-table__component-layout",
|
|
893
848
|
"data-comins-component-only": "true",
|
|
894
|
-
children: /* @__PURE__ */
|
|
849
|
+
children: /* @__PURE__ */ N("span", {
|
|
895
850
|
className: "comins-table__component-group",
|
|
896
851
|
"data-comins-component-direction": "all",
|
|
897
852
|
children: [o, s]
|
|
898
853
|
})
|
|
899
854
|
});
|
|
900
855
|
}
|
|
901
|
-
function
|
|
902
|
-
return Math.max(
|
|
856
|
+
function _t(e) {
|
|
857
|
+
return Math.max(Je, e.minWidth ?? Je);
|
|
903
858
|
}
|
|
904
|
-
function
|
|
859
|
+
function vt(e) {
|
|
905
860
|
return e.maxWidth ?? Infinity;
|
|
906
861
|
}
|
|
907
|
-
function
|
|
862
|
+
function yt(e, t) {
|
|
908
863
|
return e.columnState[t.id]?.width ?? t.width ?? 100;
|
|
909
864
|
}
|
|
910
|
-
function
|
|
865
|
+
function q(e, t, n) {
|
|
911
866
|
return Math.min(n, Math.max(t, e));
|
|
912
867
|
}
|
|
913
|
-
function
|
|
914
|
-
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));
|
|
915
870
|
for (; i.size > 0;) {
|
|
916
871
|
let e = s - r.reduce((e, t) => e + t, 0);
|
|
917
872
|
if (Math.abs(e) < .001) break;
|
|
918
873
|
let t = [...i], n = t.reduce((e, t) => e + Math.max(r[t] ?? 0, 0), 0), c = !1;
|
|
919
874
|
for (let s of t) {
|
|
920
|
-
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);
|
|
921
876
|
r[s] = d, Math.abs(d - u) > .001 && (i.delete(s), c = !0);
|
|
922
877
|
}
|
|
923
878
|
if (!c) break;
|
|
924
879
|
}
|
|
925
880
|
return r;
|
|
926
881
|
}
|
|
927
|
-
function
|
|
882
|
+
function xt(e, t, n) {
|
|
928
883
|
let r = e.columnGroups.find((e) => e.children.includes(t));
|
|
929
|
-
if (!r || e.columnGroupState[r.id]?.hidden === !0) return
|
|
884
|
+
if (!r || e.columnGroupState[r.id]?.hidden === !0) return D(e, t, n);
|
|
930
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);
|
|
931
|
-
if (!a) return
|
|
886
|
+
if (!a) return D(e, t, n);
|
|
932
887
|
let o = i.filter((e) => e.id !== t);
|
|
933
888
|
if (o.length === 0) {
|
|
934
|
-
let r =
|
|
935
|
-
return
|
|
889
|
+
let r = yt(e, a);
|
|
890
|
+
return D(e, t, q(n, _t(a), Math.min(vt(a), r)));
|
|
936
891
|
}
|
|
937
|
-
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);
|
|
938
893
|
return o.forEach((e, t) => {
|
|
939
|
-
p =
|
|
894
|
+
p = D(p, e.id, f[t] ?? yt(p, e));
|
|
940
895
|
}), p;
|
|
941
896
|
}
|
|
942
|
-
function
|
|
897
|
+
function St(e, t, n) {
|
|
943
898
|
if (!e || typeof e != "object") return e;
|
|
944
899
|
let r = t.split("."), [i] = r;
|
|
945
900
|
if (!i) return e;
|
|
@@ -953,7 +908,7 @@ function Mt(e, t, n) {
|
|
|
953
908
|
o[e] = a, n && (o = a);
|
|
954
909
|
}), o[r.at(-1)] = n, a;
|
|
955
910
|
}
|
|
956
|
-
function
|
|
911
|
+
function Ct(e, t) {
|
|
957
912
|
return e?.columnId === t ? e.direction === "asc" ? {
|
|
958
913
|
columnId: t,
|
|
959
914
|
direction: "desc"
|
|
@@ -962,60 +917,60 @@ function Nt(e, t) {
|
|
|
962
917
|
direction: "asc"
|
|
963
918
|
};
|
|
964
919
|
}
|
|
965
|
-
function
|
|
966
|
-
let r = e.findIndex((e) => e.columnId === t), i =
|
|
920
|
+
function wt(e, t, n) {
|
|
921
|
+
let r = e.findIndex((e) => e.columnId === t), i = Ct(r < 0 ? null : e[r] ?? null, t);
|
|
967
922
|
return n ? i ? r < 0 ? [...e, i] : e.map((e, t) => t === r ? i : e) : e.filter((e) => e.columnId !== t) : i ? [i] : [];
|
|
968
923
|
}
|
|
969
|
-
function
|
|
924
|
+
function Tt(e, t) {
|
|
970
925
|
let n = e.findIndex((e) => e.columnId === t);
|
|
971
926
|
return n < 0 ? null : {
|
|
972
927
|
priority: n + 1,
|
|
973
928
|
rule: e[n]
|
|
974
929
|
};
|
|
975
930
|
}
|
|
976
|
-
function
|
|
977
|
-
let n =
|
|
931
|
+
function Et(e, t) {
|
|
932
|
+
let n = Tt(e, t)?.rule;
|
|
978
933
|
return n ? n.direction : "none";
|
|
979
934
|
}
|
|
980
|
-
function
|
|
981
|
-
let n =
|
|
935
|
+
function Dt(e, t) {
|
|
936
|
+
let n = Tt(e, t);
|
|
982
937
|
if (!n) return e.length > 1 ? void 0 : "none";
|
|
983
938
|
if (!(n.priority > 1)) return n.rule.direction === "asc" ? "ascending" : "descending";
|
|
984
939
|
}
|
|
985
|
-
function
|
|
940
|
+
function Ot(e, t) {
|
|
986
941
|
return !e || !t ? e === t : e.columnId === t.columnId && e.direction === t.direction;
|
|
987
942
|
}
|
|
988
|
-
function
|
|
943
|
+
function kt(e, t) {
|
|
989
944
|
return e.length === t.length && e.every((e, n) => e.columnId === t[n]?.columnId && e.direction === t[n]?.direction);
|
|
990
945
|
}
|
|
991
|
-
function
|
|
946
|
+
function At(e, t) {
|
|
992
947
|
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
993
948
|
}
|
|
994
|
-
function
|
|
995
|
-
if (!
|
|
949
|
+
function jt(e, t) {
|
|
950
|
+
if (!At(e.rowIds, t.rowIds)) return !1;
|
|
996
951
|
let n = new Set(t.columns.map((e) => e.id)), r = e.selection.cell, i = e.selection.range;
|
|
997
952
|
return !(r && !n.has(r.columnId) || i && (!n.has(i.anchor.columnId) || !n.has(i.focus.columnId)));
|
|
998
953
|
}
|
|
999
|
-
function
|
|
954
|
+
function Mt(e, t) {
|
|
1000
955
|
return t.split(".").reduce((e, t) => {
|
|
1001
956
|
if (!(typeof e != "object" || !e)) return e[t];
|
|
1002
957
|
}, e);
|
|
1003
958
|
}
|
|
1004
|
-
function
|
|
959
|
+
function J(e, t) {
|
|
1005
960
|
return typeof e == "number" && typeof t == "number" ? e - t : String(e ?? "").localeCompare(String(t ?? ""));
|
|
1006
961
|
}
|
|
1007
|
-
function
|
|
1008
|
-
return n.length === 0 ? e :
|
|
962
|
+
function Nt(e, t, n) {
|
|
963
|
+
return n.length === 0 ? e : W(e, (e, r) => {
|
|
1009
964
|
for (let i of n) {
|
|
1010
965
|
let n = t.find((e) => (e.id ?? e.field) === i.columnId);
|
|
1011
966
|
if (!n?.sort) continue;
|
|
1012
|
-
let a =
|
|
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);
|
|
1013
968
|
if (s !== 0) return i.direction === "desc" ? s * -1 : s;
|
|
1014
969
|
}
|
|
1015
970
|
return 0;
|
|
1016
971
|
});
|
|
1017
972
|
}
|
|
1018
|
-
function
|
|
973
|
+
function Pt(e, t, n, r, i) {
|
|
1019
974
|
if (t?.length === 0) return e;
|
|
1020
975
|
let a = [], o = /* @__PURE__ */ new Map(), s = 0, c = (e, t) => {
|
|
1021
976
|
e.forEach((e) => {
|
|
@@ -1047,185 +1002,190 @@ function Gt(e, t, n, r, i) {
|
|
|
1047
1002
|
};
|
|
1048
1003
|
return m(e);
|
|
1049
1004
|
}
|
|
1050
|
-
function
|
|
1051
|
-
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({
|
|
1052
1007
|
columnGroups: l,
|
|
1053
1008
|
columns: u,
|
|
1054
1009
|
getRowId: m,
|
|
1055
|
-
pagination:
|
|
1056
|
-
rows:
|
|
1057
|
-
showHeader:
|
|
1058
|
-
theme:
|
|
1059
|
-
})),
|
|
1010
|
+
pagination: I,
|
|
1011
|
+
rows: rn,
|
|
1012
|
+
showHeader: Re,
|
|
1013
|
+
theme: Ve
|
|
1014
|
+
})), X = A(Y), on = A({
|
|
1060
1015
|
columnGroups: l,
|
|
1061
1016
|
columns: u,
|
|
1062
|
-
data:
|
|
1017
|
+
data: rn,
|
|
1063
1018
|
getRowId: m,
|
|
1064
|
-
pagination:
|
|
1065
|
-
showHeader:
|
|
1066
|
-
}),
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
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;
|
|
1028
|
+
let t = X.current.rows.length;
|
|
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,
|
|
1073
1033
|
offset: i,
|
|
1074
1034
|
reason: e,
|
|
1075
1035
|
signal: n.signal
|
|
1076
1036
|
}).then((t) => {
|
|
1077
|
-
if (n.signal.aborted ||
|
|
1078
|
-
let i = e === "scroll" ? [...
|
|
1079
|
-
|
|
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);
|
|
1080
1040
|
}).catch(() => {}).finally(() => {
|
|
1081
|
-
|
|
1041
|
+
tt.current === r && (et.current = null, G.current = null, Kt(null));
|
|
1082
1042
|
});
|
|
1083
1043
|
};
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
}, [
|
|
1087
|
-
|
|
1088
|
-
}, [
|
|
1089
|
-
|
|
1090
|
-
}, [d,
|
|
1091
|
-
if (!(!
|
|
1092
|
-
|
|
1044
|
+
O(() => {
|
|
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));
|
|
1050
|
+
}, [d, x]), O(() => {
|
|
1051
|
+
if (!(!x || !Pe)) return fn("initial"), () => {
|
|
1052
|
+
tt.current += 1, et.current = null, G.current?.abort(), G.current = null;
|
|
1093
1053
|
};
|
|
1094
1054
|
}, [
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
]),
|
|
1099
|
-
let e =
|
|
1100
|
-
if (e.columns === u && e.columnGroups === l && e.data ===
|
|
1101
|
-
|
|
1055
|
+
x,
|
|
1056
|
+
Pe,
|
|
1057
|
+
cn
|
|
1058
|
+
]), O(() => {
|
|
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 = {
|
|
1102
1062
|
columnGroups: l,
|
|
1103
1063
|
columns: u,
|
|
1104
|
-
data:
|
|
1064
|
+
data: rn,
|
|
1105
1065
|
getRowId: m,
|
|
1106
|
-
pagination:
|
|
1107
|
-
showHeader:
|
|
1066
|
+
pagination: I,
|
|
1067
|
+
showHeader: Re
|
|
1108
1068
|
};
|
|
1109
|
-
let t =
|
|
1110
|
-
columnLayout:
|
|
1069
|
+
let t = X.current, n = c({
|
|
1070
|
+
columnLayout: fe(t),
|
|
1111
1071
|
columnGroups: l,
|
|
1112
1072
|
columns: u,
|
|
1113
1073
|
getRowId: m,
|
|
1114
|
-
pagination:
|
|
1115
|
-
rows:
|
|
1116
|
-
showHeader:
|
|
1074
|
+
pagination: I ?? t.pagination,
|
|
1075
|
+
rows: rn,
|
|
1076
|
+
showHeader: Re,
|
|
1117
1077
|
sortModel: t.sortModel,
|
|
1118
1078
|
theme: t.theme
|
|
1119
|
-
}), r =
|
|
1079
|
+
}), r = jt(t, n) ? {
|
|
1120
1080
|
...n,
|
|
1121
1081
|
selection: t.selection
|
|
1122
1082
|
} : n;
|
|
1123
|
-
|
|
1083
|
+
X.current = r, an(r), Ot(r.sort, t.sort) || xe?.(r.sort), kt(r.sortModel, t.sortModel) || Te?.(r.sortModel);
|
|
1124
1084
|
}, [
|
|
1125
1085
|
l,
|
|
1126
1086
|
u,
|
|
1127
|
-
|
|
1087
|
+
rn,
|
|
1128
1088
|
m,
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
]),
|
|
1132
|
-
|
|
1133
|
-
}, [
|
|
1134
|
-
|
|
1135
|
-
}, [
|
|
1136
|
-
|
|
1137
|
-
}, []),
|
|
1138
|
-
let e =
|
|
1089
|
+
I,
|
|
1090
|
+
Re
|
|
1091
|
+
]), O(() => {
|
|
1092
|
+
X.current = Y;
|
|
1093
|
+
}, [Y]), O(() => {
|
|
1094
|
+
pt.current !== null && pt.current !== Y.rows.length && (pt.current = null);
|
|
1095
|
+
}, [Y.rows.length]), O(() => () => {
|
|
1096
|
+
un(), Mt.current !== null && window.cancelAnimationFrame(Mt.current), At.current !== null && window.clearTimeout(At.current);
|
|
1097
|
+
}, []), O(() => {
|
|
1098
|
+
let e = We.current;
|
|
1139
1099
|
if (!e || typeof ResizeObserver > "u") return;
|
|
1140
1100
|
let t = new ResizeObserver(([e]) => {
|
|
1141
|
-
e && (
|
|
1101
|
+
e && (Pt(e.contentRect.height), It(e.contentRect.width));
|
|
1142
1102
|
});
|
|
1143
1103
|
return t.observe(e), () => t.disconnect();
|
|
1144
1104
|
}, []);
|
|
1145
|
-
let
|
|
1146
|
-
t.rows !== e.rows &&
|
|
1147
|
-
},
|
|
1148
|
-
let n =
|
|
1149
|
-
|
|
1150
|
-
},
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
]),
|
|
1156
|
-
if (!
|
|
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);
|
|
1107
|
+
}, Z = (e, t = {}) => {
|
|
1108
|
+
let n = X.current, r = typeof e == "function" ? e(n) : e;
|
|
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, [
|
|
1111
|
+
Y.rows,
|
|
1112
|
+
R,
|
|
1113
|
+
z?.summaryRows,
|
|
1114
|
+
Q
|
|
1115
|
+
]), gn = k(() => {
|
|
1116
|
+
if (!R) return [];
|
|
1157
1117
|
let e = [], t = 0;
|
|
1158
|
-
for (; t <
|
|
1159
|
-
let n =
|
|
1118
|
+
for (; t < Q.length;) {
|
|
1119
|
+
let n = Q[t], r = R.columns[n.id], i = typeof r == "object" && r ? r : void 0, a = i?.colSpan, o = Math.min(typeof a == "number" && Number.isFinite(a) ? Math.max(1, Math.floor(a)) : 1, Q.length - t);
|
|
1160
1120
|
e.push({
|
|
1161
1121
|
className: i?.className,
|
|
1162
1122
|
colSpan: o,
|
|
1163
1123
|
column: n,
|
|
1164
1124
|
style: i?.style,
|
|
1165
|
-
value:
|
|
1125
|
+
value: hn?.[n.id] ?? (e.length === 0 ? R.label : null)
|
|
1166
1126
|
}), t += o;
|
|
1167
1127
|
}
|
|
1168
1128
|
return e;
|
|
1169
1129
|
}, [
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
]),
|
|
1174
|
-
if (
|
|
1175
|
-
let e = Math.max(1,
|
|
1130
|
+
R,
|
|
1131
|
+
hn,
|
|
1132
|
+
Q
|
|
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(() => {
|
|
1134
|
+
if (B) {
|
|
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;
|
|
1176
1136
|
return {
|
|
1177
|
-
entries:
|
|
1137
|
+
entries: Ye(_n, Y.rows, Y.rowIds, c, l),
|
|
1178
1138
|
renderOffset: d,
|
|
1179
1139
|
scrollHeight: r
|
|
1180
1140
|
};
|
|
1181
1141
|
}
|
|
1182
1142
|
return {
|
|
1183
|
-
entries:
|
|
1143
|
+
entries: Ye(_n, Y.rows, Y.rowIds, yn, yn + Math.max(1, Y.pagination.pageSize)),
|
|
1184
1144
|
renderOffset: 0,
|
|
1185
1145
|
scrollHeight: 0
|
|
1186
1146
|
};
|
|
1187
1147
|
}, [
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
]),
|
|
1200
|
-
let e =
|
|
1148
|
+
Nt,
|
|
1149
|
+
yn,
|
|
1150
|
+
L,
|
|
1151
|
+
tn,
|
|
1152
|
+
_n,
|
|
1153
|
+
Y.pagination.pageSize,
|
|
1154
|
+
Y.rowIds,
|
|
1155
|
+
Y.rows,
|
|
1156
|
+
sn,
|
|
1157
|
+
B,
|
|
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(() => {
|
|
1160
|
+
let e = Q.length;
|
|
1201
1161
|
if (e === 0) return [];
|
|
1202
|
-
let t =
|
|
1203
|
-
if (
|
|
1162
|
+
let t = Q.map((e) => Y.columnState[e.id]?.width ?? e.width);
|
|
1163
|
+
if (Ft <= 0) {
|
|
1204
1164
|
let n = `${100 / e}%`;
|
|
1205
1165
|
return t.map((e) => e ?? n);
|
|
1206
1166
|
}
|
|
1207
1167
|
let n = 0;
|
|
1208
1168
|
for (let e of t) n += e ?? 0;
|
|
1209
|
-
let r =
|
|
1210
|
-
return
|
|
1211
|
-
let r = t[n] ?? i, a =
|
|
1169
|
+
let r = Q.filter((e, n) => t[n] === void 0), i = r.length > 0 ? Math.max(0, (Ft - n) / r.length) : 0;
|
|
1170
|
+
return Q.map((e, n) => {
|
|
1171
|
+
let r = t[n] ?? i, a = _t(e), o = e.maxWidth ?? Infinity;
|
|
1212
1172
|
return Math.min(o, Math.max(a, r));
|
|
1213
1173
|
});
|
|
1214
1174
|
}, [
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
]),
|
|
1175
|
+
Ft,
|
|
1176
|
+
Y.columnState,
|
|
1177
|
+
Q
|
|
1178
|
+
]), Tn = k(() => {
|
|
1219
1179
|
let e = 0;
|
|
1220
|
-
for (let t of
|
|
1180
|
+
for (let t of wn) {
|
|
1221
1181
|
if (typeof t != "number") return;
|
|
1222
1182
|
e += t;
|
|
1223
1183
|
}
|
|
1224
1184
|
return e;
|
|
1225
|
-
}, [
|
|
1226
|
-
if (typeof
|
|
1227
|
-
}, [
|
|
1228
|
-
let r = (
|
|
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) => {
|
|
1188
|
+
let r = (z ? e.rows.map((e, t) => t) : b(e)).flatMap((t, n) => {
|
|
1229
1189
|
let r = e.rows[t], i = e.rowIds[t];
|
|
1230
1190
|
return r === void 0 || i === void 0 ? [] : [{
|
|
1231
1191
|
dataIndex: t,
|
|
@@ -1237,54 +1197,54 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1237
1197
|
if (i < 0 || a < 0) return [n];
|
|
1238
1198
|
let o = Math.min(i, a), s = Math.max(i, a);
|
|
1239
1199
|
return r.slice(o, s + 1).map((e) => e.rowId);
|
|
1240
|
-
},
|
|
1241
|
-
|
|
1242
|
-
},
|
|
1243
|
-
|
|
1244
|
-
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);
|
|
1245
1205
|
return t ? [t.rowId] : [];
|
|
1246
1206
|
})));
|
|
1247
|
-
},
|
|
1248
|
-
let e =
|
|
1249
|
-
e && (e.cleanup(), e.timer !== null && window.clearTimeout(e.timer),
|
|
1250
|
-
},
|
|
1251
|
-
|
|
1207
|
+
}, $ = () => {
|
|
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 = {
|
|
1252
1212
|
cleanup: () => void 0,
|
|
1253
1213
|
columnId: e,
|
|
1254
1214
|
timer: null
|
|
1255
1215
|
});
|
|
1256
|
-
},
|
|
1257
|
-
let e =
|
|
1216
|
+
}, Kn = () => {
|
|
1217
|
+
let e = J.current;
|
|
1258
1218
|
e && (e.cleanup(), e.cleanup = () => void 0, e.timer = window.setTimeout(() => {
|
|
1259
|
-
|
|
1219
|
+
J.current === e && (J.current = null);
|
|
1260
1220
|
}, 0));
|
|
1261
|
-
},
|
|
1262
|
-
let e =
|
|
1221
|
+
}, qn = () => {
|
|
1222
|
+
let e = J.current;
|
|
1263
1223
|
if (!e) return;
|
|
1264
|
-
let t = () =>
|
|
1224
|
+
let t = () => Kn(), n = () => $(), r = () => $();
|
|
1265
1225
|
e.cleanup(), e.cleanup = () => {
|
|
1266
1226
|
window.removeEventListener("pointerup", t), window.removeEventListener("pointercancel", n), window.removeEventListener("blur", r);
|
|
1267
1227
|
}, window.addEventListener("pointerup", t, { once: !0 }), window.addEventListener("pointercancel", n, { once: !0 }), window.addEventListener("blur", r, { once: !0 });
|
|
1268
|
-
},
|
|
1269
|
-
e.sort &&
|
|
1270
|
-
},
|
|
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) => {
|
|
1271
1231
|
let n = document.elementFromPoint(e, t)?.closest("[data-comins-column-id], [data-comins-column-group-id]");
|
|
1272
1232
|
if (!n) return null;
|
|
1273
1233
|
if (n.dataset.cominsColumnId) return n.dataset.cominsColumnId;
|
|
1274
1234
|
let r = n.dataset.cominsColumnGroupId;
|
|
1275
|
-
return (r ?
|
|
1235
|
+
return (r ? X.current.columnGroups.find((e) => e.id === r) : void 0)?.children.find((e) => Q.some((t) => t.id === e)) ?? null;
|
|
1276
1236
|
};
|
|
1277
|
-
|
|
1278
|
-
clearSort: () =>
|
|
1279
|
-
expand: (e) =>
|
|
1280
|
-
fold: (e) =>
|
|
1281
|
-
getColumnLayout: () =>
|
|
1282
|
-
getSortModel: () =>
|
|
1283
|
-
getSortState: () =>
|
|
1284
|
-
setColumnLayout: (e) =>
|
|
1285
|
-
setMoveTargetRow: (e, t) =>
|
|
1286
|
-
if (
|
|
1287
|
-
let r =
|
|
1237
|
+
De(He, () => ({
|
|
1238
|
+
clearSort: () => Z((e) => i(e)),
|
|
1239
|
+
expand: (e) => z?.onExpand(e),
|
|
1240
|
+
fold: (e) => z?.onFold(e),
|
|
1241
|
+
getColumnLayout: () => fe(Y),
|
|
1242
|
+
getSortModel: () => Y.sortModel,
|
|
1243
|
+
getSortState: () => Y.sort,
|
|
1244
|
+
setColumnLayout: (e) => Z((n) => t(n, e), { columnLayoutChanged: !0 }),
|
|
1245
|
+
setMoveTargetRow: (e, t) => Z((n) => {
|
|
1246
|
+
if (z) return n;
|
|
1247
|
+
let r = b(n).flatMap((e) => {
|
|
1288
1248
|
let t = n.rowIds[e];
|
|
1289
1249
|
return t === void 0 ? [] : [t];
|
|
1290
1250
|
}), i = r[t];
|
|
@@ -1303,34 +1263,34 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1303
1263
|
sortModel: []
|
|
1304
1264
|
} : n;
|
|
1305
1265
|
}),
|
|
1306
|
-
setSelectedRow: (e) =>
|
|
1307
|
-
setSelectedRows: (e) =>
|
|
1308
|
-
setSortModel: (e) =>
|
|
1309
|
-
setSortState: (e) =>
|
|
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))
|
|
1310
1270
|
}), [
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1271
|
+
bn.entries,
|
|
1272
|
+
Y,
|
|
1273
|
+
z
|
|
1314
1274
|
]);
|
|
1315
|
-
let
|
|
1316
|
-
let e =
|
|
1317
|
-
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);
|
|
1318
1278
|
};
|
|
1319
|
-
|
|
1320
|
-
|
|
1279
|
+
O(() => () => {
|
|
1280
|
+
Zn(), $();
|
|
1321
1281
|
}, []);
|
|
1322
|
-
let
|
|
1282
|
+
let Qn = (e) => {
|
|
1323
1283
|
if (e.event.button !== 0) return;
|
|
1324
1284
|
let t = e.event.pointerType, n = t === "mouse" || t === "", r = () => {
|
|
1325
|
-
e.sortColumnId &&
|
|
1285
|
+
e.sortColumnId && Gn(e.sortColumnId);
|
|
1326
1286
|
}, i = (t, n) => {
|
|
1327
|
-
let i =
|
|
1287
|
+
let i = W.current;
|
|
1328
1288
|
!i || i !== u || i.active || i.blocked || (i.active = !0, i.cancelSort = !0, r(), e.activate(t, n));
|
|
1329
1289
|
}, a = (e) => {
|
|
1330
|
-
let t =
|
|
1290
|
+
let t = W.current;
|
|
1331
1291
|
if (!(!t || t !== u)) {
|
|
1332
1292
|
if (!t.active && !t.blocked && n) {
|
|
1333
|
-
let n =
|
|
1293
|
+
let n = ke({
|
|
1334
1294
|
clientX: e.clientX,
|
|
1335
1295
|
clientY: e.clientY,
|
|
1336
1296
|
startX: t.startX,
|
|
@@ -1338,24 +1298,24 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1338
1298
|
});
|
|
1339
1299
|
n === "activate" ? i(e.clientX, e.clientY) : n === "cancel" && (t.blocked = !0, t.cancelSort = !0, r());
|
|
1340
1300
|
}
|
|
1341
|
-
!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({
|
|
1342
1302
|
x: e.clientX,
|
|
1343
1303
|
y: e.clientY
|
|
1344
|
-
}),
|
|
1304
|
+
}), Wt(Xn(e.clientX, e.clientY)));
|
|
1345
1305
|
}
|
|
1346
1306
|
}, o = (t) => {
|
|
1347
|
-
let n =
|
|
1307
|
+
let n = W.current;
|
|
1348
1308
|
if (n === u && n.active) {
|
|
1349
|
-
let n =
|
|
1309
|
+
let n = Xn(t.clientX, t.clientY);
|
|
1350
1310
|
n && e.commitTarget(n);
|
|
1351
1311
|
}
|
|
1352
|
-
n === u && n.cancelSort &&
|
|
1312
|
+
n === u && n.cancelSort && Kn(), Zn();
|
|
1353
1313
|
}, s = () => {
|
|
1354
|
-
|
|
1314
|
+
$(), Zn();
|
|
1355
1315
|
}, c = (e) => {
|
|
1356
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
1316
|
+
e.key === "Escape" && (e.preventDefault(), W.current === u && u.cancelSort && qn(), Zn());
|
|
1357
1317
|
}, l = () => {
|
|
1358
|
-
|
|
1318
|
+
$(), Zn();
|
|
1359
1319
|
}, u = {
|
|
1360
1320
|
active: !1,
|
|
1361
1321
|
blocked: !1,
|
|
@@ -1370,24 +1330,24 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1370
1330
|
startY: e.event.clientY,
|
|
1371
1331
|
timer: null
|
|
1372
1332
|
};
|
|
1373
|
-
|
|
1374
|
-
let e =
|
|
1333
|
+
Zn(), $(), n || (u.timer = window.setTimeout(() => {
|
|
1334
|
+
let e = W.current;
|
|
1375
1335
|
e === u && !e.active && !e.blocked && i(e.startX, e.startY);
|
|
1376
|
-
}, 1e3)),
|
|
1377
|
-
},
|
|
1378
|
-
|
|
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({
|
|
1379
1339
|
activate: (e, n) => {
|
|
1380
|
-
|
|
1340
|
+
Ht({
|
|
1381
1341
|
x: e,
|
|
1382
1342
|
y: n
|
|
1383
|
-
}),
|
|
1343
|
+
}), Wt(t.id), Bt(null), Rt(t.id);
|
|
1384
1344
|
},
|
|
1385
1345
|
commitTarget: (e) => {
|
|
1386
1346
|
if (e === t.id) return;
|
|
1387
|
-
let n =
|
|
1347
|
+
let n = Q.findIndex((t) => t.id === e);
|
|
1388
1348
|
if (n >= 0) {
|
|
1389
|
-
let e =
|
|
1390
|
-
r !== e && r.columnOrder.some((t, n) => t !== e.columnOrder[n]) &&
|
|
1349
|
+
let e = X.current, r = ne(e, t.id, n);
|
|
1350
|
+
r !== e && r.columnOrder.some((t, n) => t !== e.columnOrder[n]) && Z(r, { columnLayoutChanged: !0 });
|
|
1391
1351
|
}
|
|
1392
1352
|
},
|
|
1393
1353
|
event: e,
|
|
@@ -1395,98 +1355,102 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1395
1355
|
kind: "column",
|
|
1396
1356
|
sortColumnId: t.id
|
|
1397
1357
|
});
|
|
1398
|
-
},
|
|
1399
|
-
|
|
1358
|
+
}, er = (e, t) => {
|
|
1359
|
+
Qn({
|
|
1400
1360
|
activate: (e, n) => {
|
|
1401
|
-
|
|
1361
|
+
Ht({
|
|
1402
1362
|
x: e,
|
|
1403
1363
|
y: n
|
|
1404
|
-
}),
|
|
1364
|
+
}), Wt(t.children[0] ?? null), Rt(null), Bt(t.id);
|
|
1405
1365
|
},
|
|
1406
1366
|
commitTarget: (e) => {
|
|
1407
1367
|
if (t.children.includes(e)) return;
|
|
1408
|
-
let n =
|
|
1368
|
+
let n = Q.findIndex((t) => t.id === e);
|
|
1409
1369
|
if (n >= 0) {
|
|
1410
|
-
let e =
|
|
1411
|
-
r !== e && r.columnOrder.some((t, n) => t !== e.columnOrder[n]) &&
|
|
1370
|
+
let e = X.current, r = re(e, t.id, n);
|
|
1371
|
+
r !== e && r.columnOrder.some((t, n) => t !== e.columnOrder[n]) && Z(r, { columnLayoutChanged: !0 });
|
|
1412
1372
|
}
|
|
1413
1373
|
},
|
|
1414
1374
|
event: e,
|
|
1415
1375
|
id: t.id,
|
|
1416
1376
|
kind: "group"
|
|
1417
1377
|
});
|
|
1418
|
-
},
|
|
1419
|
-
if (e.shiftKey &&
|
|
1420
|
-
|
|
1378
|
+
}, tr = (e, t) => {
|
|
1379
|
+
if (e.shiftKey && K.current !== null) {
|
|
1380
|
+
Un(K.current, t.rowId), K.current = t.rowId;
|
|
1421
1381
|
return;
|
|
1422
1382
|
}
|
|
1423
|
-
|
|
1383
|
+
Z((n) => E(n, t.rowId, {
|
|
1424
1384
|
multi: e.ctrlKey || e.metaKey,
|
|
1425
1385
|
toggle: e.ctrlKey || e.metaKey
|
|
1426
|
-
})),
|
|
1427
|
-
},
|
|
1386
|
+
})), K.current = t.rowId;
|
|
1387
|
+
}, nr = (e, t, n) => {
|
|
1428
1388
|
if (n) {
|
|
1429
1389
|
e.preventDefault();
|
|
1430
1390
|
return;
|
|
1431
1391
|
}
|
|
1432
|
-
if (
|
|
1433
|
-
if (
|
|
1392
|
+
if (Ne?.(nt(e, t)), !(e.defaultPrevented || e.target !== e.currentTarget)) {
|
|
1393
|
+
if (z && (Bn(e, "c") || Bn(e, "v"))) {
|
|
1434
1394
|
e.preventDefault();
|
|
1435
1395
|
return;
|
|
1436
1396
|
}
|
|
1437
|
-
if (
|
|
1438
|
-
e.preventDefault(),
|
|
1397
|
+
if (Bn(e, "c")) {
|
|
1398
|
+
e.preventDefault(), qe.current = s(Y, t.rowId);
|
|
1439
1399
|
return;
|
|
1440
1400
|
}
|
|
1441
|
-
|
|
1401
|
+
Bn(e, "v") && qe.current && (e.preventDefault(), Z((e) => oe(e, qe.current, {
|
|
1442
1402
|
mode: "insert-after",
|
|
1443
1403
|
targetRowId: t.rowId
|
|
1444
1404
|
})));
|
|
1445
1405
|
}
|
|
1446
|
-
},
|
|
1406
|
+
}, rr = (e, t, n, r, i, s) => {
|
|
1447
1407
|
if (s) {
|
|
1448
1408
|
e.preventDefault(), e.stopPropagation();
|
|
1449
1409
|
return;
|
|
1450
1410
|
}
|
|
1451
|
-
if (
|
|
1452
|
-
if (
|
|
1453
|
-
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);
|
|
1454
1414
|
return;
|
|
1455
1415
|
}
|
|
1456
|
-
|
|
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)));
|
|
1457
1417
|
}
|
|
1458
|
-
},
|
|
1459
|
-
n && (r || e.button !== 0 || e.shiftKey || (
|
|
1460
|
-
},
|
|
1461
|
-
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) ?
|
|
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) => {
|
|
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;
|
|
1462
1422
|
return r && a !== void 0 ? {
|
|
1463
1423
|
columnId: r,
|
|
1464
1424
|
rowId: a
|
|
1465
1425
|
} : null;
|
|
1466
|
-
},
|
|
1426
|
+
}, or = (e) => {
|
|
1467
1427
|
if (!n) return;
|
|
1468
|
-
let t =
|
|
1469
|
-
!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, {
|
|
1470
1430
|
anchor: t,
|
|
1471
1431
|
focus: e
|
|
1472
1432
|
})));
|
|
1473
|
-
},
|
|
1474
|
-
n && (
|
|
1475
|
-
},
|
|
1476
|
-
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;
|
|
1477
1437
|
let r = (e) => {
|
|
1478
1438
|
if (e.buttons !== 1) return;
|
|
1479
|
-
let t =
|
|
1480
|
-
t &&
|
|
1439
|
+
let t = ar(e.clientX, e.clientY);
|
|
1440
|
+
t && or(t);
|
|
1481
1441
|
}, i = () => {
|
|
1482
|
-
|
|
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();
|
|
1483
1447
|
};
|
|
1484
|
-
e.preventDefault(), window.addEventListener("pointermove", r), window.addEventListener("pointerup",
|
|
1485
|
-
},
|
|
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) => {
|
|
1486
1450
|
if (n || !r || e.button !== 0) return;
|
|
1487
1451
|
e.preventDefault(), e.stopPropagation();
|
|
1488
1452
|
let i = t.rowId, a = (e) => {
|
|
1489
|
-
|
|
1453
|
+
bt.current = e, en(e);
|
|
1490
1454
|
}, o = (e, t) => {
|
|
1491
1455
|
let n = document.elementFromPoint(e, t)?.closest("[data-comins-row-data-index]");
|
|
1492
1456
|
if (!n || n.dataset.cominsRowDataIndex === void 0) return;
|
|
@@ -1497,96 +1461,104 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1497
1461
|
});
|
|
1498
1462
|
}, s = (e) => {
|
|
1499
1463
|
e.buttons === 1 && o(e.clientX, e.clientY);
|
|
1500
|
-
}, c = (
|
|
1501
|
-
window.removeEventListener("pointermove", s), window.removeEventListener("pointerup",
|
|
1502
|
-
|
|
1503
|
-
|
|
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);
|
|
1504
1472
|
};
|
|
1505
|
-
o(e.clientX, e.clientY), window.addEventListener("pointermove", s), window.addEventListener("pointerup",
|
|
1506
|
-
},
|
|
1507
|
-
if (e.kind === "group") return /* @__PURE__ */
|
|
1508
|
-
className: ["comins-table__th comins-table__group-th px-3 py-2 text-left font-semibold",
|
|
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) => {
|
|
1475
|
+
if (e.kind === "group") return /* @__PURE__ */ N("th", {
|
|
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(" "),
|
|
1509
1477
|
colSpan: e.colSpan,
|
|
1510
|
-
"data-column-moving":
|
|
1511
|
-
"data-column-placeholder":
|
|
1478
|
+
"data-column-moving": zt === e.groupId ? "true" : void 0,
|
|
1479
|
+
"data-column-placeholder": zt === e.groupId ? "true" : void 0,
|
|
1512
1480
|
"data-comins-column-group-id": e.groupId,
|
|
1513
1481
|
"data-testid": `header-group-${e.groupId}`,
|
|
1514
|
-
onPointerDown: (t) =>
|
|
1482
|
+
onPointerDown: (t) => er(t, e.group),
|
|
1515
1483
|
rowSpan: e.rowSpan,
|
|
1516
1484
|
scope: "colgroup",
|
|
1517
1485
|
children: [
|
|
1518
|
-
/* @__PURE__ */
|
|
1486
|
+
/* @__PURE__ */ M("span", {
|
|
1519
1487
|
"aria-hidden": "true",
|
|
1520
1488
|
className: "comins-column-drop-marker"
|
|
1521
1489
|
}),
|
|
1522
|
-
/* @__PURE__ */
|
|
1490
|
+
/* @__PURE__ */ M("span", {
|
|
1523
1491
|
className: "comins-table__header-content",
|
|
1524
1492
|
"data-comins-header-body": "true",
|
|
1525
|
-
children: /* @__PURE__ */
|
|
1493
|
+
children: /* @__PURE__ */ M("span", {
|
|
1526
1494
|
className: "comins-table__header-label",
|
|
1527
1495
|
children: e.group.label
|
|
1528
1496
|
})
|
|
1529
1497
|
}),
|
|
1530
|
-
/* @__PURE__ */
|
|
1498
|
+
/* @__PURE__ */ M("span", {
|
|
1531
1499
|
"aria-hidden": "true",
|
|
1532
1500
|
className: "comins-table__resize",
|
|
1533
|
-
"data-resizing":
|
|
1501
|
+
"data-resizing": Zt === e.groupId ? "true" : void 0,
|
|
1534
1502
|
"data-testid": `resize-group-${e.groupId}`,
|
|
1535
1503
|
onClick: (e) => e.stopPropagation(),
|
|
1536
1504
|
onPointerDown: (t) => {
|
|
1537
1505
|
t.preventDefault(), t.stopPropagation();
|
|
1538
1506
|
let n = t.clientX, r = t.currentTarget.closest("th")?.getBoundingClientRect().width, i = /* @__PURE__ */ new Map();
|
|
1539
1507
|
for (let t of e.group.children) {
|
|
1540
|
-
let e =
|
|
1508
|
+
let e = Q.find((e) => e.id === t);
|
|
1541
1509
|
if (!e) continue;
|
|
1542
|
-
let n = Array.from(V.current?.querySelectorAll("[data-comins-column-id]") ?? []).find((t) => t.dataset.cominsColumnId === e.id)?.getBoundingClientRect().width, r =
|
|
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;
|
|
1543
1511
|
i.set(e.id, n && Number.isFinite(n) ? n : r);
|
|
1544
1512
|
}
|
|
1545
1513
|
let a = [...i.values()].reduce((e, t) => e + t, 0), o = r && Number.isFinite(r) ? r : Math.max(1, a);
|
|
1546
|
-
|
|
1514
|
+
Qt(e.groupId);
|
|
1547
1515
|
let s = (t) => {
|
|
1548
|
-
|
|
1516
|
+
Z((r) => {
|
|
1549
1517
|
let a = r;
|
|
1550
|
-
for (let [e, t] of i) a =
|
|
1551
|
-
return
|
|
1518
|
+
for (let [e, t] of i) a = D(a, e, t);
|
|
1519
|
+
return me(a, e.groupId, o + t.clientX - n);
|
|
1552
1520
|
}, { columnLayoutChanged: !0 });
|
|
1553
1521
|
}, c = () => {
|
|
1554
|
-
|
|
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);
|
|
1555
1527
|
};
|
|
1556
|
-
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);
|
|
1557
1529
|
},
|
|
1558
|
-
children: /* @__PURE__ */
|
|
1530
|
+
children: /* @__PURE__ */ M("span", { className: "comins-table__resize-line" })
|
|
1559
1531
|
})
|
|
1560
1532
|
]
|
|
1561
1533
|
}, `group-${e.groupId}`);
|
|
1562
|
-
let n = e.column, r =
|
|
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 = [
|
|
1563
1535
|
"comins-table__th px-3 py-2 text-left font-semibold",
|
|
1564
|
-
|
|
1536
|
+
Lt === n.id ? "comins-column-moving" : void 0,
|
|
1565
1537
|
o.className
|
|
1566
|
-
].filter(Boolean).join(" "), m =
|
|
1567
|
-
return /* @__PURE__ */
|
|
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
|
+
return /* @__PURE__ */ we("th", {
|
|
1568
1540
|
...o,
|
|
1569
1541
|
className: p,
|
|
1570
1542
|
colSpan: e.colSpan,
|
|
1571
|
-
"data-column-drop-target":
|
|
1572
|
-
"data-column-moving":
|
|
1543
|
+
"data-column-drop-target": Ut === n.id ? "true" : void 0,
|
|
1544
|
+
"data-column-moving": Lt === n.id ? "true" : void 0,
|
|
1573
1545
|
"data-column-placeholder": f ? "true" : void 0,
|
|
1574
1546
|
"data-comins-column-id": n.id,
|
|
1575
1547
|
"data-comins-column-index": i,
|
|
1576
|
-
"data-sort-count": s ?
|
|
1548
|
+
"data-sort-count": s ? Y.sortModel.length : void 0,
|
|
1577
1549
|
"data-sort-direction": s?.rule.direction,
|
|
1578
1550
|
"data-sort-priority": s?.priority,
|
|
1579
1551
|
"data-sortable": n.sort ? "true" : "false",
|
|
1580
1552
|
"data-testid": `header-${n.id}`,
|
|
1581
|
-
"aria-sort": n.sort ?
|
|
1553
|
+
"aria-sort": n.sort ? Dt(Y.sortModel, n.id) : void 0,
|
|
1582
1554
|
key: `column-${n.id}`,
|
|
1583
1555
|
onClick: (e) => {
|
|
1584
|
-
o.onClick?.(e), !(e.defaultPrevented || !n.sort) && (
|
|
1556
|
+
o.onClick?.(e), !(e.defaultPrevented || !n.sort) && (Jn(n.id) || Yn(n, e.shiftKey));
|
|
1585
1557
|
},
|
|
1586
1558
|
onKeyDown: (e) => {
|
|
1587
|
-
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));
|
|
1588
1560
|
},
|
|
1589
|
-
onPointerDown: (e) =>
|
|
1561
|
+
onPointerDown: (e) => $n(e, n),
|
|
1590
1562
|
rowSpan: e.rowSpan,
|
|
1591
1563
|
scope: "col",
|
|
1592
1564
|
style: {
|
|
@@ -1594,104 +1566,103 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1594
1566
|
...o.style
|
|
1595
1567
|
},
|
|
1596
1568
|
tabIndex: n.sort ? 0 : void 0
|
|
1597
|
-
}, /* @__PURE__ */
|
|
1569
|
+
}, /* @__PURE__ */ M("span", {
|
|
1598
1570
|
"aria-hidden": "true",
|
|
1599
1571
|
className: "comins-column-drop-marker"
|
|
1600
|
-
}), /* @__PURE__ */
|
|
1572
|
+
}), /* @__PURE__ */ N("span", {
|
|
1601
1573
|
className: "comins-table__header-content",
|
|
1602
1574
|
"data-comins-header-body": "true",
|
|
1603
|
-
"data-comins-header-components":
|
|
1575
|
+
"data-comins-header-components": v ? "true" : void 0,
|
|
1604
1576
|
"data-comins-sort-indicator-visible": l ? "true" : void 0,
|
|
1605
1577
|
children: [
|
|
1606
|
-
/* @__PURE__ */
|
|
1578
|
+
/* @__PURE__ */ M("span", {
|
|
1607
1579
|
className: "comins-table__header-slot",
|
|
1608
1580
|
"data-comins-header-slot": "left",
|
|
1609
1581
|
children: g
|
|
1610
1582
|
}),
|
|
1611
|
-
/* @__PURE__ */
|
|
1583
|
+
/* @__PURE__ */ M("span", {
|
|
1612
1584
|
className: "comins-table__header-label",
|
|
1613
1585
|
children: n.header?.renderer ? h : n.label
|
|
1614
1586
|
}),
|
|
1615
|
-
/* @__PURE__ */
|
|
1587
|
+
/* @__PURE__ */ N("span", {
|
|
1616
1588
|
className: "comins-sort-meta",
|
|
1617
1589
|
"data-sort-visible": l ? "true" : void 0,
|
|
1618
|
-
children: [/* @__PURE__ */
|
|
1590
|
+
children: [/* @__PURE__ */ M("span", {
|
|
1619
1591
|
"aria-hidden": "true",
|
|
1620
1592
|
className: "comins-sort-indicator",
|
|
1621
1593
|
"data-sort-state": c,
|
|
1622
1594
|
"data-sort-visible": l ? "true" : void 0,
|
|
1623
1595
|
"data-testid": `sort-indicator-${n.id}`,
|
|
1624
|
-
children: /* @__PURE__ */
|
|
1625
|
-
|
|
1626
|
-
focusable: "false",
|
|
1627
|
-
size: 14,
|
|
1628
|
-
strokeWidth: 2.25
|
|
1629
|
-
})
|
|
1630
|
-
}), u ? /* @__PURE__ */ A("span", {
|
|
1596
|
+
children: /* @__PURE__ */ M("span", { className: "comins-sort-icon" })
|
|
1597
|
+
}), u ? /* @__PURE__ */ M("span", {
|
|
1631
1598
|
"aria-hidden": "true",
|
|
1632
1599
|
className: "comins-sort-priority",
|
|
1633
1600
|
"data-testid": `sort-priority-${n.id}`,
|
|
1634
1601
|
children: s.priority
|
|
1635
1602
|
}) : null]
|
|
1636
1603
|
}),
|
|
1637
|
-
u ? /* @__PURE__ */
|
|
1604
|
+
u ? /* @__PURE__ */ M("span", {
|
|
1638
1605
|
className: "comins-table__sort-status",
|
|
1639
|
-
children: `Sorted ${s.rule.direction === "asc" ? "ascending" : "descending"}, priority ${s.priority} of ${
|
|
1606
|
+
children: `Sorted ${s.rule.direction === "asc" ? "ascending" : "descending"}, priority ${s.priority} of ${Y.sortModel.length}`
|
|
1640
1607
|
}) : null,
|
|
1641
|
-
/* @__PURE__ */
|
|
1608
|
+
/* @__PURE__ */ M("span", {
|
|
1642
1609
|
className: "comins-table__header-slot",
|
|
1643
1610
|
"data-comins-header-slot": "right",
|
|
1644
|
-
children:
|
|
1611
|
+
children: _
|
|
1645
1612
|
})
|
|
1646
1613
|
]
|
|
1647
|
-
}), /* @__PURE__ */
|
|
1614
|
+
}), /* @__PURE__ */ M("span", {
|
|
1648
1615
|
"aria-hidden": "true",
|
|
1649
1616
|
className: "comins-table__resize",
|
|
1650
|
-
"data-resizing":
|
|
1617
|
+
"data-resizing": Zt === n.id ? "true" : void 0,
|
|
1651
1618
|
"data-testid": `resize-${n.id}`,
|
|
1652
1619
|
onClick: (e) => e.stopPropagation(),
|
|
1653
1620
|
onPointerDown: (e) => {
|
|
1654
1621
|
e.preventDefault(), e.stopPropagation();
|
|
1655
1622
|
let t = e.clientX, r = e.currentTarget.closest("th")?.getBoundingClientRect().width, i = /* @__PURE__ */ new Map();
|
|
1656
|
-
for (let e of
|
|
1657
|
-
let t = Array.from(V.current?.querySelectorAll("[data-comins-column-id]") ?? []).find((t) => t.dataset.cominsColumnId === e.id)?.getBoundingClientRect().width, n =
|
|
1623
|
+
for (let e of Q) {
|
|
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;
|
|
1658
1625
|
i.set(e.id, t && Number.isFinite(t) ? t : n);
|
|
1659
1626
|
}
|
|
1660
1627
|
let o = i.get(n.id) ?? (r && Number.isFinite(r) ? r : a?.width ?? n.width ?? 160);
|
|
1661
|
-
|
|
1628
|
+
Qt(n.id);
|
|
1662
1629
|
let s = (e) => {
|
|
1663
|
-
|
|
1630
|
+
Z((r) => {
|
|
1664
1631
|
let a = r;
|
|
1665
|
-
for (let [e, t] of i) a =
|
|
1666
|
-
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));
|
|
1667
1634
|
}, { columnLayoutChanged: !0 });
|
|
1668
1635
|
}, c = () => {
|
|
1669
|
-
|
|
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);
|
|
1670
1641
|
};
|
|
1671
|
-
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);
|
|
1672
1643
|
},
|
|
1673
|
-
children: /* @__PURE__ */
|
|
1644
|
+
children: /* @__PURE__ */ M("span", { className: "comins-table__resize-line" })
|
|
1674
1645
|
}));
|
|
1675
|
-
},
|
|
1676
|
-
|
|
1677
|
-
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;
|
|
1678
1649
|
return Math.abs(e - t) > .5 ? t : e;
|
|
1679
1650
|
});
|
|
1680
|
-
},
|
|
1681
|
-
if (
|
|
1682
|
-
if (!
|
|
1683
|
-
e.scrollHeight - e.scrollTop - e.clientHeight <=
|
|
1651
|
+
}, gr = (e) => {
|
|
1652
|
+
if (x) {
|
|
1653
|
+
if (!Pe || et.current) return;
|
|
1654
|
+
e.scrollHeight - e.scrollTop - e.clientHeight <= ln && fn("scroll");
|
|
1684
1655
|
return;
|
|
1685
1656
|
}
|
|
1686
|
-
if (!
|
|
1687
|
-
let t = Math.max(0,
|
|
1657
|
+
if (!v || !h || pe || !Fe) return;
|
|
1658
|
+
let t = Math.max(0, y);
|
|
1688
1659
|
if (e.scrollHeight - e.scrollTop - e.clientHeight > t) return;
|
|
1689
|
-
let n =
|
|
1690
|
-
|
|
1691
|
-
},
|
|
1660
|
+
let n = X.current.rows.length;
|
|
1661
|
+
pt.current !== n && (pt.current = n, Fe());
|
|
1662
|
+
}, _r = (e) => {
|
|
1692
1663
|
let t = e.currentTarget;
|
|
1693
|
-
|
|
1694
|
-
|
|
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();
|
|
1695
1666
|
}));
|
|
1696
1667
|
let n = Math.max(0, t.scrollLeft);
|
|
1697
1668
|
if (V.current) {
|
|
@@ -1700,88 +1671,88 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1700
1671
|
}
|
|
1701
1672
|
Ge.current && (Ge.current.scrollLeft = n);
|
|
1702
1673
|
};
|
|
1703
|
-
return /* @__PURE__ */
|
|
1674
|
+
return /* @__PURE__ */ N("div", {
|
|
1704
1675
|
className: [
|
|
1705
1676
|
"comins-table comins-typography-base h-full w-full overflow-hidden",
|
|
1706
|
-
|
|
1707
|
-
|
|
1677
|
+
Sn,
|
|
1678
|
+
xn.className,
|
|
1708
1679
|
r
|
|
1709
1680
|
].filter(Boolean).join(" "),
|
|
1710
|
-
"aria-busy":
|
|
1711
|
-
"data-loading":
|
|
1712
|
-
"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,
|
|
1713
1684
|
style: {
|
|
1714
|
-
...
|
|
1715
|
-
...
|
|
1685
|
+
...xn.style,
|
|
1686
|
+
...Be
|
|
1716
1687
|
},
|
|
1717
1688
|
children: [
|
|
1718
|
-
|
|
1689
|
+
zn ? /* @__PURE__ */ M("div", {
|
|
1719
1690
|
className: "comins-table__header",
|
|
1720
1691
|
ref: V,
|
|
1721
|
-
children: /* @__PURE__ */
|
|
1692
|
+
children: /* @__PURE__ */ N("table", {
|
|
1722
1693
|
className: "comins-table__table comins-table__header-table min-w-full table-fixed",
|
|
1723
|
-
style: { width:
|
|
1724
|
-
children: [
|
|
1694
|
+
style: { width: En },
|
|
1695
|
+
children: [mr(), /* @__PURE__ */ M("thead", {
|
|
1725
1696
|
className: "comins-table__thead",
|
|
1726
|
-
children:
|
|
1697
|
+
children: mn.map((e, t) => /* @__PURE__ */ M("tr", { children: e.map((e, t) => pr(e, t)) }, `header-row-${t}`))
|
|
1727
1698
|
})]
|
|
1728
1699
|
})
|
|
1729
1700
|
}) : null,
|
|
1730
|
-
/* @__PURE__ */
|
|
1701
|
+
/* @__PURE__ */ N("div", {
|
|
1731
1702
|
className: "comins-table__body-viewport",
|
|
1732
|
-
"data-horizontal-overflow":
|
|
1733
|
-
"data-virtualized":
|
|
1703
|
+
"data-horizontal-overflow": Dn ? "true" : void 0,
|
|
1704
|
+
"data-virtualized": B ? "true" : void 0,
|
|
1734
1705
|
"data-testid": f,
|
|
1735
|
-
onScroll:
|
|
1736
|
-
ref:
|
|
1706
|
+
onScroll: _r,
|
|
1707
|
+
ref: We,
|
|
1737
1708
|
children: [
|
|
1738
|
-
/* @__PURE__ */
|
|
1739
|
-
className: ["comins-table__table comins-table__body-table min-w-full table-fixed",
|
|
1740
|
-
style:
|
|
1741
|
-
transform: `translate3d(0, ${
|
|
1742
|
-
width:
|
|
1743
|
-
} : { width:
|
|
1744
|
-
children: [
|
|
1745
|
-
|
|
1709
|
+
/* @__PURE__ */ N("table", {
|
|
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(" "),
|
|
1711
|
+
style: B ? {
|
|
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", {
|
|
1746
1717
|
"aria-hidden": "true",
|
|
1747
1718
|
className: "comins-table__tr comins-table__skeleton-row",
|
|
1748
1719
|
"data-comins-row-parity": t % 2 == 0 ? "even" : "odd",
|
|
1749
1720
|
"data-testid": "loading-skeleton-row",
|
|
1750
|
-
style: { height:
|
|
1751
|
-
children:
|
|
1721
|
+
style: { height: L },
|
|
1722
|
+
children: Q.length > 0 ? Q.map((e) => /* @__PURE__ */ M("td", {
|
|
1752
1723
|
className: "comins-table__td comins-table__skeleton-cell px-3 py-2",
|
|
1753
1724
|
"data-testid": `loading-skeleton-cell-${t}-${e.id}`,
|
|
1754
|
-
style: { height:
|
|
1755
|
-
children: /* @__PURE__ */
|
|
1756
|
-
}, e.id)) : /* @__PURE__ */
|
|
1725
|
+
style: { height: L },
|
|
1726
|
+
children: /* @__PURE__ */ M("span", { className: "comins-table__skeleton-block" })
|
|
1727
|
+
}, e.id)) : /* @__PURE__ */ M("td", {
|
|
1757
1728
|
className: "comins-table__td comins-table__skeleton-cell px-3 py-2",
|
|
1758
|
-
children: /* @__PURE__ */
|
|
1729
|
+
children: /* @__PURE__ */ M("span", { className: "comins-table__skeleton-block" })
|
|
1759
1730
|
})
|
|
1760
1731
|
}, `loading-skeleton-${t}`)) : null,
|
|
1761
|
-
|
|
1732
|
+
Nn ? /* @__PURE__ */ M("tr", {
|
|
1762
1733
|
className: "comins-table__tr comins-table__empty-state-row",
|
|
1763
|
-
style: { height:
|
|
1764
|
-
children: /* @__PURE__ */
|
|
1734
|
+
style: { height: L },
|
|
1735
|
+
children: /* @__PURE__ */ M("td", {
|
|
1765
1736
|
className: "comins-table__td comins-table__empty-state-cell",
|
|
1766
|
-
colSpan: Math.max(1,
|
|
1767
|
-
children: /* @__PURE__ */
|
|
1737
|
+
colSpan: Math.max(1, Q.length),
|
|
1738
|
+
children: /* @__PURE__ */ M("div", {
|
|
1768
1739
|
"data-testid": "data-table-empty-state",
|
|
1769
1740
|
className: "comins-table__empty-state",
|
|
1770
1741
|
children: p ?? "표시할 데이터가 없습니다."
|
|
1771
1742
|
})
|
|
1772
1743
|
})
|
|
1773
1744
|
}) : null,
|
|
1774
|
-
|
|
1775
|
-
let r =
|
|
1776
|
-
return /* @__PURE__ */
|
|
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", {
|
|
1777
1748
|
"aria-hidden": "true",
|
|
1778
1749
|
className: "comins-row-move-placeholder",
|
|
1779
|
-
children: /* @__PURE__ */
|
|
1780
|
-
colSpan: Math.max(1,
|
|
1750
|
+
children: /* @__PURE__ */ M("td", {
|
|
1751
|
+
colSpan: Math.max(1, Q.length),
|
|
1781
1752
|
"data-testid": "row-move-placeholder",
|
|
1782
1753
|
children: "이 위치로 이동"
|
|
1783
1754
|
})
|
|
1784
|
-
}) : null, /* @__PURE__ */
|
|
1755
|
+
}) : null, /* @__PURE__ */ M("tr", {
|
|
1785
1756
|
"aria-disabled": r.disabled ? "true" : void 0,
|
|
1786
1757
|
"aria-selected": i,
|
|
1787
1758
|
className: [
|
|
@@ -1803,71 +1774,71 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1803
1774
|
t.preventDefault();
|
|
1804
1775
|
return;
|
|
1805
1776
|
}
|
|
1806
|
-
t.__cominsCellSelectionHandled ||
|
|
1777
|
+
t.__cominsCellSelectionHandled || tr(t, e), Oe?.(nt(t, e));
|
|
1807
1778
|
},
|
|
1808
1779
|
onContextMenu: (t) => {
|
|
1809
1780
|
if (r.disabled) {
|
|
1810
1781
|
t.preventDefault();
|
|
1811
1782
|
return;
|
|
1812
1783
|
}
|
|
1813
|
-
|
|
1784
|
+
Z((t) => E(t, e.rowId)), K.current = e.rowId, F?.(nt(t, e));
|
|
1814
1785
|
},
|
|
1815
1786
|
onDoubleClick: (t) => {
|
|
1816
1787
|
if (r.disabled) {
|
|
1817
1788
|
t.preventDefault();
|
|
1818
1789
|
return;
|
|
1819
1790
|
}
|
|
1820
|
-
|
|
1791
|
+
je?.(nt(t, e));
|
|
1821
1792
|
},
|
|
1822
|
-
onKeyDown: (t) =>
|
|
1823
|
-
style:
|
|
1793
|
+
onKeyDown: (t) => nr(t, e, r.disabled),
|
|
1794
|
+
style: $e(L, r.style, o),
|
|
1824
1795
|
tabIndex: r.disabled ? -1 : 0,
|
|
1825
|
-
children:
|
|
1826
|
-
let o = g(
|
|
1796
|
+
children: Q.map((t, a) => {
|
|
1797
|
+
let o = g(Y, e.row, t.id), s = {
|
|
1827
1798
|
columnId: t.id,
|
|
1828
1799
|
rowId: e.rowId
|
|
1829
|
-
}, 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) => {
|
|
1830
1801
|
if (e.type !== "input") return e;
|
|
1831
1802
|
let t = e.onValueChange;
|
|
1832
1803
|
return {
|
|
1833
1804
|
...e,
|
|
1834
1805
|
onValueChange: (e) => {
|
|
1835
|
-
|
|
1806
|
+
Z((t) => Se(t, [{
|
|
1836
1807
|
id: e.row.id,
|
|
1837
|
-
patch: (t) =>
|
|
1808
|
+
patch: (t) => St(t, e.column.field, e.value)
|
|
1838
1809
|
}])), t?.(e);
|
|
1839
1810
|
}
|
|
1840
1811
|
};
|
|
1841
|
-
}),
|
|
1812
|
+
}), b = mt(y, u), x = t.cell?.renderer ? t.cell.renderer(u) : _ ? gt(v, y, u, {
|
|
1842
1813
|
interaction: p,
|
|
1843
1814
|
showContent: !1
|
|
1844
|
-
}) : /* @__PURE__ */
|
|
1815
|
+
}) : /* @__PURE__ */ M("span", {
|
|
1845
1816
|
className: "comins-table__cell-value",
|
|
1846
|
-
children:
|
|
1847
|
-
}),
|
|
1817
|
+
children: v
|
|
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", {
|
|
1848
1819
|
className: "comins-tree-cell-content",
|
|
1849
|
-
style: { "--comins-tree-depth":
|
|
1850
|
-
children: [
|
|
1851
|
-
"aria-expanded":
|
|
1852
|
-
"aria-label": `${
|
|
1820
|
+
style: { "--comins-tree-depth": S.depth },
|
|
1821
|
+
children: [S.hasChildren ? /* @__PURE__ */ M("button", {
|
|
1822
|
+
"aria-expanded": S.expanded,
|
|
1823
|
+
"aria-label": `${S.expanded ? "Collapse" : "Expand"} ${String(e.rowId)}`,
|
|
1853
1824
|
className: "comins-tree-expander",
|
|
1854
1825
|
"data-testid": `tree-expander-${String(e.rowId)}`,
|
|
1855
1826
|
onClick: (t) => {
|
|
1856
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1827
|
+
t.preventDefault(), t.stopPropagation(), z?.onToggle(e.rowId);
|
|
1857
1828
|
},
|
|
1858
1829
|
onMouseDown: (e) => e.stopPropagation(),
|
|
1859
1830
|
onPointerDown: (e) => e.stopPropagation(),
|
|
1860
1831
|
type: "button",
|
|
1861
|
-
children:
|
|
1862
|
-
}) : /* @__PURE__ */
|
|
1832
|
+
children: S.expanded ? "▾" : "▸"
|
|
1833
|
+
}) : /* @__PURE__ */ M("span", {
|
|
1863
1834
|
"aria-hidden": "true",
|
|
1864
1835
|
className: "comins-tree-expander-spacer"
|
|
1865
|
-
}), /* @__PURE__ */
|
|
1836
|
+
}), /* @__PURE__ */ M("span", {
|
|
1866
1837
|
className: "comins-tree-cell-value",
|
|
1867
|
-
children:
|
|
1838
|
+
children: x
|
|
1868
1839
|
})]
|
|
1869
|
-
}) :
|
|
1870
|
-
return /* @__PURE__ */
|
|
1840
|
+
}) : x;
|
|
1841
|
+
return /* @__PURE__ */ N("td", {
|
|
1871
1842
|
"aria-disabled": f ? "true" : void 0,
|
|
1872
1843
|
className: [
|
|
1873
1844
|
"comins-table__td px-3 py-2",
|
|
@@ -1877,138 +1848,142 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
1877
1848
|
].filter(Boolean).join(" "),
|
|
1878
1849
|
"data-disabled": f ? "true" : void 0,
|
|
1879
1850
|
"data-comins-cell-column-id": t.id,
|
|
1880
|
-
"data-comins-component-cell":
|
|
1851
|
+
"data-comins-component-cell": b.length > 0 ? "true" : void 0,
|
|
1881
1852
|
"data-comins-data-index": e.dataIndex,
|
|
1882
1853
|
"data-range-selected": c ? "true" : void 0,
|
|
1883
1854
|
"data-selected": l ? "true" : void 0,
|
|
1884
1855
|
"data-testid": `cell-${String(e.rowId)}-${t.id}`,
|
|
1885
1856
|
draggable: !1,
|
|
1886
1857
|
onClick: (r) => {
|
|
1887
|
-
if (
|
|
1858
|
+
if (Ee && r.stopPropagation(), f) {
|
|
1888
1859
|
r.preventDefault(), r.stopPropagation();
|
|
1889
1860
|
return;
|
|
1890
1861
|
}
|
|
1891
|
-
if (
|
|
1892
|
-
|
|
1862
|
+
if (q.current) {
|
|
1863
|
+
q.current = !1, r.__cominsCellSelectionHandled = !0;
|
|
1893
1864
|
return;
|
|
1894
1865
|
}
|
|
1895
|
-
let i = n ?
|
|
1866
|
+
let i = n ? Y.selection.cell ?? Je.current : null;
|
|
1896
1867
|
if (r.shiftKey && i) {
|
|
1897
|
-
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)), {
|
|
1898
1869
|
anchor: i,
|
|
1899
1870
|
focus: s
|
|
1900
|
-
})),
|
|
1871
|
+
})), K.current = e.rowId;
|
|
1901
1872
|
return;
|
|
1902
1873
|
}
|
|
1903
|
-
n && (
|
|
1904
|
-
let i =
|
|
1874
|
+
n && (Je.current = s), Z((t) => {
|
|
1875
|
+
let i = E(t, e.rowId, {
|
|
1905
1876
|
multi: r.ctrlKey || r.metaKey,
|
|
1906
1877
|
toggle: r.ctrlKey || r.metaKey
|
|
1907
1878
|
});
|
|
1908
|
-
return n ?
|
|
1909
|
-
}), 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));
|
|
1910
1881
|
},
|
|
1911
1882
|
onContextMenu: (r) => {
|
|
1912
1883
|
if (f) {
|
|
1913
1884
|
r.preventDefault(), r.stopPropagation();
|
|
1914
1885
|
return;
|
|
1915
1886
|
}
|
|
1916
|
-
|
|
1917
|
-
let r =
|
|
1918
|
-
return n ?
|
|
1919
|
-
}),
|
|
1887
|
+
Z((t) => {
|
|
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)));
|
|
1920
1891
|
},
|
|
1921
1892
|
onDoubleClick: (n) => {
|
|
1922
|
-
if (
|
|
1893
|
+
if (Ae && n.stopPropagation(), f) {
|
|
1923
1894
|
n.preventDefault(), n.stopPropagation();
|
|
1924
1895
|
return;
|
|
1925
1896
|
}
|
|
1926
|
-
|
|
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);
|
|
1927
1908
|
},
|
|
1928
|
-
onKeyDown: (n) => tr(n, e, t, a, s, f),
|
|
1929
|
-
onMouseDown: (e) => nr(e, s, f),
|
|
1930
|
-
onMouseOver: () => ir(s),
|
|
1931
|
-
onMouseUp: ar,
|
|
1932
|
-
onPointerDown: (e) => or(e, s, f),
|
|
1933
|
-
onPointerEnter: () => ir(s),
|
|
1934
1909
|
onPointerMove: (e) => {
|
|
1935
|
-
e.buttons === 1 &&
|
|
1910
|
+
e.buttons === 1 && or(s);
|
|
1936
1911
|
},
|
|
1937
|
-
onPointerUp:
|
|
1912
|
+
onPointerUp: sr,
|
|
1938
1913
|
style: {
|
|
1939
|
-
height:
|
|
1914
|
+
height: L,
|
|
1940
1915
|
...h
|
|
1941
1916
|
},
|
|
1942
|
-
title: typeof
|
|
1917
|
+
title: typeof ee == "string" ? ee : void 0,
|
|
1943
1918
|
tabIndex: f ? -1 : 0,
|
|
1944
|
-
children: [a === 0 && r.draggable ? /* @__PURE__ */
|
|
1919
|
+
children: [a === 0 && r.draggable ? /* @__PURE__ */ M("span", {
|
|
1945
1920
|
"aria-hidden": "true",
|
|
1946
1921
|
className: "comins-row-drag-handle",
|
|
1947
1922
|
"data-testid": `row-drag-handle-${String(e.rowId)}`,
|
|
1948
1923
|
draggable: !1,
|
|
1949
1924
|
onClick: (e) => e.stopPropagation(),
|
|
1950
1925
|
onMouseDown: (e) => e.stopPropagation(),
|
|
1951
|
-
onPointerDown: (t) =>
|
|
1952
|
-
}) : null,
|
|
1926
|
+
onPointerDown: (t) => lr(t, e, r.disabled, r.draggable)
|
|
1927
|
+
}) : null, w]
|
|
1953
1928
|
}, t.id);
|
|
1954
1929
|
})
|
|
1955
1930
|
}, s)] }, s);
|
|
1956
1931
|
}),
|
|
1957
|
-
|
|
1932
|
+
Pn ? /* @__PURE__ */ M("tr", {
|
|
1958
1933
|
className: "comins-table__tr comins-table__infinite-loading-row",
|
|
1959
|
-
style: { height:
|
|
1960
|
-
children: /* @__PURE__ */
|
|
1934
|
+
style: { height: L },
|
|
1935
|
+
children: /* @__PURE__ */ N("td", {
|
|
1961
1936
|
className: "comins-table__td comins-table__infinite-loading-cell",
|
|
1962
|
-
colSpan: Math.max(1,
|
|
1937
|
+
colSpan: Math.max(1, Q.length),
|
|
1963
1938
|
"data-testid": "data-table-infinite-loading-row",
|
|
1964
|
-
children: [/* @__PURE__ */
|
|
1939
|
+
children: [/* @__PURE__ */ M("span", {
|
|
1965
1940
|
className: "comins-table__loading-spinner",
|
|
1966
1941
|
"data-testid": "data-table-infinite-loading-spinner"
|
|
1967
|
-
}), /* @__PURE__ */
|
|
1942
|
+
}), /* @__PURE__ */ M("span", { children: "데이터를 불러오는 중입니다." })]
|
|
1968
1943
|
})
|
|
1969
1944
|
}) : null,
|
|
1970
|
-
|
|
1945
|
+
Rn > 0 ? /* @__PURE__ */ M("tr", {
|
|
1971
1946
|
"aria-hidden": "true",
|
|
1972
1947
|
className: "comins-table-empty-filler",
|
|
1973
|
-
children: /* @__PURE__ */
|
|
1974
|
-
colSpan: Math.max(1,
|
|
1948
|
+
children: /* @__PURE__ */ M("td", {
|
|
1949
|
+
colSpan: Math.max(1, Q.length),
|
|
1975
1950
|
"data-testid": "table-empty-filler",
|
|
1976
|
-
style: { height:
|
|
1951
|
+
style: { height: Rn }
|
|
1977
1952
|
})
|
|
1978
1953
|
}) : null
|
|
1979
1954
|
] })]
|
|
1980
1955
|
}),
|
|
1981
|
-
|
|
1956
|
+
B ? /* @__PURE__ */ M("div", {
|
|
1982
1957
|
"aria-hidden": "true",
|
|
1983
1958
|
className: "comins-table__body-virtual-sizer",
|
|
1984
1959
|
style: {
|
|
1985
|
-
height:
|
|
1986
|
-
width:
|
|
1960
|
+
height: bn.scrollHeight,
|
|
1961
|
+
width: En
|
|
1987
1962
|
}
|
|
1988
1963
|
}) : null,
|
|
1989
|
-
|
|
1964
|
+
kn && !jn ? /* @__PURE__ */ N("div", {
|
|
1990
1965
|
className: "comins-table__loading-overlay",
|
|
1991
1966
|
"data-testid": "data-table-loading-overlay",
|
|
1992
1967
|
role: "status",
|
|
1993
|
-
style:
|
|
1994
|
-
children: [/* @__PURE__ */
|
|
1968
|
+
style: tn > 0 ? { transform: `translateY(${tn}px)` } : void 0,
|
|
1969
|
+
children: [/* @__PURE__ */ M("span", {
|
|
1995
1970
|
className: "comins-table__loading-spinner",
|
|
1996
1971
|
"data-testid": "data-table-loading-spinner"
|
|
1997
|
-
}), /* @__PURE__ */
|
|
1972
|
+
}), /* @__PURE__ */ M("span", { children: ce ?? "불러오는 중입니다." })]
|
|
1998
1973
|
}) : null
|
|
1999
1974
|
]
|
|
2000
1975
|
}),
|
|
2001
|
-
|
|
1976
|
+
R ? /* @__PURE__ */ M("div", {
|
|
2002
1977
|
"aria-label": "Table summary",
|
|
2003
1978
|
className: "comins-table__summary",
|
|
2004
1979
|
ref: Ge,
|
|
2005
|
-
children: /* @__PURE__ */
|
|
1980
|
+
children: /* @__PURE__ */ N("table", {
|
|
2006
1981
|
className: "comins-table__table comins-table__summary-table min-w-full table-fixed",
|
|
2007
|
-
style: { width:
|
|
2008
|
-
children: [
|
|
2009
|
-
className: ["comins-table__summary-row",
|
|
2010
|
-
style:
|
|
2011
|
-
children:
|
|
1982
|
+
style: { width: En },
|
|
1983
|
+
children: [mr(), /* @__PURE__ */ M("tfoot", { children: /* @__PURE__ */ M("tr", {
|
|
1984
|
+
className: ["comins-table__summary-row", R.className].filter(Boolean).join(" "),
|
|
1985
|
+
style: R.style,
|
|
1986
|
+
children: gn.map((e) => /* @__PURE__ */ M("td", {
|
|
2012
1987
|
className: ["comins-table__summary-cell px-3 py-2", e.className].filter(Boolean).join(" "),
|
|
2013
1988
|
colSpan: e.colSpan,
|
|
2014
1989
|
"data-testid": `summary-cell-${e.column.id}`,
|
|
@@ -2018,56 +1993,56 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
|
|
|
2018
1993
|
}) })]
|
|
2019
1994
|
})
|
|
2020
1995
|
}) : null,
|
|
2021
|
-
|
|
1996
|
+
fr && Vt ? /* @__PURE__ */ M("div", {
|
|
2022
1997
|
"aria-hidden": "true",
|
|
2023
1998
|
className: "comins-column-move-ghost",
|
|
2024
1999
|
"data-testid": "column-move-ghost",
|
|
2025
2000
|
style: {
|
|
2026
|
-
left:
|
|
2027
|
-
top:
|
|
2001
|
+
left: Vt.x + 12,
|
|
2002
|
+
top: Vt.y + 12
|
|
2028
2003
|
},
|
|
2029
|
-
children:
|
|
2004
|
+
children: fr
|
|
2030
2005
|
}) : null
|
|
2031
2006
|
]
|
|
2032
2007
|
});
|
|
2033
2008
|
}
|
|
2034
|
-
function
|
|
2035
|
-
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), [
|
|
2036
2011
|
e,
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
]),
|
|
2012
|
+
v.columns,
|
|
2013
|
+
x
|
|
2014
|
+
]), C = k(() => Ke(S, n, { defaultExpandAll: b }), [
|
|
2040
2015
|
n,
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
]),
|
|
2044
|
-
entriesByRowId:
|
|
2016
|
+
b,
|
|
2017
|
+
S
|
|
2018
|
+
]), w = k(() => new Map(C.map((e) => [e.rowId, e])), [C]), te = k(() => ({
|
|
2019
|
+
entriesByRowId: w,
|
|
2045
2020
|
onExpand: (t) => {
|
|
2046
|
-
let r =
|
|
2021
|
+
let r = Pt(e, t, !0, n, b);
|
|
2047
2022
|
r !== e && d?.([...r]);
|
|
2048
2023
|
},
|
|
2049
2024
|
onFold: (t) => {
|
|
2050
|
-
let r =
|
|
2025
|
+
let r = Pt(e, t, !1, n, b);
|
|
2051
2026
|
r !== e && d?.([...r]);
|
|
2052
2027
|
},
|
|
2053
|
-
onToggle: (t) => d?.(
|
|
2054
|
-
summaryRows:
|
|
2028
|
+
onToggle: (t) => d?.(qe(e, t, n, { defaultExpandAll: b })),
|
|
2029
|
+
summaryRows: H(e)
|
|
2055
2030
|
}), [
|
|
2056
2031
|
e,
|
|
2057
|
-
|
|
2032
|
+
w,
|
|
2058
2033
|
n,
|
|
2059
|
-
|
|
2034
|
+
b,
|
|
2060
2035
|
d
|
|
2061
|
-
]),
|
|
2036
|
+
]), ne = (t) => {
|
|
2062
2037
|
let r = e;
|
|
2063
2038
|
t.forEach((e, t) => {
|
|
2064
|
-
let i =
|
|
2065
|
-
i && i.item !== e && (r =
|
|
2039
|
+
let i = C[t];
|
|
2040
|
+
i && i.item !== e && (r = U(r, i.rowId, n, () => e));
|
|
2066
2041
|
}), r !== e && d?.([...r]);
|
|
2067
2042
|
};
|
|
2068
|
-
return /* @__PURE__ */
|
|
2069
|
-
...
|
|
2070
|
-
data:
|
|
2043
|
+
return /* @__PURE__ */ M(Lt, {
|
|
2044
|
+
...v,
|
|
2045
|
+
data: C.map((e) => e.item),
|
|
2071
2046
|
getRowId: n,
|
|
2072
2047
|
hasMoreRows: !1,
|
|
2073
2048
|
infiniteScroll: !1,
|
|
@@ -2077,38 +2052,38 @@ function qt({ data: e, defaultExpandAll: t = !0, getRowId: n, hasMoreRows: r, in
|
|
|
2077
2052
|
lazyLoadMode: void 0,
|
|
2078
2053
|
lazyLoadThreshold: void 0,
|
|
2079
2054
|
loadingMore: !1,
|
|
2080
|
-
onChangeData:
|
|
2055
|
+
onChangeData: ne,
|
|
2081
2056
|
onChangeSort: f,
|
|
2082
2057
|
onChangeSortModel: (e) => {
|
|
2083
|
-
|
|
2058
|
+
ee(e), p?.(e);
|
|
2084
2059
|
},
|
|
2085
2060
|
onLazyLoad: void 0,
|
|
2086
2061
|
onLoadMore: void 0,
|
|
2087
2062
|
pagination: {
|
|
2088
2063
|
pageIndex: 0,
|
|
2089
|
-
pageSize: Math.max(1,
|
|
2064
|
+
pageSize: Math.max(1, C.length)
|
|
2090
2065
|
},
|
|
2091
2066
|
rowProps: {
|
|
2092
2067
|
...g,
|
|
2093
2068
|
draggable: !1
|
|
2094
2069
|
},
|
|
2095
2070
|
tree: !1,
|
|
2096
|
-
ref:
|
|
2097
|
-
treeContext:
|
|
2071
|
+
ref: y,
|
|
2072
|
+
treeContext: te
|
|
2098
2073
|
});
|
|
2099
2074
|
}
|
|
2100
|
-
var
|
|
2101
|
-
function
|
|
2102
|
-
return e.tree ? /* @__PURE__ */
|
|
2075
|
+
var Lt = Te(Ft), Rt = Te(It);
|
|
2076
|
+
function zt(e, t) {
|
|
2077
|
+
return e.tree ? /* @__PURE__ */ M(Rt, {
|
|
2103
2078
|
...e,
|
|
2104
2079
|
ref: t
|
|
2105
|
-
}) : /* @__PURE__ */
|
|
2080
|
+
}) : /* @__PURE__ */ M(Lt, {
|
|
2106
2081
|
...e,
|
|
2107
2082
|
ref: t
|
|
2108
2083
|
});
|
|
2109
2084
|
}
|
|
2110
|
-
var
|
|
2085
|
+
var Bt = Te(zt), Vt = "comins-table";
|
|
2111
2086
|
//#endregion
|
|
2112
|
-
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 };
|
|
2113
2088
|
|
|
2114
2089
|
//# sourceMappingURL=index.js.map
|