import{d as b,o as g,n as h,A as i,J as w,_ as D,P as _,O as k,B as c,j as f,aK as p,H as S,c as m,r as x,g as u}from"./index-DOFLUERq.js";import{_ as I}from"./_plugin-vue_export-helper-DlAUqK2U.js";const N={class:"field-label"},B={key:0,class:"required"},T={key:1,class:"date-inline-wrapper"},$=b({__name:"Date",props:{df:{},record:{},canEdit:{type:Boolean},ctx:{},onlyInput:{type:Boolean}},setup(l){const n=l,v=m(()=>n.df.label_layout||"vertical"),o=x(!1),s=m({get(){const a=n.record[n.df.fieldname];if(!a)return null;if(typeof a=="number")return a;const e=String(a).split("-");if(e.length===3){const d=parseInt(e[0],10),r=parseInt(e[1],10)-1,y=parseInt(e[2],10);return new Date(d,r,y).getTime()}const t=new Date(a).getTime();return isNaN(t)?null:t},set(a){if(a===null)n.record[n.df.fieldname]=null;else{const e=new Date(a),t=e.getFullYear(),d=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");n.record[n.df.fieldname]=`${t}-${d}-${r}`}o.value=!1}});return g(()=>{n.onlyInput&&h(()=>{o.value=!0})}),(a,e)=>l.onlyInput?(u(),i("div",T,[c(f(p),{value:s.value,"onUpdate:value":e[1]||(e[1]=t=>s.value=t),show:o.value,"onUpdate:show":e[2]||(e[2]=t=>o.value=t),type:"date",placeholder:"",disabled:!l.canEdit,style:{width:"100%"}},null,8,["value","show","disabled"])])):(u(),i("div",{key:0,class:S(["field-wrapper",`layout-${v.value}`])},[w("label",N,[D(_(l.ctx.t(l.df.label||l.df.fieldname))+" ",1),l.df.reqd?(u(),i("span",B,"*")):k("",!0)]),c(f(p),{value:s.value,"onUpdate:value":e[0]||(e[0]=t=>s.value=t),type:"date",placeholder:"",disabled:!l.canEdit},null,8,["value","disabled"])],2))}}),E=I($,[["__scopeId","data-v-b761b558"]]),j=Object.freeze(Object.defineProperty({__proto__:null,default:E},Symbol.toStringTag,{value:"Module"}));export{E as D,j as _};
