text: import{d as w,k as S,P as I,j as de,z as me,aN as _e,M as L,C as N,O as ve,b as t,aK as fe,an as he,K as ne,N as ue,a0 as xe,_ as H,r as h,B as Y,o as D,c as M,w as o,p as W,e as K,f as a,a as B,F as oe,q as pe,v as z,t as $e}from"./index.d6404b28.js";var se=function(e,s){var r,l=s.arg;if(!l){console.error("\u53C2\u6570\u6709\u8BEF");return}var v=s.value,u=xe(l)?l.value:(r=s.instance)===null||r===void 0?void 0:r.$refs[l];if(!u){console.error("\u6CA1\u6709\u627E\u5230 ".concat(l," \u5BF9\u5E94\u7684\u5B9E\u4F8B"));return}if(typeof u.addReference!="function"){console.error("".concat(l," \u5BF9\u5E94\u7684\u5B9E\u4F8B\u4E0D\u662F VContextmenu"));return}e.$contextmenuKey=l,u.addReference(e,v)},le=function(e,s){var r,l=e.$contextmenuKey;if(!!l){var v=(r=s.instance)===null||r===void 0?void 0:r.$refs[l];v==null||v.removeReference(e)}},be=function(e,s){le(e,s),se(e,s)},J={mounted:se,updated:be,beforeUnmount:le},c={contextmenu:"v-contextmenu",contextmenuIcon:"v-contextmenu-icon",contextmenuInner:"v-contextmenu-inner",contextmenuDivider:"v-contextmenu-divider",contextmenuItem:"v-contextmenu-item",contextmenuItemHover:"v-contextmenu-item--hover",contextmenuItemDisabled:"v-contextmenu-item--disabled",contextmenuGroup:"v-contextmenu-group",contextmenuGroupTitle:"v-contextmenu-group__title",contextmenuGroupMenus:"v-contextmenu-group__menus",contextmenuSubmenu:"v-contextmenu-submenu",contextmenuSubmenuTitle:"v-contextmenu-submenu__title",contextmenuSubmenuMenus:"v-contextmenu-submenu__menus",contextmenuSubmenuMenusTop:"v-contextmenu-submenu__menus--top",contextmenuSubmenuMenusRight:"v-contextmenu-submenu__menus--right",contextmenuSubmenuMenusBottom:"v-contextmenu-submenu__menus--bottom",contextmenuSubmenuMenusLeft:"v-contextmenu-submenu__menus--left",contextmenuSubmenuArrow:"v-contextmenu-submenu__arrow"};function ge(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Object]"&&!fe(n)}var Ce={trigger:["contextmenu"]},k=w({name:"VContextmenu",props:{modelValue:{type:Boolean,default:!1},autoAjustPlacement:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},teleport:{type:[String,Object],default:function(){return"body"}}},emits:["show","hide","update:modelValue"],setup:function(e,s){var r=s.emit,l=S(null),v=S(e.modelValue||!1),u=function(_){v.value=_,r("update:modelValue",_)},m=S({top:0,left:0}),x=I(function(){return{top:"".concat(m.value.top,"px"),left:"".concat(m.value.left,"px")}}),$=S(null),d=function(_,g){var f=_ instanceof Event?g:_,G=(f==null?void 0:f.autoAjustPlacement)||e.autoAjustPlacement,y={top:(f==null?void 0:f.top)||0,left:(f==null?void 0:f.left)||0};if(_ instanceof Event){var j,U;_.preventDefault(),y.top=(j=f==null?void 0:f.top)!==null&&j!==void 0?j:_.pageY,y.left=(U=f==null?void 0:f.left)!==null&&U!==void 0?U:_.pageX}u(!0),ue(function(){if(G){var X=l.value;if(!X)return;var Q=X.clientWidth,Z=X.clientHeight;if(Z+y.top>=window.innerHeight+window.scrollY){var ee=y.top-Z;ee>window.scrollY&&(y.top=ee)}if(Q+y.left>=window.innerWidth+window.scrollX){var te=y.left-Q;te>window.scrollX&&(y.left=te)}}m.value=y,r("show")})},b=function(){$.value=null,u(!1),r("hide")},i=de(new Map),p=S(),F=I(function(){return p.value&&i.get(p.value)}),q=function(_,g){var f=function(){return g!=null&&g.trigger?Array.isArray(g.trigger)?g.trigger:[g.trigger]:Ce.trigger}(),G=function(j){e.disabled||(p.value=_,d(j,{}))};f.forEach(function(y){_.addEventListener(y,G)}),i.set(_,{triggers:f,handler:G})},T=function(_){var g=i.get(_);!g||(g.triggers.forEach(function(f){_.removeEventListener(f,g.handler)}),i.delete(_))},P=function(_){if(!(!_.target||!l.value||!p.value)){var g=l.value.contains(_.target)||F.value&&F.value.triggers.includes("click")&&p.value.contains(_.target);g||u(!1)}};return me(v,function(E){E?document.addEventListener("click",P):document.removeEventListener("click",P)}),_e(function(){document.removeEventListener("click",P)}),L("visible",v),L("autoAjustPlacement",e.autoAjustPlacement),L("show",d),L("hide",b),{visible:v,style:x,currentReferenceOptions:F,currentOptions:$,contextmenuRef:l,addReference:q,removeReference:T,toggle:u,show:d,hide:b}},methods:{renderContent:function(){var e,s;return N(t("div",{class:c.contextmenu,ref:"contextmenuRef",style:this.style},[t("ul",{class:c.contextmenuInner},[(e=(s=this.$slots).default)===null||e===void 0?void 0:e.call(s,{triggerOptions:"currentReferenceOptions",options:"currentOptions"})])]),[[ve,"visible"]])}},render:function(){var e;return this.visible?this.teleport?t(he,{to:this.teleport},ge(e=this.renderContent())?e:{default:function(){return[e]}}):this.renderContent():null}});function C(n,e,s){return e in n?Object.defineProperty(n,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[e]=s,n}var A=w({name:"VContextmenuItem",props:{disabled:{type:Boolean,default:!1},hideOnClick:{type:Boolean,default:!0}},emits:["click","mouseenter","mouseleave"],setup:function(e,s){var r=s.emit,l=ne("hide"),v=S(!1),u=I(function(){var d;return d={},C(d,c.contextmenuItem,!0),C(d,c.contextmenuItemDisabled,e.disabled),C(d,c.contextmenuItemHover,v.value),d}),m=function(b){e.disabled||(r("click",b),e.hideOnClick&&(l==null||l()))},x=function(b){e.disabled||(v.value=!0,r("mouseenter",b))},$=function(b){e.disabled||(v.value=!1,r("mouseleave",b))};return{classes:u,handleClick:m,handleMouseenter:x,handleMouseleave:$}},render:function(){var e,s;return t("li",{class:this.classes,onClick:this.handleClick,onMouseenter:this.handleMouseenter,onMouseleave:this.handleMouseleave},[(e=(s=this.$slots).default)===null||e===void 0?void 0:e.call(s)])}}),R=w({name:"VContextmenuDivider",render:function(){return t("li",{class:c.contextmenuDivider},null)}}),ye=w({name:"VContextmenuIcon",props:{name:{type:String,required:!0}},render:function(){return t("i",{class:[c.contextmenuIcon,"".concat(c.contextmenuIcon,"-").concat(this.name)]},null)}}),O=w({name:"VContextmenuSubmenu",props:{title:{type:String,required:!0},disabled:{type:Boolean,default:!1}},emits:["mouseenter","mouseleave"],setup:function(e,s){var r=s.emit,l=S(null),v=ne("autoAjustPlacement"),u=S(["top","right"]),m=S(!1),x=function(p){e.disabled||(m.value=!0,r("mouseenter",p),ue(function(){var F=[];if(v){var q=p.target,T=q.getBoundingClientRect();if(!l.value)return;var P=l.value.clientWidth,E=l.value.clientHeight;T.right+P>=window.innerWidth?F.push("left"):F.push("right"),T.bottom+E>=window.innerHeight?F.push("bottom"):F.push("top")}u.value=F}))},$=function(p){e.disabled||(m.value=!1,r("mouseleave",p))},d=I(function(){var i;return i={},C(i,c.contextmenuItem,!0),C(i,c.contextmenuSubmenuTitle,!0),C(i,c.contextmenuItemHover,m.value),C(i,c.contextmenuItemDisabled,e.disabled),i}),b=I(function(){var i;return i={},C(i,c.contextmenu,!0),C(i,c.contextmenuSubmenuMenus,!0),C(i,c.contextmenuSubmenuMenusTop,u.value.includes("top")),C(i,c.contextmenuSubmenuMenusRight,u.value.includes("right")),C(i,c.contextmenuSubmenuMenusBottom,u.value.includes("bottom")),C(i,c.contextmenuSubmenuMenusLeft,u.value.includes("left")),i});return{hover:m,submenuRef:l,titleClasses:d,menusClasses:b,handleMouseenter:x,handleMouseleave:$}},render:function(){var e,s,r,l;return t("li",{class:c.contextmenuSubmenu,onMouseenter:this.handleMouseenter,onMouseleave:this.handleMouseleave},[t("div",{class:this.titleClasses},[((e=(s=this.$slots).title)===null||e===void 0?void 0:e.call(s))||this.title,t("span",{class:c.contextmenuSubmenuArrow},[t(ye,{name:"right-arrow"},null)])]),this.hover?t("div",{ref:"submenuRef",class:this.menusClasses},[t("ul",{class:c.contextmenuInner},[(r=(l=this.$slots).default)===null||r===void 0?void 0:r.call(l)])]):null])}}),V=w({name:"VContextmenuGroup",props:{title:{type:String,default:void 0},maxWidth:{type:[Number,String],default:void 0}},setup:function(e){var s=I(function(){if(!!e.maxWidth)return{"max-width":typeof e.maxWidth=="number"?"".concat(e.maxWidth,"px"):e.maxWidth,"overflow-x":"auto"}});return{style:s}},methods:{renderTitle:function(){var e,s,r=((e=(s=this.$slots).title)===null||e===void 0?void 0:e.call(s))||this.title;return r?t("div",{class:c.contextmenuGroupTitle},[r]):null}},render:function(){var e,s;return t("li",{class:c.contextmenuGroup},[this.renderTitle(),t("ul",{style:this.style,class:c.contextmenuGroupMenus},[(e=(s=this.$slots).default)===null||e===void 0?void 0:e.call(s)])])}});const De=w({name:"ExampleSimple",components:{[k.name]:k,[A.name]:A,[R.name]:R,[O.name]:O,[V.name]:V},directives:{contextmenu:J}}),re=n=>(W("data-v-488970a8"),n=n(),K(),n),we={class:"box"},Be=re(()=>B("h1",null,"\u57FA\u7840\u4F7F\u7528",-1)),Fe={class:"wrapper"},Ee=re(()=>B("code",null,"\u53F3\u952E\u70B9\u51FB\u6B64\u533A\u57DF",-1)),Se=[Ee],Me=a("\u7F16\u8F91"),Ie=a("\u5220\u9664"),ke=a("\u6545\u4E8B"),Ae=a("\u4F18\u79C0"),Re=a("\u67E5\u770B"),Oe=a("\u6E90\u7801\u6587\u6863"),Ve=a("\u8BF4\u660E\u6587\u6863"),Pe=a("\u501F\u9605");function je(n,e,s,r,l,v){const u=h("v-contextmenu-item"),m=h("v-contextmenu-divider"),x=h("v-contextmenu-submenu"),$=h("v-contextmenu"),d=Y("contextmenu");return D(),M("div",we,[Be,N((D(),M("div",Fe,Se)),[[d,void 0,"contextmenu"]]),t($,{ref:"contextmenu"},{default:o(()=>[t(u,null,{default:o(()=>[Me]),_:1}),t(u,null,{default:o(()=>[Ie]),_:1}),t(u,{disabled:""},{default:o(()=>[ke]),_:1}),t(u,null,{default:o(()=>[Ae]),_:1}),t(m),t(x,{title:"\u66F4\u591A\u64CD\u4F5C"},{default:o(()=>[t(u,null,{default:o(()=>[Re]),_:1}),t(x,{title:"\u6587\u6863"},{default:o(()=>[t(u,null,{default:o(()=>[Oe]),_:1}),t(u,null,{default:o(()=>[Ve]),_:1})]),_:1}),t(u,null,{default:o(()=>[Pe]),_:1})]),_:1}),t(m)]),_:1},512)])}var Te=H(De,[["render",je],["__scopeId","data-v-488970a8"]]);const Ge=w({name:"ExampleSFC",components:{[k.name]:k,[A.name]:A,[R.name]:R,[O.name]:O,[V.name]:V},directives:{contextmenu:J}}),Le=Ge,ie=n=>(W("data-v-31a865b6"),n=n(),K(),n),Ne={class:"box"},He=ie(()=>B("h1",null,"\u6309\u94AE\u7EC4",-1)),We={class:"wrapper"},Ke=ie(()=>B("code",null,"\u53F3\u952E\u70B9\u51FB\u6B64\u533A\u57DF",-1)),qe=[Ke],Ue=a("\u83DC\u5355"),Xe=a("vue3"),Ye=a("axios"),ze=a("vuex"),Je=a("router"),Qe=a("\u83DC\u53551"),Ze=a("\u83DC\u53552"),et=a("\u83DC\u53553");function tt(n,e,s,r,l,v){const u=h("v-contextmenu-item"),m=h("v-contextmenu-group"),x=h("v-contextmenu-divider"),$=h("v-contextmenu"),d=Y("contextmenu");return D(),M("div",Ne,[He,N((D(),M("div",We,qe)),[[d,void 0,"contextmenu"]]),t($,{ref:"contextmenu"},{default:o(()=>[t(u,null,{default:o(()=>[Ue]),_:1}),t(m,null,{default:o(()=>[t(u,null,{default:o(()=>[Xe]),_:1}),t(u,null,{default:o(()=>[Ye]),_:1}),t(u,{disabled:""},{default:o(()=>[ze]),_:1}),t(u,null,{default:o(()=>[Je]),_:1})]),_:1}),t(x),t(m,{title:"\u6309\u94AE\u7EC4"},{default:o(()=>[t(u,null,{default:o(()=>[Qe]),_:1}),t(u,null,{default:o(()=>[Ze]),_:1}),t(u,{disabled:""},{default:o(()=>[et]),_:1})]),_:1})]),_:1},512)])}var nt=H(Le,[["render",tt],["__scopeId","data-v-31a865b6"]]);const ut=w({name:"ExampleDynamic",components:{[k.name]:k,[A.name]:A,[R.name]:R,[O.name]:O,[V.name]:V},directives:{contextmenu:J},data(){return{extra:[]}},methods:{addItem(n="item"){this.extra.push(n)},removeItem(){this.extra.pop()}}}),ae=n=>(W("data-v-f4e7004e"),n=n(),K(),n),ot={class:"box"},st=ae(()=>B("h1",null,"\u52A8\u6001\u83DC\u5355",-1)),lt={class:"wrapper"},rt=ae(()=>B("code",null,"\u53F3\u952E\u70B9\u51FB\u6B64\u533A\u57DF",-1)),it=[rt],at=a("\u6DFB\u52A0\u83DC\u5355"),ct=a("\u6DFB\u52A0\u83DC\u5355\u7EC4"),dt=a("\u6DFB\u52A0\u5B50\u83DC\u5355"),mt=a("\u5220\u9664"),_t=a("\u83DC\u53551"),vt=a("\u83DC\u53552"),ft=a("\u83DC\u53553"),ht=a("\u83DC\u53551"),xt=a("\u83DC\u53552"),pt=a("\u83DC\u53553");function $t(n,e,s,r,l,v){const u=h("v-contextmenu-item"),m=h("v-contextmenu-group"),x=h("v-contextmenu-divider"),$=h("v-contextmenu-submenu"),d=h("v-contextmenu"),b=Y("contextmenu");return D(),M("div",ot,[st,N((D(),M("div",lt,it)),[[b,void 0,"contextmenu"]]),t(d,{ref:"contextmenu"},{default:o(()=>[t(m,{title:"\u64CD\u4F5C"},{default:o(()=>[t(u,{"hide-on-click":!1,onClick:e[0]||(e[0]=i=>n.extra.push("item"))},{default:o(()=>[at]),_:1}),t(u,{"hide-on-click":!1,onClick:e[1]||(e[1]=i=>n.extra.push("group"))},{default:o(()=>[ct]),_:1}),t(u,{"hide-on-click":!1,onClick:e[2]||(e[2]=i=>n.extra.push("submenu"))},{default:o(()=>[dt]),_:1}),t(u,{"hide-on-click":!1,onClick:e[3]||(e[3]=i=>n.extra.pop())},{default:o(()=>[mt]),_:1})]),_:1}),(D(!0),M(oe,null,pe(n.extra,(i,p)=>(D(),M(oe,{key:p},[t(x),i==="group"?(D(),z(m,{key:0,title:`\u83DC\u5355\u7EC4 ${p+1}`},{default:o(()=>[t(u,null,{default:o(()=>[_t]),_:1}),t(u,null,{default:o(()=>[vt]),_:1}),t(u,null,{default:o(()=>[ft]),_:1})]),_:2},1032,["title"])):i==="submenu"?(D(),z($,{key:1,title:`\u5B50\u83DC\u5355 ${p+1}`},{default:o(()=>[t(u,null,{default:o(()=>[ht]),_:1}),t(u,null,{default:o(()=>[xt]),_:1}),t(u,null,{default:o(()=>[pt]),_:1})]),_:2},1032,["title"])):(D(),z(u,{key:2},{default:o(()=>[a("\u83DC\u5355 "+$e(p+1),1)]),_:2},1024))],64))),128))]),_:1},512)])}var bt=H(ut,[["render",$t],["__scopeId","data-v-f4e7004e"]]);const gt=w({components:{basic:Te,menuGroup:nt,menuDynamic:bt},setup(){}}),ce=n=>(W("data-v-161ed4dd"),n=n(),K(),n),Ct={class:"layout-container"},yt={class:"flex-box"},Dt=ce(()=>B("p",{style:{"text-align":"left"}},"demo\u91C7\u7528\u63D2\u4EF6\uFF1Av-contextmenu",-1)),wt=ce(()=>B("p",null,[a("\u4F7F\u7528\u65B9\u6CD5\uFF1A"),B("a",{href:"https://github.com/heynext/v-contextmenu",target:"_blank"},"https://github.com/heynext/v-contextmenu")],-1));function Bt(n,e,s,r,l,v){const u=h("el-alert"),m=h("basic"),x=h("el-col"),$=h("menuGroup"),d=h("menuDynamic"),b=h("el-row");return D(),M("div",Ct,[B("div",yt,[t(u,{type:"success"},{default:o(()=>[Dt,wt]),_:1}),t(b,{gutter:24},{default:o(()=>[t(x,{xs:24,sm:8,md:8,lg:8,xl:8},{default:o(()=>[t(m)]),_:1}),t(x,{xs:24,sm:8,md:8,lg:8,xl:8},{default:o(()=>[t($)]),_:1}),t(x,{xs:24,sm:8,md:8,lg:8,xl:8},{default:o(()=>[t(d)]),_:1})]),_:1})])])}var Et=H(gt,[["render",Bt],["__scopeId","data-v-161ed4dd"]]);export{Et as default};
  