comins-table 0.1.3 → 0.1.4

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