import{_ as L,S as M,T as N,C as U,w as $}from"./element-plus.55d71530.js";import{d as A,r as p,w as D,o as a,c as b,V as m,M as s,a as i,a4 as x,I,L as f,u as c,j as v,U as O,aa as P,S as k}from"./@vue.96c135a1.js";import{u as T}from"./@vueuse.f4694335.js";const j={class:"popover-input__input mr-[10px] flex-1"},F={class:"popover-input__btns flex-none"},H=A({__name:"index",props:{value:{type:String},type:{type:String,default:"text"},width:{type:[Number,String],default:"300px"},placeholder:String,disabled:{type:Boolean,default:!1},options:{type:Array,default:()=>[]},size:{type:String,default:"default"},limit:{type:Number,default:200},showLimit:{type:Boolean,default:!1},teleported:{type:Boolean,default:!0}},emits:["confirm"],setup(e,{emit:V}){const y=e,g=V,n=p(!1),u=p(!1),o=p(),h=()=>{r(),g("confirm",o.value)},z=()=>{y.disabled||(n.value=!0)},r=()=>{n.value=!1};return D(()=>y.value,d=>{o.value=d},{immediate:!0}),T(document.documentElement,"click",()=>{u.value||r()}),(d,t)=>{const B=M,E=N,S=U,w=$,C=L;return a(),b("div",{onMouseenter:t[4]||(t[4]=l=>u.value=!0),onMouseleave:t[5]||(t[5]=l=>u.value=!1)},[m(C,{placement:"top",visible:c(n),"onUpdate:visible":t[3]||(t[3]=l=>v(n)?n.value=l:null),width:e.width,trigger:"contextmenu",class:"popover-input",teleported:e.teleported,persistent:!1,"popper-class":"!p-0"},{reference:s(()=>[i("div",{class:"inline",onClick:x(z,["stop"])},[I(d.$slots,"default")])]),default:s(()=>[i("div",{class:"flex p-3",onClick:t[2]||(t[2]=x(()=>{},["stop"]))},[i("div",j,[e.type=="select"?(a(),f(E,{key:0,class:"flex-1",size:e.size,modelValue:c(o),"onUpdate:modelValue":t[0]||(t[0]=l=>v(o)?o.value=l:null),teleported:e.teleported},{default:s(()=>[(a(!0),b(O,null,P(e.options,l=>(a(),f(B,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["size","modelValue","teleported"])):(a(),f(S,{key:1,modelValue:c(o),"onUpdate:modelValue":t[1]||(t[1]=l=>v(o)?o.value=l:null),modelModifiers:{trim:!0},maxlength:e.limit,"show-word-limit":e.showLimit,type:e.type,size:e.size,clearable:"",placeholder:e.placeholder},null,8,["modelValue","maxlength","show-word-limit","type","size","placeholder"]))]),i("div",F,[m(w,{link:"",onClick:r},{default:s(()=>[k("\u53D6\u6D88")]),_:1}),m(w,{type:"primary",size:e.size,onClick:h},{default:s(()=>[k("\u786E\u5B9A")]),_:1},8,["size"])])])]),_:3},8,["visible","width","teleported"])],32)}}});export{H as _};
