@micromerce/formbuilder-react 1.0.542 → 1.0.544
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/formbuilder.js +1 -1
- package/dist/formbuilder.js.map +1 -1
- package/package.json +1 -1
package/dist/formbuilder.js
CHANGED
@@ -663,5 +663,5 @@ ${e=>e["data-disabled"]&&Ob`pointer-events: none;`}
|
|
663
663
|
padding-right: 10px;
|
664
664
|
margin: 10px 0 20px;
|
665
665
|
`}
|
666
|
-
`;class WF extends r.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){console.error("Uncaught error:",e,t)}render(){return this.state.hasError?n().createElement(FF,null,n().createElement("p",{style:{paddingLeft:205}},"Ein Fehler ist aufgetreten, bitte erneut versuchen")):this.props.children}}const YF=WF,VF=({isExpert:e,isHidden:t,children:r})=>n().createElement(YF,null,n().createElement(FF,{isHidden:t,isExpert:e},r)),XF=({formControl:e,id:t,objectPathId:o,hideLabel:i=!1,groupIsRequired:a=!0,isInGroup:s=!1,controlProps:l})=>{const{control:c,required:u,"custom-attributes":d,hasChanged:p}=e,h=d?.visibility?.form,f="object"==typeof h&&h?.hideOnCondition,{value:m}=(0,B.ZP)({query:f,objectPathId:o}),g="hidden"===h||m,b="expert"===h,[y,v]=(0,r.useState)(null),w=!("input"!==c||!d?.["mrn-ref"]&&!d?.mrnSources||d?.mrnPreview),{resolveUrl:A,enableExpertMode:x,hasExpertMode:k,isExpertMode:S}=(0,r.useContext)(O.L8),C=(g||b&&!S)&&!u,_="group"===c&&W(e.controls,S)||w&&C,E=d?.valueGenerator?.template,{value:P,hasQuery:q}=(0,B.ZP)({query:E,objectPathId:o});if(q&&!p&&(e.value=P),(0,r.useEffect)((()=>{b&&!k&&x()}),[]),(0,r.useEffect)((()=>{(async()=>{if(!Boolean(d?.mrnPreview)||!Boolean(!d?.mrnSources))return;if(!jr(e.value))return null;const t=await(async()=>await A(e.value,null,{headers:{accept:"application/xhtml-form+json"}}))(),r=Or()(t.values,d?.mrnPreview?.displayField);v(r&&"null"!==r?r:"-")})()}),[]),_)return n().createElement(n().Fragment,null);const T={id:t,objectPathId:o,control:e,groupIsRequired:a,isInGroup:s,isExpertMode:S},j=((e,t,r,n)=>{const o=((e,t,r,n)=>[...t.filter((t=>t.query(e,n))),...r.filter((t=>t.query(e,n)))].sort(((e,t)=>e.matchCount<t.matchCount?1:t.matchCount<e.matchCount?-1:0)))(e,t,r,n);return o[0]?.control?{control:o[0]?.control}:{control:Ta,error:"No matching control found"}})(e,[],UF,o).control;return["group","list"].includes(c)?n().createElement(VF,{isHidden:C,isExpert:b},n().createElement(j,{controlProps:l,...T})):n().createElement(VF,{isHidden:C},n().createElement(qr,{Control:j,config:{...T,control:{...e,value:y||e.value}},isExpert:b,hideLabel:i,controlProps:l}))};var HF=__webpack_require__(6229),GF=__webpack_require__(129),KF=__webpack_require__.n(GF);const JF=(0,r.forwardRef)((({state:e,method:t,formSubmitted:o,controlProps:i},a)=>{const{formControls:s,isExpertMode:l}=(0,r.useContext)(O.L8),{activeFormControls:c,activeMenuItemIndex:u,controlGroups:d,hasSubmenu:p,menuItems:h,setActiveMenuItemIndex:f}=((e,t,n)=>{const o=K(e,n),i=H(e,n),a=(0,D.Z)(e),s=i&&o?.menuItems,l=i&&o?.controlGroups,c=i?G(l):Number(Y),[u,d]=(0,r.useState)(c),p=l?.[u];return(0,r.useEffect)((()=>{i&&a&&d(G(l))}),[t]),N((()=>{d(Number(Y))}),[n]),{activeFormControls:p,activeMenuItemIndex:u,controlGroups:l,hasSubmenu:i,menuItems:s,setActiveMenuItemIndex:d}})(s,o,l);return n().createElement("form",{ref:a,className:v()(Uv["form-builder-container"],{[Uv.hasSubmenu]:p},e),id:"form-horizontal xhtmlInstantForm","data-testid":"form-horizontal xhtmlInstantForm",role:"form",method:t,style:i?.formProps?.style,onSubmit:e=>e.preventDefault()},p&&n().createElement(M,{menuItems:h,activeMenuItemIndex:u,onActiveMenuItemIndex:f},d&&c&&Object.entries(c).map((([e,t])=>n().createElement(n().Fragment,{key:e},n().createElement(XF,{key:e,formControl:t,id:e,controlProps:i}))))),!p&&n().createElement(n().Fragment,null,s&&Object.entries(s).map((([e,t])=>n().createElement(n().Fragment,{key:e},n().createElement(XF,{key:e,formControl:t,id:e,controlProps:i}))))))}));JF.displayName="Form";const eW=({config:e,controlProps:t,fileUploaderConfig:o,iconType:i,state:a,resolveUrl:s,onSubmit:l,postGenAiMessage:c})=>{const[u,d]=(0,r.useState)(e),{items:p,error:h,method:f}=u,[m,y]=(0,r.useState)(h?.message),[v,w]=(0,r.useState)(a||""),[A,x]=(0,r.useState)(!0),k=(0,r.useRef)(null),S=()=>x((e=>!e));if((0,r.useEffect)((()=>{d(e)}),[e]),u)return p||console.log("Items have to be defined in form config"),n().createElement(O.f_,{controls:p,fileUploaderConfig:o,resolveUrl:s,postGenAiMessage:c},n().createElement(g,{theme:(0,b.Z)({components:{MuiPaper:{styleOverrides:{root:{fontFamily:t?.formProps?.style?.fontFamily||"Roboto"}}}}})},n().createElement(JF,{method:f,ref:k,state:v,controlProps:t,formSubmitted:A}),n().createElement(yr,{controlProps:t,error:m,iconType:i,loading:"processing"===v,onSubmit:async e=>{if(!k.current.checkValidity())return;w("processing");const t=(0,HF.Z)(e),r=(n=t,KF().stringify(n,{allowDots:!0,encoder:function(e,t,r,n){const o="]"===e[e.length-1];return"key"===n&&o?encodeURIComponent(e.
|
666
|
+
`;class WF extends r.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){console.error("Uncaught error:",e,t)}render(){return this.state.hasError?n().createElement(FF,null,n().createElement("p",{style:{paddingLeft:205}},"Ein Fehler ist aufgetreten, bitte erneut versuchen")):this.props.children}}const YF=WF,VF=({isExpert:e,isHidden:t,children:r})=>n().createElement(YF,null,n().createElement(FF,{isHidden:t,isExpert:e},r)),XF=({formControl:e,id:t,objectPathId:o,hideLabel:i=!1,groupIsRequired:a=!0,isInGroup:s=!1,controlProps:l})=>{const{control:c,required:u,"custom-attributes":d,hasChanged:p}=e,h=d?.visibility?.form,f="object"==typeof h&&h?.hideOnCondition,{value:m}=(0,B.ZP)({query:f,objectPathId:o}),g="hidden"===h||m,b="expert"===h,[y,v]=(0,r.useState)(null),w=!("input"!==c||!d?.["mrn-ref"]&&!d?.mrnSources||d?.mrnPreview),{resolveUrl:A,enableExpertMode:x,hasExpertMode:k,isExpertMode:S}=(0,r.useContext)(O.L8),C=(g||b&&!S)&&!u,_="group"===c&&W(e.controls,S)||w&&C,E=d?.valueGenerator?.template,{value:P,hasQuery:q}=(0,B.ZP)({query:E,objectPathId:o});if(q&&!p&&(e.value=P),(0,r.useEffect)((()=>{b&&!k&&x()}),[]),(0,r.useEffect)((()=>{(async()=>{if(!Boolean(d?.mrnPreview)||!Boolean(!d?.mrnSources))return;if(!jr(e.value))return null;const t=await(async()=>await A(e.value,null,{headers:{accept:"application/xhtml-form+json"}}))(),r=Or()(t.values,d?.mrnPreview?.displayField);v(r&&"null"!==r?r:"-")})()}),[]),_)return n().createElement(n().Fragment,null);const T={id:t,objectPathId:o,control:e,groupIsRequired:a,isInGroup:s,isExpertMode:S},j=((e,t,r,n)=>{const o=((e,t,r,n)=>[...t.filter((t=>t.query(e,n))),...r.filter((t=>t.query(e,n)))].sort(((e,t)=>e.matchCount<t.matchCount?1:t.matchCount<e.matchCount?-1:0)))(e,t,r,n);return o[0]?.control?{control:o[0]?.control}:{control:Ta,error:"No matching control found"}})(e,[],UF,o).control;return["group","list"].includes(c)?n().createElement(VF,{isHidden:C,isExpert:b},n().createElement(j,{controlProps:l,...T})):n().createElement(VF,{isHidden:C},n().createElement(qr,{Control:j,config:{...T,control:{...e,value:y||e.value}},isExpert:b,hideLabel:i,controlProps:l}))};var HF=__webpack_require__(6229),GF=__webpack_require__(129),KF=__webpack_require__.n(GF);const JF=(0,r.forwardRef)((({state:e,method:t,formSubmitted:o,controlProps:i},a)=>{const{formControls:s,isExpertMode:l}=(0,r.useContext)(O.L8),{activeFormControls:c,activeMenuItemIndex:u,controlGroups:d,hasSubmenu:p,menuItems:h,setActiveMenuItemIndex:f}=((e,t,n)=>{const o=K(e,n),i=H(e,n),a=(0,D.Z)(e),s=i&&o?.menuItems,l=i&&o?.controlGroups,c=i?G(l):Number(Y),[u,d]=(0,r.useState)(c),p=l?.[u];return(0,r.useEffect)((()=>{i&&a&&d(G(l))}),[t]),N((()=>{d(Number(Y))}),[n]),{activeFormControls:p,activeMenuItemIndex:u,controlGroups:l,hasSubmenu:i,menuItems:s,setActiveMenuItemIndex:d}})(s,o,l);return n().createElement("form",{ref:a,className:v()(Uv["form-builder-container"],{[Uv.hasSubmenu]:p},e),id:"form-horizontal xhtmlInstantForm","data-testid":"form-horizontal xhtmlInstantForm",role:"form",method:t,style:i?.formProps?.style,onSubmit:e=>e.preventDefault()},p&&n().createElement(M,{menuItems:h,activeMenuItemIndex:u,onActiveMenuItemIndex:f},d&&c&&Object.entries(c).map((([e,t])=>n().createElement(n().Fragment,{key:e},n().createElement(XF,{key:e,formControl:t,id:e,controlProps:i}))))),!p&&n().createElement(n().Fragment,null,s&&Object.entries(s).map((([e,t])=>n().createElement(n().Fragment,{key:e},n().createElement(XF,{key:e,formControl:t,id:e,controlProps:i}))))))}));JF.displayName="Form";const eW=({config:e,controlProps:t,fileUploaderConfig:o,iconType:i,state:a,resolveUrl:s,onSubmit:l,postGenAiMessage:c})=>{const[u,d]=(0,r.useState)(e),{items:p,error:h,method:f}=u,[m,y]=(0,r.useState)(h?.message),[v,w]=(0,r.useState)(a||""),[A,x]=(0,r.useState)(!0),k=(0,r.useRef)(null),S=()=>x((e=>!e));if((0,r.useEffect)((()=>{d(e)}),[e]),u)return p||console.log("Items have to be defined in form config"),n().createElement(O.f_,{controls:p,fileUploaderConfig:o,resolveUrl:s,postGenAiMessage:c},n().createElement(g,{theme:(0,b.Z)({components:{MuiPaper:{styleOverrides:{root:{fontFamily:t?.formProps?.style?.fontFamily||"Roboto"}}}}})},n().createElement(JF,{method:f,ref:k,state:v,controlProps:t,formSubmitted:A}),n().createElement(yr,{controlProps:t,error:m,iconType:i,loading:"processing"===v,onSubmit:async e=>{if(!k.current.checkValidity())return;w("processing");const t=(0,HF.Z)(e),r=(n=t,KF().stringify(n,{allowDots:!0,encoder:function(e,t,r,n){const o="]"===e[e.length-1];return"key"===n&&o?encodeURIComponent(e.replace(/\[\d+\]$/,"")):encodeURIComponent(e)}}));var n;l(r,t).then((()=>{w("success"),S()})).catch((e=>{console.error("error submitting form",e),y(`${e.message}`),w("error"),S()}))}})));console.log("form config missing")},tW=eW})(),__webpack_exports__})()));
|
667
667
|
//# sourceMappingURL=formbuilder.js.map
|