dynamic-mui 2.1.0 → 2.3.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/README.md +355 -37
- package/dist/accordion-DqBdGRim.mjs +23 -0
- package/dist/accordion-lvbD_BpX.js +1 -0
- package/dist/addressfield-CGX3UppE.mjs +152 -0
- package/dist/addressfield-DDG15fqJ.js +1 -0
- package/dist/asyncautocomplete-BAfBR9P7.mjs +89 -0
- package/dist/asyncautocomplete-w9q_1DWt.js +1 -0
- package/dist/bar-BzO7tvYJ.mjs +20 -0
- package/dist/bar-DEVxyUVS.js +1 -0
- package/dist/cascadeselect-C3QVfoig.mjs +64 -0
- package/dist/cascadeselect-DzbhK9en.js +1 -0
- package/dist/colorpicker-5qmEq7ZI.js +1 -0
- package/dist/colorpicker-DhNZulJY.mjs +98 -0
- package/dist/components/DynamicComponent.d.ts +2 -0
- package/dist/components/FormGenerator.d.ts +123 -2
- package/dist/components/controls/AsyncAutocomplete/asyncautocomplete.d.ts +9 -0
- package/dist/components/controls/CheckBox/checkbox.d.ts +1 -1
- package/dist/components/controls/ChipSelect/chipselect.d.ts +1 -1
- package/dist/components/controls/EditableTable/editabletable.d.ts +2 -0
- package/dist/components/controls/IntlPhone/intlphone.d.ts +2 -0
- package/dist/components/controls/LocationField/locationfield.d.ts +1 -1
- package/dist/components/controls/MultiTextbox/multitextbox.d.ts +1 -1
- package/dist/components/controls/NpsScale/npsscale.d.ts +3 -0
- package/dist/components/controls/NumberField/numberfield.d.ts +1 -1
- package/dist/components/controls/PasswordField/passwordfield.d.ts +1 -1
- package/dist/components/controls/Radio/radio.d.ts +1 -1
- package/dist/components/controls/RichTextEditor/richtexteditor.d.ts +3 -0
- package/dist/components/controls/Select/select.d.ts +1 -1
- package/dist/components/controls/Switch/switch.d.ts +1 -1
- package/dist/components/controls/TextField/textfield.d.ts +1 -1
- package/dist/components/controls/index.d.ts +45 -69
- package/dist/consentfield-B7Rm8d3U.js +1 -0
- package/dist/consentfield-CBQUR4J5.mjs +78 -0
- package/dist/datatable-BIQznwQe.mjs +20 -0
- package/dist/datatable-BWlcUP0M.js +1 -0
- package/dist/dynamic-mui.cjs +1 -0
- package/dist/dynamic-mui.mjs +32 -0
- package/dist/editabletable-DCoRmsEO.js +1 -0
- package/dist/editabletable-DRlBV8lk.mjs +126 -0
- package/dist/fileupload-ByBv1UjT.mjs +172 -0
- package/dist/fileupload-Cze3Oc_2.js +1 -0
- package/dist/formrepeater-BBkKGLFJ.mjs +71 -0
- package/dist/formrepeater-BxJzXoHx.js +1 -0
- package/dist/formwizard-BDZE1UDD.js +1 -0
- package/dist/formwizard-D2u1bMvK.mjs +83 -0
- package/dist/geofield-8WTeZk0Z.mjs +104 -0
- package/dist/geofield-Bw3p4NLJ.js +1 -0
- package/dist/group-B2mSylHd.mjs +23 -0
- package/dist/group-BlfO3ZZf.js +1 -0
- package/dist/imagelist-Bn9QhIv7.js +1 -0
- package/dist/imagelist-rqmJajHt.mjs +18 -0
- package/dist/index-CddjLTWF.mjs +12499 -0
- package/dist/index-D08GIfqF.js +43 -0
- package/dist/index.d.ts +11 -1
- package/dist/intlphone-B_Xn98pU.js +1 -0
- package/dist/intlphone-DtQZ12xk.mjs +140 -0
- package/dist/keyvaluefield-B_1NeGuP.mjs +125 -0
- package/dist/keyvaluefield-DyKCGd32.js +1 -0
- package/dist/line-B-DwR1hm.mjs +20 -0
- package/dist/line-BkymZu31.js +1 -0
- package/dist/lineitemlist-DGo8UOZC.js +1 -0
- package/dist/lineitemlist-vGKzJlQx.mjs +166 -0
- package/dist/list-7uNWrepS.mjs +20 -0
- package/dist/list-C0FgmtQw.js +1 -0
- package/dist/locationfield-CeUgxLkQ.mjs +119 -0
- package/dist/locationfield-Duyw1ZEz.js +1 -0
- package/dist/markdowneditor-B1y-hfny.mjs +90 -0
- package/dist/markdowneditor-Db0Un1_Z.js +2 -0
- package/dist/matrixfield-C7Sc-YpI.mjs +117 -0
- package/dist/matrixfield-CckODuPn.js +1 -0
- package/dist/mixChart-C3o184UT.js +1 -0
- package/dist/mixChart-ISf3Kbr-.mjs +75 -0
- package/dist/multitextbox-BYazIAeG.js +1 -0
- package/dist/multitextbox-ide2lvJ6.mjs +78 -0
- package/dist/npsscale-C2e88qk_.js +1 -0
- package/dist/npsscale-lndz7GEq.mjs +87 -0
- package/dist/numberstepper-DitbcvV9.mjs +128 -0
- package/dist/numberstepper-DyRjQM_K.js +1 -0
- package/dist/pie-CJSL8Sv5.js +1 -0
- package/dist/pie-CL29dlh5.mjs +20 -0
- package/dist/richtexteditor-CVg-MnKp.js +1 -0
- package/dist/richtexteditor-DsC1XC7h.mjs +141 -0
- package/dist/s3Upload-B0JeoLkS.js +1 -0
- package/dist/s3Upload-dpioZ2c8.mjs +51 -0
- package/dist/schema.d.ts +404 -0
- package/dist/signature-14OrZriO.mjs +1225 -0
- package/dist/signature-D582X6tB.js +2 -0
- package/dist/stepper-B-FpcZvT.js +1 -0
- package/dist/stepper-CDfEy_C6.mjs +140 -0
- package/dist/summaryfield-B08ZmVHh.js +1 -0
- package/dist/summaryfield-CTpPlZBG.mjs +96 -0
- package/dist/tabs-BIliqFOs.js +1 -0
- package/dist/tabs-DDeJCFt8.mjs +39 -0
- package/dist/tagsinput-D-q6rRZS.mjs +58 -0
- package/dist/tagsinput-qh_lhdFb.js +1 -0
- package/dist/types.d.ts +16 -0
- package/dist/util/registry.d.ts +29 -0
- package/dist/util/resolvers.d.ts +45 -0
- package/dist/util/useFormEngine.d.ts +74 -0
- package/dist/util/validateSchema.d.ts +23 -0
- package/dist/v4-BysszJq8.mjs +30 -0
- package/dist/v4-CqdK_b8Y.js +1 -0
- package/package.json +36 -11
- package/dist/XmlShapeDeserializer-3yQdm0b0.mjs +0 -237
- package/dist/XmlShapeDeserializer-XKJAoqLc.js +0 -1
- package/dist/date-utils-CFUUt6NL.js +0 -4
- package/dist/date-utils-pGzaKb0p.mjs +0 -477
- package/dist/dynamic-mui.cjs.js +0 -469
- package/dist/dynamic-mui.es.js +0 -102550
- package/dist/index-BW8_rRff.js +0 -7
- package/dist/index-BXFVK_GX.js +0 -1
- package/dist/index-CVqLvm8B.js +0 -1
- package/dist/index-Cr6Wp_S-.mjs +0 -3141
- package/dist/index-DA0XouZs.mjs +0 -153
- package/dist/index-DKS5Sz9e.js +0 -14
- package/dist/index-DcWfyXJp.mjs +0 -92
- package/dist/index-MllWgTJ5.mjs +0 -9372
- package/dist/index.browser-BSu11T_q.mjs +0 -363
- package/dist/index.browser-By7-GABP.js +0 -4
- package/dist/loadCognitoIdentity-DtYTy-DW.js +0 -1
- package/dist/loadCognitoIdentity-DzdR91GB.mjs +0 -872
- package/dist/loadSts-Cic6UToN.mjs +0 -593
- package/dist/loadSts-csbFP6zX.js +0 -1
- package/dist/main.d.ts +0 -1
- package/dist/noAuth-B8ui2kBg.mjs +0 -71
- package/dist/noAuth-JPA2o4dt.js +0 -1
- package/dist/playground/AIContext.d.ts +0 -18
- package/dist/playground/AIPanel.d.ts +0 -10
- package/dist/playground/Builder.d.ts +0 -1
- package/dist/playground/Canvas.d.ts +0 -9
- package/dist/playground/PropertiesEditor.d.ts +0 -10
- package/dist/playground/Sidebar.d.ts +0 -1
- package/dist/playground/documentation.d.ts +0 -6
- package/dist/playground/templates.d.ts +0 -7
- package/dist/playground/testData.d.ts +0 -2
- package/dist/test/setup.d.ts +0 -0
- package/dist/theme/theme.d.ts +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx as c, jsxs as F, Fragment as K } from "react/jsx-runtime";
|
|
2
|
+
import { useState as f, useRef as y, useEffect as L, createElement as M } from "react";
|
|
3
|
+
import _ from "@mui/material/Autocomplete";
|
|
4
|
+
import k from "@mui/material/TextField";
|
|
5
|
+
import z from "@mui/material/CircularProgress";
|
|
6
|
+
import { u as V, a as w } from "./index-CddjLTWF.mjs";
|
|
7
|
+
function Q({ attributes: t = {}, rules: v = {}, onChange: A }) {
|
|
8
|
+
const {
|
|
9
|
+
MuiAttributes: C = {},
|
|
10
|
+
id: x = "",
|
|
11
|
+
label: I = "Search",
|
|
12
|
+
placeholder: O = "",
|
|
13
|
+
minChars: S = 1,
|
|
14
|
+
debounceMs: q = 300,
|
|
15
|
+
labelKey: P = "label",
|
|
16
|
+
valueKey: p = "value",
|
|
17
|
+
loadOptions: m,
|
|
18
|
+
optionsUrl: s
|
|
19
|
+
} = t, [T, d] = f(t.value ?? null), [b, a] = f([]), [h, o] = f(!1), u = y(0), r = y(null);
|
|
20
|
+
V(() => {
|
|
21
|
+
d(t.value ?? null);
|
|
22
|
+
}, [t.value]), L(() => () => {
|
|
23
|
+
r.current && clearTimeout(r.current);
|
|
24
|
+
}, []);
|
|
25
|
+
const j = async (e) => {
|
|
26
|
+
if (typeof m == "function")
|
|
27
|
+
return m(e);
|
|
28
|
+
if (s) {
|
|
29
|
+
const n = `${s}${s.includes("?") ? "&" : "?"}q=${encodeURIComponent(e)}`, g = await (await fetch(n)).json();
|
|
30
|
+
return Array.isArray(g) ? g : [];
|
|
31
|
+
}
|
|
32
|
+
return [];
|
|
33
|
+
}, E = (e) => {
|
|
34
|
+
const n = ++u.current;
|
|
35
|
+
o(!0), j(e).then((i) => {
|
|
36
|
+
n === u.current && (a(Array.isArray(i) ? i : []), o(!1));
|
|
37
|
+
}).catch(() => {
|
|
38
|
+
n === u.current && (a([]), o(!1));
|
|
39
|
+
});
|
|
40
|
+
}, R = (e, n) => {
|
|
41
|
+
if (r.current && clearTimeout(r.current), !n || n.length < S) {
|
|
42
|
+
u.current++, o(!1), a([]);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
r.current = setTimeout(() => {
|
|
46
|
+
E(n);
|
|
47
|
+
}, q);
|
|
48
|
+
}, U = (e, n) => {
|
|
49
|
+
d(n), A?.({
|
|
50
|
+
id: x,
|
|
51
|
+
value: n != null ? n?.[p] ?? n : n,
|
|
52
|
+
option: n
|
|
53
|
+
});
|
|
54
|
+
}, l = (e) => typeof e == "string" ? e : e?.[P] ?? "", $ = !!v?.validation?.some((e) => e.rule === "mandatory");
|
|
55
|
+
return /* @__PURE__ */ c(
|
|
56
|
+
_,
|
|
57
|
+
{
|
|
58
|
+
value: T,
|
|
59
|
+
onChange: U,
|
|
60
|
+
onInputChange: R,
|
|
61
|
+
options: b,
|
|
62
|
+
loading: h,
|
|
63
|
+
filterOptions: (e) => e,
|
|
64
|
+
getOptionLabel: l,
|
|
65
|
+
renderOption: (e, n) => /* @__PURE__ */ M("li", { ...e, key: (n && n[p]) ?? l(n) }, l(n)),
|
|
66
|
+
...C,
|
|
67
|
+
renderInput: (e) => /* @__PURE__ */ c(
|
|
68
|
+
k,
|
|
69
|
+
{
|
|
70
|
+
...e,
|
|
71
|
+
label: I,
|
|
72
|
+
placeholder: O,
|
|
73
|
+
required: $,
|
|
74
|
+
sx: w,
|
|
75
|
+
InputProps: {
|
|
76
|
+
...e.InputProps,
|
|
77
|
+
endAdornment: /* @__PURE__ */ F(K, { children: [
|
|
78
|
+
h ? /* @__PURE__ */ c(z, { color: "inherit", size: 20 }) : null,
|
|
79
|
+
e.InputProps.endAdornment
|
|
80
|
+
] })
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
Q as default
|
|
89
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),t=require("react"),$=require("@mui/material/Autocomplete"),F=require("@mui/material/TextField"),K=require("@mui/material/CircularProgress"),y=require("./index-D08GIfqF.js");function L({attributes:o={},rules:v={},onChange:q}){const{MuiAttributes:A={},id:x="",label:S="Search",placeholder:j="",minChars:C=1,debounceMs:O=300,labelKey:I="label",valueKey:d="value",loadOptions:p,optionsUrl:a}=o,[R,h]=t.useState(o.value??null),[b,i]=t.useState([]),[m,s]=t.useState(!1),c=t.useRef(0),r=t.useRef(null);y.useUpdateEffect(()=>{h(o.value??null)},[o.value]),t.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]);const P=async e=>{if(typeof p=="function")return p(e);if(a){const n=`${a}${a.includes("?")?"&":"?"}q=${encodeURIComponent(e)}`,g=await(await fetch(n)).json();return Array.isArray(g)?g:[]}return[]},T=e=>{const n=++c.current;s(!0),P(e).then(f=>{n===c.current&&(i(Array.isArray(f)?f:[]),s(!1))}).catch(()=>{n===c.current&&(i([]),s(!1))})},E=(e,n)=>{if(r.current&&clearTimeout(r.current),!n||n.length<C){c.current++,s(!1),i([]);return}r.current=setTimeout(()=>{T(n)},O)},M=(e,n)=>{h(n),q?.({id:x,value:n!=null?n?.[d]??n:n,option:n})},l=e=>typeof e=="string"?e:e?.[I]??"",U=!!v?.validation?.some(e=>e.rule==="mandatory");return u.jsx($,{value:R,onChange:M,onInputChange:E,options:b,loading:m,filterOptions:e=>e,getOptionLabel:l,renderOption:(e,n)=>t.createElement("li",{...e,key:(n&&n[d])??l(n)},l(n)),...A,renderInput:e=>u.jsx(F,{...e,label:S,placeholder:j,required:U,sx:y.premiumInputSx,InputProps:{...e.InputProps,endAdornment:u.jsxs(u.Fragment,{children:[m?u.jsx(K,{color:"inherit",size:20}):null,e.InputProps.endAdornment]})}})})}exports.default=L;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import a, { Suspense as i } from "react";
|
|
3
|
+
import n from "@mui/material/Box";
|
|
4
|
+
import s from "@mui/material/CircularProgress";
|
|
5
|
+
const f = a.lazy(
|
|
6
|
+
() => import("@mui/x-charts/BarChart").then((t) => ({ default: t.BarChart }))
|
|
7
|
+
);
|
|
8
|
+
function u({ attributes: t = {} }) {
|
|
9
|
+
const { MuiChartAttributes: e = {}, id: o = "" } = t;
|
|
10
|
+
return /* @__PURE__ */ r(
|
|
11
|
+
i,
|
|
12
|
+
{
|
|
13
|
+
fallback: /* @__PURE__ */ r(n, { sx: { display: "flex", justifyContent: "center", p: 2 }, children: /* @__PURE__ */ r(s, {}) }),
|
|
14
|
+
children: /* @__PURE__ */ r(f, { height: 300, ...e }, o)
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
u as default
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var c=Object.create;var u=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var x=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of l(t))!h.call(e,s)&&s!==r&&u(e,s,{get:()=>t[s],enumerable:!(n=o(t,s))||n.enumerable});return e};var f=(e,t,r)=>(r=e!=null?c(d(e)):{},x(t||!e||!e.__esModule?u(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),a=require("react"),j=require("@mui/material/Box"),p=require("@mui/material/CircularProgress"),y=a.lazy(()=>import("@mui/x-charts/BarChart").then(e=>({default:e.BarChart})));function C({attributes:e={}}){const{MuiChartAttributes:t={},id:r=""}=e;return i.jsx(a.Suspense,{fallback:i.jsx(j,{sx:{display:"flex",justifyContent:"center",p:2},children:i.jsx(p,{})}),children:i.jsx(y,{height:300,...t},r)})}exports.default=C;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsxs as C, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import x, { useCallback as E } from "react";
|
|
3
|
+
import I from "@mui/material/TextField";
|
|
4
|
+
import S from "@mui/material/MenuItem";
|
|
5
|
+
import { u as y, m as O, a as P } from "./index-CddjLTWF.mjs";
|
|
6
|
+
const R = (a) => Array.isArray(a) ? a.map(
|
|
7
|
+
(e) => e != null && typeof e == "object" ? { value: e.value, label: e.label ?? e.title ?? String(e.value) } : { value: e, label: String(e) }
|
|
8
|
+
) : [], h = (a, e, t) => {
|
|
9
|
+
const r = a && e != null && e !== "" ? a[e] : void 0;
|
|
10
|
+
return R(r ?? t ?? []);
|
|
11
|
+
};
|
|
12
|
+
function U({ attributes: a = {}, rules: e = {}, onChange: t }) {
|
|
13
|
+
const {
|
|
14
|
+
id: r = "",
|
|
15
|
+
parentValue: s,
|
|
16
|
+
optionsMap: o,
|
|
17
|
+
options: i,
|
|
18
|
+
label: v = "",
|
|
19
|
+
placeholder: c = "",
|
|
20
|
+
MuiAttributes: f = {}
|
|
21
|
+
} = a, b = e?.validation?.some(
|
|
22
|
+
(l) => l.rule === "mandatory" || l.rule === "mandatoryselect"
|
|
23
|
+
) || !1, [m, g] = x.useState(
|
|
24
|
+
() => h(o, s, i)
|
|
25
|
+
), [n, d] = x.useState(() => a?.value ?? "");
|
|
26
|
+
y(() => {
|
|
27
|
+
d(a?.value ?? "");
|
|
28
|
+
}, [a?.value]), y(() => {
|
|
29
|
+
const l = h(o, s, i);
|
|
30
|
+
g(l), n !== "" && n != null && !l.some((u) => u.value === n) && (d(""), t?.({ id: r, value: "", option: null }));
|
|
31
|
+
}, [s, o, i]);
|
|
32
|
+
const M = E(
|
|
33
|
+
(l) => {
|
|
34
|
+
const u = l.target.value, j = m.find((A) => A.value === u) ?? null;
|
|
35
|
+
d(u), t?.({ id: r, value: u, option: j });
|
|
36
|
+
},
|
|
37
|
+
[m, r, t]
|
|
38
|
+
);
|
|
39
|
+
return /* @__PURE__ */ C(
|
|
40
|
+
I,
|
|
41
|
+
{
|
|
42
|
+
select: !0,
|
|
43
|
+
fullWidth: !0,
|
|
44
|
+
label: v,
|
|
45
|
+
placeholder: c,
|
|
46
|
+
required: b,
|
|
47
|
+
value: n ?? "",
|
|
48
|
+
onChange: M,
|
|
49
|
+
SelectProps: {
|
|
50
|
+
displayEmpty: !0,
|
|
51
|
+
inputProps: { "aria-label": v || "cascade-select" }
|
|
52
|
+
},
|
|
53
|
+
...f,
|
|
54
|
+
sx: O(P, f?.sx),
|
|
55
|
+
children: [
|
|
56
|
+
c ? /* @__PURE__ */ p(S, { value: "", children: /* @__PURE__ */ p("em", { children: c }) }) : null,
|
|
57
|
+
m.map((l) => /* @__PURE__ */ p(S, { value: l.value, children: l.label }, String(l.value)))
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
U as default
|
|
64
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),f=require("react"),A=require("@mui/material/TextField"),y=require("@mui/material/MenuItem"),i=require("./index-D08GIfqF.js"),E=t=>Array.isArray(t)?t.map(e=>e!=null&&typeof e=="object"?{value:e.value,label:e.label??e.title??String(e.value)}:{value:e,label:String(e)}):[],b=(t,e,a)=>{const u=t&&e!=null&&e!==""?t[e]:void 0;return E(u??a??[])};function O({attributes:t={},rules:e={},onChange:a}){const{id:u="",parentValue:c,optionsMap:o,options:d,label:x="",placeholder:v="",MuiAttributes:S={}}=t,g=e?.validation?.some(l=>l.rule==="mandatory"||l.rule==="mandatoryselect")||!1,[p,h]=f.useState(()=>b(o,c,d)),[r,m]=f.useState(()=>t?.value??"");i.useUpdateEffect(()=>{m(t?.value??"")},[t?.value]),i.useUpdateEffect(()=>{const l=b(o,c,d);h(l),r!==""&&r!=null&&!l.some(n=>n.value===r)&&(m(""),a?.({id:u,value:"",option:null}))},[c,o,d]);const j=f.useCallback(l=>{const n=l.target.value,q=p.find(M=>M.value===n)??null;m(n),a?.({id:u,value:n,option:q})},[p,u,a]);return s.jsxs(A,{select:!0,fullWidth:!0,label:x,placeholder:v,required:g,value:r??"",onChange:j,SelectProps:{displayEmpty:!0,inputProps:{"aria-label":x||"cascade-select"}},...S,sx:i.mergeSx(i.premiumInputSx,S?.sx),children:[v?s.jsx(y,{value:"",children:s.jsx("em",{children:v})}):null,p.map(l=>s.jsx(y,{value:l.value,children:l.label},String(l.value)))]})}exports.default=O;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),k=require("react"),p=require("@mui/material/Box"),x=require("@mui/material/Stack"),C=require("@mui/material/TextField"),$=require("@mui/material/FormControl"),A=require("@mui/material/FormLabel"),n=require("@mui/material/styles"),l=require("./index-D08GIfqF.js"),h="#000000";function R({attributes:t={},rules:m={},onChange:b}){const{id:u="",label:o,presets:s=[],MuiAttributes:g={}}=t,{sx:y,...f}=g,[a,d]=k.useState(t.value||h);l.useUpdateEffect(()=>{d(t.value||h)},[t.value]);const v=m?.validation?.some(e=>e.rule==="mandatory"||e.rule==="mandatoryselect")||!1,c=e=>{d(e),b?.({id:u,value:e})},S=e=>{c(e.target.value)},w=e=>{c(e.target.value)},j=e=>{c(e)},q={width:44,height:44,borderRadius:"10px",border:e=>`1px solid ${n.alpha(e.palette.text.primary,.2)}`,boxShadow:e=>`0 2px 8px ${n.alpha(e.palette.common.black,.12)}`,cursor:"pointer",flexShrink:0,position:"relative",overflow:"hidden"};return r.jsxs($,{required:v,component:"fieldset",fullWidth:!0,children:[o&&r.jsx(A,{component:"legend",children:o}),r.jsxs(x,{direction:"row",spacing:1.5,alignItems:"center",sx:{mt:o?1:0},children:[r.jsx(p,{sx:{...q,backgroundColor:a},children:r.jsx("input",{type:"color","aria-label":o?`${o} colour`:"colour",value:a,onChange:S,...f,style:{position:"absolute",inset:0,width:"100%",height:"100%",opacity:0,border:"none",padding:0,cursor:"pointer"}})}),r.jsx(C,{id:u||void 0,value:a,onChange:w,size:"small",label:"Hex",inputProps:{"aria-label":"hex value"},sx:l.mergeSx(l.premiumInputSx,l.mergeSx({maxWidth:160},y))})]}),Array.isArray(s)&&s.length>0&&r.jsx(x,{direction:"row",spacing:1,sx:{mt:1.5,flexWrap:"wrap",rowGap:1},children:s.map(e=>r.jsx(p,{role:"button","aria-label":`preset ${e}`,onClick:()=>j(e),sx:{width:26,height:26,borderRadius:"8px",backgroundColor:e,cursor:"pointer",flexShrink:0,border:i=>a===e?`2px solid ${i.palette.primary.main}`:`1px solid ${n.alpha(i.palette.text.primary,.2)}`,boxShadow:i=>`0 1px 4px ${n.alpha(i.palette.common.black,.12)}`}},e))})]})}exports.default=R;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import $ from "react";
|
|
3
|
+
import m from "@mui/material/Box";
|
|
4
|
+
import u from "@mui/material/Stack";
|
|
5
|
+
import A from "@mui/material/TextField";
|
|
6
|
+
import F from "@mui/material/FormControl";
|
|
7
|
+
import I from "@mui/material/FormLabel";
|
|
8
|
+
import { alpha as l } from "@mui/material/styles";
|
|
9
|
+
import { u as R, m as x, a as B } from "./index-CddjLTWF.mjs";
|
|
10
|
+
const h = "#000000";
|
|
11
|
+
function q({ attributes: t = {}, rules: f = {}, onChange: b }) {
|
|
12
|
+
const { id: p = "", label: r, presets: n = [], MuiAttributes: g = {} } = t, { sx: w, ...v } = g, [a, d] = $.useState(
|
|
13
|
+
t.value || h
|
|
14
|
+
);
|
|
15
|
+
R(() => {
|
|
16
|
+
d(t.value || h);
|
|
17
|
+
}, [t.value]);
|
|
18
|
+
const y = f?.validation?.some(
|
|
19
|
+
(o) => o.rule === "mandatory" || o.rule === "mandatoryselect"
|
|
20
|
+
) || !1, s = (o) => {
|
|
21
|
+
d(o), b?.({ id: p, value: o });
|
|
22
|
+
}, k = (o) => {
|
|
23
|
+
s(o.target.value);
|
|
24
|
+
}, C = (o) => {
|
|
25
|
+
s(o.target.value);
|
|
26
|
+
}, S = (o) => {
|
|
27
|
+
s(o);
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ c(F, { required: y, component: "fieldset", fullWidth: !0, children: [
|
|
30
|
+
r && /* @__PURE__ */ e(I, { component: "legend", children: r }),
|
|
31
|
+
/* @__PURE__ */ c(u, { direction: "row", spacing: 1.5, alignItems: "center", sx: { mt: r ? 1 : 0 }, children: [
|
|
32
|
+
/* @__PURE__ */ e(m, { sx: { ...{
|
|
33
|
+
width: 44,
|
|
34
|
+
height: 44,
|
|
35
|
+
borderRadius: "10px",
|
|
36
|
+
border: (o) => `1px solid ${l(o.palette.text.primary, 0.2)}`,
|
|
37
|
+
boxShadow: (o) => `0 2px 8px ${l(o.palette.common.black, 0.12)}`,
|
|
38
|
+
cursor: "pointer",
|
|
39
|
+
flexShrink: 0,
|
|
40
|
+
position: "relative",
|
|
41
|
+
overflow: "hidden"
|
|
42
|
+
}, backgroundColor: a }, children: /* @__PURE__ */ e(
|
|
43
|
+
"input",
|
|
44
|
+
{
|
|
45
|
+
type: "color",
|
|
46
|
+
"aria-label": r ? `${r} colour` : "colour",
|
|
47
|
+
value: a,
|
|
48
|
+
onChange: k,
|
|
49
|
+
...v,
|
|
50
|
+
style: {
|
|
51
|
+
position: "absolute",
|
|
52
|
+
inset: 0,
|
|
53
|
+
width: "100%",
|
|
54
|
+
height: "100%",
|
|
55
|
+
opacity: 0,
|
|
56
|
+
border: "none",
|
|
57
|
+
padding: 0,
|
|
58
|
+
cursor: "pointer"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
) }),
|
|
62
|
+
/* @__PURE__ */ e(
|
|
63
|
+
A,
|
|
64
|
+
{
|
|
65
|
+
id: p || void 0,
|
|
66
|
+
value: a,
|
|
67
|
+
onChange: C,
|
|
68
|
+
size: "small",
|
|
69
|
+
label: "Hex",
|
|
70
|
+
inputProps: { "aria-label": "hex value" },
|
|
71
|
+
sx: x(B, x({ maxWidth: 160 }, w))
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] }),
|
|
75
|
+
Array.isArray(n) && n.length > 0 && /* @__PURE__ */ e(u, { direction: "row", spacing: 1, sx: { mt: 1.5, flexWrap: "wrap", rowGap: 1 }, children: n.map((o) => /* @__PURE__ */ e(
|
|
76
|
+
m,
|
|
77
|
+
{
|
|
78
|
+
role: "button",
|
|
79
|
+
"aria-label": `preset ${o}`,
|
|
80
|
+
onClick: () => S(o),
|
|
81
|
+
sx: {
|
|
82
|
+
width: 26,
|
|
83
|
+
height: 26,
|
|
84
|
+
borderRadius: "8px",
|
|
85
|
+
backgroundColor: o,
|
|
86
|
+
cursor: "pointer",
|
|
87
|
+
flexShrink: 0,
|
|
88
|
+
border: (i) => a === o ? `2px solid ${i.palette.primary.main}` : `1px solid ${l(i.palette.text.primary, 0.2)}`,
|
|
89
|
+
boxShadow: (i) => `0 1px 4px ${l(i.palette.common.black, 0.12)}`
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
o
|
|
93
|
+
)) })
|
|
94
|
+
] });
|
|
95
|
+
}
|
|
96
|
+
export {
|
|
97
|
+
q as default
|
|
98
|
+
};
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { GridProps } from '@mui/material';
|
|
3
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
4
|
import { FormField } from '../util/helper';
|
|
4
|
-
|
|
5
|
+
import { FormResolver } from '../util/resolvers';
|
|
6
|
+
export declare const FormData: <T = any>(id?: string) => T;
|
|
5
7
|
export declare const ClearFormData: (id?: string) => void;
|
|
8
|
+
/** Convenience accessor for a form's stored values (imperative; pairs with `guid`).
|
|
9
|
+
* Pass a values type for autocomplete: `useForm<MyValues>(guid)`. */
|
|
10
|
+
export declare const useForm: <T = Record<string, any>>(guid: string) => {
|
|
11
|
+
getValues: () => T;
|
|
12
|
+
clear: () => void;
|
|
13
|
+
};
|
|
6
14
|
export interface FormGeneratorProps {
|
|
7
15
|
/** Component unique identifier */
|
|
8
16
|
guid: string;
|
|
@@ -46,5 +54,118 @@ export interface FormGeneratorProps {
|
|
|
46
54
|
autoSaveKey?: string;
|
|
47
55
|
/** Which browser storage to use for auto-save (default 'local'). */
|
|
48
56
|
autoSaveStorage?: 'local' | 'session';
|
|
57
|
+
/** Imperative API — getValues/getErrors/validate/reset/setValues/submit. */
|
|
58
|
+
apiRef?: React.Ref<FormApi<any>>;
|
|
59
|
+
/** Localizable default messages (e.g. { required: 'Champ obligatoire' }). */
|
|
60
|
+
messages?: FormMessages;
|
|
61
|
+
/** Translate every user-facing string (labels, placeholders, helper text,
|
|
62
|
+
* option labels, validation messages, typography, submit/cancel labels).
|
|
63
|
+
* Plug in any i18n: `translate={(s) => dictionary[s] ?? s}`. */
|
|
64
|
+
translate?: (text: string) => string;
|
|
65
|
+
/** Show a visible validation summary above the form after a failed submit. */
|
|
66
|
+
validationSummary?: boolean;
|
|
67
|
+
/** Validate the whole form against a schema resolver (see `zodResolver` /
|
|
68
|
+
* `yupResolver`). Its errors merge with per-field `rules.validation` and
|
|
69
|
+
* appear in `onSubmit`, the validation summary, and `apiRef.getErrors()`. */
|
|
70
|
+
resolver?: FormResolver;
|
|
71
|
+
/** Per-field async (remote) validators, keyed by field id — e.g. an
|
|
72
|
+
* "is this username taken?" server check. Each returns an error message
|
|
73
|
+
* (string) or a falsy value when valid. Runs debounced on change with a
|
|
74
|
+
* pending / valid / invalid indicator, and blocks submit while pending or
|
|
75
|
+
* invalid. */
|
|
76
|
+
asyncValidators?: Record<string, AsyncValidator>;
|
|
77
|
+
/** Render every control disabled (non-editable) while keeping the form layout. */
|
|
78
|
+
readOnly?: boolean;
|
|
79
|
+
/** Warn the user (native beforeunload prompt) when they try to leave the page
|
|
80
|
+
* with unsaved edits — i.e. while the form is dirty. */
|
|
81
|
+
warnOnUnsavedChanges?: boolean;
|
|
82
|
+
/** Render a visible submit button with this label (runs the same submit flow).
|
|
83
|
+
* When omitted, no visible submit button is rendered (external/apiRef submit).
|
|
84
|
+
* Shortcut for `submitButton: { label }`. */
|
|
85
|
+
submitLabel?: string;
|
|
86
|
+
/** Fully configure the visible submit button — colour, icon, loader, variant.
|
|
87
|
+
* Takes precedence over `submitLabel`. */
|
|
88
|
+
submitButton?: SubmitButtonConfig;
|
|
89
|
+
/** Make the submit bar stick to the bottom of the scroll area. */
|
|
90
|
+
stickySubmit?: boolean;
|
|
91
|
+
/** Optional cancel/secondary action shown beside submit. */
|
|
92
|
+
cancelLabel?: string;
|
|
93
|
+
/** Handler for the cancel button. */
|
|
94
|
+
onCancel?: () => void;
|
|
95
|
+
/**
|
|
96
|
+
* Render the form as a clean read-only SUMMARY of its current values
|
|
97
|
+
* (label → value), instead of input controls. Respects `visibleWhen`,
|
|
98
|
+
* resolves option labels/booleans/dates, and follows matching subforms.
|
|
99
|
+
*/
|
|
100
|
+
reviewMode?: boolean;
|
|
101
|
+
}
|
|
102
|
+
/** Localizable built-in strings. */
|
|
103
|
+
export interface FormMessages {
|
|
104
|
+
required?: string;
|
|
105
|
+
/** "{n} error(s) found" summary prefix; `{n}` is replaced with the count. */
|
|
106
|
+
errorSummary?: string;
|
|
107
|
+
}
|
|
108
|
+
/** Declarative styling/behaviour for the visible submit button. */
|
|
109
|
+
export interface SubmitButtonConfig {
|
|
110
|
+
/** Button text. */
|
|
111
|
+
label?: string;
|
|
112
|
+
/** MUI theme palette colour, or any CSS colour string for a custom fill. */
|
|
113
|
+
color?: 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info' | 'inherit' | string;
|
|
114
|
+
/** Two-colour gradient `[from, to]` for the button background (overrides `color`). */
|
|
115
|
+
gradient?: [string, string];
|
|
116
|
+
/** Leading Material icon name (e.g. `send`, `save`). */
|
|
117
|
+
icon?: string;
|
|
118
|
+
/** Trailing Material icon name. */
|
|
119
|
+
endIcon?: string;
|
|
120
|
+
/** MUI button variant. */
|
|
121
|
+
variant?: 'contained' | 'outlined' | 'text';
|
|
122
|
+
/** Show a spinner and disable the button. Also driven automatically while an
|
|
123
|
+
* async `onSubmit` (one that returns a Promise) is pending. */
|
|
124
|
+
loading?: boolean;
|
|
125
|
+
/** Text shown while loading (defaults to the label). */
|
|
126
|
+
loadingLabel?: string;
|
|
127
|
+
/** Stretch the button to the full width of the bar. */
|
|
128
|
+
fullWidth?: boolean;
|
|
129
|
+
/** Extra styles merged onto the button. */
|
|
130
|
+
sx?: SxProps<Theme>;
|
|
131
|
+
}
|
|
132
|
+
/** An async field validator: resolves to an error message when invalid, or a
|
|
133
|
+
* falsy value when valid. Receives the field's value and all current values. */
|
|
134
|
+
export type AsyncValidator = (value: any, values: Record<string, any>) => Promise<string | null | undefined | false>;
|
|
135
|
+
/** Imperative handle exposed via `apiRef`. Pass a values type for full
|
|
136
|
+
* autocomplete: `useRef<FormApi<MyValues>>(null)`. */
|
|
137
|
+
export interface FormApi<T = Record<string, any>> {
|
|
138
|
+
/** Current values for this form. */
|
|
139
|
+
getValues: () => T;
|
|
140
|
+
/** Run validation now and return the errors (also displays them). */
|
|
141
|
+
getErrors: () => any[];
|
|
142
|
+
/** Alias of getErrors that returns whether the form is valid. */
|
|
143
|
+
validate: () => boolean;
|
|
144
|
+
/** Merge values into the form and re-render. */
|
|
145
|
+
setValues: (values: Partial<T>) => void;
|
|
146
|
+
/** Clear this form's stored values. */
|
|
147
|
+
reset: () => void;
|
|
148
|
+
/** The values the form started with (initial patch/schema snapshot). */
|
|
149
|
+
getInitialValues: () => T;
|
|
150
|
+
/** True when the current values differ from the initial snapshot. */
|
|
151
|
+
isDirty: () => boolean;
|
|
152
|
+
/** Restore the values to the initial snapshot (undo all edits). */
|
|
153
|
+
resetToInitial: () => void;
|
|
154
|
+
/** Adopt the current values as the new "clean" baseline (e.g. after a save),
|
|
155
|
+
* so `isDirty()` reports false until the next edit. */
|
|
156
|
+
markPristine: () => void;
|
|
157
|
+
/** Programmatically submit (runs the same flow as the submit button). */
|
|
158
|
+
submit: () => void;
|
|
159
|
+
/** Open the browser print dialog for a clean summary of the current values
|
|
160
|
+
* (the same "review" layout). Users can also "Save as PDF" from there. */
|
|
161
|
+
print: (options?: {
|
|
162
|
+
title?: string;
|
|
163
|
+
}) => void;
|
|
164
|
+
/** Download a PDF of the current values. Requires the optional `pdfmake`
|
|
165
|
+
* package (`npm i pdfmake`); lazy-loaded, so it never bloats the bundle. */
|
|
166
|
+
exportPdf: (options?: {
|
|
167
|
+
title?: string;
|
|
168
|
+
filename?: string;
|
|
169
|
+
}) => Promise<void>;
|
|
49
170
|
}
|
|
50
|
-
export declare function FormGenerator({ data, patch, guid, formRef, onSubmit, onChange, onStepChange, MuiGridAttributes, activeStep, onFieldClick, onFieldDoubleClick, onFieldContextMenu, persistOnUnmount, autoSave, autoSaveKey, autoSaveStorage, }: FormGeneratorProps): import("react/jsx-runtime").JSX.Element;
|
|
171
|
+
export declare function FormGenerator({ data, patch, guid, formRef, onSubmit, onChange, onStepChange, MuiGridAttributes, activeStep, onFieldClick, onFieldDoubleClick, onFieldContextMenu, persistOnUnmount, autoSave, autoSaveKey, autoSaveStorage, apiRef, messages, validationSummary, resolver, asyncValidators, readOnly, reviewMode, warnOnUnsavedChanges, submitLabel, submitButton, stickySubmit, cancelLabel, onCancel, translate, }: FormGeneratorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ControlProps } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* AsyncAutocomplete — an MUI `Autocomplete` whose options are loaded
|
|
4
|
+
* asynchronously as the user types (server-side search). Client-side filtering
|
|
5
|
+
* is disabled; options come from `loadOptions(query)` or by fetching
|
|
6
|
+
* `optionsUrl` with a `q` query param. Requests are debounced and guarded
|
|
7
|
+
* against out-of-order responses.
|
|
8
|
+
*/
|
|
9
|
+
export default function AsyncAutocomplete({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
2
|
/** Playground Component */
|
|
3
|
-
export default function CheckBox({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default function CheckBox({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
2
|
/** Premium selectable-chip control supporting single and multi select. */
|
|
3
|
-
export default function ChipSelect({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default function ChipSelect({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
|
-
export default function LocationField({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function LocationField({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
|
-
export default function MultiTextbox({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function MultiTextbox({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ControlProps } from '../../../types';
|
|
2
|
+
/** NpsScale Component — a horizontal 0..N rating scale (Net Promoter Score style). */
|
|
3
|
+
export default function NpsScale({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
|
-
export default function NumberField({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function NumberField({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
|
-
export default function PasswordField({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function PasswordField({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
2
|
/** Radio Component */
|
|
3
|
-
export default function Radio({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default function Radio({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
|
-
export default function Select({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function Select({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
2
|
/** Switch Component */
|
|
3
|
-
export default function Switch({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default function Switch({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ControlProps } from '../../../types';
|
|
2
|
-
export default function TextField({ attributes, rules, onChange }: ControlProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function TextField({ attributes, rules, onChange, submitTick, messages }: ControlProps): import("react/jsx-runtime").JSX.Element;
|