mirror of
https://github.com/ZeroCatDev/Classworks.git
synced 2026-03-21 09:13:10 +00:00
2 lines
7.0 KiB
JavaScript
2 lines
7.0 KiB
JavaScript
import{j as t,R as X,V as Z,k as l,N as A,n as E,t as s,E as J,o as ve,m as C,F as fe,b as $,e as h,s as me}from"./vendor-vue-B2vxubPy.js";import{a3 as ge,au as be,j as ye,Y as Ce,a8 as he,H as Ie,G as ke,Z as _e,a9 as xe,ar as Ve,ab as Pe,$ as Se}from"./index-CFUCTEXJ.js";import{f as D,u as N,p as F,k as M,h as Fe,A as Be,P as Le,T as Re,a4 as $e,s as we,I as w,m as Te,ag as T,a6 as Ae}from"./vendor-vuetify-s-yw_Hr8.js";import{a as Ee,u as De,b as Ne,f as Me}from"./VLabel-CU-8PdVS.js";const Oe=F({active:Boolean,disabled:Boolean,max:[Number,String],value:{type:[Number,String],default:0},...M(),...be({transition:{component:ye}})},"VCounter"),Ye=D()({name:"VCounter",functional:!0,props:Oe(),setup(e,r){let{slots:o}=r;const d=s(()=>e.max?`${e.value} / ${e.max}`:String(e.value));return N(()=>t(ge,{transition:e.transition},{default:()=>[X(l("div",{class:E(["v-counter",{"text-error":e.max&&!e.disabled&&parseFloat(e.value)>parseFloat(e.max)},e.class]),style:A(e.style)},[o.default?o.default({counter:d.value,max:e.max,value:e.value}):d.value]),[[Z,e.active]])]})),{}}}),qe=F({floating:Boolean,...M()},"VFieldLabel"),S=D()({name:"VFieldLabel",props:qe(),setup(e,r){let{slots:o}=r;return N(()=>t(Ee,{class:E(["v-field-label",{"v-field-label--floating":e.floating},e.class]),style:A(e.style)},o)),{}}}),He=["underlined","outlined","filled","solo","solo-inverted","solo-filled","plain"],Ue=F({appendInnerIcon:w,bgColor:String,clearable:Boolean,clearIcon:{type:w,default:"$clear"},active:Boolean,centerAffix:{type:Boolean,default:void 0},color:String,baseColor:String,dirty:Boolean,disabled:{type:Boolean,default:null},glow:Boolean,error:Boolean,flat:Boolean,iconColor:[Boolean,String],label:String,persistentClear:Boolean,prependInnerIcon:w,reverse:Boolean,singleLine:Boolean,variant:{type:String,default:"filled",validator:e=>He.includes(e)},"onClick:clear":T(),"onClick:appendInner":T(),"onClick:prependInner":T(),...M(),...Se(),...Pe(),...Te()},"VField"),Ge=D()({name:"VField",inheritAttrs:!1,props:{id:String,details:Boolean,labelId:String,...Me(),...Ue()},emits:{"update:focused":e=>!0,"update:modelValue":e=>!0},setup(e,r){let{attrs:o,emit:d,slots:a}=r;const{themeClasses:c}=Fe(e),{loaderClasses:K}=Ce(e),{focusClasses:Q,isFocused:B,focus:I,blur:k}=De(e),{InputIcon:L}=Ne(e),{roundedClasses:ee}=he(e),{rtlClasses:ae}=Be(),m=s(()=>e.dirty||e.active),O=s(()=>!!(e.label||a.label)),b=s(()=>!e.singleLine&&O.value),le=J(),g=h(()=>e.id||`input-${le}`),q=s(()=>e.details?`${g.value}-messages`:void 0),H=$(),_=$(),U=$(),j=h(()=>["plain","underlined"].includes(e.variant)),p=h(()=>e.error||e.disabled?void 0:m.value&&B.value?e.color:e.baseColor),x=h(()=>{if(!(!e.iconColor||e.glow&&!B.value))return e.iconColor===!0?p.value:e.iconColor}),{backgroundColorClasses:ne,backgroundColorStyles:te}=Ie(()=>e.bgColor),{textColorClasses:z,textColorStyles:W}=ke(p);ve(m,n=>{if(b.value&&!Le()){const u=H.value.$el,v=_.value.$el;requestAnimationFrame(()=>{const f=Re(u),i=v.getBoundingClientRect(),V=i.x-f.x,P=i.y-f.y-(f.height/2-i.height/2),Y=i.width/.75,se=Math.abs(Y-f.width)>1?{maxWidth:we(Y)}:void 0,re=getComputedStyle(u),G=getComputedStyle(v),de=parseFloat(re.transitionDuration)*1e3||150,ue=parseFloat(G.getPropertyValue("--v-field-label-scale")),ce=G.getPropertyValue("color");u.style.visibility="visible",v.style.visibility="hidden",$e(u,{transform:`translate(${V}px, ${P}px) scale(${ue})`,color:ce,...se},{duration:de,easing:Ae,direction:n?"normal":"reverse"}).finished.then(()=>{u.style.removeProperty("visibility"),v.style.removeProperty("visibility")})})}},{flush:"post"});const y=h(()=>({isActive:m,isFocused:B,controlRef:U,iconColor:x,blur:k,focus:I})),R=s(()=>{const n=!m.value;return{"aria-hidden":n,for:n?void 0:g.value}}),oe=s(()=>{const n=b.value&&m.value;return{"aria-hidden":n,for:n?void 0:g.value}});function ie(n){n.target!==document.activeElement&&n.preventDefault()}return N(()=>{var V;const n=e.variant==="outlined",u=!!(a["prepend-inner"]||e.prependInnerIcon),v=!!(e.clearable||a.clear)&&!e.disabled,f=!!(a["append-inner"]||e.appendInnerIcon||v),i=()=>a.label?a.label({...y.value,label:e.label,props:{for:g.value}}):e.label;return l("div",C({class:["v-field",{"v-field--active":m.value,"v-field--appended":f,"v-field--center-affix":e.centerAffix??!j.value,"v-field--disabled":e.disabled,"v-field--dirty":e.dirty,"v-field--error":e.error,"v-field--glow":e.glow,"v-field--flat":e.flat,"v-field--has-background":!!e.bgColor,"v-field--persistent-clear":e.persistentClear,"v-field--prepended":u,"v-field--reverse":e.reverse,"v-field--single-line":e.singleLine,"v-field--no-label":!i(),[`v-field--variant-${e.variant}`]:!0},c.value,ne.value,Q.value,K.value,ee.value,ae.value,e.class],style:[te.value,e.style],onClick:ie},o),[l("div",{class:"v-field__overlay"},null),t(_e,{name:"v-field",active:!!e.loading,color:e.error?"error":typeof e.loading=="string"?e.loading:e.color},{default:a.loader}),u&&l("div",{key:"prepend",class:"v-field__prepend-inner"},[a["prepend-inner"]?a["prepend-inner"](y.value):e.prependInnerIcon&&t(L,{key:"prepend-icon",name:"prependInner",color:x.value},null)]),l("div",{class:"v-field__field","data-no-activator":""},[["filled","solo","solo-inverted","solo-filled"].includes(e.variant)&&b.value&&t(S,C({key:"floating-label",ref:_,class:[z.value],floating:!0},R.value,{style:W.value}),{default:()=>[i()]}),O.value&&t(S,C({key:"label",ref:H,id:e.labelId},oe.value),{default:()=>[i()]}),((V=a.default)==null?void 0:V.call(a,{...y.value,props:{id:g.value,class:"v-field__input","aria-describedby":q.value},focus:I,blur:k}))??l("div",{id:g.value,class:"v-field__input","aria-describedby":q.value},null)]),v&&t(Ve,{key:"clear"},{default:()=>[X(l("div",{class:"v-field__clearable",onMousedown:P=>{P.preventDefault(),P.stopPropagation()}},[t(xe,{defaults:{VIcon:{icon:e.clearIcon}}},{default:()=>[a.clear?a.clear({...y.value,props:{onFocus:I,onBlur:k,onClick:e["onClick:clear"],tabindex:-1}}):t(L,{name:"clear",onFocus:I,onBlur:k,tabindex:-1},null)]})]),[[Z,e.dirty]])]}),f&&l("div",{key:"append",class:"v-field__append-inner"},[a["append-inner"]?a["append-inner"](y.value):e.appendInnerIcon&&t(L,{key:"append-icon",name:"appendInner",color:x.value},null)]),l("div",{class:E(["v-field__outline",z.value]),style:A(W.value)},[n&&l(fe,null,[l("div",{class:"v-field__outline__start"},null),b.value&&l("div",{class:"v-field__outline__notch"},[t(S,C({ref:_,floating:!0},R.value),{default:()=>[i()]})]),l("div",{class:"v-field__outline__end"},null)]),j.value&&b.value&&t(S,C({ref:_,floating:!0},R.value),{default:()=>[i()]})])])}),{controlRef:U,fieldIconColor:x}}}),Xe=F({autocomplete:String},"autocomplete");function Ze(e){const r=J(),o=me(0),d=s(()=>e.autocomplete==="suppress"),a=s(()=>{if(e.name)return d.value?`${e.name}-${r}-${o.value}`:e.name}),c=s(()=>d.value?"off":e.autocomplete);return{isSuppressing:d,fieldAutocomplete:c,fieldName:a,update:()=>o.value=new Date().getTime()}}function Je(e){function r(o,d){if(!e.autofocus||!o)return;const a=d[0].target,c=a.matches("input,textarea")?a:a.querySelector("input,textarea");c==null||c.focus()}return{onIntersect:r}}export{Ge as V,Ye as a,Je as b,Xe as c,Ue as m,Ze as u};
|