import{O as L,P as M,B as N,h as U,X as O}from"./element-plus-z3MwpXC9.js";import{d as P,r as p,w as $,o as a,c as w,V as m,M as s,a as i,a3 as x,I,L as f,u as v,i as c,U as A,aa as F,S as k}from"./@vue-TMcuEboY.js";import{c as R}from"./@vueuse-BQYVjZ5N.js";const T={class:"popover-input__input mr-[10px] flex-1"},X={class:"popover-input__btns flex-none"},G=P({__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(t,{emit:V}){const y=t,g=V,n=p(!1),u=p(!1),o=p(),z=()=>{r(),g("confirm",o.value)},B=()=>{y.disabled||(n.value=!0)},r=()=>{n.value=!1};return $(()=>y.value,d=>{o.value=d},{immediate:!0}),R(document.documentElement,"click",()=>{u.value||r()}),(d,e)=>{const E=L,S=M,h=N,b=U,C=O;return a(),w("div",{onMouseenter:e[4]||(e[4]=l=>u.value=!0),onMouseleave:e[5]||(e[5]=l=>u.value=!1)},[m(C,{placement:"top",visible:v(n),"onUpdate:visible":e[3]||(e[3]=l=>c(n)?n.value=l:null),width:t.width,trigger:"contextmenu",class:"popover-input",teleported:t.teleported,persistent:!1,"popper-class":"!p-0"},{reference:s(()=>[i("div",{class:"inline",onClick:x(B,["stop"])},[I(d.$slots,"default")])]),default:s(()=>[i("div",{class:"flex p-3",onClick:e[2]||(e[2]=x(()=>{},["stop"]))},[i("div",T,[t.type=="select"?(a(),f(S,{key:0,class:"flex-1",size:t.size,modelValue:v(o),"onUpdate:modelValue":e[0]||(e[0]=l=>c(o)?o.value=l:null),teleported:t.teleported},{default:s(()=>[(a(!0),w(A,null,F(t.options,l=>(a(),f(E,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["size","modelValue","teleported"])):(a(),f(h,{key:1,modelValue:v(o),"onUpdate:modelValue":e[1]||(e[1]=l=>c(o)?o.value=l:null),modelModifiers:{trim:!0},maxlength:t.limit,"show-word-limit":t.showLimit,type:t.type,size:t.size,clearable:"",placeholder:t.placeholder},null,8,["modelValue","maxlength","show-word-limit","type","size","placeholder"]))]),i("div",X,[m(b,{link:"",onClick:r},{default:s(()=>e[6]||(e[6]=[k("取消")])),_:1}),m(b,{type:"primary",size:t.size,onClick:z},{default:s(()=>e[7]||(e[7]=[k("确定")])),_:1},8,["size"])])])]),_:3},8,["visible","width","teleported"])],32)}}});export{G as _};
