"use strict";const e=require("../../../../common/vendor.js"),t={name:"uni-easyinput",emits:["click","iconClick","update:modelValue","input","focus","blur","confirm"],model:{prop:"modelValue",event:"update:modelValue"},props:{name:String,value:[Number,String],modelValue:[Number,String],type:{type:String,default:"text"},clearable:{type:Boolean,default:!0},autoHeight:{type:Boolean,default:!1},placeholder:String,placeholderStyle:String,focus:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},maxlength:{type:[Number,String],default:140},confirmType:{type:String,default:"done"},clearSize:{type:[Number,String],default:15},inputBorder:{type:Boolean,default:!0},prefixIcon:{type:String,default:""},suffixIcon:{type:String,default:""},trim:{type:[Boolean,String],default:!0},passwordIcon:{type:Boolean,default:!0},styles:{type:Object,default:()=>({color:"#333",disableColor:"#F7F6F6",borderColor:"#e5e5e5"})},errorMessage:{type:[String,Boolean],default:""},paddingLeft:{type:[Number,String],default:0}},data:()=>({focused:!1,errMsg:"",val:"",showMsg:"",border:!1,isFirstBorder:!1,showClearIcon:!1,showPassword:!1}),computed:{msg(){return this.errorMessage||this.errMsg},inputMaxlength(){return Number(this.maxlength)}},watch:{value(e){this.errMsg&&(this.errMsg=""),this.val=e,this.form&&this.formItem&&!this.is_reset&&(this.is_reset=!1,this.formItem.setValue(e))},modelValue(e){this.errMsg&&(this.errMsg=""),this.val=e,this.form&&this.formItem&&!this.is_reset&&(this.is_reset=!1,this.formItem.setValue(e))},focus(e){this.$nextTick((()=>{this.focused=this.focus}))}},created(){this.value||0===this.value||(this.val=this.modelValue),this.modelValue||0===this.modelValue||(this.val=this.value),this.form=this.getForm("uniForms"),this.formItem=this.getForm("uniFormsItem"),this.form&&this.formItem&&this.formItem.name&&(this.is_reset||(this.is_reset=!1,this.formItem.setValue(this.val)),this.rename=this.formItem.name,this.form.inputChildrens.push(this))},mounted(){this.$nextTick((()=>{this.focused=this.focus}))},methods:{init(){},onClickIcon(e){this.$emit("iconClick",e)},getForm(e="uniForms"){let t=this.$parent,o=t.$options.name;for(;o!==e;){if(t=t.$parent,!t)return!1;o=t.$options.name}return t},onEyes(){this.showPassword=!this.showPassword},onInput(e){let t=e.detail.value;this.trim&&("boolean"==typeof this.trim&&this.trim&&(t=this.trimStr(t)),"string"==typeof this.trim&&(t=this.trimStr(t,this.trim))),this.errMsg&&(this.errMsg=""),this.val=t,this.$emit("input",t),this.$emit("update:modelValue",t)},onFocus(e){this.$emit("focus",e)},onBlur(e){e.detail.value,this.$emit("blur",e)},onConfirm(e){this.$emit("confirm",e.detail.value)},onClear(e){this.val="",this.$emit("input",""),this.$emit("update:modelValue","")},fieldClick(){this.$emit("click")},trimStr:(e,t="both")=>"both"===t?e.trim():"left"===t?e.trimLeft():"right"===t?e.trimRight():"start"===t?e.trimStart():"end"===t?e.trimEnd():"all"===t?e.replace(/\s+/g,""):e}};if(!Array){e.resolveComponent("uni-icons")()}Math;const o=e._export_sfc(t,[["render",function(t,o,i,s,r,l){return e.e({a:i.prefixIcon},i.prefixIcon?{b:e.o((e=>l.onClickIcon("prefix"))),c:e.p({type:i.prefixIcon,color:"#c0c4cc"})}:{},{d:"textarea"===i.type},"textarea"===i.type?{e:i.inputBorder?1:"",f:i.name,g:r.val,h:i.placeholder,i:i.placeholderStyle,j:i.disabled,k:l.inputMaxlength,l:r.focused,m:i.autoHeight,n:e.o(((...e)=>l.onInput&&l.onInput(...e))),o:e.o(((...e)=>l.onBlur&&l.onBlur(...e))),p:e.o(((...e)=>l.onFocus&&l.onFocus(...e))),q:e.o(((...e)=>l.onConfirm&&l.onConfirm(...e)))}:{r:"password"===i.type?"text":i.type,s:"password"===i.type||i.clearable||i.prefixIcon?"":"10px",t:i.paddingLeft+"px",v:i.name,w:r.val,x:!r.showPassword&&"password"===i.type,y:i.placeholder,z:i.placeholderStyle,A:i.disabled,B:l.inputMaxlength,C:r.focused,D:i.confirmType,E:e.o(((...e)=>l.onFocus&&l.onFocus(...e))),F:e.o(((...e)=>l.onBlur&&l.onBlur(...e))),G:e.o(((...e)=>l.onInput&&l.onInput(...e))),H:e.o(((...e)=>l.onInput&&l.onInput(...e))),I:e.o(((...e)=>l.onConfirm&&l.onConfirm(...e)))},{J:"password"===i.type&&i.passwordIcon},"password"===i.type&&i.passwordIcon?e.e({K:r.val},r.val?{L:"textarea"===i.type?1:"",M:e.o(l.onEyes),N:e.p({type:r.showPassword?"eye-slash-filled":"eye-filled",size:18,color:"#c0c4cc"})}:{}):i.suffixIcon?e.e({P:i.suffixIcon},i.suffixIcon?{Q:e.o((e=>l.onClickIcon("suffix"))),R:e.p({type:i.suffixIcon,color:"#c0c4cc"})}:{}):e.e({S:i.clearable&&r.val&&!i.disabled},i.clearable&&r.val&&!i.disabled?{T:"textarea"===i.type?1:"",U:e.o(l.onClear),V:e.p({type:"clear",size:i.clearSize,color:"#c0c4cc"})}:{}),{O:i.suffixIcon,W:i.inputBorder?1:"",X:i.inputBorder&&l.msg?1:"",Y:"textarea"===i.type?1:"",Z:i.disabled?1:"",aa:i.inputBorder&&l.msg?"#dd524d":i.styles.borderColor,ab:i.disabled?i.styles.disableColor:"",ac:l.msg?1:"",ad:i.inputBorder&&l.msg?"#e43d33":i.styles.color})}]]);wx.createComponent(o);
