var v=Object.defineProperty;var r=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var i=(e,t,a)=>t in e?v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,s=(e,t)=>{for(var a in t||(t={}))S.call(t,a)&&i(e,a,t[a]);if(r)for(var a of r(t))C.call(t,a)&&i(e,a,t[a]);return e};import{_ as B,z as V,A as x,c as u,o as d,w as h,k as $,i as N,bh as j,B as o,q as F,p as k,t as c,a1 as w,j as E}from"./index-CZJgrp0v.js";var f,m;const K={props:s({value:{type:[String,Number],default:""},modelValue:{type:[String,Number],default:""},placeholder:{type:[String,Number],default:""},placeholderClass:{type:String,default:"textarea-placeholder"},placeholderStyle:{type:[String,Object],default:"color: #c0c4cc"},height:{type:[String,Number],default:70},confirmType:{type:String,default:"return"},disabled:{type:Boolean,default:!1},count:{type:Boolean,default:!1},focus:{type:Boolean,default:!1},autoHeight:{type:Boolean,default:!1},fixed:{type:Boolean,default:!1},cursorSpacing:{type:Number,default:0},cursor:{type:[String,Number],default:""},showConfirmBar:{type:Boolean,default:!0},selectionStart:{type:Number,default:-1},selectionEnd:{type:Number,default:-1},adjustPosition:{type:Boolean,default:!0},disableDefaultPadding:{type:Boolean,default:!1},holdKeyboard:{type:Boolean,default:!1},maxlength:{type:[String,Number],default:140},border:{type:String,default:"surround"},formatter:{type:[Function,null],default:null},ignoreCompositionEvent:{type:Boolean,default:!0},confirmHold:{type:Boolean,default:!1},textStyle:{type:[Object,String],default:()=>{}},countStyle:{type:[Object,String],default:()=>{}}},(m=(f=uni.$uv)==null?void 0:f.props)==null?void 0:m.textarea)},P={name:"uv-textarea",mixins:[V,x,K],data(){return{innerValue:"",focused:!1,innerFormatter:e=>e}},created(){this.innerValue=this.modelValue},watch:{value(e){this.innerValue=e},modelValue(e){this.innerValue=e}},computed:{textareaClass(){let e=[],{border:t,disabled:a}=this;return t==="surround"&&(e=e.concat(["uv-border","uv-textarea--radius"])),t==="bottom"&&(e=e.concat(["uv-border-bottom","uv-textarea--no-radius"])),a&&e.push("uv-textarea--disabled"),e.join(" ")},textareaStyle(){const e={};return this.$uv.deepMerge(e,this.$uv.addStyle(this.customStyle))},maxlen(){return this.maxlength<0?this.maxlength<0?-1:140:this.maxlength},getCount(){try{return this.innerValue.length>this.maxlen?this.maxlen:this.innerValue.length}catch(e){return 0}}},methods:{setFormatter(e){this.innerFormatter=e},onFocus(e){this.$emit("focus",e)},onBlur(e){this.$emit("blur",e),this.$uv.formValidate(this,"blur")},onLinechange(e){this.$emit("linechange",e)},onInput(e){let{value:t=""}=e.detail||{};const l=(this.formatter||this.innerFormatter)(t);this.innerValue=t,this.$nextTick(()=>{this.innerValue=l,this.valueChange()})},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")})},onConfirm(e){this.$emit("confirm",e)},onKeyboardheightchange(e){this.$emit("keyboardheightchange",e)}}};function H(e,t,a,l,p,n){const y=j,g=F,b=E;return d(),u(b,{class:w(["uv-textarea",n.textareaClass]),style:o([n.textareaStyle])},{default:h(()=>[$(y,{class:"uv-textarea__field",value:p.innerValue,style:o([{height:e.autoHeight?"auto":e.$uv.addUnit(e.height)},e.$uv.addStyle(e.textStyle)]),placeholder:e.placeholder,"placeholder-style":e.$uv.addStyle(e.placeholderStyle,"string"),"placeholder-class":e.placeholderClass,disabled:e.disabled,focus:e.focus,autoHeight:e.autoHeight,fixed:e.fixed,cursorSpacing:e.cursorSpacing,cursor:e.cursor,showConfirmBar:e.showConfirmBar,selectionStart:e.selectionStart,selectionEnd:e.selectionEnd,adjustPosition:e.adjustPosition,disableDefaultPadding:e.disableDefaultPadding,holdKeyboard:e.holdKeyboard,maxlength:n.maxlen,confirmType:e.confirmType,ignoreCompositionEvent:e.ignoreCompositionEvent,"confirm-hold":e.confirmHold,onFocus:n.onFocus,onBlur:n.onBlur,onLinechange:n.onLinechange,onInput:n.onInput,onConfirm:n.onConfirm,onKeyboardheightchange:n.onKeyboardheightchange},null,8,["value","style","placeholder","placeholder-style","placeholder-class","disabled","focus","autoHeight","fixed","cursorSpacing","cursor","showConfirmBar","selectionStart","selectionEnd","adjustPosition","disableDefaultPadding","holdKeyboard","maxlength","confirmType","ignoreCompositionEvent","confirm-hold","onFocus","onBlur","onLinechange","onInput","onConfirm","onKeyboardheightchange"]),e.count&&n.maxlen!=-1?(d(),u(g,{key:0,class:"uv-textarea__count",style:o([{"background-color":e.disabled?"transparent":"#fff"},e.$uv.addStyle(e.countStyle)])},{default:h(()=>[k(c(n.getCount)+"/"+c(n.maxlen),1)]),_:1},8,["style"])):N("",!0)]),_:1},8,["class","style"])}const I=B(P,[["render",H],["__scopeId","data-v-b56fd13a"]]);export{I as _};
