comins-table 0.1.4 → 0.1.6

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/dist/index.js CHANGED
@@ -1,92 +1,49 @@
1
- import { addCominsRows as e, applyCominsColumnLayout as t, clearCominsCellRange as n, clearCominsSelection as r, clearCominsSortState as i, copyCominsCell as a, copyCominsCellRange as o, copyCominsRow as s, createCominsTableState as c, deleteCominsRows as l, exportCominsRowsToCsv as u, exportCominsRowsToJson as d, fillCominsCellRange as f, formatCominsCellValue as p, getCominsCellClassName as m, getCominsCellStyle as h, getCominsCellValue as g, getCominsHeaderRows as ee, getCominsPageRows as _, getCominsSelectedCellRange as te, getCominsSortedRowIndexes as v, getCominsVirtualRows as y, getCominsVisibleColumns as ne, isCominsCellDisabled as b, isCominsCellInSelectedRange as x, isCominsCellSelected as S, isCominsRowSelected as re, moveCominsColumn as ie, moveCominsColumnGroup as C, moveCominsRow as w, pasteCominsCell as ae, pasteCominsCellRange as oe, pasteCominsRow as se, queryCominsRows as ce, replaceCominsRows as le, selectCell as ue, selectCellRange as de, selectRow as T, selectRows as fe, serializeCominsColumnLayout as pe, setCominsColumnGroupHidden as me, setCominsColumnGroupWidth as he, setCominsColumnHidden as ge, setCominsColumnWidth as _e, setCominsHeaderVisible as ve, setCominsPagination as ye, setCominsSortModel as be, setCominsSortState as xe, setCominsTableTheme as Se, sortCominsRows as Ce, updateCominsRows as we } from "./core.js";
2
- import { Fragment as Te, createContext as Ee, createElement as De, forwardRef as Oe, useContext as ke, useEffect as E, useId as Ae, useImperativeHandle as je, useLayoutEffect as Me, useMemo as D, useRef as O, useState as k } from "react";
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 ee, getCominsVisibleColumns as te, isCominsCellDisabled as ne, isCominsCellInSelectedRange as re, isCominsCellSelected as ie, isCominsRowSelected as x, moveCominsColumn as S, moveCominsColumnGroup as C, moveCominsRow as w, pasteCominsCell as ae, pasteCominsCellRange as T, pasteCominsRow as oe, queryCominsRows as se, replaceCominsRows as ce, selectCell as le, selectCellRange as ue, selectRow as de, selectRows as fe, serializeCominsColumnLayout as pe, setCominsColumnGroupHidden as me, setCominsColumnGroupWidth as he, setCominsColumnHidden as ge, setCominsColumnWidth as _e, setCominsHeaderVisible as ve, setCominsPagination as ye, setCominsSortModel as be, setCominsSortState as xe, setCominsTableTheme as Se, sortCominsRows as Ce, updateCominsRows as we } from "./core.js";
2
+ import * as Te from "react";
3
+ import { Fragment as Ee, createElement as De, forwardRef as Oe, isValidElement as ke, useEffect as E, useId as Ae, useImperativeHandle as je, useLayoutEffect as Me, useMemo as D, useRef as O, useState as k } from "react";
3
4
  import { jsx as A, jsxs as j } from "react/jsx-runtime";
