1 |
- import{a as R,r as g,aC as H,aB as B,aH as F,_ as j,q as U,W as V,aJ as q,w as z,aj as M,c as m,o as c,S as v,K as E,b as d,R as G,a9 as J,G as C,u as f,Q as $,t as K}from"./vue.YrNK8sx4.js";import{au as Q,u as W,e as i,av as X}from"./index.IRF5Ik0K.js";import{f as Y}from"./routeFilter.CCAbkObw.js";import{_ as Z}from"./_plugin-vue_export-helper.DlAUqK2U.js";const ee={class:"layout-columns-aside"},te=["onClick","onMouseenter","title"],se={class:"columns-vertical-title font12"},ne=["href"],oe={class:"columns-vertical-title font12"},le=R({name:"layoutColumnsAside"}),ie=R({...le,setup(ae){const _=g([]),A=g(),h=Q(),k=W(),{routesList:O,isColumnsMenuHover:b,isColumnsNavHover:x}=H(h),{themeConfig:a}=H(k),y=B(),S=F(),t=j({columnsAsideList:[],liIndex:0,liOldIndex:null,liHoverIndex:null,liOldPath:null,difference:0,routeSplit:[]}),L=e=>{t.liIndex=e,A.value.style.top=`${_.value[e].offsetTop+t.difference}px`},T=(e,o)=>{L(o);let{path:n,redirect:l}=e;l?S.push(l):S.push(n)},D=(e,o)=>{if(!a.value.isColumnsMenuHoverPreload)return!1;let{path:n}=e;t.liOldPath=n,t.liOldIndex=o,t.liHoverIndex=o,i.emit("setSendColumnsChildren",r(n)),h.setColumnsMenuHover(!1),h.setColumnsNavHover(!0)},P=async()=>{await h.setColumnsNavHover(!1),setTimeout(()=>{!b&&!x&&i.emit("restoreDefault")},100)},I=e=>{K(()=>{L(e)})},N=()=>{var o;t.columnsAsideList=Y(O.value);const e=r(y.path);if(Object.keys(e).length<=0)return!1;I((o=e.item)==null?void 0:o.k),i.emit("setSendColumnsChildren",e)},r=e=>{const o=e.split("/");let n={children:[]};return t.columnsAsideList.map((l,s)=>{l.path===`/${o[1]}`&&(l.k=s,n.item={...l},n.children=[{...l}],l.children&&(n.children=l.children))}),n},w=e=>{t.routeSplit=e.split("/"),t.routeSplit.shift();const o=`/${t.routeSplit[0]}`,n=t.columnsAsideList.find(l=>l.path===o);if(!n)return!1;setTimeout(()=>{I(n.k)},0)};return U(()=>{N(),i.on("restoreDefault",()=>{t.liOldIndex=null,t.liOldPath=null})}),V(()=>{i.off("restoreDefault",()=>{})}),q(e=>{w(e.path),i.emit("setSendColumnsChildren",r(e.path))}),z(X.state,e=>{if(e.themeConfig.themeConfig.columnsAsideStyle==="columnsRound"?t.difference=3:t.difference=0,!e.routesList.isColumnsMenuHover&&!e.routesList.isColumnsNavHover)t.liHoverIndex=null,i.emit("setSendColumnsChildren",r(y.path));else{if(t.liHoverIndex=t.liOldIndex,!t.liOldPath)return!1;i.emit("setSendColumnsChildren",r(t.liOldPath))}},{deep:!0}),(e,o)=>{const n=M("SvgIcon"),l=M("el-scrollbar");return c(),m("div",ee,[v(l,null,{default:E(()=>[d("ul",{onMouseleave:o[0]||(o[0]=s=>P())},[(c(!0),m(G,null,J(t.columnsAsideList,(s,u)=>(c(),m("li",{key:u,onClick:p=>T(s,u),onMouseenter:p=>D(s,u),ref_for:!0,ref:p=>{p&&(_.value[u]=p)},class:C({"layout-columns-active":t.liIndex===u,"layout-columns-hover":t.liHoverIndex===u}),title:e.$t(s.meta.title)},[!s.meta.isLink||s.meta.isLink&&s.meta.isIframe?(c(),m("div",{key:0,class:C(f(a).columnsAsideLayout)},[v(n,{name:s.meta.icon},null,8,["name"]),d("div",se,$(e.$t(s.meta.title)&&e.$t(s.meta.title).length>=4?e.$t(s.meta.title).substr(0,f(a).columnsAsideLayout==="columns-vertical"?4:3):e.$t(s.meta.title)),1)],2)):(c(),m("div",{key:1,class:C(f(a).columnsAsideLayout)},[d("a",{href:s.meta.isLink,target:"_blank"},[v(n,{name:s.meta.icon},null,8,["name"]),d("div",oe,$(e.$t(s.meta.title)&&e.$t(s.meta.title).length>=4?e.$t(s.meta.title).substr(0,f(a).columnsAsideLayout==="columns-vertical"?4:3):e.$t(s.meta.title)),1)],8,ne)],2))],42,te))),128)),d("div",{ref_key:"columnsAsideActiveRef",ref:A,class:C(f(a).columnsAsideStyle)},null,2)],32)]),_:1})])}}}),de=Z(ie,[["__scopeId","data-v-b7b31976"]]);export{de as default};
|