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