dynamic-mui 2.5.0 → 2.5.1
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/README.md +61 -0
- package/dist/{AIForm-Czsvpf7g.mjs → AIForm-BVJ7qhP5.mjs} +2712 -2521
- package/dist/AIForm-D8_6RVmA.js +44 -0
- package/dist/{accordion-8p1FoyfL.js → accordion-B3fSXKqC.js} +1 -1
- package/dist/{accordion-CQ4Vldth.mjs → accordion-BxTjyh5y.mjs} +1 -1
- package/dist/{addressfield-N7DifI3i.mjs → addressfield-C9VaV9xw.mjs} +1 -1
- package/dist/{addressfield-T4e_d87q.js → addressfield-Cv8zK_sb.js} +1 -1
- package/dist/ai/index.cjs +1 -1
- package/dist/ai/index.mjs +1 -1
- package/dist/{asyncautocomplete-BB_MyjIj.mjs → asyncautocomplete-BveFRqpV.mjs} +1 -1
- package/dist/{asyncautocomplete-CpO6EO3W.js → asyncautocomplete-CoOb7mtv.js} +1 -1
- package/dist/{bar-CbpJ-MEV.mjs → bar-BfMaIpfo.mjs} +1 -1
- package/dist/{bar-BOse0ZkP.js → bar-CE_D8esp.js} +1 -1
- package/dist/{cascadeselect-PzCw6JHX.mjs → cascadeselect-C53hT-C-.mjs} +1 -1
- package/dist/{cascadeselect-C30RVgmc.js → cascadeselect-CWECmehh.js} +1 -1
- package/dist/collection-Cf87KWZM.js +1 -0
- package/dist/collection-HUYkt74J.mjs +1140 -0
- package/dist/{colorpicker-CMhVJNQT.mjs → colorpicker-BRQPl_IL.mjs} +1 -1
- package/dist/{colorpicker-DoNrfUY7.js → colorpicker-zE3r16Gc.js} +1 -1
- package/dist/components/controls/Collection/CollectionList.d.ts +22 -0
- package/dist/components/controls/Collection/ItemDialog.d.ts +20 -0
- package/dist/components/controls/Collection/collection.d.ts +9 -0
- package/dist/components/controls/Collection/parts.d.ts +39 -0
- package/dist/components/controls/Collection/tree.d.ts +18 -0
- package/dist/components/controls/Collection/ui.d.ts +49 -0
- package/dist/components/controls/index.d.ts +1 -0
- package/dist/{consentfield-Bp1dXs7L.js → consentfield-CEddOmCa.js} +1 -1
- package/dist/{consentfield-DIa3sXrr.mjs → consentfield-Cylid9il.mjs} +1 -1
- package/dist/{datatable-CyfyY3Wh.js → datatable-3MUZQhnx.js} +1 -1
- package/dist/{datatable-CO0Iv6R6.mjs → datatable-BWimO7zD.mjs} +1 -1
- package/dist/dynamic-mui.cjs +1 -1
- package/dist/dynamic-mui.mjs +2 -2
- package/dist/{editabletable-CCDJ2BPB.js → editabletable--ow4E3bB.js} +1 -1
- package/dist/{editabletable-C_MA7QEb.mjs → editabletable-CVJ14zrm.mjs} +1 -1
- package/dist/{fileupload-WV5shCIK.js → fileupload-B7f6VOb0.js} +1 -1
- package/dist/{fileupload-DX3dxKFN.mjs → fileupload-DHiYLdJ5.mjs} +1 -1
- package/dist/{formrepeater-D5K8qgAA.mjs → formrepeater-BGZGTcVb.mjs} +1 -1
- package/dist/{formrepeater-Cxu8Dk8P.js → formrepeater-CvWeLug8.js} +1 -1
- package/dist/{formwizard-B-HCfrnp.mjs → formwizard-BeJK5mqc.mjs} +1 -1
- package/dist/{formwizard-HRF3hTyF.js → formwizard-DrHKFPfN.js} +1 -1
- package/dist/{geofield-DlqMZ_hl.mjs → geofield-Bchfb6__.mjs} +1 -1
- package/dist/{geofield-0k7PkHRa.js → geofield-thoXisie.js} +1 -1
- package/dist/{group-mONe185y.js → group-B3QBe0YI.js} +1 -1
- package/dist/{group-BFDXdAfg.mjs → group-DUnv46e_.mjs} +1 -1
- package/dist/{intlphone-Bbk2UF9T.mjs → intlphone-BY59PVDg.mjs} +1 -1
- package/dist/{intlphone-zZ0xd-DG.js → intlphone-CMXEolsT.js} +1 -1
- package/dist/{keyvaluefield-BynOkgTq.mjs → keyvaluefield-BAYbTkCY.mjs} +1 -1
- package/dist/{keyvaluefield-B6oRZzic.js → keyvaluefield-FBaHQ8Ak.js} +1 -1
- package/dist/{line-ChQNdVfl.js → line-Bk15u06y.js} +1 -1
- package/dist/{line-DebtzkF3.mjs → line-Bzbkzk7f.mjs} +1 -1
- package/dist/{lineitemlist-CI0LwIUz.js → lineitemlist-8NL2THwe.js} +1 -1
- package/dist/{lineitemlist-CjFNpqI5.mjs → lineitemlist-PsoQ4LU4.mjs} +1 -1
- package/dist/{list-B5wBsflP.mjs → list-BGzVPlgh.mjs} +1 -1
- package/dist/{list-CJFKxKyN.js → list-BmGiSIoi.js} +1 -1
- package/dist/{locationfield-CrOMF7jt.js → locationfield-BG76gNbD.js} +1 -1
- package/dist/{locationfield-DQj3yDCa.mjs → locationfield-CupDmXsM.mjs} +1 -1
- package/dist/{markdowneditor-emqJhQV7.mjs → markdowneditor-4StkbrKV.mjs} +1 -1
- package/dist/{markdowneditor-Jaz7uTyZ.js → markdowneditor-vDHguMtU.js} +1 -1
- package/dist/{matrixfield-j5mf9lh5.mjs → matrixfield-CeROIIAj.mjs} +1 -1
- package/dist/{matrixfield-BPJsawGk.js → matrixfield-Vptf0zNH.js} +1 -1
- package/dist/{multitextbox-CyZiTd_E.mjs → multitextbox-DeVv6uzi.mjs} +1 -1
- package/dist/{multitextbox-DQbcEqkM.js → multitextbox-DtSydHcv.js} +1 -1
- package/dist/{npsscale-BIkJMD4Z.mjs → npsscale-Cd7PoCJS.mjs} +1 -1
- package/dist/{npsscale-oUUyPdxP.js → npsscale-Dwp2T0DQ.js} +1 -1
- package/dist/{numberstepper-thjufBMI.mjs → numberstepper-BFNTu3Ii.mjs} +1 -1
- package/dist/{numberstepper-DRIvgtcH.js → numberstepper-DBKq7hUm.js} +1 -1
- package/dist/{pie-COA-uozf.js → pie-CE4QV82D.js} +1 -1
- package/dist/{pie-4SHUYmRs.mjs → pie-DKRRH37e.mjs} +1 -1
- package/dist/{richtexteditor-BSV7hG6d.js → richtexteditor-B6lK2iIt.js} +1 -1
- package/dist/{richtexteditor-CvZ3Y7X1.mjs → richtexteditor-DdIfi0-T.mjs} +1 -1
- package/dist/schema.d.ts +10 -2
- package/dist/{signature-6QvVbfkT.js → signature-B_drsWTj.js} +1 -1
- package/dist/{signature-DeDxnc8U.mjs → signature-D9B8bFqg.mjs} +1 -1
- package/dist/{stepper-CDsErlLH.js → stepper-CO6XiIaw.js} +1 -1
- package/dist/{stepper-Sx3SWXTM.mjs → stepper-D6e9yWIr.mjs} +1 -1
- package/dist/{summaryfield-CAJjGmE2.mjs → summaryfield-BIA2gc1w.mjs} +1 -1
- package/dist/{summaryfield-DxzQ3g6Z.js → summaryfield-CR3aNMZU.js} +1 -1
- package/dist/{tabs-CnDP2ngC.js → tabs-B4ZbZQvt.js} +1 -1
- package/dist/{tabs-CvHNZU5o.mjs → tabs-PgOpdVX1.mjs} +1 -1
- package/dist/{tagsinput-DZcLPuX1.js → tagsinput-DtNb1IuV.js} +1 -1
- package/dist/{tagsinput-bWU3Mem0.mjs → tagsinput-G_M0DbpI.mjs} +1 -1
- package/dist/types.d.ts +188 -0
- package/dist/util/collection.d.ts +82 -0
- package/package.json +1 -1
- package/dist/AIForm-LoeI18mO.js +0 -43
|
@@ -0,0 +1,1140 @@
|
|
|
1
|
+
import { jsxs as h, jsx as n, Fragment as St } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as Xe, useState as Z, Fragment as De } from "react";
|
|
3
|
+
import { R as we, S as Ct, T as kt, U as wt, W as At, X as Je, Y as Tt, Z as It, _ as zt, $ as Ye, a0 as Mt, a1 as _t, a2 as $t, a3 as qt, a4 as jt, a5 as Wt, a6 as Et, a7 as Dt, a8 as Ze, a9 as Ot, aa as Rt, ab as Bt, ac as Lt, ad as Pt, ae as Ft, af as _e, ag as Vt, ah as Qe, F as Gt, ai as Ht, aj as ae, ak as Nt, al as Ut, am as Ae, an as et, j as Oe, ao as Kt } from "./AIForm-BVJ7qhP5.mjs";
|
|
4
|
+
import { ButtonBase as tt, Icon as q, Button as Q, Typography as O, Box as f, Tooltip as U, useMediaQuery as nt, Dialog as rt, IconButton as X, DialogContent as at, DialogActions as ot, Menu as Xt, MenuItem as de, ListItemIcon as pe, ListItemText as xe, Table as Jt, TableHead as Yt, TableRow as me, TableCell as K, TableBody as Zt, Collapse as it } from "@mui/material";
|
|
5
|
+
import { alpha as p, useTheme as J } from "@mui/material/styles";
|
|
6
|
+
let Qt = 0;
|
|
7
|
+
const oe = () => `dmui-col-${++Qt}`, lt = (e) => (e.collections || []).map((t) => t.id), en = (e) => Object.fromEntries(lt(e).map((t) => [t, []])), Te = (e, t) => we(e).map((r) => {
|
|
8
|
+
const a = new Set(lt(t)), i = Object.fromEntries(Object.entries(r).filter(([c]) => !a.has(c))), l = Object.fromEntries(
|
|
9
|
+
(t.collections || []).map((c) => [c.id, Te(r[c.id], c)])
|
|
10
|
+
);
|
|
11
|
+
return { key: oe(), data: i, children: l };
|
|
12
|
+
}), Ie = (e, t) => e.map((r) => {
|
|
13
|
+
const a = { ...r.data };
|
|
14
|
+
return (t.collections || []).forEach((i) => {
|
|
15
|
+
a[i.id] = Ie(r.children[i.id] || [], i);
|
|
16
|
+
}), a;
|
|
17
|
+
}), st = (e) => ({
|
|
18
|
+
key: oe(),
|
|
19
|
+
data: Ct(e.data),
|
|
20
|
+
children: Object.fromEntries(Object.entries(e.children).map(([t, r]) => [t, r.map(st)]))
|
|
21
|
+
});
|
|
22
|
+
var he, Re;
|
|
23
|
+
function ct() {
|
|
24
|
+
if (Re) return he;
|
|
25
|
+
Re = 1;
|
|
26
|
+
var e = kt(), t = wt();
|
|
27
|
+
function r(a, i, l) {
|
|
28
|
+
(l !== void 0 && !t(a[i], l) || l === void 0 && !(i in a)) && e(a, i, l);
|
|
29
|
+
}
|
|
30
|
+
return he = r, he;
|
|
31
|
+
}
|
|
32
|
+
var fe, Be;
|
|
33
|
+
function tn() {
|
|
34
|
+
if (Be) return fe;
|
|
35
|
+
Be = 1;
|
|
36
|
+
var e = At(), t = Je();
|
|
37
|
+
function r(a) {
|
|
38
|
+
return t(a) && e(a);
|
|
39
|
+
}
|
|
40
|
+
return fe = r, fe;
|
|
41
|
+
}
|
|
42
|
+
var ge, Le;
|
|
43
|
+
function nn() {
|
|
44
|
+
if (Le) return ge;
|
|
45
|
+
Le = 1;
|
|
46
|
+
var e = Tt(), t = It(), r = Je(), a = "[object Object]", i = Function.prototype, l = Object.prototype, c = i.toString, x = l.hasOwnProperty, g = c.call(Object);
|
|
47
|
+
function d(u) {
|
|
48
|
+
if (!r(u) || e(u) != a)
|
|
49
|
+
return !1;
|
|
50
|
+
var b = t(u);
|
|
51
|
+
if (b === null)
|
|
52
|
+
return !0;
|
|
53
|
+
var o = x.call(b, "constructor") && b.constructor;
|
|
54
|
+
return typeof o == "function" && o instanceof o && c.call(o) == g;
|
|
55
|
+
}
|
|
56
|
+
return ge = d, ge;
|
|
57
|
+
}
|
|
58
|
+
var be, Pe;
|
|
59
|
+
function dt() {
|
|
60
|
+
if (Pe) return be;
|
|
61
|
+
Pe = 1;
|
|
62
|
+
function e(t, r) {
|
|
63
|
+
if (!(r === "constructor" && typeof t[r] == "function") && r != "__proto__")
|
|
64
|
+
return t[r];
|
|
65
|
+
}
|
|
66
|
+
return be = e, be;
|
|
67
|
+
}
|
|
68
|
+
var ue, Fe;
|
|
69
|
+
function rn() {
|
|
70
|
+
if (Fe) return ue;
|
|
71
|
+
Fe = 1;
|
|
72
|
+
var e = zt(), t = Ye();
|
|
73
|
+
function r(a) {
|
|
74
|
+
return e(a, t(a));
|
|
75
|
+
}
|
|
76
|
+
return ue = r, ue;
|
|
77
|
+
}
|
|
78
|
+
var ye, Ve;
|
|
79
|
+
function an() {
|
|
80
|
+
if (Ve) return ye;
|
|
81
|
+
Ve = 1;
|
|
82
|
+
var e = ct(), t = Mt(), r = _t(), a = $t(), i = qt(), l = jt(), c = Wt(), x = tn(), g = Et(), d = Dt(), u = Ze(), b = nn(), o = Ot(), y = dt(), v = rn();
|
|
83
|
+
function I(A, k, M, W, P, $, j) {
|
|
84
|
+
var w = y(A, M), S = y(k, M), F = j.get(S);
|
|
85
|
+
if (F) {
|
|
86
|
+
e(A, M, F);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
var _ = $ ? $(w, S, M + "", A, k, j) : void 0, E = _ === void 0;
|
|
90
|
+
if (E) {
|
|
91
|
+
var D = c(S), R = !D && g(S), H = !D && !R && o(S);
|
|
92
|
+
_ = S, D || R || H ? c(w) ? _ = w : x(w) ? _ = a(w) : R ? (E = !1, _ = t(S, !0)) : H ? (E = !1, _ = r(S, !0)) : _ = [] : b(S) || l(S) ? (_ = w, l(w) ? _ = v(w) : (!u(w) || d(w)) && (_ = i(S))) : E = !1;
|
|
93
|
+
}
|
|
94
|
+
E && (j.set(S, _), P(_, S, W, $, j), j.delete(S)), e(A, M, _);
|
|
95
|
+
}
|
|
96
|
+
return ye = I, ye;
|
|
97
|
+
}
|
|
98
|
+
var ve, Ge;
|
|
99
|
+
function on() {
|
|
100
|
+
if (Ge) return ve;
|
|
101
|
+
Ge = 1;
|
|
102
|
+
var e = Rt(), t = ct(), r = Bt(), a = an(), i = Ze(), l = Ye(), c = dt();
|
|
103
|
+
function x(g, d, u, b, o) {
|
|
104
|
+
g !== d && r(d, function(y, v) {
|
|
105
|
+
if (o || (o = new e()), i(y))
|
|
106
|
+
a(g, d, v, u, x, b, o);
|
|
107
|
+
else {
|
|
108
|
+
var I = b ? b(c(g, v), y, v + "", g, d, o) : void 0;
|
|
109
|
+
I === void 0 && (I = y), t(g, v, I);
|
|
110
|
+
}
|
|
111
|
+
}, l);
|
|
112
|
+
}
|
|
113
|
+
return ve = x, ve;
|
|
114
|
+
}
|
|
115
|
+
var Se, He;
|
|
116
|
+
function ln() {
|
|
117
|
+
if (He) return Se;
|
|
118
|
+
He = 1;
|
|
119
|
+
var e = Lt(), t = Pt();
|
|
120
|
+
function r(a) {
|
|
121
|
+
return e(function(i, l) {
|
|
122
|
+
var c = -1, x = l.length, g = x > 1 ? l[x - 1] : void 0, d = x > 2 ? l[2] : void 0;
|
|
123
|
+
for (g = a.length > 3 && typeof g == "function" ? (x--, g) : void 0, d && t(l[0], l[1], d) && (g = x < 3 ? void 0 : g, x = 1), i = Object(i); ++c < x; ) {
|
|
124
|
+
var u = l[c];
|
|
125
|
+
u && a(i, u, c, g);
|
|
126
|
+
}
|
|
127
|
+
return i;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return Se = r, Se;
|
|
131
|
+
}
|
|
132
|
+
var Ce, Ne;
|
|
133
|
+
function sn() {
|
|
134
|
+
if (Ne) return Ce;
|
|
135
|
+
Ne = 1;
|
|
136
|
+
var e = on(), t = ln(), r = t(function(a, i, l) {
|
|
137
|
+
e(a, i, l);
|
|
138
|
+
});
|
|
139
|
+
return Ce = r, Ce;
|
|
140
|
+
}
|
|
141
|
+
var cn = sn();
|
|
142
|
+
const dn = /* @__PURE__ */ Ft(cn), pt = (e, t) => {
|
|
143
|
+
const r = e.palette[t || "primary"];
|
|
144
|
+
if (r && typeof r == "object" && r.main) return r;
|
|
145
|
+
try {
|
|
146
|
+
return e.palette.augmentColor({ color: { main: String(t) } });
|
|
147
|
+
} catch {
|
|
148
|
+
return e.palette.primary;
|
|
149
|
+
}
|
|
150
|
+
}, xt = (e, t) => e.palette.mode === "dark" ? t.light : t.dark, pn = {
|
|
151
|
+
add: "Add {label}",
|
|
152
|
+
addMore: "Add another {labelLower}",
|
|
153
|
+
emptyTitle: "No {pluralLower} yet",
|
|
154
|
+
emptyText: void 0,
|
|
155
|
+
edit: "Edit",
|
|
156
|
+
duplicate: "Duplicate",
|
|
157
|
+
moveUp: "Move up",
|
|
158
|
+
moveDown: "Move down",
|
|
159
|
+
delete: "Delete",
|
|
160
|
+
more: "More actions",
|
|
161
|
+
collapse: "Collapse",
|
|
162
|
+
expand: "Expand",
|
|
163
|
+
editAria: "Edit {title}",
|
|
164
|
+
deleteAria: "Delete {title}",
|
|
165
|
+
viewAria: "View {title}",
|
|
166
|
+
moreAria: "More actions for {title}",
|
|
167
|
+
collapseAria: "Collapse {title}",
|
|
168
|
+
expandAria: "Expand {title}",
|
|
169
|
+
maxReached: "Maximum of {max} reached",
|
|
170
|
+
dialogAddTitle: "Add {label}",
|
|
171
|
+
dialogEditTitle: "Edit {label}",
|
|
172
|
+
dialogViewTitle: "{label}",
|
|
173
|
+
dialogContext: "For {parent}",
|
|
174
|
+
save: "Add {label}",
|
|
175
|
+
saveChanges: "Save changes",
|
|
176
|
+
saveAndAddAnother: "Save & add another",
|
|
177
|
+
cancel: "Cancel",
|
|
178
|
+
close: "Close",
|
|
179
|
+
closeAria: "Close dialog",
|
|
180
|
+
shortcut: "⌘/Ctrl + Enter",
|
|
181
|
+
deleteTitle: "Delete {labelLower}?",
|
|
182
|
+
deleteMessage: "{title} will be removed{detail}. This can’t be undone.",
|
|
183
|
+
deleteDetail: ", along with {detail}",
|
|
184
|
+
deleteConfirm: "Delete"
|
|
185
|
+
}, xn = (e, t) => e.replace(/\{(\w+)\}/g, (r, a) => t[a] != null ? String(t[a]) : r), mn = (e, t) => {
|
|
186
|
+
if (e == null) return `repeat(auto-fill, minmax(min(${t}px, 100%), 1fr))`;
|
|
187
|
+
const r = (a) => `repeat(${Math.max(1, a)}, minmax(0, 1fr))`;
|
|
188
|
+
return typeof e == "number" ? r(e) : Object.fromEntries(Object.entries(e).map(([a, i]) => [a, r(Number(i))]));
|
|
189
|
+
}, Ue = (e) => e == null ? [] : Array.isArray(e) ? e : [e], hn = (e, t, r, a = {}) => {
|
|
190
|
+
const i = r > 0, l = pt(e, t.color), c = _e(t), x = Vt(t), g = { ...pn, ...a, ...t.texts || {} }, d = t.styles || {}, u = {
|
|
191
|
+
label: c,
|
|
192
|
+
labelLower: c.toLowerCase(),
|
|
193
|
+
plural: x,
|
|
194
|
+
pluralLower: x.toLowerCase(),
|
|
195
|
+
max: t.max
|
|
196
|
+
};
|
|
197
|
+
return {
|
|
198
|
+
config: t,
|
|
199
|
+
depth: r,
|
|
200
|
+
nested: i,
|
|
201
|
+
accent: l,
|
|
202
|
+
ink: xt(e, l),
|
|
203
|
+
icon: t.icon || (i ? "label" : "folder_open"),
|
|
204
|
+
itemLabel: c,
|
|
205
|
+
plural: x,
|
|
206
|
+
texts: g,
|
|
207
|
+
layout: t.layout || (i ? "table" : "cards"),
|
|
208
|
+
variant: t.variant || "outlined",
|
|
209
|
+
addButton: {
|
|
210
|
+
position: "header",
|
|
211
|
+
variant: i ? "outlined" : "contained",
|
|
212
|
+
icon: "add",
|
|
213
|
+
...t.addButton || {}
|
|
214
|
+
},
|
|
215
|
+
// Simple by default: edit + delete. Duplicate / move / collapse are opt-in.
|
|
216
|
+
actions: { edit: !0, delete: !0, duplicate: !1, move: !1, collapse: !1, ...t.actions || {} },
|
|
217
|
+
t: (b, o = {}) => xn(String(g[b] ?? ""), { ...u, ...o }),
|
|
218
|
+
sx: (b, o) => [...Ue(o), ...Ue(d[b])],
|
|
219
|
+
merged: (b, o = {}) => dn({}, o, d[b] || {})
|
|
220
|
+
};
|
|
221
|
+
}, ee = "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
222
|
+
function fn({ ui: e, n: t }) {
|
|
223
|
+
const r = J();
|
|
224
|
+
return /* @__PURE__ */ n(
|
|
225
|
+
f,
|
|
226
|
+
{
|
|
227
|
+
component: "span",
|
|
228
|
+
sx: e.sx("headerCount", {
|
|
229
|
+
minWidth: 22,
|
|
230
|
+
height: 20,
|
|
231
|
+
px: 0.75,
|
|
232
|
+
borderRadius: "999px",
|
|
233
|
+
display: "inline-grid",
|
|
234
|
+
placeItems: "center",
|
|
235
|
+
fontSize: 11.5,
|
|
236
|
+
fontWeight: 700,
|
|
237
|
+
bgcolor: t > 0 ? p(e.accent.main, 0.12) : p(r.palette.text.primary, 0.07),
|
|
238
|
+
color: t > 0 ? e.ink : "text.secondary",
|
|
239
|
+
border: `1px solid ${t > 0 ? p(e.accent.main, 0.2) : "transparent"}`
|
|
240
|
+
}),
|
|
241
|
+
children: t
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
const gn = (e) => e.split(/\s+/).map((t) => t.match(/[A-Za-z0-9]/)?.[0] || "").filter(Boolean).slice(0, 2).join("").toUpperCase() || "#";
|
|
246
|
+
function bn({ ui: e, mode: t, title: r, index: a }) {
|
|
247
|
+
return t === "none" ? null : /* @__PURE__ */ n(f, { sx: e.sx("avatar", {
|
|
248
|
+
width: 40,
|
|
249
|
+
height: 40,
|
|
250
|
+
flexShrink: 0,
|
|
251
|
+
borderRadius: "10px",
|
|
252
|
+
display: "grid",
|
|
253
|
+
placeItems: "center",
|
|
254
|
+
fontWeight: 600,
|
|
255
|
+
fontSize: 14,
|
|
256
|
+
bgcolor: p(e.accent.main, 0.1),
|
|
257
|
+
color: e.ink,
|
|
258
|
+
"& .MuiIcon-root": { fontSize: 20 }
|
|
259
|
+
}), children: t === "initials" ? gn(r) : t === "index" ? a + 1 : /* @__PURE__ */ n(q, { children: e.icon }) });
|
|
260
|
+
}
|
|
261
|
+
function un({ ui: e, text: t, color: r }) {
|
|
262
|
+
const a = J(), i = r === "default" ? null : pt(a, r);
|
|
263
|
+
return /* @__PURE__ */ n(
|
|
264
|
+
f,
|
|
265
|
+
{
|
|
266
|
+
component: "span",
|
|
267
|
+
sx: e.sx("badge", {
|
|
268
|
+
display: "inline-flex",
|
|
269
|
+
alignItems: "center",
|
|
270
|
+
gap: 0.5,
|
|
271
|
+
px: 1.25,
|
|
272
|
+
py: 0.3,
|
|
273
|
+
borderRadius: "999px",
|
|
274
|
+
fontSize: 11.5,
|
|
275
|
+
fontWeight: 700,
|
|
276
|
+
lineHeight: 1.6,
|
|
277
|
+
whiteSpace: "nowrap",
|
|
278
|
+
letterSpacing: "0.02em",
|
|
279
|
+
bgcolor: i ? p(i.main, 0.1) : p(a.palette.text.primary, 0.06),
|
|
280
|
+
color: i ? xt(a, i) : "text.secondary",
|
|
281
|
+
border: `1px solid ${i ? p(i.main, 0.25) : p(a.palette.text.primary, 0.12)}`,
|
|
282
|
+
"&::before": {
|
|
283
|
+
content: '""',
|
|
284
|
+
width: 6,
|
|
285
|
+
height: 6,
|
|
286
|
+
borderRadius: "50%",
|
|
287
|
+
bgcolor: i ? i.main : "text.disabled",
|
|
288
|
+
flexShrink: 0
|
|
289
|
+
}
|
|
290
|
+
}),
|
|
291
|
+
children: t
|
|
292
|
+
}
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
function Ke({ ui: e, placement: t, empty: r, disabled: a, onClick: i }) {
|
|
296
|
+
const { variant: l, icon: c, size: x, fullWidth: g } = e.addButton, d = t === "footer" && !r ? e.t("addMore") : e.t("add"), u = e.config.max != null && a, b = !!g || l === "dashed" && g !== !1, o = (v) => /* @__PURE__ */ n(U, { title: u ? e.t("maxReached") : "", children: /* @__PURE__ */ n(f, { component: "span", sx: { display: b ? "block" : "inline-flex", flexShrink: 0 }, children: v }) });
|
|
297
|
+
if (l === "dashed")
|
|
298
|
+
return o(
|
|
299
|
+
/* @__PURE__ */ h(
|
|
300
|
+
tt,
|
|
301
|
+
{
|
|
302
|
+
onClick: i,
|
|
303
|
+
disabled: a,
|
|
304
|
+
sx: e.sx("addButton", {
|
|
305
|
+
width: b ? "100%" : "auto",
|
|
306
|
+
display: "flex",
|
|
307
|
+
alignItems: "center",
|
|
308
|
+
justifyContent: "center",
|
|
309
|
+
gap: 0.75,
|
|
310
|
+
py: 1.1,
|
|
311
|
+
px: 2,
|
|
312
|
+
borderRadius: "8px",
|
|
313
|
+
border: `1px dashed ${p(e.accent.main, 0.5)}`,
|
|
314
|
+
color: e.ink,
|
|
315
|
+
fontFamily: "inherit",
|
|
316
|
+
fontSize: 14,
|
|
317
|
+
fontWeight: 600,
|
|
318
|
+
transition: `background-color .15s ${ee}`,
|
|
319
|
+
"&:hover": { bgcolor: p(e.accent.main, 0.06) },
|
|
320
|
+
"&.Mui-focusVisible": { outline: `2px solid ${p(e.accent.main, 0.5)}`, outlineOffset: 2 },
|
|
321
|
+
"&.Mui-disabled": { opacity: 0.5 },
|
|
322
|
+
"& .MuiIcon-root": { fontSize: 19 }
|
|
323
|
+
}),
|
|
324
|
+
children: [
|
|
325
|
+
/* @__PURE__ */ n(q, { children: c }),
|
|
326
|
+
d
|
|
327
|
+
]
|
|
328
|
+
}
|
|
329
|
+
)
|
|
330
|
+
);
|
|
331
|
+
const y = {
|
|
332
|
+
contained: { bgcolor: e.accent.main, color: e.accent.contrastText, "&:hover": { bgcolor: e.accent.dark } },
|
|
333
|
+
outlined: { color: e.ink, borderColor: p(e.accent.main, 0.5), "&:hover": { borderColor: e.accent.main, bgcolor: p(e.accent.main, 0.05) } },
|
|
334
|
+
text: { color: e.ink, "&:hover": { bgcolor: p(e.accent.main, 0.07) } },
|
|
335
|
+
soft: { color: e.ink, bgcolor: p(e.accent.main, 0.1), "&:hover": { bgcolor: p(e.accent.main, 0.16) } }
|
|
336
|
+
}[l] || {};
|
|
337
|
+
return o(
|
|
338
|
+
/* @__PURE__ */ n(
|
|
339
|
+
Q,
|
|
340
|
+
{
|
|
341
|
+
onClick: i,
|
|
342
|
+
disabled: a,
|
|
343
|
+
variant: l === "soft" ? "text" : l,
|
|
344
|
+
color: "inherit",
|
|
345
|
+
size: x || (e.nested ? "small" : "medium"),
|
|
346
|
+
fullWidth: g,
|
|
347
|
+
disableElevation: !0,
|
|
348
|
+
startIcon: /* @__PURE__ */ n(q, { children: c }),
|
|
349
|
+
sx: e.sx("addButton", {
|
|
350
|
+
textTransform: "none",
|
|
351
|
+
fontWeight: 600,
|
|
352
|
+
borderRadius: "8px",
|
|
353
|
+
px: e.nested ? 1.5 : 2,
|
|
354
|
+
whiteSpace: "nowrap",
|
|
355
|
+
...y
|
|
356
|
+
}),
|
|
357
|
+
children: d
|
|
358
|
+
}
|
|
359
|
+
)
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
const yn = (e) => /^[aeiou]/i.test(e) ? "an" : "a", vn = (e) => e.length <= 1 ? e.join("") : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`, Sn = (e) => {
|
|
363
|
+
if (e.nested) return "";
|
|
364
|
+
const t = e.itemLabel.toLowerCase(), r = (e.config.collections || []).map((a) => Qe(_e(a)).toLowerCase());
|
|
365
|
+
return r.length ? `Add ${yn(t)} ${t}, then add its ${vn(r)}.` : `Add your first ${t} to get started.`;
|
|
366
|
+
};
|
|
367
|
+
function Cn({ ui: e, readOnly: t, error: r }) {
|
|
368
|
+
const a = J(), i = e.texts.emptyText != null ? e.t("emptyText") : Sn(e);
|
|
369
|
+
return e.nested ? /* @__PURE__ */ n(O, { sx: e.sx("empty", {
|
|
370
|
+
fontSize: 13,
|
|
371
|
+
color: "text.disabled",
|
|
372
|
+
fontStyle: "italic",
|
|
373
|
+
py: 0.75,
|
|
374
|
+
px: 0,
|
|
375
|
+
display: "block"
|
|
376
|
+
}), children: e.t("emptyTitle") }) : /* @__PURE__ */ h(
|
|
377
|
+
f,
|
|
378
|
+
{
|
|
379
|
+
sx: e.sx("empty", {
|
|
380
|
+
py: 5,
|
|
381
|
+
px: 3,
|
|
382
|
+
textAlign: "center",
|
|
383
|
+
borderRadius: "10px",
|
|
384
|
+
border: `1.5px dashed ${r ? a.palette.error.main : p(a.palette.text.primary, 0.15)}`,
|
|
385
|
+
bgcolor: r ? p(a.palette.error.main, 0.03) : p(a.palette.text.primary, 0.02)
|
|
386
|
+
}),
|
|
387
|
+
children: [
|
|
388
|
+
/* @__PURE__ */ n(f, { sx: {
|
|
389
|
+
width: 48,
|
|
390
|
+
height: 48,
|
|
391
|
+
borderRadius: "50%",
|
|
392
|
+
bgcolor: p(e.accent.main, 0.1),
|
|
393
|
+
display: "flex",
|
|
394
|
+
alignItems: "center",
|
|
395
|
+
justifyContent: "center",
|
|
396
|
+
mx: "auto",
|
|
397
|
+
mb: 1.5
|
|
398
|
+
}, children: /* @__PURE__ */ n(q, { sx: { color: e.ink, fontSize: "22px !important" }, children: e.icon || "inbox" }) }),
|
|
399
|
+
/* @__PURE__ */ n(O, { sx: e.sx("emptyTitle", { fontSize: 15, fontWeight: 600, color: "text.primary" }), children: e.t("emptyTitle") }),
|
|
400
|
+
i && !t && /* @__PURE__ */ n(O, { sx: e.sx("emptyText", { fontSize: 13.5, color: "text.secondary", mt: 0.5, maxWidth: 380, mx: "auto" }), children: i })
|
|
401
|
+
]
|
|
402
|
+
}
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
function kn({ ui: e, open: t, mode: r, guid: a, session: i, initial: l, context: c, onClose: x, onSave: g }) {
|
|
406
|
+
const d = J(), u = e.config.dialog || {}, b = nt(d.breakpoints.down("sm")), o = u.fullScreen === !0 || u.fullScreen !== !1 && b, y = Xe(null), [v, I] = Z(0), { accent: A } = e, k = e.t(r === "add" ? "dialogAddTitle" : r === "edit" ? "dialogEditTitle" : "dialogViewTitle"), M = `${a}-dialog-${i}-${v}`, W = e.t("dialogContext"), [P, $] = W.includes("{parent}") ? W.split("{parent}") : [W, null], j = (w) => {
|
|
407
|
+
const S = y.current;
|
|
408
|
+
!S || !S.validate() || (g({ ...S.getValues() }, w), w && I((F) => F + 1));
|
|
409
|
+
};
|
|
410
|
+
return /* @__PURE__ */ h(
|
|
411
|
+
rt,
|
|
412
|
+
{
|
|
413
|
+
open: t,
|
|
414
|
+
onClose: (w, S) => {
|
|
415
|
+
S !== "backdropClick" && x();
|
|
416
|
+
},
|
|
417
|
+
fullScreen: o,
|
|
418
|
+
fullWidth: !0,
|
|
419
|
+
maxWidth: u.maxWidth || "sm",
|
|
420
|
+
"aria-labelledby": `${a}-dialog-title`,
|
|
421
|
+
onKeyDown: (w) => {
|
|
422
|
+
r !== "view" && w.key === "Enter" && (w.metaKey || w.ctrlKey) && (w.preventDefault(), j(!1));
|
|
423
|
+
},
|
|
424
|
+
sx: {
|
|
425
|
+
"& .MuiDialog-paper": e.merged("dialog", {
|
|
426
|
+
borderRadius: o ? 0 : "12px",
|
|
427
|
+
backgroundImage: "none"
|
|
428
|
+
})
|
|
429
|
+
},
|
|
430
|
+
children: [
|
|
431
|
+
/* @__PURE__ */ h(f, { sx: e.sx("dialogHeader", {
|
|
432
|
+
display: "flex",
|
|
433
|
+
alignItems: "flex-start",
|
|
434
|
+
gap: 1,
|
|
435
|
+
px: { xs: 2, sm: 3 },
|
|
436
|
+
pt: 2.5,
|
|
437
|
+
pb: 2,
|
|
438
|
+
borderBottom: `1px solid ${d.palette.divider}`
|
|
439
|
+
}), children: [
|
|
440
|
+
/* @__PURE__ */ h(f, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
441
|
+
/* @__PURE__ */ n(O, { id: `${a}-dialog-title`, sx: e.sx("dialogTitle", { fontWeight: 600, fontSize: 18, lineHeight: 1.3 }), children: k }),
|
|
442
|
+
c && /* @__PURE__ */ h(O, { sx: e.sx("dialogContext", { fontSize: 13.5, color: "text.secondary", mt: 0.25 }), children: [
|
|
443
|
+
P,
|
|
444
|
+
$ !== null && /* @__PURE__ */ n(f, { component: "strong", sx: { color: "text.primary", fontWeight: 600 }, children: c }),
|
|
445
|
+
$
|
|
446
|
+
] }),
|
|
447
|
+
u.description && /* @__PURE__ */ n(O, { sx: e.sx("dialogDescription", { fontSize: 13.5, color: "text.secondary", mt: 0.25 }), children: u.description })
|
|
448
|
+
] }),
|
|
449
|
+
/* @__PURE__ */ n(X, { "aria-label": e.t("closeAria"), onClick: x, size: "small", sx: { mt: -0.5, mr: -1, color: "text.secondary" }, children: /* @__PURE__ */ n(q, { children: "close" }) })
|
|
450
|
+
] }),
|
|
451
|
+
/* @__PURE__ */ n(at, { sx: e.sx("dialogContent", { px: { xs: 2, sm: 3 }, pt: "20px !important", pb: 3 }), children: /* @__PURE__ */ n(
|
|
452
|
+
Gt,
|
|
453
|
+
{
|
|
454
|
+
guid: M,
|
|
455
|
+
data: e.config.fields || [],
|
|
456
|
+
patch: r === "add" ? {} : l || {},
|
|
457
|
+
apiRef: y,
|
|
458
|
+
readOnly: r === "view",
|
|
459
|
+
MuiGridAttributes: { spacing: u.spacing ?? 2 }
|
|
460
|
+
},
|
|
461
|
+
M
|
|
462
|
+
) }),
|
|
463
|
+
/* @__PURE__ */ n(ot, { sx: e.sx("dialogActions", {
|
|
464
|
+
px: { xs: 2, sm: 3 },
|
|
465
|
+
py: 1.5,
|
|
466
|
+
gap: 1,
|
|
467
|
+
flexWrap: "wrap",
|
|
468
|
+
borderTop: `1px solid ${d.palette.divider}`,
|
|
469
|
+
"& .MuiButton-root": { textTransform: "none", fontWeight: 600, borderRadius: "8px", px: 2, whiteSpace: "nowrap", ml: "0 !important" }
|
|
470
|
+
}), children: r === "view" ? /* @__PURE__ */ n(Q, { variant: "contained", disableElevation: !0, onClick: x, sx: e.sx("dialogSave", { bgcolor: A.main, color: A.contrastText, "&:hover": { bgcolor: A.dark } }), children: e.t("close") }) : /* @__PURE__ */ h(St, { children: [
|
|
471
|
+
/* @__PURE__ */ n(Q, { onClick: x, color: "inherit", sx: e.sx("dialogCancel", { color: "text.secondary" }), children: e.t("cancel") }),
|
|
472
|
+
r === "add" && u.addAnother !== !1 && /* @__PURE__ */ n(
|
|
473
|
+
Q,
|
|
474
|
+
{
|
|
475
|
+
variant: "outlined",
|
|
476
|
+
color: "inherit",
|
|
477
|
+
onClick: () => j(!0),
|
|
478
|
+
sx: e.sx("dialogSaveAnother", { color: e.ink, borderColor: p(A.main, 0.5), "&:hover": { borderColor: A.main, bgcolor: p(A.main, 0.06) } }),
|
|
479
|
+
children: e.t("saveAndAddAnother")
|
|
480
|
+
}
|
|
481
|
+
),
|
|
482
|
+
/* @__PURE__ */ n(U, { title: e.t("shortcut"), placement: "top", describeChild: !0, children: /* @__PURE__ */ n(
|
|
483
|
+
Q,
|
|
484
|
+
{
|
|
485
|
+
variant: "contained",
|
|
486
|
+
color: "inherit",
|
|
487
|
+
disableElevation: !0,
|
|
488
|
+
startIcon: /* @__PURE__ */ n(q, { children: r === "add" ? "add" : "check" }),
|
|
489
|
+
onClick: () => j(!1),
|
|
490
|
+
sx: e.sx("dialogSave", { bgcolor: A.main, color: A.contrastText, "&:hover": { bgcolor: A.dark } }),
|
|
491
|
+
children: r === "add" ? e.t("save") : e.t("saveChanges")
|
|
492
|
+
}
|
|
493
|
+
) })
|
|
494
|
+
] }) })
|
|
495
|
+
]
|
|
496
|
+
}
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
function wn({ ui: e, count: t, required: r, action: a, alone: i = !1 }) {
|
|
500
|
+
const { nested: l } = e;
|
|
501
|
+
return /* @__PURE__ */ h(f, { sx: e.sx("header", { display: "flex", alignItems: "center", gap: 1.5, mb: i ? 0 : l ? 1.25 : 2.5, flexWrap: "wrap" }), children: [
|
|
502
|
+
/* @__PURE__ */ h(f, { sx: { flex: 1, minWidth: l ? 140 : { xs: "100%", sm: 220 } }, children: [
|
|
503
|
+
/* @__PURE__ */ h(f, { sx: { display: "flex", alignItems: "center", gap: l ? 0.75 : 1 }, children: [
|
|
504
|
+
e.config.icon && /* Same pill-badge for both nested and top-level — just smaller for nested */
|
|
505
|
+
/* @__PURE__ */ n(f, { sx: {
|
|
506
|
+
width: l ? 26 : 32,
|
|
507
|
+
height: l ? 26 : 32,
|
|
508
|
+
borderRadius: l ? "6px" : "8px",
|
|
509
|
+
bgcolor: p(e.accent.main, 0.12),
|
|
510
|
+
display: "flex",
|
|
511
|
+
alignItems: "center",
|
|
512
|
+
justifyContent: "center",
|
|
513
|
+
flexShrink: 0
|
|
514
|
+
}, children: /* @__PURE__ */ n(q, { sx: e.sx("headerIcon", {
|
|
515
|
+
color: e.ink,
|
|
516
|
+
fontSize: `${l ? 14 : 18}px !important`
|
|
517
|
+
}), children: e.icon }) }),
|
|
518
|
+
/* @__PURE__ */ h(O, { sx: e.sx("headerTitle", {
|
|
519
|
+
fontWeight: 700,
|
|
520
|
+
fontSize: l ? 14 : 19,
|
|
521
|
+
lineHeight: 1.3,
|
|
522
|
+
color: "text.primary"
|
|
523
|
+
}), children: [
|
|
524
|
+
e.plural,
|
|
525
|
+
r && /* @__PURE__ */ n(f, { component: "span", sx: { color: "error.main", ml: 0.25 }, children: "*" })
|
|
526
|
+
] }),
|
|
527
|
+
/* @__PURE__ */ n(fn, { ui: e, n: t })
|
|
528
|
+
] }),
|
|
529
|
+
e.config.description && /* @__PURE__ */ n(O, { sx: e.sx("headerDescription", {
|
|
530
|
+
fontSize: 13.5,
|
|
531
|
+
color: "text.secondary",
|
|
532
|
+
mt: 0.5,
|
|
533
|
+
ml: l ? 0 : e.config.icon ? "44px" : 0
|
|
534
|
+
}), children: e.config.description })
|
|
535
|
+
] }),
|
|
536
|
+
a
|
|
537
|
+
] });
|
|
538
|
+
}
|
|
539
|
+
function ze({ ui: e, title: t, canEdit: r, onOpen: a, size: i }) {
|
|
540
|
+
return /* @__PURE__ */ n(
|
|
541
|
+
tt,
|
|
542
|
+
{
|
|
543
|
+
onClick: a,
|
|
544
|
+
"aria-label": r ? void 0 : e.t("viewAria", { title: t }),
|
|
545
|
+
"aria-haspopup": "dialog",
|
|
546
|
+
sx: e.sx("itemTitle", {
|
|
547
|
+
borderRadius: "4px",
|
|
548
|
+
textAlign: "left",
|
|
549
|
+
justifyContent: "flex-start",
|
|
550
|
+
fontFamily: "inherit",
|
|
551
|
+
fontWeight: 600,
|
|
552
|
+
fontSize: i,
|
|
553
|
+
lineHeight: 1.4,
|
|
554
|
+
color: "text.primary",
|
|
555
|
+
wordBreak: "break-word",
|
|
556
|
+
"&:hover": { color: e.ink, textDecoration: "underline" },
|
|
557
|
+
"&.Mui-focusVisible": { outline: `2px solid ${p(e.accent.main, 0.5)}`, outlineOffset: 2 }
|
|
558
|
+
}),
|
|
559
|
+
children: t
|
|
560
|
+
}
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
function Me({ ui: e, data: t }) {
|
|
564
|
+
const r = e.config.display || {}, a = typeof r.badge == "string" ? { field: r.badge } : r.badge;
|
|
565
|
+
if (!a) return null;
|
|
566
|
+
const i = t[a.field], l = et(Ae(e.config.fields || [], a.field), i);
|
|
567
|
+
if (!l) return null;
|
|
568
|
+
const c = a.colors?.[String(i)] ?? a.colors?.[l] ?? "default";
|
|
569
|
+
return /* @__PURE__ */ n(un, { ui: e, text: l, color: c });
|
|
570
|
+
}
|
|
571
|
+
function An({ ui: e, title: t, readOnly: r, open: a, canToggle: i, onEdit: l, onDelete: c, onMenu: x, onToggle: g }) {
|
|
572
|
+
const d = J(), u = !r && e.actions.edit, b = !r && e.actions.delete, o = !r && (e.actions.duplicate || e.actions.move), y = (v, I) => ({
|
|
573
|
+
width: 30,
|
|
574
|
+
height: 30,
|
|
575
|
+
borderRadius: "8px",
|
|
576
|
+
color: v,
|
|
577
|
+
transition: `background-color .15s ${ee}, color .15s ${ee}`,
|
|
578
|
+
"&:hover": { bgcolor: I }
|
|
579
|
+
});
|
|
580
|
+
return /* @__PURE__ */ h(f, { sx: e.sx("actions", { display: "flex", alignItems: "center", gap: 0.25, flexShrink: 0 }), children: [
|
|
581
|
+
u && /* @__PURE__ */ n(U, { title: e.t("edit"), children: /* @__PURE__ */ n(
|
|
582
|
+
X,
|
|
583
|
+
{
|
|
584
|
+
size: "small",
|
|
585
|
+
"aria-label": e.t("editAria", { title: t }),
|
|
586
|
+
onClick: l,
|
|
587
|
+
sx: e.sx("actionButton", y(e.ink, p(e.accent.main, 0.1))),
|
|
588
|
+
children: /* @__PURE__ */ n(q, { sx: { fontSize: "17px !important" }, children: "edit" })
|
|
589
|
+
}
|
|
590
|
+
) }),
|
|
591
|
+
b && /* @__PURE__ */ n(U, { title: e.t("delete"), children: /* @__PURE__ */ n(
|
|
592
|
+
X,
|
|
593
|
+
{
|
|
594
|
+
size: "small",
|
|
595
|
+
"aria-label": e.t("deleteAria", { title: t }),
|
|
596
|
+
onClick: c,
|
|
597
|
+
sx: e.sx("actionButton", y(d.palette.error.main, p(d.palette.error.main, 0.08))),
|
|
598
|
+
children: /* @__PURE__ */ n(q, { sx: { fontSize: "17px !important" }, children: "delete_outline" })
|
|
599
|
+
}
|
|
600
|
+
) }),
|
|
601
|
+
o && /* @__PURE__ */ n(U, { title: e.t("more"), children: /* @__PURE__ */ n(
|
|
602
|
+
X,
|
|
603
|
+
{
|
|
604
|
+
size: "small",
|
|
605
|
+
"aria-label": e.t("moreAria", { title: t }),
|
|
606
|
+
onClick: (v) => x(v.currentTarget),
|
|
607
|
+
sx: e.sx("actionButton", y(d.palette.text.secondary, p(d.palette.text.primary, 0.07))),
|
|
608
|
+
children: /* @__PURE__ */ n(q, { sx: { fontSize: "17px !important" }, children: "more_vert" })
|
|
609
|
+
}
|
|
610
|
+
) }),
|
|
611
|
+
i && /* @__PURE__ */ n(U, { title: a ? e.t("collapse") : e.t("expand"), children: /* @__PURE__ */ n(
|
|
612
|
+
X,
|
|
613
|
+
{
|
|
614
|
+
size: "small",
|
|
615
|
+
"aria-label": e.t(a ? "collapseAria" : "expandAria", { title: t }),
|
|
616
|
+
"aria-expanded": a,
|
|
617
|
+
onClick: g,
|
|
618
|
+
sx: e.sx("actionButton", y(d.palette.text.secondary, p(d.palette.text.primary, 0.07))),
|
|
619
|
+
children: /* @__PURE__ */ n(q, { sx: { fontSize: "19px !important", transition: `transform .2s ${ee}`, transform: a ? "rotate(180deg)" : "none" }, children: "expand_more" })
|
|
620
|
+
}
|
|
621
|
+
) })
|
|
622
|
+
] });
|
|
623
|
+
}
|
|
624
|
+
function mt({ ui: e, node: t, guid: r, readOnly: a, issues: i, showErrors: l, texts: c, parentTitle: x, onChildChange: g }) {
|
|
625
|
+
const d = J(), u = e.config.collections || [];
|
|
626
|
+
return /* @__PURE__ */ n(f, { sx: e.sx("sections", { display: "grid", gridTemplateColumns: mn(e.config.sectionColumns ?? 1, 320) }), children: u.map((b, o) => /* @__PURE__ */ n(
|
|
627
|
+
f,
|
|
628
|
+
{
|
|
629
|
+
sx: e.sx("section", {
|
|
630
|
+
borderTop: `1px solid ${d.palette.divider}`,
|
|
631
|
+
bgcolor: d.palette.mode === "dark" ? p(d.palette.common.white, 0.02) : p(d.palette.grey[500], 0.03),
|
|
632
|
+
minWidth: 0,
|
|
633
|
+
// If there are multiple columns, add left border to separate them
|
|
634
|
+
...o > 0 ? { borderLeft: `1px solid ${d.palette.divider}` } : {}
|
|
635
|
+
}),
|
|
636
|
+
children: /* @__PURE__ */ n(f, { sx: { px: { xs: 2, sm: 2.5 }, pt: { xs: 1.5, sm: 1.75 }, pb: { xs: 1.25, sm: 1.5 } }, children: /* @__PURE__ */ n(
|
|
637
|
+
ht,
|
|
638
|
+
{
|
|
639
|
+
config: b,
|
|
640
|
+
nodes: t.children[b.id] || [],
|
|
641
|
+
onChange: (y) => g(b.id, y),
|
|
642
|
+
guid: `${r}-${t.key}`,
|
|
643
|
+
depth: e.depth + 1,
|
|
644
|
+
readOnly: a,
|
|
645
|
+
issues: i.filter((y) => y.path[0] === b.id).map((y) => ({ ...y, path: y.path.slice(1) })),
|
|
646
|
+
showErrors: l,
|
|
647
|
+
parentTitle: x,
|
|
648
|
+
texts: c
|
|
649
|
+
}
|
|
650
|
+
) })
|
|
651
|
+
},
|
|
652
|
+
b.id
|
|
653
|
+
)) });
|
|
654
|
+
}
|
|
655
|
+
function Tn({ ui: e, node: t, index: r, guid: a, readOnly: i, collapsed: l, issues: c, showErrors: x, texts: g, onOpen: d, onDelete: u, onMenu: b, onToggle: o, onChildChange: y }) {
|
|
656
|
+
const v = J(), { config: I } = e, A = I.display || {}, { title: k, subtitle: M, details: W } = ae(t.data, I, r), P = I.collections || [], $ = P.length > 0, j = x && c.length > 0, w = A.avatar || "none", S = !i && e.actions.edit, F = !i && e.actions.delete, _ = !i && (e.actions.duplicate || e.actions.move), E = W.length > 0 || $, D = !l, R = j ? p(v.palette.error.main, 0.05) : p(e.accent.main, 0.05), H = j ? p(v.palette.error.main, 0.2) : p(e.accent.main, 0.15), V = (m, C) => ({
|
|
657
|
+
width: 30,
|
|
658
|
+
height: 30,
|
|
659
|
+
borderRadius: "8px",
|
|
660
|
+
color: m,
|
|
661
|
+
transition: `background-color .15s ${ee}`,
|
|
662
|
+
"&:hover": { bgcolor: C }
|
|
663
|
+
});
|
|
664
|
+
return /* @__PURE__ */ h(f, { sx: e.sx("item", {
|
|
665
|
+
border: `1px solid ${j ? v.palette.error.main : v.palette.divider}`,
|
|
666
|
+
borderRadius: "14px",
|
|
667
|
+
overflow: "hidden",
|
|
668
|
+
bgcolor: "background.paper",
|
|
669
|
+
boxShadow: `0 1px 3px ${p(v.palette.common.black, 0.06)}, 0 4px 12px ${p(v.palette.common.black, 0.04)}`
|
|
670
|
+
}), children: [
|
|
671
|
+
/* @__PURE__ */ h(f, { sx: e.sx("itemHeader", {
|
|
672
|
+
px: { xs: 2, sm: 2.5 },
|
|
673
|
+
pt: { xs: 1.75, sm: 2 },
|
|
674
|
+
pb: { xs: 1.5, sm: 1.75 },
|
|
675
|
+
bgcolor: R,
|
|
676
|
+
borderBottom: D && E ? `1px solid ${H}` : "1px solid transparent",
|
|
677
|
+
transition: `border-color .2s ${ee}`,
|
|
678
|
+
display: "flex",
|
|
679
|
+
alignItems: "flex-start",
|
|
680
|
+
gap: 1.5
|
|
681
|
+
}), children: [
|
|
682
|
+
w !== "none" && /* @__PURE__ */ n(bn, { ui: e, mode: w, title: k, index: r }),
|
|
683
|
+
/* @__PURE__ */ h(f, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
684
|
+
/* @__PURE__ */ h(f, { sx: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 0.75, mb: M ? 0.25 : 0 }, children: [
|
|
685
|
+
/* @__PURE__ */ n(ze, { ui: e, title: k, canEdit: S, onOpen: d, size: 15.5 }),
|
|
686
|
+
/* @__PURE__ */ n(Me, { ui: e, data: t.data })
|
|
687
|
+
] }),
|
|
688
|
+
M && /* @__PURE__ */ h(O, { sx: e.sx("subtitle", {
|
|
689
|
+
display: "flex",
|
|
690
|
+
alignItems: "center",
|
|
691
|
+
gap: 0.4,
|
|
692
|
+
fontSize: 13,
|
|
693
|
+
color: "text.secondary",
|
|
694
|
+
wordBreak: "break-word",
|
|
695
|
+
"& .MuiIcon-root": { fontSize: 14, color: "text.disabled" }
|
|
696
|
+
}), children: [
|
|
697
|
+
A.subtitleIcon && /* @__PURE__ */ n(q, { children: A.subtitleIcon }),
|
|
698
|
+
M
|
|
699
|
+
] }),
|
|
700
|
+
!D && $ && /* @__PURE__ */ n(f, { sx: { display: "flex", flexWrap: "wrap", gap: 0.75, mt: 0.6 }, children: P.map((m) => {
|
|
701
|
+
const C = (t.children[m.id] || []).length;
|
|
702
|
+
return /* @__PURE__ */ h(f, { component: "span", sx: {
|
|
703
|
+
fontSize: 12,
|
|
704
|
+
fontWeight: 600,
|
|
705
|
+
px: 1,
|
|
706
|
+
py: 0.2,
|
|
707
|
+
borderRadius: "999px",
|
|
708
|
+
bgcolor: p(e.accent.main, 0.08),
|
|
709
|
+
color: e.ink,
|
|
710
|
+
border: `1px solid ${p(e.accent.main, 0.18)}`
|
|
711
|
+
}, children: [
|
|
712
|
+
C,
|
|
713
|
+
" ",
|
|
714
|
+
Qe(_e(m), C).toLowerCase()
|
|
715
|
+
] }, m.id);
|
|
716
|
+
}) })
|
|
717
|
+
] }),
|
|
718
|
+
/* @__PURE__ */ h(f, { sx: { display: "flex", alignItems: "center", flexShrink: 0, gap: 0.25, mt: -0.25 }, children: [
|
|
719
|
+
S && /* @__PURE__ */ n(U, { title: e.t("edit"), children: /* @__PURE__ */ n(
|
|
720
|
+
X,
|
|
721
|
+
{
|
|
722
|
+
size: "small",
|
|
723
|
+
"aria-label": e.t("editAria", { title: k }),
|
|
724
|
+
onClick: d,
|
|
725
|
+
sx: V(e.ink, p(e.accent.main, 0.1)),
|
|
726
|
+
children: /* @__PURE__ */ n(q, { sx: { fontSize: "17px !important" }, children: "edit" })
|
|
727
|
+
}
|
|
728
|
+
) }),
|
|
729
|
+
F && /* @__PURE__ */ n(U, { title: e.t("delete"), children: /* @__PURE__ */ n(
|
|
730
|
+
X,
|
|
731
|
+
{
|
|
732
|
+
size: "small",
|
|
733
|
+
"aria-label": e.t("deleteAria", { title: k }),
|
|
734
|
+
onClick: u,
|
|
735
|
+
sx: V(v.palette.error.main, p(v.palette.error.main, 0.08)),
|
|
736
|
+
children: /* @__PURE__ */ n(q, { sx: { fontSize: "17px !important" }, children: "delete_outline" })
|
|
737
|
+
}
|
|
738
|
+
) }),
|
|
739
|
+
_ && /* @__PURE__ */ n(U, { title: e.t("more"), children: /* @__PURE__ */ n(
|
|
740
|
+
X,
|
|
741
|
+
{
|
|
742
|
+
size: "small",
|
|
743
|
+
"aria-label": e.t("moreAria", { title: k }),
|
|
744
|
+
onClick: (m) => b(m.currentTarget),
|
|
745
|
+
sx: V(v.palette.text.secondary, p(v.palette.text.primary, 0.07)),
|
|
746
|
+
children: /* @__PURE__ */ n(q, { sx: { fontSize: "17px !important" }, children: "more_vert" })
|
|
747
|
+
}
|
|
748
|
+
) }),
|
|
749
|
+
E && /* @__PURE__ */ n(U, { title: D ? e.t("collapse") : e.t("expand"), children: /* @__PURE__ */ n(
|
|
750
|
+
X,
|
|
751
|
+
{
|
|
752
|
+
size: "small",
|
|
753
|
+
"aria-label": e.t(D ? "collapseAria" : "expandAria", { title: k }),
|
|
754
|
+
onClick: o,
|
|
755
|
+
sx: V(v.palette.text.secondary, p(v.palette.text.primary, 0.07)),
|
|
756
|
+
children: /* @__PURE__ */ n(q, { sx: {
|
|
757
|
+
fontSize: "19px !important",
|
|
758
|
+
transition: `transform .25s ${ee}`,
|
|
759
|
+
transform: D ? "rotate(180deg)" : "none"
|
|
760
|
+
}, children: "expand_more" })
|
|
761
|
+
}
|
|
762
|
+
) })
|
|
763
|
+
] })
|
|
764
|
+
] }),
|
|
765
|
+
E && /* @__PURE__ */ h(it, { in: D, timeout: 220, children: [
|
|
766
|
+
W.length > 0 && /* @__PURE__ */ n(f, { sx: e.sx("details", {
|
|
767
|
+
display: "flex",
|
|
768
|
+
overflowX: "auto",
|
|
769
|
+
borderBottom: $ ? `1px solid ${v.palette.divider}` : "none",
|
|
770
|
+
"&::-webkit-scrollbar": { height: 0 }
|
|
771
|
+
}), children: W.map((m, C) => /* @__PURE__ */ h(
|
|
772
|
+
f,
|
|
773
|
+
{
|
|
774
|
+
sx: e.sx("detail", {
|
|
775
|
+
flex: "1 1 0",
|
|
776
|
+
minWidth: 90,
|
|
777
|
+
maxWidth: 220,
|
|
778
|
+
px: { xs: 2, sm: 2.5 },
|
|
779
|
+
py: 1.5,
|
|
780
|
+
borderLeft: C > 0 ? `1px solid ${v.palette.divider}` : "none"
|
|
781
|
+
}),
|
|
782
|
+
children: [
|
|
783
|
+
/* @__PURE__ */ h(O, { sx: e.sx("detailLabel", {
|
|
784
|
+
fontSize: 10.5,
|
|
785
|
+
fontWeight: 700,
|
|
786
|
+
letterSpacing: "0.07em",
|
|
787
|
+
textTransform: "uppercase",
|
|
788
|
+
color: "text.disabled",
|
|
789
|
+
mb: 0.25,
|
|
790
|
+
display: "flex",
|
|
791
|
+
alignItems: "center",
|
|
792
|
+
gap: 0.4,
|
|
793
|
+
whiteSpace: "nowrap"
|
|
794
|
+
}), children: [
|
|
795
|
+
m.icon && /* @__PURE__ */ n(q, { sx: { fontSize: "11px !important" }, children: m.icon }),
|
|
796
|
+
m.label
|
|
797
|
+
] }),
|
|
798
|
+
/* @__PURE__ */ n(O, { sx: e.sx("detailValue", {
|
|
799
|
+
fontSize: 13.5,
|
|
800
|
+
fontWeight: 600,
|
|
801
|
+
color: m.value ? "text.primary" : "text.disabled",
|
|
802
|
+
wordBreak: "break-word",
|
|
803
|
+
lineHeight: 1.4
|
|
804
|
+
}), children: m.value || "—" })
|
|
805
|
+
]
|
|
806
|
+
},
|
|
807
|
+
m.id
|
|
808
|
+
)) }),
|
|
809
|
+
$ && /* @__PURE__ */ n(
|
|
810
|
+
mt,
|
|
811
|
+
{
|
|
812
|
+
ui: e,
|
|
813
|
+
node: t,
|
|
814
|
+
guid: a,
|
|
815
|
+
readOnly: i,
|
|
816
|
+
issues: c,
|
|
817
|
+
showErrors: x,
|
|
818
|
+
texts: g,
|
|
819
|
+
parentTitle: k,
|
|
820
|
+
onChildChange: y
|
|
821
|
+
}
|
|
822
|
+
)
|
|
823
|
+
] })
|
|
824
|
+
] });
|
|
825
|
+
}
|
|
826
|
+
function In({ ui: e, nodes: t, guid: r, readOnly: a, issues: i, showErrors: l, texts: c, isCollapsed: x, onToggle: g, onOpen: d, onDelete: u, onMenu: b, onChildChange: o }) {
|
|
827
|
+
const y = J(), v = nt(y.breakpoints.down("sm")), { config: I } = e, A = I.fields || [], k = I.display || {}, M = Nt(I), W = typeof k.badge == "string" ? k.badge : k.badge?.field, P = typeof k.badge == "object" && k.badge?.label || (W ? Ut(Ae(A, W)) || W : ""), $ = (I.collections || []).length > 0, j = !a && e.actions.edit, w = !a && (e.actions.edit || e.actions.delete || e.actions.duplicate || e.actions.move), S = (m) => i.filter((C) => C.path[0] === m).map((C) => ({ ...C, path: C.path.slice(1) })), F = /* @__PURE__ */ n(f, { component: "span", sx: { color: "text.disabled" }, children: "—" }), _ = (m, C, L) => $ && /* @__PURE__ */ n(it, { in: !x(m.key), timeout: 200, unmountOnExit: !0, children: /* @__PURE__ */ n(
|
|
828
|
+
mt,
|
|
829
|
+
{
|
|
830
|
+
ui: e,
|
|
831
|
+
node: m,
|
|
832
|
+
guid: r,
|
|
833
|
+
readOnly: a,
|
|
834
|
+
issues: S(C),
|
|
835
|
+
showErrors: l,
|
|
836
|
+
texts: c,
|
|
837
|
+
parentTitle: L,
|
|
838
|
+
onChildChange: (G, Y) => o(C, G, Y)
|
|
839
|
+
}
|
|
840
|
+
) }), E = (m, C, L) => /* @__PURE__ */ n(
|
|
841
|
+
An,
|
|
842
|
+
{
|
|
843
|
+
ui: e,
|
|
844
|
+
title: L,
|
|
845
|
+
readOnly: a,
|
|
846
|
+
open: !x(m.key),
|
|
847
|
+
canToggle: $,
|
|
848
|
+
onEdit: () => d(C),
|
|
849
|
+
onDelete: () => u(C),
|
|
850
|
+
onMenu: (G) => b(G, C),
|
|
851
|
+
onToggle: () => g(m.key)
|
|
852
|
+
}
|
|
853
|
+
), D = p(y.palette.error.main, 0.06);
|
|
854
|
+
if (v)
|
|
855
|
+
return /* @__PURE__ */ n(f, { sx: e.sx("table", { border: `1px solid ${y.palette.divider}`, borderRadius: "8px", overflow: "hidden", bgcolor: "background.paper" }), children: t.map((m, C) => {
|
|
856
|
+
const { title: L, details: G } = ae(m.data, I, C), Y = l && S(C).length > 0;
|
|
857
|
+
return /* @__PURE__ */ h(f, { sx: e.sx("mobileRow", { borderTop: C ? `1px solid ${y.palette.divider}` : "none", ...Y ? { bgcolor: D } : {} }), children: [
|
|
858
|
+
/* @__PURE__ */ h(f, { sx: { display: "flex", alignItems: "flex-start", gap: 1, p: 1.5 }, children: [
|
|
859
|
+
/* @__PURE__ */ h(f, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
860
|
+
/* @__PURE__ */ h(f, { sx: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 1 }, children: [
|
|
861
|
+
/* @__PURE__ */ n(ze, { ui: e, title: L, canEdit: j, onOpen: () => d(C), size: 14.5 }),
|
|
862
|
+
/* @__PURE__ */ n(Me, { ui: e, data: m.data })
|
|
863
|
+
] }),
|
|
864
|
+
G.length > 0 && /* @__PURE__ */ n(f, { sx: { display: "grid", gridTemplateColumns: "auto 1fr", columnGap: 1.5, rowGap: 0.25, mt: 0.75 }, children: G.map((N) => /* @__PURE__ */ h(De, { children: [
|
|
865
|
+
/* @__PURE__ */ n(O, { sx: e.sx("detailLabel", { fontSize: 13, color: "text.secondary" }), children: N.label }),
|
|
866
|
+
/* @__PURE__ */ n(O, { sx: e.sx("detailValue", { fontSize: 13, fontWeight: 500, wordBreak: "break-word" }), children: N.value })
|
|
867
|
+
] }, N.id)) })
|
|
868
|
+
] }),
|
|
869
|
+
(w || $) && E(m, C, L)
|
|
870
|
+
] }),
|
|
871
|
+
_(m, C, L)
|
|
872
|
+
] }, m.key);
|
|
873
|
+
}) });
|
|
874
|
+
const R = e.sx("tableHeadCell", { fontSize: 12.5, fontWeight: 600, color: "text.secondary", whiteSpace: "nowrap", py: 1, px: 1.75 }), H = e.sx("tableCell", { fontSize: 14, color: "text.primary", whiteSpace: "nowrap", py: 1.1, px: 1.75 }), V = 1 + M.length + (W ? 1 : 0) + (w || $ ? 1 : 0);
|
|
875
|
+
return /* @__PURE__ */ n(f, { sx: e.sx("table", { border: `1px solid ${y.palette.divider}`, borderRadius: "8px", overflowX: "auto", bgcolor: "background.paper" }), children: /* @__PURE__ */ h(Jt, { size: "small", children: [
|
|
876
|
+
/* @__PURE__ */ n(Yt, { children: /* @__PURE__ */ h(me, { sx: e.sx("tableHead", { bgcolor: p(y.palette.text.primary, y.palette.mode === "dark" ? 0.05 : 0.03) }), children: [
|
|
877
|
+
/* @__PURE__ */ n(K, { sx: R, children: k.titleLabel || e.itemLabel }),
|
|
878
|
+
M.map((m) => /* @__PURE__ */ n(K, { sx: R, children: m.label }, m.id)),
|
|
879
|
+
W && /* @__PURE__ */ n(K, { sx: R, children: P }),
|
|
880
|
+
(w || $) && /* @__PURE__ */ n(K, { sx: R })
|
|
881
|
+
] }) }),
|
|
882
|
+
/* @__PURE__ */ n(Zt, { children: t.map((m, C) => {
|
|
883
|
+
const { title: L } = ae(m.data, I, C), G = l && S(C).length > 0, Y = C === t.length - 1, N = Y && !($ && !x(m.key)) ? { "& > td": { borderBottom: 0 } } : {};
|
|
884
|
+
return /* @__PURE__ */ h(De, { children: [
|
|
885
|
+
/* @__PURE__ */ h(me, { hover: !0, sx: e.sx("tableRow", { ...N, ...G ? { bgcolor: D } : {} }), children: [
|
|
886
|
+
/* @__PURE__ */ n(K, { sx: H, children: /* @__PURE__ */ n(ze, { ui: e, title: L, canEdit: j, onOpen: () => d(C), size: 14 }) }),
|
|
887
|
+
M.map((te) => /* @__PURE__ */ n(K, { sx: H, children: et(Ae(A, te.id), m.data[te.id]) || F }, te.id)),
|
|
888
|
+
W && /* @__PURE__ */ n(K, { sx: H, children: /* @__PURE__ */ n(Me, { ui: e, data: m.data }) }),
|
|
889
|
+
(w || $) && /* @__PURE__ */ n(K, { align: "right", sx: e.sx("rowActions", { width: "1%", whiteSpace: "nowrap", py: 0.25 }), children: /* @__PURE__ */ n(f, { sx: { display: "inline-flex" }, children: E(m, C, L) }) })
|
|
890
|
+
] }),
|
|
891
|
+
$ && !x(m.key) && /* @__PURE__ */ n(me, { children: /* @__PURE__ */ n(K, { colSpan: V, sx: { p: 0, ...Y ? { borderBottom: 0 } : {} }, children: _(m, C, L) }) })
|
|
892
|
+
] }, m.key);
|
|
893
|
+
}) })
|
|
894
|
+
] }) });
|
|
895
|
+
}
|
|
896
|
+
function ht({
|
|
897
|
+
config: e,
|
|
898
|
+
nodes: t,
|
|
899
|
+
onChange: r,
|
|
900
|
+
guid: a,
|
|
901
|
+
depth: i = 0,
|
|
902
|
+
readOnly: l = !1,
|
|
903
|
+
issues: c = [],
|
|
904
|
+
showErrors: x = !1,
|
|
905
|
+
required: g = !1,
|
|
906
|
+
parentTitle: d,
|
|
907
|
+
texts: u
|
|
908
|
+
}) {
|
|
909
|
+
const b = J(), o = hn(b, e, i, u), { emptyTitle: y, emptyText: v, ...I } = { ...u || {}, ...e.texts || {} }, A = e.max != null ? Number(e.max) : void 0, k = !l && (A === void 0 || t.length < A), M = l ? "none" : o.addButton.position, W = M === "header" || M === "both", P = M === "footer" || M === "both", $ = e.showEmpty ?? !o.nested, j = t.length === 0 && $ && !(P && o.addButton.variant === "dashed"), w = t.length === 0 && !j && !P, [S, F] = Z({ open: !1, mode: "add", index: -1, session: 0 }), [_, E] = Z({ open: !1, index: -1, title: "", detail: "" }), [D, R] = Z(null), [H, V] = Z({}), m = (s, T = -1) => F((z) => ({ open: !0, mode: s, index: T, session: z.session + 1 })), C = () => F((s) => ({ ...s, open: !1 })), L = () => m("add"), G = (s) => m(!l && o.actions.edit ? "edit" : "view", s), Y = e.defaultCollapsed ?? o.layout === "table", N = (s) => H[s] ?? Y, te = (s) => V((T) => ({ ...T, [s]: !N(s) })), ft = (s, T) => {
|
|
910
|
+
if (S.mode === "add") {
|
|
911
|
+
const z = { key: oe(), data: s, children: en(e) };
|
|
912
|
+
o.layout === "cards" && V((ce) => ({ ...ce, [z.key]: !1 })), r([...t, z]);
|
|
913
|
+
const B = A !== void 0 && t.length + 1 >= A;
|
|
914
|
+
(!T || B) && C();
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
S.mode === "edit" && r(t.map((z, B) => B === S.index ? { ...z, data: s } : z)), C();
|
|
918
|
+
}, $e = (s) => r(t.filter((T, z) => z !== s)), qe = (s) => {
|
|
919
|
+
if (e.confirmDelete === !1) {
|
|
920
|
+
$e(s);
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
const T = t[s];
|
|
924
|
+
E({
|
|
925
|
+
open: !0,
|
|
926
|
+
index: s,
|
|
927
|
+
title: ae(T.data, e, s).title,
|
|
928
|
+
detail: Ht({ ...T.data, ...T.children }, e)
|
|
929
|
+
});
|
|
930
|
+
}, gt = (s) => {
|
|
931
|
+
const T = [...t];
|
|
932
|
+
T.splice(s + 1, 0, st(t[s])), r(T);
|
|
933
|
+
}, je = (s, T) => {
|
|
934
|
+
const z = s + T;
|
|
935
|
+
if (z < 0 || z >= t.length) return;
|
|
936
|
+
const B = [...t];
|
|
937
|
+
[B[s], B[z]] = [B[z], B[s]], r(B);
|
|
938
|
+
}, We = (s, T, z) => r(t.map((B, ce) => ce === s ? { ...B, children: { ...B.children, [T]: z } } : B)), re = x ? c.find((s) => s.path.length === 0)?.message : void 0, bt = S.index >= 0 ? t[S.index] : void 0, ne = D?.index ?? -1, ie = (s) => {
|
|
939
|
+
R(null), s();
|
|
940
|
+
}, ut = () => V(Object.fromEntries(t.map((s) => [s.key, !0]))), yt = () => V(Object.fromEntries(t.map((s) => [s.key, !1]))), le = t.length > 0 && t.every((s) => N(s.key)), se = o.t("deleteMessage", { detail: _.detail ? o.t("deleteDetail", { detail: _.detail }) : "" }), [vt, Ee] = se.includes("{title}") ? se.split("{title}") : [se, null];
|
|
941
|
+
return /* @__PURE__ */ h(f, { "data-collection": e.id, sx: o.sx("root", { width: "100%", minWidth: 0 }), children: [
|
|
942
|
+
/* @__PURE__ */ n(
|
|
943
|
+
wn,
|
|
944
|
+
{
|
|
945
|
+
ui: o,
|
|
946
|
+
count: t.length,
|
|
947
|
+
required: g || (Number(e.min) || 0) > 0,
|
|
948
|
+
alone: w && !re,
|
|
949
|
+
action: /* @__PURE__ */ h(f, { sx: { display: "flex", alignItems: "center", gap: 1, flexWrap: "wrap" }, children: [
|
|
950
|
+
o.layout === "cards" && t.length >= 2 && /* @__PURE__ */ n(
|
|
951
|
+
Q,
|
|
952
|
+
{
|
|
953
|
+
size: "small",
|
|
954
|
+
variant: "text",
|
|
955
|
+
onClick: le ? yt : ut,
|
|
956
|
+
sx: {
|
|
957
|
+
fontSize: 12.5,
|
|
958
|
+
fontWeight: 600,
|
|
959
|
+
color: "text.secondary",
|
|
960
|
+
px: 1,
|
|
961
|
+
minWidth: 0,
|
|
962
|
+
textTransform: "none",
|
|
963
|
+
"&:hover": { color: "text.primary", bgcolor: p(b.palette.text.primary, 0.05) }
|
|
964
|
+
},
|
|
965
|
+
startIcon: /* @__PURE__ */ n(q, { sx: { fontSize: "15px !important" }, children: le ? "unfold_more" : "unfold_less" }),
|
|
966
|
+
children: le ? "Expand all" : "Collapse all"
|
|
967
|
+
}
|
|
968
|
+
),
|
|
969
|
+
W && /* @__PURE__ */ n(Ke, { ui: o, placement: "header", empty: t.length === 0, disabled: !k, onClick: L })
|
|
970
|
+
] })
|
|
971
|
+
}
|
|
972
|
+
),
|
|
973
|
+
re && /* @__PURE__ */ h(
|
|
974
|
+
O,
|
|
975
|
+
{
|
|
976
|
+
role: "alert",
|
|
977
|
+
sx: o.sx("error", { display: "flex", alignItems: "center", gap: 0.5, color: "error.main", fontSize: 13, fontWeight: 500, mt: -0.5, mb: 1.25 }),
|
|
978
|
+
children: [
|
|
979
|
+
/* @__PURE__ */ n(q, { sx: { fontSize: "17px !important" }, children: "error_outline" }),
|
|
980
|
+
re
|
|
981
|
+
]
|
|
982
|
+
}
|
|
983
|
+
),
|
|
984
|
+
j && /* @__PURE__ */ n(Cn, { ui: o, readOnly: l, error: !!re }),
|
|
985
|
+
t.length > 0 && o.layout === "table" && /* @__PURE__ */ n(
|
|
986
|
+
In,
|
|
987
|
+
{
|
|
988
|
+
ui: o,
|
|
989
|
+
nodes: t,
|
|
990
|
+
guid: a,
|
|
991
|
+
readOnly: l,
|
|
992
|
+
issues: c,
|
|
993
|
+
showErrors: x,
|
|
994
|
+
texts: I,
|
|
995
|
+
isCollapsed: N,
|
|
996
|
+
onToggle: te,
|
|
997
|
+
onOpen: G,
|
|
998
|
+
onDelete: qe,
|
|
999
|
+
onMenu: (s, T) => R({ anchor: s, index: T }),
|
|
1000
|
+
onChildChange: We
|
|
1001
|
+
}
|
|
1002
|
+
),
|
|
1003
|
+
t.length > 0 && o.layout === "cards" && /* @__PURE__ */ n(f, { sx: o.sx("list", { display: "flex", flexDirection: "column", gap: 2 }), children: t.map((s, T) => /* @__PURE__ */ n(
|
|
1004
|
+
Tn,
|
|
1005
|
+
{
|
|
1006
|
+
ui: o,
|
|
1007
|
+
node: s,
|
|
1008
|
+
index: T,
|
|
1009
|
+
guid: a,
|
|
1010
|
+
readOnly: l,
|
|
1011
|
+
collapsed: N(s.key),
|
|
1012
|
+
issues: c.filter((z) => z.path[0] === T).map((z) => ({ ...z, path: z.path.slice(1) })),
|
|
1013
|
+
showErrors: x,
|
|
1014
|
+
texts: I,
|
|
1015
|
+
onOpen: () => G(T),
|
|
1016
|
+
onDelete: () => qe(T),
|
|
1017
|
+
onMenu: (z) => R({ anchor: z, index: T }),
|
|
1018
|
+
onToggle: () => te(s.key),
|
|
1019
|
+
onChildChange: (z, B) => We(T, z, B)
|
|
1020
|
+
},
|
|
1021
|
+
s.key
|
|
1022
|
+
)) }),
|
|
1023
|
+
P && /* @__PURE__ */ n(f, { sx: { mt: t.length || o.addButton.variant !== "dashed" ? 1.25 : 0 }, children: /* @__PURE__ */ n(Ke, { ui: o, placement: "footer", empty: t.length === 0, disabled: !k, onClick: L }) }),
|
|
1024
|
+
/* @__PURE__ */ n(
|
|
1025
|
+
kn,
|
|
1026
|
+
{
|
|
1027
|
+
ui: o,
|
|
1028
|
+
open: S.open,
|
|
1029
|
+
mode: S.mode,
|
|
1030
|
+
session: S.session,
|
|
1031
|
+
guid: `${a}-${e.id}`,
|
|
1032
|
+
initial: bt?.data,
|
|
1033
|
+
context: d,
|
|
1034
|
+
onClose: C,
|
|
1035
|
+
onSave: ft
|
|
1036
|
+
}
|
|
1037
|
+
),
|
|
1038
|
+
/* @__PURE__ */ h(
|
|
1039
|
+
Xt,
|
|
1040
|
+
{
|
|
1041
|
+
anchorEl: D?.anchor,
|
|
1042
|
+
open: !!D,
|
|
1043
|
+
onClose: () => R(null),
|
|
1044
|
+
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
1045
|
+
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
1046
|
+
sx: { "& .MuiPaper-root": o.merged("menu", { borderRadius: "10px", minWidth: 170 }) },
|
|
1047
|
+
children: [
|
|
1048
|
+
o.actions.duplicate && /* @__PURE__ */ h(de, { sx: o.sx("menuItem"), disabled: !k, onClick: () => ie(() => gt(ne)), children: [
|
|
1049
|
+
/* @__PURE__ */ n(pe, { children: /* @__PURE__ */ n(q, { fontSize: "small", children: "content_copy" }) }),
|
|
1050
|
+
/* @__PURE__ */ n(xe, { children: o.t("duplicate") })
|
|
1051
|
+
] }),
|
|
1052
|
+
o.actions.move && /* @__PURE__ */ h(de, { sx: o.sx("menuItem"), disabled: ne <= 0, onClick: () => ie(() => je(ne, -1)), children: [
|
|
1053
|
+
/* @__PURE__ */ n(pe, { children: /* @__PURE__ */ n(q, { fontSize: "small", children: "arrow_upward" }) }),
|
|
1054
|
+
/* @__PURE__ */ n(xe, { children: o.t("moveUp") })
|
|
1055
|
+
] }),
|
|
1056
|
+
o.actions.move && /* @__PURE__ */ h(de, { sx: o.sx("menuItem"), disabled: ne >= t.length - 1, onClick: () => ie(() => je(ne, 1)), children: [
|
|
1057
|
+
/* @__PURE__ */ n(pe, { children: /* @__PURE__ */ n(q, { fontSize: "small", children: "arrow_downward" }) }),
|
|
1058
|
+
/* @__PURE__ */ n(xe, { children: o.t("moveDown") })
|
|
1059
|
+
] })
|
|
1060
|
+
]
|
|
1061
|
+
}
|
|
1062
|
+
),
|
|
1063
|
+
/* @__PURE__ */ h(
|
|
1064
|
+
rt,
|
|
1065
|
+
{
|
|
1066
|
+
open: _.open,
|
|
1067
|
+
onClose: () => E((s) => ({ ...s, open: !1 })),
|
|
1068
|
+
maxWidth: "xs",
|
|
1069
|
+
fullWidth: !0,
|
|
1070
|
+
sx: { "& .MuiDialog-paper": o.merged("confirm", { borderRadius: "12px", backgroundImage: "none" }) },
|
|
1071
|
+
children: [
|
|
1072
|
+
/* @__PURE__ */ h(at, { sx: { pt: 3, pb: 1 }, children: [
|
|
1073
|
+
/* @__PURE__ */ n(O, { sx: o.sx("confirmTitle", { fontWeight: 600, fontSize: 17 }), children: o.t("deleteTitle") }),
|
|
1074
|
+
/* @__PURE__ */ h(O, { sx: o.sx("confirmText", { fontSize: 14, color: "text.secondary", mt: 1 }), children: [
|
|
1075
|
+
vt,
|
|
1076
|
+
Ee !== null && /* @__PURE__ */ n(f, { component: "strong", sx: { color: "text.primary", fontWeight: 600 }, children: _.title }),
|
|
1077
|
+
Ee
|
|
1078
|
+
] })
|
|
1079
|
+
] }),
|
|
1080
|
+
/* @__PURE__ */ h(ot, { sx: { px: 3, pb: 2.5, pt: 2, gap: 1, "& .MuiButton-root": { textTransform: "none", fontWeight: 600, borderRadius: "8px" } }, children: [
|
|
1081
|
+
/* @__PURE__ */ n(Q, { color: "inherit", onClick: () => E((s) => ({ ...s, open: !1 })), sx: o.sx("confirmCancel", { color: "text.secondary" }), children: o.t("cancel") }),
|
|
1082
|
+
/* @__PURE__ */ n(
|
|
1083
|
+
Q,
|
|
1084
|
+
{
|
|
1085
|
+
variant: "contained",
|
|
1086
|
+
color: "error",
|
|
1087
|
+
disableElevation: !0,
|
|
1088
|
+
onClick: () => {
|
|
1089
|
+
$e(_.index), E((s) => ({ ...s, open: !1 }));
|
|
1090
|
+
},
|
|
1091
|
+
sx: o.sx("confirmDelete"),
|
|
1092
|
+
children: o.t("deleteConfirm")
|
|
1093
|
+
}
|
|
1094
|
+
)
|
|
1095
|
+
] })
|
|
1096
|
+
]
|
|
1097
|
+
}
|
|
1098
|
+
)
|
|
1099
|
+
] });
|
|
1100
|
+
}
|
|
1101
|
+
const zn = ["mandatory", "mandatoryselect"], ke = (e) => {
|
|
1102
|
+
try {
|
|
1103
|
+
return JSON.stringify(e);
|
|
1104
|
+
} catch {
|
|
1105
|
+
return "";
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
function Wn({ attributes: e = {}, rules: t = {}, onChange: r, submitTick: a }) {
|
|
1109
|
+
const { id: i = "", value: l } = e, c = { ...e, id: i, fields: e.fields || [] }, x = !!(e.readOnly || e.disabled || e.MuiAttributes?.disabled), g = t?.validation?.find((k) => zn.includes(k.rule)), [d] = Z(oe), [u, b] = Z(() => Te(l, c)), [o, y] = Z(!1), v = Xe(ke(we(l)));
|
|
1110
|
+
Oe(() => {
|
|
1111
|
+
const k = ke(we(l));
|
|
1112
|
+
k !== v.current && (v.current = k, b(Te(l, c)));
|
|
1113
|
+
}, [l]), Oe(() => {
|
|
1114
|
+
a && y(!0);
|
|
1115
|
+
}, [a]);
|
|
1116
|
+
const I = (k) => {
|
|
1117
|
+
b(k);
|
|
1118
|
+
const M = Ie(k, c);
|
|
1119
|
+
v.current = ke(M), r?.({ id: i, value: M });
|
|
1120
|
+
}, A = Kt(Ie(u, c), c, {
|
|
1121
|
+
required: !!g,
|
|
1122
|
+
requiredMessage: g?.message
|
|
1123
|
+
});
|
|
1124
|
+
return /* @__PURE__ */ n(
|
|
1125
|
+
ht,
|
|
1126
|
+
{
|
|
1127
|
+
config: c,
|
|
1128
|
+
nodes: u,
|
|
1129
|
+
onChange: I,
|
|
1130
|
+
guid: `${d}-${i}`,
|
|
1131
|
+
readOnly: x,
|
|
1132
|
+
issues: A,
|
|
1133
|
+
showErrors: o,
|
|
1134
|
+
required: !!g
|
|
1135
|
+
}
|
|
1136
|
+
);
|
|
1137
|
+
}
|
|
1138
|
+
export {
|
|
1139
|
+
Wn as default
|
|
1140
|
+
};
|