mirror of
https://github.com/ZeroCatDev/Classworks.git
synced 2025-12-08 13:49:37 +00:00
2 lines
2.9 KiB
JavaScript
2 lines
2.9 KiB
JavaScript
import{g as x,p as M,$ as R,aF as p,bh as I,aM as T,ax as L,W as S,bG as O,cc as w,X as K,aO as F,cd as U,a2 as B,a1 as H,E as b,c as N,at as k,d as A,aa as $,ab as j,ac as z,bk as G,ca as W,ce as m,cf as X,cg as q,bL as J,ch as Q}from"./index-Cn8n78WY.js";const Y=M({id:String,submenu:Boolean,...z(G({captureFocus:!0,closeDelay:250,closeOnContentClick:!0,locationStrategy:"connected",location:void 0,openDelay:300,scrim:!1,scrollStrategy:"reposition",transition:{component:W}}),["absolute"])},"VMenu"),ee=x()({name:"VMenu",props:Y(),emits:{"update:modelValue":t=>!0},setup(t,E){let{slots:i}=E;const o=R(t,"modelValue"),{scopeId:V}=p(),{isRtl:c}=I(),v=T(),f=L(()=>t.id||`v-menu-${v}`),s=S(),a=O(w,null),d=K(new Set);J(w,{register(){d.value.add(v)},unregister(){d.value.delete(v)},closeParents(e){setTimeout(()=>{var n;!d.value.size&&!t.persistent&&(e==null||(n=s.value)!=null&&n.contentEl&&!Q(e,s.value.contentEl))&&(o.value=!1,a==null||a.closeParents())},40)}}),F(()=>a==null?void 0:a.unregister()),U(()=>o.value=!1),B(o,e=>{e?a==null||a.register():a==null||a.unregister()},{immediate:!0});function h(e){a==null||a.closeParents(e)}function P(e){var n,l,r,u,y;if(!t.disabled)if(e.key==="Tab"||e.key==="Enter"&&!t.closeOnContentClick){if(e.key==="Enter"&&(e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLInputElement&&e.target.closest("form")))return;e.key==="Enter"&&e.preventDefault(),!X(q((n=s.value)==null?void 0:n.contentEl,!1),e.shiftKey?"prev":"next",D=>D.tabIndex>=0)&&!t.retainFocus&&(o.value=!1,(r=(l=s.value)==null?void 0:l.activatorEl)==null||r.focus())}else t.submenu&&e.key===(c.value?"ArrowRight":"ArrowLeft")&&(o.value=!1,(y=(u=s.value)==null?void 0:u.activatorEl)==null||y.focus())}function g(e){var l;if(t.disabled)return;const n=(l=s.value)==null?void 0:l.contentEl;n&&o.value?e.key==="ArrowDown"?(e.preventDefault(),e.stopImmediatePropagation(),m(n,"next")):e.key==="ArrowUp"?(e.preventDefault(),e.stopImmediatePropagation(),m(n,"prev")):t.submenu&&(e.key===(c.value?"ArrowRight":"ArrowLeft")?o.value=!1:e.key===(c.value?"ArrowLeft":"ArrowRight")&&(e.preventDefault(),m(n,"first"))):(t.submenu?e.key===(c.value?"ArrowLeft":"ArrowRight"):["ArrowDown","ArrowUp"].includes(e.key))&&(o.value=!0,e.preventDefault(),setTimeout(()=>setTimeout(()=>g(e))))}const C=H(()=>b({"aria-haspopup":"menu","aria-expanded":String(o.value),"aria-controls":f.value,"aria-owns":f.value,onKeydown:g},t.activatorProps));return N(()=>{const e=k.filterProps(t);return A(k,b({ref:s,id:f.value,class:["v-menu",t.class],style:t.style},e,{modelValue:o.value,"onUpdate:modelValue":n=>o.value=n,absolute:!0,activatorProps:C.value,location:t.location??(t.submenu?"end":"bottom"),"onClick:outside":h,onKeydown:P},V),{activator:i.activator,default:function(){for(var n=arguments.length,l=new Array(n),r=0;r<n;r++)l[r]=arguments[r];return A($,{root:"VMenu"},{default:()=>{var u;return[(u=i.default)==null?void 0:u.call(i,...l)]}})}})}),j({id:f,ΨopenChildren:d},s)}});export{ee as V};
|