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