@cronocode/react-box 3.1.10 → 3.1.11

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,43 +1,172 @@
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
- import g from "../box.mjs";
4
- import m from "./flex.mjs";
5
- import me from "./grid.mjs";
6
- import { F as Ie, m as P, f as ae, E as ge, b as Me, D as He, S as oe, P as ce, G as se, d as ze } from "../core.mjs";
7
- import le from "./checkbox.mjs";
8
- import D from "./button.mjs";
9
- import fe from "./baseSvg.mjs";
10
- import b from "./dropdown.mjs";
11
- import j from "./textbox.mjs";
12
- import { Span as I } from "./semantics.mjs";
13
- import Ae from "./tooltip.mjs";
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: [
1
+ import { jsxs as d, jsx as o, Fragment as Ae } from "react/jsx-runtime";
2
+ import Oe, { useCallback as v, useMemo as X, useState as I, useRef as H, useEffect as de, useLayoutEffect as Ue } from "react";
3
+ import m from "../box.mjs";
4
+ import g from "./flex.mjs";
5
+ import U from "./baseSvg.mjs";
6
+ import L from "./button.mjs";
7
+ import ce from "./grid.mjs";
8
+ import { E as pe, F as je, m as B, f as ge, b as qe, D as Ke, S as he, P as fe, G as ue, d as Xe } from "../core.mjs";
9
+ import me from "./checkbox.mjs";
10
+ import x from "./dropdown.mjs";
11
+ import q from "./textbox.mjs";
12
+ import { Span as $ } from "./semantics.mjs";
13
+ import Ye from "./tooltip.mjs";
14
+ function Re(s) {
15
+ const { grid: e } = s, t = e.paginationState, i = t?.page ?? 1, n = t?.totalPages ?? 1, r = i <= 1, c = i >= n, h = v(() => !r && e.changePage(1), [e, r]), u = v(() => !r && e.changePage(i - 1), [e, i, r]), a = v(() => !c && e.changePage(i + 1), [e, i, c]), l = v(() => !c && e.changePage(n), [e, n, c]);
16
+ return t ? /* @__PURE__ */ d(g, { component: `${e.componentName}.bottomBar.pagination`, gap: 0.5, ai: "center", children: [
17
+ /* @__PURE__ */ o(ie, { onClick: h, disabled: r, children: /* @__PURE__ */ o(Ze, {}) }),
18
+ /* @__PURE__ */ o(ie, { onClick: u, disabled: r, children: /* @__PURE__ */ o(Je, {}) }),
19
+ /* @__PURE__ */ d(m, { fontSize: 12, px: 3, userSelect: "none", children: [
20
+ i,
21
+ " of ",
22
+ n
23
+ ] }),
24
+ /* @__PURE__ */ o(ie, { onClick: a, disabled: c, children: /* @__PURE__ */ o(Qe, {}) }),
25
+ /* @__PURE__ */ o(ie, { onClick: l, disabled: c, children: /* @__PURE__ */ o(et, {}) })
26
+ ] }) : null;
27
+ }
28
+ Re.displayName = "DataGridPagination";
29
+ function ie(s) {
30
+ const { onClick: e, disabled: t, children: i } = s;
31
+ return /* @__PURE__ */ o(
32
+ L,
33
+ {
34
+ clean: !0,
35
+ onClick: e,
36
+ cursor: t ? "default" : "pointer",
37
+ p: 1,
38
+ borderRadius: 4,
39
+ opacity: t ? 0.3 : 0.7,
40
+ hover: t ? void 0 : { opacity: 1, bgColor: "gray-100" },
41
+ theme: { dark: { hover: t ? void 0 : { bgColor: "gray-700" } } },
42
+ transition: "all",
43
+ transitionDuration: 150,
44
+ children: i
45
+ }
46
+ );
47
+ }
48
+ function Je() {
49
+ return /* @__PURE__ */ o(U, { viewBox: "0 0 24 24", width: "14", height: "14", children: /* @__PURE__ */ o(
50
+ m,
51
+ {
52
+ tag: "path",
53
+ props: { d: "M15 18l-6-6 6-6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }
54
+ }
55
+ ) });
56
+ }
57
+ function Qe() {
58
+ return /* @__PURE__ */ o(U, { viewBox: "0 0 24 24", width: "14", height: "14", children: /* @__PURE__ */ o(
59
+ m,
60
+ {
61
+ tag: "path",
62
+ props: { d: "M9 18l6-6-6-6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }
63
+ }
64
+ ) });
65
+ }
66
+ function Ze() {
67
+ return /* @__PURE__ */ o(U, { viewBox: "0 0 24 24", width: "14", height: "14", children: /* @__PURE__ */ o(
68
+ m,
69
+ {
70
+ tag: "path",
71
+ props: {
72
+ d: "M18 18l-6-6 6-6M11 18l-6-6 6-6",
73
+ stroke: "currentColor",
74
+ strokeWidth: "2",
75
+ strokeLinecap: "round",
76
+ strokeLinejoin: "round"
77
+ }
78
+ }
79
+ ) });
80
+ }
81
+ function et() {
82
+ return /* @__PURE__ */ o(U, { viewBox: "0 0 24 24", width: "14", height: "14", children: /* @__PURE__ */ o(
83
+ m,
84
+ {
85
+ tag: "path",
86
+ props: {
87
+ d: "M6 18l6-6-6-6M13 18l6-6-6-6",
88
+ stroke: "currentColor",
89
+ strokeWidth: "2",
90
+ strokeLinecap: "round",
91
+ strokeLinejoin: "round"
92
+ }
93
+ }
94
+ ) });
95
+ }
96
+ function tt(s) {
97
+ const { grid: e } = s, t = e.paginationState;
98
+ if (t) {
99
+ const { page: c, pageSize: h, totalItems: u } = t, a = (c - 1) * h + 1, l = Math.min(a + h - 1, u);
100
+ return /* @__PURE__ */ d(g, { component: `${e.componentName}.bottomBar`, children: [
101
+ /* @__PURE__ */ d(m, { children: [
102
+ "Rows: ",
103
+ u > 0 ? `${a}–${l} of ${u}` : "0"
104
+ ] }),
105
+ e.props.def.rowSelection && /* @__PURE__ */ d(m, { children: [
106
+ "Selected: ",
107
+ e.selectedRows.size
108
+ ] }),
109
+ /* @__PURE__ */ o(Re, { grid: e })
110
+ ] });
111
+ }
112
+ const { filtered: i, total: n } = e.filterStats, r = e.hasActiveFilters;
113
+ return /* @__PURE__ */ d(g, { component: `${e.componentName}.bottomBar`, children: [
114
+ /* @__PURE__ */ d(m, { children: [
18
115
  "Rows: ",
19
- t !== i ? `${t} / ${i}` : i
116
+ i !== n ? `${i} / ${n}` : n
20
117
  ] }),
21
- e.props.def.rowSelection && /* @__PURE__ */ p(g, { children: [
118
+ e.props.def.rowSelection && /* @__PURE__ */ d(m, { children: [
22
119
  "Selected: ",
23
120
  e.selectedRows.size
24
121
  ] }),
25
- r && /* @__PURE__ */ n(g, { color: "blue-600", cursor: "pointer", hover: { textDecoration: "underline" }, props: { onClick: e.clearAllFilters }, children: "Clear filters" })
122
+ r && /* @__PURE__ */ o(m, { color: "blue-600", cursor: "pointer", hover: { textDecoration: "underline" }, props: { onClick: e.clearAllFilters }, children: "Clear filters" })
26
123
  ] });
27
124
  }
28
- function Ce(l) {
29
- const { cell: e } = l, t = k(() => {
125
+ class Y {
126
+ constructor(e, t) {
127
+ this.grid = e, this.parentRow = t;
128
+ }
129
+ get key() {
130
+ return `detail-${this.parentRow.key}`;
131
+ }
132
+ static AUTO_HEIGHT_ESTIMATE = 200;
133
+ get height() {
134
+ const e = this.grid.props.def.rowDetail;
135
+ return !e || e.height === void 0 || e.height === "auto" ? "auto" : typeof e.height == "function" ? e.height(this.parentRow.data) : e.height;
136
+ }
137
+ /** Numeric height for virtualization offset calculations. Uses estimate for 'auto'. */
138
+ get heightForOffset() {
139
+ const e = this.height;
140
+ return e === "auto" ? Y.AUTO_HEIGHT_ESTIMATE : e;
141
+ }
142
+ count = 0;
143
+ get flatRows() {
144
+ return [this];
145
+ }
146
+ get allRows() {
147
+ return [];
148
+ }
149
+ }
150
+ function xe(s) {
151
+ const { cell: e } = s, t = e.grid.expandedDetailRows.has(e.row.key), i = v(() => {
152
+ e.grid.toggleDetailRow(e.row.key);
153
+ }, [e.grid, e.row.key]);
154
+ return /* @__PURE__ */ o(L, { clean: !0, onClick: i, cursor: "pointer", display: "flex", ai: "center", jc: "center", children: /* @__PURE__ */ o(pe, { fill: "currentColor", width: "14px", height: "14px", rotate: t ? 0 : -90 }) });
155
+ }
156
+ xe.displayName = "DataGridCellRowDetail";
157
+ function ke(s) {
158
+ const { cell: e } = s, t = v(() => {
30
159
  e.grid.toggleRowSelection(e.row.key);
31
160
  }, [e.grid, e.row.key]);
32
- return /* @__PURE__ */ n(le, { variant: "datagrid", checked: e.row.selected, onChange: t });
161
+ return /* @__PURE__ */ o(me, { variant: "datagrid", checked: e.row.selected, onChange: t });
33
162
  }
34
- Ce.displayName = "DataGridCellRowSelection";
35
- const $e = "NO_PIN";
36
- class A {
163
+ ke.displayName = "DataGridCellRowSelection";
164
+ const it = "NO_PIN";
165
+ class M {
37
166
  constructor(e, t, i) {
38
- if (this.def = e, this.grid = t, this.parent = i, this.columns = e.columns?.map((r) => new A(e.pin ? { ...r, pin: e.pin } : r, t, this)) ?? [], this.isLeaf) {
39
- const r = this.grid.columnWidths.get(this.key);
40
- this._inlineWidth = this.key == V ? void 0 : r ?? this.def.width ?? this.grid.DEFAULT_COLUMN_WIDTH_PX, this._pin = e.pin;
167
+ if (this.def = e, this.grid = t, this.parent = i, this.columns = e.columns?.map((n) => new M(e.pin ? { ...n, pin: e.pin } : n, t, this)) ?? [], this.isLeaf) {
168
+ const n = this.grid.columnWidths.get(this.key);
169
+ this._inlineWidth = this.key == W ? void 0 : n ?? this.def.width ?? this.grid.DEFAULT_COLUMN_WIDTH_PX, this._pin = e.pin;
41
170
  }
42
171
  }
43
172
  columns = [];
@@ -98,10 +227,10 @@ class A {
98
227
  getPinnedColumn(e) {
99
228
  if (this.hasPin(e)) {
100
229
  if (this.isLeaf) return this;
101
- const t = new A({ ...this.def, pin: e }, this.grid, this.parent);
230
+ const t = new M({ ...this.def, pin: e }, this.grid, this.parent);
102
231
  return t.columns = this.columns.filter((i) => i.hasPin(e)).map((i) => {
103
- const r = i.getPinnedColumn(e);
104
- return r.parent = t, r;
232
+ const n = i.getPinnedColumn(e);
233
+ return n.parent = t, n;
105
234
  }).filter((i) => !!i), t;
106
235
  }
107
236
  }
@@ -126,22 +255,22 @@ class A {
126
255
  get left() {
127
256
  let e = 0;
128
257
  if (this.parent) {
129
- const { visibleColumns: t, left: i } = this.parent, r = t.findIndex((o) => o === this);
130
- e += t.sumBy((o, a) => a < r ? o.inlineWidth ?? 0 : 0), e += i;
258
+ const { visibleColumns: t, left: i } = this.parent, n = t.findIndex((r) => r === this);
259
+ e += t.sumBy((r, c) => c < n ? r.inlineWidth ?? 0 : 0), e += i;
131
260
  } else {
132
- const t = this.grid.columns.value.left.filter((r) => r.isVisible), i = t.findIndex((r) => r === this);
133
- e += t.sumBy((r, o) => o < i ? r.inlineWidth ?? 0 : 0);
261
+ const t = this.grid.columns.value.left.filter((n) => n.isVisible), i = t.findIndex((n) => n === this);
262
+ e += t.sumBy((n, r) => r < i ? n.inlineWidth ?? 0 : 0);
134
263
  }
135
264
  return e;
136
265
  }
137
266
  get right() {
138
267
  let e = 0;
139
268
  if (this.parent) {
140
- const { visibleColumns: t } = this.parent, i = t.reverse(), r = i.findIndex((o) => o === this);
141
- e += i.sumBy((o, a) => a < r ? o.inlineWidth ?? 0 : 0), e += this.parent.right;
269
+ const { visibleColumns: t } = this.parent, i = t.reverse(), n = i.findIndex((r) => r === this);
270
+ e += i.sumBy((r, c) => c < n ? r.inlineWidth ?? 0 : 0), e += this.parent.right;
142
271
  } else {
143
- const i = this.grid.columns.value.right.filter((o) => o.isVisible).reverse(), r = i.findIndex((o) => o === this);
144
- e += i.sumBy((o, a) => a < r ? o.inlineWidth ?? 0 : 0);
272
+ const i = this.grid.columns.value.right.filter((r) => r.isVisible).reverse(), n = i.findIndex((r) => r === this);
273
+ e += i.sumBy((r, c) => c < n ? r.inlineWidth ?? 0 : 0);
145
274
  }
146
275
  return e;
147
276
  }
@@ -176,16 +305,16 @@ class A {
176
305
  return this.isLeaf ? this.grid.columns.value.maxDeath - this.death : 1;
177
306
  }
178
307
  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, u = Ie.throttle((c) => {
180
- const d = (c.pageX - t) * (this.pin === "RIGHT" ? -1 : 1);
308
+ const t = e.pageX, { MIN_COLUMN_WIDTH_PX: i, update: n } = this.grid, r = this.leafs.toRecord((l) => [l.key, l.inlineWidth ?? l.baseWidth]), c = this.leafs.sumBy((l) => r[l.key]) - this.leafs.length * i, h = je.throttle((l) => {
309
+ const p = (l.pageX - t) * (this.pin === "RIGHT" ? -1 : 1);
181
310
  this.leafs.forEach((f) => {
182
- const y = o[f.key], v = a > 0 ? (y - i) / a * d : d / this.leafs.length, R = Math.round(y + v);
183
- f.setWidth(R < i ? i : R);
184
- }), this.grid.flexWidths.clear(), this.grid.sizes.clear(), r();
185
- }, 40), h = new AbortController(), s = (c) => {
186
- h.abort(), r();
311
+ const C = r[f.key], b = c > 0 ? (C - i) / c * p : p / this.leafs.length, k = Math.round(C + b);
312
+ f.setWidth(k < i ? i : k);
313
+ }), this.grid.flexWidths.clear(), this.grid.sizes.clear(), n();
314
+ }, 40), u = new AbortController(), a = (l) => {
315
+ u.abort(), n();
187
316
  };
188
- window.addEventListener("mousemove", u, h), window.addEventListener("mouseup", s, h);
317
+ window.addEventListener("mousemove", h, u), window.addEventListener("mouseup", a, u);
189
318
  };
190
319
  pinColumn = (e) => {
191
320
  this.isLeaf ? this._pin = e : this.columns.forEach((t) => t.pinColumn(e)), this.grid.pinColumn(this.uniqueKey, e);
@@ -205,7 +334,7 @@ class A {
205
334
  this.grid.toggleColumnVisibility(this.key);
206
335
  };
207
336
  }
208
- class Ue {
337
+ class nt {
209
338
  constructor(e, t, i) {
210
339
  this.grid = e, this.row = t, this.column = i;
211
340
  }
@@ -213,7 +342,7 @@ class Ue {
213
342
  return this.column.key === G ? this.row.rowIndex + 1 : this.row.data[this.column.key];
214
343
  }
215
344
  }
216
- class ue {
345
+ class we {
217
346
  constructor(e, t, i) {
218
347
  this.grid = e, this.data = t, this.rowIndex = i, this.grid = e, this.data = t, this.key = this.grid.getRowKey(t);
219
348
  }
@@ -221,65 +350,75 @@ class ue {
221
350
  parentRow;
222
351
  count = 1;
223
352
  get cells() {
224
- return this.grid.columns.value.visibleLeafs.map((e) => new Ue(this.grid, this, e));
353
+ return this.grid.columns.value.visibleLeafs.map((e) => new nt(this.grid, this, e));
225
354
  }
226
355
  get selected() {
227
356
  return this.grid.selectedRows.has(this.key);
228
357
  }
358
+ get expanded() {
359
+ return this.grid.expandedDetailRows.has(this.key);
360
+ }
229
361
  get flatRows() {
230
- return this;
362
+ return this.grid.props.def.rowDetail && this.expanded ? [this, new Y(this.grid, this)] : [this];
231
363
  }
232
364
  get allRows() {
233
365
  return this;
234
366
  }
235
367
  }
236
- const V = "empty-cell", G = "row-number-cell", he = 70, _ = "row-selection-cell", T = "grouping-cell";
237
- class je {
368
+ const W = "empty-cell", G = "row-number-cell", Ce = 70, _ = "row-selection-cell", T = "grouping-cell", O = "row-detail-cell";
369
+ class ot {
238
370
  constructor(e, t) {
239
371
  this.props = e, this.update = t, console.debug("\x1B[32m%s\x1B[0m", "[react-box]: DataGrid GridModel ctor");
240
372
  }
241
- sourceColumns = P(() => {
373
+ get componentName() {
374
+ return this.props.component || "datagrid";
375
+ }
376
+ sourceColumns = B(() => {
242
377
  const { def: e } = this.props, t = [];
243
- if (this.groupColumns.size > 0 && t.push(new A({ key: T }, this)), t.push(...e.columns.map((i) => new A(i, this))), e.rowSelection) {
378
+ if (this.groupColumns.size > 0 && t.push(new M({ key: T }, this)), t.push(...e.columns.map((i) => new M(i, this))), e.rowSelection) {
244
379
  const i = typeof e.rowSelection == "object" && e.rowSelection.pinned ? "LEFT" : void 0;
245
380
  t.unshift(
246
- new A({ key: _, pin: i, width: 50, align: "center", Cell: Ce }, this)
381
+ new M({ key: _, pin: i, width: 50, align: "center", Cell: ke }, this)
247
382
  );
248
383
  }
249
384
  if (e.showRowNumber) {
250
- let i, r = he;
251
- typeof e.showRowNumber == "object" && (e.showRowNumber.pinned && (i = "LEFT"), r = e.showRowNumber.width ?? he), t.unshift(new A({ key: G, pin: i, width: r, align: "right" }, this));
385
+ let i, n = Ce;
386
+ typeof e.showRowNumber == "object" && (e.showRowNumber.pinned && (i = "LEFT"), n = e.showRowNumber.width ?? Ce), t.unshift(new M({ key: G, pin: i, width: n, align: "right" }, this));
387
+ }
388
+ if (e.rowDetail) {
389
+ const i = e.rowDetail.pinned ? "LEFT" : void 0, n = e.rowDetail.expandColumnWidth ?? 50;
390
+ t.unshift(new M({ key: O, pin: i, width: n, align: "center", Cell: xe }, this));
252
391
  }
253
392
  return t;
254
393
  });
255
- columns = P(() => {
394
+ columns = B(() => {
256
395
  console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid columns memo");
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;
396
+ const e = this.sourceColumns.value.map((a) => a.getPinnedColumn("LEFT")).filter((a) => !!a), t = this.sourceColumns.value.map((a) => a.getPinnedColumn()).filter((a) => !!a), i = this.sourceColumns.value.map((a) => a.getPinnedColumn("RIGHT")).filter((a) => !!a), n = [...e, ...t, ...i].flatMap((a) => a.flatColumns), r = n.filter((a) => a.isLeaf), c = n.filter((a) => a.isLeaf && a.isVisible), h = c.filter(
397
+ (a) => ![W, G, _, T, O].includes(a.key)
398
+ ), u = n.maxBy((a) => a.death) + 1;
260
399
  return {
261
400
  left: e,
262
401
  middle: t,
263
402
  right: i,
264
- flat: r,
265
- leafs: o,
266
- visibleLeafs: a,
267
- userVisibleLeafs: u,
268
- maxDeath: h
403
+ flat: n,
404
+ leafs: r,
405
+ visibleLeafs: c,
406
+ userVisibleLeafs: h,
407
+ maxDeath: u
269
408
  };
270
409
  });
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) => {
272
- const i = t.values.groupBy((r) => r.pin ?? $e).toRecord((r) => [r.key, r.values]);
410
+ headerRows = B(() => (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) => {
411
+ const i = t.values.groupBy((n) => n.pin ?? it).toRecord((n) => [n.key, n.values]);
273
412
  return [
274
- ...i.LEFT?.filter((r) => r.isVisible) ?? [],
275
- ...i.NO_PIN?.filter((r) => r.isVisible) ?? [],
276
- ...i.RIGHT?.filter((r) => r.isVisible) ?? []
413
+ ...i.LEFT?.filter((n) => n.isVisible) ?? [],
414
+ ...i.NO_PIN?.filter((n) => n.isVisible) ?? [],
415
+ ...i.RIGHT?.filter((n) => n.isVisible) ?? []
277
416
  ];
278
417
  })));
279
- gridTemplateColumns = P(() => {
418
+ gridTemplateColumns = B(() => {
280
419
  console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid gridTemplateColumns memo");
281
- const { visibleLeafs: e } = this.columns.value, t = e.sumBy((a) => a.pin === "RIGHT" ? 1 : 0), i = e.length - t, r = i > 0 ? `repeat(${i}, max-content)` : "", o = t > 0 ? `repeat(${t}, max-content)` : "";
282
- return `${r} ${o}`.trim();
420
+ const { visibleLeafs: e } = this.columns.value, t = e.sumBy((c) => c.pin === "RIGHT" ? 1 : 0), i = e.length - t, n = i > 0 ? `repeat(${i}, max-content)` : "", r = t > 0 ? `repeat(${t}, max-content)` : "";
421
+ return `${n} ${r}`.trim();
283
422
  });
284
423
  // ========== Filtering ==========
285
424
  _globalFilterValue = "";
@@ -296,12 +435,12 @@ class je {
296
435
  applyGlobalFilter(e) {
297
436
  const t = this.globalFilterValue.trim();
298
437
  if (!t) return e;
299
- const { globalFilterKeys: i } = this.props.def, r = i ?? this.columns.value.leafs.filter(
300
- (o) => o.key !== V && o.key !== G && o.key !== _ && o.key !== T
301
- ).map((o) => o.key);
302
- return e.filter((o) => r.some((a) => {
303
- const u = o[a];
304
- return u == null ? !1 : ae(t, String(u));
438
+ const { globalFilterKeys: i } = this.props.def, n = i ?? this.columns.value.leafs.filter(
439
+ (r) => r.key !== W && r.key !== G && r.key !== _ && r.key !== T && r.key !== O
440
+ ).map((r) => r.key);
441
+ return e.filter((r) => n.some((c) => {
442
+ const h = r[c];
443
+ return h == null ? !1 : ge(t, String(h));
305
444
  }));
306
445
  }
307
446
  /**
@@ -309,11 +448,11 @@ class je {
309
448
  */
310
449
  applyColumnFilters(e) {
311
450
  const t = this.columnFilters, i = Object.keys(t);
312
- return i.length === 0 ? e : e.filter((r) => i.every((o) => {
313
- const a = t[o];
314
- if (!a) return !0;
315
- const u = r[o];
316
- return this.matchesFilter(u, a);
451
+ return i.length === 0 ? e : e.filter((n) => i.every((r) => {
452
+ const c = t[r];
453
+ if (!c) return !0;
454
+ const h = n[r];
455
+ return this.matchesFilter(h, c);
317
456
  }));
318
457
  }
319
458
  /**
@@ -322,7 +461,7 @@ class je {
322
461
  matchesFilter(e, t) {
323
462
  switch (t.type) {
324
463
  case "text":
325
- return t.value.trim() ? e == null ? !1 : ae(t.value, String(e)) : !0;
464
+ return t.value.trim() ? e == null ? !1 : ge(t.value, String(e)) : !0;
326
465
  case "number": {
327
466
  if (e == null) return !1;
328
467
  const i = typeof e == "number" ? e : parseFloat(String(e));
@@ -357,33 +496,48 @@ class je {
357
496
  */
358
497
  applyExternalFilters(e) {
359
498
  const t = this.props.filters;
360
- return !t || t.length === 0 ? e : e.filter((i) => t.every((r) => r(i)));
499
+ return !t || t.length === 0 ? e : e.filter((i) => t.every((n) => n(i)));
361
500
  }
362
501
  /**
363
502
  * Get filtered data (applies external, global, then column filters)
364
503
  */
365
504
  get filteredData() {
505
+ if (this.isPaginated) return this.props.data;
366
506
  let e = this.props.data;
367
507
  return e = this.applyExternalFilters(e), this.props.def.globalFilter && (e = this.applyGlobalFilter(e)), e = this.applyColumnFilters(e), e;
368
508
  }
509
+ fireServerStateChange(e) {
510
+ this.props.onServerStateChange?.({
511
+ page: e?.page ?? this.page,
512
+ pageSize: this.pageSize,
513
+ sortColumn: "sortColumn" in (e ?? {}) ? e.sortColumn : this._sortColumn,
514
+ sortDirection: "sortDirection" in (e ?? {}) ? e.sortDirection : this._sortDirection,
515
+ columnFilters: e?.columnFilters ?? this.columnFilters,
516
+ globalFilterValue: e?.globalFilterValue ?? this.globalFilterValue
517
+ });
518
+ }
369
519
  /**
370
520
  * Set global filter value
371
521
  */
372
522
  setGlobalFilter = (e) => {
373
- this.props.onGlobalFilterChange ? this.props.onGlobalFilterChange(e) : this._globalFilterValue = e, this.rows.clear(), this.flatRows.clear(), this.update();
523
+ this.props.onGlobalFilterChange ? this.props.onGlobalFilterChange(e) : this._globalFilterValue = e;
524
+ const t = this.isPaginated && this.page !== 1 ? 1 : this.page;
525
+ t !== this.page && (this.props.onPageChange ? this.props.onPageChange(1, this.pageSize) : this._page = 1), this.fireServerStateChange({ globalFilterValue: e, page: t }), this.rows.clear(), this.flatRows.clear(), this.rowOffsets.clear(), this.update();
374
526
  };
375
527
  /**
376
528
  * Set a single column filter
377
529
  */
378
530
  setColumnFilter = (e, t) => {
379
531
  const i = { ...this.columnFilters };
380
- t === void 0 ? delete i[e] : i[e] = t, this.props.onColumnFiltersChange ? this.props.onColumnFiltersChange(i) : this._columnFilters = i, this.rows.clear(), this.flatRows.clear(), this.update();
532
+ t === void 0 ? delete i[e] : i[e] = t, this.props.onColumnFiltersChange ? this.props.onColumnFiltersChange(i) : this._columnFilters = i;
533
+ const n = this.isPaginated && this.page !== 1 ? 1 : this.page;
534
+ n !== this.page && (this.props.onPageChange ? this.props.onPageChange(1, this.pageSize) : this._page = 1), this.fireServerStateChange({ columnFilters: i, page: n }), this.rows.clear(), this.flatRows.clear(), this.rowOffsets.clear(), this.update();
381
535
  };
382
536
  /**
383
537
  * Clear all column filters
384
538
  */
385
539
  clearColumnFilters = () => {
386
- this.props.onColumnFiltersChange ? this.props.onColumnFiltersChange({}) : this._columnFilters = {}, this.rows.clear(), this.flatRows.clear(), this.update();
540
+ this.props.onColumnFiltersChange ? this.props.onColumnFiltersChange({}) : this._columnFilters = {}, this.fireServerStateChange({ columnFilters: {} }), this.rows.clear(), this.flatRows.clear(), this.rowOffsets.clear(), this.update();
387
541
  };
388
542
  /**
389
543
  * Clear all filters (global + column)
@@ -397,9 +551,9 @@ class je {
397
551
  getColumnUniqueValues = (e) => {
398
552
  const t = /* @__PURE__ */ new Set();
399
553
  return this.props.data.forEach((i) => {
400
- const r = i[e];
401
- r !== void 0 && t.add(r);
402
- }), Array.from(t).sort((i, r) => i === null ? 1 : r === null ? -1 : typeof i == "string" && typeof r == "string" ? i.localeCompare(r) : typeof i == "number" && typeof r == "number" ? i - r : String(i).localeCompare(String(r)));
554
+ const n = i[e];
555
+ n !== void 0 && t.add(n);
556
+ }), Array.from(t).sort((i, n) => i === null ? 1 : n === null ? -1 : typeof i == "string" && typeof n == "string" ? i.localeCompare(n) : typeof i == "number" && typeof n == "number" ? i - n : String(i).localeCompare(String(n)));
403
557
  };
404
558
  /**
405
559
  * Check if any filter is active
@@ -411,49 +565,53 @@ class je {
411
565
  * Get count of filtered rows vs total rows
412
566
  */
413
567
  get filterStats() {
568
+ if (this.isPaginated) {
569
+ const e = this.props.def.pagination.totalCount;
570
+ return { filtered: e, total: e };
571
+ }
414
572
  return {
415
573
  filtered: this.filteredData.length,
416
574
  total: this.props.data.length
417
575
  };
418
576
  }
419
- rows = P(() => {
577
+ rows = B(() => {
420
578
  console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid rows memo");
421
579
  let e = this.filteredData;
422
- if (this._sortColumn && (e = e.sortBy((t) => t[this._sortColumn], this._sortDirection)), this.groupColumns.size > 0) {
423
- const t = (i, r, o) => {
424
- const a = r.values().next().value;
425
- r.delete(a);
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;
580
+ if (this._sortColumn && !this.isPaginated && (e = e.sortBy((t) => t[this._sortColumn], this._sortDirection)), this.groupColumns.size > 0) {
581
+ const t = (i, n, r) => {
582
+ const c = n.values().next().value;
583
+ n.delete(c);
584
+ const h = this.columns.value.leafs.findOrThrow((u) => u.key === c);
585
+ return this._sortColumn === T && (i = i.sortBy((u) => u[c], this._sortDirection)), i.groupBy((u) => u[c]).map((u) => {
586
+ let a;
587
+ n.size > 0 ? a = t(u.values, new Set(n), r + 1) : a = u.values.map((p, f) => new we(this, p, r + 1 + f));
588
+ const l = new Se(this, h, a, r, u.key);
589
+ return r += 1, l.expanded && (r += a.length), l;
432
590
  });
433
591
  };
434
592
  return t(e, new Set(this.groupColumns), 0);
435
593
  }
436
- return e.map((t, i) => new ue(this, t, i));
594
+ return e.map((t, i) => new we(this, t, i));
437
595
  });
438
- flatRows = P(() => (console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid flatRows memo"), this.rows.value.flatMap((e) => e.flatRows)));
596
+ flatRows = B(() => (console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid flatRows memo"), this.rows.value.flatMap((e) => e.flatRows)));
439
597
  get rowHeight() {
440
598
  return this.props.def.rowHeight ?? this.DEFAULT_ROW_HEIGHT_PX;
441
599
  }
442
- sizes = P(() => {
600
+ sizes = B(() => {
443
601
  console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid sizes memo");
444
- const e = this.columns.value.flat.reduce((r, o) => {
445
- const { inlineWidth: a } = o;
446
- return typeof a == "number" && (r[o.widthVarName] = `${o.inlineWidth}px`), o.pin === "LEFT" && (r[o.leftVarName] = `${o.left}px`), o.pin === "RIGHT" && (r[o.rightVarName] = `${o.right}px`), r;
602
+ const e = this.columns.value.flat.reduce((n, r) => {
603
+ const { inlineWidth: c } = r;
604
+ return typeof c == "number" && (n[r.widthVarName] = `${r.inlineWidth}px`), r.pin === "LEFT" && (n[r.leftVarName] = `${r.left}px`), r.pin === "RIGHT" && (n[r.rightVarName] = `${r.right}px`), n;
447
605
  }, {});
448
606
  e[this.rowHeightVarName] = `${this.rowHeight}px`, e[this.leftEdgeVarName] = `${this.leftEdge}px`;
449
- const { visibleLeafs: t } = this.columns.value, i = t.find((r) => r.key === T);
607
+ const { visibleLeafs: t } = this.columns.value, i = t.find((n) => n.key === T);
450
608
  if (i) {
451
- const r = t.sumBy((o) => o.pin === i.pin && o.key !== G && o.key !== _ ? o.inlineWidth ?? 0 : 0);
452
- e[i.groupColumnWidthVarName] = `${r}px`;
609
+ const n = t.sumBy((r) => r.pin === i.pin && r.key !== G && r.key !== _ && r.key !== O ? r.inlineWidth ?? 0 : 0);
610
+ e[i.groupColumnWidthVarName] = `${n}px`;
453
611
  }
454
- return this.groupColumns.forEach((r) => {
455
- const o = this.columns.value.leafs.findOrThrow((a) => a.key === r);
456
- e[o.groupColumnWidthVarName] = `${t.sumBy((a) => a.pin === o.pin ? a.inlineWidth ?? 0 : 0)}px`;
612
+ return this.groupColumns.forEach((n) => {
613
+ const r = this.columns.value.leafs.findOrThrow((c) => c.key === n);
614
+ e[r.groupColumnWidthVarName] = `${t.sumBy((c) => c.pin === r.pin ? c.inlineWidth ?? 0 : 0)}px`;
457
615
  }), e;
458
616
  });
459
617
  // ========== Flexible Column Sizing ==========
@@ -464,23 +622,23 @@ class je {
464
622
  setContainerWidth = (e) => {
465
623
  this._containerWidth !== e && (this._containerWidth = e, this.flexWidths.clear(), this.sizes.clear(), this.update());
466
624
  };
467
- flexWidths = P(() => {
625
+ flexWidths = B(() => {
468
626
  console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid flexWidths memo");
469
627
  const e = this._containerWidth;
470
628
  if (e <= 0) return {};
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)
473
- return o.toRecord((c) => [c.key, c.baseWidth]);
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;
629
+ const t = this.columns.value.visibleLeafs.filter((l) => l.key !== W), i = (l) => !l.isFlexible || this.columnWidths.has(l.key), n = t.filter(i).sumBy((l) => l.baseWidth), r = t.filter((l) => !i(l)), c = r.sumBy((l) => l.baseWidth), h = e - n;
630
+ if (h <= c)
631
+ return r.toRecord((l) => [l.key, l.baseWidth]);
632
+ const u = {};
633
+ let a = 0;
634
+ return r.forEach((l, p) => {
635
+ if (p === r.length - 1)
636
+ u[l.key] = h - a;
479
637
  else {
480
- const f = Math.floor(c.baseWidth / a * u);
481
- h[c.key] = f, s += f;
638
+ const f = Math.floor(l.baseWidth / c * h);
639
+ u[l.key] = f, a += f;
482
640
  }
483
- }), h;
641
+ }), u;
484
642
  });
485
643
  getFlexWidth(e) {
486
644
  return this.flexWidths.value[e];
@@ -489,6 +647,54 @@ class je {
489
647
  MIN_COLUMN_WIDTH_PX = 48;
490
648
  DEFAULT_COLUMN_WIDTH_PX = 200;
491
649
  expandedGroupRow = /* @__PURE__ */ new Set();
650
+ // ========== Row Detail Expansion ==========
651
+ _expandedDetailRows = /* @__PURE__ */ new Set();
652
+ get expandedDetailRows() {
653
+ return this.props.expandedRowKeys ? new Set(this.props.expandedRowKeys) : this._expandedDetailRows;
654
+ }
655
+ toggleDetailRow = (e) => {
656
+ const t = new Set(this.expandedDetailRows);
657
+ t.has(e) ? t.delete(e) : t.add(e), this.props.onExpandedRowKeysChange ? this.props.onExpandedRowKeysChange(Array.from(t)) : this._expandedDetailRows = t, this.rows.clear(), this.flatRows.clear(), this.rowOffsets.clear(), this.update();
658
+ };
659
+ // ========== Pagination ==========
660
+ _page = 1;
661
+ get page() {
662
+ return this.props.page ?? this._page;
663
+ }
664
+ get pageSize() {
665
+ const e = this.props.def.pagination;
666
+ if (e?.pageSize) return e.pageSize;
667
+ const t = this.props.def.visibleRowsCount;
668
+ return typeof t == "number" ? t : 10;
669
+ }
670
+ get isPaginated() {
671
+ return !!this.props.def.pagination;
672
+ }
673
+ get paginationState() {
674
+ const e = this.props.def.pagination;
675
+ if (!e) return;
676
+ const t = e.totalCount, i = this.pageSize;
677
+ return {
678
+ page: this.page,
679
+ pageSize: i,
680
+ totalItems: t,
681
+ totalPages: Math.max(1, Math.ceil(t / i))
682
+ };
683
+ }
684
+ changePage = (e) => {
685
+ const t = this.paginationState;
686
+ if (!t) return;
687
+ const i = Math.max(1, Math.min(e, t.totalPages));
688
+ i !== this.page && (this.props.onPageChange ? this.props.onPageChange(i, t.pageSize) : this._page = i, this.fireServerStateChange({ page: i }), this.rows.clear(), this.flatRows.clear(), this.rowOffsets.clear(), this.update());
689
+ };
690
+ // ========== Row Offsets (for variable-height virtualization) ==========
691
+ rowOffsets = B(() => {
692
+ const e = [];
693
+ let t = 0;
694
+ for (const i of this.flatRows.value)
695
+ e.push(t), t += i instanceof Y ? i.heightForOffset : this.rowHeight;
696
+ return { offsets: e, totalHeight: t };
697
+ });
492
698
  selectedRows = /* @__PURE__ */ new Set();
493
699
  get leftEdge() {
494
700
  return this.columns.value.left.sumBy((e) => e.inlineWidth ?? 0);
@@ -507,24 +713,26 @@ class je {
507
713
  if (t.length > 0)
508
714
  [this._sortDirection] = t, this._sortColumn = this._sortDirection ? e : void 0;
509
715
  else {
510
- const { _sortColumn: i, _sortDirection: r } = this;
511
- this._sortColumn = i === e && r === "DESC" ? void 0 : e, this._sortDirection = i === e && r === "ASC" ? "DESC" : "ASC";
716
+ const { _sortColumn: n, _sortDirection: r } = this;
717
+ this._sortColumn = n === e && r === "DESC" ? void 0 : e, this._sortDirection = n === e && r === "ASC" ? "DESC" : "ASC";
512
718
  }
513
- this.headerRows.clear(), this.rows.clear(), this.flatRows.clear(), this.update();
719
+ this.props.onSortChange?.(this._sortColumn, this._sortDirection);
720
+ const i = this.isPaginated && this.page !== 1 ? 1 : this.page;
721
+ i !== this.page && (this.props.onPageChange ? this.props.onPageChange(1, this.pageSize) : this._page = 1), this.fireServerStateChange({ sortColumn: this._sortColumn, sortDirection: this._sortDirection, page: i }), this.headerRows.clear(), this.rows.clear(), this.flatRows.clear(), this.rowOffsets.clear(), this.update();
514
722
  };
515
723
  pinColumn = (e, t) => {
516
- const i = this.columns.value.flat.findOrThrow((r) => r.uniqueKey === e);
517
- i.pin !== t && i.pinColumn(t), this.columns.clear(), this.headerRows.clear(), this.gridTemplateColumns.clear(), this.rows.clear(), this.flatRows.clear(), this.flexWidths.clear(), this.sizes.clear(), this.update();
724
+ const i = this.columns.value.flat.findOrThrow((n) => n.uniqueKey === e);
725
+ i.pin !== t && i.pinColumn(t), this.columns.clear(), this.headerRows.clear(), this.gridTemplateColumns.clear(), this.rows.clear(), this.flatRows.clear(), this.rowOffsets.clear(), this.flexWidths.clear(), this.sizes.clear(), this.update();
518
726
  };
519
727
  toggleGrouping = (e) => {
520
- this.groupColumns = new Set(this.groupColumns), this.hiddenColumns = new Set(this.hiddenColumns), this.groupColumns.has(e) ? (this.groupColumns.delete(e), this.hiddenColumns.delete(e)) : (this.groupColumns.add(e), this.hiddenColumns.add(e)), this.sourceColumns.clear(), this.columns.clear(), this.headerRows.clear(), this.gridTemplateColumns.clear(), this.rows.clear(), this.flatRows.clear(), this.flexWidths.clear(), this.sizes.clear(), this.update();
728
+ this.groupColumns = new Set(this.groupColumns), this.hiddenColumns = new Set(this.hiddenColumns), this.groupColumns.has(e) ? (this.groupColumns.delete(e), this.hiddenColumns.delete(e)) : (this.groupColumns.add(e), this.hiddenColumns.add(e)), this.sourceColumns.clear(), this.columns.clear(), this.headerRows.clear(), this.gridTemplateColumns.clear(), this.rows.clear(), this.flatRows.clear(), this.rowOffsets.clear(), this.flexWidths.clear(), this.sizes.clear(), this.update();
521
729
  };
522
730
  unGroupAll = () => {
523
731
  const e = new Set(this.groupColumns);
524
- this.groupColumns = /* @__PURE__ */ new Set(), this.hiddenColumns = new Set(Array.from(this.hiddenColumns).filter((t) => !e.has(t))), this.sourceColumns.clear(), this.columns.clear(), this.headerRows.clear(), this.gridTemplateColumns.clear(), this.rows.clear(), this.flatRows.clear(), this.flexWidths.clear(), this.sizes.clear(), this.update();
732
+ this.groupColumns = /* @__PURE__ */ new Set(), this.hiddenColumns = new Set(Array.from(this.hiddenColumns).filter((t) => !e.has(t))), this.sourceColumns.clear(), this.columns.clear(), this.headerRows.clear(), this.gridTemplateColumns.clear(), this.rows.clear(), this.flatRows.clear(), this.rowOffsets.clear(), this.flexWidths.clear(), this.sizes.clear(), this.update();
525
733
  };
526
734
  toggleGroupRow = (e) => {
527
- this.expandedGroupRow = new Set(this.expandedGroupRow), this.expandedGroupRow.has(e) ? this.expandedGroupRow.delete(e) : this.expandedGroupRow.add(e), this.rows.clear(), this.flatRows.clear(), this.update();
735
+ this.expandedGroupRow = new Set(this.expandedGroupRow), this.expandedGroupRow.has(e) ? this.expandedGroupRow.delete(e) : this.expandedGroupRow.add(e), this.rows.clear(), this.flatRows.clear(), this.rowOffsets.clear(), this.update();
528
736
  };
529
737
  toggleRowSelection = (e) => {
530
738
  this.toggleRowsSelection([e]);
@@ -532,7 +740,7 @@ class je {
532
740
  toggleRowsSelection = (e) => {
533
741
  this.selectedRows = new Set(this.selectedRows);
534
742
  const t = e.every((i) => this.selectedRows.has(i));
535
- t ? e.forEach((i) => this.selectedRows.delete(i)) : e.forEach((i) => this.selectedRows.add(i)), this.flatRows.clear(), this.update(), this.props.onSelectionChange?.({
743
+ t ? e.forEach((i) => this.selectedRows.delete(i)) : e.forEach((i) => this.selectedRows.add(i)), this.flatRows.clear(), this.rowOffsets.clear(), this.update(), this.props.onSelectionChange?.({
536
744
  action: t ? "deselect" : "select",
537
745
  affectedRowKeys: e,
538
746
  selectedRowKeys: Array.from(this.selectedRows),
@@ -543,7 +751,7 @@ class je {
543
751
  this.toggleRowsSelection(this.props.data.map((e) => this.getRowKey(e)));
544
752
  };
545
753
  toggleColumnVisibility = (e) => {
546
- this.hiddenColumns = new Set(this.hiddenColumns), this.hiddenColumns.has(e) ? this.hiddenColumns.delete(e) : this.hiddenColumns.add(e), this.columns.clear(), this.headerRows.clear(), this.gridTemplateColumns.clear(), this.rows.clear(), this.flatRows.clear(), this.flexWidths.clear(), this.sizes.clear(), this.update();
754
+ this.hiddenColumns = new Set(this.hiddenColumns), this.hiddenColumns.has(e) ? this.hiddenColumns.delete(e) : this.hiddenColumns.add(e), this.columns.clear(), this.headerRows.clear(), this.gridTemplateColumns.clear(), this.rows.clear(), this.flatRows.clear(), this.rowOffsets.clear(), this.flexWidths.clear(), this.sizes.clear(), this.update();
547
755
  };
548
756
  setWidth = (e, t) => {
549
757
  this.columnWidths.set(e, t);
@@ -560,7 +768,7 @@ class je {
560
768
  return this._sortDirection;
561
769
  }
562
770
  }
563
- class qe {
771
+ class rt {
564
772
  constructor(e, t, i) {
565
773
  this.grid = e, this.row = t, this.column = i;
566
774
  }
@@ -568,16 +776,16 @@ class qe {
568
776
  return this.column.key === G ? this.row.rowIndex + 1 : this.column.key === T ? `${this.row.groupValue} (${this.row.count})` : null;
569
777
  }
570
778
  }
571
- class we {
572
- constructor(e, t, i, r, o) {
573
- this.grid = e, this.groupColumn = t, this.rows = i, this.rowIndex = r, this.groupValue = o, i.forEach((a) => a.parentRow = this);
779
+ class Se {
780
+ constructor(e, t, i, n, r) {
781
+ this.grid = e, this.groupColumn = t, this.rows = i, this.rowIndex = n, this.groupValue = r, i.forEach((c) => c.parentRow = this);
574
782
  }
575
783
  get key() {
576
784
  return `${this.parentRow?.key ?? ""}${this.groupColumn.key}${this.groupValue}`;
577
785
  }
578
786
  parentRow;
579
787
  get cells() {
580
- return this.grid.columns.value.visibleLeafs.map((e) => new qe(this.grid, this, e));
788
+ return this.grid.columns.value.visibleLeafs.map((e) => new rt(this.grid, this, e));
581
789
  }
582
790
  get selected() {
583
791
  return this.allRows.every((e) => e.selected);
@@ -606,131 +814,206 @@ class we {
606
814
  get groupingColumnGridColumn() {
607
815
  const { visibleLeafs: e } = this.grid.columns.value, { groupingColumn: t } = this;
608
816
  return e.sumBy(
609
- (r) => r.pin === t.pin && r.key !== V && r.key !== _ && r.key !== G ? 1 : 0
817
+ (n) => n.pin === t.pin && n.key !== W && n.key !== _ && n.key !== G && n.key !== O ? 1 : 0
610
818
  );
611
819
  }
612
820
  toggleRow() {
613
821
  this.grid.toggleGroupRow(this.key);
614
822
  }
615
823
  }
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;
618
- "align" in t.def && (r.jc = c);
619
- const N = o === G, S = o === _, x = o === V, L = a === "LEFT", C = a === "RIGHT";
620
- return /* @__PURE__ */ n(
621
- m,
824
+ function Fe(s) {
825
+ const { row: e } = s, { grid: t, parentRow: i } = e, n = t.props.def.rowDetail, r = e.height === "auto";
826
+ return /* @__PURE__ */ o(
827
+ g,
622
828
  {
623
- component: "datagrid.body.cell",
829
+ component: `${t.componentName}.body.detailRow`,
830
+ props: { role: "row" },
831
+ style: {
832
+ gridColumn: "1 / -1",
833
+ height: r ? "auto" : `${e.height}px`
834
+ },
835
+ children: /* @__PURE__ */ o(m, { position: "sticky", left: 0, width: "fit", overflow: "hidden", style: { minWidth: "100%" }, children: n.content(i.data) })
836
+ }
837
+ );
838
+ }
839
+ Fe.displayName = "DataGridDetailRow";
840
+ function K(s) {
841
+ const { children: e, column: t, style: i, ...n } = s, { key: r, pin: c, left: h, right: u, isEdge: a, align: l, widthVarName: p, leftVarName: f, rightVarName: C, isFirstLeaf: b, isLastLeaf: k } = t;
842
+ "align" in t.def && (n.jc = l);
843
+ const P = r === G, N = r === _, S = r === W, F = c === "LEFT", w = c === "RIGHT", y = F || w, R = F && h === 0, D = F && a, E = w && a, V = w && u === 0;
844
+ return /* @__PURE__ */ o(
845
+ g,
846
+ {
847
+ component: `${t.grid.componentName}.body.cell`,
624
848
  props: { role: "cell" },
625
849
  variant: {
626
- isPinned: L || C,
627
- isFirstLeftPinned: L && u === 0,
628
- isLastLeftPinned: L && s,
629
- isFirstRightPinned: C && s,
630
- isLastRightPinned: C && h === 0,
631
- isRowSelection: S,
632
- isRowNumber: N,
633
- isFirstLeaf: v,
634
- isLastLeaf: R,
635
- isEmptyCell: x
850
+ isPinned: y,
851
+ isFirstLeftPinned: R,
852
+ isLastLeftPinned: D,
853
+ isFirstRightPinned: E,
854
+ isLastRightPinned: V,
855
+ isRowSelection: N,
856
+ isRowNumber: P,
857
+ isFirstLeaf: b,
858
+ isLastLeaf: k,
859
+ isEmptyCell: S
636
860
  },
637
861
  style: {
638
- width: `var(${d})`,
862
+ width: `var(${p})`,
639
863
  height: `var(${t.grid.rowHeightVarName})`,
640
- left: L ? `var(${f})` : void 0,
641
- right: C ? `var(${y})` : void 0,
864
+ left: F ? `var(${f})` : void 0,
865
+ right: w ? `var(${C})` : void 0,
642
866
  ...i
643
867
  },
644
- ...r,
868
+ ...n,
645
869
  children: e
646
870
  }
647
871
  );
648
872
  }
649
- q.displayName = "DataGridCell";
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(() => {
652
- e.grid.toggleRowsSelection(e.allRows.map((c) => c.key));
873
+ K.displayName = "DataGridCell";
874
+ function De(s) {
875
+ const { row: e } = s, { selected: t, indeterminate: i, cells: n, groupingColumn: r, groupingColumnGridColumn: c, depth: h, expanded: u } = e, a = v(() => {
876
+ e.grid.toggleRowsSelection(e.allRows.map((l) => l.key));
653
877
  }, []);
654
- return /* @__PURE__ */ n(m, { className: "grid-row", selected: t, display: "contents", props: { role: "rowgroup" }, children: r.map((c) => {
655
- const { key: d, pin: f, groupColumnWidthVarName: y } = c.column, v = f === "RIGHT";
656
- if (d === T)
657
- return /* @__PURE__ */ n(
658
- q,
659
- {
660
- column: c.column,
661
- style: {
662
- width: `var(${y})`,
663
- right: v ? "0" : void 0
664
- },
665
- br: o.pin === "LEFT" ? 1 : void 0,
666
- gridColumn: a,
667
- pl: 4 * u,
668
- overflow: "auto",
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 }),
671
- c.value
672
- ] }) })
673
- },
674
- d
675
- );
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);
680
- }) });
878
+ return /* @__PURE__ */ o(
879
+ g,
880
+ {
881
+ component: `${e.grid.componentName}.body.groupRow`,
882
+ className: "grid-row",
883
+ selected: t,
884
+ display: "contents",
885
+ props: { role: "rowgroup" },
886
+ children: n.map((l) => {
887
+ const { key: p, pin: f, groupColumnWidthVarName: C } = l.column, b = f === "RIGHT";
888
+ if (p === T)
889
+ return /* @__PURE__ */ o(
890
+ K,
891
+ {
892
+ column: l.column,
893
+ style: {
894
+ width: `var(${C})`,
895
+ right: b ? "0" : void 0
896
+ },
897
+ br: r.pin === "LEFT" ? 1 : void 0,
898
+ gridColumn: c,
899
+ pl: 4 * h,
900
+ overflow: "auto",
901
+ children: /* @__PURE__ */ o(m, { textWrap: "nowrap", px: 3, children: /* @__PURE__ */ d(L, { clean: !0, onClick: () => e.toggleRow(), cursor: "pointer", display: "flex", gap: 1, ai: "center", children: [
902
+ /* @__PURE__ */ o(pe, { fill: "currentColor", width: "14px", height: "14px", rotate: u ? 0 : -90 }),
903
+ l.value
904
+ ] }) })
905
+ },
906
+ p
907
+ );
908
+ if (p === _)
909
+ return /* @__PURE__ */ o(K, { column: l.column, children: /* @__PURE__ */ o(me, { variant: "datagrid", m: 1, checked: t, indeterminate: i, onChange: a }) }, p);
910
+ if (f !== r.pin || p === G || p === W || p === O)
911
+ return /* @__PURE__ */ o(K, { column: l.column, px: p === G ? 3 : void 0, children: l.value }, p);
912
+ })
913
+ }
914
+ );
681
915
  }
682
- ye.displayName = "DataGridGroupRow";
683
- function ve(l) {
684
- const { cell: e } = l;
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 }) });
916
+ De.displayName = "DataGridGroupRow";
917
+ function Ge(s) {
918
+ const { cell: e } = s;
919
+ return /* @__PURE__ */ o(g, { height: "fit", width: "fit", overflow: "auto", ai: "center", jc: e.column.align, children: /* @__PURE__ */ o(m, { px: 3, textOverflow: "ellipsis", overflow: "hidden", textWrap: "nowrap", children: e.value }) });
686
920
  }
687
- ve.displayName = "DataGridCellText";
688
- function be(l) {
689
- const { row: e } = l, { selected: t } = e;
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)) });
921
+ Ge.displayName = "DataGridCellText";
922
+ function Ne(s) {
923
+ const { row: e } = s, { selected: t } = e, i = e.grid.props.def.rowDetail?.expandOnRowClick, n = v(() => {
924
+ e.grid.toggleDetailRow(e.key);
925
+ }, [e.grid, e.key]);
926
+ return /* @__PURE__ */ o(
927
+ g,
928
+ {
929
+ component: `${e.grid.componentName}.body.row`,
930
+ className: "grid-row",
931
+ selected: t,
932
+ display: "contents",
933
+ props: { role: "row", onClick: i ? n : void 0 },
934
+ cursor: i ? "pointer" : void 0,
935
+ children: e.cells.map((r) => /* @__PURE__ */ o(K, { column: r.column, children: r.column.Cell ? /* @__PURE__ */ o(r.column.Cell, { cell: r }) : /* @__PURE__ */ o(Ge, { cell: r }) }, r.column.key))
936
+ }
937
+ );
938
+ }
939
+ Ne.displayName = "DataGridRow";
940
+ const ye = 10, ae = 20;
941
+ function st(s, e) {
942
+ let t = 0, i = s.length - 1;
943
+ for (; t < i; ) {
944
+ const n = t + i + 1 >>> 1;
945
+ s[n] <= e ? t = n : i = n - 1;
946
+ }
947
+ return t;
691
948
  }
692
- be.displayName = "DataGridRow";
693
- const Xe = 10, de = 20;
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)
949
+ function ve(s) {
950
+ return s instanceof Y ? /* @__PURE__ */ o(Fe, { row: s }, s.key) : s instanceof Se ? /* @__PURE__ */ o(De, { row: s }, s.key) : /* @__PURE__ */ o(Ne, { row: s }, s.key);
951
+ }
952
+ function Le(s) {
953
+ const { grid: e, scrollTop: t } = s, i = e.props.def.visibleRowsCount === "all", { offsets: n, totalHeight: r } = e.rowOffsets.value, c = !!e.props.def.rowDetail, h = i ? 0 : c ? Math.max(0, st(n, t) - ae) : Math.max(0, Math.floor(t / e.rowHeight) - ae), u = i ? 0 : c ? n[h] ?? 0 : h * e.rowHeight, a = i ? e.flatRows.value.length : e.props.def.visibleRowsCount ?? ye, l = i ? void 0 : e.rowHeight * a + e.rowHeight / 5, p = e.props.data.length === 0, f = X(() => {
954
+ if (console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render rows"), p)
697
955
  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(
706
- g,
956
+ if (i)
957
+ return e.flatRows.value.map(ve);
958
+ const C = a + ae * 2;
959
+ return e.flatRows.value.take(C, h).map(ve);
960
+ }, [e.flatRows.value, p, i, h, a]);
961
+ if (console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render DataGridBody"), p) {
962
+ const { noDataComponent: C } = e.props.def, b = e.props.loading ? "loading..." : "empty";
963
+ return /* @__PURE__ */ o(
964
+ g,
965
+ {
966
+ jc: "center",
967
+ ai: "center",
968
+ width: "fit",
969
+ position: "sticky",
970
+ left: 0,
971
+ style: { height: l ?? e.rowHeight * ye },
972
+ children: C ?? b
973
+ }
974
+ );
975
+ }
976
+ return i ? /* @__PURE__ */ o(
977
+ ce,
978
+ {
979
+ component: `${e.componentName}.body`,
980
+ width: "max-content",
981
+ minWidth: "fit",
982
+ transition: "none",
983
+ style: { gridTemplateColumns: e.gridTemplateColumns.value },
984
+ children: f
985
+ }
986
+ ) : /* @__PURE__ */ o(m, { style: { height: l }, children: /* @__PURE__ */ o(
987
+ m,
707
988
  {
708
989
  style: {
709
- height: `${i * e.rowHeight}px`
990
+ height: c ? `${r}px` : `${e.flatRows.value.length * e.rowHeight}px`
710
991
  },
711
- children: /* @__PURE__ */ n(
712
- me,
992
+ children: /* @__PURE__ */ o(
993
+ ce,
713
994
  {
714
- component: "datagrid.body",
995
+ component: `${e.componentName}.body`,
715
996
  width: "max-content",
716
997
  minWidth: "fit",
717
998
  transition: "none",
718
999
  style: {
719
- transform: `translate3d(0, ${r * e.rowHeight}px, 0)`,
1000
+ transform: `translate3d(0, ${u}px, 0)`,
720
1001
  willChange: "transform",
721
1002
  gridTemplateColumns: e.gridTemplateColumns.value
722
1003
  },
723
- children: h
1004
+ children: f
724
1005
  }
725
1006
  )
726
1007
  }
727
1008
  ) });
728
1009
  }
729
- Re.displayName = "DataGridBody";
730
- function Ye() {
731
- return /* @__PURE__ */ n(
732
- m,
1010
+ Le.displayName = "DataGridBody";
1011
+ function lt(s) {
1012
+ const { grid: e } = s;
1013
+ return /* @__PURE__ */ o(
1014
+ g,
733
1015
  {
1016
+ component: `${e.componentName}.emptyColumns`,
734
1017
  d: "column",
735
1018
  ai: "center",
736
1019
  jc: "center",
@@ -740,9 +1023,9 @@ function Ye() {
740
1023
  bgColor: "gray-50",
741
1024
  borderRadius: 4,
742
1025
  theme: { dark: { bgColor: "gray-900" } },
743
- children: /* @__PURE__ */ p(m, { d: "column", ai: "center", gap: 3, children: [
744
- /* @__PURE__ */ n(
745
- g,
1026
+ children: /* @__PURE__ */ d(g, { d: "column", ai: "center", gap: 3, children: [
1027
+ /* @__PURE__ */ o(
1028
+ m,
746
1029
  {
747
1030
  width: 16,
748
1031
  height: 16,
@@ -752,7 +1035,7 @@ function Ye() {
752
1035
  display: "flex",
753
1036
  ai: "center",
754
1037
  jc: "center",
755
- children: /* @__PURE__ */ n(fe, { viewBox: "0 0 24 24", width: "40", fill: "currentColor", color: "gray-400", theme: { dark: { color: "gray-500" } }, children: /* @__PURE__ */ n(
1038
+ children: /* @__PURE__ */ o(U, { viewBox: "0 0 24 24", width: "40", fill: "currentColor", color: "gray-400", theme: { dark: { color: "gray-500" } }, children: /* @__PURE__ */ o(
756
1039
  "path",
757
1040
  {
758
1041
  fillRule: "evenodd",
@@ -762,160 +1045,160 @@ function Ye() {
762
1045
  ) })
763
1046
  }
764
1047
  ),
765
- /* @__PURE__ */ p(m, { d: "column", ai: "center", gap: 1, children: [
766
- /* @__PURE__ */ n(g, { fontSize: 18, fontWeight: 600, color: "gray-900", theme: { dark: { color: "gray-50" } }, children: "No Columns Selected" }),
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" })
1048
+ /* @__PURE__ */ d(g, { d: "column", ai: "center", gap: 1, children: [
1049
+ /* @__PURE__ */ o(m, { fontSize: 18, fontWeight: 600, color: "gray-900", theme: { dark: { color: "gray-50" } }, children: "No Columns Selected" }),
1050
+ /* @__PURE__ */ o(m, { 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" })
768
1051
  ] })
769
1052
  ] })
770
1053
  }
771
1054
  );
772
1055
  }
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);
775
- z(() => () => {
776
- a.current && clearTimeout(a.current);
1056
+ function be({ column: s, grid: e }) {
1057
+ const t = e.columnFilters[s.key], i = t?.type === "text" ? t.value : "", [n, r] = I(i), c = H(null);
1058
+ de(() => () => {
1059
+ c.current && clearTimeout(c.current);
777
1060
  }, []);
778
- const u = k(
779
- (c) => {
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;
1061
+ const h = v(
1062
+ (l) => {
1063
+ const p = l.target.value;
1064
+ r(p), c.current && clearTimeout(c.current), c.current = setTimeout(() => {
1065
+ p.trim() ? e.setColumnFilter(s.key, { type: "text", value: p }) : e.setColumnFilter(s.key, void 0), c.current = null;
783
1066
  }, 300);
784
1067
  },
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: "✕" }) })
1068
+ [e, s.key]
1069
+ ), u = v(() => {
1070
+ r(""), e.setColumnFilter(s.key, void 0);
1071
+ }, [e, s.key]), a = typeof s.def.filterable == "object" ? s.def.filterable : {};
1072
+ return /* @__PURE__ */ d(g, { ai: "center", position: "relative", width: "fit", children: [
1073
+ /* @__PURE__ */ o(q, { width: "fit", variant: "compact", placeholder: a.placeholder ?? "Filter...", value: n, onChange: h }),
1074
+ n && /* @__PURE__ */ o(g, { position: "absolute", right: 2, top: "1/2", translateY: "-1/2", cursor: "pointer", props: { onClick: u }, children: /* @__PURE__ */ o(m, { fontSize: 10, color: "gray-400", hover: { color: "gray-600" }, children: "✕" }) })
792
1075
  ] });
793
1076
  }
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);
796
- z(() => () => {
797
- f.current && clearTimeout(f.current), y.current && clearTimeout(y.current);
1077
+ function at({ column: s, grid: e }) {
1078
+ const t = e.columnFilters[s.key], i = t?.type === "number" ? t.value : "", n = t?.type === "number" ? t.operator : "eq", r = t?.type === "number" ? t.valueTo : "", [c, h] = I(i), [u, a] = I(n), [l, p] = I(r ?? ""), f = H(null), C = H(null);
1079
+ de(() => () => {
1080
+ f.current && clearTimeout(f.current), C.current && clearTimeout(C.current);
798
1081
  }, []);
799
- const v = typeof l.def.filterable == "object" ? l.def.filterable : {}, R = k(
800
- (C, w, F) => {
801
- const W = typeof w == "number" ? w : parseFloat(w);
802
- if (isNaN(W) || w === "") {
803
- e.setColumnFilter(l.key, void 0);
1082
+ const b = typeof s.def.filterable == "object" ? s.def.filterable : {}, k = v(
1083
+ (w, y, R) => {
1084
+ const D = typeof y == "number" ? y : parseFloat(y);
1085
+ if (isNaN(D) || y === "") {
1086
+ e.setColumnFilter(s.key, void 0);
804
1087
  return;
805
1088
  }
806
1089
  const E = {
807
1090
  type: "number",
808
- operator: C,
809
- value: W
1091
+ operator: w,
1092
+ value: D
810
1093
  };
811
- if (C === "between" && F !== void 0 && F !== "") {
812
- const B = typeof F == "number" ? F : parseFloat(String(F));
813
- isNaN(B) || (E.valueTo = B);
1094
+ if (w === "between" && R !== void 0 && R !== "") {
1095
+ const V = typeof R == "number" ? R : parseFloat(String(R));
1096
+ isNaN(V) || (E.valueTo = V);
814
1097
  }
815
- e.setColumnFilter(l.key, E);
1098
+ e.setColumnFilter(s.key, E);
816
1099
  },
817
- [e, l.key]
818
- ), N = k(
819
- (C) => {
820
- const w = C.target.value;
821
- u(w), f.current && clearTimeout(f.current), f.current = setTimeout(() => {
822
- R(h, w, c), f.current = null;
1100
+ [e, s.key]
1101
+ ), P = v(
1102
+ (w) => {
1103
+ const y = w.target.value;
1104
+ h(y), f.current && clearTimeout(f.current), f.current = setTimeout(() => {
1105
+ k(u, y, l), f.current = null;
823
1106
  }, 300);
824
1107
  },
825
- [h, c, R]
826
- ), S = k(
827
- (C) => {
828
- s(C), R(C, a, c);
1108
+ [u, l, k]
1109
+ ), N = v(
1110
+ (w) => {
1111
+ a(w), k(w, c, l);
829
1112
  },
830
- [a, c, R]
831
- ), x = k(
832
- (C) => {
833
- const w = C.target.value;
834
- d(w), y.current && clearTimeout(y.current), y.current = setTimeout(() => {
835
- R(h, a, w), y.current = null;
1113
+ [c, l, k]
1114
+ ), S = v(
1115
+ (w) => {
1116
+ const y = w.target.value;
1117
+ p(y), C.current && clearTimeout(C.current), C.current = setTimeout(() => {
1118
+ k(u, c, y), C.current = null;
836
1119
  }, 300);
837
1120
  },
838
- [h, a, R]
839
- ), L = k(() => {
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(
844
- b,
1121
+ [u, c, k]
1122
+ ), F = v(() => {
1123
+ h(""), p(""), a("eq"), e.setColumnFilter(s.key, void 0);
1124
+ }, [e, s.key]);
1125
+ return /* @__PURE__ */ d(g, { ai: u === "between" ? "start" : "center", gap: 1, width: "fit", children: [
1126
+ /* @__PURE__ */ d(
1127
+ x,
845
1128
  {
846
- value: h,
1129
+ value: u,
847
1130
  variant: "compact",
848
- onChange: (C) => C && S(C),
1131
+ onChange: (w) => w && N(w),
849
1132
  minWidth: 6,
850
1133
  hideIcon: !0,
851
1134
  children: [
852
- /* @__PURE__ */ n(b.Item, { value: "eq", children: "=" }),
853
- /* @__PURE__ */ n(b.Item, { value: "ne", children: "≠" }),
854
- /* @__PURE__ */ n(b.Item, { value: "gt", children: ">" }),
855
- /* @__PURE__ */ n(b.Item, { value: "gte", children: "≥" }),
856
- /* @__PURE__ */ n(b.Item, { value: "lt", children: "<" }),
857
- /* @__PURE__ */ n(b.Item, { value: "lte", children: "≤" }),
858
- /* @__PURE__ */ n(b.Item, { value: "between", children: "↔" })
1135
+ /* @__PURE__ */ o(x.Item, { value: "eq", children: "=" }),
1136
+ /* @__PURE__ */ o(x.Item, { value: "ne", children: "≠" }),
1137
+ /* @__PURE__ */ o(x.Item, { value: "gt", children: ">" }),
1138
+ /* @__PURE__ */ o(x.Item, { value: "gte", children: "≥" }),
1139
+ /* @__PURE__ */ o(x.Item, { value: "lt", children: "<" }),
1140
+ /* @__PURE__ */ o(x.Item, { value: "lte", children: "≤" }),
1141
+ /* @__PURE__ */ o(x.Item, { value: "between", children: "↔" })
859
1142
  ]
860
1143
  }
861
1144
  ),
862
- h === "between" ? /* @__PURE__ */ p(m, { d: "column", gap: 1, flex1: !0, children: [
863
- /* @__PURE__ */ p(m, { ai: "center", position: "relative", flex1: !0, children: [
864
- /* @__PURE__ */ n(
865
- j,
1145
+ u === "between" ? /* @__PURE__ */ d(g, { d: "column", gap: 1, flex1: !0, children: [
1146
+ /* @__PURE__ */ d(g, { ai: "center", position: "relative", flex1: !0, children: [
1147
+ /* @__PURE__ */ o(
1148
+ q,
866
1149
  {
867
1150
  type: "number",
868
1151
  variant: "compact",
869
- placeholder: v.placeholder ?? "From",
870
- value: a,
871
- onChange: N,
1152
+ placeholder: b.placeholder ?? "From",
1153
+ value: c,
1154
+ onChange: P,
872
1155
  width: "fit",
873
- step: v.step
1156
+ step: b.step
874
1157
  }
875
1158
  ),
876
- (a !== "" || c !== "") && /* @__PURE__ */ n(m, { position: "absolute", right: 2, top: "1/2", translateY: "-1/2", cursor: "pointer", props: { onClick: L }, children: /* @__PURE__ */ n(g, { fontSize: 10, color: "gray-400", hover: { color: "gray-600" }, children: "✕" }) })
1159
+ (c !== "" || l !== "") && /* @__PURE__ */ o(g, { position: "absolute", right: 2, top: "1/2", translateY: "-1/2", cursor: "pointer", props: { onClick: F }, children: /* @__PURE__ */ o(m, { fontSize: 10, color: "gray-400", hover: { color: "gray-600" }, children: "✕" }) })
877
1160
  ] }),
878
- /* @__PURE__ */ n(m, { ai: "center", flex1: !0, children: /* @__PURE__ */ n(
879
- j,
1161
+ /* @__PURE__ */ o(g, { ai: "center", flex1: !0, children: /* @__PURE__ */ o(
1162
+ q,
880
1163
  {
881
1164
  type: "number",
882
1165
  variant: "compact",
883
1166
  placeholder: "To",
884
- value: c,
885
- onChange: x,
1167
+ value: l,
1168
+ onChange: S,
886
1169
  width: "fit",
887
- step: v.step
1170
+ step: b.step
888
1171
  }
889
1172
  ) })
890
- ] }) : /* @__PURE__ */ p(m, { ai: "center", position: "relative", flex1: !0, children: [
891
- /* @__PURE__ */ n(
892
- j,
1173
+ ] }) : /* @__PURE__ */ d(g, { ai: "center", position: "relative", flex1: !0, children: [
1174
+ /* @__PURE__ */ o(
1175
+ q,
893
1176
  {
894
1177
  type: "number",
895
1178
  variant: "compact",
896
- placeholder: v.placeholder ?? "Value",
897
- value: a,
898
- onChange: N,
1179
+ placeholder: b.placeholder ?? "Value",
1180
+ value: c,
1181
+ onChange: P,
899
1182
  width: "fit",
900
- step: v.step
1183
+ step: b.step
901
1184
  }
902
1185
  ),
903
- a !== "" && /* @__PURE__ */ n(m, { position: "absolute", right: 2, top: "1/2", translateY: "-1/2", cursor: "pointer", props: { onClick: L }, children: /* @__PURE__ */ n(g, { fontSize: 10, color: "gray-400", hover: { color: "gray-600" }, children: "✕" }) })
1186
+ c !== "" && /* @__PURE__ */ o(g, { position: "absolute", right: 2, top: "1/2", translateY: "-1/2", cursor: "pointer", props: { onClick: F }, children: /* @__PURE__ */ o(m, { fontSize: 10, color: "gray-400", hover: { color: "gray-600" }, children: "✕" }) })
904
1187
  ] })
905
1188
  ] });
906
1189
  }
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 });
1190
+ function ct({ column: s, grid: e }) {
1191
+ const t = e.columnFilters[s.key], i = t?.type === "multiselect" ? t.values : [], n = typeof s.def.filterable == "object" ? s.def.filterable : {}, r = X(() => n.options ? n.options : e.getColumnUniqueValues(s.key).map((u) => ({
1192
+ label: u === null ? "(empty)" : String(u),
1193
+ value: u
1194
+ })), [n.options, e, s.key]), c = v(
1195
+ (h, u) => {
1196
+ u.length === 0 ? e.setColumnFilter(s.key, void 0) : e.setColumnFilter(s.key, { type: "multiselect", values: u });
914
1197
  },
915
- [e, l.key]
1198
+ [e, s.key]
916
1199
  );
917
- return /* @__PURE__ */ p(
918
- b,
1200
+ return /* @__PURE__ */ d(
1201
+ x,
919
1202
  {
920
1203
  multiple: !0,
921
1204
  showCheckbox: !0,
@@ -924,109 +1207,152 @@ function Je({ column: l, grid: e }) {
924
1207
  value: i,
925
1208
  width: "fit",
926
1209
  minWidth: 0,
927
- onChange: a,
1210
+ onChange: c,
928
1211
  variant: "compact",
929
1212
  children: [
930
- /* @__PURE__ */ n(b.Unselect, { children: "Clear" }),
931
- /* @__PURE__ */ n(b.SelectAll, { children: "Select All" }),
932
- o.map((u) => /* @__PURE__ */ n(b.Item, { value: u.value, ai: "center", gap: 2, children: u.label }, String(u.value)))
1213
+ /* @__PURE__ */ o(x.Unselect, { children: "Clear" }),
1214
+ /* @__PURE__ */ o(x.SelectAll, { children: "Select All" }),
1215
+ r.map((h) => /* @__PURE__ */ o(x.Item, { value: h.value, ai: "center", gap: 2, children: h.label }, String(h.value)))
933
1216
  ]
934
1217
  }
935
1218
  );
936
1219
  }
937
- function xe(l) {
938
- const { column: e, grid: t } = l, { filterable: i } = e.def;
1220
+ function Te(s) {
1221
+ const { column: e, grid: t } = s, { filterable: i } = e.def;
939
1222
  if (!i) return null;
940
1223
  switch ((typeof i == "object" ? i : { type: "text" }).type) {
941
1224
  case "text":
942
- return /* @__PURE__ */ n(pe, { column: e, grid: t });
1225
+ return /* @__PURE__ */ o(be, { column: e, grid: t });
943
1226
  case "number":
944
- return /* @__PURE__ */ n(Ke, { column: e, grid: t });
1227
+ return /* @__PURE__ */ o(at, { column: e, grid: t });
945
1228
  case "multiselect":
946
- return /* @__PURE__ */ n(Je, { column: e, grid: t });
1229
+ return /* @__PURE__ */ o(ct, { column: e, grid: t });
947
1230
  default:
948
- return /* @__PURE__ */ n(pe, { column: e, grid: t });
1231
+ return /* @__PURE__ */ o(be, { column: e, grid: t });
949
1232
  }
950
1233
  }
951
- xe.displayName = "DataGridColumnFilter";
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";
954
- return /* @__PURE__ */ n(
955
- m,
1234
+ Te.displayName = "DataGridColumnFilter";
1235
+ function _e(s) {
1236
+ const { column: e, grid: t } = s, { key: i, pin: n, left: r, right: c, isEdge: h, widthVarName: u, leftVarName: a, rightVarName: l, filterable: p } = e, f = i === W, P = f || i === T || i === G || i === _, N = n === "LEFT", S = n === "RIGHT", F = N || S, w = N && r === 0, y = N && h, R = S && h, D = S && c === 0;
1237
+ return /* @__PURE__ */ o(
1238
+ g,
956
1239
  {
957
- component: "datagrid.filter.cell",
958
- variant: { isPinned: S || x, isFirstLeftPinned: S && o === 0, isLastLeftPinned: S && u, isFirstRightPinned: x && u, isLastRightPinned: x && a === 0 },
1240
+ component: `${t.componentName}.filter.cell`,
1241
+ variant: { isPinned: F, isFirstLeftPinned: w, isLastLeftPinned: y, isFirstRightPinned: R, isLastRightPinned: D },
959
1242
  px: f ? 0 : 2,
960
1243
  style: {
961
- width: `var(${h})`,
962
- left: S ? `var(${s})` : void 0,
963
- right: x ? `var(${c})` : void 0
1244
+ width: `var(${u})`,
1245
+ left: N ? `var(${a})` : void 0,
1246
+ right: S ? `var(${l})` : void 0
964
1247
  },
965
- children: !N && d && /* @__PURE__ */ n(xe, { column: e, grid: t })
1248
+ children: !P && p && /* @__PURE__ */ o(Te, { column: e, grid: t })
966
1249
  }
967
1250
  );
968
1251
  }
969
- Fe.displayName = "DataGridFilterCell";
970
- function ke(l) {
971
- const { grid: e } = l, { visibleLeafs: t } = e.columns.value;
972
- return t.some((r) => r.filterable) ? t.map((r) => /* @__PURE__ */ n(Fe, { column: r, grid: e }, r.uniqueKey)) : null;
1252
+ _e.displayName = "DataGridFilterCell";
1253
+ function We(s) {
1254
+ const { grid: e } = s, { visibleLeafs: t } = e.columns.value;
1255
+ return t.some((n) => n.filterable) ? t.map((n) => /* @__PURE__ */ o(_e, { column: n, grid: e }, n.uniqueKey)) : null;
973
1256
  }
974
- ke.displayName = "DataGridFilterRow";
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(
978
- D,
1257
+ We.displayName = "DataGridFilterRow";
1258
+ function Pe(s) {
1259
+ const { column: e } = s, { key: t, pin: i, left: n, right: r, isEdge: c, isLeaf: h, align: u, header: a, grid: l } = e, [p, f, C] = qe({ hideOnScroll: !0, event: "mousedown" }), [b, k] = I({ top: 0, left: 0 }), P = X(() => b.left > window.innerWidth / 2, [b.left]), N = h && e.sortable && (l.sortColumn !== t || l.sortDirection === "DESC"), S = h && e.sortable && (l.sortColumn !== t || l.sortDirection === "ASC"), F = h && e.sortable && l.sortColumn === t, w = i !== "LEFT", y = i !== "RIGHT", R = !!i, D = h && t !== T, E = h && t === T, V = N || S || F, J = w || y || R, ne = u === "right" ? 2 : void 0, oe = u === "right" ? void 0 : i === "RIGHT" ? 2.5 : 4, Q = t === W, Z = t === G, re = t === _, A = i === "LEFT", ee = i === "RIGHT", se = A || i === "RIGHT", te = A && n === 0, le = A && c, z = ee && c, j = ee && r === 0, He = h && !Q && !Z && !re && e.sortable;
1260
+ return /* @__PURE__ */ o(g, { position: "absolute", left: ne, right: oe, top: "1/2", translateY: -3, ai: "center", children: /* @__PURE__ */ d(
1261
+ L,
979
1262
  {
980
- component: "datagrid.header.cell.contextMenu",
981
- onClick: () => f(!d),
982
- variant: { isPinned: re, isFirstLeftPinned: Z, isLastLeftPinned: ne, isFirstRightPinned: H, isLastRightPinned: U, isSortable: Ne, isRowNumber: J },
1263
+ component: `${l.componentName}.header.cell.contextMenu`,
1264
+ onClick: () => f(!p),
1265
+ variant: { isPinned: se, isFirstLeftPinned: te, isLastLeftPinned: le, isFirstRightPinned: z, isLastRightPinned: j, isSortable: He, isRowNumber: Z },
983
1266
  children: [
984
- /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.icon", children: /* @__PURE__ */ n(He, { fill: "currentColor" }) }),
985
- d && /* @__PURE__ */ p(
986
- Ae,
1267
+ /* @__PURE__ */ o($, { component: `${l.componentName}.header.cell.contextMenu.icon`, children: /* @__PURE__ */ o(Ke, { fill: "currentColor" }) }),
1268
+ p && /* @__PURE__ */ d(
1269
+ Ye,
987
1270
  {
988
- component: "datagrid.header.cell.contextMenu.tooltip",
989
- onPositionChange: R,
990
- ref: y,
991
- adjustTranslateX: N ? "-100%" : "-21px",
1271
+ component: `${l.componentName}.header.cell.contextMenu.tooltip`,
1272
+ onPositionChange: k,
1273
+ ref: C,
1274
+ adjustTranslateX: P ? "-100%" : "-21px",
992
1275
  adjustTranslateY: "16px",
993
1276
  children: [
994
- S && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn("ASC"), children: [
995
- /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(oe, { width: "100%", fill: "currentColor" }) }),
996
- "Sort Ascending"
997
- ] }),
998
- x && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn("DESC"), children: [
999
- /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(oe, { width: "100%", fill: "currentColor", rotate: 180 }) }),
1000
- "Sort Descending"
1001
- ] }),
1002
- L && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn(void 0), children: [
1003
- /* @__PURE__ */ n(g, { width: 4 }),
1004
- "Clear Sort"
1005
- ] }),
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: [
1008
- /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(ce, { width: "100%", fill: "currentColor" }) }),
1009
- "Pin Left"
1010
- ] }),
1011
- w && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn("RIGHT"), children: [
1012
- /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(ce, { width: "100%", fill: "currentColor", rotate: -90 }) }),
1013
- "Pin Right"
1014
- ] }),
1015
- F && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn(), children: [
1016
- /* @__PURE__ */ n(g, { width: 4 }),
1277
+ N && /* @__PURE__ */ d(
1278
+ L,
1279
+ {
1280
+ component: `${l.componentName}.header.cell.contextMenu.tooltip.item`,
1281
+ onClick: () => e.sortColumn("ASC"),
1282
+ children: [
1283
+ /* @__PURE__ */ o($, { component: `${l.componentName}.header.cell.contextMenu.tooltip.item.icon`, children: /* @__PURE__ */ o(he, { width: "100%", fill: "currentColor" }) }),
1284
+ "Sort Ascending"
1285
+ ]
1286
+ }
1287
+ ),
1288
+ S && /* @__PURE__ */ d(
1289
+ L,
1290
+ {
1291
+ component: `${l.componentName}.header.cell.contextMenu.tooltip.item`,
1292
+ onClick: () => e.sortColumn("DESC"),
1293
+ children: [
1294
+ /* @__PURE__ */ o($, { component: `${l.componentName}.header.cell.contextMenu.tooltip.item.icon`, children: /* @__PURE__ */ o(he, { width: "100%", fill: "currentColor", rotate: 180 }) }),
1295
+ "Sort Descending"
1296
+ ]
1297
+ }
1298
+ ),
1299
+ F && /* @__PURE__ */ d(
1300
+ L,
1301
+ {
1302
+ component: `${l.componentName}.header.cell.contextMenu.tooltip.item`,
1303
+ onClick: () => e.sortColumn(void 0),
1304
+ children: [
1305
+ /* @__PURE__ */ o(m, { width: 4 }),
1306
+ "Clear Sort"
1307
+ ]
1308
+ }
1309
+ ),
1310
+ V && (J || D || E) && /* @__PURE__ */ o(
1311
+ m,
1312
+ {
1313
+ bb: 1,
1314
+ my: 2,
1315
+ borderColor: "gray-300",
1316
+ component: `${l.componentName}.header.cell.contextMenu.tooltip.item.separator`
1317
+ }
1318
+ ),
1319
+ w && /* @__PURE__ */ d(
1320
+ L,
1321
+ {
1322
+ component: `${l.componentName}.header.cell.contextMenu.tooltip.item`,
1323
+ onClick: () => e.pinColumn("LEFT"),
1324
+ children: [
1325
+ /* @__PURE__ */ o($, { component: `${l.componentName}.header.cell.contextMenu.tooltip.item.icon`, children: /* @__PURE__ */ o(fe, { width: "100%", fill: "currentColor" }) }),
1326
+ "Pin Left"
1327
+ ]
1328
+ }
1329
+ ),
1330
+ y && /* @__PURE__ */ d(
1331
+ L,
1332
+ {
1333
+ component: `${l.componentName}.header.cell.contextMenu.tooltip.item`,
1334
+ onClick: () => e.pinColumn("RIGHT"),
1335
+ children: [
1336
+ /* @__PURE__ */ o($, { component: `${l.componentName}.header.cell.contextMenu.tooltip.item.icon`, children: /* @__PURE__ */ o(fe, { width: "100%", fill: "currentColor", rotate: -90 }) }),
1337
+ "Pin Right"
1338
+ ]
1339
+ }
1340
+ ),
1341
+ R && /* @__PURE__ */ d(L, { component: `${l.componentName}.header.cell.contextMenu.tooltip.item`, onClick: () => e.pinColumn(), children: [
1342
+ /* @__PURE__ */ o(m, { width: 4 }),
1017
1343
  "Unpin"
1018
1344
  ] }),
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: [
1021
- /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(se, { width: "100%", fill: "currentColor" }) }),
1022
- /* @__PURE__ */ p(g, { textWrap: "nowrap", children: [
1345
+ V && J && (D || E) && /* @__PURE__ */ o(m, { component: `${l.componentName}.header.cell.contextMenu.tooltip.item.separator` }),
1346
+ D && /* @__PURE__ */ d(L, { component: `${l.componentName}.header.cell.contextMenu.tooltip.item`, onClick: e.toggleGrouping, children: [
1347
+ /* @__PURE__ */ o($, { component: `${l.componentName}.header.cell.contextMenu.tooltip.item.icon`, children: /* @__PURE__ */ o(ue, { width: "100%", fill: "currentColor" }) }),
1348
+ /* @__PURE__ */ d(m, { textWrap: "nowrap", children: [
1023
1349
  "Group by ",
1024
- s ?? t
1350
+ a ?? t
1025
1351
  ] })
1026
1352
  ] }),
1027
- E && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: c.unGroupAll, children: [
1028
- /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(se, { width: "100%", fill: "currentColor" }) }),
1029
- /* @__PURE__ */ n(g, { textWrap: "nowrap", children: "Un-Group All" })
1353
+ E && /* @__PURE__ */ d(L, { component: `${l.componentName}.header.cell.contextMenu.tooltip.item`, onClick: l.unGroupAll, children: [
1354
+ /* @__PURE__ */ o($, { component: `${l.componentName}.header.cell.contextMenu.tooltip.item.icon`, children: /* @__PURE__ */ o(ue, { width: "100%", fill: "currentColor" }) }),
1355
+ /* @__PURE__ */ o(m, { textWrap: "nowrap", children: "Un-Group All" })
1030
1356
  ] })
1031
1357
  ]
1032
1358
  }
@@ -1035,11 +1361,11 @@ function Ge(l) {
1035
1361
  }
1036
1362
  ) });
1037
1363
  }
1038
- Ge.displayName = "DataGridHeaderCellContextMenu";
1039
- function Se(l) {
1040
- const { column: e } = l;
1041
- return /* @__PURE__ */ n(
1042
- m,
1364
+ Pe.displayName = "DataGridHeaderCellContextMenu";
1365
+ function Ee(s) {
1366
+ const { column: e } = s;
1367
+ return /* @__PURE__ */ o(
1368
+ g,
1043
1369
  {
1044
1370
  height: "fit",
1045
1371
  ai: "center",
@@ -1047,8 +1373,8 @@ function Se(l) {
1047
1373
  right: e.pin === "RIGHT" ? void 0 : 0,
1048
1374
  left: e.pin !== "RIGHT" ? void 0 : 0,
1049
1375
  py: 3,
1050
- children: /* @__PURE__ */ n(
1051
- g,
1376
+ children: /* @__PURE__ */ o(
1377
+ m,
1052
1378
  {
1053
1379
  cursor: "col-resize",
1054
1380
  px: 0.75,
@@ -1056,163 +1382,179 @@ function Se(l) {
1056
1382
  className: "resizer",
1057
1383
  height: "fit",
1058
1384
  props: { onMouseDown: e.resizeColumn, onTouchStart: e.resizeColumn },
1059
- children: /* @__PURE__ */ n(g, { component: "datagrid.header.cell.resizer" })
1385
+ children: /* @__PURE__ */ o(m, { component: `${e.grid.componentName}.header.cell.resizer` })
1060
1386
  }
1061
1387
  )
1062
1388
  }
1063
1389
  );
1064
1390
  }
1065
- Se.displayName = "DataGridHeaderCellResizer";
1066
- function Le(l) {
1067
- const { column: e } = l, {
1391
+ Ee.displayName = "DataGridHeaderCellResizer";
1392
+ function Ve(s) {
1393
+ const { column: e } = s, {
1068
1394
  key: t,
1069
1395
  pin: i,
1070
- left: r,
1071
- right: o,
1072
- isEdge: a,
1073
- isLeaf: u,
1074
- leafs: h,
1075
- grid: s,
1076
- header: c,
1077
- gridRows: d,
1396
+ left: n,
1397
+ right: r,
1398
+ isEdge: c,
1399
+ isLeaf: h,
1400
+ leafs: u,
1401
+ grid: a,
1402
+ header: l,
1403
+ gridRows: p,
1078
1404
  widthVarName: f,
1079
- leftVarName: y,
1080
- rightVarName: v,
1081
- inlineWidth: R,
1082
- isFirstLeaf: N,
1083
- isLastLeaf: S
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();
1086
- }, []), ne = X(() => {
1087
- if (C) return null;
1088
- if (w) {
1089
- const H = s.selectedRows.size === s.props.data.length, U = !H && s.selectedRows.size > 0;
1090
- return /* @__PURE__ */ n(le, { variant: "datagrid", m: 1, indeterminate: U, checked: H, onChange: Z });
1405
+ leftVarName: C,
1406
+ rightVarName: b,
1407
+ inlineWidth: k,
1408
+ isFirstLeaf: P,
1409
+ isLastLeaf: N
1410
+ } = e, S = t === W, F = t === T, w = t === G, y = t === _, R = i === "LEFT", D = i === "RIGHT", E = R || i === "RIGHT", V = R && n === 0, J = R && c, ne = D && c, oe = D && r === 0, Q = h && !S && !w && !y && e.sortable, Z = h ? 1 : u.length, re = !w && !y && e.resizable, A = !w && !y, ee = y ? void 0 : e.align === "right" ? 10 : 3, se = y ? void 0 : e.align === "center" ? 3 : void 0, te = v(() => {
1411
+ a.toggleSelectAllRows();
1412
+ }, []), le = X(() => {
1413
+ if (w) return null;
1414
+ if (y) {
1415
+ const z = a.selectedRows.size === a.props.data.length, j = !z && a.selectedRows.size > 0;
1416
+ return /* @__PURE__ */ o(me, { variant: "datagrid", m: 1, indeterminate: j, checked: z, onChange: te });
1091
1417
  }
1092
- if (L) {
1093
- if (s.groupColumns.size === 1) {
1094
- const H = s.columns.value.leafs.findOrThrow((U) => U.key === s.groupColumns.values().next().value);
1095
- return H.header ?? H.key;
1418
+ if (F) {
1419
+ if (a.groupColumns.size === 1) {
1420
+ const z = a.columns.value.leafs.findOrThrow((j) => j.key === a.groupColumns.values().next().value);
1421
+ return z.header ?? z.key;
1096
1422
  }
1097
1423
  return "Group";
1098
1424
  }
1099
- return c ?? t;
1100
- }, [s.groupColumns, s.selectedRows, Z]);
1101
- return /* @__PURE__ */ n(
1102
- m,
1425
+ return l ?? t;
1426
+ }, [a.groupColumns, a.selectedRows, te]);
1427
+ return /* @__PURE__ */ o(
1428
+ g,
1103
1429
  {
1104
1430
  props: { role: "columnheader" },
1105
- component: "datagrid.header.cell",
1431
+ component: `${a.componentName}.header.cell`,
1106
1432
  variant: {
1107
1433
  isPinned: E,
1108
- isFirstLeftPinned: B,
1109
- isLastLeftPinned: Y,
1110
- isFirstRightPinned: ee,
1111
- isLastRightPinned: te,
1112
- isSortable: K,
1113
- isRowNumber: C,
1114
- isFirstLeaf: N,
1115
- isLastLeaf: S,
1116
- isEmptyCell: x
1434
+ isFirstLeftPinned: V,
1435
+ isLastLeftPinned: J,
1436
+ isFirstRightPinned: ne,
1437
+ isLastRightPinned: oe,
1438
+ isSortable: Q,
1439
+ isRowNumber: w,
1440
+ isFirstLeaf: P,
1441
+ isLastLeaf: N,
1442
+ isEmptyCell: S
1117
1443
  },
1118
- gridRow: d,
1119
- gridColumn: J,
1444
+ gridRow: p,
1445
+ gridColumn: Z,
1120
1446
  style: {
1121
1447
  width: `var(${f})`,
1122
- left: F ? `var(${y})` : void 0,
1123
- right: W ? `var(${v})` : void 0
1448
+ left: R ? `var(${C})` : void 0,
1449
+ right: D ? `var(${b})` : void 0
1124
1450
  },
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(
1127
- m,
1451
+ children: !S && /* @__PURE__ */ d(Ae, { children: [
1452
+ /* @__PURE__ */ o(g, { width: "fit", height: "fit", jc: e.align, props: { onClick: Q ? () => e.sortColumn() : void 0 }, children: /* @__PURE__ */ d(
1453
+ g,
1128
1454
  {
1129
1455
  overflow: "hidden",
1130
- position: u ? void 0 : "sticky",
1456
+ position: h ? void 0 : "sticky",
1131
1457
  ai: "center",
1132
1458
  transition: "none",
1133
- pl: Q,
1134
- pr: re,
1459
+ pl: ee,
1460
+ pr: se,
1135
1461
  style: {
1136
- left: i ? void 0 : `var(${s.leftEdgeVarName})`
1462
+ left: i ? void 0 : `var(${a.leftEdgeVarName})`
1137
1463
  },
1138
1464
  children: [
1139
- /* @__PURE__ */ n(g, { overflow: "hidden", textOverflow: "ellipsis", textWrap: "nowrap", children: ne }),
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" }) }),
1141
- $ && /* @__PURE__ */ n(g, { minWidth: e.align === "right" ? 4 : 10 })
1465
+ /* @__PURE__ */ o(m, { overflow: "hidden", textOverflow: "ellipsis", textWrap: "nowrap", children: le }),
1466
+ t === a.sortColumn && /* @__PURE__ */ o(m, { pl: (k ?? 0) < 58 ? 0 : 2, children: /* @__PURE__ */ o(he, { width: "16px", rotate: a.sortDirection === "ASC" ? 0 : 180, fill: "currentColor" }) }),
1467
+ A && /* @__PURE__ */ o(m, { minWidth: e.align === "right" ? 4 : 10 })
1142
1468
  ]
1143
1469
  }
1144
1470
  ) }),
1145
- ie && /* @__PURE__ */ n(Se, { column: e }),
1146
- $ && /* @__PURE__ */ n(Ge, { column: e })
1471
+ re && /* @__PURE__ */ o(Ee, { column: e }),
1472
+ A && /* @__PURE__ */ o(Pe, { column: e })
1147
1473
  ] })
1148
1474
  }
1149
1475
  );
1150
1476
  }
1151
- Le.displayName = "DataGridHeaderCell";
1152
- function Te(l) {
1153
- const { grid: e } = l;
1154
- return /* @__PURE__ */ p(me, { component: "datagrid.header", style: { gridTemplateColumns: e.gridTemplateColumns.value }, children: [
1155
- e.headerRows.value.map((t) => t.map((i) => /* @__PURE__ */ n(Le, { column: i }, i.uniqueKey))),
1156
- /* @__PURE__ */ n(ke, { grid: e })
1477
+ Ve.displayName = "DataGridHeaderCell";
1478
+ function Be(s) {
1479
+ const { grid: e } = s;
1480
+ return /* @__PURE__ */ d(ce, { component: `${e.componentName}.header`, style: { gridTemplateColumns: e.gridTemplateColumns.value }, children: [
1481
+ e.headerRows.value.map((t) => t.map((i) => /* @__PURE__ */ o(Ve, { column: i }, i.uniqueKey))),
1482
+ /* @__PURE__ */ o(We, { grid: e })
1157
1483
  ] });
1158
1484
  }
1159
- Te.displayName = "DataGridHeader";
1160
- function We(l) {
1161
- const { grid: e } = l, [t, i] = M(0), r = O(null), o = k((u) => {
1162
- r.current !== null && cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
1163
- i(u.target.scrollTop), r.current = null;
1485
+ Be.displayName = "DataGridHeader";
1486
+ function $e(s) {
1487
+ const { grid: e } = s, [t, i] = I(0), n = H(null), r = v((h) => {
1488
+ n.current !== null && cancelAnimationFrame(n.current), n.current = requestAnimationFrame(() => {
1489
+ i(h.target.scrollTop), n.current = null;
1164
1490
  });
1165
1491
  }, []);
1166
- return e.columns.value.userVisibleLeafs.length > 0 ? /* @__PURE__ */ p(g, { overflowX: "scroll", style: { willChange: "scroll-position" }, props: { onScroll: o }, children: [
1167
- /* @__PURE__ */ n(Te, { grid: e }),
1168
- /* @__PURE__ */ n(Re, { grid: e, scrollTop: t })
1169
- ] }) : /* @__PURE__ */ n(Ye, {});
1492
+ return e.columns.value.userVisibleLeafs.length > 0 ? /* @__PURE__ */ d(
1493
+ m,
1494
+ {
1495
+ component: `${e.componentName}.content`,
1496
+ overflowX: "scroll",
1497
+ style: { willChange: "scroll-position" },
1498
+ props: { onScroll: r },
1499
+ children: [
1500
+ /* @__PURE__ */ o(Be, { grid: e }),
1501
+ /* @__PURE__ */ o(Le, { grid: e, scrollTop: t })
1502
+ ]
1503
+ }
1504
+ ) : /* @__PURE__ */ o(lt, { grid: e });
1170
1505
  }
1171
- We.displayName = "DataGridContent";
1172
- function De(l) {
1173
- const { grid: e } = l;
1174
- return e.groupColumns.size === 0 ? null : /* @__PURE__ */ p(m, { component: "datagrid.topBar.columnGroups", children: [
1175
- /* @__PURE__ */ n(I, { component: "datagrid.topBar.columnGroups.icon", children: /* @__PURE__ */ n(se, { width: "100%", fill: "currentColor" }) }),
1506
+ $e.displayName = "DataGridContent";
1507
+ function Me(s) {
1508
+ const { grid: e } = s;
1509
+ return e.groupColumns.size === 0 ? null : /* @__PURE__ */ d(g, { component: `${e.componentName}.topBar.columnGroups`, children: [
1510
+ /* @__PURE__ */ o($, { component: `${e.componentName}.topBar.columnGroups.icon`, children: /* @__PURE__ */ o(ue, { width: "100%", fill: "currentColor" }) }),
1176
1511
  Array.from(e.groupColumns, (t) => {
1177
- const i = e.columns.value.leafs.findOrThrow((r) => r.key === t);
1178
- return /* @__PURE__ */ p(Be.Fragment, { children: [
1179
- /* @__PURE__ */ n(ge, { fill: "currentColor", width: "14px", height: "14px", rotate: -90 }),
1180
- /* @__PURE__ */ p(m, { component: "datagrid.topBar.columnGroups.item", children: [
1512
+ const i = e.columns.value.leafs.findOrThrow((n) => n.key === t);
1513
+ return /* @__PURE__ */ d(Oe.Fragment, { children: [
1514
+ /* @__PURE__ */ o(pe, { fill: "currentColor", width: "14px", height: "14px", rotate: -90 }),
1515
+ /* @__PURE__ */ d(g, { component: `${e.componentName}.topBar.columnGroups.item`, children: [
1181
1516
  i.header ?? i.key,
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: "✕" }) })
1517
+ /* @__PURE__ */ o(
1518
+ L,
1519
+ {
1520
+ component: `${e.componentName}.topBar.columnGroups.item.icon`,
1521
+ onClick: () => e.toggleGrouping(i.key),
1522
+ children: /* @__PURE__ */ o(m, { fontSize: 10, color: "gray-400", hover: { color: "gray-600" }, children: "✕" })
1523
+ }
1524
+ )
1183
1525
  ] })
1184
1526
  ] }, t);
1185
1527
  })
1186
1528
  ] });
1187
1529
  }
1188
- De.displayName = "DataGridColumnGroups";
1189
- function Qe(l) {
1190
- const { grid: e } = l, [t, i] = M(e.globalFilterValue), r = O(null);
1191
- z(() => () => {
1192
- r.current && clearTimeout(r.current);
1530
+ Me.displayName = "DataGridColumnGroups";
1531
+ function ht(s) {
1532
+ const { grid: e } = s, [t, i] = I(e.globalFilterValue), n = H(null);
1533
+ de(() => () => {
1534
+ n.current && clearTimeout(n.current);
1193
1535
  }, []);
1194
- const o = k(
1195
- (c) => {
1196
- const d = c.target.value;
1197
- i(d), r.current && clearTimeout(r.current), r.current = setTimeout(() => {
1198
- e.setGlobalFilter(d), r.current = null;
1536
+ const r = v(
1537
+ (l) => {
1538
+ const p = l.target.value;
1539
+ i(p), n.current && clearTimeout(n.current), n.current = setTimeout(() => {
1540
+ e.setGlobalFilter(p), n.current = null;
1199
1541
  }, 300);
1200
1542
  },
1201
1543
  [e]
1202
- ), a = k(() => {
1544
+ ), c = v(() => {
1203
1545
  i(""), e.setGlobalFilter("");
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,
1546
+ }, [e]), { filtered: h, total: u } = e.filterStats, a = e.hasActiveFilters && h !== u;
1547
+ return /* @__PURE__ */ d(g, { component: `${e.componentName}.topBar.globalFilter`, children: [
1548
+ a && /* @__PURE__ */ d(m, { component: `${e.componentName}.topBar.globalFilter.stats`, children: [
1549
+ h,
1208
1550
  "/",
1209
- h
1551
+ u
1210
1552
  ] }),
1211
- /* @__PURE__ */ p(m, { position: "relative", ai: "center", children: [
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" }) }),
1213
- /* @__PURE__ */ n(j, { placeholder: "Search...", variant: "compact", value: t, onChange: o, pl: 8, pr: t ? 8 : 3 }),
1214
- t && /* @__PURE__ */ n(
1215
- g,
1553
+ /* @__PURE__ */ d(g, { position: "relative", ai: "center", children: [
1554
+ /* @__PURE__ */ o(g, { position: "absolute", left: 3, pointerEvents: "none", color: "gray-400", theme: { dark: { color: "gray-500" } }, children: /* @__PURE__ */ o(Xe, { fill: "currentColor", width: "14px" }) }),
1555
+ /* @__PURE__ */ o(q, { placeholder: "Search...", variant: "compact", value: t, onChange: r, pl: 8, pr: t ? 8 : 3 }),
1556
+ t && /* @__PURE__ */ o(
1557
+ m,
1216
1558
  {
1217
1559
  position: "absolute",
1218
1560
  right: 2,
@@ -1221,53 +1563,53 @@ function Qe(l) {
1221
1563
  color: "gray-400",
1222
1564
  hover: { color: "gray-600" },
1223
1565
  theme: { dark: { color: "gray-500", hover: { color: "gray-300" } } },
1224
- props: { onClick: a },
1225
- children: /* @__PURE__ */ n(g, { fontSize: 12, fontWeight: 600, children: "✕" })
1566
+ props: { onClick: c },
1567
+ children: /* @__PURE__ */ o(m, { fontSize: 12, fontWeight: 600, children: "✕" })
1226
1568
  }
1227
1569
  )
1228
1570
  ] })
1229
1571
  ] });
1230
1572
  }
1231
- function _e(l) {
1232
- const { grid: e } = l, i = X(
1573
+ function Ie(s) {
1574
+ const { grid: e } = s, i = X(
1233
1575
  () => e.columns.value.leafs.filter(
1234
- (s) => ![V, G, _, T].includes(s.key)
1576
+ (a) => ![W, G, _, T].includes(a.key)
1235
1577
  ),
1236
1578
  [e.columns.value.leafs]
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(
1243
- b,
1579
+ ).map((a) => ({
1580
+ id: String(a.key),
1581
+ label: a.header ?? a.key,
1582
+ leaf: a
1583
+ })), n = i.filter((a) => a.leaf.isVisible).map((a) => a.id), r = i.length, h = r - n.length > 0;
1584
+ return /* @__PURE__ */ d(
1585
+ x,
1244
1586
  {
1245
1587
  multiple: !0,
1246
1588
  showCheckbox: !0,
1247
1589
  hideIcon: !0,
1248
1590
  variant: "compact",
1249
- value: r,
1250
- onChange: (s, c) => {
1251
- const d = new Set(c);
1591
+ value: n,
1592
+ onChange: (a, l) => {
1593
+ const p = new Set(l);
1252
1594
  i.forEach((f) => {
1253
- const y = d.has(f.id);
1254
- f.leaf.isVisible !== y && f.leaf.toggleVisibility();
1595
+ const C = p.has(f.id);
1596
+ f.leaf.isVisible !== C && f.leaf.toggleVisibility();
1255
1597
  });
1256
1598
  },
1257
1599
  isSearchable: i.length > 6,
1258
1600
  searchPlaceholder: "Search columns...",
1259
1601
  display: "inline-flex",
1260
1602
  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: [
1265
- /* @__PURE__ */ n("rect", { x: "2", y: "3", width: "4", height: "14", rx: "1", fill: "currentColor", opacity: 0.9 }),
1266
- /* @__PURE__ */ n("rect", { x: "8", y: "3", width: "4", height: "14", rx: "1", fill: "currentColor", opacity: 0.6 }),
1267
- /* @__PURE__ */ n("rect", { x: "14", y: "3", width: "4", height: "14", rx: "1", fill: "currentColor", opacity: 0.3 })
1603
+ /* @__PURE__ */ o(x.Display, { children: (a) => {
1604
+ const l = a.length === 0;
1605
+ return /* @__PURE__ */ d(g, { ai: "center", gap: 2, children: [
1606
+ /* @__PURE__ */ d(U, { viewBox: "0 0 20 20", width: "18", height: "18", children: [
1607
+ /* @__PURE__ */ o("rect", { x: "2", y: "3", width: "4", height: "14", rx: "1", fill: "currentColor", opacity: 0.9 }),
1608
+ /* @__PURE__ */ o("rect", { x: "8", y: "3", width: "4", height: "14", rx: "1", fill: "currentColor", opacity: 0.6 }),
1609
+ /* @__PURE__ */ o("rect", { x: "14", y: "3", width: "4", height: "14", rx: "1", fill: "currentColor", opacity: 0.3 })
1268
1610
  ] }),
1269
- u && /* @__PURE__ */ p(
1270
- g,
1611
+ h && /* @__PURE__ */ d(
1612
+ m,
1271
1613
  {
1272
1614
  tag: "span",
1273
1615
  fontSize: 11,
@@ -1276,75 +1618,69 @@ function _e(l) {
1276
1618
  px: 2,
1277
1619
  py: 0.5,
1278
1620
  borderRadius: 1,
1279
- bgColor: c ? "red-100" : "amber-100",
1280
- color: c ? "red-700" : "amber-700",
1621
+ bgColor: l ? "red-100" : "amber-100",
1622
+ color: l ? "red-700" : "amber-700",
1281
1623
  theme: {
1282
1624
  dark: {
1283
- bgColor: c ? "red-900" : "amber-900",
1284
- color: c ? "red-300" : "amber-300"
1625
+ bgColor: l ? "red-900" : "amber-900",
1626
+ color: l ? "red-300" : "amber-300"
1285
1627
  }
1286
1628
  },
1287
1629
  children: [
1288
- s.length,
1630
+ a.length,
1289
1631
  "/",
1290
- o
1632
+ r
1291
1633
  ]
1292
1634
  }
1293
1635
  )
1294
1636
  ] });
1295
1637
  } }),
1296
- /* @__PURE__ */ n(b.SelectAll, { children: "Show All" }),
1297
- /* @__PURE__ */ n(b.Unselect, { children: "Hide All" }),
1298
- i.map((s) => /* @__PURE__ */ n(b.Item, { value: s.id, textWrap: "nowrap", children: s.label }, s.id))
1638
+ /* @__PURE__ */ o(x.SelectAll, { children: "Show All" }),
1639
+ /* @__PURE__ */ o(x.Unselect, { children: "Hide All" }),
1640
+ i.map((a) => /* @__PURE__ */ o(x.Item, { value: a.id, textWrap: "nowrap", children: a.label }, a.id))
1299
1641
  ]
1300
1642
  }
1301
1643
  );
1302
1644
  }
1303
- _e.displayName = "DataGridTopBarContextMenu";
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: [
1308
- /* @__PURE__ */ n(_e, { grid: e }),
1309
- t && /* @__PURE__ */ n(g, { fontWeight: 600, fontSize: 16, color: "gray-800", theme: { dark: { color: "gray-100" } }, children: t }),
1310
- /* @__PURE__ */ n(De, { grid: e })
1645
+ Ie.displayName = "DataGridTopBarContextMenu";
1646
+ function ze(s) {
1647
+ const { grid: e } = s, { title: t, topBarContent: i, globalFilter: n } = e.props.def;
1648
+ return /* @__PURE__ */ d(g, { component: `${e.componentName}.topBar`, position: "relative", ai: "center", jc: "space-between", gap: 4, flexWrap: "wrap", children: [
1649
+ /* @__PURE__ */ d(g, { ai: "center", gap: 3, flexWrap: "wrap", minWidth: 0, children: [
1650
+ /* @__PURE__ */ o(Ie, { grid: e }),
1651
+ t && /* @__PURE__ */ o(m, { fontWeight: 600, fontSize: 16, color: "gray-800", theme: { dark: { color: "gray-100" } }, children: t }),
1652
+ /* @__PURE__ */ o(Me, { grid: e })
1311
1653
  ] }),
1312
- /* @__PURE__ */ p(m, { ai: "center", gap: 3, flexWrap: "wrap", jc: "flex-end", minWidth: 0, children: [
1313
- i && /* @__PURE__ */ n(g, { children: i }),
1314
- r && /* @__PURE__ */ n(Qe, { grid: e })
1654
+ /* @__PURE__ */ d(g, { ai: "center", gap: 3, flexWrap: "wrap", jc: "flex-end", minWidth: 0, children: [
1655
+ i && /* @__PURE__ */ o(m, { children: i }),
1656
+ n && /* @__PURE__ */ o(ht, { grid: e })
1315
1657
  ] })
1316
1658
  ] });
1317
1659
  }
1318
- Ve.displayName = "DataGridTopBar";
1319
- function Ze(l) {
1320
- const [e, t] = M(0), i = O();
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;
1660
+ ze.displayName = "DataGridTopBar";
1661
+ function ut(s) {
1662
+ const [e, t] = I(0), i = H();
1663
+ i.current || (i.current = new ot(s, () => t((c) => c + 1)));
1664
+ const n = i.current, r = n.props;
1665
+ return r !== s && (n.props = s, r.def !== s.def && (n.sourceColumns.clear(), n.columns.clear(), n.headerRows.clear(), n.gridTemplateColumns.clear(), n.sizes.clear()), (r.data !== s.data || r.def !== s.def || r.globalFilterValue !== s.globalFilterValue || r.columnFilters !== s.columnFilters || r.filters !== s.filters || r.expandedRowKeys !== s.expandedRowKeys || r.page !== s.page) && (n.rows.clear(), n.flatRows.clear(), n.rowOffsets.clear())), n;
1330
1666
  }
1331
- function et(l) {
1332
- const e = Ze(l), t = O(null);
1333
- return Pe(() => {
1667
+ function dt(s) {
1668
+ const e = ut(s), t = H(null);
1669
+ return Ue(() => {
1334
1670
  const i = t.current;
1335
1671
  if (!i) return;
1336
- const r = new ResizeObserver((o) => {
1337
- const a = o[0]?.contentRect.width ?? 0;
1338
- e.setContainerWidth(a);
1672
+ const n = new ResizeObserver((r) => {
1673
+ const c = r[0]?.contentRect.width ?? 0;
1674
+ e.setContainerWidth(c);
1339
1675
  });
1340
- return r.observe(i), () => r.disconnect();
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: [
1342
- e.props.def.topBar && /* @__PURE__ */ n(Ve, { grid: e }),
1343
- /* @__PURE__ */ n(We, { grid: e }),
1344
- e.props.def.bottomBar && /* @__PURE__ */ n(Oe, { grid: e })
1676
+ return n.observe(i), () => n.disconnect();
1677
+ }, [e]), console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render"), /* @__PURE__ */ d(m, { ref: t, component: e.componentName, style: e.sizes.value, props: { role: "presentation" }, children: [
1678
+ e.props.def.topBar && /* @__PURE__ */ o(ze, { grid: e }),
1679
+ /* @__PURE__ */ o($e, { grid: e }),
1680
+ e.props.def.bottomBar && /* @__PURE__ */ o(tt, { grid: e })
1345
1681
  ] });
1346
1682
  }
1347
- et.displayName = "DataGrid";
1683
+ dt.displayName = "DataGrid";
1348
1684
  export {
1349
- et as default
1685
+ dt as default
1350
1686
  };