p3x-redis-ui-material
Version:
💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity
1 lines • 5.37 kB
JavaScript
import{A as e,C as t,G as n,H as r,R as i,Wt as a,_t as o,at as s,ht as c,m as l,nt as u,rt as d,w as f,y as p,z as m}from"./i18n.store-Bbsc3Bab.js";import{Ct as h,En as g,Pt as _,Vt as v,Yn as y,a as b,fn as x,gn as S,hn as ee,ht as te,lt as ne}from"./_plugin-vue_export-helper-D1H5elb2.js";import{t as C}from"./intersect-DKQyINFq.js";import{l as w,n as T,t as E}from"./VInput-CpVsgFmo.js";import{a as D,i as O,l as k,o as A,r as re,s as j}from"./VTextField-Cly86AKT.js";var M=v({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))},maxHeight:{type:[Number,String],validator:e=>!isNaN(parseFloat(e))},maxRows:{type:[Number,String],validator:e=>!isNaN(parseFloat(e))},suffix:String,modelModifiers:Object,...O(),...y(T(),[`direction`]),...j()},`VTextarea`),N=_()({name:`VTextarea`,directives:{vIntersect:C},inheritAttrs:!1,props:M(),emits:{"click:control":e=>!0,"mousedown:control":e=>!0,"update:focused":e=>!0,"update:modelValue":e=>!0,"update:rows":e=>!0},setup(_,{attrs:v,emit:y,slots:T}){let O=te(_,`modelValue`),{isFocused:j,focus:M,blur:N}=w(_),{onIntersect:ie}=re(_),P=t(()=>typeof _.counterValue==`function`?_.counterValue(O.value):(O.value||``).toString().length),F=t(()=>{if(v.maxlength)return v.maxlength;if(!(!_.counter||typeof _.counter!=`number`&&typeof _.counter!=`string`))return _.counter}),I=c(),L=c(),R=o(``),z=c(),B=c(0),{platform:V}=ne(),H=D(_),U=t(()=>_.persistentPlaceholder||j.value||_.active);function W(){H.isSuppressing.value&&H.update(),z.value!==document.activeElement&&z.value?.focus(),j.value||M()}function G(e){W(),y(`click:control`,e)}function K(e){y(`mousedown:control`,e)}function q(e){e.stopPropagation(),W(),m(()=>{O.value=``,x(_[`onClick:clear`],e)})}function J(e){let t=e.target;if(!_.modelModifiers?.trim){O.value=t.value;return}let n=t.value,r=t.selectionStart,i=t.selectionEnd;O.value=n,m(()=>{let e=0;n.trimStart().length===t.value.length&&(e=n.length-t.value.length),r!=null&&(t.selectionStart=r-e),i!=null&&(t.selectionEnd=i-e)})}let Y=c(),X=c(Number(_.rows)),Z=t(()=>[`plain`,`underlined`].includes(_.variant));d(()=>{_.autoGrow||(X.value=Number(_.rows))});function Q(){m(()=>{if(!z.value)return;if(V.value.firefox){B.value=12;return}let{offsetWidth:e,clientWidth:t}=z.value;B.value=Math.max(0,e-t)}),_.autoGrow&&m(()=>{if(!Y.value||!L.value)return;let e=getComputedStyle(Y.value),t=getComputedStyle(L.value.$el),n=parseFloat(e.getPropertyValue(`--v-field-padding-top`))+parseFloat(e.getPropertyValue(`--v-input-padding-top`))+parseFloat(e.getPropertyValue(`--v-field-padding-bottom`)),r=Y.value.scrollHeight,i=parseFloat(e.lineHeight),a=Math.max(parseFloat(_.rows)*i+n,parseFloat(t.getPropertyValue(`--v-input-control-height`))),o=_.maxHeight?parseFloat(_.maxHeight):parseFloat(_.maxRows)*i+n||1/0,s=ee(r??0,a,o);X.value=Math.floor((s-n)/i),R.value=S(s)})}n(Q),u(O,Q),u(()=>_.rows,Q),u(()=>_.maxHeight,Q),u(()=>_.maxRows,Q),u(()=>_.density,Q),u(X,e=>{y(`update:rows`,e)});let $;return u(Y,e=>{e?($=new ResizeObserver(Q),$.observe(Y.value)):$?.disconnect()}),r(()=>{$?.disconnect()}),h(()=>{let t=!!(T.counter||_.counter||_.counterValue),n=!!(t||T.details),[r,o]=g(v),{modelValue:c,...u}=E.filterProps(_),d={...A.filterProps(_),"onClick:clear":q};return e(E,i({ref:I,modelValue:O.value,"onUpdate:modelValue":e=>O.value=e,class:[`v-textarea v-text-field`,{"v-textarea--prefixed":_.prefix,"v-textarea--suffixed":_.suffix,"v-text-field--prefixed":_.prefix,"v-text-field--suffixed":_.suffix,"v-textarea--auto-grow":_.autoGrow,"v-textarea--no-resize":_.noResize||_.autoGrow,"v-input--plain-underlined":Z.value},_.class],style:[{"--v-textarea-max-height":_.maxHeight?S(_.maxHeight):void 0,"--v-textarea-scroll-bar-width":S(B.value)},_.style]},r,u,{centerAffix:X.value===1&&!Z.value,focused:j.value,indentDetails:_.indentDetails??!Z.value}),{...T,default:({id:t,isDisabled:n,isDirty:r,isReadonly:c,isValid:u,hasDetails:m})=>e(A,i({ref:L,style:{"--v-textarea-control-height":R.value},onClick:G,onMousedown:K,"onClick:prependInner":_[`onClick:prependInner`],"onClick:appendInner":_[`onClick:appendInner`]},d,{id:t.value,active:U.value||r.value,labelId:`${t.value}-label`,centerAffix:X.value===1&&!Z.value,dirty:r.value||_.dirty,disabled:n.value,focused:j.value,details:m.value,error:u.value===!1}),{...T,default:({props:{class:e,...r},controlRef:u})=>f(p,null,[_.prefix&&f(`span`,{class:`v-text-field__prefix`},[_.prefix]),s(f(`textarea`,i({ref:e=>z.value=u.value=e,class:e,value:O.value,onInput:J,autofocus:_.autofocus,readonly:c.value,disabled:n.value,placeholder:_.placeholder,rows:_.rows,name:H.fieldName.value,autocomplete:H.fieldAutocomplete.value,onFocus:W,onBlur:N,"aria-labelledby":`${t.value}-label`},r,o),null),[[C,{handler:ie},null,{once:!0}]]),_.autoGrow&&s(f(`textarea`,{class:a([e,`v-textarea__sizer`]),id:`${r.id}-sizer`,"onUpdate:modelValue":e=>O.value=e,ref:Y,readonly:!0,"aria-hidden":`true`},null),[[l,O.value]]),_.suffix&&f(`span`,{class:`v-text-field__suffix`},[_.suffix])])}),details:n?n=>f(p,null,[T.details?.(n),t&&f(p,null,[f(`span`,null,null),e(k,{active:_.persistentCounter||j.value,value:P.value,max:F.value,disabled:_.disabled},T.counter)])]):void 0})}),b({},I,L,z)}});export{N as t};