Files
tvbox_collect/ediart/buye/vod/player/assets/VTextarea-CXFSbVox.js
T
2026-06-29 03:41:14 +00:00

2 lines
4.5 KiB
JavaScript

import{p as e,s as a,af as t,C as l,t as o,A as r,G as n,o as u,W as s,X as i,H as d,aC as c,d as v,m as p,F as f,ab as x,ao as m,aI as g,ai as w,ar as y,aJ as V,I as h,ae as b}from"./index-y1hS5lj0.js";import{m as C,b as F,u as I,V as S,f as k,d as P,e as z}from"./VInput-Ba6RirnE.js";import{I as B}from"./loader-C-60Rb6M.js";const G=e({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,...C(),...F()},"VTextarea"),N=a()({name:"VTextarea",directives:{Intersect:B},inheritAttrs:!1,props:G(),emits:{"click:control":e=>!0,"mousedown:control":e=>!0,"update:focused":e=>!0,"update:modelValue":e=>!0},setup(e,a){function C(a,t){var l,o;e.autofocus&&a&&(null==(o=null==(l=t[0].target)?void 0:l.focus)||o.call(l))}function F(){var e;$.value!==document.activeElement&&(null==(e=$.value)||e.focus()),H.value||D()}function B(e){F(),j("click:control",e)}function G(e){j("mousedown:control",e)}function N(a){a.stopPropagation(),F(),y((()=>{E.value="",V(e["onClick:clear"],a)}))}function R(a){var t;const l=a.target;if(E.value=l.value,null==(t=e.modelModifiers)?void 0:t.trim){const e=[l.selectionStart,l.selectionEnd];y((()=>{l.selectionStart=e[0],l.selectionEnd=e[1]}))}}function _(){e.autoGrow&&y((()=>{if(!K.value||!W.value)return;const a=getComputedStyle(K.value),t=getComputedStyle(W.value.$el),l=parseFloat(a.getPropertyValue("--v-field-padding-top"))+parseFloat(a.getPropertyValue("--v-input-padding-top"))+parseFloat(a.getPropertyValue("--v-field-padding-bottom")),o=K.value.scrollHeight,r=parseFloat(a.lineHeight),n=Math.max(parseFloat(e.rows)*r+l,parseFloat(t.getPropertyValue("--v-input-control-height"))),u=b(o??0,n,parseFloat(e.maxRows)*r+l||1/0);L.value=Math.floor((u-l)/r),X.value=h(u)}))}let{attrs:M,emit:j,slots:A}=a;const E=t(e,"modelValue"),{isFocused:H,focus:D,blur:O}=I(e),T=l((()=>"function"==typeof e.counterValue?e.counterValue(E.value):(""+(E.value||"")).length)),U=l((()=>M.maxlength?M.maxlength:!e.counter||"number"!=typeof e.counter&&"string"!=typeof e.counter?void 0:e.counter)),J=o(),W=o(),X=r(""),$=o(),q=l((()=>e.persistentPlaceholder||H.value||e.active)),K=o(),L=o(+e.rows),Q=l((()=>["plain","underlined"].includes(e.variant)));let Y;return n((()=>{e.autoGrow||(L.value=+e.rows)})),u(_),s(E,_),s((()=>e.rows),_),s((()=>e.maxRows),_),s((()=>e.density),_),s(K,(e=>{e?(Y=new ResizeObserver(_),Y.observe(K.value)):null==Y||Y.disconnect()})),i((()=>{null==Y||Y.disconnect()})),d((()=>{const a=!!(A.counter||e.counter||e.counterValue),t=!(!a&&!A.details),[l,o]=c(M),{modelValue:r,...n}=S.filterProps(e),u=k(e);return v(S,p({ref:J,modelValue:E.value,"onUpdate:modelValue":e=>E.value=e,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":Q.value},e.class],style:e.style},l,n,{centerAffix:1===L.value&&!Q.value,focused:H.value}),{...A,default:a=>{let{id:t,isDisabled:l,isDirty:r,isReadonly:n,isValid:s}=a;return v(P,p({ref:W,style:{"--v-textarea-control-height":X.value},onClick:B,onMousedown:G,"onClick:clear":N,"onClick:prependInner":e["onClick:prependInner"],"onClick:appendInner":e["onClick:appendInner"]},u,{id:t.value,active:q.value||r.value,centerAffix:1===L.value&&!Q.value,dirty:r.value||e.dirty,disabled:l.value,focused:H.value,error:!1===s.value}),{...A,default:a=>{let{props:{class:t,...r}}=a;return v(f,null,[e.prefix&&v("span",{class:"v-text-field__prefix"},[e.prefix]),x(v("textarea",p({ref:$,class:t,value:E.value,onInput:R,autofocus:e.autofocus,readonly:n.value,disabled:l.value,placeholder:e.placeholder,rows:e.rows,name:e.name,onFocus:F,onBlur:O},r,o),null),[[m("intersect"),{handler:C},null,{once:!0}]]),e.autoGrow&&x(v("textarea",{class:[t,"v-textarea__sizer"],id:r.id+"-sizer","onUpdate:modelValue":e=>E.value=e,ref:K,readonly:!0,"aria-hidden":"true"},null),[[g,E.value]]),e.suffix&&v("span",{class:"v-text-field__suffix"},[e.suffix])])}})},details:t?t=>{var l;return v(f,null,[null==(l=A.details)?void 0:l.call(A,t),a&&v(f,null,[v("span",null,null),v(z,{active:e.persistentCounter||H.value,value:T.value,max:U.value,disabled:e.disabled},A.counter)])])}:void 0})})),w({},J,W,$)}});export{N as V};