import{j as o}from"./cm-1.0.63-CSIRHMXC.js";import{l as c,k as x}from"./lib-1.0.63-DJZPtMem.js";import{u as g}from"./useAutoUpdate-1.0.63-3DXsSxm4.js";import{S as f}from"./Select-1.0.63-BMejr8a7.js";import{M as a}from"./MenuItem-1.0.63-Bvb3IjMP.js";import{E as d}from"./EnumTypeEnum-1.0.63-Ws4BsaYD.js";import{R as E}from"./RadioGroup-1.0.63-DNdHdAIV.js";import{F as R}from"./FormControlLabel-1.0.63-DpYUdUm6.js";import{R as j}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"./Menu-1.0.63-DLh4HkF0.js";import"./ThemeProvider-1.0.63-Cq0KMgkh.js";import"./useEnhancedEffect-1.0.63-DnR0ZFqV.js";import"./index-1.0.63-oIDff4nA.js";import"./ButtonBase-1.0.63-CF10PFMS.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 I=({value:n,columnMetaData:e,setValue:r,saveChanges:p,enumValues:s})=>{c.debug(n,e);const m=g(n,p),u=null;return o.jsx("div",{onClick:i=>{i.stopPropagation()},children:o.jsx(f,{MenuProps:{id:"pp-select-menu"},className:"pp-inline-editing",value:n??"",variant:"outlined",onChange:i=>{r(i.target.value===""?null:i.target.value)},sx:{width:"100%","&.MuiInputBase-root.Mui-focused .MuiOutlinedInput-notchedOutline":{borderWidth:"1px !important"}},children:(()=>{const i=s.map(function(t){return o.jsx(a,{value:t,onClick:()=>{m(!0)},children:t},t)});return e.is_nullable==="YES"?[o.jsx(a,{"data-id":"pp-empty-enum-item",value:u,onClick:()=>{m(!0)},children:" "},"pp-empty-enum-item")].concat(i):i})()})})},h=({value:n,tableState:e,columnState:r,columnMetaData:p,setValue:s,saveChanges:m,enumValues:u})=>{c.debug(n,e,r,p);const i=g(n,m);return o.jsx("div",{onClick:t=>{t.stopPropagation()},children:o.jsx(E,{className:"pp-inline-editing",sx:{flexDirection:r.inlineEditingEnum===d.RADIO_HORIZONTAL?"row":"column",justifyContent:r.alignment,...r.alignment===x.RIGHT&&{marginRight:"-16px"}},value:n,onChange:t=>{s(t.target.value)},children:u.map(function(l){return o.jsx(R,{control:o.jsx(j,{onClick:()=>{i(!0)}}),value:l,label:l},l)})})})},J=({value:n,tableState:e,columnState:r,columnMetaData:p,setValue:s,saveChanges:m,cancel:u,setButtons:i})=>{c.debug(n,e,r,p);const t=p.column_type.replace("enum(","").replace(")","").replaceAll("'","").split(",");switch(r.inlineEditingEnum){case d.RADIO_HORIZONTAL:case d.RADIO_VERTICAL:return o.jsx(h,{value:n,tableState:e,columnState:r,columnMetaData:p,setValue:s,saveChanges:m,cancel:u,setButtons:i,enumValues:t});default:return o.jsx(I,{value:n,tableState:e,columnState:r,columnMetaData:p,setValue:s,saveChanges:m,cancel:u,setButtons:i,enumValues:t})}};export{J as default};
