import{j as i}from"./cm-1.0.63-CSIRHMXC.js";import{l as k,cJ as w,cS as d,cL as T,cK as B}from"./lib-1.0.63-DJZPtMem.js";import{F as H,I as U,b as S,a as D}from"./TextField-1.0.63-C35Mfi1Q.js";import{S as P}from"./Select-1.0.63-BMejr8a7.js";import{M as _}from"./MenuItem-1.0.63-Bvb3IjMP.js";import{E as O}from"./EnumTypeEnum-1.0.63-Ws4BsaYD.js";import{R as Z}from"./RadioGroup-1.0.63-DNdHdAIV.js";import{F as $}from"./FormControlLabel-1.0.63-DpYUdUm6.js";import{R as G}from"./Radio-1.0.63-CTxGi4al.js";import"./redux-1.0.63-Df-eBzJn.js";import"./vendor-1.0.63-CN03Eozo.js";import"./loglevel-1.0.63-BZ7XahX3.js";import"./lodash-1.0.63-hMxolcpJ.js";import"./moment-1.0.63-C5S46NFB.js";import"./Typography-1.0.63-mecuj_Wl.js";import"./ButtonBase-1.0.63-CF10PFMS.js";import"./useEnhancedEffect-1.0.63-DnR0ZFqV.js";import"./Menu-1.0.63-DLh4HkF0.js";import"./ThemeProvider-1.0.63-Cq0KMgkh.js";import"./index-1.0.63-oIDff4nA.js";import"./Modal-1.0.63-fMXTbfks.js";import"./notistack-1.0.63-B49ULGrj.js";import"./iconBase-1.0.63-CFvHhC4t.js";import"./createSvgIcon-1.0.63-DWL3J-DK.js";import"./SwitchBase-1.0.63-Br-lbcZ1.js";const J=({columnName:C,columnValue:e,columnMetaData:g,storeColumn:x,columnValidation:p,onColumnChange:f,metaData:j,storeForm:F,enumValues:L,formMode:b,locale:R,columnEvents:r})=>{k.debug(C,e,g,x,p,j,F,L,b,R);const I={readOnly:w(j,g,x,b)},A=p!=null&&p.error?p==null?void 0:p.text:R.selectFromList,y=null;return i.jsxs(H,{className:d(x),children:[i.jsx(U,{variant:T(),children:g.formLabel}),i.jsx(P,{MenuProps:{id:"pp-select-menu"},error:p==null?void 0:p.error,label:g.formLabel,value:e??"",inputProps:I,variant:T(),onChange:h=>{f(C,h.target.value===""?null:h.target.value),r!=null&&r.onChange&&r.onChange(h)},sx:{textAlign:x.alignment},onBlurCapture:r==null?void 0:r.onBlur,onClickCapture:r==null?void 0:r.onClick,onDoubleClickCapture:r==null?void 0:r.onDoubleClick,onFocusCapture:r==null?void 0:r.onFocus,onKeyDownCapture:r==null?void 0:r.onKeyDown,onKeyUpCapture:r==null?void 0:r.onKeyUp,children:(()=>{const h=L.map(function(K){return i.jsx(_,{"data-id":C,value:K,children:K},K)});return g.is_nullable==="YES"?[i.jsx(_,{"data-id":"pp-empty-enum-item",value:y,children:" "},"pp-empty-enum-item")].concat(h):h})()}),i.jsx(S,{children:B(x,A)})]})},Y=({columnName:C,columnValue:e,columnMetaData:g,storeColumn:x,columnValidation:p,onColumnChange:f,metaData:j,enumValues:F,formMode:L,orientation:b,locale:R,columnEvents:r})=>{k.debug(C,e,g,x,p,j,F,L,b,R);const I=p!=null&&p.error?p==null?void 0:p.text:R.selectFromRadio;return i.jsxs(H,{className:d(x),children:[i.jsx(D,{children:g.formLabel}),i.jsx(Z,{value:e,sx:{flexDirection:b===O.RADIO_HORIZONTAL?"row":"column",...b!==O.RADIO_VERTICAL&&{justifyContent:x.alignment},...b===O.RADIO_VERTICAL&&{alignItems:x.alignment},paddingLeft:"12px"},onChange:A=>{f(C,A.target.value)},onBlurCapture:r==null?void 0:r.onBlur,onChangeCapture:r==null?void 0:r.onChange,onClickCapture:r==null?void 0:r.onClick,onDoubleClickCapture:r==null?void 0:r.onDoubleClick,onFocusCapture:r==null?void 0:r.onFocus,onKeyDownCapture:r==null?void 0:r.onKeyDown,onKeyUpCapture:r==null?void 0:r.onKeyUp,children:F.map(function(y){return i.jsx($,{control:i.jsx(G,{disabled:w(j,g,x,L)}),value:y,label:y},y)})}),i.jsx(S,{children:B(x,I)})]})},br=({appId:C,columnName:e,columnValue:g,columnInitialValue:x,columnMetaData:p,storeColumn:f,columnValidation:j,onColumnChange:F,metaData:L,context:b,storeTable:R,storeForm:r,formMode:I,locale:A,columnEvents:y})=>{k.debug(C,f,e,g);const h=p.column_type.replace("enum(","").replace(")","").replaceAll("'","").split(",");switch(f.updatableEnum){case O.RADIO_HORIZONTAL:case O.RADIO_VERTICAL:return i.jsx(Y,{appId:C,columnName:e,columnValue:g,columnInitialValue:x,columnMetaData:p,storeColumn:f,onColumnChange:F,metaData:L,context:b,storeTable:R,storeForm:r,enumValues:h,orientation:f.updatableEnum,formMode:I,columnValidation:j,locale:A,columnEvents:y});default:return i.jsx(J,{appId:C,columnName:e,columnValue:g,columnInitialValue:x,columnMetaData:p,storeColumn:f,onColumnChange:F,metaData:L,context:b,storeTable:R,storeForm:r,enumValues:h,formMode:I,columnValidation:j,locale:A,columnEvents:y})}};export{br as default};
