dynamic-mui 2.5.3 → 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.
Files changed (252) hide show
  1. package/dist/accordion-DB151BNT.mjs +22 -0
  2. package/dist/accordion-YWjUldL8.js +1 -0
  3. package/dist/addressfield-CpvOajVo.mjs +242 -0
  4. package/dist/addressfield-CwKjfnTq.js +1 -0
  5. package/dist/ai/index.cjs +1 -1
  6. package/dist/ai/index.mjs +1 -14
  7. package/dist/ai/react/AIForm.d.ts +2 -1
  8. package/dist/ai/react/AIFormGenerator.d.ts +1 -1
  9. package/dist/ai/react/AISchemaReview.d.ts +1 -1
  10. package/dist/ai/react/AITextAssist.d.ts +1 -1
  11. package/dist/ai/react/AIVisionImport.d.ts +2 -1
  12. package/dist/ai-BFpA3uHx.js +29 -0
  13. package/dist/ai-UvDYQ30b.mjs +4533 -0
  14. package/dist/asyncautocomplete-DQLDdmVl.js +1 -0
  15. package/dist/asyncautocomplete-mwra2KKJ.mjs +72 -0
  16. package/dist/bar-CgYZxXHl.js +1 -0
  17. package/dist/bar-LVtZP6Ui.mjs +4 -0
  18. package/dist/cascadeselect-BJzHZA9-.js +1 -0
  19. package/dist/cascadeselect-Cl4OHq-L.mjs +66 -0
  20. package/dist/chartControl-IQafKpDk.mjs +29 -0
  21. package/dist/chartControl-ifHiG3nr.js +1 -0
  22. package/dist/collection-DPJTrAiB.mjs +1692 -0
  23. package/dist/collection-Dd_Ojgwl.js +1 -0
  24. package/dist/colorpicker-9AUe21p1.mjs +110 -0
  25. package/dist/colorpicker-DgKTLBmU.js +1 -0
  26. package/dist/components/DynamicComponent.d.ts +2 -1
  27. package/dist/components/FormGenerator.d.ts +1 -1
  28. package/dist/components/charts/Bar/bar.d.ts +6 -2
  29. package/dist/components/charts/Line/line.d.ts +6 -2
  30. package/dist/components/charts/Mixchart/mixChart.d.ts +2 -1
  31. package/dist/components/charts/Pie/pie.d.ts +6 -2
  32. package/dist/components/charts/chartControl.d.ts +15 -0
  33. package/dist/components/controls/Accordion/accordion.d.ts +2 -1
  34. package/dist/components/controls/AddressField/addressfield.d.ts +2 -1
  35. package/dist/components/controls/Alert/alert.d.ts +1 -1
  36. package/dist/components/controls/AsyncAutocomplete/asyncautocomplete.d.ts +1 -1
  37. package/dist/components/controls/Autocomplete/autocomplete.d.ts +1 -1
  38. package/dist/components/controls/Button/button.d.ts +1 -1
  39. package/dist/components/controls/CascadeSelect/cascadeselect.d.ts +2 -1
  40. package/dist/components/controls/CheckBox/checkbox.d.ts +2 -2
  41. package/dist/components/controls/CheckBox/toggleInput.d.ts +25 -0
  42. package/dist/components/controls/Chip/chip.d.ts +1 -1
  43. package/dist/components/controls/ChipSelect/chipselect.d.ts +2 -1
  44. package/dist/components/controls/Collection/CollectionList.d.ts +1 -1
  45. package/dist/components/controls/Collection/ItemDialog.d.ts +1 -1
  46. package/dist/components/controls/Collection/collection.d.ts +1 -1
  47. package/dist/components/controls/Collection/parts.d.ts +6 -6
  48. package/dist/components/controls/ColorPicker/colorpicker.d.ts +2 -1
  49. package/dist/components/controls/Computed/computed.d.ts +1 -1
  50. package/dist/components/controls/ConsentField/consentfield.d.ts +2 -1
  51. package/dist/components/controls/CurrencyField/currencyfield.d.ts +1 -1
  52. package/dist/components/controls/DataTable/datatable.d.ts +2 -1
  53. package/dist/components/controls/DateRangePicker/daterangepicker.d.ts +1 -1
  54. package/dist/components/controls/DateTime/datetime.d.ts +15 -1
  55. package/dist/components/controls/DateTimePicker/datetimepicker.d.ts +6 -2
  56. package/dist/components/controls/Divider/divider.d.ts +1 -1
  57. package/dist/components/controls/EditableTable/editabletable.d.ts +1 -1
  58. package/dist/components/controls/FileUpload/fileupload.d.ts +1 -1
  59. package/dist/components/controls/FormRepeater/formrepeater.d.ts +1 -1
  60. package/dist/components/controls/FormWizard/formwizard.d.ts +1 -1
  61. package/dist/components/controls/GeoField/geofield.d.ts +1 -1
  62. package/dist/components/controls/Group/group.d.ts +2 -1
  63. package/dist/components/controls/Hyperlink/hyperlink.d.ts +1 -1
  64. package/dist/components/controls/ImageList/imagelist.d.ts +1 -1
  65. package/dist/components/controls/IntlPhone/intlphone.d.ts +2 -1
  66. package/dist/components/controls/KeyValueField/keyvaluefield.d.ts +2 -1
  67. package/dist/components/controls/LineItemList/lineitemlist.d.ts +1 -1
  68. package/dist/components/controls/List/list.d.ts +1 -1
  69. package/dist/components/controls/LocationField/locationfield.d.ts +1 -1
  70. package/dist/components/controls/MarkdownEditor/markdowneditor.d.ts +2 -1
  71. package/dist/components/controls/MatrixField/matrixfield.d.ts +2 -1
  72. package/dist/components/controls/MultiTextbox/multitextbox.d.ts +1 -1
  73. package/dist/components/controls/NpsScale/npsscale.d.ts +2 -1
  74. package/dist/components/controls/NumberField/numberfield.d.ts +2 -1
  75. package/dist/components/controls/NumberStepper/numberstepper.d.ts +1 -1
  76. package/dist/components/controls/OtpField/otpfield.d.ts +2 -1
  77. package/dist/components/controls/PasswordField/passwordfield.d.ts +2 -1
  78. package/dist/components/controls/PhoneField/phonefield.d.ts +1 -1
  79. package/dist/components/controls/Radio/radio.d.ts +2 -1
  80. package/dist/components/controls/Rating/rating.d.ts +2 -1
  81. package/dist/components/controls/RichTextEditor/richtexteditor.d.ts +2 -1
  82. package/dist/components/controls/Select/select.d.ts +2 -1
  83. package/dist/components/controls/Signature/signature.d.ts +1 -1
  84. package/dist/components/controls/Slider/slider.d.ts +1 -1
  85. package/dist/components/controls/Stepper/stepper.d.ts +1 -1
  86. package/dist/components/controls/SummaryField/summaryfield.d.ts +2 -1
  87. package/dist/components/controls/Switch/switch.d.ts +1 -1
  88. package/dist/components/controls/Tabs/tabs.d.ts +2 -1
  89. package/dist/components/controls/TagsInput/tagsinput.d.ts +1 -1
  90. package/dist/components/controls/TextField/textfield.d.ts +1 -1
  91. package/dist/components/controls/TextField/useTextInput.d.ts +18 -0
  92. package/dist/components/controls/TimePicker/timepicker.d.ts +6 -2
  93. package/dist/components/controls/ToggleButtons/togglebuttons.d.ts +1 -1
  94. package/dist/components/controls/Typography/typography.d.ts +1 -1
  95. package/dist/components/controls/index.d.ts +24 -9
  96. package/dist/consentfield-CFm1IDa5.mjs +68 -0
  97. package/dist/consentfield-z8W0Yfx8.js +1 -0
  98. package/dist/datatable-CMjaTDPM.js +1 -0
  99. package/dist/datatable-lZIwHx6a.mjs +29 -0
  100. package/dist/dynamic-mui.cjs +1 -1
  101. package/dist/dynamic-mui.d.ts +1 -1
  102. package/dist/dynamic-mui.mjs +264 -204
  103. package/dist/editabletable-B3Df4Jys.mjs +117 -0
  104. package/dist/editabletable-r0RwM1rO.js +1 -0
  105. package/dist/fileupload-Cr-Mz7oH.js +1 -0
  106. package/dist/fileupload-D2fXyMIu.mjs +191 -0
  107. package/dist/formrepeater-BP-RBrQv.js +1 -0
  108. package/dist/formrepeater-BrYTYCzc.mjs +82 -0
  109. package/dist/formwizard-CQ2z6fUX.mjs +82 -0
  110. package/dist/formwizard-DR7fa59M.js +1 -0
  111. package/dist/geofield-CxVFA0og.mjs +116 -0
  112. package/dist/geofield-DtN-d2Bq.js +1 -0
  113. package/dist/group-CiohorzN.mjs +30 -0
  114. package/dist/group-HQL7UqHt.js +1 -0
  115. package/dist/imagelist-CNe1Dp_M.mjs +23 -0
  116. package/dist/imagelist-Wm5Qa6wA.js +1 -0
  117. package/dist/index.d.ts +1 -0
  118. package/dist/intlphone-DwsiSfSt.js +1 -0
  119. package/dist/intlphone-LGE-cB6X.mjs +341 -0
  120. package/dist/keyvaluefield-B7NlE0AT.js +1 -0
  121. package/dist/keyvaluefield-Cd4NQf6d.mjs +128 -0
  122. package/dist/line-BGSi1tvf.js +1 -0
  123. package/dist/line-cK6taoCA.mjs +4 -0
  124. package/dist/lineitemlist-bmk7fEf9.mjs +169 -0
  125. package/dist/lineitemlist-mulPt3cO.js +1 -0
  126. package/dist/list-D5qW-7Xg.js +1 -0
  127. package/dist/list-xPNiijgm.mjs +20 -0
  128. package/dist/locationfield-DtWkxnX-.js +1 -0
  129. package/dist/locationfield-SPonkbMU.mjs +90 -0
  130. package/dist/markdowneditor-6lJQ5cEn.mjs +82 -0
  131. package/dist/markdowneditor-nPP0t2eK.js +2 -0
  132. package/dist/matrixfield-CUYoJCwi.js +1 -0
  133. package/dist/matrixfield-Jm9Yx0EP.mjs +119 -0
  134. package/dist/mixChart-CSq7pQqJ.mjs +49 -0
  135. package/dist/mixChart-DoehYa8V.js +1 -0
  136. package/dist/muiX-BHOKpogF.mjs +12 -0
  137. package/dist/muiX-CG_D1XQ2.js +1 -0
  138. package/dist/multitextbox-D-JUSnT7.js +1 -0
  139. package/dist/multitextbox-gUt8BmfQ.mjs +96 -0
  140. package/dist/npsscale-D_VtbpJi.js +1 -0
  141. package/dist/npsscale-LWe7yCxB.mjs +111 -0
  142. package/dist/numberstepper-BXXlSKT_.js +1 -0
  143. package/dist/numberstepper-K_JfJJtg.mjs +111 -0
  144. package/dist/pie-CueMspFX.js +1 -0
  145. package/dist/pie-DFO89j-z.mjs +4 -0
  146. package/dist/richtexteditor-BHM-8xe3.js +1 -0
  147. package/dist/richtexteditor-gmObNHZ7.mjs +178 -0
  148. package/dist/rolldown-runtime-5iZMYShA.js +1 -0
  149. package/dist/s3Upload-C3-wcrua.js +1 -0
  150. package/dist/s3Upload-HtE088XA.mjs +39 -0
  151. package/dist/signature-DjYfiNzq.js +3 -0
  152. package/dist/signature-HiL8FJ6C.mjs +1116 -0
  153. package/dist/stepper-cpOj2wWz.mjs +166 -0
  154. package/dist/stepper-zEfhqmbA.js +1 -0
  155. package/dist/summaryfield-BzrdvTVy.js +1 -0
  156. package/dist/summaryfield-DIQfJjjo.mjs +65 -0
  157. package/dist/tabs-DvPu-zDC.mjs +50 -0
  158. package/dist/tabs-xdkLXUCp.js +1 -0
  159. package/dist/tagsinput-B33m6GJ_.js +1 -0
  160. package/dist/tagsinput-CTBGuv0M.mjs +49 -0
  161. package/dist/useSyncedState-CzAO4D1o.mjs +17 -0
  162. package/dist/useSyncedState-DYNKkpDv.js +1 -0
  163. package/dist/useTextInput-Cm0_Ps2V.js +1 -0
  164. package/dist/useTextInput-Dr-ncTE8.mjs +1683 -0
  165. package/dist/useUpdateEffect-CNBo9hj8.js +1 -0
  166. package/dist/useUpdateEffect-CXAhttj7.mjs +14 -0
  167. package/dist/util/helper.d.ts +18 -1
  168. package/dist/util/muiVersion.d.ts +13 -0
  169. package/dist/util/stepperComponents.d.ts +1 -1
  170. package/dist/util/useSyncedState.d.ts +22 -0
  171. package/dist/util/validation.d.ts +40 -0
  172. package/dist/v4-Dyp-SQ1c.js +1 -0
  173. package/dist/v4-YCkfo8OR.mjs +27 -0
  174. package/dist/validation-B7DPZ218.js +7 -0
  175. package/dist/validation-BRcYhhsT.mjs +4991 -0
  176. package/package.json +35 -35
  177. package/dist/AIForm-D204ogdw.js +0 -44
  178. package/dist/AIForm-IafSvW2_.mjs +0 -12281
  179. package/dist/accordion-DA8VpkJ_.mjs +0 -23
  180. package/dist/accordion-yIxiSIl4.js +0 -1
  181. package/dist/addressfield-DCzPapIx.mjs +0 -164
  182. package/dist/addressfield-EFiWgeWB.js +0 -1
  183. package/dist/asyncautocomplete-5-8SXotM.mjs +0 -92
  184. package/dist/asyncautocomplete-BmHm-S4u.js +0 -1
  185. package/dist/bar-BvwjqB4v.mjs +0 -21
  186. package/dist/bar-DRjoPCtv.js +0 -1
  187. package/dist/cascadeselect-BEaoupK6.js +0 -1
  188. package/dist/cascadeselect-CzSf78Pg.mjs +0 -66
  189. package/dist/collection-CthMZ0Go.js +0 -1
  190. package/dist/collection-n9eBOioi.mjs +0 -1157
  191. package/dist/colorpicker-Bm9M38_c.mjs +0 -111
  192. package/dist/colorpicker-DHkdM8Q2.js +0 -1
  193. package/dist/consentfield-B2-UFm5n.mjs +0 -80
  194. package/dist/consentfield-DV8Gz0k9.js +0 -1
  195. package/dist/datatable-BVZFBd-8.mjs +0 -21
  196. package/dist/datatable-DnnyVWJm.js +0 -1
  197. package/dist/editabletable-B_JS4UZ9.js +0 -1
  198. package/dist/editabletable-BwvIvAt7.mjs +0 -128
  199. package/dist/fileupload-BHT7K0YT.mjs +0 -185
  200. package/dist/fileupload-CugVG3o3.js +0 -1
  201. package/dist/formrepeater-CaJMPo3Q.mjs +0 -75
  202. package/dist/formrepeater-DiKPaOfi.js +0 -1
  203. package/dist/formwizard-BzvdbvBY.js +0 -1
  204. package/dist/formwizard-C9fOIHQv.mjs +0 -83
  205. package/dist/geofield-BM4b5Zwx.js +0 -1
  206. package/dist/geofield-DYXx9K9o.mjs +0 -108
  207. package/dist/group-D5fMqJTx.mjs +0 -23
  208. package/dist/group-mwS8FSGJ.js +0 -1
  209. package/dist/imagelist-Bn9QhIv7.js +0 -1
  210. package/dist/imagelist-rqmJajHt.mjs +0 -18
  211. package/dist/intlphone-BQYytFWy.js +0 -1
  212. package/dist/intlphone-DHDwdBbm.mjs +0 -144
  213. package/dist/keyvaluefield-DM0eSfPF.mjs +0 -127
  214. package/dist/keyvaluefield-DXyuqDba.js +0 -1
  215. package/dist/line-Dst2QjuI.mjs +0 -21
  216. package/dist/line-hM3OgPH7.js +0 -1
  217. package/dist/lineitemlist-89hrdS0p.mjs +0 -170
  218. package/dist/lineitemlist-DfEjbNCH.js +0 -1
  219. package/dist/list-B8S2MrOx.js +0 -1
  220. package/dist/list-C97cCc78.mjs +0 -20
  221. package/dist/locationfield-BEMe22_x.mjs +0 -118
  222. package/dist/locationfield-DlgLvvdU.js +0 -1
  223. package/dist/markdowneditor-JoiWE-qO.js +0 -2
  224. package/dist/markdowneditor-K4TAKJ3s.mjs +0 -94
  225. package/dist/matrixfield-D4sHu6rU.mjs +0 -121
  226. package/dist/matrixfield-szah6uOP.js +0 -1
  227. package/dist/mixChart-Doq4lt7Z.mjs +0 -75
  228. package/dist/mixChart-rgyMCdnp.js +0 -1
  229. package/dist/multitextbox-CBChuyw9.js +0 -1
  230. package/dist/multitextbox-Cnrwie5U.mjs +0 -78
  231. package/dist/npsscale-Cc2eD9Nk.js +0 -1
  232. package/dist/npsscale-DgQPa1eH.mjs +0 -91
  233. package/dist/numberstepper-BcuSZHwZ.js +0 -1
  234. package/dist/numberstepper-BqINnIm7.mjs +0 -132
  235. package/dist/pie-B6dXjc4o.mjs +0 -21
  236. package/dist/pie-a_dhmBUq.js +0 -1
  237. package/dist/richtexteditor-Bs5-VQj3.js +0 -1
  238. package/dist/richtexteditor-CveBdsmJ.mjs +0 -143
  239. package/dist/s3Upload-B0JeoLkS.js +0 -1
  240. package/dist/s3Upload-dpioZ2c8.mjs +0 -51
  241. package/dist/signature-BRWAWqeA.mjs +0 -1227
  242. package/dist/signature-Bj9GDrvy.js +0 -2
  243. package/dist/stepper-B9sSsbQD.js +0 -1
  244. package/dist/stepper-DTMAP67o.mjs +0 -140
  245. package/dist/summaryfield-JKL3ZLl2.js +0 -1
  246. package/dist/summaryfield-xhr0Q4RL.mjs +0 -96
  247. package/dist/tabs-ClkmKlV8.mjs +0 -39
  248. package/dist/tabs-DmEP_QW0.js +0 -1
  249. package/dist/tagsinput-B0yVrYgB.mjs +0 -58
  250. package/dist/tagsinput-COKkxIxg.js +0 -1
  251. package/dist/v4-BysszJq8.mjs +0 -30
  252. package/dist/v4-CqdK_b8Y.js +0 -1
