1
0
mirror of https://github.com/ZeroCatDev/Classworks.git synced 2025-12-07 21:13:11 +00:00
Classworks/assets/VMenu-Benc8GrC.js

2 lines
2.9 KiB
JavaScript

import{g as x,p as M,a3 as R,aG as p,bi as I,aN as T,ay as S,$ as L,bH as K,cd as w,a0 as O,aP as U,ce as F,a6 as H,a5 as N,E as b,c as B,au as A,d as E,ac as $,ad as j,ae as z,bl as G,cb as q,cf as m,cg as J,ch as Q,bM as W,ci as X}from"./index-DN18mNda.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:q}}),["absolute"])},"VMenu"),ee=x()({name:"VMenu",props:Y(),emits:{"update:modelValue":t=>!0},setup(t,P){let{slots:i}=P;const o=R(t,"modelValue"),{scopeId:V}=p(),{isRtl:c}=I(),v=T(),f=S(()=>t.id||`v-menu-${v}`),s=L(),a=K(w,null),d=O(new Set);W(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&&!X(e,s.value.contentEl))&&(o.value=!1,a==null||a.closeParents())},40)}}),U(()=>a==null?void 0:a.unregister()),F(()=>o.value=!1),H(o,e=>{e?a==null||a.register():a==null||a.unregister()},{immediate:!0});function k(e){a==null||a.closeParents(e)}function h(e){var n,l,r,u,g;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(),!J(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,(g=(u=s.value)==null?void 0:u.activatorEl)==null||g.focus())}function y(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(()=>y(e))))}const C=N(()=>b({"aria-haspopup":"menu","aria-expanded":String(o.value),"aria-controls":f.value,"aria-owns":f.value,onKeydown:y},t.activatorProps));return B(()=>{const e=A.filterProps(t);return E(A,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":k,onKeydown:h},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 E($,{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};