dynamic-mui 2.5.2 → 2.6.0
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/dist/accordion-DB151BNT.mjs +22 -0
- package/dist/accordion-YWjUldL8.js +1 -0
- package/dist/addressfield-CpvOajVo.mjs +242 -0
- package/dist/addressfield-CwKjfnTq.js +1 -0
- package/dist/ai/index.cjs +1 -1
- package/dist/ai/index.mjs +1 -14
- package/dist/ai/react/AIForm.d.ts +2 -1
- package/dist/ai/react/AIFormGenerator.d.ts +1 -1
- package/dist/ai/react/AISchemaReview.d.ts +1 -1
- package/dist/ai/react/AITextAssist.d.ts +1 -1
- package/dist/ai/react/AIVisionImport.d.ts +2 -1
- package/dist/ai-BFpA3uHx.js +29 -0
- package/dist/ai-UvDYQ30b.mjs +4533 -0
- package/dist/asyncautocomplete-DQLDdmVl.js +1 -0
- package/dist/asyncautocomplete-mwra2KKJ.mjs +72 -0
- package/dist/bar-CgYZxXHl.js +1 -0
- package/dist/bar-LVtZP6Ui.mjs +4 -0
- package/dist/cascadeselect-BJzHZA9-.js +1 -0
- package/dist/cascadeselect-Cl4OHq-L.mjs +66 -0
- package/dist/chartControl-IQafKpDk.mjs +29 -0
- package/dist/chartControl-ifHiG3nr.js +1 -0
- package/dist/collection-DPJTrAiB.mjs +1692 -0
- package/dist/collection-Dd_Ojgwl.js +1 -0
- package/dist/colorpicker-9AUe21p1.mjs +110 -0
- package/dist/colorpicker-DgKTLBmU.js +1 -0
- package/dist/components/DynamicComponent.d.ts +2 -1
- package/dist/components/FormGenerator.d.ts +1 -1
- package/dist/components/charts/Bar/bar.d.ts +6 -2
- package/dist/components/charts/Line/line.d.ts +6 -2
- package/dist/components/charts/Mixchart/mixChart.d.ts +2 -1
- package/dist/components/charts/Pie/pie.d.ts +6 -2
- package/dist/components/charts/chartControl.d.ts +15 -0
- package/dist/components/controls/Accordion/accordion.d.ts +2 -1
- package/dist/components/controls/AddressField/addressfield.d.ts +2 -1
- package/dist/components/controls/Alert/alert.d.ts +1 -1
- package/dist/components/controls/AsyncAutocomplete/asyncautocomplete.d.ts +1 -1
- package/dist/components/controls/Autocomplete/autocomplete.d.ts +1 -1
- package/dist/components/controls/Button/button.d.ts +1 -1
- package/dist/components/controls/CascadeSelect/cascadeselect.d.ts +2 -1
- package/dist/components/controls/CheckBox/checkbox.d.ts +2 -2
- package/dist/components/controls/CheckBox/toggleInput.d.ts +25 -0
- package/dist/components/controls/Chip/chip.d.ts +1 -1
- package/dist/components/controls/ChipSelect/chipselect.d.ts +2 -1
- package/dist/components/controls/Collection/CollectionList.d.ts +1 -1
- package/dist/components/controls/Collection/ItemDialog.d.ts +1 -1
- package/dist/components/controls/Collection/collection.d.ts +1 -1
- package/dist/components/controls/Collection/parts.d.ts +6 -6
- package/dist/components/controls/ColorPicker/colorpicker.d.ts +2 -1
- package/dist/components/controls/Computed/computed.d.ts +1 -1
- package/dist/components/controls/ConsentField/consentfield.d.ts +2 -1
- package/dist/components/controls/CurrencyField/currencyfield.d.ts +1 -1
- package/dist/components/controls/DataTable/datatable.d.ts +2 -1
- package/dist/components/controls/DateRangePicker/daterangepicker.d.ts +1 -1
- package/dist/components/controls/DateTime/datetime.d.ts +15 -1
- package/dist/components/controls/DateTimePicker/datetimepicker.d.ts +6 -2
- package/dist/components/controls/Divider/divider.d.ts +1 -1
- package/dist/components/controls/EditableTable/editabletable.d.ts +1 -1
- package/dist/components/controls/FileUpload/fileupload.d.ts +1 -1
- package/dist/components/controls/FormRepeater/formrepeater.d.ts +1 -1
- package/dist/components/controls/FormWizard/formwizard.d.ts +1 -1
- package/dist/components/controls/GeoField/geofield.d.ts +1 -1
- package/dist/components/controls/Group/group.d.ts +2 -1
- package/dist/components/controls/Hyperlink/hyperlink.d.ts +1 -1
- package/dist/components/controls/ImageList/imagelist.d.ts +1 -1
- package/dist/components/controls/IntlPhone/intlphone.d.ts +2 -1
- package/dist/components/controls/KeyValueField/keyvaluefield.d.ts +2 -1
- package/dist/components/controls/LineItemList/lineitemlist.d.ts +1 -1
- package/dist/components/controls/List/list.d.ts +1 -1
- package/dist/components/controls/LocationField/locationfield.d.ts +1 -1
- package/dist/components/controls/MarkdownEditor/markdowneditor.d.ts +2 -1
- package/dist/components/controls/MatrixField/matrixfield.d.ts +2 -1
- package/dist/components/controls/MultiTextbox/multitextbox.d.ts +1 -1
- package/dist/components/controls/NpsScale/npsscale.d.ts +2 -1
- package/dist/components/controls/NumberField/numberfield.d.ts +2 -1
- package/dist/components/controls/NumberStepper/numberstepper.d.ts +1 -1
- package/dist/components/controls/OtpField/otpfield.d.ts +2 -1
- package/dist/components/controls/PasswordField/passwordfield.d.ts +2 -1
- package/dist/components/controls/PhoneField/phonefield.d.ts +1 -1
- package/dist/components/controls/Radio/radio.d.ts +2 -1
- package/dist/components/controls/Rating/rating.d.ts +2 -1
- package/dist/components/controls/RichTextEditor/richtexteditor.d.ts +2 -1
- package/dist/components/controls/Select/select.d.ts +2 -1
- package/dist/components/controls/Signature/signature.d.ts +1 -1
- package/dist/components/controls/Slider/slider.d.ts +1 -1
- package/dist/components/controls/Stepper/stepper.d.ts +1 -1
- package/dist/components/controls/SummaryField/summaryfield.d.ts +2 -1
- package/dist/components/controls/Switch/switch.d.ts +1 -1
- package/dist/components/controls/Tabs/tabs.d.ts +2 -1
- package/dist/components/controls/TagsInput/tagsinput.d.ts +1 -1
- package/dist/components/controls/TextField/textfield.d.ts +1 -1
- package/dist/components/controls/TextField/useTextInput.d.ts +18 -0
- package/dist/components/controls/TimePicker/timepicker.d.ts +6 -2
- package/dist/components/controls/ToggleButtons/togglebuttons.d.ts +1 -1
- package/dist/components/controls/Typography/typography.d.ts +1 -1
- package/dist/components/controls/index.d.ts +24 -9
- package/dist/consentfield-CFm1IDa5.mjs +68 -0
- package/dist/consentfield-z8W0Yfx8.js +1 -0
- package/dist/datatable-CMjaTDPM.js +1 -0
- package/dist/datatable-lZIwHx6a.mjs +29 -0
- package/dist/dynamic-mui.cjs +1 -1
- package/dist/dynamic-mui.d.ts +1 -1
- package/dist/dynamic-mui.mjs +264 -204
- package/dist/editabletable-B3Df4Jys.mjs +117 -0
- package/dist/editabletable-r0RwM1rO.js +1 -0
- package/dist/fileupload-Cr-Mz7oH.js +1 -0
- package/dist/fileupload-D2fXyMIu.mjs +191 -0
- package/dist/formrepeater-BP-RBrQv.js +1 -0
- package/dist/formrepeater-BrYTYCzc.mjs +82 -0
- package/dist/formwizard-CQ2z6fUX.mjs +82 -0
- package/dist/formwizard-DR7fa59M.js +1 -0
- package/dist/geofield-CxVFA0og.mjs +116 -0
- package/dist/geofield-DtN-d2Bq.js +1 -0
- package/dist/group-CiohorzN.mjs +30 -0
- package/dist/group-HQL7UqHt.js +1 -0
- package/dist/imagelist-CNe1Dp_M.mjs +23 -0
- package/dist/imagelist-Wm5Qa6wA.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/intlphone-DwsiSfSt.js +1 -0
- package/dist/intlphone-LGE-cB6X.mjs +341 -0
- package/dist/keyvaluefield-B7NlE0AT.js +1 -0
- package/dist/keyvaluefield-Cd4NQf6d.mjs +128 -0
- package/dist/line-BGSi1tvf.js +1 -0
- package/dist/line-cK6taoCA.mjs +4 -0
- package/dist/lineitemlist-bmk7fEf9.mjs +169 -0
- package/dist/lineitemlist-mulPt3cO.js +1 -0
- package/dist/list-D5qW-7Xg.js +1 -0
- package/dist/list-xPNiijgm.mjs +20 -0
- package/dist/locationfield-DtWkxnX-.js +1 -0
- package/dist/locationfield-SPonkbMU.mjs +90 -0
- package/dist/markdowneditor-6lJQ5cEn.mjs +82 -0
- package/dist/markdowneditor-nPP0t2eK.js +2 -0
- package/dist/matrixfield-CUYoJCwi.js +1 -0
- package/dist/matrixfield-Jm9Yx0EP.mjs +119 -0
- package/dist/mixChart-CSq7pQqJ.mjs +49 -0
- package/dist/mixChart-DoehYa8V.js +1 -0
- package/dist/muiX-BHOKpogF.mjs +12 -0
- package/dist/muiX-CG_D1XQ2.js +1 -0
- package/dist/multitextbox-D-JUSnT7.js +1 -0
- package/dist/multitextbox-gUt8BmfQ.mjs +96 -0
- package/dist/npsscale-D_VtbpJi.js +1 -0
- package/dist/npsscale-LWe7yCxB.mjs +111 -0
- package/dist/numberstepper-BXXlSKT_.js +1 -0
- package/dist/numberstepper-K_JfJJtg.mjs +111 -0
- package/dist/pie-CueMspFX.js +1 -0
- package/dist/pie-DFO89j-z.mjs +4 -0
- package/dist/richtexteditor-BHM-8xe3.js +1 -0
- package/dist/richtexteditor-gmObNHZ7.mjs +178 -0
- package/dist/rolldown-runtime-5iZMYShA.js +1 -0
- package/dist/s3Upload-C3-wcrua.js +1 -0
- package/dist/s3Upload-HtE088XA.mjs +39 -0
- package/dist/signature-DjYfiNzq.js +3 -0
- package/dist/signature-HiL8FJ6C.mjs +1116 -0
- package/dist/stepper-cpOj2wWz.mjs +166 -0
- package/dist/stepper-zEfhqmbA.js +1 -0
- package/dist/summaryfield-BzrdvTVy.js +1 -0
- package/dist/summaryfield-DIQfJjjo.mjs +65 -0
- package/dist/tabs-DvPu-zDC.mjs +50 -0
- package/dist/tabs-xdkLXUCp.js +1 -0
- package/dist/tagsinput-B33m6GJ_.js +1 -0
- package/dist/tagsinput-CTBGuv0M.mjs +49 -0
- package/dist/useSyncedState-CzAO4D1o.mjs +17 -0
- package/dist/useSyncedState-DYNKkpDv.js +1 -0
- package/dist/useTextInput-Cm0_Ps2V.js +1 -0
- package/dist/useTextInput-Dr-ncTE8.mjs +1683 -0
- package/dist/useUpdateEffect-CNBo9hj8.js +1 -0
- package/dist/useUpdateEffect-CXAhttj7.mjs +14 -0
- package/dist/util/helper.d.ts +18 -1
- package/dist/util/muiVersion.d.ts +13 -0
- package/dist/util/stepperComponents.d.ts +1 -1
- package/dist/util/useSyncedState.d.ts +22 -0
- package/dist/util/validation.d.ts +40 -0
- package/dist/v4-Dyp-SQ1c.js +1 -0
- package/dist/v4-YCkfo8OR.mjs +27 -0
- package/dist/validation-B7DPZ218.js +7 -0
- package/dist/validation-BRcYhhsT.mjs +4991 -0
- package/package.json +35 -35
- package/dist/AIForm-CAlzDffx.js +0 -44
- package/dist/AIForm-DhR29Z6d.mjs +0 -12274
- package/dist/accordion-B1Laqpu6.js +0 -1
- package/dist/accordion-DRo0ZP5u.mjs +0 -23
- package/dist/addressfield-1Ht4A4u9.mjs +0 -164
- package/dist/addressfield-DEu_5gQv.js +0 -1
- package/dist/asyncautocomplete-BPTtLquY.mjs +0 -92
- package/dist/asyncautocomplete-DPn-jVl4.js +0 -1
- package/dist/bar-CEFjy1KY.js +0 -1
- package/dist/bar-CkCZunh6.mjs +0 -21
- package/dist/cascadeselect-BKqX6e3j.mjs +0 -66
- package/dist/cascadeselect-DCMmaKxY.js +0 -1
- package/dist/collection-B6mXg1EE.js +0 -1
- package/dist/collection-D6iGJnXe.mjs +0 -1157
- package/dist/colorpicker-DRC4NHgd.mjs +0 -111
- package/dist/colorpicker-VOk6ZC89.js +0 -1
- package/dist/consentfield-Bogbxanw.js +0 -1
- package/dist/consentfield-DHIVXzhj.mjs +0 -80
- package/dist/datatable-DU0W9LHs.mjs +0 -21
- package/dist/datatable-DUdM8xtY.js +0 -1
- package/dist/editabletable-D801lgHY.mjs +0 -128
- package/dist/editabletable-De_BiNVx.js +0 -1
- package/dist/fileupload-CozsBlXX.mjs +0 -185
- package/dist/fileupload-YGYUpPXo.js +0 -1
- package/dist/formrepeater-LXzfFY3V.mjs +0 -75
- package/dist/formrepeater-iD9e1ow4.js +0 -1
- package/dist/formwizard-Bb0LOmIN.mjs +0 -83
- package/dist/formwizard-CuDayHm6.js +0 -1
- package/dist/geofield-B22-bJ0f.mjs +0 -108
- package/dist/geofield-DkB-js8Y.js +0 -1
- package/dist/group-B5vjjzsk.mjs +0 -23
- package/dist/group-B_WI43pI.js +0 -1
- package/dist/imagelist-Bn9QhIv7.js +0 -1
- package/dist/imagelist-rqmJajHt.mjs +0 -18
- package/dist/intlphone-CkHQ2YvK.js +0 -1
- package/dist/intlphone-DnqGCNdx.mjs +0 -144
- package/dist/keyvaluefield-CX97ykNT.js +0 -1
- package/dist/keyvaluefield-Dm5dRen5.mjs +0 -127
- package/dist/line-CjQk91Nq.js +0 -1
- package/dist/line-pFBz6CTL.mjs +0 -21
- package/dist/lineitemlist-B5JJqhjg.mjs +0 -170
- package/dist/lineitemlist-C39r0qRM.js +0 -1
- package/dist/list-73Pemuh_.mjs +0 -20
- package/dist/list-CkVSoMPM.js +0 -1
- package/dist/locationfield-DLFggIVT.js +0 -1
- package/dist/locationfield-DY8wZ-Vv.mjs +0 -118
- package/dist/markdowneditor-BtF43ekZ.js +0 -2
- package/dist/markdowneditor-VfwnN9cX.mjs +0 -94
- package/dist/matrixfield-BIKQg7FM.mjs +0 -121
- package/dist/matrixfield-BjdsHrtX.js +0 -1
- package/dist/mixChart-Doq4lt7Z.mjs +0 -75
- package/dist/mixChart-rgyMCdnp.js +0 -1
- package/dist/multitextbox-BNZ6kVPG.js +0 -1
- package/dist/multitextbox-DqLIw1i-.mjs +0 -78
- package/dist/npsscale-B2JYIHr8.js +0 -1
- package/dist/npsscale-CWFVm0wp.mjs +0 -91
- package/dist/numberstepper-Cpb7ceR4.js +0 -1
- package/dist/numberstepper-DLwZsyV1.mjs +0 -132
- package/dist/pie-AC1_bQ6M.mjs +0 -21
- package/dist/pie-BZhroZyG.js +0 -1
- package/dist/richtexteditor-Bwn62mA-.mjs +0 -143
- package/dist/richtexteditor-DDIzZxki.js +0 -1
- package/dist/s3Upload-B0JeoLkS.js +0 -1
- package/dist/s3Upload-dpioZ2c8.mjs +0 -51
- package/dist/signature-DtXYAy1a.js +0 -2
- package/dist/signature-z2PB3zv7.mjs +0 -1227
- package/dist/stepper-B8Blpvp8.mjs +0 -140
- package/dist/stepper-o3Ef6Czl.js +0 -1
- package/dist/summaryfield-2t_sXF8P.js +0 -1
- package/dist/summaryfield-CTQL3W7R.mjs +0 -96
- package/dist/tabs-DlIOUQ5z.js +0 -1
- package/dist/tabs-lqveygGh.mjs +0 -39
- package/dist/tagsinput-C2awcyJT.mjs +0 -58
- package/dist/tagsinput-g_-HLhtt.js +0 -1
- package/dist/v4-BysszJq8.mjs +0 -30
- package/dist/v4-CqdK_b8Y.js +0 -1
|
@@ -0,0 +1,1692 @@
|
|
|
1
|
+
import { c as e, s as t } from "./validation-BRcYhhsT.mjs";
|
|
2
|
+
import { A as n, C as r, D as i, E as a, F as o, I as s, L as c, M as l, N as u, P as d, S as f, _ as p, b as m, g as h, h as g, j as _, k as v, m as y, p as b, v as x, w as S, x as C, y as w } from "./useTextInput-Dr-ncTE8.mjs";
|
|
3
|
+
import { C as T, E, S as D, T as O, _ as k, b as A, g as j, m as M, v as ee, w as N, x as P, y as te } from "./ai-UvDYQ30b.mjs";
|
|
4
|
+
import { t as ne } from "./useUpdateEffect-CXAhttj7.mjs";
|
|
5
|
+
import { Fragment as re, useRef as F, useState as I } from "react";
|
|
6
|
+
import { Box as L, Button as R, ButtonBase as z, Collapse as ie, Dialog as ae, DialogActions as oe, DialogContent as se, Icon as B, IconButton as V, ListItemIcon as ce, ListItemText as le, Menu as ue, MenuItem as de, Table as fe, TableBody as pe, TableCell as H, TableHead as me, TableRow as U, Tooltip as W, Typography as G, useMediaQuery as K } from "@mui/material";
|
|
7
|
+
import { alpha as q, useTheme as J } from "@mui/material/styles";
|
|
8
|
+
import { Fragment as he, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
9
|
+
// src/components/controls/Collection/tree.ts
|
|
10
|
+
var ge = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
|
|
11
|
+
var n = h(), r = 1, i = 4;
|
|
12
|
+
function a(e) {
|
|
13
|
+
return n(e, r | i);
|
|
14
|
+
}
|
|
15
|
+
t.exports = a;
|
|
16
|
+
})))()), _e = 0, ve = () => `dmui-col-${++_e}`, Z = (e) => (e.collections || []).map((e) => e.id), ye = (e) => Object.fromEntries(Z(e).map((e) => [e, []])), Q = (e, t) => E(e).map((e) => {
|
|
17
|
+
let n = new Set(Z(t)), r = Object.fromEntries(Object.entries(e).filter(([e]) => !n.has(e))), i = Object.fromEntries((t.collections || []).map((t) => [t.id, Q(e[t.id], t)]));
|
|
18
|
+
return {
|
|
19
|
+
key: ve(),
|
|
20
|
+
data: r,
|
|
21
|
+
children: i
|
|
22
|
+
};
|
|
23
|
+
}), be = (e, t) => e.map((e) => {
|
|
24
|
+
let n = { ...e.data };
|
|
25
|
+
return (t.collections || []).forEach((t) => {
|
|
26
|
+
n[t.id] = be(e.children[t.id] || [], t);
|
|
27
|
+
}), n;
|
|
28
|
+
}), xe = (e) => ({
|
|
29
|
+
key: ve(),
|
|
30
|
+
data: (0, ge.default)(e.data),
|
|
31
|
+
children: Object.fromEntries(Object.entries(e.children).map(([e, t]) => [e, t.map(xe)]))
|
|
32
|
+
}), Se = /* @__PURE__ */ t(((e, t) => {
|
|
33
|
+
var n = S(), r = i();
|
|
34
|
+
function a(e, t, i) {
|
|
35
|
+
(i !== void 0 && !r(e[t], i) || i === void 0 && !(t in e)) && n(e, t, i);
|
|
36
|
+
}
|
|
37
|
+
t.exports = a;
|
|
38
|
+
})), Ce = /* @__PURE__ */ t(((e, t) => {
|
|
39
|
+
var n = _(), r = d();
|
|
40
|
+
function i(e) {
|
|
41
|
+
return r(e) && n(e);
|
|
42
|
+
}
|
|
43
|
+
t.exports = i;
|
|
44
|
+
})), we = /* @__PURE__ */ t(((e, t) => {
|
|
45
|
+
var n = c(), r = w(), i = d(), a = "[object Object]", o = Function.prototype, s = Object.prototype, l = o.toString, u = s.hasOwnProperty, f = l.call(Object);
|
|
46
|
+
function p(e) {
|
|
47
|
+
if (!i(e) || n(e) != a) return !1;
|
|
48
|
+
var t = r(e);
|
|
49
|
+
if (t === null) return !0;
|
|
50
|
+
var o = u.call(t, "constructor") && t.constructor;
|
|
51
|
+
return typeof o == "function" && o instanceof o && l.call(o) == f;
|
|
52
|
+
}
|
|
53
|
+
t.exports = p;
|
|
54
|
+
})), Te = /* @__PURE__ */ t(((e, t) => {
|
|
55
|
+
function n(e, t) {
|
|
56
|
+
if ((t !== "constructor" || typeof e[t] != "function") && t != "__proto__") return e[t];
|
|
57
|
+
}
|
|
58
|
+
t.exports = n;
|
|
59
|
+
})), Ee = /* @__PURE__ */ t(((e, t) => {
|
|
60
|
+
var n = r(), i = f();
|
|
61
|
+
function a(e) {
|
|
62
|
+
return n(e, i(e));
|
|
63
|
+
}
|
|
64
|
+
t.exports = a;
|
|
65
|
+
})), De = /* @__PURE__ */ t(((e, t) => {
|
|
66
|
+
var r = Se(), i = C(), a = x(), c = m(), d = p(), f = u(), h = l(), g = Ce(), _ = n(), y = o(), b = s(), S = we(), w = v(), T = Te(), E = Ee();
|
|
67
|
+
function D(e, t, n, o, s, l, u) {
|
|
68
|
+
var p = T(e, n), m = T(t, n), v = u.get(m);
|
|
69
|
+
if (v) r(e, n, v);
|
|
70
|
+
else {
|
|
71
|
+
var x = l ? l(p, m, n + "", e, t, u) : void 0, C = x === void 0;
|
|
72
|
+
if (C) {
|
|
73
|
+
var D = h(m), O = !D && _(m), k = !D && !O && w(m);
|
|
74
|
+
x = m, D || O || k ? h(p) ? x = p : g(p) ? x = c(p) : O ? (C = !1, x = i(m, !0)) : k ? (C = !1, x = a(m, !0)) : x = [] : S(m) || f(m) ? (x = p, f(p) ? x = E(p) : (!b(p) || y(p)) && (x = d(m))) : C = !1;
|
|
75
|
+
}
|
|
76
|
+
C && (u.set(m, x), s(x, m, o, l, u), u.delete(m)), r(e, n, x);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
t.exports = D;
|
|
80
|
+
})), Oe = /* @__PURE__ */ t(((e, t) => {
|
|
81
|
+
var n = a(), r = Se(), i = g(), o = De(), c = s(), l = f(), u = Te();
|
|
82
|
+
function d(e, t, a, s, f) {
|
|
83
|
+
e !== t && i(t, function(i, l) {
|
|
84
|
+
if (f ||= new n(), c(i)) o(e, t, l, a, d, s, f);
|
|
85
|
+
else {
|
|
86
|
+
var p = s ? s(u(e, l), i, l + "", e, t, f) : void 0;
|
|
87
|
+
p === void 0 && (p = i), r(e, l, p);
|
|
88
|
+
}
|
|
89
|
+
}, l);
|
|
90
|
+
}
|
|
91
|
+
t.exports = d;
|
|
92
|
+
})), ke = /* @__PURE__ */ t(((e, t) => {
|
|
93
|
+
var n = y(), r = b();
|
|
94
|
+
function i(e) {
|
|
95
|
+
return n(function(t, n) {
|
|
96
|
+
var i = -1, a = n.length, o = a > 1 ? n[a - 1] : void 0, s = a > 2 ? n[2] : void 0;
|
|
97
|
+
for (o = e.length > 3 && typeof o == "function" ? (a--, o) : void 0, s && r(n[0], n[1], s) && (o = a < 3 ? void 0 : o, a = 1), t = Object(t); ++i < a;) {
|
|
98
|
+
var c = n[i];
|
|
99
|
+
c && e(t, c, i, o);
|
|
100
|
+
}
|
|
101
|
+
return t;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
t.exports = i;
|
|
105
|
+
})), Ae = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
|
|
106
|
+
var n = Oe();
|
|
107
|
+
t.exports = ke()(function(e, t, r) {
|
|
108
|
+
n(e, t, r);
|
|
109
|
+
});
|
|
110
|
+
})))()), je = (e, t) => {
|
|
111
|
+
let n = e.palette[t || "primary"];
|
|
112
|
+
if (n && typeof n == "object" && n.main) return n;
|
|
113
|
+
try {
|
|
114
|
+
return e.palette.augmentColor({ color: { main: String(t) } });
|
|
115
|
+
} catch {
|
|
116
|
+
return e.palette.primary;
|
|
117
|
+
}
|
|
118
|
+
}, Me = (e, t) => e.palette.mode === "dark" ? t.light : t.dark, Ne = {
|
|
119
|
+
add: "Add {label}",
|
|
120
|
+
addMore: "Add another {labelLower}",
|
|
121
|
+
emptyTitle: "No {pluralLower} yet",
|
|
122
|
+
emptyText: void 0,
|
|
123
|
+
edit: "Edit",
|
|
124
|
+
duplicate: "Duplicate",
|
|
125
|
+
moveUp: "Move up",
|
|
126
|
+
moveDown: "Move down",
|
|
127
|
+
delete: "Delete",
|
|
128
|
+
more: "More actions",
|
|
129
|
+
collapse: "Collapse",
|
|
130
|
+
expand: "Expand",
|
|
131
|
+
editAria: "Edit {title}",
|
|
132
|
+
deleteAria: "Delete {title}",
|
|
133
|
+
viewAria: "View {title}",
|
|
134
|
+
moreAria: "More actions for {title}",
|
|
135
|
+
collapseAria: "Collapse {title}",
|
|
136
|
+
expandAria: "Expand {title}",
|
|
137
|
+
maxReached: "Maximum of {max} reached",
|
|
138
|
+
dialogAddTitle: "Add {label}",
|
|
139
|
+
dialogEditTitle: "Edit {label}",
|
|
140
|
+
dialogViewTitle: "{label}",
|
|
141
|
+
dialogContext: "For {parent}",
|
|
142
|
+
save: "Add {label}",
|
|
143
|
+
saveChanges: "Save changes",
|
|
144
|
+
saveAndAddAnother: "Save & add another",
|
|
145
|
+
cancel: "Cancel",
|
|
146
|
+
close: "Close",
|
|
147
|
+
closeAria: "Close dialog",
|
|
148
|
+
shortcut: "⌘/Ctrl + Enter",
|
|
149
|
+
deleteTitle: "Delete {labelLower}?",
|
|
150
|
+
deleteMessage: "{title} will be removed{detail}. This can’t be undone.",
|
|
151
|
+
deleteDetail: ", along with {detail}",
|
|
152
|
+
deleteConfirm: "Delete"
|
|
153
|
+
}, Pe = (e, t) => e.replace(/\{(\w+)\}/g, (e, n) => t[n] == null ? e : String(t[n])), Fe = (e, t) => {
|
|
154
|
+
if (e == null) return `repeat(auto-fill, minmax(min(${t}px, 100%), 1fr))`;
|
|
155
|
+
let n = (e) => `repeat(${Math.max(1, e)}, minmax(0, 1fr))`;
|
|
156
|
+
return typeof e == "number" ? n(e) : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, n(Number(t))]));
|
|
157
|
+
}, Ie = (e) => e == null ? [] : Array.isArray(e) ? e : [e], Le = (e, t, n, r = {}) => {
|
|
158
|
+
let i = n > 0, a = je(e, t.color), o = T(t), s = O(t), c = {
|
|
159
|
+
...Ne,
|
|
160
|
+
...r,
|
|
161
|
+
...t.texts || {}
|
|
162
|
+
}, l = t.styles || {}, u = {
|
|
163
|
+
label: o,
|
|
164
|
+
labelLower: o.toLowerCase(),
|
|
165
|
+
plural: s,
|
|
166
|
+
pluralLower: s.toLowerCase(),
|
|
167
|
+
max: t.max
|
|
168
|
+
};
|
|
169
|
+
return {
|
|
170
|
+
config: t,
|
|
171
|
+
depth: n,
|
|
172
|
+
nested: i,
|
|
173
|
+
accent: a,
|
|
174
|
+
ink: Me(e, a),
|
|
175
|
+
icon: t.icon || (i ? "label" : "folder_open"),
|
|
176
|
+
itemLabel: o,
|
|
177
|
+
plural: s,
|
|
178
|
+
texts: c,
|
|
179
|
+
layout: t.layout || (i ? "table" : "cards"),
|
|
180
|
+
variant: t.variant || "outlined",
|
|
181
|
+
addButton: {
|
|
182
|
+
position: "header",
|
|
183
|
+
variant: i ? "outlined" : "contained",
|
|
184
|
+
icon: "add",
|
|
185
|
+
...t.addButton || {}
|
|
186
|
+
},
|
|
187
|
+
actions: {
|
|
188
|
+
edit: !0,
|
|
189
|
+
delete: !0,
|
|
190
|
+
duplicate: !1,
|
|
191
|
+
move: !1,
|
|
192
|
+
collapse: !1,
|
|
193
|
+
...t.actions || {}
|
|
194
|
+
},
|
|
195
|
+
t: (e, t = {}) => Pe(String(c[e] ?? ""), {
|
|
196
|
+
...u,
|
|
197
|
+
...t
|
|
198
|
+
}),
|
|
199
|
+
sx: (e, t) => [...Ie(t), ...Ie(l[e])],
|
|
200
|
+
merged: (e, t = {}) => (0, Ae.default)({}, t, l[e] || {})
|
|
201
|
+
};
|
|
202
|
+
}, $ = "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
203
|
+
function Re({ ui: e, n: t }) {
|
|
204
|
+
let n = J();
|
|
205
|
+
return /* @__PURE__ */ Y(L, {
|
|
206
|
+
component: "span",
|
|
207
|
+
sx: e.sx("headerCount", {
|
|
208
|
+
minWidth: 22,
|
|
209
|
+
height: 20,
|
|
210
|
+
px: .75,
|
|
211
|
+
borderRadius: "999px",
|
|
212
|
+
display: "inline-grid",
|
|
213
|
+
placeItems: "center",
|
|
214
|
+
fontSize: 11.5,
|
|
215
|
+
fontWeight: 700,
|
|
216
|
+
bgcolor: t > 0 ? q(e.accent.main, .12) : q(n.palette.text.primary, .07),
|
|
217
|
+
color: t > 0 ? e.ink : "text.secondary",
|
|
218
|
+
border: `1px solid ${t > 0 ? q(e.accent.main, .2) : "transparent"}`
|
|
219
|
+
}),
|
|
220
|
+
children: t
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
var ze = (e) => e.split(/\s+/).map((e) => e.match(/[A-Za-z0-9]/)?.[0] || "").filter(Boolean).slice(0, 2).join("").toUpperCase() || "#";
|
|
224
|
+
function Be({ ui: e, mode: t, title: n, index: r }) {
|
|
225
|
+
return t === "none" ? null : /* @__PURE__ */ Y(L, {
|
|
226
|
+
sx: e.sx("avatar", {
|
|
227
|
+
width: 40,
|
|
228
|
+
height: 40,
|
|
229
|
+
flexShrink: 0,
|
|
230
|
+
borderRadius: "10px",
|
|
231
|
+
display: "grid",
|
|
232
|
+
placeItems: "center",
|
|
233
|
+
fontWeight: 600,
|
|
234
|
+
fontSize: 14,
|
|
235
|
+
bgcolor: q(e.accent.main, .1),
|
|
236
|
+
color: e.ink,
|
|
237
|
+
"& .MuiIcon-root": { fontSize: 20 }
|
|
238
|
+
}),
|
|
239
|
+
children: t === "initials" ? ze(n) : t === "index" ? r + 1 : /* @__PURE__ */ Y(B, { children: e.icon })
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
function Ve({ ui: e, text: t, color: n }) {
|
|
243
|
+
let r = J(), i = n === "default" ? null : je(r, n);
|
|
244
|
+
return /* @__PURE__ */ Y(L, {
|
|
245
|
+
component: "span",
|
|
246
|
+
sx: e.sx("badge", {
|
|
247
|
+
display: "inline-flex",
|
|
248
|
+
alignItems: "center",
|
|
249
|
+
gap: .5,
|
|
250
|
+
px: 1.25,
|
|
251
|
+
py: .3,
|
|
252
|
+
borderRadius: "999px",
|
|
253
|
+
fontSize: 11.5,
|
|
254
|
+
fontWeight: 700,
|
|
255
|
+
lineHeight: 1.6,
|
|
256
|
+
whiteSpace: "nowrap",
|
|
257
|
+
letterSpacing: "0.02em",
|
|
258
|
+
bgcolor: i ? q(i.main, .1) : q(r.palette.text.primary, .06),
|
|
259
|
+
color: i ? Me(r, i) : "text.secondary",
|
|
260
|
+
border: `1px solid ${i ? q(i.main, .25) : q(r.palette.text.primary, .12)}`,
|
|
261
|
+
"&::before": {
|
|
262
|
+
content: "\"\"",
|
|
263
|
+
width: 6,
|
|
264
|
+
height: 6,
|
|
265
|
+
borderRadius: "50%",
|
|
266
|
+
bgcolor: i ? i.main : "text.disabled",
|
|
267
|
+
flexShrink: 0
|
|
268
|
+
}
|
|
269
|
+
}),
|
|
270
|
+
children: t
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
function He({ ui: e, placement: t, empty: n, disabled: r, onClick: i }) {
|
|
274
|
+
let { variant: a, icon: o, size: s, fullWidth: c } = e.addButton, l = t === "footer" && !n ? e.t("addMore") : e.t("add"), u = e.config.max != null && r, d = !!c || a === "dashed" && c !== !1, f = (t) => /* @__PURE__ */ Y(W, {
|
|
275
|
+
title: u ? e.t("maxReached") : "",
|
|
276
|
+
children: /* @__PURE__ */ Y(L, {
|
|
277
|
+
component: "span",
|
|
278
|
+
sx: {
|
|
279
|
+
display: d ? "block" : "inline-flex",
|
|
280
|
+
flexShrink: 0
|
|
281
|
+
},
|
|
282
|
+
children: t
|
|
283
|
+
})
|
|
284
|
+
});
|
|
285
|
+
if (a === "dashed") return f(/* @__PURE__ */ X(z, {
|
|
286
|
+
onClick: i,
|
|
287
|
+
disabled: r,
|
|
288
|
+
sx: e.sx("addButton", {
|
|
289
|
+
width: d ? "100%" : "auto",
|
|
290
|
+
display: "flex",
|
|
291
|
+
alignItems: "center",
|
|
292
|
+
justifyContent: "center",
|
|
293
|
+
gap: .75,
|
|
294
|
+
py: 1.1,
|
|
295
|
+
px: 2,
|
|
296
|
+
borderRadius: "8px",
|
|
297
|
+
border: `1px dashed ${q(e.accent.main, .5)}`,
|
|
298
|
+
color: e.ink,
|
|
299
|
+
fontFamily: "inherit",
|
|
300
|
+
fontSize: 14,
|
|
301
|
+
fontWeight: 600,
|
|
302
|
+
transition: `background-color .15s ${$}`,
|
|
303
|
+
"&:hover": { bgcolor: q(e.accent.main, .06) },
|
|
304
|
+
"&.Mui-focusVisible": {
|
|
305
|
+
outline: `2px solid ${q(e.accent.main, .5)}`,
|
|
306
|
+
outlineOffset: 2
|
|
307
|
+
},
|
|
308
|
+
"&.Mui-disabled": { opacity: .5 },
|
|
309
|
+
"& .MuiIcon-root": { fontSize: 19 }
|
|
310
|
+
}),
|
|
311
|
+
children: [/* @__PURE__ */ Y(B, { children: o }), l]
|
|
312
|
+
}));
|
|
313
|
+
let p = {
|
|
314
|
+
contained: {
|
|
315
|
+
bgcolor: e.accent.main,
|
|
316
|
+
color: e.accent.contrastText,
|
|
317
|
+
"&:hover": { bgcolor: e.accent.dark }
|
|
318
|
+
},
|
|
319
|
+
outlined: {
|
|
320
|
+
color: e.ink,
|
|
321
|
+
borderColor: q(e.accent.main, .5),
|
|
322
|
+
"&:hover": {
|
|
323
|
+
borderColor: e.accent.main,
|
|
324
|
+
bgcolor: q(e.accent.main, .05)
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
text: {
|
|
328
|
+
color: e.ink,
|
|
329
|
+
"&:hover": { bgcolor: q(e.accent.main, .07) }
|
|
330
|
+
},
|
|
331
|
+
soft: {
|
|
332
|
+
color: e.ink,
|
|
333
|
+
bgcolor: q(e.accent.main, .1),
|
|
334
|
+
"&:hover": { bgcolor: q(e.accent.main, .16) }
|
|
335
|
+
}
|
|
336
|
+
}[a] || {};
|
|
337
|
+
return f(/* @__PURE__ */ Y(R, {
|
|
338
|
+
onClick: i,
|
|
339
|
+
disabled: r,
|
|
340
|
+
variant: a === "soft" ? "text" : a,
|
|
341
|
+
color: "inherit",
|
|
342
|
+
size: s || (e.nested ? "small" : "medium"),
|
|
343
|
+
fullWidth: c,
|
|
344
|
+
disableElevation: !0,
|
|
345
|
+
startIcon: /* @__PURE__ */ Y(B, { children: o }),
|
|
346
|
+
sx: e.sx("addButton", {
|
|
347
|
+
textTransform: "none",
|
|
348
|
+
fontWeight: 600,
|
|
349
|
+
borderRadius: "8px",
|
|
350
|
+
px: e.nested ? 1.5 : 2,
|
|
351
|
+
whiteSpace: "nowrap",
|
|
352
|
+
...p
|
|
353
|
+
}),
|
|
354
|
+
children: l
|
|
355
|
+
}));
|
|
356
|
+
}
|
|
357
|
+
var Ue = (e) => /^[aeiou]/i.test(e) ? "an" : "a", We = (e) => e.length <= 1 ? e.join("") : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`, Ge = (e) => {
|
|
358
|
+
if (e.nested) return "";
|
|
359
|
+
let t = e.itemLabel.toLowerCase(), n = (e.config.collections || []).map((e) => N(T(e)).toLowerCase());
|
|
360
|
+
return n.length ? `Add ${Ue(t)} ${t}, then add its ${We(n)}.` : `Add your first ${t} to get started.`;
|
|
361
|
+
};
|
|
362
|
+
function Ke({ ui: e, readOnly: t, error: n }) {
|
|
363
|
+
let r = J(), i = e.texts.emptyText == null ? Ge(e) : e.t("emptyText");
|
|
364
|
+
return e.nested ? /* @__PURE__ */ Y(G, {
|
|
365
|
+
sx: e.sx("empty", {
|
|
366
|
+
fontSize: 13,
|
|
367
|
+
color: "text.disabled",
|
|
368
|
+
fontStyle: "italic",
|
|
369
|
+
py: .75,
|
|
370
|
+
px: 0,
|
|
371
|
+
display: "block"
|
|
372
|
+
}),
|
|
373
|
+
children: e.t("emptyTitle")
|
|
374
|
+
}) : /* @__PURE__ */ X(L, {
|
|
375
|
+
sx: e.sx("empty", {
|
|
376
|
+
py: 5,
|
|
377
|
+
px: 3,
|
|
378
|
+
textAlign: "center",
|
|
379
|
+
borderRadius: "10px",
|
|
380
|
+
border: `1.5px dashed ${n ? r.palette.error.main : q(r.palette.text.primary, .15)}`,
|
|
381
|
+
bgcolor: n ? q(r.palette.error.main, .03) : q(r.palette.text.primary, .02)
|
|
382
|
+
}),
|
|
383
|
+
children: [
|
|
384
|
+
/* @__PURE__ */ Y(L, {
|
|
385
|
+
sx: {
|
|
386
|
+
width: 48,
|
|
387
|
+
height: 48,
|
|
388
|
+
borderRadius: "50%",
|
|
389
|
+
bgcolor: q(e.accent.main, .1),
|
|
390
|
+
display: "flex",
|
|
391
|
+
alignItems: "center",
|
|
392
|
+
justifyContent: "center",
|
|
393
|
+
mx: "auto",
|
|
394
|
+
mb: 1.5
|
|
395
|
+
},
|
|
396
|
+
children: /* @__PURE__ */ Y(B, {
|
|
397
|
+
sx: {
|
|
398
|
+
color: e.ink,
|
|
399
|
+
fontSize: "22px !important"
|
|
400
|
+
},
|
|
401
|
+
children: e.icon || "inbox"
|
|
402
|
+
})
|
|
403
|
+
}),
|
|
404
|
+
/* @__PURE__ */ Y(G, {
|
|
405
|
+
sx: e.sx("emptyTitle", {
|
|
406
|
+
fontSize: 15,
|
|
407
|
+
fontWeight: 600,
|
|
408
|
+
color: "text.primary"
|
|
409
|
+
}),
|
|
410
|
+
children: e.t("emptyTitle")
|
|
411
|
+
}),
|
|
412
|
+
i && !t && /* @__PURE__ */ Y(G, {
|
|
413
|
+
sx: e.sx("emptyText", {
|
|
414
|
+
fontSize: 13.5,
|
|
415
|
+
color: "text.secondary",
|
|
416
|
+
mt: .5,
|
|
417
|
+
maxWidth: 380,
|
|
418
|
+
mx: "auto"
|
|
419
|
+
}),
|
|
420
|
+
children: i
|
|
421
|
+
})
|
|
422
|
+
]
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
// src/components/controls/Collection/ItemDialog.tsx
|
|
426
|
+
function qe({ ui: e, open: t, mode: n, guid: r, session: i, initial: a, context: o, onClose: s, onSave: c }) {
|
|
427
|
+
let l = J(), u = e.config.dialog || {}, d = K(l.breakpoints.down("sm")), f = u.fullScreen === !0 || u.fullScreen !== !1 && d, p = F(null), [m, h] = I(0), { accent: g } = e, _ = e.t(n === "add" ? "dialogAddTitle" : n === "edit" ? "dialogEditTitle" : "dialogViewTitle"), v = `${r}-dialog-${i}-${m}`, y = e.t("dialogContext"), [b, x] = y.includes("{parent}") ? y.split("{parent}") : [y, null], S = (e) => {
|
|
428
|
+
let t = p.current;
|
|
429
|
+
t && t.validate() && (c({ ...t.getValues() }, e), e && h((e) => e + 1));
|
|
430
|
+
};
|
|
431
|
+
return /* @__PURE__ */ X(ae, {
|
|
432
|
+
open: t,
|
|
433
|
+
onClose: (e, t) => {
|
|
434
|
+
t !== "backdropClick" && s();
|
|
435
|
+
},
|
|
436
|
+
fullScreen: f,
|
|
437
|
+
fullWidth: !0,
|
|
438
|
+
maxWidth: u.maxWidth || "sm",
|
|
439
|
+
"aria-labelledby": `${r}-dialog-title`,
|
|
440
|
+
onKeyDown: (e) => {
|
|
441
|
+
n !== "view" && e.key === "Enter" && (e.metaKey || e.ctrlKey) && (e.preventDefault(), S(!1));
|
|
442
|
+
},
|
|
443
|
+
sx: { "& .MuiDialog-paper": e.merged("dialog", {
|
|
444
|
+
borderRadius: f ? 0 : "12px",
|
|
445
|
+
backgroundImage: "none"
|
|
446
|
+
}) },
|
|
447
|
+
children: [
|
|
448
|
+
/* @__PURE__ */ X(L, {
|
|
449
|
+
sx: e.sx("dialogHeader", {
|
|
450
|
+
display: "flex",
|
|
451
|
+
alignItems: "flex-start",
|
|
452
|
+
gap: 1,
|
|
453
|
+
px: {
|
|
454
|
+
xs: 2,
|
|
455
|
+
sm: 3
|
|
456
|
+
},
|
|
457
|
+
pt: 2.5,
|
|
458
|
+
pb: 2,
|
|
459
|
+
borderBottom: `1px solid ${l.palette.divider}`
|
|
460
|
+
}),
|
|
461
|
+
children: [/* @__PURE__ */ X(L, {
|
|
462
|
+
sx: {
|
|
463
|
+
flex: 1,
|
|
464
|
+
minWidth: 0
|
|
465
|
+
},
|
|
466
|
+
children: [
|
|
467
|
+
/* @__PURE__ */ Y(G, {
|
|
468
|
+
id: `${r}-dialog-title`,
|
|
469
|
+
sx: e.sx("dialogTitle", {
|
|
470
|
+
fontWeight: 600,
|
|
471
|
+
fontSize: 18,
|
|
472
|
+
lineHeight: 1.3
|
|
473
|
+
}),
|
|
474
|
+
children: _
|
|
475
|
+
}),
|
|
476
|
+
o && /* @__PURE__ */ X(G, {
|
|
477
|
+
sx: e.sx("dialogContext", {
|
|
478
|
+
fontSize: 13.5,
|
|
479
|
+
color: "text.secondary",
|
|
480
|
+
mt: .25
|
|
481
|
+
}),
|
|
482
|
+
children: [
|
|
483
|
+
b,
|
|
484
|
+
x !== null && /* @__PURE__ */ Y(L, {
|
|
485
|
+
component: "strong",
|
|
486
|
+
sx: {
|
|
487
|
+
color: "text.primary",
|
|
488
|
+
fontWeight: 600
|
|
489
|
+
},
|
|
490
|
+
children: o
|
|
491
|
+
}),
|
|
492
|
+
x
|
|
493
|
+
]
|
|
494
|
+
}),
|
|
495
|
+
u.description && /* @__PURE__ */ Y(G, {
|
|
496
|
+
sx: e.sx("dialogDescription", {
|
|
497
|
+
fontSize: 13.5,
|
|
498
|
+
color: "text.secondary",
|
|
499
|
+
mt: .25
|
|
500
|
+
}),
|
|
501
|
+
children: u.description
|
|
502
|
+
})
|
|
503
|
+
]
|
|
504
|
+
}), /* @__PURE__ */ Y(V, {
|
|
505
|
+
"aria-label": e.t("closeAria"),
|
|
506
|
+
onClick: s,
|
|
507
|
+
size: "small",
|
|
508
|
+
sx: {
|
|
509
|
+
mt: -.5,
|
|
510
|
+
mr: -1,
|
|
511
|
+
color: "text.secondary"
|
|
512
|
+
},
|
|
513
|
+
children: /* @__PURE__ */ Y(B, { children: "close" })
|
|
514
|
+
})]
|
|
515
|
+
}),
|
|
516
|
+
/* @__PURE__ */ Y(se, {
|
|
517
|
+
sx: e.sx("dialogContent", {
|
|
518
|
+
px: {
|
|
519
|
+
xs: 2,
|
|
520
|
+
sm: 3
|
|
521
|
+
},
|
|
522
|
+
pt: "20px !important",
|
|
523
|
+
pb: 3
|
|
524
|
+
}),
|
|
525
|
+
children: /* @__PURE__ */ Y(M, {
|
|
526
|
+
guid: v,
|
|
527
|
+
data: e.config.fields || [],
|
|
528
|
+
patch: n === "add" ? {} : a || {},
|
|
529
|
+
apiRef: p,
|
|
530
|
+
readOnly: n === "view",
|
|
531
|
+
MuiGridAttributes: { spacing: u.spacing ?? 2 }
|
|
532
|
+
}, v)
|
|
533
|
+
}),
|
|
534
|
+
/* @__PURE__ */ Y(oe, {
|
|
535
|
+
sx: e.sx("dialogActions", {
|
|
536
|
+
px: {
|
|
537
|
+
xs: 2,
|
|
538
|
+
sm: 3
|
|
539
|
+
},
|
|
540
|
+
py: 1.5,
|
|
541
|
+
gap: 1,
|
|
542
|
+
flexWrap: "wrap",
|
|
543
|
+
borderTop: `1px solid ${l.palette.divider}`,
|
|
544
|
+
"& .MuiButton-root": {
|
|
545
|
+
textTransform: "none",
|
|
546
|
+
fontWeight: 600,
|
|
547
|
+
borderRadius: "8px",
|
|
548
|
+
px: 2,
|
|
549
|
+
whiteSpace: "nowrap",
|
|
550
|
+
ml: "0 !important"
|
|
551
|
+
}
|
|
552
|
+
}),
|
|
553
|
+
children: n === "view" ? /* @__PURE__ */ Y(R, {
|
|
554
|
+
variant: "contained",
|
|
555
|
+
disableElevation: !0,
|
|
556
|
+
onClick: s,
|
|
557
|
+
sx: e.sx("dialogSave", {
|
|
558
|
+
bgcolor: g.main,
|
|
559
|
+
color: g.contrastText,
|
|
560
|
+
"&:hover": { bgcolor: g.dark }
|
|
561
|
+
}),
|
|
562
|
+
children: e.t("close")
|
|
563
|
+
}) : /* @__PURE__ */ X(he, { children: [
|
|
564
|
+
/* @__PURE__ */ Y(R, {
|
|
565
|
+
onClick: s,
|
|
566
|
+
color: "inherit",
|
|
567
|
+
sx: e.sx("dialogCancel", { color: "text.secondary" }),
|
|
568
|
+
children: e.t("cancel")
|
|
569
|
+
}),
|
|
570
|
+
n === "add" && u.addAnother !== !1 && /* @__PURE__ */ Y(R, {
|
|
571
|
+
variant: "outlined",
|
|
572
|
+
color: "inherit",
|
|
573
|
+
onClick: () => S(!0),
|
|
574
|
+
sx: e.sx("dialogSaveAnother", {
|
|
575
|
+
color: e.ink,
|
|
576
|
+
borderColor: q(g.main, .5),
|
|
577
|
+
"&:hover": {
|
|
578
|
+
borderColor: g.main,
|
|
579
|
+
bgcolor: q(g.main, .06)
|
|
580
|
+
}
|
|
581
|
+
}),
|
|
582
|
+
children: e.t("saveAndAddAnother")
|
|
583
|
+
}),
|
|
584
|
+
/* @__PURE__ */ Y(W, {
|
|
585
|
+
title: e.t("shortcut"),
|
|
586
|
+
placement: "top",
|
|
587
|
+
describeChild: !0,
|
|
588
|
+
children: /* @__PURE__ */ Y(R, {
|
|
589
|
+
variant: "contained",
|
|
590
|
+
color: "inherit",
|
|
591
|
+
disableElevation: !0,
|
|
592
|
+
startIcon: /* @__PURE__ */ Y(B, { children: n === "add" ? "add" : "check" }),
|
|
593
|
+
onClick: () => S(!1),
|
|
594
|
+
sx: e.sx("dialogSave", {
|
|
595
|
+
bgcolor: g.main,
|
|
596
|
+
color: g.contrastText,
|
|
597
|
+
"&:hover": { bgcolor: g.dark }
|
|
598
|
+
}),
|
|
599
|
+
children: n === "add" ? e.t("save") : e.t("saveChanges")
|
|
600
|
+
})
|
|
601
|
+
})
|
|
602
|
+
] })
|
|
603
|
+
})
|
|
604
|
+
]
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
// src/components/controls/Collection/CollectionList.tsx
|
|
608
|
+
function Je({ ui: e, count: t, required: n, action: r, alone: i = !1 }) {
|
|
609
|
+
let { nested: a } = e;
|
|
610
|
+
return /* @__PURE__ */ X(L, {
|
|
611
|
+
sx: e.sx("header", {
|
|
612
|
+
display: "flex",
|
|
613
|
+
alignItems: "center",
|
|
614
|
+
gap: 1.5,
|
|
615
|
+
mb: i ? 0 : a ? 1.25 : 2.5,
|
|
616
|
+
flexWrap: "wrap"
|
|
617
|
+
}),
|
|
618
|
+
children: [/* @__PURE__ */ X(L, {
|
|
619
|
+
sx: {
|
|
620
|
+
flex: 1,
|
|
621
|
+
minWidth: a ? 140 : {
|
|
622
|
+
xs: "100%",
|
|
623
|
+
sm: 220
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
children: [/* @__PURE__ */ X(L, {
|
|
627
|
+
sx: {
|
|
628
|
+
display: "flex",
|
|
629
|
+
alignItems: "center",
|
|
630
|
+
gap: a ? .75 : 1
|
|
631
|
+
},
|
|
632
|
+
children: [
|
|
633
|
+
e.config.icon && /* @__PURE__ */ Y(L, {
|
|
634
|
+
sx: {
|
|
635
|
+
width: a ? 26 : 32,
|
|
636
|
+
height: a ? 26 : 32,
|
|
637
|
+
borderRadius: a ? "6px" : "8px",
|
|
638
|
+
bgcolor: q(e.accent.main, .12),
|
|
639
|
+
display: "flex",
|
|
640
|
+
alignItems: "center",
|
|
641
|
+
justifyContent: "center",
|
|
642
|
+
flexShrink: 0
|
|
643
|
+
},
|
|
644
|
+
children: /* @__PURE__ */ Y(B, {
|
|
645
|
+
sx: e.sx("headerIcon", {
|
|
646
|
+
color: e.ink,
|
|
647
|
+
fontSize: `${a ? 14 : 18}px !important`
|
|
648
|
+
}),
|
|
649
|
+
children: e.icon
|
|
650
|
+
})
|
|
651
|
+
}),
|
|
652
|
+
/* @__PURE__ */ X(G, {
|
|
653
|
+
sx: e.sx("headerTitle", {
|
|
654
|
+
fontWeight: 700,
|
|
655
|
+
fontSize: a ? 14 : 19,
|
|
656
|
+
lineHeight: 1.3,
|
|
657
|
+
color: "text.primary"
|
|
658
|
+
}),
|
|
659
|
+
children: [e.plural, n && /* @__PURE__ */ Y(L, {
|
|
660
|
+
component: "span",
|
|
661
|
+
sx: {
|
|
662
|
+
color: "error.main",
|
|
663
|
+
ml: .25
|
|
664
|
+
},
|
|
665
|
+
children: "*"
|
|
666
|
+
})]
|
|
667
|
+
}),
|
|
668
|
+
/* @__PURE__ */ Y(Re, {
|
|
669
|
+
ui: e,
|
|
670
|
+
n: t
|
|
671
|
+
})
|
|
672
|
+
]
|
|
673
|
+
}), e.config.description && /* @__PURE__ */ Y(G, {
|
|
674
|
+
sx: e.sx("headerDescription", {
|
|
675
|
+
fontSize: 13.5,
|
|
676
|
+
color: "text.secondary",
|
|
677
|
+
mt: .5,
|
|
678
|
+
ml: a ? 0 : e.config.icon ? "44px" : 0
|
|
679
|
+
}),
|
|
680
|
+
children: e.config.description
|
|
681
|
+
})]
|
|
682
|
+
}), r]
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
function Ye({ ui: e, title: t, canEdit: n, onOpen: r, size: i }) {
|
|
686
|
+
return /* @__PURE__ */ Y(z, {
|
|
687
|
+
onClick: r,
|
|
688
|
+
"aria-label": n ? void 0 : e.t("viewAria", { title: t }),
|
|
689
|
+
"aria-haspopup": "dialog",
|
|
690
|
+
sx: e.sx("itemTitle", {
|
|
691
|
+
borderRadius: "4px",
|
|
692
|
+
textAlign: "left",
|
|
693
|
+
justifyContent: "flex-start",
|
|
694
|
+
fontFamily: "inherit",
|
|
695
|
+
fontWeight: 600,
|
|
696
|
+
fontSize: i,
|
|
697
|
+
lineHeight: 1.4,
|
|
698
|
+
color: "text.primary",
|
|
699
|
+
wordBreak: "break-word",
|
|
700
|
+
"&:hover": {
|
|
701
|
+
color: e.ink,
|
|
702
|
+
textDecoration: "underline"
|
|
703
|
+
},
|
|
704
|
+
"&.Mui-focusVisible": {
|
|
705
|
+
outline: `2px solid ${q(e.accent.main, .5)}`,
|
|
706
|
+
outlineOffset: 2
|
|
707
|
+
}
|
|
708
|
+
}),
|
|
709
|
+
children: t
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
function Xe({ ui: e, data: t }) {
|
|
713
|
+
let n = e.config.display || {}, r = typeof n.badge == "string" ? { field: n.badge } : n.badge;
|
|
714
|
+
if (!r) return null;
|
|
715
|
+
let i = t[r.field], a = D(P(e.config.fields || [], r.field), i);
|
|
716
|
+
if (!a) return null;
|
|
717
|
+
let o = r.colors?.[String(i)] ?? r.colors?.[a] ?? "default";
|
|
718
|
+
return /* @__PURE__ */ Y(Ve, {
|
|
719
|
+
ui: e,
|
|
720
|
+
text: a,
|
|
721
|
+
color: o
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
function Ze({ ui: e, title: t, readOnly: n, open: r, canToggle: i, onEdit: a, onDelete: o, onMenu: s, onToggle: c }) {
|
|
725
|
+
let l = J(), u = !n && e.actions.edit, d = !n && e.actions.delete, f = !n && (e.actions.duplicate || e.actions.move), p = (e, t) => ({
|
|
726
|
+
width: 30,
|
|
727
|
+
height: 30,
|
|
728
|
+
borderRadius: "8px",
|
|
729
|
+
color: e,
|
|
730
|
+
transition: `background-color .15s ${$}, color .15s ${$}`,
|
|
731
|
+
"&:hover": { bgcolor: t }
|
|
732
|
+
});
|
|
733
|
+
return /* @__PURE__ */ X(L, {
|
|
734
|
+
sx: e.sx("actions", {
|
|
735
|
+
display: "flex",
|
|
736
|
+
alignItems: "center",
|
|
737
|
+
gap: .25,
|
|
738
|
+
flexShrink: 0
|
|
739
|
+
}),
|
|
740
|
+
children: [
|
|
741
|
+
u && /* @__PURE__ */ Y(W, {
|
|
742
|
+
title: e.t("edit"),
|
|
743
|
+
children: /* @__PURE__ */ Y(V, {
|
|
744
|
+
size: "small",
|
|
745
|
+
"aria-label": e.t("editAria", { title: t }),
|
|
746
|
+
onClick: a,
|
|
747
|
+
sx: e.sx("actionButton", p(e.ink, q(e.accent.main, .1))),
|
|
748
|
+
children: /* @__PURE__ */ Y(B, {
|
|
749
|
+
sx: { fontSize: "17px !important" },
|
|
750
|
+
children: "edit"
|
|
751
|
+
})
|
|
752
|
+
})
|
|
753
|
+
}),
|
|
754
|
+
d && /* @__PURE__ */ Y(W, {
|
|
755
|
+
title: e.t("delete"),
|
|
756
|
+
children: /* @__PURE__ */ Y(V, {
|
|
757
|
+
size: "small",
|
|
758
|
+
"aria-label": e.t("deleteAria", { title: t }),
|
|
759
|
+
onClick: o,
|
|
760
|
+
sx: e.sx("actionButton", p(l.palette.error.main, q(l.palette.error.main, .08))),
|
|
761
|
+
children: /* @__PURE__ */ Y(B, {
|
|
762
|
+
sx: { fontSize: "17px !important" },
|
|
763
|
+
children: "delete_outline"
|
|
764
|
+
})
|
|
765
|
+
})
|
|
766
|
+
}),
|
|
767
|
+
f && /* @__PURE__ */ Y(W, {
|
|
768
|
+
title: e.t("more"),
|
|
769
|
+
children: /* @__PURE__ */ Y(V, {
|
|
770
|
+
size: "small",
|
|
771
|
+
"aria-label": e.t("moreAria", { title: t }),
|
|
772
|
+
onClick: (e) => s(e.currentTarget),
|
|
773
|
+
sx: e.sx("actionButton", p(l.palette.text.secondary, q(l.palette.text.primary, .07))),
|
|
774
|
+
children: /* @__PURE__ */ Y(B, {
|
|
775
|
+
sx: { fontSize: "17px !important" },
|
|
776
|
+
children: "more_vert"
|
|
777
|
+
})
|
|
778
|
+
})
|
|
779
|
+
}),
|
|
780
|
+
i && /* @__PURE__ */ Y(W, {
|
|
781
|
+
title: r ? e.t("collapse") : e.t("expand"),
|
|
782
|
+
children: /* @__PURE__ */ Y(V, {
|
|
783
|
+
size: "small",
|
|
784
|
+
"aria-label": e.t(r ? "collapseAria" : "expandAria", { title: t }),
|
|
785
|
+
"aria-expanded": r,
|
|
786
|
+
onClick: c,
|
|
787
|
+
sx: e.sx("actionButton", p(l.palette.text.secondary, q(l.palette.text.primary, .07))),
|
|
788
|
+
children: /* @__PURE__ */ Y(B, {
|
|
789
|
+
sx: {
|
|
790
|
+
fontSize: "19px !important",
|
|
791
|
+
transition: "transform .2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
792
|
+
transform: r ? "rotate(180deg)" : "none"
|
|
793
|
+
},
|
|
794
|
+
children: "expand_more"
|
|
795
|
+
})
|
|
796
|
+
})
|
|
797
|
+
})
|
|
798
|
+
]
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
function Qe({ ui: e, node: t, guid: n, readOnly: r, issues: i, showErrors: a, texts: o, parentTitle: s, onChildChange: c }) {
|
|
802
|
+
let l = J(), u = e.config.collections || [];
|
|
803
|
+
return /* @__PURE__ */ Y(L, {
|
|
804
|
+
sx: e.sx("sections", {
|
|
805
|
+
display: "grid",
|
|
806
|
+
gridTemplateColumns: Fe(e.config.sectionColumns ?? 1, 320)
|
|
807
|
+
}),
|
|
808
|
+
children: u.map((u, d) => /* @__PURE__ */ Y(L, {
|
|
809
|
+
sx: e.sx("section", {
|
|
810
|
+
borderTop: `1px solid ${l.palette.divider}`,
|
|
811
|
+
bgcolor: l.palette.mode === "dark" ? q(l.palette.common.white, .02) : q(l.palette.grey[500], .03),
|
|
812
|
+
minWidth: 0,
|
|
813
|
+
...d > 0 ? { borderLeft: `1px solid ${l.palette.divider}` } : {}
|
|
814
|
+
}),
|
|
815
|
+
children: /* @__PURE__ */ Y(L, {
|
|
816
|
+
sx: {
|
|
817
|
+
px: {
|
|
818
|
+
xs: 2,
|
|
819
|
+
sm: 2.5
|
|
820
|
+
},
|
|
821
|
+
pt: {
|
|
822
|
+
xs: 1.5,
|
|
823
|
+
sm: 1.75
|
|
824
|
+
},
|
|
825
|
+
pb: {
|
|
826
|
+
xs: 1.25,
|
|
827
|
+
sm: 1.5
|
|
828
|
+
}
|
|
829
|
+
},
|
|
830
|
+
children: /* @__PURE__ */ Y(tt, {
|
|
831
|
+
config: u,
|
|
832
|
+
nodes: t.children[u.id] || [],
|
|
833
|
+
onChange: (e) => c(u.id, e),
|
|
834
|
+
guid: `${n}-${t.key}`,
|
|
835
|
+
depth: e.depth + 1,
|
|
836
|
+
readOnly: r,
|
|
837
|
+
issues: i.filter((e) => e.path[0] === u.id).map((e) => ({
|
|
838
|
+
...e,
|
|
839
|
+
path: e.path.slice(1)
|
|
840
|
+
})),
|
|
841
|
+
showErrors: a,
|
|
842
|
+
parentTitle: s,
|
|
843
|
+
texts: o
|
|
844
|
+
})
|
|
845
|
+
})
|
|
846
|
+
}, u.id))
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
function $e({ ui: e, node: t, index: n, guid: r, readOnly: i, collapsed: a, issues: o, showErrors: s, texts: c, onOpen: l, onDelete: u, onMenu: d, onToggle: f, onChildChange: p }) {
|
|
850
|
+
let m = J(), { config: h } = e, g = h.display || {}, { title: _, subtitle: v, details: y } = ee(t.data, h, n), b = h.collections || [], x = b.length > 0, S = s && o.length > 0, C = g.avatar || "none", w = !i && e.actions.edit, E = !i && e.actions.delete, D = !i && (e.actions.duplicate || e.actions.move), O = y.length > 0 || x, k = !a, A = q(S ? m.palette.error.main : e.accent.main, .05), j = S ? q(m.palette.error.main, .2) : q(e.accent.main, .15), M = (e, t) => ({
|
|
851
|
+
width: 30,
|
|
852
|
+
height: 30,
|
|
853
|
+
borderRadius: "8px",
|
|
854
|
+
color: e,
|
|
855
|
+
transition: `background-color .15s ${$}`,
|
|
856
|
+
"&:hover": { bgcolor: t }
|
|
857
|
+
});
|
|
858
|
+
return /* @__PURE__ */ X(L, {
|
|
859
|
+
sx: e.sx("item", {
|
|
860
|
+
border: `1px solid ${S ? m.palette.error.main : m.palette.divider}`,
|
|
861
|
+
borderRadius: "14px",
|
|
862
|
+
overflow: "hidden",
|
|
863
|
+
bgcolor: "background.paper",
|
|
864
|
+
boxShadow: `0 1px 3px ${q(m.palette.common.black, .06)}, 0 4px 12px ${q(m.palette.common.black, .04)}`
|
|
865
|
+
}),
|
|
866
|
+
children: [/* @__PURE__ */ X(L, {
|
|
867
|
+
sx: e.sx("itemHeader", {
|
|
868
|
+
px: {
|
|
869
|
+
xs: 2,
|
|
870
|
+
sm: 2.5
|
|
871
|
+
},
|
|
872
|
+
pt: {
|
|
873
|
+
xs: 1.75,
|
|
874
|
+
sm: 2
|
|
875
|
+
},
|
|
876
|
+
pb: {
|
|
877
|
+
xs: 1.5,
|
|
878
|
+
sm: 1.75
|
|
879
|
+
},
|
|
880
|
+
bgcolor: A,
|
|
881
|
+
borderBottom: k && O ? `1px solid ${j}` : "1px solid transparent",
|
|
882
|
+
transition: `border-color .2s ${$}`,
|
|
883
|
+
display: "flex",
|
|
884
|
+
alignItems: "flex-start",
|
|
885
|
+
gap: 1.5
|
|
886
|
+
}),
|
|
887
|
+
children: [
|
|
888
|
+
C !== "none" && /* @__PURE__ */ Y(Be, {
|
|
889
|
+
ui: e,
|
|
890
|
+
mode: C,
|
|
891
|
+
title: _,
|
|
892
|
+
index: n
|
|
893
|
+
}),
|
|
894
|
+
/* @__PURE__ */ X(L, {
|
|
895
|
+
sx: {
|
|
896
|
+
flex: 1,
|
|
897
|
+
minWidth: 0
|
|
898
|
+
},
|
|
899
|
+
children: [
|
|
900
|
+
/* @__PURE__ */ X(L, {
|
|
901
|
+
sx: {
|
|
902
|
+
display: "flex",
|
|
903
|
+
alignItems: "center",
|
|
904
|
+
flexWrap: "wrap",
|
|
905
|
+
gap: .75,
|
|
906
|
+
mb: v ? .25 : 0
|
|
907
|
+
},
|
|
908
|
+
children: [/* @__PURE__ */ Y(Ye, {
|
|
909
|
+
ui: e,
|
|
910
|
+
title: _,
|
|
911
|
+
canEdit: w,
|
|
912
|
+
onOpen: l,
|
|
913
|
+
size: 15.5
|
|
914
|
+
}), /* @__PURE__ */ Y(Xe, {
|
|
915
|
+
ui: e,
|
|
916
|
+
data: t.data
|
|
917
|
+
})]
|
|
918
|
+
}),
|
|
919
|
+
v && /* @__PURE__ */ X(G, {
|
|
920
|
+
sx: e.sx("subtitle", {
|
|
921
|
+
display: "flex",
|
|
922
|
+
alignItems: "center",
|
|
923
|
+
gap: .4,
|
|
924
|
+
fontSize: 13,
|
|
925
|
+
color: "text.secondary",
|
|
926
|
+
wordBreak: "break-word",
|
|
927
|
+
"& .MuiIcon-root": {
|
|
928
|
+
fontSize: 14,
|
|
929
|
+
color: "text.disabled"
|
|
930
|
+
}
|
|
931
|
+
}),
|
|
932
|
+
children: [g.subtitleIcon && /* @__PURE__ */ Y(B, { children: g.subtitleIcon }), v]
|
|
933
|
+
}),
|
|
934
|
+
!k && x && /* @__PURE__ */ Y(L, {
|
|
935
|
+
sx: {
|
|
936
|
+
display: "flex",
|
|
937
|
+
flexWrap: "wrap",
|
|
938
|
+
gap: .75,
|
|
939
|
+
mt: .6
|
|
940
|
+
},
|
|
941
|
+
children: b.map((n) => {
|
|
942
|
+
let r = (t.children[n.id] || []).length;
|
|
943
|
+
return /* @__PURE__ */ X(L, {
|
|
944
|
+
component: "span",
|
|
945
|
+
sx: {
|
|
946
|
+
fontSize: 12,
|
|
947
|
+
fontWeight: 600,
|
|
948
|
+
px: 1,
|
|
949
|
+
py: .2,
|
|
950
|
+
borderRadius: "999px",
|
|
951
|
+
bgcolor: q(e.accent.main, .08),
|
|
952
|
+
color: e.ink,
|
|
953
|
+
border: `1px solid ${q(e.accent.main, .18)}`
|
|
954
|
+
},
|
|
955
|
+
children: [
|
|
956
|
+
r,
|
|
957
|
+
" ",
|
|
958
|
+
N(T(n), r).toLowerCase()
|
|
959
|
+
]
|
|
960
|
+
}, n.id);
|
|
961
|
+
})
|
|
962
|
+
})
|
|
963
|
+
]
|
|
964
|
+
}),
|
|
965
|
+
/* @__PURE__ */ X(L, {
|
|
966
|
+
sx: {
|
|
967
|
+
display: "flex",
|
|
968
|
+
alignItems: "center",
|
|
969
|
+
flexShrink: 0,
|
|
970
|
+
gap: .25,
|
|
971
|
+
mt: -.25
|
|
972
|
+
},
|
|
973
|
+
children: [
|
|
974
|
+
w && /* @__PURE__ */ Y(W, {
|
|
975
|
+
title: e.t("edit"),
|
|
976
|
+
children: /* @__PURE__ */ Y(V, {
|
|
977
|
+
size: "small",
|
|
978
|
+
"aria-label": e.t("editAria", { title: _ }),
|
|
979
|
+
onClick: l,
|
|
980
|
+
sx: M(e.ink, q(e.accent.main, .1)),
|
|
981
|
+
children: /* @__PURE__ */ Y(B, {
|
|
982
|
+
sx: { fontSize: "17px !important" },
|
|
983
|
+
children: "edit"
|
|
984
|
+
})
|
|
985
|
+
})
|
|
986
|
+
}),
|
|
987
|
+
E && /* @__PURE__ */ Y(W, {
|
|
988
|
+
title: e.t("delete"),
|
|
989
|
+
children: /* @__PURE__ */ Y(V, {
|
|
990
|
+
size: "small",
|
|
991
|
+
"aria-label": e.t("deleteAria", { title: _ }),
|
|
992
|
+
onClick: u,
|
|
993
|
+
sx: M(m.palette.error.main, q(m.palette.error.main, .08)),
|
|
994
|
+
children: /* @__PURE__ */ Y(B, {
|
|
995
|
+
sx: { fontSize: "17px !important" },
|
|
996
|
+
children: "delete_outline"
|
|
997
|
+
})
|
|
998
|
+
})
|
|
999
|
+
}),
|
|
1000
|
+
D && /* @__PURE__ */ Y(W, {
|
|
1001
|
+
title: e.t("more"),
|
|
1002
|
+
children: /* @__PURE__ */ Y(V, {
|
|
1003
|
+
size: "small",
|
|
1004
|
+
"aria-label": e.t("moreAria", { title: _ }),
|
|
1005
|
+
onClick: (e) => d(e.currentTarget),
|
|
1006
|
+
sx: M(m.palette.text.secondary, q(m.palette.text.primary, .07)),
|
|
1007
|
+
children: /* @__PURE__ */ Y(B, {
|
|
1008
|
+
sx: { fontSize: "17px !important" },
|
|
1009
|
+
children: "more_vert"
|
|
1010
|
+
})
|
|
1011
|
+
})
|
|
1012
|
+
}),
|
|
1013
|
+
O && /* @__PURE__ */ Y(W, {
|
|
1014
|
+
title: k ? e.t("collapse") : e.t("expand"),
|
|
1015
|
+
children: /* @__PURE__ */ Y(V, {
|
|
1016
|
+
size: "small",
|
|
1017
|
+
"aria-label": e.t(k ? "collapseAria" : "expandAria", { title: _ }),
|
|
1018
|
+
onClick: f,
|
|
1019
|
+
sx: M(m.palette.text.secondary, q(m.palette.text.primary, .07)),
|
|
1020
|
+
children: /* @__PURE__ */ Y(B, {
|
|
1021
|
+
sx: {
|
|
1022
|
+
fontSize: "19px !important",
|
|
1023
|
+
transition: "transform .25s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
1024
|
+
transform: k ? "rotate(180deg)" : "none"
|
|
1025
|
+
},
|
|
1026
|
+
children: "expand_more"
|
|
1027
|
+
})
|
|
1028
|
+
})
|
|
1029
|
+
})
|
|
1030
|
+
]
|
|
1031
|
+
})
|
|
1032
|
+
]
|
|
1033
|
+
}), O && /* @__PURE__ */ X(ie, {
|
|
1034
|
+
in: k,
|
|
1035
|
+
timeout: 220,
|
|
1036
|
+
children: [y.length > 0 && /* @__PURE__ */ Y(L, {
|
|
1037
|
+
sx: e.sx("details", {
|
|
1038
|
+
display: "flex",
|
|
1039
|
+
overflowX: "auto",
|
|
1040
|
+
borderBottom: x ? `1px solid ${m.palette.divider}` : "none",
|
|
1041
|
+
"&::-webkit-scrollbar": { height: 0 }
|
|
1042
|
+
}),
|
|
1043
|
+
children: y.map((t, n) => /* @__PURE__ */ X(L, {
|
|
1044
|
+
sx: e.sx("detail", {
|
|
1045
|
+
flex: "1 1 0",
|
|
1046
|
+
minWidth: 90,
|
|
1047
|
+
maxWidth: 220,
|
|
1048
|
+
px: {
|
|
1049
|
+
xs: 2,
|
|
1050
|
+
sm: 2.5
|
|
1051
|
+
},
|
|
1052
|
+
py: 1.5,
|
|
1053
|
+
borderLeft: n > 0 ? `1px solid ${m.palette.divider}` : "none"
|
|
1054
|
+
}),
|
|
1055
|
+
children: [/* @__PURE__ */ X(G, {
|
|
1056
|
+
sx: e.sx("detailLabel", {
|
|
1057
|
+
fontSize: 10.5,
|
|
1058
|
+
fontWeight: 700,
|
|
1059
|
+
letterSpacing: "0.07em",
|
|
1060
|
+
textTransform: "uppercase",
|
|
1061
|
+
color: "text.disabled",
|
|
1062
|
+
mb: .25,
|
|
1063
|
+
display: "flex",
|
|
1064
|
+
alignItems: "center",
|
|
1065
|
+
gap: .4,
|
|
1066
|
+
whiteSpace: "nowrap"
|
|
1067
|
+
}),
|
|
1068
|
+
children: [t.icon && /* @__PURE__ */ Y(B, {
|
|
1069
|
+
sx: { fontSize: "11px !important" },
|
|
1070
|
+
children: t.icon
|
|
1071
|
+
}), t.label]
|
|
1072
|
+
}), /* @__PURE__ */ Y(G, {
|
|
1073
|
+
sx: e.sx("detailValue", {
|
|
1074
|
+
fontSize: 13.5,
|
|
1075
|
+
fontWeight: 600,
|
|
1076
|
+
color: t.value ? "text.primary" : "text.disabled",
|
|
1077
|
+
wordBreak: "break-word",
|
|
1078
|
+
lineHeight: 1.4
|
|
1079
|
+
}),
|
|
1080
|
+
children: t.value || "—"
|
|
1081
|
+
})]
|
|
1082
|
+
}, t.id))
|
|
1083
|
+
}), x && /* @__PURE__ */ Y(Qe, {
|
|
1084
|
+
ui: e,
|
|
1085
|
+
node: t,
|
|
1086
|
+
guid: r,
|
|
1087
|
+
readOnly: i,
|
|
1088
|
+
issues: o,
|
|
1089
|
+
showErrors: s,
|
|
1090
|
+
texts: c,
|
|
1091
|
+
parentTitle: _,
|
|
1092
|
+
onChildChange: p
|
|
1093
|
+
})]
|
|
1094
|
+
})]
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
function et({ ui: e, nodes: t, guid: n, readOnly: r, issues: i, showErrors: a, texts: o, isCollapsed: s, onToggle: c, onOpen: l, onDelete: u, onMenu: d, onChildChange: f }) {
|
|
1098
|
+
let p = J(), m = K(p.breakpoints.down("sm")), { config: h } = e, g = h.fields || [], _ = h.display || {}, v = te(h), y = typeof _.badge == "string" ? _.badge : _.badge?.field, b = typeof _.badge == "object" && _.badge?.label || (y ? A(P(g, y)) || y : ""), x = (h.collections || []).length > 0, S = !r && e.actions.edit, C = !r && (e.actions.edit || e.actions.delete || e.actions.duplicate || e.actions.move), w = (e) => i.filter((t) => t.path[0] === e).map((e) => ({
|
|
1099
|
+
...e,
|
|
1100
|
+
path: e.path.slice(1)
|
|
1101
|
+
})), T = /* @__PURE__ */ Y(L, {
|
|
1102
|
+
component: "span",
|
|
1103
|
+
sx: { color: "text.disabled" },
|
|
1104
|
+
children: "—"
|
|
1105
|
+
}), E = (t, i, c) => x && /* @__PURE__ */ Y(ie, {
|
|
1106
|
+
in: !s(t.key),
|
|
1107
|
+
timeout: 200,
|
|
1108
|
+
unmountOnExit: !0,
|
|
1109
|
+
children: /* @__PURE__ */ Y(Qe, {
|
|
1110
|
+
ui: e,
|
|
1111
|
+
node: t,
|
|
1112
|
+
guid: n,
|
|
1113
|
+
readOnly: r,
|
|
1114
|
+
issues: w(i),
|
|
1115
|
+
showErrors: a,
|
|
1116
|
+
texts: o,
|
|
1117
|
+
parentTitle: c,
|
|
1118
|
+
onChildChange: (e, t) => f(i, e, t)
|
|
1119
|
+
})
|
|
1120
|
+
}), O = (t, n, i) => /* @__PURE__ */ Y(Ze, {
|
|
1121
|
+
ui: e,
|
|
1122
|
+
title: i,
|
|
1123
|
+
readOnly: r,
|
|
1124
|
+
open: !s(t.key),
|
|
1125
|
+
canToggle: x,
|
|
1126
|
+
onEdit: () => l(n),
|
|
1127
|
+
onDelete: () => u(n),
|
|
1128
|
+
onMenu: (e) => d(e, n),
|
|
1129
|
+
onToggle: () => c(t.key)
|
|
1130
|
+
}), k = q(p.palette.error.main, .06);
|
|
1131
|
+
if (m) return /* @__PURE__ */ Y(L, {
|
|
1132
|
+
sx: e.sx("table", {
|
|
1133
|
+
border: `1px solid ${p.palette.divider}`,
|
|
1134
|
+
borderRadius: "8px",
|
|
1135
|
+
overflow: "hidden",
|
|
1136
|
+
bgcolor: "background.paper"
|
|
1137
|
+
}),
|
|
1138
|
+
children: t.map((t, n) => {
|
|
1139
|
+
let { title: r, details: i } = ee(t.data, h, n), o = a && w(n).length > 0;
|
|
1140
|
+
return /* @__PURE__ */ X(L, {
|
|
1141
|
+
sx: e.sx("mobileRow", {
|
|
1142
|
+
borderTop: n ? `1px solid ${p.palette.divider}` : "none",
|
|
1143
|
+
...o ? { bgcolor: k } : {}
|
|
1144
|
+
}),
|
|
1145
|
+
children: [/* @__PURE__ */ X(L, {
|
|
1146
|
+
sx: {
|
|
1147
|
+
display: "flex",
|
|
1148
|
+
alignItems: "flex-start",
|
|
1149
|
+
gap: 1,
|
|
1150
|
+
p: 1.5
|
|
1151
|
+
},
|
|
1152
|
+
children: [/* @__PURE__ */ X(L, {
|
|
1153
|
+
sx: {
|
|
1154
|
+
flex: 1,
|
|
1155
|
+
minWidth: 0
|
|
1156
|
+
},
|
|
1157
|
+
children: [/* @__PURE__ */ X(L, {
|
|
1158
|
+
sx: {
|
|
1159
|
+
display: "flex",
|
|
1160
|
+
alignItems: "center",
|
|
1161
|
+
flexWrap: "wrap",
|
|
1162
|
+
gap: 1
|
|
1163
|
+
},
|
|
1164
|
+
children: [/* @__PURE__ */ Y(Ye, {
|
|
1165
|
+
ui: e,
|
|
1166
|
+
title: r,
|
|
1167
|
+
canEdit: S,
|
|
1168
|
+
onOpen: () => l(n),
|
|
1169
|
+
size: 14.5
|
|
1170
|
+
}), /* @__PURE__ */ Y(Xe, {
|
|
1171
|
+
ui: e,
|
|
1172
|
+
data: t.data
|
|
1173
|
+
})]
|
|
1174
|
+
}), i.length > 0 && /* @__PURE__ */ Y(L, {
|
|
1175
|
+
sx: {
|
|
1176
|
+
display: "grid",
|
|
1177
|
+
gridTemplateColumns: "auto 1fr",
|
|
1178
|
+
columnGap: 1.5,
|
|
1179
|
+
rowGap: .25,
|
|
1180
|
+
mt: .75
|
|
1181
|
+
},
|
|
1182
|
+
children: i.map((t) => /* @__PURE__ */ X(re, { children: [/* @__PURE__ */ Y(G, {
|
|
1183
|
+
sx: e.sx("detailLabel", {
|
|
1184
|
+
fontSize: 13,
|
|
1185
|
+
color: "text.secondary"
|
|
1186
|
+
}),
|
|
1187
|
+
children: t.label
|
|
1188
|
+
}), /* @__PURE__ */ Y(G, {
|
|
1189
|
+
sx: e.sx("detailValue", {
|
|
1190
|
+
fontSize: 13,
|
|
1191
|
+
fontWeight: 500,
|
|
1192
|
+
wordBreak: "break-word"
|
|
1193
|
+
}),
|
|
1194
|
+
children: t.value
|
|
1195
|
+
})] }, t.id))
|
|
1196
|
+
})]
|
|
1197
|
+
}), (C || x) && O(t, n, r)]
|
|
1198
|
+
}), E(t, n, r)]
|
|
1199
|
+
}, t.key);
|
|
1200
|
+
})
|
|
1201
|
+
});
|
|
1202
|
+
let j = e.sx("tableHeadCell", {
|
|
1203
|
+
fontSize: 12.5,
|
|
1204
|
+
fontWeight: 600,
|
|
1205
|
+
color: "text.secondary",
|
|
1206
|
+
whiteSpace: "nowrap",
|
|
1207
|
+
py: 1,
|
|
1208
|
+
px: 1.75
|
|
1209
|
+
}), M = e.sx("tableCell", {
|
|
1210
|
+
fontSize: 14,
|
|
1211
|
+
color: "text.primary",
|
|
1212
|
+
whiteSpace: "nowrap",
|
|
1213
|
+
py: 1.1,
|
|
1214
|
+
px: 1.75
|
|
1215
|
+
}), N = 1 + v.length + +!!y + (C || x ? 1 : 0);
|
|
1216
|
+
return /* @__PURE__ */ Y(L, {
|
|
1217
|
+
sx: e.sx("table", {
|
|
1218
|
+
border: `1px solid ${p.palette.divider}`,
|
|
1219
|
+
borderRadius: "8px",
|
|
1220
|
+
overflowX: "auto",
|
|
1221
|
+
bgcolor: "background.paper"
|
|
1222
|
+
}),
|
|
1223
|
+
children: /* @__PURE__ */ X(fe, {
|
|
1224
|
+
size: "small",
|
|
1225
|
+
children: [/* @__PURE__ */ Y(me, { children: /* @__PURE__ */ X(U, {
|
|
1226
|
+
sx: e.sx("tableHead", { bgcolor: q(p.palette.text.primary, p.palette.mode === "dark" ? .05 : .03) }),
|
|
1227
|
+
children: [
|
|
1228
|
+
/* @__PURE__ */ Y(H, {
|
|
1229
|
+
sx: j,
|
|
1230
|
+
children: _.titleLabel || e.itemLabel
|
|
1231
|
+
}),
|
|
1232
|
+
v.map((e) => /* @__PURE__ */ Y(H, {
|
|
1233
|
+
sx: j,
|
|
1234
|
+
children: e.label
|
|
1235
|
+
}, e.id)),
|
|
1236
|
+
y && /* @__PURE__ */ Y(H, {
|
|
1237
|
+
sx: j,
|
|
1238
|
+
children: b
|
|
1239
|
+
}),
|
|
1240
|
+
(C || x) && /* @__PURE__ */ Y(H, { sx: j })
|
|
1241
|
+
]
|
|
1242
|
+
}) }), /* @__PURE__ */ Y(pe, { children: t.map((n, r) => {
|
|
1243
|
+
let { title: i, rawTitle: o } = ee(n.data, h, r), c = a && w(r).length > 0, u = r === t.length - 1, d = u && (!x || s(n.key)) ? { "& > td": { borderBottom: 0 } } : {};
|
|
1244
|
+
return /* @__PURE__ */ X(re, { children: [/* @__PURE__ */ X(U, {
|
|
1245
|
+
hover: !0,
|
|
1246
|
+
sx: e.sx("tableRow", {
|
|
1247
|
+
...d,
|
|
1248
|
+
...c ? { bgcolor: k } : {}
|
|
1249
|
+
}),
|
|
1250
|
+
children: [
|
|
1251
|
+
/* @__PURE__ */ Y(H, {
|
|
1252
|
+
sx: M,
|
|
1253
|
+
children: o ? /* @__PURE__ */ Y(Ye, {
|
|
1254
|
+
ui: e,
|
|
1255
|
+
title: o,
|
|
1256
|
+
canEdit: S,
|
|
1257
|
+
onOpen: () => l(r),
|
|
1258
|
+
size: 14
|
|
1259
|
+
}) : /* @__PURE__ */ Y(L, {
|
|
1260
|
+
component: S ? "button" : "span",
|
|
1261
|
+
type: S ? "button" : void 0,
|
|
1262
|
+
onClick: S ? () => l(r) : void 0,
|
|
1263
|
+
"aria-label": S ? e.t("editAria", { title: i }) : void 0,
|
|
1264
|
+
sx: {
|
|
1265
|
+
background: "none",
|
|
1266
|
+
border: 0,
|
|
1267
|
+
p: 0,
|
|
1268
|
+
font: "inherit",
|
|
1269
|
+
color: "text.disabled",
|
|
1270
|
+
cursor: S ? "pointer" : "default"
|
|
1271
|
+
},
|
|
1272
|
+
children: "—"
|
|
1273
|
+
})
|
|
1274
|
+
}),
|
|
1275
|
+
v.map((e) => /* @__PURE__ */ Y(H, {
|
|
1276
|
+
sx: M,
|
|
1277
|
+
children: D(P(g, e.id), n.data[e.id]) || T
|
|
1278
|
+
}, e.id)),
|
|
1279
|
+
y && /* @__PURE__ */ Y(H, {
|
|
1280
|
+
sx: M,
|
|
1281
|
+
children: /* @__PURE__ */ Y(Xe, {
|
|
1282
|
+
ui: e,
|
|
1283
|
+
data: n.data
|
|
1284
|
+
})
|
|
1285
|
+
}),
|
|
1286
|
+
(C || x) && /* @__PURE__ */ Y(H, {
|
|
1287
|
+
align: "right",
|
|
1288
|
+
sx: e.sx("rowActions", {
|
|
1289
|
+
width: "1%",
|
|
1290
|
+
whiteSpace: "nowrap",
|
|
1291
|
+
py: .25
|
|
1292
|
+
}),
|
|
1293
|
+
children: /* @__PURE__ */ Y(L, {
|
|
1294
|
+
sx: { display: "inline-flex" },
|
|
1295
|
+
children: O(n, r, i)
|
|
1296
|
+
})
|
|
1297
|
+
})
|
|
1298
|
+
]
|
|
1299
|
+
}), x && !s(n.key) && /* @__PURE__ */ Y(U, { children: /* @__PURE__ */ Y(H, {
|
|
1300
|
+
colSpan: N,
|
|
1301
|
+
sx: {
|
|
1302
|
+
p: 0,
|
|
1303
|
+
...u ? { borderBottom: 0 } : {}
|
|
1304
|
+
},
|
|
1305
|
+
children: E(n, r, i)
|
|
1306
|
+
}) })] }, n.key);
|
|
1307
|
+
}) })]
|
|
1308
|
+
})
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
function tt({ config: e, nodes: t, onChange: n, guid: r, depth: i = 0, readOnly: a = !1, issues: o = [], showErrors: s = !1, required: c = !1, parentTitle: l, texts: u }) {
|
|
1312
|
+
let d = J(), f = Le(d, e, i, u), { emptyTitle: p, emptyText: m, ...h } = {
|
|
1313
|
+
...u || {},
|
|
1314
|
+
...e.texts || {}
|
|
1315
|
+
}, g = e.max == null ? void 0 : Number(e.max), _ = !a && (g === void 0 || t.length < g), v = a ? "none" : f.addButton.position, y = v === "header" || v === "both", b = v === "footer" || v === "both", x = e.showEmpty ?? !f.nested, S = t.length === 0 && x && !(b && f.addButton.variant === "dashed"), C = t.length === 0 && !S && !b, [w, T] = I({
|
|
1316
|
+
open: !1,
|
|
1317
|
+
mode: "add",
|
|
1318
|
+
index: -1,
|
|
1319
|
+
session: 0
|
|
1320
|
+
}), [E, D] = I({
|
|
1321
|
+
open: !1,
|
|
1322
|
+
index: -1,
|
|
1323
|
+
title: "",
|
|
1324
|
+
detail: ""
|
|
1325
|
+
}), [O, A] = I(null), [j, M] = I({}), N = (e, t = -1) => T((n) => ({
|
|
1326
|
+
open: !0,
|
|
1327
|
+
mode: e,
|
|
1328
|
+
index: t,
|
|
1329
|
+
session: n.session + 1
|
|
1330
|
+
})), P = () => T((e) => ({
|
|
1331
|
+
...e,
|
|
1332
|
+
open: !1
|
|
1333
|
+
})), te = () => N("add"), ne = (e) => N(!a && f.actions.edit ? "edit" : "view", e), re = e.defaultCollapsed ?? f.layout === "table", F = (e) => j[e] ?? re, z = (e) => M((t) => ({
|
|
1334
|
+
...t,
|
|
1335
|
+
[e]: !F(e)
|
|
1336
|
+
})), ie = (r, i) => {
|
|
1337
|
+
if (w.mode === "add") {
|
|
1338
|
+
let a = {
|
|
1339
|
+
key: ve(),
|
|
1340
|
+
data: r,
|
|
1341
|
+
children: ye(e)
|
|
1342
|
+
};
|
|
1343
|
+
f.layout === "cards" && M((e) => ({
|
|
1344
|
+
...e,
|
|
1345
|
+
[a.key]: !1
|
|
1346
|
+
})), n([...t, a]);
|
|
1347
|
+
let o = g !== void 0 && t.length + 1 >= g;
|
|
1348
|
+
(!i || o) && P();
|
|
1349
|
+
} else w.mode === "edit" && n(t.map((e, t) => t === w.index ? {
|
|
1350
|
+
...e,
|
|
1351
|
+
data: r
|
|
1352
|
+
} : e)), P();
|
|
1353
|
+
}, V = (e) => n(t.filter((t, n) => n !== e)), fe = (n) => {
|
|
1354
|
+
if (e.confirmDelete === !1) {
|
|
1355
|
+
V(n);
|
|
1356
|
+
return;
|
|
1357
|
+
}
|
|
1358
|
+
let r = t[n];
|
|
1359
|
+
D({
|
|
1360
|
+
open: !0,
|
|
1361
|
+
index: n,
|
|
1362
|
+
title: ee(r.data, e, n).title,
|
|
1363
|
+
detail: k({
|
|
1364
|
+
...r.data,
|
|
1365
|
+
...r.children
|
|
1366
|
+
}, e)
|
|
1367
|
+
});
|
|
1368
|
+
}, pe = (e) => {
|
|
1369
|
+
let r = [...t];
|
|
1370
|
+
r.splice(e + 1, 0, xe(t[e])), n(r);
|
|
1371
|
+
}, H = (e, r) => {
|
|
1372
|
+
let i = e + r;
|
|
1373
|
+
if (i < 0 || i >= t.length) return;
|
|
1374
|
+
let a = [...t];
|
|
1375
|
+
[a[e], a[i]] = [a[i], a[e]], n(a);
|
|
1376
|
+
}, me = (e, r, i) => n(t.map((t, n) => n === e ? {
|
|
1377
|
+
...t,
|
|
1378
|
+
children: {
|
|
1379
|
+
...t.children,
|
|
1380
|
+
[r]: i
|
|
1381
|
+
}
|
|
1382
|
+
} : t)), U = s ? o.find((e) => e.path.length === 0)?.message : void 0, W = w.index >= 0 ? t[w.index] : void 0, K = O?.index ?? -1, he = (e) => {
|
|
1383
|
+
A(null), e();
|
|
1384
|
+
}, ge = () => M(Object.fromEntries(t.map((e) => [e.key, !0]))), _e = () => M(Object.fromEntries(t.map((e) => [e.key, !1]))), Z = t.length > 0 && t.every((e) => F(e.key)), Q = f.t("deleteMessage", { detail: E.detail ? f.t("deleteDetail", { detail: E.detail }) : "" }), [be, Se] = Q.includes("{title}") ? Q.split("{title}") : [Q, null];
|
|
1385
|
+
return /* @__PURE__ */ X(L, {
|
|
1386
|
+
"data-collection": e.id,
|
|
1387
|
+
sx: f.sx("root", {
|
|
1388
|
+
width: "100%",
|
|
1389
|
+
minWidth: 0
|
|
1390
|
+
}),
|
|
1391
|
+
children: [
|
|
1392
|
+
/* @__PURE__ */ Y(Je, {
|
|
1393
|
+
ui: f,
|
|
1394
|
+
count: t.length,
|
|
1395
|
+
required: c || (Number(e.min) || 0) > 0,
|
|
1396
|
+
alone: C && !U,
|
|
1397
|
+
action: /* @__PURE__ */ X(L, {
|
|
1398
|
+
sx: {
|
|
1399
|
+
display: "flex",
|
|
1400
|
+
alignItems: "center",
|
|
1401
|
+
gap: 1,
|
|
1402
|
+
flexWrap: "wrap"
|
|
1403
|
+
},
|
|
1404
|
+
children: [f.layout === "cards" && t.length >= 2 && /* @__PURE__ */ Y(R, {
|
|
1405
|
+
size: "small",
|
|
1406
|
+
variant: "text",
|
|
1407
|
+
onClick: Z ? _e : ge,
|
|
1408
|
+
sx: {
|
|
1409
|
+
fontSize: 12.5,
|
|
1410
|
+
fontWeight: 600,
|
|
1411
|
+
color: "text.secondary",
|
|
1412
|
+
px: 1,
|
|
1413
|
+
minWidth: 0,
|
|
1414
|
+
textTransform: "none",
|
|
1415
|
+
"&:hover": {
|
|
1416
|
+
color: "text.primary",
|
|
1417
|
+
bgcolor: q(d.palette.text.primary, .05)
|
|
1418
|
+
}
|
|
1419
|
+
},
|
|
1420
|
+
startIcon: /* @__PURE__ */ Y(B, {
|
|
1421
|
+
sx: { fontSize: "15px !important" },
|
|
1422
|
+
children: Z ? "unfold_more" : "unfold_less"
|
|
1423
|
+
}),
|
|
1424
|
+
children: Z ? "Expand all" : "Collapse all"
|
|
1425
|
+
}), y && /* @__PURE__ */ Y(He, {
|
|
1426
|
+
ui: f,
|
|
1427
|
+
placement: "header",
|
|
1428
|
+
empty: t.length === 0,
|
|
1429
|
+
disabled: !_,
|
|
1430
|
+
onClick: te
|
|
1431
|
+
})]
|
|
1432
|
+
})
|
|
1433
|
+
}),
|
|
1434
|
+
U && /* @__PURE__ */ X(G, {
|
|
1435
|
+
role: "alert",
|
|
1436
|
+
sx: f.sx("error", {
|
|
1437
|
+
display: "flex",
|
|
1438
|
+
alignItems: "center",
|
|
1439
|
+
gap: .5,
|
|
1440
|
+
color: "error.main",
|
|
1441
|
+
fontSize: 13,
|
|
1442
|
+
fontWeight: 500,
|
|
1443
|
+
mt: -.5,
|
|
1444
|
+
mb: 1.25
|
|
1445
|
+
}),
|
|
1446
|
+
children: [/* @__PURE__ */ Y(B, {
|
|
1447
|
+
sx: { fontSize: "17px !important" },
|
|
1448
|
+
children: "error_outline"
|
|
1449
|
+
}), U]
|
|
1450
|
+
}),
|
|
1451
|
+
S && /* @__PURE__ */ Y(Ke, {
|
|
1452
|
+
ui: f,
|
|
1453
|
+
readOnly: a,
|
|
1454
|
+
error: !!U
|
|
1455
|
+
}),
|
|
1456
|
+
t.length > 0 && f.layout === "table" && /* @__PURE__ */ Y(et, {
|
|
1457
|
+
ui: f,
|
|
1458
|
+
nodes: t,
|
|
1459
|
+
guid: r,
|
|
1460
|
+
readOnly: a,
|
|
1461
|
+
issues: o,
|
|
1462
|
+
showErrors: s,
|
|
1463
|
+
texts: h,
|
|
1464
|
+
isCollapsed: F,
|
|
1465
|
+
onToggle: z,
|
|
1466
|
+
onOpen: ne,
|
|
1467
|
+
onDelete: fe,
|
|
1468
|
+
onMenu: (e, t) => A({
|
|
1469
|
+
anchor: e,
|
|
1470
|
+
index: t
|
|
1471
|
+
}),
|
|
1472
|
+
onChildChange: me
|
|
1473
|
+
}),
|
|
1474
|
+
t.length > 0 && f.layout === "cards" && /* @__PURE__ */ Y(L, {
|
|
1475
|
+
sx: f.sx("list", {
|
|
1476
|
+
display: "flex",
|
|
1477
|
+
flexDirection: "column",
|
|
1478
|
+
gap: 2
|
|
1479
|
+
}),
|
|
1480
|
+
children: t.map((e, t) => /* @__PURE__ */ Y($e, {
|
|
1481
|
+
ui: f,
|
|
1482
|
+
node: e,
|
|
1483
|
+
index: t,
|
|
1484
|
+
guid: r,
|
|
1485
|
+
readOnly: a,
|
|
1486
|
+
collapsed: F(e.key),
|
|
1487
|
+
issues: o.filter((e) => e.path[0] === t).map((e) => ({
|
|
1488
|
+
...e,
|
|
1489
|
+
path: e.path.slice(1)
|
|
1490
|
+
})),
|
|
1491
|
+
showErrors: s,
|
|
1492
|
+
texts: h,
|
|
1493
|
+
onOpen: () => ne(t),
|
|
1494
|
+
onDelete: () => fe(t),
|
|
1495
|
+
onMenu: (e) => A({
|
|
1496
|
+
anchor: e,
|
|
1497
|
+
index: t
|
|
1498
|
+
}),
|
|
1499
|
+
onToggle: () => z(e.key),
|
|
1500
|
+
onChildChange: (e, n) => me(t, e, n)
|
|
1501
|
+
}, e.key))
|
|
1502
|
+
}),
|
|
1503
|
+
b && /* @__PURE__ */ Y(L, {
|
|
1504
|
+
sx: { mt: t.length || f.addButton.variant !== "dashed" ? 1.25 : 0 },
|
|
1505
|
+
children: /* @__PURE__ */ Y(He, {
|
|
1506
|
+
ui: f,
|
|
1507
|
+
placement: "footer",
|
|
1508
|
+
empty: t.length === 0,
|
|
1509
|
+
disabled: !_,
|
|
1510
|
+
onClick: te
|
|
1511
|
+
})
|
|
1512
|
+
}),
|
|
1513
|
+
/* @__PURE__ */ Y(qe, {
|
|
1514
|
+
ui: f,
|
|
1515
|
+
open: w.open,
|
|
1516
|
+
mode: w.mode,
|
|
1517
|
+
session: w.session,
|
|
1518
|
+
guid: `${r}-${e.id}`,
|
|
1519
|
+
initial: W?.data,
|
|
1520
|
+
context: l,
|
|
1521
|
+
onClose: P,
|
|
1522
|
+
onSave: ie
|
|
1523
|
+
}),
|
|
1524
|
+
/* @__PURE__ */ X(ue, {
|
|
1525
|
+
anchorEl: O?.anchor,
|
|
1526
|
+
open: !!O,
|
|
1527
|
+
onClose: () => A(null),
|
|
1528
|
+
anchorOrigin: {
|
|
1529
|
+
vertical: "bottom",
|
|
1530
|
+
horizontal: "right"
|
|
1531
|
+
},
|
|
1532
|
+
transformOrigin: {
|
|
1533
|
+
vertical: "top",
|
|
1534
|
+
horizontal: "right"
|
|
1535
|
+
},
|
|
1536
|
+
sx: { "& .MuiPaper-root": f.merged("menu", {
|
|
1537
|
+
borderRadius: "10px",
|
|
1538
|
+
minWidth: 170
|
|
1539
|
+
}) },
|
|
1540
|
+
children: [
|
|
1541
|
+
f.actions.duplicate && /* @__PURE__ */ X(de, {
|
|
1542
|
+
sx: f.sx("menuItem"),
|
|
1543
|
+
disabled: !_,
|
|
1544
|
+
onClick: () => he(() => pe(K)),
|
|
1545
|
+
children: [/* @__PURE__ */ Y(ce, { children: /* @__PURE__ */ Y(B, {
|
|
1546
|
+
fontSize: "small",
|
|
1547
|
+
children: "content_copy"
|
|
1548
|
+
}) }), /* @__PURE__ */ Y(le, { children: f.t("duplicate") })]
|
|
1549
|
+
}),
|
|
1550
|
+
f.actions.move && /* @__PURE__ */ X(de, {
|
|
1551
|
+
sx: f.sx("menuItem"),
|
|
1552
|
+
disabled: K <= 0,
|
|
1553
|
+
onClick: () => he(() => H(K, -1)),
|
|
1554
|
+
children: [/* @__PURE__ */ Y(ce, { children: /* @__PURE__ */ Y(B, {
|
|
1555
|
+
fontSize: "small",
|
|
1556
|
+
children: "arrow_upward"
|
|
1557
|
+
}) }), /* @__PURE__ */ Y(le, { children: f.t("moveUp") })]
|
|
1558
|
+
}),
|
|
1559
|
+
f.actions.move && /* @__PURE__ */ X(de, {
|
|
1560
|
+
sx: f.sx("menuItem"),
|
|
1561
|
+
disabled: K >= t.length - 1,
|
|
1562
|
+
onClick: () => he(() => H(K, 1)),
|
|
1563
|
+
children: [/* @__PURE__ */ Y(ce, { children: /* @__PURE__ */ Y(B, {
|
|
1564
|
+
fontSize: "small",
|
|
1565
|
+
children: "arrow_downward"
|
|
1566
|
+
}) }), /* @__PURE__ */ Y(le, { children: f.t("moveDown") })]
|
|
1567
|
+
})
|
|
1568
|
+
]
|
|
1569
|
+
}),
|
|
1570
|
+
/* @__PURE__ */ X(ae, {
|
|
1571
|
+
open: E.open,
|
|
1572
|
+
onClose: () => D((e) => ({
|
|
1573
|
+
...e,
|
|
1574
|
+
open: !1
|
|
1575
|
+
})),
|
|
1576
|
+
maxWidth: "xs",
|
|
1577
|
+
fullWidth: !0,
|
|
1578
|
+
sx: { "& .MuiDialog-paper": f.merged("confirm", {
|
|
1579
|
+
borderRadius: "12px",
|
|
1580
|
+
backgroundImage: "none"
|
|
1581
|
+
}) },
|
|
1582
|
+
children: [/* @__PURE__ */ X(se, {
|
|
1583
|
+
sx: {
|
|
1584
|
+
pt: 3,
|
|
1585
|
+
pb: 1
|
|
1586
|
+
},
|
|
1587
|
+
children: [/* @__PURE__ */ Y(G, {
|
|
1588
|
+
sx: f.sx("confirmTitle", {
|
|
1589
|
+
fontWeight: 600,
|
|
1590
|
+
fontSize: 17
|
|
1591
|
+
}),
|
|
1592
|
+
children: f.t("deleteTitle")
|
|
1593
|
+
}), /* @__PURE__ */ X(G, {
|
|
1594
|
+
sx: f.sx("confirmText", {
|
|
1595
|
+
fontSize: 14,
|
|
1596
|
+
color: "text.secondary",
|
|
1597
|
+
mt: 1
|
|
1598
|
+
}),
|
|
1599
|
+
children: [
|
|
1600
|
+
be,
|
|
1601
|
+
Se !== null && /* @__PURE__ */ Y(L, {
|
|
1602
|
+
component: "strong",
|
|
1603
|
+
sx: {
|
|
1604
|
+
color: "text.primary",
|
|
1605
|
+
fontWeight: 600
|
|
1606
|
+
},
|
|
1607
|
+
children: E.title
|
|
1608
|
+
}),
|
|
1609
|
+
Se
|
|
1610
|
+
]
|
|
1611
|
+
})]
|
|
1612
|
+
}), /* @__PURE__ */ X(oe, {
|
|
1613
|
+
sx: {
|
|
1614
|
+
px: 3,
|
|
1615
|
+
pb: 2.5,
|
|
1616
|
+
pt: 2,
|
|
1617
|
+
gap: 1,
|
|
1618
|
+
"& .MuiButton-root": {
|
|
1619
|
+
textTransform: "none",
|
|
1620
|
+
fontWeight: 600,
|
|
1621
|
+
borderRadius: "8px"
|
|
1622
|
+
}
|
|
1623
|
+
},
|
|
1624
|
+
children: [/* @__PURE__ */ Y(R, {
|
|
1625
|
+
color: "inherit",
|
|
1626
|
+
onClick: () => D((e) => ({
|
|
1627
|
+
...e,
|
|
1628
|
+
open: !1
|
|
1629
|
+
})),
|
|
1630
|
+
sx: f.sx("confirmCancel", { color: "text.secondary" }),
|
|
1631
|
+
children: f.t("cancel")
|
|
1632
|
+
}), /* @__PURE__ */ Y(R, {
|
|
1633
|
+
variant: "contained",
|
|
1634
|
+
color: "error",
|
|
1635
|
+
disableElevation: !0,
|
|
1636
|
+
onClick: () => {
|
|
1637
|
+
V(E.index), D((e) => ({
|
|
1638
|
+
...e,
|
|
1639
|
+
open: !1
|
|
1640
|
+
}));
|
|
1641
|
+
},
|
|
1642
|
+
sx: f.sx("confirmDelete"),
|
|
1643
|
+
children: f.t("deleteConfirm")
|
|
1644
|
+
})]
|
|
1645
|
+
})]
|
|
1646
|
+
})
|
|
1647
|
+
]
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
// src/components/controls/Collection/collection.tsx
|
|
1651
|
+
var nt = ["mandatory", "mandatoryselect"], rt = (e) => {
|
|
1652
|
+
try {
|
|
1653
|
+
return JSON.stringify(e);
|
|
1654
|
+
} catch {
|
|
1655
|
+
return "";
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
function it({ attributes: e = {}, rules: t = {}, onChange: n, submitTick: r }) {
|
|
1659
|
+
let { id: i = "", value: a } = e, o = {
|
|
1660
|
+
...e,
|
|
1661
|
+
id: i,
|
|
1662
|
+
fields: e.fields || []
|
|
1663
|
+
}, s = !!(e.readOnly || e.disabled || e.MuiAttributes?.disabled), c = t?.validation?.find((e) => nt.includes(e.rule)), [l] = I(ve), [u, d] = I(() => Q(a, o)), [f, p] = I(!1), m = F(rt(E(a)));
|
|
1664
|
+
ne(() => {
|
|
1665
|
+
let e = rt(E(a));
|
|
1666
|
+
e !== m.current && (m.current = e, d(Q(a, o)));
|
|
1667
|
+
}, [a]), ne(() => {
|
|
1668
|
+
r && p(!0);
|
|
1669
|
+
}, [r]);
|
|
1670
|
+
let h = (e) => {
|
|
1671
|
+
d(e);
|
|
1672
|
+
let t = be(e, o);
|
|
1673
|
+
m.current = rt(t), n?.({
|
|
1674
|
+
id: i,
|
|
1675
|
+
value: t
|
|
1676
|
+
});
|
|
1677
|
+
}, g = j(be(u, o), o, {
|
|
1678
|
+
required: !!c,
|
|
1679
|
+
requiredMessage: c?.message
|
|
1680
|
+
});
|
|
1681
|
+
return /* @__PURE__ */ Y(tt, {
|
|
1682
|
+
config: o,
|
|
1683
|
+
nodes: u,
|
|
1684
|
+
onChange: h,
|
|
1685
|
+
guid: `${l}-${i}`,
|
|
1686
|
+
readOnly: s,
|
|
1687
|
+
issues: g,
|
|
1688
|
+
showErrors: f,
|
|
1689
|
+
required: !!c
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
export { it as default };
|