@@ -1,1157 +0,0 @@
1
- import { jsxs as h, jsx as n, Fragment as St } from "react/jsx-runtime";
2
- import { useRef as Je, useState as Y, Fragment as Re } from "react";
3
- import { R as Ae, S as Ct, T as kt, U as wt, W as At, X as Ye, Y as Tt, Z as It, _ as zt, $ as Ze, 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 Qe, a9 as Rt, aa as Ot, ab as Bt, ac as Lt, ad as Pt, ae as Ft, af as $e, ag as Vt, ah as et, F as Gt, ai as Ht, aj as oe, ak as Nt, al as Ut, am as Te, an as tt, j as Oe, ao as Kt } from "./AIForm-IafSvW2_.mjs";
4
- import { ButtonBase as nt, Icon as j, Button as Z, Typography as R, Box as f, Tooltip as U, useMediaQuery as rt, Dialog as at, IconButton as X, DialogContent as ot, DialogActions as it, Menu as Xt, MenuItem as pe, ListItemIcon as xe, ListItemText as me, Table as Jt, TableHead as Yt, TableRow as he, TableCell as K, TableBody as Zt, Collapse as lt } from "@mui/material";
5
- import { alpha as p, useTheme as J } from "@mui/material/styles";
6
- let Qt = 0;
7
- const ie = () => `dmui-col-${++Qt}`, st = (e) => (e.collections || []).map((t) => t.id), en = (e) => Object.fromEntries(st(e).map((t) => [t, []])), Ie = (e, t) => Ae(e).map((r) => {
8
- const a = new Set(st(t)), i = Object.fromEntries(Object.entries(r).filter(([c]) => !a.has(c))), l = Object.fromEntries(
9
- (t.collections || []).map((c) => [c.id, Ie(r[c.id], c)])
10
- );
11
- return { key: ie(), data: i, children: l };
12
- }), ze = (e, t) => e.map((r) => {
13
- const a = { ...r.data };
14
- return (t.collections || []).forEach((i) => {
15
- a[i.id] = ze(r.children[i.id] || [], i);
16
- }), a;
17
- }), ct = (e) => ({
18
- key: ie(),
19
- data: Ct(e.data),
20
- children: Object.fromEntries(Object.entries(e.children).map(([t, r]) => [t, r.map(ct)]))
21
- });
22
- var fe, Be;
23
- function dt() {
24
- if (Be) return fe;
25
- Be = 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 fe = r, fe;
31
- }
32
- var ge, Le;
33
- function tn() {
34
- if (Le) return ge;
35
- Le = 1;
36
- var e = At(), t = Ye();
37
- function r(a) {
38
- return t(a) && e(a);
39
- }
40
- return ge = r, ge;
41
- }
42
- var be, Pe;
43
- function nn() {
44
- if (Pe) return be;
45
- Pe = 1;
46
- var e = Tt(), t = It(), r = Ye(), a = "[object Object]", i = Function.prototype, l = Object.prototype, c = i.toString, x = l.hasOwnProperty, g = c.call(Object);
47
- function d(y) {
48
- if (!r(y) || e(y) != a)
49
- return !1;
50
- var b = t(y);
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 be = d, be;
57
- }
58
- var ue, Fe;
59
- function pt() {
60
- if (Fe) return ue;
61
- Fe = 1;
62
- function e(t, r) {
63
- if (!(r === "constructor" && typeof t[r] == "function") && r != "__proto__")
64
- return t[r];
65
- }
66
- return ue = e, ue;
67
- }
68
- var ye, Ve;
69
- function rn() {
70
- if (Ve) return ye;
71
- Ve = 1;
72
- var e = zt(), t = Ze();
73
- function r(a) {
74
- return e(a, t(a));
75
- }
76
- return ye = r, ye;
77
- }
78
- var ve, Ge;
79
- function an() {
80
- if (Ge) return ve;
81
- Ge = 1;
82
- var e = dt(), t = Mt(), r = _t(), a = $t(), i = qt(), l = jt(), c = Wt(), x = tn(), g = Et(), d = Dt(), y = Qe(), b = nn(), o = Rt(), v = pt(), S = rn();
83
- function I(A, k, M, W, P, q, _) {
84
- var w = v(A, M), C = v(k, M), V = _.get(C);
85
- if (V) {
86
- e(A, M, V);
87
- return;
88
- }
89
- var $ = q ? q(w, C, M + "", A, k, _) : void 0, E = $ === void 0;
90
- if (E) {
91
- var D = c(C), O = !D && g(C), N = !D && !O && o(C);
92
- $ = C, D || O || N ? c(w) ? $ = w : x(w) ? $ = a(w) : O ? (E = !1, $ = t(C, !0)) : N ? (E = !1, $ = r(C, !0)) : $ = [] : b(C) || l(C) ? ($ = w, l(w) ? $ = S(w) : (!y(w) || d(w)) && ($ = i(C))) : E = !1;
93
- }
94
- E && (_.set(C, $), P($, C, W, q, _), _.delete(C)), e(A, M, $);
95
- }
96
- return ve = I, ve;
97
- }
98
- var Se, He;
99
- function on() {
100
- if (He) return Se;
101
- He = 1;
102
- var e = Ot(), t = dt(), r = Bt(), a = an(), i = Qe(), l = Ze(), c = pt();
103
- function x(g, d, y, b, o) {
104
- g !== d && r(d, function(v, S) {
105
- if (o || (o = new e()), i(v))
106
- a(g, d, S, y, x, b, o);
107
- else {
108
- var I = b ? b(c(g, S), v, S + "", g, d, o) : void 0;
109
- I === void 0 && (I = v), t(g, S, I);
110
- }
111
- }, l);
112
- }
113
- return Se = x, Se;
114
- }
115
- var Ce, Ne;
116
- function ln() {
117
- if (Ne) return Ce;
118
- Ne = 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 y = l[c];
125
- y && a(i, y, c, g);
126
- }
127
- return i;
128
- });
129
- }
130
- return Ce = r, Ce;
131
- }
132
- var ke, Ue;
133
- function sn() {
134
- if (Ue) return ke;
135
- Ue = 1;
136
- var e = on(), t = ln(), r = t(function(a, i, l) {
137
- e(a, i, l);
138
- });
139
- return ke = r, ke;
140
- }
141
- var cn = sn();
142
- const dn = /* @__PURE__ */ Ft(cn), xt = (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
- }, mt = (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
- }, Ke = (e) => e == null ? [] : Array.isArray(e) ? e : [e], hn = (e, t, r, a = {}) => {
190
- const i = r > 0, l = xt(e, t.color), c = $e(t), x = Vt(t), g = { ...pn, ...a, ...t.texts || {} }, d = t.styles || {}, y = {
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: mt(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] ?? ""), { ...y, ...o }),
218
- sx: (b, o) => [...Ke(o), ...Ke(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(j, { children: e.icon }) });
260
- }
261
- function un({ ui: e, text: t, color: r }) {
262
- const a = J(), i = r === "default" ? null : xt(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 ? mt(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 Xe({ 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"), y = e.config.max != null && a, b = !!g || l === "dashed" && g !== !1, o = (S) => /* @__PURE__ */ n(U, { title: y ? e.t("maxReached") : "", children: /* @__PURE__ */ n(f, { component: "span", sx: { display: b ? "block" : "inline-flex", flexShrink: 0 }, children: S }) });
297
- if (l === "dashed")
298
- return o(
299
- /* @__PURE__ */ h(
300
- nt,
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(j, { children: c }),
326
- d
327
- ]
328
- }
329
- )
330
- );
331
- const v = {
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
- Z,
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(j, { 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
- ...v
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) => et($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(R, { 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(j, { sx: { color: e.ink, fontSize: "22px !important" }, children: e.icon || "inbox" }) }),
399
- /* @__PURE__ */ n(R, { sx: e.sx("emptyTitle", { fontSize: 15, fontWeight: 600, color: "text.primary" }), children: e.t("emptyTitle") }),
400
- i && !t && /* @__PURE__ */ n(R, { 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(), y = e.config.dialog || {}, b = rt(d.breakpoints.down("sm")), o = y.fullScreen === !0 || y.fullScreen !== !1 && b, v = Je(null), [S, I] = Y(0), { accent: A } = e, k = e.t(r === "add" ? "dialogAddTitle" : r === "edit" ? "dialogEditTitle" : "dialogViewTitle"), M = `${a}-dialog-${i}-${S}`, W = e.t("dialogContext"), [P, q] = W.includes("{parent}") ? W.split("{parent}") : [W, null], _ = (w) => {
407
- const C = v.current;
408
- !C || !C.validate() || (g({ ...C.getValues() }, w), w && I((V) => V + 1));
409
- };
410
- return /* @__PURE__ */ h(
411
- at,
412
- {
413
- open: t,
414
- onClose: (w, C) => {
415
- C !== "backdropClick" && x();
416
- },
417
- fullScreen: o,
418
- fullWidth: !0,
419
- maxWidth: y.maxWidth || "sm",
420
- "aria-labelledby": `${a}-dialog-title`,
421
- onKeyDown: (w) => {
422
- r !== "view" && w.key === "Enter" && (w.metaKey || w.ctrlKey) && (w.preventDefault(), _(!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(R, { id: `${a}-dialog-title`, sx: e.sx("dialogTitle", { fontWeight: 600, fontSize: 18, lineHeight: 1.3 }), children: k }),
442
- c && /* @__PURE__ */ h(R, { sx: e.sx("dialogContext", { fontSize: 13.5, color: "text.secondary", mt: 0.25 }), children: [
443
- P,
444
- q !== null && /* @__PURE__ */ n(f, { component: "strong", sx: { color: "text.primary", fontWeight: 600 }, children: c }),
445
- q
446
- ] }),
447
- y.description && /* @__PURE__ */ n(R, { sx: e.sx("dialogDescription", { fontSize: 13.5, color: "text.secondary", mt: 0.25 }), children: y.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(j, { children: "close" }) })
450
- ] }),
451
- /* @__PURE__ */ n(ot, { 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: v,
458
- readOnly: r === "view",
459
- MuiGridAttributes: { spacing: y.spacing ?? 2 }
460
- },
461
- M
462
- ) }),
463
- /* @__PURE__ */ n(it, { 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(Z, { 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(Z, { onClick: x, color: "inherit", sx: e.sx("dialogCancel", { color: "text.secondary" }), children: e.t("cancel") }),
472
- r === "add" && y.addAnother !== !1 && /* @__PURE__ */ n(
473
- Z,
474
- {
475
- variant: "outlined",
476
- color: "inherit",
477
- onClick: () => _(!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
- Z,
484
- {
485
- variant: "contained",
486
- color: "inherit",
487
- disableElevation: !0,
488
- startIcon: /* @__PURE__ */ n(j, { children: r === "add" ? "add" : "check" }),
489
- onClick: () => _(!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(j, { sx: e.sx("headerIcon", {
515
- color: e.ink,
516
- fontSize: `${l ? 14 : 18}px !important`
517
- }), children: e.icon }) }),
518
- /* @__PURE__ */ h(R, { 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(R, { 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 Me({ ui: e, title: t, canEdit: r, onOpen: a, size: i }) {
540
- return /* @__PURE__ */ n(
541
- nt,
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 _e({ 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 = tt(Te(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(), y = !r && e.actions.edit, b = !r && e.actions.delete, o = !r && (e.actions.duplicate || e.actions.move), v = (S, I) => ({
573
- width: 30,
574
- height: 30,
575
- borderRadius: "8px",
576
- color: S,
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
- y && /* @__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", v(e.ink, p(e.accent.main, 0.1))),
588
- children: /* @__PURE__ */ n(j, { 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", v(d.palette.error.main, p(d.palette.error.main, 0.08))),
598
- children: /* @__PURE__ */ n(j, { 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: (S) => x(S.currentTarget),
607
- sx: e.sx("actionButton", v(d.palette.text.secondary, p(d.palette.text.primary, 0.07))),
608
- children: /* @__PURE__ */ n(j, { 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", v(d.palette.text.secondary, p(d.palette.text.primary, 0.07))),
619
- children: /* @__PURE__ */ n(j, { sx: { fontSize: "19px !important", transition: `transform .2s ${ee}`, transform: a ? "rotate(180deg)" : "none" }, children: "expand_more" })
620
- }
621
- ) })
622
- ] });
623
- }
624
- function ht({ ui: e, node: t, guid: r, readOnly: a, issues: i, showErrors: l, texts: c, parentTitle: x, onChildChange: g }) {
625
- const d = J(), y = e.config.collections || [];
626
- return /* @__PURE__ */ n(f, { sx: e.sx("sections", { display: "grid", gridTemplateColumns: mn(e.config.sectionColumns ?? 1, 320) }), children: y.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
- ft,
638
- {
639
- config: b,
640
- nodes: t.children[b.id] || [],
641
- onChange: (v) => g(b.id, v),
642
- guid: `${r}-${t.key}`,
643
- depth: e.depth + 1,
644
- readOnly: a,
645
- issues: i.filter((v) => v.path[0] === b.id).map((v) => ({ ...v, path: v.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: y, onMenu: b, onToggle: o, onChildChange: v }) {
656
- const S = J(), { config: I } = e, A = I.display || {}, { title: k, subtitle: M, details: W } = oe(t.data, I, r), P = I.collections || [], q = P.length > 0, _ = x && c.length > 0, w = A.avatar || "none", C = !i && e.actions.edit, V = !i && e.actions.delete, $ = !i && (e.actions.duplicate || e.actions.move), E = W.length > 0 || q, D = !l, O = _ ? p(S.palette.error.main, 0.05) : p(e.accent.main, 0.05), N = _ ? p(S.palette.error.main, 0.2) : p(e.accent.main, 0.15), G = (m, u) => ({
657
- width: 30,
658
- height: 30,
659
- borderRadius: "8px",
660
- color: m,
661
- transition: `background-color .15s ${ee}`,
662
- "&:hover": { bgcolor: u }
663
- });
664
- return /* @__PURE__ */ h(f, { sx: e.sx("item", {
665
- border: `1px solid ${_ ? S.palette.error.main : S.palette.divider}`,
666
- borderRadius: "14px",
667
- overflow: "hidden",
668
- bgcolor: "background.paper",
669
- boxShadow: `0 1px 3px ${p(S.palette.common.black, 0.06)}, 0 4px 12px ${p(S.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: O,
676
- borderBottom: D && E ? `1px solid ${N}` : "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(Me, { ui: e, title: k, canEdit: C, onOpen: d, size: 15.5 }),
686
- /* @__PURE__ */ n(_e, { ui: e, data: t.data })
687
- ] }),
688
- M && /* @__PURE__ */ h(R, { 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(j, { children: A.subtitleIcon }),
698
- M
699
- ] }),
700
- !D && q && /* @__PURE__ */ n(f, { sx: { display: "flex", flexWrap: "wrap", gap: 0.75, mt: 0.6 }, children: P.map((m) => {
701
- const u = (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
- u,
713
- " ",
714
- et($e(m), u).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
- C && /* @__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: G(e.ink, p(e.accent.main, 0.1)),
726
- children: /* @__PURE__ */ n(j, { sx: { fontSize: "17px !important" }, children: "edit" })
727
- }
728
- ) }),
729
- V && /* @__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: y,
735
- sx: G(S.palette.error.main, p(S.palette.error.main, 0.08)),
736
- children: /* @__PURE__ */ n(j, { 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: G(S.palette.text.secondary, p(S.palette.text.primary, 0.07)),
746
- children: /* @__PURE__ */ n(j, { 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: G(S.palette.text.secondary, p(S.palette.text.primary, 0.07)),
756
- children: /* @__PURE__ */ n(j, { 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(lt, { in: D, timeout: 220, children: [
766
- W.length > 0 && /* @__PURE__ */ n(f, { sx: e.sx("details", {
767
- display: "flex",
768
- overflowX: "auto",
769
- borderBottom: q ? `1px solid ${S.palette.divider}` : "none",
770
- "&::-webkit-scrollbar": { height: 0 }
771
- }), children: W.map((m, u) => /* @__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: u > 0 ? `1px solid ${S.palette.divider}` : "none"
781
- }),
782
- children: [
783
- /* @__PURE__ */ h(R, { 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(j, { sx: { fontSize: "11px !important" }, children: m.icon }),
796
- m.label
797
- ] }),
798
- /* @__PURE__ */ n(R, { 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
- q && /* @__PURE__ */ n(
810
- ht,
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: v
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: y, onMenu: b, onChildChange: o }) {
827
- const v = J(), S = rt(v.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(Te(A, W)) || W : ""), q = (I.collections || []).length > 0, _ = !a && e.actions.edit, w = !a && (e.actions.edit || e.actions.delete || e.actions.duplicate || e.actions.move), C = (m) => i.filter((u) => u.path[0] === m).map((u) => ({ ...u, path: u.path.slice(1) })), V = /* @__PURE__ */ n(f, { component: "span", sx: { color: "text.disabled" }, children: "—" }), $ = (m, u, L) => q && /* @__PURE__ */ n(lt, { in: !x(m.key), timeout: 200, unmountOnExit: !0, children: /* @__PURE__ */ n(
828
- ht,
829
- {
830
- ui: e,
831
- node: m,
832
- guid: r,
833
- readOnly: a,
834
- issues: C(u),
835
- showErrors: l,
836
- texts: c,
837
- parentTitle: L,
838
- onChildChange: (F, Q) => o(u, F, Q)
839
- }
840
- ) }), E = (m, u, L) => /* @__PURE__ */ n(
841
- An,
842
- {
843
- ui: e,
844
- title: L,
845
- readOnly: a,
846
- open: !x(m.key),
847
- canToggle: q,
848
- onEdit: () => d(u),
849
- onDelete: () => y(u),
850
- onMenu: (F) => b(F, u),
851
- onToggle: () => g(m.key)
852
- }
853
- ), D = p(v.palette.error.main, 0.06);
854
- if (S)
855
- return /* @__PURE__ */ n(f, { sx: e.sx("table", { border: `1px solid ${v.palette.divider}`, borderRadius: "8px", overflow: "hidden", bgcolor: "background.paper" }), children: t.map((m, u) => {
856
- const { title: L, details: F } = oe(m.data, I, u), Q = l && C(u).length > 0;
857
- return /* @__PURE__ */ h(f, { sx: e.sx("mobileRow", { borderTop: u ? `1px solid ${v.palette.divider}` : "none", ...Q ? { 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(Me, { ui: e, title: L, canEdit: _, onOpen: () => d(u), size: 14.5 }),
862
- /* @__PURE__ */ n(_e, { ui: e, data: m.data })
863
- ] }),
864
- F.length > 0 && /* @__PURE__ */ n(f, { sx: { display: "grid", gridTemplateColumns: "auto 1fr", columnGap: 1.5, rowGap: 0.25, mt: 0.75 }, children: F.map((H) => /* @__PURE__ */ h(Re, { children: [
865
- /* @__PURE__ */ n(R, { sx: e.sx("detailLabel", { fontSize: 13, color: "text.secondary" }), children: H.label }),
866
- /* @__PURE__ */ n(R, { sx: e.sx("detailValue", { fontSize: 13, fontWeight: 500, wordBreak: "break-word" }), children: H.value })
867
- ] }, H.id)) })
868
- ] }),
869
- (w || q) && E(m, u, L)
870
- ] }),
871
- $(m, u, L)
872
- ] }, m.key);
873
- }) });
874
- const O = e.sx("tableHeadCell", { fontSize: 12.5, fontWeight: 600, color: "text.secondary", whiteSpace: "nowrap", py: 1, px: 1.75 }), N = e.sx("tableCell", { fontSize: 14, color: "text.primary", whiteSpace: "nowrap", py: 1.1, px: 1.75 }), G = 1 + M.length + (W ? 1 : 0) + (w || q ? 1 : 0);
875
- return /* @__PURE__ */ n(f, { sx: e.sx("table", { border: `1px solid ${v.palette.divider}`, borderRadius: "8px", overflowX: "auto", bgcolor: "background.paper" }), children: /* @__PURE__ */ h(Jt, { size: "small", children: [
876
- /* @__PURE__ */ n(Yt, { children: /* @__PURE__ */ h(he, { sx: e.sx("tableHead", { bgcolor: p(v.palette.text.primary, v.palette.mode === "dark" ? 0.05 : 0.03) }), children: [
877
- /* @__PURE__ */ n(K, { sx: O, children: k.titleLabel || e.itemLabel }),
878
- M.map((m) => /* @__PURE__ */ n(K, { sx: O, children: m.label }, m.id)),
879
- W && /* @__PURE__ */ n(K, { sx: O, children: P }),
880
- (w || q) && /* @__PURE__ */ n(K, { sx: O })
881
- ] }) }),
882
- /* @__PURE__ */ n(Zt, { children: t.map((m, u) => {
883
- const { title: L, rawTitle: F } = oe(m.data, I, u), Q = l && C(u).length > 0, H = u === t.length - 1, re = H && !(q && !x(m.key)) ? { "& > td": { borderBottom: 0 } } : {};
884
- return /* @__PURE__ */ h(Re, { children: [
885
- /* @__PURE__ */ h(he, { hover: !0, sx: e.sx("tableRow", { ...re, ...Q ? { bgcolor: D } : {} }), children: [
886
- /* @__PURE__ */ n(K, { sx: N, children: F ? /* @__PURE__ */ n(Me, { ui: e, title: F, canEdit: _, onOpen: () => d(u), size: 14 }) : /* @__PURE__ */ n(
887
- f,
888
- {
889
- component: _ ? "button" : "span",
890
- type: _ ? "button" : void 0,
891
- onClick: _ ? () => d(u) : void 0,
892
- "aria-label": _ ? e.t("editAria", { title: L }) : void 0,
893
- sx: {
894
- background: "none",
895
- border: 0,
896
- p: 0,
897
- font: "inherit",
898
- color: "text.disabled",
899
- cursor: _ ? "pointer" : "default"
900
- },
901
- children: "—"
902
- }
903
- ) }),
904
- M.map((te) => /* @__PURE__ */ n(K, { sx: N, children: tt(Te(A, te.id), m.data[te.id]) || V }, te.id)),
905
- W && /* @__PURE__ */ n(K, { sx: N, children: /* @__PURE__ */ n(_e, { ui: e, data: m.data }) }),
906
- (w || q) && /* @__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, u, L) }) })
907
- ] }),
908
- q && !x(m.key) && /* @__PURE__ */ n(he, { children: /* @__PURE__ */ n(K, { colSpan: G, sx: { p: 0, ...H ? { borderBottom: 0 } : {} }, children: $(m, u, L) }) })
909
- ] }, m.key);
910
- }) })
911
- ] }) });
912
- }
913
- function ft({
914
- config: e,
915
- nodes: t,
916
- onChange: r,
917
- guid: a,
918
- depth: i = 0,
919
- readOnly: l = !1,
920
- issues: c = [],
921
- showErrors: x = !1,
922
- required: g = !1,
923
- parentTitle: d,
924
- texts: y
925
- }) {
926
- const b = J(), o = hn(b, e, i, y), { emptyTitle: v, emptyText: S, ...I } = { ...y || {}, ...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", q = e.showEmpty ?? !o.nested, _ = t.length === 0 && q && !(P && o.addButton.variant === "dashed"), w = t.length === 0 && !_ && !P, [C, V] = Y({ open: !1, mode: "add", index: -1, session: 0 }), [$, E] = Y({ open: !1, index: -1, title: "", detail: "" }), [D, O] = Y(null), [N, G] = Y({}), m = (s, T = -1) => V((z) => ({ open: !0, mode: s, index: T, session: z.session + 1 })), u = () => V((s) => ({ ...s, open: !1 })), L = () => m("add"), F = (s) => m(!l && o.actions.edit ? "edit" : "view", s), Q = e.defaultCollapsed ?? o.layout === "table", H = (s) => N[s] ?? Q, re = (s) => G((T) => ({ ...T, [s]: !H(s) })), te = (s, T) => {
927
- if (C.mode === "add") {
928
- const z = { key: ie(), data: s, children: en(e) };
929
- o.layout === "cards" && G((de) => ({ ...de, [z.key]: !1 })), r([...t, z]);
930
- const B = A !== void 0 && t.length + 1 >= A;
931
- (!T || B) && u();
932
- return;
933
- }
934
- C.mode === "edit" && r(t.map((z, B) => B === C.index ? { ...z, data: s } : z)), u();
935
- }, qe = (s) => r(t.filter((T, z) => z !== s)), je = (s) => {
936
- if (e.confirmDelete === !1) {
937
- qe(s);
938
- return;
939
- }
940
- const T = t[s];
941
- E({
942
- open: !0,
943
- index: s,
944
- title: oe(T.data, e, s).title,
945
- detail: Ht({ ...T.data, ...T.children }, e)
946
- });
947
- }, gt = (s) => {
948
- const T = [...t];
949
- T.splice(s + 1, 0, ct(t[s])), r(T);
950
- }, We = (s, T) => {
951
- const z = s + T;
952
- if (z < 0 || z >= t.length) return;
953
- const B = [...t];
954
- [B[s], B[z]] = [B[z], B[s]], r(B);
955
- }, Ee = (s, T, z) => r(t.map((B, de) => de === s ? { ...B, children: { ...B.children, [T]: z } } : B)), ae = x ? c.find((s) => s.path.length === 0)?.message : void 0, bt = C.index >= 0 ? t[C.index] : void 0, ne = D?.index ?? -1, le = (s) => {
956
- O(null), s();
957
- }, ut = () => G(Object.fromEntries(t.map((s) => [s.key, !0]))), yt = () => G(Object.fromEntries(t.map((s) => [s.key, !1]))), se = t.length > 0 && t.every((s) => H(s.key)), ce = o.t("deleteMessage", { detail: $.detail ? o.t("deleteDetail", { detail: $.detail }) : "" }), [vt, De] = ce.includes("{title}") ? ce.split("{title}") : [ce, null];
958
- return /* @__PURE__ */ h(f, { "data-collection": e.id, sx: o.sx("root", { width: "100%", minWidth: 0 }), children: [
959
- /* @__PURE__ */ n(
960
- wn,
961
- {
962
- ui: o,
963
- count: t.length,
964
- required: g || (Number(e.min) || 0) > 0,
965
- alone: w && !ae,
966
- action: /* @__PURE__ */ h(f, { sx: { display: "flex", alignItems: "center", gap: 1, flexWrap: "wrap" }, children: [
967
- o.layout === "cards" && t.length >= 2 && /* @__PURE__ */ n(
968
- Z,
969
- {
970
- size: "small",
971
- variant: "text",
972
- onClick: se ? yt : ut,
973
- sx: {
974
- fontSize: 12.5,
975
- fontWeight: 600,
976
- color: "text.secondary",
977
- px: 1,
978
- minWidth: 0,
979
- textTransform: "none",
980
- "&:hover": { color: "text.primary", bgcolor: p(b.palette.text.primary, 0.05) }
981
- },
982
- startIcon: /* @__PURE__ */ n(j, { sx: { fontSize: "15px !important" }, children: se ? "unfold_more" : "unfold_less" }),
983
- children: se ? "Expand all" : "Collapse all"
984
- }
985
- ),
986
- W && /* @__PURE__ */ n(Xe, { ui: o, placement: "header", empty: t.length === 0, disabled: !k, onClick: L })
987
- ] })
988
- }
989
- ),
990
- ae && /* @__PURE__ */ h(
991
- R,
992
- {
993
- role: "alert",
994
- sx: o.sx("error", { display: "flex", alignItems: "center", gap: 0.5, color: "error.main", fontSize: 13, fontWeight: 500, mt: -0.5, mb: 1.25 }),
995
- children: [
996
- /* @__PURE__ */ n(j, { sx: { fontSize: "17px !important" }, children: "error_outline" }),
997
- ae
998
- ]
999
- }
1000
- ),
1001
- _ && /* @__PURE__ */ n(Cn, { ui: o, readOnly: l, error: !!ae }),
1002
- t.length > 0 && o.layout === "table" && /* @__PURE__ */ n(
1003
- In,
1004
- {
1005
- ui: o,
1006
- nodes: t,
1007
- guid: a,
1008
- readOnly: l,
1009
- issues: c,
1010
- showErrors: x,
1011
- texts: I,
1012
- isCollapsed: H,
1013
- onToggle: re,
1014
- onOpen: F,
1015
- onDelete: je,
1016
- onMenu: (s, T) => O({ anchor: s, index: T }),
1017
- onChildChange: Ee
1018
- }
1019
- ),
1020
- 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(
1021
- Tn,
1022
- {
1023
- ui: o,
1024
- node: s,
1025
- index: T,
1026
- guid: a,
1027
- readOnly: l,
1028
- collapsed: H(s.key),
1029
- issues: c.filter((z) => z.path[0] === T).map((z) => ({ ...z, path: z.path.slice(1) })),
1030
- showErrors: x,
1031
- texts: I,
1032
- onOpen: () => F(T),
1033
- onDelete: () => je(T),
1034
- onMenu: (z) => O({ anchor: z, index: T }),
1035
- onToggle: () => re(s.key),
1036
- onChildChange: (z, B) => Ee(T, z, B)
1037
- },
1038
- s.key
1039
- )) }),
1040
- P && /* @__PURE__ */ n(f, { sx: { mt: t.length || o.addButton.variant !== "dashed" ? 1.25 : 0 }, children: /* @__PURE__ */ n(Xe, { ui: o, placement: "footer", empty: t.length === 0, disabled: !k, onClick: L }) }),
1041
- /* @__PURE__ */ n(
1042
- kn,
1043
- {
1044
- ui: o,
1045
- open: C.open,
1046
- mode: C.mode,
1047
- session: C.session,
1048
- guid: `${a}-${e.id}`,
1049
- initial: bt?.data,
1050
- context: d,
1051
- onClose: u,
1052
- onSave: te
1053
- }
1054
- ),
1055
- /* @__PURE__ */ h(
1056
- Xt,
1057
- {
1058
- anchorEl: D?.anchor,
1059
- open: !!D,
1060
- onClose: () => O(null),
1061
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
1062
- transformOrigin: { vertical: "top", horizontal: "right" },
1063
- sx: { "& .MuiPaper-root": o.merged("menu", { borderRadius: "10px", minWidth: 170 }) },
1064
- children: [
1065
- o.actions.duplicate && /* @__PURE__ */ h(pe, { sx: o.sx("menuItem"), disabled: !k, onClick: () => le(() => gt(ne)), children: [
1066
- /* @__PURE__ */ n(xe, { children: /* @__PURE__ */ n(j, { fontSize: "small", children: "content_copy" }) }),
1067
- /* @__PURE__ */ n(me, { children: o.t("duplicate") })
1068
- ] }),
1069
- o.actions.move && /* @__PURE__ */ h(pe, { sx: o.sx("menuItem"), disabled: ne <= 0, onClick: () => le(() => We(ne, -1)), children: [
1070
- /* @__PURE__ */ n(xe, { children: /* @__PURE__ */ n(j, { fontSize: "small", children: "arrow_upward" }) }),
1071
- /* @__PURE__ */ n(me, { children: o.t("moveUp") })
1072
- ] }),
1073
- o.actions.move && /* @__PURE__ */ h(pe, { sx: o.sx("menuItem"), disabled: ne >= t.length - 1, onClick: () => le(() => We(ne, 1)), children: [
1074
- /* @__PURE__ */ n(xe, { children: /* @__PURE__ */ n(j, { fontSize: "small", children: "arrow_downward" }) }),
1075
- /* @__PURE__ */ n(me, { children: o.t("moveDown") })
1076
- ] })
1077
- ]
1078
- }
1079
- ),
1080
- /* @__PURE__ */ h(
1081
- at,
1082
- {
1083
- open: $.open,
1084
- onClose: () => E((s) => ({ ...s, open: !1 })),
1085
- maxWidth: "xs",
1086
- fullWidth: !0,
1087
- sx: { "& .MuiDialog-paper": o.merged("confirm", { borderRadius: "12px", backgroundImage: "none" }) },
1088
- children: [
1089
- /* @__PURE__ */ h(ot, { sx: { pt: 3, pb: 1 }, children: [
1090
- /* @__PURE__ */ n(R, { sx: o.sx("confirmTitle", { fontWeight: 600, fontSize: 17 }), children: o.t("deleteTitle") }),
1091
- /* @__PURE__ */ h(R, { sx: o.sx("confirmText", { fontSize: 14, color: "text.secondary", mt: 1 }), children: [
1092
- vt,
1093
- De !== null && /* @__PURE__ */ n(f, { component: "strong", sx: { color: "text.primary", fontWeight: 600 }, children: $.title }),
1094
- De
1095
- ] })
1096
- ] }),
1097
- /* @__PURE__ */ h(it, { sx: { px: 3, pb: 2.5, pt: 2, gap: 1, "& .MuiButton-root": { textTransform: "none", fontWeight: 600, borderRadius: "8px" } }, children: [
1098
- /* @__PURE__ */ n(Z, { color: "inherit", onClick: () => E((s) => ({ ...s, open: !1 })), sx: o.sx("confirmCancel", { color: "text.secondary" }), children: o.t("cancel") }),
1099
- /* @__PURE__ */ n(
1100
- Z,
1101
- {
1102
- variant: "contained",
1103
- color: "error",
1104
- disableElevation: !0,
1105
- onClick: () => {
1106
- qe($.index), E((s) => ({ ...s, open: !1 }));
1107
- },
1108
- sx: o.sx("confirmDelete"),
1109
- children: o.t("deleteConfirm")
1110
- }
1111
- )
1112
- ] })
1113
- ]
1114
- }
1115
- )
1116
- ] });
1117
- }
1118
- const zn = ["mandatory", "mandatoryselect"], we = (e) => {
1119
- try {
1120
- return JSON.stringify(e);
1121
- } catch {
1122
- return "";
1123
- }
1124
- };
1125
- function Wn({ attributes: e = {}, rules: t = {}, onChange: r, submitTick: a }) {
1126
- 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] = Y(ie), [y, b] = Y(() => Ie(l, c)), [o, v] = Y(!1), S = Je(we(Ae(l)));
1127
- Oe(() => {
1128
- const k = we(Ae(l));
1129
- k !== S.current && (S.current = k, b(Ie(l, c)));
1130
- }, [l]), Oe(() => {
1131
- a && v(!0);
1132
- }, [a]);
1133
- const I = (k) => {
1134
- b(k);
1135
- const M = ze(k, c);
1136
- S.current = we(M), r?.({ id: i, value: M });
1137
- }, A = Kt(ze(y, c), c, {
1138
- required: !!g,
1139
- requiredMessage: g?.message
1140
- });
1141
- return /* @__PURE__ */ n(
1142
- ft,
1143
- {
1144
- config: c,
1145
- nodes: y,
1146
- onChange: I,
1147
- guid: `${d}-${i}`,
1148
- readOnly: x,
1149
- issues: A,
1150
- showErrors: o,
1151
- required: !!g
1152
- }
1153
- );
1154
- }
1155
- export {
1156
- Wn as default
1157
- };