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