1
0
mirror of https://github.com/ZeroCatDev/Classworks.git synced 2025-09-05 01:19:23 +00:00
Classworks/assets/VTabsWindowItem-2LzsABeI.js

2 lines
6.7 KiB
JavaScript

import{bC as $,g as T,p as V,a6 as N,aj as Z,ai as q,bz as Q,U as _,J as h,W as x,Y as p,X,d as m,i as y,y as Y,c as I,am as L,n as M,e as A,ac as ee,m as te,h as j,by as ne,bt as z,R as oe,E as G,Z as se,bw as ae,b as ie,bu as ue,aJ as le,N as ce,bv as re,bx as de,a4 as ve,K as k}from"./index-BPtvo4Tw.js";const fe=e=>{const{touchstartX:o,touchendX:t,touchstartY:n,touchendY:a}=e,i=.5,s=16;e.offsetX=t-o,e.offsetY=a-n,Math.abs(e.offsetY)<i*Math.abs(e.offsetX)&&(e.left&&t<o-s&&e.left(e),e.right&&t>o+s&&e.right(e)),Math.abs(e.offsetX)<i*Math.abs(e.offsetY)&&(e.up&&a<n-s&&e.up(e),e.down&&a>n+s&&e.down(e))};function he(e,o){var n;const t=e.changedTouches[0];o.touchstartX=t.clientX,o.touchstartY=t.clientY,(n=o.start)==null||n.call(o,{originalEvent:e,...o})}function me(e,o){var n;const t=e.changedTouches[0];o.touchendX=t.clientX,o.touchendY=t.clientY,(n=o.end)==null||n.call(o,{originalEvent:e,...o}),fe(o)}function ge(e,o){var n;const t=e.changedTouches[0];o.touchmoveX=t.clientX,o.touchmoveY=t.clientY,(n=o.move)==null||n.call(o,{originalEvent:e,...o})}function ye(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const o={touchstartX:0,touchstartY:0,touchendX:0,touchendY:0,touchmoveX:0,touchmoveY:0,offsetX:0,offsetY:0,left:e.left,right:e.right,up:e.up,down:e.down,start:e.start,move:e.move,end:e.end};return{touchstart:t=>he(t,o),touchend:t=>me(t,o),touchmove:t=>ge(t,o)}}function be(e,o){var l;const t=o.value,n=t!=null&&t.parent?e.parentElement:e,a=(t==null?void 0:t.options)??{passive:!0},i=(l=o.instance)==null?void 0:l.$.uid;if(!n||!i)return;const s=ye(o.value);n._touchHandlers=n._touchHandlers??Object.create(null),n._touchHandlers[i]=s,$(s).forEach(d=>{n.addEventListener(d,s[d],a)})}function we(e,o){var i,s;const t=(i=o.value)!=null&&i.parent?e.parentElement:e,n=(s=o.instance)==null?void 0:s.$.uid;if(!(t!=null&&t._touchHandlers)||!n)return;const a=t._touchHandlers[n];$(a).forEach(l=>{t.removeEventListener(l,a[l])}),delete t._touchHandlers[n]}const C={mounted:be,unmounted:we},Te=Symbol.for("vuetify:v-tabs"),O=Symbol.for("vuetify:v-window"),F=Symbol.for("vuetify:v-window-group"),U=V({continuous:Boolean,nextIcon:{type:[Boolean,String,Function,Object],default:"$next"},prevIcon:{type:[Boolean,String,Function,Object],default:"$prev"},reverse:Boolean,showArrows:{type:[Boolean,String],validator:e=>typeof e=="boolean"||e==="hover"},touch:{type:[Object,Boolean],default:void 0},direction:{type:String,default:"horizontal"},modelValue:null,disabled:Boolean,selectedClass:{type:String,default:"v-window-item--active"},mandatory:{type:[Boolean,String],default:"force"},...j(),...te(),...ee()},"VWindow"),R=T()({name:"VWindow",directives:{vTouch:C},props:U(),emits:{"update:modelValue":e=>!0},setup(e,o){let{slots:t}=o;const{themeClasses:n}=N(e),{isRtl:a}=Z(),{t:i}=q(),s=Q(e,F),l=_(),d=h(()=>a.value?!e.reverse:e.reverse),v=x(!1),b=h(()=>{const u=e.direction==="vertical"?"y":"x",f=(d.value?!v.value:v.value)?"-reverse":"";return`v-window-${u}${f}-transition`}),W=x(0),w=_(void 0),g=h(()=>s.items.value.findIndex(u=>s.selected.value.includes(u.id)));p(g,(u,r)=>{const f=s.items.value.length,E=f-1;f<=2?v.value=u<r:u===E&&r===0?v.value=!0:u===0&&r===E?v.value=!1:v.value=u<r}),ne(O,{transition:b,isReversed:v,transitionCount:W,transitionHeight:w,rootRef:l});const c=X(()=>e.continuous||g.value!==0),S=X(()=>e.continuous||g.value!==s.items.value.length-1);function B(){c.value&&s.prev()}function P(){S.value&&s.next()}const J=h(()=>{const u=[],r={icon:a.value?e.nextIcon:e.prevIcon,class:`v-window__${d.value?"right":"left"}`,onClick:s.prev,"aria-label":i("$vuetify.carousel.prev")};u.push(c.value?t.prev?t.prev({props:r}):m(Y,r,null):y("div",null,null));const f={icon:a.value?e.prevIcon:e.nextIcon,class:`v-window__${d.value?"left":"right"}`,onClick:s.next,"aria-label":i("$vuetify.carousel.next")};return u.push(S.value?t.next?t.next({props:f}):m(Y,f,null):y("div",null,null)),u}),K=h(()=>e.touch===!1?e.touch:{...{left:()=>{d.value?B():P()},right:()=>{d.value?P():B()},start:r=>{let{originalEvent:f}=r;f.stopPropagation()}},...e.touch===!0?{}:e.touch});return I(()=>L(m(e.tag,{ref:l,class:A(["v-window",{"v-window--show-arrows-on-hover":e.showArrows==="hover"},n.value,e.class]),style:M(e.style)},{default:()=>{var u,r;return[y("div",{class:"v-window__container",style:{height:w.value}},[(u=t.default)==null?void 0:u.call(t,{group:s}),e.showArrows!==!1&&y("div",{class:"v-window__controls"},[J.value])]),(r=t.additional)==null?void 0:r.call(t,{group:s})]}}),[[C,K.value]])),{group:s}}}),Ve=V({...se(U(),["continuous","nextIcon","prevIcon","showArrows","touch","mandatory"])},"VTabsWindow"),xe=T()({name:"VTabsWindow",props:Ve(),emits:{"update:modelValue":e=>!0},setup(e,o){let{slots:t}=o;const n=z(Te,null),a=oe(e,"modelValue"),i=h({get(){var s;return a.value!=null||!n?a.value:(s=n.items.value.find(l=>n.selected.value.includes(l.id)))==null?void 0:s.value},set(s){a.value=s}});return I(()=>{const s=R.filterProps(e);return m(R,G({_as:"VTabsWindow"},s,{modelValue:i.value,"onUpdate:modelValue":l=>i.value=l,class:["v-tabs-window",e.class],style:e.style,mandatory:!1,touch:!1}),t)}),{}}}),D=V({reverseTransition:{type:[Boolean,String],default:void 0},transition:{type:[Boolean,String],default:void 0},...j(),...de(),...re()},"VWindowItem"),H=T()({name:"VWindowItem",directives:{vTouch:C},props:D(),emits:{"group:selected":e=>!0},setup(e,o){let{slots:t}=o;const n=z(O),a=ae(e,F),{isBooted:i}=ie();if(!n||!a)throw new Error("[Vuetify] VWindowItem must be used inside VWindow");const s=x(!1),l=h(()=>i.value&&(n.isReversed.value?e.reverseTransition!==!1:e.transition!==!1));function d(){!s.value||!n||(s.value=!1,n.transitionCount.value>0&&(n.transitionCount.value-=1,n.transitionCount.value===0&&(n.transitionHeight.value=void 0)))}function v(){var c;s.value||!n||(s.value=!0,n.transitionCount.value===0&&(n.transitionHeight.value=k((c=n.rootRef.value)==null?void 0:c.clientHeight)),n.transitionCount.value+=1)}function b(){d()}function W(c){s.value&&ve(()=>{!l.value||!s.value||!n||(n.transitionHeight.value=k(c.clientHeight))})}const w=h(()=>{const c=n.isReversed.value?e.reverseTransition:e.transition;return l.value?{name:typeof c!="string"?n.transition.value:c,onBeforeEnter:v,onAfterEnter:d,onEnterCancelled:b,onBeforeLeave:v,onAfterLeave:d,onLeaveCancelled:b,onEnter:W}:!1}),{hasContent:g}=ue(e,a.isSelected);return I(()=>m(ce,{transition:w.value,disabled:!i.value},{default:()=>{var c;return[L(y("div",{class:A(["v-window-item",a.selectedClass.value,e.class]),style:M(e.style)},[g.value&&((c=t.default)==null?void 0:c.call(t))]),[[le,a.isSelected.value]])]}})),{groupItem:a}}}),Ie=V({...D()},"VTabsWindowItem"),Ce=T()({name:"VTabsWindowItem",props:Ie(),setup(e,o){let{slots:t}=o;return I(()=>{const n=H.filterProps(e);return m(H,G({_as:"VTabsWindowItem"},n,{class:["v-tabs-window-item",e.class],style:e.style}),t)}),{}}});export{Te as V,Ce as a,xe as b,R as c,H as d};