"use strict";const n=require("vue"),u=require("./base-iCmnU-fv.js"),h=require("./Index.vue_vue_type_script_setup_true_lang-Dd2V82en.js"),T=n.defineComponent({name:"ClInputSearch",components:{ClInput:h._sfc_main},__name:"Index",props:{theme:{type:String,default:"icon",validator:a=>["icon","text"].indexOf(a)!==-1},location:{type:String,default:"right",validator:a=>["left","right"].indexOf(a)!==-1},value:{type:String,default:""},placeholder:{type:String,default:""},className:{type:String,default:""},disabled:{type:Boolean,default:!1},textLabel:{type:String,default:""},changDelayTime:{type:Number,default:200}},emits:["update:value","onChange","onSearch","onFocus","onBlur"],setup(a,{expose:y,emit:v}){const t=a,c=v,m=n.ref(null);let r=t.value;const o=n.ref(t.value),g=n.computed(()=>{const e={"panel-input-search":!0,"input-search-disabled":t.disabled};u.CommonBase.isEmpty(t.className)||t.className?.split(" ").forEach(i=>{u.CommonBase.isEmpty(i)||(e[i]=!0)});const l=u.CommonBase.isEmpty(t.theme)?"icon":t.theme;return e[`input-search-${l}`]=!0,e}),C=n.computed(()=>{let e="append";return u.CommonBase.isEmpty(t.location)||(e=t.location==="left"?"prepend":"append"),e});let s;const _=()=>{s&&(clearTimeout(s),s=null)},p=e=>{c("update:value",e),c("onChange",e)},d=e=>{c("onSearch",e)},b=e=>{c("onFocus",e)},B=e=>{c("onBlur",e)};n.watch(()=>t.value,(e,l)=>{e!==l&&(o.value=e)});const S=e=>{t.disabled||(_(),s=setTimeout(()=>{r!==e&&(r=e,p(e))},t.changDelayTime))},k=e=>{t.disabled||setTimeout(()=>{d(e)},t.changDelayTime)},E=e=>{t.disabled||b(e)},x=e=>{t.disabled||B(e)},f=()=>{t.disabled||d(o.value)},I=()=>{t.disabled||(p(""),d(""))};return y({getValue:()=>o.value,setValue:e=>{r=e,o.value=e},focus:()=>{m.value?.focus()}}),(e,l)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(g.value)},[n.createVNode(h._sfc_main,{ref_key:"refElInput",ref:m,value:o.value,"onUpdate:value":l[0]||(l[0]=i=>o.value=i),theme:"icon",placeholder:a.placeholder,isClean:!0,disabled:a.disabled,onOnChange:S,onOnKeyupEnter:k,onOnFocus:E,onOnBlur:x,onOnClear:I},{[C.value]:n.withCtx(()=>[a.theme==="text"?(n.openBlock(),n.createElementBlock("span",{key:0,onClick:f},n.toDisplayString(a.textLabel),1)):(n.openBlock(),n.createElementBlock("i",{key:1,class:"clIconFont clIcon-search",onClick:f}))]),_:2},1032,["value","placeholder","disabled"])],2))}});exports._sfc_main=T;
//# sourceMappingURL=Index.vue_vue_type_script_setup_true_lang-BWdaQyLA.js.map
