import{j as x}from"./tanstack-1.0.74-aU0azVkW.js";import{l as k,dg as _,dj as w,di as K,dh as B}from"./lib-1.0.74-B5IEqfHg.js";import{F as H,I as D,b as U,a as S}from"./TextField-1.0.74-BW9Byijb.js";import{S as P}from"./Select-1.0.74-DHOnlEEH.js";import{M as T}from"./MenuItem-1.0.74-D9LDbFUb.js";import{E as O}from"./EnumTypeEnum-1.0.74-Ws4BsaYD.js";import{R as Z}from"./RadioGroup-1.0.74-DWBtoS7u.js";import{F as $}from"./FormControlLabel-1.0.74-CdAG1Jo8.js";import{R as G}from"./Radio-1.0.74-fPSETwpC.js";import"./redux-1.0.74-D8bIc6ki.js";import"./vendor-1.0.74-CN03Eozo.js";import"./utils-1.0.74-7xWhx9mc.js";import"./CircularProgress-1.0.74-QfwfRJ7i.js";import"./ButtonBase-1.0.74-W6tAH7AI.js";import"./Typography-1.0.74-B4mhsevh.js";import"./useEnhancedEffect-1.0.74-B56M26dS.js";import"./Menu-1.0.74-CdjCBJ4R.js";import"./ThemeProvider-1.0.74-4uzbYYLM.js";import"./index-1.0.74-DxwH6OqZ.js";import"./Portal-1.0.74-BrUPeMX9.js";import"./iconBase-1.0.74-Cs0vntJu.js";import"./isHostComponent-1.0.74-DVu5iVWx.js";import"./Modal-1.0.74-BfLid1bk.js";import"./createSvgIcon-1.0.74-Cw_ZFbxi.js";import"./SwitchBase-1.0.74-pUYMwK3f.js";const Y=({columnName:C,columnValue:h,columnMetaData:g,storeColumn:i,columnValidation:p,onColumnChange:e,metaData:j,storeForm:F,enumValues:R,formMode:b,locale:L,columnEvents:r})=>{k.debug(C,h,g,i,p,j,F,R,b,L);const I={readOnly:_(j,g,i,b)},A=p!=null&&p.error?p==null?void 0:p.text:L.selectFromList,y=null;return x.jsxs(H,{className:w(i),children:[x.jsx(D,{variant:K(),children:g.formLabel}),x.jsx(P,{MenuProps:{id:"pp-select-menu"},error:p==null?void 0:p.error,label:g.formLabel,value:h??"",inputProps:I,variant:K(),onChange:f=>{e(C,f.target.value===""?null:f.target.value),r!=null&&r.onChange&&r.onChange(f)},sx:{textAlign:i.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 f=R.map(function(d){return x.jsx(T,{"data-id":C,value:d,children:d},d)});return g.is_nullable==="YES"?[x.jsx(T,{"data-id":"pp-empty-enum-item",value:y,children:" "},"pp-empty-enum-item")].concat(f):f})()}),x.jsx(U,{children:B(i,A)})]})},q=({columnName:C,columnValue:h,columnMetaData:g,storeColumn:i,columnValidation:p,onColumnChange:e,metaData:j,enumValues:F,formMode:R,orientation:b,locale:L,columnEvents:r})=>{k.debug(C,h,g,i,p,j,F,R,b,L);const I=p!=null&&p.error?p==null?void 0:p.text:L.selectFromRadio;return x.jsxs(H,{className:w(i),children:[x.jsx(S,{children:g.formLabel}),x.jsx(Z,{value:h,sx:{flexDirection:b===O.RADIO_HORIZONTAL?"row":"column",...b!==O.RADIO_VERTICAL&&{justifyContent:i.alignment},...b===O.RADIO_VERTICAL&&{alignItems:i.alignment},paddingLeft:"12px"},onChange:A=>{e(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 x.jsx($,{control:x.jsx(G,{disabled:_(j,g,i,R)}),value:y,label:y},y)})}),x.jsx(U,{children:B(i,I)})]})},br=({appId:C,columnName:h,columnValue:g,columnInitialValue:i,columnMetaData:p,storeColumn:e,columnValidation:j,onColumnChange:F,metaData:R,context:b,storeTable:L,storeForm:r,formMode:I,locale:A,columnEvents:y})=>{k.debug(C,e,h,g);const f=p.column_type.replace("enum(","").replace(")","").replaceAll("'","").split(",");switch(e.updatableEnum){case O.RADIO_HORIZONTAL:case O.RADIO_VERTICAL:return x.jsx(q,{appId:C,columnName:h,columnValue:g,columnInitialValue:i,columnMetaData:p,storeColumn:e,onColumnChange:F,metaData:R,context:b,storeTable:L,storeForm:r,enumValues:f,orientation:e.updatableEnum,formMode:I,columnValidation:j,locale:A,columnEvents:y});default:return x.jsx(Y,{appId:C,columnName:h,columnValue:g,columnInitialValue:i,columnMetaData:p,storeColumn:e,onColumnChange:F,metaData:R,context:b,storeTable:L,storeForm:r,enumValues:f,formMode:I,columnValidation:j,locale:A,columnEvents:y})}};export{br as default};
