|
|
import{D as e,E as t,G as a,H as o,K as n,L as i,J as r,a8 as s,o as l,c as d,w as u,d as g,M as h,e as p,t as c,m,k as f,a9 as b,j as A,i as y,aa as S,ab as x,b as B,f as C,F as N,O as v,a3 as T}from"./index-DkGewvWo.js";import{_ as F}from"./_plugin-vue_export-helper.BCo6x5W8.js";import{_ as w}from"./u-loading-icon.CdrBTsp-.js";import{r as z}from"./uni-app.es.Bo01BzMV.js";import{_ as P}from"./u-icon.x7ElsZU9.js";const M=F({name:"u-textarea",mixins:[a,o,e({props:{value:{type:[String,Number],default:()=>t.textarea.value},modelValue:{type:[String,Number],default:()=>t.textarea.value},placeholder:{type:[String,Number],default:()=>t.textarea.placeholder},placeholderClass:{type:String,default:()=>t.input.placeholderClass},placeholderStyle:{type:[String,Object],default:()=>t.input.placeholderStyle},height:{type:[String,Number],default:()=>t.textarea.height},confirmType:{type:String,default:()=>t.textarea.confirmType},disabled:{type:Boolean,default:()=>t.textarea.disabled},count:{type:Boolean,default:()=>t.textarea.count},focus:{type:Boolean,default:()=>t.textarea.focus},autoHeight:{type:Boolean,default:()=>t.textarea.autoHeight},fixed:{type:Boolean,default:()=>t.textarea.fixed},cursorSpacing:{type:Number,default:()=>t.textarea.cursorSpacing},cursor:{type:[String,Number],default:()=>t.textarea.cursor},showConfirmBar:{type:Boolean,default:()=>t.textarea.showConfirmBar},selectionStart:{type:Number,default:()=>t.textarea.selectionStart},selectionEnd:{type:Number,default:()=>t.textarea.selectionEnd},adjustPosition:{type:Boolean,default:()=>t.textarea.adjustPosition},disableDefaultPadding:{type:Boolean,default:()=>t.textarea.disableDefaultPadding},holdKeyboard:{type:Boolean,default:()=>t.textarea.holdKeyboard},maxlength:{type:[String,Number],default:()=>t.textarea.maxlength},border:{type:String,default:()=>t.textarea.border},formatter:{type:[Function,null],default:()=>t.textarea.formatter},ignoreCompositionEvent:{type:Boolean,default:!0}}})],data:()=>({innerValue:"",focused:!1,firstChange:!0,changeFromInner:!1,innerFormatter:e=>e}),created(){},watch:{modelValue:{immediate:!0,handler(e,t){this.innerValue=e,!1===this.firstChange&&!1===this.changeFromInner&&this.valueChange(),this.firstChange=!1,this.changeFromInner=!1}}},computed:{textareaClass(){let e=[],{border:t,disabled:a}=this;return"surround"===t&&(e=e.concat(["u-border","u-textarea--radius"])),"bottom"===t&&(e=e.concat(["u-border-bottom","u-textarea--no-radius"])),a&&e.push("u-textarea--disabled"),e.join(" ")},textareaStyle(){return n({},i(this.customStyle))}},emits:["update:modelValue","linechange","focus","blur","change","confirm","keyboardheightchange"],methods:{addStyle:i,addUnit:r,setFormatter(e){this.innerFormatter=e},onFocus(e){this.$emit("focus",e)},onBlur(e){this.$emit("blur",e),s(this,"blur")},onLinechange(e){this.$emit("linechange",e)},onInput(e){let{value:t=""}=e.detail||{};const a=(this.formatter||this.innerFormatter)(t);this.innerValue=t,this.$nextTick((()=>{this.innerValue=a,this.valueChange()}))},valueChange(){const e=this.innerValue;this.$nextTick((()=>{this.$emit("update:modelValue",e),this.changeFromInner=!0,this.$emit("change",e),s(this,"change")}))},onConfirm(e){this.$emit("confirm",e)},onKeyboardheightchange(e){this.$emit("keyboardheightchange",e)}}},[["render",function(e,t,a,o,n,i){const r=b,s=A,S=y;return l(),d(S,{class:f(["u-textarea",i.textareaClass]),style:h([i.textareaStyle])},{default:u((()=>[g(r,{class:"u-textarea__field",value:n.innerValue,style:h({height:i.addUnit(e.height)}),placeholder:e.placeholder,"placeholder-style":i.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:e.maxlength,"confirm-type":e.confirmType,ignoreCompositionEvent:e.ignoreCompositionEvent,onFocus:i.onFocus,onBlur:i.onBlur,onLine
|