import{d as p,r as v,w as y,A as c,J as b,_,P as g,O as x,B as C,j as u,aF as f,H as N,i as B,c as d,g as s}from"./index-DOFLUERq.js";import{_ as k}from"./_plugin-vue_export-helper-DlAUqK2U.js";const h={class:"field-label"},w={key:0,class:"required"},j=p({__name:"Currency",props:{df:{},record:{},canEdit:{type:Boolean},ctx:{},onlyInput:{type:Boolean}},setup(l){const e=l,m=d(()=>e.df.label_layout||"vertical"),i=d(()=>{if(typeof e.df.precision=="number")return e.df.precision;const a=window.jingrow?.boot?.sysdefaults?.currency_precision;return a?Number(a):2}),n=v(e.record[e.df.fieldname]),t=d({get:()=>{const a=e.record[e.df.fieldname];return a===""||a===void 0?null:Number(a)},set:a=>{e.record[e.df.fieldname]=a}});return y(()=>e.record[e.df.fieldname],a=>{e.ctx?.onFieldChange&&a!==n.value&&e.ctx.onFieldChange(e.df.fieldname,a,n.value,e.record),n.value=a}),(a,o)=>l.onlyInput?(s(),B(u(f),{key:1,value:t.value,"onUpdate:value":o[1]||(o[1]=r=>t.value=r),precision:i.value,placeholder:"",disabled:!l.canEdit,style:{width:"100%"}},null,8,["value","precision","disabled"])):(s(),c("div",{key:0,class:N(["field-wrapper",`layout-${m.value}`])},[b("label",h,[_(g(l.ctx.t(l.df.label||l.df.fieldname))+" ",1),l.df.reqd?(s(),c("span",w,"*")):x("",!0)]),C(u(f),{value:t.value,"onUpdate:value":o[0]||(o[0]=r=>t.value=r),precision:i.value,placeholder:"",disabled:!l.canEdit},null,8,["value","precision","disabled"])],2))}}),E=k(j,[["__scopeId","data-v-489a4905"]]),z=Object.freeze(Object.defineProperty({__proto__:null,default:E},Symbol.toStringTag,{value:"Module"}));export{E as C,z as _};
