"use strict";const i=require("../../../../common/vendor.js"),a=require("./props.js"),n=require("../../libs/mixin/mpMixin.js"),u=require("../../libs/mixin/mixin.js"),c=require("../../libs/function/index.js"),t={name:"u-search",mixins:[n.mpMixin,u.mixin,a.props],data(){return{keyword:"",showClear:!1,show:!1,focused:this.focus}},watch:{keyword(e){this.$emit("update:modelValue",e),this.$emit("change",e)},modelValue:{immediate:!0,handler(e){this.keyword=e}}},computed:{showActionBtn(){return!this.animation&&this.showAction}},emits:["clear","search","custom","focus","blur","click","clickIcon","update:modelValue","change"],methods:{addStyle:c.addStyle,addUnit:c.addUnit,inputChange(e){this.keyword=e.detail.value},clear(){this.keyword="",this.$nextTick(()=>{this.$emit("clear")})},search(e){this.$emit("search",e.detail.value);try{i.index.hideKeyboard()}catch{}},custom(){this.$emit("custom",this.keyword);try{i.index.hideKeyboard()}catch{}},getFocus(){this.focused=!0,this.animation&&this.showAction&&(this.show=!0),this.$emit("focus",this.keyword)},blur(){setTimeout(()=>{this.focused=!1},100),this.show=!1,this.$emit("blur",this.keyword)},clickHandler(){this.disabled&&this.$emit("click")},clickIcon(e){this.$emit("clickIcon",this.keyword);try{i.index.hideKeyboard()}catch{}}}};Array||i.resolveComponent("u-icon")();const h=()=>"../u-icon/u-icon.js";Math||h();function d(e,l,y,f,r,o){return i.e({a:e.$slots.label||e.label!==null},e.$slots.label||e.label!==null?{b:i.t(e.label)}:{},{c:i.o(o.clickIcon),d:i.p({size:e.searchIconSize,name:e.searchIcon,color:e.searchIconColor?e.searchIconColor:e.color}),e:i.o((...s)=>o.blur&&o.blur(...s)),f:r.keyword,g:i.o((...s)=>o.search&&o.search(...s)),h:i.o((...s)=>o.inputChange&&o.inputChange(...s)),i:e.disabled,j:i.o((...s)=>o.getFocus&&o.getFocus(...s)),k:e.focus,l:e.maxlength,m:e.adjustPosition,n:e.autoBlur,o:e.placeholder,p:`color: ${e.placeholderColor}`,q:i.s({textAlign:e.inputAlign,color:e.color,backgroundColor:e.bgColor,height:o.addUnit(e.height)}),r:i.s(e.inputStyle),s:r.keyword&&e.clearabled&&r.focused},r.keyword&&e.clearabled&&r.focused?{t:i.p({name:"close",size:"11",color:"#ffffff",customStyle:"line-height: 12px"}),v:i.o((...s)=>o.clear&&o.clear(...s))}:{},{w:e.bgColor,x:e.shape=="round"?"100px":"4px",y:e.borderColor,z:i.t(e.actionText),A:i.s(e.actionStyle),B:i.n((o.showActionBtn||r.show)&&"u-search__action--active"),C:i.o((...s)=>o.custom&&o.custom(...s)),D:i.o((...s)=>o.clickHandler&&o.clickHandler(...s)),E:i.s({margin:e.margin}),F:i.s(o.addStyle(e.customStyle))})}const m=i._export_sfc(t,[["render",d],["__scopeId","data-v-e082a34a"]]);wx.createComponent(m);
