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