@cronocode/react-box 3.1.8 → 3.1.10

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.
@@ -1,5 +1,5 @@
1
- import { jsxs as d, jsx as n, Fragment as Be } from "react/jsx-runtime";
2
- import Ee, { useCallback as k, useMemo as X, useState as M, useRef as O, useEffect as z, useLayoutEffect as Pe } from "react";
1
+ import { jsxs as p, jsx as n, Fragment as Ee } from "react/jsx-runtime";
2
+ import Be, { useCallback as k, useMemo as X, useState as M, useRef as O, useEffect as z, useLayoutEffect as Pe } from "react";
3
3
  import g from "../box.mjs";
4
4
  import m from "./flex.mjs";
5
5
  import me from "./grid.mjs";
@@ -11,22 +11,22 @@ import b from "./dropdown.mjs";
11
11
  import j from "./textbox.mjs";
12
12
  import { Span as I } from "./semantics.mjs";
13
13
  import Ae from "./tooltip.mjs";
14
- function Oe(s) {
15
- const { grid: e } = s, { filtered: t, total: i } = e.filterStats, r = e.hasActiveFilters;
16
- return /* @__PURE__ */ d(m, { component: "datagrid.bottomBar", children: [
17
- /* @__PURE__ */ d(g, { children: [
14
+ function Oe(l) {
15
+ const { grid: e } = l, { filtered: t, total: i } = e.filterStats, r = e.hasActiveFilters;
16
+ return /* @__PURE__ */ p(m, { component: "datagrid.bottomBar", children: [
17
+ /* @__PURE__ */ p(g, { children: [
18
18
  "Rows: ",
19
- r ? `${t} / ${i}` : i
19
+ t !== i ? `${t} / ${i}` : i
20
20
  ] }),
21
- e.props.def.rowSelection && /* @__PURE__ */ d(g, { children: [
21
+ e.props.def.rowSelection && /* @__PURE__ */ p(g, { children: [
22
22
  "Selected: ",
23
23
  e.selectedRows.size
24
24
  ] }),
25
25
  r && /* @__PURE__ */ n(g, { color: "blue-600", cursor: "pointer", hover: { textDecoration: "underline" }, props: { onClick: e.clearAllFilters }, children: "Clear filters" })
26
26
  ] });
27
27
  }
28
- function Ce(s) {
29
- const { cell: e } = s, t = k(() => {
28
+ function Ce(l) {
29
+ const { cell: e } = l, t = k(() => {
30
30
  e.grid.toggleRowSelection(e.row.key);
31
31
  }, [e.grid, e.row.key]);
32
32
  return /* @__PURE__ */ n(le, { variant: "datagrid", checked: e.row.selected, onChange: t });
@@ -176,16 +176,16 @@ class A {
176
176
  return this.isLeaf ? this.grid.columns.value.maxDeath - this.death : 1;
177
177
  }
178
178
  resizeColumn = (e) => {
179
- const t = e.pageX, { MIN_COLUMN_WIDTH_PX: i, update: r } = this.grid, o = this.leafs.toRecord((c) => [c.key, c.inlineWidth ?? c.baseWidth]), a = this.leafs.sumBy((c) => o[c.key]) - this.leafs.length * i, h = Ie.throttle((c) => {
180
- const p = (c.pageX - t) * (this.pin === "RIGHT" ? -1 : 1);
179
+ const t = e.pageX, { MIN_COLUMN_WIDTH_PX: i, update: r } = this.grid, o = this.leafs.toRecord((c) => [c.key, c.inlineWidth ?? c.baseWidth]), a = this.leafs.sumBy((c) => o[c.key]) - this.leafs.length * i, u = Ie.throttle((c) => {
180
+ const d = (c.pageX - t) * (this.pin === "RIGHT" ? -1 : 1);
181
181
  this.leafs.forEach((f) => {
182
- const y = o[f.key], v = a > 0 ? (y - i) / a * p : p / this.leafs.length, R = Math.round(y + v);
182
+ const y = o[f.key], v = a > 0 ? (y - i) / a * d : d / this.leafs.length, R = Math.round(y + v);
183
183
  f.setWidth(R < i ? i : R);
184
184
  }), this.grid.flexWidths.clear(), this.grid.sizes.clear(), r();
185
- }, 40), u = new AbortController(), l = (c) => {
186
- u.abort(), r();
185
+ }, 40), h = new AbortController(), s = (c) => {
186
+ h.abort(), r();
187
187
  };
188
- window.addEventListener("mousemove", h, u), window.addEventListener("mouseup", l, u);
188
+ window.addEventListener("mousemove", u, h), window.addEventListener("mouseup", s, h);
189
189
  };
190
190
  pinColumn = (e) => {
191
191
  this.isLeaf ? this._pin = e : this.columns.forEach((t) => t.pinColumn(e)), this.grid.pinColumn(this.uniqueKey, e);
@@ -254,9 +254,9 @@ class je {
254
254
  });
255
255
  columns = P(() => {
256
256
  console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid columns memo");
257
- const e = this.sourceColumns.value.map((l) => l.getPinnedColumn("LEFT")).filter((l) => !!l), t = this.sourceColumns.value.map((l) => l.getPinnedColumn()).filter((l) => !!l), i = this.sourceColumns.value.map((l) => l.getPinnedColumn("RIGHT")).filter((l) => !!l), r = [...e, ...t, ...i].flatMap((l) => l.flatColumns), o = r.filter((l) => l.isLeaf), a = r.filter((l) => l.isLeaf && l.isVisible), h = a.filter(
258
- (l) => ![V, G, _, T].includes(l.key)
259
- ), u = r.maxBy((l) => l.death) + 1;
257
+ const e = this.sourceColumns.value.map((s) => s.getPinnedColumn("LEFT")).filter((s) => !!s), t = this.sourceColumns.value.map((s) => s.getPinnedColumn()).filter((s) => !!s), i = this.sourceColumns.value.map((s) => s.getPinnedColumn("RIGHT")).filter((s) => !!s), r = [...e, ...t, ...i].flatMap((s) => s.flatColumns), o = r.filter((s) => s.isLeaf), a = r.filter((s) => s.isLeaf && s.isVisible), u = a.filter(
258
+ (s) => ![V, G, _, T].includes(s.key)
259
+ ), h = r.maxBy((s) => s.death) + 1;
260
260
  return {
261
261
  left: e,
262
262
  middle: t,
@@ -264,8 +264,8 @@ class je {
264
264
  flat: r,
265
265
  leafs: o,
266
266
  visibleLeafs: a,
267
- userVisibleLeafs: h,
268
- maxDeath: u
267
+ userVisibleLeafs: u,
268
+ maxDeath: h
269
269
  };
270
270
  });
271
271
  headerRows = P(() => (console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid headerRows memo"), this.columns.value.flat.groupBy((t) => t.death).sortBy((t) => t.key).map((t) => {
@@ -300,8 +300,8 @@ class je {
300
300
  (o) => o.key !== V && o.key !== G && o.key !== _ && o.key !== T
301
301
  ).map((o) => o.key);
302
302
  return e.filter((o) => r.some((a) => {
303
- const h = o[a];
304
- return h == null ? !1 : ae(t, String(h));
303
+ const u = o[a];
304
+ return u == null ? !1 : ae(t, String(u));
305
305
  }));
306
306
  }
307
307
  /**
@@ -312,8 +312,8 @@ class je {
312
312
  return i.length === 0 ? e : e.filter((r) => i.every((o) => {
313
313
  const a = t[o];
314
314
  if (!a) return !0;
315
- const h = r[o];
316
- return this.matchesFilter(h, a);
315
+ const u = r[o];
316
+ return this.matchesFilter(u, a);
317
317
  }));
318
318
  }
319
319
  /**
@@ -353,11 +353,18 @@ class je {
353
353
  }
354
354
  }
355
355
  /**
356
- * Get filtered data (applies global filter then column filters)
356
+ * Apply external predicate filters from the filters prop
357
+ */
358
+ applyExternalFilters(e) {
359
+ const t = this.props.filters;
360
+ return !t || t.length === 0 ? e : e.filter((i) => t.every((r) => r(i)));
361
+ }
362
+ /**
363
+ * Get filtered data (applies external, global, then column filters)
357
364
  */
358
365
  get filteredData() {
359
366
  let e = this.props.data;
360
- return this.props.def.globalFilter && (e = this.applyGlobalFilter(e)), e = this.applyColumnFilters(e), e;
367
+ return e = this.applyExternalFilters(e), this.props.def.globalFilter && (e = this.applyGlobalFilter(e)), e = this.applyColumnFilters(e), e;
361
368
  }
362
369
  /**
363
370
  * Set global filter value
@@ -416,12 +423,12 @@ class je {
416
423
  const t = (i, r, o) => {
417
424
  const a = r.values().next().value;
418
425
  r.delete(a);
419
- const h = this.columns.value.leafs.findOrThrow((u) => u.key === a);
420
- return this._sortColumn === T && (i = i.sortBy((u) => u[a], this._sortDirection)), i.groupBy((u) => u[a]).map((u) => {
421
- let l;
422
- r.size > 0 ? l = t(u.values, new Set(r), o + 1) : l = u.values.map((p, f) => new ue(this, p, o + 1 + f));
423
- const c = new we(this, h, l, o, u.key);
424
- return o += 1, c.expanded && (o += l.length), c;
426
+ const u = this.columns.value.leafs.findOrThrow((h) => h.key === a);
427
+ return this._sortColumn === T && (i = i.sortBy((h) => h[a], this._sortDirection)), i.groupBy((h) => h[a]).map((h) => {
428
+ let s;
429
+ r.size > 0 ? s = t(h.values, new Set(r), o + 1) : s = h.values.map((d, f) => new ue(this, d, o + 1 + f));
430
+ const c = new we(this, u, s, o, h.key);
431
+ return o += 1, c.expanded && (o += s.length), c;
425
432
  });
426
433
  };
427
434
  return t(e, new Set(this.groupColumns), 0);
@@ -461,19 +468,19 @@ class je {
461
468
  console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid flexWidths memo");
462
469
  const e = this._containerWidth;
463
470
  if (e <= 0) return {};
464
- const t = this.columns.value.visibleLeafs.filter((c) => c.key !== V), i = (c) => !c.isFlexible || this.columnWidths.has(c.key), r = t.filter(i).sumBy((c) => c.baseWidth), o = t.filter((c) => !i(c)), a = o.sumBy((c) => c.baseWidth), h = e - r;
465
- if (h <= a)
471
+ const t = this.columns.value.visibleLeafs.filter((c) => c.key !== V), i = (c) => !c.isFlexible || this.columnWidths.has(c.key), r = t.filter(i).sumBy((c) => c.baseWidth), o = t.filter((c) => !i(c)), a = o.sumBy((c) => c.baseWidth), u = e - r;
472
+ if (u <= a)
466
473
  return o.toRecord((c) => [c.key, c.baseWidth]);
467
- const u = {};
468
- let l = 0;
469
- return o.forEach((c, p) => {
470
- if (p === o.length - 1)
471
- u[c.key] = h - l;
474
+ const h = {};
475
+ let s = 0;
476
+ return o.forEach((c, d) => {
477
+ if (d === o.length - 1)
478
+ h[c.key] = u - s;
472
479
  else {
473
- const f = Math.floor(c.baseWidth / a * h);
474
- u[c.key] = f, l += f;
480
+ const f = Math.floor(c.baseWidth / a * u);
481
+ h[c.key] = f, s += f;
475
482
  }
476
- }), u;
483
+ }), h;
477
484
  });
478
485
  getFlexWidth(e) {
479
486
  return this.flexWidths.value[e];
@@ -606,8 +613,8 @@ class we {
606
613
  this.grid.toggleGroupRow(this.key);
607
614
  }
608
615
  }
609
- function q(s) {
610
- const { children: e, column: t, style: i, ...r } = s, { key: o, pin: a, left: h, right: u, isEdge: l, align: c, widthVarName: p, leftVarName: f, rightVarName: y, isFirstLeaf: v, isLastLeaf: R } = t;
616
+ function q(l) {
617
+ const { children: e, column: t, style: i, ...r } = l, { key: o, pin: a, left: u, right: h, isEdge: s, align: c, widthVarName: d, leftVarName: f, rightVarName: y, isFirstLeaf: v, isLastLeaf: R } = t;
611
618
  "align" in t.def && (r.jc = c);
612
619
  const N = o === G, S = o === _, x = o === V, L = a === "LEFT", C = a === "RIGHT";
613
620
  return /* @__PURE__ */ n(
@@ -617,10 +624,10 @@ function q(s) {
617
624
  props: { role: "cell" },
618
625
  variant: {
619
626
  isPinned: L || C,
620
- isFirstLeftPinned: L && h === 0,
621
- isLastLeftPinned: L && l,
622
- isFirstRightPinned: C && l,
623
- isLastRightPinned: C && u === 0,
627
+ isFirstLeftPinned: L && u === 0,
628
+ isLastLeftPinned: L && s,
629
+ isFirstRightPinned: C && s,
630
+ isLastRightPinned: C && h === 0,
624
631
  isRowSelection: S,
625
632
  isRowNumber: N,
626
633
  isFirstLeaf: v,
@@ -628,7 +635,7 @@ function q(s) {
628
635
  isEmptyCell: x
629
636
  },
630
637
  style: {
631
- width: `var(${p})`,
638
+ width: `var(${d})`,
632
639
  height: `var(${t.grid.rowHeightVarName})`,
633
640
  left: L ? `var(${f})` : void 0,
634
641
  right: C ? `var(${y})` : void 0,
@@ -640,13 +647,13 @@ function q(s) {
640
647
  );
641
648
  }
642
649
  q.displayName = "DataGridCell";
643
- function ye(s) {
644
- const { row: e } = s, { selected: t, indeterminate: i, cells: r, groupingColumn: o, groupingColumnGridColumn: a, depth: h, expanded: u } = e, l = k(() => {
650
+ function ye(l) {
651
+ const { row: e } = l, { selected: t, indeterminate: i, cells: r, groupingColumn: o, groupingColumnGridColumn: a, depth: u, expanded: h } = e, s = k(() => {
645
652
  e.grid.toggleRowsSelection(e.allRows.map((c) => c.key));
646
653
  }, []);
647
654
  return /* @__PURE__ */ n(m, { className: "grid-row", selected: t, display: "contents", props: { role: "rowgroup" }, children: r.map((c) => {
648
- const { key: p, pin: f, groupColumnWidthVarName: y } = c.column, v = f === "RIGHT";
649
- if (p === T)
655
+ const { key: d, pin: f, groupColumnWidthVarName: y } = c.column, v = f === "RIGHT";
656
+ if (d === T)
650
657
  return /* @__PURE__ */ n(
651
658
  q,
652
659
  {
@@ -657,41 +664,45 @@ function ye(s) {
657
664
  },
658
665
  br: o.pin === "LEFT" ? 1 : void 0,
659
666
  gridColumn: a,
660
- pl: 4 * h,
667
+ pl: 4 * u,
661
668
  overflow: "auto",
662
- children: /* @__PURE__ */ n(g, { textWrap: "nowrap", px: 3, children: /* @__PURE__ */ d(D, { clean: !0, onClick: () => e.toggleRow(), cursor: "pointer", display: "flex", gap: 1, ai: "center", children: [
663
- /* @__PURE__ */ n(ge, { fill: "currentColor", width: "14px", height: "14px", rotate: u ? 0 : -90 }),
669
+ children: /* @__PURE__ */ n(g, { textWrap: "nowrap", px: 3, children: /* @__PURE__ */ p(D, { clean: !0, onClick: () => e.toggleRow(), cursor: "pointer", display: "flex", gap: 1, ai: "center", children: [
670
+ /* @__PURE__ */ n(ge, { fill: "currentColor", width: "14px", height: "14px", rotate: h ? 0 : -90 }),
664
671
  c.value
665
672
  ] }) })
666
673
  },
667
- p
674
+ d
668
675
  );
669
- if (p === _)
670
- return /* @__PURE__ */ n(q, { column: c.column, children: /* @__PURE__ */ n(le, { variant: "datagrid", m: 1, checked: t, indeterminate: i, onChange: l }) }, p);
671
- if (f !== o.pin || p === G || p === V)
672
- return /* @__PURE__ */ n(q, { column: c.column, px: p === G ? 3 : void 0, children: c.value }, p);
676
+ if (d === _)
677
+ return /* @__PURE__ */ n(q, { column: c.column, children: /* @__PURE__ */ n(le, { variant: "datagrid", m: 1, checked: t, indeterminate: i, onChange: s }) }, d);
678
+ if (f !== o.pin || d === G || d === V)
679
+ return /* @__PURE__ */ n(q, { column: c.column, px: d === G ? 3 : void 0, children: c.value }, d);
673
680
  }) });
674
681
  }
675
682
  ye.displayName = "DataGridGroupRow";
676
- function ve(s) {
677
- const { cell: e } = s;
683
+ function ve(l) {
684
+ const { cell: e } = l;
678
685
  return /* @__PURE__ */ n(m, { height: "fit", width: "fit", overflow: "auto", ai: "center", jc: e.column.align, children: /* @__PURE__ */ n(g, { px: 3, textOverflow: "ellipsis", overflow: "hidden", textWrap: "nowrap", children: e.value }) });
679
686
  }
680
687
  ve.displayName = "DataGridCellText";
681
- function be(s) {
682
- const { row: e } = s, { selected: t } = e;
688
+ function be(l) {
689
+ const { row: e } = l, { selected: t } = e;
683
690
  return /* @__PURE__ */ n(m, { className: "grid-row", selected: t, display: "contents", props: { role: "row" }, children: e.cells.map((i) => /* @__PURE__ */ n(q, { column: i.column, children: i.column.Cell ? /* @__PURE__ */ n(i.column.Cell, { cell: i }) : /* @__PURE__ */ n(ve, { cell: i }) }, i.column.key)) });
684
691
  }
685
692
  be.displayName = "DataGridRow";
686
693
  const Xe = 10, de = 20;
687
- function Re(s) {
688
- const { grid: e, scrollTop: t } = s, i = e.flatRows.value.length, r = Math.max(0, Math.floor(t / e.rowHeight) - de), o = e.props.def.visibleRowsCount ?? Xe, a = e.rowHeight * o + e.rowHeight / 5, h = X(() => {
689
- if (console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render rows"), e.props.data.length === 0)
690
- return /* @__PURE__ */ n(m, { jc: "center", ai: "center", gridColumn: "full-row", style: { height: a }, children: e.props.loading ? "loading..." : "empty" });
691
- const u = o + de * 2;
692
- return e.flatRows.value.take(u, r).map((c) => c instanceof we ? /* @__PURE__ */ n(ye, { row: c }, c.key) : /* @__PURE__ */ n(be, { row: c }, c.key));
693
- }, [e.flatRows.value, e.props.data.length, e.props.loading, r, a, o]);
694
- return console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render DataGridBody"), /* @__PURE__ */ n(g, { style: { height: a }, children: /* @__PURE__ */ n(
694
+ function Re(l) {
695
+ const { grid: e, scrollTop: t } = l, i = e.flatRows.value.length, r = Math.max(0, Math.floor(t / e.rowHeight) - de), o = e.props.def.visibleRowsCount ?? Xe, a = e.rowHeight * o + e.rowHeight / 5, u = e.props.data.length === 0, h = X(() => {
696
+ if (console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render rows"), u)
697
+ return null;
698
+ const s = o + de * 2;
699
+ return e.flatRows.value.take(s, r).map((d) => d instanceof we ? /* @__PURE__ */ n(ye, { row: d }, d.key) : /* @__PURE__ */ n(be, { row: d }, d.key));
700
+ }, [e.flatRows.value, u, r, o]);
701
+ if (console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render DataGridBody"), u) {
702
+ const { noDataComponent: s } = e.props.def, c = e.props.loading ? "loading..." : "empty";
703
+ return /* @__PURE__ */ n(m, { jc: "center", ai: "center", width: "fit", position: "sticky", left: 0, style: { height: a }, children: s ?? c });
704
+ }
705
+ return /* @__PURE__ */ n(g, { style: { height: a }, children: /* @__PURE__ */ n(
695
706
  g,
696
707
  {
697
708
  style: {
@@ -729,7 +740,7 @@ function Ye() {
729
740
  bgColor: "gray-50",
730
741
  borderRadius: 4,
731
742
  theme: { dark: { bgColor: "gray-900" } },
732
- children: /* @__PURE__ */ d(m, { d: "column", ai: "center", gap: 3, children: [
743
+ children: /* @__PURE__ */ p(m, { d: "column", ai: "center", gap: 3, children: [
733
744
  /* @__PURE__ */ n(
734
745
  g,
735
746
  {
@@ -751,7 +762,7 @@ function Ye() {
751
762
  ) })
752
763
  }
753
764
  ),
754
- /* @__PURE__ */ d(m, { d: "column", ai: "center", gap: 1, children: [
765
+ /* @__PURE__ */ p(m, { d: "column", ai: "center", gap: 1, children: [
755
766
  /* @__PURE__ */ n(g, { fontSize: 18, fontWeight: 600, color: "gray-900", theme: { dark: { color: "gray-50" } }, children: "No Columns Selected" }),
756
767
  /* @__PURE__ */ n(g, { fontSize: 14, color: "gray-500", textAlign: "center", theme: { dark: { color: "gray-400" } }, children: "Select at least one column from the columns menu to display data" })
757
768
  ] })
@@ -759,80 +770,80 @@ function Ye() {
759
770
  }
760
771
  );
761
772
  }
762
- function pe({ column: s, grid: e }) {
763
- const t = e.columnFilters[s.key], i = t?.type === "text" ? t.value : "", [r, o] = M(i), a = O(null);
773
+ function pe({ column: l, grid: e }) {
774
+ const t = e.columnFilters[l.key], i = t?.type === "text" ? t.value : "", [r, o] = M(i), a = O(null);
764
775
  z(() => () => {
765
776
  a.current && clearTimeout(a.current);
766
777
  }, []);
767
- const h = k(
778
+ const u = k(
768
779
  (c) => {
769
- const p = c.target.value;
770
- o(p), a.current && clearTimeout(a.current), a.current = setTimeout(() => {
771
- p.trim() ? e.setColumnFilter(s.key, { type: "text", value: p }) : e.setColumnFilter(s.key, void 0), a.current = null;
780
+ const d = c.target.value;
781
+ o(d), a.current && clearTimeout(a.current), a.current = setTimeout(() => {
782
+ d.trim() ? e.setColumnFilter(l.key, { type: "text", value: d }) : e.setColumnFilter(l.key, void 0), a.current = null;
772
783
  }, 300);
773
784
  },
774
- [e, s.key]
775
- ), u = k(() => {
776
- o(""), e.setColumnFilter(s.key, void 0);
777
- }, [e, s.key]), l = typeof s.def.filterable == "object" ? s.def.filterable : {};
778
- return /* @__PURE__ */ d(m, { ai: "center", position: "relative", width: "fit", children: [
779
- /* @__PURE__ */ n(j, { width: "fit", variant: "compact", placeholder: l.placeholder ?? "Filter...", value: r, onChange: h }),
780
- r && /* @__PURE__ */ n(m, { position: "absolute", right: 2, top: "1/2", translateY: "-1/2", cursor: "pointer", props: { onClick: u }, children: /* @__PURE__ */ n(g, { fontSize: 10, color: "gray-400", hover: { color: "gray-600" }, children: "✕" }) })
785
+ [e, l.key]
786
+ ), h = k(() => {
787
+ o(""), e.setColumnFilter(l.key, void 0);
788
+ }, [e, l.key]), s = typeof l.def.filterable == "object" ? l.def.filterable : {};
789
+ return /* @__PURE__ */ p(m, { ai: "center", position: "relative", width: "fit", children: [
790
+ /* @__PURE__ */ n(j, { width: "fit", variant: "compact", placeholder: s.placeholder ?? "Filter...", value: r, onChange: u }),
791
+ r && /* @__PURE__ */ n(m, { position: "absolute", right: 2, top: "1/2", translateY: "-1/2", cursor: "pointer", props: { onClick: h }, children: /* @__PURE__ */ n(g, { fontSize: 10, color: "gray-400", hover: { color: "gray-600" }, children: "✕" }) })
781
792
  ] });
782
793
  }
783
- function Ke({ column: s, grid: e }) {
784
- const t = e.columnFilters[s.key], i = t?.type === "number" ? t.value : "", r = t?.type === "number" ? t.operator : "eq", o = t?.type === "number" ? t.valueTo : "", [a, h] = M(i), [u, l] = M(r), [c, p] = M(o ?? ""), f = O(null), y = O(null);
794
+ function Ke({ column: l, grid: e }) {
795
+ const t = e.columnFilters[l.key], i = t?.type === "number" ? t.value : "", r = t?.type === "number" ? t.operator : "eq", o = t?.type === "number" ? t.valueTo : "", [a, u] = M(i), [h, s] = M(r), [c, d] = M(o ?? ""), f = O(null), y = O(null);
785
796
  z(() => () => {
786
797
  f.current && clearTimeout(f.current), y.current && clearTimeout(y.current);
787
798
  }, []);
788
- const v = typeof s.def.filterable == "object" ? s.def.filterable : {}, R = k(
799
+ const v = typeof l.def.filterable == "object" ? l.def.filterable : {}, R = k(
789
800
  (C, w, F) => {
790
801
  const W = typeof w == "number" ? w : parseFloat(w);
791
802
  if (isNaN(W) || w === "") {
792
- e.setColumnFilter(s.key, void 0);
803
+ e.setColumnFilter(l.key, void 0);
793
804
  return;
794
805
  }
795
- const B = {
806
+ const E = {
796
807
  type: "number",
797
808
  operator: C,
798
809
  value: W
799
810
  };
800
811
  if (C === "between" && F !== void 0 && F !== "") {
801
- const E = typeof F == "number" ? F : parseFloat(String(F));
802
- isNaN(E) || (B.valueTo = E);
812
+ const B = typeof F == "number" ? F : parseFloat(String(F));
813
+ isNaN(B) || (E.valueTo = B);
803
814
  }
804
- e.setColumnFilter(s.key, B);
815
+ e.setColumnFilter(l.key, E);
805
816
  },
806
- [e, s.key]
817
+ [e, l.key]
807
818
  ), N = k(
808
819
  (C) => {
809
820
  const w = C.target.value;
810
- h(w), f.current && clearTimeout(f.current), f.current = setTimeout(() => {
811
- R(u, w, c), f.current = null;
821
+ u(w), f.current && clearTimeout(f.current), f.current = setTimeout(() => {
822
+ R(h, w, c), f.current = null;
812
823
  }, 300);
813
824
  },
814
- [u, c, R]
825
+ [h, c, R]
815
826
  ), S = k(
816
827
  (C) => {
817
- l(C), R(C, a, c);
828
+ s(C), R(C, a, c);
818
829
  },
819
830
  [a, c, R]
820
831
  ), x = k(
821
832
  (C) => {
822
833
  const w = C.target.value;
823
- p(w), y.current && clearTimeout(y.current), y.current = setTimeout(() => {
824
- R(u, a, w), y.current = null;
834
+ d(w), y.current && clearTimeout(y.current), y.current = setTimeout(() => {
835
+ R(h, a, w), y.current = null;
825
836
  }, 300);
826
837
  },
827
- [u, a, R]
838
+ [h, a, R]
828
839
  ), L = k(() => {
829
- h(""), p(""), l("eq"), e.setColumnFilter(s.key, void 0);
830
- }, [e, s.key]);
831
- return /* @__PURE__ */ d(m, { ai: u === "between" ? "start" : "center", gap: 1, width: "fit", children: [
832
- /* @__PURE__ */ d(
840
+ u(""), d(""), s("eq"), e.setColumnFilter(l.key, void 0);
841
+ }, [e, l.key]);
842
+ return /* @__PURE__ */ p(m, { ai: h === "between" ? "start" : "center", gap: 1, width: "fit", children: [
843
+ /* @__PURE__ */ p(
833
844
  b,
834
845
  {
835
- value: u,
846
+ value: h,
836
847
  variant: "compact",
837
848
  onChange: (C) => C && S(C),
838
849
  minWidth: 6,
@@ -848,8 +859,8 @@ function Ke({ column: s, grid: e }) {
848
859
  ]
849
860
  }
850
861
  ),
851
- u === "between" ? /* @__PURE__ */ d(m, { d: "column", gap: 1, flex1: !0, children: [
852
- /* @__PURE__ */ d(m, { ai: "center", position: "relative", flex1: !0, children: [
862
+ h === "between" ? /* @__PURE__ */ p(m, { d: "column", gap: 1, flex1: !0, children: [
863
+ /* @__PURE__ */ p(m, { ai: "center", position: "relative", flex1: !0, children: [
853
864
  /* @__PURE__ */ n(
854
865
  j,
855
866
  {
@@ -876,7 +887,7 @@ function Ke({ column: s, grid: e }) {
876
887
  step: v.step
877
888
  }
878
889
  ) })
879
- ] }) : /* @__PURE__ */ d(m, { ai: "center", position: "relative", flex1: !0, children: [
890
+ ] }) : /* @__PURE__ */ p(m, { ai: "center", position: "relative", flex1: !0, children: [
880
891
  /* @__PURE__ */ n(
881
892
  j,
882
893
  {
@@ -893,17 +904,17 @@ function Ke({ column: s, grid: e }) {
893
904
  ] })
894
905
  ] });
895
906
  }
896
- function Je({ column: s, grid: e }) {
897
- const t = e.columnFilters[s.key], i = t?.type === "multiselect" ? t.values : [], r = typeof s.def.filterable == "object" ? s.def.filterable : {}, o = X(() => r.options ? r.options : e.getColumnUniqueValues(s.key).map((u) => ({
898
- label: u === null ? "(empty)" : String(u),
899
- value: u
900
- })), [r.options, e, s.key]), a = k(
901
- (h, u) => {
902
- u.length === 0 ? e.setColumnFilter(s.key, void 0) : e.setColumnFilter(s.key, { type: "multiselect", values: u });
907
+ function Je({ column: l, grid: e }) {
908
+ const t = e.columnFilters[l.key], i = t?.type === "multiselect" ? t.values : [], r = typeof l.def.filterable == "object" ? l.def.filterable : {}, o = X(() => r.options ? r.options : e.getColumnUniqueValues(l.key).map((h) => ({
909
+ label: h === null ? "(empty)" : String(h),
910
+ value: h
911
+ })), [r.options, e, l.key]), a = k(
912
+ (u, h) => {
913
+ h.length === 0 ? e.setColumnFilter(l.key, void 0) : e.setColumnFilter(l.key, { type: "multiselect", values: h });
903
914
  },
904
- [e, s.key]
915
+ [e, l.key]
905
916
  );
906
- return /* @__PURE__ */ d(
917
+ return /* @__PURE__ */ p(
907
918
  b,
908
919
  {
909
920
  multiple: !0,
@@ -918,13 +929,13 @@ function Je({ column: s, grid: e }) {
918
929
  children: [
919
930
  /* @__PURE__ */ n(b.Unselect, { children: "Clear" }),
920
931
  /* @__PURE__ */ n(b.SelectAll, { children: "Select All" }),
921
- o.map((h) => /* @__PURE__ */ n(b.Item, { value: h.value, ai: "center", gap: 2, children: h.label }, String(h.value)))
932
+ o.map((u) => /* @__PURE__ */ n(b.Item, { value: u.value, ai: "center", gap: 2, children: u.label }, String(u.value)))
922
933
  ]
923
934
  }
924
935
  );
925
936
  }
926
- function xe(s) {
927
- const { column: e, grid: t } = s, { filterable: i } = e.def;
937
+ function xe(l) {
938
+ const { column: e, grid: t } = l, { filterable: i } = e.def;
928
939
  if (!i) return null;
929
940
  switch ((typeof i == "object" ? i : { type: "text" }).type) {
930
941
  case "text":
@@ -938,40 +949,40 @@ function xe(s) {
938
949
  }
939
950
  }
940
951
  xe.displayName = "DataGridColumnFilter";
941
- function Fe(s) {
942
- const { column: e, grid: t } = s, { key: i, pin: r, left: o, right: a, isEdge: h, widthVarName: u, leftVarName: l, rightVarName: c, filterable: p } = e, f = i === V, N = f || i === T || i === G || i === _, S = r === "LEFT", x = r === "RIGHT";
952
+ function Fe(l) {
953
+ const { column: e, grid: t } = l, { key: i, pin: r, left: o, right: a, isEdge: u, widthVarName: h, leftVarName: s, rightVarName: c, filterable: d } = e, f = i === V, N = f || i === T || i === G || i === _, S = r === "LEFT", x = r === "RIGHT";
943
954
  return /* @__PURE__ */ n(
944
955
  m,
945
956
  {
946
957
  component: "datagrid.filter.cell",
947
- variant: { isPinned: S || x, isFirstLeftPinned: S && o === 0, isLastLeftPinned: S && h, isFirstRightPinned: x && h, isLastRightPinned: x && a === 0 },
958
+ variant: { isPinned: S || x, isFirstLeftPinned: S && o === 0, isLastLeftPinned: S && u, isFirstRightPinned: x && u, isLastRightPinned: x && a === 0 },
948
959
  px: f ? 0 : 2,
949
960
  style: {
950
- width: `var(${u})`,
951
- left: S ? `var(${l})` : void 0,
961
+ width: `var(${h})`,
962
+ left: S ? `var(${s})` : void 0,
952
963
  right: x ? `var(${c})` : void 0
953
964
  },
954
- children: !N && p && /* @__PURE__ */ n(xe, { column: e, grid: t })
965
+ children: !N && d && /* @__PURE__ */ n(xe, { column: e, grid: t })
955
966
  }
956
967
  );
957
968
  }
958
969
  Fe.displayName = "DataGridFilterCell";
959
- function ke(s) {
960
- const { grid: e } = s, { visibleLeafs: t } = e.columns.value;
970
+ function ke(l) {
971
+ const { grid: e } = l, { visibleLeafs: t } = e.columns.value;
961
972
  return t.some((r) => r.filterable) ? t.map((r) => /* @__PURE__ */ n(Fe, { column: r, grid: e }, r.uniqueKey)) : null;
962
973
  }
963
974
  ke.displayName = "DataGridFilterRow";
964
- function Ge(s) {
965
- const { column: e } = s, { key: t, pin: i, left: r, right: o, isEdge: a, isLeaf: h, align: u, header: l, grid: c } = e, [p, f, y] = Me({ hideOnScroll: !0, event: "mousedown" }), [v, R] = M({ top: 0, left: 0 }), N = X(() => v.left > window.innerWidth / 2, [v.left]), S = h && e.sortable && (c.sortColumn !== t || c.sortDirection === "DESC"), x = h && e.sortable && (c.sortColumn !== t || c.sortDirection === "ASC"), L = h && e.sortable && c.sortColumn === t, C = i !== "LEFT", w = i !== "RIGHT", F = !!i, W = h && t !== T, B = h && t === T, E = S || x || L, Y = C || w || F, ee = u === "right" ? 2 : void 0, te = u === "right" ? void 0 : i === "RIGHT" ? 2.5 : 4, K = t === V, J = t === G, ie = t === _, $ = i === "LEFT", Q = i === "RIGHT", re = $ || i === "RIGHT", Z = $ && r === 0, ne = $ && a, H = Q && a, U = Q && o === 0, Ne = h && !K && !J && !ie && e.sortable;
966
- return /* @__PURE__ */ n(m, { position: "absolute", left: ee, right: te, top: "1/2", translateY: -3, ai: "center", children: /* @__PURE__ */ d(
975
+ function Ge(l) {
976
+ const { column: e } = l, { key: t, pin: i, left: r, right: o, isEdge: a, isLeaf: u, align: h, header: s, grid: c } = e, [d, f, y] = Me({ hideOnScroll: !0, event: "mousedown" }), [v, R] = M({ top: 0, left: 0 }), N = X(() => v.left > window.innerWidth / 2, [v.left]), S = u && e.sortable && (c.sortColumn !== t || c.sortDirection === "DESC"), x = u && e.sortable && (c.sortColumn !== t || c.sortDirection === "ASC"), L = u && e.sortable && c.sortColumn === t, C = i !== "LEFT", w = i !== "RIGHT", F = !!i, W = u && t !== T, E = u && t === T, B = S || x || L, Y = C || w || F, ee = h === "right" ? 2 : void 0, te = h === "right" ? void 0 : i === "RIGHT" ? 2.5 : 4, K = t === V, J = t === G, ie = t === _, $ = i === "LEFT", Q = i === "RIGHT", re = $ || i === "RIGHT", Z = $ && r === 0, ne = $ && a, H = Q && a, U = Q && o === 0, Ne = u && !K && !J && !ie && e.sortable;
977
+ return /* @__PURE__ */ n(m, { position: "absolute", left: ee, right: te, top: "1/2", translateY: -3, ai: "center", children: /* @__PURE__ */ p(
967
978
  D,
968
979
  {
969
980
  component: "datagrid.header.cell.contextMenu",
970
- onClick: () => f(!p),
981
+ onClick: () => f(!d),
971
982
  variant: { isPinned: re, isFirstLeftPinned: Z, isLastLeftPinned: ne, isFirstRightPinned: H, isLastRightPinned: U, isSortable: Ne, isRowNumber: J },
972
983
  children: [
973
984
  /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.icon", children: /* @__PURE__ */ n(He, { fill: "currentColor" }) }),
974
- p && /* @__PURE__ */ d(
985
+ d && /* @__PURE__ */ p(
975
986
  Ae,
976
987
  {
977
988
  component: "datagrid.header.cell.contextMenu.tooltip",
@@ -980,40 +991,40 @@ function Ge(s) {
980
991
  adjustTranslateX: N ? "-100%" : "-21px",
981
992
  adjustTranslateY: "16px",
982
993
  children: [
983
- S && /* @__PURE__ */ d(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn("ASC"), children: [
994
+ S && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn("ASC"), children: [
984
995
  /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(oe, { width: "100%", fill: "currentColor" }) }),
985
996
  "Sort Ascending"
986
997
  ] }),
987
- x && /* @__PURE__ */ d(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn("DESC"), children: [
998
+ x && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn("DESC"), children: [
988
999
  /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(oe, { width: "100%", fill: "currentColor", rotate: 180 }) }),
989
1000
  "Sort Descending"
990
1001
  ] }),
991
- L && /* @__PURE__ */ d(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn(void 0), children: [
1002
+ L && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn(void 0), children: [
992
1003
  /* @__PURE__ */ n(g, { width: 4 }),
993
1004
  "Clear Sort"
994
1005
  ] }),
995
- E && (Y || W || B) && /* @__PURE__ */ n(g, { bb: 1, my: 2, borderColor: "gray-300", component: "datagrid.header.cell.contextMenu.tooltip.item.separator" }),
996
- C && /* @__PURE__ */ d(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn("LEFT"), children: [
1006
+ B && (Y || W || E) && /* @__PURE__ */ n(g, { bb: 1, my: 2, borderColor: "gray-300", component: "datagrid.header.cell.contextMenu.tooltip.item.separator" }),
1007
+ C && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn("LEFT"), children: [
997
1008
  /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(ce, { width: "100%", fill: "currentColor" }) }),
998
1009
  "Pin Left"
999
1010
  ] }),
1000
- w && /* @__PURE__ */ d(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn("RIGHT"), children: [
1011
+ w && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn("RIGHT"), children: [
1001
1012
  /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(ce, { width: "100%", fill: "currentColor", rotate: -90 }) }),
1002
1013
  "Pin Right"
1003
1014
  ] }),
1004
- F && /* @__PURE__ */ d(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn(), children: [
1015
+ F && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn(), children: [
1005
1016
  /* @__PURE__ */ n(g, { width: 4 }),
1006
1017
  "Unpin"
1007
1018
  ] }),
1008
- E && Y && (W || B) && /* @__PURE__ */ n(g, { component: "datagrid.header.cell.contextMenu.tooltip.item.separator" }),
1009
- W && /* @__PURE__ */ d(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: e.toggleGrouping, children: [
1019
+ B && Y && (W || E) && /* @__PURE__ */ n(g, { component: "datagrid.header.cell.contextMenu.tooltip.item.separator" }),
1020
+ W && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: e.toggleGrouping, children: [
1010
1021
  /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(se, { width: "100%", fill: "currentColor" }) }),
1011
- /* @__PURE__ */ d(g, { textWrap: "nowrap", children: [
1022
+ /* @__PURE__ */ p(g, { textWrap: "nowrap", children: [
1012
1023
  "Group by ",
1013
- l ?? t
1024
+ s ?? t
1014
1025
  ] })
1015
1026
  ] }),
1016
- B && /* @__PURE__ */ d(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: c.unGroupAll, children: [
1027
+ E && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: c.unGroupAll, children: [
1017
1028
  /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(se, { width: "100%", fill: "currentColor" }) }),
1018
1029
  /* @__PURE__ */ n(g, { textWrap: "nowrap", children: "Un-Group All" })
1019
1030
  ] })
@@ -1025,8 +1036,8 @@ function Ge(s) {
1025
1036
  ) });
1026
1037
  }
1027
1038
  Ge.displayName = "DataGridHeaderCellContextMenu";
1028
- function Se(s) {
1029
- const { column: e } = s;
1039
+ function Se(l) {
1040
+ const { column: e } = l;
1030
1041
  return /* @__PURE__ */ n(
1031
1042
  m,
1032
1043
  {
@@ -1052,49 +1063,49 @@ function Se(s) {
1052
1063
  );
1053
1064
  }
1054
1065
  Se.displayName = "DataGridHeaderCellResizer";
1055
- function Le(s) {
1056
- const { column: e } = s, {
1066
+ function Le(l) {
1067
+ const { column: e } = l, {
1057
1068
  key: t,
1058
1069
  pin: i,
1059
1070
  left: r,
1060
1071
  right: o,
1061
1072
  isEdge: a,
1062
- isLeaf: h,
1063
- leafs: u,
1064
- grid: l,
1073
+ isLeaf: u,
1074
+ leafs: h,
1075
+ grid: s,
1065
1076
  header: c,
1066
- gridRows: p,
1077
+ gridRows: d,
1067
1078
  widthVarName: f,
1068
1079
  leftVarName: y,
1069
1080
  rightVarName: v,
1070
1081
  inlineWidth: R,
1071
1082
  isFirstLeaf: N,
1072
1083
  isLastLeaf: S
1073
- } = e, x = t === V, L = t === T, C = t === G, w = t === _, F = i === "LEFT", W = i === "RIGHT", B = F || i === "RIGHT", E = F && r === 0, Y = F && a, ee = W && a, te = W && o === 0, K = h && !x && !C && !w && e.sortable, J = h ? 1 : u.length, ie = !C && !w && e.resizable, $ = !C && !w, Q = w ? void 0 : e.align === "right" ? 10 : 3, re = w ? void 0 : e.align === "center" ? 3 : void 0, Z = k(() => {
1074
- l.toggleSelectAllRows();
1084
+ } = e, x = t === V, L = t === T, C = t === G, w = t === _, F = i === "LEFT", W = i === "RIGHT", E = F || i === "RIGHT", B = F && r === 0, Y = F && a, ee = W && a, te = W && o === 0, K = u && !x && !C && !w && e.sortable, J = u ? 1 : h.length, ie = !C && !w && e.resizable, $ = !C && !w, Q = w ? void 0 : e.align === "right" ? 10 : 3, re = w ? void 0 : e.align === "center" ? 3 : void 0, Z = k(() => {
1085
+ s.toggleSelectAllRows();
1075
1086
  }, []), ne = X(() => {
1076
1087
  if (C) return null;
1077
1088
  if (w) {
1078
- const H = l.selectedRows.size === l.props.data.length, U = !H && l.selectedRows.size > 0;
1089
+ const H = s.selectedRows.size === s.props.data.length, U = !H && s.selectedRows.size > 0;
1079
1090
  return /* @__PURE__ */ n(le, { variant: "datagrid", m: 1, indeterminate: U, checked: H, onChange: Z });
1080
1091
  }
1081
1092
  if (L) {
1082
- if (l.groupColumns.size === 1) {
1083
- const H = l.columns.value.leafs.findOrThrow((U) => U.key === l.groupColumns.values().next().value);
1093
+ if (s.groupColumns.size === 1) {
1094
+ const H = s.columns.value.leafs.findOrThrow((U) => U.key === s.groupColumns.values().next().value);
1084
1095
  return H.header ?? H.key;
1085
1096
  }
1086
1097
  return "Group";
1087
1098
  }
1088
1099
  return c ?? t;
1089
- }, [l.groupColumns, l.selectedRows, Z]);
1100
+ }, [s.groupColumns, s.selectedRows, Z]);
1090
1101
  return /* @__PURE__ */ n(
1091
1102
  m,
1092
1103
  {
1093
1104
  props: { role: "columnheader" },
1094
1105
  component: "datagrid.header.cell",
1095
1106
  variant: {
1096
- isPinned: B,
1097
- isFirstLeftPinned: E,
1107
+ isPinned: E,
1108
+ isFirstLeftPinned: B,
1098
1109
  isLastLeftPinned: Y,
1099
1110
  isFirstRightPinned: ee,
1100
1111
  isLastRightPinned: te,
@@ -1104,29 +1115,29 @@ function Le(s) {
1104
1115
  isLastLeaf: S,
1105
1116
  isEmptyCell: x
1106
1117
  },
1107
- gridRow: p,
1118
+ gridRow: d,
1108
1119
  gridColumn: J,
1109
1120
  style: {
1110
1121
  width: `var(${f})`,
1111
1122
  left: F ? `var(${y})` : void 0,
1112
1123
  right: W ? `var(${v})` : void 0
1113
1124
  },
1114
- children: !x && /* @__PURE__ */ d(Be, { children: [
1115
- /* @__PURE__ */ n(m, { width: "fit", height: "fit", jc: e.align, props: { onClick: K ? () => e.sortColumn() : void 0 }, children: /* @__PURE__ */ d(
1125
+ children: !x && /* @__PURE__ */ p(Ee, { children: [
1126
+ /* @__PURE__ */ n(m, { width: "fit", height: "fit", jc: e.align, props: { onClick: K ? () => e.sortColumn() : void 0 }, children: /* @__PURE__ */ p(
1116
1127
  m,
1117
1128
  {
1118
1129
  overflow: "hidden",
1119
- position: h ? void 0 : "sticky",
1130
+ position: u ? void 0 : "sticky",
1120
1131
  ai: "center",
1121
1132
  transition: "none",
1122
1133
  pl: Q,
1123
1134
  pr: re,
1124
1135
  style: {
1125
- left: i ? void 0 : `var(${l.leftEdgeVarName})`
1136
+ left: i ? void 0 : `var(${s.leftEdgeVarName})`
1126
1137
  },
1127
1138
  children: [
1128
1139
  /* @__PURE__ */ n(g, { overflow: "hidden", textOverflow: "ellipsis", textWrap: "nowrap", children: ne }),
1129
- t === l.sortColumn && /* @__PURE__ */ n(g, { pl: (R ?? 0) < 58 ? 0 : 2, children: /* @__PURE__ */ n(oe, { width: "16px", rotate: l.sortDirection === "ASC" ? 0 : 180, fill: "currentColor" }) }),
1140
+ t === s.sortColumn && /* @__PURE__ */ n(g, { pl: (R ?? 0) < 58 ? 0 : 2, children: /* @__PURE__ */ n(oe, { width: "16px", rotate: s.sortDirection === "ASC" ? 0 : 180, fill: "currentColor" }) }),
1130
1141
  $ && /* @__PURE__ */ n(g, { minWidth: e.align === "right" ? 4 : 10 })
1131
1142
  ]
1132
1143
  }
@@ -1138,35 +1149,35 @@ function Le(s) {
1138
1149
  );
1139
1150
  }
1140
1151
  Le.displayName = "DataGridHeaderCell";
1141
- function Te(s) {
1142
- const { grid: e } = s;
1143
- return /* @__PURE__ */ d(me, { component: "datagrid.header", style: { gridTemplateColumns: e.gridTemplateColumns.value }, children: [
1152
+ function Te(l) {
1153
+ const { grid: e } = l;
1154
+ return /* @__PURE__ */ p(me, { component: "datagrid.header", style: { gridTemplateColumns: e.gridTemplateColumns.value }, children: [
1144
1155
  e.headerRows.value.map((t) => t.map((i) => /* @__PURE__ */ n(Le, { column: i }, i.uniqueKey))),
1145
1156
  /* @__PURE__ */ n(ke, { grid: e })
1146
1157
  ] });
1147
1158
  }
1148
1159
  Te.displayName = "DataGridHeader";
1149
- function We(s) {
1150
- const { grid: e } = s, [t, i] = M(0), r = O(null), o = k((h) => {
1160
+ function We(l) {
1161
+ const { grid: e } = l, [t, i] = M(0), r = O(null), o = k((u) => {
1151
1162
  r.current !== null && cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
1152
- i(h.target.scrollTop), r.current = null;
1163
+ i(u.target.scrollTop), r.current = null;
1153
1164
  });
1154
1165
  }, []);
1155
- return e.columns.value.userVisibleLeafs.length > 0 ? /* @__PURE__ */ d(g, { overflowX: "scroll", style: { willChange: "scroll-position" }, props: { onScroll: o }, children: [
1166
+ return e.columns.value.userVisibleLeafs.length > 0 ? /* @__PURE__ */ p(g, { overflowX: "scroll", style: { willChange: "scroll-position" }, props: { onScroll: o }, children: [
1156
1167
  /* @__PURE__ */ n(Te, { grid: e }),
1157
1168
  /* @__PURE__ */ n(Re, { grid: e, scrollTop: t })
1158
1169
  ] }) : /* @__PURE__ */ n(Ye, {});
1159
1170
  }
1160
1171
  We.displayName = "DataGridContent";
1161
- function De(s) {
1162
- const { grid: e } = s;
1163
- return e.groupColumns.size === 0 ? null : /* @__PURE__ */ d(m, { component: "datagrid.topBar.columnGroups", children: [
1172
+ function De(l) {
1173
+ const { grid: e } = l;
1174
+ return e.groupColumns.size === 0 ? null : /* @__PURE__ */ p(m, { component: "datagrid.topBar.columnGroups", children: [
1164
1175
  /* @__PURE__ */ n(I, { component: "datagrid.topBar.columnGroups.icon", children: /* @__PURE__ */ n(se, { width: "100%", fill: "currentColor" }) }),
1165
1176
  Array.from(e.groupColumns, (t) => {
1166
1177
  const i = e.columns.value.leafs.findOrThrow((r) => r.key === t);
1167
- return /* @__PURE__ */ d(Ee.Fragment, { children: [
1178
+ return /* @__PURE__ */ p(Be.Fragment, { children: [
1168
1179
  /* @__PURE__ */ n(ge, { fill: "currentColor", width: "14px", height: "14px", rotate: -90 }),
1169
- /* @__PURE__ */ d(m, { component: "datagrid.topBar.columnGroups.item", children: [
1180
+ /* @__PURE__ */ p(m, { component: "datagrid.topBar.columnGroups.item", children: [
1170
1181
  i.header ?? i.key,
1171
1182
  /* @__PURE__ */ n(D, { component: "datagrid.topBar.columnGroups.item.icon", onClick: () => e.toggleGrouping(i.key), children: /* @__PURE__ */ n(g, { fontSize: 10, color: "gray-400", hover: { color: "gray-600" }, children: "✕" }) })
1172
1183
  ] })
@@ -1175,29 +1186,29 @@ function De(s) {
1175
1186
  ] });
1176
1187
  }
1177
1188
  De.displayName = "DataGridColumnGroups";
1178
- function Qe(s) {
1179
- const { grid: e } = s, [t, i] = M(e.globalFilterValue), r = O(null);
1189
+ function Qe(l) {
1190
+ const { grid: e } = l, [t, i] = M(e.globalFilterValue), r = O(null);
1180
1191
  z(() => () => {
1181
1192
  r.current && clearTimeout(r.current);
1182
1193
  }, []);
1183
1194
  const o = k(
1184
1195
  (c) => {
1185
- const p = c.target.value;
1186
- i(p), r.current && clearTimeout(r.current), r.current = setTimeout(() => {
1187
- e.setGlobalFilter(p), r.current = null;
1196
+ const d = c.target.value;
1197
+ i(d), r.current && clearTimeout(r.current), r.current = setTimeout(() => {
1198
+ e.setGlobalFilter(d), r.current = null;
1188
1199
  }, 300);
1189
1200
  },
1190
1201
  [e]
1191
1202
  ), a = k(() => {
1192
1203
  i(""), e.setGlobalFilter("");
1193
- }, [e]), { filtered: h, total: u } = e.filterStats, l = e.hasActiveFilters && h !== u;
1194
- return /* @__PURE__ */ d(m, { component: "datagrid.topBar.globalFilter", children: [
1195
- l && /* @__PURE__ */ d(g, { component: "datagrid.topBar.globalFilter.stats", children: [
1196
- h,
1204
+ }, [e]), { filtered: u, total: h } = e.filterStats, s = e.hasActiveFilters && u !== h;
1205
+ return /* @__PURE__ */ p(m, { component: "datagrid.topBar.globalFilter", children: [
1206
+ s && /* @__PURE__ */ p(g, { component: "datagrid.topBar.globalFilter.stats", children: [
1207
+ u,
1197
1208
  "/",
1198
- u
1209
+ h
1199
1210
  ] }),
1200
- /* @__PURE__ */ d(m, { position: "relative", ai: "center", children: [
1211
+ /* @__PURE__ */ p(m, { position: "relative", ai: "center", children: [
1201
1212
  /* @__PURE__ */ n(m, { position: "absolute", left: 3, pointerEvents: "none", color: "gray-400", theme: { dark: { color: "gray-500" } }, children: /* @__PURE__ */ n(ze, { fill: "currentColor", width: "14px" }) }),
1202
1213
  /* @__PURE__ */ n(j, { placeholder: "Search...", variant: "compact", value: t, onChange: o, pl: 8, pr: t ? 8 : 3 }),
1203
1214
  t && /* @__PURE__ */ n(
@@ -1217,18 +1228,18 @@ function Qe(s) {
1217
1228
  ] })
1218
1229
  ] });
1219
1230
  }
1220
- function _e(s) {
1221
- const { grid: e } = s, i = X(
1231
+ function _e(l) {
1232
+ const { grid: e } = l, i = X(
1222
1233
  () => e.columns.value.leafs.filter(
1223
- (l) => ![V, G, _, T].includes(l.key)
1234
+ (s) => ![V, G, _, T].includes(s.key)
1224
1235
  ),
1225
1236
  [e.columns.value.leafs]
1226
- ).map((l) => ({
1227
- id: String(l.key),
1228
- label: l.header ?? l.key,
1229
- leaf: l
1230
- })), r = i.filter((l) => l.leaf.isVisible).map((l) => l.id), o = i.length, h = o - r.length > 0;
1231
- return /* @__PURE__ */ d(
1237
+ ).map((s) => ({
1238
+ id: String(s.key),
1239
+ label: s.header ?? s.key,
1240
+ leaf: s
1241
+ })), r = i.filter((s) => s.leaf.isVisible).map((s) => s.id), o = i.length, u = o - r.length > 0;
1242
+ return /* @__PURE__ */ p(
1232
1243
  b,
1233
1244
  {
1234
1245
  multiple: !0,
@@ -1236,10 +1247,10 @@ function _e(s) {
1236
1247
  hideIcon: !0,
1237
1248
  variant: "compact",
1238
1249
  value: r,
1239
- onChange: (l, c) => {
1240
- const p = new Set(c);
1250
+ onChange: (s, c) => {
1251
+ const d = new Set(c);
1241
1252
  i.forEach((f) => {
1242
- const y = p.has(f.id);
1253
+ const y = d.has(f.id);
1243
1254
  f.leaf.isVisible !== y && f.leaf.toggleVisibility();
1244
1255
  });
1245
1256
  },
@@ -1247,15 +1258,15 @@ function _e(s) {
1247
1258
  searchPlaceholder: "Search columns...",
1248
1259
  display: "inline-flex",
1249
1260
  children: [
1250
- /* @__PURE__ */ n(b.Display, { children: (l) => {
1251
- const c = l.length === 0;
1252
- return /* @__PURE__ */ d(m, { ai: "center", gap: 2, children: [
1253
- /* @__PURE__ */ d(fe, { viewBox: "0 0 20 20", width: "18", height: "18", children: [
1261
+ /* @__PURE__ */ n(b.Display, { children: (s) => {
1262
+ const c = s.length === 0;
1263
+ return /* @__PURE__ */ p(m, { ai: "center", gap: 2, children: [
1264
+ /* @__PURE__ */ p(fe, { viewBox: "0 0 20 20", width: "18", height: "18", children: [
1254
1265
  /* @__PURE__ */ n("rect", { x: "2", y: "3", width: "4", height: "14", rx: "1", fill: "currentColor", opacity: 0.9 }),
1255
1266
  /* @__PURE__ */ n("rect", { x: "8", y: "3", width: "4", height: "14", rx: "1", fill: "currentColor", opacity: 0.6 }),
1256
1267
  /* @__PURE__ */ n("rect", { x: "14", y: "3", width: "4", height: "14", rx: "1", fill: "currentColor", opacity: 0.3 })
1257
1268
  ] }),
1258
- h && /* @__PURE__ */ d(
1269
+ u && /* @__PURE__ */ p(
1259
1270
  g,
1260
1271
  {
1261
1272
  tag: "span",
@@ -1274,7 +1285,7 @@ function _e(s) {
1274
1285
  }
1275
1286
  },
1276
1287
  children: [
1277
- l.length,
1288
+ s.length,
1278
1289
  "/",
1279
1290
  o
1280
1291
  ]
@@ -1284,41 +1295,41 @@ function _e(s) {
1284
1295
  } }),
1285
1296
  /* @__PURE__ */ n(b.SelectAll, { children: "Show All" }),
1286
1297
  /* @__PURE__ */ n(b.Unselect, { children: "Hide All" }),
1287
- i.map((l) => /* @__PURE__ */ n(b.Item, { value: l.id, textWrap: "nowrap", children: l.label }, l.id))
1298
+ i.map((s) => /* @__PURE__ */ n(b.Item, { value: s.id, textWrap: "nowrap", children: s.label }, s.id))
1288
1299
  ]
1289
1300
  }
1290
1301
  );
1291
1302
  }
1292
1303
  _e.displayName = "DataGridTopBarContextMenu";
1293
- function Ve(s) {
1294
- const { grid: e } = s, { title: t, topBarContent: i, globalFilter: r } = e.props.def;
1295
- return /* @__PURE__ */ d(m, { component: "datagrid.topBar", position: "relative", ai: "center", jc: "space-between", gap: 4, flexWrap: "wrap", children: [
1296
- /* @__PURE__ */ d(m, { ai: "center", gap: 3, flexWrap: "wrap", minWidth: 0, children: [
1304
+ function Ve(l) {
1305
+ const { grid: e } = l, { title: t, topBarContent: i, globalFilter: r } = e.props.def;
1306
+ return /* @__PURE__ */ p(m, { component: "datagrid.topBar", position: "relative", ai: "center", jc: "space-between", gap: 4, flexWrap: "wrap", children: [
1307
+ /* @__PURE__ */ p(m, { ai: "center", gap: 3, flexWrap: "wrap", minWidth: 0, children: [
1297
1308
  /* @__PURE__ */ n(_e, { grid: e }),
1298
1309
  t && /* @__PURE__ */ n(g, { fontWeight: 600, fontSize: 16, color: "gray-800", theme: { dark: { color: "gray-100" } }, children: t }),
1299
1310
  /* @__PURE__ */ n(De, { grid: e })
1300
1311
  ] }),
1301
- /* @__PURE__ */ d(m, { ai: "center", gap: 3, flexWrap: "wrap", jc: "flex-end", minWidth: 0, children: [
1312
+ /* @__PURE__ */ p(m, { ai: "center", gap: 3, flexWrap: "wrap", jc: "flex-end", minWidth: 0, children: [
1302
1313
  i && /* @__PURE__ */ n(g, { children: i }),
1303
1314
  r && /* @__PURE__ */ n(Qe, { grid: e })
1304
1315
  ] })
1305
1316
  ] });
1306
1317
  }
1307
1318
  Ve.displayName = "DataGridTopBar";
1308
- function Ze(s) {
1319
+ function Ze(l) {
1309
1320
  const [e, t] = M(0), i = O();
1310
- return i.current || (i.current = new je(s, () => t((r) => r + 1))), z(() => {
1311
- i.current.props = s, i.current.rows.clear(), i.current.flatRows.clear(), i.current.update();
1312
- }, [s.data]), z(() => {
1313
- i.current.props = s, i.current.sourceColumns.clear(), i.current.columns.clear(), i.current.headerRows.clear(), i.current.gridTemplateColumns.clear(), i.current.rows.clear(), i.current.flatRows.clear(), i.current.sizes.clear(), i.current.update();
1314
- }, [s.def]), z(() => {
1315
- i.current.props = s, i.current.update();
1316
- }, [s.loading]), z(() => {
1317
- i.current.props = s, i.current.rows.clear(), i.current.flatRows.clear(), i.current.update();
1318
- }, [s.globalFilterValue, s.columnFilters]), i.current;
1321
+ return i.current || (i.current = new je(l, () => t((r) => r + 1))), z(() => {
1322
+ i.current.props = l, i.current.rows.clear(), i.current.flatRows.clear(), i.current.update();
1323
+ }, [l.data]), z(() => {
1324
+ i.current.props = l, i.current.sourceColumns.clear(), i.current.columns.clear(), i.current.headerRows.clear(), i.current.gridTemplateColumns.clear(), i.current.rows.clear(), i.current.flatRows.clear(), i.current.sizes.clear(), i.current.update();
1325
+ }, [l.def]), z(() => {
1326
+ i.current.props = l, i.current.update();
1327
+ }, [l.loading]), z(() => {
1328
+ i.current.props = l, i.current.rows.clear(), i.current.flatRows.clear(), i.current.update();
1329
+ }, [l.globalFilterValue, l.columnFilters, l.filters]), i.current;
1319
1330
  }
1320
- function et(s) {
1321
- const e = Ze(s), t = O(null);
1331
+ function et(l) {
1332
+ const e = Ze(l), t = O(null);
1322
1333
  return Pe(() => {
1323
1334
  const i = t.current;
1324
1335
  if (!i) return;
@@ -1327,7 +1338,7 @@ function et(s) {
1327
1338
  e.setContainerWidth(a);
1328
1339
  });
1329
1340
  return r.observe(i), () => r.disconnect();
1330
- }, [e]), console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render"), /* @__PURE__ */ d(g, { ref: t, component: "datagrid", style: e.sizes.value, props: { role: "presentation" }, children: [
1341
+ }, [e]), console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render"), /* @__PURE__ */ p(g, { ref: t, component: "datagrid", style: e.sizes.value, props: { role: "presentation" }, children: [
1331
1342
  e.props.def.topBar && /* @__PURE__ */ n(Ve, { grid: e }),
1332
1343
  /* @__PURE__ */ n(We, { grid: e }),
1333
1344
  e.props.def.bottomBar && /* @__PURE__ */ n(Oe, { grid: e })