@erpsquad/common 1.8.113 → 1.8.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index/index.esm10.js +3 -3
- package/dist/_virtual/index/index.esm11.js +4 -2
- package/dist/_virtual/index/index.esm11.js.map +1 -1
- package/dist/_virtual/index/index.esm2.js +2 -4
- package/dist/_virtual/index/index.esm2.js.map +1 -1
- package/dist/_virtual/index/index.esm3.js +3 -3
- package/dist/_virtual/index/index.esm4.js +3 -3
- package/dist/_virtual/index/index.esm5.js +3 -3
- package/dist/_virtual/index/index.esm6.js +3 -3
- package/dist/_virtual/index/index.esm7.js +3 -3
- package/dist/_virtual/index/index.esm8.js +3 -3
- package/dist/_virtual/index/index.esm9.js +3 -3
- package/dist/_virtual/index/index10.js +1 -1
- package/dist/_virtual/index/index11.js +1 -1
- package/dist/_virtual/index/index2.js +1 -1
- package/dist/_virtual/index/index3.js +1 -1
- package/dist/_virtual/index/index4.js +1 -1
- package/dist/_virtual/index/index5.js +1 -1
- package/dist/_virtual/index/index6.js +1 -1
- package/dist/_virtual/index/index7.js +1 -1
- package/dist/_virtual/index/index8.js +1 -1
- package/dist/_virtual/index/index9.js +1 -1
- package/dist/components/form-control/form-parser/form-parser/index.esm.js +11 -2
- package/dist/components/form-control/form-parser/form-parser/index.esm.js.map +1 -1
- package/dist/components/form-control/form-parser/form-parser/index.js +3 -3
- package/dist/components/form-control/form-parser/form-parser/index.js.map +1 -1
- package/dist/components/form-control/form-parser/form-parser.d.ts +0 -1
- package/dist/components/index.esm.js +2 -2
- package/dist/components/index.js +1 -1
- package/dist/index.esm.js +73 -73
- package/dist/index.js +1 -1
- package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.esm.js +1 -1
- package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.js +1 -1
- package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.js.map +1 -1
- package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.esm.js +1 -1
- package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.js +1 -1
- package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.js.map +1 -1
- package/dist/node_modules/@mui/system/colorManipulator/index.esm.js +2 -2
- package/dist/node_modules/@mui/system/colorManipulator/index.js +1 -1
- package/dist/node_modules/@mui/system/colorManipulator/index.js.map +1 -1
- package/dist/node_modules/@mui/system/createStyled/index.esm.js +6 -6
- package/dist/node_modules/@mui/system/createStyled/index.js +1 -1
- package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.esm.js +1 -1
- package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.js +1 -1
- package/dist/src/components/form-control/form-parser/form-parser.d.ts +0 -1
- package/dist/style.css +69 -69
- package/dist/views/form-builder/custom-form/index.esm.js +1 -1
- package/dist/views/form-builder/custom-form/index.js +17 -17
- package/dist/views/form-builder/custom-form/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -20,7 +20,7 @@ import { Radio } from "../../../components/radio/radio/index.esm.js";
|
|
|
20
20
|
import { SECTION_TYPES } from "../../../utils/constant/index.esm.js";
|
|
21
21
|
import { ErpLoader } from "../../../components/loaders/erp-loader/index.esm.js";
|
|
22
22
|
import { getErrorMessage } from "../../../utils/common/index.esm.js";
|
|
23
|
-
import
|
|
23
|
+
import FormParser from "../../../components/form-control/form-parser/form-parser/index.esm.js";
|
|
24
24
|
import { patchFormDataById, getFormDataById, getFieldsByFormId } from "../redux/actionCreator/index.esm.js";
|
|
25
25
|
import { element } from "../field_properties/index.esm.js";
|
|
26
26
|
import { TextEditForm } from "../element-edit-forms/text/index.esm.js";
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("react-router-dom"),i=require("react-hook-form"),
|
|
2
|
-
return e.jsx("div",{className:"text-gray-500 p-4",children:"Select a field to edit"});const i=r.toLowerCase().trim(),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("react-router-dom"),i=require("react-hook-form"),n=require("react-dnd"),o=require("react-dnd-html5-backend"),s=require("react-i18next"),l=,/* empty css */a=,/* empty css */d=,/* empty css */c=,/* empty css */u=,/* empty css */m=,/* empty css */f=,/* empty css */h=,/* empty css */p=,/* empty css */b=,/* empty css */v=,/* empty css */y=,/* empty css */_=,/* empty css */x=,/* empty css */g=,/* empty css */S=,/* empty css */j=,/* empty css */N=,/* empty css */k=,/* empty css */C=,/* empty css */q=,/* empty css */E=,/* empty css */w=,/* empty css */O=,/* empty css */B=;/* empty css */;/* empty css */var F=,/* empty css */J=,/* empty css */A=,/* empty css */M=,/* empty css */T=,/* empty css */I=,/* empty css */D=;/* empty css */const P=e=>!isNaN(Number(e))&&isFinite(Number(e)),G=e=>JSON.parse(JSON.stringify(e)),L=(e="")=>({uniqueStringId:`${Date.now()}${e}${Math.random().toString(36).substr(2,9)}`});function U(){const{t:U}=s.useTranslation(),V=p.useAppDispatch(),$=r.useNavigate(),R=r.useLocation(),H=R.state??[],W=p.useAppSelector(e=>e.formBuilder),{control:z}=i.useForm({reValidateMode:"onBlur"}),{fields:Y,append:K,remove:Q,update:X,move:Z,insert:ee}=i.useFieldArray({control:z,name:"members"}),{fields:te,append:re,remove:ie,update:ne}=i.useFieldArray({control:z,name:"section"}),[oe,se]=t.useState(""),[le,ae]=t.useState(),[de,ce]=t.useState(),[ue,me]=t.useState([]),[fe,he]=t.useState(null),[pe,be]=t.useState(),[ve,ye]=t.useState([]),[_e,xe]=t.useState({}),[ge,Se]=t.useState(),[je,Ne]=t.useState(!1),[ke,Ce]=t.useState(!1),[qe,Ee]=t.useState(),[we,Oe]=t.useState(!0),[Be,Fe]=t.useState([]),[Je,Ae]=t.useState(0),[Me,Te]=t.useState(!1),[Ie,De]=t.useState(!1),[Pe,Ge]=t.useState(null),[Le,Ue]=t.useState(null),[Ve,$e]=t.useState(),Re=R.pathname.split("/")[2],He=B.generateModulePath(Re);B.useFormDataEffect(W,Be,Je,{removeSection:ie,remove:Q,setTabsData:Fe,append:K,appendSection:re});const We=t.useCallback(r=>{try{if(!r||"string"!=typeof r)/* @__PURE__ */
|
|
2
|
+
return e.jsx("div",{className:"text-gray-500 p-4",children:"Select a field to edit"});const i=r.toLowerCase().trim(),n={text:["text","number","email","phone","date","time","url","currency","file","geolocation","image","relation","info","tagsinput"],select:["select"],section:["section"],checkbox:["checkbox","togglebutton","radiobutton"],table:["table"]},o={element:fe,handlePropertyValueUpdate:nt,handleWidthChange:rt,handleColumnSelect:it,fields:(null==W?void 0:W.fields)||[]},s={element:fe,handlePropertyValueUpdate:nt,handleSelectOptionValueUpdate:ot,handleWidthChange:rt,handleColumnSelect:it};return n.text.includes(i)?/* @__PURE__ */t.createElement(k.TextEditForm,{...o,key:`text-form-${(null==fe?void 0:fe.id)||"default"}`}):n.select.includes(i)?/* @__PURE__ */t.createElement(C.SelectEditForm,{...s,key:`select-form-${(null==fe?void 0:fe.id)||"default"}`}):n.section.includes(i)?/* @__PURE__ */e.jsx(q.SectionEditForm,{element:_e,handlePropertyValueUpdate:tt},`section-form-${(null==_e?void 0:_e.id)||"default"}`):n.checkbox.includes(i)?/* @__PURE__ */t.createElement(E.CheckboxEditForm,{...s,key:`checkbox-form-${(null==fe?void 0:fe.id)||"default"}`}):n.table.includes(i)?/* @__PURE__ */e.jsx(w.default,{element:fe,handlePropertyValueUpdate:nt,handleColumnsUpdate:st,fields:(null==W?void 0:W.fields)||[]},`table-form-${(null==fe?void 0:fe.id)||"default"}`):/* @__PURE__ */e.jsxs("div",{className:"text-gray-500 p-4 border border-gray-200 rounded",children:[
|
|
3
3
|
/* @__PURE__ */e.jsx("p",{className:"font-medium",children:"Unknown Field Type"}),
|
|
4
4
|
/* @__PURE__ */e.jsxs("p",{className:"text-sm mt-1",children:['Field type "',r,'" is not supported. Please select a valid field to edit.']})]})}catch(i){/* @__PURE__ */
|
|
5
5
|
return e.jsxs("div",{className:"text-red-500 p-4 border border-red-200 rounded bg-red-50",children:[
|
|
6
6
|
/* @__PURE__ */e.jsx("p",{className:"font-medium",children:"Error Loading Form"}),
|
|
7
|
-
/* @__PURE__ */e.jsx("p",{className:"text-sm mt-1",children:"There was an error loading the property edit form. Please try again."})]})}},[fe,_e,W]),ze=t.useCallback(()=>{var e;try{if(!(null==(e=N.element)?void 0:e.section))return;const{uniqueStringId:t}=L("-"),r={...G(N.element.section),id:t};r.switcher_forms&&(r.switcher_forms=r.switcher_forms.map(e=>({...e,id:L("-").uniqueStringId})));const i=te.length;re(r),ae(i),se("section");const
|
|
8
|
-
return e.jsx(xt,{});if("element"===
|
|
9
|
-
return e.jsx(xt,{});const t=gt(fe);return We(t)}if("section"===
|
|
7
|
+
/* @__PURE__ */e.jsx("p",{className:"text-sm mt-1",children:"There was an error loading the property edit form. Please try again."})]})}},[fe,_e,W]),ze=t.useCallback(()=>{var e;try{if(!(null==(e=N.element)?void 0:e.section))return;const{uniqueStringId:t}=L("-"),r={...G(N.element.section),id:t};r.switcher_forms&&(r.switcher_forms=r.switcher_forms.map(e=>({...e,id:L("-").uniqueStringId})));const i=te.length;re(r),ae(i),se("section");const n={field_type:r.field_type,section_type:r.section_type,switcher_forms:r.switcher_forms,form_switcher_label:r.form_switcher_label,form_switcher_name:r.form_switcher_name,label:r.label,is_accordion:r.is_accordion,id:r.id??i};xe(n),Se(i),We(r.field_type)}catch(t){}},[N.element,te,re,ae,se,xe,Se,We]),Ye=t.useCallback(()=>{try{const e=G(ve);e.forEach((e,t)=>{e.members=Y.filter(e=>(null==e?void 0:e.section_order)===t)});const t=e.some(e=>{var t;return null==(t=e.members)?void 0:t.some(e=>Boolean(null==e?void 0:e.is_system_field))}),r=!(null==Be?void 0:Be.length)&&t,i={tab_order:Be.length+1,title:"data",remove_tab:r,data:(null==Be?void 0:Be.length)?[]:e};Fe(e=>[...e,i])}catch(e){}},[ve,Y,Be,Fe]),Ke=t.useCallback((e,t)=>{try{if(!P(e)||!(null==t?void 0:t.trim()))return;Fe(r=>r.map(r=>r.tab_order===e?{...r,title:t.trim()}:r))}catch(r){}},[Fe]),Qe=t.useCallback(e=>{try{if(!P(e))return;const t=Be.filter(t=>t.tab_order!==e).map(t=>({...t,tab_order:t.tab_order>e?t.tab_order-1:t.tab_order}));if(Fe(t),Je==e&&Ae((null==t?void 0:t.length)-1),t.length>0){const e=t.find(e=>e.tab_order===(Je??0)+1);if(null==e?void 0:e.data){const t=e.data.map(({field_type:e,label:t,is_accordion:r,id:i,remove_section:n})=>({field_type:e,label:t,is_accordion:r,id:i,remove_section:n})),r=e.data.flatMap(e=>{var t;return(null==(t=e.members)?void 0:t.map(e=>({...e})))||[]});Q(),ie(),r.forEach(e=>K(e)),t.forEach(e=>re(e))}}else Q(),ie()}catch(t){}},[Be,Je,Fe,Q,ie,K,re]),Xe=t.useCallback(e=>{try{const t=e.target.dataset.position;if(!t||!P(t))return;const r=Number(t);if(r<0||r>=ue.length)return;ce(r);const i=G(ue[r]);be(r),he(i),se("element")}catch(t){}},[ue,ce,be,he,se]),Ze=t.useCallback(e=>{try{const t=e.target.dataset.position;if(!t||!P(t))return;const r=Number(t);if(r<0||r>=ve.length)return;ae(r);const i=G(ve[r]);Se(r),xe(i),se("section")}catch(t){}},[ve,ae,Se,xe,se]),et=t.useCallback((e,t)=>{var r,i;try{const n=e.currentTarget,o=null==(r=null==n?void 0:n.dataset)?void 0:r.position;if(void 0===o||!P(o))return;const s=Number(o);if(s<0)return;if(!(null==(i=N.element)?void 0:i.text))return;const l={...G(N.element.text),...t,section_order:s,type:"custom",is_new:!0,custom_width:Math.floor(6),is_fullwidth:!1,is_system_field:Boolean(null==t?void 0:t.is_system_field),id:L().uniqueStringId};ae(s),K(l);const a=Y.length;ce(a),se("element"),be(a),he(l),We(l.field_type)}catch(n){}},[N.element,Y,ae,K,ce,se,be,he,We]),tt=t.useCallback((e,t)=>{try{const{name:r,type:i,checked:n,value:o}=e.target;if(!r)return;const s=void 0!==t?t:"checkbox"===i?n:o;_e[r]!==s&&xe(e=>({...e,[r]:s}))}catch(r){}},[_e,xe]),rt=t.useCallback(e=>{try{if(!P(e)||e<1||e>12)return;he(t=>({...t,custom_width:e}))}catch(t){}},[he]),it=t.useCallback(e=>{try{const t=Number(e.target.value);if(!P(t)||t<=0)return;const r=Math.floor(12/t);if(r<=0)return;Y.forEach((e,t)=>{X(t,{...e,custom_width:r})})}catch(t){}},[Y,X]),nt=t.useCallback((e,t,r,i)=>{var n;try{const o=(()=>{var n;return i||(void 0!==r?r:void 0!==t?t:null==(n=null==e?void 0:e.target)?void 0:n.value)})(),s=G(fe);if((null==(n=null==e?void 0:e.target)?void 0:n.name)&&(s[e.target.name]="checkbox"===e.target.type?e.target.checked:o),i){const{uniqueStringId:e}=L(),t={...N.element[i],section_form_id:null==s?void 0:s.section_form_id,is_form_switcher_section:null==s?void 0:s.is_form_switcher_section,section_order:s.section_order,id:e,type:"custom",is_system_field:Boolean(null==s?void 0:s.is_system_field),is_new:!0,column_width:(null==s?void 0:s.column_width)||6,custom_width:(null==s?void 0:s.custom_width)||6};he(t)}else JSON.stringify(fe)!==JSON.stringify(s)&&he({...fe,...s})}catch(o){}},[fe,N.element,he]),ot=t.useCallback(e=>{try{if(!Array.isArray(e))return;const t=G(fe);t.options=[...e];const{uniqueStringId:r}=L("-");JSON.stringify(fe.options)!==JSON.stringify(e)&&he({...fe,...t,id:r})}catch(t){}},[fe,he]),st=t.useCallback(e=>{try{if(!Array.isArray(e))return;const t=G(fe);t.table_columns=[...e];const{uniqueStringId:r}=L("-");JSON.stringify(fe.table_columns)!==JSON.stringify(e)&&he({...fe,...t,id:r})}catch(t){}},[fe,he]),lt=t.useCallback(e=>{try{if(!P(e)||e<0||e>=te.length)return;Ee(e),ie(e);const t=[];Y.forEach((r,i)=>{(null==r?void 0:r.section_order)===e&&t.push(i)}),t.reverse().forEach(e=>{Q(e)}),Ne(!0)}catch(t){}},[te,Y,Ee,ie,Q,Ne]),at=t.useCallback(e=>{try{if(!P(e)||e<0||e>=te.length)return;De(!0),Se(e),ae(e);const t={...G(te[e]),is_accordion:!0};ne(e,t),se("section"),xe(t),We(t.field_type)}catch(t){}},[te,De,Se,ae,ne,se,xe,We]),dt=t.useCallback(()=>{try{const e=G(ve);e.forEach((e,t)=>{e.members=Y.filter(e=>(null==e?void 0:e.section_order)===t)});const t=e.some(e=>{var t;return null==(t=e.members)?void 0:t.some(e=>Boolean(null==e?void 0:e.is_system_field))}),r=Number(Je);if(P(r)&&r>=0&&r<Be.length){const i=[...Be];i[r]={...i[r],data:e,remove_tab:t},Fe(i),Q(),ie(),ce(void 0),se(""),ae(void 0)}}catch(e){}},[ve,Y,Je,Be,Fe]),ct=t.useMemo(()=>ve&&Y?ve.map((e,t)=>({...e,members:Y.filter(e=>(null==e?void 0:e.section_order)===t)})):null,[ve,Y]),ut=t.useMemo(()=>ct?(null==Be?void 0:Be.length)?{tab:Be}:{section:ct}:null,[Be,ct]),mt=t.useMemo(()=>ut?h.formBuilderConversion(ut):null,[ut]),ft=t.useCallback(()=>{mt&&Ue(mt)},[mt,Ue]),ht=t.useCallback(()=>{Ue(null)},[]),pt=t.useCallback(async()=>{var e;try{if(!ve||!Array.isArray(ve))return;if(!Y||!Array.isArray(Y))return;if(!(null==H?void 0:H._id))return;let i;try{i=structuredClone(ve)}catch(t){i=JSON.parse(JSON.stringify(ve))}i.forEach((e,t)=>{e&&"object"==typeof e&&(e.members=Y.filter(e=>e&&"object"==typeof e&&"number"==typeof e.section_order&&e.section_order===t))});const n=i.some(e=>{var t;return null==(t=e.members)?void 0:t.some(e=>Boolean(null==e?void 0:e.is_system_field))}),o=Number(Je);let s=[...Be];P(o)&&o>=0&&o<Be.length&&(s=[...Be],s[o]={...s[o],data:i,remove_tab:n},Fe(s));const a=(null==s?void 0:s.length)>0?{tab:s}:{section:i};if("function"!=typeof h.formBuilderConversion)return;let d;try{d=h.formBuilderConversion(a)}catch(r){return}if(!d)return;const c={gridCol:2,fields:d},u=await V(j.patchFormDataById({id:H._id,data:c}));if("rejected"===u.meta.requestStatus){const t=g.getErrorMessage(null==(e=null==u?void 0:u.error)?void 0:e.message);l.enqueueSnackbar(t,{variant:"error"})}else l.enqueueSnackbar("Form updated successfully",{variant:"success"}),$(He)}catch(i){const e=(null==i?void 0:i.message)||"Something went wrong while updating the form";l.enqueueSnackbar(e,{variant:"error"})}},[ve,Y,Be,null==H?void 0:H._id,void 0,V,h.formBuilderConversion]),bt=e=>{const t={...Y[e],type:"custom"};t&&ee(e+1,t),ce(e+1),se("element"),be(e+1),he(t),We(t.field_type)},vt=[{link:He,label:"Forms"},{link:"",label:b.formatLabel(null==H?void 0:H.name)},{link:"",label:"Edit Form"}];t.useEffect(()=>{je&&(Y.forEach((e,t)=>{void 0!==qe&&Boolean(null==qe?void 0:qe.toString)&&e.section_order>qe&&X(t,{...e,section_order:e.section_order-1})}),Ne(!1),Ce(!0),Ee(void 0),se(""))},[je]),t.useEffect(()=>{W.isSuccess&&$(He)},[W.isSuccess]),t.useEffect(()=>{W.isError&&Ge({type:"alert",message:W.error})},[W.error,W.isError]),t.useEffect(()=>{if("number"!=typeof pe||"string"!=typeof pe){const e=Number(pe);if(ue[e]){const t=JSON.parse(JSON.stringify(ue[e]));X(e,{...t})}}},[ue]),t.useEffect(()=>{const e=ue.map((e,t)=>t===Number(pe)?{...fe}:{...e});me(e)},[fe]),t.useEffect(()=>{if(Y.length!==ue.length&&me(JSON.parse(JSON.stringify(Y))),Boolean(Me)&&JSON.stringify(Y)!==JSON.stringify(ue)){me(JSON.parse(JSON.stringify(Y))),Te(!1);const e=pe&&Y[pe];e&&se("element"),e&&he(e),e&&We(e.field_type)}ke&&JSON.stringify(Y)!==JSON.stringify(ue)&&(me(JSON.parse(JSON.stringify(Y))),Ce(!1))},[Y,Me]),t.useEffect(()=>{if("number"!=typeof ge||"string"!=typeof ge){const e=Number(ge);if(ve[e]){const t=JSON.parse(JSON.stringify(ve[e]));ne(e,{...t})}}},[ve]),t.useEffect(()=>{const e=ve.map((e,t)=>t===Number(ge)?{...e,..._e}:{...e});ye(e)},[_e]),t.useEffect(()=>{te.length!==ve.length&&ye(JSON.parse(JSON.stringify(te))),JSON.stringify(ve)!==JSON.stringify(te)&&Ie&&(ye(JSON.parse(JSON.stringify(te))),De(!1))},[te]),t.useEffect(()=>{},[]);const yt=t.useCallback(async()=>{Oe(!0);try{(null==H?void 0:H._id)&&(Fe([]),await V(j.getFormDataById(null==H?void 0:H._id)),await V(j.getFieldsByFormId({id:null==H?void 0:H._id})))}finally{Oe(!1)}},[null==H?void 0:H._id]);t.useEffect(()=>{yt()},[yt]);const _t=e=>e&&Object.keys(e).length>0,xt=()=>/* @__PURE__ */e.jsx(f.Typography,{type:"s5",color:"theme.secondary.800",className:"formSection--Text",children:"Select a field to edit its properties."}),gt=(e,t="text")=>(null==e?void 0:e.field_type)||t,St=t.useMemo(()=>{if(!oe)/* @__PURE__ */
|
|
8
|
+
return e.jsx(xt,{});if("element"===oe){if(!_t(Y))/* @__PURE__ */
|
|
9
|
+
return e.jsx(xt,{});const t=gt(fe);return We(t)}if("section"===oe){if(!_t(te))/* @__PURE__ */
|
|
10
10
|
return e.jsx(xt,{});const t=gt(_e);return We(t)}/* @__PURE__ */
|
|
11
|
-
return e.jsx(xt,{})},[
|
|
11
|
+
return e.jsx(xt,{})},[oe,Object.keys(Y).length,Object.keys(te).length,null==fe?void 0:fe.field_type,null==fe?void 0:fe.field_properties,null==_e?void 0:_e.field_type,null==_e?void 0:_e.field_properties,We]);
|
|
12
12
|
/* @__PURE__ */
|
|
13
|
-
return e.jsx(
|
|
13
|
+
return e.jsx(F.default,{position:"relative",children:we?/* @__PURE__ */e.jsx(x.ErpLoader,{}):/* @__PURE__ */e.jsxs(n.DndProvider,{backend:o.HTML5Backend,children:[
|
|
14
14
|
/* @__PURE__ */e.jsx(m.FormHeader,{breadCrumbPath:vt,children:/* @__PURE__ */e.jsxs("div",{className:"formSection--Buttons",children:[
|
|
15
15
|
/* @__PURE__ */e.jsx(d.DynamicButton,{variant:"outlined",className:"formSection--PreviewButton",text:"Preview",onClick:()=>{Le?ht():ft()},disable:!(null==Y?void 0:Y.length),startIcon:Le?/* @__PURE__ */e.jsx(J.EyeOff,{}):/* @__PURE__ */e.jsx(A.Eye,{})}),
|
|
16
|
-
/* @__PURE__ */e.jsx(d.DynamicButton,{variant:"contained",type:"submit",text:"Update",onClick:pt,disable:Le})]})}),Le?/* @__PURE__ */e.jsx(S.
|
|
16
|
+
/* @__PURE__ */e.jsx(d.DynamicButton,{variant:"contained",type:"submit",text:"Update",onClick:pt,disable:Le})]})}),Le?/* @__PURE__ */e.jsx(S.default,{data:Le||[],handleFormSubmit:e=>{},className:"form-container",fieldArrayName:"form-builder-preview",getFormMethods:e=>$e({...e})}):/* @__PURE__ */e.jsxs(M.default,{className:"formSection--Grid",container:!0,children:[
|
|
17
17
|
/* @__PURE__ */e.jsx(M.default,{item:!0,xs:9,component:"form",sx:{position:"relative",background:"#F5F6F5",padding:"0.75rem"},children:/* @__PURE__ */e.jsxs(M.default,{className:"formSection--GridContainer",children:[
|
|
18
|
-
/* @__PURE__ */e.jsxs(
|
|
18
|
+
/* @__PURE__ */e.jsxs(F.default,{className:"formSection--Tab",children:[Be&&/* @__PURE__ */e.jsx(c.TabBar,{tabs:Be,onEditTabTitle:Ke,activeValue:Je,setActiveValue:Ae,handleTabChange:()=>{dt()},handleRemoveTab:Qe,containerProps:{mb:0}}),
|
|
19
19
|
/* @__PURE__ */e.jsx(d.DynamicButton,{variant:"outlined",text:"Add Tab",onClick:Ye,style:{color:"#292D32",margin:"0.5rem"}})]}),
|
|
20
|
-
/* @__PURE__ */e.jsxs("div",{className:"formSection--Form",children:[null==te?void 0:te.map((t,r)=>{var i;const
|
|
21
|
-
return e.jsxs(a.DynamicSectionHOC,{index:r,label:U(t.label),onClick:Ze,position:r,fieldArrayName:"section",isFormSwitcher:
|
|
20
|
+
/* @__PURE__ */e.jsxs("div",{className:"formSection--Form",children:[null==te?void 0:te.map((t,r)=>{var i;const n=Y.filter(e=>e.section_order===r),o=t.section_type===_.SECTION_TYPES.FORM_SWITCH_SECTION,s=null==(i=null==t?void 0:t.switcher_forms)?void 0:i.map(e=>({...e,formMembers:Y.filter(t=>t.section_form_id===e.id)}));/* @__PURE__ */
|
|
21
|
+
return e.jsxs(a.DynamicSectionHOC,{index:r,label:U(t.label),onClick:Ze,position:r,fieldArrayName:"section",isFormSwitcher:o,activeIndex:le===r,removeSection:()=>lt(r),handleAccordion:()=>at(r),handleAddButton:e=>et(e),remove_section:t.remove_section,children:[o?/* @__PURE__ */e.jsxs("div",{style:{width:"100%"},children:[
|
|
22
22
|
/* @__PURE__ */e.jsx(f.Typography,{type:"s5",style:{fontWeight:500},color:"theme.secondary.800",children:t.form_switcher_label}),
|
|
23
|
-
/* @__PURE__ */e.jsx(T.default,{"aria-labelledby":"theme-radio-buttons-group-label",name:t.form_switcher_name||t.form_switcher_label,children:null==s?void 0:s.map(({name:t,id:i,formMembers:
|
|
23
|
+
/* @__PURE__ */e.jsx(T.default,{"aria-labelledby":"theme-radio-buttons-group-label",name:t.form_switcher_name||t.form_switcher_label,children:null==s?void 0:s.map(({name:t,id:i,formMembers:n})=>/* @__PURE__ */e.jsxs(e.Fragment,{children:[
|
|
24
24
|
/* @__PURE__ */e.jsx("div",{children:/* @__PURE__ */e.jsx(I.default,{value:t,control:/* @__PURE__ */e.jsx(y.Radio,{}),label:U(t),disabled:!0},i)}),
|
|
25
|
-
/* @__PURE__ */e.jsx(M.default,{container:!0,sx:{mb:3},children:/* @__PURE__ */e.jsx(O.default,{sectionMembers:
|
|
26
|
-
/* @__PURE__ */e.jsx(d.DynamicButton,{text:"Add",variant:"outlined",className:"formSection--PreviewButton","data-position":r,onClick:e=>et(e,{section_form_id:i,is_form_switcher_section:!0}),startIcon:/* @__PURE__ */e.jsx(
|
|
27
|
-
/* @__PURE__ */e.jsx("div",{className:"formSection--Section",children:/* @__PURE__ */e.jsx(d.DynamicButton,{text:"Add a section",variant:"outlined",className:"formSection--PreviewButton",onClick:ze,startIcon:/* @__PURE__ */e.jsx(
|
|
28
|
-
/* @__PURE__ */e.jsx(M.default,{item:!0,xs:3,className:Boolean(
|
|
29
|
-
/* @__PURE__ */e.jsx(v.Toast,{open:Boolean(
|
|
25
|
+
/* @__PURE__ */e.jsx(M.default,{container:!0,sx:{mb:3},children:/* @__PURE__ */e.jsx(O.default,{sectionMembers:n||[],members:Y,activeMember:de,control:z,t:U,element:N.element,images:u.images,elementJSON:fe,remove:Q,move:Z,handleElementSelection:Xe,setElementSwap:Te,handleDuplicateElement:bt,setSelectedHoc:se,setActiveMember:ce})}),
|
|
26
|
+
/* @__PURE__ */e.jsx(d.DynamicButton,{text:"Add",variant:"outlined",className:"formSection--PreviewButton","data-position":r,onClick:e=>et(e,{section_form_id:i,is_form_switcher_section:!0}),startIcon:/* @__PURE__ */e.jsx(D.default,{})})]}))})]}):null,!o&&/* @__PURE__ */e.jsx(O.default,{sectionMembers:n||[],members:Y,activeMember:de,control:z,t:U,element:N.element,images:u.images,elementJSON:fe,remove:Q,move:Z,handleElementSelection:Xe,setElementSwap:Te,handleDuplicateElement:bt,setSelectedHoc:se,setActiveMember:ce})]})}),
|
|
27
|
+
/* @__PURE__ */e.jsx("div",{className:"formSection--Section",children:/* @__PURE__ */e.jsx(d.DynamicButton,{text:"Add a section",variant:"outlined",className:"formSection--PreviewButton",onClick:ze,startIcon:/* @__PURE__ */e.jsx(D.default,{})})})]})]})}),
|
|
28
|
+
/* @__PURE__ */e.jsx(M.default,{item:!0,xs:3,className:Boolean(oe)&&((null==Y?void 0:Y.length)||te.length)?"formSection--RightGrid":"formSection--RightGrid formSection--Text",children:St})]}),
|
|
29
|
+
/* @__PURE__ */e.jsx(v.Toast,{open:Boolean(Pe),type:null==Pe?void 0:Pe.type,message:null==Pe?void 0:Pe.message,handleClose:()=>Ge(null),anchorOrigin:{horizontal:"right",vertical:"bottom"}})]})})}exports.CustomForm=U,exports.default=U;
|
|
30
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/views/form-builder/custom-form.tsx"],"sourcesContent":["// React imports\nimport { useState, useEffect, useMemo, useCallback } from \"react\";\n\n// React Router imports\nimport { useLocation, useNavigate } from \"react-router-dom\";\n\n// React Hook Form imports\nimport { useForm, useFieldArray } from \"react-hook-form\";\n\n// Material UI imports\nimport { Box, FormControlLabel, Grid, RadioGroup } from \"@mui/material\";\nimport { Add } from \"@mui/icons-material\";\n\n// Third-party imports\nimport { DndProvider } from \"react-dnd\";\nimport { HTML5Backend } from \"react-dnd-html5-backend\";\nimport { MRT_ColumnDef, MRT_RowData } from \"material-react-table\";\nimport { useTranslation } from \"react-i18next\";\nimport { enqueueSnackbar } from \"notistack\";\n\n// ERP Common imports\nimport DynamicSectionHOC from \"@/components/form-control/form-builder/form-builder-element/section\";\nimport Button from \"@/components/form-control/form-builder/form-builder-element/button\";\nimport TabBar from \"@/components/tabs/tabs\";\nimport images from \"@/assets/images\";\nimport { Pathname } from \"@/constants\";\nimport FormHeader from \"@/components/form-header/form-header\";\nimport Typography from \"@/components/typography/typography\";\nimport formBuilderConversion from \"@/utils/form-builder-conversion\";\nimport { useAppDispatch, useAppSelector } from \"@/redux/hooks\";\nimport { formatLabel } from \"@/utils/format-text\";\nimport Toast from \"@/components/toast/toast\";\nimport Radio from \"@/components/radio/radio\";\nimport { SECTION_TYPES } from \"@/utils/constant\";\nimport ErpLoader from \"@/components/loaders/erp-loader\";\nimport { getErrorMessage } from \"@/utils/common\";\nimport FormParser from \"@/components/form-control/form-parser/form-parser\";\nimport { Eye, EyeOff } from \"@/components/icons\";\n\n// Redux actions\nimport {\n patchFormDataById,\n getFormDataById,\n getFieldsByFormId,\n} from \"../form-builder/redux/actionCreator\";\n\n// Local imports\nimport {\n IProperty,\n ISectionProperty,\n ISelectProperty,\n element,\n} from \"./field_properties\";\nimport TextEditForm from \"./element-edit-forms/text\";\nimport SelectEditForm from \"./element-edit-forms/select\";\nimport SectionEditForm from \"./element-edit-forms/section\";\nimport CheckboxEditForm from \"./element-edit-forms/checkbox\";\nimport TableEditForm from \"./element-edit-forms/table-form\";\nimport FormFields from \"./form-fields\";\nimport { generateModulePath, useFormDataEffect } from \"./utils/common\";\nimport \"./custom-form.scss\";\n\nexport interface IElementJson extends IProperty {\n type: string;\n}\n\nconst FIELD_TYPES = {\n TEXT: 'text',\n NUMBER: 'number',\n EMAIL: 'email',\n PHONE: 'phone',\n SELECT: 'select',\n DATE: 'date',\n TIME: 'time',\n URL: 'url',\n CURRENCY: 'currency',\n FILE: 'file',\n GEO_LOCATION: 'geoLocation',\n IMAGE: 'image',\n SECTION: 'section',\n INFO: 'info',\n RELATION: 'relation',\n CHECKBOX: 'checkbox',\n TOGGLE_BUTTON: 'toggleButton',\n TAGS_INPUT: 'tagsInput'\n} as const;\n\nconst DEFAULT_GRID_COLUMNS = 12;\nconst DEFAULT_COLUMN_WIDTH = 2;\nconst DEFAULT_TAB_TITLE = 'data';\n\nconst isValidNumber = (value: any): boolean => !isNaN(Number(value)) && isFinite(Number(value));\nconst deepClone = (obj: T): T => JSON.parse(JSON.stringify(obj));\nconst generateUniqueId = (separator = ''): { uniqueStringId: string } => {\n return { uniqueStringId: `${Date.now()}${separator}${Math.random().toString(36).substr(2, 9)}` };\n};\n\n\nexport function CustomForm() {\n const { t } = useTranslation();\n const dispatch = useAppDispatch();\n const navigate = useNavigate();\n const location = useLocation();\n const rowData = location.state ?? [];\n\n const formBuilder = useAppSelector((state) => state.formBuilder);\n\n const { control } = useForm({\n reValidateMode: \"onBlur\",\n });\n\n const {\n fields: members,\n append,\n remove,\n update,\n move,\n insert,\n } = useFieldArray({\n control,\n name: \"members\",\n });\n\n const {\n fields: section,\n append: appendSection,\n remove: removeSection,\n update: updateSection,\n } = useFieldArray({\n control,\n name: \"section\",\n });\n\n const [selectedHoc, setSelectedHoc] = useState(\"\");\n const [activeSection, setActiveSection] = useState<number>();\n const [activeMember, setActiveMember] = useState<number>();\n\n const [formJSON, setFormJSON] = useState<object[]>([]);\n const [elementJSON, setElementJSON] = useState<any>(null);\n const [positionEditedElement, setPositionEditedElement] = useState<\n number | undefined\n >();\n\n const [sectionFormJSON, setSectionFormJSON] = useState<object[]>([]);\n const [sectionJSON, setSectionJSON] = useState<any>({});\n const [sectionPositionEditedElement, setSectionPositionEditedElement] =\n useState<number | undefined>();\n const [removeSectionActionPerformed, setRemoveSectionActionPerformed] =\n useState(false);\n const [removeSectionMembersPerformed, setRemoveSectionMembersPerformed] =\n useState(false);\n const [removeSectionPosition, setRemoveSectionPosition] = useState<\n number | undefined\n >();\n const [initialLoading, setInitialLoading] = useState(true);\n const [tabsData, setTabsData] = useState<any[]>([]);\n const [activeTabValue, setActiveTabValue] = useState<number | undefined>(0);\n\n const [elementSwap, setElementSwap] = useState(false);\n const [modifyAccordion, setModifyAccordion] = useState(false);\n const [toast, setToast] = useState<IToast | null>(null);\n const [previewFieldsData, setPreviewFields] = useState<any>(null);\n const [_, setFormParserMethods] = useState<any>();\n\n let elementPerColumn: any;\n\n const currentModule = location.pathname.split('/')[2]\n\n const path = generateModulePath(currentModule)\n\n useFormDataEffect(\n formBuilder,\n tabsData,\n activeTabValue,\n {\n removeSection,\n remove,\n setTabsData,\n append,\n appendSection\n }\n );\n\n const pickPropertyEditForm = useCallback((type: string): React.ReactElement => {\n try {\n if (!type || typeof type !== 'string') {\n console.warn('Invalid field type provided to pickPropertyEditForm');\n return <div className=\"text-gray-500 p-4\">Select a field to edit</div>;\n }\n\n const normalizedType = type.toLowerCase().trim();\n\n // Define form type groups for better maintainability\n const formGroups = {\n text: [\n 'text', 'number', 'email', 'phone', 'date', 'time',\n 'url', 'currency', 'file', 'geolocation', 'image',\n 'relation', 'info', 'tagsinput'\n ],\n select: ['select'],\n section: ['section'],\n checkbox: ['checkbox', 'togglebutton', 'radiobutton'],\n table: ['table']\n };\n\n // Common props for reusability\n const commonTextProps = {\n element: elementJSON,\n handlePropertyValueUpdate,\n handleWidthChange,\n handleColumnSelect,\n fields: formBuilder?.fields || []\n };\n\n const commonSelectProps = {\n element: elementJSON,\n handlePropertyValueUpdate,\n handleSelectOptionValueUpdate,\n handleWidthChange,\n handleColumnSelect\n };\n\n // Determine form type and render appropriate component\n if (formGroups.text.includes(normalizedType)) {\n return (\n <TextEditForm\n {...commonTextProps}\n key={`text-form-${elementJSON?.id || 'default'}`}\n />\n );\n }\n\n if (formGroups.select.includes(normalizedType)) {\n return (\n <SelectEditForm\n {...commonSelectProps}\n key={`select-form-${elementJSON?.id || 'default'}`}\n />\n );\n }\n\n if (formGroups.section.includes(normalizedType)) {\n return (\n <SectionEditForm\n element={sectionJSON}\n handlePropertyValueUpdate={handleSectionPropertyValueUpdate}\n key={`section-form-${sectionJSON?.id || 'default'}`}\n />\n );\n }\n\n if (formGroups.checkbox.includes(normalizedType)) {\n return (\n <CheckboxEditForm\n {...commonSelectProps}\n key={`checkbox-form-${elementJSON?.id || 'default'}`}\n />\n );\n }\n\n if (formGroups.table.includes(normalizedType)) {\n return (\n <TableEditForm\n element={elementJSON}\n handlePropertyValueUpdate={handlePropertyValueUpdate}\n handleColumnsUpdate={handleColumnsUpdate}\n fields={formBuilder?.fields || []}\n key={`table-form-${elementJSON?.id || 'default'}`}\n />\n );\n }\n\n // Default fallback with helpful message\n console.warn(`Unknown field type: ${type}`);\n return (\n <div className=\"text-gray-500 p-4 border border-gray-200 rounded\">\n <p className=\"font-medium\">Unknown Field Type</p>\n <p className=\"text-sm mt-1\">\n Field type \"{type}\" is not supported. Please select a valid field to edit.\n </p>\n </div>\n );\n\n } catch (error) {\n console.error('Error in pickPropertyEditForm:', error);\n return (\n <div className=\"text-red-500 p-4 border border-red-200 rounded bg-red-50\">\n <p className=\"font-medium\">Error Loading Form</p>\n <p className=\"text-sm mt-1\">\n There was an error loading the property edit form. Please try again.\n </p>\n </div>\n );\n }\n }, [elementJSON, sectionJSON, formBuilder]);\n\n const addNewSection = useCallback((): void => {\n try {\n if (!element?.section) {\n console.error('Element section template is not available');\n return;\n }\n\n const { uniqueStringId: id } = generateUniqueId('-');\n const newSection: ISectionProperty = {\n ...deepClone(element.section),\n id: id,\n };\n\n // Update switcher forms with new ID if they exist\n if (newSection.switcher_forms) {\n newSection.switcher_forms = newSection.switcher_forms.map(form => ({\n ...form,\n id: generateUniqueId('-').uniqueStringId\n }));\n }\n\n const newSectionIndex = section.length;\n\n appendSection(newSection);\n setActiveSection(newSectionIndex);\n setSelectedHoc('section');\n\n const sectionData: ISectionProperty = {\n field_type: newSection.field_type,\n section_type: newSection.section_type,\n switcher_forms: newSection.switcher_forms,\n form_switcher_label: newSection.form_switcher_label,\n form_switcher_name: newSection.form_switcher_name,\n label: newSection.label,\n is_accordion: newSection.is_accordion,\n id: newSection.id ?? newSectionIndex,\n };\n\n setSectionJSON(sectionData);\n setSectionPositionEditedElement(newSectionIndex);\n pickPropertyEditForm(newSection.field_type);\n } catch (error) {\n console.error('Error adding new section:', error);\n }\n }, [element, section, appendSection, setActiveSection, setSelectedHoc, setSectionJSON, setSectionPositionEditedElement, pickPropertyEditForm]);\n\n /**\n * Enhanced handleAddTab with better validation and error handling\n */\n const handleAddTab = useCallback((): void => {\n try {\n const formWithMembers = deepClone(sectionFormJSON);\n\n // Populate sections with their members\n formWithMembers.forEach((section: ISectionProperty, sectionIndex: number) => {\n section.members = members.filter(\n (member: IProperty) => member?.section_order === sectionIndex\n );\n });\n\n const hasSystemMembers = formWithMembers.some((section: ISectionProperty) =>\n section.members?.some((member: IProperty) => Boolean(member?.is_system_field))\n );\n\n const shouldRemoveTab = !tabsData?.length && hasSystemMembers;\n\n const newTab: TabData = {\n tab_order: tabsData.length + 1,\n title: DEFAULT_TAB_TITLE,\n remove_tab: shouldRemoveTab,\n data: tabsData?.length ? [] : formWithMembers\n };\n\n setTabsData(prevTabs => [...prevTabs, newTab]);\n } catch (error) {\n console.error('Error adding new tab:', error);\n }\n }, [sectionFormJSON, members, tabsData, setTabsData]);\n\n const handleEditTabTitle = useCallback((tabId: number, newTitle: string): void => {\n try {\n if (!isValidNumber(tabId) || !newTitle?.trim()) {\n console.error('Invalid tab ID or title provided');\n return;\n }\n\n setTabsData(prevTabs =>\n prevTabs.map((tab: TabData) =>\n tab.tab_order === tabId ? { ...tab, title: newTitle.trim() } : tab\n )\n );\n } catch (error) {\n console.error('Error editing tab title:', error);\n }\n }, [setTabsData]);\n\n const handleRemoveTab = useCallback((id: number): void => {\n try {\n if (!isValidNumber(id)) {\n console.error('Invalid tab ID provided');\n return;\n }\n\n const filteredTabs = tabsData.filter((tab: TabData) => tab.tab_order !== id);\n\n // Reorder remaining tabs\n const reorderedTabs = filteredTabs.map((tab: TabData) => ({\n ...tab,\n tab_order: tab.tab_order > id ? tab.tab_order - 1 : tab.tab_order,\n }));\n\n setTabsData(reorderedTabs);\n if (activeTabValue == id) {\n setActiveTabValue(reorderedTabs?.length - 1)\n }\n\n if (reorderedTabs.length > 0) {\n const activeTab = reorderedTabs.find(\n (tab: TabData) => tab.tab_order === (activeTabValue ?? 0) + 1\n );\n\n if (activeTab?.data) {\n const sections = activeTab.data.map(\n ({ field_type, label, is_accordion, id, remove_section }) => ({\n field_type,\n label,\n is_accordion,\n id,\n remove_section,\n })\n );\n\n const membersList = activeTab.data.flatMap((section: ISectionProperty) =>\n section.members?.map((member: IProperty) => ({ ...member })) || []\n );\n\n // Clear current data and add new data\n remove();\n removeSection();\n membersList.forEach(member => append(member));\n sections.forEach(section => appendSection(section));\n }\n } else {\n // Clear all data if no tabs remain\n remove();\n removeSection();\n }\n } catch (error) {\n console.error('Error removing tab:', error);\n }\n }, [tabsData, activeTabValue, setTabsData, remove, removeSection, append, appendSection]);\n\n const handleElementSelection = useCallback((e: React.MouseEvent<HTMLElement>): void => {\n try {\n const target = e.target as HTMLElement;\n const elementPositionIndex = target.dataset.position;\n\n if (!elementPositionIndex || !isValidNumber(elementPositionIndex)) {\n console.error('Invalid element position index');\n return;\n }\n\n const positionIndex = Number(elementPositionIndex);\n\n if (positionIndex < 0 || positionIndex >= formJSON.length) {\n console.error('Element position index out of bounds');\n return;\n }\n\n setActiveMember(positionIndex);\n\n const elementDetails = deepClone(formJSON[positionIndex]);\n setPositionEditedElement(positionIndex);\n setElementJSON(elementDetails);\n setSelectedHoc('element');\n } catch (error) {\n console.error('Error selecting element:', error);\n }\n }, [formJSON, setActiveMember, setPositionEditedElement, setElementJSON, setSelectedHoc]);\n\n const handleSectionSelection = useCallback((e: React.MouseEvent<HTMLElement>): void => {\n try {\n const target = e.target as HTMLElement;\n const sectionPositionIndex = target.dataset.position;\n\n if (!sectionPositionIndex || !isValidNumber(sectionPositionIndex)) {\n console.error('Invalid section position index');\n return;\n }\n\n const positionIndex = Number(sectionPositionIndex);\n\n if (positionIndex < 0 || positionIndex >= sectionFormJSON.length) {\n console.error('Section position index out of bounds');\n return;\n }\n\n setActiveSection(positionIndex);\n\n const sectionDetails = deepClone(sectionFormJSON[positionIndex]);\n setSectionPositionEditedElement(positionIndex);\n setSectionJSON(sectionDetails);\n setSelectedHoc('section');\n } catch (error) {\n console.error('Error selecting section:', error);\n }\n }, [sectionFormJSON, setActiveSection, setSectionPositionEditedElement, setSectionJSON, setSelectedHoc]);\n\n const handleAddMember = useCallback((\n e: React.SyntheticEvent<HTMLElement>,\n otherProperties?: Record<string, any>\n ): void => {\n try {\n const target = e.currentTarget as HTMLElement;\n const sectionPositionIndex = target?.dataset?.position;\n\n if (sectionPositionIndex === undefined || !isValidNumber(sectionPositionIndex)) {\n console.error('Invalid section position index for adding member');\n return;\n }\n\n const positionIndex = Number(sectionPositionIndex);\n\n if (positionIndex < 0) {\n console.error('Section position index cannot be negative');\n return;\n }\n\n if (!element?.text) {\n console.error('Element text template is not available');\n return;\n }\n\n const newMember: IProperty = {\n ...deepClone(element.text),\n ...otherProperties,\n section_order: positionIndex,\n type: 'custom',\n is_new: true,\n custom_width: Math.floor(DEFAULT_GRID_COLUMNS / DEFAULT_COLUMN_WIDTH),\n is_fullwidth: false,\n is_system_field: Boolean(otherProperties?.is_system_field),\n id: generateUniqueId().uniqueStringId,\n };\n\n setActiveSection(positionIndex);\n append(newMember);\n\n const elementPositionIndex = members.length;\n setActiveMember(elementPositionIndex);\n setSelectedHoc('element');\n setPositionEditedElement(elementPositionIndex);\n setElementJSON(newMember);\n pickPropertyEditForm(newMember.field_type);\n } catch (error) {\n console.error('Error adding new member:', error);\n }\n }, [element, members, setActiveSection, append, setActiveMember, setSelectedHoc, setPositionEditedElement, setElementJSON, pickPropertyEditForm]);\n\n\n const handleSectionPropertyValueUpdate = useCallback((\n e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement>,\n overrideValue?: any\n ): void => {\n try {\n const { name, type, checked, value } = e.target;\n\n if (!name) {\n console.error('Property name is required for update');\n return;\n }\n\n const updatedValue = overrideValue !== undefined ? overrideValue : (type === 'checkbox' ? checked : value);\n\n // Only update if value actually changed\n if (sectionJSON[name] !== updatedValue) {\n setSectionJSON(prev => ({ ...prev, [name]: updatedValue }));\n }\n } catch (error) {\n console.error('Error updating section property:', error);\n }\n }, [sectionJSON, setSectionJSON]);\n\n const handleWidthChange = useCallback((newCustomWidth: number): void => {\n try {\n if (!isValidNumber(newCustomWidth) || newCustomWidth < 1 || newCustomWidth > DEFAULT_GRID_COLUMNS) {\n console.error('Invalid width value provided');\n return;\n }\n\n setElementJSON(prevData => ({\n ...prevData,\n custom_width: newCustomWidth,\n }));\n } catch (error) {\n console.error('Error updating width:', error);\n }\n }, [setElementJSON]);\n\n const handleColumnSelect = useCallback((e: React.ChangeEvent<HTMLSelectElement>): void => {\n try {\n const columnValue = Number(e.target.value);\n\n if (!isValidNumber(columnValue) || columnValue <= 0) {\n console.error('Invalid column value provided');\n return;\n }\n\n const elementPerColumn = Math.floor(DEFAULT_GRID_COLUMNS / columnValue);\n\n if (elementPerColumn <= 0) {\n console.error('Calculated element per column is invalid');\n return;\n }\n\n // Batch update all members\n members.forEach((field: IProperty, index: number) => {\n update(index, { ...field, custom_width: elementPerColumn });\n });\n } catch (error) {\n console.error('Error updating column selection:', error);\n }\n }, [members, update]);\n\n const handlePropertyValueUpdate = useCallback((\n e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement>,\n numberValue?: number,\n val?: string,\n fieldType?: keyof typeof FIELD_TYPES\n ): void => {\n try {\n const getValue = (): any => {\n if (fieldType) return fieldType;\n if (val !== undefined) return val;\n if (numberValue !== undefined) return numberValue;\n return e?.target?.value;\n };\n\n const value = getValue();\n const elementJSONCopy = deepClone(elementJSON);\n\n if (e?.target?.name) {\n elementJSONCopy[e.target.name] = e.target.type === 'checkbox' ? e.target.checked : value;\n }\n // Only update if there's an actual change\n if (fieldType) {\n const { uniqueStringId: uniqueId } = generateUniqueId();\n const copyOfUpdatedElement: IProperty = {\n ...element[fieldType],\n section_form_id: elementJSONCopy?.section_form_id,\n is_form_switcher_section: elementJSONCopy?.is_form_switcher_section,\n section_order: elementJSONCopy.section_order,\n id: uniqueId,\n type: 'custom',\n is_system_field: Boolean(elementJSONCopy?.is_system_field),\n is_new: true,\n column_width: elementJSONCopy?.column_width || 6,\n custom_width: elementJSONCopy?.custom_width || 6\n };\n setElementJSON(copyOfUpdatedElement);\n } else if (JSON.stringify(elementJSON) !== JSON.stringify(elementJSONCopy)) {\n setElementJSON({ ...elementJSON, ...elementJSONCopy });\n }\n } catch (error) {\n console.error('Error updating property value:', error);\n }\n }, [elementJSON, element, setElementJSON]);\n\n const handleSelectOptionValueUpdate = useCallback((options: any[]): void => {\n try {\n if (!Array.isArray(options)) {\n console.error('Options must be an array');\n return;\n }\n\n const elementJSONCopy = deepClone(elementJSON);\n elementJSONCopy.options = [...options];\n const { uniqueStringId: uniqueId } = generateUniqueId('-');\n\n if (JSON.stringify(elementJSON.options) !== JSON.stringify(options)) {\n setElementJSON({ ...elementJSON, ...elementJSONCopy, id: uniqueId });\n }\n } catch (error) {\n console.error('Error updating select options:', error);\n }\n }, [elementJSON, setElementJSON]);\n\n const handleColumnsUpdate = useCallback((columns: MRT_ColumnDef<MRT_RowData>[]): void => {\n try {\n if (!Array.isArray(columns)) {\n console.error('Columns must be an array');\n return;\n }\n\n const elementJSONCopy = deepClone(elementJSON);\n elementJSONCopy.table_columns = [...columns];\n const { uniqueStringId: uniqueId } = generateUniqueId('-');\n\n if (JSON.stringify(elementJSON.table_columns) !== JSON.stringify(columns)) {\n setElementJSON({ ...elementJSON, ...elementJSONCopy, id: uniqueId });\n }\n } catch (error) {\n console.error('Error updating table columns:', error);\n }\n }, [elementJSON, setElementJSON]);\n\n const handleRemoveSection = useCallback((sectionIndex: number): void => {\n try {\n if (!isValidNumber(sectionIndex) || sectionIndex < 0 || sectionIndex >= section.length) {\n console.error('Invalid section index for removal');\n return;\n }\n\n setRemoveSectionPosition(sectionIndex);\n removeSection(sectionIndex);\n\n // Remove associated members in reverse order to maintain indices\n const membersToRemove: number[] = [];\n members.forEach((member: IProperty, index: number) => {\n if (member?.section_order === sectionIndex) {\n membersToRemove.push(index);\n }\n });\n\n // Remove members in reverse order to maintain correct indices\n membersToRemove.reverse().forEach(memberIndex => {\n remove(memberIndex);\n });\n\n setRemoveSectionActionPerformed(true);\n } catch (error) {\n console.error('Error removing section:', error);\n }\n }, [section, members, setRemoveSectionPosition, removeSection, remove, setRemoveSectionActionPerformed]);\n\n const handleMakeAccordion = useCallback((sectionIndex: number): void => {\n try {\n if (!isValidNumber(sectionIndex) || sectionIndex < 0 || sectionIndex >= section.length) {\n console.error('Invalid section index for accordion conversion');\n return;\n }\n\n setModifyAccordion(true);\n setSectionPositionEditedElement(sectionIndex);\n setActiveSection(sectionIndex);\n\n const copyOfSection: ISectionProperty = {\n ...deepClone(section[sectionIndex]),\n is_accordion: true\n };\n\n updateSection(sectionIndex, copyOfSection);\n setSelectedHoc('section');\n setSectionJSON(copyOfSection);\n pickPropertyEditForm(copyOfSection.field_type);\n } catch (error) {\n console.error('Error making section accordion:', error);\n }\n }, [section, setModifyAccordion, setSectionPositionEditedElement, setActiveSection, updateSection, setSelectedHoc, setSectionJSON, pickPropertyEditForm]);\n\n const handleTabData = useCallback((): void => {\n try {\n const formWithMembers = deepClone(sectionFormJSON);\n\n formWithMembers.forEach((section: ISectionProperty, sectionIndex: number) => {\n section.members = members.filter(\n (member: IProperty) => member?.section_order === sectionIndex\n );\n });\n\n const hasSystemMembers = formWithMembers.some((section: ISectionProperty) =>\n section.members?.some((member: IProperty) => Boolean(member?.is_system_field))\n );\n\n const activeTabIndex = Number(activeTabValue);\n if (isValidNumber(activeTabIndex) && activeTabIndex >= 0 && activeTabIndex < tabsData.length) {\n const updatedTabsData = [...tabsData];\n updatedTabsData[activeTabIndex] = {\n ...updatedTabsData[activeTabIndex],\n data: formWithMembers,\n remove_tab: hasSystemMembers,\n };\n setTabsData(updatedTabsData)\n remove();\n removeSection();\n setActiveMember(undefined);\n setSelectedHoc(\"\");\n setActiveSection(undefined);\n }\n } catch (error) {\n console.error('Error updating tab data:', error);\n }\n }, [sectionFormJSON, members, activeTabValue, tabsData, setTabsData]);\n\n // const handlePreview = () => {\n // const formWithMembers = JSON.parse(JSON.stringify(sectionFormJSON));\n\n // formWithMembers.forEach(\n // (section: ISectionProperty, sectionIndex: number) => {\n // section.members = members.filter(\n // (member: any) => member?.section_order === sectionIndex,\n // ) as (IProperty | ISelectProperty)[];\n // },\n // );\n // const state = tabsData?.length\n // ? { tab: tabsData }\n // : { section: formWithMembers };\n\n // const FormBuilderConversion = state && formBuilderConversion(state);\n\n // setPreviewFields(FormBuilderConversion);\n // };\n\n // Option 1: Using useMemo to memoize the expensive computation\n const formWithMembers = useMemo(() => {\n if (!sectionFormJSON || !members) return null;\n\n return sectionFormJSON.map((section: ISectionProperty, sectionIndex: number) => ({\n ...section,\n members: members.filter(\n (member: any) => member?.section_order === sectionIndex,\n ) as (IProperty | ISelectProperty)[]\n }));\n }, [sectionFormJSON, members]);\n\n const previewState = useMemo(() => {\n if (!formWithMembers) return null;\n\n return tabsData?.length\n ? { tab: tabsData }\n : { section: formWithMembers };\n }, [tabsData, formWithMembers]);\n\n const previewFields = useMemo(() => {\n if (!previewState) return null;\n return formBuilderConversion(previewState);\n }, [previewState]);\n\n\n // Option 2: Optimized handlePreview function using useCallback\n const showPreview = useCallback(() => {\n if (previewFields) {\n setPreviewFields(previewFields);\n }\n }, [previewFields, setPreviewFields]);\n const hidePreview = useCallback(() => {\n setPreviewFields(null);\n }, []);\n\n // Enhanced handleFormUpdate with proper error handling and validation\n const handleFormUpdate = useCallback(async (): void => {\n try {\n\n\n\n // Early validation checks\n if (!sectionFormJSON || !Array.isArray(sectionFormJSON)) {\n console.warn('Invalid sectionFormJSON provided');\n return;\n }\n\n if (!members || !Array.isArray(members)) {\n console.warn('Invalid members array provided');\n return;\n }\n\n if (!rowData?._id) {\n console.warn('Missing rowData._id for form update');\n return;\n }\n\n // Deep clone with proper error handling\n let formWithMembers: IEnhancedSectionProperty[];\n\n try {\n formWithMembers = structuredClone(sectionFormJSON);\n } catch (cloneError) {\n // Fallback to JSON method if structuredClone is not available\n formWithMembers = JSON.parse(JSON.stringify(sectionFormJSON));\n }\n\n // Enhanced member filtering with better type safety and validation\n formWithMembers.forEach((section: IEnhancedSectionProperty, sectionIndex: number) => {\n // Validate section object\n if (!section || typeof section !== 'object') {\n console.warn(`Invalid section at index ${sectionIndex}`);\n return;\n }\n\n // Filter members with proper type checking and validation\n section.members = members.filter((member: IMember) => {\n // Validate member object and section_order\n return (\n member &&\n typeof member === 'object' &&\n typeof member.section_order === 'number' &&\n member.section_order === sectionIndex\n );\n }) as (IProperty | ISelectProperty)[];\n });\n\n const hasSystemMembers = formWithMembers.some((section: ISectionProperty) =>\n section.members?.some((member: IProperty) => Boolean(member?.is_system_field))\n );\n\n const activeTabIndex = Number(activeTabValue);\n let updatedTabsData = [...tabsData];\n if (isValidNumber(activeTabIndex) && activeTabIndex >= 0 && activeTabIndex < tabsData.length) {\n updatedTabsData = [...tabsData];\n updatedTabsData[activeTabIndex] = {\n ...updatedTabsData[activeTabIndex],\n data: formWithMembers,\n remove_tab: hasSystemMembers,\n };\n\n setTabsData(updatedTabsData)\n }\n\n // Build state object with proper validation\n const state: IFormState = updatedTabsData?.length > 0\n ? { tab: updatedTabsData }\n : { section: formWithMembers };\n\n // Validate formBuilderConversion function exists\n if (typeof formBuilderConversion !== 'function') {\n console.error('formBuilderConversion is not a function');\n return;\n }\n\n // Execute conversion with error handling\n let formBuilderConversionResult: any;\n try {\n formBuilderConversionResult = formBuilderConversion(state);\n } catch (conversionError) {\n console.error('Error during form builder conversion:', conversionError);\n return;\n }\n\n // Validate conversion result\n if (!formBuilderConversionResult) {\n console.warn('Form builder conversion returned empty result');\n return;\n }\n\n // Validate elementPerColumn\n // if (typeof elementPerColumn !== 'number' || elementPerColumn <= 0) {\n\n // console.warn('Invalid elementPerColumn value');\n // return;\n // }\n\n // Prepare payload with validation\n const updatePayload: IFormUpdatePayload = {\n gridCol: elementPerColumn || 2,\n fields: formBuilderConversionResult\n };\n\n // Dispatch update action\n const updateRes = await dispatch(\n patchFormDataById({\n id: rowData._id,\n data: updatePayload\n })\n );\n if (updateRes.meta.requestStatus === 'rejected') {\n\n const m = getErrorMessage(updateRes?.error?.message);\n enqueueSnackbar(m, { variant: 'error' });\n } else {\n enqueueSnackbar(\"Form updated successfully\", { variant: 'success' });\n navigate(path);\n }\n\n } catch (error) {\n const m = error?.message || 'Something went wrong while updating the form';\n enqueueSnackbar(m, { variant: 'error' });\n }\n }, [\n sectionFormJSON,\n members,\n tabsData,\n rowData?._id,\n elementPerColumn,\n dispatch,\n formBuilderConversion\n ]);\n\n const handleDuplicateElement = (index: number) => {\n const copyOfMember: any = { ...members[index], type: \"custom\" };\n copyOfMember && insert(index + 1, copyOfMember);\n setActiveMember(index + 1);\n setSelectedHoc(\"element\");\n setPositionEditedElement(index + 1);\n setElementJSON(copyOfMember);\n pickPropertyEditForm(copyOfMember.field_type);\n };\n\n const breadCrumbPath = [\n {\n link: path,\n label: \"Forms\",\n },\n {\n link: \"\",\n label: formatLabel(rowData?.name),\n },\n {\n link: \"\",\n label: \"Edit Form\",\n },\n ];\n\n\n useEffect(() => {\n if (removeSectionActionPerformed) {\n members.forEach((member: any, index: number) => {\n if (\n removeSectionPosition !== undefined &&\n Boolean(removeSectionPosition?.toString) &&\n member.section_order > removeSectionPosition\n ) {\n update(index, { ...member, section_order: member.section_order - 1 });\n }\n });\n setRemoveSectionActionPerformed(false);\n setRemoveSectionMembersPerformed(true);\n setRemoveSectionPosition(undefined);\n setSelectedHoc(\"\");\n }\n\n // eslint-disable-next-line\n }, [removeSectionActionPerformed]);\n\n useEffect(() => {\n formBuilder.isSuccess && navigate(path);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [formBuilder.isSuccess]);\n\n useEffect(() => {\n if (formBuilder.isError) {\n setToast({\n type: 'alert',\n message: formBuilder.error\n });\n }\n }, [formBuilder.error, formBuilder.isError]);\n\n useEffect(() => {\n if (\n typeof positionEditedElement !== \"number\" ||\n typeof positionEditedElement !== \"string\"\n ) {\n const index = Number(positionEditedElement);\n if (formJSON[index]) {\n const copyOfUpdatedFormJson = JSON.parse(\n JSON.stringify(formJSON[index]),\n );\n update(index, { ...copyOfUpdatedFormJson });\n }\n }\n // eslint-disable-next-line\n }, [formJSON]);\n\n useEffect(() => {\n const updatedFormJSON = formJSON.map((obj: any, index: number) => {\n if (index === Number(positionEditedElement)) {\n return { ...elementJSON };\n } else {\n return { ...obj };\n }\n });\n setFormJSON(updatedFormJSON);\n\n // eslint-disable-next-line\n }, [elementJSON]);\n\n useEffect(() => {\n if (members.length !== formJSON.length) {\n setFormJSON(JSON.parse(JSON.stringify(members)));\n }\n if (\n Boolean(elementSwap) &&\n JSON.stringify(members) !== JSON.stringify(formJSON)\n ) {\n setFormJSON(JSON.parse(JSON.stringify(members)));\n setElementSwap(false);\n const newMember: any =\n positionEditedElement && members[positionEditedElement];\n newMember && setSelectedHoc(\"element\");\n newMember && setElementJSON(newMember);\n newMember && pickPropertyEditForm(newMember.field_type);\n }\n if (\n removeSectionMembersPerformed &&\n JSON.stringify(members) !== JSON.stringify(formJSON)\n ) {\n setFormJSON(JSON.parse(JSON.stringify(members)));\n setRemoveSectionMembersPerformed(false);\n }\n // eslint-disable-next-line\n }, [members, elementSwap]);\n\n useEffect(() => {\n if (\n typeof sectionPositionEditedElement !== \"number\" ||\n typeof sectionPositionEditedElement !== \"string\"\n ) {\n const index = Number(sectionPositionEditedElement);\n if (sectionFormJSON[index]) {\n const copyOfUpdatedFormJson = JSON.parse(\n JSON.stringify(sectionFormJSON[index]),\n );\n updateSection(index, { ...copyOfUpdatedFormJson });\n }\n }\n // eslint-disable-next-line\n }, [sectionFormJSON]);\n\n useEffect(() => {\n const updatedFormJSON = sectionFormJSON.map((obj: any, index: number) => {\n if (index === Number(sectionPositionEditedElement)) {\n return { ...obj, ...sectionJSON };\n } else {\n return { ...obj };\n }\n });\n setSectionFormJSON(updatedFormJSON);\n // eslint-disable-next-line\n }, [sectionJSON]);\n\n useEffect(() => {\n if (section.length !== sectionFormJSON.length) {\n setSectionFormJSON(JSON.parse(JSON.stringify(section)));\n }\n if (\n JSON.stringify(sectionFormJSON) !== JSON.stringify(section) &&\n modifyAccordion\n ) {\n setSectionFormJSON(JSON.parse(JSON.stringify(section)));\n setModifyAccordion(false);\n }\n // eslint-disable-next-line\n }, [section]);\n\n useEffect(() => {\n () => setInitialLoading(true);\n }, [])\n\n const handleFormData = useCallback(async () => {\n setInitialLoading(true)\n try {\n if (rowData?._id) {\n setTabsData([])\n await dispatch(getFormDataById(rowData?._id));\n await dispatch(getFieldsByFormId({ id: rowData?._id }));\n\n }\n } finally {\n setInitialLoading(false);\n }\n\n }, [rowData?._id])\n\n useEffect(() => {\n handleFormData();\n }, [handleFormData]);\n\n type SelectedHoc = \"element\" | \"section\" | null;\n\n // Constants\n const DEFAULT_FIELD_TYPE = \"text\";\n const HOC_TYPES = {\n ELEMENT: \"element\",\n SECTION: \"section\"\n } as const;\n\n // Helper function to check if object has meaningful content\n const hasValidContent = (obj: Record<string, any>): boolean => {\n return obj && Object.keys(obj).length > 0;\n };\n\n const EmptyStateMessage = () => (\n <Typography type=\"s5\" color={\"theme.secondary.800\"} className=\"formSection--Text\">Select a field to edit its properties.</Typography>\n )\n\n // Helper function to get field type with fallback\n const getFieldTypeWithFallback = (\n json: ElementJSON | SectionJSON | null | undefined,\n fallback: string = DEFAULT_FIELD_TYPE\n ): string => {\n return json?.field_type || fallback;\n };\n\n const memoizedForm = useMemo(() => {\n // Early return for empty state\n if (!selectedHoc) {\n\n return <EmptyStateMessage />;\n }\n\n // Handle element selection\n if (selectedHoc === HOC_TYPES.ELEMENT) {\n if (!hasValidContent(members)) {\n console.warn('Element selected but no members data available');\n return <EmptyStateMessage />;\n }\n\n const fieldType = getFieldTypeWithFallback(elementJSON);\n return pickPropertyEditForm(fieldType);\n }\n\n // Handle section selection\n if (selectedHoc === HOC_TYPES.SECTION) {\n if (!hasValidContent(section)) {\n console.warn('Section selected but no section data available');\n return <EmptyStateMessage />;\n }\n\n const fieldType = getFieldTypeWithFallback(sectionJSON);\n return pickPropertyEditForm(fieldType);\n }\n\n // Fallback for unknown selection type\n console.warn(`Unknown selectedHoc type: ${selectedHoc}`);\n return <EmptyStateMessage />;\n }, [\n // Core dependencies\n selectedHoc,\n\n // Data dependencies\n Object.keys(members).length,\n Object.keys(section).length,\n\n // JSON dependencies with deep comparison consideration\n elementJSON?.field_type,\n elementJSON?.field_properties,\n sectionJSON?.field_type,\n sectionJSON?.field_properties,\n\n // Function dependency\n pickPropertyEditForm\n ]);\n\n return (\n // <FullScreenLayout className=\"formSection--Layout\">\n <Box position='relative'>\n {initialLoading ? <ErpLoader /> :\n <DndProvider backend={HTML5Backend}>\n <FormHeader breadCrumbPath={breadCrumbPath}>\n <div className=\"formSection--Buttons\">\n <Button\n variant=\"outlined\"\n className=\"formSection--PreviewButton\"\n text=\"Preview\"\n onClick={() => { !previewFieldsData ? showPreview() : hidePreview() }}\n disable={!members?.length}\n startIcon={previewFieldsData ? <EyeOff /> : <Eye />}\n />\n <Button\n variant=\"contained\"\n type=\"submit\"\n text=\"Update\"\n onClick={handleFormUpdate}\n disable={previewFieldsData}\n />\n </div>\n </FormHeader>\n {!previewFieldsData ?\n <Grid className=\"formSection--Grid\" container>\n <Grid\n item\n xs={9}\n component=\"form\"\n sx={{\n position: \"relative\",\n background: \"#F5F6F5\",\n padding: \"0.75rem\",\n }}\n >\n <Grid className=\"formSection--GridContainer\">\n <Box className=\"formSection--Tab\">\n {tabsData && (\n <TabBar\n tabs={tabsData}\n onEditTabTitle={handleEditTabTitle}\n activeValue={activeTabValue}\n setActiveValue={setActiveTabValue}\n handleTabChange={() => {\n handleTabData()\n }}\n handleRemoveTab={handleRemoveTab}\n containerProps={{ mb: 0 }}\n />\n )}\n <Button\n variant=\"outlined\"\n text=\"Add Tab\"\n onClick={handleAddTab}\n style={{ color: \"#292D32\", margin: \"0.5rem\" }}\n />\n </Box>\n <div className=\"formSection--Form\">\n {section?.map((item: any, i: number) => {\n const sectionMembers = members.filter(\n (member: any) => member.section_order === i,\n );\n const isFormSwitcher = item.section_type === SECTION_TYPES.FORM_SWITCH_SECTION\n const switchForms = item?.switcher_forms?.map((form: any) => ({\n ...form,\n formMembers: members.filter(\n (member: any) => member.section_form_id === form.id,\n )\n }))\n\n return (\n <DynamicSectionHOC\n index={i}\n label={t(item.label)}\n onClick={handleSectionSelection}\n position={i}\n fieldArrayName=\"section\"\n isFormSwitcher={isFormSwitcher}\n activeIndex={activeSection === i}\n removeSection={() => handleRemoveSection(i)}\n handleAccordion={() => handleMakeAccordion(i)}\n handleAddButton={(e) => handleAddMember(e)}\n remove_section={item.remove_section}\n >\n {isFormSwitcher ? (\n <div style={{ width: '100%' }} >\n <Typography type=\"s5\" style={{ fontWeight: 500 }} color={\"theme.secondary.800\"}>\n {item.form_switcher_label}\n </Typography>\n <RadioGroup\n aria-labelledby=\"theme-radio-buttons-group-label\"\n name={item.form_switcher_name || item.form_switcher_label}\n >\n\n {switchForms?.map(({ name, id, formMembers }: { name: string, id: number, formMembers: any }) => (\n <>\n <div>\n <FormControlLabel\n key={id}\n value={name}\n control={<Radio />}\n label={t(name)}\n disabled\n />\n </div>\n\n <Grid container sx={{ mb: 3 }}>\n <FormFields\n sectionMembers={formMembers || []}\n members={members}\n activeMember={activeMember}\n control={control}\n t={t}\n element={element}\n images={images}\n elementJSON={elementJSON}\n remove={remove}\n move={move}\n handleElementSelection={handleElementSelection}\n setElementSwap={setElementSwap}\n handleDuplicateElement={handleDuplicateElement}\n setSelectedHoc={setSelectedHoc}\n setActiveMember={setActiveMember}\n />\n </Grid>\n <Button\n text=\"Add\"\n variant=\"outlined\"\n className=\"formSection--PreviewButton\"\n data-position={i}\n onClick={(e) => handleAddMember(e, {\n section_form_id: id,\n is_form_switcher_section: true\n })}\n startIcon={<Add />}\n />\n </>\n ))}\n </RadioGroup>\n </div>\n ) : null}\n {!isFormSwitcher &&\n <FormFields\n sectionMembers={sectionMembers || []}\n members={members}\n activeMember={activeMember}\n control={control}\n t={t}\n element={element}\n images={images}\n elementJSON={elementJSON}\n remove={remove}\n move={move}\n handleElementSelection={handleElementSelection}\n setElementSwap={setElementSwap}\n handleDuplicateElement={handleDuplicateElement}\n setSelectedHoc={setSelectedHoc}\n setActiveMember={setActiveMember}\n />\n }\n </DynamicSectionHOC>\n );\n })}\n <div className=\"formSection--Section\">\n <Button\n text=\"Add a section\"\n variant=\"outlined\"\n className=\"formSection--PreviewButton\"\n onClick={addNewSection}\n startIcon={<Add />}\n />\n </div>\n </div>\n </Grid>\n\n </Grid>\n <Grid\n item\n xs={3}\n className={\n Boolean(selectedHoc) && (members?.length || section.length)\n ? \"formSection--RightGrid\"\n : \"formSection--RightGrid formSection--Text\"\n }\n >\n {memoizedForm}\n </Grid>\n </Grid>\n :\n <FormParser\n data={previewFieldsData || []}\n handleFormSubmit={(data) => console.log(\"Preview Data\", data)}\n className='form-container'\n fieldArrayName='form-builder-preview'\n getFormMethods={(methods: any) =>\n setFormParserMethods({ ...methods })\n }\n />\n }\n <Toast\n open={Boolean(toast)}\n type={toast?.type}\n message={toast?.message}\n handleClose={() => setToast(null)}\n anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}\n />\n </DndProvider>}\n </Box>\n // </FullScreenLayout>\n );\n}\n\nexport default CustomForm;\n"],"names":["isValidNumber","value","isNaN","Number","isFinite","deepClone","obj","JSON","parse","stringify","generateUniqueId","separator","uniqueStringId","Date","now","Math","random","toString","substr","CustomForm","t","useTranslation","dispatch","useAppDispatch","navigate","useNavigate","location","useLocation","rowData","state","formBuilder","useAppSelector","control","useForm","reValidateMode","fields","members","append","remove","update","move","insert","useFieldArray","name","section","appendSection","removeSection","updateSection","selectedHoc","setSelectedHoc","useState","activeSection","setActiveSection","activeMember","setActiveMember","formJSON","setFormJSON","elementJSON","setElementJSON","positionEditedElement","setPositionEditedElement","sectionFormJSON","setSectionFormJSON","sectionJSON","setSectionJSON","sectionPositionEditedElement","setSectionPositionEditedElement","removeSectionActionPerformed","setRemoveSectionActionPerformed","removeSectionMembersPerformed","setRemoveSectionMembersPerformed","removeSectionPosition","setRemoveSectionPosition","initialLoading","setInitialLoading","tabsData","setTabsData","activeTabValue","setActiveTabValue","elementSwap","setElementSwap","modifyAccordion","setModifyAccordion","toast","setToast","previewFieldsData","setPreviewFields","_","setFormParserMethods","currentModule","pathname","split","path","generateModulePath","useFormDataEffect","pickPropertyEditForm","useCallback","type","jsx","className","children","normalizedType","toLowerCase","trim","formGroups","text","select","checkbox","table","commonTextProps","element","handlePropertyValueUpdate","handleWidthChange","handleColumnSelect","commonSelectProps","handleSelectOptionValueUpdate","includes","createElement","TextEditForm","key","id","SelectEditForm","SectionEditForm","handleSectionPropertyValueUpdate","CheckboxEditForm","TableEditForm","handleColumnsUpdate","jsxs","error","addNewSection","newSection","switcher_forms","map","form","newSectionIndex","length","sectionData","field_type","section_type","form_switcher_label","form_switcher_name","label","is_accordion","handleAddTab","formWithMembers","forEach","sectionIndex","filter","member","section_order","hasSystemMembers","some","Boolean","is_system_field","shouldRemoveTab","newTab","tab_order","title","remove_tab","data","prevTabs","handleEditTabTitle","tabId","newTitle","tab","handleRemoveTab","reorderedTabs","activeTab","find","sections","remove_section","membersList","flatMap","handleElementSelection","e","elementPositionIndex","target","dataset","position","positionIndex","elementDetails","handleSectionSelection","sectionPositionIndex","sectionDetails","handleAddMember","otherProperties","currentTarget","_a","newMember","is_new","custom_width","floor","DEFAULT_GRID_COLUMNS","is_fullwidth","overrideValue","checked","updatedValue","prev","newCustomWidth","prevData","columnValue","elementPerColumn","field","index","numberValue","val","fieldType","getValue","elementJSONCopy","uniqueId","copyOfUpdatedElement","section_form_id","is_form_switcher_section","column_width","options","Array","isArray","columns","table_columns","handleRemoveSection","membersToRemove","push","reverse","memberIndex","handleMakeAccordion","copyOfSection","handleTabData","activeTabIndex","updatedTabsData","useMemo","previewState","previewFields","formBuilderConversion","showPreview","hidePreview","handleFormUpdate","async","_id","structuredClone","cloneError","formBuilderConversionResult","conversionError","updatePayload","gridCol","updateRes","patchFormDataById","meta","requestStatus","m","getErrorMessage","message","enqueueSnackbar","variant","handleDuplicateElement","copyOfMember","breadCrumbPath","link","formatLabel","useEffect","isSuccess","isError","copyOfUpdatedFormJson","updatedFormJSON","handleFormData","getFormDataById","getFieldsByFormId","hasValidContent","Object","keys","EmptyStateMessage","Typography","color","getFieldTypeWithFallback","json","fallback","memoizedForm","field_properties","Box","ErpLoader","DndProvider","backend","HTML5Backend","FormHeader","Button","onClick","disable","startIcon","EyeOff","Eye","FormParser","handleFormSubmit","fieldArrayName","getFormMethods","methods","Grid","container","item","xs","component","sx","background","padding","TabBar","tabs","onEditTabTitle","activeValue","setActiveValue","handleTabChange","containerProps","mb","style","margin","i","sectionMembers","isFormSwitcher","SECTION_TYPES","FORM_SWITCH_SECTION","switchForms","formMembers","DynamicSectionHOC","activeIndex","handleAccordion","handleAddButton","width","fontWeight","RadioGroup","Fragment","FormControlLabel","Radio","disabled","FormFields","images","Add","Toast","open","handleClose","anchorOrigin","horizontal","vertical"],"mappings":"gpEAuFA,MAIMA,EAAiBC,IAAyBC,MAAMC,OAAOF,KAAWG,SAASD,OAAOF,IAClFI,EAAaC,GAAcC,KAAKC,MAAMD,KAAKE,UAAUH,IACrDI,EAAmB,CAACC,EAAY,MAC7B,CAAEC,eAAgB,GAAGC,KAAKC,QAAQH,IAAYI,KAAKC,SAASC,SAAS,IAAIC,OAAO,EAAG,OAIrF,SAASC,IACd,MAAMC,EAAEA,GAAMC,mBACRC,EAAWC,EAAAA,iBACXC,EAAWC,EAAAA,cACXC,EAAWC,EAAAA,cACXC,EAAUF,EAASG,OAAS,GAE5BC,EAAcC,EAAAA,eAAgBF,GAAUA,EAAMC,cAE9CE,QAAEA,GAAYC,UAAQ,CAC1BC,eAAgB,YAIhBC,OAAQC,EAAAC,OACRA,EAAAC,OACAA,EAAAC,OACAA,EAAAC,KACAA,EAAAC,OACAA,IACEC,gBAAc,CAChBV,UACAW,KAAM,aAINR,OAAQS,GACRP,OAAQQ,GACRP,OAAQQ,GACRP,OAAQQ,IACNL,gBAAc,CAChBV,UACAW,KAAM,aAGDK,GAAaC,IAAkBC,EAAAA,SAAS,KACxCC,GAAeC,IAAoBF,cACnCG,GAAcC,IAAmBJ,cAEjCK,GAAUC,IAAeN,EAAAA,SAAmB,KAC5CO,GAAaC,IAAkBR,EAAAA,SAAc,OAC7CS,GAAuBC,IAA4BV,cAInDW,GAAiBC,IAAsBZ,EAAAA,SAAmB,KAC1Da,GAAaC,IAAkBd,EAAAA,SAAc,CAAA,IAC7Ce,GAA8BC,IACnChB,cACKiB,GAA8BC,IACnClB,EAAAA,UAAS,IACJmB,GAA+BC,IACpCpB,EAAAA,UAAS,IACJqB,GAAuBC,IAA4BtB,cAGnDuB,GAAgBC,IAAqBxB,EAAAA,UAAS,IAC9CyB,GAAUC,IAAe1B,EAAAA,SAAgB,KACzC2B,GAAgBC,IAAqB5B,EAAAA,SAA6B,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"index.js","sources":["../../../../src/views/form-builder/custom-form.tsx"],"sourcesContent":["// React imports\nimport { useState, useEffect, useMemo, useCallback } from \"react\";\n\n// React Router imports\nimport { useLocation, useNavigate } from \"react-router-dom\";\n\n// React Hook Form imports\nimport { useForm, useFieldArray } from \"react-hook-form\";\n\n// Material UI imports\nimport { Box, FormControlLabel, Grid, RadioGroup } from \"@mui/material\";\nimport { Add } from \"@mui/icons-material\";\n\n// Third-party imports\nimport { DndProvider } from \"react-dnd\";\nimport { HTML5Backend } from \"react-dnd-html5-backend\";\nimport { MRT_ColumnDef, MRT_RowData } from \"material-react-table\";\nimport { useTranslation } from \"react-i18next\";\nimport { enqueueSnackbar } from \"notistack\";\n\n// ERP Common imports\nimport DynamicSectionHOC from \"@/components/form-control/form-builder/form-builder-element/section\";\nimport Button from \"@/components/form-control/form-builder/form-builder-element/button\";\nimport TabBar from \"@/components/tabs/tabs\";\nimport images from \"@/assets/images\";\nimport { Pathname } from \"@/constants\";\nimport FormHeader from \"@/components/form-header/form-header\";\nimport Typography from \"@/components/typography/typography\";\nimport formBuilderConversion from \"@/utils/form-builder-conversion\";\nimport { useAppDispatch, useAppSelector } from \"@/redux/hooks\";\nimport { formatLabel } from \"@/utils/format-text\";\nimport Toast from \"@/components/toast/toast\";\nimport Radio from \"@/components/radio/radio\";\nimport { SECTION_TYPES } from \"@/utils/constant\";\nimport ErpLoader from \"@/components/loaders/erp-loader\";\nimport { getErrorMessage } from \"@/utils/common\";\nimport FormParser from \"@/components/form-control/form-parser/form-parser\";\nimport { Eye, EyeOff } from \"@/components/icons\";\n\n// Redux actions\nimport {\n patchFormDataById,\n getFormDataById,\n getFieldsByFormId,\n} from \"../form-builder/redux/actionCreator\";\n\n// Local imports\nimport {\n IProperty,\n ISectionProperty,\n ISelectProperty,\n element,\n} from \"./field_properties\";\nimport TextEditForm from \"./element-edit-forms/text\";\nimport SelectEditForm from \"./element-edit-forms/select\";\nimport SectionEditForm from \"./element-edit-forms/section\";\nimport CheckboxEditForm from \"./element-edit-forms/checkbox\";\nimport TableEditForm from \"./element-edit-forms/table-form\";\nimport FormFields from \"./form-fields\";\nimport { generateModulePath, useFormDataEffect } from \"./utils/common\";\nimport \"./custom-form.scss\";\n\nexport interface IElementJson extends IProperty {\n type: string;\n}\n\nconst FIELD_TYPES = {\n TEXT: 'text',\n NUMBER: 'number',\n EMAIL: 'email',\n PHONE: 'phone',\n SELECT: 'select',\n DATE: 'date',\n TIME: 'time',\n URL: 'url',\n CURRENCY: 'currency',\n FILE: 'file',\n GEO_LOCATION: 'geoLocation',\n IMAGE: 'image',\n SECTION: 'section',\n INFO: 'info',\n RELATION: 'relation',\n CHECKBOX: 'checkbox',\n TOGGLE_BUTTON: 'toggleButton',\n TAGS_INPUT: 'tagsInput'\n} as const;\n\nconst DEFAULT_GRID_COLUMNS = 12;\nconst DEFAULT_COLUMN_WIDTH = 2;\nconst DEFAULT_TAB_TITLE = 'data';\n\nconst isValidNumber = (value: any): boolean => !isNaN(Number(value)) && isFinite(Number(value));\nconst deepClone = (obj: T): T => JSON.parse(JSON.stringify(obj));\nconst generateUniqueId = (separator = ''): { uniqueStringId: string } => {\n return { uniqueStringId: `${Date.now()}${separator}${Math.random().toString(36).substr(2, 9)}` };\n};\n\n\nexport function CustomForm() {\n const { t } = useTranslation();\n const dispatch = useAppDispatch();\n const navigate = useNavigate();\n const location = useLocation();\n const rowData = location.state ?? [];\n\n const formBuilder = useAppSelector((state) => state.formBuilder);\n\n const { control } = useForm({\n reValidateMode: \"onBlur\",\n });\n\n const {\n fields: members,\n append,\n remove,\n update,\n move,\n insert,\n } = useFieldArray({\n control,\n name: \"members\",\n });\n\n const {\n fields: section,\n append: appendSection,\n remove: removeSection,\n update: updateSection,\n } = useFieldArray({\n control,\n name: \"section\",\n });\n\n const [selectedHoc, setSelectedHoc] = useState(\"\");\n const [activeSection, setActiveSection] = useState<number>();\n const [activeMember, setActiveMember] = useState<number>();\n\n const [formJSON, setFormJSON] = useState<object[]>([]);\n const [elementJSON, setElementJSON] = useState<any>(null);\n const [positionEditedElement, setPositionEditedElement] = useState<\n number | undefined\n >();\n\n const [sectionFormJSON, setSectionFormJSON] = useState<object[]>([]);\n const [sectionJSON, setSectionJSON] = useState<any>({});\n const [sectionPositionEditedElement, setSectionPositionEditedElement] =\n useState<number | undefined>();\n const [removeSectionActionPerformed, setRemoveSectionActionPerformed] =\n useState(false);\n const [removeSectionMembersPerformed, setRemoveSectionMembersPerformed] =\n useState(false);\n const [removeSectionPosition, setRemoveSectionPosition] = useState<\n number | undefined\n >();\n const [initialLoading, setInitialLoading] = useState(true);\n const [tabsData, setTabsData] = useState<any[]>([]);\n const [activeTabValue, setActiveTabValue] = useState<number | undefined>(0);\n\n const [elementSwap, setElementSwap] = useState(false);\n const [modifyAccordion, setModifyAccordion] = useState(false);\n const [toast, setToast] = useState<IToast | null>(null);\n const [previewFieldsData, setPreviewFields] = useState<any>(null);\n const [_, setFormParserMethods] = useState<any>();\n\n let elementPerColumn: any;\n\n const currentModule = location.pathname.split('/')[2]\n\n const path = generateModulePath(currentModule)\n\n useFormDataEffect(\n formBuilder,\n tabsData,\n activeTabValue,\n {\n removeSection,\n remove,\n setTabsData,\n append,\n appendSection\n }\n );\n\n const pickPropertyEditForm = useCallback((type: string): React.ReactElement => {\n try {\n if (!type || typeof type !== 'string') {\n console.warn('Invalid field type provided to pickPropertyEditForm');\n return <div className=\"text-gray-500 p-4\">Select a field to edit</div>;\n }\n\n const normalizedType = type.toLowerCase().trim();\n\n // Define form type groups for better maintainability\n const formGroups = {\n text: [\n 'text', 'number', 'email', 'phone', 'date', 'time',\n 'url', 'currency', 'file', 'geolocation', 'image',\n 'relation', 'info', 'tagsinput'\n ],\n select: ['select'],\n section: ['section'],\n checkbox: ['checkbox', 'togglebutton', 'radiobutton'],\n table: ['table']\n };\n\n // Common props for reusability\n const commonTextProps = {\n element: elementJSON,\n handlePropertyValueUpdate,\n handleWidthChange,\n handleColumnSelect,\n fields: formBuilder?.fields || []\n };\n\n const commonSelectProps = {\n element: elementJSON,\n handlePropertyValueUpdate,\n handleSelectOptionValueUpdate,\n handleWidthChange,\n handleColumnSelect\n };\n\n // Determine form type and render appropriate component\n if (formGroups.text.includes(normalizedType)) {\n return (\n <TextEditForm\n {...commonTextProps}\n key={`text-form-${elementJSON?.id || 'default'}`}\n />\n );\n }\n\n if (formGroups.select.includes(normalizedType)) {\n return (\n <SelectEditForm\n {...commonSelectProps}\n key={`select-form-${elementJSON?.id || 'default'}`}\n />\n );\n }\n\n if (formGroups.section.includes(normalizedType)) {\n return (\n <SectionEditForm\n element={sectionJSON}\n handlePropertyValueUpdate={handleSectionPropertyValueUpdate}\n key={`section-form-${sectionJSON?.id || 'default'}`}\n />\n );\n }\n\n if (formGroups.checkbox.includes(normalizedType)) {\n return (\n <CheckboxEditForm\n {...commonSelectProps}\n key={`checkbox-form-${elementJSON?.id || 'default'}`}\n />\n );\n }\n\n if (formGroups.table.includes(normalizedType)) {\n return (\n <TableEditForm\n element={elementJSON}\n handlePropertyValueUpdate={handlePropertyValueUpdate}\n handleColumnsUpdate={handleColumnsUpdate}\n fields={formBuilder?.fields || []}\n key={`table-form-${elementJSON?.id || 'default'}`}\n />\n );\n }\n\n // Default fallback with helpful message\n console.warn(`Unknown field type: ${type}`);\n return (\n <div className=\"text-gray-500 p-4 border border-gray-200 rounded\">\n <p className=\"font-medium\">Unknown Field Type</p>\n <p className=\"text-sm mt-1\">\n Field type \"{type}\" is not supported. Please select a valid field to edit.\n </p>\n </div>\n );\n\n } catch (error) {\n console.error('Error in pickPropertyEditForm:', error);\n return (\n <div className=\"text-red-500 p-4 border border-red-200 rounded bg-red-50\">\n <p className=\"font-medium\">Error Loading Form</p>\n <p className=\"text-sm mt-1\">\n There was an error loading the property edit form. Please try again.\n </p>\n </div>\n );\n }\n }, [elementJSON, sectionJSON, formBuilder]);\n\n const addNewSection = useCallback((): void => {\n try {\n if (!element?.section) {\n console.error('Element section template is not available');\n return;\n }\n\n const { uniqueStringId: id } = generateUniqueId('-');\n const newSection: ISectionProperty = {\n ...deepClone(element.section),\n id: id,\n };\n\n // Update switcher forms with new ID if they exist\n if (newSection.switcher_forms) {\n newSection.switcher_forms = newSection.switcher_forms.map(form => ({\n ...form,\n id: generateUniqueId('-').uniqueStringId\n }));\n }\n\n const newSectionIndex = section.length;\n\n appendSection(newSection);\n setActiveSection(newSectionIndex);\n setSelectedHoc('section');\n\n const sectionData: ISectionProperty = {\n field_type: newSection.field_type,\n section_type: newSection.section_type,\n switcher_forms: newSection.switcher_forms,\n form_switcher_label: newSection.form_switcher_label,\n form_switcher_name: newSection.form_switcher_name,\n label: newSection.label,\n is_accordion: newSection.is_accordion,\n id: newSection.id ?? newSectionIndex,\n };\n\n setSectionJSON(sectionData);\n setSectionPositionEditedElement(newSectionIndex);\n pickPropertyEditForm(newSection.field_type);\n } catch (error) {\n console.error('Error adding new section:', error);\n }\n }, [element, section, appendSection, setActiveSection, setSelectedHoc, setSectionJSON, setSectionPositionEditedElement, pickPropertyEditForm]);\n\n /**\n * Enhanced handleAddTab with better validation and error handling\n */\n const handleAddTab = useCallback((): void => {\n try {\n const formWithMembers = deepClone(sectionFormJSON);\n\n // Populate sections with their members\n formWithMembers.forEach((section: ISectionProperty, sectionIndex: number) => {\n section.members = members.filter(\n (member: IProperty) => member?.section_order === sectionIndex\n );\n });\n\n const hasSystemMembers = formWithMembers.some((section: ISectionProperty) =>\n section.members?.some((member: IProperty) => Boolean(member?.is_system_field))\n );\n\n const shouldRemoveTab = !tabsData?.length && hasSystemMembers;\n\n const newTab: TabData = {\n tab_order: tabsData.length + 1,\n title: DEFAULT_TAB_TITLE,\n remove_tab: shouldRemoveTab,\n data: tabsData?.length ? [] : formWithMembers\n };\n\n setTabsData(prevTabs => [...prevTabs, newTab]);\n } catch (error) {\n console.error('Error adding new tab:', error);\n }\n }, [sectionFormJSON, members, tabsData, setTabsData]);\n\n const handleEditTabTitle = useCallback((tabId: number, newTitle: string): void => {\n try {\n if (!isValidNumber(tabId) || !newTitle?.trim()) {\n console.error('Invalid tab ID or title provided');\n return;\n }\n\n setTabsData(prevTabs =>\n prevTabs.map((tab: TabData) =>\n tab.tab_order === tabId ? { ...tab, title: newTitle.trim() } : tab\n )\n );\n } catch (error) {\n console.error('Error editing tab title:', error);\n }\n }, [setTabsData]);\n\n const handleRemoveTab = useCallback((id: number): void => {\n try {\n if (!isValidNumber(id)) {\n console.error('Invalid tab ID provided');\n return;\n }\n\n const filteredTabs = tabsData.filter((tab: TabData) => tab.tab_order !== id);\n\n // Reorder remaining tabs\n const reorderedTabs = filteredTabs.map((tab: TabData) => ({\n ...tab,\n tab_order: tab.tab_order > id ? tab.tab_order - 1 : tab.tab_order,\n }));\n\n setTabsData(reorderedTabs);\n if (activeTabValue == id) {\n setActiveTabValue(reorderedTabs?.length - 1)\n }\n\n if (reorderedTabs.length > 0) {\n const activeTab = reorderedTabs.find(\n (tab: TabData) => tab.tab_order === (activeTabValue ?? 0) + 1\n );\n\n if (activeTab?.data) {\n const sections = activeTab.data.map(\n ({ field_type, label, is_accordion, id, remove_section }) => ({\n field_type,\n label,\n is_accordion,\n id,\n remove_section,\n })\n );\n\n const membersList = activeTab.data.flatMap((section: ISectionProperty) =>\n section.members?.map((member: IProperty) => ({ ...member })) || []\n );\n\n // Clear current data and add new data\n remove();\n removeSection();\n membersList.forEach(member => append(member));\n sections.forEach(section => appendSection(section));\n }\n } else {\n // Clear all data if no tabs remain\n remove();\n removeSection();\n }\n } catch (error) {\n console.error('Error removing tab:', error);\n }\n }, [tabsData, activeTabValue, setTabsData, remove, removeSection, append, appendSection]);\n\n const handleElementSelection = useCallback((e: React.MouseEvent<HTMLElement>): void => {\n try {\n const target = e.target as HTMLElement;\n const elementPositionIndex = target.dataset.position;\n\n if (!elementPositionIndex || !isValidNumber(elementPositionIndex)) {\n console.error('Invalid element position index');\n return;\n }\n\n const positionIndex = Number(elementPositionIndex);\n\n if (positionIndex < 0 || positionIndex >= formJSON.length) {\n console.error('Element position index out of bounds');\n return;\n }\n\n setActiveMember(positionIndex);\n\n const elementDetails = deepClone(formJSON[positionIndex]);\n setPositionEditedElement(positionIndex);\n setElementJSON(elementDetails);\n setSelectedHoc('element');\n } catch (error) {\n console.error('Error selecting element:', error);\n }\n }, [formJSON, setActiveMember, setPositionEditedElement, setElementJSON, setSelectedHoc]);\n\n const handleSectionSelection = useCallback((e: React.MouseEvent<HTMLElement>): void => {\n try {\n const target = e.target as HTMLElement;\n const sectionPositionIndex = target.dataset.position;\n\n if (!sectionPositionIndex || !isValidNumber(sectionPositionIndex)) {\n console.error('Invalid section position index');\n return;\n }\n\n const positionIndex = Number(sectionPositionIndex);\n\n if (positionIndex < 0 || positionIndex >= sectionFormJSON.length) {\n console.error('Section position index out of bounds');\n return;\n }\n\n setActiveSection(positionIndex);\n\n const sectionDetails = deepClone(sectionFormJSON[positionIndex]);\n setSectionPositionEditedElement(positionIndex);\n setSectionJSON(sectionDetails);\n setSelectedHoc('section');\n } catch (error) {\n console.error('Error selecting section:', error);\n }\n }, [sectionFormJSON, setActiveSection, setSectionPositionEditedElement, setSectionJSON, setSelectedHoc]);\n\n const handleAddMember = useCallback((\n e: React.SyntheticEvent<HTMLElement>,\n otherProperties?: Record<string, any>\n ): void => {\n try {\n const target = e.currentTarget as HTMLElement;\n const sectionPositionIndex = target?.dataset?.position;\n\n if (sectionPositionIndex === undefined || !isValidNumber(sectionPositionIndex)) {\n console.error('Invalid section position index for adding member');\n return;\n }\n\n const positionIndex = Number(sectionPositionIndex);\n\n if (positionIndex < 0) {\n console.error('Section position index cannot be negative');\n return;\n }\n\n if (!element?.text) {\n console.error('Element text template is not available');\n return;\n }\n\n const newMember: IProperty = {\n ...deepClone(element.text),\n ...otherProperties,\n section_order: positionIndex,\n type: 'custom',\n is_new: true,\n custom_width: Math.floor(DEFAULT_GRID_COLUMNS / DEFAULT_COLUMN_WIDTH),\n is_fullwidth: false,\n is_system_field: Boolean(otherProperties?.is_system_field),\n id: generateUniqueId().uniqueStringId,\n };\n\n setActiveSection(positionIndex);\n append(newMember);\n\n const elementPositionIndex = members.length;\n setActiveMember(elementPositionIndex);\n setSelectedHoc('element');\n setPositionEditedElement(elementPositionIndex);\n setElementJSON(newMember);\n pickPropertyEditForm(newMember.field_type);\n } catch (error) {\n console.error('Error adding new member:', error);\n }\n }, [element, members, setActiveSection, append, setActiveMember, setSelectedHoc, setPositionEditedElement, setElementJSON, pickPropertyEditForm]);\n\n\n const handleSectionPropertyValueUpdate = useCallback((\n e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement>,\n overrideValue?: any\n ): void => {\n try {\n const { name, type, checked, value } = e.target;\n\n if (!name) {\n console.error('Property name is required for update');\n return;\n }\n\n const updatedValue = overrideValue !== undefined ? overrideValue : (type === 'checkbox' ? checked : value);\n\n // Only update if value actually changed\n if (sectionJSON[name] !== updatedValue) {\n setSectionJSON(prev => ({ ...prev, [name]: updatedValue }));\n }\n } catch (error) {\n console.error('Error updating section property:', error);\n }\n }, [sectionJSON, setSectionJSON]);\n\n const handleWidthChange = useCallback((newCustomWidth: number): void => {\n try {\n if (!isValidNumber(newCustomWidth) || newCustomWidth < 1 || newCustomWidth > DEFAULT_GRID_COLUMNS) {\n console.error('Invalid width value provided');\n return;\n }\n\n setElementJSON(prevData => ({\n ...prevData,\n custom_width: newCustomWidth,\n }));\n } catch (error) {\n console.error('Error updating width:', error);\n }\n }, [setElementJSON]);\n\n const handleColumnSelect = useCallback((e: React.ChangeEvent<HTMLSelectElement>): void => {\n try {\n const columnValue = Number(e.target.value);\n\n if (!isValidNumber(columnValue) || columnValue <= 0) {\n console.error('Invalid column value provided');\n return;\n }\n\n const elementPerColumn = Math.floor(DEFAULT_GRID_COLUMNS / columnValue);\n\n if (elementPerColumn <= 0) {\n console.error('Calculated element per column is invalid');\n return;\n }\n\n // Batch update all members\n members.forEach((field: IProperty, index: number) => {\n update(index, { ...field, custom_width: elementPerColumn });\n });\n } catch (error) {\n console.error('Error updating column selection:', error);\n }\n }, [members, update]);\n\n const handlePropertyValueUpdate = useCallback((\n e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement>,\n numberValue?: number,\n val?: string,\n fieldType?: keyof typeof FIELD_TYPES\n ): void => {\n try {\n const getValue = (): any => {\n if (fieldType) return fieldType;\n if (val !== undefined) return val;\n if (numberValue !== undefined) return numberValue;\n return e?.target?.value;\n };\n\n const value = getValue();\n const elementJSONCopy = deepClone(elementJSON);\n\n if (e?.target?.name) {\n elementJSONCopy[e.target.name] = e.target.type === 'checkbox' ? e.target.checked : value;\n }\n // Only update if there's an actual change\n if (fieldType) {\n const { uniqueStringId: uniqueId } = generateUniqueId();\n const copyOfUpdatedElement: IProperty = {\n ...element[fieldType],\n section_form_id: elementJSONCopy?.section_form_id,\n is_form_switcher_section: elementJSONCopy?.is_form_switcher_section,\n section_order: elementJSONCopy.section_order,\n id: uniqueId,\n type: 'custom',\n is_system_field: Boolean(elementJSONCopy?.is_system_field),\n is_new: true,\n column_width: elementJSONCopy?.column_width || 6,\n custom_width: elementJSONCopy?.custom_width || 6\n };\n setElementJSON(copyOfUpdatedElement);\n } else if (JSON.stringify(elementJSON) !== JSON.stringify(elementJSONCopy)) {\n setElementJSON({ ...elementJSON, ...elementJSONCopy });\n }\n } catch (error) {\n console.error('Error updating property value:', error);\n }\n }, [elementJSON, element, setElementJSON]);\n\n const handleSelectOptionValueUpdate = useCallback((options: any[]): void => {\n try {\n if (!Array.isArray(options)) {\n console.error('Options must be an array');\n return;\n }\n\n const elementJSONCopy = deepClone(elementJSON);\n elementJSONCopy.options = [...options];\n const { uniqueStringId: uniqueId } = generateUniqueId('-');\n\n if (JSON.stringify(elementJSON.options) !== JSON.stringify(options)) {\n setElementJSON({ ...elementJSON, ...elementJSONCopy, id: uniqueId });\n }\n } catch (error) {\n console.error('Error updating select options:', error);\n }\n }, [elementJSON, setElementJSON]);\n\n const handleColumnsUpdate = useCallback((columns: MRT_ColumnDef<MRT_RowData>[]): void => {\n try {\n if (!Array.isArray(columns)) {\n console.error('Columns must be an array');\n return;\n }\n\n const elementJSONCopy = deepClone(elementJSON);\n elementJSONCopy.table_columns = [...columns];\n const { uniqueStringId: uniqueId } = generateUniqueId('-');\n\n if (JSON.stringify(elementJSON.table_columns) !== JSON.stringify(columns)) {\n setElementJSON({ ...elementJSON, ...elementJSONCopy, id: uniqueId });\n }\n } catch (error) {\n console.error('Error updating table columns:', error);\n }\n }, [elementJSON, setElementJSON]);\n\n const handleRemoveSection = useCallback((sectionIndex: number): void => {\n try {\n if (!isValidNumber(sectionIndex) || sectionIndex < 0 || sectionIndex >= section.length) {\n console.error('Invalid section index for removal');\n return;\n }\n\n setRemoveSectionPosition(sectionIndex);\n removeSection(sectionIndex);\n\n // Remove associated members in reverse order to maintain indices\n const membersToRemove: number[] = [];\n members.forEach((member: IProperty, index: number) => {\n if (member?.section_order === sectionIndex) {\n membersToRemove.push(index);\n }\n });\n\n // Remove members in reverse order to maintain correct indices\n membersToRemove.reverse().forEach(memberIndex => {\n remove(memberIndex);\n });\n\n setRemoveSectionActionPerformed(true);\n } catch (error) {\n console.error('Error removing section:', error);\n }\n }, [section, members, setRemoveSectionPosition, removeSection, remove, setRemoveSectionActionPerformed]);\n\n const handleMakeAccordion = useCallback((sectionIndex: number): void => {\n try {\n if (!isValidNumber(sectionIndex) || sectionIndex < 0 || sectionIndex >= section.length) {\n console.error('Invalid section index for accordion conversion');\n return;\n }\n\n setModifyAccordion(true);\n setSectionPositionEditedElement(sectionIndex);\n setActiveSection(sectionIndex);\n\n const copyOfSection: ISectionProperty = {\n ...deepClone(section[sectionIndex]),\n is_accordion: true\n };\n\n updateSection(sectionIndex, copyOfSection);\n setSelectedHoc('section');\n setSectionJSON(copyOfSection);\n pickPropertyEditForm(copyOfSection.field_type);\n } catch (error) {\n console.error('Error making section accordion:', error);\n }\n }, [section, setModifyAccordion, setSectionPositionEditedElement, setActiveSection, updateSection, setSelectedHoc, setSectionJSON, pickPropertyEditForm]);\n\n const handleTabData = useCallback((): void => {\n try {\n const formWithMembers = deepClone(sectionFormJSON);\n\n formWithMembers.forEach((section: ISectionProperty, sectionIndex: number) => {\n section.members = members.filter(\n (member: IProperty) => member?.section_order === sectionIndex\n );\n });\n\n const hasSystemMembers = formWithMembers.some((section: ISectionProperty) =>\n section.members?.some((member: IProperty) => Boolean(member?.is_system_field))\n );\n\n const activeTabIndex = Number(activeTabValue);\n if (isValidNumber(activeTabIndex) && activeTabIndex >= 0 && activeTabIndex < tabsData.length) {\n const updatedTabsData = [...tabsData];\n updatedTabsData[activeTabIndex] = {\n ...updatedTabsData[activeTabIndex],\n data: formWithMembers,\n remove_tab: hasSystemMembers,\n };\n setTabsData(updatedTabsData)\n remove();\n removeSection();\n setActiveMember(undefined);\n setSelectedHoc(\"\");\n setActiveSection(undefined);\n }\n } catch (error) {\n console.error('Error updating tab data:', error);\n }\n }, [sectionFormJSON, members, activeTabValue, tabsData, setTabsData]);\n\n // const handlePreview = () => {\n // const formWithMembers = JSON.parse(JSON.stringify(sectionFormJSON));\n\n // formWithMembers.forEach(\n // (section: ISectionProperty, sectionIndex: number) => {\n // section.members = members.filter(\n // (member: any) => member?.section_order === sectionIndex,\n // ) as (IProperty | ISelectProperty)[];\n // },\n // );\n // const state = tabsData?.length\n // ? { tab: tabsData }\n // : { section: formWithMembers };\n\n // const FormBuilderConversion = state && formBuilderConversion(state);\n\n // setPreviewFields(FormBuilderConversion);\n // };\n\n // Option 1: Using useMemo to memoize the expensive computation\n const formWithMembers = useMemo(() => {\n if (!sectionFormJSON || !members) return null;\n\n return sectionFormJSON.map((section: ISectionProperty, sectionIndex: number) => ({\n ...section,\n members: members.filter(\n (member: any) => member?.section_order === sectionIndex,\n ) as (IProperty | ISelectProperty)[]\n }));\n }, [sectionFormJSON, members]);\n\n const previewState = useMemo(() => {\n if (!formWithMembers) return null;\n\n return tabsData?.length\n ? { tab: tabsData }\n : { section: formWithMembers };\n }, [tabsData, formWithMembers]);\n\n const previewFields = useMemo(() => {\n if (!previewState) return null;\n return formBuilderConversion(previewState);\n }, [previewState]);\n\n\n // Option 2: Optimized handlePreview function using useCallback\n const showPreview = useCallback(() => {\n if (previewFields) {\n setPreviewFields(previewFields);\n }\n }, [previewFields, setPreviewFields]);\n const hidePreview = useCallback(() => {\n setPreviewFields(null);\n }, []);\n\n // Enhanced handleFormUpdate with proper error handling and validation\n const handleFormUpdate = useCallback(async (): void => {\n try {\n\n\n\n // Early validation checks\n if (!sectionFormJSON || !Array.isArray(sectionFormJSON)) {\n console.warn('Invalid sectionFormJSON provided');\n return;\n }\n\n if (!members || !Array.isArray(members)) {\n console.warn('Invalid members array provided');\n return;\n }\n\n if (!rowData?._id) {\n console.warn('Missing rowData._id for form update');\n return;\n }\n\n // Deep clone with proper error handling\n let formWithMembers: IEnhancedSectionProperty[];\n\n try {\n formWithMembers = structuredClone(sectionFormJSON);\n } catch (cloneError) {\n // Fallback to JSON method if structuredClone is not available\n formWithMembers = JSON.parse(JSON.stringify(sectionFormJSON));\n }\n\n // Enhanced member filtering with better type safety and validation\n formWithMembers.forEach((section: IEnhancedSectionProperty, sectionIndex: number) => {\n // Validate section object\n if (!section || typeof section !== 'object') {\n console.warn(`Invalid section at index ${sectionIndex}`);\n return;\n }\n\n // Filter members with proper type checking and validation\n section.members = members.filter((member: IMember) => {\n // Validate member object and section_order\n return (\n member &&\n typeof member === 'object' &&\n typeof member.section_order === 'number' &&\n member.section_order === sectionIndex\n );\n }) as (IProperty | ISelectProperty)[];\n });\n\n const hasSystemMembers = formWithMembers.some((section: ISectionProperty) =>\n section.members?.some((member: IProperty) => Boolean(member?.is_system_field))\n );\n\n const activeTabIndex = Number(activeTabValue);\n let updatedTabsData = [...tabsData];\n if (isValidNumber(activeTabIndex) && activeTabIndex >= 0 && activeTabIndex < tabsData.length) {\n updatedTabsData = [...tabsData];\n updatedTabsData[activeTabIndex] = {\n ...updatedTabsData[activeTabIndex],\n data: formWithMembers,\n remove_tab: hasSystemMembers,\n };\n\n setTabsData(updatedTabsData)\n }\n\n // Build state object with proper validation\n const state: IFormState = updatedTabsData?.length > 0\n ? { tab: updatedTabsData }\n : { section: formWithMembers };\n\n // Validate formBuilderConversion function exists\n if (typeof formBuilderConversion !== 'function') {\n console.error('formBuilderConversion is not a function');\n return;\n }\n\n // Execute conversion with error handling\n let formBuilderConversionResult: any;\n try {\n formBuilderConversionResult = formBuilderConversion(state);\n } catch (conversionError) {\n console.error('Error during form builder conversion:', conversionError);\n return;\n }\n\n // Validate conversion result\n if (!formBuilderConversionResult) {\n console.warn('Form builder conversion returned empty result');\n return;\n }\n\n // Validate elementPerColumn\n // if (typeof elementPerColumn !== 'number' || elementPerColumn <= 0) {\n\n // console.warn('Invalid elementPerColumn value');\n // return;\n // }\n\n // Prepare payload with validation\n const updatePayload: IFormUpdatePayload = {\n gridCol: elementPerColumn || 2,\n fields: formBuilderConversionResult\n };\n\n // Dispatch update action\n const updateRes = await dispatch(\n patchFormDataById({\n id: rowData._id,\n data: updatePayload\n })\n );\n if (updateRes.meta.requestStatus === 'rejected') {\n\n const m = getErrorMessage(updateRes?.error?.message);\n enqueueSnackbar(m, { variant: 'error' });\n } else {\n enqueueSnackbar(\"Form updated successfully\", { variant: 'success' });\n navigate(path);\n }\n\n } catch (error) {\n const m = error?.message || 'Something went wrong while updating the form';\n enqueueSnackbar(m, { variant: 'error' });\n }\n }, [\n sectionFormJSON,\n members,\n tabsData,\n rowData?._id,\n elementPerColumn,\n dispatch,\n formBuilderConversion\n ]);\n\n const handleDuplicateElement = (index: number) => {\n const copyOfMember: any = { ...members[index], type: \"custom\" };\n copyOfMember && insert(index + 1, copyOfMember);\n setActiveMember(index + 1);\n setSelectedHoc(\"element\");\n setPositionEditedElement(index + 1);\n setElementJSON(copyOfMember);\n pickPropertyEditForm(copyOfMember.field_type);\n };\n\n const breadCrumbPath = [\n {\n link: path,\n label: \"Forms\",\n },\n {\n link: \"\",\n label: formatLabel(rowData?.name),\n },\n {\n link: \"\",\n label: \"Edit Form\",\n },\n ];\n\n\n useEffect(() => {\n if (removeSectionActionPerformed) {\n members.forEach((member: any, index: number) => {\n if (\n removeSectionPosition !== undefined &&\n Boolean(removeSectionPosition?.toString) &&\n member.section_order > removeSectionPosition\n ) {\n update(index, { ...member, section_order: member.section_order - 1 });\n }\n });\n setRemoveSectionActionPerformed(false);\n setRemoveSectionMembersPerformed(true);\n setRemoveSectionPosition(undefined);\n setSelectedHoc(\"\");\n }\n\n // eslint-disable-next-line\n }, [removeSectionActionPerformed]);\n\n useEffect(() => {\n formBuilder.isSuccess && navigate(path);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [formBuilder.isSuccess]);\n\n useEffect(() => {\n if (formBuilder.isError) {\n setToast({\n type: 'alert',\n message: formBuilder.error\n });\n }\n }, [formBuilder.error, formBuilder.isError]);\n\n useEffect(() => {\n if (\n typeof positionEditedElement !== \"number\" ||\n typeof positionEditedElement !== \"string\"\n ) {\n const index = Number(positionEditedElement);\n if (formJSON[index]) {\n const copyOfUpdatedFormJson = JSON.parse(\n JSON.stringify(formJSON[index]),\n );\n update(index, { ...copyOfUpdatedFormJson });\n }\n }\n // eslint-disable-next-line\n }, [formJSON]);\n\n useEffect(() => {\n const updatedFormJSON = formJSON.map((obj: any, index: number) => {\n if (index === Number(positionEditedElement)) {\n return { ...elementJSON };\n } else {\n return { ...obj };\n }\n });\n setFormJSON(updatedFormJSON);\n\n // eslint-disable-next-line\n }, [elementJSON]);\n\n useEffect(() => {\n if (members.length !== formJSON.length) {\n setFormJSON(JSON.parse(JSON.stringify(members)));\n }\n if (\n Boolean(elementSwap) &&\n JSON.stringify(members) !== JSON.stringify(formJSON)\n ) {\n setFormJSON(JSON.parse(JSON.stringify(members)));\n setElementSwap(false);\n const newMember: any =\n positionEditedElement && members[positionEditedElement];\n newMember && setSelectedHoc(\"element\");\n newMember && setElementJSON(newMember);\n newMember && pickPropertyEditForm(newMember.field_type);\n }\n if (\n removeSectionMembersPerformed &&\n JSON.stringify(members) !== JSON.stringify(formJSON)\n ) {\n setFormJSON(JSON.parse(JSON.stringify(members)));\n setRemoveSectionMembersPerformed(false);\n }\n // eslint-disable-next-line\n }, [members, elementSwap]);\n\n useEffect(() => {\n if (\n typeof sectionPositionEditedElement !== \"number\" ||\n typeof sectionPositionEditedElement !== \"string\"\n ) {\n const index = Number(sectionPositionEditedElement);\n if (sectionFormJSON[index]) {\n const copyOfUpdatedFormJson = JSON.parse(\n JSON.stringify(sectionFormJSON[index]),\n );\n updateSection(index, { ...copyOfUpdatedFormJson });\n }\n }\n // eslint-disable-next-line\n }, [sectionFormJSON]);\n\n useEffect(() => {\n const updatedFormJSON = sectionFormJSON.map((obj: any, index: number) => {\n if (index === Number(sectionPositionEditedElement)) {\n return { ...obj, ...sectionJSON };\n } else {\n return { ...obj };\n }\n });\n setSectionFormJSON(updatedFormJSON);\n // eslint-disable-next-line\n }, [sectionJSON]);\n\n useEffect(() => {\n if (section.length !== sectionFormJSON.length) {\n setSectionFormJSON(JSON.parse(JSON.stringify(section)));\n }\n if (\n JSON.stringify(sectionFormJSON) !== JSON.stringify(section) &&\n modifyAccordion\n ) {\n setSectionFormJSON(JSON.parse(JSON.stringify(section)));\n setModifyAccordion(false);\n }\n // eslint-disable-next-line\n }, [section]);\n\n useEffect(() => {\n () => setInitialLoading(true);\n }, [])\n\n const handleFormData = useCallback(async () => {\n setInitialLoading(true)\n try {\n if (rowData?._id) {\n setTabsData([])\n await dispatch(getFormDataById(rowData?._id));\n await dispatch(getFieldsByFormId({ id: rowData?._id }));\n\n }\n } finally {\n setInitialLoading(false);\n }\n\n }, [rowData?._id])\n\n useEffect(() => {\n handleFormData();\n }, [handleFormData]);\n\n type SelectedHoc = \"element\" | \"section\" | null;\n\n // Constants\n const DEFAULT_FIELD_TYPE = \"text\";\n const HOC_TYPES = {\n ELEMENT: \"element\",\n SECTION: \"section\"\n } as const;\n\n // Helper function to check if object has meaningful content\n const hasValidContent = (obj: Record<string, any>): boolean => {\n return obj && Object.keys(obj).length > 0;\n };\n\n const EmptyStateMessage = () => (\n <Typography type=\"s5\" color={\"theme.secondary.800\"} className=\"formSection--Text\">Select a field to edit its properties.</Typography>\n )\n\n // Helper function to get field type with fallback\n const getFieldTypeWithFallback = (\n json: ElementJSON | SectionJSON | null | undefined,\n fallback: string = DEFAULT_FIELD_TYPE\n ): string => {\n return json?.field_type || fallback;\n };\n\n const memoizedForm = useMemo(() => {\n // Early return for empty state\n if (!selectedHoc) {\n\n return <EmptyStateMessage />;\n }\n\n // Handle element selection\n if (selectedHoc === HOC_TYPES.ELEMENT) {\n if (!hasValidContent(members)) {\n console.warn('Element selected but no members data available');\n return <EmptyStateMessage />;\n }\n\n const fieldType = getFieldTypeWithFallback(elementJSON);\n return pickPropertyEditForm(fieldType);\n }\n\n // Handle section selection\n if (selectedHoc === HOC_TYPES.SECTION) {\n if (!hasValidContent(section)) {\n console.warn('Section selected but no section data available');\n return <EmptyStateMessage />;\n }\n\n const fieldType = getFieldTypeWithFallback(sectionJSON);\n return pickPropertyEditForm(fieldType);\n }\n\n // Fallback for unknown selection type\n console.warn(`Unknown selectedHoc type: ${selectedHoc}`);\n return <EmptyStateMessage />;\n }, [\n // Core dependencies\n selectedHoc,\n\n // Data dependencies\n Object.keys(members).length,\n Object.keys(section).length,\n\n // JSON dependencies with deep comparison consideration\n elementJSON?.field_type,\n elementJSON?.field_properties,\n sectionJSON?.field_type,\n sectionJSON?.field_properties,\n\n // Function dependency\n pickPropertyEditForm\n ]);\n\n return (\n // <FullScreenLayout className=\"formSection--Layout\">\n <Box position='relative'>\n {initialLoading ? <ErpLoader /> :\n <DndProvider backend={HTML5Backend}>\n <FormHeader breadCrumbPath={breadCrumbPath}>\n <div className=\"formSection--Buttons\">\n <Button\n variant=\"outlined\"\n className=\"formSection--PreviewButton\"\n text=\"Preview\"\n onClick={() => { !previewFieldsData ? showPreview() : hidePreview() }}\n disable={!members?.length}\n startIcon={previewFieldsData ? <EyeOff /> : <Eye />}\n />\n <Button\n variant=\"contained\"\n type=\"submit\"\n text=\"Update\"\n onClick={handleFormUpdate}\n disable={previewFieldsData}\n />\n </div>\n </FormHeader>\n {!previewFieldsData ?\n <Grid className=\"formSection--Grid\" container>\n <Grid\n item\n xs={9}\n component=\"form\"\n sx={{\n position: \"relative\",\n background: \"#F5F6F5\",\n padding: \"0.75rem\",\n }}\n >\n <Grid className=\"formSection--GridContainer\">\n <Box className=\"formSection--Tab\">\n {tabsData && (\n <TabBar\n tabs={tabsData}\n onEditTabTitle={handleEditTabTitle}\n activeValue={activeTabValue}\n setActiveValue={setActiveTabValue}\n handleTabChange={() => {\n handleTabData()\n }}\n handleRemoveTab={handleRemoveTab}\n containerProps={{ mb: 0 }}\n />\n )}\n <Button\n variant=\"outlined\"\n text=\"Add Tab\"\n onClick={handleAddTab}\n style={{ color: \"#292D32\", margin: \"0.5rem\" }}\n />\n </Box>\n <div className=\"formSection--Form\">\n {section?.map((item: any, i: number) => {\n const sectionMembers = members.filter(\n (member: any) => member.section_order === i,\n );\n const isFormSwitcher = item.section_type === SECTION_TYPES.FORM_SWITCH_SECTION\n const switchForms = item?.switcher_forms?.map((form: any) => ({\n ...form,\n formMembers: members.filter(\n (member: any) => member.section_form_id === form.id,\n )\n }))\n\n return (\n <DynamicSectionHOC\n index={i}\n label={t(item.label)}\n onClick={handleSectionSelection}\n position={i}\n fieldArrayName=\"section\"\n isFormSwitcher={isFormSwitcher}\n activeIndex={activeSection === i}\n removeSection={() => handleRemoveSection(i)}\n handleAccordion={() => handleMakeAccordion(i)}\n handleAddButton={(e) => handleAddMember(e)}\n remove_section={item.remove_section}\n >\n {isFormSwitcher ? (\n <div style={{ width: '100%' }} >\n <Typography type=\"s5\" style={{ fontWeight: 500 }} color={\"theme.secondary.800\"}>\n {item.form_switcher_label}\n </Typography>\n <RadioGroup\n aria-labelledby=\"theme-radio-buttons-group-label\"\n name={item.form_switcher_name || item.form_switcher_label}\n >\n\n {switchForms?.map(({ name, id, formMembers }: { name: string, id: number, formMembers: any }) => (\n <>\n <div>\n <FormControlLabel\n key={id}\n value={name}\n control={<Radio />}\n label={t(name)}\n disabled\n />\n </div>\n\n <Grid container sx={{ mb: 3 }}>\n <FormFields\n sectionMembers={formMembers || []}\n members={members}\n activeMember={activeMember}\n control={control}\n t={t}\n element={element}\n images={images}\n elementJSON={elementJSON}\n remove={remove}\n move={move}\n handleElementSelection={handleElementSelection}\n setElementSwap={setElementSwap}\n handleDuplicateElement={handleDuplicateElement}\n setSelectedHoc={setSelectedHoc}\n setActiveMember={setActiveMember}\n />\n </Grid>\n <Button\n text=\"Add\"\n variant=\"outlined\"\n className=\"formSection--PreviewButton\"\n data-position={i}\n onClick={(e) => handleAddMember(e, {\n section_form_id: id,\n is_form_switcher_section: true\n })}\n startIcon={<Add />}\n />\n </>\n ))}\n </RadioGroup>\n </div>\n ) : null}\n {!isFormSwitcher &&\n <FormFields\n sectionMembers={sectionMembers || []}\n members={members}\n activeMember={activeMember}\n control={control}\n t={t}\n element={element}\n images={images}\n elementJSON={elementJSON}\n remove={remove}\n move={move}\n handleElementSelection={handleElementSelection}\n setElementSwap={setElementSwap}\n handleDuplicateElement={handleDuplicateElement}\n setSelectedHoc={setSelectedHoc}\n setActiveMember={setActiveMember}\n />\n }\n </DynamicSectionHOC>\n );\n })}\n <div className=\"formSection--Section\">\n <Button\n text=\"Add a section\"\n variant=\"outlined\"\n className=\"formSection--PreviewButton\"\n onClick={addNewSection}\n startIcon={<Add />}\n />\n </div>\n </div>\n </Grid>\n\n </Grid>\n <Grid\n item\n xs={3}\n className={\n Boolean(selectedHoc) && (members?.length || section.length)\n ? \"formSection--RightGrid\"\n : \"formSection--RightGrid formSection--Text\"\n }\n >\n {memoizedForm}\n </Grid>\n </Grid>\n :\n <FormParser\n data={previewFieldsData || []}\n handleFormSubmit={(data) => console.log(\"Preview Data\", data)}\n className='form-container'\n fieldArrayName='form-builder-preview'\n getFormMethods={(methods: any) =>\n setFormParserMethods({ ...methods })\n }\n />\n }\n <Toast\n open={Boolean(toast)}\n type={toast?.type}\n message={toast?.message}\n handleClose={() => setToast(null)}\n anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }}\n />\n </DndProvider>}\n </Box>\n // </FullScreenLayout>\n );\n}\n\nexport default CustomForm;\n"],"names":["isValidNumber","value","isNaN","Number","isFinite","deepClone","obj","JSON","parse","stringify","generateUniqueId","separator","uniqueStringId","Date","now","Math","random","toString","substr","CustomForm","t","useTranslation","dispatch","useAppDispatch","navigate","useNavigate","location","useLocation","rowData","state","formBuilder","useAppSelector","control","useForm","reValidateMode","fields","members","append","remove","update","move","insert","useFieldArray","name","section","appendSection","removeSection","updateSection","selectedHoc","setSelectedHoc","useState","activeSection","setActiveSection","activeMember","setActiveMember","formJSON","setFormJSON","elementJSON","setElementJSON","positionEditedElement","setPositionEditedElement","sectionFormJSON","setSectionFormJSON","sectionJSON","setSectionJSON","sectionPositionEditedElement","setSectionPositionEditedElement","removeSectionActionPerformed","setRemoveSectionActionPerformed","removeSectionMembersPerformed","setRemoveSectionMembersPerformed","removeSectionPosition","setRemoveSectionPosition","initialLoading","setInitialLoading","tabsData","setTabsData","activeTabValue","setActiveTabValue","elementSwap","setElementSwap","modifyAccordion","setModifyAccordion","toast","setToast","previewFieldsData","setPreviewFields","_","setFormParserMethods","currentModule","pathname","split","path","generateModulePath","useFormDataEffect","pickPropertyEditForm","useCallback","type","jsx","className","children","normalizedType","toLowerCase","trim","formGroups","text","select","checkbox","table","commonTextProps","element","handlePropertyValueUpdate","handleWidthChange","handleColumnSelect","commonSelectProps","handleSelectOptionValueUpdate","includes","createElement","TextEditForm","key","id","SelectEditForm","SectionEditForm","handleSectionPropertyValueUpdate","CheckboxEditForm","TableEditForm","handleColumnsUpdate","jsxs","error","addNewSection","newSection","switcher_forms","map","form","newSectionIndex","length","sectionData","field_type","section_type","form_switcher_label","form_switcher_name","label","is_accordion","handleAddTab","formWithMembers","forEach","sectionIndex","filter","member","section_order","hasSystemMembers","some","Boolean","is_system_field","shouldRemoveTab","newTab","tab_order","title","remove_tab","data","prevTabs","handleEditTabTitle","tabId","newTitle","tab","handleRemoveTab","reorderedTabs","activeTab","find","sections","remove_section","membersList","flatMap","handleElementSelection","e","elementPositionIndex","target","dataset","position","positionIndex","elementDetails","handleSectionSelection","sectionPositionIndex","sectionDetails","handleAddMember","otherProperties","currentTarget","_a","newMember","is_new","custom_width","floor","DEFAULT_GRID_COLUMNS","is_fullwidth","overrideValue","checked","updatedValue","prev","newCustomWidth","prevData","columnValue","elementPerColumn","field","index","numberValue","val","fieldType","getValue","elementJSONCopy","uniqueId","copyOfUpdatedElement","section_form_id","is_form_switcher_section","column_width","options","Array","isArray","columns","table_columns","handleRemoveSection","membersToRemove","push","reverse","memberIndex","handleMakeAccordion","copyOfSection","handleTabData","activeTabIndex","updatedTabsData","useMemo","previewState","previewFields","formBuilderConversion","showPreview","hidePreview","handleFormUpdate","async","_id","structuredClone","cloneError","formBuilderConversionResult","conversionError","updatePayload","gridCol","updateRes","patchFormDataById","meta","requestStatus","m","getErrorMessage","message","enqueueSnackbar","variant","handleDuplicateElement","copyOfMember","breadCrumbPath","link","formatLabel","useEffect","isSuccess","isError","copyOfUpdatedFormJson","updatedFormJSON","handleFormData","getFormDataById","getFieldsByFormId","hasValidContent","Object","keys","EmptyStateMessage","Typography","color","getFieldTypeWithFallback","json","fallback","memoizedForm","field_properties","Box","ErpLoader","DndProvider","backend","HTML5Backend","FormHeader","Button","onClick","disable","startIcon","EyeOff","Eye","FormParser","handleFormSubmit","fieldArrayName","getFormMethods","methods","Grid","container","item","xs","component","sx","background","padding","TabBar","tabs","onEditTabTitle","activeValue","setActiveValue","handleTabChange","containerProps","mb","style","margin","i","sectionMembers","isFormSwitcher","SECTION_TYPES","FORM_SWITCH_SECTION","switchForms","formMembers","DynamicSectionHOC","activeIndex","handleAccordion","handleAddButton","width","fontWeight","RadioGroup","Fragment","FormControlLabel","Radio","disabled","FormFields","images","Add","Toast","open","handleClose","anchorOrigin","horizontal","vertical"],"mappings":"gpEAuFA,MAIMA,EAAiBC,IAA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