4
- //#region node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs
5
- var Ne = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), Pe = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Fe = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), Ie = (e) => {
6
- let t = Fe(e);
7
- return t.charAt(0).toUpperCase() + t.slice(1);
8
- }, M = {
9
- xmlns: "http://www.w3.org/2000/svg",
10
- width: 24,
11
- height: 24,
12
- viewBox: "0 0 24 24",
13
- fill: "none",
14
- stroke: "currentColor",
15
- strokeWidth: 2,
16
- strokeLinecap: "round",
17
- strokeLinejoin: "round"
18
- }, Le = (e) => {
19
- for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
20
- return !1;
21
- }, Re = Ee({}), ze = () => ke(Re), N = Oe(({ color: e, size: t, strokeWidth: n, absoluteStrokeWidth: r, className: i = "", children: a, iconNode: o, ...s }, c) => {
22
- let { size: l = 24, strokeWidth: u = 2, absoluteStrokeWidth: d = !1, color: f = "currentColor", className: p = "" } = ze() ?? {}, m = r ?? d ? Number(n ?? u) * 24 / Number(t ?? l) : n ?? u;
23
- return De("svg", {
24
- ref: c,
25
- ...M,
26
- width: t ?? l ?? M.width,
27
- height: t ?? l ?? M.height,
28
- stroke: e ?? f,
29
- strokeWidth: m,
30
- className: Ne("lucide", p, i),
31
- ...!a && !Le(s) && { "aria-hidden": "true" },
32
- ...s
33
- }, [...o.map(([e, t]) => De(e, t)), ...Array.isArray(a) ? a : [a]]);
34
- }), Be = ((e, t) => {
35
- let n = Oe(({ className: n, ...r }, i) => De(N, {
36
- ref: i,
37
- iconNode: t,
38
- className: Ne(`lucide-${Pe(Ie(e))}`, `lucide-${e}`, n),
39
- ...r
40
- }));
41
- return n.displayName = Ie(e), n;
42
- })("arrow-up", [["path", {
43
- d: "m5 12 7-7 7 7",
44
- key: "hav0vg"
45
- }], ["path", {
46
- d: "M12 19V5",
47
- key: "x0mq9r"
48
- }]]);
49
- function Ve({ clientX: e, clientY: t, startX: n, startY: r }) {
5
+ import { CaretSortIcon as Ne, ChevronRightIcon as Pe, DragHandleDots2Icon as Fe, ThickArrowDownIcon as Ie, ThickArrowUpIcon as Le } from "@radix-ui/react-icons";
6
+ function Re({ clientX: e, clientY: t, startX: n, startY: r }) {
50
7
  let i = Math.abs(e - n), a = Math.abs(t - r);
51
8
  return i >= 6 && i > a ? "activate" : a >= 6 && a >= i ? "cancel" : "pending";
52
9
  }
53
10
  //#endregion
54
11
  //#region src/component-renderer.tsx
55
- function P(...e) {
12
+ function M(...e) {
56
13
  return e.filter(Boolean).join(" ");
57
14
  }
58
- function F(e, t) {
15
+ function N(e, t) {
59
16
  return typeof e == "function" ? e(t) : e ?? {};
60
17
  }
61
- function He(e, t) {
18
+ function ze(e, t) {
62
19
  return typeof e == "function" ? e(t) : e;
63
20
  }
64
- function Ue(e, t) {
21
+ function Be(e, t) {
65
22
  return typeof e == "function" ? e(t) : e;
66
23
  }
67
- function I(e, t) {
24
+ function Ve(e, t) {
68
25
  return typeof e == "function" ? e(t) : e;
69
26
  }
70
- function We(e) {
71
- return typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map(We).join(" ") : "";
27
+ function He(e) {
28
+ return typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map(He).join(" ") : "";
72
29
  }
73
- function L(e) {
30
+ function Ue(e) {
74
31
  return e.type !== "divider" && e.type !== "label";
75
32
  }
76
- function R(e, t) {
33
+ function We(e, t) {
77
34
  return !!(e && t instanceof Node && e.contains(t));
78
35
  }
79
- function z(e) {
36
+ function P(e) {
80
37
  e.stopPropagation();
81
38
  }
82
- function B(e) {
39
+ function F(e) {
83
40
  e.preventDefault(), e.stopPropagation();
84
41
  }
85
42
  function Ge(e) {
86
43
  return e == null ? "" : String(e);
87
44
  }
88
- function V({ component: e, payload: t }) {
89
- let n = F(e.props, t), { defaultValue: r, onBlur: i, onChange: a, onClick: o, onKeyDown: s, onMouseDown: c, onPointerDown: l, value: u, ...d } = n, f = Ge(u ?? r), [p, m] = k(f), h = O(f);
45
+ function Ke({ component: e, payload: t }) {
46
+ let n = N(e.props, t), { defaultValue: r, onBlur: i, onChange: a, onClick: o, onKeyDown: s, onMouseDown: c, onPointerDown: l, value: u, ...d } = n, f = Ge(u ?? r), [p, m] = k(f), h = O(f);
90
47
  E(() => {
91
48
  m(f), h.current = f;
92
49
  }, [f]);
@@ -102,53 +59,53 @@ function V({ component: e, payload: t }) {
102
59
  };
103
60
  return /* @__PURE__ */ A("input", {
104
61
  ...d,
105
- className: P("comins-table__component", "comins-table__component-input", n.className),
62
+ className: M("comins-table__component", "comins-table__component-input", n.className),
106
63
  onBlur: (e) => {
107
- i?.(e), z(e), g(e);
64
+ i?.(e), P(e), g(e);
108
65
  },
109
66
  onChange: (e) => {
110
- z(e), m(e.currentTarget.value);
67
+ P(e), m(e.currentTarget.value);
111
68
  },
112
69
  onClick: (e) => {
113
- o?.(e), z(e);
70
+ o?.(e), P(e);
114
71
  },
115
72
  onKeyDown: (e) => {
116
- s?.(e), z(e), e.key === "Enter" && (e.preventDefault(), g(e), e.currentTarget.blur());
73
+ s?.(e), P(e), e.key === "Enter" && (e.preventDefault(), g(e), e.currentTarget.blur());
117
74
  },
118
75
  onMouseDown: (e) => {
119
- c?.(e), z(e);
76
+ c?.(e), P(e);
120
77
  },
121
78
  onPointerDown: (e) => {
122
- l?.(e), z(e);
79
+ l?.(e), P(e);
123
80
  },
124
81
  value: p
125
82
  });
126
83
  }
127
- function Ke({ component: e, payload: t }) {
128
- let n = F(e.props, t), { checked: r, defaultChecked: i, onChange: a, onClick: o, onKeyDown: s, onMouseDown: c, onPointerDown: l, style: u, ...d } = n, [f, p] = k(!!(r ?? i));
84
+ function qe({ component: e, payload: t }) {
85
+ let n = N(e.props, t), { checked: r, defaultChecked: i, onChange: a, onClick: o, onKeyDown: s, onMouseDown: c, onPointerDown: l, style: u, ...d } = n, [f, p] = k(!!(r ?? i));
129
86
  return E(() => {
130
87
  r !== void 0 && p(!!r);
131
88
  }, [r]), /* @__PURE__ */ A("input", {
132
89
  ...d,
133
90
  checked: f,
134
- className: P("comins-table__component", "comins-table__component-checkbox", n.className),
91
+ className: M("comins-table__component", "comins-table__component-checkbox", n.className),
135
92
  onClick: (e) => {
136
- o?.(e), z(e);
93
+ o?.(e), P(e);
137
94
  },
138
95
  onChange: (n) => {
139
- a?.(n), z(n), p(n.currentTarget.checked), e.onCheckedChange?.({
96
+ a?.(n), P(n), p(n.currentTarget.checked), e.onCheckedChange?.({
140
97
  ...t,
141
98
  checked: n.currentTarget.checked
142
99
  });
143
100
  },
144
101
  onKeyDown: (e) => {
145
- s?.(e), z(e);
102
+ s?.(e), P(e);
146
103
  },
147
104
  onMouseDown: (e) => {
148
- c?.(e), z(e);
105
+ c?.(e), P(e);
149
106
  },
150
107
  onPointerDown: (e) => {
151
- l?.(e), z(e);
108
+ l?.(e), P(e);
152
109
  },
153
110
  style: {
154
111
  height: 20,
@@ -158,8 +115,8 @@ function Ke({ component: e, payload: t }) {
158
115
  type: "checkbox"
159
116
  });
160
117
  }
161
- function qe({ component: e, payload: t }) {
162
- let { checked: n, ...r } = F(e.props, t), { onClick: i, onKeyDown: a, onMouseDown: o, onPointerDown: s, ...c } = r, [l, u] = k(!!n);
118
+ function Je({ component: e, payload: t }) {
119
+ let { checked: n, ...r } = N(e.props, t), { onClick: i, onKeyDown: a, onMouseDown: o, onPointerDown: s, ...c } = r, [l, u] = k(!!n);
163
120
  E(() => {
164
121
  n !== void 0 && u(!!n);
165
122
  }, [n]);
@@ -167,9 +124,9 @@ function qe({ component: e, payload: t }) {
167
124
  return /* @__PURE__ */ A("button", {
168
125
  ...c,
169
126
  "aria-pressed": l,
170
- className: P("comins-table__component", "comins-table__component-toggle", r.className),
127
+ className: M("comins-table__component", "comins-table__component-toggle", r.className),
171
128
  onClick: (n) => {
172
- i?.(n), z(n);
129
+ i?.(n), P(n);
173
130
  let r = !l;
174
131
  u(r), e.onCheckedChange?.({
175
132
  ...t,
@@ -177,24 +134,24 @@ function qe({ component: e, payload: t }) {
177
134
  });
178
135
  },
179
136
  onKeyDown: (e) => {
180
- a?.(e), z(e);
137
+ a?.(e), P(e);
181
138
  },
182
139
  onMouseDown: (e) => {
183
- o?.(e), z(e);
140
+ o?.(e), P(e);
184
141
  },
185
142
  onPointerDown: (e) => {
186
- s?.(e), z(e);
143
+ s?.(e), P(e);
187
144
  },
188
145
  type: r.type ?? "button",
189
146
  children: d
190
147
  });
191
148
  }
192
- function Je({ component: e, payload: t }) {
149
+ function Ye({ component: e, payload: t }) {
193
150
  let [n, r] = k(!1), i = Ae(), a = O(null), o = O(null), [s, c] = k({
194
151
  left: 0,
195
152
  position: "fixed",
196
153
  top: 0
197
- }), l = F(e.props, t), u = D(() => Ue(e.items, t), [e.items, t]), d = () => {
154
+ }), l = N(e.props, t), u = D(() => Be(e.items, t), [e.items, t]), d = () => {
198
155
  let e = a.current;
199
156
  if (!e || typeof window > "u") return;
200
157
  let t = e.getBoundingClientRect(), n = Math.max(o.current?.offsetWidth ?? 136, 136);
@@ -218,7 +175,7 @@ function Je({ component: e, payload: t }) {
218
175
  E(() => {
219
176
  if (!n) return;
220
177
  let e = (e) => {
221
- R(a.current, e.target) || R(o.current, e.target) || f(!1, e);
178
+ We(a.current, e.target) || We(o.current, e.target) || f(!1, e);
222
179
  }, t = (e) => {
223
180
  e.key === "Escape" && (f(!1, e), a.current?.focus());
224
181
  };
@@ -249,16 +206,16 @@ function Je({ component: e, payload: t }) {
249
206
  className: "comins-table__component-menu-item",
250
207
  disabled: n.disabled,
251
208
  onClick: (r) => {
252
- B(r), !(n.disabled || !L(n)) && (f(!1, r), e.onSelect?.({
209
+ F(r), !(n.disabled || !Ue(n)) && (f(!1, r), e.onSelect?.({
253
210
  ...t,
254
211
  event: r,
255
212
  item: n,
256
213
  value: n.value
257
214
  }));
258
215
  },
259
- onKeyDown: z,
260
- onMouseDown: z,
261
- onPointerDown: z,
216
+ onKeyDown: P,
217
+ onMouseDown: P,
218
+ onPointerDown: P,
262
219
  role: "menuitem",
263
220
  type: "button",
264
221
  children: n.label
@@ -272,20 +229,20 @@ function Je({ component: e, payload: t }) {
272
229
  "aria-expanded": n,
273
230
  "aria-haspopup": "menu",
274
231
  "aria-label": l["aria-label"] ?? "Header menu",
275
- className: P("comins-table__component-menu-trigger", l.className),
232
+ className: M("comins-table__component-menu-trigger", l.className),
276
233
  onClick: (e) => {
277
- B(e), f(!n, e);
234
+ F(e), f(!n, e);
278
235
  },
279
236
  onKeyDown: (e) => {
280
237
  if (l.onKeyDown?.(e), e.key === "Escape" && n) {
281
- B(e), f(!1, e);
238
+ F(e), f(!1, e);
282
239
  return;
283
240
  }
284
- z(e);
241
+ P(e);
285
242
  },
286
- onMouseDown: z,
243
+ onMouseDown: P,
287
244
  onPointerDown: (e) => {
288
- l.onPointerDown?.(e), z(e);
245
+ l.onPointerDown?.(e), P(e);
289
246
  },
290
247
  ref: a,
291
248
  type: l.type ?? "button",
@@ -293,28 +250,28 @@ function Je({ component: e, payload: t }) {
293
250
  }), p]
294
251
  });
295
252
  }
296
- function H({ component: e, interaction: t, payload: n }) {
297
- let { height: r, itemHeight: i, limit: a, more: o = !1, searchable: s = !1, style: c, ...l } = F(e.props, n), u = D(() => I(e.items, n), [e.items, n]), d = Math.max(1, Number(a ?? 5)), f = Math.max(1, Number(i ?? 28)), p = f * 5, m = r !== void 0 || c?.height !== void 0, [h, g] = k(""), [ee, _] = k(!1), [te, v] = k(0), [y, ne] = k(null), [b, x] = k(p), S = O(null), re = n.row.selected && n.selection.selectedRowCount === 1, ie = !!(s && re), C = ie ? h : "";
253
+ function Xe({ component: e, interaction: t, payload: n }) {
254
+ let { height: r, itemHeight: i, limit: a, more: o = !1, searchable: s = !1, style: c, ...l } = N(e.props, n), u = D(() => Ve(e.items, n), [e.items, n]), d = Math.max(1, Number(a ?? 5)), f = Math.max(1, Number(i ?? 28)), p = f * 5, m = r !== void 0 || c?.height !== void 0, [h, g] = k(""), [_, v] = k(!1), [y, b] = k(0), [ee, te] = k(null), [ne, re] = k(p), ie = O(null), x = n.row.selected && n.selection.selectedRowCount === 1, S = !!(s && x), C = S ? h : "";
298
255
  E(() => {
299
- _(!1), v(0);
256
+ v(!1), b(0);
300
257
  }, [u.length, d]), Me(() => {
301
- let e = S.current;
258
+ let e = ie.current;
302
259
  if (!e) return;
303
260
  let t = e.clientHeight > 0 ? e.clientHeight : p;
304
- x(m ? t : Math.min(t, p));
261
+ re(m ? t : Math.min(t, p));
305
262
  }, [
306
263
  p,
307
- ee,
264
+ _,
308
265
  C,
309
266
  m
310
267
  ]), E(() => {
311
- let e = S.current;
312
- e && (e.scrollTop = 0, v(0));
268
+ let e = ie.current;
269
+ e && (e.scrollTop = 0, b(0));
313
270
  }, [C]), E(() => {
314
- if (re) return;
315
- let e = S.current;
316
- e && (e.scrollTop = 0), _(!1), g(""), v(0);
317
- }, [re]);
271
+ if (x) return;
272
+ let e = ie.current;
273
+ e && (e.scrollTop = 0), v(!1), g(""), b(0);
274
+ }, [x]);
318
275
  let w = D(() => {
319
276
  let t = C.trim().toLowerCase();
320
277
  return u.map((e, t) => ({
@@ -324,12 +281,12 @@ function H({ component: e, interaction: t, payload: n }) {
324
281
  item: n,
325
282
  itemIndex: r,
326
283
  value: C
327
- }) : We(n.label).toLowerCase().includes(t) : !0);
284
+ }) : He(n.label).toLowerCase().includes(t) : !0);
328
285
  }, [
329
286
  C,
330
287
  e,
331
288
  u
332
- ]), ae = w.length > d, oe = !!(re && (ee || C.trim().length > 0 || !o && ae)), se = ae && !oe, ce = ie && !ee ? 0 : 2, le = Math.max(f, m ? b || p : Math.min(b || p, p)), ue = Math.max(0, Math.floor(Math.max(0, te) / f) - ce), de = Math.min(w.length, Math.ceil((Math.max(0, te) + le) / f) + ce), T = oe ? w.slice(ue, de) : w.slice(0, ae ? d : w.length), fe = oe ? ue * f : 0, pe = oe ? Math.max(0, w.length - de) * f : 0, me = `${String(n.row.id)}-${n.column.id}`, he = {
289
+ ]), ae = w.length > d, T = !!(x && (_ || C.trim().length > 0 || !o && ae)), oe = ae && !T, se = S && !_ ? 0 : 2, ce = Math.max(f, m ? ne || p : Math.min(ne || p, p)), le = Math.max(0, Math.floor(Math.max(0, y) / f) - se), ue = Math.min(w.length, Math.ceil((Math.max(0, y) + ce) / f) + se), de = T ? w.slice(le, ue) : w.slice(0, ae ? d : w.length), fe = T ? le * f : 0, pe = T ? Math.max(0, w.length - ue) * f : 0, me = `${String(n.row.id)}-${n.column.id}`, he = {
333
290
  ...c,
334
291
  "--comins-table-virtual-list-item-height": `${f}px`,
335
292
  height: r ?? c?.height ?? p
@@ -337,7 +294,7 @@ function H({ component: e, interaction: t, payload: n }) {
337
294
  r.disabled || t?.requestRowSelection?.({
338
295
  event: a,
339
296
  mode: "row-click"
340
- }) !== !1 && (ne(r.value), e.onClickItem?.({
297
+ }) !== !1 && (te(r.value), e.onClickItem?.({
341
298
  ...n,
342
299
  event: a,
343
300
  item: r,
@@ -348,50 +305,50 @@ function H({ component: e, interaction: t, payload: n }) {
348
305
  return /* @__PURE__ */ j("div", {
349
306
  ...l,
350
307
  "aria-label": l["aria-label"] ?? "Virtual list",
351
- className: P("comins-table__component", "comins-table__component-virtual-list", l.className),
352
- "data-comins-virtual-list-expanded": oe ? "true" : void 0,
353
- "data-comins-virtual-list-visible-count": T.length,
308
+ className: M("comins-table__component", "comins-table__component-virtual-list", l.className),
309
+ "data-comins-virtual-list-expanded": T ? "true" : void 0,
310
+ "data-comins-virtual-list-visible-count": de.length,
354
311
  "data-testid": `virtual-list-${me}`,
355
312
  onClick: (e) => {
356
- l.onClick?.(e), z(e);
313
+ l.onClick?.(e), P(e);
357
314
  },
358
- onKeyDown: z,
359
- onMouseDown: z,
360
- onContextMenu: z,
361
- onDoubleClick: z,
362
- onMouseUp: z,
363
- onPointerUp: z,
364
- onPointerMove: z,
365
- onPointerEnter: z,
366
- onMouseOver: z,
367
- onMouseOut: z,
368
- onPointerLeave: z,
369
- onBlur: z,
370
- onFocus: z,
371
- onInput: z,
372
- onChange: z,
373
- onMouseMove: z,
374
- onMouseEnter: z,
375
- onMouseLeave: z,
376
- onTouchStart: z,
377
- onTouchMove: z,
378
- onTouchEnd: z,
315
+ onKeyDown: P,
316
+ onMouseDown: P,
317
+ onContextMenu: P,
318
+ onDoubleClick: P,
319
+ onMouseUp: P,
320
+ onPointerUp: P,
321
+ onPointerMove: P,
322
+ onPointerEnter: P,
323
+ onMouseOver: P,
324
+ onMouseOut: P,
325
+ onPointerLeave: P,
326
+ onBlur: P,
327
+ onFocus: P,
328
+ onInput: P,
329
+ onChange: P,
330
+ onMouseMove: P,
331
+ onMouseEnter: P,
332
+ onMouseLeave: P,
333
+ onTouchStart: P,
334
+ onTouchMove: P,
335
+ onTouchEnd: P,
379
336
  onWheel: (e) => {
380
- l.onWheel?.(e), z(e);
337
+ l.onWheel?.(e), P(e);
381
338
  },
382
339
  onPointerDown: (e) => {
383
- l.onPointerDown?.(e), z(e);
340
+ l.onPointerDown?.(e), P(e);
384
341
  },
385
342
  role: "listbox",
386
343
  style: he,
387
344
  children: [/* @__PURE__ */ j("div", {
388
345
  className: "comins-table__component-virtual-list-items",
389
346
  onScroll: (e) => {
390
- z(e), v(e.currentTarget.scrollTop);
347
+ P(e), b(e.currentTarget.scrollTop);
391
348
  let t = e.currentTarget.clientHeight > 0 ? e.currentTarget.clientHeight : p;
392
- x(m ? t : Math.min(t, p));
349
+ re(m ? t : Math.min(t, p));
393
350
  },
394
- ref: S,
351
+ ref: ie,
395
352
  role: "presentation",
396
353
  children: [
397
354
  fe > 0 ? /* @__PURE__ */ A("span", {
@@ -399,16 +356,16 @@ function H({ component: e, interaction: t, payload: n }) {
399
356
  className: "comins-table__component-virtual-list-spacer",
400
357
  style: { height: fe }
401
358
  }) : null,
402
- T.map(({ item: t, itemIndex: r }) => /* @__PURE__ */ A("button", {
403
- "aria-selected": y === t.value,
359
+ de.map(({ item: t, itemIndex: r }) => /* @__PURE__ */ A("button", {
360
+ "aria-selected": ee === t.value,
404
361
  className: "comins-table__component-virtual-list-item",
405
362
  "data-comins-virtual-list-item": "true",
406
363
  disabled: t.disabled,
407
364
  onClick: (e) => {
408
- B(e), ge(t, r, e);
365
+ F(e), ge(t, r, e);
409
366
  },
410
367
  onContextMenu: (i) => {
411
- z(i), !t.disabled && e.onContextMenuItem?.({
368
+ P(i), !t.disabled && e.onContextMenuItem?.({
412
369
  ...n,
413
370
  event: i,
414
371
  item: t,
@@ -417,10 +374,10 @@ function H({ component: e, interaction: t, payload: n }) {
417
374
  });
418
375
  },
419
376
  onKeyDown: (e) => {
420
- z(e), (e.key === "Enter" || e.key === " " || e.key === "Spacebar") && (e.preventDefault(), ge(t, r, e));
377
+ P(e), (e.key === "Enter" || e.key === " " || e.key === "Spacebar") && (e.preventDefault(), ge(t, r, e));
421
378
  },
422
- onMouseDown: z,
423
- onPointerDown: z,
379
+ onMouseDown: P,
380
+ onPointerDown: P,
424
381
  role: "option",
425
382
  type: "button",
426
383
  children: /* @__PURE__ */ A("span", {
@@ -437,106 +394,106 @@ function H({ component: e, interaction: t, payload: n }) {
437
394
  }), /* @__PURE__ */ j("div", {
438
395
  className: "comins-table__component-virtual-list-controls",
439
396
  children: [o && ae ? /* @__PURE__ */ A("button", {
440
- "aria-expanded": oe,
397
+ "aria-expanded": T,
441
398
  "aria-label": "전체 목록 보기",
442
399
  className: "comins-table__component-virtual-list-overflow comins-table__component-virtual-list-more",
443
400
  "data-testid": `virtual-list-overflow-${me}`,
444
401
  onClick: (e) => {
445
- B(e), t?.requestRowSelection?.({
402
+ F(e), t?.requestRowSelection?.({
446
403
  event: e,
447
404
  mode: "exclusive"
448
- }) !== !1 && _(!0);
405
+ }) !== !1 && v(!0);
449
406
  },
450
- onKeyDown: z,
451
- onMouseDown: z,
452
- onPointerDown: z,
407
+ onKeyDown: P,
408
+ onMouseDown: P,
409
+ onPointerDown: P,
453
410
  type: "button",
454
411
  children: "..."
455
- }) : se ? /* @__PURE__ */ A("span", {
412
+ }) : oe ? /* @__PURE__ */ A("span", {
456
413
  "aria-hidden": "true",
457
414
  className: "comins-table__component-virtual-list-overflow comins-table__component-virtual-list-more",
458
415
  "data-testid": `virtual-list-overflow-${me}`,
459
416
  children: "..."
460
- }) : null, ie ? /* @__PURE__ */ A("input", {
417
+ }) : null, S ? /* @__PURE__ */ A("input", {
461
418
  "aria-label": `${l["aria-label"] ?? "Virtual list"} 검색`,
462
419
  className: "comins-table__component-virtual-list-search",
463
420
  "data-testid": `virtual-list-search-${me}`,
464
421
  onChange: (e) => {
465
- z(e), g(e.currentTarget.value);
422
+ P(e), g(e.currentTarget.value);
466
423
  },
467
- onClick: z,
468
- onKeyDown: z,
469
- onMouseDown: z,
470
- onPointerDown: z,
424
+ onClick: P,
425
+ onKeyDown: P,
426
+ onMouseDown: P,
427
+ onPointerDown: P,
471
428
  placeholder: "검색",
472
429
  value: h
473
430
  }) : null]
474
431
  })]
475
432
  });
476
433
  }
477
- function Ye(e, t, n) {
478
- if (e.type === "menu") return /* @__PURE__ */ A(Je, {
434
+ function Ze(e, t, n) {
435
+ if (e.type === "menu") return /* @__PURE__ */ A(Ye, {
479
436
  component: e,
480
437
  payload: t
481
438
  });
482
- if (e.type === "virtual-list") return /* @__PURE__ */ A(H, {
439
+ if (e.type === "virtual-list") return /* @__PURE__ */ A(Xe, {
483
440
  component: e,
484
441
  interaction: n,
485
442
  payload: t
486
443
  });
487
444
  if (e.type === "button") {
488
- let n = F(e.props, t), { onClick: r, onKeyDown: i, onMouseDown: a, onPointerDown: o, ...s } = n;
445
+ let n = N(e.props, t), { onClick: r, onKeyDown: i, onMouseDown: a, onPointerDown: o, ...s } = n;
489
446
  return /* @__PURE__ */ A("button", {
490
447
  ...s,
491
- className: P("comins-table__component", "comins-table__component-button", n.className),
448
+ className: M("comins-table__component", "comins-table__component-button", n.className),
492
449
  onClick: (n) => {
493
- r?.(n), z(n), e.onClick?.({
450
+ r?.(n), P(n), e.onClick?.({
494
451
  ...t,
495
452
  event: n
496
453
  });
497
454
  },
498
455
  onKeyDown: (e) => {
499
- i?.(e), z(e);
456
+ i?.(e), P(e);
500
457
  },
501
458
  onMouseDown: (e) => {
502
- a?.(e), z(e);
459
+ a?.(e), P(e);
503
460
  },
504
461
  onPointerDown: (e) => {
505
- o?.(e), z(e);
462
+ o?.(e), P(e);
506
463
  },
507
464
  type: n.type ?? "button"
508
465
  });
509
466
  }
510
- if (e.type === "input") return /* @__PURE__ */ A(V, {
467
+ if (e.type === "input") return /* @__PURE__ */ A(Ke, {
511
468
  component: e,
512
469
  payload: t
513
470
  });
514
- if (e.type === "checkbox") return /* @__PURE__ */ A(Ke, {
471
+ if (e.type === "checkbox") return /* @__PURE__ */ A(qe, {
515
472
  component: e,
516
473
  payload: t
517
474
  });
518
475
  if (e.type === "select") {
519
- let n = F(e.props, t), r = He(e.options, t), { onChange: i, onClick: a, onKeyDown: o, onMouseDown: s, onPointerDown: c, ...l } = n;
476
+ let n = N(e.props, t), r = ze(e.options, t), { onChange: i, onClick: a, onKeyDown: o, onMouseDown: s, onPointerDown: c, ...l } = n;
520
477
  return /* @__PURE__ */ A("select", {
521
478
  ...l,
522
- className: P("comins-table__component", "comins-table__component-select", n.className),
479
+ className: M("comins-table__component", "comins-table__component-select", n.className),
523
480
  onClick: (e) => {
524
- a?.(e), z(e);
481
+ a?.(e), P(e);
525
482
  },
526
483
  onChange: (n) => {
527
- i?.(n), z(n), e.onValueChange?.({
484
+ i?.(n), P(n), e.onValueChange?.({
528
485
  ...t,
529
486
  value: n.currentTarget.value
530
487
  });
531
488
  },
532
489
  onKeyDown: (e) => {
533
- o?.(e), z(e);
490
+ o?.(e), P(e);
534
491
  },
535
492
  onMouseDown: (e) => {
536
- s?.(e), z(e);
493
+ s?.(e), P(e);
537
494
  },
538
495
  onPointerDown: (e) => {
539
- c?.(e), z(e);
496
+ c?.(e), P(e);
540
497
  },
541
498
  children: r.map((e) => /* @__PURE__ */ A("option", {
542
499
  disabled: e.disabled,
@@ -546,40 +503,40 @@ function Ye(e, t, n) {
546
503
  });
547
504
  }
548
505
  if (e.type === "radio") {
549
- let n = F(e.props, t), r = He(e.options, t), i = n.value ?? ("value" in t ? t.value : void 0), a = "row" in t ? `${t.column.id}-${String(t.row.id)}-radio` : `${t.column.id}-header-radio`, { value: o, ...s } = n;
506
+ let n = N(e.props, t), r = ze(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
507
  return /* @__PURE__ */ A("div", {
551
508
  ...s,
552
- className: P("comins-table__component", "comins-table__component-radio", s.className),
509
+ className: M("comins-table__component", "comins-table__component-radio", s.className),
553
510
  onClick: (e) => {
554
- s.onClick?.(e), z(e);
511
+ s.onClick?.(e), P(e);
555
512
  },
556
513
  onKeyDown: (e) => {
557
- s.onKeyDown?.(e), z(e);
514
+ s.onKeyDown?.(e), P(e);
558
515
  },
559
516
  onMouseDown: (e) => {
560
- s.onMouseDown?.(e), z(e);
517
+ s.onMouseDown?.(e), P(e);
561
518
  },
562
519
  onPointerDown: (e) => {
563
- s.onPointerDown?.(e), z(e);
520
+ s.onPointerDown?.(e), P(e);
564
521
  },
565
522
  role: "radiogroup",
566
523
  children: r.map((n) => /* @__PURE__ */ j("label", {
567
- onClick: z,
568
- onMouseDown: z,
524
+ onClick: P,
525
+ onMouseDown: P,
569
526
  children: [/* @__PURE__ */ A("input", {
570
527
  checked: i === void 0 ? void 0 : String(i) === String(n.value),
571
528
  disabled: n.disabled,
572
529
  name: a,
573
- onClick: z,
530
+ onClick: P,
574
531
  onChange: (r) => {
575
- z(r), r.currentTarget.checked && e.onValueChange?.({
532
+ P(r), r.currentTarget.checked && e.onValueChange?.({
576
533
  ...t,
577
534
  value: String(n.value)
578
535
  });
579
536
  },
580
- onKeyDown: z,
581
- onMouseDown: z,
582
- onPointerDown: z,
537
+ onKeyDown: P,
538
+ onMouseDown: P,
539
+ onPointerDown: P,
583
540
  style: {
584
541
  height: 20,
585
542
  width: 20
@@ -590,49 +547,134 @@ function Ye(e, t, n) {
590
547
  }, String(n.value)))
591
548
  });
592
549
  }
593
- if (e.type === "toggle") return /* @__PURE__ */ A(qe, {
550
+ if (e.type === "toggle") return /* @__PURE__ */ A(Je, {
594
551
  component: e,
595
552
  payload: t
596
553
  });
597
- let r = F(e.props, t), i = Number(r.value ?? 0), a = Math.max(1, Number(r.max ?? 100)), o = Math.max(0, Math.min(100, i / a * 100));
554
+ let r = N(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
555
  return /* @__PURE__ */ A("div", {
599
556
  ...r,
600
557
  "aria-valuemax": a,
601
558
  "aria-valuemin": 0,
602
559
  "aria-valuenow": i,
603
- className: P("comins-table__component", "comins-table__component-progress", r.className),
604
- onClick: z,
605
- onKeyDown: z,
606
- onMouseDown: z,
607
- onPointerDown: z,
560
+ className: M("comins-table__component", "comins-table__component-progress", r.className),
561
+ onClick: P,
562
+ onKeyDown: P,
563
+ onMouseDown: P,
564
+ onPointerDown: P,
608
565
  role: "progressbar",
609
566
  children: /* @__PURE__ */ A("span", { style: { width: `${o}%` } })
610
567
  });
611
568
  }
612
569
  //#endregion
570
+ //#region src/table-icons.tsx
571
+ var I = {
572
+ columnMove: Fe,
573
+ disclosureCollapsed: Pe,
574
+ disclosureExpanded: Pe,
575
+ sortAscending: Le,
576
+ sortDescending: Ie,
577
+ sortUnsorted: Ne
578
+ };
579
+ function Qe({ className: e, name: t }) {
580
+ let n = I[t];
581
+ return /* @__PURE__ */ A(n, {
582
+ "aria-hidden": "true",
583
+ className: ["comins-table-icon", e].filter(Boolean).join(" "),
584
+ "data-comins-icon": t,
585
+ focusable: "false"
586
+ });
587
+ }
588
+ var $e = Te.forwardRef(function({ className: e, icon: t, type: n = "button", ...r }, i) {
589
+ return /* @__PURE__ */ A("button", {
590
+ className: ["comins-table-icon-button", e].filter(Boolean).join(" "),
591
+ ref: i,
592
+ type: n,
593
+ ...r,
594
+ children: /* @__PURE__ */ A(Qe, { name: t })
595
+ });
596
+ });
597
+ //#endregion
598
+ //#region src/row-detail.tsx
599
+ function et(e) {
600
+ return /* @__PURE__ */ A($e, {
601
+ "aria-controls": e.expanded ? e.controlsId : void 0,
602
+ "aria-expanded": e.expanded,
603
+ "aria-label": e.label,
604
+ className: "comins-row-detail-expander",
605
+ "data-comins-row-leading-control": "disclosure",
606
+ "data-testid": e.testId,
607
+ disabled: e.disabled,
608
+ icon: e.expanded ? "disclosureExpanded" : "disclosureCollapsed",
609
+ id: e.id,
610
+ onClick: (t) => {
611
+ t.preventDefault(), t.stopPropagation(), e.onToggle();
612
+ },
613
+ onKeyDown: (e) => e.stopPropagation(),
614
+ onMouseDown: (e) => e.stopPropagation(),
615
+ onPointerDown: (e) => e.stopPropagation(),
616
+ ref: e.onElement
617
+ });
618
+ }
619
+ function tt(e) {
620
+ let t = O(null), n = O(e.getToggleElement), r = O(e.onContentElement), i = e.fixedHeight === void 0;
621
+ return n.current = e.getToggleElement, r.current = e.onContentElement, Me(() => {
622
+ let e = t.current;
623
+ return r.current(e), () => r.current(null);
624
+ }, [i]), Me(() => {
625
+ let e = t.current;
626
+ return () => {
627
+ if (e?.contains(document.activeElement)) {
628
+ let e = () => {
629
+ let e = n.current();
630
+ e?.isConnected && e.focus();
631
+ };
632
+ e(), window.requestAnimationFrame(e);
633
+ }
634
+ };
635
+ }, []), /* @__PURE__ */ A("tr", {
636
+ className: "comins-table__detail-row",
637
+ "data-detail-for": e.ownerId,
638
+ children: /* @__PURE__ */ A("td", {
639
+ className: "comins-table__detail-cell",
640
+ colSpan: Math.max(1, e.colSpan),
641
+ children: /* @__PURE__ */ A("div", {
642
+ "aria-labelledby": e.labelId,
643
+ className: "comins-table__detail-content",
644
+ "data-testid": e.testId,
645
+ id: e.contentId,
646
+ ref: t,
647
+ role: "region",
648
+ style: e.fixedHeight === void 0 ? void 0 : { height: e.fixedHeight },
649
+ children: e.children
650
+ })
651
+ })
652
+ });
653
+ }
654
+ //#endregion
613
655
  //#region src/summary.ts
614
- function Xe(e, t) {
656
+ function nt(e, t) {
615
657
  return t.split(".").reduce((e, t) => {
616
658
  if (!(typeof e != "object" || !e)) return e[t];
617
659
  }, e);
618
660
  }
619
- function Ze(e) {
661
+ function L(e) {
620
662
  return e.filter((e) => typeof e == "number" && Number.isFinite(e));
621
663
  }
622
- function Qe(e, t) {
664
+ function R(e, t) {
623
665
  if (e === "count") return t.length;
624
- let n = Ze(t);
666
+ let n = L(t);
625
667
  return n.length === 0 ? null : e === "sum" ? n.reduce((e, t) => e + t, 0) : e === "avg" ? n.reduce((e, t) => e + t, 0) / n.length : e === "min" ? Math.min(...n) : Math.max(...n);
626
668
  }
627
- function $e(e, t, n) {
669
+ function rt(e, t, n) {
628
670
  return Object.entries(n.columns).reduce((n, [r, i]) => {
629
671
  let a = t.find((e) => e.id === r);
630
672
  if (!a || !i) return n;
631
- let o = typeof i == "object" && i ? i : void 0, s = typeof i == "object" && i ? i.aggregate : i, c = e.map((e) => Xe(e, a.field)), l = typeof s == "function" ? s({
673
+ let o = typeof i == "object" && i ? i : void 0, s = typeof i == "object" && i ? i.aggregate : i, c = e.map((e) => nt(e, a.field)), l = typeof s == "function" ? s({
632
674
  column: a,
633
675
  rows: e,
634
676
  values: c
635
- }) : Qe(s, c);
677
+ }) : R(s, c);
636
678
  return n[r] = o?.format ? o.format({
637
679
  column: a,
638
680
  rows: e,
@@ -643,15 +685,15 @@ function $e(e, t, n) {
643
685
  }
644
686
  //#endregion
645
687
  //#region src/tree.ts
646
- function et(e) {
688
+ function it(e) {
647
689
  return e.join(".");
648
690
  }
649
- function U(e, t) {
691
+ function z(e, t) {
650
692
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = 0, a = (e, o) => {
651
693
  e.forEach((e, s) => {
652
694
  let c = [...o, s], l = t(e.item, i);
653
695
  if (i += 1, n.has(l)) throw Error(`Duplicate tree row id: ${String(l)}`);
654
- n.set(l, c), r.set(et(c), l), e.children?.length && a(e.children, c);
696
+ n.set(l, c), r.set(it(c), l), e.children?.length && a(e.children, c);
655
697
  });
656
698
  };
657
699
  return a(e, []), {
@@ -659,17 +701,17 @@ function U(e, t) {
659
701
  idByPath: r
660
702
  };
661
703
  }
662
- function W(e, t, n) {
704
+ function at(e, t, n) {
663
705
  let [r, ...i] = t;
664
706
  return r === void 0 ? [...e] : e.map((e, t) => t === r ? i.length === 0 ? n(e) : e.children ? {
665
707
  ...e,
666
- children: W(e.children, i, n)
708
+ children: at(e.children, i, n)
667
709
  } : e : e);
668
710
  }
669
- function G(e, t, n = {}) {
670
- let r = U(e, t), i = [], a = (e, t, o) => {
711
+ function B(e, t, n = {}) {
712
+ let r = z(e, t), i = [], a = (e, t, o) => {
671
713
  e.forEach((e, s) => {
672
- let c = [...o, s], l = e.children ?? [], u = l.length > 0, d = e.expand ?? n.defaultExpandAll ?? !1, f = r.idByPath.get(et(c));
714
+ let c = [...o, s], l = e.children ?? [], u = l.length > 0, d = e.expand ?? n.defaultExpandAll ?? !1, f = r.idByPath.get(it(c));
673
715
  f !== void 0 && (i.push({
674
716
  depth: t,
675
717
  expanded: d,
@@ -682,33 +724,171 @@ function G(e, t, n = {}) {
682
724
  };
683
725
  return a(e, 0, []), i;
684
726
  }
685
- function tt(e) {
686
- return e.flatMap((e) => e.children?.length ? tt(e.children) : [e.item]);
727
+ function ot(e) {
728
+ return e.flatMap((e) => e.children?.length ? ot(e.children) : [e.item]);
687
729
  }
688
- function nt(e, t, n, r = {}) {
689
- let i = U(e, n).byId.get(t);
690
- return i ? W(e, i, (e) => ({
730
+ function st(e, t, n, r = {}) {
731
+ let i = z(e, n).byId.get(t);
732
+ return i ? at(e, i, (e) => ({
691
733
  ...e,
692
734
  expand: !(e.expand ?? r.defaultExpandAll ?? !1)
693
735
  })) : [...e];
694
736
  }
695
- function rt(e, t, n, r) {
696
- let i = U(e, n).byId.get(t);
697
- return i ? W(e, i, (e) => ({
737
+ function ct(e, t, n, r) {
738
+ let i = z(e, n).byId.get(t);
739
+ return i ? at(e, i, (e) => ({
698
740
  ...e,
699
741
  item: r(e.item)
700
742
  })) : [...e];
701
743
  }
702
- function it(e, t) {
744
+ function lt(e, t) {
703
745
  return [...e].sort((e, n) => t(e.item, n.item)).map((e) => ({
704
746
  ...e,
705
- children: e.children ? it(e.children, t) : void 0
747
+ children: e.children ? lt(e.children, t) : void 0
706
748
  }));
707
749
  }
708
750
  //#endregion
751
+ //#region src/virtual-layout.ts
752
+ var V = 15e5;
753
+ function ut(e) {
754
+ return `data:${typeof e}:${encodeURIComponent(String(e))}`;
755
+ }
756
+ function dt(e) {
757
+ return {
758
+ dataIndex: e.dataIndex,
759
+ ...e.detail ? { detail: e.detail } : {},
760
+ key: ut(e.rowId),
761
+ kind: "data",
762
+ row: e.row,
763
+ rowId: e.rowId,
764
+ visibleIndex: e.visibleIndex
765
+ };
766
+ }
767
+ function ft(e, t) {
768
+ return typeof e == "number" && Number.isFinite(e) && e > 0 ? e : Math.max(1, t);
769
+ }
770
+ function pt(e) {
771
+ return typeof e == "number" && Number.isFinite(e) && e > 0 ? {
772
+ height: e,
773
+ mode: "fixed"
774
+ } : { mode: "auto" };
775
+ }
776
+ var mt = class e {
777
+ heights;
778
+ tree;
779
+ totalHeight;
780
+ constructor(e) {
781
+ this.heights = Float64Array.from(e, (e) => Math.max(0, e)), this.tree = new Float64Array(this.heights.length + 1), this.totalHeight = 0;
782
+ for (let e = 0; e < this.heights.length; e += 1) {
783
+ let t = e + 1, n = this.heights[e] ?? 0, r = t + (t & -t);
784
+ this.tree[t] = (this.tree[t] ?? 0) + n, this.totalHeight += n, r < this.tree.length && (this.tree[r] = (this.tree[r] ?? 0) + (this.tree[t] ?? 0));
785
+ }
786
+ }
787
+ static from(t) {
788
+ return new e(t);
789
+ }
790
+ add(e, t) {
791
+ for (let n = e + 1; n < this.tree.length; n += n & -n) this.tree[n] = (this.tree[n] ?? 0) + t;
792
+ }
793
+ getHeight(e) {
794
+ return this.heights[e] ?? 0;
795
+ }
796
+ getPrefixHeight(e) {
797
+ let t = 0;
798
+ for (let n = Math.min(this.heights.length, Math.max(0, e)); n > 0; n -= n & -n) t += this.tree[n] ?? 0;
799
+ return t;
800
+ }
801
+ getTotalHeight() {
802
+ return this.totalHeight;
803
+ }
804
+ findIndexAtOffset(e) {
805
+ if (this.heights.length === 0 || this.totalHeight <= 0) return 0;
806
+ let t = Math.min(Math.max(0, e), Math.max(0, this.getTotalHeight() - 2 ** -52)), n = 0, r = 0, i = 1;
807
+ for (; i * 2 < this.tree.length;) i *= 2;
808
+ for (; i > 0; i = Math.floor(i / 2)) {
809
+ let e = n + i, a = r + (this.tree[e] ?? 0);
810
+ e < this.tree.length && a <= t && (n = e, r = a);
811
+ }
812
+ return Math.min(this.heights.length - 1, n);
813
+ }
814
+ updateHeight(e, t) {
815
+ let n = Math.max(0, t), r = this.heights[e];
816
+ if (r === void 0) return 0;
817
+ let i = n - r;
818
+ return this.heights[e] = n, this.totalHeight += i, this.add(e, i), i;
819
+ }
820
+ };
821
+ function ht(e, t) {
822
+ return e.kind === "group" ? e.height : t + (e.detail?.height ?? 0);
823
+ }
824
+ function H(e, t) {
825
+ let n = Math.min(e, V), r = Math.max(0, e - t), i = Math.max(0, n - t);
826
+ return {
827
+ logicalScrollableHeight: r,
828
+ physicalScrollableHeight: i,
829
+ physicalScrollHeight: n,
830
+ scrollScale: r > 0 && i > 0 ? r / i : 1
831
+ };
832
+ }
833
+ function gt(e) {
834
+ let t = H(e.heightIndex.getTotalHeight(), e.viewportHeight), n = Math.min(t.physicalScrollableHeight, Math.max(0, e.physicalScrollTop)), r = Math.min(t.logicalScrollableHeight, n * t.scrollScale), i = e.heightIndex.findIndexAtOffset(r), a = e.heightIndex.findIndexAtOffset(r + Math.max(0, e.viewportHeight)), o = Math.max(0, i - Math.max(0, e.overscan)), s = Math.min(a + Math.max(0, e.overscan) + 1, e.heightIndex.findIndexAtOffset(Infinity) + 1), c = e.heightIndex.getPrefixHeight(o);
835
+ return {
836
+ endIndex: s,
837
+ logicalScrollTop: r,
838
+ logicalStartOffset: c,
839
+ physicalScrollHeight: t.physicalScrollHeight,
840
+ renderOffset: n - (r - c),
841
+ scrollScale: t.scrollScale,
842
+ startIndex: o
843
+ };
844
+ }
845
+ function _t(e, t, n, r) {
846
+ let i = e.get(t);
847
+ return i && i.width === Math.round(n) ? {
848
+ estimated: !1,
849
+ height: i.height
850
+ } : {
851
+ estimated: !0,
852
+ height: r
853
+ };
854
+ }
855
+ function vt(e, t) {
856
+ for (let n of e.keys()) t.has(n) || e.delete(n);
857
+ }
858
+ function yt(e) {
859
+ if (e.keys.length === 0) return;
860
+ let t = e.heightIndex.findIndexAtOffset(e.logicalScrollTop), n = e.keys[t];
861
+ if (n === void 0) return;
862
+ let r = e.heightIndex.getPrefixHeight(t);
863
+ return {
864
+ key: n,
865
+ offsetWithinSlot: Math.max(0, e.logicalScrollTop - r),
866
+ previousIndex: t
867
+ };
868
+ }
869
+ function bt(e) {
870
+ let t = e.nextKeys.indexOf(e.anchor.key);
871
+ if (t === -1) for (let n = Math.min(e.anchor.previousIndex - 1, e.previousKeys.length - 1); n >= 0 && (t = e.nextKeys.indexOf(e.previousKeys[n] ?? ""), t === -1); --n);
872
+ if (t === -1) for (let n = Math.max(0, e.anchor.previousIndex + 1); n < e.previousKeys.length && (t = e.nextKeys.indexOf(e.previousKeys[n] ?? ""), t === -1); n += 1);
873
+ if (t !== -1) return {
874
+ index: t,
875
+ offsetWithinSlot: Math.min(Math.max(0, e.anchor.offsetWithinSlot), Math.max(0, e.getNextHeight(t)))
876
+ };
877
+ }
878
+ function xt(e, t, n) {
879
+ let r = H(t, n);
880
+ return Math.min(r.physicalScrollableHeight, Math.max(0, e) / r.scrollScale);
881
+ }
882
+ //#endregion
709
883
  //#region src/index.tsx
710
- var at = 50;
711
- function ot(e, t, n, r, i) {
884
+ var St = 88;
885
+ function Ct(e, t, n) {
886
+ return e.id === t.id && e.kind === t.kind ? "neutral" : e.depth !== t.depth || e.parentGroupId !== t.parentGroupId ? "invalid" : n ? "valid" : "invalid";
887
+ }
888
+ function wt(e, t) {
889
+ return e.selection.rowIds.includes(t) ? e : de(e, t);
890
+ }
891
+ function Tt(e, t, n, r, i) {
712
892
  let a = Math.max(0, r), o = e?.length ?? t.length, s = Math.min(o, Math.max(a, i)), c = [];
713
893
  for (let r = a; r < s; r += 1) {
714
894
  let i = e?.[r] ?? r, a = t[i], o = n[i];
@@ -721,26 +901,62 @@ function ot(e, t, n, r, i) {
721
901
  }
722
902
  return c;
723
903
  }
724
- function st(e) {
904
+ function Et(e) {
905
+ return e.mixed ? e.keys : e.projectedDataIndexes.flatMap((t) => {
906
+ let n = e.rowIds[t];
907
+ return n === void 0 ? [] : [ut(n)];
908
+ });
909
+ }
910
+ function Dt(e) {
911
+ let t = Et(e.projection), n = e.logicalScrollTop ?? (e.projection.mixed ? gt({
912
+ heightIndex: e.projection.heightIndex,
913
+ overscan: 0,
914
+ physicalScrollTop: e.physicalScrollTop,
915
+ viewportHeight: e.viewportHeight
916
+ }).logicalScrollTop : (() => {
917
+ let t = H(e.projection.visibleRowCount * e.projection.rowHeight, e.viewportHeight);
918
+ return Math.min(t.logicalScrollableHeight, Math.max(0, e.physicalScrollTop) * t.scrollScale);
919
+ })()), r = e.projection.mixed ? yt({
920
+ heightIndex: e.projection.heightIndex,
921
+ keys: t,
922
+ logicalScrollTop: n
923
+ }) : (() => {
924
+ if (e.projection.visibleRowCount === 0) return;
925
+ let r = Math.min(e.projection.visibleRowCount - 1, Math.floor(n / e.projection.rowHeight)), i = t[r];
926
+ return i === void 0 ? void 0 : {
927
+ key: i,
928
+ offsetWithinSlot: n - r * e.projection.rowHeight,
929
+ previousIndex: r
930
+ };
931
+ })();
932
+ return r ? {
933
+ anchor: r,
934
+ previousKeys: t,
935
+ previousLogicalScrollTop: n,
936
+ previousPhysicalScrollTop: e.physicalScrollTop,
937
+ previousViewportHeight: e.viewportHeight
938
+ } : void 0;
939
+ }
940
+ function Ot(e) {
725
941
  return !e || typeof e == "string" ? e : Object.entries(e).filter(([, e]) => e).map(([e]) => e).join(" ");
726
942
  }
727
- function K(e, t, n) {
943
+ function kt(e, t, n) {
728
944
  return typeof e == "function" ? e(t, n) : e;
729
945
  }
730
- function ct(e, t, n) {
731
- let r = K(e?.disabled, t, n) === !0;
946
+ function At(e, t, n) {
947
+ let r = kt(e?.disabled, t, n) === !0;
732
948
  return {
733
- className: st(K(e?.className, t, n)),
949
+ className: Ot(kt(e?.className, t, n)),
734
950
  disabled: r,
735
- draggable: !r && K(e?.draggable, t, n) !== !1,
736
- style: K(e?.style, t, n)
951
+ draggable: !r && kt(e?.draggable, t, n) !== !1,
952
+ style: kt(e?.style, t, n)
737
953
  };
738
954
  }
739
- function lt(e) {
955
+ function jt(e) {
740
956
  let t = e?.background ?? e?.backgroundColor;
741
957
  return typeof t == "string" || typeof t == "number" ? t : void 0;
742
958
  }
743
- function ut(e, t, n) {
959
+ function Mt(e, t, n) {
744
960
  let r = {
745
961
  height: e,
746
962
  ...t
@@ -750,7 +966,7 @@ function ut(e, t, n) {
750
966
  "--comins-table-row-custom-background": n
751
967
  };
752
968
  }
753
- function dt(e) {
969
+ function Nt(e) {
754
970
  return {
755
971
  data: e.row,
756
972
  dataIndex: e.dataIndex,
@@ -758,7 +974,7 @@ function dt(e) {
758
974
  index: e.visibleIndex
759
975
  };
760
976
  }
761
- function q(e, t) {
977
+ function U(e, t) {
762
978
  return {
763
979
  definition: e,
764
980
  field: e.field,
@@ -767,23 +983,23 @@ function q(e, t) {
767
983
  label: e.label
768
984
  };
769
985
  }
770
- function ft(e, t) {
986
+ function Pt(e, t) {
771
987
  return {
772
988
  event: e,
773
989
  index: t.visibleIndex,
774
- row: dt(t)
990
+ row: Nt(t)
775
991
  };
776
992
  }
777
- function pt(e, t, n, r, i) {
993
+ function Ft(e, t, n, r, i) {
778
994
  return {
779
- column: q(n, r),
995
+ column: U(n, r),
780
996
  event: e,
781
997
  index: t.visibleIndex,
782
- row: dt(t),
998
+ row: Nt(t),
783
999
  value: i
784
1000
  };
785
1001
  }
786
- function mt(e, t) {
1002
+ function W(e, t) {
787
1003
  return {
788
1004
  definition: e,
789
1005
  field: e.field,
@@ -792,9 +1008,9 @@ function mt(e, t) {
792
1008
  label: e.label
793
1009
  };
794
1010
  }
795
- function ht(e, t, n, r, i, a, o) {
1011
+ function It(e, t, n, r, i, a, o) {
796
1012
  return {
797
- column: mt(i, a),
1013
+ column: W(i, a),
798
1014
  row: {
799
1015
  data: e.row,
800
1016
  dataIndex: e.dataIndex,
@@ -807,31 +1023,31 @@ function ht(e, t, n, r, i, a, o) {
807
1023
  value: o
808
1024
  };
809
1025
  }
810
- function gt(e, t) {
1026
+ function Lt(e, t) {
811
1027
  let n = e.cell?.props;
812
1028
  return typeof n == "function" ? n(t) : n;
813
1029
  }
814
- function _t(e, t) {
1030
+ function Rt(e, t) {
815
1031
  return e === void 0 ? !0 : typeof e == "boolean" ? e : e(t);
816
1032
  }
817
- function vt(e, t) {
818
- return e?.disabled !== void 0 && _t(e.disabled, t) === !0;
1033
+ function zt(e, t) {
1034
+ return e?.disabled !== void 0 && Rt(e.disabled, t) === !0;
819
1035
  }
820
- function yt(e, t) {
1036
+ function Bt(e, t) {
821
1037
  let n = e?.className;
822
1038
  return typeof n == "function" ? n(t) : n;
823
1039
  }
824
- function bt(e, t) {
1040
+ function Vt(e, t) {
825
1041
  let n = e?.style;
826
1042
  return typeof n == "function" ? n(t) : n;
827
1043
  }
828
- function xt(e, t, n) {
1044
+ function Ht(e, t, n) {
829
1045
  return e.cell?.format ? e.cell.format(n) : t == null ? "" : String(t);
830
1046
  }
831
- function St(e, t, n) {
832
- let r = e.columnState[t.id], i = Ft(e.sortModel, t.id);
1047
+ function Ut(e, t, n) {
1048
+ let r = e.columnState[t.id], i = un(e.sortModel, t.id);
833
1049
  return {
834
- column: mt(t, n),
1050
+ column: W(t, n),
835
1051
  layout: {
836
1052
  hidden: r?.hidden === !0 || t.hidden === !0,
837
1053
  width: r?.width ?? t.width
@@ -844,17 +1060,17 @@ function St(e, t, n) {
844
1060
  }
845
1061
  };
846
1062
  }
847
- function Ct(e) {
1063
+ function Wt(e) {
848
1064
  return "row" in e && "selection" in e;
849
1065
  }
850
- function wt(e, t) {
851
- return !Ct(t) || e.type !== "input" && e.type !== "select" || t.selection.selectedRowCount === 1 && t.row.selected;
1066
+ function Gt(e, t) {
1067
+ return !Wt(t) || e.type !== "input" && e.type !== "select" || t.selection.selectedRowCount === 1 && t.row.selected;
852
1068
  }
853
- function Tt(e, t) {
854
- return (e ?? []).filter((e) => wt(e, t));
1069
+ function Kt(e, t) {
1070
+ return (e ?? []).filter((e) => Gt(e, t));
855
1071
  }
856
- function Et(e, t, n, r) {
857
- return Tt(e, t).map((e, t) => ({
1072
+ function qt(e, t, n, r) {
1073
+ return Kt(e, t).map((e, t) => ({
858
1074
  component: e,
859
1075
  index: t
860
1076
  })).filter(({ component: e }) => (e.direction ?? "left") === n).map(({ component: e, index: i }) => /* @__PURE__ */ A("span", {
@@ -862,14 +1078,64 @@ function Et(e, t, n, r) {
862
1078
  "data-comins-component-align": e.align ?? "center",
863
1079
  "data-comins-component-direction": n,
864
1080
  "data-comins-component-id": e.id ?? `${e.type}-${i}`,
865
- children: Ye(e, t, r)
1081
+ children: Ze(e, t, r)
866
1082
  }, e.id ?? `${e.type}-${i}`));
867
1083
  }
868
- function Dt(e, t, n, r = {}) {
1084
+ function G(e) {
1085
+ e.preventDefault(), e.stopPropagation();
1086
+ }
1087
+ function Jt(e) {
1088
+ e.stopPropagation(), e.target instanceof HTMLElement && e.target.blur();
1089
+ }
1090
+ var Yt = /* @__PURE__ */ new WeakSet();
1091
+ function Xt(e) {
1092
+ if (!e || Yt.has(e)) return;
1093
+ let t = (t) => {
1094
+ e.hasAttribute("inert") && e.getAttribute("aria-hidden") === "true" && (t.preventDefault(), t.stopPropagation());
1095
+ };
1096
+ e.addEventListener("change", t, !0), e.addEventListener("input", t, !0), Yt.add(e);
1097
+ }
1098
+ var Zt = {
1099
+ onBeforeInputCapture: G,
1100
+ onBlurCapture: G,
1101
+ onChangeCapture: G,
1102
+ onClickCapture: G,
1103
+ onContextMenuCapture: G,
1104
+ onDoubleClickCapture: G,
1105
+ onFocusCapture: Jt,
1106
+ onInputCapture: G,
1107
+ onKeyDownCapture: G,
1108
+ onKeyPressCapture: G,
1109
+ onKeyUpCapture: G,
1110
+ onMouseDownCapture: G,
1111
+ onMouseMoveCapture: G,
1112
+ onMouseOutCapture: G,
1113
+ onMouseOverCapture: G,
1114
+ onMouseUpCapture: G,
1115
+ onPointerCancelCapture: G,
1116
+ onPointerDownCapture: G,
1117
+ onPointerMoveCapture: G,
1118
+ onPointerOutCapture: G,
1119
+ onPointerOverCapture: G,
1120
+ onPointerUpCapture: G,
1121
+ onResetCapture: G,
1122
+ onScrollCapture: G,
1123
+ onSubmitCapture: G,
1124
+ onTouchCancelCapture: G,
1125
+ onTouchEndCapture: G,
1126
+ onTouchMoveCapture: G,
1127
+ onTouchStartCapture: G,
1128
+ onWheelCapture: G
1129
+ };
1130
+ function Qt(e, t) {
1131
+ let n = (e) => typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(n).join("") : ke(e) && typeof e.type == "string" ? n(e.props.children) : "";
1132
+ return n(e).trim() || t;
1133
+ }
1134
+ function $t(e, t, n, r = {}) {
869
1135
  if (!t?.length) return e;
870
- let i = r.showContent ?? !0, a = Tt(t, n);
1136
+ let i = r.showContent ?? !0, a = Kt(t, n);
871
1137
  if (!a.length) return e;
872
- let o = Et(a, n, "left", r.interaction), s = Et(a, n, "right", r.interaction);
1138
+ let o = qt(a, n, "left", r.interaction), s = qt(a, n, "right", r.interaction);
873
1139
  return i ? /* @__PURE__ */ j("span", {
874
1140
  className: "comins-table__component-layout",
875
1141
  children: [
@@ -898,48 +1164,48 @@ function Dt(e, t, n, r = {}) {
898
1164
  })
899
1165
  });
900
1166
  }
901
- function Ot(e) {
902
- return Math.max(at, e.minWidth ?? at);
1167
+ function en(e) {
1168
+ return Math.max(St, e.minWidth ?? St);
903
1169
  }
904
- function J(e) {
1170
+ function tn(e) {
905
1171
  return e.maxWidth ?? Infinity;
906
1172
  }
907
- function kt(e, t) {
1173
+ function nn(e, t) {
908
1174
  return e.columnState[t.id]?.width ?? t.width ?? 100;
909
1175
  }
910
- function Y(e, t, n) {
1176
+ function rn(e, t, n) {
911
1177
  return Math.min(n, Math.max(t, e));
912
1178
  }
913
- function At(e, t, n) {
914
- let r = t.map((t) => Y(kt(e, t), Ot(t), J(t))), i = new Set(t.map((e, t) => t)), a = t.map(Ot), o = t.map(J), s = Y(n, a.reduce((e, t) => e + t, 0), o.reduce((e, t) => e + t, 0));
1179
+ function an(e, t, n) {
1180
+ let r = t.map((t) => rn(nn(e, t), en(t), tn(t))), i = new Set(t.map((e, t) => t)), a = t.map(en), o = t.map(tn), s = rn(n, a.reduce((e, t) => e + t, 0), o.reduce((e, t) => e + t, 0));
915
1181
  for (; i.size > 0;) {
916
1182
  let e = s - r.reduce((e, t) => e + t, 0);
917
1183
  if (Math.abs(e) < .001) break;
918
1184
  let t = [...i], n = t.reduce((e, t) => e + Math.max(r[t] ?? 0, 0), 0), c = !1;
919
1185
  for (let s of t) {
920
- let l = r[s] ?? 0, u = l + e * (n > 0 ? l / n : 1 / t.length), d = Y(u, a[s] ?? 0, o[s] ?? Infinity);
1186
+ let l = r[s] ?? 0, u = l + e * (n > 0 ? l / n : 1 / t.length), d = rn(u, a[s] ?? 0, o[s] ?? Infinity);
921
1187
  r[s] = d, Math.abs(d - u) > .001 && (i.delete(s), c = !0);
922
1188
  }
923
1189
  if (!c) break;
924
1190
  }
925
1191
  return r;
926
1192
  }
927
- function jt(e, t, n) {
1193
+ function on(e, t, n) {
928
1194
  let r = e.columnGroups.find((e) => e.children.includes(t));
929
1195
  if (!r || e.columnGroupState[r.id]?.hidden === !0) return _e(e, t, n);
930
1196
  let i = r.children.map((t) => e.columns.find((e) => e.id === t)).filter((e) => !!e).filter((t) => e.columnState[t.id]?.hidden !== !0), a = i.find((e) => e.id === t);
931
1197
  if (!a) return _e(e, t, n);
932
1198
  let o = i.filter((e) => e.id !== t);
933
1199
  if (o.length === 0) {
934
- let r = kt(e, a);
935
- return _e(e, t, Y(n, Ot(a), Math.min(J(a), r)));
1200
+ let r = nn(e, a);
1201
+ return _e(e, t, rn(n, en(a), Math.min(tn(a), r)));
936
1202
  }
937
- let s = i.reduce((t, n) => t + kt(e, n), 0), c = o.reduce((e, t) => e + Ot(t), 0), l = o.reduce((e, t) => e + J(t), 0), u = Math.max(Ot(a), s - l), d = Y(n, u, Math.max(u, Math.min(J(a), s - c))), f = At(e, o, s - d), p = _e(e, t, d);
1203
+ let s = i.reduce((t, n) => t + nn(e, n), 0), c = o.reduce((e, t) => e + en(t), 0), l = o.reduce((e, t) => e + tn(t), 0), u = Math.max(en(a), s - l), d = rn(n, u, Math.max(u, Math.min(tn(a), s - c))), f = an(e, o, s - d), p = _e(e, t, d);
938
1204
  return o.forEach((e, t) => {
939
- p = _e(p, e.id, f[t] ?? kt(p, e));
1205
+ p = _e(p, e.id, f[t] ?? nn(p, e));
940
1206
  }), p;
941
1207
  }
942
- function Mt(e, t, n) {
1208
+ function sn(e, t, n) {
943
1209
  if (!e || typeof e != "object") return e;
944
1210
  let r = t.split("."), [i] = r;
945
1211
  if (!i) return e;
@@ -953,7 +1219,7 @@ function Mt(e, t, n) {
953
1219
  o[e] = a, n && (o = a);
954
1220
  }), o[r.at(-1)] = n, a;
955
1221
  }
956
- function Nt(e, t) {
1222
+ function cn(e, t) {
957
1223
  return e?.columnId === t ? e.direction === "asc" ? {
958
1224
  columnId: t,
959
1225
  direction: "desc"
@@ -962,60 +1228,60 @@ function Nt(e, t) {
962
1228
  direction: "asc"
963
1229
  };
964
1230
  }
965
- function Pt(e, t, n) {
966
- let r = e.findIndex((e) => e.columnId === t), i = Nt(r < 0 ? null : e[r] ?? null, t);
1231
+ function ln(e, t, n) {
1232
+ let r = e.findIndex((e) => e.columnId === t), i = cn(r < 0 ? null : e[r] ?? null, t);
967
1233
  return n ? i ? r < 0 ? [...e, i] : e.map((e, t) => t === r ? i : e) : e.filter((e) => e.columnId !== t) : i ? [i] : [];
968
1234
  }
969
- function Ft(e, t) {
1235
+ function un(e, t) {
970
1236
  let n = e.findIndex((e) => e.columnId === t);
971
1237
  return n < 0 ? null : {
972
1238
  priority: n + 1,
973
1239
  rule: e[n]
974
1240
  };
975
1241
  }
976
- function It(e, t) {
977
- let n = Ft(e, t)?.rule;
1242
+ function dn(e, t) {
1243
+ let n = un(e, t)?.rule;
978
1244
  return n ? n.direction : "none";
979
1245
  }
980
- function Lt(e, t) {
981
- let n = Ft(e, t);
1246
+ function fn(e, t) {
1247
+ let n = un(e, t);
982
1248
  if (!n) return e.length > 1 ? void 0 : "none";
983
1249
  if (!(n.priority > 1)) return n.rule.direction === "asc" ? "ascending" : "descending";
984
1250
  }
985
- function Rt(e, t) {
1251
+ function pn(e, t) {
986
1252
  return !e || !t ? e === t : e.columnId === t.columnId && e.direction === t.direction;
987
1253
  }
988
- function zt(e, t) {
1254
+ function mn(e, t) {
989
1255
  return e.length === t.length && e.every((e, n) => e.columnId === t[n]?.columnId && e.direction === t[n]?.direction);
990
1256
  }
991
- function Bt(e, t) {
1257
+ function K(e, t) {
992
1258
  return e.length === t.length && e.every((e, n) => e === t[n]);
993
1259
  }
994
- function Vt(e, t) {
995
- if (!Bt(e.rowIds, t.rowIds)) return !1;
1260
+ function hn(e, t) {
1261
+ if (!K(e.rowIds, t.rowIds)) return !1;
996
1262
  let n = new Set(t.columns.map((e) => e.id)), r = e.selection.cell, i = e.selection.range;
997
1263
  return !(r && !n.has(r.columnId) || i && (!n.has(i.anchor.columnId) || !n.has(i.focus.columnId)));
998
1264
  }
999
- function Ht(e, t) {
1265
+ function gn(e, t) {
1000
1266
  return t.split(".").reduce((e, t) => {
1001
1267
  if (!(typeof e != "object" || !e)) return e[t];
1002
1268
  }, e);
1003
1269
  }
1004
- function Ut(e, t) {
1270
+ function _n(e, t) {
1005
1271
  return typeof e == "number" && typeof t == "number" ? e - t : String(e ?? "").localeCompare(String(t ?? ""));
1006
1272
  }
1007
- function Wt(e, t, n) {
1008
- return n.length === 0 ? e : it(e, (e, r) => {
1273
+ function vn(e, t, n) {
1274
+ return n.length === 0 ? e : lt(e, (e, r) => {
1009
1275
  for (let i of n) {
1010
1276
  let n = t.find((e) => (e.id ?? e.field) === i.columnId);
1011
1277
  if (!n?.sort) continue;
1012
- let a = Ht(e, n.field), o = Ht(r, n.field), s = typeof n.sort == "function" ? n.sort(a, o, e, r) : Ut(a, o);
1278
+ let a = gn(e, n.field), o = gn(r, n.field), s = typeof n.sort == "function" ? n.sort(a, o, e, r) : _n(a, o);
1013
1279
  if (s !== 0) return i.direction === "desc" ? s * -1 : s;
1014
1280
  }
1015
1281
  return 0;
1016
1282
  });
1017
1283
  }
1018
- function Gt(e, t, n, r, i) {
1284
+ function yn(e, t, n, r, i) {
1019
1285
  if (t?.length === 0) return e;
1020
1286
  let a = [], o = /* @__PURE__ */ new Map(), s = 0, c = (e, t) => {
1021
1287
  e.forEach((e) => {
@@ -1047,185 +1313,504 @@ function Gt(e, t, n, r, i) {
1047
1313
  };
1048
1314
  return m(e);
1049
1315
  }
1050
- function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroups: l, columns: u, data: d, "data-testid": f, emptyComponent: p, getRowId: m, hasMoreRows: h = !1, infiniteScroll: _ = !1, infiniteScrollThreshold: te = 160, lazyLoad: y = !1, lazyLoadBatchSize: b = 30, lazyLoadMode: S = "append", lazyLoadThreshold: re, loading: ce = !1, loadingComponent: le, loadingMore: me = !1, multiSort: ge = !1, onChangeColumnLayout: ve, onChangeData: ye, onChangeSelection: Se, onChangeSort: Ce, onChangeSortModel: Ee, onClickCell: Oe, onClickRow: ke, onContextMenuCell: Ae, onContextMenuRow: Me, onDoubleClickCell: Ne, onDoubleClickRow: Pe, onKeyDownCell: Fe, onKeyDownRow: Ie, onLazyLoad: M, onLoadMore: Le, pagination: Re, persistHeaderWhenEmpty: ze = !0, rowHeight: N = 36, rowProps: P, showHeader: F = !0, skeletonRowCount: He, style: Ue, summary: I, theme: We, treeContext: L, virtualized: R = !1 }, z) {
1051
- let B = O(null), Ge = O(null), V = O(null), Ke = O(null), qe = O(null), Je = O(null), H = O(null), Ye = O(null), Xe = O(null), Ze = O(null), Qe = O(0), et = O(d), U = O(void 0), W = O(null), G = O(null), tt = O(null), nt = O(null), rt = O(!1), it = O(null), at = O(0), K = O(null), dt = O(null), q = O(null), [mt, _t] = k(0), [Ct, wt] = k(0), [J, kt] = k(null), [Y, At] = k(null), [Nt, Bt] = k(null), [Ht, Ut] = k(null), [Wt, Gt] = k(null), [Kt, qt] = k(d), [Jt, Yt] = k(void 0), [Xt, Zt] = k(null), [Qt, $t] = k(null), [en, tn] = k(0), nn = y ? Kt : d, [X, rn] = k(() => c({
1316
+ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroups: l, columns: u, data: d, "data-testid": f, emptyComponent: p, estimatedRowDetailHeight: m, expandedRowIds: h, getRowDetailHeight: v, getRowId: y, hasMoreRows: ee = !1, infiniteScroll: ne = !1, infiniteScrollThreshold: ie = 160, lazyLoad: x = !1, lazyLoadBatchSize: se = 30, lazyLoadMode: ce = "append", lazyLoadThreshold: me, loading: ge = !1, loadingComponent: ve, loadingMore: ye = !1, multiSort: Se = !1, onChangeColumnLayout: Ce, onChangeData: Te, onChangeSelection: Oe, onChangeSort: ke, onChangeSortModel: Ne, onClickCell: Pe, onClickRow: Fe, onContextMenuCell: Ie, onContextMenuRow: Le, onChangeExpandedRowIds: M, onDoubleClickCell: N, onDoubleClickRow: ze, onKeyDownCell: Be, onKeyDownRow: Ve, onLazyLoad: He, onLoadMore: Ue, pagination: We, persistHeaderWhenEmpty: P = !0, rowHeight: F = 36, rowProps: Ge, isRowExpandable: Ke, renderRowDetail: qe, showColumnMoveHandle: Je = !0, showHeader: Ye = !0, skeletonRowCount: Xe, style: Ze, summary: I, theme: nt, treeContext: L, virtualized: R = !1 }, it) {
1317
+ let z = O(null), at = O(null), B = O(null), ot = O(null), st = O(null), ct = O(null), lt = O(/* @__PURE__ */ new Map()), V = O(/* @__PURE__ */ new Map()), ut = O(/* @__PURE__ */ new Set()), H = O(null), yt = O(/* @__PURE__ */ new Set()), St = O(null), kt = O(/* @__PURE__ */ new Map()), U = O(null), W = O(null), Rt = O(null), Wt = O(null), Gt = O(/* @__PURE__ */ new Map()), G = O(null), Jt = O(null), Yt = O(null), nn = O(He), an = O(0), cn = O(null), K = O(null), gn = O(null), _n = O(null), vn = O(!1), yn = O(null), bn = O(0), xn = O(null), q = O(null), Sn = O(0), Cn = O(null), wn = O(null), Tn = O(null), En = O(null), [Dn, On] = k(0), [kn, An] = k(0), [jn, Mn] = k(0), [Nn, Pn] = k(null), [Fn, In] = k(null), [Ln, Rn] = k(null), [zn, Bn] = k(null), [Vn, Hn] = k(null), [Un, Wn] = k(null), [Gn, Kn] = k(null), [qn, Jn] = k(0), Yn = Ae(), Xn = d, [J, Zn] = k(() => c({
1052
1318
  columnGroups: l,
1053
1319
  columns: u,
1054
- getRowId: m,
1055
- pagination: Re,
1056
- rows: nn,
1057
- showHeader: F,
1058
- theme: We
1059
- })), Z = O(X), an = O({
1320
+ getRowId: y,
1321
+ pagination: We,
1322
+ rows: Xn,
1323
+ showHeader: Ye,
1324
+ theme: nt
1325
+ })), Y = O(J), Qn = O({
1060
1326
  columnGroups: l,
1061
1327
  columns: u,
1062
- data: nn,
1063
- getRowId: m,
1064
- pagination: Re,
1065
- showHeader: F
1066
- }), on = Math.max(0, Math.floor(Number.isFinite(e) ? Number(e) : 10)), sn = Math.max(1, Math.floor(b)), cn = Math.max(0, Math.floor(re ?? te)), ln = (e) => {
1067
- if (!y || S !== "append" || !M || Ze.current) return;
1068
- let t = Z.current.rows.length;
1069
- if (e === "scroll" && U.current !== void 0 && t >= U.current) return;
1070
- let n = new AbortController(), r = Qe.current + 1, i = e === "scroll" ? t : 0;
1071
- Qe.current = r, Xe.current?.abort(), Xe.current = n, Ze.current = e, e !== "scroll" && (at.current = 0, tn(0), B.current && (B.current.scrollTop = 0)), Gt(e), M({
1072
- limit: sn,
1073
- offset: i,
1074
- reason: e,
1075
- signal: n.signal
1076
- }).then((t) => {
1077
- if (n.signal.aborted || Qe.current !== r) return;
1078
- let i = e === "scroll" ? [...et.current, ...t.rows] : [...t.rows];
1079
- et.current = i, U.current = t.total, qt(i), Yt(t.total);
1080
- }).catch(() => {}).finally(() => {
1081
- Qe.current === r && (Ze.current = null, Xe.current = null, Gt(null));
1328
+ data: Xn,
1329
+ getRowId: y,
1330
+ pagination: We,
1331
+ showHeader: Ye
1332
+ }), $n = Math.max(0, Math.floor(Number.isFinite(e) ? Number(e) : 10)), er = Math.max(1, Math.floor(se)), tr = Math.max(0, Math.floor(me ?? ie)), nr = typeof He == "function", rr = typeof qe == "function" && !L, ir = D(() => {
1333
+ let e = /* @__PURE__ */ new Set();
1334
+ return (h ?? []).filter((t) => e.has(t) ? !1 : (e.add(t), !0));
1335
+ }, [h]), ar = D(() => new Set(ir), [ir]), or = (e, t) => {
1336
+ !rr || !t || !M || M(ar.has(e) ? ir.filter((t) => t !== e) : [...ir, e]);
1337
+ }, sr = () => {
1338
+ let e = U.current;
1339
+ U.current = null, e?.();
1340
+ }, cr = (e) => {
1341
+ sr(), U.current = e;
1342
+ };
1343
+ Me(() => {
1344
+ nn.current = He;
1345
+ }, [He]);
1346
+ let lr = (e) => {
1347
+ let t = nn.current;
1348
+ if (!x || ce !== "append" || !t || Yt.current) return;
1349
+ let n = Y.current.rows.length;
1350
+ if (e === "scroll" && (!ee || ge || ye)) return;
1351
+ let r = new AbortController(), i = an.current + 1, a = e === "scroll" ? n : 0;
1352
+ an.current = i, Jt.current?.abort(), Jt.current = r, Yt.current = e, e !== "scroll" && (Sn.current = 0, Jn(0), z.current && (z.current.scrollTop = 0));
1353
+ let o;
1354
+ try {
1355
+ o = t({
1356
+ limit: er,
1357
+ offset: a,
1358
+ reason: e,
1359
+ signal: r.signal
1360
+ });
1361
+ } catch {
1362
+ Yt.current = null, Jt.current = null;
1363
+ return;
1364
+ }
1365
+ Promise.resolve(o).catch(() => {}).finally(() => {
1366
+ an.current === i && (Yt.current = null, Jt.current = null);
1082
1367
  });
1083
1368
  };
1084
1369
  E(() => {
1085
- et.current = Kt;
1086
- }, [Kt]), E(() => {
1087
- U.current = Jt;
1088
- }, [Jt]), E(() => {
1089
- y || (et.current = d, qt(d), U.current = void 0, Yt(void 0));
1090
- }, [d, y]), E(() => {
1091
- if (!(!y || !M)) return ln("initial"), () => {
1092
- Qe.current += 1, Ze.current = null, Xe.current?.abort(), Xe.current = null;
1370
+ if (!(!x || !nr)) return lr("initial"), () => {
1371
+ an.current += 1, Yt.current = null, Jt.current?.abort(), Jt.current = null;
1093
1372
  };
1094
1373
  }, [
1095
- y,
1096
- M,
1097
- sn
1374
+ nr,
1375
+ x,
1376
+ er
1098
1377
  ]), E(() => {
1099
- let e = an.current;
1100
- if (e.columns === u && e.columnGroups === l && e.data === nn && e.getRowId === m && e.pagination === Re && e.showHeader === F) return;
1101
- an.current = {
1378
+ let e = Qn.current;
1379
+ if (e.columns === u && e.columnGroups === l && e.data === Xn && e.getRowId === y && e.pagination === We && e.showHeader === Ye) return;
1380
+ Qn.current = {
1102
1381
  columnGroups: l,
1103
1382
  columns: u,
1104
- data: nn,
1105
- getRowId: m,
1106
- pagination: Re,
1107
- showHeader: F
1383
+ data: Xn,
1384
+ getRowId: y,
1385
+ pagination: We,
1386
+ showHeader: Ye
1108
1387
  };
1109
- let t = Z.current, n = c({
1388
+ let t = Y.current, n = c({
1110
1389
  columnLayout: pe(t),
1111
1390
  columnGroups: l,
1112
1391
  columns: u,
1113
- getRowId: m,
1114
- pagination: Re ?? t.pagination,
1115
- rows: nn,
1116
- showHeader: F,
1392
+ getRowId: y,
1393
+ pagination: We ?? t.pagination,
1394
+ rows: Xn,
1395
+ showHeader: Ye,
1117
1396
  sortModel: t.sortModel,
1118
1397
  theme: t.theme
1119
- }), r = Vt(t, n) ? {
1398
+ }), r = hn(t, n) ? {
1120
1399
  ...n,
1121
1400
  selection: t.selection
1122
1401
  } : n;
1123
- Z.current = r, rn(r), Rt(r.sort, t.sort) || Ce?.(r.sort), zt(r.sortModel, t.sortModel) || Ee?.(r.sortModel);
1402
+ if (e.getRowId !== y) {
1403
+ let e = new Map(t.rowIds.map((e, n) => [e, t.rows[n]]));
1404
+ r.rowIds.forEach((t, n) => {
1405
+ e.has(t) && e.get(t) !== r.rows[n] && lt.current.delete(t);
1406
+ });
1407
+ }
1408
+ Y.current = r, Zn(r), pn(r.sort, t.sort) || ke?.(r.sort), mn(r.sortModel, t.sortModel) || Ne?.(r.sortModel);
1124
1409
  }, [
1125
1410
  l,
1126
1411
  u,
1127
- nn,
1128
- m,
1129
- Re,
1130
- F
1412
+ Xn,
1413
+ y,
1414
+ We,
1415
+ Ye
1131
1416
  ]), E(() => {
1132
- Z.current = X;
1133
- }, [X]), E(() => {
1134
- W.current !== null && W.current !== X.rows.length && (W.current = null);
1135
- }, [X.rows.length]), E(() => () => {
1136
- dt.current !== null && window.cancelAnimationFrame(dt.current), K.current !== null && window.clearTimeout(K.current);
1417
+ Y.current = J;
1418
+ }, [J]), E(() => {
1419
+ cn.current !== null && cn.current !== J.rows.length && (cn.current = null);
1420
+ }, [J.rows.length]), E(() => () => {
1421
+ sr(), Tn.current !== null && window.cancelAnimationFrame(Tn.current), wn.current !== null && window.clearTimeout(wn.current);
1137
1422
  }, []), E(() => {
1138
- let e = B.current;
1423
+ let e = z.current;
1139
1424
  if (!e || typeof ResizeObserver > "u") return;
1140
1425
  let t = new ResizeObserver(([e]) => {
1141
- e && (_t(e.contentRect.height), wt(e.contentRect.width));
1426
+ e && (On(e.contentRect.height), An(e.contentRect.width));
1142
1427
  });
1143
1428
  return t.observe(e), () => t.disconnect();
1429
+ }, []), E(() => {
1430
+ vt(lt.current, new Set(J.rowIds));
1431
+ }, [J.rowIds]);
1432
+ let ur = (e, t, n, r) => {
1433
+ let i = e.projection;
1434
+ if (!i || r !== e.contentWidth) return !1;
1435
+ let a = i.slotIndexByRowId.get(t), o = a === void 0 ? void 0 : i.slots[a];
1436
+ if (a === void 0 || o?.detail?.mode !== "auto") return !1;
1437
+ let s = i.heightIndex.getHeight(a) - o.detail.height + n, c = i.heightIndex.updateHeight(a, s);
1438
+ return o.detail.estimated = !1, o.detail.height = n, c !== 0;
1439
+ }, dr = (e) => {
1440
+ let t = St.current;
1441
+ if (!t) return;
1442
+ let n = e.filter(({ height: e, rowId: t, width: n }) => {
1443
+ let r = lt.current.get(t);
1444
+ return !r || r.width !== n || Math.abs(r.height - e) >= .5;
1445
+ });
1446
+ if (n.length === 0) return;
1447
+ let r = t.projection, i = z.current, a = i?.clientHeight || t.viewportHeight, o = q.current, s = o?.status === "pending" ? o : !o && r && i ? Dt({
1448
+ logicalScrollTop: xn.current && Math.abs(i.scrollTop - xn.current.actualPhysical) <= .5 ? xn.current.targetLogical : void 0,
1449
+ physicalScrollTop: i.scrollTop,
1450
+ projection: {
1451
+ heightIndex: r.heightIndex,
1452
+ keys: r.keys,
1453
+ mixed: !0
1454
+ },
1455
+ viewportHeight: a
1456
+ }) : void 0, c = !1;
1457
+ for (let e of n) lt.current.set(e.rowId, {
1458
+ height: e.height,
1459
+ width: e.width
1460
+ }), c = ur(t, e.rowId, e.height, e.width) || c;
1461
+ if (s && c && o?.status !== "pending") {
1462
+ let e = bn.current + 1;
1463
+ bn.current = e, q.current = {
1464
+ ...s,
1465
+ revision: e,
1466
+ status: "pending"
1467
+ };
1468
+ }
1469
+ (c || !r) && Mn((e) => e + 1);
1470
+ }, fr = () => {
1471
+ if (typeof ResizeObserver > "u") return null;
1472
+ let e = new ResizeObserver((e) => {
1473
+ let t = [];
1474
+ for (let n of e) {
1475
+ let e = V.current.get(n.target);
1476
+ if (!e) continue;
1477
+ let r = (Array.isArray(n.borderBoxSize) ? n.borderBoxSize[0] : n.borderBoxSize)?.blockSize ?? n.target.getBoundingClientRect().height, i = Math.round(n.target.getBoundingClientRect().width);
1478
+ Number.isFinite(r) && r > 0 && t.push({
1479
+ height: r,
1480
+ rowId: e.rowId,
1481
+ width: i
1482
+ });
1483
+ }
1484
+ dr(t);
1485
+ });
1486
+ H.current = e;
1487
+ for (let t of V.current.values()) yt.current.add(t.element), e.observe(t.element);
1488
+ return e;
1489
+ };
1490
+ Me(() => () => {
1491
+ H.current?.disconnect(), H.current = null, yt.current.clear(), V.current.clear(), ut.current.clear(), St.current = null;
1144
1492
  }, []);
1145
- let un = (e, t, n = {}) => {
1146
- t.rows !== e.rows && ye?.(t.rows), t.selection !== e.selection && Se?.(t.selection), n.columnLayoutChanged && ve?.(pe(t)), Rt(t.sort, e.sort) || Ce?.(t.sort), zt(t.sortModel, e.sortModel) || Ee?.(t.sortModel);
1147
- }, Q = (e, t = {}) => {
1148
- let n = Z.current, r = typeof e == "function" ? e(n) : e;
1149
- Z.current = r, rn(r), un(n, r, t);
1150
- }, $ = D(() => ne(X), [X]), dn = D(() => ee(X), [X]), fn = D(() => I ? $e(L?.summaryRows ?? X.rows, $, I) : null, [
1151
- X.rows,
1493
+ let pr = () => {
1494
+ V.current.size === 0 && (H.current?.disconnect(), H.current = null, yt.current.clear());
1495
+ }, mr = (e, t, n) => {
1496
+ for (let [t, r] of V.current) r.rowId === e && t !== n && (H.current?.unobserve(t), yt.current.delete(t), V.current.delete(t), ut.current.delete(t));
1497
+ if (!n || t === "fixed") {
1498
+ pr();
1499
+ return;
1500
+ }
1501
+ V.current.set(n, {
1502
+ element: n,
1503
+ rowId: e
1504
+ });
1505
+ }, hr = (e, t, n = {}) => {
1506
+ t.rows !== e.rows && Te?.(t.rows), t.selection !== e.selection && Oe?.(t.selection), n.columnLayoutChanged && Ce?.(pe(t)), pn(t.sort, e.sort) || ke?.(t.sort), mn(t.sortModel, e.sortModel) || Ne?.(t.sortModel);
1507
+ }, X = (e, t = {}) => {
1508
+ let n = Y.current, r = typeof e == "function" ? e(n) : e;
1509
+ Y.current = r, Zn(r), hr(n, r, t);
1510
+ }, Z = D(() => te(J), [J]), gr = /* @__PURE__ */ new Map();
1511
+ E(() => {
1512
+ Gt.current = gr;
1513
+ });
1514
+ let _r = D(() => {
1515
+ let e = Z.length;
1516
+ if (e === 0) return [];
1517
+ let t = Z.map((e) => J.columnState[e.id]?.width ?? e.width);
1518
+ if (kn <= 0) {
1519
+ let n = `${100 / e}%`;
1520
+ return t.map((e, t) => {
1521
+ if (e === void 0) return n;
1522
+ let r = Z[t];
1523
+ return rn(e, en(r), tn(r));
1524
+ });
1525
+ }
1526
+ let n = 0;
1527
+ for (let e of t) n += e ?? 0;
1528
+ let r = Z.filter((e, n) => t[n] === void 0), i = r.length > 0 ? Math.max(0, (kn - n) / r.length) : 0;
1529
+ return Z.map((e, n) => {
1530
+ let r = t[n] ?? i, a = en(e), o = e.maxWidth ?? Infinity;
1531
+ return Math.min(o, Math.max(a, r));
1532
+ });
1533
+ }, [
1534
+ kn,
1535
+ J.columnState,
1536
+ Z
1537
+ ]), vr = D(() => {
1538
+ let e = 0;
1539
+ for (let t of _r) {
1540
+ if (typeof t != "number") return;
1541
+ e += t;
1542
+ }
1543
+ return e;
1544
+ }, [_r]), yr = D(() => {
1545
+ if (typeof vr == "number") return Math.max(kn, vr);
1546
+ }, [vr, kn]), br = typeof yr == "number" && Number.isFinite(yr) ? Math.round(yr) : 0, xr = D(() => _(J), [J]), Sr = D(() => I ? rt(L?.summaryRows ?? J.rows, Z, I) : null, [
1547
+ J.rows,
1152
1548
  I,
1153
1549
  L?.summaryRows,
1154
- $
1155
- ]), pn = D(() => {
1550
+ Z
1551
+ ]), Cr = D(() => {
1156
1552
  if (!I) return [];
1157
1553
  let e = [], t = 0;
1158
- for (; t < $.length;) {
1159
- let n = $[t], r = I.columns[n.id], i = typeof r == "object" && r ? r : void 0, a = i?.colSpan, o = Math.min(typeof a == "number" && Number.isFinite(a) ? Math.max(1, Math.floor(a)) : 1, $.length - t);
1554
+ for (; t < Z.length;) {
1555
+ let n = Z[t], r = I.columns[n.id], i = typeof r == "object" && r ? r : void 0, a = i?.colSpan, o = Math.min(typeof a == "number" && Number.isFinite(a) ? Math.max(1, Math.floor(a)) : 1, Z.length - t);
1160
1556
  e.push({
1161
1557
  className: i?.className,
1162
1558
  colSpan: o,
1163
1559
  column: n,
1164
1560
  style: i?.style,
1165
- value: fn?.[n.id] ?? (e.length === 0 ? I.label : null)
1561
+ value: Sr?.[n.id] ?? (e.length === 0 ? I.label : null)
1166
1562
  }), t += o;
1167
1563
  }
1168
1564
  return e;
1169
1565
  }, [
1170
1566
  I,
1171
- fn,
1172
- $
1173
- ]), mn = D(() => L || X.sortModel.length === 0 ? null : v(X), [X, L]), hn = mn?.length ?? X.rows.length, gn = Math.max(0, X.pagination.pageIndex) * Math.max(1, X.pagination.pageSize), _n = D(() => {
1567
+ Sr,
1568
+ Z
1569
+ ]), wr = D(() => L || J.sortModel.length === 0 ? null : b(J), [J, L]), Tr = D(() => wr ?? J.rows.map((e, t) => t), [wr, J.rows]), Er = Tr.length, Dr = Math.max(1, J.pagination.pageSize), Or = Math.max(0, J.pagination.pageIndex) * Dr, kr = D(() => {
1570
+ if (!rr) return /* @__PURE__ */ new Set();
1571
+ let e = /* @__PURE__ */ new Set(), t = R ? 0 : Or, n = R ? Tr.length : Math.min(Tr.length, Or + Dr);
1572
+ for (let r = t; r < n; r += 1) {
1573
+ let t = Tr[r];
1574
+ if (t === void 0) continue;
1575
+ let n = J.rows[t], i = J.rowIds[t];
1576
+ if (n === void 0 || i === void 0 || !ar.has(i)) continue;
1577
+ let a = { row: Nt({
1578
+ dataIndex: t,
1579
+ row: n,
1580
+ rowId: i,
1581
+ visibleIndex: r
1582
+ }) };
1583
+ Ke?.(a) !== !1 && e.add(i);
1584
+ }
1585
+ return e;
1586
+ }, [
1587
+ ar,
1588
+ Ke,
1589
+ Dr,
1590
+ Or,
1591
+ Tr,
1592
+ rr,
1593
+ J.rowIds,
1594
+ J.rows,
1595
+ R
1596
+ ]), Ar = D(() => {
1597
+ if (!R || kr.size === 0) return null;
1598
+ let e = Math.max(1, F), t = Tr.flatMap((t, n) => {
1599
+ let r = J.rows[t], i = J.rowIds[t];
1600
+ if (r === void 0 || i === void 0) return [];
1601
+ let a = null;
1602
+ if (kr.has(i)) {
1603
+ let e = { row: Nt({
1604
+ dataIndex: t,
1605
+ row: r,
1606
+ rowId: i,
1607
+ visibleIndex: n
1608
+ }) }, o = pt(v?.(e));
1609
+ a = o.mode === "auto" ? {
1610
+ ..._t(lt.current, i, br, ft(m, F)),
1611
+ mode: "auto"
1612
+ } : {
1613
+ estimated: !1,
1614
+ height: o.height,
1615
+ mode: "fixed"
1616
+ };
1617
+ }
1618
+ return [dt({
1619
+ dataIndex: t,
1620
+ detail: a,
1621
+ row: r,
1622
+ rowHeight: e,
1623
+ rowId: i,
1624
+ visibleIndex: n
1625
+ })];
1626
+ }), n = mt.from(t.map((t) => ht(t, e))), r = /* @__PURE__ */ new Map();
1627
+ for (let e = 0; e < t.length; e += 1) {
1628
+ let n = t[e]?.rowId;
1629
+ n !== void 0 && !r.has(n) && r.set(n, e);
1630
+ }
1631
+ return {
1632
+ heightIndex: n,
1633
+ keys: t.map((e) => e.key),
1634
+ slotIndexByRowId: r,
1635
+ slots: t
1636
+ };
1637
+ }, [
1638
+ kr,
1639
+ br,
1640
+ m,
1641
+ v,
1642
+ Tr,
1643
+ F,
1644
+ J.rowIds,
1645
+ J.rows,
1646
+ R
1647
+ ]), jr = D(() => ({
1648
+ contentWidth: br,
1649
+ projection: Ar,
1650
+ viewportHeight: Dn || Math.max(1, F) * 12
1651
+ }), [
1652
+ Dn,
1653
+ br,
1654
+ Ar,
1655
+ F
1656
+ ]);
1657
+ Me(() => {
1658
+ if (St.current = jr, V.current.size === 0) {
1659
+ pr();
1660
+ return;
1661
+ }
1662
+ if (typeof ResizeObserver < "u") {
1663
+ let e = H.current, t = e ?? fr();
1664
+ if (e) for (let e of V.current.values()) yt.current.has(e.element) || (yt.current.add(e.element), t?.observe(e.element));
1665
+ return;
1666
+ }
1667
+ let e = [];
1668
+ for (let t of V.current.values()) {
1669
+ if (ut.current.has(t.element)) continue;
1670
+ ut.current.add(t.element);
1671
+ let n = t.element.getBoundingClientRect();
1672
+ Number.isFinite(n.height) && n.height > 0 && e.push({
1673
+ height: n.height,
1674
+ rowId: t.rowId,
1675
+ width: Math.round(n.width)
1676
+ });
1677
+ }
1678
+ dr(e);
1679
+ });
1680
+ let Mr = D(() => {
1174
1681
  if (R) {
1175
- let e = Math.max(1, N), t = mt || N * 12, n = hn * e, r = Math.min(n, 15e5), i = Math.max(0, n - t), a = Math.max(0, r - t), o = i > 0 && a > 0 ? i / a : 1, s = Math.min(i, Math.max(0, en) * o), c = Math.max(0, Math.floor(s / e) - on), l = Math.min(hn, Math.ceil((s + Math.max(0, t)) / e) + on), u = c * e, d = o > 0 ? u / o : u;
1682
+ let e = Math.max(1, F), t = Dn || F * 12;
1683
+ if (Ar) {
1684
+ let e = Vn && Math.abs(qn - Vn.actualPhysical) <= .5 ? Vn : null, n = gt({
1685
+ heightIndex: Ar.heightIndex,
1686
+ overscan: $n,
1687
+ physicalScrollTop: e?.requestedPhysical ?? qn,
1688
+ viewportHeight: t
1689
+ });
1690
+ return {
1691
+ mixed: !0,
1692
+ renderOffset: e ? e.actualPhysical - (e.targetLogical - n.logicalStartOffset) : n.renderOffset,
1693
+ scrollHeight: n.physicalScrollHeight,
1694
+ slots: Ar.slots.slice(n.startIndex, n.endIndex)
1695
+ };
1696
+ }
1697
+ let n = Er * 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, qn) * o), c = Math.max(0, Math.floor(s / e) - $n), l = Math.min(Er, Math.ceil((s + Math.max(0, t)) / e) + $n), u = c * e;
1176
1698
  return {
1177
- entries: ot(mn, X.rows, X.rowIds, c, l),
1178
- renderOffset: d,
1179
- scrollHeight: r
1699
+ mixed: !1,
1700
+ renderOffset: o > 0 ? u / o : u,
1701
+ scrollHeight: r,
1702
+ slots: Tt(wr, J.rows, J.rowIds, c, l).map((t) => dt({
1703
+ ...t,
1704
+ detail: null,
1705
+ rowHeight: e
1706
+ }))
1180
1707
  };
1181
1708
  }
1182
1709
  return {
1183
- entries: ot(mn, X.rows, X.rowIds, gn, gn + Math.max(1, X.pagination.pageSize)),
1710
+ mixed: !1,
1184
1711
  renderOffset: 0,
1185
- scrollHeight: 0
1712
+ scrollHeight: 0,
1713
+ slots: Tt(wr, J.rows, J.rowIds, Or, Or + Dr).map((e) => {
1714
+ let t = null;
1715
+ if (kr.has(e.rowId)) {
1716
+ let n = { row: Nt(e) }, r = pt(v?.(n));
1717
+ t = r.mode === "auto" ? {
1718
+ ..._t(lt.current, e.rowId, br, ft(m, F)),
1719
+ mode: "auto"
1720
+ } : {
1721
+ estimated: !1,
1722
+ height: r.height,
1723
+ mode: "fixed"
1724
+ };
1725
+ }
1726
+ return dt({
1727
+ ...e,
1728
+ detail: t,
1729
+ rowHeight: F
1730
+ });
1731
+ })
1186
1732
  };
1187
1733
  }, [
1188
- mt,
1189
- gn,
1190
- N,
1191
- en,
1192
- mn,
1193
- X.pagination.pageSize,
1194
- X.rowIds,
1195
- X.rows,
1196
- on,
1734
+ Dn,
1735
+ br,
1736
+ jn,
1737
+ kr,
1738
+ m,
1739
+ v,
1740
+ Vn,
1741
+ Ar,
1742
+ Or,
1743
+ F,
1744
+ qn,
1745
+ Dr,
1746
+ wr,
1747
+ J.rowIds,
1748
+ J.rows,
1749
+ $n,
1197
1750
  R,
1198
- hn
1199
- ]), vn = We ?? X.theme, yn = vn.density === "compact" ? "text-[11px]" : vn.density === "spacious" ? "text-[13px]" : "text-[length:var(--comins-font-size-base,12px)]", bn = D(() => new Set(X.selection.rowIds), [X.selection.rowIds]), xn = D(() => {
1200
- let e = $.length;
1201
- if (e === 0) return [];
1202
- let t = $.map((e) => X.columnState[e.id]?.width ?? e.width);
1203
- if (Ct <= 0) {
1204
- let n = `${100 / e}%`;
1205
- return t.map((e) => e ?? n);
1751
+ Er
1752
+ ]), Q = D(() => R ? Ar ? {
1753
+ heightIndex: Ar.heightIndex,
1754
+ keys: Ar.keys,
1755
+ mixed: !0
1756
+ } : {
1757
+ mixed: !1,
1758
+ projectedDataIndexes: Tr,
1759
+ rowHeight: Math.max(1, F),
1760
+ rowIds: J.rowIds,
1761
+ visibleRowCount: Er
1762
+ } : null, [
1763
+ Ar,
1764
+ Tr,
1765
+ F,
1766
+ J.rowIds,
1767
+ R,
1768
+ Er
1769
+ ]), Nr = Cn.current, $ = q.current, Pr = !$ && Q && Nr && Q !== Nr && z.current ? Dt({
1770
+ logicalScrollTop: Vn && Math.abs(z.current.scrollTop - Vn.actualPhysical) <= .5 ? Vn.targetLogical : void 0,
1771
+ physicalScrollTop: z.current.scrollTop,
1772
+ projection: Nr,
1773
+ viewportHeight: z.current.clientHeight || Dn || F * 12
1774
+ }) : void 0, Fr = $?.status === "pending" ? $ : Pr;
1775
+ Me(() => {
1776
+ if (!Q) {
1777
+ Cn.current = null, q.current = null, xn.current = null, Hn(null);
1778
+ return;
1206
1779
  }
1207
- let n = 0;
1208
- for (let e of t) n += e ?? 0;
1209
- let r = $.filter((e, n) => t[n] === void 0), i = r.length > 0 ? Math.max(0, (Ct - n) / r.length) : 0;
1210
- return $.map((e, n) => {
1211
- let r = t[n] ?? i, a = Ot(e), o = e.maxWidth ?? Infinity;
1212
- return Math.min(o, Math.max(a, r));
1213
- });
1214
- }, [
1215
- Ct,
1216
- X.columnState,
1217
- $
1218
- ]), Sn = D(() => {
1219
- let e = 0;
1220
- for (let t of xn) {
1221
- if (typeof t != "number") return;
1222
- e += t;
1780
+ if (Cn.current = Q, $?.status === "cancelled") {
1781
+ let e = q.current;
1782
+ e?.revision === $.revision && e.status === "cancelled" && (q.current = null);
1783
+ return;
1223
1784
  }
1224
- return e;
1225
- }, [xn]), Cn = D(() => {
1226
- if (typeof Sn == "number") return Math.max(Ct, Sn);
1227
- }, [Sn, Ct]), wn = typeof Sn == "number" && Ct > 0 && Sn > Ct + 1, Tn = y ? y && (Jt === void 0 || hn < Jt) : h, En = ce || Wt === "initial" || Wt === "refresh", Dn = me || Wt === "scroll", On = hn === 0, kn = En && On, An = !En && On, jn = (_ || y) && Dn && Tn && !On, Mn = Math.max(1, Math.floor(He ?? Math.min(Math.max(1, X.pagination.pageSize), 5))), Nn = (kn ? Mn : +!!An) + +!!jn, Pn = (_n.entries.length + Nn) * N, Fn = R ? 0 : Math.max(0, mt - Pn), In = X.showHeader && (ze || !On || En), Ln = (e, t) => (e.ctrlKey || e.metaKey) && e.key.toLowerCase() === t, Rn = (e) => _n.entries[e], zn = (e, t, n) => {
1228
- let r = (L ? e.rows.map((e, t) => t) : v(e)).flatMap((t, n) => {
1785
+ let e = z.current;
1786
+ if (!e || !Fr) return;
1787
+ let t = Et(Q), n = bt({
1788
+ anchor: Fr.anchor,
1789
+ getNextHeight: (e) => Q.mixed ? Q.heightIndex.getHeight(e) : Q.rowHeight,
1790
+ nextKeys: t,
1791
+ previousKeys: Fr.previousKeys
1792
+ }), r = n ? (Q.mixed ? Q.heightIndex.getPrefixHeight(n.index) : n.index * Q.rowHeight) + n.offsetWithinSlot : 0, i = xt(r, Q.mixed ? Q.heightIndex.getTotalHeight() : Q.visibleRowCount * Q.rowHeight, e.clientHeight || Fr.previousViewportHeight);
1793
+ if ($) {
1794
+ let e = q.current;
1795
+ if (e?.revision !== $.revision || e.status !== "pending") return;
1796
+ }
1797
+ if (Tn.current !== null && (window.cancelAnimationFrame(Tn.current), Tn.current = null), e.scrollTop = i, $) {
1798
+ let e = q.current;
1799
+ if (e?.revision !== $.revision || e.status !== "pending") return;
1800
+ }
1801
+ let a = e.scrollTop, o = $?.revision ?? bn.current + 1, s = Q.mixed ? {
1802
+ actualPhysical: a,
1803
+ requestedPhysical: i,
1804
+ revision: o,
1805
+ targetLogical: r
1806
+ } : null;
1807
+ bn.current = Math.max(bn.current, o), $ && (q.current = null), xn.current = s, Sn.current = a, Hn(s), Jn(a);
1808
+ }, [Q, Fr]);
1809
+ let Ir = nt ?? J.theme, Lr = Ir.density === "compact" ? "text-[11px]" : Ir.density === "spacious" ? "text-[13px]" : "text-[length:var(--comins-font-size-base,12px)]", Rr = D(() => new Set(J.selection.rowIds), [J.selection.rowIds]), zr = typeof vr == "number" && kn > 0 && vr > kn + 1, Br = ee, Vr = ge, Hr = ye, Ur = Er === 0, Wr = Vr && Ur, Gr = !Vr && Ur, Kr = (ne || x) && Hr && Br && !Ur, qr = Math.max(1, Math.floor(Xe ?? Math.min(Math.max(1, J.pagination.pageSize), 5))), Jr = (Wr ? qr : +!!Gr) + +!!Kr, Yr = Mr.slots.reduce((e, t) => e + ht(t, F), 0) + Jr * F, Xr = R ? 0 : Math.max(0, Dn - Yr), Zr = J.showHeader && (P || !Ur || Vr), Qr = (e, t) => (e.ctrlKey || e.metaKey) && e.key.toLowerCase() === t, $r = (e) => {
1810
+ let t = Mr.slots[e];
1811
+ return t?.kind === "data" ? t : void 0;
1812
+ }, ei = (e, t, n) => {
1813
+ let r = (L ? e.rows.map((e, t) => t) : b(e)).flatMap((t, n) => {
1229
1814
  let r = e.rows[t], i = e.rowIds[t];
1230
1815
  return r === void 0 || i === void 0 ? [] : [{
1231
1816
  dataIndex: t,
@@ -1237,54 +1822,68 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1237
1822
  if (i < 0 || a < 0) return [n];
1238
1823
  let o = Math.min(i, a), s = Math.max(i, a);
1239
1824
  return r.slice(o, s + 1).map((e) => e.rowId);
1240
- }, Bn = (e, t) => {
1241
- Q((n) => fe(n, zn(n, e, t)));
1242
- }, Vn = (e) => {
1243
- Q((t) => fe(t, e.flatMap((e) => {
1244
- let t = Rn(e);
1825
+ }, ti = (e, t) => {
1826
+ X((n) => fe(n, ei(n, e, t)));
1827
+ }, ni = (e) => {
1828
+ X((t) => fe(t, e.flatMap((e) => {
1829
+ let t = $r(e);
1245
1830
  return t ? [t.rowId] : [];
1246
1831
  })));
1247
- }, Hn = () => {
1248
- let e = q.current;
1249
- e && (e.cleanup(), e.timer !== null && window.clearTimeout(e.timer), q.current = null);
1250
- }, Un = (e) => {
1251
- q.current?.columnId !== e && (Hn(), q.current = {
1832
+ }, ri = () => {
1833
+ let e = En.current;
1834
+ e && (e.cleanup(), e.timer !== null && window.clearTimeout(e.timer), En.current = null);
1835
+ }, ii = (e) => {
1836
+ En.current?.columnId !== e && (ri(), En.current = {
1252
1837
  cleanup: () => void 0,
1253
1838
  columnId: e,
1254
1839
  timer: null
1255
1840
  });
1256
- }, Wn = () => {
1257
- let e = q.current;
1841
+ }, ai = () => {
1842
+ let e = En.current;
1258
1843
  e && (e.cleanup(), e.cleanup = () => void 0, e.timer = window.setTimeout(() => {
1259
- q.current === e && (q.current = null);
1844
+ En.current === e && (En.current = null);
1260
1845
  }, 0));
1261
- }, Gn = () => {
1262
- let e = q.current;
1846
+ }, oi = () => {
1847
+ let e = En.current;
1263
1848
  if (!e) return;
1264
- let t = () => Wn(), n = () => Hn(), r = () => Hn();
1849
+ let t = () => ai(), n = () => ri(), r = () => ri();
1265
1850
  e.cleanup(), e.cleanup = () => {
1266
1851
  window.removeEventListener("pointerup", t), window.removeEventListener("pointercancel", n), window.removeEventListener("blur", r);
1267
1852
  }, window.addEventListener("pointerup", t, { once: !0 }), window.addEventListener("pointercancel", n, { once: !0 }), window.addEventListener("blur", r, { once: !0 });
1268
- }, Kn = (e) => q.current?.columnId === e ? (Hn(), !0) : !1, qn = (e, t) => {
1269
- e.sort && Q((n) => be(n, Pt(n.sortModel, e.id, ge && t)));
1270
- }, Jn = (e, t) => {
1853
+ }, si = (e) => En.current?.columnId === e ? (ri(), !0) : !1, ci = (e, t) => {
1854
+ e.sort && X((n) => be(n, ln(n.sortModel, e.id, Se && t)));
1855
+ }, li = (e, t) => {
1271
1856
  let n = document.elementFromPoint(e, t)?.closest("[data-comins-column-id], [data-comins-column-group-id]");
1272
1857
  if (!n) return null;
1273
- if (n.dataset.cominsColumnId) return n.dataset.cominsColumnId;
1274
- let r = n.dataset.cominsColumnGroupId;
1275
- return (r ? Z.current.columnGroups.find((e) => e.id === r) : void 0)?.children.find((e) => $.some((t) => t.id === e)) ?? null;
1858
+ let r = Number(n.dataset.cominsColumnDepth);
1859
+ if (r !== 0 && r !== 1) return null;
1860
+ if (n.dataset.cominsColumnId) return {
1861
+ depth: r,
1862
+ id: n.dataset.cominsColumnId,
1863
+ kind: "column",
1864
+ parentGroupId: n.dataset.cominsColumnParentGroupId
1865
+ };
1866
+ let i = n.dataset.cominsColumnGroupId;
1867
+ return i ? {
1868
+ depth: r,
1869
+ id: i,
1870
+ kind: "group"
1871
+ } : null;
1872
+ }, ui = (e) => {
1873
+ let t = e.kind === "column" ? e.id : Y.current.columnGroups.find((t) => t.id === e.id)?.children.find((e) => Z.some((t) => t.id === e));
1874
+ return t ? Z.findIndex((e) => e.id === t) : -1;
1276
1875
  };
1277
- je(z, () => ({
1278
- clearSort: () => Q((e) => i(e)),
1876
+ je(it, () => ({
1877
+ clearSort: () => X((e) => i(e)),
1279
1878
  expand: (e) => L?.onExpand(e),
1280
1879
  fold: (e) => L?.onFold(e),
1281
- getColumnLayout: () => pe(X),
1282
- getSortModel: () => X.sortModel,
1283
- getSortState: () => X.sort,
1284
- setColumnLayout: (e) => Q((n) => t(n, e), { columnLayoutChanged: !0 }),
1285
- setMoveTargetRow: (e, t) => Q((n) => {
1880
+ getColumnLayout: () => pe(J),
1881
+ getSortModel: () => J.sortModel,
1882
+ getSortState: () => J.sort,
1883
+ setColumnLayout: (e) => X((n) => t(n, e), { columnLayoutChanged: !0 }),
1884
+ setMoveTargetRow: (e, t) => X((n) => {
1286
1885
  if (L) return n;
1287
- let r = v(n).flatMap((e) => {
1886
+ let r = b(n).flatMap((e) => {
1288
1887
  let t = n.rowIds[e];
1289
1888
  return t === void 0 ? [] : [t];
1290
1889
  }), i = r[t];
@@ -1303,65 +1902,105 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1303
1902
  sortModel: []
1304
1903
  } : n;
1305
1904
  }),
1306
- setSelectedRow: (e) => Vn([e]),
1307
- setSelectedRows: (e) => Vn(e),
1308
- setSortModel: (e) => Q((t) => be(t, e)),
1309
- setSortState: (e) => Q((t) => xe(t, e))
1905
+ setSelectedRow: (e) => ni([e]),
1906
+ setSelectedRows: (e) => ni(e),
1907
+ setSortModel: (e) => X((t) => be(t, e)),
1908
+ setSortState: (e) => X((t) => xe(t, e))
1310
1909
  }), [
1311
- _n.entries,
1312
- X,
1910
+ Mr.slots,
1911
+ J,
1313
1912
  L
1314
1913
  ]);
1315
- let Yn = () => {
1316
- let e = H.current;
1317
- e && (e.cleanup(), e.timer !== null && window.clearTimeout(e.timer)), H.current = null, kt(null), At(null), Bt(null), Ut(null);
1914
+ let di = () => {
1915
+ let e = W.current;
1916
+ e && (e.cleanup(), e.timer !== null && window.clearTimeout(e.timer)), W.current = null, Pn(null), In(null), Rn(null), Bn(null);
1318
1917
  };
1319
1918
  E(() => () => {
1320
- Yn(), Hn();
1919
+ di(), ri(), Rt.current?.();
1321
1920
  }, []);
1322
- let Xn = (e) => {
1921
+ let fi = () => {
1922
+ if (Rt.current?.(), Rt.current = null, Wt.current = null, typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
1923
+ let e = [
1924
+ B.current,
1925
+ z.current,
1926
+ at.current
1927
+ ].flatMap((e) => e ? Array.from(e.querySelectorAll("[data-comins-column-id], [data-comins-cell-column-id], [data-comins-summary-column-id]")) : []), t = /* @__PURE__ */ new Map();
1928
+ for (let n of e) t.set(n, n.getBoundingClientRect().left);
1929
+ Wt.current = t;
1930
+ };
1931
+ Me(() => {
1932
+ let e = Wt.current;
1933
+ if (Wt.current = null, !e) return;
1934
+ let t = [];
1935
+ for (let [n, r] of e) {
1936
+ if (!n.isConnected) continue;
1937
+ let e = r - n.getBoundingClientRect().left;
1938
+ Math.abs(e) < .5 || (n.dataset.columnMoveAnimating = "prepare", n.style.setProperty("--comins-column-move-offset", `${e}px`), t.push(n));
1939
+ }
1940
+ if (t.length === 0) return;
1941
+ t[0]?.getBoundingClientRect();
1942
+ let n = 0, r = 0, i = () => {
1943
+ window.cancelAnimationFrame(n), window.clearTimeout(r);
1944
+ for (let e of t) delete e.dataset.columnMoveAnimating, e.style.removeProperty("--comins-column-move-offset");
1945
+ Rt.current === i && (Rt.current = null);
1946
+ };
1947
+ return Rt.current = i, n = window.requestAnimationFrame(() => {
1948
+ for (let e of t) e.dataset.columnMoveAnimating = "true", e.style.setProperty("--comins-column-move-offset", "0px");
1949
+ }), r = window.setTimeout(i, 220), i;
1950
+ }, [J.columnOrder]);
1951
+ let pi = (e) => {
1323
1952
  if (e.event.button !== 0) return;
1324
1953
  let t = e.event.pointerType, n = t === "mouse" || t === "", r = () => {
1325
- e.sortColumnId && Un(e.sortColumnId);
1954
+ e.sortColumnId && ii(e.sortColumnId);
1326
1955
  }, i = (t, n) => {
1327
- let i = H.current;
1328
- !i || i !== u || i.active || i.blocked || (i.active = !0, i.cancelSort = !0, r(), e.activate(t, n));
1329
- }, a = (e) => {
1330
- let t = H.current;
1331
- if (!(!t || t !== u)) {
1332
- if (!t.active && !t.blocked && n) {
1333
- let n = Ve({
1334
- clientX: e.clientX,
1335
- clientY: e.clientY,
1336
- startX: t.startX,
1337
- startY: t.startY
1956
+ let i = W.current;
1957
+ !i || i !== u || i.active || i.blocked || (i.active = !0, i.cancelSort = !0, r(), e.activate(t, n), Bn({
1958
+ ...e.source,
1959
+ status: "neutral"
1960
+ }));
1961
+ }, a = (t) => {
1962
+ let a = W.current;
1963
+ if (!(!a || a !== u)) {
1964
+ if (!a.active && !a.blocked && n) {
1965
+ let e = Re({
1966
+ clientX: t.clientX,
1967
+ clientY: t.clientY,
1968
+ startX: a.startX,
1969
+ startY: a.startY
1338
1970
  });
1339
- n === "activate" ? i(e.clientX, e.clientY) : n === "cancel" && (t.blocked = !0, t.cancelSort = !0, r());
1971
+ e === "activate" ? i(t.clientX, t.clientY) : e === "cancel" && (a.blocked = !0, a.cancelSort = !0, r());
1972
+ }
1973
+ if (!a.active && !a.blocked && !n && Math.hypot(t.clientX - a.startX, t.clientY - a.startY) > 4 && (a.blocked = !0, a.cancelSort = !0, window.clearTimeout(a.timer ?? void 0), r()), a.active) {
1974
+ t.preventDefault(), Rn({
1975
+ x: t.clientX,
1976
+ y: t.clientY
1977
+ });
1978
+ let n = li(t.clientX, t.clientY);
1979
+ Bn(n ? {
1980
+ ...n,
1981
+ status: e.resolveTarget(n)
1982
+ } : null);
1340
1983
  }
1341
- !t.active && !t.blocked && !n && Math.hypot(e.clientX - t.startX, e.clientY - t.startY) > 4 && (t.blocked = !0, t.cancelSort = !0, window.clearTimeout(t.timer ?? void 0), r()), t.active && (e.preventDefault(), Bt({
1342
- x: e.clientX,
1343
- y: e.clientY
1344
- }), Ut(Jn(e.clientX, e.clientY)));
1345
1984
  }
1346
1985
  }, o = (t) => {
1347
- let n = H.current;
1986
+ let n = W.current;
1348
1987
  if (n === u && n.active) {
1349
- let n = Jn(t.clientX, t.clientY);
1350
- n && e.commitTarget(n);
1988
+ let n = li(t.clientX, t.clientY);
1989
+ n && e.resolveTarget(n) === "valid" && e.commitTarget(n);
1351
1990
  }
1352
- n === u && n.cancelSort && Wn(), Yn();
1991
+ n === u && n.cancelSort && ai(), di();
1353
1992
  }, s = () => {
1354
- Hn(), Yn();
1993
+ ri(), di();
1355
1994
  }, c = (e) => {
1356
- e.key === "Escape" && (e.preventDefault(), H.current === u && u.cancelSort && Gn(), Yn());
1995
+ e.key === "Escape" && (e.preventDefault(), W.current === u && u.cancelSort && oi(), di());
1357
1996
  }, l = () => {
1358
- Hn(), Yn();
1997
+ ri(), di();
1359
1998
  }, u = {
1360
1999
  active: !1,
1361
2000
  blocked: !1,
1362
2001
  cancelSort: !1,
1363
2002
  cleanup: () => {
1364
- window.removeEventListener("pointermove", a), window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", s), window.removeEventListener("keydown", c), window.removeEventListener("blur", l);
2003
+ window.removeEventListener("pointermove", a, !0), window.removeEventListener("pointerup", o, !0), window.removeEventListener("pointercancel", s, !0), window.removeEventListener("keydown", c), window.removeEventListener("blur", l);
1365
2004
  },
1366
2005
  id: e.id,
1367
2006
  kind: e.kind,
@@ -1370,123 +2009,155 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1370
2009
  startY: e.event.clientY,
1371
2010
  timer: null
1372
2011
  };
1373
- Yn(), Hn(), n || (u.timer = window.setTimeout(() => {
1374
- let e = H.current;
2012
+ di(), ri(), n || (u.timer = window.setTimeout(() => {
2013
+ let e = W.current;
1375
2014
  e === u && !e.active && !e.blocked && i(e.startX, e.startY);
1376
- }, 1e3)), H.current = u, window.addEventListener("pointermove", a), window.addEventListener("pointerup", o), window.addEventListener("pointercancel", s), window.addEventListener("keydown", c), window.addEventListener("blur", l);
1377
- }, Zn = (e, t) => {
1378
- Xn({
1379
- activate: (e, n) => {
1380
- Bt({
2015
+ }, 1e3)), W.current = u, window.addEventListener("pointermove", a, !0), window.addEventListener("pointerup", o, !0), window.addEventListener("pointercancel", s, !0), window.addEventListener("keydown", c), window.addEventListener("blur", l), e.activateImmediately && i(u.startX, u.startY);
2016
+ }, mi = (e, t, n = !1) => {
2017
+ let r = t.column;
2018
+ if (r.lockPosition) return;
2019
+ let i = {
2020
+ depth: +!!t.groupId,
2021
+ id: r.id,
2022
+ kind: "column",
2023
+ parentGroupId: t.groupId
2024
+ };
2025
+ pi({
2026
+ activateImmediately: n,
2027
+ activate: (e, t) => {
2028
+ Rn({
1381
2029
  x: e,
1382
- y: n
1383
- }), Ut(t.id), At(null), kt(t.id);
2030
+ y: t
2031
+ }), In(null), Pn(r.id);
1384
2032
  },
1385
2033
  commitTarget: (e) => {
1386
- if (e === t.id) return;
1387
- let n = $.findIndex((t) => t.id === e);
1388
- if (n >= 0) {
1389
- let e = Z.current, r = ie(e, t.id, n);
1390
- r !== e && r.columnOrder.some((t, n) => t !== e.columnOrder[n]) && Q(r, { columnLayoutChanged: !0 });
2034
+ let t = ui(e);
2035
+ if (t >= 0) {
2036
+ let e = Y.current, n = S(e, r.id, t);
2037
+ n !== e && n.columnOrder.some((t, n) => t !== e.columnOrder[n]) && (fi(), X(n, { columnLayoutChanged: !0 }));
1391
2038
  }
1392
2039
  },
1393
2040
  event: e,
1394
- id: t.id,
2041
+ id: r.id,
1395
2042
  kind: "column",
1396
- sortColumnId: t.id
2043
+ resolveTarget: (e) => {
2044
+ let t = ui(e);
2045
+ if (t < 0) return "invalid";
2046
+ let n = Y.current, a = S(n, r.id, t);
2047
+ return Ct(i, e, a.columnOrder.some((e, t) => e !== n.columnOrder[t]));
2048
+ },
2049
+ sortColumnId: r.id,
2050
+ source: i
1397
2051
  });
1398
- }, Qn = (e, t) => {
1399
- Xn({
2052
+ }, hi = (e, t, n = !1) => {
2053
+ if (t.lockPosition) return;
2054
+ let r = {
2055
+ depth: 0,
2056
+ id: t.id,
2057
+ kind: "group"
2058
+ };
2059
+ pi({
2060
+ activateImmediately: n,
1400
2061
  activate: (e, n) => {
1401
- Bt({
2062
+ Rn({
1402
2063
  x: e,
1403
2064
  y: n
1404
- }), Ut(t.children[0] ?? null), kt(null), At(t.id);
2065
+ }), Pn(null), In(t.id);
1405
2066
  },
1406
2067
  commitTarget: (e) => {
1407
- if (t.children.includes(e)) return;
1408
- let n = $.findIndex((t) => t.id === e);
2068
+ let n = ui(e);
1409
2069
  if (n >= 0) {
1410
- let e = Z.current, r = C(e, t.id, n);
1411
- r !== e && r.columnOrder.some((t, n) => t !== e.columnOrder[n]) && Q(r, { columnLayoutChanged: !0 });
2070
+ let e = Y.current, r = C(e, t.id, n);
2071
+ r !== e && r.columnOrder.some((t, n) => t !== e.columnOrder[n]) && (fi(), X(r, { columnLayoutChanged: !0 }));
1412
2072
  }
1413
2073
  },
1414
2074
  event: e,
1415
2075
  id: t.id,
1416
- kind: "group"
2076
+ kind: "group",
2077
+ resolveTarget: (e) => {
2078
+ let n = ui(e);
2079
+ if (n < 0) return "invalid";
2080
+ let i = Y.current, a = C(i, t.id, n);
2081
+ return Ct(r, e, a.columnOrder.some((e, t) => e !== i.columnOrder[t]));
2082
+ },
2083
+ source: r
1417
2084
  });
1418
- }, $n = (e, t) => {
1419
- if (e.shiftKey && G.current !== null) {
1420
- Bn(G.current, t.rowId), G.current = t.rowId;
2085
+ }, gi = (e, t) => {
2086
+ if (e.shiftKey && K.current !== null) {
2087
+ ti(K.current, t.rowId), K.current = t.rowId;
1421
2088
  return;
1422
2089
  }
1423
- Q((n) => T(n, t.rowId, {
2090
+ X((n) => de(n, t.rowId, {
1424
2091
  multi: e.ctrlKey || e.metaKey,
1425
2092
  toggle: e.ctrlKey || e.metaKey
1426
- })), G.current = t.rowId;
1427
- }, er = (e, t, n) => {
2093
+ })), K.current = t.rowId;
2094
+ }, _i = (e, t, n) => {
1428
2095
  if (n) {
1429
2096
  e.preventDefault();
1430
2097
  return;
1431
2098
  }
1432
- if (Ie?.(ft(e, t)), !(e.defaultPrevented || e.target !== e.currentTarget)) {
1433
- if (L && (Ln(e, "c") || Ln(e, "v"))) {
2099
+ if (Ve?.(Pt(e, t)), !(e.defaultPrevented || e.target !== e.currentTarget)) {
2100
+ if (L && (Qr(e, "c") || Qr(e, "v"))) {
1434
2101
  e.preventDefault();
1435
2102
  return;
1436
2103
  }
1437
- if (Ln(e, "c")) {
1438
- e.preventDefault(), Je.current = s(X, t.rowId);
2104
+ if (Qr(e, "c")) {
2105
+ e.preventDefault(), ct.current = s(J, t.rowId);
1439
2106
  return;
1440
2107
  }
1441
- Ln(e, "v") && Je.current && (e.preventDefault(), Q((e) => se(e, Je.current, {
2108
+ Qr(e, "v") && ct.current && (e.preventDefault(), X((e) => oe(e, ct.current, {
1442
2109
  mode: "insert-after",
1443
2110
  targetRowId: t.rowId
1444
2111
  })));
1445
2112
  }
1446
- }, tr = (e, t, n, r, i, s) => {
2113
+ }, vi = (e, t, n, r, i, s) => {
1447
2114
  if (s) {
1448
2115
  e.preventDefault(), e.stopPropagation();
1449
2116
  return;
1450
2117
  }
1451
- if (Fe?.(pt(e, t, n, r, g(X, t.row, n.id))), !e.defaultPrevented) {
1452
- if (Ln(e, "c")) {
1453
- e.preventDefault(), e.stopPropagation(), qe.current = X.selection.range ? o(X) : null, Ke.current = qe.current ? null : a(X, i);
2118
+ if (Be?.(Ft(e, t, n, r, g(J, t.row, n.id))), !e.defaultPrevented) {
2119
+ if (Qr(e, "c")) {
2120
+ e.preventDefault(), e.stopPropagation(), st.current = J.selection.range ? o(J) : null, ot.current = st.current ? null : a(J, i);
1454
2121
  return;
1455
2122
  }
1456
- Ln(e, "v") && (qe.current || Ke.current) && (e.preventDefault(), e.stopPropagation(), Q((e) => qe.current ? oe(e, i, qe.current) : ae(e, i, Ke.current)));
2123
+ Qr(e, "v") && (st.current || ot.current) && (e.preventDefault(), e.stopPropagation(), X((e) => st.current ? T(e, i, st.current) : ae(e, i, ot.current)));
1457
2124
  }
1458
- }, nr = (e, t, r) => {
1459
- n && (r || e.button !== 0 || e.shiftKey || (tt.current = t, nt.current = t, rt.current = !1));
1460
- }, rr = (e, t) => {
1461
- let n = document.elementFromPoint(e, t)?.closest("[data-comins-cell-column-id][data-comins-data-index]"), r = n?.dataset.cominsCellColumnId, i = n?.dataset.cominsDataIndex === void 0 ? NaN : Number(n.dataset.cominsDataIndex), a = Number.isInteger(i) ? X.rowIds[i] : void 0;
2125
+ }, yi = (e, t, r) => {
2126
+ n && (r || e.button !== 0 || e.shiftKey || (gn.current = t, _n.current = t, vn.current = !1));
2127
+ }, bi = (e, t) => {
2128
+ 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) ? J.rowIds[i] : void 0;
1462
2129
  return r && a !== void 0 ? {
1463
2130
  columnId: r,
1464
2131
  rowId: a
1465
2132
  } : null;
1466
- }, ir = (e) => {
2133
+ }, xi = (e) => {
1467
2134
  if (!n) return;
1468
- let t = tt.current;
1469
- !t || t.rowId === e.rowId && t.columnId === e.columnId || (rt.current = !0, nt.current = e, Ye.current = t, Q((n) => de(n, {
2135
+ let t = gn.current;
2136
+ !t || t.rowId === e.rowId && t.columnId === e.columnId || (vn.current = !0, _n.current = e, G.current = t, X((n) => ue(n, {
1470
2137
  anchor: t,
1471
2138
  focus: e
1472
2139
  })));
1473
- }, ar = () => {
1474
- n && (tt.current = null, nt.current = null);
1475
- }, or = (e, t, n) => {
1476
- if (nr(e, t, n), n || e.button !== 0 || e.shiftKey) return;
2140
+ }, Si = () => {
2141
+ n && (gn.current = null, _n.current = null);
2142
+ }, Ci = (e, t, n) => {
2143
+ if (yi(e, t, n), n || e.button !== 0 || e.shiftKey) return;
1477
2144
  let r = (e) => {
1478
2145
  if (e.buttons !== 1) return;
1479
- let t = rr(e.clientX, e.clientY);
1480
- t && ir(t);
2146
+ let t = bi(e.clientX, e.clientY);
2147
+ t && xi(t);
1481
2148
  }, i = () => {
1482
- ar(), window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", i);
2149
+ window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", a), window.removeEventListener("pointercancel", o), window.removeEventListener("blur", o), U.current === i && (U.current = null);
2150
+ }, a = () => {
2151
+ i(), Si();
2152
+ }, o = () => {
2153
+ i(), Si();
1483
2154
  };
1484
- e.preventDefault(), window.addEventListener("pointermove", r), window.addEventListener("pointerup", i);
1485
- }, sr = (e, t, n, r) => {
2155
+ e.preventDefault(), cr(i), window.addEventListener("pointermove", r), window.addEventListener("pointerup", a), window.addEventListener("pointercancel", o), window.addEventListener("blur", o);
2156
+ }, wi = (e, t, n, r) => {
1486
2157
  if (n || !r || e.button !== 0) return;
1487
2158
  e.preventDefault(), e.stopPropagation();
1488
2159
  let i = t.rowId, a = (e) => {
1489
- it.current = e, $t(e);
2160
+ yn.current = e, Kn(e);
1490
2161
  }, o = (e, t) => {
1491
2162
  let n = document.elementFromPoint(e, t)?.closest("[data-comins-row-data-index]");
1492
2163
  if (!n || n.dataset.cominsRowDataIndex === void 0) return;
@@ -1497,120 +2168,190 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1497
2168
  });
1498
2169
  }, s = (e) => {
1499
2170
  e.buttons === 1 && o(e.clientX, e.clientY);
1500
- }, c = (e) => {
1501
- window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", c), o(e.clientX, e.clientY);
1502
- let t = it.current?.targetDataIndex;
1503
- a(null), t !== void 0 && Q((e) => w(e, i, t));
2171
+ }, c = () => {
2172
+ window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", u), window.removeEventListener("blur", u), U.current === c && (U.current = null);
2173
+ }, l = (e) => {
2174
+ c(), o(e.clientX, e.clientY);
2175
+ let t = yn.current?.targetDataIndex;
2176
+ a(null), t !== void 0 && X((e) => w(e, i, t));
2177
+ }, u = () => {
2178
+ c(), a(null);
1504
2179
  };
1505
- o(e.clientX, e.clientY), window.addEventListener("pointermove", s), window.addEventListener("pointerup", c);
1506
- }, cr = J ? $.find((e) => e.id === J) : void 0, lr = Y ? X.columnGroups.find((e) => e.id === Y) : void 0, ur = cr?.label ?? lr?.label, dr = (e, t) => {
1507
- if (e.kind === "group") return /* @__PURE__ */ j("th", {
1508
- className: ["comins-table__th comins-table__group-th px-3 py-2 text-left font-semibold", Y === e.groupId ? "comins-column-moving" : void 0].filter(Boolean).join(" "),
1509
- colSpan: e.colSpan,
1510
- "data-column-moving": Y === e.groupId ? "true" : void 0,
1511
- "data-column-placeholder": Y === e.groupId ? "true" : void 0,
1512
- "data-comins-column-group-id": e.groupId,
1513
- "data-testid": `header-group-${e.groupId}`,
1514
- onPointerDown: (t) => Qn(t, e.group),
1515
- rowSpan: e.rowSpan,
1516
- scope: "colgroup",
1517
- children: [
1518
- /* @__PURE__ */ A("span", {
1519
- "aria-hidden": "true",
1520
- className: "comins-column-drop-marker"
1521
- }),
1522
- /* @__PURE__ */ A("span", {
1523
- className: "comins-table__header-content",
1524
- "data-comins-header-body": "true",
1525
- children: /* @__PURE__ */ A("span", {
1526
- className: "comins-table__header-label",
1527
- children: e.group.label
2180
+ o(e.clientX, e.clientY), cr(c), window.addEventListener("pointermove", s), window.addEventListener("pointerup", l), window.addEventListener("pointercancel", u), window.addEventListener("blur", u);
2181
+ }, Ti = Nn ? Z.find((e) => e.id === Nn) : void 0, Ei = Fn ? J.columnGroups.find((e) => e.id === Fn) : void 0, Di = Ti ? Qt(Ti.label, Ti.id) : Ei ? Qt(Ei.label, Ei.id) : void 0, Oi = (e, t) => {
2182
+ if (e.kind === "group") {
2183
+ let t = zn?.kind === "group" && zn.id === e.groupId, n = Fn === e.groupId, r = e.group.lockPosition === !0, i = Qt(e.group.label, e.groupId);
2184
+ return /* @__PURE__ */ j("th", {
2185
+ "aria-label": n ? i : void 0,
2186
+ className: ["comins-table__th comins-table__group-th px-3 py-2 text-left font-semibold", n ? "comins-column-moving" : void 0].filter(Boolean).join(" "),
2187
+ colSpan: e.colSpan,
2188
+ "data-column-drop-target": t ? "true" : void 0,
2189
+ "data-column-drop-valid": t && zn.status !== "neutral" ? zn.status === "valid" ? "true" : "false" : void 0,
2190
+ "data-column-moving": n ? "true" : void 0,
2191
+ "data-column-placeholder": n ? "true" : void 0,
2192
+ "data-column-position-locked": r ? "true" : void 0,
2193
+ "data-comins-column-depth": "0",
2194
+ "data-comins-column-group-id": e.groupId,
2195
+ "data-testid": `header-group-${e.groupId}`,
2196
+ onPointerDown: (t) => hi(t, e.group),
2197
+ rowSpan: e.rowSpan,
2198
+ scope: "colgroup",
2199
+ children: [
2200
+ /* @__PURE__ */ A("span", {
2201
+ "aria-hidden": "true",
2202
+ className: "comins-column-drop-marker"
2203
+ }),
2204
+ /* @__PURE__ */ j("span", {
2205
+ ...n ? Zt : {},
2206
+ "aria-hidden": n ? "true" : void 0,
2207
+ className: "comins-table__header-content",
2208
+ "data-comins-header-body": "true",
2209
+ inert: n ? !0 : void 0,
2210
+ ref: Xt,
2211
+ children: [Je && !r ? /* @__PURE__ */ A("span", {
2212
+ "aria-hidden": "true",
2213
+ className: "comins-column-move-handle",
2214
+ "data-comins-column-move-handle": "true",
2215
+ "data-testid": `column-group-move-handle-${e.groupId}`,
2216
+ draggable: !1,
2217
+ onClick: (e) => e.stopPropagation(),
2218
+ onPointerDown: (t) => {
2219
+ t.preventDefault(), t.stopPropagation(), hi(t, e.group, !0);
2220
+ },
2221
+ children: /* @__PURE__ */ A(Qe, { name: "columnMove" })
2222
+ }) : null, /* @__PURE__ */ A("span", {
2223
+ className: "comins-table__header-label",
2224
+ children: n ? null : e.group.label
2225
+ })]
2226
+ }),
2227
+ n ? /* @__PURE__ */ A("span", {
2228
+ "aria-hidden": "true",
2229
+ className: "comins-column-placeholder-label",
2230
+ children: i
2231
+ }) : null,
2232
+ /* @__PURE__ */ A("span", {
2233
+ "aria-hidden": "true",
2234
+ className: "comins-table__resize",
2235
+ "data-resizing": Un === e.groupId ? "true" : void 0,
2236
+ "data-testid": `resize-group-${e.groupId}`,
2237
+ onClick: (e) => e.stopPropagation(),
2238
+ onPointerDown: (t) => {
2239
+ t.preventDefault(), t.stopPropagation();
2240
+ let n = t.clientX, r = t.currentTarget.closest("th")?.getBoundingClientRect().width, i = /* @__PURE__ */ new Map();
2241
+ for (let t of e.group.children) {
2242
+ let e = Z.find((e) => e.id === t);
2243
+ if (!e) continue;
2244
+ let n = Array.from(B.current?.querySelectorAll("[data-comins-column-id]") ?? []).find((t) => t.dataset.cominsColumnId === e.id)?.getBoundingClientRect().width, r = Y.current.columnState[e.id]?.width ?? e.width ?? 160;
2245
+ i.set(e.id, n && Number.isFinite(n) ? n : r);
2246
+ }
2247
+ let a = [...i.values()].reduce((e, t) => e + t, 0), o = r && Number.isFinite(r) ? r : Math.max(1, a);
2248
+ Wn(e.groupId);
2249
+ let s = (t) => {
2250
+ X((r) => {
2251
+ let a = r;
2252
+ for (let [e, t] of i) a = _e(a, e, t);
2253
+ return he(a, e.groupId, o + t.clientX - n);
2254
+ }, { columnLayoutChanged: !0 });
2255
+ }, c = () => {
2256
+ window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", u), window.removeEventListener("blur", u), U.current === c && (U.current = null);
2257
+ }, l = () => {
2258
+ c(), Wn(null);
2259
+ }, u = () => {
2260
+ c(), Wn(null);
2261
+ };
2262
+ cr(c), window.addEventListener("pointermove", s), window.addEventListener("pointerup", l), window.addEventListener("pointercancel", u), window.addEventListener("blur", u);
2263
+ },
2264
+ children: /* @__PURE__ */ A("span", { className: "comins-table__resize-line" })
1528
2265
  })
1529
- }),
1530
- /* @__PURE__ */ A("span", {
1531
- "aria-hidden": "true",
1532
- className: "comins-table__resize",
1533
- "data-resizing": Xt === e.groupId ? "true" : void 0,
1534
- "data-testid": `resize-group-${e.groupId}`,
1535
- onClick: (e) => e.stopPropagation(),
1536
- onPointerDown: (t) => {
1537
- t.preventDefault(), t.stopPropagation();
1538
- let n = t.clientX, r = t.currentTarget.closest("th")?.getBoundingClientRect().width, i = /* @__PURE__ */ new Map();
1539
- for (let t of e.group.children) {
1540
- let e = $.find((e) => e.id === t);
1541
- if (!e) continue;
1542
- let n = Array.from(V.current?.querySelectorAll("[data-comins-column-id]") ?? []).find((t) => t.dataset.cominsColumnId === e.id)?.getBoundingClientRect().width, r = Z.current.columnState[e.id]?.width ?? e.width ?? 160;
1543
- i.set(e.id, n && Number.isFinite(n) ? n : r);
1544
- }
1545
- let a = [...i.values()].reduce((e, t) => e + t, 0), o = r && Number.isFinite(r) ? r : Math.max(1, a);
1546
- Zt(e.groupId);
1547
- let s = (t) => {
1548
- Q((r) => {
1549
- let a = r;
1550
- for (let [e, t] of i) a = _e(a, e, t);
1551
- return he(a, e.groupId, o + t.clientX - n);
1552
- }, { columnLayoutChanged: !0 });
1553
- }, c = () => {
1554
- Zt(null), window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", c);
1555
- };
1556
- window.addEventListener("pointermove", s), window.addEventListener("pointerup", c);
1557
- },
1558
- children: /* @__PURE__ */ A("span", { className: "comins-table__resize-line" })
1559
- })
1560
- ]
1561
- }, `group-${e.groupId}`);
1562
- let n = e.column, r = $.findIndex((e) => e.id === n.id), i = r >= 0 ? r : t, a = X.columnState[n.id], o = n.header?.props ?? {}, s = Ft(X.sortModel, n.id), c = It(X.sortModel, n.id), l = c === "asc" || c === "desc", u = s !== null && X.sortModel.length > 1, d = !!lr?.children.includes(n.id), f = J === n.id || d, p = [
2266
+ ]
2267
+ }, `group-${e.groupId}`);
2268
+ }
2269
+ let n = e.column, r = Z.findIndex((e) => e.id === n.id), i = r >= 0 ? r : t, a = J.columnState[n.id], o = n.header?.props ?? {}, s = un(J.sortModel, n.id), c = dn(J.sortModel, n.id), l = c === "asc" || c === "desc", u = s !== null && J.sortModel.length > 1, d = !!Ei?.children.includes(n.id), f = Nn === n.id || d, p = Qt(n.label, n.id), m = [
1563
2270
  "comins-table__th px-3 py-2 text-left font-semibold",
1564
- J === n.id ? "comins-column-moving" : void 0,
2271
+ Nn === n.id ? "comins-column-moving" : void 0,
1565
2272
  o.className
1566
- ].filter(Boolean).join(" "), m = St(X, n, i), h = n.header?.renderer ? n.header.renderer(m) : null, g = n.header?.renderer ? [] : Et(n.header?.components, m, "left"), ee = n.header?.renderer ? [] : Et(n.header?.components, m, "right"), _ = g.length > 0 || ee.length > 0;
2273
+ ].filter(Boolean).join(" "), h = Ut(J, n, i), g = n.header?.renderer, _ = g ? Gt.current.get(n.id) : void 0, v = !!g && (!f || _?.renderer !== g), y = g ? v ? g(h) : _?.body : null;
2274
+ g && v ? gr.set(n.id, {
2275
+ body: y,
2276
+ renderer: g
2277
+ }) : g && _ && gr.set(n.id, _);
2278
+ let b = n.header?.renderer ? [] : qt(n.header?.components, h, "left"), ee = n.header?.renderer ? [] : qt(n.header?.components, h, "right"), te = b.length > 0 || ee.length > 0, ne = zn?.kind === "column" && zn.id === n.id, re = n.lockPosition === !0;
1567
2279
  return /* @__PURE__ */ De("th", {
1568
2280
  ...o,
1569
- className: p,
2281
+ "aria-label": f ? p : o["aria-label"],
2282
+ "aria-labelledby": f ? void 0 : o["aria-labelledby"],
2283
+ className: m,
1570
2284
  colSpan: e.colSpan,
1571
- "data-column-drop-target": Ht === n.id ? "true" : void 0,
1572
- "data-column-moving": J === n.id ? "true" : void 0,
2285
+ "data-column-drop-target": ne ? "true" : void 0,
2286
+ "data-column-drop-valid": ne && zn.status !== "neutral" ? zn.status === "valid" ? "true" : "false" : void 0,
2287
+ "data-column-moving": Nn === n.id ? "true" : void 0,
1573
2288
  "data-column-placeholder": f ? "true" : void 0,
2289
+ "data-column-position-locked": re ? "true" : void 0,
2290
+ "data-comins-column-depth": e.groupId ? "1" : "0",
1574
2291
  "data-comins-column-id": n.id,
1575
2292
  "data-comins-column-index": i,
1576
- "data-sort-count": s ? X.sortModel.length : void 0,
2293
+ "data-comins-column-parent-group-id": e.groupId,
2294
+ "data-sort-count": s ? J.sortModel.length : void 0,
1577
2295
  "data-sort-direction": s?.rule.direction,
1578
2296
  "data-sort-priority": s?.priority,
1579
2297
  "data-sortable": n.sort ? "true" : "false",
1580
2298
  "data-testid": `header-${n.id}`,
1581
- "aria-sort": n.sort ? Lt(X.sortModel, n.id) : void 0,
2299
+ "aria-sort": n.sort ? fn(J.sortModel, n.id) : void 0,
1582
2300
  key: `column-${n.id}`,
1583
2301
  onClick: (e) => {
1584
- o.onClick?.(e), !(e.defaultPrevented || !n.sort) && (Kn(n.id) || qn(n, e.shiftKey));
2302
+ if (f) {
2303
+ e.preventDefault();
2304
+ return;
2305
+ }
2306
+ o.onClick?.(e), !(e.defaultPrevented || !n.sort) && (si(n.id) || ci(n, e.shiftKey));
1585
2307
  },
1586
2308
  onKeyDown: (e) => {
1587
- o.onKeyDown?.(e), !(e.defaultPrevented || !n.sort) && (e.key === "Enter" || e.key === " " || e.key === "Spacebar") && (e.preventDefault(), qn(n, e.shiftKey));
2309
+ if (f) {
2310
+ e.preventDefault();
2311
+ return;
2312
+ }
2313
+ o.onKeyDown?.(e), !(e.defaultPrevented || !n.sort) && (e.key === "Enter" || e.key === " " || e.key === "Spacebar") && (e.preventDefault(), ci(n, e.shiftKey));
1588
2314
  },
1589
- onPointerDown: (e) => Zn(e, n),
2315
+ onPointerDown: (t) => mi(t, e),
1590
2316
  rowSpan: e.rowSpan,
1591
2317
  scope: "col",
1592
2318
  style: {
1593
2319
  width: a?.width ?? n.width,
1594
2320
  ...o.style
1595
2321
  },
1596
- tabIndex: n.sort ? 0 : void 0
2322
+ tabIndex: n.sort && !f ? 0 : void 0
1597
2323
  }, /* @__PURE__ */ A("span", {
1598
2324
  "aria-hidden": "true",
1599
2325
  className: "comins-column-drop-marker"
1600
2326
  }), /* @__PURE__ */ j("span", {
2327
+ ...f ? Zt : {},
2328
+ "aria-hidden": f ? "true" : void 0,
1601
2329
  className: "comins-table__header-content",
1602
2330
  "data-comins-header-body": "true",
1603
- "data-comins-header-components": _ ? "true" : void 0,
2331
+ "data-comins-header-components": te ? "true" : void 0,
1604
2332
  "data-comins-sort-indicator-visible": l ? "true" : void 0,
2333
+ inert: f ? !0 : void 0,
2334
+ ref: Xt,
1605
2335
  children: [
1606
- /* @__PURE__ */ A("span", {
2336
+ /* @__PURE__ */ j("span", {
1607
2337
  className: "comins-table__header-slot",
1608
2338
  "data-comins-header-slot": "left",
1609
- children: g
2339
+ children: [Je && !re ? /* @__PURE__ */ A("span", {
2340
+ "aria-hidden": "true",
2341
+ className: "comins-column-move-handle",
2342
+ "data-comins-column-move-handle": "true",
2343
+ "data-testid": `column-move-handle-${n.id}`,
2344
+ draggable: !1,
2345
+ onClick: (e) => e.stopPropagation(),
2346
+ onPointerDown: (t) => {
2347
+ t.preventDefault(), t.stopPropagation(), mi(t, e, !0);
2348
+ },
2349
+ children: /* @__PURE__ */ A(Qe, { name: "columnMove" })
2350
+ }) : null, b]
1610
2351
  }),
1611
2352
  /* @__PURE__ */ A("span", {
1612
2353
  className: "comins-table__header-label",
1613
- children: n.header?.renderer ? h : n.label
2354
+ children: n.header?.renderer ? y : f ? null : n.label
1614
2355
  }),
1615
2356
  /* @__PURE__ */ j("span", {
1616
2357
  className: "comins-sort-meta",
@@ -1621,12 +2362,7 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1621
2362
  "data-sort-state": c,
1622
2363
  "data-sort-visible": l ? "true" : void 0,
1623
2364
  "data-testid": `sort-indicator-${n.id}`,
1624
- children: /* @__PURE__ */ A(Be, {
1625
- className: "comins-sort-icon",
1626
- focusable: "false",
1627
- size: 14,
1628
- strokeWidth: 2.25
1629
- })
2365
+ children: /* @__PURE__ */ A(Qe, { name: c === "asc" ? "sortAscending" : c === "desc" ? "sortDescending" : "sortUnsorted" })
1630
2366
  }), u ? /* @__PURE__ */ A("span", {
1631
2367
  "aria-hidden": "true",
1632
2368
  className: "comins-sort-priority",
@@ -1636,7 +2372,7 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1636
2372
  }),
1637
2373
  u ? /* @__PURE__ */ A("span", {
1638
2374
  className: "comins-table__sort-status",
1639
- children: `Sorted ${s.rule.direction === "asc" ? "ascending" : "descending"}, priority ${s.priority} of ${X.sortModel.length}`
2375
+ children: `Sorted ${s.rule.direction === "asc" ? "ascending" : "descending"}, priority ${s.priority} of ${J.sortModel.length}`
1640
2376
  }) : null,
1641
2377
  /* @__PURE__ */ A("span", {
1642
2378
  className: "comins-table__header-slot",
@@ -1644,126 +2380,137 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1644
2380
  children: ee
1645
2381
  })
1646
2382
  ]
1647
- }), /* @__PURE__ */ A("span", {
2383
+ }), f ? /* @__PURE__ */ A("span", {
2384
+ "aria-hidden": "true",
2385
+ className: "comins-column-placeholder-label",
2386
+ children: p
2387
+ }) : null, /* @__PURE__ */ A("span", {
1648
2388
  "aria-hidden": "true",
1649
2389
  className: "comins-table__resize",
1650
- "data-resizing": Xt === n.id ? "true" : void 0,
2390
+ "data-resizing": Un === n.id ? "true" : void 0,
1651
2391
  "data-testid": `resize-${n.id}`,
1652
2392
  onClick: (e) => e.stopPropagation(),
1653
2393
  onPointerDown: (e) => {
1654
2394
  e.preventDefault(), e.stopPropagation();
1655
2395
  let t = e.clientX, r = e.currentTarget.closest("th")?.getBoundingClientRect().width, i = /* @__PURE__ */ new Map();
1656
- for (let e of $) {
1657
- let t = Array.from(V.current?.querySelectorAll("[data-comins-column-id]") ?? []).find((t) => t.dataset.cominsColumnId === e.id)?.getBoundingClientRect().width, n = Z.current.columnState[e.id]?.width ?? e.width ?? 160;
2396
+ for (let e of Z) {
2397
+ let t = Array.from(B.current?.querySelectorAll("[data-comins-column-id]") ?? []).find((t) => t.dataset.cominsColumnId === e.id)?.getBoundingClientRect().width, n = Y.current.columnState[e.id]?.width ?? e.width ?? 160;
1658
2398
  i.set(e.id, t && Number.isFinite(t) ? t : n);
1659
2399
  }
1660
2400
  let o = i.get(n.id) ?? (r && Number.isFinite(r) ? r : a?.width ?? n.width ?? 160);
1661
- Zt(n.id);
2401
+ Wn(n.id);
1662
2402
  let s = (e) => {
1663
- Q((r) => {
2403
+ X((r) => {
1664
2404
  let a = r;
1665
2405
  for (let [e, t] of i) a = _e(a, e, t);
1666
- return jt(a, n.id, Math.max(Ot(n), o + e.clientX - t));
2406
+ return on(a, n.id, Math.max(en(n), o + e.clientX - t));
1667
2407
  }, { columnLayoutChanged: !0 });
1668
2408
  }, c = () => {
1669
- Zt(null), window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", c);
2409
+ window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", u), window.removeEventListener("blur", u), U.current === c && (U.current = null);
2410
+ }, l = () => {
2411
+ c(), Wn(null);
2412
+ }, u = () => {
2413
+ c(), Wn(null);
1670
2414
  };
1671
- window.addEventListener("pointermove", s), window.addEventListener("pointerup", c);
2415
+ cr(c), window.addEventListener("pointermove", s), window.addEventListener("pointerup", l), window.addEventListener("pointercancel", u), window.addEventListener("blur", u);
1672
2416
  },
1673
2417
  children: /* @__PURE__ */ A("span", { className: "comins-table__resize-line" })
1674
2418
  }));
1675
- }, fr = () => /* @__PURE__ */ A("colgroup", { children: $.map((e, t) => /* @__PURE__ */ A("col", { style: { width: xn[t] } }, e.id)) }), pr = () => {
1676
- tn((e) => {
1677
- let t = at.current;
2419
+ }, ki = () => /* @__PURE__ */ A("colgroup", { children: Z.map((e, t) => /* @__PURE__ */ A("col", { style: { width: _r[t] } }, e.id)) }), Ai = () => {
2420
+ Jn((e) => {
2421
+ let t = Sn.current;
1678
2422
  return Math.abs(e - t) > .5 ? t : e;
1679
2423
  });
1680
- }, mr = (e) => {
1681
- if (y) {
1682
- if (!M || Ze.current) return;
1683
- e.scrollHeight - e.scrollTop - e.clientHeight <= cn && ln("scroll");
2424
+ }, ji = (e) => {
2425
+ if (x) {
2426
+ if (!He || Yt.current) return;
2427
+ e.scrollHeight - e.scrollTop - e.clientHeight <= tr && lr("scroll");
1684
2428
  return;
1685
2429
  }
1686
- if (!_ || !h || me || !Le) return;
1687
- let t = Math.max(0, te);
2430
+ if (!ne || !ee || ye || !Ue) return;
2431
+ let t = Math.max(0, ie);
1688
2432
  if (e.scrollHeight - e.scrollTop - e.clientHeight > t) return;
1689
- let n = Z.current.rows.length;
1690
- W.current !== n && (W.current = n, Le());
1691
- }, hr = (e) => {
1692
- let t = e.currentTarget;
1693
- at.current = t.scrollTop, mr(t), K.current !== null && (window.clearTimeout(K.current), K.current = null), dt.current === null && (dt.current = window.requestAnimationFrame(() => {
1694
- dt.current = null, pr();
2433
+ let n = Y.current.rows.length;
2434
+ cn.current !== n && (cn.current = n, Ue());
2435
+ }, Mi = (e) => {
2436
+ let t = e.currentTarget, n = xn.current, r = q.current;
2437
+ Sn.current = t.scrollTop, r?.status === "pending" && Math.abs(t.scrollTop - r.previousPhysicalScrollTop) > .5 && (q.current = {
2438
+ ...r,
2439
+ status: "cancelled"
2440
+ }), n && Math.abs(t.scrollTop - n.actualPhysical) > .5 && (xn.current = null, Hn(null)), ji(t), wn.current !== null && (window.clearTimeout(wn.current), wn.current = null), Tn.current === null && (Tn.current = window.requestAnimationFrame(() => {
2441
+ Tn.current = null, Ai();
1695
2442
  }));
1696
- let n = Math.max(0, t.scrollLeft);
1697
- if (V.current) {
1698
- let e = Math.max(0, V.current.scrollWidth - V.current.clientWidth), r = Math.max(0, t.scrollWidth - t.clientWidth);
1699
- n = Math.min(Math.min(e, r), n), Math.abs(t.scrollLeft - n) > .5 && (t.scrollLeft = n), V.current.scrollLeft = n;
2443
+ let i = Math.max(0, t.scrollLeft);
2444
+ if (B.current) {
2445
+ let e = Math.max(0, B.current.scrollWidth - B.current.clientWidth), n = Math.max(0, t.scrollWidth - t.clientWidth);
2446
+ i = Math.min(Math.min(e, n), i), Math.abs(t.scrollLeft - i) > .5 && (t.scrollLeft = i), B.current.scrollLeft = i;
1700
2447
  }
1701
- Ge.current && (Ge.current.scrollLeft = n);
2448
+ at.current && (at.current.scrollLeft = i);
1702
2449
  };
1703
2450
  return /* @__PURE__ */ j("div", {
1704
2451
  className: [
1705
2452
  "comins-table comins-typography-base h-full w-full overflow-hidden",
1706
- yn,
1707
- vn.className,
2453
+ Lr,
2454
+ Ir.className,
1708
2455
  r
1709
2456
  ].filter(Boolean).join(" "),
1710
- "aria-busy": En || Dn ? "true" : void 0,
1711
- "data-loading": En || Dn ? "true" : void 0,
1712
- "data-show-header": In ? "true" : void 0,
2457
+ "aria-busy": Vr || Hr ? "true" : void 0,
2458
+ "data-loading": Vr || Hr ? "true" : void 0,
2459
+ "data-show-header": Zr ? "true" : void 0,
1713
2460
  style: {
1714
- ...vn.style,
1715
- ...Ue
2461
+ ...Ir.style,
2462
+ ...Ze
1716
2463
  },
1717
2464
  children: [
1718
- In ? /* @__PURE__ */ A("div", {
2465
+ Zr ? /* @__PURE__ */ A("div", {
1719
2466
  className: "comins-table__header",
1720
- ref: V,
2467
+ ref: B,
1721
2468
  children: /* @__PURE__ */ j("table", {
1722
2469
  className: "comins-table__table comins-table__header-table min-w-full table-fixed",
1723
- style: { width: Cn },
1724
- children: [fr(), /* @__PURE__ */ A("thead", {
2470
+ style: { width: yr },
2471
+ children: [ki(), /* @__PURE__ */ A("thead", {
1725
2472
  className: "comins-table__thead",
1726
- children: dn.map((e, t) => /* @__PURE__ */ A("tr", { children: e.map((e, t) => dr(e, t)) }, `header-row-${t}`))
2473
+ children: xr.map((e, t) => /* @__PURE__ */ A("tr", { children: e.map((e, t) => Oi(e, t)) }, `header-row-${t}`))
1727
2474
  })]
1728
2475
  })
1729
2476
  }) : null,
1730
2477
  /* @__PURE__ */ j("div", {
1731
2478
  className: "comins-table__body-viewport",
1732
- "data-horizontal-overflow": wn ? "true" : void 0,
2479
+ "data-horizontal-overflow": zr ? "true" : void 0,
1733
2480
  "data-virtualized": R ? "true" : void 0,
1734
2481
  "data-testid": f,
1735
- onScroll: hr,
1736
- ref: B,
2482
+ onScroll: Mi,
2483
+ ref: z,
1737
2484
  children: [
1738
2485
  /* @__PURE__ */ j("table", {
1739
2486
  className: ["comins-table__table comins-table__body-table min-w-full table-fixed", R ? "comins-table__body-table--virtualized" : void 0].filter(Boolean).join(" "),
1740
2487
  style: R ? {
1741
- transform: `translate3d(0, ${_n.renderOffset}px, 0)`,
1742
- width: Cn
1743
- } : { width: Cn },
1744
- children: [fr(), /* @__PURE__ */ j("tbody", { children: [
1745
- kn ? Array.from({ length: Mn }).map((e, t) => /* @__PURE__ */ A("tr", {
2488
+ transform: `translate3d(0, ${Mr.renderOffset}px, 0)`,
2489
+ width: yr
2490
+ } : { width: yr },
2491
+ children: [ki(), /* @__PURE__ */ j("tbody", { children: [
2492
+ Wr ? Array.from({ length: qr }).map((e, t) => /* @__PURE__ */ A("tr", {
1746
2493
  "aria-hidden": "true",
1747
2494
  className: "comins-table__tr comins-table__skeleton-row",
1748
2495
  "data-comins-row-parity": t % 2 == 0 ? "even" : "odd",
1749
2496
  "data-testid": "loading-skeleton-row",
1750
- style: { height: N },
1751
- children: $.length > 0 ? $.map((e) => /* @__PURE__ */ A("td", {
2497
+ style: { height: F },
2498
+ children: Z.length > 0 ? Z.map((e) => /* @__PURE__ */ A("td", {
1752
2499
  className: "comins-table__td comins-table__skeleton-cell px-3 py-2",
1753
2500
  "data-testid": `loading-skeleton-cell-${t}-${e.id}`,
1754
- style: { height: N },
2501
+ style: { height: F },
1755
2502
  children: /* @__PURE__ */ A("span", { className: "comins-table__skeleton-block" })
1756
2503
  }, e.id)) : /* @__PURE__ */ A("td", {
1757
2504
  className: "comins-table__td comins-table__skeleton-cell px-3 py-2",
1758
2505
  children: /* @__PURE__ */ A("span", { className: "comins-table__skeleton-block" })
1759
2506
  })
1760
2507
  }, `loading-skeleton-${t}`)) : null,
1761
- An ? /* @__PURE__ */ A("tr", {
2508
+ Gr ? /* @__PURE__ */ A("tr", {
1762
2509
  className: "comins-table__tr comins-table__empty-state-row",
1763
- style: { height: N },
2510
+ style: { height: F },
1764
2511
  children: /* @__PURE__ */ A("td", {
1765
2512
  className: "comins-table__td comins-table__empty-state-cell",
1766
- colSpan: Math.max(1, $.length),
2513
+ colSpan: Math.max(1, Z.length),
1767
2514
  children: /* @__PURE__ */ A("div", {
1768
2515
  "data-testid": "data-table-empty-state",
1769
2516
  className: "comins-table__empty-state",
@@ -1771,195 +2518,245 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1771
2518
  })
1772
2519
  })
1773
2520
  }) : null,
1774
- _n.entries.map((e, t) => {
1775
- let r = ct(P, e.row, e.visibleIndex), i = bn.has(e.rowId), a = Fn === 0 && t === _n.entries.length - 1, o = lt(r.style), s = R ? `virtual-row-slot-${t}` : String(e.rowId);
1776
- return /* @__PURE__ */ j(Te, { children: [Qt?.targetDataIndex === e.dataIndex && Qt.sourceRowId !== e.rowId ? /* @__PURE__ */ A("tr", {
1777
- "aria-hidden": "true",
1778
- className: "comins-row-move-placeholder",
1779
- children: /* @__PURE__ */ A("td", {
1780
- colSpan: Math.max(1, $.length),
1781
- "data-testid": "row-move-placeholder",
1782
- children: "이 위치로 이동"
1783
- })
1784
- }) : null, /* @__PURE__ */ A("tr", {
1785
- "aria-disabled": r.disabled ? "true" : void 0,
1786
- "aria-selected": i,
1787
- className: [
1788
- "comins-table__tr",
1789
- a ? "comins-table__tr--viewport-end" : void 0,
1790
- i ? "comins-row-selected" : void 0,
1791
- r.className
1792
- ].filter(Boolean).join(" "),
1793
- "data-disabled": r.disabled ? "true" : void 0,
1794
- "data-comins-row-custom-background": o === void 0 ? void 0 : "true",
1795
- "data-comins-row-data-index": e.dataIndex,
1796
- "data-comins-row-parity": e.visibleIndex % 2 == 0 ? "even" : "odd",
1797
- "data-row-draggable": r.draggable ? "true" : "false",
1798
- "data-selected-row": i ? "true" : void 0,
1799
- "data-testid": `row-${String(e.rowId)}`,
1800
- draggable: !1,
1801
- onClick: (t) => {
1802
- if (r.disabled) {
1803
- t.preventDefault();
1804
- return;
1805
- }
1806
- t.__cominsCellSelectionHandled || $n(t, e), ke?.(ft(t, e));
1807
- },
1808
- onContextMenu: (t) => {
1809
- if (r.disabled) {
1810
- t.preventDefault();
1811
- return;
1812
- }
1813
- Q((t) => T(t, e.rowId)), G.current = e.rowId, Me?.(ft(t, e));
1814
- },
1815
- onDoubleClick: (t) => {
1816
- if (r.disabled) {
1817
- t.preventDefault();
1818
- return;
1819
- }
1820
- Pe?.(ft(t, e));
1821
- },
1822
- onKeyDown: (t) => er(t, e, r.disabled),
1823
- style: ut(N, r.style, o),
1824
- tabIndex: r.disabled ? -1 : 0,
1825
- children: $.map((t, a) => {
1826
- let o = g(X, e.row, t.id), s = {
1827
- columnId: t.id,
1828
- rowId: e.rowId
1829
- }, c = n && x(X, s), l = n && X.selection.cell?.rowId === e.rowId && X.selection.cell.columnId === t.id, u = ht(e, r.disabled, i, X.selection.rowIds.length, t, a, o), d = gt(t, u), f = r.disabled || vt(d, u), p = { requestRowSelection: ({ event: t, mode: n }) => f ? !1 : n === "exclusive" ? (Q((t) => T(t, e.rowId)), G.current = e.rowId, !0) : ($n(t, e), !0) }, m = st(yt(d, u)), h = bt(d, u), ee = !!t.cell?.components?.length, _ = xt(t, o, u), te = t.cell?.components?.map((e) => {
1830
- if (e.type !== "input") return e;
1831
- let t = e.onValueChange;
1832
- return {
1833
- ...e,
1834
- onValueChange: (e) => {
1835
- Q((t) => we(t, [{
1836
- id: e.row.id,
1837
- patch: (t) => Mt(t, e.column.field, e.value)
1838
- }])), t?.(e);
1839
- }
1840
- };
1841
- }), v = Tt(te, u), y = t.cell?.renderer ? t.cell.renderer(u) : ee ? Dt(_, te, u, {
1842
- interaction: p,
1843
- showContent: !1
1844
- }) : /* @__PURE__ */ A("span", {
1845
- className: "comins-table__cell-value",
1846
- children: _
1847
- }), ne = typeof t.cell?.tooltip == "function" ? t.cell.tooltip(u) : t.cell?.tooltip, b = a === 0 ? L?.entriesByRowId.get(e.rowId) : void 0, S = b ? /* @__PURE__ */ j("span", {
1848
- className: "comins-tree-cell-content",
1849
- style: { "--comins-tree-depth": b.depth },
1850
- children: [b.hasChildren ? /* @__PURE__ */ A("button", {
1851
- "aria-expanded": b.expanded,
1852
- "aria-label": `${b.expanded ? "Collapse" : "Expand"} ${String(e.rowId)}`,
1853
- className: "comins-tree-expander",
1854
- "data-testid": `tree-expander-${String(e.rowId)}`,
1855
- onClick: (t) => {
1856
- t.preventDefault(), t.stopPropagation(), L?.onToggle(e.rowId);
1857
- },
1858
- onMouseDown: (e) => e.stopPropagation(),
1859
- onPointerDown: (e) => e.stopPropagation(),
1860
- type: "button",
1861
- children: b.expanded ? "▾" : "▸"
2521
+ Mr.slots.map((e, t) => {
2522
+ if (e.kind !== "data") return null;
2523
+ let r = e, i = At(Ge, r.row, r.visibleIndex), a = Rr.has(r.rowId), o = t === Mr.slots.length - 1, s = r.visibleIndex === Er - 1, c = Mr.scrollHeight >= Dn - 1, l = o && (R ? s && c : Xr === 0), u = jt(i.style), d = R && Mr.mixed ? r.key : R ? `virtual-row-slot-${t}` : String(r.rowId), f = { row: Nt(r) }, p = rr && (Ke?.(f) ?? !0), m = p && kr.has(r.rowId), h = m && r.detail?.mode === "fixed" ? r.detail.height : void 0, _ = r.detail?.mode ?? "fixed", v = `${typeof r.rowId}-${encodeURIComponent(String(r.rowId))}`, y = `comins-row-detail-${encodeURIComponent(Yn)}-${v}`, b = `${y}-content`, ee = `${y}-toggle`;
2524
+ return /* @__PURE__ */ j(Ee, { children: [
2525
+ Gn?.targetDataIndex === r.dataIndex && Gn.sourceRowId !== r.rowId ? /* @__PURE__ */ A("tr", {
2526
+ "aria-hidden": "true",
2527
+ className: "comins-row-move-placeholder",
2528
+ children: /* @__PURE__ */ A("td", {
2529
+ colSpan: Math.max(1, Z.length),
2530
+ "data-testid": "row-move-placeholder",
2531
+ children: "이 위치로 이동"
2532
+ })
2533
+ }) : null,
2534
+ /* @__PURE__ */ A("tr", {
2535
+ "aria-disabled": i.disabled ? "true" : void 0,
2536
+ "aria-selected": a,
2537
+ className: [
2538
+ "comins-table__tr",
2539
+ l && !m ? "comins-table__tr--viewport-end" : void 0,
2540
+ a ? "comins-row-selected" : void 0,
2541
+ i.className
2542
+ ].filter(Boolean).join(" "),
2543
+ "data-disabled": i.disabled ? "true" : void 0,
2544
+ "data-comins-row-custom-background": u === void 0 ? void 0 : "true",
2545
+ "data-comins-row-data-index": r.dataIndex,
2546
+ "data-comins-row-parity": r.visibleIndex % 2 == 0 ? "even" : "odd",
2547
+ "data-row-draggable": i.draggable ? "true" : "false",
2548
+ "data-selected-row": a ? "true" : void 0,
2549
+ "data-testid": `row-${String(r.rowId)}`,
2550
+ draggable: !1,
2551
+ onClick: (e) => {
2552
+ if (i.disabled) {
2553
+ e.preventDefault();
2554
+ return;
2555
+ }
2556
+ e.__cominsCellSelectionHandled || gi(e, r), Fe?.(Pt(e, r));
2557
+ },
2558
+ onContextMenu: (e) => {
2559
+ if (i.disabled) {
2560
+ e.preventDefault();
2561
+ return;
2562
+ }
2563
+ X((e) => wt(e, r.rowId)), K.current = r.rowId, Le?.(Pt(e, r));
2564
+ },
2565
+ onDoubleClick: (e) => {
2566
+ if (i.disabled) {
2567
+ e.preventDefault();
2568
+ return;
2569
+ }
2570
+ ze?.(Pt(e, r));
2571
+ },
2572
+ onKeyDown: (e) => _i(e, r, i.disabled),
2573
+ style: Mt(F, i.style, u),
2574
+ tabIndex: i.disabled ? -1 : 0,
2575
+ children: Z.map((e, t) => {
2576
+ let o = g(J, r.row, e.id), s = {
2577
+ columnId: e.id,
2578
+ rowId: r.rowId
2579
+ }, c = n && re(J, s), l = n && J.selection.cell?.rowId === r.rowId && J.selection.cell.columnId === e.id, u = It(r, i.disabled, a, J.selection.rowIds.length, e, t, o), d = Lt(e, u), f = i.disabled || zt(d, u), h = { requestRowSelection: ({ event: e, mode: t }) => f ? !1 : t === "exclusive" ? (X((e) => de(e, r.rowId)), K.current = r.rowId, !0) : (gi(e, r), !0) }, _ = Ot(Bt(d, u)), v = Vt(d, u), y = !!e.cell?.components?.length, te = Ht(e, o, u), ne = e.cell?.components?.map((e) => {
2580
+ if (e.type !== "input") return e;
2581
+ let t = e.onValueChange;
2582
+ return {
2583
+ ...e,
2584
+ onValueChange: (e) => {
2585
+ X((t) => we(t, [{
2586
+ id: e.row.id,
2587
+ patch: (t) => sn(t, e.column.field, e.value)
2588
+ }])), t?.(e);
2589
+ }
2590
+ };
2591
+ }), ie = Kt(ne, u), x = e.cell?.renderer ? e.cell.renderer(u) : y ? $t(te, ne, u, {
2592
+ interaction: h,
2593
+ showContent: !1
1862
2594
  }) : /* @__PURE__ */ A("span", {
1863
- "aria-hidden": "true",
1864
- className: "comins-tree-expander-spacer"
1865
- }), /* @__PURE__ */ A("span", {
1866
- className: "comins-tree-cell-value",
1867
- children: y
1868
- })]
1869
- }) : y;
1870
- return /* @__PURE__ */ j("td", {
1871
- "aria-disabled": f ? "true" : void 0,
1872
- className: [
1873
- "comins-table__td px-3 py-2",
1874
- a === 0 ? "comins-table__td--with-row-handle" : void 0,
1875
- c ? "comins-cell-range-selected" : void 0,
1876
- m
1877
- ].filter(Boolean).join(" "),
1878
- "data-disabled": f ? "true" : void 0,
1879
- "data-comins-cell-column-id": t.id,
1880
- "data-comins-component-cell": v.length > 0 ? "true" : void 0,
1881
- "data-comins-data-index": e.dataIndex,
1882
- "data-range-selected": c ? "true" : void 0,
1883
- "data-selected": l ? "true" : void 0,
1884
- "data-testid": `cell-${String(e.rowId)}-${t.id}`,
1885
- draggable: !1,
1886
- onClick: (r) => {
1887
- if (Oe && r.stopPropagation(), f) {
1888
- r.preventDefault(), r.stopPropagation();
1889
- return;
1890
- }
1891
- if (rt.current) {
1892
- rt.current = !1, r.__cominsCellSelectionHandled = !0;
1893
- return;
1894
- }
1895
- let i = n ? X.selection.cell ?? Ye.current : null;
1896
- if (r.shiftKey && i) {
1897
- r.__cominsCellSelectionHandled = !0, Ye.current = i, Q((t) => de(G.current === null ? T(t, e.rowId) : fe(t, zn(t, G.current, e.rowId)), {
1898
- anchor: i,
1899
- focus: s
1900
- })), G.current = e.rowId;
1901
- return;
1902
- }
1903
- n && (Ye.current = s), Q((t) => {
1904
- let i = T(t, e.rowId, {
1905
- multi: r.ctrlKey || r.metaKey,
1906
- toggle: r.ctrlKey || r.metaKey
1907
- });
1908
- return n ? ue(i, s) : i;
1909
- }), r.__cominsCellSelectionHandled = !0, G.current = e.rowId, Oe?.(pt(r, e, t, a, o));
1910
- },
1911
- onContextMenu: (r) => {
1912
- if (f) {
1913
- r.preventDefault(), r.stopPropagation();
1914
- return;
1915
- }
1916
- Q((t) => {
1917
- let r = T(t, e.rowId);
1918
- return n ? ue(r, s) : r;
1919
- }), G.current = e.rowId, n && (Ye.current = s), Ae && (r.stopPropagation(), Ae(pt(r, e, t, a, o)));
1920
- },
1921
- onDoubleClick: (n) => {
1922
- if (Ne && n.stopPropagation(), f) {
1923
- n.preventDefault(), n.stopPropagation();
1924
- return;
1925
- }
1926
- Ne?.(pt(n, e, t, a, o));
1927
- },
1928
- onKeyDown: (n) => tr(n, e, t, a, s, f),
1929
- onMouseDown: (e) => nr(e, s, f),
1930
- onMouseOver: () => ir(s),
1931
- onMouseUp: ar,
1932
- onPointerDown: (e) => or(e, s, f),
1933
- onPointerEnter: () => ir(s),
1934
- onPointerMove: (e) => {
1935
- e.buttons === 1 && ir(s);
1936
- },
1937
- onPointerUp: ar,
1938
- style: {
1939
- height: N,
1940
- ...h
1941
- },
1942
- title: typeof ne == "string" ? ne : void 0,
1943
- tabIndex: f ? -1 : 0,
1944
- children: [a === 0 && r.draggable ? /* @__PURE__ */ A("span", {
1945
- "aria-hidden": "true",
1946
- className: "comins-row-drag-handle",
1947
- "data-testid": `row-drag-handle-${String(e.rowId)}`,
2595
+ className: "comins-table__cell-value",
2596
+ children: te
2597
+ }), S = typeof e.cell?.tooltip == "function" ? e.cell.tooltip(u) : e.cell?.tooltip, C = e.id === L?.treeColumnId ? L.entriesByRowId.get(r.rowId) : void 0, w = C ? /* @__PURE__ */ j("span", {
2598
+ className: "comins-tree-cell-content",
2599
+ style: { "--comins-tree-depth": C.depth },
2600
+ children: [C.hasChildren ? /* @__PURE__ */ A($e, {
2601
+ "aria-expanded": C.expanded,
2602
+ "aria-label": `${C.expanded ? "Collapse" : "Expand"} ${String(r.rowId)}`,
2603
+ className: "comins-tree-expander",
2604
+ "data-testid": `tree-expander-${String(r.rowId)}`,
2605
+ icon: C.expanded ? "disclosureExpanded" : "disclosureCollapsed",
2606
+ onClick: (e) => {
2607
+ e.preventDefault(), e.stopPropagation(), L?.onToggle(r.rowId);
2608
+ },
2609
+ onMouseDown: (e) => e.stopPropagation(),
2610
+ onPointerDown: (e) => e.stopPropagation()
2611
+ }) : /* @__PURE__ */ A("span", {
2612
+ "aria-hidden": "true",
2613
+ className: "comins-tree-expander-spacer"
2614
+ }), /* @__PURE__ */ A("span", {
2615
+ className: "comins-tree-cell-value",
2616
+ children: x
2617
+ })]
2618
+ }) : x;
2619
+ return /* @__PURE__ */ A("td", {
2620
+ "aria-disabled": f ? "true" : void 0,
2621
+ className: [
2622
+ "comins-table__td px-3 py-2",
2623
+ c ? "comins-cell-range-selected" : void 0,
2624
+ _
2625
+ ].filter(Boolean).join(" "),
2626
+ "data-disabled": f ? "true" : void 0,
2627
+ "data-comins-cell-column-id": e.id,
2628
+ "data-comins-component-cell": ie.length > 0 ? "true" : void 0,
2629
+ "data-comins-data-index": r.dataIndex,
2630
+ "data-range-selected": c ? "true" : void 0,
2631
+ "data-selected": l ? "true" : void 0,
2632
+ "data-testid": `cell-${String(r.rowId)}-${e.id}`,
1948
2633
  draggable: !1,
1949
- onClick: (e) => e.stopPropagation(),
1950
- onMouseDown: (e) => e.stopPropagation(),
1951
- onPointerDown: (t) => sr(t, e, r.disabled, r.draggable)
1952
- }) : null, S]
1953
- }, t.id);
1954
- })
1955
- }, s)] }, s);
2634
+ onClick: (i) => {
2635
+ if (Pe && i.stopPropagation(), f) {
2636
+ i.preventDefault(), i.stopPropagation();
2637
+ return;
2638
+ }
2639
+ if (vn.current) {
2640
+ vn.current = !1, i.__cominsCellSelectionHandled = !0;
2641
+ return;
2642
+ }
2643
+ let a = n ? J.selection.cell ?? G.current : null;
2644
+ if (i.shiftKey && a) {
2645
+ i.__cominsCellSelectionHandled = !0, G.current = a, X((e) => ue(K.current === null ? de(e, r.rowId) : fe(e, ei(e, K.current, r.rowId)), {
2646
+ anchor: a,
2647
+ focus: s
2648
+ })), K.current = r.rowId;
2649
+ return;
2650
+ }
2651
+ n && (G.current = s), X((e) => {
2652
+ let t = de(e, r.rowId, {
2653
+ multi: i.ctrlKey || i.metaKey,
2654
+ toggle: i.ctrlKey || i.metaKey
2655
+ });
2656
+ return n ? le(t, s) : t;
2657
+ }), i.__cominsCellSelectionHandled = !0, K.current = r.rowId, Pe?.(Ft(i, r, e, t, o));
2658
+ },
2659
+ onContextMenu: (i) => {
2660
+ if (i.target.closest(".comins-row-detail-expander")) {
2661
+ i.stopPropagation();
2662
+ return;
2663
+ }
2664
+ if (f) {
2665
+ i.preventDefault(), i.stopPropagation();
2666
+ return;
2667
+ }
2668
+ X((e) => {
2669
+ let t = wt(e, r.rowId);
2670
+ return n ? le(t, s) : t;
2671
+ }), K.current = r.rowId, n && (G.current = s), Ie && (i.stopPropagation(), Ie(Ft(i, r, e, t, o)));
2672
+ },
2673
+ onDoubleClick: (n) => {
2674
+ if (n.target.closest(".comins-row-detail-expander")) {
2675
+ n.stopPropagation();
2676
+ return;
2677
+ }
2678
+ if (N && n.stopPropagation(), f) {
2679
+ n.preventDefault(), n.stopPropagation();
2680
+ return;
2681
+ }
2682
+ N?.(Ft(n, r, e, t, o));
2683
+ },
2684
+ onKeyDown: (n) => vi(n, r, e, t, s, f),
2685
+ onMouseDown: (e) => yi(e, s, f),
2686
+ onMouseOver: (e) => {
2687
+ e.buttons === 1 && !U.current && xi(s);
2688
+ },
2689
+ onMouseUp: Si,
2690
+ onPointerDown: (e) => Ci(e, s, f),
2691
+ onPointerEnter: (e) => {
2692
+ e.buttons === 1 && xi(s);
2693
+ },
2694
+ onPointerMove: (e) => {
2695
+ e.buttons === 1 && xi(s);
2696
+ },
2697
+ onPointerUp: Si,
2698
+ style: {
2699
+ height: F,
2700
+ ...v
2701
+ },
2702
+ title: typeof S == "string" ? S : void 0,
2703
+ tabIndex: f ? -1 : 0,
2704
+ children: t === 0 && (rr || i.draggable) ? /* @__PURE__ */ j("div", {
2705
+ className: "comins-row-cell-content",
2706
+ children: [/* @__PURE__ */ j("span", {
2707
+ className: "comins-row-leading-controls",
2708
+ children: [rr ? p ? /* @__PURE__ */ A(et, {
2709
+ controlsId: b,
2710
+ disabled: !M,
2711
+ expanded: m,
2712
+ id: ee,
2713
+ label: `${m ? "Collapse" : "Expand"} ${String(r.rowId)} details`,
2714
+ onElement: (e) => {
2715
+ e ? kt.current.set(r.rowId, e) : kt.current.delete(r.rowId);
2716
+ },
2717
+ onToggle: () => or(r.rowId, p),
2718
+ testId: `row-detail-toggle-${String(r.rowId)}`
2719
+ }) : /* @__PURE__ */ A("span", {
2720
+ "aria-hidden": "true",
2721
+ className: "comins-row-detail-expander-spacer",
2722
+ "data-comins-row-leading-control": "disclosure"
2723
+ }) : null, i.draggable ? /* @__PURE__ */ A("span", {
2724
+ "aria-hidden": "true",
2725
+ className: "comins-row-drag-handle",
2726
+ "data-comins-row-leading-control": "drag",
2727
+ "data-testid": `row-drag-handle-${String(r.rowId)}`,
2728
+ draggable: !1,
2729
+ onClick: (e) => e.stopPropagation(),
2730
+ onMouseDown: (e) => e.stopPropagation(),
2731
+ onPointerDown: (e) => wi(e, r, i.disabled, i.draggable)
2732
+ }) : null]
2733
+ }), /* @__PURE__ */ A("div", {
2734
+ className: "comins-row-cell-content__value",
2735
+ children: w
2736
+ })]
2737
+ }) : w
2738
+ }, e.id);
2739
+ })
2740
+ }, d),
2741
+ m ? /* @__PURE__ */ A(tt, {
2742
+ colSpan: Z.length,
2743
+ contentId: b,
2744
+ fixedHeight: h,
2745
+ labelId: ee,
2746
+ onContentElement: (e) => mr(r.rowId, _, e),
2747
+ ownerId: String(r.rowId),
2748
+ testId: `row-detail-content-${String(r.rowId)}`,
2749
+ getToggleElement: () => kt.current.get(r.rowId) ?? null,
2750
+ children: qe?.(f)
2751
+ }) : null
2752
+ ] }, d);
1956
2753
  }),
1957
- jn ? /* @__PURE__ */ A("tr", {
2754
+ Kr ? /* @__PURE__ */ A("tr", {
1958
2755
  className: "comins-table__tr comins-table__infinite-loading-row",
1959
- style: { height: N },
2756
+ style: { height: F },
1960
2757
  children: /* @__PURE__ */ j("td", {
1961
2758
  className: "comins-table__td comins-table__infinite-loading-cell",
1962
- colSpan: Math.max(1, $.length),
2759
+ colSpan: Math.max(1, Z.length),
1963
2760
  "data-testid": "data-table-infinite-loading-row",
1964
2761
  children: [/* @__PURE__ */ A("span", {
1965
2762
  className: "comins-table__loading-spinner",
@@ -1967,13 +2764,13 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1967
2764
  }), /* @__PURE__ */ A("span", { children: "데이터를 불러오는 중입니다." })]
1968
2765
  })
1969
2766
  }) : null,
1970
- Fn > 0 ? /* @__PURE__ */ A("tr", {
2767
+ Xr > 0 ? /* @__PURE__ */ A("tr", {
1971
2768
  "aria-hidden": "true",
1972
2769
  className: "comins-table-empty-filler",
1973
2770
  children: /* @__PURE__ */ A("td", {
1974
- colSpan: Math.max(1, $.length),
2771
+ colSpan: Math.max(1, Z.length),
1975
2772
  "data-testid": "table-empty-filler",
1976
- style: { height: Fn }
2773
+ style: { height: Xr }
1977
2774
  })
1978
2775
  }) : null
1979
2776
  ] })]
@@ -1982,35 +2779,36 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1982
2779
  "aria-hidden": "true",
1983
2780
  className: "comins-table__body-virtual-sizer",
1984
2781
  style: {
1985
- height: _n.scrollHeight,
1986
- width: Cn
2782
+ height: Mr.scrollHeight,
2783
+ width: yr
1987
2784
  }
1988
2785
  }) : null,
1989
- En && !On ? /* @__PURE__ */ j("div", {
2786
+ Vr && !Ur ? /* @__PURE__ */ j("div", {
1990
2787
  className: "comins-table__loading-overlay",
1991
2788
  "data-testid": "data-table-loading-overlay",
1992
2789
  role: "status",
1993
- style: en > 0 ? { transform: `translateY(${en}px)` } : void 0,
2790
+ style: qn > 0 ? { transform: `translateY(${qn}px)` } : void 0,
1994
2791
  children: [/* @__PURE__ */ A("span", {
1995
2792
  className: "comins-table__loading-spinner",
1996
2793
  "data-testid": "data-table-loading-spinner"
1997
- }), /* @__PURE__ */ A("span", { children: le ?? "불러오는 중입니다." })]
2794
+ }), /* @__PURE__ */ A("span", { children: ve ?? "불러오는 중입니다." })]
1998
2795
  }) : null
1999
2796
  ]
2000
2797
  }),
2001
2798
  I ? /* @__PURE__ */ A("div", {
2002
2799
  "aria-label": "Table summary",
2003
2800
  className: "comins-table__summary",
2004
- ref: Ge,
2801
+ ref: at,
2005
2802
  children: /* @__PURE__ */ j("table", {
2006
2803
  className: "comins-table__table comins-table__summary-table min-w-full table-fixed",
2007
- style: { width: Cn },
2008
- children: [fr(), /* @__PURE__ */ A("tfoot", { children: /* @__PURE__ */ A("tr", {
2804
+ style: { width: yr },
2805
+ children: [ki(), /* @__PURE__ */ A("tfoot", { children: /* @__PURE__ */ A("tr", {
2009
2806
  className: ["comins-table__summary-row", I.className].filter(Boolean).join(" "),
2010
2807
  style: I.style,
2011
- children: pn.map((e) => /* @__PURE__ */ A("td", {
2808
+ children: Cr.map((e) => /* @__PURE__ */ A("td", {
2012
2809
  className: ["comins-table__summary-cell px-3 py-2", e.className].filter(Boolean).join(" "),
2013
2810
  colSpan: e.colSpan,
2811
+ "data-comins-summary-column-id": e.column.id,
2014
2812
  "data-testid": `summary-cell-${e.column.id}`,
2015
2813
  style: e.style,
2016
2814
  children: e.value
@@ -2018,57 +2816,66 @@ function Kt({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
2018
2816
  }) })]
2019
2817
  })
2020
2818
  }) : null,
2021
- ur && Nt ? /* @__PURE__ */ A("div", {
2819
+ Di && Ln ? /* @__PURE__ */ j("div", {
2022
2820
  "aria-hidden": "true",
2023
2821
  className: "comins-column-move-ghost",
2024
2822
  "data-testid": "column-move-ghost",
2025
2823
  style: {
2026
- left: Nt.x + 12,
2027
- top: Nt.y + 12
2824
+ left: Ln.x + 12,
2825
+ top: Ln.y + 12
2028
2826
  },
2029
- children: ur
2827
+ children: [/* @__PURE__ */ A(Qe, { name: "columnMove" }), /* @__PURE__ */ A("span", {
2828
+ className: "comins-column-move-ghost__label",
2829
+ children: Di
2830
+ })]
2030
2831
  }) : null
2031
2832
  ]
2032
2833
  });
2033
2834
  }
2034
- function qt({ data: e, defaultExpandAll: t = !0, getRowId: n, hasMoreRows: r, infiniteScroll: i, infiniteScrollThreshold: a, lazyLoad: o, lazyLoadBatchSize: s, lazyLoadMode: c, lazyLoadThreshold: l, loadingMore: u, onChangeData: d, onChangeSort: f, onChangeSortModel: p, onLazyLoad: m, onLoadMore: h, rowProps: g, tree: ee, ..._ }, te) {
2035
- let v = O(t).current, [y, ne] = k([]), b = D(() => Wt(e, _.columns, y), [
2835
+ function xn({ data: e, defaultExpandAll: t = !0, estimatedRowDetailHeight: n, expandedRowIds: r, getRowDetailHeight: i, getRowId: a, hasMoreRows: o, infiniteScroll: s, infiniteScrollThreshold: c, lazyLoad: l, lazyLoadBatchSize: u, lazyLoadMode: d, lazyLoadThreshold: f, loadingMore: p, onChangeData: m, onChangeExpandedRowIds: h, onChangeSort: g, onChangeSortModel: _, onLazyLoad: v, onLoadMore: y, rowProps: b, isRowExpandable: ee, renderRowDetail: te, tree: ne, ...re }, ie) {
2836
+ let x = O(t).current, [S, C] = k([]), w = D(() => re.columns.map((e, t) => t === 0 ? {
2837
+ ...e,
2838
+ lockPosition: !0
2839
+ } : e), [re.columns]), ae = w[0]?.id ?? w[0]?.field ?? null, T = D(() => vn(e, w, S), [
2036
2840
  e,
2037
- _.columns,
2038
- y
2039
- ]), x = D(() => G(b, n, { defaultExpandAll: v }), [
2040
- n,
2041
- v,
2042
- b
2043
- ]), S = D(() => new Map(x.map((e) => [e.rowId, e])), [x]), re = D(() => ({
2044
- entriesByRowId: S,
2841
+ w,
2842
+ S
2843
+ ]), oe = D(() => B(T, a, { defaultExpandAll: x }), [
2844
+ a,
2845
+ x,
2846
+ T
2847
+ ]), se = D(() => new Map(oe.map((e) => [e.rowId, e])), [oe]), ce = D(() => ({
2848
+ entriesByRowId: se,
2045
2849
  onExpand: (t) => {
2046
- let r = Gt(e, t, !0, n, v);
2047
- r !== e && d?.([...r]);
2850
+ let n = yn(e, t, !0, a, x);
2851
+ n !== e && m?.([...n]);
2048
2852
  },
2049
2853
  onFold: (t) => {
2050
- let r = Gt(e, t, !1, n, v);
2051
- r !== e && d?.([...r]);
2854
+ let n = yn(e, t, !1, a, x);
2855
+ n !== e && m?.([...n]);
2052
2856
  },
2053
- onToggle: (t) => d?.(nt(e, t, n, { defaultExpandAll: v })),
2054
- summaryRows: tt(e)
2857
+ onToggle: (t) => m?.(st(e, t, a, { defaultExpandAll: x })),
2858
+ summaryRows: ot(e),
2859
+ treeColumnId: ae
2055
2860
  }), [
2056
2861
  e,
2057
- S,
2058
- n,
2059
- v,
2060
- d
2061
- ]), ie = (t) => {
2062
- let r = e;
2862
+ se,
2863
+ a,
2864
+ x,
2865
+ m,
2866
+ ae
2867
+ ]), le = (t) => {
2868
+ let n = e;
2063
2869
  t.forEach((e, t) => {
2064
- let i = x[t];
2065
- i && i.item !== e && (r = rt(r, i.rowId, n, () => e));
2066
- }), r !== e && d?.([...r]);
2870
+ let r = oe[t];
2871
+ r && r.item !== e && (n = ct(n, r.rowId, a, () => e));
2872
+ }), n !== e && m?.([...n]);
2067
2873
  };
2068
- return /* @__PURE__ */ A(Jt, {
2069
- ..._,
2070
- data: x.map((e) => e.item),
2071
- getRowId: n,
2874
+ return /* @__PURE__ */ A(q, {
2875
+ ...re,
2876
+ columns: w,
2877
+ data: oe.map((e) => e.item),
2878
+ getRowId: a,
2072
2879
  hasMoreRows: !1,
2073
2880
  infiniteScroll: !1,
2074
2881
  infiniteScrollThreshold: void 0,
@@ -2077,38 +2884,38 @@ function qt({ data: e, defaultExpandAll: t = !0, getRowId: n, hasMoreRows: r, in
2077
2884
  lazyLoadMode: void 0,
2078
2885
  lazyLoadThreshold: void 0,
2079
2886
  loadingMore: !1,
2080
- onChangeData: ie,
2081
- onChangeSort: f,
2887
+ onChangeData: le,
2888
+ onChangeSort: g,
2082
2889
  onChangeSortModel: (e) => {
2083
- ne(e), p?.(e);
2890
+ C(e), _?.(e);
2084
2891
  },
2085
2892
  onLazyLoad: void 0,
2086
2893
  onLoadMore: void 0,
2087
2894
  pagination: {
2088
2895
  pageIndex: 0,
2089
- pageSize: Math.max(1, x.length)
2896
+ pageSize: Math.max(1, oe.length)
2090
2897
  },
2091
2898
  rowProps: {
2092
- ...g,
2899
+ ...b,
2093
2900
  draggable: !1
2094
2901
  },
2095
2902
  tree: !1,
2096
- ref: te,
2097
- treeContext: re
2903
+ ref: ie,
2904
+ treeContext: ce
2098
2905
  });
2099
2906
  }
2100
- var Jt = Oe(Kt), Yt = Oe(qt);
2101
- function Xt(e, t) {
2102
- return e.tree ? /* @__PURE__ */ A(Yt, {
2907
+ var q = Oe(bn), Sn = Oe(xn);
2908
+ function Cn(e, t) {
2909
+ return e.tree ? /* @__PURE__ */ A(Sn, {
2103
2910
  ...e,
2104
2911
  ref: t
2105
- }) : /* @__PURE__ */ A(Jt, {
2912
+ }) : /* @__PURE__ */ A(q, {
2106
2913
  ...e,
2107
2914
  ref: t
2108
2915
  });
2109
2916
  }
2110
- var Zt = Oe(Xt), Qt = "comins-table";
2917
+ var wn = Oe(Cn), Tn = "comins-table";
2111
2918
  //#endregion
2112
- export { Zt as CominsTable, e as addCominsRows, t as applyCominsColumnLayout, n as clearCominsCellRange, r as clearCominsSelection, i as clearCominsSortState, Qt as cominsTablePackage, a as copyCominsCell, o as copyCominsCellRange, s as copyCominsRow, c as createCominsTableState, l as deleteCominsRows, u as exportCominsRowsToCsv, d as exportCominsRowsToJson, f as fillCominsCellRange, G as flattenCominsTree, p as formatCominsCellValue, m as getCominsCellClassName, h as getCominsCellStyle, g as getCominsCellValue, ee as getCominsHeaderRows, _ as getCominsPageRows, te as getCominsSelectedCellRange, v as getCominsSortedRowIndexes, $e as getCominsSummaryValues, tt as getCominsTreeLeafItems, y as getCominsVirtualRows, ne as getCominsVisibleColumns, b as isCominsCellDisabled, x as isCominsCellInSelectedRange, S as isCominsCellSelected, re as isCominsRowSelected, ie as moveCominsColumn, C as moveCominsColumnGroup, w as moveCominsRow, ae as pasteCominsCell, oe as pasteCominsCellRange, se as pasteCominsRow, ce as queryCominsRows, le as replaceCominsRows, ue as selectCell, de as selectCellRange, T as selectRow, fe as selectRows, pe as serializeCominsColumnLayout, me as setCominsColumnGroupHidden, he as setCominsColumnGroupWidth, ge as setCominsColumnHidden, _e as setCominsColumnWidth, ve as setCominsHeaderVisible, ye as setCominsPagination, be as setCominsSortModel, xe as setCominsSortState, Se as setCominsTableTheme, Ce as sortCominsRows, it as sortCominsTreeSiblings, nt as toggleCominsTreeNode, we as updateCominsRows, rt as updateCominsTreeItem };
2919
+ export { wn as CominsTable, e as addCominsRows, t as applyCominsColumnLayout, n as clearCominsCellRange, r as clearCominsSelection, i as clearCominsSortState, Tn 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, B 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, rt as getCominsSummaryValues, ot as getCominsTreeLeafItems, ee as getCominsVirtualRows, te as getCominsVisibleColumns, ne as isCominsCellDisabled, re as isCominsCellInSelectedRange, ie as isCominsCellSelected, x as isCominsRowSelected, S as moveCominsColumn, C as moveCominsColumnGroup, w as moveCominsRow, ae as pasteCominsCell, T as pasteCominsCellRange, oe as pasteCominsRow, se as queryCominsRows, ce as replaceCominsRows, le as selectCell, ue as selectCellRange, de as selectRow, fe as selectRows, pe as serializeCominsColumnLayout, me as setCominsColumnGroupHidden, he as setCominsColumnGroupWidth, ge as setCominsColumnHidden, _e as setCominsColumnWidth, ve as setCominsHeaderVisible, ye as setCominsPagination, be as setCominsSortModel, xe as setCominsSortState, Se as setCominsTableTheme, Ce as sortCominsRows, lt as sortCominsTreeSiblings, st as toggleCominsTreeNode, we as updateCominsRows, ct as updateCominsTreeItem };
2113
2920
 
2114
2921
  //# sourceMappingURL=index.js.map