@cronocode/react-box 3.1.8 → 3.1.9

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
19
  r ? `${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
  /**
@@ -416,12 +416,12 @@ class je {
416
416
  const t = (i, r, o) => {
417
417
  const a = r.values().next().value;
418
418
  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;
419
+ const u = this.columns.value.leafs.findOrThrow((h) => h.key === a);
420
+ return this._sortColumn === T && (i = i.sortBy((h) => h[a], this._sortDirection)), i.groupBy((h) => h[a]).map((h) => {
421
+ let s;
422
+ 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));
423
+ const c = new we(this, u, s, o, h.key);
424
+ return o += 1, c.expanded && (o += s.length), c;
425
425
  });
426
426
  };
427
427
  return t(e, new Set(this.groupColumns), 0);
@@ -461,19 +461,19 @@ class je {
461
461
  console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid flexWidths memo");
462
462
  const e = this._containerWidth;
463
463
  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)
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), u = e - r;
465
+ if (u <= a)
466
466
  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;
467
+ const h = {};
468
+ let s = 0;
469
+ return o.forEach((c, d) => {
470
+ if (d === o.length - 1)
471
+ h[c.key] = u - s;
472
472
  else {
473
- const f = Math.floor(c.baseWidth / a * h);
474
- u[c.key] = f, l += f;
473
+ const f = Math.floor(c.baseWidth / a * u);
474
+ h[c.key] = f, s += f;
475
475
  }
476
- }), u;
476
+ }), h;
477
477
  });
478
478
  getFlexWidth(e) {
479
479
  return this.flexWidths.value[e];
@@ -606,8 +606,8 @@ class we {
606
606
  this.grid.toggleGroupRow(this.key);
607
607
  }
608
608
  }
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;
609
+ function q(l) {
610
+ 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
611
  "align" in t.def && (r.jc = c);
612
612
  const N = o === G, S = o === _, x = o === V, L = a === "LEFT", C = a === "RIGHT";
613
613
  return /* @__PURE__ */ n(
@@ -617,10 +617,10 @@ function q(s) {
617
617
  props: { role: "cell" },
618
618
  variant: {
619
619
  isPinned: L || C,
620
- isFirstLeftPinned: L && h === 0,
621
- isLastLeftPinned: L && l,
622
- isFirstRightPinned: C && l,
623
- isLastRightPinned: C && u === 0,
620
+ isFirstLeftPinned: L && u === 0,
621
+ isLastLeftPinned: L && s,
622
+ isFirstRightPinned: C && s,
623
+ isLastRightPinned: C && h === 0,
624
624
  isRowSelection: S,
625
625
  isRowNumber: N,
626
626
  isFirstLeaf: v,
@@ -628,7 +628,7 @@ function q(s) {
628
628
  isEmptyCell: x
629
629
  },
630
630
  style: {
631
- width: `var(${p})`,
631
+ width: `var(${d})`,
632
632
  height: `var(${t.grid.rowHeightVarName})`,
633
633
  left: L ? `var(${f})` : void 0,
634
634
  right: C ? `var(${y})` : void 0,
@@ -640,13 +640,13 @@ function q(s) {
640
640
  );
641
641
  }
642
642
  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(() => {
643
+ function ye(l) {
644
+ const { row: e } = l, { selected: t, indeterminate: i, cells: r, groupingColumn: o, groupingColumnGridColumn: a, depth: u, expanded: h } = e, s = k(() => {
645
645
  e.grid.toggleRowsSelection(e.allRows.map((c) => c.key));
646
646
  }, []);
647
647
  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)
648
+ const { key: d, pin: f, groupColumnWidthVarName: y } = c.column, v = f === "RIGHT";
649
+ if (d === T)
650
650
  return /* @__PURE__ */ n(
651
651
  q,
652
652
  {
@@ -657,41 +657,45 @@ function ye(s) {
657
657
  },
658
658
  br: o.pin === "LEFT" ? 1 : void 0,
659
659
  gridColumn: a,
660
- pl: 4 * h,
660
+ pl: 4 * u,
661
661
  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 }),
662
+ 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: [
663
+ /* @__PURE__ */ n(ge, { fill: "currentColor", width: "14px", height: "14px", rotate: h ? 0 : -90 }),
664
664
  c.value
665
665
  ] }) })
666
666
  },
667
- p
667
+ d
668
668
  );
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);
669
+ if (d === _)
670
+ return /* @__PURE__ */ n(q, { column: c.column, children: /* @__PURE__ */ n(le, { variant: "datagrid", m: 1, checked: t, indeterminate: i, onChange: s }) }, d);
671
+ if (f !== o.pin || d === G || d === V)
672
+ return /* @__PURE__ */ n(q, { column: c.column, px: d === G ? 3 : void 0, children: c.value }, d);
673
673
  }) });
674
674
  }
675
675
  ye.displayName = "DataGridGroupRow";
676
- function ve(s) {
677
- const { cell: e } = s;
676
+ function ve(l) {
677
+ const { cell: e } = l;
678
678
  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
679
  }
680
680
  ve.displayName = "DataGridCellText";
681
- function be(s) {
682
- const { row: e } = s, { selected: t } = e;
681
+ function be(l) {
682
+ const { row: e } = l, { selected: t } = e;
683
683
  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
684
  }
685
685
  be.displayName = "DataGridRow";
686
686
  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(
687
+ function Re(l) {
688
+ 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(() => {
689
+ if (console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render rows"), u)
690
+ return null;
691
+ const s = o + de * 2;
692
+ 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));
693
+ }, [e.flatRows.value, u, r, o]);
694
+ if (console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render DataGridBody"), u) {
695
+ const { noDataComponent: s } = e.props.def, c = e.props.loading ? "loading..." : "empty";
696
+ return /* @__PURE__ */ n(m, { jc: "center", ai: "center", width: "fit", position: "sticky", left: 0, style: { height: a }, children: s ?? c });
697
+ }
698
+ return /* @__PURE__ */ n(g, { style: { height: a }, children: /* @__PURE__ */ n(
695
699
  g,
696
700
  {
697
701
  style: {
@@ -729,7 +733,7 @@ function Ye() {
729
733
  bgColor: "gray-50",
730
734
  borderRadius: 4,
731
735
  theme: { dark: { bgColor: "gray-900" } },
732
- children: /* @__PURE__ */ d(m, { d: "column", ai: "center", gap: 3, children: [
736
+ children: /* @__PURE__ */ p(m, { d: "column", ai: "center", gap: 3, children: [
733
737
  /* @__PURE__ */ n(
734
738
  g,
735
739
  {
@@ -751,7 +755,7 @@ function Ye() {
751
755
  ) })
752
756
  }
753
757
  ),
754
- /* @__PURE__ */ d(m, { d: "column", ai: "center", gap: 1, children: [
758
+ /* @__PURE__ */ p(m, { d: "column", ai: "center", gap: 1, children: [
755
759
  /* @__PURE__ */ n(g, { fontSize: 18, fontWeight: 600, color: "gray-900", theme: { dark: { color: "gray-50" } }, children: "No Columns Selected" }),
756
760
  /* @__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
761
  ] })
@@ -759,80 +763,80 @@ function Ye() {
759
763
  }
760
764
  );
761
765
  }
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);
766
+ function pe({ column: l, grid: e }) {
767
+ const t = e.columnFilters[l.key], i = t?.type === "text" ? t.value : "", [r, o] = M(i), a = O(null);
764
768
  z(() => () => {
765
769
  a.current && clearTimeout(a.current);
766
770
  }, []);
767
- const h = k(
771
+ const u = k(
768
772
  (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;
773
+ const d = c.target.value;
774
+ o(d), a.current && clearTimeout(a.current), a.current = setTimeout(() => {
775
+ d.trim() ? e.setColumnFilter(l.key, { type: "text", value: d }) : e.setColumnFilter(l.key, void 0), a.current = null;
772
776
  }, 300);
773
777
  },
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: "✕" }) })
778
+ [e, l.key]
779
+ ), h = k(() => {
780
+ o(""), e.setColumnFilter(l.key, void 0);
781
+ }, [e, l.key]), s = typeof l.def.filterable == "object" ? l.def.filterable : {};
782
+ return /* @__PURE__ */ p(m, { ai: "center", position: "relative", width: "fit", children: [
783
+ /* @__PURE__ */ n(j, { width: "fit", variant: "compact", placeholder: s.placeholder ?? "Filter...", value: r, onChange: u }),
784
+ 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
785
  ] });
782
786
  }
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);
787
+ function Ke({ column: l, grid: e }) {
788
+ 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
789
  z(() => () => {
786
790
  f.current && clearTimeout(f.current), y.current && clearTimeout(y.current);
787
791
  }, []);
788
- const v = typeof s.def.filterable == "object" ? s.def.filterable : {}, R = k(
792
+ const v = typeof l.def.filterable == "object" ? l.def.filterable : {}, R = k(
789
793
  (C, w, F) => {
790
794
  const W = typeof w == "number" ? w : parseFloat(w);
791
795
  if (isNaN(W) || w === "") {
792
- e.setColumnFilter(s.key, void 0);
796
+ e.setColumnFilter(l.key, void 0);
793
797
  return;
794
798
  }
795
- const B = {
799
+ const E = {
796
800
  type: "number",
797
801
  operator: C,
798
802
  value: W
799
803
  };
800
804
  if (C === "between" && F !== void 0 && F !== "") {
801
- const E = typeof F == "number" ? F : parseFloat(String(F));
802
- isNaN(E) || (B.valueTo = E);
805
+ const B = typeof F == "number" ? F : parseFloat(String(F));
806
+ isNaN(B) || (E.valueTo = B);
803
807
  }
804
- e.setColumnFilter(s.key, B);
808
+ e.setColumnFilter(l.key, E);
805
809
  },
806
- [e, s.key]
810
+ [e, l.key]
807
811
  ), N = k(
808
812
  (C) => {
809
813
  const w = C.target.value;
810
- h(w), f.current && clearTimeout(f.current), f.current = setTimeout(() => {
811
- R(u, w, c), f.current = null;
814
+ u(w), f.current && clearTimeout(f.current), f.current = setTimeout(() => {
815
+ R(h, w, c), f.current = null;
812
816
  }, 300);
813
817
  },
814
- [u, c, R]
818
+ [h, c, R]
815
819
  ), S = k(
816
820
  (C) => {
817
- l(C), R(C, a, c);
821
+ s(C), R(C, a, c);
818
822
  },
819
823
  [a, c, R]
820
824
  ), x = k(
821
825
  (C) => {
822
826
  const w = C.target.value;
823
- p(w), y.current && clearTimeout(y.current), y.current = setTimeout(() => {
824
- R(u, a, w), y.current = null;
827
+ d(w), y.current && clearTimeout(y.current), y.current = setTimeout(() => {
828
+ R(h, a, w), y.current = null;
825
829
  }, 300);
826
830
  },
827
- [u, a, R]
831
+ [h, a, R]
828
832
  ), 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(
833
+ u(""), d(""), s("eq"), e.setColumnFilter(l.key, void 0);
834
+ }, [e, l.key]);
835
+ return /* @__PURE__ */ p(m, { ai: h === "between" ? "start" : "center", gap: 1, width: "fit", children: [
836
+ /* @__PURE__ */ p(
833
837
  b,
834
838
  {
835
- value: u,
839
+ value: h,
836
840
  variant: "compact",
837
841
  onChange: (C) => C && S(C),
838
842
  minWidth: 6,
@@ -848,8 +852,8 @@ function Ke({ column: s, grid: e }) {
848
852
  ]
849
853
  }
850
854
  ),
851
- u === "between" ? /* @__PURE__ */ d(m, { d: "column", gap: 1, flex1: !0, children: [
852
- /* @__PURE__ */ d(m, { ai: "center", position: "relative", flex1: !0, children: [
855
+ h === "between" ? /* @__PURE__ */ p(m, { d: "column", gap: 1, flex1: !0, children: [
856
+ /* @__PURE__ */ p(m, { ai: "center", position: "relative", flex1: !0, children: [
853
857
  /* @__PURE__ */ n(
854
858
  j,
855
859
  {
@@ -876,7 +880,7 @@ function Ke({ column: s, grid: e }) {
876
880
  step: v.step
877
881
  }
878
882
  ) })
879
- ] }) : /* @__PURE__ */ d(m, { ai: "center", position: "relative", flex1: !0, children: [
883
+ ] }) : /* @__PURE__ */ p(m, { ai: "center", position: "relative", flex1: !0, children: [
880
884
  /* @__PURE__ */ n(
881
885
  j,
882
886
  {
@@ -893,17 +897,17 @@ function Ke({ column: s, grid: e }) {
893
897
  ] })
894
898
  ] });
895
899
  }
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 });
900
+ function Je({ column: l, grid: e }) {
901
+ 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) => ({
902
+ label: h === null ? "(empty)" : String(h),
903
+ value: h
904
+ })), [r.options, e, l.key]), a = k(
905
+ (u, h) => {
906
+ h.length === 0 ? e.setColumnFilter(l.key, void 0) : e.setColumnFilter(l.key, { type: "multiselect", values: h });
903
907
  },
904
- [e, s.key]
908
+ [e, l.key]
905
909
  );
906
- return /* @__PURE__ */ d(
910
+ return /* @__PURE__ */ p(
907
911
  b,
908
912
  {
909
913
  multiple: !0,
@@ -918,13 +922,13 @@ function Je({ column: s, grid: e }) {
918
922
  children: [
919
923
  /* @__PURE__ */ n(b.Unselect, { children: "Clear" }),
920
924
  /* @__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)))
925
+ o.map((u) => /* @__PURE__ */ n(b.Item, { value: u.value, ai: "center", gap: 2, children: u.label }, String(u.value)))
922
926
  ]
923
927
  }
924
928
  );
925
929
  }
926
- function xe(s) {
927
- const { column: e, grid: t } = s, { filterable: i } = e.def;
930
+ function xe(l) {
931
+ const { column: e, grid: t } = l, { filterable: i } = e.def;
928
932
  if (!i) return null;
929
933
  switch ((typeof i == "object" ? i : { type: "text" }).type) {
930
934
  case "text":
@@ -938,40 +942,40 @@ function xe(s) {
938
942
  }
939
943
  }
940
944
  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";
945
+ function Fe(l) {
946
+ 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
947
  return /* @__PURE__ */ n(
944
948
  m,
945
949
  {
946
950
  component: "datagrid.filter.cell",
947
- variant: { isPinned: S || x, isFirstLeftPinned: S && o === 0, isLastLeftPinned: S && h, isFirstRightPinned: x && h, isLastRightPinned: x && a === 0 },
951
+ variant: { isPinned: S || x, isFirstLeftPinned: S && o === 0, isLastLeftPinned: S && u, isFirstRightPinned: x && u, isLastRightPinned: x && a === 0 },
948
952
  px: f ? 0 : 2,
949
953
  style: {
950
- width: `var(${u})`,
951
- left: S ? `var(${l})` : void 0,
954
+ width: `var(${h})`,
955
+ left: S ? `var(${s})` : void 0,
952
956
  right: x ? `var(${c})` : void 0
953
957
  },
954
- children: !N && p && /* @__PURE__ */ n(xe, { column: e, grid: t })
958
+ children: !N && d && /* @__PURE__ */ n(xe, { column: e, grid: t })
955
959
  }
956
960
  );
957
961
  }
958
962
  Fe.displayName = "DataGridFilterCell";
959
- function ke(s) {
960
- const { grid: e } = s, { visibleLeafs: t } = e.columns.value;
963
+ function ke(l) {
964
+ const { grid: e } = l, { visibleLeafs: t } = e.columns.value;
961
965
  return t.some((r) => r.filterable) ? t.map((r) => /* @__PURE__ */ n(Fe, { column: r, grid: e }, r.uniqueKey)) : null;
962
966
  }
963
967
  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(
968
+ function Ge(l) {
969
+ 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;
970
+ return /* @__PURE__ */ n(m, { position: "absolute", left: ee, right: te, top: "1/2", translateY: -3, ai: "center", children: /* @__PURE__ */ p(
967
971
  D,
968
972
  {
969
973
  component: "datagrid.header.cell.contextMenu",
970
- onClick: () => f(!p),
974
+ onClick: () => f(!d),
971
975
  variant: { isPinned: re, isFirstLeftPinned: Z, isLastLeftPinned: ne, isFirstRightPinned: H, isLastRightPinned: U, isSortable: Ne, isRowNumber: J },
972
976
  children: [
973
977
  /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.icon", children: /* @__PURE__ */ n(He, { fill: "currentColor" }) }),
974
- p && /* @__PURE__ */ d(
978
+ d && /* @__PURE__ */ p(
975
979
  Ae,
976
980
  {
977
981
  component: "datagrid.header.cell.contextMenu.tooltip",
@@ -980,40 +984,40 @@ function Ge(s) {
980
984
  adjustTranslateX: N ? "-100%" : "-21px",
981
985
  adjustTranslateY: "16px",
982
986
  children: [
983
- S && /* @__PURE__ */ d(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn("ASC"), children: [
987
+ S && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn("ASC"), children: [
984
988
  /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(oe, { width: "100%", fill: "currentColor" }) }),
985
989
  "Sort Ascending"
986
990
  ] }),
987
- x && /* @__PURE__ */ d(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn("DESC"), children: [
991
+ x && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn("DESC"), children: [
988
992
  /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(oe, { width: "100%", fill: "currentColor", rotate: 180 }) }),
989
993
  "Sort Descending"
990
994
  ] }),
991
- L && /* @__PURE__ */ d(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn(void 0), children: [
995
+ L && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn(void 0), children: [
992
996
  /* @__PURE__ */ n(g, { width: 4 }),
993
997
  "Clear Sort"
994
998
  ] }),
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: [
999
+ B && (Y || W || E) && /* @__PURE__ */ n(g, { bb: 1, my: 2, borderColor: "gray-300", component: "datagrid.header.cell.contextMenu.tooltip.item.separator" }),
1000
+ C && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn("LEFT"), children: [
997
1001
  /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(ce, { width: "100%", fill: "currentColor" }) }),
998
1002
  "Pin Left"
999
1003
  ] }),
1000
- w && /* @__PURE__ */ d(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn("RIGHT"), children: [
1004
+ w && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn("RIGHT"), children: [
1001
1005
  /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(ce, { width: "100%", fill: "currentColor", rotate: -90 }) }),
1002
1006
  "Pin Right"
1003
1007
  ] }),
1004
- F && /* @__PURE__ */ d(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn(), children: [
1008
+ F && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn(), children: [
1005
1009
  /* @__PURE__ */ n(g, { width: 4 }),
1006
1010
  "Unpin"
1007
1011
  ] }),
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: [
1012
+ B && Y && (W || E) && /* @__PURE__ */ n(g, { component: "datagrid.header.cell.contextMenu.tooltip.item.separator" }),
1013
+ W && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: e.toggleGrouping, children: [
1010
1014
  /* @__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: [
1015
+ /* @__PURE__ */ p(g, { textWrap: "nowrap", children: [
1012
1016
  "Group by ",
1013
- l ?? t
1017
+ s ?? t
1014
1018
  ] })
1015
1019
  ] }),
1016
- B && /* @__PURE__ */ d(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: c.unGroupAll, children: [
1020
+ E && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: c.unGroupAll, children: [
1017
1021
  /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(se, { width: "100%", fill: "currentColor" }) }),
1018
1022
  /* @__PURE__ */ n(g, { textWrap: "nowrap", children: "Un-Group All" })
1019
1023
  ] })
@@ -1025,8 +1029,8 @@ function Ge(s) {
1025
1029
  ) });
1026
1030
  }
1027
1031
  Ge.displayName = "DataGridHeaderCellContextMenu";
1028
- function Se(s) {
1029
- const { column: e } = s;
1032
+ function Se(l) {
1033
+ const { column: e } = l;
1030
1034
  return /* @__PURE__ */ n(
1031
1035
  m,
1032
1036
  {
@@ -1052,49 +1056,49 @@ function Se(s) {
1052
1056
  );
1053
1057
  }
1054
1058
  Se.displayName = "DataGridHeaderCellResizer";
1055
- function Le(s) {
1056
- const { column: e } = s, {
1059
+ function Le(l) {
1060
+ const { column: e } = l, {
1057
1061
  key: t,
1058
1062
  pin: i,
1059
1063
  left: r,
1060
1064
  right: o,
1061
1065
  isEdge: a,
1062
- isLeaf: h,
1063
- leafs: u,
1064
- grid: l,
1066
+ isLeaf: u,
1067
+ leafs: h,
1068
+ grid: s,
1065
1069
  header: c,
1066
- gridRows: p,
1070
+ gridRows: d,
1067
1071
  widthVarName: f,
1068
1072
  leftVarName: y,
1069
1073
  rightVarName: v,
1070
1074
  inlineWidth: R,
1071
1075
  isFirstLeaf: N,
1072
1076
  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();
1077
+ } = 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(() => {
1078
+ s.toggleSelectAllRows();
1075
1079
  }, []), ne = X(() => {
1076
1080
  if (C) return null;
1077
1081
  if (w) {
1078
- const H = l.selectedRows.size === l.props.data.length, U = !H && l.selectedRows.size > 0;
1082
+ const H = s.selectedRows.size === s.props.data.length, U = !H && s.selectedRows.size > 0;
1079
1083
  return /* @__PURE__ */ n(le, { variant: "datagrid", m: 1, indeterminate: U, checked: H, onChange: Z });
1080
1084
  }
1081
1085
  if (L) {
1082
- if (l.groupColumns.size === 1) {
1083
- const H = l.columns.value.leafs.findOrThrow((U) => U.key === l.groupColumns.values().next().value);
1086
+ if (s.groupColumns.size === 1) {
1087
+ const H = s.columns.value.leafs.findOrThrow((U) => U.key === s.groupColumns.values().next().value);
1084
1088
  return H.header ?? H.key;
1085
1089
  }
1086
1090
  return "Group";
1087
1091
  }
1088
1092
  return c ?? t;
1089
- }, [l.groupColumns, l.selectedRows, Z]);
1093
+ }, [s.groupColumns, s.selectedRows, Z]);
1090
1094
  return /* @__PURE__ */ n(
1091
1095
  m,
1092
1096
  {
1093
1097
  props: { role: "columnheader" },
1094
1098
  component: "datagrid.header.cell",
1095
1099
  variant: {
1096
- isPinned: B,
1097
- isFirstLeftPinned: E,
1100
+ isPinned: E,
1101
+ isFirstLeftPinned: B,
1098
1102
  isLastLeftPinned: Y,
1099
1103
  isFirstRightPinned: ee,
1100
1104
  isLastRightPinned: te,
@@ -1104,29 +1108,29 @@ function Le(s) {
1104
1108
  isLastLeaf: S,
1105
1109
  isEmptyCell: x
1106
1110
  },
1107
- gridRow: p,
1111
+ gridRow: d,
1108
1112
  gridColumn: J,
1109
1113
  style: {
1110
1114
  width: `var(${f})`,
1111
1115
  left: F ? `var(${y})` : void 0,
1112
1116
  right: W ? `var(${v})` : void 0
1113
1117
  },
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(
1118
+ children: !x && /* @__PURE__ */ p(Ee, { children: [
1119
+ /* @__PURE__ */ n(m, { width: "fit", height: "fit", jc: e.align, props: { onClick: K ? () => e.sortColumn() : void 0 }, children: /* @__PURE__ */ p(
1116
1120
  m,
1117
1121
  {
1118
1122
  overflow: "hidden",
1119
- position: h ? void 0 : "sticky",
1123
+ position: u ? void 0 : "sticky",
1120
1124
  ai: "center",
1121
1125
  transition: "none",
1122
1126
  pl: Q,
1123
1127
  pr: re,
1124
1128
  style: {
1125
- left: i ? void 0 : `var(${l.leftEdgeVarName})`
1129
+ left: i ? void 0 : `var(${s.leftEdgeVarName})`
1126
1130
  },
1127
1131
  children: [
1128
1132
  /* @__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" }) }),
1133
+ 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
1134
  $ && /* @__PURE__ */ n(g, { minWidth: e.align === "right" ? 4 : 10 })
1131
1135
  ]
1132
1136
  }
@@ -1138,35 +1142,35 @@ function Le(s) {
1138
1142
  );
1139
1143
  }
1140
1144
  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: [
1145
+ function Te(l) {
1146
+ const { grid: e } = l;
1147
+ return /* @__PURE__ */ p(me, { component: "datagrid.header", style: { gridTemplateColumns: e.gridTemplateColumns.value }, children: [
1144
1148
  e.headerRows.value.map((t) => t.map((i) => /* @__PURE__ */ n(Le, { column: i }, i.uniqueKey))),
1145
1149
  /* @__PURE__ */ n(ke, { grid: e })
1146
1150
  ] });
1147
1151
  }
1148
1152
  Te.displayName = "DataGridHeader";
1149
- function We(s) {
1150
- const { grid: e } = s, [t, i] = M(0), r = O(null), o = k((h) => {
1153
+ function We(l) {
1154
+ const { grid: e } = l, [t, i] = M(0), r = O(null), o = k((u) => {
1151
1155
  r.current !== null && cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
1152
- i(h.target.scrollTop), r.current = null;
1156
+ i(u.target.scrollTop), r.current = null;
1153
1157
  });
1154
1158
  }, []);
1155
- return e.columns.value.userVisibleLeafs.length > 0 ? /* @__PURE__ */ d(g, { overflowX: "scroll", style: { willChange: "scroll-position" }, props: { onScroll: o }, children: [
1159
+ return e.columns.value.userVisibleLeafs.length > 0 ? /* @__PURE__ */ p(g, { overflowX: "scroll", style: { willChange: "scroll-position" }, props: { onScroll: o }, children: [
1156
1160
  /* @__PURE__ */ n(Te, { grid: e }),
1157
1161
  /* @__PURE__ */ n(Re, { grid: e, scrollTop: t })
1158
1162
  ] }) : /* @__PURE__ */ n(Ye, {});
1159
1163
  }
1160
1164
  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: [
1165
+ function De(l) {
1166
+ const { grid: e } = l;
1167
+ return e.groupColumns.size === 0 ? null : /* @__PURE__ */ p(m, { component: "datagrid.topBar.columnGroups", children: [
1164
1168
  /* @__PURE__ */ n(I, { component: "datagrid.topBar.columnGroups.icon", children: /* @__PURE__ */ n(se, { width: "100%", fill: "currentColor" }) }),
1165
1169
  Array.from(e.groupColumns, (t) => {
1166
1170
  const i = e.columns.value.leafs.findOrThrow((r) => r.key === t);
1167
- return /* @__PURE__ */ d(Ee.Fragment, { children: [
1171
+ return /* @__PURE__ */ p(Be.Fragment, { children: [
1168
1172
  /* @__PURE__ */ n(ge, { fill: "currentColor", width: "14px", height: "14px", rotate: -90 }),
1169
- /* @__PURE__ */ d(m, { component: "datagrid.topBar.columnGroups.item", children: [
1173
+ /* @__PURE__ */ p(m, { component: "datagrid.topBar.columnGroups.item", children: [
1170
1174
  i.header ?? i.key,
1171
1175
  /* @__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
1176
  ] })
@@ -1175,29 +1179,29 @@ function De(s) {
1175
1179
  ] });
1176
1180
  }
1177
1181
  De.displayName = "DataGridColumnGroups";
1178
- function Qe(s) {
1179
- const { grid: e } = s, [t, i] = M(e.globalFilterValue), r = O(null);
1182
+ function Qe(l) {
1183
+ const { grid: e } = l, [t, i] = M(e.globalFilterValue), r = O(null);
1180
1184
  z(() => () => {
1181
1185
  r.current && clearTimeout(r.current);
1182
1186
  }, []);
1183
1187
  const o = k(
1184
1188
  (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;
1189
+ const d = c.target.value;
1190
+ i(d), r.current && clearTimeout(r.current), r.current = setTimeout(() => {
1191
+ e.setGlobalFilter(d), r.current = null;
1188
1192
  }, 300);
1189
1193
  },
1190
1194
  [e]
1191
1195
  ), a = k(() => {
1192
1196
  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,
1197
+ }, [e]), { filtered: u, total: h } = e.filterStats, s = e.hasActiveFilters && u !== h;
1198
+ return /* @__PURE__ */ p(m, { component: "datagrid.topBar.globalFilter", children: [
1199
+ s && /* @__PURE__ */ p(g, { component: "datagrid.topBar.globalFilter.stats", children: [
1200
+ u,
1197
1201
  "/",
1198
- u
1202
+ h
1199
1203
  ] }),
1200
- /* @__PURE__ */ d(m, { position: "relative", ai: "center", children: [
1204
+ /* @__PURE__ */ p(m, { position: "relative", ai: "center", children: [
1201
1205
  /* @__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
1206
  /* @__PURE__ */ n(j, { placeholder: "Search...", variant: "compact", value: t, onChange: o, pl: 8, pr: t ? 8 : 3 }),
1203
1207
  t && /* @__PURE__ */ n(
@@ -1217,18 +1221,18 @@ function Qe(s) {
1217
1221
  ] })
1218
1222
  ] });
1219
1223
  }
1220
- function _e(s) {
1221
- const { grid: e } = s, i = X(
1224
+ function _e(l) {
1225
+ const { grid: e } = l, i = X(
1222
1226
  () => e.columns.value.leafs.filter(
1223
- (l) => ![V, G, _, T].includes(l.key)
1227
+ (s) => ![V, G, _, T].includes(s.key)
1224
1228
  ),
1225
1229
  [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(
1230
+ ).map((s) => ({
1231
+ id: String(s.key),
1232
+ label: s.header ?? s.key,
1233
+ leaf: s
1234
+ })), r = i.filter((s) => s.leaf.isVisible).map((s) => s.id), o = i.length, u = o - r.length > 0;
1235
+ return /* @__PURE__ */ p(
1232
1236
  b,
1233
1237
  {
1234
1238
  multiple: !0,
@@ -1236,10 +1240,10 @@ function _e(s) {
1236
1240
  hideIcon: !0,
1237
1241
  variant: "compact",
1238
1242
  value: r,
1239
- onChange: (l, c) => {
1240
- const p = new Set(c);
1243
+ onChange: (s, c) => {
1244
+ const d = new Set(c);
1241
1245
  i.forEach((f) => {
1242
- const y = p.has(f.id);
1246
+ const y = d.has(f.id);
1243
1247
  f.leaf.isVisible !== y && f.leaf.toggleVisibility();
1244
1248
  });
1245
1249
  },
@@ -1247,15 +1251,15 @@ function _e(s) {
1247
1251
  searchPlaceholder: "Search columns...",
1248
1252
  display: "inline-flex",
1249
1253
  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: [
1254
+ /* @__PURE__ */ n(b.Display, { children: (s) => {
1255
+ const c = s.length === 0;
1256
+ return /* @__PURE__ */ p(m, { ai: "center", gap: 2, children: [
1257
+ /* @__PURE__ */ p(fe, { viewBox: "0 0 20 20", width: "18", height: "18", children: [
1254
1258
  /* @__PURE__ */ n("rect", { x: "2", y: "3", width: "4", height: "14", rx: "1", fill: "currentColor", opacity: 0.9 }),
1255
1259
  /* @__PURE__ */ n("rect", { x: "8", y: "3", width: "4", height: "14", rx: "1", fill: "currentColor", opacity: 0.6 }),
1256
1260
  /* @__PURE__ */ n("rect", { x: "14", y: "3", width: "4", height: "14", rx: "1", fill: "currentColor", opacity: 0.3 })
1257
1261
  ] }),
1258
- h && /* @__PURE__ */ d(
1262
+ u && /* @__PURE__ */ p(
1259
1263
  g,
1260
1264
  {
1261
1265
  tag: "span",
@@ -1274,7 +1278,7 @@ function _e(s) {
1274
1278
  }
1275
1279
  },
1276
1280
  children: [
1277
- l.length,
1281
+ s.length,
1278
1282
  "/",
1279
1283
  o
1280
1284
  ]
@@ -1284,41 +1288,41 @@ function _e(s) {
1284
1288
  } }),
1285
1289
  /* @__PURE__ */ n(b.SelectAll, { children: "Show All" }),
1286
1290
  /* @__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))
1291
+ i.map((s) => /* @__PURE__ */ n(b.Item, { value: s.id, textWrap: "nowrap", children: s.label }, s.id))
1288
1292
  ]
1289
1293
  }
1290
1294
  );
1291
1295
  }
1292
1296
  _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: [
1297
+ function Ve(l) {
1298
+ const { grid: e } = l, { title: t, topBarContent: i, globalFilter: r } = e.props.def;
1299
+ return /* @__PURE__ */ p(m, { component: "datagrid.topBar", position: "relative", ai: "center", jc: "space-between", gap: 4, flexWrap: "wrap", children: [
1300
+ /* @__PURE__ */ p(m, { ai: "center", gap: 3, flexWrap: "wrap", minWidth: 0, children: [
1297
1301
  /* @__PURE__ */ n(_e, { grid: e }),
1298
1302
  t && /* @__PURE__ */ n(g, { fontWeight: 600, fontSize: 16, color: "gray-800", theme: { dark: { color: "gray-100" } }, children: t }),
1299
1303
  /* @__PURE__ */ n(De, { grid: e })
1300
1304
  ] }),
1301
- /* @__PURE__ */ d(m, { ai: "center", gap: 3, flexWrap: "wrap", jc: "flex-end", minWidth: 0, children: [
1305
+ /* @__PURE__ */ p(m, { ai: "center", gap: 3, flexWrap: "wrap", jc: "flex-end", minWidth: 0, children: [
1302
1306
  i && /* @__PURE__ */ n(g, { children: i }),
1303
1307
  r && /* @__PURE__ */ n(Qe, { grid: e })
1304
1308
  ] })
1305
1309
  ] });
1306
1310
  }
1307
1311
  Ve.displayName = "DataGridTopBar";
1308
- function Ze(s) {
1312
+ function Ze(l) {
1309
1313
  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;
1314
+ return i.current || (i.current = new je(l, () => t((r) => r + 1))), z(() => {
1315
+ i.current.props = l, i.current.rows.clear(), i.current.flatRows.clear(), i.current.update();
1316
+ }, [l.data]), z(() => {
1317
+ 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();
1318
+ }, [l.def]), z(() => {
1319
+ i.current.props = l, i.current.update();
1320
+ }, [l.loading]), z(() => {
1321
+ i.current.props = l, i.current.rows.clear(), i.current.flatRows.clear(), i.current.update();
1322
+ }, [l.globalFilterValue, l.columnFilters]), i.current;
1319
1323
  }
1320
- function et(s) {
1321
- const e = Ze(s), t = O(null);
1324
+ function et(l) {
1325
+ const e = Ze(l), t = O(null);
1322
1326
  return Pe(() => {
1323
1327
  const i = t.current;
1324
1328
  if (!i) return;
@@ -1327,7 +1331,7 @@ function et(s) {
1327
1331
  e.setContainerWidth(a);
1328
1332
  });
1329
1333
  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: [
1334
+ }, [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
1335
  e.props.def.topBar && /* @__PURE__ */ n(Ve, { grid: e }),
1332
1336
  /* @__PURE__ */ n(We, { grid: e }),
1333
1337
  e.props.def.bottomBar && /* @__PURE__ */ n(Oe, { grid: e })