comins-table 0.1.6 → 0.1.7

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,49 +1,467 @@
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 }) {
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 te, isCominsCellInSelectedRange as ne, isCominsCellSelected as re, isCominsRowSelected as S, moveCominsColumn as ie, moveCominsColumnGroup as C, moveCominsRow as ae, moveCominsRowToGroup as oe, pasteCominsCell as w, pasteCominsCellRange as se, pasteCominsRow as ce, queryCominsRows as T, replaceCominsRows as le, selectCell as ue, selectCellRange as de, selectRow as fe, selectRows as pe, serializeCominsColumnLayout as me, setCominsColumnGroupHidden as he, setCominsColumnGroupWidth as ge, setCominsColumnHidden as _e, setCominsColumnWidth as ve, setCominsHeaderVisible as ye, setCominsPagination as be, setCominsSortModel as xe, setCominsSortState as Se, setCominsTableTheme as Ce, sortCominsRows as we, updateCominsRows as Te } from "./core.js";
2
+ import * as Ee from "react";
3
+ import { Fragment as De, createElement as Oe, forwardRef as ke, isValidElement as Ae, useEffect as E, useId as je, useImperativeHandle as Me, useLayoutEffect as Ne, useMemo as D, useRef as O, useState as k } from "react";
4
+ import { CaretSortIcon as Pe, ChevronRightIcon as Fe, DragHandleDots2Icon as Ie, MagnifyingGlassIcon as Le, ThickArrowDownIcon as Re, ThickArrowUpIcon as ze } from "@radix-ui/react-icons";
5
+ import { Fragment as Be, jsx as A, jsxs as j } from "react/jsx-runtime";
6
+ function Ve({ clientX: e, clientY: t, startX: n, startY: r }) {
7
7
  let i = Math.abs(e - n), a = Math.abs(t - r);
8
8
  return i >= 6 && i > a ? "activate" : a >= 6 && a >= i ? "cancel" : "pending";
9
9
  }
10
10
  //#endregion
11
+ //#region src/filtering.ts
12
+ var He = {
13
+ boolean: /* @__PURE__ */ new Set([
14
+ "equals",
15
+ "isEmpty",
16
+ "isNotEmpty",
17
+ "notEquals"
18
+ ]),
19
+ date: /* @__PURE__ */ new Set([
20
+ "between",
21
+ "equals",
22
+ "greaterThan",
23
+ "greaterThanOrEqual",
24
+ "isEmpty",
25
+ "isNotEmpty",
26
+ "lessThan",
27
+ "lessThanOrEqual",
28
+ "notEquals"
29
+ ]),
30
+ number: /* @__PURE__ */ new Set([
31
+ "between",
32
+ "equals",
33
+ "greaterThan",
34
+ "greaterThanOrEqual",
35
+ "isEmpty",
36
+ "isNotEmpty",
37
+ "lessThan",
38
+ "lessThanOrEqual",
39
+ "notEquals"
40
+ ]),
41
+ text: /* @__PURE__ */ new Set([
42
+ "contains",
43
+ "endsWith",
44
+ "equals",
45
+ "isEmpty",
46
+ "isNotEmpty",
47
+ "notContains",
48
+ "notEquals",
49
+ "startsWith"
50
+ ])
51
+ };
52
+ function Ue(e) {
53
+ return [...He[e]];
54
+ }
55
+ function We(e, t) {
56
+ return t.split(".").reduce((e, t) => {
57
+ if (!(typeof e != "object" || !e)) return e[t];
58
+ }, e);
59
+ }
60
+ function Ge(e) {
61
+ return e == null || e === "";
62
+ }
63
+ function Ke(e) {
64
+ if (typeof e == "string" && /^\d{4}-\d{2}-\d{2}$/u.test(e)) {
65
+ let [t, n, r] = e.split("-").map(Number), i = Date.UTC(t, n - 1, r), a = new Date(i);
66
+ return a.getUTCFullYear() === t && a.getUTCMonth() === n - 1 && a.getUTCDate() === r ? i : null;
67
+ }
68
+ let t = e instanceof Date ? e : typeof e == "number" || typeof e == "string" ? new Date(e) : null;
69
+ return !t || !Number.isFinite(t.getTime()) ? null : Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
70
+ }
71
+ function qe(e, t) {
72
+ switch (e) {
73
+ case "boolean": return typeof t == "boolean" ? t : null;
74
+ case "date": return Ke(t);
75
+ case "number": return typeof t == "number" && Number.isFinite(t) ? t : null;
76
+ case "text": {
77
+ if (t == null) return null;
78
+ let e = String(t);
79
+ return e.length > 0 ? e : null;
80
+ }
81
+ }
82
+ }
83
+ function Je(e) {
84
+ return e === "boolean" || e === "date" || e === "number" || e === "text";
85
+ }
86
+ function Ye(e) {
87
+ return typeof e == "string" && Object.values(He).some((t) => t.has(e));
88
+ }
89
+ function Xe({ columns: e, model: t }) {
90
+ if (!Array.isArray(t)) return [];
91
+ let n = new Map(e.map((e) => [e.id, e])), r = /* @__PURE__ */ new Set(), i = [];
92
+ for (let e of t) {
93
+ if (!e || typeof e != "object") continue;
94
+ let t = e, a = typeof t.columnId == "string" ? n.get(t.columnId) : void 0, o = a?.filter;
95
+ if (!a || !o || !Je(o.kind) || !Ye(t.operator) || !He[o.kind].has(t.operator) || r.has(a.id)) continue;
96
+ if (t.operator === "isEmpty" || t.operator === "isNotEmpty") {
97
+ r.add(a.id), i.push({
98
+ column: a,
99
+ config: o,
100
+ operator: t.operator
101
+ });
102
+ continue;
103
+ }
104
+ let s = qe(o.kind, t.value);
105
+ if (s !== null) {
106
+ if (t.operator === "between") {
107
+ let e = qe(o.kind, t.valueTo);
108
+ if (typeof s != "number" || typeof e != "number") continue;
109
+ r.add(a.id), i.push({
110
+ column: a,
111
+ config: o,
112
+ operator: t.operator,
113
+ value: Math.min(s, e),
114
+ valueTo: Math.max(s, e)
115
+ });
116
+ continue;
117
+ }
118
+ r.add(a.id), i.push({
119
+ column: a,
120
+ config: o,
121
+ operator: t.operator,
122
+ value: s
123
+ });
124
+ }
125
+ }
126
+ return i;
127
+ }
128
+ function Ze(e, t, n, r) {
129
+ switch (t) {
130
+ case "between": return typeof e == "number" && typeof n == "number" && r !== void 0 && e >= n && e <= r;
131
+ case "equals": return e === n;
132
+ case "greaterThan": return e > n;
133
+ case "greaterThanOrEqual": return e >= n;
134
+ case "lessThan": return e < n;
135
+ case "lessThanOrEqual": return e <= n;
136
+ case "notEquals": return e !== n;
137
+ default: return !1;
138
+ }
139
+ }
140
+ function M(e, t) {
141
+ let n = We(e.data, t.column.field), r = t.config.getValue ? t.config.getValue({
142
+ column: t.column,
143
+ row: e.data,
144
+ rowId: e.id,
145
+ value: n
146
+ }) : n;
147
+ if (t.operator === "isEmpty") return Ge(r);
148
+ if (t.operator === "isNotEmpty") return !Ge(r);
149
+ if (Ge(r) || t.value === void 0) return !1;
150
+ switch (t.config.kind) {
151
+ case "boolean": return typeof r == "boolean" && typeof t.value == "boolean" ? t.operator === "equals" ? r === t.value : r !== t.value : !1;
152
+ case "date": {
153
+ let e = Ke(r);
154
+ return e !== null && typeof t.value == "number" && Ze(e, t.operator, t.value, t.valueTo);
155
+ }
156
+ case "number": return typeof r == "number" && Number.isFinite(r) && typeof t.value == "number" ? Ze(r, t.operator, t.value, t.valueTo) : !1;
157
+ case "text": {
158
+ let e = String(r), n = String(t.value), i = t.config.caseSensitive ? e : e.toLocaleLowerCase(), a = t.config.caseSensitive ? n : n.toLocaleLowerCase();
159
+ switch (t.operator) {
160
+ case "contains": return i.includes(a);
161
+ case "endsWith": return i.endsWith(a);
162
+ case "equals": return i === a;
163
+ case "notContains": return !i.includes(a);
164
+ case "notEquals": return i !== a;
165
+ case "startsWith": return i.startsWith(a);
166
+ default: return !1;
167
+ }
168
+ }
169
+ }
170
+ }
171
+ function Qe({ columns: e, model: t, rows: n }) {
172
+ let r = Xe({
173
+ columns: e,
174
+ model: t
175
+ });
176
+ return r.length === 0 ? n.map((e) => e.dataIndex) : n.flatMap((e) => r.every((t) => M(e, t)) ? [e.dataIndex] : []);
177
+ }
178
+ //#endregion
179
+ //#region src/table-icons.tsx
180
+ var N = {
181
+ columnMove: Ie,
182
+ disclosureCollapsed: Fe,
183
+ disclosureExpanded: Fe,
184
+ filter: Le,
185
+ sortAscending: ze,
186
+ sortDescending: Re,
187
+ sortUnsorted: Pe
188
+ };
189
+ function $e({ className: e, name: t }) {
190
+ let n = N[t];
191
+ return /* @__PURE__ */ A(n, {
192
+ "aria-hidden": "true",
193
+ className: ["comins-table-icon", e].filter(Boolean).join(" "),
194
+ "data-comins-icon": t,
195
+ focusable: "false"
196
+ });
197
+ }
198
+ var et = Ee.forwardRef(function({ className: e, icon: t, type: n = "button", ...r }, i) {
199
+ return /* @__PURE__ */ A("button", {
200
+ className: ["comins-table-icon-button", e].filter(Boolean).join(" "),
201
+ ref: i,
202
+ type: n,
203
+ ...r,
204
+ children: /* @__PURE__ */ A($e, { name: t })
205
+ });
206
+ }), tt = {
207
+ between: "Between",
208
+ contains: "Contains",
209
+ endsWith: "Ends with",
210
+ equals: "Equals",
211
+ greaterThan: "Greater than",
212
+ greaterThanOrEqual: "Greater than or equal",
213
+ isEmpty: "Is empty",
214
+ isNotEmpty: "Is not empty",
215
+ lessThan: "Less than",
216
+ lessThanOrEqual: "Less than or equal",
217
+ notContains: "Does not contain",
218
+ notEquals: "Does not equal",
219
+ startsWith: "Starts with"
220
+ };
221
+ function nt(e) {
222
+ return e === "text" ? "contains" : "equals";
223
+ }
224
+ function rt(e, t) {
225
+ let n = e?.value;
226
+ return n === void 0 ? t === "boolean" ? "true" : "" : t === "date" && typeof n == "number" ? new Date(n).toISOString().slice(0, 10) : String(n);
227
+ }
228
+ function it(e, t) {
229
+ let n = e?.valueTo;
230
+ return n === void 0 ? "" : t === "date" ? new Date(n).toISOString().slice(0, 10) : String(n);
231
+ }
232
+ function at(e) {
233
+ if (!/^\d{4}-\d{2}-\d{2}$/u.test(e)) return !1;
234
+ let [t, n, r] = e.split("-").map(Number), i = new Date(Date.UTC(t, n - 1, r));
235
+ return i.getUTCFullYear() === t && i.getUTCMonth() === n - 1 && i.getUTCDate() === r;
236
+ }
237
+ function ot({ columnId: e, columnLabel: t, kind: n, onChangeRule: r, onOpenChange: i, open: a, rule: o }) {
238
+ let s = O(null), c = O(i), l = O(null), u = je(), [d, f] = k(o?.operator ?? nt(n)), [p, m] = k(() => rt(o, n)), [h, g] = k(() => it(o, n)), [_, v] = k({
239
+ left: 0,
240
+ top: 0
241
+ }), y = o !== void 0, b = typeof r != "function", x = d !== "isEmpty" && d !== "isNotEmpty";
242
+ Ne(() => {
243
+ c.current = i;
244
+ }, [i]), E(() => {
245
+ a && (f(o?.operator ?? nt(n)), m(rt(o, n)), g(it(o, n)));
246
+ }, [
247
+ n,
248
+ a,
249
+ o?.operator,
250
+ o?.value,
251
+ o?.valueTo
252
+ ]), Ne(() => {
253
+ if (!a) return;
254
+ let e = () => {
255
+ let e = s.current, t = l.current;
256
+ if (!e) return;
257
+ let n = e.getBoundingClientRect(), r = t?.offsetWidth || 260, i = t?.offsetHeight || 220, a = Math.min(Math.max(8, n.left), Math.max(8, window.innerWidth - r - 8)), o = n.bottom + 6, c = o + i <= window.innerHeight - 8 ? o : Math.max(8, n.top - i - 6);
258
+ v({
259
+ left: a,
260
+ top: c
261
+ });
262
+ }, t = (e) => {
263
+ let t = e.target;
264
+ t instanceof Node && (s.current?.contains(t) || l.current?.contains(t)) || c.current?.(null);
265
+ }, n = (e) => {
266
+ e.key === "Escape" && (e.preventDefault(), c.current?.(null), s.current?.focus());
267
+ };
268
+ return e(), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), window.addEventListener("pointerdown", t, !0), window.addEventListener("keydown", n), () => {
269
+ window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0), window.removeEventListener("pointerdown", t, !0), window.removeEventListener("keydown", n);
270
+ };
271
+ }, [a]);
272
+ let ee = (t, i, a) => {
273
+ if (!r) return;
274
+ if (t === "isEmpty" || t === "isNotEmpty") {
275
+ r({
276
+ columnId: e,
277
+ operator: t
278
+ });
279
+ return;
280
+ }
281
+ if (n === "text") {
282
+ r(i.length > 0 ? {
283
+ columnId: e,
284
+ operator: t,
285
+ value: i
286
+ } : null);
287
+ return;
288
+ }
289
+ if (n === "boolean") {
290
+ r(i === "true" || i === "false" ? {
291
+ columnId: e,
292
+ operator: t,
293
+ value: i === "true"
294
+ } : null);
295
+ return;
296
+ }
297
+ let o = n === "date" ? at(i) ? i : null : i !== "" && Number.isFinite(Number(i)) ? Number(i) : null;
298
+ if (o === null) {
299
+ if (t === "between") return;
300
+ r(null);
301
+ return;
302
+ }
303
+ if (t === "between") {
304
+ let i = n === "date" ? at(a) ? a : null : a !== "" && Number.isFinite(Number(a)) ? Number(a) : null;
305
+ if (i === null) return;
306
+ r({
307
+ columnId: e,
308
+ operator: t,
309
+ value: o,
310
+ valueTo: i
311
+ });
312
+ return;
313
+ }
314
+ r({
315
+ columnId: e,
316
+ operator: t,
317
+ value: o
318
+ });
319
+ };
320
+ return /* @__PURE__ */ j("span", {
321
+ className: "comins-column-filter",
322
+ "data-active": y ? "true" : void 0,
323
+ onClick: (e) => e.stopPropagation(),
324
+ onDoubleClick: (e) => e.stopPropagation(),
325
+ onKeyDown: (e) => {
326
+ e.stopPropagation(), e.key === "Escape" && (e.preventDefault(), i?.(null), s.current?.focus());
327
+ },
328
+ onPointerDown: (e) => e.stopPropagation(),
329
+ children: [/* @__PURE__ */ A(et, {
330
+ "aria-controls": a ? u : void 0,
331
+ "aria-expanded": a,
332
+ "aria-label": `Filter ${t}`,
333
+ className: "comins-column-filter__trigger",
334
+ "data-active": y ? "true" : void 0,
335
+ "data-testid": `column-filter-trigger-${e}`,
336
+ disabled: !i,
337
+ icon: "filter",
338
+ onClick: () => i?.(a ? null : e),
339
+ ref: s
340
+ }), a ? /* @__PURE__ */ j("span", {
341
+ "aria-label": `Filter ${t}`,
342
+ className: "comins-column-filter__popover",
343
+ "data-testid": `column-filter-popover-${e}`,
344
+ id: u,
345
+ ref: l,
346
+ role: "dialog",
347
+ style: _,
348
+ children: [
349
+ /* @__PURE__ */ A("strong", {
350
+ className: "comins-column-filter__title",
351
+ children: t
352
+ }),
353
+ /* @__PURE__ */ j("label", {
354
+ className: "comins-column-filter__field",
355
+ children: [/* @__PURE__ */ A("span", { children: "Operator" }), /* @__PURE__ */ A("select", {
356
+ "data-testid": `column-filter-operator-${e}`,
357
+ disabled: b,
358
+ onChange: (e) => {
359
+ let t = e.currentTarget.value;
360
+ f(t), ee(t, p, h);
361
+ },
362
+ value: d,
363
+ children: Ue(n).map((e) => /* @__PURE__ */ A("option", {
364
+ value: e,
365
+ children: tt[e]
366
+ }, e))
367
+ })]
368
+ }),
369
+ x && n === "boolean" ? /* @__PURE__ */ j("label", {
370
+ className: "comins-column-filter__field",
371
+ children: [/* @__PURE__ */ A("span", { children: "Value" }), /* @__PURE__ */ j("select", {
372
+ "data-testid": `column-filter-value-${e}`,
373
+ disabled: b,
374
+ onChange: (e) => {
375
+ let t = e.currentTarget.value;
376
+ m(t), ee(d, t, h);
377
+ },
378
+ value: p,
379
+ children: [/* @__PURE__ */ A("option", {
380
+ value: "true",
381
+ children: "True"
382
+ }), /* @__PURE__ */ A("option", {
383
+ value: "false",
384
+ children: "False"
385
+ })]
386
+ })]
387
+ }) : null,
388
+ x && n !== "boolean" ? /* @__PURE__ */ j("label", {
389
+ className: "comins-column-filter__field",
390
+ children: [/* @__PURE__ */ A("span", { children: d === "between" ? "From" : "Value" }), /* @__PURE__ */ A("input", {
391
+ "data-testid": `column-filter-value-${e}`,
392
+ disabled: b,
393
+ onChange: (e) => {
394
+ let t = e.currentTarget.value;
395
+ m(t), ee(d, t, h);
396
+ },
397
+ type: n === "date" ? "date" : n === "number" ? "number" : "text",
398
+ value: p
399
+ })]
400
+ }) : null,
401
+ x && d === "between" ? /* @__PURE__ */ j("label", {
402
+ className: "comins-column-filter__field",
403
+ children: [/* @__PURE__ */ A("span", { children: "To" }), /* @__PURE__ */ A("input", {
404
+ "data-testid": `column-filter-value-to-${e}`,
405
+ disabled: b,
406
+ onChange: (e) => {
407
+ let t = e.currentTarget.value;
408
+ g(t), ee(d, p, t);
409
+ },
410
+ type: n === "date" ? "date" : "number",
411
+ value: h
412
+ })]
413
+ }) : null,
414
+ /* @__PURE__ */ A("button", {
415
+ className: "comins-column-filter__clear",
416
+ "data-testid": `column-filter-clear-${e}`,
417
+ disabled: b || !y,
418
+ onClick: () => {
419
+ f(nt(n)), m(n === "boolean" ? "true" : ""), g(""), r?.(null);
420
+ },
421
+ type: "button",
422
+ children: "Clear"
423
+ })
424
+ ]
425
+ }) : null]
426
+ });
427
+ }
428
+ //#endregion
11
429
  //#region src/component-renderer.tsx
