"use strict";const e=require("./props.js"),i=require("../../libs/mixin/mpMixin.js"),n=require("../../libs/mixin/mixin.js"),t=require("../../libs/function/index.js"),o=require("../../../../common/vendor.js"),r={name:"u-input",mixins:[i.mpMixin,n.mixin,e.props],data:()=>({clearInput:!1,innerValue:"",focused:!1,firstChange:!0,changeFromInner:!1,innerFormatter:e=>e}),watch:{modelValue:{immediate:!0,handler(e,i){this.innerValue=e,this.firstChange=!1,this.changeFromInner=!1}}},computed:{isShowClear(){const{clearable:e,readonly:i,focused:n,innerValue:t}=this;return!!e&&!i&&!!n&&""!==t},inputClass(){let e=[],{border:i,disabled:n,shape:t}=this;return"surround"===i&&(e=e.concat(["u-border","u-input--radius"])),e.push(`u-input--${t}`),"bottom"===i&&(e=e.concat(["u-border-bottom","u-input--no-radius"])),e.join(" ")},wrapperStyle(){const e={};return this.disabled&&(e.backgroundColor=this.disabledColor),"none"===this.border?e.padding="0":(e.paddingTop="6px",e.paddingBottom="6px",e.paddingLeft="9px",e.paddingRight="9px"),t.deepMerge(e,t.addStyle(this.customStyle))},inputStyle(){return{color:this.color,fontSize:t.addUnit(this.fontSize),textAlign:this.inputAlign}}},emits:["update:modelValue","focus","blur","change","confirm","clear","keyboardheightchange"],methods:{setFormatter(e){this.innerFormatter=e},onInput(e){let{value:i=""}=e.detail||{};const n=(this.formatter||this.innerFormatter)(i);this.innerValue=i,this.$nextTick((()=>{this.innerValue=n,this.valueChange()}))},onBlur(e){this.$emit("blur",e.detail.value),t.sleep(150).then((()=>{this.focused=!1})),t.formValidate(this,"blur")},onFocus(e){this.focused=!0,this.$emit("focus")},onConfirm(e){this.$emit("confirm",this.innerValue)},onkeyboardheightchange(e){this.$emit("keyboardheightchange",e)},valueChange(){this.clearInput&&(this.innerValue="",this.clearInput=!1);const e=this.innerValue;this.$nextTick((()=>{this.$emit("update:modelValue",e),this.changeFromInner=!0,this.$emit("change",e),t.formValidate(this,"change")}))},onClear(){this.clearInput=!0,this.innerValue="",this.$nextTick((()=>{this.valueChange(),this.$emit("clear")}))},clickHandler(){}}};if(!Array){o.resolveComponent("u-icon")()}Math;const s=o._export_sfc(r,[["render",function(e,i,n,t,r,s){return o.e({a:e.prefixIcon||e.$slots.prefix},e.prefixIcon||e.$slots.prefix?{b:o.p({name:e.prefixIcon,size:"18",customStyle:e.prefixIconStyle})}:{},{c:o.s(s.inputStyle),d:e.type,e:e.focus,f:e.cursor,g:r.innerValue,h:e.autoBlur,i:e.disabled||e.readonly,j:e.maxlength,k:e.placeholder,l:e.placeholderStyle,m:e.placeholderClass,n:e.confirmType,o:e.confirmHold,p:e.holdKeyboard,q:e.cursorSpacing,r:e.adjustPosition,s:e.selectionEnd,t:e.selectionStart,v:e.password||"password"===e.type||!1,w:e.ignoreCompositionEvent,x:o.o(((...e)=>s.onInput&&s.onInput(...e))),y:o.o(((...e)=>s.onBlur&&s.onBlur(...e))),z:o.o(((...e)=>s.onFocus&&s.onFocus(...e))),A:o.o(((...e)=>s.onConfirm&&s.onConfirm(...e))),B:o.o(((...e)=>s.onkeyboardheightchange&&s.onkeyboardheightchange(...e))),C:o.o(((...e)=>s.clickHandler&&s.clickHandler(...e))),D:s.isShowClear},s.isShowClear?{E:o.p({name:"close",size:"11",color:"#ffffff",customStyle:"line-height: 12px"}),F:o.o(((...e)=>s.onClear&&s.onClear(...e)))}:{},{G:e.suffixIcon||e.$slots.suffix},e.suffixIcon||e.$slots.suffix?{H:o.p({name:e.suffixIcon,size:"18",customStyle:e.suffixIconStyle,imgMode:"widthFix"})}:{},{I:o.n(s.inputClass),J:o.s(s.wrapperStyle)})}],["__scopeId","data-v-bd44b066"]]);wx.createComponent(s);
