"use strict";(self["webpackChunkgolden_software"]=self["webpackChunkgolden_software"]||[]).push([[436],{1436:function(e,l,a){a.r(l),a.d(l,{default:function(){return v}});var t=a(3396),d=a(2268),n=a(9242),r=a(4870),o=a(7139);const i={class:"relative"},u=["id","name","disabled"],s=["value"],c=["id","name","placeholder","required","disabled"],p=["id","name","autocomplete","required","placeholder","type","disabled","max","min"],m={key:3,class:"absolute right-1 cursor-pointer top-2"},g={key:4,class:"absolute right-8 cursor-pointer top-2"};var b={__name:"Base-Control",props:{name:{type:String,default:null},id:{type:String,default:null},autocomplete:{type:String,default:null},placeholder:{type:String,default:null},options:{type:Array,default:null},type:{type:String,default:"text"},disabled:{type:Boolean,default:!1},max:{type:String,default:null},min:{type:String,default:null},modelValue:{type:[String,Number,Boolean,Array,Object],default:""},height:{type:String,default:null},icon:{type:String,default:null},icon2:{type:String,default:null},required:Boolean,borderless:Boolean,transparent:Boolean,ctrlKFocus:Boolean},emits:["update:modelValue","right-icon-click","update:changeDate"],setup(e,{emit:l}){const a=e,b=(0,t.FN)(),y=(0,t.Fl)({get:()=>a.modelValue,set:e=>{l("update:modelValue",e)}}),v=(0,t.Fl)((()=>{const e=["px-2 py-1 max-w-full focus:ring focus:outline-none dark:border-gray-700 rounded w-full","dark:placeholder-gray-400 text-xs","textarea"===h.value?"h-20":"h-10",a.borderless?"border-0":"border",a.transparent?"bg-transparent":"bg-white dark:bg-gray-800",a.disabled?"border-gray-300 cursor-not-allowed select-none bg-slate-300":"border-blue-300",a.height?a.height:""];return e})),h=(0,t.Fl)((()=>a.options?"select":a.type)),f=(0,o.oR)(),k=(0,r.iH)(null);if(a.ctrlKFocus){const e=e=>{e.ctrlKey&&"k"===e.key?(e.preventDefault(),k.value.focus()):"Escape"===e.key&&k.value.blur()};(0,t.bv)((()=>{f.state.isFieldFocusRegistered||(window.addEventListener("keydown",e),f.commit("basic",{key:"isFieldFocusRegistered",value:!0}))})),(0,t.Jd)((()=>{window.removeEventListener("keydown",e),f.commit("basic",{key:"isFieldFocusRegistered",value:!1})}))}const w=e=>{let l=!a.disabled;1===e?b.emit("update:changeDate",{disabled:l,remove:!1}):2===e&&b.emit("update:changeDate",{disabled:a.disabled,remove:!a.disabled})};return(l,r)=>{const o=(0,t.up)("base-icon");return(0,t.wg)(),(0,t.iD)("div",i,["select"===h.value?(0,t.wy)(((0,t.wg)(),(0,t.iD)("select",{key:0,id:e.id,"onUpdate:modelValue":r[0]||(r[0]=e=>y.value=e),name:e.name,class:(0,d.C_)(v.value),disabled:e.disabled},[((0,t.wg)(!0),(0,t.iD)(t.HY,null,(0,t.Ko)(e.options,(e=>((0,t.wg)(),(0,t.iD)("option",{key:e.id??e,value:e},(0,d.zw)(e.label??e.name),9,s)))),128))],10,u)),[[n.bM,y.value]]):"textarea"===h.value?(0,t.wy)(((0,t.wg)(),(0,t.iD)("textarea",{key:1,id:e.id,"onUpdate:modelValue":r[1]||(r[1]=e=>y.value=e),class:(0,d.C_)(v.value),name:e.name,placeholder:e.placeholder,required:e.required,disabled:e.disabled},null,10,c)),[[n.nr,y.value]]):(0,t.wy)(((0,t.wg)(),(0,t.iD)("input",{key:2,id:e.id,ref_key:"inputEl",ref:k,"onUpdate:modelValue":r[2]||(r[2]=e=>y.value=e),name:e.name,autocomplete:e.autocomplete,required:e.required,placeholder:e.placeholder,type:h.value,class:(0,d.C_)(v.value),disabled:e.disabled,max:e.max,min:e.min},null,10,p)),[[n.YZ,y.value]]),e.icon?((0,t.wg)(),(0,t.iD)("span",m,[(0,t.Wm)(o,{path:e.icon,color:a.disabled?"":"text-green-500",onClick:r[3]||(r[3]=e=>w(1))},null,8,["path","color"])])):(0,t.kq)("",!0),e.icon2&&!a.disabled?((0,t.wg)(),(0,t.iD)("span",g,[(0,t.Wm)(o,{path:e.icon2,color:"text-red-500",onClick:r[4]||(r[4]=e=>w(2))},null,8,["path"])])):(0,t.kq)("",!0)])}}};const y=b;var v=y}}]);
//# sourceMappingURL=436.82553fd1.js.map