comins-table 0.1.5 → 0.1.6

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