comins-table 0.1.1 → 0.1.2

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