import{_ as e}from"./uv-icon.c815b875.js";import{Y as t,Z as n,G as o,H as i,o as s,j as a,w as l,h as r,a0 as u,z as c,y as d,m as h,B as p,a5 as m}from"./index-90c12cc1.js";import{p as f}from"./uv-input.vue_vue_type_style_index_0_scoped_a7ca300a_lang.8012b887.js";import{_}from"./_plugin-vue_export-helper.1b428a4d.js";const y=_({name:"uv-input",mixins:[t,n,f],data:()=>({innerValue:"",focused:!1,innerFormatter:e=>e}),created(){this.innerValue=this.modelValue},watch:{value(e){this.innerValue=e},modelValue(e){this.innerValue=e}},computed:{isShowClear(){const{clearable:e,readonly:t,focused:n,innerValue:o}=this;return!!e&&!t&&!!n&&""!==o},inputClass(){let e=[],{border:t,disabled:n,shape:o}=this;return"surround"===t&&(e=e.concat(["uv-border","uv-input--radius"])),e.push(`uv-input--${o}`),"bottom"===t&&(e=e.concat(["uv-border-bottom","uv-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"),this.$uv.deepMerge(e,this.$uv.addStyle(this.customStyle))},inputStyle(){return{color:this.color,fontSize:this.$uv.addUnit(this.fontSize),textAlign:this.inputAlign}}},methods:{setFormatter(e){this.innerFormatter=e},onInput(e){let{value:t=""}=e.detail||{};const n=(this.formatter||this.innerFormatter)(t);this.innerValue=t,this.$nextTick((()=>{this.innerValue=n,this.valueChange()}))},onBlur(e){this.$emit("blur",e.detail.value),this.$uv.sleep(100).then((()=>{this.focused=!1})),this.$uv.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(){const e=this.innerValue;this.$nextTick((()=>{this.$emit("input",e),this.$emit("update:modelValue",e),this.$emit("change",e),this.$uv.formValidate(this,"change")}))},onClear(){this.innerValue="",this.$nextTick((()=>{this.$emit("clear"),this.valueChange()}))},clickHandler(){}}},[["render",function(t,n,f,_,y,v){const g=o(i("uv-icon"),e),b=p,x=m;return s(),a(b,{class:h(["uv-input",v.inputClass]),style:d([v.wrapperStyle])},{default:l((()=>[r(b,{class:"uv-input__content"},{default:l((()=>[r(b,{class:"uv-input__content__prefix-icon"},{default:l((()=>[u(t.$slots,"prefix",{},(()=>[t.prefixIcon?(s(),a(g,{key:0,name:t.prefixIcon,size:"18",customStyle:t.prefixIconStyle},null,8,["name","customStyle"])):c("",!0)]),!0)])),_:3}),r(b,{class:"uv-input__content__field-wrapper",onClick:v.clickHandler},{default:l((()=>[r(x,{class:"uv-input__content__field-wrapper__field",style:d([v.inputStyle]),type:t.type,focus:t.focus,cursor:t.cursor,value:y.innerValue,"auto-blur":t.autoBlur,disabled:t.disabled||t.readonly,maxlength:t.maxlength,placeholder:t.placeholder,"placeholder-style":t.placeholderStyle,"placeholder-class":t.placeholderClass,"confirm-type":t.confirmType,"confirm-hold":t.confirmHold,"hold-keyboard":t.holdKeyboard,"cursor-spacing":t.cursorSpacing,"adjust-position":t.adjustPosition,"selection-end":t.selectionEnd,"selection-start":t.selectionStart,password:t.password||"password"===t.type||void 0,ignoreCompositionEvent:t.ignoreCompositionEvent,onInput:v.onInput,onBlur:v.onBlur,onFocus:v.onFocus,onConfirm:v.onConfirm,onKeyboardheightchange:v.onkeyboardheightchange},null,8,["style","type","focus","cursor","value","auto-blur","disabled","maxlength","placeholder","placeholder-style","placeholder-class","confirm-type","confirm-hold","hold-keyboard","cursor-spacing","adjust-position","selection-end","selection-start","password","ignoreCompositionEvent","onInput","onBlur","onFocus","onConfirm","onKeyboardheightchange"])])),_:1},8,["onClick"]),v.isShowClear?(s(),a(b,{key:0,class:"uv-input__content__clear",onClick:v.onClear},{default:l((()=>[r(g,{name:"close",size:"11",color:"#ffffff",customStyle:"line-height: 12px"})])),_:1},8,["onClick"])):c("",!0),r(b,{class:"uv-input__content__subfix-icon"},{default:l((()=>[u(t.$slots,"suffix",{},(()=>[t.suffixIcon?(s(),a(g,{key:0,name:t.suffixIcon,size:"18",customStyle:t.suffixIconStyle},null,8,["name","customStyle"])):c("",!0)]),!0)])),_:3})])),_:3})])),_:3},8,["class","style"])}],["__scopeId","data-v-a7ca300a"]]);export{y as _};