12
- function M(...e) {
430
+ function st(...e) {
13
431
  return e.filter(Boolean).join(" ");
14
432
  }
15
- function N(e, t) {
433
+ function ct(e, t) {
16
434
  return typeof e == "function" ? e(t) : e ?? {};
17
435
  }
18
- function ze(e, t) {
436
+ function P(e, t) {
19
437
  return typeof e == "function" ? e(t) : e;
20
438
  }
21
- function Be(e, t) {
439
+ function lt(e, t) {
22
440
  return typeof e == "function" ? e(t) : e;
23
441
  }
24
- function Ve(e, t) {
442
+ function F(e, t) {
25
443
  return typeof e == "function" ? e(t) : e;
26
444
  }
27
- function He(e) {
28
- return typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map(He).join(" ") : "";
445
+ function I(e) {
446
+ return typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map(I).join(" ") : "";
29
447
  }
30
- function Ue(e) {
448
+ function ut(e) {
31
449
  return e.type !== "divider" && e.type !== "label";
32
450
  }
33
- function We(e, t) {
451
+ function L(e, t) {
34
452
  return !!(e && t instanceof Node && e.contains(t));
35
453
  }
36
- function P(e) {
454
+ function R(e) {
37
455
  e.stopPropagation();
38
456
  }
39
- function F(e) {
457
+ function z(e) {
40
458
  e.preventDefault(), e.stopPropagation();
41
459
  }
42
- function Ge(e) {
460
+ function dt(e) {
43
461
  return e == null ? "" : String(e);
44
462
  }
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);
463
+ function ft({ component: e, payload: t }) {
464
+ let n = ct(e.props, t), { defaultValue: r, onBlur: i, onChange: a, onClick: o, onKeyDown: s, onMouseDown: c, onPointerDown: l, value: u, ...d } = n, f = dt(u ?? r), [p, m] = k(f), h = O(f);
47
465
  E(() => {
48
466
  m(f), h.current = f;
49
467
  }, [f]);
@@ -59,53 +477,53 @@ function Ke({ component: e, payload: t }) {
59
477
  };
60
478
  return /* @__PURE__ */ A("input", {
61
479
  ...d,
62
- className: M("comins-table__component", "comins-table__component-input", n.className),
480
+ className: st("comins-table__component", "comins-table__component-input", n.className),
63
481
  onBlur: (e) => {
64
- i?.(e), P(e), g(e);
482
+ i?.(e), R(e), g(e);
65
483
  },
66
484
  onChange: (e) => {
67
- P(e), m(e.currentTarget.value);
485
+ R(e), m(e.currentTarget.value);
68
486
  },
69
487
  onClick: (e) => {
70
- o?.(e), P(e);
488
+ o?.(e), R(e);
71
489
  },
72
490
  onKeyDown: (e) => {
73
- s?.(e), P(e), e.key === "Enter" && (e.preventDefault(), g(e), e.currentTarget.blur());
491
+ s?.(e), R(e), e.key === "Enter" && (e.preventDefault(), g(e), e.currentTarget.blur());
74
492
  },
75
493
  onMouseDown: (e) => {
76
- c?.(e), P(e);
494
+ c?.(e), R(e);
77
495
  },
78
496
  onPointerDown: (e) => {
79
- l?.(e), P(e);
497
+ l?.(e), R(e);
80
498
  },
81
499
  value: p
82
500
  });
83
501
  }
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));
502
+ function pt({ component: e, payload: t }) {
503
+ let n = ct(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
504
  return E(() => {
87
505
  r !== void 0 && p(!!r);
88
506
  }, [r]), /* @__PURE__ */ A("input", {
89
507
  ...d,
90
508
  checked: f,
91
- className: M("comins-table__component", "comins-table__component-checkbox", n.className),
509
+ className: st("comins-table__component", "comins-table__component-checkbox", n.className),
92
510
  onClick: (e) => {
93
- o?.(e), P(e);
511
+ o?.(e), R(e);
94
512
  },
95
513
  onChange: (n) => {
96
- a?.(n), P(n), p(n.currentTarget.checked), e.onCheckedChange?.({
514
+ a?.(n), R(n), p(n.currentTarget.checked), e.onCheckedChange?.({
97
515
  ...t,
98
516
  checked: n.currentTarget.checked
99
517
  });
100
518
  },
101
519
  onKeyDown: (e) => {
102
- s?.(e), P(e);
520
+ s?.(e), R(e);
103
521
  },
104
522
  onMouseDown: (e) => {
105
- c?.(e), P(e);
523
+ c?.(e), R(e);
106
524
  },
107
525
  onPointerDown: (e) => {
108
- l?.(e), P(e);
526
+ l?.(e), R(e);
109
527
  },
110
528
  style: {
111
529
  height: 20,
@@ -115,8 +533,8 @@ function qe({ component: e, payload: t }) {
115
533
  type: "checkbox"
116
534
  });
117
535
  }
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);
536
+ function mt({ component: e, payload: t }) {
537
+ let { checked: n, ...r } = ct(e.props, t), { onClick: i, onKeyDown: a, onMouseDown: o, onPointerDown: s, ...c } = r, [l, u] = k(!!n);
120
538
  E(() => {
121
539
  n !== void 0 && u(!!n);
122
540
  }, [n]);
@@ -124,9 +542,9 @@ function Je({ component: e, payload: t }) {
124
542
  return /* @__PURE__ */ A("button", {
125
543
  ...c,
126
544
  "aria-pressed": l,
127
- className: M("comins-table__component", "comins-table__component-toggle", r.className),
545
+ className: st("comins-table__component", "comins-table__component-toggle", r.className),
128
546
  onClick: (n) => {
129
- i?.(n), P(n);
547
+ i?.(n), R(n);
130
548
  let r = !l;
131
549
  u(r), e.onCheckedChange?.({
132
550
  ...t,
@@ -134,24 +552,24 @@ function Je({ component: e, payload: t }) {
134
552
  });
135
553
  },
136
554
  onKeyDown: (e) => {
137
- a?.(e), P(e);
555
+ a?.(e), R(e);
138
556
  },
139
557
  onMouseDown: (e) => {
140
- o?.(e), P(e);
558
+ o?.(e), R(e);
141
559
  },
142
560
  onPointerDown: (e) => {
143
- s?.(e), P(e);
561
+ s?.(e), R(e);
144
562
  },
145
563
  type: r.type ?? "button",
146
564
  children: d
147
565
  });
148
566
  }
149
- function Ye({ component: e, payload: t }) {
150
- let [n, r] = k(!1), i = Ae(), a = O(null), o = O(null), [s, c] = k({
567
+ function ht({ component: e, payload: t }) {
568
+ let [n, r] = k(!1), i = je(), a = O(null), o = O(null), [s, c] = k({
151
569
  left: 0,
152
570
  position: "fixed",
153
571
  top: 0
154
- }), l = N(e.props, t), u = D(() => Be(e.items, t), [e.items, t]), d = () => {
572
+ }), l = ct(e.props, t), u = D(() => lt(e.items, t), [e.items, t]), d = () => {
155
573
  let e = a.current;
156
574
  if (!e || typeof window > "u") return;
157
575
  let t = e.getBoundingClientRect(), n = Math.max(o.current?.offsetWidth ?? 136, 136);
@@ -175,14 +593,14 @@ function Ye({ component: e, payload: t }) {
175
593
  E(() => {
176
594
  if (!n) return;
177
595
  let e = (e) => {
178
- We(a.current, e.target) || We(o.current, e.target) || f(!1, e);
596
+ L(a.current, e.target) || L(o.current, e.target) || f(!1, e);
179
597
  }, t = (e) => {
180
598
  e.key === "Escape" && (f(!1, e), a.current?.focus());
181
599
  };
182
600
  return document.addEventListener("pointerdown", e), document.addEventListener("keydown", t), () => {
183
601
  document.removeEventListener("pointerdown", e), document.removeEventListener("keydown", t);
184
602
  };
185
- }, [n]), Me(() => {
603
+ }, [n]), Ne(() => {
186
604
  if (n && (d(), !(typeof window > "u"))) return window.addEventListener("resize", d), window.addEventListener("scroll", d, !0), () => {
187
605
  window.removeEventListener("resize", d), window.removeEventListener("scroll", d, !0);
188
606
  };
@@ -206,16 +624,16 @@ function Ye({ component: e, payload: t }) {
206
624
  className: "comins-table__component-menu-item",
207
625
  disabled: n.disabled,
208
626
  onClick: (r) => {
209
- F(r), !(n.disabled || !Ue(n)) && (f(!1, r), e.onSelect?.({
627
+ z(r), !(n.disabled || !ut(n)) && (f(!1, r), e.onSelect?.({
210
628
  ...t,
211
629
  event: r,
212
630
  item: n,
213
631
  value: n.value
214
632
  }));
215
633
  },
216
- onKeyDown: P,
217
- onMouseDown: P,
218
- onPointerDown: P,
634
+ onKeyDown: R,
635
+ onMouseDown: R,
636
+ onPointerDown: R,
219
637
  role: "menuitem",
220
638
  type: "button",
221
639
  children: n.label
@@ -229,20 +647,20 @@ function Ye({ component: e, payload: t }) {
229
647
  "aria-expanded": n,
230
648
  "aria-haspopup": "menu",
231
649
  "aria-label": l["aria-label"] ?? "Header menu",
232
- className: M("comins-table__component-menu-trigger", l.className),
650
+ className: st("comins-table__component-menu-trigger", l.className),
233
651
  onClick: (e) => {
234
- F(e), f(!n, e);
652
+ z(e), f(!n, e);
235
653
  },
236
654
  onKeyDown: (e) => {
237
655
  if (l.onKeyDown?.(e), e.key === "Escape" && n) {
238
- F(e), f(!1, e);
656
+ z(e), f(!1, e);
239
657
  return;
240
658
  }
241
- P(e);
659
+ R(e);
242
660
  },
243
- onMouseDown: P,
661
+ onMouseDown: R,
244
662
  onPointerDown: (e) => {
245
- l.onPointerDown?.(e), P(e);
663
+ l.onPointerDown?.(e), R(e);
246
664
  },
247
665
  ref: a,
248
666
  type: l.type ?? "button",
@@ -250,29 +668,29 @@ function Ye({ component: e, payload: t }) {
250
668
  }), p]
251
669
  });
252
670
  }
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 : "";
671
+ function gt({ component: e, interaction: t, payload: n }) {
672
+ let { height: r, itemHeight: i, limit: a, more: o = !1, searchable: s = !1, style: c, ...l } = ct(e.props, n), u = D(() => F(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), [x, ee] = k(null), [te, ne] = k(p), re = O(null), S = n.row.selected && n.selection.selectedRowCount === 1, ie = !!(s && S), C = ie ? h : "";
255
673
  E(() => {
256
674
  v(!1), b(0);
257
- }, [u.length, d]), Me(() => {
258
- let e = ie.current;
675
+ }, [u.length, d]), Ne(() => {
676
+ let e = re.current;
259
677
  if (!e) return;
260
678
  let t = e.clientHeight > 0 ? e.clientHeight : p;
261
- re(m ? t : Math.min(t, p));
679
+ ne(m ? t : Math.min(t, p));
262
680
  }, [
263
681
  p,
264
682
  _,
265
683
  C,
266
684
  m
267
685
  ]), E(() => {
268
- let e = ie.current;
686
+ let e = re.current;
269
687
  e && (e.scrollTop = 0, b(0));
270
688
  }, [C]), E(() => {
271
- if (x) return;
272
- let e = ie.current;
689
+ if (S) return;
690
+ let e = re.current;
273
691
  e && (e.scrollTop = 0), v(!1), g(""), b(0);
274
- }, [x]);
275
- let w = D(() => {
692
+ }, [S]);
693
+ let ae = D(() => {
276
694
  let t = C.trim().toLowerCase();
277
695
  return u.map((e, t) => ({
278
696
  item: e,
@@ -281,12 +699,12 @@ function Xe({ component: e, interaction: t, payload: n }) {
281
699
  item: n,
282
700
  itemIndex: r,
283
701
  value: C
284
- }) : He(n.label).toLowerCase().includes(t) : !0);
702
+ }) : I(n.label).toLowerCase().includes(t) : !0);
285
703
  }, [
286
704
  C,
287
705
  e,
288
706
  u
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 = {
707
+ ]), oe = ae.length > d, w = !!(S && (_ || C.trim().length > 0 || !o && oe)), se = oe && !w, ce = ie && !_ ? 0 : 2, T = Math.max(f, m ? te || p : Math.min(te || p, p)), le = Math.max(0, Math.floor(Math.max(0, y) / f) - ce), ue = Math.min(ae.length, Math.ceil((Math.max(0, y) + T) / f) + ce), de = w ? ae.slice(le, ue) : ae.slice(0, oe ? d : ae.length), fe = w ? le * f : 0, pe = w ? Math.max(0, ae.length - ue) * f : 0, me = `${String(n.row.id)}-${n.column.id}`, he = {
290
708
  ...c,
291
709
  "--comins-table-virtual-list-item-height": `${f}px`,
292
710
  height: r ?? c?.height ?? p
@@ -294,7 +712,7 @@ function Xe({ component: e, interaction: t, payload: n }) {
294
712
  r.disabled || t?.requestRowSelection?.({
295
713
  event: a,
296
714
  mode: "row-click"
297
- }) !== !1 && (te(r.value), e.onClickItem?.({
715
+ }) !== !1 && (ee(r.value), e.onClickItem?.({
298
716
  ...n,
299
717
  event: a,
300
718
  item: r,
@@ -305,50 +723,50 @@ function Xe({ component: e, interaction: t, payload: n }) {
305
723
  return /* @__PURE__ */ j("div", {
306
724
  ...l,
307
725
  "aria-label": l["aria-label"] ?? "Virtual list",
308
- className: M("comins-table__component", "comins-table__component-virtual-list", l.className),
309
- "data-comins-virtual-list-expanded": T ? "true" : void 0,
726
+ className: st("comins-table__component", "comins-table__component-virtual-list", l.className),
727
+ "data-comins-virtual-list-expanded": w ? "true" : void 0,
310
728
  "data-comins-virtual-list-visible-count": de.length,
311
729
  "data-testid": `virtual-list-${me}`,
312
730
  onClick: (e) => {
313
- l.onClick?.(e), P(e);
731
+ l.onClick?.(e), R(e);
314
732
  },
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,
733
+ onKeyDown: R,
734
+ onMouseDown: R,
735
+ onContextMenu: R,
736
+ onDoubleClick: R,
737
+ onMouseUp: R,
738
+ onPointerUp: R,
739
+ onPointerMove: R,
740
+ onPointerEnter: R,
741
+ onMouseOver: R,
742
+ onMouseOut: R,
743
+ onPointerLeave: R,
744
+ onBlur: R,
745
+ onFocus: R,
746
+ onInput: R,
747
+ onChange: R,
748
+ onMouseMove: R,
749
+ onMouseEnter: R,
750
+ onMouseLeave: R,
751
+ onTouchStart: R,
752
+ onTouchMove: R,
753
+ onTouchEnd: R,
336
754
  onWheel: (e) => {
337
- l.onWheel?.(e), P(e);
755
+ l.onWheel?.(e), R(e);
338
756
  },
339
757
  onPointerDown: (e) => {
340
- l.onPointerDown?.(e), P(e);
758
+ l.onPointerDown?.(e), R(e);
341
759
  },
342
760
  role: "listbox",
343
761
  style: he,
344
762
  children: [/* @__PURE__ */ j("div", {
345
763
  className: "comins-table__component-virtual-list-items",
346
764
  onScroll: (e) => {
347
- P(e), b(e.currentTarget.scrollTop);
765
+ R(e), b(e.currentTarget.scrollTop);
348
766
  let t = e.currentTarget.clientHeight > 0 ? e.currentTarget.clientHeight : p;
349
- re(m ? t : Math.min(t, p));
767
+ ne(m ? t : Math.min(t, p));
350
768
  },
351
- ref: ie,
769
+ ref: re,
352
770
  role: "presentation",
353
771
  children: [
354
772
  fe > 0 ? /* @__PURE__ */ A("span", {
@@ -357,15 +775,15 @@ function Xe({ component: e, interaction: t, payload: n }) {
357
775
  style: { height: fe }
358
776
  }) : null,
359
777
  de.map(({ item: t, itemIndex: r }) => /* @__PURE__ */ A("button", {
360
- "aria-selected": ee === t.value,
778
+ "aria-selected": x === t.value,
361
779
  className: "comins-table__component-virtual-list-item",
362
780
  "data-comins-virtual-list-item": "true",
363
781
  disabled: t.disabled,
364
782
  onClick: (e) => {
365
- F(e), ge(t, r, e);
783
+ z(e), ge(t, r, e);
366
784
  },
367
785
  onContextMenu: (i) => {
368
- P(i), !t.disabled && e.onContextMenuItem?.({
786
+ R(i), !t.disabled && e.onContextMenuItem?.({
369
787
  ...n,
370
788
  event: i,
371
789
  item: t,
@@ -374,10 +792,10 @@ function Xe({ component: e, interaction: t, payload: n }) {
374
792
  });
375
793
  },
376
794
  onKeyDown: (e) => {
377
- P(e), (e.key === "Enter" || e.key === " " || e.key === "Spacebar") && (e.preventDefault(), ge(t, r, e));
795
+ R(e), (e.key === "Enter" || e.key === " " || e.key === "Spacebar") && (e.preventDefault(), ge(t, r, e));
378
796
  },
379
- onMouseDown: P,
380
- onPointerDown: P,
797
+ onMouseDown: R,
798
+ onPointerDown: R,
381
799
  role: "option",
382
800
  type: "button",
383
801
  children: /* @__PURE__ */ A("span", {
@@ -393,107 +811,107 @@ function Xe({ component: e, interaction: t, payload: n }) {
393
811
  ]
394
812
  }), /* @__PURE__ */ j("div", {
395
813
  className: "comins-table__component-virtual-list-controls",
396
- children: [o && ae ? /* @__PURE__ */ A("button", {
397
- "aria-expanded": T,
814
+ children: [o && oe ? /* @__PURE__ */ A("button", {
815
+ "aria-expanded": w,
398
816
  "aria-label": "전체 목록 보기",
399
817
  className: "comins-table__component-virtual-list-overflow comins-table__component-virtual-list-more",
400
818
  "data-testid": `virtual-list-overflow-${me}`,
401
819
  onClick: (e) => {
402
- F(e), t?.requestRowSelection?.({
820
+ z(e), t?.requestRowSelection?.({
403
821
  event: e,
404
822
  mode: "exclusive"
405
823
  }) !== !1 && v(!0);
406
824
  },
407
- onKeyDown: P,
408
- onMouseDown: P,
409
- onPointerDown: P,
825
+ onKeyDown: R,
826
+ onMouseDown: R,
827
+ onPointerDown: R,
410
828
  type: "button",
411
829
  children: "..."
412
- }) : oe ? /* @__PURE__ */ A("span", {
830
+ }) : se ? /* @__PURE__ */ A("span", {
413
831
  "aria-hidden": "true",
414
832
  className: "comins-table__component-virtual-list-overflow comins-table__component-virtual-list-more",
415
833
  "data-testid": `virtual-list-overflow-${me}`,
416
834
  children: "..."
417
- }) : null, S ? /* @__PURE__ */ A("input", {
835
+ }) : null, ie ? /* @__PURE__ */ A("input", {
418
836
  "aria-label": `${l["aria-label"] ?? "Virtual list"} 검색`,
419
837
  className: "comins-table__component-virtual-list-search",
420
838
  "data-testid": `virtual-list-search-${me}`,
421
839
  onChange: (e) => {
422
- P(e), g(e.currentTarget.value);
840
+ R(e), g(e.currentTarget.value);
423
841
  },
424
- onClick: P,
425
- onKeyDown: P,
426
- onMouseDown: P,
427
- onPointerDown: P,
842
+ onClick: R,
843
+ onKeyDown: R,
844
+ onMouseDown: R,
845
+ onPointerDown: R,
428
846
  placeholder: "검색",
429
847
  value: h
430
848
  }) : null]
431
849
  })]
432
850
  });
433
851
  }
434
- function Ze(e, t, n) {
435
- if (e.type === "menu") return /* @__PURE__ */ A(Ye, {
852
+ function _t(e, t, n) {
853
+ if (e.type === "menu") return /* @__PURE__ */ A(ht, {
436
854
  component: e,
437
855
  payload: t
438
856
  });
439
- if (e.type === "virtual-list") return /* @__PURE__ */ A(Xe, {
857
+ if (e.type === "virtual-list") return /* @__PURE__ */ A(gt, {
440
858
  component: e,
441
859
  interaction: n,
442
860
  payload: t
443
861
  });
444
862
  if (e.type === "button") {
445
- let n = N(e.props, t), { onClick: r, onKeyDown: i, onMouseDown: a, onPointerDown: o, ...s } = n;
863
+ let n = ct(e.props, t), { onClick: r, onKeyDown: i, onMouseDown: a, onPointerDown: o, ...s } = n;
446
864
  return /* @__PURE__ */ A("button", {
447
865
  ...s,
448
- className: M("comins-table__component", "comins-table__component-button", n.className),
866
+ className: st("comins-table__component", "comins-table__component-button", n.className),
449
867
  onClick: (n) => {
450
- r?.(n), P(n), e.onClick?.({
868
+ r?.(n), R(n), e.onClick?.({
451
869
  ...t,
452
870
  event: n
453
871
  });
454
872
  },
455
873
  onKeyDown: (e) => {
456
- i?.(e), P(e);
874
+ i?.(e), R(e);
457
875
  },
458
876
  onMouseDown: (e) => {
459
- a?.(e), P(e);
877
+ a?.(e), R(e);
460
878
  },
461
879
  onPointerDown: (e) => {
462
- o?.(e), P(e);
880
+ o?.(e), R(e);
463
881
  },
464
882
  type: n.type ?? "button"
465
883
  });
466
884
  }
467
- if (e.type === "input") return /* @__PURE__ */ A(Ke, {
885
+ if (e.type === "input") return /* @__PURE__ */ A(ft, {
468
886
  component: e,
469
887
  payload: t
470
888
  });
471
- if (e.type === "checkbox") return /* @__PURE__ */ A(qe, {
889
+ if (e.type === "checkbox") return /* @__PURE__ */ A(pt, {
472
890
  component: e,
473
891
  payload: t
474
892
  });
475
893
  if (e.type === "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;
894
+ let n = ct(e.props, t), r = P(e.options, t), { onChange: i, onClick: a, onKeyDown: o, onMouseDown: s, onPointerDown: c, ...l } = n;
477
895
  return /* @__PURE__ */ A("select", {
478
896
  ...l,
479
- className: M("comins-table__component", "comins-table__component-select", n.className),
897
+ className: st("comins-table__component", "comins-table__component-select", n.className),
480
898
  onClick: (e) => {
481
- a?.(e), P(e);
899
+ a?.(e), R(e);
482
900
  },
483
901
  onChange: (n) => {
484
- i?.(n), P(n), e.onValueChange?.({
902
+ i?.(n), R(n), e.onValueChange?.({
485
903
  ...t,
486
904
  value: n.currentTarget.value
487
905
  });
488
906
  },
489
907
  onKeyDown: (e) => {
490
- o?.(e), P(e);
908
+ o?.(e), R(e);
491
909
  },
492
910
  onMouseDown: (e) => {
493
- s?.(e), P(e);
911
+ s?.(e), R(e);
494
912
  },
495
913
  onPointerDown: (e) => {
496
- c?.(e), P(e);
914
+ c?.(e), R(e);
497
915
  },
498
916
  children: r.map((e) => /* @__PURE__ */ A("option", {
499
917
  disabled: e.disabled,
@@ -503,40 +921,40 @@ function Ze(e, t, n) {
503
921
  });
504
922
  }
505
923
  if (e.type === "radio") {
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;
924
+ let n = ct(e.props, t), r = P(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
925
  return /* @__PURE__ */ A("div", {
508
926
  ...s,
509
- className: M("comins-table__component", "comins-table__component-radio", s.className),
927
+ className: st("comins-table__component", "comins-table__component-radio", s.className),
510
928
  onClick: (e) => {
511
- s.onClick?.(e), P(e);
929
+ s.onClick?.(e), R(e);
512
930
  },
513
931
  onKeyDown: (e) => {
514
- s.onKeyDown?.(e), P(e);
932
+ s.onKeyDown?.(e), R(e);
515
933
  },
516
934
  onMouseDown: (e) => {
517
- s.onMouseDown?.(e), P(e);
935
+ s.onMouseDown?.(e), R(e);
518
936
  },
519
937
  onPointerDown: (e) => {
520
- s.onPointerDown?.(e), P(e);
938
+ s.onPointerDown?.(e), R(e);
521
939
  },
522
940
  role: "radiogroup",
523
941
  children: r.map((n) => /* @__PURE__ */ j("label", {
524
- onClick: P,
525
- onMouseDown: P,
942
+ onClick: R,
943
+ onMouseDown: R,
526
944
  children: [/* @__PURE__ */ A("input", {
527
945
  checked: i === void 0 ? void 0 : String(i) === String(n.value),
528
946
  disabled: n.disabled,
529
947
  name: a,
530
- onClick: P,
948
+ onClick: R,
531
949
  onChange: (r) => {
532
- P(r), r.currentTarget.checked && e.onValueChange?.({
950
+ R(r), r.currentTarget.checked && e.onValueChange?.({
533
951
  ...t,
534
952
  value: String(n.value)
535
953
  });
536
954
  },
537
- onKeyDown: P,
538
- onMouseDown: P,
539
- onPointerDown: P,
955
+ onKeyDown: R,
956
+ onMouseDown: R,
957
+ onPointerDown: R,
540
958
  style: {
541
959
  height: 20,
542
960
  width: 20
@@ -547,57 +965,29 @@ function Ze(e, t, n) {
547
965
  }, String(n.value)))
548
966
  });
549
967
  }
550
- if (e.type === "toggle") return /* @__PURE__ */ A(Je, {
968
+ if (e.type === "toggle") return /* @__PURE__ */ A(mt, {
551
969
  component: e,
552
970
  payload: t
553
971
  });
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));
972
+ let r = ct(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
973
  return /* @__PURE__ */ A("div", {
556
974
  ...r,
557
975
  "aria-valuemax": a,
558
976
  "aria-valuemin": 0,
559
977
  "aria-valuenow": 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,
978
+ className: st("comins-table__component", "comins-table__component-progress", r.className),
979
+ onClick: R,
980
+ onKeyDown: R,
981
+ onMouseDown: R,
982
+ onPointerDown: R,
565
983
  role: "progressbar",
566
984
  children: /* @__PURE__ */ A("span", { style: { width: `${o}%` } })
567
985
  });
568
986
  }
569
987
  //#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
988
  //#region src/row-detail.tsx
599
- function et(e) {
600
- return /* @__PURE__ */ A($e, {
989
+ function vt(e) {
990
+ return /* @__PURE__ */ A(et, {
601
991
  "aria-controls": e.expanded ? e.controlsId : void 0,
602
992
  "aria-expanded": e.expanded,
603
993
  "aria-label": e.label,
@@ -616,12 +1006,12 @@ function et(e) {
616
1006
  ref: e.onElement
617
1007
  });
618
1008
  }
619
- function tt(e) {
1009
+ function yt(e) {
620
1010
  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(() => {
1011
+ return n.current = e.getToggleElement, r.current = e.onContentElement, Ne(() => {
622
1012
  let e = t.current;
623
1013
  return r.current(e), () => r.current(null);
624
- }, [i]), Me(() => {
1014
+ }, [i]), Ne(() => {
625
1015
  let e = t.current;
626
1016
  return () => {
627
1017
  if (e?.contains(document.activeElement)) {
@@ -652,29 +1042,205 @@ function tt(e) {
652
1042
  });
653
1043
  }
654
1044
  //#endregion
1045
+ //#region src/grouping.ts
1046
+ var bt = /* @__PURE__ */ new Set([
1047
+ "avg",
1048
+ "count",
1049
+ "max",
1050
+ "min",
1051
+ "sum"
1052
+ ]);
1053
+ function xt(e, t) {
1054
+ return t.split(".").reduce((e, t) => {
1055
+ if (!(typeof e != "object" || !e)) return e[t];
1056
+ }, e);
1057
+ }
1058
+ function St(e, t) {
1059
+ return xt(e, t.field);
1060
+ }
1061
+ function B(e) {
1062
+ switch (e) {
1063
+ case "avg": return {
1064
+ count: 0,
1065
+ kind: "avg",
1066
+ sum: 0
1067
+ };
1068
+ case "count": return {
1069
+ count: 0,
1070
+ kind: "count"
1071
+ };
1072
+ case "max":
1073
+ case "min": return {
1074
+ hasValue: !1,
1075
+ kind: e,
1076
+ value: 0
1077
+ };
1078
+ case "sum": return {
1079
+ count: 0,
1080
+ kind: "sum",
1081
+ sum: 0
1082
+ };
1083
+ }
1084
+ }
1085
+ function Ct(e, t) {
1086
+ if (e.kind === "count") {
1087
+ e.count += 1;
1088
+ return;
1089
+ }
1090
+ if (!(typeof t != "number" || !Number.isFinite(t))) {
1091
+ if (e.kind === "avg" || e.kind === "sum") {
1092
+ e.count += 1, e.sum += t;
1093
+ return;
1094
+ }
1095
+ if (!e.hasValue) {
1096
+ e.hasValue = !0, e.value = t;
1097
+ return;
1098
+ }
1099
+ e.value = e.kind === "min" ? Math.min(e.value, t) : Math.max(e.value, t);
1100
+ }
1101
+ }
1102
+ function wt(e) {
1103
+ switch (e.kind) {
1104
+ case "avg": return e.count === 0 ? null : e.sum / e.count;
1105
+ case "count": return e.count;
1106
+ case "max":
1107
+ case "min": return e.hasValue ? e.value : null;
1108
+ case "sum": return e.count === 0 ? null : e.sum;
1109
+ }
1110
+ }
1111
+ function Tt(e) {
1112
+ return `group:${typeof e}:${encodeURIComponent(String(e))}`;
1113
+ }
1114
+ function Et(e) {
1115
+ let t = new Map(e.columns.map((e) => [e.id, e])), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
1116
+ for (let [i, a] of Object.entries(e.config.aggregations ?? {})) t.has(i) && typeof a == "string" && bt.has(a) && (n.set(i, a), r.set(i, t.get(i)));
1117
+ let i = [], a = /* @__PURE__ */ new Map(), o = Array.isArray(e.config.groups) ? e.config.groups : [];
1118
+ for (let t of o) {
1119
+ let n = e.config.getGroupId(t);
1120
+ if (a.has(n)) continue;
1121
+ let r = {
1122
+ group: t,
1123
+ groupId: n,
1124
+ groupIndex: i.length,
1125
+ label: e.config.getGroupLabel?.(t) ?? String(n)
1126
+ };
1127
+ i.push(n), a.set(n, r);
1128
+ }
1129
+ return {
1130
+ aggregationColumns: r,
1131
+ aggregations: n,
1132
+ groupIds: i,
1133
+ groupsById: a
1134
+ };
1135
+ }
1136
+ function Dt(e) {
1137
+ let t = /* @__PURE__ */ new Map();
1138
+ for (let n of e.groupIds) {
1139
+ let r = e.groupsById.get(n);
1140
+ if (!r) continue;
1141
+ let i = /* @__PURE__ */ new Map();
1142
+ for (let [t, n] of e.aggregations) i.set(t, B(n));
1143
+ t.set(n, {
1144
+ ...r,
1145
+ aggregationState: i,
1146
+ leafSourceIndexes: []
1147
+ });
1148
+ }
1149
+ for (let n of e.rows) {
1150
+ let r = e.getRowGroupId(n.data, n.dataIndex), i = t.get(r);
1151
+ if (i) {
1152
+ i.leafSourceIndexes.push(n.dataIndex);
1153
+ for (let [t, r] of i.aggregationState) {
1154
+ let i = e.aggregationColumns?.get(t);
1155
+ Ct(r, i ? St(n.data, i) : xt(n.data, t));
1156
+ }
1157
+ }
1158
+ }
1159
+ return {
1160
+ groupIds: [...e.groupIds],
1161
+ groupsById: t
1162
+ };
1163
+ }
1164
+ function Ot(e, t) {
1165
+ return typeof e == "number" && typeof t == "number" ? e - t : String(e ?? "").localeCompare(String(t ?? ""));
1166
+ }
1167
+ function kt(e) {
1168
+ let t = new Map(e.columns.map((e) => [e.id, e])), n = /* @__PURE__ */ new Map(), r = (n) => [...n].sort((n, r) => {
1169
+ let i = e.rows[n], a = e.rows[r];
1170
+ if (i === void 0 || a === void 0) return n - r;
1171
+ for (let n of e.sortModel) {
1172
+ let e = t.get(n.columnId);
1173
+ if (!e?.sort) continue;
1174
+ let r = St(i, e), o = St(a, e), s = typeof e.sort == "function" ? e.sort(r, o, i, a) : Ot(r, o);
1175
+ if (s !== 0) return n.direction === "desc" ? s * -1 : s;
1176
+ }
1177
+ return n - r;
1178
+ });
1179
+ for (let t of e.model.groupIds) {
1180
+ let i = e.model.groupsById.get(t);
1181
+ i && n.set(t, r(i.leafSourceIndexes));
1182
+ }
1183
+ return {
1184
+ ...e.model,
1185
+ groupIds: [...e.model.groupIds],
1186
+ orderedLeafSourceIndexesById: n
1187
+ };
1188
+ }
1189
+ function At(e) {
1190
+ let t = [], n = new Set(e.expandedGroupIds), r = [];
1191
+ for (let i of e.model.groupIds) if (e.model.groupsById.get(i) && (t.push({
1192
+ groupId: i,
1193
+ key: Tt(i),
1194
+ kind: "group"
1195
+ }), n.has(i))) for (let n of e.model.orderedLeafSourceIndexesById.get(i) ?? []) {
1196
+ let i = e.rowIds[n];
1197
+ if (i === void 0) continue;
1198
+ let a = r.length;
1199
+ r.push(i), t.push({
1200
+ dataIndex: n,
1201
+ key: `data:${typeof i}:${encodeURIComponent(String(i))}`,
1202
+ kind: "data",
1203
+ rowId: i,
1204
+ visibleLeafIndex: a
1205
+ });
1206
+ }
1207
+ return {
1208
+ entries: t,
1209
+ visibleLeafRowIds: r
1210
+ };
1211
+ }
1212
+ function jt(e) {
1213
+ let t = [...e.groups], n = t.findIndex((t) => e.getGroupId(t) === e.sourceGroupId);
1214
+ if (n < 0 || e.sourceGroupId === e.targetGroupId) return t;
1215
+ let [r] = t.splice(n, 1), i = t.findIndex((t) => e.getGroupId(t) === e.targetGroupId);
1216
+ if (r === void 0 || i < 0) return [...e.groups];
1217
+ let a = e.position === "after" ? i + 1 : i;
1218
+ return t.splice(a, 0, r), t;
1219
+ }
1220
+ //#endregion
655
1221
  //#region src/summary.ts
656
- function nt(e, t) {
1222
+ function Mt(e, t) {
657
1223
  return t.split(".").reduce((e, t) => {
658
1224
  if (!(typeof e != "object" || !e)) return e[t];
659
1225
  }, e);
660
1226
  }
661
- function L(e) {
1227
+ function Nt(e) {
662
1228
  return e.filter((e) => typeof e == "number" && Number.isFinite(e));
663
1229
  }
664
- function R(e, t) {
1230
+ function Pt(e, t) {
665
1231
  if (e === "count") return t.length;
666
- let n = L(t);
1232
+ let n = Nt(t);
667
1233
  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);
668
1234
  }
669
- function rt(e, t, n) {
1235
+ function Ft(e, t, n) {
670
1236
  return Object.entries(n.columns).reduce((n, [r, i]) => {
671
1237
  let a = t.find((e) => e.id === r);
672
1238
  if (!a || !i) return n;
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({
1239
+ let o = typeof i == "object" && i ? i : void 0, s = typeof i == "object" && i ? i.aggregate : i, c = e.map((e) => Mt(e, a.field)), l = typeof s == "function" ? s({
674
1240
  column: a,
675
1241
  rows: e,
676
1242
  values: c
677
- }) : R(s, c);
1243
+ }) : Pt(s, c);
678
1244
  return n[r] = o?.format ? o.format({
679
1245
  column: a,
680
1246
  rows: e,
@@ -685,15 +1251,15 @@ function rt(e, t, n) {
685
1251
  }
686
1252
  //#endregion
687
1253
  //#region src/tree.ts
688
- function it(e) {
1254
+ function It(e) {
689
1255
  return e.join(".");
690
1256
  }
691
- function z(e, t) {
1257
+ function Lt(e, t) {
692
1258
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = 0, a = (e, o) => {
693
1259
  e.forEach((e, s) => {
694
1260
  let c = [...o, s], l = t(e.item, i);
695
1261
  if (i += 1, n.has(l)) throw Error(`Duplicate tree row id: ${String(l)}`);
696
- n.set(l, c), r.set(it(c), l), e.children?.length && a(e.children, c);
1262
+ n.set(l, c), r.set(It(c), l), e.children?.length && a(e.children, c);
697
1263
  });
698
1264
  };
699
1265
  return a(e, []), {
@@ -701,17 +1267,17 @@ function z(e, t) {
701
1267
  idByPath: r
702
1268
  };
703
1269
  }
704
- function at(e, t, n) {
1270
+ function Rt(e, t, n) {
705
1271
  let [r, ...i] = t;
706
1272
  return r === void 0 ? [...e] : e.map((e, t) => t === r ? i.length === 0 ? n(e) : e.children ? {
707
1273
  ...e,
708
- children: at(e.children, i, n)
1274
+ children: Rt(e.children, i, n)
709
1275
  } : e : e);
710
1276
  }
711
- function B(e, t, n = {}) {
712
- let r = z(e, t), i = [], a = (e, t, o) => {
1277
+ function zt(e, t, n = {}) {
1278
+ let r = Lt(e, t), i = [], a = (e, t, o) => {
713
1279
  e.forEach((e, s) => {
714
- let c = [...o, s], l = e.children ?? [], u = l.length > 0, d = e.expand ?? n.defaultExpandAll ?? !1, f = r.idByPath.get(it(c));
1280
+ let c = [...o, s], l = e.children ?? [], u = l.length > 0, d = e.expand ?? n.defaultExpandAll ?? !1, f = r.idByPath.get(It(c));
715
1281
  f !== void 0 && (i.push({
716
1282
  depth: t,
717
1283
  expanded: d,
@@ -724,56 +1290,56 @@ function B(e, t, n = {}) {
724
1290
  };
725
1291
  return a(e, 0, []), i;
726
1292
  }
727
- function ot(e) {
728
- return e.flatMap((e) => e.children?.length ? ot(e.children) : [e.item]);
1293
+ function V(e) {
1294
+ return e.flatMap((e) => e.children?.length ? V(e.children) : [e.item]);
729
1295
  }
730
- function st(e, t, n, r = {}) {
731
- let i = z(e, n).byId.get(t);
732
- return i ? at(e, i, (e) => ({
1296
+ function Bt(e, t, n, r = {}) {
1297
+ let i = Lt(e, n).byId.get(t);
1298
+ return i ? Rt(e, i, (e) => ({
733
1299
  ...e,
734
1300
  expand: !(e.expand ?? r.defaultExpandAll ?? !1)
735
1301
  })) : [...e];
736
1302
  }
737
- function ct(e, t, n, r) {
738
- let i = z(e, n).byId.get(t);
739
- return i ? at(e, i, (e) => ({
1303
+ function Vt(e, t, n, r) {
1304
+ let i = Lt(e, n).byId.get(t);
1305
+ return i ? Rt(e, i, (e) => ({
740
1306
  ...e,
741
1307
  item: r(e.item)
742
1308
  })) : [...e];
743
1309
  }
744
- function lt(e, t) {
1310
+ function Ht(e, t) {
745
1311
  return [...e].sort((e, n) => t(e.item, n.item)).map((e) => ({
746
1312
  ...e,
747
- children: e.children ? lt(e.children, t) : void 0
1313
+ children: e.children ? Ht(e.children, t) : void 0
748
1314
  }));
749
1315
  }
750
1316
  //#endregion
751
1317
  //#region src/virtual-layout.ts
752
- var V = 15e5;
753
- function ut(e) {
1318
+ var Ut = 15e5;
1319
+ function Wt(e) {
754
1320
  return `data:${typeof e}:${encodeURIComponent(String(e))}`;
755
1321
  }
756
- function dt(e) {
1322
+ function Gt(e) {
757
1323
  return {
758
1324
  dataIndex: e.dataIndex,
759
1325
  ...e.detail ? { detail: e.detail } : {},
760
- key: ut(e.rowId),
1326
+ key: Wt(e.rowId),
761
1327
  kind: "data",
762
1328
  row: e.row,
763
1329
  rowId: e.rowId,
764
1330
  visibleIndex: e.visibleIndex
765
1331
  };
766
1332
  }
767
- function ft(e, t) {
1333
+ function Kt(e, t) {
768
1334
  return typeof e == "number" && Number.isFinite(e) && e > 0 ? e : Math.max(1, t);
769
1335
  }
770
- function pt(e) {
1336
+ function qt(e) {
771
1337
  return typeof e == "number" && Number.isFinite(e) && e > 0 ? {
772
1338
  height: e,
773
1339
  mode: "fixed"
774
1340
  } : { mode: "auto" };
775
1341
  }
776
- var mt = class e {
1342
+ var Jt = class e {
777
1343
  heights;
778
1344
  tree;
779
1345
  totalHeight;
@@ -818,11 +1384,11 @@ var mt = class e {
818
1384
  return this.heights[e] = n, this.totalHeight += i, this.add(e, i), i;
819
1385
  }
820
1386
  };
821
- function ht(e, t) {
1387
+ function Yt(e, t) {
822
1388
  return e.kind === "group" ? e.height : t + (e.detail?.height ?? 0);
823
1389
  }
824
- function H(e, t) {
825
- let n = Math.min(e, V), r = Math.max(0, e - t), i = Math.max(0, n - t);
1390
+ function Xt(e, t) {
1391
+ let n = Math.min(e, Ut), r = Math.max(0, e - t), i = Math.max(0, n - t);
826
1392
  return {
827
1393
  logicalScrollableHeight: r,
828
1394
  physicalScrollableHeight: i,
@@ -830,8 +1396,8 @@ function H(e, t) {
830
1396
  scrollScale: r > 0 && i > 0 ? r / i : 1
831
1397
  };
832
1398
  }
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);
1399
+ function Zt(e) {
1400
+ let t = Xt(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
1401
  return {
836
1402
  endIndex: s,
837
1403
  logicalScrollTop: r,
@@ -842,7 +1408,7 @@ function gt(e) {
842
1408
  startIndex: o
843
1409
  };
844
1410
  }
845
- function _t(e, t, n, r) {
1411
+ function Qt(e, t, n, r) {
846
1412
  let i = e.get(t);
847
1413
  return i && i.width === Math.round(n) ? {
848
1414
  estimated: !1,
@@ -852,10 +1418,10 @@ function _t(e, t, n, r) {
852
1418
  height: r
853
1419
  };
854
1420
  }
855
- function vt(e, t) {
1421
+ function $t(e, t) {
856
1422
  for (let n of e.keys()) t.has(n) || e.delete(n);
857
1423
  }
858
- function yt(e) {
1424
+ function en(e) {
859
1425
  if (e.keys.length === 0) return;
860
1426
  let t = e.heightIndex.findIndexAtOffset(e.logicalScrollTop), n = e.keys[t];
861
1427
  if (n === void 0) return;
@@ -866,7 +1432,7 @@ function yt(e) {
866
1432
  previousIndex: t
867
1433
  };
868
1434
  }
869
- function bt(e) {
1435
+ function tn(e) {
870
1436
  let t = e.nextKeys.indexOf(e.anchor.key);
871
1437
  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
1438
  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);
@@ -875,48 +1441,32 @@ function bt(e) {
875
1441
  offsetWithinSlot: Math.min(Math.max(0, e.anchor.offsetWithinSlot), Math.max(0, e.getNextHeight(t)))
876
1442
  };
877
1443
  }
878
- function xt(e, t, n) {
879
- let r = H(t, n);
1444
+ function nn(e, t, n) {
1445
+ let r = Xt(t, n);
880
1446
  return Math.min(r.physicalScrollableHeight, Math.max(0, e) / r.scrollScale);
881
1447
  }
882
1448
  //#endregion
883
1449
  //#region src/index.tsx
884
- var St = 88;
885
- function Ct(e, t, n) {
1450
+ var rn = 88;
1451
+ function an(e, t, n) {
886
1452
  return e.id === t.id && e.kind === t.kind ? "neutral" : e.depth !== t.depth || e.parentGroupId !== t.parentGroupId ? "invalid" : n ? "valid" : "invalid";
887
1453
  }
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) {
892
- let a = Math.max(0, r), o = e?.length ?? t.length, s = Math.min(o, Math.max(a, i)), c = [];
893
- for (let r = a; r < s; r += 1) {
894
- let i = e?.[r] ?? r, a = t[i], o = n[i];
895
- a !== void 0 && o !== void 0 && c.push({
896
- dataIndex: i,
897
- row: a,
898
- rowId: o,
899
- visibleIndex: r
900
- });
901
- }
902
- return c;
1454
+ function on(e, t) {
1455
+ return e.selection.rowIds.includes(t) ? e : fe(e, t);
903
1456
  }
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
- });
1457
+ function sn(e) {
1458
+ return e.mixed, e.keys;
909
1459
  }
910
- function Dt(e) {
911
- let t = Et(e.projection), n = e.logicalScrollTop ?? (e.projection.mixed ? gt({
1460
+ function cn(e) {
1461
+ let t = sn(e.projection), n = e.logicalScrollTop ?? (e.projection.mixed ? Zt({
912
1462
  heightIndex: e.projection.heightIndex,
913
1463
  overscan: 0,
914
1464
  physicalScrollTop: e.physicalScrollTop,
915
1465
  viewportHeight: e.viewportHeight
916
1466
  }).logicalScrollTop : (() => {
917
- let t = H(e.projection.visibleRowCount * e.projection.rowHeight, e.viewportHeight);
1467
+ let t = Xt(e.projection.visibleRowCount * e.projection.rowHeight, e.viewportHeight);
918
1468
  return Math.min(t.logicalScrollableHeight, Math.max(0, e.physicalScrollTop) * t.scrollScale);
919
- })()), r = e.projection.mixed ? yt({
1469
+ })()), r = e.projection.mixed ? en({
920
1470
  heightIndex: e.projection.heightIndex,
921
1471
  keys: t,
922
1472
  logicalScrollTop: n
@@ -937,26 +1487,26 @@ function Dt(e) {
937
1487
  previousViewportHeight: e.viewportHeight
938
1488
  } : void 0;
939
1489
  }
940
- function Ot(e) {
1490
+ function ln(e) {
941
1491
  return !e || typeof e == "string" ? e : Object.entries(e).filter(([, e]) => e).map(([e]) => e).join(" ");
942
1492
  }
943
- function kt(e, t, n) {
1493
+ function un(e, t, n) {
944
1494
  return typeof e == "function" ? e(t, n) : e;
945
1495
  }
946
- function At(e, t, n) {
947
- let r = kt(e?.disabled, t, n) === !0;
1496
+ function dn(e, t, n) {
1497
+ let r = un(e?.disabled, t, n) === !0;
948
1498
  return {
949
- className: Ot(kt(e?.className, t, n)),
1499
+ className: ln(un(e?.className, t, n)),
950
1500
  disabled: r,
951
- draggable: !r && kt(e?.draggable, t, n) !== !1,
952
- style: kt(e?.style, t, n)
1501
+ draggable: !r && un(e?.draggable, t, n) !== !1,
1502
+ style: un(e?.style, t, n)
953
1503
  };
954
1504
  }
955
- function jt(e) {
1505
+ function fn(e) {
956
1506
  let t = e?.background ?? e?.backgroundColor;
957
1507
  return typeof t == "string" || typeof t == "number" ? t : void 0;
958
1508
  }
959
- function Mt(e, t, n) {
1509
+ function pn(e, t, n) {
960
1510
  let r = {
961
1511
  height: e,
962
1512
  ...t
@@ -966,7 +1516,7 @@ function Mt(e, t, n) {
966
1516
  "--comins-table-row-custom-background": n
967
1517
  };
968
1518
  }
969
- function Nt(e) {
1519
+ function mn(e) {
970
1520
  return {
971
1521
  data: e.row,
972
1522
  dataIndex: e.dataIndex,
@@ -974,7 +1524,7 @@ function Nt(e) {
974
1524
  index: e.visibleIndex
975
1525
  };
976
1526
  }
977
- function U(e, t) {
1527
+ function hn(e, t) {
978
1528
  return {
979
1529
  definition: e,
980
1530
  field: e.field,
@@ -983,23 +1533,23 @@ function U(e, t) {
983
1533
  label: e.label
984
1534
  };
985
1535
  }
986
- function Pt(e, t) {
1536
+ function gn(e, t) {
987
1537
  return {
988
1538
  event: e,
989
1539
  index: t.visibleIndex,
990
- row: Nt(t)
1540
+ row: mn(t)
991
1541
  };
992
1542
  }
993
- function Ft(e, t, n, r, i) {
1543
+ function _n(e, t, n, r, i) {
994
1544
  return {
995
- column: U(n, r),
1545
+ column: hn(n, r),
996
1546
  event: e,
997
1547
  index: t.visibleIndex,
998
- row: Nt(t),
1548
+ row: mn(t),
999
1549
  value: i
1000
1550
  };
1001
1551
  }
1002
- function W(e, t) {
1552
+ function vn(e, t) {
1003
1553
  return {
1004
1554
  definition: e,
1005
1555
  field: e.field,
@@ -1008,9 +1558,9 @@ function W(e, t) {
1008
1558
  label: e.label
1009
1559
  };
1010
1560
  }
1011
- function It(e, t, n, r, i, a, o) {
1561
+ function yn(e, t, n, r, i, a, o) {
1012
1562
  return {
1013
- column: W(i, a),
1563
+ column: vn(i, a),
1014
1564
  row: {
1015
1565
  data: e.row,
1016
1566
  dataIndex: e.dataIndex,
@@ -1023,31 +1573,31 @@ function It(e, t, n, r, i, a, o) {
1023
1573
  value: o
1024
1574
  };
1025
1575
  }
1026
- function Lt(e, t) {
1576
+ function bn(e, t) {
1027
1577
  let n = e.cell?.props;
1028
1578
  return typeof n == "function" ? n(t) : n;
1029
1579
  }
1030
- function Rt(e, t) {
1580
+ function xn(e, t) {
1031
1581
  return e === void 0 ? !0 : typeof e == "boolean" ? e : e(t);
1032
1582
  }
1033
- function zt(e, t) {
1034
- return e?.disabled !== void 0 && Rt(e.disabled, t) === !0;
1583
+ function Sn(e, t) {
1584
+ return e?.disabled !== void 0 && xn(e.disabled, t) === !0;
1035
1585
  }
1036
- function Bt(e, t) {
1586
+ function Cn(e, t) {
1037
1587
  let n = e?.className;
1038
1588
  return typeof n == "function" ? n(t) : n;
1039
1589
  }
1040
- function Vt(e, t) {
1590
+ function wn(e, t) {
1041
1591
  let n = e?.style;
1042
1592
  return typeof n == "function" ? n(t) : n;
1043
1593
  }
1044
- function Ht(e, t, n) {
1594
+ function Tn(e, t, n) {
1045
1595
  return e.cell?.format ? e.cell.format(n) : t == null ? "" : String(t);
1046
1596
  }
1047
- function Ut(e, t, n) {
1048
- let r = e.columnState[t.id], i = un(e.sortModel, t.id);
1597
+ function En(e, t, n) {
1598
+ let r = e.columnState[t.id], i = Wn(e.sortModel, t.id);
1049
1599
  return {
1050
- column: W(t, n),
1600
+ column: vn(t, n),
1051
1601
  layout: {
1052
1602
  hidden: r?.hidden === !0 || t.hidden === !0,
1053
1603
  width: r?.width ?? t.width
@@ -1060,17 +1610,17 @@ function Ut(e, t, n) {
1060
1610
  }
1061
1611
  };
1062
1612
  }
1063
- function Wt(e) {
1613
+ function H(e) {
1064
1614
  return "row" in e && "selection" in e;
1065
1615
  }
1066
- function Gt(e, t) {
1067
- return !Wt(t) || e.type !== "input" && e.type !== "select" || t.selection.selectedRowCount === 1 && t.row.selected;
1616
+ function Dn(e, t) {
1617
+ return !H(t) || e.type !== "input" && e.type !== "select" || t.selection.selectedRowCount === 1 && t.row.selected;
1068
1618
  }
1069
- function Kt(e, t) {
1070
- return (e ?? []).filter((e) => Gt(e, t));
1619
+ function On(e, t) {
1620
+ return (e ?? []).filter((e) => Dn(e, t));
1071
1621
  }
1072
- function qt(e, t, n, r) {
1073
- return Kt(e, t).map((e, t) => ({
1622
+ function kn(e, t, n, r) {
1623
+ return On(e, t).map((e, t) => ({
1074
1624
  component: e,
1075
1625
  index: t
1076
1626
  })).filter(({ component: e }) => (e.direction ?? "left") === n).map(({ component: e, index: i }) => /* @__PURE__ */ A("span", {
@@ -1078,64 +1628,64 @@ function qt(e, t, n, r) {
1078
1628
  "data-comins-component-align": e.align ?? "center",
1079
1629
  "data-comins-component-direction": n,
1080
1630
  "data-comins-component-id": e.id ?? `${e.type}-${i}`,
1081
- children: Ze(e, t, r)
1631
+ children: _t(e, t, r)
1082
1632
  }, e.id ?? `${e.type}-${i}`));
1083
1633
  }
1084
- function G(e) {
1634
+ function U(e) {
1085
1635
  e.preventDefault(), e.stopPropagation();
1086
1636
  }
1087
- function Jt(e) {
1637
+ function An(e) {
1088
1638
  e.stopPropagation(), e.target instanceof HTMLElement && e.target.blur();
1089
1639
  }
1090
- var Yt = /* @__PURE__ */ new WeakSet();
1091
- function Xt(e) {
1092
- if (!e || Yt.has(e)) return;
1640
+ var jn = /* @__PURE__ */ new WeakSet();
1641
+ function Mn(e) {
1642
+ if (!e || jn.has(e)) return;
1093
1643
  let t = (t) => {
1094
1644
  e.hasAttribute("inert") && e.getAttribute("aria-hidden") === "true" && (t.preventDefault(), t.stopPropagation());
1095
1645
  };
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
1646
+ e.addEventListener("change", t, !0), e.addEventListener("input", t, !0), jn.add(e);
1647
+ }
1648
+ var Nn = {
1649
+ onBeforeInputCapture: U,
1650
+ onBlurCapture: U,
1651
+ onChangeCapture: U,
1652
+ onClickCapture: U,
1653
+ onContextMenuCapture: U,
1654
+ onDoubleClickCapture: U,
1655
+ onFocusCapture: An,
1656
+ onInputCapture: U,
1657
+ onKeyDownCapture: U,
1658
+ onKeyPressCapture: U,
1659
+ onKeyUpCapture: U,
1660
+ onMouseDownCapture: U,
1661
+ onMouseMoveCapture: U,
1662
+ onMouseOutCapture: U,
1663
+ onMouseOverCapture: U,
1664
+ onMouseUpCapture: U,
1665
+ onPointerCancelCapture: U,
1666
+ onPointerDownCapture: U,
1667
+ onPointerMoveCapture: U,
1668
+ onPointerOutCapture: U,
1669
+ onPointerOverCapture: U,
1670
+ onPointerUpCapture: U,
1671
+ onResetCapture: U,
1672
+ onScrollCapture: U,
1673
+ onSubmitCapture: U,
1674
+ onTouchCancelCapture: U,
1675
+ onTouchEndCapture: U,
1676
+ onTouchMoveCapture: U,
1677
+ onTouchStartCapture: U,
1678
+ onWheelCapture: U
1129
1679
  };
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) : "";
1680
+ function Pn(e, t) {
1681
+ let n = (e) => typeof e == "string" || typeof e == "number" ? String(e) : Array.isArray(e) ? e.map(n).join("") : Ae(e) && typeof e.type == "string" ? n(e.props.children) : "";
1132
1682
  return n(e).trim() || t;
1133
1683
  }
1134
- function $t(e, t, n, r = {}) {
1684
+ function Fn(e, t, n, r = {}) {
1135
1685
  if (!t?.length) return e;
1136
- let i = r.showContent ?? !0, a = Kt(t, n);
1686
+ let i = r.showContent ?? !0, a = On(t, n);
1137
1687
  if (!a.length) return e;
1138
- let o = qt(a, n, "left", r.interaction), s = qt(a, n, "right", r.interaction);
1688
+ let o = kn(a, n, "left", r.interaction), s = kn(a, n, "right", r.interaction);
1139
1689
  return i ? /* @__PURE__ */ j("span", {
1140
1690
  className: "comins-table__component-layout",
1141
1691
  children: [
@@ -1164,48 +1714,48 @@ function $t(e, t, n, r = {}) {
1164
1714
  })
1165
1715
  });
1166
1716
  }
1167
- function en(e) {
1168
- return Math.max(St, e.minWidth ?? St);
1717
+ function In(e) {
1718
+ return Math.max(rn, e.minWidth ?? rn);
1169
1719
  }
1170
- function tn(e) {
1720
+ function Ln(e) {
1171
1721
  return e.maxWidth ?? Infinity;
1172
1722
  }
1173
- function nn(e, t) {
1723
+ function W(e, t) {
1174
1724
  return e.columnState[t.id]?.width ?? t.width ?? 100;
1175
1725
  }
1176
- function rn(e, t, n) {
1726
+ function Rn(e, t, n) {
1177
1727
  return Math.min(n, Math.max(t, e));
1178
1728
  }
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));
1729
+ function zn(e, t, n) {
1730
+ let r = t.map((t) => Rn(W(e, t), In(t), Ln(t))), i = new Set(t.map((e, t) => t)), a = t.map(In), o = t.map(Ln), s = Rn(n, a.reduce((e, t) => e + t, 0), o.reduce((e, t) => e + t, 0));
1181
1731
  for (; i.size > 0;) {
1182
1732
  let e = s - r.reduce((e, t) => e + t, 0);
1183
1733
  if (Math.abs(e) < .001) break;
1184
1734
  let t = [...i], n = t.reduce((e, t) => e + Math.max(r[t] ?? 0, 0), 0), c = !1;
1185
1735
  for (let s of t) {
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);
1736
+ let l = r[s] ?? 0, u = l + e * (n > 0 ? l / n : 1 / t.length), d = Rn(u, a[s] ?? 0, o[s] ?? Infinity);
1187
1737
  r[s] = d, Math.abs(d - u) > .001 && (i.delete(s), c = !0);
1188
1738
  }
1189
1739
  if (!c) break;
1190
1740
  }
1191
1741
  return r;
1192
1742
  }
1193
- function on(e, t, n) {
1743
+ function Bn(e, t, n) {
1194
1744
  let r = e.columnGroups.find((e) => e.children.includes(t));
1195
- if (!r || e.columnGroupState[r.id]?.hidden === !0) return _e(e, t, n);
1745
+ if (!r || e.columnGroupState[r.id]?.hidden === !0) return ve(e, t, n);
1196
1746
  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);
1197
- if (!a) return _e(e, t, n);
1747
+ if (!a) return ve(e, t, n);
1198
1748
  let o = i.filter((e) => e.id !== t);
1199
1749
  if (o.length === 0) {
1200
- let r = nn(e, a);
1201
- return _e(e, t, rn(n, en(a), Math.min(tn(a), r)));
1750
+ let r = W(e, a);
1751
+ return ve(e, t, Rn(n, In(a), Math.min(Ln(a), r)));
1202
1752
  }
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);
1753
+ let s = i.reduce((t, n) => t + W(e, n), 0), c = o.reduce((e, t) => e + In(t), 0), l = o.reduce((e, t) => e + Ln(t), 0), u = Math.max(In(a), s - l), d = Rn(n, u, Math.max(u, Math.min(Ln(a), s - c))), f = zn(e, o, s - d), p = ve(e, t, d);
1204
1754
  return o.forEach((e, t) => {
1205
- p = _e(p, e.id, f[t] ?? nn(p, e));
1755
+ p = ve(p, e.id, f[t] ?? W(p, e));
1206
1756
  }), p;
1207
1757
  }
1208
- function sn(e, t, n) {
1758
+ function Vn(e, t, n) {
1209
1759
  if (!e || typeof e != "object") return e;
1210
1760
  let r = t.split("."), [i] = r;
1211
1761
  if (!i) return e;
@@ -1219,7 +1769,7 @@ function sn(e, t, n) {
1219
1769
  o[e] = a, n && (o = a);
1220
1770
  }), o[r.at(-1)] = n, a;
1221
1771
  }
1222
- function cn(e, t) {
1772
+ function Hn(e, t) {
1223
1773
  return e?.columnId === t ? e.direction === "asc" ? {
1224
1774
  columnId: t,
1225
1775
  direction: "desc"
@@ -1228,60 +1778,60 @@ function cn(e, t) {
1228
1778
  direction: "asc"
1229
1779
  };
1230
1780
  }
1231
- function ln(e, t, n) {
1232
- let r = e.findIndex((e) => e.columnId === t), i = cn(r < 0 ? null : e[r] ?? null, t);
1781
+ function Un(e, t, n) {
1782
+ let r = e.findIndex((e) => e.columnId === t), i = Hn(r < 0 ? null : e[r] ?? null, t);
1233
1783
  return n ? i ? r < 0 ? [...e, i] : e.map((e, t) => t === r ? i : e) : e.filter((e) => e.columnId !== t) : i ? [i] : [];
1234
1784
  }
1235
- function un(e, t) {
1785
+ function Wn(e, t) {
1236
1786
  let n = e.findIndex((e) => e.columnId === t);
1237
1787
  return n < 0 ? null : {
1238
1788
  priority: n + 1,
1239
1789
  rule: e[n]
1240
1790
  };
1241
1791
  }
1242
- function dn(e, t) {
1243
- let n = un(e, t)?.rule;
1792
+ function Gn(e, t) {
1793
+ let n = Wn(e, t)?.rule;
1244
1794
  return n ? n.direction : "none";
1245
1795
  }
1246
- function fn(e, t) {
1247
- let n = un(e, t);
1796
+ function Kn(e, t) {
1797
+ let n = Wn(e, t);
1248
1798
  if (!n) return e.length > 1 ? void 0 : "none";
1249
1799
  if (!(n.priority > 1)) return n.rule.direction === "asc" ? "ascending" : "descending";
1250
1800
  }
1251
- function pn(e, t) {
1801
+ function qn(e, t) {
1252
1802
  return !e || !t ? e === t : e.columnId === t.columnId && e.direction === t.direction;
1253
1803
  }
1254
- function mn(e, t) {
1804
+ function Jn(e, t) {
1255
1805
  return e.length === t.length && e.every((e, n) => e.columnId === t[n]?.columnId && e.direction === t[n]?.direction);
1256
1806
  }
1257
- function K(e, t) {
1807
+ function Yn(e, t) {
1258
1808
  return e.length === t.length && e.every((e, n) => e === t[n]);
1259
1809
  }
1260
- function hn(e, t) {
1261
- if (!K(e.rowIds, t.rowIds)) return !1;
1810
+ function Xn(e, t) {
1811
+ if (!Yn(e.rowIds, t.rowIds)) return !1;
1262
1812
  let n = new Set(t.columns.map((e) => e.id)), r = e.selection.cell, i = e.selection.range;
1263
1813
  return !(r && !n.has(r.columnId) || i && (!n.has(i.anchor.columnId) || !n.has(i.focus.columnId)));
1264
1814
  }
1265
- function gn(e, t) {
1815
+ function Zn(e, t) {
1266
1816
  return t.split(".").reduce((e, t) => {
1267
1817
  if (!(typeof e != "object" || !e)) return e[t];
1268
1818
  }, e);
1269
1819
  }
1270
- function _n(e, t) {
1820
+ function Qn(e, t) {
1271
1821
  return typeof e == "number" && typeof t == "number" ? e - t : String(e ?? "").localeCompare(String(t ?? ""));
1272
1822
  }
1273
- function vn(e, t, n) {
1274
- return n.length === 0 ? e : lt(e, (e, r) => {
1823
+ function $n(e, t, n) {
1824
+ return n.length === 0 ? e : Ht(e, (e, r) => {
1275
1825
  for (let i of n) {
1276
1826
  let n = t.find((e) => (e.id ?? e.field) === i.columnId);
1277
1827
  if (!n?.sort) continue;
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);
1828
+ let a = Zn(e, n.field), o = Zn(r, n.field), s = typeof n.sort == "function" ? n.sort(a, o, e, r) : Qn(a, o);
1279
1829
  if (s !== 0) return i.direction === "desc" ? s * -1 : s;
1280
1830
  }
1281
1831
  return 0;
1282
1832
  });
1283
1833
  }
1284
- function yn(e, t, n, r, i) {
1834
+ function er(e, t, n, r, i) {
1285
1835
  if (t?.length === 0) return e;
1286
1836
  let a = [], o = /* @__PURE__ */ new Map(), s = 0, c = (e, t) => {
1287
1837
  e.forEach((e) => {
@@ -1313,138 +1863,150 @@ function yn(e, t, n, r, i) {
1313
1863
  };
1314
1864
  return m(e);
1315
1865
  }
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({
1318
- columnGroups: l,
1319
- columns: u,
1320
- getRowId: y,
1321
- pagination: We,
1322
- rows: Xn,
1323
- showHeader: Ye,
1324
- theme: nt
1325
- })), Y = O(J), Qn = O({
1326
- columnGroups: l,
1327
- columns: u,
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(() => {
1866
+ function tr({ "buffer-size": e, cellSelection: n = !0, className: r, columnFiltering: l, columnGroups: u, columns: d, data: f, "data-testid": p, emptyComponent: m, estimatedRowDetailHeight: h, expandedRowIds: v, getRowDetailHeight: y, getRowId: x, hasMoreRows: te = !1, infiniteScroll: re = !1, infiniteScrollThreshold: S = 160, lazyLoad: T = !1, lazyLoadBatchSize: le = 30, lazyLoadMode: he = "append", lazyLoadThreshold: _e, loading: ye = !1, loadingComponent: be, loadingMore: Ce = !1, multiSort: we = !1, onChangeColumnLayout: Ee, onChangeData: ke, onChangeSelection: Ae, onChangeSort: Pe, onChangeSortModel: Fe, onClickCell: Ie, onClickRow: Le, onContextMenuCell: Re, onContextMenuRow: ze, onChangeExpandedRowIds: He, onDoubleClickCell: Ue, onDoubleClickRow: We, onKeyDownCell: Ge, onKeyDownRow: Ke, onLazyLoad: qe, onLoadMore: Je, pagination: Ye, persistHeaderWhenEmpty: Ze = !0, rowHeight: M = 36, rowGrouping: N, rowProps: tt, isRowExpandable: nt, renderRowDetail: rt, showColumnMoveHandle: it = !0, showHeader: at = !0, skeletonRowCount: st, style: ct, summary: P, theme: lt, treeContext: F, virtualized: I = !1 }, ut) {
1867
+ let L = O(null), R = O(null), z = O(null), dt = O(null), ft = O(null), pt = O(null), mt = O(/* @__PURE__ */ new Map()), ht = O(/* @__PURE__ */ new Map()), gt = O(/* @__PURE__ */ new Set()), _t = O(null), bt = O(/* @__PURE__ */ new Set()), xt = O(null), St = O(/* @__PURE__ */ new Map()), B = O(null), Ct = O(null), Tt = O(null), Ot = O(null), Mt = O(/* @__PURE__ */ new Map()), Nt = O(null), Pt = O(null), It = O(null), Lt = O(qe), Rt = O(0), zt = O(null), V = O(null), Bt = O(null), Vt = O(null), Ht = O(!1), Ut = O(null), Xt = O(null), en = O(/* @__PURE__ */ new Map()), rn = O(null), un = O(null), hn = O(null), vn = O(0), xn = O(null), H = O(null), Dn = O(0), U = O(null), An = O(null), jn = O(null), W = O(null), [zn, Hn] = k(0), [Yn, Zn] = k(0), [Qn, $n] = k(0), [er, tr] = k(null), [nr, rr] = k(null), [ir, ar] = k(null), [or, sr] = k(null), [cr, lr] = k(null), [ur, dr] = k(null), [fr, pr] = k(null), [mr, hr] = k(null), [gr, _r] = k(0), vr = je(), yr = f, G = !F && typeof N == "object" && !!N && N !== void 0 && Array.isArray(N.groups) && typeof N.getGroupId == "function" && typeof N.getRowGroupId == "function", K = !F && typeof l == "object" && !!l && l !== void 0 && Array.isArray(l.model), br = D(() => G ? {
1868
+ pageIndex: 0,
1869
+ pageSize: Math.max(1, yr.length)
1870
+ } : Ye, [
1871
+ yr.length,
1872
+ G,
1873
+ Ye
1874
+ ]), xr = K ? {
1875
+ ...tt,
1876
+ draggable: !1
1877
+ } : tt, [q, Sr] = k(() => c({
1878
+ columnGroups: u,
1879
+ columns: d,
1880
+ getRowId: x,
1881
+ pagination: br,
1882
+ rows: yr,
1883
+ showHeader: at,
1884
+ theme: lt
1885
+ })), J = O(q), Cr = O({
1886
+ columnGroups: u,
1887
+ columns: d,
1888
+ data: yr,
1889
+ getRowId: x,
1890
+ pagination: br,
1891
+ showHeader: at
1892
+ }), wr = Math.max(0, Math.floor(Number.isFinite(e) ? Number(e) : 10)), Tr = Math.max(1, Math.floor(le)), Er = Math.max(0, Math.floor(_e ?? S)), Dr = typeof qe == "function", Or = typeof rt == "function" && !F, kr = D(() => {
1333
1893
  let e = /* @__PURE__ */ new Set();
1334
- return (h ?? []).filter((t) => e.has(t) ? !1 : (e.add(t), !0));
1335
- }, [h]), ar = D(() => new Set(ir), [ir]), or = (e, t) => {
1336
- !rr || !t || !M || M(ar.has(e) ? ir.filter((t) => t !== e) : [...ir, e]);
1337
- }, sr = () => {
1338
- let e = U.current;
1339
- U.current = null, e?.();
1340
- }, cr = (e) => {
1341
- sr(), U.current = e;
1894
+ return (v ?? []).filter((t) => !e.has(t) && (e.add(t), !0));
1895
+ }, [v]), Ar = D(() => new Set(kr), [kr]), jr = (e, t) => {
1896
+ !Or || !t || !He || He(Ar.has(e) ? kr.filter((t) => t !== e) : [...kr, e]);
1897
+ }, Mr = () => {
1898
+ let e = B.current;
1899
+ B.current = null, e?.();
1900
+ }, Nr = (e) => {
1901
+ Mr(), B.current = e;
1342
1902
  };
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));
1903
+ Ne(() => {
1904
+ Lt.current = qe;
1905
+ }, [qe]);
1906
+ let Pr = (e) => {
1907
+ let t = Lt.current;
1908
+ if (G || K || !T || he !== "append" || !t || It.current) return;
1909
+ let n = J.current.rows.length;
1910
+ if (e === "scroll" && (!te || ye || Ce)) return;
1911
+ let r = new AbortController(), i = Rt.current + 1, a = e === "scroll" ? n : 0;
1912
+ Rt.current = i, Pt.current?.abort(), Pt.current = r, It.current = e, e !== "scroll" && (Dn.current = 0, _r(0), L.current && (L.current.scrollTop = 0));
1353
1913
  let o;
1354
1914
  try {
1355
1915
  o = t({
1356
- limit: er,
1916
+ limit: Tr,
1357
1917
  offset: a,
1358
1918
  reason: e,
1359
1919
  signal: r.signal
1360
1920
  });
1361
1921
  } catch {
1362
- Yt.current = null, Jt.current = null;
1922
+ It.current = null, Pt.current = null;
1363
1923
  return;
1364
1924
  }
1365
1925
  Promise.resolve(o).catch(() => {}).finally(() => {
1366
- an.current === i && (Yt.current = null, Jt.current = null);
1926
+ Rt.current === i && (It.current = null, Pt.current = null);
1367
1927
  });
1368
1928
  };
1369
1929
  E(() => {
1370
- if (!(!x || !nr)) return lr("initial"), () => {
1371
- an.current += 1, Yt.current = null, Jt.current?.abort(), Jt.current = null;
1930
+ if (!(G || K || !T || !Dr)) return Pr("initial"), () => {
1931
+ Rt.current += 1, It.current = null, Pt.current?.abort(), Pt.current = null;
1372
1932
  };
1373
1933
  }, [
1374
- nr,
1375
- x,
1376
- er
1934
+ K,
1935
+ G,
1936
+ Dr,
1937
+ T,
1938
+ Tr
1377
1939
  ]), 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 = {
1381
- columnGroups: l,
1382
- columns: u,
1383
- data: Xn,
1384
- getRowId: y,
1385
- pagination: We,
1386
- showHeader: Ye
1940
+ let e = Cr.current;
1941
+ if (e.columns === d && e.columnGroups === u && e.data === yr && e.getRowId === x && e.pagination === br && e.showHeader === at) return;
1942
+ Cr.current = {
1943
+ columnGroups: u,
1944
+ columns: d,
1945
+ data: yr,
1946
+ getRowId: x,
1947
+ pagination: br,
1948
+ showHeader: at
1387
1949
  };
1388
- let t = Y.current, n = c({
1389
- columnLayout: pe(t),
1390
- columnGroups: l,
1391
- columns: u,
1392
- getRowId: y,
1393
- pagination: We ?? t.pagination,
1394
- rows: Xn,
1395
- showHeader: Ye,
1950
+ let t = J.current, n = c({
1951
+ columnLayout: me(t),
1952
+ columnGroups: u,
1953
+ columns: d,
1954
+ getRowId: x,
1955
+ pagination: br ?? t.pagination,
1956
+ rows: yr,
1957
+ showHeader: at,
1396
1958
  sortModel: t.sortModel,
1397
1959
  theme: t.theme
1398
- }), r = hn(t, n) ? {
1960
+ }), r = Xn(t, n) ? {
1399
1961
  ...n,
1400
1962
  selection: t.selection
1401
1963
  } : n;
1402
- if (e.getRowId !== y) {
1964
+ if (e.getRowId !== x) {
1403
1965
  let e = new Map(t.rowIds.map((e, n) => [e, t.rows[n]]));
1404
1966
  r.rowIds.forEach((t, n) => {
1405
- e.has(t) && e.get(t) !== r.rows[n] && lt.current.delete(t);
1967
+ e.has(t) && e.get(t) !== r.rows[n] && mt.current.delete(t);
1406
1968
  });
1407
1969
  }
1408
- Y.current = r, Zn(r), pn(r.sort, t.sort) || ke?.(r.sort), mn(r.sortModel, t.sortModel) || Ne?.(r.sortModel);
1970
+ J.current = r, Sr(r), qn(r.sort, t.sort) || Pe?.(r.sort), Jn(r.sortModel, t.sortModel) || Fe?.(r.sortModel);
1409
1971
  }, [
1410
- l,
1411
1972
  u,
1412
- Xn,
1413
- y,
1414
- We,
1415
- Ye
1973
+ d,
1974
+ yr,
1975
+ br,
1976
+ x,
1977
+ at
1416
1978
  ]), 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);
1979
+ J.current = q;
1980
+ }, [q]), E(() => {
1981
+ zt.current !== null && zt.current !== q.rows.length && (zt.current = null);
1982
+ }, [q.rows.length]), E(() => () => {
1983
+ Mr(), jn.current !== null && window.cancelAnimationFrame(jn.current), An.current !== null && window.clearTimeout(An.current);
1422
1984
  }, []), E(() => {
1423
- let e = z.current;
1985
+ let e = L.current;
1424
1986
  if (!e || typeof ResizeObserver > "u") return;
1425
1987
  let t = new ResizeObserver(([e]) => {
1426
- e && (On(e.contentRect.height), An(e.contentRect.width));
1988
+ e && (Hn(e.contentRect.height), Zn(e.contentRect.width));
1427
1989
  });
1428
1990
  return t.observe(e), () => t.disconnect();
1429
1991
  }, []), E(() => {
1430
- vt(lt.current, new Set(J.rowIds));
1431
- }, [J.rowIds]);
1432
- let ur = (e, t, n, r) => {
1992
+ $t(mt.current, new Set(q.rowIds));
1993
+ }, [q.rowIds]);
1994
+ let Fr = (e, t, n, r) => {
1433
1995
  let i = e.projection;
1434
1996
  if (!i || r !== e.contentWidth) return !1;
1435
1997
  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;
1998
+ if (a === void 0 || o?.kind !== "data" || o.detail?.mode !== "auto") return !1;
1437
1999
  let s = i.heightIndex.getHeight(a) - o.detail.height + n, c = i.heightIndex.updateHeight(a, s);
1438
2000
  return o.detail.estimated = !1, o.detail.height = n, c !== 0;
1439
- }, dr = (e) => {
1440
- let t = St.current;
2001
+ }, Ir = (e) => {
2002
+ let t = xt.current;
1441
2003
  if (!t) return;
1442
2004
  let n = e.filter(({ height: e, rowId: t, width: n }) => {
1443
- let r = lt.current.get(t);
2005
+ let r = mt.current.get(t);
1444
2006
  return !r || r.width !== n || Math.abs(r.height - e) >= .5;
1445
2007
  });
1446
2008
  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({
2009
+ let r = t.projection, i = L.current, a = i?.clientHeight || t.viewportHeight, o = H.current, s = o?.status === "pending" ? o : !o && r && i ? cn({
1448
2010
  logicalScrollTop: xn.current && Math.abs(i.scrollTop - xn.current.actualPhysical) <= .5 ? xn.current.targetLogical : void 0,
1449
2011
  physicalScrollTop: i.scrollTop,
1450
2012
  projection: {
@@ -1454,25 +2016,25 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1454
2016
  },
1455
2017
  viewportHeight: a
1456
2018
  }) : void 0, c = !1;
1457
- for (let e of n) lt.current.set(e.rowId, {
2019
+ for (let e of n) mt.current.set(e.rowId, {
1458
2020
  height: e.height,
1459
2021
  width: e.width
1460
- }), c = ur(t, e.rowId, e.height, e.width) || c;
2022
+ }), c = Fr(t, e.rowId, e.height, e.width) || c;
1461
2023
  if (s && c && o?.status !== "pending") {
1462
- let e = bn.current + 1;
1463
- bn.current = e, q.current = {
2024
+ let e = vn.current + 1;
2025
+ vn.current = e, H.current = {
1464
2026
  ...s,
1465
2027
  revision: e,
1466
2028
  status: "pending"
1467
2029
  };
1468
2030
  }
1469
- (c || !r) && Mn((e) => e + 1);
1470
- }, fr = () => {
2031
+ (c || !r) && $n((e) => e + 1);
2032
+ }, Lr = () => {
1471
2033
  if (typeof ResizeObserver > "u") return null;
1472
2034
  let e = new ResizeObserver((e) => {
1473
2035
  let t = [];
1474
2036
  for (let n of e) {
1475
- let e = V.current.get(n.target);
2037
+ let e = ht.current.get(n.target);
1476
2038
  if (!e) continue;
1477
2039
  let r = (Array.isArray(n.borderBoxSize) ? n.borderBoxSize[0] : n.borderBoxSize)?.blockSize ?? n.target.getBoundingClientRect().height, i = Math.round(n.target.getBoundingClientRect().width);
1478
2040
  Number.isFinite(r) && r > 0 && t.push({
@@ -1481,152 +2043,312 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1481
2043
  width: i
1482
2044
  });
1483
2045
  }
1484
- dr(t);
2046
+ Ir(t);
1485
2047
  });
1486
- H.current = e;
1487
- for (let t of V.current.values()) yt.current.add(t.element), e.observe(t.element);
2048
+ _t.current = e;
2049
+ for (let t of ht.current.values()) bt.current.add(t.element), e.observe(t.element);
1488
2050
  return e;
1489
2051
  };
1490
- Me(() => () => {
1491
- H.current?.disconnect(), H.current = null, yt.current.clear(), V.current.clear(), ut.current.clear(), St.current = null;
2052
+ Ne(() => () => {
2053
+ _t.current?.disconnect(), _t.current = null, bt.current.clear(), ht.current.clear(), gt.current.clear(), xt.current = null;
1492
2054
  }, []);
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));
2055
+ let Rr = () => {
2056
+ ht.current.size === 0 && (_t.current?.disconnect(), _t.current = null, bt.current.clear());
2057
+ }, zr = (e, t, n) => {
2058
+ for (let [t, r] of ht.current) r.rowId === e && t !== n && (_t.current?.unobserve(t), bt.current.delete(t), ht.current.delete(t), gt.current.delete(t));
1497
2059
  if (!n || t === "fixed") {
1498
- pr();
2060
+ Rr();
1499
2061
  return;
1500
2062
  }
1501
- V.current.set(n, {
2063
+ ht.current.set(n, {
1502
2064
  element: n,
1503
2065
  rowId: e
1504
2066
  });
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();
2067
+ }, Br = (e, t, n = {}) => {
2068
+ t.rows !== e.rows && ke?.(t.rows), t.selection !== e.selection && Ae?.(t.selection), n.columnLayoutChanged && Ee?.(me(t)), qn(t.sort, e.sort) || Pe?.(t.sort), Jn(t.sortModel, e.sortModel) || Fe?.(t.sortModel);
2069
+ }, Y = (e, t = {}) => {
2070
+ let n = J.current, r = typeof e == "function" ? e(n) : e;
2071
+ J.current = r, Sr(r), Br(n, r, t);
2072
+ }, X = D(() => ee(q), [q]), Vr = /* @__PURE__ */ new Map();
1511
2073
  E(() => {
1512
- Gt.current = gr;
2074
+ Mt.current = Vr;
1513
2075
  });
1514
- let _r = D(() => {
1515
- let e = Z.length;
2076
+ let Hr = D(() => {
2077
+ let e = X.length;
1516
2078
  if (e === 0) return [];
1517
- let t = Z.map((e) => J.columnState[e.id]?.width ?? e.width);
1518
- if (kn <= 0) {
2079
+ let t = X.map((e) => q.columnState[e.id]?.width ?? e.width);
2080
+ if (Yn <= 0) {
1519
2081
  let n = `${100 / e}%`;
1520
2082
  return t.map((e, t) => {
1521
2083
  if (e === void 0) return n;
1522
- let r = Z[t];
1523
- return rn(e, en(r), tn(r));
2084
+ let r = X[t];
2085
+ return Rn(e, In(r), Ln(r));
1524
2086
  });
1525
2087
  }
1526
2088
  let n = 0;
1527
2089
  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;
2090
+ let r = X.filter((e, n) => t[n] === void 0), i = r.length > 0 ? Math.max(0, (Yn - n) / r.length) : 0;
2091
+ return X.map((e, n) => {
2092
+ let r = t[n] ?? i, a = In(e), o = e.maxWidth ?? Infinity;
1531
2093
  return Math.min(o, Math.max(a, r));
1532
2094
  });
1533
2095
  }, [
1534
- kn,
1535
- J.columnState,
1536
- Z
1537
- ]), vr = D(() => {
2096
+ Yn,
2097
+ q.columnState,
2098
+ X
2099
+ ]), Ur = D(() => {
1538
2100
  let e = 0;
1539
- for (let t of _r) {
2101
+ for (let t of Hr) {
1540
2102
  if (typeof t != "number") return;
1541
2103
  e += t;
1542
2104
  }
1543
2105
  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 [];
2106
+ }, [Hr]), Wr = D(() => {
2107
+ if (typeof Ur == "number") return Math.max(Yn, Ur);
2108
+ }, [Ur, Yn]), Gr = typeof Wr == "number" && Number.isFinite(Wr) ? Math.round(Wr) : 0, Kr = D(() => _(q), [q]), qr = D(() => K ? Xe({
2109
+ columns: q.columns,
2110
+ model: l?.model
2111
+ }) : [], [
2112
+ l?.model,
2113
+ K,
2114
+ q.columns
2115
+ ]), Jr = qr.length > 0, Yr = D(() => new Map(qr.map((e) => [e.column.id, e])), [qr]), Xr = D(() => K ? Qe({
2116
+ columns: q.columns,
2117
+ model: l?.model,
2118
+ rows: q.rows.map((e, t) => ({
2119
+ data: e,
2120
+ dataIndex: t,
2121
+ id: q.rowIds[t]
2122
+ }))
2123
+ }) : q.rows.map((e, t) => t), [
2124
+ l?.model,
2125
+ K,
2126
+ q.columns,
2127
+ q.rowIds,
2128
+ q.rows
2129
+ ]), Zr = D(() => Xr.flatMap((e) => {
2130
+ let t = q.rows[e];
2131
+ return t === void 0 ? [] : [t];
2132
+ }), [Xr, q.rows]), Qr = D(() => P ? Ft(F?.summaryRows ?? Zr, X, P) : null, [
2133
+ Zr,
2134
+ P,
2135
+ F?.summaryRows,
2136
+ X
2137
+ ]), $r = D(() => {
2138
+ if (!P) return [];
1553
2139
  let e = [], t = 0;
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);
2140
+ for (; t < X.length;) {
2141
+ let n = X[t], r = P.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, X.length - t);
1556
2142
  e.push({
1557
2143
  className: i?.className,
1558
2144
  colSpan: o,
1559
2145
  column: n,
1560
2146
  style: i?.style,
1561
- value: Sr?.[n.id] ?? (e.length === 0 ? I.label : null)
2147
+ value: Qr?.[n.id] ?? (e.length === 0 ? P.label : null)
1562
2148
  }), t += o;
1563
2149
  }
1564
2150
  return e;
1565
2151
  }, [
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);
2152
+ P,
2153
+ Qr,
2154
+ X
2155
+ ]), ei = N?.aggregations, ti = N?.getGroupId, ni = N?.getGroupLabel, ri = N?.getRowGroupId, ii = N?.groups, ai = D(() => G && ti && ri && ii ? Et({
2156
+ columns: q.columns,
2157
+ config: {
2158
+ aggregations: ei,
2159
+ getGroupId: ti,
2160
+ getGroupLabel: ni,
2161
+ getRowGroupId: ri,
2162
+ groups: ii
2163
+ }
2164
+ }) : null, [
2165
+ ei,
2166
+ ti,
2167
+ ni,
2168
+ ri,
2169
+ ii,
2170
+ G,
2171
+ q.columns
2172
+ ]), oi = D(() => ai && ri ? Dt({
2173
+ ...ai,
2174
+ getRowGroupId: ri,
2175
+ rows: Xr.flatMap((e) => {
2176
+ let t = q.rows[e], n = q.rowIds[e];
2177
+ return t === void 0 || n === void 0 ? [] : [{
2178
+ data: t,
2179
+ dataIndex: e,
2180
+ id: n
2181
+ }];
2182
+ })
2183
+ }) : null, [
2184
+ Xr,
2185
+ ri,
2186
+ ai,
2187
+ q.rowIds,
2188
+ q.rows
2189
+ ]), Z = D(() => oi ? kt({
2190
+ columns: q.columns,
2191
+ model: oi,
2192
+ rows: q.rows,
2193
+ sortModel: q.sortModel
2194
+ }) : null, [
2195
+ oi,
2196
+ q.columns,
2197
+ q.rows,
2198
+ q.sortModel
2199
+ ]), si = D(() => {
2200
+ let e = /* @__PURE__ */ new Set();
2201
+ return (Array.isArray(N?.expandedGroupIds) ? N.expandedGroupIds : []).filter((t) => !Z?.groupsById.has(t) || e.has(t) ? !1 : (e.add(t), !0));
2202
+ }, [Z, N?.expandedGroupIds]), ci = D(() => new Set(si), [si]), li = (e) => {
2203
+ let t = N?.onChangeExpandedGroupIds;
2204
+ typeof t != "function" || !Z?.groupsById.has(e) || t(ci.has(e) ? si.filter((t) => t !== e) : [...si, e]);
2205
+ }, Q = D(() => Z ? At({
2206
+ expandedGroupIds: si,
2207
+ model: Z,
2208
+ rowIds: q.rowIds
2209
+ }) : null, [
2210
+ si,
2211
+ Z,
2212
+ q.rowIds
2213
+ ]), ui = Q !== null;
2214
+ Ne(() => {
2215
+ if (!Q || !Z) {
2216
+ hn.current = null, rn.current = null;
2217
+ return;
2218
+ }
2219
+ let e = rn.current;
2220
+ if (e !== null) {
2221
+ let t = en.current.get(e);
2222
+ t && (rn.current = null, un.current = null, t.focus());
2223
+ }
2224
+ let t = new Set(Q.entries.flatMap((e) => e.kind === "data" ? [e.dataIndex] : [])), n = hn.current, r = un.current;
2225
+ if (hn.current = t, r === null || !n?.has(r) || t.has(r)) return;
2226
+ let i = document.activeElement;
2227
+ if (!(i && (L.current?.contains(i) || i === document.body))) return;
2228
+ let a = [...Z.groupsById.values()].find((e) => e.leafSourceIndexes.includes(r))?.groupId;
2229
+ a !== void 0 && en.current.get(a)?.focus();
2230
+ }, [Q, Z]);
2231
+ let di = D(() => F || ui ? null : b(q, Xr), [
2232
+ Xr,
2233
+ ui,
2234
+ q,
2235
+ F
2236
+ ]), fi = D(() => Q ? Q.entries.flatMap((e) => e.kind === "data" ? [e.dataIndex] : []) : di ?? Xr, [
2237
+ Xr,
2238
+ Q,
2239
+ di
2240
+ ]), pi = fi.length, mi = Q?.entries.length ?? pi, hi = Math.max(1, q.pagination.pageSize), gi = Math.max(0, Math.ceil(pi / hi) - 1), _i = Math.min(Math.max(0, q.pagination.pageIndex), gi) * hi;
2241
+ E(() => {
2242
+ if (!Q && !K) return;
2243
+ let e = new Set(Q?.visibleLeafRowIds ?? fi.flatMap((e) => {
2244
+ let t = q.rowIds[e];
2245
+ return t === void 0 ? [] : [t];
2246
+ })), t = J.current, n = t.selection.cell !== null && !e.has(t.selection.cell.rowId), r = t.selection.range !== null && (!e.has(t.selection.range.anchor.rowId) || !e.has(t.selection.range.focus.rowId));
2247
+ !n && !r || (n && (Nt.current = null), Bt.current = null, Vt.current = null, Y({
2248
+ ...t,
2249
+ selection: {
2250
+ ...t.selection,
2251
+ cell: n ? null : t.selection.cell,
2252
+ range: r || n ? null : t.selection.range
2253
+ }
2254
+ }));
2255
+ }, [
2256
+ K,
2257
+ Q,
2258
+ fi,
2259
+ q.rowIds
2260
+ ]);
2261
+ let vi = D(() => {
2262
+ if (!Or) return /* @__PURE__ */ new Set();
2263
+ let e = /* @__PURE__ */ new Set(), t = I || ui ? 0 : _i, n = I || ui ? fi.length : Math.min(fi.length, _i + hi);
1572
2264
  for (let r = t; r < n; r += 1) {
1573
- let t = Tr[r];
2265
+ let t = fi[r];
1574
2266
  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({
2267
+ let n = q.rows[t], i = q.rowIds[t];
2268
+ if (n === void 0 || i === void 0 || !Ar.has(i)) continue;
2269
+ let a = { row: mn({
1578
2270
  dataIndex: t,
1579
2271
  row: n,
1580
2272
  rowId: i,
1581
2273
  visibleIndex: r
1582
2274
  }) };
1583
- Ke?.(a) !== !1 && e.add(i);
2275
+ nt?.(a) !== !1 && e.add(i);
1584
2276
  }
1585
2277
  return e;
1586
2278
  }, [
1587
- ar,
1588
- Ke,
1589
- Dr,
2279
+ Ar,
2280
+ ui,
2281
+ nt,
2282
+ hi,
2283
+ _i,
2284
+ fi,
1590
2285
  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)),
2286
+ q.rowIds,
2287
+ q.rows,
2288
+ I
2289
+ ]), yi = D(() => {
2290
+ let e = Math.max(1, M);
2291
+ return (Q?.entries ?? fi.map((e, t) => {
2292
+ let n = q.rowIds[e];
2293
+ return n === void 0 ? null : {
2294
+ dataIndex: e,
2295
+ key: Wt(n),
2296
+ kind: "data",
2297
+ rowId: n,
2298
+ visibleLeafIndex: t
2299
+ };
2300
+ }).filter((e) => e !== null)).flatMap((t) => {
2301
+ if (t.kind === "group") return [{
2302
+ groupId: t.groupId,
2303
+ height: e,
2304
+ key: t.key,
2305
+ kind: "group"
2306
+ }];
2307
+ let { dataIndex: n, rowId: r, visibleLeafIndex: i } = t, a = q.rows[n];
2308
+ if (a === void 0 || r === void 0) return [];
2309
+ let o = null;
2310
+ if (vi.has(r)) {
2311
+ let e = { row: mn({
2312
+ dataIndex: n,
2313
+ row: a,
2314
+ rowId: r,
2315
+ visibleIndex: i
2316
+ }) }, t = qt(y?.(e));
2317
+ o = t.mode === "auto" ? {
2318
+ ...Qt(mt.current, r, Gr, Kt(h, M)),
1611
2319
  mode: "auto"
1612
2320
  } : {
1613
2321
  estimated: !1,
1614
- height: o.height,
2322
+ height: t.height,
1615
2323
  mode: "fixed"
1616
2324
  };
1617
2325
  }
1618
- return [dt({
1619
- dataIndex: t,
1620
- detail: a,
1621
- row: r,
2326
+ return [Gt({
2327
+ dataIndex: n,
2328
+ detail: o,
2329
+ row: a,
1622
2330
  rowHeight: e,
1623
- rowId: i,
1624
- visibleIndex: n
2331
+ rowId: r,
2332
+ visibleIndex: i
1625
2333
  })];
1626
- }), n = mt.from(t.map((t) => ht(t, e))), r = /* @__PURE__ */ new Map();
2334
+ });
2335
+ }, [
2336
+ Gr,
2337
+ I ? 0 : Qn,
2338
+ vi,
2339
+ h,
2340
+ y,
2341
+ Q,
2342
+ fi,
2343
+ M,
2344
+ q.rowIds,
2345
+ q.rows
2346
+ ]), bi = D(() => {
2347
+ if (!I || vi.size === 0) return null;
2348
+ let e = Math.max(1, M), t = yi, n = Jt.from(t.map((t) => Yt(t, e))), r = /* @__PURE__ */ new Map();
1627
2349
  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);
2350
+ let n = t[e], i = n?.kind === "data" ? n.rowId : void 0;
2351
+ i !== void 0 && !r.has(i) && r.set(i, e);
1630
2352
  }
1631
2353
  return {
1632
2354
  heightIndex: n,
@@ -1635,39 +2357,34 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1635
2357
  slots: t
1636
2358
  };
1637
2359
  }, [
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
2360
+ vi,
2361
+ yi,
2362
+ M,
2363
+ I
2364
+ ]), xi = D(() => ({
2365
+ contentWidth: Gr,
2366
+ projection: bi,
2367
+ viewportHeight: zn || Math.max(1, M) * 12
1651
2368
  }), [
1652
- Dn,
1653
- br,
1654
- Ar,
1655
- F
2369
+ zn,
2370
+ Gr,
2371
+ bi,
2372
+ M
1656
2373
  ]);
1657
- Me(() => {
1658
- if (St.current = jr, V.current.size === 0) {
1659
- pr();
2374
+ Ne(() => {
2375
+ if (xt.current = xi, ht.current.size === 0) {
2376
+ Rr();
1660
2377
  return;
1661
2378
  }
1662
2379
  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));
2380
+ let e = _t.current, t = e ?? Lr();
2381
+ if (e) for (let e of ht.current.values()) bt.current.has(e.element) || (bt.current.add(e.element), t?.observe(e.element));
1665
2382
  return;
1666
2383
  }
1667
2384
  let e = [];
1668
- for (let t of V.current.values()) {
1669
- if (ut.current.has(t.element)) continue;
1670
- ut.current.add(t.element);
2385
+ for (let t of ht.current.values()) {
2386
+ if (gt.current.has(t.element)) continue;
2387
+ gt.current.add(t.element);
1671
2388
  let n = t.element.getBoundingClientRect();
1672
2389
  Number.isFinite(n.height) && n.height > 0 && e.push({
1673
2390
  height: n.height,
@@ -1675,142 +2392,119 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1675
2392
  width: Math.round(n.width)
1676
2393
  });
1677
2394
  }
1678
- dr(e);
2395
+ Ir(e);
1679
2396
  });
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,
2397
+ let Si = D(() => {
2398
+ if (I) {
2399
+ let e = Math.max(1, M), t = zn || M * 12;
2400
+ if (bi) {
2401
+ let e = cr && Math.abs(gr - cr.actualPhysical) <= .5 ? cr : null, n = Zt({
2402
+ heightIndex: bi.heightIndex,
2403
+ overscan: wr,
2404
+ physicalScrollTop: e?.requestedPhysical ?? gr,
1688
2405
  viewportHeight: t
1689
2406
  });
1690
2407
  return {
1691
2408
  mixed: !0,
1692
2409
  renderOffset: e ? e.actualPhysical - (e.targetLogical - n.logicalStartOffset) : n.renderOffset,
1693
2410
  scrollHeight: n.physicalScrollHeight,
1694
- slots: Ar.slots.slice(n.startIndex, n.endIndex)
2411
+ slots: bi.slots.slice(n.startIndex, n.endIndex)
1695
2412
  };
1696
2413
  }
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;
2414
+ let n = mi * 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, gr) * o), c = Math.max(0, Math.floor(s / e) - wr), l = Math.min(mi, Math.ceil((s + Math.max(0, t)) / e) + wr), u = c * e;
1698
2415
  return {
1699
2416
  mixed: !1,
1700
2417
  renderOffset: o > 0 ? u / o : u,
1701
2418
  scrollHeight: r,
1702
- slots: Tt(wr, J.rows, J.rowIds, c, l).map((t) => dt({
1703
- ...t,
1704
- detail: null,
1705
- rowHeight: e
1706
- }))
2419
+ slots: yi.slice(c, l)
1707
2420
  };
1708
2421
  }
1709
2422
  return {
1710
2423
  mixed: !1,
1711
2424
  renderOffset: 0,
1712
2425
  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
- })
2426
+ slots: ui ? yi : yi.slice(_i, _i + hi)
1732
2427
  };
1733
2428
  }, [
1734
- Dn,
1735
- br,
1736
- jn,
1737
- kr,
1738
- m,
1739
- v,
1740
- Vn,
1741
- Ar,
1742
- Or,
1743
- F,
1744
- qn,
1745
- Dr,
2429
+ zn,
2430
+ Qn,
2431
+ yi,
2432
+ ui,
2433
+ cr,
2434
+ bi,
2435
+ _i,
2436
+ M,
2437
+ gr,
2438
+ hi,
1746
2439
  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,
2440
+ I,
2441
+ mi
2442
+ ]), $ = D(() => I ? bi ? {
2443
+ heightIndex: bi.heightIndex,
2444
+ keys: bi.keys,
1755
2445
  mixed: !0
1756
2446
  } : {
2447
+ keys: yi.map((e) => e.key),
1757
2448
  mixed: !1,
1758
- projectedDataIndexes: Tr,
1759
- rowHeight: Math.max(1, F),
1760
- rowIds: J.rowIds,
1761
- visibleRowCount: Er
2449
+ rowHeight: Math.max(1, M),
2450
+ visibleRowCount: mi
1762
2451
  } : 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);
2452
+ bi,
2453
+ yi,
2454
+ M,
2455
+ I,
2456
+ mi
2457
+ ]), Ci = U.current, wi = H.current, Ti = !wi && $ && Ci && $ !== Ci && L.current ? cn({
2458
+ logicalScrollTop: cr && Math.abs(L.current.scrollTop - cr.actualPhysical) <= .5 ? cr.targetLogical : void 0,
2459
+ physicalScrollTop: L.current.scrollTop,
2460
+ projection: Ci,
2461
+ viewportHeight: L.current.clientHeight || zn || M * 12
2462
+ }) : void 0, Ei = wi?.status === "pending" ? wi : Ti;
2463
+ Ne(() => {
2464
+ if (!$) {
2465
+ U.current = null, H.current = null, xn.current = null, lr(null);
1778
2466
  return;
1779
2467
  }
1780
- if (Cn.current = Q, $?.status === "cancelled") {
1781
- let e = q.current;
1782
- e?.revision === $.revision && e.status === "cancelled" && (q.current = null);
2468
+ if (U.current = $, wi?.status === "cancelled") {
2469
+ let e = H.current;
2470
+ e?.revision === wi.revision && e.status === "cancelled" && (H.current = null);
1783
2471
  return;
1784
2472
  }
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,
2473
+ let e = L.current;
2474
+ if (!e || !Ei) return;
2475
+ let t = sn($), n = tn({
2476
+ anchor: Ei.anchor,
2477
+ getNextHeight: (e) => $.mixed ? $.heightIndex.getHeight(e) : $.rowHeight,
1790
2478
  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;
2479
+ previousKeys: Ei.previousKeys
2480
+ }), r = n ? ($.mixed ? $.heightIndex.getPrefixHeight(n.index) : n.index * $.rowHeight) + n.offsetWithinSlot : 0, i = nn(r, $.mixed ? $.heightIndex.getTotalHeight() : $.visibleRowCount * $.rowHeight, e.clientHeight || Ei.previousViewportHeight);
2481
+ if (wi) {
2482
+ let e = H.current;
2483
+ if (e?.revision !== wi.revision || e.status !== "pending") return;
1796
2484
  }
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;
2485
+ if (jn.current !== null && (window.cancelAnimationFrame(jn.current), jn.current = null), e.scrollTop = i, wi) {
2486
+ let e = H.current;
2487
+ if (e?.revision !== wi.revision || e.status !== "pending") return;
1800
2488
  }
1801
- let a = e.scrollTop, o = $?.revision ?? bn.current + 1, s = Q.mixed ? {
2489
+ let a = e.scrollTop, o = wi?.revision ?? vn.current + 1, s = $.mixed ? {
1802
2490
  actualPhysical: a,
1803
2491
  requestedPhysical: i,
1804
2492
  revision: o,
1805
2493
  targetLogical: r
1806
2494
  } : 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];
2495
+ vn.current = Math.max(vn.current, o), wi && (H.current = null), xn.current = s, Dn.current = a, lr(s), _r(a);
2496
+ }, [$, Ei]);
2497
+ let Di = lt ?? q.theme, Oi = Di.density === "compact" ? "text-[11px]" : Di.density === "spacious" ? "text-[13px]" : "text-[length:var(--comins-font-size-base,12px)]", ki = D(() => new Set(q.selection.rowIds), [q.selection.rowIds]), Ai = typeof Ur == "number" && Yn > 0 && Ur > Yn + 1, ji = G || K ? !1 : te, Mi = ye, Ni = G || K ? !1 : Ce, Pi = mi === 0, Fi = Mi && Pi, Ii = !Mi && Pi, Li = !G && !K && (re || T) && Ni && ji && !Pi, Ri = Math.max(1, Math.floor(st ?? Math.min(Math.max(1, q.pagination.pageSize), 5))), zi = (Fi ? Ri : +!!Ii) + +!!Li, Bi = Si.slots.reduce((e, t) => e + Yt(t, M), 0) + zi * M, Vi = I ? 0 : Math.max(0, zn - Bi), Hi = q.showHeader && (Ze || !Pi || Mi), Ui = (e, t) => (e.ctrlKey || e.metaKey) && e.key.toLowerCase() === t, Wi = (e) => {
2498
+ let t = Si.slots[e];
1811
2499
  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) => {
2500
+ }, Gi = (e, t, n) => {
2501
+ if (Q) {
2502
+ let e = Q.visibleLeafRowIds.indexOf(t), r = Q.visibleLeafRowIds.indexOf(n);
2503
+ if (e < 0 || r < 0) return [n];
2504
+ let i = Math.min(e, r), a = Math.max(e, r);
2505
+ return Q.visibleLeafRowIds.slice(i, a + 1);
2506
+ }
2507
+ let r = (F ? e.rows.map((e, t) => t) : b(e)).flatMap((t, n) => {
1814
2508
  let r = e.rows[t], i = e.rowIds[t];
1815
2509
  return r === void 0 || i === void 0 ? [] : [{
1816
2510
  dataIndex: t,
@@ -1822,37 +2516,44 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1822
2516
  if (i < 0 || a < 0) return [n];
1823
2517
  let o = Math.min(i, a), s = Math.max(i, a);
1824
2518
  return r.slice(o, s + 1).map((e) => e.rowId);
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);
1830
- return t ? [t.rowId] : [];
1831
- })));
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 = {
2519
+ }, Ki = (e, t) => {
2520
+ Y((n) => pe(n, Gi(n, e, t)));
2521
+ }, qi = (e) => {
2522
+ Y((t) => {
2523
+ let n = e.flatMap((e) => {
2524
+ if (Q) {
2525
+ let t = Q.visibleLeafRowIds[e];
2526
+ return t === void 0 ? [] : [t];
2527
+ }
2528
+ let t = Wi(e);
2529
+ return t ? [t.rowId] : [];
2530
+ });
2531
+ return pe(t, n);
2532
+ });
2533
+ }, Ji = () => {
2534
+ let e = W.current;
2535
+ e && (e.cleanup(), e.timer !== null && window.clearTimeout(e.timer), W.current = null);
2536
+ }, Yi = (e) => {
2537
+ W.current?.columnId !== e && (Ji(), W.current = {
1837
2538
  cleanup: () => void 0,
1838
2539
  columnId: e,
1839
2540
  timer: null
1840
2541
  });
1841
- }, ai = () => {
1842
- let e = En.current;
2542
+ }, Xi = () => {
2543
+ let e = W.current;
1843
2544
  e && (e.cleanup(), e.cleanup = () => void 0, e.timer = window.setTimeout(() => {
1844
- En.current === e && (En.current = null);
2545
+ W.current === e && (W.current = null);
1845
2546
  }, 0));
1846
- }, oi = () => {
1847
- let e = En.current;
2547
+ }, Zi = () => {
2548
+ let e = W.current;
1848
2549
  if (!e) return;
1849
- let t = () => ai(), n = () => ri(), r = () => ri();
2550
+ let t = () => Xi(), n = () => Ji(), r = () => Ji();
1850
2551
  e.cleanup(), e.cleanup = () => {
1851
2552
  window.removeEventListener("pointerup", t), window.removeEventListener("pointercancel", n), window.removeEventListener("blur", r);
1852
2553
  }, window.addEventListener("pointerup", t, { once: !0 }), window.addEventListener("pointercancel", n, { once: !0 }), window.addEventListener("blur", r, { once: !0 });
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) => {
2554
+ }, Qi = (e) => W.current?.columnId === e && (Ji(), !0), $i = (e, t) => {
2555
+ e.sort && Y((n) => xe(n, Un(n.sortModel, e.id, we && t)));
2556
+ }, ea = (e, t) => {
1856
2557
  let n = document.elementFromPoint(e, t)?.closest("[data-comins-column-id], [data-comins-column-group-id]");
1857
2558
  if (!n) return null;
1858
2559
  let r = Number(n.dataset.cominsColumnDepth);
@@ -1869,20 +2570,40 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1869
2570
  id: i,
1870
2571
  kind: "group"
1871
2572
  } : 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;
2573
+ }, ta = (e) => {
2574
+ let t = e.kind === "column" ? e.id : J.current.columnGroups.find((t) => t.id === e.id)?.children.find((e) => X.some((t) => t.id === e));
2575
+ return t ? X.findIndex((e) => e.id === t) : -1;
1875
2576
  };
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;
2577
+ Me(ut, () => ({
2578
+ clearSort: () => Y((e) => i(e)),
2579
+ expand: (e) => F?.onExpand(e),
2580
+ expandGroups: (e) => {
2581
+ let t = N?.onChangeExpandedGroupIds;
2582
+ if (!Z || typeof t != "function") return;
2583
+ let n = e === void 0 ? Z.groupIds : e.filter((e) => Z.groupsById.has(e));
2584
+ if (n.length === 0) return;
2585
+ let r = [...si], i = new Set(r);
2586
+ for (let e of n) i.has(e) || (i.add(e), r.push(e));
2587
+ r.length !== si.length && t(r);
2588
+ },
2589
+ fold: (e) => F?.onFold(e),
2590
+ foldGroups: (e) => {
2591
+ let t = N?.onChangeExpandedGroupIds;
2592
+ if (!Z || typeof t != "function") return;
2593
+ if (e === void 0) {
2594
+ si.length > 0 && t([]);
2595
+ return;
2596
+ }
2597
+ if (e.length === 0) return;
2598
+ let n = new Set(e.filter((e) => Z.groupsById.has(e))), r = si.filter((e) => !n.has(e));
2599
+ r.length !== si.length && t(r);
2600
+ },
2601
+ getColumnLayout: () => me(q),
2602
+ getSortModel: () => q.sortModel,
2603
+ getSortState: () => q.sort,
2604
+ setColumnLayout: (e) => Y((n) => t(n, e), { columnLayoutChanged: !0 }),
2605
+ setMoveTargetRow: (e, t) => Y((n) => {
2606
+ if (F || G || K) return n;
1886
2607
  let r = b(n).flatMap((e) => {
1887
2608
  let t = n.rowIds[e];
1888
2609
  return t === void 0 ? [] : [t];
@@ -1902,35 +2623,41 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1902
2623
  sortModel: []
1903
2624
  } : n;
1904
2625
  }),
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))
2626
+ setSelectedRow: (e) => qi([e]),
2627
+ setSelectedRows: (e) => qi(e),
2628
+ setSortModel: (e) => Y((t) => xe(t, e)),
2629
+ setSortState: (e) => Y((t) => Se(t, e))
1909
2630
  }), [
1910
- Mr.slots,
1911
- J,
1912
- L
2631
+ Q,
2632
+ G,
2633
+ K,
2634
+ si,
2635
+ Z,
2636
+ N,
2637
+ Si.slots,
2638
+ q,
2639
+ F
1913
2640
  ]);
1914
- let di = () => {
1915
- let e = W.current;
1916
- e && (e.cleanup(), e.timer !== null && window.clearTimeout(e.timer)), W.current = null, Pn(null), In(null), Rn(null), Bn(null);
2641
+ let na = () => {
2642
+ let e = Ct.current;
2643
+ e && (e.cleanup(), e.timer !== null && window.clearTimeout(e.timer)), Ct.current = null, tr(null), rr(null), ar(null), sr(null);
1917
2644
  };
1918
2645
  E(() => () => {
1919
- di(), ri(), Rt.current?.();
2646
+ na(), Ji(), Tt.current?.();
1920
2647
  }, []);
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;
2648
+ let ra = () => {
2649
+ if (Tt.current?.(), Tt.current = null, Ot.current = null, typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
1923
2650
  let e = [
1924
- B.current,
1925
2651
  z.current,
1926
- at.current
2652
+ L.current,
2653
+ R.current
1927
2654
  ].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
2655
  for (let n of e) t.set(n, n.getBoundingClientRect().left);
1929
- Wt.current = t;
2656
+ Ot.current = t;
1930
2657
  };
1931
- Me(() => {
1932
- let e = Wt.current;
1933
- if (Wt.current = null, !e) return;
2658
+ Ne(() => {
2659
+ let e = Ot.current;
2660
+ if (Ot.current = null, !e) return;
1934
2661
  let t = [];
1935
2662
  for (let [n, r] of e) {
1936
2663
  if (!n.isConnected) continue;
@@ -1942,27 +2669,27 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1942
2669
  let n = 0, r = 0, i = () => {
1943
2670
  window.cancelAnimationFrame(n), window.clearTimeout(r);
1944
2671
  for (let e of t) delete e.dataset.columnMoveAnimating, e.style.removeProperty("--comins-column-move-offset");
1945
- Rt.current === i && (Rt.current = null);
2672
+ Tt.current === i && (Tt.current = null);
1946
2673
  };
1947
- return Rt.current = i, n = window.requestAnimationFrame(() => {
2674
+ return Tt.current = i, n = window.requestAnimationFrame(() => {
1948
2675
  for (let e of t) e.dataset.columnMoveAnimating = "true", e.style.setProperty("--comins-column-move-offset", "0px");
1949
2676
  }), r = window.setTimeout(i, 220), i;
1950
- }, [J.columnOrder]);
1951
- let pi = (e) => {
2677
+ }, [q.columnOrder]);
2678
+ let ia = (e) => {
1952
2679
  if (e.event.button !== 0) return;
1953
2680
  let t = e.event.pointerType, n = t === "mouse" || t === "", r = () => {
1954
- e.sortColumnId && ii(e.sortColumnId);
2681
+ e.sortColumnId && Yi(e.sortColumnId);
1955
2682
  }, i = (t, n) => {
1956
- let i = W.current;
1957
- !i || i !== u || i.active || i.blocked || (i.active = !0, i.cancelSort = !0, r(), e.activate(t, n), Bn({
2683
+ let i = Ct.current;
2684
+ !i || i !== u || i.active || i.blocked || (i.active = !0, i.cancelSort = !0, r(), e.activate(t, n), sr({
1958
2685
  ...e.source,
1959
2686
  status: "neutral"
1960
2687
  }));
1961
2688
  }, a = (t) => {
1962
- let a = W.current;
2689
+ let a = Ct.current;
1963
2690
  if (!(!a || a !== u)) {
1964
2691
  if (!a.active && !a.blocked && n) {
1965
- let e = Re({
2692
+ let e = Ve({
1966
2693
  clientX: t.clientX,
1967
2694
  clientY: t.clientY,
1968
2695
  startX: a.startX,
@@ -1971,30 +2698,30 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
1971
2698
  e === "activate" ? i(t.clientX, t.clientY) : e === "cancel" && (a.blocked = !0, a.cancelSort = !0, r());
1972
2699
  }
1973
2700
  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({
2701
+ t.preventDefault(), ar({
1975
2702
  x: t.clientX,
1976
2703
  y: t.clientY
1977
2704
  });
1978
- let n = li(t.clientX, t.clientY);
1979
- Bn(n ? {
2705
+ let n = ea(t.clientX, t.clientY);
2706
+ sr(n ? {
1980
2707
  ...n,
1981
2708
  status: e.resolveTarget(n)
1982
2709
  } : null);
1983
2710
  }
1984
2711
  }
1985
2712
  }, o = (t) => {
1986
- let n = W.current;
2713
+ let n = Ct.current;
1987
2714
  if (n === u && n.active) {
1988
- let n = li(t.clientX, t.clientY);
2715
+ let n = ea(t.clientX, t.clientY);
1989
2716
  n && e.resolveTarget(n) === "valid" && e.commitTarget(n);
1990
2717
  }
1991
- n === u && n.cancelSort && ai(), di();
2718
+ n === u && n.cancelSort && Xi(), na();
1992
2719
  }, s = () => {
1993
- ri(), di();
2720
+ Ji(), na();
1994
2721
  }, c = (e) => {
1995
- e.key === "Escape" && (e.preventDefault(), W.current === u && u.cancelSort && oi(), di());
2722
+ e.key === "Escape" && (e.preventDefault(), Ct.current === u && u.cancelSort && Zi(), na());
1996
2723
  }, l = () => {
1997
- ri(), di();
2724
+ Ji(), na();
1998
2725
  }, u = {
1999
2726
  active: !1,
2000
2727
  blocked: !1,
@@ -2009,11 +2736,11 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
2009
2736
  startY: e.event.clientY,
2010
2737
  timer: null
2011
2738
  };
2012
- di(), ri(), n || (u.timer = window.setTimeout(() => {
2013
- let e = W.current;
2739
+ na(), Ji(), n || (u.timer = window.setTimeout(() => {
2740
+ let e = Ct.current;
2014
2741
  e === u && !e.active && !e.blocked && i(e.startX, e.startY);
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) => {
2742
+ }, 1e3)), Ct.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);
2743
+ }, aa = (e, t, n = !1) => {
2017
2744
  let r = t.column;
2018
2745
  if (r.lockPosition) return;
2019
2746
  let i = {
@@ -2022,178 +2749,256 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
2022
2749
  kind: "column",
2023
2750
  parentGroupId: t.groupId
2024
2751
  };
2025
- pi({
2752
+ ia({
2026
2753
  activateImmediately: n,
2027
2754
  activate: (e, t) => {
2028
- Rn({
2755
+ ar({
2029
2756
  x: e,
2030
2757
  y: t
2031
- }), In(null), Pn(r.id);
2758
+ }), rr(null), tr(r.id);
2032
2759
  },
2033
2760
  commitTarget: (e) => {
2034
- let t = ui(e);
2761
+ let t = ta(e);
2035
2762
  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 }));
2763
+ let e = J.current, n = ie(e, r.id, t);
2764
+ n !== e && n.columnOrder.some((t, n) => t !== e.columnOrder[n]) && (ra(), Y(n, { columnLayoutChanged: !0 }));
2038
2765
  }
2039
2766
  },
2040
2767
  event: e,
2041
2768
  id: r.id,
2042
2769
  kind: "column",
2043
2770
  resolveTarget: (e) => {
2044
- let t = ui(e);
2771
+ let t = ta(e);
2045
2772
  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]));
2773
+ let n = J.current, a = ie(n, r.id, t);
2774
+ return an(i, e, a.columnOrder.some((e, t) => e !== n.columnOrder[t]));
2048
2775
  },
2049
2776
  sortColumnId: r.id,
2050
2777
  source: i
2051
2778
  });
2052
- }, hi = (e, t, n = !1) => {
2779
+ }, oa = (e, t, n = !1) => {
2053
2780
  if (t.lockPosition) return;
2054
2781
  let r = {
2055
2782
  depth: 0,
2056
2783
  id: t.id,
2057
2784
  kind: "group"
2058
2785
  };
2059
- pi({
2786
+ ia({
2060
2787
  activateImmediately: n,
2061
2788
  activate: (e, n) => {
2062
- Rn({
2789
+ ar({
2063
2790
  x: e,
2064
2791
  y: n
2065
- }), Pn(null), In(t.id);
2792
+ }), tr(null), rr(t.id);
2066
2793
  },
2067
2794
  commitTarget: (e) => {
2068
- let n = ui(e);
2795
+ let n = ta(e);
2069
2796
  if (n >= 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 }));
2797
+ let e = J.current, r = C(e, t.id, n);
2798
+ r !== e && r.columnOrder.some((t, n) => t !== e.columnOrder[n]) && (ra(), Y(r, { columnLayoutChanged: !0 }));
2072
2799
  }
2073
2800
  },
2074
2801
  event: e,
2075
2802
  id: t.id,
2076
2803
  kind: "group",
2077
2804
  resolveTarget: (e) => {
2078
- let n = ui(e);
2805
+ let n = ta(e);
2079
2806
  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]));
2807
+ let i = J.current, a = C(i, t.id, n);
2808
+ return an(r, e, a.columnOrder.some((e, t) => e !== i.columnOrder[t]));
2082
2809
  },
2083
2810
  source: r
2084
2811
  });
2085
- }, gi = (e, t) => {
2086
- if (e.shiftKey && K.current !== null) {
2087
- ti(K.current, t.rowId), K.current = t.rowId;
2812
+ }, sa = (e, t) => {
2813
+ if (e.shiftKey && V.current !== null) {
2814
+ Ki(V.current, t.rowId), V.current = t.rowId;
2088
2815
  return;
2089
2816
  }
2090
- X((n) => de(n, t.rowId, {
2817
+ Y((n) => fe(n, t.rowId, {
2091
2818
  multi: e.ctrlKey || e.metaKey,
2092
2819
  toggle: e.ctrlKey || e.metaKey
2093
- })), K.current = t.rowId;
2094
- }, _i = (e, t, n) => {
2820
+ })), V.current = t.rowId;
2821
+ }, ca = (e, t, n) => {
2095
2822
  if (n) {
2096
2823
  e.preventDefault();
2097
2824
  return;
2098
2825
  }
2099
- if (Ve?.(Pt(e, t)), !(e.defaultPrevented || e.target !== e.currentTarget)) {
2100
- if (L && (Qr(e, "c") || Qr(e, "v"))) {
2826
+ if (Ke?.(gn(e, t)), !(e.defaultPrevented || e.target !== e.currentTarget)) {
2827
+ if (F && (Ui(e, "c") || Ui(e, "v"))) {
2101
2828
  e.preventDefault();
2102
2829
  return;
2103
2830
  }
2104
- if (Qr(e, "c")) {
2105
- e.preventDefault(), ct.current = s(J, t.rowId);
2831
+ if (Ui(e, "c")) {
2832
+ e.preventDefault(), pt.current = s(q, t.rowId);
2106
2833
  return;
2107
2834
  }
2108
- Qr(e, "v") && ct.current && (e.preventDefault(), X((e) => oe(e, ct.current, {
2835
+ Ui(e, "v") && pt.current && (e.preventDefault(), Y((e) => ce(e, pt.current, {
2109
2836
  mode: "insert-after",
2110
2837
  targetRowId: t.rowId
2111
2838
  })));
2112
2839
  }
2113
- }, vi = (e, t, n, r, i, s) => {
2840
+ }, la = (e, t, n, r, i, s) => {
2114
2841
  if (s) {
2115
2842
  e.preventDefault(), e.stopPropagation();
2116
2843
  return;
2117
2844
  }
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);
2845
+ if (Ge?.(_n(e, t, n, r, g(q, t.row, n.id))), !e.defaultPrevented) {
2846
+ if (Ui(e, "c")) {
2847
+ e.preventDefault(), e.stopPropagation(), ft.current = q.selection.range ? o(q, q.selection.range, Q?.visibleLeafRowIds ?? q.rowIds) : null, dt.current = ft.current ? null : a(q, i);
2121
2848
  return;
2122
2849
  }
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)));
2850
+ Ui(e, "v") && (ft.current || dt.current) && (e.preventDefault(), e.stopPropagation(), Y((e) => ft.current ? se(e, i, ft.current, Q?.visibleLeafRowIds ?? e.rowIds) : w(e, i, dt.current)));
2124
2851
  }
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;
2852
+ }, ua = (e, t, r) => {
2853
+ n && (r || e.button !== 0 || e.shiftKey || (Bt.current = t, Vt.current = t, Ht.current = !1));
2854
+ }, da = (e, t) => {
2855
+ 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) ? q.rowIds[i] : void 0;
2129
2856
  return r && a !== void 0 ? {
2130
2857
  columnId: r,
2131
2858
  rowId: a
2132
2859
  } : null;
2133
- }, xi = (e) => {
2860
+ }, fa = (e) => {
2134
2861
  if (!n) return;
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, {
2862
+ let t = Bt.current;
2863
+ !t || t.rowId === e.rowId && t.columnId === e.columnId || (Ht.current = !0, Vt.current = e, Nt.current = t, Y((n) => de(n, {
2137
2864
  anchor: t,
2138
2865
  focus: e
2139
2866
  })));
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;
2867
+ }, pa = () => {
2868
+ n && (Bt.current = null, Vt.current = null);
2869
+ }, ma = (e, t, n) => {
2870
+ if (ua(e, t, n), n || e.button !== 0 || e.shiftKey) return;
2144
2871
  let r = (e) => {
2145
2872
  if (e.buttons !== 1) return;
2146
- let t = bi(e.clientX, e.clientY);
2147
- t && xi(t);
2873
+ let t = da(e.clientX, e.clientY);
2874
+ t && fa(t);
2148
2875
  }, i = () => {
2149
- window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", a), window.removeEventListener("pointercancel", o), window.removeEventListener("blur", o), U.current === i && (U.current = null);
2876
+ window.removeEventListener("pointermove", r), window.removeEventListener("pointerup", a), window.removeEventListener("pointercancel", o), window.removeEventListener("blur", o), B.current === i && (B.current = null);
2150
2877
  }, a = () => {
2151
- i(), Si();
2878
+ i(), pa();
2152
2879
  }, o = () => {
2153
- i(), Si();
2880
+ i(), pa();
2154
2881
  };
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) => {
2882
+ e.preventDefault(), Nr(i), window.addEventListener("pointermove", r), window.addEventListener("pointerup", a), window.addEventListener("pointercancel", o), window.addEventListener("blur", o);
2883
+ }, ha = (e, t, n, r) => {
2157
2884
  if (n || !r || e.button !== 0) return;
2158
2885
  e.preventDefault(), e.stopPropagation();
2159
2886
  let i = t.rowId, a = (e) => {
2160
- yn.current = e, Kn(e);
2161
- }, o = (e, t) => {
2162
- let n = document.elementFromPoint(e, t)?.closest("[data-comins-row-data-index]");
2163
- if (!n || n.dataset.cominsRowDataIndex === void 0) return;
2164
- let r = Number(n.dataset.cominsRowDataIndex);
2165
- Number.isInteger(r) && a({
2166
- sourceRowId: i,
2167
- targetDataIndex: r
2168
- });
2887
+ Ut.current = e, pr(e);
2888
+ }, o = (e, n) => {
2889
+ let r = document.elementFromPoint(e, n)?.closest("[data-comins-row-data-index], [data-comins-group-index]");
2890
+ if (!r) return;
2891
+ if (r.dataset.cominsRowDataIndex !== void 0) {
2892
+ let e = Number(r.dataset.cominsRowDataIndex);
2893
+ if (!Number.isInteger(e)) return;
2894
+ let n = J.current.rows[e], o = ui && N && n !== void 0 ? N.getRowGroupId(n, e) : void 0, s = ui && N ? N.getRowGroupId(t.row, t.dataIndex) : void 0, c = o === void 0 || s === o || typeof N?.setRowGroupId == "function" && typeof ke == "function";
2895
+ a({
2896
+ sourceRowId: i,
2897
+ targetDataIndex: e,
2898
+ targetGroupId: o,
2899
+ valid: c
2900
+ });
2901
+ return;
2902
+ }
2903
+ let o = Number(r.dataset.cominsGroupIndex), s = Number.isInteger(o) ? Z?.groupIds[o] : void 0;
2904
+ if (s !== void 0 && ui && N) {
2905
+ let e = N.getRowGroupId(t.row, t.dataIndex) === s || typeof N.setRowGroupId == "function" && typeof ke == "function";
2906
+ a({
2907
+ sourceRowId: i,
2908
+ targetGroupId: s,
2909
+ valid: e
2910
+ });
2911
+ }
2169
2912
  }, s = (e) => {
2170
2913
  e.buttons === 1 && o(e.clientX, e.clientY);
2171
2914
  }, c = () => {
2172
- window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", u), window.removeEventListener("blur", u), U.current === c && (U.current = null);
2915
+ window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", u), window.removeEventListener("blur", u), B.current === c && (B.current = null);
2173
2916
  }, l = (e) => {
2174
2917
  c(), o(e.clientX, e.clientY);
2175
- let t = yn.current?.targetDataIndex;
2176
- a(null), t !== void 0 && X((e) => w(e, i, t));
2918
+ let n = Ut.current;
2919
+ if (a(null), n?.valid) {
2920
+ if (ui && N && n.targetGroupId !== void 0) {
2921
+ N.getRowGroupId(t.row, t.dataIndex) !== n.targetGroupId && !ci.has(n.targetGroupId) && (rn.current = n.targetGroupId), Y((e) => oe(e, {
2922
+ getRowGroupId: N.getRowGroupId,
2923
+ setRowGroupId: N.setRowGroupId,
2924
+ sourceRowId: i,
2925
+ targetGroupId: n.targetGroupId,
2926
+ targetRowId: n.targetDataIndex === void 0 ? void 0 : e.rowIds[n.targetDataIndex]
2927
+ }));
2928
+ return;
2929
+ }
2930
+ n.targetDataIndex !== void 0 && Y((e) => ae(e, i, n.targetDataIndex));
2931
+ }
2177
2932
  }, u = () => {
2178
2933
  c(), a(null);
2179
2934
  };
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) => {
2935
+ o(e.clientX, e.clientY), Nr(c), window.addEventListener("pointermove", s), window.addEventListener("pointerup", l), window.addEventListener("pointercancel", u), window.addEventListener("blur", u);
2936
+ }, ga = (e, t) => {
2937
+ let n = N?.onChangeGroups;
2938
+ if (e.button !== 0 || !N?.groupDraggable || typeof n != "function" || !Z?.groupsById.has(t)) return;
2939
+ e.preventDefault(), e.stopPropagation();
2940
+ let r = (e) => {
2941
+ Xt.current = e, hr(e);
2942
+ }, i = (e, n) => {
2943
+ let i = document.elementFromPoint(e, n)?.closest("[data-comins-group-index]"), a = Number(i?.dataset.cominsGroupIndex), o = Number.isInteger(a) ? Z.groupIds[a] : void 0;
2944
+ if (!i || o === void 0) return;
2945
+ let s = i.getBoundingClientRect(), c = n >= s.top + s.height / 2 ? "after" : "before";
2946
+ r({
2947
+ position: c,
2948
+ sourceGroupId: t,
2949
+ targetGroupId: o
2950
+ });
2951
+ }, a = (e) => {
2952
+ e.buttons === 1 && i(e.clientX, e.clientY);
2953
+ }, o = () => {
2954
+ window.removeEventListener("pointermove", a), window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", c), window.removeEventListener("blur", c), B.current === o && (B.current = null);
2955
+ }, s = (e) => {
2956
+ o(), i(e.clientX, e.clientY);
2957
+ let t = Xt.current;
2958
+ if (r(null), !t || t.sourceGroupId === t.targetGroupId) return;
2959
+ let a = N.groups, s = a.findIndex((e) => N.getGroupId(e) === t.sourceGroupId), c = jt({
2960
+ getGroupId: N.getGroupId,
2961
+ groups: a,
2962
+ position: t.position,
2963
+ sourceGroupId: t.sourceGroupId,
2964
+ targetGroupId: t.targetGroupId
2965
+ }), l = c.findIndex((e) => N.getGroupId(e) === t.sourceGroupId);
2966
+ s >= 0 && l >= 0 && a.some((e, t) => e !== c[t]) && n(c, {
2967
+ fromIndex: s,
2968
+ groupId: t.sourceGroupId,
2969
+ reason: "move",
2970
+ targetGroupId: t.targetGroupId,
2971
+ toIndex: l
2972
+ });
2973
+ }, c = () => {
2974
+ o(), r(null);
2975
+ };
2976
+ r({
2977
+ position: "before",
2978
+ sourceGroupId: t,
2979
+ targetGroupId: t
2980
+ }), Nr(o), window.addEventListener("pointermove", a), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", c), window.addEventListener("blur", c);
2981
+ }, _a = er ? X.find((e) => e.id === er) : void 0, va = nr ? q.columnGroups.find((e) => e.id === nr) : void 0, ya = _a ? Pn(_a.label, _a.id) : va ? Pn(va.label, va.id) : void 0, ba = (e, t) => {
2982
+ let n = l, r = n?.onChangeModel;
2983
+ if (!n || typeof r != "function") return;
2984
+ let i = Array.isArray(n.model) ? n.model : [], a = i.findIndex((t) => t?.columnId === e), o = i.filter((t) => t?.columnId !== e);
2985
+ t && o.splice(a < 0 ? o.length : a, 0, t), r(o);
2986
+ }, xa = (e, t) => {
2182
2987
  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);
2988
+ let t = or?.kind === "group" && or.id === e.groupId, n = nr === e.groupId, r = e.group.lockPosition === !0, i = Pn(e.group.label, e.groupId);
2184
2989
  return /* @__PURE__ */ j("th", {
2185
2990
  "aria-label": n ? i : void 0,
2186
2991
  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
2992
  colSpan: e.colSpan,
2188
2993
  "data-column-drop-target": t ? "true" : void 0,
2189
- "data-column-drop-valid": t && zn.status !== "neutral" ? zn.status === "valid" ? "true" : "false" : void 0,
2994
+ "data-column-drop-valid": t && or.status !== "neutral" ? or.status === "valid" ? "true" : "false" : void 0,
2190
2995
  "data-column-moving": n ? "true" : void 0,
2191
2996
  "data-column-placeholder": n ? "true" : void 0,
2192
2997
  "data-column-position-locked": r ? "true" : void 0,
2193
2998
  "data-comins-column-depth": "0",
2194
2999
  "data-comins-column-group-id": e.groupId,
2195
3000
  "data-testid": `header-group-${e.groupId}`,
2196
- onPointerDown: (t) => hi(t, e.group),
3001
+ onPointerDown: (t) => oa(t, e.group),
2197
3002
  rowSpan: e.rowSpan,
2198
3003
  scope: "colgroup",
2199
3004
  children: [
@@ -2202,13 +3007,13 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
2202
3007
  className: "comins-column-drop-marker"
2203
3008
  }),
2204
3009
  /* @__PURE__ */ j("span", {
2205
- ...n ? Zt : {},
3010
+ ...n ? Nn : {},
2206
3011
  "aria-hidden": n ? "true" : void 0,
2207
3012
  className: "comins-table__header-content",
2208
3013
  "data-comins-header-body": "true",
2209
3014
  inert: n ? !0 : void 0,
2210
- ref: Xt,
2211
- children: [Je && !r ? /* @__PURE__ */ A("span", {
3015
+ ref: Mn,
3016
+ children: [it && !r ? /* @__PURE__ */ A("span", {
2212
3017
  "aria-hidden": "true",
2213
3018
  className: "comins-column-move-handle",
2214
3019
  "data-comins-column-move-handle": "true",
@@ -2216,9 +3021,9 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
2216
3021
  draggable: !1,
2217
3022
  onClick: (e) => e.stopPropagation(),
2218
3023
  onPointerDown: (t) => {
2219
- t.preventDefault(), t.stopPropagation(), hi(t, e.group, !0);
3024
+ t.preventDefault(), t.stopPropagation(), oa(t, e.group, !0);
2220
3025
  },
2221
- children: /* @__PURE__ */ A(Qe, { name: "columnMove" })
3026
+ children: /* @__PURE__ */ A($e, { name: "columnMove" })
2222
3027
  }) : null, /* @__PURE__ */ A("span", {
2223
3028
  className: "comins-table__header-label",
2224
3029
  children: n ? null : e.group.label
@@ -2232,111 +3037,112 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
2232
3037
  /* @__PURE__ */ A("span", {
2233
3038
  "aria-hidden": "true",
2234
3039
  className: "comins-table__resize",
2235
- "data-resizing": Un === e.groupId ? "true" : void 0,
3040
+ "data-resizing": ur === e.groupId ? "true" : void 0,
2236
3041
  "data-testid": `resize-group-${e.groupId}`,
2237
3042
  onClick: (e) => e.stopPropagation(),
2238
3043
  onPointerDown: (t) => {
2239
3044
  t.preventDefault(), t.stopPropagation();
2240
3045
  let n = t.clientX, r = t.currentTarget.closest("th")?.getBoundingClientRect().width, i = /* @__PURE__ */ new Map();
2241
3046
  for (let t of e.group.children) {
2242
- let e = Z.find((e) => e.id === t);
3047
+ let e = X.find((e) => e.id === t);
2243
3048
  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;
3049
+ let n = Array.from(z.current?.querySelectorAll("[data-comins-column-id]") ?? []).find((t) => t.dataset.cominsColumnId === e.id)?.getBoundingClientRect().width, r = J.current.columnState[e.id]?.width ?? e.width ?? 160;
2245
3050
  i.set(e.id, n && Number.isFinite(n) ? n : r);
2246
3051
  }
2247
3052
  let a = [...i.values()].reduce((e, t) => e + t, 0), o = r && Number.isFinite(r) ? r : Math.max(1, a);
2248
- Wn(e.groupId);
3053
+ dr(e.groupId);
2249
3054
  let s = (t) => {
2250
- X((r) => {
3055
+ Y((r) => {
2251
3056
  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);
3057
+ for (let [e, t] of i) a = ve(a, e, t);
3058
+ return ge(a, e.groupId, o + t.clientX - n);
2254
3059
  }, { columnLayoutChanged: !0 });
2255
3060
  }, c = () => {
2256
- window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", u), window.removeEventListener("blur", u), U.current === c && (U.current = null);
3061
+ window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", u), window.removeEventListener("blur", u), B.current === c && (B.current = null);
2257
3062
  }, l = () => {
2258
- c(), Wn(null);
3063
+ c(), dr(null);
2259
3064
  }, u = () => {
2260
- c(), Wn(null);
3065
+ c(), dr(null);
2261
3066
  };
2262
- cr(c), window.addEventListener("pointermove", s), window.addEventListener("pointerup", l), window.addEventListener("pointercancel", u), window.addEventListener("blur", u);
3067
+ Nr(c), window.addEventListener("pointermove", s), window.addEventListener("pointerup", l), window.addEventListener("pointercancel", u), window.addEventListener("blur", u);
2263
3068
  },
2264
3069
  children: /* @__PURE__ */ A("span", { className: "comins-table__resize-line" })
2265
3070
  })
2266
3071
  ]
2267
3072
  }, `group-${e.groupId}`);
2268
3073
  }
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 = [
3074
+ let n = e.column, r = X.findIndex((e) => e.id === n.id), i = r >= 0 ? r : t, a = q.columnState[n.id], o = n.header?.props ?? {}, s = Wn(q.sortModel, n.id), c = Gn(q.sortModel, n.id), u = c === "asc" || c === "desc", d = s !== null && q.sortModel.length > 1, f = !!va?.children.includes(n.id), p = er === n.id || f, m = Pn(n.label, n.id), h = [
2270
3075
  "comins-table__th px-3 py-2 text-left font-semibold",
2271
- Nn === n.id ? "comins-column-moving" : void 0,
3076
+ er === n.id ? "comins-column-moving" : void 0,
2272
3077
  o.className
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", {
3078
+ ].filter(Boolean).join(" "), g = En(q, n, i), _ = n.header?.renderer, v = _ ? Mt.current.get(n.id) : void 0, y = !!_ && (!p || v?.renderer !== _), b = _ ? y ? _(g) : v?.body : null;
3079
+ _ && y ? Vr.set(n.id, {
3080
+ body: b,
3081
+ renderer: _
3082
+ }) : _ && v && Vr.set(n.id, v);
3083
+ let x = n.header?.renderer ? [] : kn(n.header?.components, g, "left"), ee = n.header?.renderer ? [] : kn(n.header?.components, g, "right"), te = x.length > 0 || ee.length > 0, ne = or?.kind === "column" && or.id === n.id, re = n.lockPosition === !0, S = n.filter?.kind, ie = K && (S === "boolean" || S === "date" || S === "number" || S === "text");
3084
+ return /* @__PURE__ */ Oe("th", {
2280
3085
  ...o,
2281
- "aria-label": f ? p : o["aria-label"],
2282
- "aria-labelledby": f ? void 0 : o["aria-labelledby"],
2283
- className: m,
3086
+ "aria-label": p ? m : o["aria-label"],
3087
+ "aria-labelledby": p ? void 0 : o["aria-labelledby"],
3088
+ className: h,
2284
3089
  colSpan: e.colSpan,
2285
3090
  "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,
2288
- "data-column-placeholder": f ? "true" : void 0,
3091
+ "data-column-drop-valid": ne && or.status !== "neutral" ? or.status === "valid" ? "true" : "false" : void 0,
3092
+ "data-column-moving": er === n.id ? "true" : void 0,
3093
+ "data-column-placeholder": p ? "true" : void 0,
2289
3094
  "data-column-position-locked": re ? "true" : void 0,
2290
3095
  "data-comins-column-depth": e.groupId ? "1" : "0",
2291
3096
  "data-comins-column-id": n.id,
2292
3097
  "data-comins-column-index": i,
2293
3098
  "data-comins-column-parent-group-id": e.groupId,
2294
- "data-sort-count": s ? J.sortModel.length : void 0,
3099
+ "data-sort-count": s ? q.sortModel.length : void 0,
2295
3100
  "data-sort-direction": s?.rule.direction,
2296
3101
  "data-sort-priority": s?.priority,
2297
3102
  "data-sortable": n.sort ? "true" : "false",
3103
+ "data-filter-active": Yr.has(n.id) ? "true" : void 0,
2298
3104
  "data-testid": `header-${n.id}`,
2299
- "aria-sort": n.sort ? fn(J.sortModel, n.id) : void 0,
3105
+ "aria-sort": n.sort ? Kn(q.sortModel, n.id) : void 0,
2300
3106
  key: `column-${n.id}`,
2301
3107
  onClick: (e) => {
2302
- if (f) {
3108
+ if (p) {
2303
3109
  e.preventDefault();
2304
3110
  return;
2305
3111
  }
2306
- o.onClick?.(e), !(e.defaultPrevented || !n.sort) && (si(n.id) || ci(n, e.shiftKey));
3112
+ o.onClick?.(e), !(e.defaultPrevented || !n.sort) && (Qi(n.id) || $i(n, e.shiftKey));
2307
3113
  },
2308
3114
  onKeyDown: (e) => {
2309
- if (f) {
3115
+ if (p) {
2310
3116
  e.preventDefault();
2311
3117
  return;
2312
3118
  }
2313
- o.onKeyDown?.(e), !(e.defaultPrevented || !n.sort) && (e.key === "Enter" || e.key === " " || e.key === "Spacebar") && (e.preventDefault(), ci(n, e.shiftKey));
3119
+ o.onKeyDown?.(e), !(e.defaultPrevented || !n.sort) && (e.key === "Enter" || e.key === " " || e.key === "Spacebar") && (e.preventDefault(), $i(n, e.shiftKey));
2314
3120
  },
2315
- onPointerDown: (t) => mi(t, e),
3121
+ onPointerDown: (t) => aa(t, e),
2316
3122
  rowSpan: e.rowSpan,
2317
3123
  scope: "col",
2318
3124
  style: {
2319
3125
  width: a?.width ?? n.width,
2320
3126
  ...o.style
2321
3127
  },
2322
- tabIndex: n.sort && !f ? 0 : void 0
3128
+ tabIndex: n.sort && !p ? 0 : void 0
2323
3129
  }, /* @__PURE__ */ A("span", {
2324
3130
  "aria-hidden": "true",
2325
3131
  className: "comins-column-drop-marker"
2326
3132
  }), /* @__PURE__ */ j("span", {
2327
- ...f ? Zt : {},
2328
- "aria-hidden": f ? "true" : void 0,
3133
+ ...p ? Nn : {},
3134
+ "aria-hidden": p ? "true" : void 0,
2329
3135
  className: "comins-table__header-content",
2330
3136
  "data-comins-header-body": "true",
2331
3137
  "data-comins-header-components": te ? "true" : void 0,
2332
- "data-comins-sort-indicator-visible": l ? "true" : void 0,
2333
- inert: f ? !0 : void 0,
2334
- ref: Xt,
3138
+ "data-comins-sort-indicator-visible": u ? "true" : void 0,
3139
+ inert: p ? !0 : void 0,
3140
+ ref: Mn,
2335
3141
  children: [
2336
3142
  /* @__PURE__ */ j("span", {
2337
3143
  className: "comins-table__header-slot",
2338
3144
  "data-comins-header-slot": "left",
2339
- children: [Je && !re ? /* @__PURE__ */ A("span", {
3145
+ children: [it && !re ? /* @__PURE__ */ A("span", {
2340
3146
  "aria-hidden": "true",
2341
3147
  className: "comins-column-move-handle",
2342
3148
  "data-comins-column-move-handle": "true",
@@ -2344,189 +3150,291 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
2344
3150
  draggable: !1,
2345
3151
  onClick: (e) => e.stopPropagation(),
2346
3152
  onPointerDown: (t) => {
2347
- t.preventDefault(), t.stopPropagation(), mi(t, e, !0);
3153
+ t.preventDefault(), t.stopPropagation(), aa(t, e, !0);
2348
3154
  },
2349
- children: /* @__PURE__ */ A(Qe, { name: "columnMove" })
2350
- }) : null, b]
3155
+ children: /* @__PURE__ */ A($e, { name: "columnMove" })
3156
+ }) : null, x]
2351
3157
  }),
2352
3158
  /* @__PURE__ */ A("span", {
2353
3159
  className: "comins-table__header-label",
2354
- children: n.header?.renderer ? y : f ? null : n.label
3160
+ children: n.header?.renderer ? b : p ? null : n.label
2355
3161
  }),
2356
3162
  /* @__PURE__ */ j("span", {
2357
3163
  className: "comins-sort-meta",
2358
- "data-sort-visible": l ? "true" : void 0,
3164
+ "data-sort-visible": u ? "true" : void 0,
2359
3165
  children: [/* @__PURE__ */ A("span", {
2360
3166
  "aria-hidden": "true",
2361
3167
  className: "comins-sort-indicator",
2362
3168
  "data-sort-state": c,
2363
- "data-sort-visible": l ? "true" : void 0,
3169
+ "data-sort-visible": u ? "true" : void 0,
2364
3170
  "data-testid": `sort-indicator-${n.id}`,
2365
- children: /* @__PURE__ */ A(Qe, { name: c === "asc" ? "sortAscending" : c === "desc" ? "sortDescending" : "sortUnsorted" })
2366
- }), u ? /* @__PURE__ */ A("span", {
3171
+ children: /* @__PURE__ */ A($e, { name: c === "asc" ? "sortAscending" : c === "desc" ? "sortDescending" : "sortUnsorted" })
3172
+ }), d ? /* @__PURE__ */ A("span", {
2367
3173
  "aria-hidden": "true",
2368
3174
  className: "comins-sort-priority",
2369
3175
  "data-testid": `sort-priority-${n.id}`,
2370
3176
  children: s.priority
2371
3177
  }) : null]
2372
3178
  }),
2373
- u ? /* @__PURE__ */ A("span", {
3179
+ d ? /* @__PURE__ */ A("span", {
2374
3180
  className: "comins-table__sort-status",
2375
- children: `Sorted ${s.rule.direction === "asc" ? "ascending" : "descending"}, priority ${s.priority} of ${J.sortModel.length}`
3181
+ children: `Sorted ${s.rule.direction === "asc" ? "ascending" : "descending"}, priority ${s.priority} of ${q.sortModel.length}`
2376
3182
  }) : null,
2377
- /* @__PURE__ */ A("span", {
3183
+ /* @__PURE__ */ j("span", {
2378
3184
  className: "comins-table__header-slot",
2379
3185
  "data-comins-header-slot": "right",
2380
- children: ee
3186
+ children: [ie && !p ? /* @__PURE__ */ A(ot, {
3187
+ columnId: n.id,
3188
+ columnLabel: m,
3189
+ kind: S,
3190
+ onChangeRule: typeof l?.onChangeModel == "function" ? (e) => ba(n.id, e) : void 0,
3191
+ onOpenChange: typeof l?.onChangeOpenColumnId == "function" ? l.onChangeOpenColumnId : void 0,
3192
+ open: l?.openColumnId === n.id,
3193
+ rule: Yr.get(n.id)
3194
+ }) : null, ee]
2381
3195
  })
2382
3196
  ]
2383
- }), f ? /* @__PURE__ */ A("span", {
3197
+ }), p ? /* @__PURE__ */ A("span", {
2384
3198
  "aria-hidden": "true",
2385
3199
  className: "comins-column-placeholder-label",
2386
- children: p
3200
+ children: m
2387
3201
  }) : null, /* @__PURE__ */ A("span", {
2388
3202
  "aria-hidden": "true",
2389
3203
  className: "comins-table__resize",
2390
- "data-resizing": Un === n.id ? "true" : void 0,
3204
+ "data-resizing": ur === n.id ? "true" : void 0,
2391
3205
  "data-testid": `resize-${n.id}`,
2392
3206
  onClick: (e) => e.stopPropagation(),
2393
3207
  onPointerDown: (e) => {
2394
3208
  e.preventDefault(), e.stopPropagation();
2395
3209
  let t = e.clientX, r = e.currentTarget.closest("th")?.getBoundingClientRect().width, i = /* @__PURE__ */ new Map();
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;
3210
+ for (let e of X) {
3211
+ let t = Array.from(z.current?.querySelectorAll("[data-comins-column-id]") ?? []).find((t) => t.dataset.cominsColumnId === e.id)?.getBoundingClientRect().width, n = J.current.columnState[e.id]?.width ?? e.width ?? 160;
2398
3212
  i.set(e.id, t && Number.isFinite(t) ? t : n);
2399
3213
  }
2400
3214
  let o = i.get(n.id) ?? (r && Number.isFinite(r) ? r : a?.width ?? n.width ?? 160);
2401
- Wn(n.id);
3215
+ dr(n.id);
2402
3216
  let s = (e) => {
2403
- X((r) => {
3217
+ Y((r) => {
2404
3218
  let a = r;
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));
3219
+ for (let [e, t] of i) a = ve(a, e, t);
3220
+ return Bn(a, n.id, Math.max(In(n), o + e.clientX - t));
2407
3221
  }, { columnLayoutChanged: !0 });
2408
3222
  }, c = () => {
2409
- window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", u), window.removeEventListener("blur", u), U.current === c && (U.current = null);
3223
+ window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", l), window.removeEventListener("pointercancel", u), window.removeEventListener("blur", u), B.current === c && (B.current = null);
2410
3224
  }, l = () => {
2411
- c(), Wn(null);
3225
+ c(), dr(null);
2412
3226
  }, u = () => {
2413
- c(), Wn(null);
3227
+ c(), dr(null);
2414
3228
  };
2415
- cr(c), window.addEventListener("pointermove", s), window.addEventListener("pointerup", l), window.addEventListener("pointercancel", u), window.addEventListener("blur", u);
3229
+ Nr(c), window.addEventListener("pointermove", s), window.addEventListener("pointerup", l), window.addEventListener("pointercancel", u), window.addEventListener("blur", u);
2416
3230
  },
2417
3231
  children: /* @__PURE__ */ A("span", { className: "comins-table__resize-line" })
2418
3232
  }));
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;
3233
+ }, Sa = () => /* @__PURE__ */ A("colgroup", { children: X.map((e, t) => /* @__PURE__ */ A("col", { style: { width: Hr[t] } }, e.id)) }), Ca = () => {
3234
+ _r((e) => {
3235
+ let t = Dn.current;
2422
3236
  return Math.abs(e - t) > .5 ? t : e;
2423
3237
  });
2424
- }, ji = (e) => {
2425
- if (x) {
2426
- if (!He || Yt.current) return;
2427
- e.scrollHeight - e.scrollTop - e.clientHeight <= tr && lr("scroll");
3238
+ }, wa = (e) => {
3239
+ if (G || K) return;
3240
+ if (T) {
3241
+ if (!qe || It.current) return;
3242
+ e.scrollHeight - e.scrollTop - e.clientHeight <= Er && Pr("scroll");
2428
3243
  return;
2429
3244
  }
2430
- if (!ne || !ee || ye || !Ue) return;
2431
- let t = Math.max(0, ie);
3245
+ if (!re || !te || Ce || !Je) return;
3246
+ let t = Math.max(0, S);
2432
3247
  if (e.scrollHeight - e.scrollTop - e.clientHeight > t) return;
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 = {
3248
+ let n = J.current.rows.length;
3249
+ zt.current !== n && (zt.current = n, Je());
3250
+ }, Ta = (e) => {
3251
+ let t = e.currentTarget, n = xn.current, r = H.current;
3252
+ Dn.current = t.scrollTop, r?.status === "pending" && Math.abs(t.scrollTop - r.previousPhysicalScrollTop) > .5 && (H.current = {
2438
3253
  ...r,
2439
3254
  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();
3255
+ }), n && Math.abs(t.scrollTop - n.actualPhysical) > .5 && (xn.current = null, lr(null)), wa(t), An.current !== null && (window.clearTimeout(An.current), An.current = null), jn.current === null && (jn.current = window.requestAnimationFrame(() => {
3256
+ jn.current = null, Ca();
2442
3257
  }));
2443
3258
  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;
3259
+ if (z.current) {
3260
+ let e = Math.max(0, z.current.scrollWidth - z.current.clientWidth), n = Math.max(0, t.scrollWidth - t.clientWidth);
3261
+ i = Math.min(Math.min(e, n), i), Math.abs(t.scrollLeft - i) > .5 && (t.scrollLeft = i), z.current.scrollLeft = i;
2447
3262
  }
2448
- at.current && (at.current.scrollLeft = i);
3263
+ R.current && (R.current.scrollLeft = i);
2449
3264
  };
2450
3265
  return /* @__PURE__ */ j("div", {
2451
3266
  className: [
2452
3267
  "comins-table comins-typography-base h-full w-full overflow-hidden",
2453
- Lr,
2454
- Ir.className,
3268
+ Oi,
3269
+ Di.className,
2455
3270
  r
2456
3271
  ].filter(Boolean).join(" "),
2457
- "aria-busy": Vr || Hr ? "true" : void 0,
2458
- "data-loading": Vr || Hr ? "true" : void 0,
2459
- "data-show-header": Zr ? "true" : void 0,
3272
+ "aria-busy": Mi || Ni ? "true" : void 0,
3273
+ "data-filter-active": Jr ? "true" : void 0,
3274
+ "data-loading": Mi || Ni ? "true" : void 0,
3275
+ "data-show-header": Hi ? "true" : void 0,
2460
3276
  style: {
2461
- ...Ir.style,
2462
- ...Ze
3277
+ ...Di.style,
3278
+ ...ct
2463
3279
  },
2464
3280
  children: [
2465
- Zr ? /* @__PURE__ */ A("div", {
3281
+ Hi ? /* @__PURE__ */ A("div", {
2466
3282
  className: "comins-table__header",
2467
- ref: B,
3283
+ ref: z,
2468
3284
  children: /* @__PURE__ */ j("table", {
2469
3285
  className: "comins-table__table comins-table__header-table min-w-full table-fixed",
2470
- style: { width: yr },
2471
- children: [ki(), /* @__PURE__ */ A("thead", {
3286
+ style: { width: Wr },
3287
+ children: [Sa(), /* @__PURE__ */ A("thead", {
2472
3288
  className: "comins-table__thead",
2473
- children: xr.map((e, t) => /* @__PURE__ */ A("tr", { children: e.map((e, t) => Oi(e, t)) }, `header-row-${t}`))
3289
+ children: Kr.map((e, t) => /* @__PURE__ */ A("tr", { children: e.map((e, t) => xa(e, t)) }, `header-row-${t}`))
2474
3290
  })]
2475
3291
  })
2476
3292
  }) : null,
2477
3293
  /* @__PURE__ */ j("div", {
2478
3294
  className: "comins-table__body-viewport",
2479
- "data-horizontal-overflow": zr ? "true" : void 0,
2480
- "data-virtualized": R ? "true" : void 0,
2481
- "data-testid": f,
2482
- onScroll: Mi,
2483
- ref: z,
3295
+ "data-horizontal-overflow": Ai ? "true" : void 0,
3296
+ "data-virtualized": I ? "true" : void 0,
3297
+ "data-testid": p,
3298
+ onFocusCapture: (e) => {
3299
+ let t = e.target.closest("[data-comins-row-data-index]"), n = t ? Number(t.dataset.cominsRowDataIndex) : NaN;
3300
+ un.current = Number.isInteger(n) ? n : null;
3301
+ },
3302
+ onScroll: Ta,
3303
+ ref: L,
2484
3304
  children: [
2485
3305
  /* @__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", {
3306
+ className: ["comins-table__table comins-table__body-table min-w-full table-fixed", I ? "comins-table__body-table--virtualized" : void 0].filter(Boolean).join(" "),
3307
+ style: I ? {
3308
+ transform: `translate3d(0, ${Si.renderOffset}px, 0)`,
3309
+ width: Wr
3310
+ } : { width: Wr },
3311
+ children: [Sa(), /* @__PURE__ */ j("tbody", { children: [
3312
+ Fi ? Array.from({ length: Ri }).map((e, t) => /* @__PURE__ */ A("tr", {
2493
3313
  "aria-hidden": "true",
2494
3314
  className: "comins-table__tr comins-table__skeleton-row",
2495
3315
  "data-comins-row-parity": t % 2 == 0 ? "even" : "odd",
2496
3316
  "data-testid": "loading-skeleton-row",
2497
- style: { height: F },
2498
- children: Z.length > 0 ? Z.map((e) => /* @__PURE__ */ A("td", {
3317
+ style: { height: M },
3318
+ children: X.length > 0 ? X.map((e) => /* @__PURE__ */ A("td", {
2499
3319
  className: "comins-table__td comins-table__skeleton-cell px-3 py-2",
2500
3320
  "data-testid": `loading-skeleton-cell-${t}-${e.id}`,
2501
- style: { height: F },
3321
+ style: { height: M },
2502
3322
  children: /* @__PURE__ */ A("span", { className: "comins-table__skeleton-block" })
2503
3323
  }, e.id)) : /* @__PURE__ */ A("td", {
2504
3324
  className: "comins-table__td comins-table__skeleton-cell px-3 py-2",
2505
3325
  children: /* @__PURE__ */ A("span", { className: "comins-table__skeleton-block" })
2506
3326
  })
2507
3327
  }, `loading-skeleton-${t}`)) : null,
2508
- Gr ? /* @__PURE__ */ A("tr", {
3328
+ Ii ? /* @__PURE__ */ A("tr", {
2509
3329
  className: "comins-table__tr comins-table__empty-state-row",
2510
- style: { height: F },
3330
+ style: { height: M },
2511
3331
  children: /* @__PURE__ */ A("td", {
2512
3332
  className: "comins-table__td comins-table__empty-state-cell",
2513
- colSpan: Math.max(1, Z.length),
3333
+ colSpan: Math.max(1, X.length),
2514
3334
  children: /* @__PURE__ */ A("div", {
2515
3335
  "data-testid": "data-table-empty-state",
2516
3336
  className: "comins-table__empty-state",
2517
- children: p ?? "표시할 데이터가 없습니다."
3337
+ children: m ?? "표시할 데이터가 없습니다."
2518
3338
  })
2519
3339
  })
2520
3340
  }) : null,
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", {
3341
+ Si.slots.map((e, t) => {
3342
+ if (e.kind === "group") {
3343
+ let n = Z?.groupsById.get(e.groupId);
3344
+ if (!n) return null;
3345
+ let r = ci.has(e.groupId), i = t === Si.slots.length - 1, a = yi.at(-1)?.key === e.key, o = Si.scrollHeight >= zn - 1, s = i && (I ? a && o : Vi === 0), c = Object.fromEntries([...n.aggregationState].map(([e, t]) => [e, wt(t)])), l = {
3346
+ aggregateValues: c,
3347
+ expanded: r,
3348
+ group: n.group,
3349
+ groupId: n.groupId,
3350
+ groupIndex: n.groupIndex,
3351
+ isEmpty: n.leafSourceIndexes.length === 0,
3352
+ rowCount: n.leafSourceIndexes.length
3353
+ }, u = N?.getGroupRowProps?.(l), d = N?.renderGroupContent?.(l), f = Object.entries(c).flatMap(([e, t]) => {
3354
+ if (t === null) return [];
3355
+ let n = q.columns.find((t) => t.id === e);
3356
+ return [/* @__PURE__ */ j("span", {
3357
+ className: "comins-row-group-aggregate",
3358
+ children: [
3359
+ String(n?.label ?? e),
3360
+ ": ",
3361
+ String(t)
3362
+ ]
3363
+ }, e)];
3364
+ }), p = N?.groupDraggable === !0 && typeof N.onChangeGroups == "function", m = mr?.targetGroupId === e.groupId && mr.sourceGroupId !== e.groupId ? mr.position : void 0, h = fr?.targetGroupId === e.groupId;
3365
+ return /* @__PURE__ */ A("tr", {
3366
+ className: [
3367
+ "comins-table__tr comins-table__group-row",
3368
+ u?.className,
3369
+ s ? "comins-table__tr--viewport-end" : void 0
3370
+ ].filter(Boolean).join(" "),
3371
+ "data-comins-group-id": String(e.groupId),
3372
+ "data-comins-group-index": n.groupIndex,
3373
+ "data-comins-group-row": "true",
3374
+ "data-comins-group-drag-source": mr?.sourceGroupId === e.groupId ? "true" : void 0,
3375
+ "data-comins-group-drop-position": m,
3376
+ "data-comins-row-drop-valid": h ? fr.valid ? "true" : "false" : void 0,
3377
+ "data-testid": `group-row-${encodeURIComponent(String(e.groupId))}`,
3378
+ style: {
3379
+ ...u?.style,
3380
+ height: M
3381
+ },
3382
+ children: /* @__PURE__ */ A("th", {
3383
+ className: "comins-table__td comins-table__group-cell px-3 py-2",
3384
+ colSpan: Math.max(1, X.length),
3385
+ scope: "rowgroup",
3386
+ style: { height: M },
3387
+ children: /* @__PURE__ */ j("span", {
3388
+ className: "comins-row-group-cell-content",
3389
+ children: [
3390
+ p ? /* @__PURE__ */ A(et, {
3391
+ "aria-label": `Move ${String(n.label)} group`,
3392
+ className: "comins-row-group-drag-handle",
3393
+ "data-testid": `group-drag-handle-${encodeURIComponent(String(e.groupId))}`,
3394
+ icon: "columnMove",
3395
+ onPointerDown: (t) => ga(t, e.groupId)
3396
+ }) : null,
3397
+ /* @__PURE__ */ A(et, {
3398
+ "aria-expanded": r,
3399
+ "aria-label": `${r ? "Collapse" : "Expand"} ${String(n.label)} group`,
3400
+ className: "comins-row-group-expander",
3401
+ "data-testid": `group-toggle-${encodeURIComponent(String(e.groupId))}`,
3402
+ disabled: typeof N?.onChangeExpandedGroupIds != "function",
3403
+ icon: r ? "disclosureExpanded" : "disclosureCollapsed",
3404
+ onClick: (t) => {
3405
+ t.preventDefault(), t.stopPropagation(), li(e.groupId);
3406
+ },
3407
+ ref: (t) => {
3408
+ t ? en.current.set(e.groupId, t) : en.current.delete(e.groupId);
3409
+ }
3410
+ }),
3411
+ /* @__PURE__ */ A("span", {
3412
+ className: "comins-row-group-content",
3413
+ children: typeof N?.renderGroupContent == "function" ? d : /* @__PURE__ */ j(Be, { children: [
3414
+ /* @__PURE__ */ A("span", {
3415
+ className: "comins-row-group-label",
3416
+ children: n.label
3417
+ }),
3418
+ /* @__PURE__ */ j("span", {
3419
+ className: "comins-row-group-count",
3420
+ children: [n.leafSourceIndexes.length, " Rows"]
3421
+ }),
3422
+ f
3423
+ ] })
3424
+ })
3425
+ ]
3426
+ })
3427
+ })
3428
+ }, e.key);
3429
+ }
3430
+ let r = e, i = dn(xr, r.row, r.visibleIndex), a = ki.has(r.rowId), o = t === Si.slots.length - 1, s = yi.at(-1)?.key === r.key, c = Si.scrollHeight >= zn - 1, l = o && (I ? s && c : Vi === 0), u = fn(i.style), d = I && Si.mixed ? r.key : I ? `virtual-row-slot-${t}` : String(r.rowId), f = { row: mn(r) }, p = Or && (nt?.(f) ?? !0), m = p && vi.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(vr)}-${v}`, b = `${y}-content`, x = `${y}-toggle`;
3431
+ return /* @__PURE__ */ j(De, { children: [
3432
+ fr?.targetDataIndex === r.dataIndex && fr.sourceRowId !== r.rowId ? /* @__PURE__ */ A("tr", {
2526
3433
  "aria-hidden": "true",
2527
3434
  className: "comins-row-move-placeholder",
3435
+ "data-comins-row-drop-valid": fr.valid ? "true" : "false",
2528
3436
  children: /* @__PURE__ */ A("td", {
2529
- colSpan: Math.max(1, Z.length),
3437
+ colSpan: Math.max(1, X.length),
2530
3438
  "data-testid": "row-move-placeholder",
2531
3439
  children: "이 위치로 이동"
2532
3440
  })
@@ -2553,58 +3461,58 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
2553
3461
  e.preventDefault();
2554
3462
  return;
2555
3463
  }
2556
- e.__cominsCellSelectionHandled || gi(e, r), Fe?.(Pt(e, r));
3464
+ e.__cominsCellSelectionHandled || sa(e, r), Le?.(gn(e, r));
2557
3465
  },
2558
3466
  onContextMenu: (e) => {
2559
3467
  if (i.disabled) {
2560
3468
  e.preventDefault();
2561
3469
  return;
2562
3470
  }
2563
- X((e) => wt(e, r.rowId)), K.current = r.rowId, Le?.(Pt(e, r));
3471
+ Y((e) => on(e, r.rowId)), V.current = r.rowId, ze?.(gn(e, r));
2564
3472
  },
2565
3473
  onDoubleClick: (e) => {
2566
3474
  if (i.disabled) {
2567
3475
  e.preventDefault();
2568
3476
  return;
2569
3477
  }
2570
- ze?.(Pt(e, r));
3478
+ We?.(gn(e, r));
2571
3479
  },
2572
- onKeyDown: (e) => _i(e, r, i.disabled),
2573
- style: Mt(F, i.style, u),
3480
+ onKeyDown: (e) => ca(e, r, i.disabled),
3481
+ style: pn(M, i.style, u),
2574
3482
  tabIndex: i.disabled ? -1 : 0,
2575
- children: Z.map((e, t) => {
2576
- let o = g(J, r.row, e.id), s = {
3483
+ children: X.map((e, t) => {
3484
+ let o = g(q, r.row, e.id), s = {
2577
3485
  columnId: e.id,
2578
3486
  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) => {
3487
+ }, c = n && ne(q, s, Q?.visibleLeafRowIds ?? q.rowIds), l = n && q.selection.cell?.rowId === r.rowId && q.selection.cell.columnId === e.id, u = yn(r, i.disabled, a, q.selection.rowIds.length, e, t, o), d = bn(e, u), f = i.disabled || Sn(d, u), h = { requestRowSelection: ({ event: e, mode: t }) => f ? !1 : t === "exclusive" ? (Y((e) => fe(e, r.rowId)), V.current = r.rowId, !0) : (sa(e, r), !0) }, _ = ln(Cn(d, u)), v = wn(d, u), y = !!e.cell?.components?.length, ee = Tn(e, o, u), te = e.cell?.components?.map((e) => {
2580
3488
  if (e.type !== "input") return e;
2581
3489
  let t = e.onValueChange;
2582
3490
  return {
2583
3491
  ...e,
2584
3492
  onValueChange: (e) => {
2585
- X((t) => we(t, [{
3493
+ Y((t) => Te(t, [{
2586
3494
  id: e.row.id,
2587
- patch: (t) => sn(t, e.column.field, e.value)
3495
+ patch: (t) => Vn(t, e.column.field, e.value)
2588
3496
  }])), t?.(e);
2589
3497
  }
2590
3498
  };
2591
- }), ie = Kt(ne, u), x = e.cell?.renderer ? e.cell.renderer(u) : y ? $t(te, ne, u, {
3499
+ }), re = On(te, u), S = e.cell?.renderer ? e.cell.renderer(u) : y ? Fn(ee, te, u, {
2592
3500
  interaction: h,
2593
3501
  showContent: !1
2594
3502
  }) : /* @__PURE__ */ A("span", {
2595
3503
  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", {
3504
+ children: ee
3505
+ }), ie = typeof e.cell?.tooltip == "function" ? e.cell.tooltip(u) : e.cell?.tooltip, C = e.id === F?.treeColumnId ? F.entriesByRowId.get(r.rowId) : void 0, ae = C ? /* @__PURE__ */ j("span", {
2598
3506
  className: "comins-tree-cell-content",
2599
3507
  style: { "--comins-tree-depth": C.depth },
2600
- children: [C.hasChildren ? /* @__PURE__ */ A($e, {
3508
+ children: [C.hasChildren ? /* @__PURE__ */ A(et, {
2601
3509
  "aria-expanded": C.expanded,
2602
3510
  "aria-label": `${C.expanded ? "Collapse" : "Expand"} ${String(r.rowId)}`,
2603
3511
  className: "comins-tree-expander",
2604
3512
  "data-testid": `tree-expander-${String(r.rowId)}`,
2605
3513
  icon: C.expanded ? "disclosureExpanded" : "disclosureCollapsed",
2606
3514
  onClick: (e) => {
2607
- e.preventDefault(), e.stopPropagation(), L?.onToggle(r.rowId);
3515
+ e.preventDefault(), e.stopPropagation(), F?.onToggle(r.rowId);
2608
3516
  },
2609
3517
  onMouseDown: (e) => e.stopPropagation(),
2610
3518
  onPointerDown: (e) => e.stopPropagation()
@@ -2613,9 +3521,9 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
2613
3521
  className: "comins-tree-expander-spacer"
2614
3522
  }), /* @__PURE__ */ A("span", {
2615
3523
  className: "comins-tree-cell-value",
2616
- children: x
3524
+ children: S
2617
3525
  })]
2618
- }) : x;
3526
+ }) : S;
2619
3527
  return /* @__PURE__ */ A("td", {
2620
3528
  "aria-disabled": f ? "true" : void 0,
2621
3529
  className: [
@@ -2625,36 +3533,39 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
2625
3533
  ].filter(Boolean).join(" "),
2626
3534
  "data-disabled": f ? "true" : void 0,
2627
3535
  "data-comins-cell-column-id": e.id,
2628
- "data-comins-component-cell": ie.length > 0 ? "true" : void 0,
3536
+ "data-comins-component-cell": re.length > 0 ? "true" : void 0,
2629
3537
  "data-comins-data-index": r.dataIndex,
2630
3538
  "data-range-selected": c ? "true" : void 0,
2631
3539
  "data-selected": l ? "true" : void 0,
2632
3540
  "data-testid": `cell-${String(r.rowId)}-${e.id}`,
2633
3541
  draggable: !1,
2634
3542
  onClick: (i) => {
2635
- if (Pe && i.stopPropagation(), f) {
3543
+ if (Ie && i.stopPropagation(), f) {
2636
3544
  i.preventDefault(), i.stopPropagation();
2637
3545
  return;
2638
3546
  }
2639
- if (vn.current) {
2640
- vn.current = !1, i.__cominsCellSelectionHandled = !0;
3547
+ if (Ht.current) {
3548
+ Ht.current = !1, i.__cominsCellSelectionHandled = !0;
2641
3549
  return;
2642
3550
  }
2643
- let a = n ? J.selection.cell ?? G.current : null;
3551
+ let a = n ? q.selection.cell ?? Nt.current : null;
2644
3552
  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;
3553
+ i.__cominsCellSelectionHandled = !0, Nt.current = a, Y((e) => {
3554
+ let t = V.current === null ? fe(e, r.rowId) : pe(e, Gi(e, V.current, r.rowId));
3555
+ return de(t, {
3556
+ anchor: a,
3557
+ focus: s
3558
+ });
3559
+ }), V.current = r.rowId;
2649
3560
  return;
2650
3561
  }
2651
- n && (G.current = s), X((e) => {
2652
- let t = de(e, r.rowId, {
3562
+ n && (Nt.current = s), Y((e) => {
3563
+ let t = fe(e, r.rowId, {
2653
3564
  multi: i.ctrlKey || i.metaKey,
2654
3565
  toggle: i.ctrlKey || i.metaKey
2655
3566
  });
2656
- return n ? le(t, s) : t;
2657
- }), i.__cominsCellSelectionHandled = !0, K.current = r.rowId, Pe?.(Ft(i, r, e, t, o));
3567
+ return n ? ue(t, s) : t;
3568
+ }), i.__cominsCellSelectionHandled = !0, V.current = r.rowId, Ie?.(_n(i, r, e, t, o));
2658
3569
  },
2659
3570
  onContextMenu: (i) => {
2660
3571
  if (i.target.closest(".comins-row-detail-expander")) {
@@ -2665,56 +3576,56 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
2665
3576
  i.preventDefault(), i.stopPropagation();
2666
3577
  return;
2667
3578
  }
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)));
3579
+ Y((e) => {
3580
+ let t = on(e, r.rowId);
3581
+ return n ? ue(t, s) : t;
3582
+ }), V.current = r.rowId, n && (Nt.current = s), Re && (i.stopPropagation(), Re(_n(i, r, e, t, o)));
2672
3583
  },
2673
3584
  onDoubleClick: (n) => {
2674
3585
  if (n.target.closest(".comins-row-detail-expander")) {
2675
3586
  n.stopPropagation();
2676
3587
  return;
2677
3588
  }
2678
- if (N && n.stopPropagation(), f) {
3589
+ if (Ue && n.stopPropagation(), f) {
2679
3590
  n.preventDefault(), n.stopPropagation();
2680
3591
  return;
2681
3592
  }
2682
- N?.(Ft(n, r, e, t, o));
3593
+ Ue?.(_n(n, r, e, t, o));
2683
3594
  },
2684
- onKeyDown: (n) => vi(n, r, e, t, s, f),
2685
- onMouseDown: (e) => yi(e, s, f),
3595
+ onKeyDown: (n) => la(n, r, e, t, s, f),
3596
+ onMouseDown: (e) => ua(e, s, f),
2686
3597
  onMouseOver: (e) => {
2687
- e.buttons === 1 && !U.current && xi(s);
3598
+ e.buttons === 1 && !B.current && fa(s);
2688
3599
  },
2689
- onMouseUp: Si,
2690
- onPointerDown: (e) => Ci(e, s, f),
3600
+ onMouseUp: pa,
3601
+ onPointerDown: (e) => ma(e, s, f),
2691
3602
  onPointerEnter: (e) => {
2692
- e.buttons === 1 && xi(s);
3603
+ e.buttons === 1 && fa(s);
2693
3604
  },
2694
3605
  onPointerMove: (e) => {
2695
- e.buttons === 1 && xi(s);
3606
+ e.buttons === 1 && fa(s);
2696
3607
  },
2697
- onPointerUp: Si,
3608
+ onPointerUp: pa,
2698
3609
  style: {
2699
- height: F,
3610
+ height: M,
2700
3611
  ...v
2701
3612
  },
2702
- title: typeof S == "string" ? S : void 0,
3613
+ title: typeof ie == "string" ? ie : void 0,
2703
3614
  tabIndex: f ? -1 : 0,
2704
- children: t === 0 && (rr || i.draggable) ? /* @__PURE__ */ j("div", {
3615
+ children: t === 0 && (Or || i.draggable) ? /* @__PURE__ */ j("div", {
2705
3616
  className: "comins-row-cell-content",
2706
3617
  children: [/* @__PURE__ */ j("span", {
2707
3618
  className: "comins-row-leading-controls",
2708
- children: [rr ? p ? /* @__PURE__ */ A(et, {
3619
+ children: [Or ? p ? /* @__PURE__ */ A(vt, {
2709
3620
  controlsId: b,
2710
- disabled: !M,
3621
+ disabled: !He,
2711
3622
  expanded: m,
2712
- id: ee,
3623
+ id: x,
2713
3624
  label: `${m ? "Collapse" : "Expand"} ${String(r.rowId)} details`,
2714
3625
  onElement: (e) => {
2715
- e ? kt.current.set(r.rowId, e) : kt.current.delete(r.rowId);
3626
+ e ? St.current.set(r.rowId, e) : St.current.delete(r.rowId);
2716
3627
  },
2717
- onToggle: () => or(r.rowId, p),
3628
+ onToggle: () => jr(r.rowId, p),
2718
3629
  testId: `row-detail-toggle-${String(r.rowId)}`
2719
3630
  }) : /* @__PURE__ */ A("span", {
2720
3631
  "aria-hidden": "true",
@@ -2728,35 +3639,35 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
2728
3639
  draggable: !1,
2729
3640
  onClick: (e) => e.stopPropagation(),
2730
3641
  onMouseDown: (e) => e.stopPropagation(),
2731
- onPointerDown: (e) => wi(e, r, i.disabled, i.draggable)
3642
+ onPointerDown: (e) => ha(e, r, i.disabled, i.draggable)
2732
3643
  }) : null]
2733
3644
  }), /* @__PURE__ */ A("div", {
2734
3645
  className: "comins-row-cell-content__value",
2735
- children: w
3646
+ children: ae
2736
3647
  })]
2737
- }) : w
3648
+ }) : ae
2738
3649
  }, e.id);
2739
3650
  })
2740
3651
  }, d),
2741
- m ? /* @__PURE__ */ A(tt, {
2742
- colSpan: Z.length,
3652
+ m ? /* @__PURE__ */ A(yt, {
3653
+ colSpan: X.length,
2743
3654
  contentId: b,
2744
3655
  fixedHeight: h,
2745
- labelId: ee,
2746
- onContentElement: (e) => mr(r.rowId, _, e),
3656
+ labelId: x,
3657
+ onContentElement: (e) => zr(r.rowId, _, e),
2747
3658
  ownerId: String(r.rowId),
2748
3659
  testId: `row-detail-content-${String(r.rowId)}`,
2749
- getToggleElement: () => kt.current.get(r.rowId) ?? null,
2750
- children: qe?.(f)
3660
+ getToggleElement: () => St.current.get(r.rowId) ?? null,
3661
+ children: rt?.(f)
2751
3662
  }) : null
2752
3663
  ] }, d);
2753
3664
  }),
2754
- Kr ? /* @__PURE__ */ A("tr", {
3665
+ Li ? /* @__PURE__ */ A("tr", {
2755
3666
  className: "comins-table__tr comins-table__infinite-loading-row",
2756
- style: { height: F },
3667
+ style: { height: M },
2757
3668
  children: /* @__PURE__ */ j("td", {
2758
3669
  className: "comins-table__td comins-table__infinite-loading-cell",
2759
- colSpan: Math.max(1, Z.length),
3670
+ colSpan: Math.max(1, X.length),
2760
3671
  "data-testid": "data-table-infinite-loading-row",
2761
3672
  children: [/* @__PURE__ */ A("span", {
2762
3673
  className: "comins-table__loading-spinner",
@@ -2764,48 +3675,48 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
2764
3675
  }), /* @__PURE__ */ A("span", { children: "데이터를 불러오는 중입니다." })]
2765
3676
  })
2766
3677
  }) : null,
2767
- Xr > 0 ? /* @__PURE__ */ A("tr", {
3678
+ Vi > 0 ? /* @__PURE__ */ A("tr", {
2768
3679
  "aria-hidden": "true",
2769
3680
  className: "comins-table-empty-filler",
2770
3681
  children: /* @__PURE__ */ A("td", {
2771
- colSpan: Math.max(1, Z.length),
3682
+ colSpan: Math.max(1, X.length),
2772
3683
  "data-testid": "table-empty-filler",
2773
- style: { height: Xr }
3684
+ style: { height: Vi }
2774
3685
  })
2775
3686
  }) : null
2776
3687
  ] })]
2777
3688
  }),
2778
- R ? /* @__PURE__ */ A("div", {
3689
+ I ? /* @__PURE__ */ A("div", {
2779
3690
  "aria-hidden": "true",
2780
3691
  className: "comins-table__body-virtual-sizer",
2781
3692
  style: {
2782
- height: Mr.scrollHeight,
2783
- width: yr
3693
+ height: Si.scrollHeight,
3694
+ width: Wr
2784
3695
  }
2785
3696
  }) : null,
2786
- Vr && !Ur ? /* @__PURE__ */ j("div", {
3697
+ Mi && !Pi ? /* @__PURE__ */ j("div", {
2787
3698
  className: "comins-table__loading-overlay",
2788
3699
  "data-testid": "data-table-loading-overlay",
2789
3700
  role: "status",
2790
- style: qn > 0 ? { transform: `translateY(${qn}px)` } : void 0,
3701
+ style: gr > 0 ? { transform: `translateY(${gr}px)` } : void 0,
2791
3702
  children: [/* @__PURE__ */ A("span", {
2792
3703
  className: "comins-table__loading-spinner",
2793
3704
  "data-testid": "data-table-loading-spinner"
2794
- }), /* @__PURE__ */ A("span", { children: ve ?? "불러오는 중입니다." })]
3705
+ }), /* @__PURE__ */ A("span", { children: be ?? "불러오는 중입니다." })]
2795
3706
  }) : null
2796
3707
  ]
2797
3708
  }),
2798
- I ? /* @__PURE__ */ A("div", {
3709
+ P ? /* @__PURE__ */ A("div", {
2799
3710
  "aria-label": "Table summary",
2800
3711
  className: "comins-table__summary",
2801
- ref: at,
3712
+ ref: R,
2802
3713
  children: /* @__PURE__ */ j("table", {
2803
3714
  className: "comins-table__table comins-table__summary-table min-w-full table-fixed",
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", {
3715
+ style: { width: Wr },
3716
+ children: [Sa(), /* @__PURE__ */ A("tfoot", { children: /* @__PURE__ */ A("tr", {
3717
+ className: ["comins-table__summary-row", P.className].filter(Boolean).join(" "),
3718
+ style: P.style,
3719
+ children: $r.map((e) => /* @__PURE__ */ A("td", {
2809
3720
  className: ["comins-table__summary-cell px-3 py-2", e.className].filter(Boolean).join(" "),
2810
3721
  colSpan: e.colSpan,
2811
3722
  "data-comins-summary-column-id": e.column.id,
@@ -2816,66 +3727,65 @@ function bn({ "buffer-size": e, cellSelection: n = !0, className: r, columnGroup
2816
3727
  }) })]
2817
3728
  })
2818
3729
  }) : null,
2819
- Di && Ln ? /* @__PURE__ */ j("div", {
3730
+ ya && ir ? /* @__PURE__ */ j("div", {
2820
3731
  "aria-hidden": "true",
2821
3732
  className: "comins-column-move-ghost",
2822
3733
  "data-testid": "column-move-ghost",
2823
3734
  style: {
2824
- left: Ln.x + 12,
2825
- top: Ln.y + 12
3735
+ left: ir.x + 12,
3736
+ top: ir.y + 12
2826
3737
  },
2827
- children: [/* @__PURE__ */ A(Qe, { name: "columnMove" }), /* @__PURE__ */ A("span", {
3738
+ children: [/* @__PURE__ */ A($e, { name: "columnMove" }), /* @__PURE__ */ A("span", {
2828
3739
  className: "comins-column-move-ghost__label",
2829
- children: Di
3740
+ children: ya
2830
3741
  })]
2831
3742
  }) : null
2832
3743
  ]
2833
3744
  });
2834
3745
  }
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 ? {
3746
+ function nr({ data: e, columnFiltering: t, defaultExpandAll: n = !0, estimatedRowDetailHeight: r, expandedRowIds: i, getRowDetailHeight: a, getRowId: o, hasMoreRows: s, infiniteScroll: c, infiniteScrollThreshold: l, lazyLoad: u, lazyLoadBatchSize: d, lazyLoadMode: f, lazyLoadThreshold: p, loadingMore: m, onChangeData: h, onChangeExpandedRowIds: g, onChangeSort: _, onChangeSortModel: v, onLazyLoad: y, onLoadMore: b, rowGrouping: x, rowProps: ee, isRowExpandable: te, renderRowDetail: ne, tree: re, ...S }, ie) {
3747
+ let C = O(n).current, [ae, oe] = k([]), w = D(() => S.columns.map((e, t) => t === 0 ? {
2837
3748
  ...e,
2838
3749
  lockPosition: !0
2839
- } : e), [re.columns]), ae = w[0]?.id ?? w[0]?.field ?? null, T = D(() => vn(e, w, S), [
3750
+ } : e), [S.columns]), se = w[0]?.id ?? w[0]?.field ?? null, ce = D(() => $n(e, w, ae), [
2840
3751
  e,
2841
3752
  w,
2842
- S
2843
- ]), oe = D(() => B(T, a, { defaultExpandAll: x }), [
2844
- a,
2845
- x,
2846
- T
2847
- ]), se = D(() => new Map(oe.map((e) => [e.rowId, e])), [oe]), ce = D(() => ({
2848
- entriesByRowId: se,
3753
+ ae
3754
+ ]), T = D(() => zt(ce, o, { defaultExpandAll: C }), [
3755
+ o,
3756
+ C,
3757
+ ce
3758
+ ]), le = D(() => new Map(T.map((e) => [e.rowId, e])), [T]), ue = D(() => ({
3759
+ entriesByRowId: le,
2849
3760
  onExpand: (t) => {
2850
- let n = yn(e, t, !0, a, x);
2851
- n !== e && m?.([...n]);
3761
+ let n = er(e, t, !0, o, C);
3762
+ n !== e && h?.([...n]);
2852
3763
  },
2853
3764
  onFold: (t) => {
2854
- let n = yn(e, t, !1, a, x);
2855
- n !== e && m?.([...n]);
3765
+ let n = er(e, t, !1, o, C);
3766
+ n !== e && h?.([...n]);
2856
3767
  },
2857
- onToggle: (t) => m?.(st(e, t, a, { defaultExpandAll: x })),
2858
- summaryRows: ot(e),
2859
- treeColumnId: ae
3768
+ onToggle: (t) => h?.(Bt(e, t, o, { defaultExpandAll: C })),
3769
+ summaryRows: V(e),
3770
+ treeColumnId: se
2860
3771
  }), [
2861
3772
  e,
2862
- se,
2863
- a,
2864
- x,
2865
- m,
2866
- ae
2867
- ]), le = (t) => {
3773
+ le,
3774
+ o,
3775
+ C,
3776
+ h,
3777
+ se
3778
+ ]), de = (t) => {
2868
3779
  let n = e;
2869
3780
  t.forEach((e, t) => {
2870
- let r = oe[t];
2871
- r && r.item !== e && (n = ct(n, r.rowId, a, () => e));
2872
- }), n !== e && m?.([...n]);
2873
- };
2874
- return /* @__PURE__ */ A(q, {
2875
- ...re,
3781
+ let r = T[t];
3782
+ r && r.item !== e && (n = Vt(n, r.rowId, o, () => e));
3783
+ }), n !== e && h?.([...n]);
3784
+ }, fe = {
3785
+ ...S,
2876
3786
  columns: w,
2877
- data: oe.map((e) => e.item),
2878
- getRowId: a,
3787
+ data: T.map((e) => e.item),
3788
+ getRowId: o,
2879
3789
  hasMoreRows: !1,
2880
3790
  infiniteScroll: !1,
2881
3791
  infiniteScrollThreshold: void 0,
@@ -2884,38 +3794,41 @@ function xn({ data: e, defaultExpandAll: t = !0, estimatedRowDetailHeight: n, ex
2884
3794
  lazyLoadMode: void 0,
2885
3795
  lazyLoadThreshold: void 0,
2886
3796
  loadingMore: !1,
2887
- onChangeData: le,
2888
- onChangeSort: g,
3797
+ onChangeData: de,
3798
+ onChangeSort: _,
2889
3799
  onChangeSortModel: (e) => {
2890
- C(e), _?.(e);
3800
+ oe(e), v?.(e);
2891
3801
  },
2892
3802
  onLazyLoad: void 0,
2893
3803
  onLoadMore: void 0,
2894
3804
  pagination: {
2895
3805
  pageIndex: 0,
2896
- pageSize: Math.max(1, oe.length)
3806
+ pageSize: Math.max(1, T.length)
2897
3807
  },
2898
3808
  rowProps: {
2899
- ...b,
3809
+ ...ee,
2900
3810
  draggable: !1
2901
3811
  },
2902
- tree: !1,
3812
+ tree: !1
3813
+ };
3814
+ return /* @__PURE__ */ A(rr, {
3815
+ ...fe,
2903
3816
  ref: ie,
2904
- treeContext: ce
3817
+ treeContext: ue
2905
3818
  });
2906
3819
  }
2907
- var q = Oe(bn), Sn = Oe(xn);
2908
- function Cn(e, t) {
2909
- return e.tree ? /* @__PURE__ */ A(Sn, {
3820
+ var rr = ke(tr), ir = ke(nr);
3821
+ function ar(e, t) {
3822
+ return e.tree ? /* @__PURE__ */ A(ir, {
2910
3823
  ...e,
2911
3824
  ref: t
2912
- }) : /* @__PURE__ */ A(q, {
3825
+ }) : /* @__PURE__ */ A(rr, {
2913
3826
  ...e,
2914
3827
  ref: t
2915
3828
  });
2916
3829
  }
2917
- var wn = Oe(Cn), Tn = "comins-table";
3830
+ var or = ke(ar), sr = "comins-table";
2918
3831
  //#endregion
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 };
3832
+ export { or as CominsTable, e as addCominsRows, t as applyCominsColumnLayout, n as clearCominsCellRange, r as clearCominsSelection, i as clearCominsSortState, sr 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, zt 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, Ft as getCominsSummaryValues, V as getCominsTreeLeafItems, x as getCominsVirtualRows, ee as getCominsVisibleColumns, te as isCominsCellDisabled, ne as isCominsCellInSelectedRange, re as isCominsCellSelected, S as isCominsRowSelected, ie as moveCominsColumn, C as moveCominsColumnGroup, ae as moveCominsRow, jt as moveCominsRowGroup, oe as moveCominsRowToGroup, w as pasteCominsCell, se as pasteCominsCellRange, ce as pasteCominsRow, T as queryCominsRows, le as replaceCominsRows, ue as selectCell, de as selectCellRange, fe as selectRow, pe as selectRows, me as serializeCominsColumnLayout, he as setCominsColumnGroupHidden, ge as setCominsColumnGroupWidth, _e as setCominsColumnHidden, ve as setCominsColumnWidth, ye as setCominsHeaderVisible, be as setCominsPagination, xe as setCominsSortModel, Se as setCominsSortState, Ce as setCominsTableTheme, we as sortCominsRows, Ht as sortCominsTreeSiblings, Bt as toggleCominsTreeNode, Te as updateCominsRows, Vt as updateCominsTreeItem };
2920
3833
 
2921
3834
  //# sourceMappingURL=index.js.map