You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
5.2 KiB

var C=(e,r,l)=>new Promise((s,h)=>{var y=i=>{try{m(l.next(i))}catch(u){h(u)}},M=i=>{try{m(l.throw(i))}catch(u){h(u)}},m=i=>i.done?s(i.value):Promise.resolve(i.value).then(y,M);m((l=l.apply(e,r)).next())});import{d as ce,bQ as pe,d8 as de,bY as me,dr as fe,r as f,m as ge,c7 as he,aC as Me,d6 as Se,cd as Ce,f as p,u as t,eE as ve,eF as ye,P as $e,ch as V,O as Ie,eG as ke,cf as _e,ci as E,e as Te,aT as we,aU as v,ds as xe,o as w,g as x,j as d,x as a,a9 as O,s as A,aP as j,b as g,w as Q,F as U,bt as De,t as Y,v as q}from"./index-f4658ae7.js";import We from"./SimpleMenu-89e7c4ba.js";import Be from"./SimpleMenuTag-5adc79e1.js";import{useDragLine as Le}from"./useLayoutSider-669e7ecd.js";import Fe from"./index-a9188ff1.js";import"./Menu-92f46a5c.js";import"./useSimpleMenuContext-8e83f8e2.js";import"./SimpleSubMenu-85d1d86e.js";import"./MenuItem-d816c82b.js";import"./useMenu-0528c2f2.js";import"./SubMenuItem-aaf71495.js";import"./useOpenKeys-63d6d809.js";import"./SimpleMenuTag.vue_vue_type_script_lang-a44ed489.js";import"./HeaderTrigger-805c863b.js";import"./MenuUnfoldOutlined-9166492e.js";const Pe=ce({name:"LayoutMixSider",components:{ScrollContainer:pe,AppLogo:de,SimpleMenu:We,Icon:me,LayoutTrigger:Fe,SimpleMenuTag:Be},directives:{clickOutside:fe},setup(){let e=f([]);const r=f(""),l=f([]),s=f(!1),h=f(null),y=f(null),M=f(null),{prefixCls:m}=ge("layout-mix-sider"),i=he(),{t:u}=Te(),{getMenuWidth:D,getCanDrag:W,getCloseMixSidebarOnChange:B,getMenuTheme:c,getMixSideTrigger:k,getRealWidth:J,getMixSideFixed:_,mixSideHasChildren:z,setMenuSetting:K,getIsMixSidebar:X,getCollapsed:L}=Me(),{title:Z}=Se(),H=Ce();Le(y,h,!0);const ee=p(()=>({width:t(s)?`${t(D)}px`:0,left:`${t(P)}px`})),F=p(()=>{z.value=t(l).length>0;const n=t(_)&&t(z);return n&&(s.value=!0),n}),P=p(()=>t(L)?ve:ye),ne=p(()=>{const n=t(F)?t(J):0,o=`${t(P)+n}px`;return N(o)}),te=p(()=>{const n=`${t(P)}px`;return N(n)}),se=p(()=>t(_)?{}:{onMouseleave:()=>{T(!0),$()}}),ie=p(()=>t(W));$e(()=>C(this,null,function*(){e.value=yield V()})),Ie([()=>H.getLastBuildMenuTime,()=>H.getBackMenuList],()=>C(this,null,function*(){e.value=yield V()}),{immediate:!0}),ke(n=>{M.value=n,T(!0),t(B)&&$()});function N(n){return{width:n,maxWidth:n,minWidth:n,flex:`0 0 ${n}`}}function R(n,o=!1){return C(this,null,function*(){const S=yield E(n);if(t(r)===n?(o?t(s)||(s.value=!0):t(s)?$():s.value=!0,t(s)||T()):(s.value=!0,r.value=n),!S||S.length===0){o||i(n),l.value=[],$();return}l.value=S})}function T(n=!1){return C(this,null,function*(){var S;const o=(S=M.value)==null?void 0:S.path;if(o&&(r.value=yield _e(o),t(X))){const b=t(e).find(I=>I.path===t(r)),G=b==null?void 0:b.path;if(G){const I=yield E(G);n&&(l.value=I,t(_)&&(s.value=I.length>0)),I.length===0&&(l.value=[])}}})}function le(n){i(n)}function oe(){T(!0),$()}function ae(n){return t(k)==="hover"?{onMouseenter:()=>R(n.path,!0),onClick:()=>C(this,null,function*(){const o=yield E(n.path);n.path&&(!o||o.length===0)&&i(n.path)})}:{onClick:()=>R(n.path)}}function re(){K({mixSideFixed:!t(F)})}function $(){t(F)||(s.value=!1)}const ue=p(()=>({fontSize:L?"16px":"20px"}));return{t:u,prefixCls:m,menuModules:e,handleModuleClick:R,activePath:r,childrenMenus:l,getShowDragBar:ie,handleMenuClick:le,getMenuStyle:ee,handleClickOutside:oe,sideRef:y,dragBarRef:h,title:Z,openMenu:s,getMenuTheme:c,getItemEvents:ae,getMenuEvents:se,getDomStyle:ne,handleFixedMenu:re,getMixSideFixed:_,getWrapStyle:te,getCollapsed:L,mixSideIconStyle:ue}}});const Re={class:"text"};function be(e,r,l,s,h,y){const M=v("AppLogo"),m=v("LayoutTrigger"),i=v("SimpleMenuTag"),u=v("ScrollContainer"),D=v("Icon"),W=v("SimpleMenu"),B=xe("click-outside");return w(),x(U,null,[d("div",{class:a(`${e.prefixCls}-dom`),style:O(e.getDomStyle)},null,6),A((w(),x("div",j({style:e.getWrapStyle,class:[e.prefixCls,e.getMenuTheme,{open:e.openMenu,mini:e.getCollapsed}]},e.getMenuEvents),[g(M,{showTitle:!1,class:a(`${e.prefixCls}-logo`)},null,8,["class"]),g(m,{class:a(`${e.prefixCls}-trigger`)},null,8,["class"]),g(u,null,{default:Q(()=>[d("ul",{class:a(`${e.prefixCls}-module`)},[(w(!0),x(U,null,De(e.menuModules,c=>{var k;return w(),x("li",j({class:[`${e.prefixCls}-module__item `,{[`${e.prefixCls}-module__item--active`]:c.path===e.activePath}]},e.getItemEvents(c),{key:c.path}),[g(i,{item:c,collapseParent:"",dot:""},null,8,["item"]),d("i",{class:a([(k=c.meta)==null?void 0:k.Icon,`${e.prefixCls}-module__icon`]),style:O(e.mixSideIconStyle)},null,6),d("p",{class:a(`${e.prefixCls}-module__name`)},Y(e.t(c.name)),3)],16)}),128))],2)]),_:1}),d("div",{class:a(`${e.prefixCls}-menu-list`),ref:"sideRef",style:O(e.getMenuStyle)},[A(d("div",{class:a([`${e.prefixCls}-menu-list__title`,{show:e.openMenu}])},[d("span",Re,Y(e.title),1),g(D,{size:16,icon:e.getMixSideFixed?"ri:pushpin-2-fill":"ri:pushpin-2-line",class:"pushpin",onClick:e.handleFixedMenu},null,8,["icon","onClick"])],2),[[q,e.openMenu]]),g(u,{class:a(`${e.prefixCls}-menu-list__content`)},{default:Q(()=>[g(W,{items:e.childrenMenus,theme:e.getMenuTheme,mixSider:"",onMenuClick:e.handleMenuClick},null,8,["items","theme","onMenuClick"])]),_:1},8,["class"]),A(d("div",{class:a(`${e.prefixCls}-drag-bar`),ref:"dragBarRef"},null,2),[[q,e.getShowDragBar&&e.openMenu]])],6)],16)),[[B,e.handleClickOutside]])],64)}const Ze=we(Pe,[["render",be]]);export{Ze as default};