import{Z as E,G as C,H as S,B as N,w as L}from"./element-plus.ae8e286c.js";import{d as M,r as p,w as U,o as n,c as y,T as m,K as a,a as i,G as _,Y as w,J as c,U as $,a6 as A,R as b}from"./@vue.108c970a.js";import{c as D}from"./@vueuse.d3d080b7.js";const G={class:"popover-input__input mr-[10px] flex-1"},O={class:"popover-input__btns flex-none"},P=b("\u53D6\u6D88"),T=b("\u786E\u5B9A"),F=["onClick"],K=M({__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:x}){const f=e,s=p(!1),u=p(!1),o=p(),h=()=>{r(),x("confirm",o.value)},k=()=>{f.disabled||(s.value=!0)},r=()=>{s.value=!1};return U(()=>f.value,d=>{o.value=d},{immediate:!0}),D(document.documentElement,"click",()=>{u.value||r()}),(d,t)=>{const g=C,z=S,B=N,v=L,V=E;return n(),y("div",{onMouseenter:t[4]||(t[4]=l=>u.value=!0),onMouseleave:t[5]||(t[5]=l=>u.value=!1)},[m(V,{placement:"top",visible:s.value,"onUpdate:visible":t[3]||(t[3]=l=>s.value=l),width:e.width,trigger:"contextmenu",class:"popover-input",teleported:e.teleported,persistent:!1,"popper-class":"!p-0"},{reference:a(()=>[i("div",{class:"inline",onClick:w(k,["stop"])},[_(d.$slots,"default")],8,F)]),default:a(()=>[i("div",{class:"flex p-3",onClick:t[2]||(t[2]=w(()=>{},["stop"]))},[i("div",G,[e.type=="select"?(n(),c(z,{key:0,class:"flex-1",size:e.size,modelValue:o.value,"onUpdate:modelValue":t[0]||(t[0]=l=>o.value=l),teleported:e.teleported},{default:a(()=>[(n(!0),y($,null,A(e.options,l=>(n(),c(g,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["size","modelValue","teleported"])):(n(),c(B,{key:1,modelValue:o.value,"onUpdate:modelValue":t[1]||(t[1]=l=>o.value=l),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",O,[m(v,{link:"",onClick:r},{default:a(()=>[P]),_:1}),m(v,{type:"primary",size:e.size,onClick:h},{default:a(()=>[T]),_:1},8,["size"])])])]),_:3},8,["visible","width","teleported"])],32)}}});export{K as _};
