@cronocode/react-box 3.1.9 → 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
- r ? `${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));
@@ -353,30 +492,52 @@ class je {
353
492
  }
354
493
  }
355
494
  /**
356
- * Get filtered data (applies global filter then column filters)
495
+ * Apply external predicate filters from the filters prop
496
+ */
497
+ applyExternalFilters(e) {
498
+ const t = this.props.filters;
499
+ return !t || t.length === 0 ? e : e.filter((i) => t.every((n) => n(i)));
500
+ }
501
+ /**
502
+ * Get filtered data (applies external, global, then column filters)
357
503
  */
358
504
  get filteredData() {
505
+ if (this.isPaginated) return this.props.data;
359
506
  let e = this.props.data;
360
- return this.props.def.globalFilter && (e = this.applyGlobalFilter(e)), e = this.applyColumnFilters(e), e;
507
+ return e = this.applyExternalFilters(e), this.props.def.globalFilter && (e = this.applyGlobalFilter(e)), e = this.applyColumnFilters(e), e;
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
+ });
361
518
  }
362
519
  /**
363
520
  * Set global filter value
364
521
  */
365
522
  setGlobalFilter = (e) => {
366
- 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();
367
526
  };
368
527
  /**
369
528
  * Set a single column filter
370
529
  */
371
530
  setColumnFilter = (e, t) => {
372
531
  const i = { ...this.columnFilters };
373
- 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();
374
535
  };
375
536
  /**
376
537
  * Clear all column filters
377
538
  */
378
539
  clearColumnFilters = () => {
379
- 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();
380
541
  };
381
542
  /**
382
543
  * Clear all filters (global + column)
@@ -390,9 +551,9 @@ class je {
390
551
  getColumnUniqueValues = (e) => {
391
552
  const t = /* @__PURE__ */ new Set();
392
553
  return this.props.data.forEach((i) => {
393
- const r = i[e];
394
- r !== void 0 && t.add(r);
395
- }), 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)));
396
557
  };
397
558
  /**
398
559
  * Check if any filter is active
@@ -404,49 +565,53 @@ class je {
404
565
  * Get count of filtered rows vs total rows
405
566
  */
406
567
  get filterStats() {
568
+ if (this.isPaginated) {
569
+ const e = this.props.def.pagination.totalCount;
570
+ return { filtered: e, total: e };
571
+ }
407
572
  return {
408
573
  filtered: this.filteredData.length,
409
574
  total: this.props.data.length
410
575
  };
411
576
  }
412
- rows = P(() => {
577
+ rows = B(() => {
413
578
  console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid rows memo");
414
579
  let e = this.filteredData;
415
- if (this._sortColumn && (e = e.sortBy((t) => t[this._sortColumn], this._sortDirection)), this.groupColumns.size > 0) {
416
- const t = (i, r, o) => {
417
- const a = r.values().next().value;
418
- r.delete(a);
419
- const u = this.columns.value.leafs.findOrThrow((h) => h.key === a);
420
- return this._sortColumn === T && (i = i.sortBy((h) => h[a], this._sortDirection)), i.groupBy((h) => h[a]).map((h) => {
421
- let s;
422
- r.size > 0 ? s = t(h.values, new Set(r), o + 1) : s = h.values.map((d, f) => new ue(this, d, o + 1 + f));
423
- const c = new we(this, u, s, o, h.key);
424
- return o += 1, c.expanded && (o += s.length), c;
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;
425
590
  });
426
591
  };
427
592
  return t(e, new Set(this.groupColumns), 0);
428
593
  }
429
- return e.map((t, i) => new ue(this, t, i));
594
+ return e.map((t, i) => new we(this, t, i));
430
595
  });
431
- 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)));
432
597
  get rowHeight() {
433
598
  return this.props.def.rowHeight ?? this.DEFAULT_ROW_HEIGHT_PX;
434
599
  }
435
- sizes = P(() => {
600
+ sizes = B(() => {
436
601
  console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid sizes memo");
437
- const e = this.columns.value.flat.reduce((r, o) => {
438
- const { inlineWidth: a } = o;
439
- 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;
440
605
  }, {});
441
606
  e[this.rowHeightVarName] = `${this.rowHeight}px`, e[this.leftEdgeVarName] = `${this.leftEdge}px`;
442
- 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);
443
608
  if (i) {
444
- const r = t.sumBy((o) => o.pin === i.pin && o.key !== G && o.key !== _ ? o.inlineWidth ?? 0 : 0);
445
- 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`;
446
611
  }
