@trinityui/design-system 1.0.7 → 1.0.8
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/CHANGELOG.md +18 -0
- package/dist/data-table.js +1 -1
- package/dist/data-table2.js +1250 -0
- package/dist/data.js +122 -1366
- package/dist/essentials.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,1250 @@
|
|
|
1
|
+
import { jsx as e, jsxs as p, Fragment as Ae } from "react/jsx-runtime";
|
|
2
|
+
import br, { useState as R, useCallback as x, useMemo as oe } from "react";
|
|
3
|
+
import { useTheme as pe, Box as D, Stack as $, FormControl as fr, Select as xr, MenuItem as V, TextField as $e, InputAdornment as ue, Tooltip as W, IconButton as I, Menu as Le, ListItemIcon as yr, ListItemText as te, Paper as Ee, Toolbar as _e, Skeleton as A, alpha as ne, Chip as wr, Typography as Ie, Divider as Pe } from "@mui/material";
|
|
4
|
+
import { useGridApiRef as Cr, GridRowEditStopReasons as kr, DataGrid as Sr, GridToolbarColumnsButton as vr, GridToolbarFilterButton as Mr, GridToolbarDensitySelector as zr } from "@mui/x-data-grid";
|
|
5
|
+
import Rr from "@mui/icons-material/Search";
|
|
6
|
+
import Dr from "@mui/icons-material/Refresh";
|
|
7
|
+
import Br from "@mui/icons-material/FileDownload";
|
|
8
|
+
import Oe from "@mui/icons-material/Add";
|
|
9
|
+
import je from "@mui/icons-material/Close";
|
|
10
|
+
import Tr from "@mui/icons-material/Check";
|
|
11
|
+
import { b as i, s as ie } from "./navigation.js";
|
|
12
|
+
import Fr from "@mui/icons-material/MoreVert";
|
|
13
|
+
import "@mui/icons-material/CheckCircle";
|
|
14
|
+
import "@mui/icons-material/Error";
|
|
15
|
+
import "@mui/icons-material/Warning";
|
|
16
|
+
import "@mui/icons-material/Info";
|
|
17
|
+
import "@mui/icons-material/DragIndicator";
|
|
18
|
+
const ge = {
|
|
19
|
+
compact: {
|
|
20
|
+
rowHeight: 48,
|
|
21
|
+
headerHeight: 44,
|
|
22
|
+
fontSize: 12,
|
|
23
|
+
padding: "6px 8px",
|
|
24
|
+
cellPaddingY: 6,
|
|
25
|
+
avatarSize: 28,
|
|
26
|
+
avatarFontSize: 11,
|
|
27
|
+
chipHeight: 22,
|
|
28
|
+
iconSize: 14,
|
|
29
|
+
progressWidth: 80
|
|
30
|
+
},
|
|
31
|
+
standard: {
|
|
32
|
+
rowHeight: 52,
|
|
33
|
+
headerHeight: 56,
|
|
34
|
+
fontSize: 14,
|
|
35
|
+
padding: "8px 16px",
|
|
36
|
+
cellPaddingY: 8,
|
|
37
|
+
avatarSize: 32,
|
|
38
|
+
avatarFontSize: 12,
|
|
39
|
+
chipHeight: 24,
|
|
40
|
+
iconSize: 16,
|
|
41
|
+
progressWidth: 100
|
|
42
|
+
},
|
|
43
|
+
comfortable: {
|
|
44
|
+
rowHeight: 68,
|
|
45
|
+
headerHeight: 64,
|
|
46
|
+
fontSize: 14,
|
|
47
|
+
padding: "12px 16px",
|
|
48
|
+
cellPaddingY: 12,
|
|
49
|
+
avatarSize: 40,
|
|
50
|
+
avatarFontSize: 14,
|
|
51
|
+
chipHeight: 28,
|
|
52
|
+
iconSize: 18,
|
|
53
|
+
progressWidth: 120
|
|
54
|
+
}
|
|
55
|
+
}, Ve = {
|
|
56
|
+
light: {
|
|
57
|
+
headerBg: "#F3F4F6",
|
|
58
|
+
headerText: i.neutral.gray600,
|
|
59
|
+
headerBorder: "#D1D5DB",
|
|
60
|
+
background: i.neutral.white,
|
|
61
|
+
alternateRow: i.neutral.lightGray,
|
|
62
|
+
hover: i.neutral.gray100,
|
|
63
|
+
selected: `${i.primary.light}14`,
|
|
64
|
+
borderColor: i.neutral.gray100,
|
|
65
|
+
text: i.neutral.gray600,
|
|
66
|
+
textSecondary: i.neutral.gray500
|
|
67
|
+
},
|
|
68
|
+
dark: {
|
|
69
|
+
headerBg: "#3F3F46",
|
|
70
|
+
headerText: i.neutral.white,
|
|
71
|
+
headerBorder: "#52525B",
|
|
72
|
+
background: i.neutral.darkBg,
|
|
73
|
+
alternateRow: i.neutral.darkPaper,
|
|
74
|
+
hover: ie.effects.onDark.tint,
|
|
75
|
+
// 4% white - subtle hover
|
|
76
|
+
selected: `${i.primary.light}24`,
|
|
77
|
+
borderColor: ie.effects.onDark.divider,
|
|
78
|
+
// 12% white - divider lines
|
|
79
|
+
text: i.neutral.white,
|
|
80
|
+
textSecondary: i.neutral.gray400
|
|
81
|
+
}
|
|
82
|
+
}, L = {
|
|
83
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
84
|
+
headerWeight: 600,
|
|
85
|
+
cellSecondary: {
|
|
86
|
+
color: i.neutral.gray500
|
|
87
|
+
}
|
|
88
|
+
}, Gr = {
|
|
89
|
+
hover: "background-color 0.15s ease"
|
|
90
|
+
};
|
|
91
|
+
i.neutral.gray100, i.neutral.gray600, i.neutral.gray400;
|
|
92
|
+
i.neutral.white, i.neutral.lightGray, i.neutral.white, i.neutral.lightGray, i.neutral.gray100, `${i.primary.light}`, i.neutral.gray100, i.neutral.gray600, i.neutral.gray500, i.neutral.darkBg, i.neutral.darkPaper, i.neutral.darkBg, i.neutral.darkPaper, ie.effects.onDark.tint, `${i.primary.light}`, ie.effects.onDark.divider, i.neutral.white, i.neutral.gray400;
|
|
93
|
+
const Hr = ({
|
|
94
|
+
columns: s,
|
|
95
|
+
config: a,
|
|
96
|
+
density: v,
|
|
97
|
+
onAdd: c,
|
|
98
|
+
onCancel: l,
|
|
99
|
+
isActive: k,
|
|
100
|
+
onActivate: G,
|
|
101
|
+
mode: g = "light"
|
|
102
|
+
}) => {
|
|
103
|
+
const [y, w] = R({}), [B, m] = R({}), o = ge[v], S = Ve[g], P = pe(), J = s.filter((t) => a.excludeFields?.includes(t.field) || a.editableFields && !a.editableFields.includes(t.field) ? !1 : t.editable !== !1), _ = x((t, d) => {
|
|
104
|
+
w((C) => ({
|
|
105
|
+
...C,
|
|
106
|
+
[t]: d
|
|
107
|
+
})), B[t] && m((C) => {
|
|
108
|
+
const T = { ...C };
|
|
109
|
+
return delete T[t], T;
|
|
110
|
+
});
|
|
111
|
+
}, [B]), z = x(() => {
|
|
112
|
+
const t = {};
|
|
113
|
+
if (a.requiredFields?.forEach((d) => {
|
|
114
|
+
const C = y[d];
|
|
115
|
+
(C == null || C === "") && (t[d] = "Required");
|
|
116
|
+
}), a.validation) {
|
|
117
|
+
const d = a.validation(y);
|
|
118
|
+
Object.assign(t, d);
|
|
119
|
+
}
|
|
120
|
+
return m(t), Object.keys(t).length === 0;
|
|
121
|
+
}, [y, a]), b = x(() => {
|
|
122
|
+
if (z()) {
|
|
123
|
+
const t = a.defaultValues ? { ...a.defaultValues, ...y } : y;
|
|
124
|
+
c(t), w({}), m({});
|
|
125
|
+
}
|
|
126
|
+
}, [z, a.defaultValues, y, c]), f = x(() => {
|
|
127
|
+
w({}), m({}), l();
|
|
128
|
+
}, [l]), E = x((t) => {
|
|
129
|
+
t.key === "Enter" && (t.metaKey || t.ctrlKey) ? b() : t.key === "Escape" && f();
|
|
130
|
+
}, [b, f]);
|
|
131
|
+
return k ? /* @__PURE__ */ p(
|
|
132
|
+
D,
|
|
133
|
+
{
|
|
134
|
+
onKeyDown: E,
|
|
135
|
+
sx: {
|
|
136
|
+
display: "flex",
|
|
137
|
+
alignItems: "center",
|
|
138
|
+
px: 2,
|
|
139
|
+
py: 1,
|
|
140
|
+
borderBottom: `2px solid ${P.palette.primary.main}`,
|
|
141
|
+
backgroundColor: S.background,
|
|
142
|
+
gap: 1
|
|
143
|
+
},
|
|
144
|
+
children: [
|
|
145
|
+
J.map((t) => {
|
|
146
|
+
const d = a.fieldConfigs?.[t.field], C = !!B[t.field], T = y[t.field] ?? "";
|
|
147
|
+
return d?.type === "select" && d.options ? /* @__PURE__ */ e(
|
|
148
|
+
fr,
|
|
149
|
+
{
|
|
150
|
+
size: "small",
|
|
151
|
+
error: C,
|
|
152
|
+
sx: { minWidth: t.width || 150 },
|
|
153
|
+
children: /* @__PURE__ */ p(
|
|
154
|
+
xr,
|
|
155
|
+
{
|
|
156
|
+
value: T,
|
|
157
|
+
onChange: (F) => _(t.field, F.target.value),
|
|
158
|
+
displayEmpty: !0,
|
|
159
|
+
sx: {
|
|
160
|
+
fontFamily: L.fontFamily,
|
|
161
|
+
fontSize: o.fontSize,
|
|
162
|
+
"& .MuiSelect-select": {
|
|
163
|
+
py: 0.75
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ e(V, { value: "", disabled: !0, children: /* @__PURE__ */ e("em", { children: t.headerName }) }),
|
|
168
|
+
d.options.map((F) => /* @__PURE__ */ e(V, { value: F.value, children: F.label }, F.value))
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
},
|
|
173
|
+
t.field
|
|
174
|
+
) : /* @__PURE__ */ e(
|
|
175
|
+
$e,
|
|
176
|
+
{
|
|
177
|
+
size: "small",
|
|
178
|
+
placeholder: t.headerName,
|
|
179
|
+
value: T,
|
|
180
|
+
onChange: (F) => _(t.field, F.target.value),
|
|
181
|
+
error: C,
|
|
182
|
+
helperText: B[t.field],
|
|
183
|
+
type: d?.type === "number" ? "number" : "text",
|
|
184
|
+
slotProps: {
|
|
185
|
+
input: {
|
|
186
|
+
sx: {
|
|
187
|
+
fontFamily: L.fontFamily,
|
|
188
|
+
fontSize: o.fontSize
|
|
189
|
+
},
|
|
190
|
+
startAdornment: d?.prefix ? /* @__PURE__ */ e(ue, { position: "start", children: d.prefix }) : void 0,
|
|
191
|
+
endAdornment: d?.suffix ? /* @__PURE__ */ e(ue, { position: "end", children: d.suffix }) : void 0
|
|
192
|
+
},
|
|
193
|
+
formHelperText: {
|
|
194
|
+
sx: { mx: 0, fontSize: 10 }
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
sx: {
|
|
198
|
+
flex: t.flex || 1,
|
|
199
|
+
minWidth: t.width || 100,
|
|
200
|
+
maxWidth: t.maxWidth,
|
|
201
|
+
"& .MuiOutlinedInput-root": {
|
|
202
|
+
"& input": {
|
|
203
|
+
py: 0.75
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
t.field
|
|
209
|
+
);
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ p($, { direction: "row", spacing: 0.5, sx: { ml: "auto" }, children: [
|
|
212
|
+
/* @__PURE__ */ e(W, { title: "Save (⌘+Enter)", children: /* @__PURE__ */ e(
|
|
213
|
+
I,
|
|
214
|
+
{
|
|
215
|
+
size: "small",
|
|
216
|
+
color: "primary",
|
|
217
|
+
onClick: b,
|
|
218
|
+
sx: {
|
|
219
|
+
backgroundColor: "primary.main",
|
|
220
|
+
color: "common.white",
|
|
221
|
+
"&:hover": {
|
|
222
|
+
backgroundColor: "primary.dark"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
children: /* @__PURE__ */ e(Tr, { fontSize: "small" })
|
|
226
|
+
}
|
|
227
|
+
) }),
|
|
228
|
+
/* @__PURE__ */ e(W, { title: "Cancel (Esc)", children: /* @__PURE__ */ e(
|
|
229
|
+
I,
|
|
230
|
+
{
|
|
231
|
+
size: "small",
|
|
232
|
+
onClick: f,
|
|
233
|
+
sx: {
|
|
234
|
+
"&:hover": {
|
|
235
|
+
backgroundColor: S.hover
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
children: /* @__PURE__ */ e(je, { fontSize: "small" })
|
|
239
|
+
}
|
|
240
|
+
) })
|
|
241
|
+
] })
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
) : /* @__PURE__ */ e(
|
|
245
|
+
D,
|
|
246
|
+
{
|
|
247
|
+
onClick: G,
|
|
248
|
+
sx: {
|
|
249
|
+
display: "flex",
|
|
250
|
+
alignItems: "center",
|
|
251
|
+
px: 2,
|
|
252
|
+
py: o.cellPaddingY,
|
|
253
|
+
borderBottom: `1px solid ${S.borderColor}`,
|
|
254
|
+
backgroundColor: S.hover,
|
|
255
|
+
cursor: "pointer",
|
|
256
|
+
transition: "background-color 0.15s ease",
|
|
257
|
+
"&:hover": {
|
|
258
|
+
backgroundColor: S.selected
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
children: /* @__PURE__ */ p($, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
262
|
+
/* @__PURE__ */ e(Oe, { sx: { fontSize: 18, color: "primary.main" } }),
|
|
263
|
+
/* @__PURE__ */ e(
|
|
264
|
+
D,
|
|
265
|
+
{
|
|
266
|
+
sx: {
|
|
267
|
+
fontFamily: L.fontFamily,
|
|
268
|
+
fontSize: o.fontSize,
|
|
269
|
+
color: "primary.main",
|
|
270
|
+
fontWeight: 500
|
|
271
|
+
},
|
|
272
|
+
children: a.placeholder || "Add new row..."
|
|
273
|
+
}
|
|
274
|
+
)
|
|
275
|
+
] })
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
}, Er = ({
|
|
279
|
+
row: s,
|
|
280
|
+
actions: a,
|
|
281
|
+
maxInline: v = 2
|
|
282
|
+
}) => {
|
|
283
|
+
const [c, l] = br.useState(null), k = !!c, G = a.filter((o) => !o.showInMenu).slice(0, v), g = [
|
|
284
|
+
...a.filter((o) => o.showInMenu),
|
|
285
|
+
...a.filter((o) => !o.showInMenu).slice(v)
|
|
286
|
+
], y = (o) => {
|
|
287
|
+
o.stopPropagation(), l(o.currentTarget);
|
|
288
|
+
}, w = () => {
|
|
289
|
+
l(null);
|
|
290
|
+
}, B = (o) => {
|
|
291
|
+
w(), o.onClick(s);
|
|
292
|
+
}, m = (o) => typeof o.disabled == "function" ? o.disabled(s) : o.disabled;
|
|
293
|
+
return /* @__PURE__ */ p($, { direction: "row", spacing: 0.5, alignItems: "center", children: [
|
|
294
|
+
G.map((o) => /* @__PURE__ */ e(W, { title: o.label, children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
295
|
+
I,
|
|
296
|
+
{
|
|
297
|
+
size: "small",
|
|
298
|
+
color: o.color || "default",
|
|
299
|
+
onClick: (S) => {
|
|
300
|
+
S.stopPropagation(), o.onClick(s);
|
|
301
|
+
},
|
|
302
|
+
disabled: m(o),
|
|
303
|
+
sx: { p: 0.5 },
|
|
304
|
+
children: o.icon
|
|
305
|
+
}
|
|
306
|
+
) }) }, o.id)),
|
|
307
|
+
g.length > 0 && /* @__PURE__ */ p(Ae, { children: [
|
|
308
|
+
/* @__PURE__ */ e(
|
|
309
|
+
I,
|
|
310
|
+
{
|
|
311
|
+
size: "small",
|
|
312
|
+
onClick: y,
|
|
313
|
+
sx: { p: 0.5 },
|
|
314
|
+
children: /* @__PURE__ */ e(Fr, { fontSize: "small" })
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
/* @__PURE__ */ e(
|
|
318
|
+
Le,
|
|
319
|
+
{
|
|
320
|
+
anchorEl: c,
|
|
321
|
+
open: k,
|
|
322
|
+
onClose: w,
|
|
323
|
+
onClick: (o) => o.stopPropagation(),
|
|
324
|
+
transformOrigin: { horizontal: "right", vertical: "top" },
|
|
325
|
+
anchorOrigin: { horizontal: "right", vertical: "bottom" },
|
|
326
|
+
slotProps: {
|
|
327
|
+
paper: {
|
|
328
|
+
sx: {
|
|
329
|
+
minWidth: 160,
|
|
330
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)"
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
children: g.map((o) => /* @__PURE__ */ p(
|
|
335
|
+
V,
|
|
336
|
+
{
|
|
337
|
+
onClick: () => B(o),
|
|
338
|
+
disabled: m(o),
|
|
339
|
+
sx: {
|
|
340
|
+
fontFamily: L.fontFamily,
|
|
341
|
+
fontSize: 13
|
|
342
|
+
},
|
|
343
|
+
children: [
|
|
344
|
+
o.icon && /* @__PURE__ */ e(yr, { sx: { color: o.color ? `${o.color}.main` : void 0 }, children: o.icon }),
|
|
345
|
+
/* @__PURE__ */ e(te, { children: o.label })
|
|
346
|
+
]
|
|
347
|
+
},
|
|
348
|
+
o.id
|
|
349
|
+
))
|
|
350
|
+
}
|
|
351
|
+
)
|
|
352
|
+
] })
|
|
353
|
+
] });
|
|
354
|
+
}, Ir = ({
|
|
355
|
+
row: s,
|
|
356
|
+
actions: a,
|
|
357
|
+
isHovered: v = !1
|
|
358
|
+
}) => {
|
|
359
|
+
const c = (l) => typeof l.disabled == "function" ? l.disabled(s) : l.disabled;
|
|
360
|
+
return /* @__PURE__ */ e(
|
|
361
|
+
$,
|
|
362
|
+
{
|
|
363
|
+
direction: "row",
|
|
364
|
+
spacing: 0.5,
|
|
365
|
+
alignItems: "center",
|
|
366
|
+
sx: {
|
|
367
|
+
opacity: v ? 1 : 0,
|
|
368
|
+
transition: "opacity 0.15s ease-in-out",
|
|
369
|
+
visibility: v ? "visible" : "hidden"
|
|
370
|
+
},
|
|
371
|
+
children: a.map((l) => /* @__PURE__ */ e(W, { title: l.label, children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
372
|
+
I,
|
|
373
|
+
{
|
|
374
|
+
size: "small",
|
|
375
|
+
color: l.color || "default",
|
|
376
|
+
onClick: (k) => {
|
|
377
|
+
k.stopPropagation(), l.onClick(s);
|
|
378
|
+
},
|
|
379
|
+
disabled: c(l),
|
|
380
|
+
sx: {
|
|
381
|
+
p: 0.5,
|
|
382
|
+
"&:hover": {
|
|
383
|
+
backgroundColor: "action.hover"
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
children: l.icon
|
|
387
|
+
}
|
|
388
|
+
) }) }, l.id))
|
|
389
|
+
}
|
|
390
|
+
);
|
|
391
|
+
}, Pr = {
|
|
392
|
+
compact: "compact",
|
|
393
|
+
standard: "standard",
|
|
394
|
+
comfortable: "comfortable"
|
|
395
|
+
}, We = [75, 68, 82, 71, 88, 65, 79, 85, 72, 78], he = [
|
|
396
|
+
[62, 78, 55, 85, 70, 48, 92, 65, 73, 58],
|
|
397
|
+
[71, 45, 88, 63, 52, 79, 67, 90, 54, 82],
|
|
398
|
+
[58, 82, 68, 75, 45, 87, 60, 72, 93, 55],
|
|
399
|
+
[85, 55, 73, 42, 88, 65, 78, 50, 82, 68],
|
|
400
|
+
[68, 75, 52, 90, 58, 82, 47, 73, 88, 62],
|
|
401
|
+
[45, 88, 65, 72, 82, 55, 78, 68, 50, 85],
|
|
402
|
+
[78, 62, 88, 55, 70, 45, 82, 72, 65, 90],
|
|
403
|
+
[52, 78, 70, 88, 62, 75, 55, 85, 48, 72]
|
|
404
|
+
], Wr = (s) => `${We[s % We.length]}%`, Ar = (s, a) => `${he[s % he.length][a % he[0].length]}%`, $r = ({
|
|
405
|
+
columns: s,
|
|
406
|
+
rows: a,
|
|
407
|
+
density: v,
|
|
408
|
+
showCheckbox: c = !1,
|
|
409
|
+
colors: l
|
|
410
|
+
}) => {
|
|
411
|
+
const k = ge[v];
|
|
412
|
+
return /* @__PURE__ */ p(D, { sx: { width: "100%", overflow: "hidden" }, children: [
|
|
413
|
+
/* @__PURE__ */ p(
|
|
414
|
+
D,
|
|
415
|
+
{
|
|
416
|
+
sx: {
|
|
417
|
+
display: "flex",
|
|
418
|
+
alignItems: "center",
|
|
419
|
+
height: k.headerHeight,
|
|
420
|
+
px: 2,
|
|
421
|
+
gap: 2,
|
|
422
|
+
backgroundColor: l.headerBg,
|
|
423
|
+
borderBottom: `2px solid ${l.headerBorder || l.borderColor}`
|
|
424
|
+
},
|
|
425
|
+
children: [
|
|
426
|
+
c && /* @__PURE__ */ e(
|
|
427
|
+
A,
|
|
428
|
+
{
|
|
429
|
+
variant: "rectangular",
|
|
430
|
+
width: 18,
|
|
431
|
+
height: 18,
|
|
432
|
+
sx: { borderRadius: "4px", flexShrink: 0 }
|
|
433
|
+
}
|
|
434
|
+
),
|
|
435
|
+
Array.from({ length: s }).map((G, g) => /* @__PURE__ */ e(D, { sx: { flex: 1, px: 1 }, children: /* @__PURE__ */ e(A, { width: Wr(g), height: 14 }) }, g))
|
|
436
|
+
]
|
|
437
|
+
}
|
|
438
|
+
),
|
|
439
|
+
Array.from({ length: a }).map((G, g) => /* @__PURE__ */ p(
|
|
440
|
+
D,
|
|
441
|
+
{
|
|
442
|
+
sx: {
|
|
443
|
+
display: "flex",
|
|
444
|
+
alignItems: "center",
|
|
445
|
+
height: k.rowHeight,
|
|
446
|
+
px: 2,
|
|
447
|
+
gap: 2,
|
|
448
|
+
borderBottom: `1px solid ${l.borderColor}`,
|
|
449
|
+
backgroundColor: l.background
|
|
450
|
+
},
|
|
451
|
+
children: [
|
|
452
|
+
c && /* @__PURE__ */ e(
|
|
453
|
+
A,
|
|
454
|
+
{
|
|
455
|
+
variant: "rectangular",
|
|
456
|
+
width: 18,
|
|
457
|
+
height: 18,
|
|
458
|
+
sx: { borderRadius: "4px", flexShrink: 0 }
|
|
459
|
+
}
|
|
460
|
+
),
|
|
461
|
+
Array.from({ length: s }).map((y, w) => /* @__PURE__ */ e(D, { sx: { flex: 1, px: 1 }, children: /* @__PURE__ */ e(
|
|
462
|
+
A,
|
|
463
|
+
{
|
|
464
|
+
width: Ar(g, w),
|
|
465
|
+
height: 12,
|
|
466
|
+
sx: { my: 0.5 }
|
|
467
|
+
}
|
|
468
|
+
) }, w))
|
|
469
|
+
]
|
|
470
|
+
},
|
|
471
|
+
g
|
|
472
|
+
))
|
|
473
|
+
] });
|
|
474
|
+
};
|
|
475
|
+
function Lr({
|
|
476
|
+
title: s,
|
|
477
|
+
subtitle: a,
|
|
478
|
+
searchValue: v,
|
|
479
|
+
onSearchChange: c,
|
|
480
|
+
showSearch: l = !0,
|
|
481
|
+
selectedCount: k,
|
|
482
|
+
totalCount: G,
|
|
483
|
+
bulkActions: g,
|
|
484
|
+
onBulkAction: y,
|
|
485
|
+
onClearSelection: w,
|
|
486
|
+
onAddRow: B,
|
|
487
|
+
onRefresh: m,
|
|
488
|
+
onExport: o,
|
|
489
|
+
showExport: S = !0,
|
|
490
|
+
showRefresh: P = !0,
|
|
491
|
+
showColumnSelector: J = !0,
|
|
492
|
+
showFilterButton: _ = !0,
|
|
493
|
+
showDensitySelector: z = !0,
|
|
494
|
+
colors: b
|
|
495
|
+
}) {
|
|
496
|
+
const f = pe(), [E, t] = R(null), d = (M) => {
|
|
497
|
+
t(M.currentTarget);
|
|
498
|
+
}, C = () => {
|
|
499
|
+
t(null);
|
|
500
|
+
}, T = (M) => {
|
|
501
|
+
o?.(M), C();
|
|
502
|
+
}, F = k > 0;
|
|
503
|
+
return /* @__PURE__ */ p(
|
|
504
|
+
_e,
|
|
505
|
+
{
|
|
506
|
+
sx: {
|
|
507
|
+
pl: 2,
|
|
508
|
+
pr: 1.5,
|
|
509
|
+
py: 1.5,
|
|
510
|
+
borderBottom: `1px solid ${b.borderColor}`,
|
|
511
|
+
backgroundColor: F ? ne(f.palette.primary.main, 0.06) : b.background,
|
|
512
|
+
minHeight: "auto !important",
|
|
513
|
+
flexWrap: "wrap",
|
|
514
|
+
gap: 1,
|
|
515
|
+
transition: "background-color 0.2s ease"
|
|
516
|
+
},
|
|
517
|
+
children: [
|
|
518
|
+
/* @__PURE__ */ e(D, { sx: { flex: "1 1 auto", minWidth: 180 }, children: F ? /* @__PURE__ */ p($, { direction: "row", spacing: 1.5, alignItems: "center", children: [
|
|
519
|
+
/* @__PURE__ */ e(
|
|
520
|
+
wr,
|
|
521
|
+
{
|
|
522
|
+
label: `${k} selected`,
|
|
523
|
+
size: "small",
|
|
524
|
+
onDelete: w,
|
|
525
|
+
deleteIcon: /* @__PURE__ */ e(je, { fontSize: "small" }),
|
|
526
|
+
sx: {
|
|
527
|
+
backgroundColor: ne(f.palette.primary.main, 0.12),
|
|
528
|
+
color: "primary.main",
|
|
529
|
+
fontWeight: 600,
|
|
530
|
+
"& .MuiChip-deleteIcon": {
|
|
531
|
+
color: "primary.main",
|
|
532
|
+
"&:hover": {
|
|
533
|
+
color: "primary.dark"
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
),
|
|
539
|
+
g && g.length > 0 && /* @__PURE__ */ e($, { direction: "row", spacing: 0.5, children: g.map((M, Q) => /* @__PURE__ */ e(W, { title: M.label, children: /* @__PURE__ */ e(
|
|
540
|
+
I,
|
|
541
|
+
{
|
|
542
|
+
size: "small",
|
|
543
|
+
onClick: () => y?.(M),
|
|
544
|
+
color: M.color || "default",
|
|
545
|
+
sx: {
|
|
546
|
+
borderRadius: "8px",
|
|
547
|
+
"&:hover": {
|
|
548
|
+
backgroundColor: ne(f.palette.primary.main, 0.1)
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
children: M.icon
|
|
552
|
+
}
|
|
553
|
+
) }, Q)) })
|
|
554
|
+
] }) : /* @__PURE__ */ p(D, { children: [
|
|
555
|
+
s && /* @__PURE__ */ e(
|
|
556
|
+
Ie,
|
|
557
|
+
{
|
|
558
|
+
variant: "subtitle1",
|
|
559
|
+
fontWeight: 600,
|
|
560
|
+
color: "text.primary",
|
|
561
|
+
sx: { lineHeight: 1.3 },
|
|
562
|
+
children: s
|
|
563
|
+
}
|
|
564
|
+
),
|
|
565
|
+
a && /* @__PURE__ */ e(Ie, { variant: "caption", color: "text.secondary", children: a })
|
|
566
|
+
] }) }),
|
|
567
|
+
/* @__PURE__ */ p($, { direction: "row", spacing: 0.5, alignItems: "center", children: [
|
|
568
|
+
l && /* @__PURE__ */ e(
|
|
569
|
+
$e,
|
|
570
|
+
{
|
|
571
|
+
size: "small",
|
|
572
|
+
placeholder: "Search...",
|
|
573
|
+
value: v,
|
|
574
|
+
onChange: (M) => c(M.target.value),
|
|
575
|
+
InputProps: {
|
|
576
|
+
startAdornment: /* @__PURE__ */ e(ue, { position: "start", children: /* @__PURE__ */ e(Rr, { fontSize: "small", sx: { color: b.textSecondary } }) })
|
|
577
|
+
},
|
|
578
|
+
sx: {
|
|
579
|
+
width: 200,
|
|
580
|
+
"& .MuiOutlinedInput-root": {
|
|
581
|
+
borderRadius: "8px",
|
|
582
|
+
backgroundColor: b.background,
|
|
583
|
+
fontSize: "0.875rem",
|
|
584
|
+
"& fieldset": {
|
|
585
|
+
borderColor: b.borderColor
|
|
586
|
+
},
|
|
587
|
+
"&:hover fieldset": {
|
|
588
|
+
borderColor: b.textSecondary
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
),
|
|
594
|
+
B && /* @__PURE__ */ e(W, { title: "Add row", children: /* @__PURE__ */ e(
|
|
595
|
+
I,
|
|
596
|
+
{
|
|
597
|
+
size: "small",
|
|
598
|
+
onClick: B,
|
|
599
|
+
sx: {
|
|
600
|
+
borderRadius: "8px",
|
|
601
|
+
border: `1px solid ${b.borderColor}`,
|
|
602
|
+
"&:hover": {
|
|
603
|
+
backgroundColor: b.hover,
|
|
604
|
+
borderColor: b.textSecondary
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
children: /* @__PURE__ */ e(Oe, { fontSize: "small" })
|
|
608
|
+
}
|
|
609
|
+
) }),
|
|
610
|
+
/* @__PURE__ */ e(Pe, { orientation: "vertical", flexItem: !0, sx: { mx: 0.5, height: 24, alignSelf: "center" } }),
|
|
611
|
+
J && /* @__PURE__ */ e(
|
|
612
|
+
vr,
|
|
613
|
+
{
|
|
614
|
+
slotProps: {
|
|
615
|
+
button: {
|
|
616
|
+
size: "small",
|
|
617
|
+
style: {
|
|
618
|
+
borderRadius: "8px",
|
|
619
|
+
minWidth: "auto",
|
|
620
|
+
paddingLeft: 8,
|
|
621
|
+
paddingRight: 8
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
),
|
|
627
|
+
_ && /* @__PURE__ */ e(
|
|
628
|
+
Mr,
|
|
629
|
+
{
|
|
630
|
+
slotProps: {
|
|
631
|
+
button: {
|
|
632
|
+
size: "small",
|
|
633
|
+
style: {
|
|
634
|
+
borderRadius: "8px",
|
|
635
|
+
minWidth: "auto",
|
|
636
|
+
paddingLeft: 8,
|
|
637
|
+
paddingRight: 8
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
),
|
|
643
|
+
z && /* @__PURE__ */ e(
|
|
644
|
+
zr,
|
|
645
|
+
{
|
|
646
|
+
slotProps: {
|
|
647
|
+
button: {
|
|
648
|
+
size: "small",
|
|
649
|
+
style: {
|
|
650
|
+
borderRadius: "8px",
|
|
651
|
+
minWidth: "auto",
|
|
652
|
+
paddingLeft: 8,
|
|
653
|
+
paddingRight: 8
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
),
|
|
659
|
+
S && o && /* @__PURE__ */ p(Ae, { children: [
|
|
660
|
+
/* @__PURE__ */ e(W, { title: "Export", children: /* @__PURE__ */ e(
|
|
661
|
+
I,
|
|
662
|
+
{
|
|
663
|
+
size: "small",
|
|
664
|
+
onClick: d,
|
|
665
|
+
sx: {
|
|
666
|
+
borderRadius: "8px",
|
|
667
|
+
"&:hover": { backgroundColor: b.hover }
|
|
668
|
+
},
|
|
669
|
+
children: /* @__PURE__ */ e(Br, { fontSize: "small" })
|
|
670
|
+
}
|
|
671
|
+
) }),
|
|
672
|
+
/* @__PURE__ */ p(
|
|
673
|
+
Le,
|
|
674
|
+
{
|
|
675
|
+
anchorEl: E,
|
|
676
|
+
open: !!E,
|
|
677
|
+
onClose: C,
|
|
678
|
+
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
679
|
+
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
680
|
+
slotProps: {
|
|
681
|
+
paper: {
|
|
682
|
+
sx: { borderRadius: "8px", minWidth: 160 }
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
children: [
|
|
686
|
+
/* @__PURE__ */ e(V, { onClick: () => T("csv"), children: /* @__PURE__ */ e(te, { children: "Export as CSV" }) }),
|
|
687
|
+
/* @__PURE__ */ e(V, { onClick: () => T("json"), children: /* @__PURE__ */ e(te, { children: "Export as JSON" }) }),
|
|
688
|
+
/* @__PURE__ */ e(Pe, {}),
|
|
689
|
+
/* @__PURE__ */ e(V, { onClick: () => T("clipboard"), children: /* @__PURE__ */ e(te, { children: "Copy to clipboard" }) })
|
|
690
|
+
]
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
] }),
|
|
694
|
+
P && m && /* @__PURE__ */ e(W, { title: "Refresh", children: /* @__PURE__ */ e(
|
|
695
|
+
I,
|
|
696
|
+
{
|
|
697
|
+
size: "small",
|
|
698
|
+
onClick: m,
|
|
699
|
+
sx: {
|
|
700
|
+
borderRadius: "8px",
|
|
701
|
+
"&:hover": { backgroundColor: b.hover }
|
|
702
|
+
},
|
|
703
|
+
children: /* @__PURE__ */ e(Dr, { fontSize: "small" })
|
|
704
|
+
}
|
|
705
|
+
) })
|
|
706
|
+
] })
|
|
707
|
+
]
|
|
708
|
+
}
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
const ao = ({
|
|
712
|
+
// Core props
|
|
713
|
+
rows: s,
|
|
714
|
+
columns: a,
|
|
715
|
+
loading: v = !1,
|
|
716
|
+
getRowId: c,
|
|
717
|
+
// Density
|
|
718
|
+
density: l = "standard",
|
|
719
|
+
allowDensityChange: k = !0,
|
|
720
|
+
// Selection
|
|
721
|
+
selection: G,
|
|
722
|
+
// Pagination
|
|
723
|
+
pagination: g = { enabled: !0, pageSize: 25 },
|
|
724
|
+
// Sorting & Filtering
|
|
725
|
+
sorting: y = { enabled: !0 },
|
|
726
|
+
filtering: w = { enabled: !0 },
|
|
727
|
+
// Editing
|
|
728
|
+
editing: B,
|
|
729
|
+
// Tree Data
|
|
730
|
+
treeData: m,
|
|
731
|
+
// Row Grouping
|
|
732
|
+
rowGrouping: o,
|
|
733
|
+
// Inline Add
|
|
734
|
+
inlineAdd: S,
|
|
735
|
+
// Column Pinning
|
|
736
|
+
columnPinning: P,
|
|
737
|
+
// Row Reordering
|
|
738
|
+
rowReorder: J,
|
|
739
|
+
// Actions
|
|
740
|
+
rowActions: _,
|
|
741
|
+
rowActionsConfig: z,
|
|
742
|
+
bulkActions: b,
|
|
743
|
+
// Toolbar
|
|
744
|
+
toolbar: f = {
|
|
745
|
+
show: !0,
|
|
746
|
+
showSearch: !0,
|
|
747
|
+
showDensitySelector: !0,
|
|
748
|
+
showColumnVisibility: !0,
|
|
749
|
+
showExport: !0,
|
|
750
|
+
showFilter: !0,
|
|
751
|
+
showRefresh: !0
|
|
752
|
+
},
|
|
753
|
+
// Appearance
|
|
754
|
+
title: E,
|
|
755
|
+
subtitle: t,
|
|
756
|
+
height: d = 500,
|
|
757
|
+
maxHeight: C,
|
|
758
|
+
minHeight: T = 300,
|
|
759
|
+
stickyHeader: F = !0,
|
|
760
|
+
stripedRows: M = !1,
|
|
761
|
+
showBorders: Q = !0,
|
|
762
|
+
elevation: me = 0,
|
|
763
|
+
borderRadius: be = "12px",
|
|
764
|
+
// Callbacks
|
|
765
|
+
onRowClick: Ne,
|
|
766
|
+
onRowDoubleClick: Ke,
|
|
767
|
+
onCellClick: Ue,
|
|
768
|
+
onSelectionChange: X,
|
|
769
|
+
onSortChange: fe,
|
|
770
|
+
onFilterChange: xe,
|
|
771
|
+
onPageChange: ye,
|
|
772
|
+
onRowUpdate: ae,
|
|
773
|
+
onRowAdd: we,
|
|
774
|
+
onRowDelete: _r,
|
|
775
|
+
onRefresh: Ce,
|
|
776
|
+
onExport: le,
|
|
777
|
+
// Styling
|
|
778
|
+
sx: ke,
|
|
779
|
+
className: Se,
|
|
780
|
+
getRowClassName: de,
|
|
781
|
+
getCellClassName: Ye,
|
|
782
|
+
// Slot overrides
|
|
783
|
+
slots: qe,
|
|
784
|
+
slotProps: Z
|
|
785
|
+
}) => {
|
|
786
|
+
const ve = pe(), Me = ve.palette.mode, n = Ve[Me], O = Cr(), [ee, Or] = R(l), [N, ze] = R({
|
|
787
|
+
type: "include",
|
|
788
|
+
ids: /* @__PURE__ */ new Set()
|
|
789
|
+
}), [Je, Qe] = R({
|
|
790
|
+
page: g.defaultPage || 0,
|
|
791
|
+
pageSize: g.pageSize || 25
|
|
792
|
+
}), [Xe, Ze] = R(
|
|
793
|
+
y.defaultSort ? [y.defaultSort] : []
|
|
794
|
+
), [er, rr] = R({
|
|
795
|
+
items: w.defaultFilters || []
|
|
796
|
+
}), [or, tr] = R({}), [nr, re] = R(!1), [K, ir] = R(""), [Re, De] = R(null), U = ge[ee], j = z?.actions || _ || [], se = z?.mode || "menu", Be = oe(() => {
|
|
797
|
+
const r = [...a];
|
|
798
|
+
if (j.length > 0) {
|
|
799
|
+
const h = {
|
|
800
|
+
field: "__actions__",
|
|
801
|
+
headerName: "",
|
|
802
|
+
width: z?.width || (se === "hover" ? 180 : 60),
|
|
803
|
+
sortable: !1,
|
|
804
|
+
filterable: !1,
|
|
805
|
+
disableColumnMenu: !0,
|
|
806
|
+
align: "right",
|
|
807
|
+
headerAlign: "right",
|
|
808
|
+
renderCell: (u) => {
|
|
809
|
+
const H = c ? c(u.row) : u.row.id, q = String(Re) === String(H);
|
|
810
|
+
return se === "hover" ? /* @__PURE__ */ e(
|
|
811
|
+
Ir,
|
|
812
|
+
{
|
|
813
|
+
row: u.row,
|
|
814
|
+
actions: j,
|
|
815
|
+
isHovered: q
|
|
816
|
+
}
|
|
817
|
+
) : /* @__PURE__ */ e(
|
|
818
|
+
Er,
|
|
819
|
+
{
|
|
820
|
+
row: u.row,
|
|
821
|
+
actions: j,
|
|
822
|
+
maxInline: z?.maxInline || 2
|
|
823
|
+
}
|
|
824
|
+
);
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
r.push(h);
|
|
828
|
+
}
|
|
829
|
+
return r;
|
|
830
|
+
}, [a, j, se, z, Re, c]);
|
|
831
|
+
oe(() => {
|
|
832
|
+
if (P?.enabled)
|
|
833
|
+
return {
|
|
834
|
+
left: P.left || [],
|
|
835
|
+
right: P.right || (j.length > 0 && z?.pinned ? ["__actions__"] : [])
|
|
836
|
+
};
|
|
837
|
+
}, [P, j.length, z?.pinned]);
|
|
838
|
+
const Y = oe(() => {
|
|
839
|
+
if (!K.trim()) return s;
|
|
840
|
+
const r = K.toLowerCase();
|
|
841
|
+
return s.filter(
|
|
842
|
+
(h) => Object.values(h).some(
|
|
843
|
+
(u) => u != null && String(u).toLowerCase().includes(r)
|
|
844
|
+
)
|
|
845
|
+
);
|
|
846
|
+
}, [s, K]), ar = x(
|
|
847
|
+
(r) => {
|
|
848
|
+
ze(r), X?.(Array.from(r.ids));
|
|
849
|
+
},
|
|
850
|
+
[X]
|
|
851
|
+
), Te = x(() => {
|
|
852
|
+
ze({ type: "include", ids: /* @__PURE__ */ new Set() }), X?.([]);
|
|
853
|
+
}, [X]), lr = x(
|
|
854
|
+
(r) => {
|
|
855
|
+
Ze(r), r.length > 0 && fe?.(r[0].field, r[0].sort || "asc");
|
|
856
|
+
},
|
|
857
|
+
[fe]
|
|
858
|
+
), dr = x(
|
|
859
|
+
(r) => {
|
|
860
|
+
rr(r), xe?.(r);
|
|
861
|
+
},
|
|
862
|
+
[xe]
|
|
863
|
+
), sr = x(
|
|
864
|
+
(r) => {
|
|
865
|
+
Qe(r), ye?.(r.page, r.pageSize);
|
|
866
|
+
},
|
|
867
|
+
[ye]
|
|
868
|
+
), cr = x((r, h) => {
|
|
869
|
+
r.reason === kr.rowFocusOut && (h.defaultMuiPrevented = !0);
|
|
870
|
+
}, []), hr = x(
|
|
871
|
+
async (r, h) => ae ? await ae(r, h) : r,
|
|
872
|
+
[ae]
|
|
873
|
+
), ur = x(
|
|
874
|
+
(r) => {
|
|
875
|
+
we?.(r), re(!1);
|
|
876
|
+
},
|
|
877
|
+
[we]
|
|
878
|
+
), Fe = x(
|
|
879
|
+
(r) => {
|
|
880
|
+
const h = s.filter((u) => {
|
|
881
|
+
const H = c ? c(u) : u.id;
|
|
882
|
+
return N.ids.has(H);
|
|
883
|
+
});
|
|
884
|
+
r.onClick(h);
|
|
885
|
+
},
|
|
886
|
+
[s, N, c]
|
|
887
|
+
), Ge = x((r) => {
|
|
888
|
+
ir(r);
|
|
889
|
+
}, []), He = x(
|
|
890
|
+
(r) => {
|
|
891
|
+
if (le)
|
|
892
|
+
le(r);
|
|
893
|
+
else if (O.current) {
|
|
894
|
+
if (r === "csv")
|
|
895
|
+
O.current.exportDataAsCsv();
|
|
896
|
+
else if (r === "json") {
|
|
897
|
+
const h = O.current.getRowModels(), u = JSON.stringify(Array.from(h.values()), null, 2), H = new Blob([u], { type: "application/json" }), q = URL.createObjectURL(H), ce = document.createElement("a");
|
|
898
|
+
ce.href = q, ce.download = `${E || "data"}.json`, ce.click(), URL.revokeObjectURL(q);
|
|
899
|
+
} else if (r === "clipboard") {
|
|
900
|
+
const h = O.current.getRowModels(), u = Array.from(h.values()).map((H) => Object.values(H).join(" ")).join(`
|
|
901
|
+
`);
|
|
902
|
+
navigator.clipboard.writeText(u);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
},
|
|
906
|
+
[le, O, E]
|
|
907
|
+
), pr = oe(() => m?.enabled ? {
|
|
908
|
+
treeData: !0,
|
|
909
|
+
getTreeDataPath: (r) => m.getTreeDataPath ? m.getTreeDataPath(r) : r.hierarchy || [String(r.id)],
|
|
910
|
+
groupingColDef: {
|
|
911
|
+
headerName: m.groupingColumnLabel || "Group",
|
|
912
|
+
width: m.groupingColumnWidth || 200
|
|
913
|
+
},
|
|
914
|
+
defaultGroupingExpansionDepth: m.defaultExpanded ? -1 : 0
|
|
915
|
+
} : {}, [m]), gr = x(
|
|
916
|
+
(r) => {
|
|
917
|
+
const h = [];
|
|
918
|
+
if (M && Y.findIndex((H) => (c ? c(H) : H.id) === r.id) % 2 === 1 && h.push("striped-row"), de) {
|
|
919
|
+
const u = de(r.row);
|
|
920
|
+
u && h.push(u);
|
|
921
|
+
}
|
|
922
|
+
return h.join(" ");
|
|
923
|
+
},
|
|
924
|
+
[M, de, Y, c]
|
|
925
|
+
), mr = x(
|
|
926
|
+
() => /* @__PURE__ */ e(
|
|
927
|
+
Lr,
|
|
928
|
+
{
|
|
929
|
+
title: E,
|
|
930
|
+
subtitle: t,
|
|
931
|
+
searchValue: K,
|
|
932
|
+
onSearchChange: Ge,
|
|
933
|
+
showSearch: f.showSearch,
|
|
934
|
+
selectedCount: N.ids.size,
|
|
935
|
+
totalCount: Y.length,
|
|
936
|
+
bulkActions: b,
|
|
937
|
+
onBulkAction: Fe,
|
|
938
|
+
onClearSelection: Te,
|
|
939
|
+
onAddRow: S?.enabled ? () => re(!0) : void 0,
|
|
940
|
+
onRefresh: Ce,
|
|
941
|
+
onExport: f.showExport ? He : void 0,
|
|
942
|
+
showExport: f.showExport,
|
|
943
|
+
showRefresh: f.showRefresh,
|
|
944
|
+
showColumnSelector: f.showColumnVisibility,
|
|
945
|
+
showFilterButton: f.showFilter,
|
|
946
|
+
showDensitySelector: f.showDensitySelector && k,
|
|
947
|
+
colors: n
|
|
948
|
+
}
|
|
949
|
+
),
|
|
950
|
+
[
|
|
951
|
+
E,
|
|
952
|
+
t,
|
|
953
|
+
K,
|
|
954
|
+
Ge,
|
|
955
|
+
f,
|
|
956
|
+
N.ids.size,
|
|
957
|
+
Y.length,
|
|
958
|
+
b,
|
|
959
|
+
Fe,
|
|
960
|
+
Te,
|
|
961
|
+
S?.enabled,
|
|
962
|
+
Ce,
|
|
963
|
+
He,
|
|
964
|
+
k,
|
|
965
|
+
n
|
|
966
|
+
]
|
|
967
|
+
);
|
|
968
|
+
return v ? /* @__PURE__ */ p(
|
|
969
|
+
Ee,
|
|
970
|
+
{
|
|
971
|
+
elevation: me,
|
|
972
|
+
sx: {
|
|
973
|
+
width: "100%",
|
|
974
|
+
height: d,
|
|
975
|
+
borderRadius: be,
|
|
976
|
+
overflow: "hidden",
|
|
977
|
+
border: Q ? `1px solid ${n.borderColor}` : "none",
|
|
978
|
+
backgroundColor: n.background,
|
|
979
|
+
...ke
|
|
980
|
+
},
|
|
981
|
+
className: Se,
|
|
982
|
+
children: [
|
|
983
|
+
f.show && /* @__PURE__ */ p(
|
|
984
|
+
_e,
|
|
985
|
+
{
|
|
986
|
+
sx: {
|
|
987
|
+
pl: 2,
|
|
988
|
+
pr: 1.5,
|
|
989
|
+
py: 1.5,
|
|
990
|
+
borderBottom: `1px solid ${n.borderColor}`,
|
|
991
|
+
minHeight: "auto !important",
|
|
992
|
+
gap: 2
|
|
993
|
+
},
|
|
994
|
+
children: [
|
|
995
|
+
/* @__PURE__ */ e(A, { width: 120, height: 24, sx: { borderRadius: "4px" } }),
|
|
996
|
+
/* @__PURE__ */ e(D, { sx: { flex: 1 } }),
|
|
997
|
+
/* @__PURE__ */ e(A, { width: 180, height: 36, sx: { borderRadius: "8px" } }),
|
|
998
|
+
/* @__PURE__ */ e(A, { width: 32, height: 32, sx: { borderRadius: "8px" } }),
|
|
999
|
+
/* @__PURE__ */ e(A, { width: 32, height: 32, sx: { borderRadius: "8px" } })
|
|
1000
|
+
]
|
|
1001
|
+
}
|
|
1002
|
+
),
|
|
1003
|
+
/* @__PURE__ */ e(
|
|
1004
|
+
$r,
|
|
1005
|
+
{
|
|
1006
|
+
columns: Math.min(a.length, 5),
|
|
1007
|
+
rows: Math.floor((d - 120) / U.rowHeight),
|
|
1008
|
+
density: ee,
|
|
1009
|
+
showCheckbox: G?.enabled,
|
|
1010
|
+
colors: n
|
|
1011
|
+
}
|
|
1012
|
+
)
|
|
1013
|
+
]
|
|
1014
|
+
}
|
|
1015
|
+
) : /* @__PURE__ */ e(D, { sx: { width: "100%", ...ke }, className: Se, children: /* @__PURE__ */ p(
|
|
1016
|
+
Ee,
|
|
1017
|
+
{
|
|
1018
|
+
elevation: me,
|
|
1019
|
+
sx: {
|
|
1020
|
+
width: "100%",
|
|
1021
|
+
height: d,
|
|
1022
|
+
maxHeight: C,
|
|
1023
|
+
minHeight: T,
|
|
1024
|
+
borderRadius: be,
|
|
1025
|
+
overflow: "hidden",
|
|
1026
|
+
border: Q ? `1px solid ${n.borderColor}` : "none",
|
|
1027
|
+
backgroundColor: n.background,
|
|
1028
|
+
display: "flex",
|
|
1029
|
+
flexDirection: "column"
|
|
1030
|
+
},
|
|
1031
|
+
children: [
|
|
1032
|
+
/* @__PURE__ */ e(
|
|
1033
|
+
Sr,
|
|
1034
|
+
{
|
|
1035
|
+
apiRef: O,
|
|
1036
|
+
rows: Y,
|
|
1037
|
+
columns: Be,
|
|
1038
|
+
loading: !1,
|
|
1039
|
+
getRowId: c,
|
|
1040
|
+
density: Pr[ee],
|
|
1041
|
+
checkboxSelection: G?.enabled,
|
|
1042
|
+
rowSelectionModel: N,
|
|
1043
|
+
onRowSelectionModelChange: ar,
|
|
1044
|
+
disableRowSelectionOnClick: !G?.selectOnClick,
|
|
1045
|
+
pagination: !0,
|
|
1046
|
+
paginationModel: Je,
|
|
1047
|
+
onPaginationModelChange: sr,
|
|
1048
|
+
pageSizeOptions: g.pageSizeOptions || [10, 25, 50, 100],
|
|
1049
|
+
sortingMode: y.serverSide ? "server" : "client",
|
|
1050
|
+
sortModel: Xe,
|
|
1051
|
+
onSortModelChange: lr,
|
|
1052
|
+
disableColumnSorting: !y.enabled,
|
|
1053
|
+
filterMode: w.serverSide ? "server" : "client",
|
|
1054
|
+
filterModel: er,
|
|
1055
|
+
onFilterModelChange: dr,
|
|
1056
|
+
disableColumnFilter: !w.enabled,
|
|
1057
|
+
editMode: B?.mode || "cell",
|
|
1058
|
+
rowModesModel: or,
|
|
1059
|
+
onRowModesModelChange: tr,
|
|
1060
|
+
onRowEditStop: cr,
|
|
1061
|
+
processRowUpdate: hr,
|
|
1062
|
+
...pr,
|
|
1063
|
+
disableColumnMenu: !1,
|
|
1064
|
+
columnHeaderHeight: U.headerHeight,
|
|
1065
|
+
rowHeight: U.rowHeight,
|
|
1066
|
+
onRowClick: Ne,
|
|
1067
|
+
onRowDoubleClick: Ke,
|
|
1068
|
+
onCellClick: Ue,
|
|
1069
|
+
getRowClassName: gr,
|
|
1070
|
+
getCellClassName: Ye,
|
|
1071
|
+
slots: {
|
|
1072
|
+
toolbar: f.show ? mr : void 0,
|
|
1073
|
+
...qe
|
|
1074
|
+
},
|
|
1075
|
+
slotProps: {
|
|
1076
|
+
...Z,
|
|
1077
|
+
row: {
|
|
1078
|
+
...Z?.row,
|
|
1079
|
+
onMouseEnter: (r) => {
|
|
1080
|
+
const h = r.currentTarget.getAttribute("data-id");
|
|
1081
|
+
h && De(h), Z?.row?.onMouseEnter?.(r);
|
|
1082
|
+
},
|
|
1083
|
+
onMouseLeave: (r) => {
|
|
1084
|
+
De(null), Z?.row?.onMouseLeave?.(r);
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
},
|
|
1088
|
+
sx: {
|
|
1089
|
+
border: "none",
|
|
1090
|
+
borderRadius: 0,
|
|
1091
|
+
// DataGrid itself should have no border radius (Paper handles it)
|
|
1092
|
+
fontFamily: L.fontFamily,
|
|
1093
|
+
flex: 1,
|
|
1094
|
+
// MUI X DataGrid v8 CSS Variables - these control the theme
|
|
1095
|
+
"--DataGrid-t-header-background-base": n.headerBg,
|
|
1096
|
+
"--DataGrid-t-color-border-base": n.headerBorder || n.borderColor,
|
|
1097
|
+
"--DataGrid-t-color-background-base": n.background,
|
|
1098
|
+
"--DataGrid-t-color-foreground-base": n.text,
|
|
1099
|
+
"--DataGrid-t-color-foreground-muted": n.textSecondary,
|
|
1100
|
+
"--DataGrid-t-cell-background-pinned": n.background,
|
|
1101
|
+
"--DataGrid-t-radius-base": "0px",
|
|
1102
|
+
// No internal border radius
|
|
1103
|
+
// Header styles - with !important to override CSS variables
|
|
1104
|
+
"& .MuiDataGrid-columnHeaders": {
|
|
1105
|
+
backgroundColor: `${n.headerBg} !important`,
|
|
1106
|
+
borderBottom: `2px solid ${n.headerBorder} !important`,
|
|
1107
|
+
borderRadius: "0 !important"
|
|
1108
|
+
// Remove any internal border radius
|
|
1109
|
+
},
|
|
1110
|
+
"& .MuiDataGrid-columnHeader": {
|
|
1111
|
+
fontWeight: L.headerWeight,
|
|
1112
|
+
fontSize: U.fontSize,
|
|
1113
|
+
color: `${n.headerText} !important`,
|
|
1114
|
+
backgroundColor: `${n.headerBg} !important`,
|
|
1115
|
+
borderRadius: "0 !important",
|
|
1116
|
+
// No rounded corners on header cells
|
|
1117
|
+
"&:focus, &:focus-within": {
|
|
1118
|
+
outline: "none"
|
|
1119
|
+
},
|
|
1120
|
+
// Remove rounded corners from first and last header cells
|
|
1121
|
+
"&:first-of-type": {
|
|
1122
|
+
borderTopLeftRadius: "0 !important",
|
|
1123
|
+
borderBottomLeftRadius: "0 !important"
|
|
1124
|
+
},
|
|
1125
|
+
"&:last-of-type": {
|
|
1126
|
+
borderTopRightRadius: "0 !important",
|
|
1127
|
+
borderBottomRightRadius: "0 !important"
|
|
1128
|
+
}
|
|
1129
|
+
},
|
|
1130
|
+
// Target the row containing headers
|
|
1131
|
+
"& .MuiDataGrid-columnHeaderRow": {
|
|
1132
|
+
backgroundColor: `${n.headerBg} !important`,
|
|
1133
|
+
borderRadius: 0
|
|
1134
|
+
},
|
|
1135
|
+
// Target the scrollable header container
|
|
1136
|
+
"& .MuiDataGrid-scrollableHeaders": {
|
|
1137
|
+
borderRadius: 0
|
|
1138
|
+
},
|
|
1139
|
+
// Main container to clip properly
|
|
1140
|
+
"& .MuiDataGrid-main": {
|
|
1141
|
+
borderRadius: 0
|
|
1142
|
+
},
|
|
1143
|
+
"& .MuiDataGrid-columnHeaderTitle": {
|
|
1144
|
+
fontWeight: L.headerWeight
|
|
1145
|
+
},
|
|
1146
|
+
"& .MuiDataGrid-columnSeparator": {
|
|
1147
|
+
color: n.borderColor,
|
|
1148
|
+
opacity: 0.5
|
|
1149
|
+
},
|
|
1150
|
+
// Cell styles
|
|
1151
|
+
"& .MuiDataGrid-cell": {
|
|
1152
|
+
fontSize: U.fontSize,
|
|
1153
|
+
borderBottom: `1px solid ${n.borderColor}`,
|
|
1154
|
+
color: n.text,
|
|
1155
|
+
display: "flex",
|
|
1156
|
+
alignItems: "center",
|
|
1157
|
+
"&:focus, &:focus-within": {
|
|
1158
|
+
outline: "none"
|
|
1159
|
+
}
|
|
1160
|
+
},
|
|
1161
|
+
// Row styles
|
|
1162
|
+
"& .MuiDataGrid-row": {
|
|
1163
|
+
transition: Gr.hover,
|
|
1164
|
+
"&:hover": {
|
|
1165
|
+
backgroundColor: n.hover
|
|
1166
|
+
},
|
|
1167
|
+
"&.Mui-selected": {
|
|
1168
|
+
backgroundColor: n.selected,
|
|
1169
|
+
"&:hover": {
|
|
1170
|
+
backgroundColor: ne(ve.palette.primary.main, 0.12)
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
},
|
|
1174
|
+
"& .MuiDataGrid-row.striped-row": {
|
|
1175
|
+
backgroundColor: n.alternateRow,
|
|
1176
|
+
"&:hover": {
|
|
1177
|
+
backgroundColor: n.hover
|
|
1178
|
+
}
|
|
1179
|
+
},
|
|
1180
|
+
// Footer styles
|
|
1181
|
+
"& .MuiDataGrid-footerContainer": {
|
|
1182
|
+
borderTop: `1px solid ${n.borderColor}`,
|
|
1183
|
+
backgroundColor: n.background,
|
|
1184
|
+
minHeight: 48
|
|
1185
|
+
},
|
|
1186
|
+
"& .MuiTablePagination-root": {
|
|
1187
|
+
color: n.text
|
|
1188
|
+
},
|
|
1189
|
+
"& .MuiTablePagination-selectLabel, & .MuiTablePagination-displayedRows": {
|
|
1190
|
+
fontSize: "0.8125rem",
|
|
1191
|
+
color: n.textSecondary
|
|
1192
|
+
},
|
|
1193
|
+
// Checkbox styles
|
|
1194
|
+
"& .MuiCheckbox-root": {
|
|
1195
|
+
color: n.textSecondary,
|
|
1196
|
+
padding: "6px",
|
|
1197
|
+
"&.Mui-checked": {
|
|
1198
|
+
color: "primary.main"
|
|
1199
|
+
}
|
|
1200
|
+
},
|
|
1201
|
+
// Empty/loading overlay
|
|
1202
|
+
"& .MuiDataGrid-overlay": {
|
|
1203
|
+
backgroundColor: "transparent"
|
|
1204
|
+
},
|
|
1205
|
+
// Virtual scroller
|
|
1206
|
+
"& .MuiDataGrid-virtualScroller": {
|
|
1207
|
+
backgroundColor: n.background
|
|
1208
|
+
},
|
|
1209
|
+
// Toolbar container
|
|
1210
|
+
"& .MuiDataGrid-toolbarContainer": {
|
|
1211
|
+
padding: 0
|
|
1212
|
+
},
|
|
1213
|
+
// Scrollbar styling
|
|
1214
|
+
"& .MuiDataGrid-virtualScroller::-webkit-scrollbar": {
|
|
1215
|
+
width: 8,
|
|
1216
|
+
height: 8
|
|
1217
|
+
},
|
|
1218
|
+
"& .MuiDataGrid-virtualScroller::-webkit-scrollbar-track": {
|
|
1219
|
+
backgroundColor: "transparent"
|
|
1220
|
+
},
|
|
1221
|
+
"& .MuiDataGrid-virtualScroller::-webkit-scrollbar-thumb": {
|
|
1222
|
+
backgroundColor: n.borderColor,
|
|
1223
|
+
borderRadius: 4,
|
|
1224
|
+
"&:hover": {
|
|
1225
|
+
backgroundColor: n.textSecondary
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
),
|
|
1231
|
+
S?.enabled && /* @__PURE__ */ e(
|
|
1232
|
+
Hr,
|
|
1233
|
+
{
|
|
1234
|
+
columns: Be,
|
|
1235
|
+
config: S,
|
|
1236
|
+
density: ee,
|
|
1237
|
+
onAdd: ur,
|
|
1238
|
+
onCancel: () => re(!1),
|
|
1239
|
+
isActive: nr,
|
|
1240
|
+
onActivate: () => re(!0),
|
|
1241
|
+
mode: Me
|
|
1242
|
+
}
|
|
1243
|
+
)
|
|
1244
|
+
]
|
|
1245
|
+
}
|
|
1246
|
+
) });
|
|
1247
|
+
};
|
|
1248
|
+
export {
|
|
1249
|
+
ao as D
|
|
1250
|
+
};
|