"use strict";const e=require("vue"),o=require("../Shared/base-iCmnU-fv.js"),A={key:0,class:"sideNav-menu-iconOperate"},B=e.defineComponent({name:"ClSidemenuMenu",__name:"Menu",props:{activeId:{type:String,default:""},activePId:{type:Array,default:()=>[]},openId:{type:Array,default:()=>[]},list:{type:Array,default:()=>[]}},emits:["onClick"],setup(s,{emit:p}){const u=p,k=e.reactive({keyIndex:`DhhReportAnalysis-${o.CommonBase.getRandom(8)}`}),n=a=>{u("onClick",a)};return(a,h)=>{const d=e.resolveComponent("cl-link"),r=e.resolveComponent("cl-sidemenu-menu"),C=e.resolveComponent("cl-transition-slideupdown");return e.openBlock(),e.createElementBlock("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.list,t=>(e.openBlock(),e.createElementBlock("li",{key:`${k.keyIndex}-${t.id}`,class:e.normalizeClass({"sideNav-menu-submenu":t.list&&t.list.length>0,"sideNav-menu-active":!(t.list&&t.list.length>0)&&s.activeId===t.id,"sideNav-menu-parent-active":t.list&&t.list.length>0&&s.activePId.includes(t.id)})},[e.createVNode(d,{isWaves:!0,onOnClick:g=>n(t)},{default:e.withCtx(()=>[t.list&&t.list.length>0?(e.openBlock(),e.createElementBlock("span",A,[e.createElementVNode("i",{class:e.normalizeClass({clIconFont:!0,"clIcon-caret-right":!0,"icon-rotate":!0,"rotate-90":s.openId.includes(t.id)})},null,2)])):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(t.name),1)]),_:2},1032,["onOnClick"]),t.list&&t.list.length>0?(e.openBlock(),e.createBlock(C,{key:0},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(r,{activeId:s.activeId,activePId:s.activePId,openId:s.openId,list:t.list,onOnClick:n},null,8,["activeId","activePId","openId","list"]),[[e.vShow,s.openId.includes(t.id)]])]),_:2},1024)):e.createCommentVNode("",!0)],2))),128))])}}}),P={key:0,class:"panel-sideNav"},O={class:"sideNav-wrapper sideNav-wrapper-rowMult"},I=e.defineComponent({name:"ClSidemenu",__name:"Index",props:{active:String,list:{type:Array,required:!0,default:()=>[]}},emits:["onChangeMenu"],setup(s,{emit:p}){const u=s,k=p,n=e.reactive({keyIndex:`SideMenu-${o.CommonBase.getRandom(8)}`,isMenushrink:!1,menuActive:u.active,menuActiveParent:[],menuOpenPid:[]}),a=e.ref([]),h={menuJson:{}},d=i=>{k("onChangeMenu",i)},r=()=>{const i=o.CommonBase.getTreeLastParent(n.menuActive,h.menuJson,!1);let c=[];i.length>0&&(c=i.map(l=>l.id)),n.menuActiveParent=c},C=()=>{const i=u.list,c=[],l={};i.forEach(v=>{const{id:_,name:M}=v;l[v.id]={id:_,name:M,parentId:"0"},v.list&&(c.push(_),v.list.forEach(N=>{N.parentId=_,l[N.id]=N}))});const m=o.CommonBase.isEmpty(n.menuActive)?i[0].id:n.menuActive;h.menuJson=l,a.value=i,n.menuActive=m,n.menuOpenPid=c,r()},t=()=>{C(),e.nextTick(()=>{d(n.menuActive)})};e.onMounted(()=>{e.nextTick(()=>{t()})});const g=()=>{n.isMenushrink=!n.isMenushrink},y=i=>{const c=i.id;if(o.CommonBase.isUndefined(i.list))n.menuActive=c,r(),d(n.menuActive);else{const{menuOpenPid:l}=n,m=l.indexOf(c);m>-1?n.menuOpenPid.splice(m,1):n.menuOpenPid.push(c)}};return(i,c)=>{const l=e.resolveComponent("cl-link");return n.menuActive.length>0?(e.openBlock(),e.createElementBlock("div",P,[e.createElementVNode("div",{class:e.normalizeClass({"sideNav-menu":!0,"sideNav-minify":!0,"sideNav-minify-shrink":n.isMenushrink})},[e.createVNode(l,{className:"sideNav-menu-minify",onOnClick:g},{default:e.withCtx(()=>[e.createElementVNode("i",{class:e.normalizeClass({clIconFont:!0,"clIcon-angle-double-left":!n.isMenushrink,"clIcon-angle-double-right":n.isMenushrink})},null,2)]),_:1}),e.createVNode(B,{list:a.value,activeId:n.menuActive,activePId:n.menuActiveParent,openId:n.menuOpenPid,onOnClick:y},null,8,["list","activeId","activePId","openId"])],2),e.createElementVNode("div",O,[e.renderSlot(i.$slots,"default")])])):e.createCommentVNode("",!0)}}});module.exports=I;
//# sourceMappingURL=ClSidemenu.cjs.map
