import{j as e}from"./cm-1.0.63-CSIRHMXC.js";import{l as b,bz as s,cK as f}from"./lib-1.0.63-DJZPtMem.js";import{B as g}from"./Spinner-1.0.63-zcgIyS7Z.js";import{T as m,F as x,b as j}from"./TextField-1.0.63-C35Mfi1Q.js";import{F as v}from"./FormControlLabel-1.0.63-DpYUdUm6.js";import{C as E}from"./Checkbox-1.0.63-DPBXeOde.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"./Select-1.0.63-BMejr8a7.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 V=({columnName:t,columnValue:p,columnMetaData:o,onColumnChange:u,formMode:i,metaData:d,storeColumn:a})=>{b.debug(t,p,o);let r={label:"",url:"",target:""};try{r=JSON.parse(p),r!=null&&(r.label===void 0||r.url===void 0||r.target===void 0)&&(r={label:(r==null?void 0:r.label)??"",url:(r==null?void 0:r.url)??"",target:(r==null?void 0:r.target)??""})}catch(l){console.error(l),console.error(p)}b.debug(r);const n=l=>{u(t,JSON.stringify({...r,...l}))};return e.jsxs("fieldset",{className:"pp-fieldset",children:[e.jsx("legend",{children:o.formLabel}),r!==void 0?e.jsxs(g,{style:{display:"grid",gridTemplateColumns:"1fr auto",alignItems:"center",gap:"20px"},children:[e.jsx(m,{label:"Label",value:(r==null?void 0:r.label)??"",required:o.is_nullable==="NO",slotProps:{input:{readOnly:i===s.VIEW||i===s.UPDATE&&(d.primary_key.includes(t)||a.updatable===!1)}},onChange:l=>{n({label:l.target.value})}}),e.jsx(x,{sx:{"& label span":{fontSize:"80% !important"}},children:e.jsx(v,{control:e.jsx(E,{id:t,checked:(r==null?void 0:r.target)==="_blank",disabled:i===s.VIEW||i===s.UPDATE&&(d.primary_key.includes(t)||a.updatable===!1),onChange:(l,c)=>{n({target:c?"_blank":""})}}),label:"Open link in a new tab"})}),e.jsx(m,{label:"Url",value:(r==null?void 0:r.url)??"",required:o.is_nullable==="NO",slotProps:{input:{readOnly:i===s.VIEW||i===s.UPDATE&&(d.primary_key.includes(t)||a.updatable===!1)}},sx:{gridColumn:"1 / span 2"},onChange:l=>{n({url:l.target.value})}}),a.hint&&a.hint.trim()!==""&&e.jsx(x,{children:e.jsx(j,{sx:{marginLeft:0},children:f(a,"")})})]}):e.jsx(g,{color:"error.main",className:"unselectable",children:"Invalid hyperlink"})]})};export{V as default};