447
- return this.groupColumns.forEach((r) => {
448
- const o = this.columns.value.leafs.findOrThrow((a) => a.key === r);
449
- 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`;
450
615
  }), e;
451
616
  });
452
617
  // ========== Flexible Column Sizing ==========
@@ -457,23 +622,23 @@ class je {
457
622
  setContainerWidth = (e) => {
458
623
  this._containerWidth !== e && (this._containerWidth = e, this.flexWidths.clear(), this.sizes.clear(), this.update());
459
624
  };
460
- flexWidths = P(() => {
625
+ flexWidths = B(() => {
461
626
  console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid flexWidths memo");
462
627
  const e = this._containerWidth;
463
628
  if (e <= 0) return {};
464
- const t = this.columns.value.visibleLeafs.filter((c) => c.key !== V), i = (c) => !c.isFlexible || this.columnWidths.has(c.key), r = t.filter(i).sumBy((c) => c.baseWidth), o = t.filter((c) => !i(c)), a = o.sumBy((c) => c.baseWidth), u = e - r;
465
- if (u <= a)
466
- return o.toRecord((c) => [c.key, c.baseWidth]);
467
- const h = {};
468
- let s = 0;
469
- return o.forEach((c, d) => {
470
- if (d === o.length - 1)
471
- h[c.key] = u - s;
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;
472
637
  else {
473
- const f = Math.floor(c.baseWidth / a * u);
474
- h[c.key] = f, s += f;
638
+ const f = Math.floor(l.baseWidth / c * h);
639
+ u[l.key] = f, a += f;
475
640
  }
476
- }), h;
641
+ }), u;
477
642
  });
478
643
  getFlexWidth(e) {
479
644
  return this.flexWidths.value[e];
@@ -482,6 +647,54 @@ class je {
482
647
  MIN_COLUMN_WIDTH_PX = 48;
483
648
  DEFAULT_COLUMN_WIDTH_PX = 200;
484
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
+ });
485
698
  selectedRows = /* @__PURE__ */ new Set();
486
699
  get leftEdge() {
487
700
  return this.columns.value.left.sumBy((e) => e.inlineWidth ?? 0);
@@ -500,24 +713,26 @@ class je {
500
713
  if (t.length > 0)
501
714
  [this._sortDirection] = t, this._sortColumn = this._sortDirection ? e : void 0;
502
715
  else {
503
- const { _sortColumn: i, _sortDirection: r } = this;
504
- 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";
505
718
  }
506
- 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();
507
722
  };
508
723
  pinColumn = (e, t) => {
509
- const i = this.columns.value.flat.findOrThrow((r) => r.uniqueKey === e);
510
- 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();
511
726
  };
512
727
  toggleGrouping = (e) => {
513
- 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();
514
729
  };
515
730
  unGroupAll = () => {
516
731
  const e = new Set(this.groupColumns);
517
- 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();
518
733
  };
519
734
  toggleGroupRow = (e) => {
520
- 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();
521
736
  };
522
737
  toggleRowSelection = (e) => {
523
738
  this.toggleRowsSelection([e]);
@@ -525,7 +740,7 @@ class je {
525
740
  toggleRowsSelection = (e) => {
526
741
  this.selectedRows = new Set(this.selectedRows);
527
742
  const t = e.every((i) => this.selectedRows.has(i));
528
- 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?.({
529
744
  action: t ? "deselect" : "select",
530
745
  affectedRowKeys: e,
531
746
  selectedRowKeys: Array.from(this.selectedRows),
@@ -536,7 +751,7 @@ class je {
536
751
  this.toggleRowsSelection(this.props.data.map((e) => this.getRowKey(e)));
537
752
  };
538
753
  toggleColumnVisibility = (e) => {
539
- 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();
540
755
  };
541
756
  setWidth = (e, t) => {
542
757
  this.columnWidths.set(e, t);
@@ -553,7 +768,7 @@ class je {
553
768
  return this._sortDirection;
554
769
  }
555
770
  }
556
- class qe {
771
+ class rt {
557
772
  constructor(e, t, i) {
558
773
  this.grid = e, this.row = t, this.column = i;
559
774
  }
@@ -561,16 +776,16 @@ class qe {
561
776
  return this.column.key === G ? this.row.rowIndex + 1 : this.column.key === T ? `${this.row.groupValue} (${this.row.count})` : null;
562
777
  }
563
778
  }
564
- class we {
565
- constructor(e, t, i, r, o) {
566
- 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);
567
782
  }
568
783
  get key() {
569
784
  return `${this.parentRow?.key ?? ""}${this.groupColumn.key}${this.groupValue}`;
570
785
  }
571
786
  parentRow;
572
787
  get cells() {
573
- 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));
574
789
  }
575
790
  get selected() {
576
791
  return this.allRows.every((e) => e.selected);
@@ -599,131 +814,206 @@ class we {
599
814
  get groupingColumnGridColumn() {
600
815
  const { visibleLeafs: e } = this.grid.columns.value, { groupingColumn: t } = this;
601
816
  return e.sumBy(
602
- (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
603
818
  );
604
819
  }
605
820
  toggleRow() {
606
821
  this.grid.toggleGroupRow(this.key);
607
822
  }
608
823
  }
609
- function q(l) {
610
- const { children: e, column: t, style: i, ...r } = l, { key: o, pin: a, left: u, right: h, isEdge: s, align: c, widthVarName: d, leftVarName: f, rightVarName: y, isFirstLeaf: v, isLastLeaf: R } = t;
611
- "align" in t.def && (r.jc = c);
612
- const N = o === G, S = o === _, x = o === V, L = a === "LEFT", C = a === "RIGHT";
613
- return /* @__PURE__ */ n(
614
- 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,
828
+ {
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,
615
846
  {
616
- component: "datagrid.body.cell",
847
+ component: `${t.grid.componentName}.body.cell`,
617
848
  props: { role: "cell" },
618
849
  variant: {
619
- isPinned: L || C,
620
- isFirstLeftPinned: L && u === 0,
621
- isLastLeftPinned: L && s,
622
- isFirstRightPinned: C && s,
623
- isLastRightPinned: C && h === 0,
624
- isRowSelection: S,
625
- isRowNumber: N,
626
- isFirstLeaf: v,
627
- isLastLeaf: R,
628
- 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
629
860
  },
630
861
  style: {
631
- width: `var(${d})`,
862
+ width: `var(${p})`,
632
863
  height: `var(${t.grid.rowHeightVarName})`,
633
- left: L ? `var(${f})` : void 0,
634
- right: C ? `var(${y})` : void 0,
864
+ left: F ? `var(${f})` : void 0,
865
+ right: w ? `var(${C})` : void 0,
635
866
  ...i
636
867
  },
637
- ...r,
868
+ ...n,
638
869
  children: e
639
870
  }
640
871
  );
641
872
  }
642
- q.displayName = "DataGridCell";
643
- function ye(l) {
644
- const { row: e } = l, { selected: t, indeterminate: i, cells: r, groupingColumn: o, groupingColumnGridColumn: a, depth: u, expanded: h } = e, s = k(() => {
645
- 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));
646
877
  }, []);
647
- return /* @__PURE__ */ n(m, { className: "grid-row", selected: t, display: "contents", props: { role: "rowgroup" }, children: r.map((c) => {
648
- const { key: d, pin: f, groupColumnWidthVarName: y } = c.column, v = f === "RIGHT";
649
- if (d === T)
650
- return /* @__PURE__ */ n(
651
- q,
652
- {
653
- column: c.column,
654
- style: {
655
- width: `var(${y})`,
656
- right: v ? "0" : void 0
657
- },
658
- br: o.pin === "LEFT" ? 1 : void 0,
659
- gridColumn: a,
660
- pl: 4 * u,
661
- overflow: "auto",
662
- children: /* @__PURE__ */ n(g, { textWrap: "nowrap", px: 3, children: /* @__PURE__ */ p(D, { clean: !0, onClick: () => e.toggleRow(), cursor: "pointer", display: "flex", gap: 1, ai: "center", children: [
663
- /* @__PURE__ */ n(ge, { fill: "currentColor", width: "14px", height: "14px", rotate: h ? 0 : -90 }),
664
- c.value
665
- ] }) })
666
- },
667
- d
668
- );
669
- if (d === _)
670
- return /* @__PURE__ */ n(q, { column: c.column, children: /* @__PURE__ */ n(le, { variant: "datagrid", m: 1, checked: t, indeterminate: i, onChange: s }) }, d);
671
- if (f !== o.pin || d === G || d === V)
672
- return /* @__PURE__ */ n(q, { column: c.column, px: d === G ? 3 : void 0, children: c.value }, d);
673
- }) });
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
+ );
674
915
  }
675
- ye.displayName = "DataGridGroupRow";
676
- function ve(l) {
677
- const { cell: e } = l;
678
- return /* @__PURE__ */ n(m, { height: "fit", width: "fit", overflow: "auto", ai: "center", jc: e.column.align, children: /* @__PURE__ */ n(g, { px: 3, textOverflow: "ellipsis", overflow: "hidden", textWrap: "nowrap", children: e.value }) });
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 }) });
679
920
  }
680
- ve.displayName = "DataGridCellText";
681
- function be(l) {
682
- const { row: e } = l, { selected: t } = e;
683
- return /* @__PURE__ */ n(m, { className: "grid-row", selected: t, display: "contents", props: { role: "row" }, children: e.cells.map((i) => /* @__PURE__ */ n(q, { column: i.column, children: i.column.Cell ? /* @__PURE__ */ n(i.column.Cell, { cell: i }) : /* @__PURE__ */ n(ve, { cell: i }) }, i.column.key)) });
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;
684
948
  }
685
- be.displayName = "DataGridRow";
686
- const Xe = 10, de = 20;
687
- function Re(l) {
688
- const { grid: e, scrollTop: t } = l, i = e.flatRows.value.length, r = Math.max(0, Math.floor(t / e.rowHeight) - de), o = e.props.def.visibleRowsCount ?? Xe, a = e.rowHeight * o + e.rowHeight / 5, u = e.props.data.length === 0, h = X(() => {
689
- if (console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render rows"), u)
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)
690
955
  return null;
691
- const s = o + de * 2;
692
- return e.flatRows.value.take(s, r).map((d) => d instanceof we ? /* @__PURE__ */ n(ye, { row: d }, d.key) : /* @__PURE__ */ n(be, { row: d }, d.key));
693
- }, [e.flatRows.value, u, r, o]);
694
- if (console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render DataGridBody"), u) {
695
- const { noDataComponent: s } = e.props.def, c = e.props.loading ? "loading..." : "empty";
696
- return /* @__PURE__ */ n(m, { jc: "center", ai: "center", width: "fit", position: "sticky", left: 0, style: { height: a }, children: s ?? c });
697
- }
698
- return /* @__PURE__ */ n(g, { style: { height: a }, children: /* @__PURE__ */ n(
699
- 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,
700
988
  {
701
989
  style: {
702
- height: `${i * e.rowHeight}px`
990
+ height: c ? `${r}px` : `${e.flatRows.value.length * e.rowHeight}px`
703
991
  },
704
- children: /* @__PURE__ */ n(
705
- me,
992
+ children: /* @__PURE__ */ o(
993
+ ce,
706
994
  {
707
- component: "datagrid.body",
995
+ component: `${e.componentName}.body`,
708
996
  width: "max-content",
709
997
  minWidth: "fit",
710
998
  transition: "none",
711
999
  style: {
712
- transform: `translate3d(0, ${r * e.rowHeight}px, 0)`,
1000
+ transform: `translate3d(0, ${u}px, 0)`,
713
1001
  willChange: "transform",
714
1002
  gridTemplateColumns: e.gridTemplateColumns.value
715
1003
  },
716
- children: h
1004
+ children: f
717
1005
  }
718
1006
  )
719
1007
  }
720
1008
  ) });
721
1009
  }
722
- Re.displayName = "DataGridBody";
723
- function Ye() {
724
- return /* @__PURE__ */ n(
725
- m,
1010
+ Le.displayName = "DataGridBody";
1011
+ function lt(s) {
1012
+ const { grid: e } = s;
1013
+ return /* @__PURE__ */ o(
1014
+ g,
726
1015
  {
1016
+ component: `${e.componentName}.emptyColumns`,
727
1017
  d: "column",
728
1018
  ai: "center",
729
1019
  jc: "center",
@@ -733,9 +1023,9 @@ function Ye() {
733
1023
  bgColor: "gray-50",
734
1024
  borderRadius: 4,
735
1025
  theme: { dark: { bgColor: "gray-900" } },
736
- children: /* @__PURE__ */ p(m, { d: "column", ai: "center", gap: 3, children: [
737
- /* @__PURE__ */ n(
738
- g,
1026
+ children: /* @__PURE__ */ d(g, { d: "column", ai: "center", gap: 3, children: [
1027
+ /* @__PURE__ */ o(
1028
+ m,
739
1029
  {
740
1030
  width: 16,
741
1031
  height: 16,
@@ -745,7 +1035,7 @@ function Ye() {
745
1035
  display: "flex",
746
1036
  ai: "center",
747
1037
  jc: "center",
748
- 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(
749
1039
  "path",
750
1040
  {
751
1041
  fillRule: "evenodd",
@@ -755,160 +1045,160 @@ function Ye() {
755
1045
  ) })
756
1046
  }
757
1047
  ),
758
- /* @__PURE__ */ p(m, { d: "column", ai: "center", gap: 1, children: [
759
- /* @__PURE__ */ n(g, { fontSize: 18, fontWeight: 600, color: "gray-900", theme: { dark: { color: "gray-50" } }, children: "No Columns Selected" }),
760
- /* @__PURE__ */ n(g, { fontSize: 14, color: "gray-500", textAlign: "center", theme: { dark: { color: "gray-400" } }, children: "Select at least one column from the columns menu to display data" })
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" })
761
1051
  ] })
762
1052
  ] })
763
1053
  }
764
1054
  );
765
1055
  }
766
- function pe({ column: l, grid: e }) {
767
- const t = e.columnFilters[l.key], i = t?.type === "text" ? t.value : "", [r, o] = M(i), a = O(null);
768
- z(() => () => {
769
- 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);
770
1060
  }, []);
771
- const u = k(
772
- (c) => {
773
- const d = c.target.value;
774
- o(d), a.current && clearTimeout(a.current), a.current = setTimeout(() => {
775
- d.trim() ? e.setColumnFilter(l.key, { type: "text", value: d }) : e.setColumnFilter(l.key, void 0), a.current = null;
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;
776
1066
  }, 300);
777
1067
  },
778
- [e, l.key]
779
- ), h = k(() => {
780
- o(""), e.setColumnFilter(l.key, void 0);
781
- }, [e, l.key]), s = typeof l.def.filterable == "object" ? l.def.filterable : {};
782
- return /* @__PURE__ */ p(m, { ai: "center", position: "relative", width: "fit", children: [
783
- /* @__PURE__ */ n(j, { width: "fit", variant: "compact", placeholder: s.placeholder ?? "Filter...", value: r, onChange: u }),
784
- r && /* @__PURE__ */ n(m, { position: "absolute", right: 2, top: "1/2", translateY: "-1/2", cursor: "pointer", props: { onClick: h }, children: /* @__PURE__ */ n(g, { fontSize: 10, color: "gray-400", hover: { color: "gray-600" }, children: "✕" }) })
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: "✕" }) })
785
1075
  ] });
786
1076
  }
787
- function Ke({ column: l, grid: e }) {
788
- const t = e.columnFilters[l.key], i = t?.type === "number" ? t.value : "", r = t?.type === "number" ? t.operator : "eq", o = t?.type === "number" ? t.valueTo : "", [a, u] = M(i), [h, s] = M(r), [c, d] = M(o ?? ""), f = O(null), y = O(null);
789
- z(() => () => {
790
- 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);
791
1081
  }, []);
792
- const v = typeof l.def.filterable == "object" ? l.def.filterable : {}, R = k(
793
- (C, w, F) => {
794
- const W = typeof w == "number" ? w : parseFloat(w);
795
- if (isNaN(W) || w === "") {
796
- 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);
797
1087
  return;
798
1088
  }
799
1089
  const E = {
800
1090
  type: "number",
801
- operator: C,
802
- value: W
1091
+ operator: w,
1092
+ value: D
803
1093
  };
804
- if (C === "between" && F !== void 0 && F !== "") {
805
- const B = typeof F == "number" ? F : parseFloat(String(F));
806
- 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);
807
1097
  }
808
- e.setColumnFilter(l.key, E);
1098
+ e.setColumnFilter(s.key, E);
809
1099
  },
810
- [e, l.key]
811
- ), N = k(
812
- (C) => {
813
- const w = C.target.value;
814
- u(w), f.current && clearTimeout(f.current), f.current = setTimeout(() => {
815
- 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;
816
1106
  }, 300);
817
1107
  },
818
- [h, c, R]
819
- ), S = k(
820
- (C) => {
821
- s(C), R(C, a, c);
1108
+ [u, l, k]
1109
+ ), N = v(
1110
+ (w) => {
1111
+ a(w), k(w, c, l);
822
1112
  },
823
- [a, c, R]
824
- ), x = k(
825
- (C) => {
826
- const w = C.target.value;
827
- d(w), y.current && clearTimeout(y.current), y.current = setTimeout(() => {
828
- 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;
829
1119
  }, 300);
830
1120
  },
831
- [h, a, R]
832
- ), L = k(() => {
833
- u(""), d(""), s("eq"), e.setColumnFilter(l.key, void 0);
834
- }, [e, l.key]);
835
- return /* @__PURE__ */ p(m, { ai: h === "between" ? "start" : "center", gap: 1, width: "fit", children: [
836
- /* @__PURE__ */ p(
837
- 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,
838
1128
  {
839
- value: h,
1129
+ value: u,
840
1130
  variant: "compact",
841
- onChange: (C) => C && S(C),
1131
+ onChange: (w) => w && N(w),
842
1132
  minWidth: 6,
843
1133
  hideIcon: !0,
844
1134
  children: [
845
- /* @__PURE__ */ n(b.Item, { value: "eq", children: "=" }),
846
- /* @__PURE__ */ n(b.Item, { value: "ne", children: "≠" }),
847
- /* @__PURE__ */ n(b.Item, { value: "gt", children: ">" }),
848
- /* @__PURE__ */ n(b.Item, { value: "gte", children: "≥" }),
849
- /* @__PURE__ */ n(b.Item, { value: "lt", children: "<" }),
850
- /* @__PURE__ */ n(b.Item, { value: "lte", children: "≤" }),
851
- /* @__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: "↔" })
852
1142
  ]
853
1143
  }
854
1144
  ),
855
- h === "between" ? /* @__PURE__ */ p(m, { d: "column", gap: 1, flex1: !0, children: [
856
- /* @__PURE__ */ p(m, { ai: "center", position: "relative", flex1: !0, children: [
857
- /* @__PURE__ */ n(
858
- 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,
859
1149
  {
860
1150
  type: "number",
861
1151
  variant: "compact",
862
- placeholder: v.placeholder ?? "From",
863
- value: a,
864
- onChange: N,
1152
+ placeholder: b.placeholder ?? "From",
1153
+ value: c,
1154
+ onChange: P,
865
1155
  width: "fit",
866
- step: v.step
1156
+ step: b.step
867
1157
  }
868
1158
  ),
869
- (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: "✕" }) })
870
1160
  ] }),
871
- /* @__PURE__ */ n(m, { ai: "center", flex1: !0, children: /* @__PURE__ */ n(
872
- j,
1161
+ /* @__PURE__ */ o(g, { ai: "center", flex1: !0, children: /* @__PURE__ */ o(
1162
+ q,
873
1163
  {
874
1164
  type: "number",
875
1165
  variant: "compact",
876
1166
  placeholder: "To",
877
- value: c,
878
- onChange: x,
1167
+ value: l,
1168
+ onChange: S,
879
1169
  width: "fit",
880
- step: v.step
1170
+ step: b.step
881
1171
  }
882
1172
  ) })
883
- ] }) : /* @__PURE__ */ p(m, { ai: "center", position: "relative", flex1: !0, children: [
884
- /* @__PURE__ */ n(
885
- j,
1173
+ ] }) : /* @__PURE__ */ d(g, { ai: "center", position: "relative", flex1: !0, children: [
1174
+ /* @__PURE__ */ o(
1175
+ q,
886
1176
  {
887
1177
  type: "number",
888
1178
  variant: "compact",
889
- placeholder: v.placeholder ?? "Value",
890
- value: a,
891
- onChange: N,
1179
+ placeholder: b.placeholder ?? "Value",
1180
+ value: c,
1181
+ onChange: P,
892
1182
  width: "fit",
893
- step: v.step
1183
+ step: b.step
894
1184
  }
895
1185
  ),
896
- 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: "✕" }) })
897
1187
  ] })
898
1188
  ] });
899
1189
  }
900
- function Je({ column: l, grid: e }) {
901
- const t = e.columnFilters[l.key], i = t?.type === "multiselect" ? t.values : [], r = typeof l.def.filterable == "object" ? l.def.filterable : {}, o = X(() => r.options ? r.options : e.getColumnUniqueValues(l.key).map((h) => ({
902
- label: h === null ? "(empty)" : String(h),
903
- value: h
904
- })), [r.options, e, l.key]), a = k(
905
- (u, h) => {
906
- h.length === 0 ? e.setColumnFilter(l.key, void 0) : e.setColumnFilter(l.key, { type: "multiselect", values: h });
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 });
907
1197
  },
908
- [e, l.key]
1198
+ [e, s.key]
909
1199
  );
910
- return /* @__PURE__ */ p(
911
- b,
1200
+ return /* @__PURE__ */ d(
1201
+ x,
912
1202
  {
913
1203
  multiple: !0,
914
1204
  showCheckbox: !0,
@@ -917,109 +1207,152 @@ function Je({ column: l, grid: e }) {
917
1207
  value: i,
918
1208
  width: "fit",
919
1209
  minWidth: 0,
920
- onChange: a,
1210
+ onChange: c,
921
1211
  variant: "compact",
922
1212
  children: [
923
- /* @__PURE__ */ n(b.Unselect, { children: "Clear" }),
924
- /* @__PURE__ */ n(b.SelectAll, { children: "Select All" }),
925
- 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)))
926
1216
  ]
927
1217
  }
928
1218
  );
929
1219
  }
930
- function xe(l) {
931
- 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;
932
1222
  if (!i) return null;
933
1223
  switch ((typeof i == "object" ? i : { type: "text" }).type) {
934
1224
  case "text":
935
- return /* @__PURE__ */ n(pe, { column: e, grid: t });
1225
+ return /* @__PURE__ */ o(be, { column: e, grid: t });
936
1226
  case "number":
937
- return /* @__PURE__ */ n(Ke, { column: e, grid: t });
1227
+ return /* @__PURE__ */ o(at, { column: e, grid: t });
938
1228
  case "multiselect":
939
- return /* @__PURE__ */ n(Je, { column: e, grid: t });
1229
+ return /* @__PURE__ */ o(ct, { column: e, grid: t });
940
1230
  default:
941
- return /* @__PURE__ */ n(pe, { column: e, grid: t });
1231
+ return /* @__PURE__ */ o(be, { column: e, grid: t });
942
1232
  }
943
1233
  }
944
- xe.displayName = "DataGridColumnFilter";
945
- function Fe(l) {
946
- const { column: e, grid: t } = l, { key: i, pin: r, left: o, right: a, isEdge: u, widthVarName: h, leftVarName: s, rightVarName: c, filterable: d } = e, f = i === V, N = f || i === T || i === G || i === _, S = r === "LEFT", x = r === "RIGHT";
947
- return /* @__PURE__ */ n(
948
- 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,
949
1239
  {
950
- component: "datagrid.filter.cell",
951
- 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 },
952
1242
  px: f ? 0 : 2,
953
1243
  style: {
954
- width: `var(${h})`,
955
- left: S ? `var(${s})` : void 0,
956
- right: x ? `var(${c})` : void 0
1244
+ width: `var(${u})`,
1245
+ left: N ? `var(${a})` : void 0,
1246
+ right: S ? `var(${l})` : void 0
957
1247
  },
958
- children: !N && d && /* @__PURE__ */ n(xe, { column: e, grid: t })
1248
+ children: !P && p && /* @__PURE__ */ o(Te, { column: e, grid: t })
959
1249
  }
960
1250
  );
961
1251
  }
962
- Fe.displayName = "DataGridFilterCell";
963
- function ke(l) {
964
- const { grid: e } = l, { visibleLeafs: t } = e.columns.value;
965
- 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;
966
1256
  }
967
- ke.displayName = "DataGridFilterRow";
968
- function Ge(l) {
969
- const { column: e } = l, { key: t, pin: i, left: r, right: o, isEdge: a, isLeaf: u, align: h, header: s, grid: c } = e, [d, f, y] = Me({ hideOnScroll: !0, event: "mousedown" }), [v, R] = M({ top: 0, left: 0 }), N = X(() => v.left > window.innerWidth / 2, [v.left]), S = u && e.sortable && (c.sortColumn !== t || c.sortDirection === "DESC"), x = u && e.sortable && (c.sortColumn !== t || c.sortDirection === "ASC"), L = u && e.sortable && c.sortColumn === t, C = i !== "LEFT", w = i !== "RIGHT", F = !!i, W = u && t !== T, E = u && t === T, B = S || x || L, Y = C || w || F, ee = h === "right" ? 2 : void 0, te = h === "right" ? void 0 : i === "RIGHT" ? 2.5 : 4, K = t === V, J = t === G, ie = t === _, $ = i === "LEFT", Q = i === "RIGHT", re = $ || i === "RIGHT", Z = $ && r === 0, ne = $ && a, H = Q && a, U = Q && o === 0, Ne = u && !K && !J && !ie && e.sortable;
970
- return /* @__PURE__ */ n(m, { position: "absolute", left: ee, right: te, top: "1/2", translateY: -3, ai: "center", children: /* @__PURE__ */ p(
971
- 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,
972
1262
  {
973
- component: "datagrid.header.cell.contextMenu",
974
- onClick: () => f(!d),
975
- 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 },
976
1266
  children: [
977
- /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.icon", children: /* @__PURE__ */ n(He, { fill: "currentColor" }) }),
978
- d && /* @__PURE__ */ p(
979
- Ae,
1267
+ /* @__PURE__ */ o($, { component: `${l.componentName}.header.cell.contextMenu.icon`, children: /* @__PURE__ */ o(Ke, { fill: "currentColor" }) }),
1268
+ p && /* @__PURE__ */ d(
1269
+ Ye,
980
1270
  {
981
- component: "datagrid.header.cell.contextMenu.tooltip",
982
- onPositionChange: R,
983
- ref: y,
984
- adjustTranslateX: N ? "-100%" : "-21px",
1271
+ component: `${l.componentName}.header.cell.contextMenu.tooltip`,
1272
+ onPositionChange: k,
1273
+ ref: C,
1274
+ adjustTranslateX: P ? "-100%" : "-21px",
985
1275
  adjustTranslateY: "16px",
986
1276
  children: [
987
- S && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn("ASC"), children: [
988
- /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(oe, { width: "100%", fill: "currentColor" }) }),
989
- "Sort Ascending"
990
- ] }),
991
- x && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn("DESC"), children: [
992
- /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(oe, { width: "100%", fill: "currentColor", rotate: 180 }) }),
993
- "Sort Descending"
994
- ] }),
995
- L && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.sortColumn(void 0), children: [
996
- /* @__PURE__ */ n(g, { width: 4 }),
997
- "Clear Sort"
998
- ] }),
999
- B && (Y || W || E) && /* @__PURE__ */ n(g, { bb: 1, my: 2, borderColor: "gray-300", component: "datagrid.header.cell.contextMenu.tooltip.item.separator" }),
1000
- C && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn("LEFT"), children: [
1001
- /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(ce, { width: "100%", fill: "currentColor" }) }),
1002
- "Pin Left"
1003
- ] }),
1004
- w && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn("RIGHT"), children: [
1005
- /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(ce, { width: "100%", fill: "currentColor", rotate: -90 }) }),
1006
- "Pin Right"
1007
- ] }),
1008
- F && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: () => e.pinColumn(), children: [
1009
- /* @__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 }),
1010
1343
  "Unpin"
1011
1344
  ] }),
1012
- B && Y && (W || E) && /* @__PURE__ */ n(g, { component: "datagrid.header.cell.contextMenu.tooltip.item.separator" }),
1013
- W && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: e.toggleGrouping, children: [
1014
- /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(se, { width: "100%", fill: "currentColor" }) }),
1015
- /* @__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: [
1016
1349
  "Group by ",
1017
- s ?? t
1350
+ a ?? t
1018
1351
  ] })
1019
1352
  ] }),
1020
- E && /* @__PURE__ */ p(D, { component: "datagrid.header.cell.contextMenu.tooltip.item", onClick: c.unGroupAll, children: [
1021
- /* @__PURE__ */ n(I, { component: "datagrid.header.cell.contextMenu.tooltip.item.icon", children: /* @__PURE__ */ n(se, { width: "100%", fill: "currentColor" }) }),
1022
- /* @__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" })
1023
1356
  ] })
1024
1357
  ]
1025
1358
  }
@@ -1028,11 +1361,11 @@ function Ge(l) {
1028
1361
  }
1029
1362
  ) });
1030
1363
  }
1031
- Ge.displayName = "DataGridHeaderCellContextMenu";
1032
- function Se(l) {
1033
- const { column: e } = l;
1034
- return /* @__PURE__ */ n(
1035
- m,
1364
+ Pe.displayName = "DataGridHeaderCellContextMenu";
1365
+ function Ee(s) {
1366
+ const { column: e } = s;
1367
+ return /* @__PURE__ */ o(
1368
+ g,
1036
1369
  {
1037
1370
  height: "fit",
1038
1371
  ai: "center",
@@ -1040,8 +1373,8 @@ function Se(l) {
1040
1373
  right: e.pin === "RIGHT" ? void 0 : 0,
1041
1374
  left: e.pin !== "RIGHT" ? void 0 : 0,
1042
1375
  py: 3,
1043
- children: /* @__PURE__ */ n(
1044
- g,
1376
+ children: /* @__PURE__ */ o(
1377
+ m,
1045
1378
  {
1046
1379
  cursor: "col-resize",
1047
1380
  px: 0.75,
@@ -1049,163 +1382,179 @@ function Se(l) {
1049
1382
  className: "resizer",
1050
1383
  height: "fit",
1051
1384
  props: { onMouseDown: e.resizeColumn, onTouchStart: e.resizeColumn },
1052
- children: /* @__PURE__ */ n(g, { component: "datagrid.header.cell.resizer" })
1385
+ children: /* @__PURE__ */ o(m, { component: `${e.grid.componentName}.header.cell.resizer` })
1053
1386
  }
1054
1387
  )
1055
1388
  }
1056
1389
  );
1057
1390
  }
1058
- Se.displayName = "DataGridHeaderCellResizer";
1059
- function Le(l) {
1060
- const { column: e } = l, {
1391
+ Ee.displayName = "DataGridHeaderCellResizer";
1392
+ function Ve(s) {
1393
+ const { column: e } = s, {
1061
1394
  key: t,
1062
1395
  pin: i,
1063
- left: r,
1064
- right: o,
1065
- isEdge: a,
1066
- isLeaf: u,
1067
- leafs: h,
1068
- grid: s,
1069
- header: c,
1070
- 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,
1071
1404
  widthVarName: f,
1072
- leftVarName: y,
1073
- rightVarName: v,
1074
- inlineWidth: R,
1075
- isFirstLeaf: N,
1076
- isLastLeaf: S
1077
- } = e, x = t === V, L = t === T, C = t === G, w = t === _, F = i === "LEFT", W = i === "RIGHT", E = F || i === "RIGHT", B = F && r === 0, Y = F && a, ee = W && a, te = W && o === 0, K = u && !x && !C && !w && e.sortable, J = u ? 1 : h.length, ie = !C && !w && e.resizable, $ = !C && !w, Q = w ? void 0 : e.align === "right" ? 10 : 3, re = w ? void 0 : e.align === "center" ? 3 : void 0, Z = k(() => {
1078
- s.toggleSelectAllRows();
1079
- }, []), ne = X(() => {
1080
- if (C) return null;
1081
- if (w) {
1082
- const H = s.selectedRows.size === s.props.data.length, U = !H && s.selectedRows.size > 0;
1083
- 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 });
1084
1417
  }
1085
- if (L) {
1086
- if (s.groupColumns.size === 1) {
1087
- const H = s.columns.value.leafs.findOrThrow((U) => U.key === s.groupColumns.values().next().value);
1088
- 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;
1089
1422
  }
1090
1423
  return "Group";
1091
1424
  }
1092
- return c ?? t;
1093
- }, [s.groupColumns, s.selectedRows, Z]);
1094
- return /* @__PURE__ */ n(
1095
- m,
1425
+ return l ?? t;
1426
+ }, [a.groupColumns, a.selectedRows, te]);
1427
+ return /* @__PURE__ */ o(
1428
+ g,
1096
1429
  {
1097
1430
  props: { role: "columnheader" },
1098
- component: "datagrid.header.cell",
1431
+ component: `${a.componentName}.header.cell`,
1099
1432
  variant: {
1100
1433
  isPinned: E,
1101
- isFirstLeftPinned: B,
1102
- isLastLeftPinned: Y,
1103
- isFirstRightPinned: ee,
1104
- isLastRightPinned: te,
1105
- isSortable: K,
1106
- isRowNumber: C,
1107
- isFirstLeaf: N,
1108
- isLastLeaf: S,
1109
- 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
1110
1443
  },
1111
- gridRow: d,
1112
- gridColumn: J,
1444
+ gridRow: p,
1445
+ gridColumn: Z,
1113
1446
  style: {
1114
1447
  width: `var(${f})`,
1115
- left: F ? `var(${y})` : void 0,
1116
- right: W ? `var(${v})` : void 0
1448
+ left: R ? `var(${C})` : void 0,
1449
+ right: D ? `var(${b})` : void 0
1117
1450
  },
1118
- children: !x && /* @__PURE__ */ p(Ee, { children: [
1119
- /* @__PURE__ */ n(m, { width: "fit", height: "fit", jc: e.align, props: { onClick: K ? () => e.sortColumn() : void 0 }, children: /* @__PURE__ */ p(
1120
- 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,
1121
1454
  {
1122
1455
  overflow: "hidden",
1123
- position: u ? void 0 : "sticky",
1456
+ position: h ? void 0 : "sticky",
1124
1457
  ai: "center",
1125
1458
  transition: "none",
1126
- pl: Q,
1127
- pr: re,
1459
+ pl: ee,
1460
+ pr: se,
1128
1461
  style: {
1129
- left: i ? void 0 : `var(${s.leftEdgeVarName})`
1462
+ left: i ? void 0 : `var(${a.leftEdgeVarName})`
1130
1463
  },
1131
1464
  children: [
1132
- /* @__PURE__ */ n(g, { overflow: "hidden", textOverflow: "ellipsis", textWrap: "nowrap", children: ne }),
1133
- t === s.sortColumn && /* @__PURE__ */ n(g, { pl: (R ?? 0) < 58 ? 0 : 2, children: /* @__PURE__ */ n(oe, { width: "16px", rotate: s.sortDirection === "ASC" ? 0 : 180, fill: "currentColor" }) }),
1134
- $ && /* @__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 })
1135
1468
  ]
1136
1469
  }
1137
1470
  ) }),
1138
- ie && /* @__PURE__ */ n(Se, { column: e }),
1139
- $ && /* @__PURE__ */ n(Ge, { column: e })
1471
+ re && /* @__PURE__ */ o(Ee, { column: e }),
1472
+ A && /* @__PURE__ */ o(Pe, { column: e })
1140
1473
  ] })
1141
1474
  }
1142
1475
  );
1143
1476
  }
1144
- Le.displayName = "DataGridHeaderCell";
1145
- function Te(l) {
1146
- const { grid: e } = l;
1147
- return /* @__PURE__ */ p(me, { component: "datagrid.header", style: { gridTemplateColumns: e.gridTemplateColumns.value }, children: [
1148
- e.headerRows.value.map((t) => t.map((i) => /* @__PURE__ */ n(Le, { column: i }, i.uniqueKey))),
1149
- /* @__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 })
1150
1483
  ] });
1151
1484
  }
1152
- Te.displayName = "DataGridHeader";
1153
- function We(l) {
1154
- const { grid: e } = l, [t, i] = M(0), r = O(null), o = k((u) => {
1155
- r.current !== null && cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
1156
- 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;
1157
1490
  });
1158
1491
  }, []);
1159
- return e.columns.value.userVisibleLeafs.length > 0 ? /* @__PURE__ */ p(g, { overflowX: "scroll", style: { willChange: "scroll-position" }, props: { onScroll: o }, children: [
1160
- /* @__PURE__ */ n(Te, { grid: e }),
1161
- /* @__PURE__ */ n(Re, { grid: e, scrollTop: t })
1162
- ] }) : /* @__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 });
1163
1505
  }
1164
- We.displayName = "DataGridContent";
1165
- function De(l) {
1166
- const { grid: e } = l;
1167
- return e.groupColumns.size === 0 ? null : /* @__PURE__ */ p(m, { component: "datagrid.topBar.columnGroups", children: [
1168
- /* @__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" }) }),
1169
1511
  Array.from(e.groupColumns, (t) => {
1170
- const i = e.columns.value.leafs.findOrThrow((r) => r.key === t);
1171
- return /* @__PURE__ */ p(Be.Fragment, { children: [
1172
- /* @__PURE__ */ n(ge, { fill: "currentColor", width: "14px", height: "14px", rotate: -90 }),
1173
- /* @__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: [
1174
1516
  i.header ?? i.key,
1175
- /* @__PURE__ */ n(D, { component: "datagrid.topBar.columnGroups.item.icon", onClick: () => e.toggleGrouping(i.key), children: /* @__PURE__ */ n(g, { fontSize: 10, color: "gray-400", hover: { color: "gray-600" }, children: "✕" }) })
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
+ )
1176
1525
  ] })
1177
1526
  ] }, t);
1178
1527
  })
1179
1528
  ] });
1180
1529
  }
1181
- De.displayName = "DataGridColumnGroups";
1182
- function Qe(l) {
1183
- const { grid: e } = l, [t, i] = M(e.globalFilterValue), r = O(null);
1184
- z(() => () => {
1185
- 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);
1186
1535
  }, []);
1187
- const o = k(
1188
- (c) => {
1189
- const d = c.target.value;
1190
- i(d), r.current && clearTimeout(r.current), r.current = setTimeout(() => {
1191
- 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;
1192
1541
  }, 300);
1193
1542
  },
1194
1543
  [e]
1195
- ), a = k(() => {
1544
+ ), c = v(() => {
1196
1545
  i(""), e.setGlobalFilter("");
1197
- }, [e]), { filtered: u, total: h } = e.filterStats, s = e.hasActiveFilters && u !== h;
1198
- return /* @__PURE__ */ p(m, { component: "datagrid.topBar.globalFilter", children: [
1199
- s && /* @__PURE__ */ p(g, { component: "datagrid.topBar.globalFilter.stats", children: [
1200
- u,
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,
1201
1550
  "/",
1202
- h
1551
+ u
1203
1552
  ] }),
1204
- /* @__PURE__ */ p(m, { position: "relative", ai: "center", children: [
1205
- /* @__PURE__ */ n(m, { position: "absolute", left: 3, pointerEvents: "none", color: "gray-400", theme: { dark: { color: "gray-500" } }, children: /* @__PURE__ */ n(ze, { fill: "currentColor", width: "14px" }) }),
1206
- /* @__PURE__ */ n(j, { placeholder: "Search...", variant: "compact", value: t, onChange: o, pl: 8, pr: t ? 8 : 3 }),
1207
- t && /* @__PURE__ */ n(
1208
- 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,
1209
1558
  {
1210
1559
  position: "absolute",
1211
1560
  right: 2,
@@ -1214,53 +1563,53 @@ function Qe(l) {
1214
1563
  color: "gray-400",
1215
1564
  hover: { color: "gray-600" },
1216
1565
  theme: { dark: { color: "gray-500", hover: { color: "gray-300" } } },
1217
- props: { onClick: a },
1218
- children: /* @__PURE__ */ n(g, { fontSize: 12, fontWeight: 600, children: "✕" })
1566
+ props: { onClick: c },
1567
+ children: /* @__PURE__ */ o(m, { fontSize: 12, fontWeight: 600, children: "✕" })
1219
1568
  }
1220
1569
  )
1221
1570
  ] })
1222
1571
  ] });
1223
1572
  }
1224
- function _e(l) {
1225
- const { grid: e } = l, i = X(
1573
+ function Ie(s) {
1574
+ const { grid: e } = s, i = X(
1226
1575
  () => e.columns.value.leafs.filter(
1227
- (s) => ![V, G, _, T].includes(s.key)
1576
+ (a) => ![W, G, _, T].includes(a.key)
1228
1577
  ),
1229
1578
  [e.columns.value.leafs]
1230
- ).map((s) => ({
1231
- id: String(s.key),
1232
- label: s.header ?? s.key,
1233
- leaf: s
1234
- })), r = i.filter((s) => s.leaf.isVisible).map((s) => s.id), o = i.length, u = o - r.length > 0;
1235
- return /* @__PURE__ */ p(
1236
- 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,
1237
1586
  {
1238
1587
  multiple: !0,
1239
1588
  showCheckbox: !0,
1240
1589
  hideIcon: !0,
1241
1590
  variant: "compact",
1242
- value: r,
1243
- onChange: (s, c) => {
1244
- const d = new Set(c);
1591
+ value: n,
1592
+ onChange: (a, l) => {
1593
+ const p = new Set(l);
1245
1594
  i.forEach((f) => {
1246
- const y = d.has(f.id);
1247
- f.leaf.isVisible !== y && f.leaf.toggleVisibility();
1595
+ const C = p.has(f.id);
1596
+ f.leaf.isVisible !== C && f.leaf.toggleVisibility();
1248
1597
  });
1249
1598
  },
1250
1599
  isSearchable: i.length > 6,
1251
1600
  searchPlaceholder: "Search columns...",
1252
1601
  display: "inline-flex",
1253
1602
  children: [
1254
- /* @__PURE__ */ n(b.Display, { children: (s) => {
1255
- const c = s.length === 0;
1256
- return /* @__PURE__ */ p(m, { ai: "center", gap: 2, children: [
1257
- /* @__PURE__ */ p(fe, { viewBox: "0 0 20 20", width: "18", height: "18", children: [
1258
- /* @__PURE__ */ n("rect", { x: "2", y: "3", width: "4", height: "14", rx: "1", fill: "currentColor", opacity: 0.9 }),
1259
- /* @__PURE__ */ n("rect", { x: "8", y: "3", width: "4", height: "14", rx: "1", fill: "currentColor", opacity: 0.6 }),
1260
- /* @__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 })
1261
1610
  ] }),
1262
- u && /* @__PURE__ */ p(
1263
- g,
1611
+ h && /* @__PURE__ */ d(
1612
+ m,
1264
1613
  {
1265
1614
  tag: "span",
1266
1615
  fontSize: 11,
@@ -1269,75 +1618,69 @@ function _e(l) {
1269
1618
  px: 2,
1270
1619
  py: 0.5,
1271
1620
  borderRadius: 1,
1272
- bgColor: c ? "red-100" : "amber-100",
1273
- color: c ? "red-700" : "amber-700",
1621
+ bgColor: l ? "red-100" : "amber-100",
1622
+ color: l ? "red-700" : "amber-700",
1274
1623
  theme: {
1275
1624
  dark: {
1276
- bgColor: c ? "red-900" : "amber-900",
1277
- color: c ? "red-300" : "amber-300"
1625
+ bgColor: l ? "red-900" : "amber-900",
1626
+ color: l ? "red-300" : "amber-300"
1278
1627
  }
1279
1628
  },
1280
1629
  children: [
1281
- s.length,
1630
+ a.length,
1282
1631
  "/",
1283
- o
1632
+ r
1284
1633
  ]
1285
1634
  }
1286
1635
  )
1287
1636
  ] });
1288
1637
  } }),
1289
- /* @__PURE__ */ n(b.SelectAll, { children: "Show All" }),
1290
- /* @__PURE__ */ n(b.Unselect, { children: "Hide All" }),
1291
- 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))
1292
1641
  ]
1293
1642
  }
1294
1643
  );
1295
1644
  }
1296
- _e.displayName = "DataGridTopBarContextMenu";
1297
- function Ve(l) {
1298
- const { grid: e } = l, { title: t, topBarContent: i, globalFilter: r } = e.props.def;
1299
- return /* @__PURE__ */ p(m, { component: "datagrid.topBar", position: "relative", ai: "center", jc: "space-between", gap: 4, flexWrap: "wrap", children: [
1300
- /* @__PURE__ */ p(m, { ai: "center", gap: 3, flexWrap: "wrap", minWidth: 0, children: [
1301
- /* @__PURE__ */ n(_e, { grid: e }),
1302
- t && /* @__PURE__ */ n(g, { fontWeight: 600, fontSize: 16, color: "gray-800", theme: { dark: { color: "gray-100" } }, children: t }),
1303
- /* @__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 })
1304
1653
  ] }),
1305
- /* @__PURE__ */ p(m, { ai: "center", gap: 3, flexWrap: "wrap", jc: "flex-end", minWidth: 0, children: [
1306
- i && /* @__PURE__ */ n(g, { children: i }),
1307
- 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 })
1308
1657
  ] })
1309
1658
  ] });
1310
1659
  }
1311
- Ve.displayName = "DataGridTopBar";
1312
- function Ze(l) {
1313
- const [e, t] = M(0), i = O();
1314
- return i.current || (i.current = new je(l, () => t((r) => r + 1))), z(() => {
1315
- i.current.props = l, i.current.rows.clear(), i.current.flatRows.clear(), i.current.update();
1316
- }, [l.data]), z(() => {
1317
- i.current.props = l, i.current.sourceColumns.clear(), i.current.columns.clear(), i.current.headerRows.clear(), i.current.gridTemplateColumns.clear(), i.current.rows.clear(), i.current.flatRows.clear(), i.current.sizes.clear(), i.current.update();
1318
- }, [l.def]), z(() => {
1319
- i.current.props = l, i.current.update();
1320
- }, [l.loading]), z(() => {
1321
- i.current.props = l, i.current.rows.clear(), i.current.flatRows.clear(), i.current.update();
1322
- }, [l.globalFilterValue, l.columnFilters]), i.current;
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;
1323
1666
  }
1324
- function et(l) {
1325
- const e = Ze(l), t = O(null);
1326
- return Pe(() => {
1667
+ function dt(s) {
1668
+ const e = ut(s), t = H(null);
1669
+ return Ue(() => {
1327
1670
  const i = t.current;
1328
1671
  if (!i) return;
1329
- const r = new ResizeObserver((o) => {
1330
- const a = o[0]?.contentRect.width ?? 0;
1331
- e.setContainerWidth(a);
1672
+ const n = new ResizeObserver((r) => {
1673
+ const c = r[0]?.contentRect.width ?? 0;
1674
+ e.setContainerWidth(c);
1332
1675
  });
1333
- return r.observe(i), () => r.disconnect();
1334
- }, [e]), console.debug("\x1B[36m%s\x1B[0m", "[react-box]: DataGrid render"), /* @__PURE__ */ p(g, { ref: t, component: "datagrid", style: e.sizes.value, props: { role: "presentation" }, children: [
1335
- e.props.def.topBar && /* @__PURE__ */ n(Ve, { grid: e }),
1336
- /* @__PURE__ */ n(We, { grid: e }),
1337
- 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 })
1338
1681
  ] });
1339
1682
  }
1340
- et.displayName = "DataGrid";
1683
+ dt.displayName = "DataGrid";
1341
1684
  export {
1342
- et as default
1685
+ dt as default
1343
1686
  };