Files
dockerStuff/config/tandoor/staticfiles/vue3/assets/VTextarea-Dyu7dPGe.js
2025-11-16 21:46:46 +00:00

2 lines
4.4 KiB
JavaScript

import{ak as ne,al as le,cS as _,bj as oe,cn as ue,c as w,r as v,bJ as ie,cT as re,o as se,aM as c,bA as ce,at as de,cA as fe,aK as D,cB as E,g as I,av as R,c2 as ve,cC as me,co as xe,aT as S,c6 as ge,c5 as he,i as u,F as N,cD as we,aF as G,cU as Ve,cV as ye,n as Ce,cE as Fe}from"./main-BhFWIRV_.js";const be=le({autoGrow:Boolean,autofocus:Boolean,counter:[Boolean,Number,String],counterValue:Function,prefix:String,placeholder:String,persistentPlaceholder:Boolean,persistentCounter:Boolean,noResize:Boolean,rows:{type:[Number,String],default:5,validator:e=>!isNaN(parseFloat(e))},maxRows:{type:[Number,String],validator:e=>!isNaN(parseFloat(e))},suffix:String,modelModifiers:Object,...xe(),...me()},"VTextarea"),ke=ne()({name:"VTextarea",directives:{vIntersect:_},inheritAttrs:!1,props:be(),emits:{"click:control":e=>!0,"mousedown:control":e=>!0,"update:focused":e=>!0,"update:modelValue":e=>!0,"update:rows":e=>!0},setup(e,U){let{attrs:V,emit:y,slots:i}=U;const a=oe(e,"modelValue"),{isFocused:d,focus:O,blur:j}=ue(e),{onIntersect:$}=Ve(e),J=w(()=>typeof e.counterValue=="function"?e.counterValue(a.value):(a.value||"").toString().length),K=w(()=>{if(V.maxlength)return V.maxlength;if(!(!e.counter||typeof e.counter!="number"&&typeof e.counter!="string"))return e.counter}),A=v(),m=v(),B=ie(""),x=v(),q=w(()=>e.persistentPlaceholder||d.value||e.active);function C(){x.value!==document.activeElement&&x.value?.focus(),d.value||O()}function L(t){C(),y("click:control",t)}function Q(t){y("mousedown:control",t)}function W(t){t.stopPropagation(),C(),S(()=>{a.value="",Fe(e["onClick:clear"],t)})}function X(t){const n=t.target;if(a.value=n.value,e.modelModifiers?.trim){const l=[n.selectionStart,n.selectionEnd];S(()=>{n.selectionStart=l[0],n.selectionEnd=l[1]})}}const r=v(),f=v(Number(e.rows)),F=w(()=>["plain","underlined"].includes(e.variant));re(()=>{e.autoGrow||(f.value=Number(e.rows))});function s(){e.autoGrow&&S(()=>{if(!r.value||!m.value)return;const t=getComputedStyle(r.value),n=getComputedStyle(m.value.$el),l=parseFloat(t.getPropertyValue("--v-field-padding-top"))+parseFloat(t.getPropertyValue("--v-input-padding-top"))+parseFloat(t.getPropertyValue("--v-field-padding-bottom")),b=r.value.scrollHeight,h=parseFloat(t.lineHeight),P=Math.max(parseFloat(e.rows)*h+l,parseFloat(n.getPropertyValue("--v-input-control-height"))),k=parseFloat(e.maxRows)*h+l||1/0,o=he(b??0,P,k);f.value=Math.floor((o-l)/h),B.value=ge(o)})}se(s),c(a,s),c(()=>e.rows,s),c(()=>e.maxRows,s),c(()=>e.density,s),c(f,t=>{y("update:rows",t)});let g;return c(r,t=>{t?(g=new ResizeObserver(s),g.observe(r.value)):g?.disconnect()}),ce(()=>{g?.disconnect()}),de(()=>{const t=!!(i.counter||e.counter||e.counterValue),n=!!(t||i.details),[l,b]=fe(V),{modelValue:h,...P}=D.filterProps(e),k={...E.filterProps(e),"onClick:clear":W};return I(D,R({ref:A,modelValue:a.value,"onUpdate:modelValue":o=>a.value=o,class:["v-textarea v-text-field",{"v-textarea--prefixed":e.prefix,"v-textarea--suffixed":e.suffix,"v-text-field--prefixed":e.prefix,"v-text-field--suffixed":e.suffix,"v-textarea--auto-grow":e.autoGrow,"v-textarea--no-resize":e.noResize||e.autoGrow,"v-input--plain-underlined":F.value},e.class],style:e.style},l,P,{centerAffix:f.value===1&&!F.value,focused:d.value}),{...i,default:o=>{let{id:Y,isDisabled:M,isDirty:T,isReadonly:Z,isValid:p,hasDetails:ee}=o;return I(E,R({ref:m,style:{"--v-textarea-control-height":B.value},onClick:L,onMousedown:Q,"onClick:prependInner":e["onClick:prependInner"],"onClick:appendInner":e["onClick:appendInner"]},k,{id:Y.value,active:q.value||T.value,centerAffix:f.value===1&&!F.value,dirty:T.value||e.dirty,disabled:M.value,focused:d.value,details:ee.value,error:p.value===!1}),{...i,default:te=>{let{props:{class:z,...H}}=te;return u(N,null,[e.prefix&&u("span",{class:"v-text-field__prefix"},[e.prefix]),G(u("textarea",R({ref:x,class:z,value:a.value,onInput:X,autofocus:e.autofocus,readonly:Z.value,disabled:M.value,placeholder:e.placeholder,rows:e.rows,name:e.name,onFocus:C,onBlur:j},H,b),null),[[_,{handler:$},null,{once:!0}]]),e.autoGrow&&G(u("textarea",{class:Ce([z,"v-textarea__sizer"]),id:`${H.id}-sizer`,"onUpdate:modelValue":ae=>a.value=ae,ref:r,readonly:!0,"aria-hidden":"true"},null),[[ye,a.value]]),e.suffix&&u("span",{class:"v-text-field__suffix"},[e.suffix])])}})},details:n?o=>u(N,null,[i.details?.(o),t&&u(N,null,[u("span",null,null),I(we,{active:e.persistentCounter||d.value,value:J.value,max:K.value,disabled:e.disabled},i.counter)])]):void 0})}),ve({},A,m,x)}});export{ke as V};