@chewel611/naive-ui-plus 0.0.45 → 0.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +546 -544
- package/dist/index.umd.cjs +1 -1
- package/es/layout/sider/PMenus.vue.js +47 -45
- package/lib/layout/sider/PMenus.vue.cjs +1 -1
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(w,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("naive-ui"),require("vue"),require("@vicons/antd"),require("pinia"),require("vue-router"),require("element-resize-detector"),require("vuedraggable")):typeof define=="function"&&define.amd?define(["exports","naive-ui","vue","@vicons/antd","pinia","vue-router","element-resize-detector","vuedraggable"],n):(w=typeof globalThis<"u"?globalThis:w||self,n(w.naiveplus={},w.naiveUi,w.Vue,w.antd,w.pinia,w.vueRouter,w.elementResizeDetectorMaker,w.Draggable))})(this,(function(w,n,e,E,Y,I,he,_e){"use strict";const ye={class:"text-lg font-medium"},be={id:"data-content"},ke={key:0,class:"rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-4 mb-4"},we=e.defineComponent({__name:"PTable",props:{title:{},idField:{default:"id"},columns:{},onLoad:{},onDelete:{},onAdd:{},onEdit:{}},setup(t,{expose:r}){const l=e.ref(null),p=n.useDialog(),m=n.useMessage(),d=e.ref(!1),_=e.ref([]),i=e.ref([]),P=e.ref({page:1,itemCount:0,pageSize:10,pageSizes:[10,20,30,50],showSizePicker:!0,onChange:async b=>{P.value.page=b,await S()},onUpdatePageSize:async b=>{P.value.pageSize=b,await S()}}),y=t,c=b=>{const k=C=>{const L=[];return b&&b.forEach(O=>{O.key!=="edit"&&O.key!=="delete"&&L.push({label:O.name,key:O.key,icon:O.icon&&(()=>e.h(n.NIcon,null,{default:()=>e.h(O.icon)})),props:{onClick:()=>O.action(C)}})}),L};return{title:"操作",key:"actions",width:100,fixed:"right",render:C=>{let L=[];if(y.onEdit&&L.push({label:"编辑",key:"edit",icon:()=>e.h(n.NIcon,null,{default:()=>e.h(E.EditOutlined)}),props:{onClick:async()=>await y.onEdit(C)}}),y.onDelete&&L.push({label:"删除",key:"delete",icon:()=>e.h(n.NIcon,null,{default:()=>e.h(E.DeleteOutlined)}),props:{onClick:()=>B(C)}}),L=[...L,...k(C)],!(L.length<=0))return e.h(n.NDropdown,{options:L,placement:"bottom-start"},{default:()=>e.h(n.NButton,{size:"small",type:"primary"},{default:()=>["操作",e.h(n.NIcon,()=>e.h(E.MoreOutlined))]})})}}},V=e.computed(()=>{const b=y.columns.filter(C=>C.key!="action").map(C=>({title:C.title,key:C.key,width:C.width,fixed:C.fixed??!1,render:C.render,ellipsis:C.ellipsis?{tooltip:!0}:!1})),k=y.columns.reduce((C,L)=>L.key==="action"?L:C,void 0)?.action;return k&&k?.length>0||y.onEdit||y.onDelete?[{type:"selection",fixed:"left"},...b,c(k)]:[{type:"selection",fixed:"left"},...b]}),a=async()=>await S(),B=b=>x([b]),$=()=>{const b=s();x(b)},x=b=>{b&&b.length>0&&p.warning({title:"警告",content:"删除数据不可恢复, 确认删除吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(y.onDelete)try{await y.onDelete(b)?(S(),m.success("删除成功")):m.error("删除失败")}catch(k){m.error(k.message)}}})},s=()=>_.value?i.value.filter(k=>_.value.includes(k.id)).map(k=>e.toRaw(k)):[],u=()=>s()[0],N=()=>e.toRaw(i.value),S=async()=>{if(!d.value){d.value=!0;try{if(y.onLoad){var{items:b,totalCount:k}=await y.onLoad(P.value.page,P.value.pageSize);i.value=b,P.value.itemCount=k}}catch(C){m.error(C.message)}finally{d.value=!1}}},g=e.computed(()=>{const b=e.unref(l);if(!b)return;const k=b?.$el,C=k.querySelector(".n-data-table-thead "),{bottomIncludeBody:L}=F(C),O=48;let R=12,W=25;const A=k.querySelector(".n-data-table__pagination");if(A){const z=A.offsetHeight;R+=z||0}else R+=28;return L-(O+R+W)}),H=b=>!b||!b.getBoundingClientRect?0:b.getBoundingClientRect(),F=b=>{const k=document.documentElement,C=k.scrollLeft,L=k.scrollTop,O=k.clientLeft,R=k.clientTop,W=window.pageXOffset,A=window.pageYOffset,K=H(b),{left:z,top:X,width:J,height:o}=K,f=(W||C)-(O||0),h=(A||L)-(R||0),T=z+W,q=X+A,Z=T-f,G=q-h,ue=window.document.documentElement.clientWidth,ge=window.document.documentElement.clientHeight;return{left:Z,top:G,right:ue-J-Z,bottom:ge-o-G,rightIncludeBody:ue-Z,bottomIncludeBody:ge-G}};return e.onMounted(async()=>await S()),r({getData:N,getSelectedRow:u,getSelectedRows:s,refreshData:S,resetPage:()=>{P.value.page=1}}),(b,k)=>{const C=n.NTooltip,L=n.NSpace,O=n.NDataTable;return e.openBlock(),e.createBlock(e.unref(n.NCard),{bordered:!1},{header:e.withCtx(()=>[e.createVNode(L,{justify:"space-between",align:"center",class:"w-full"},{default:e.withCtx(()=>[e.createElementVNode("span",ye,e.toDisplayString(t.title),1),e.createVNode(L,null,{default:e.withCtx(()=>[y.onAdd?(e.openBlock(),e.createBlock(C,{key:0,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(n.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:y.onAdd},{default:e.withCtx(()=>[e.createVNode(e.unref(E.PlusSquareOutlined))]),_:1},8,["onClick"])]),default:e.withCtx(()=>[k[1]||(k[1]=e.createElementVNode("span",null,"新增",-1))]),_:1})):e.createCommentVNode("",!0),y.onDelete?(e.openBlock(),e.createBlock(C,{key:1,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(n.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:$},{default:e.withCtx(()=>[e.createVNode(e.unref(E.DeleteOutlined))]),_:1})]),default:e.withCtx(()=>[k[2]||(k[2]=e.createElementVNode("span",null,"删除",-1))]),_:1})):e.createCommentVNode("",!0),e.createVNode(C,{trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(n.NIcon),{size:"18",class:"cursor-pointer hover:text-blue-600",onClick:a},{default:e.withCtx(()=>[e.createVNode(e.unref(E.ReloadOutlined))]),_:1})]),default:e.withCtx(()=>[k[3]||(k[3]=e.createElementVNode("span",null,"刷新",-1))]),_:1})]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",be,[b.$slots.toolbar?(e.openBlock(),e.createElementBlock("div",ke,[e.renderSlot(b.$slots,"toolbar")])):e.createCommentVNode("",!0),e.createVNode(O,{remote:"",ref_key:"$table",ref:l,"checked-row-keys":_.value,"onUpdate:checkedRowKeys":k[0]||(k[0]=R=>_.value=R),"max-height":g.value,loading:d.value,bordered:!1,"single-line":!1,columns:V.value,data:i.value,pagination:P.value,"row-key":R=>R[t.idField]},null,8,["checked-row-keys","max-height","loading","columns","data","pagination","row-key"])])]),_:3})}}}),D=t=>{const r=t;return r.install=function(l){l.component(r.__name,t)},t},Q=D(we),Ce=["Redirect","RedirectSon","login"],j=Y.defineStore("p-layout",()=>{const t=e.reactive({collapsed:!1,title:"输入项目名称",logo:"https://picsum.photos/id/1/100/100",avatar:"",uid:"",uname:"",tabs:[],cacheTabs:!1,enableLanguage:!1});return{state:t,initTabs:s=>{s.sort((u,N)=>u.meta.affix&&!N.meta.affix?-1:!u.meta.affix&&N.meta.affix?1:Number(N.meta.sort??0)-Number(u.meta.sort??0)),t.tabs=s},addTab:s=>Ce.includes(s.name)?!1:(t.tabs?.some(N=>N.fullPath==s.fullPath)||t.tabs?.push(s),!0),getCurrentTab:()=>{const s=I.useRoute();return t.tabs.find(u=>u.fullPath==s.fullPath)},closeCurrentTab:s=>{const u=t.tabs.findIndex(N=>N.fullPath==s.fullPath);t.tabs.splice(u,1)},closeAllTabs:()=>{t.tabs=t.tabs.filter(s=>s?.meta?.affix??!1)},closeOtherTabs:s=>{t.tabs=t.tabs.filter(u=>u.fullPath==s.fullPath||(u?.meta?.affix??!1))},closeLeftTabs:s=>{const u=t.tabs.findIndex(N=>N.fullPath==s.fullPath);t.tabs=t.tabs.filter((N,S)=>S>=u||(N?.meta?.affix??!1))},closeRightTabs:s=>{const u=t.tabs.findIndex(N=>N.fullPath==s.fullPath);t.tabs=t.tabs.filter((N,S)=>S<=u||(N?.meta?.affix??!1))},collapse:()=>{t.collapsed=!t.collapsed},setTitle:s=>{t.title=s},setLogo:s=>{t.logo=s},setUser:(s,u)=>{t.uid=s,t.uname=u},setSettingPages:s=>{t.settingPages=s},setLogout:s=>{t.logout=s},enableLanguage:s=>{t.enableLanguage=s}}}),Ne={class:"logo"},xe=e.defineComponent({__name:"PLogo",setup(t){const r=j();return(l,p)=>(e.openBlock(),e.createElementBlock("div",Ne,[e.createVNode(e.unref(n.NAvatar),{color:"var(--color-logo)",size:32,src:e.unref(r).state.logo,class:e.normalizeClass({"mr-2":!e.unref(r).state.collapsed})},null,8,["src","class"]),e.withDirectives(e.createElementVNode("h1",{class:"font-bold ease-in-out ml-2 logo-size"},e.toDisplayString(e.unref(r).state.title),513),[[e.vShow,!e.unref(r).state.collapsed]])]))}}),M=(t,r)=>{const l=t.__vccOpts||t;for(const[p,m]of r)l[p]=m;return l},Pe=M(xe,[["__scopeId","data-v-e48aeefa"]]),Ve={translationApiUrl:"https://translate.zvo.cn/api",defaultLanguage:"chinese",currentLanguage:"",options:[],initLanguages:async()=>[],selectLanguage:async t=>{}},U=Y.defineStore("language",()=>{const t=e.ref(Ve),r=async()=>(t.value.options.length===0&&(t.value.options=await t.value.initLanguages()),t.value.options);return{select:async c=>{if(t.value.currentLanguage===c)return;const V=(await r()).find(a=>a.key===c);V&&(t.value.currentLanguage=V.key,t.value.selectLanguage(V))},selectLanguageCallback:async c=>{t.value.selectLanguage=c},initLanguagesCallback:async c=>{t.value.initLanguages=c},getLanguages:r,getCurrentLanguage:async()=>{if(t.value.currentLanguage)return(await r()).find(c=>c.key===t.value.currentLanguage)},setTranslationApiUrl:c=>{t.value.translationApiUrl=c},getTranslationApiUrl:()=>t.value.translationApiUrl,getDefaultLanguage:()=>t.value.defaultLanguage?t.value.defaultLanguage:"chinese_simplified",setDefaultLanguage:c=>{(c==="Chinese"||c==="chinese")&&(c="chinese_simplified"),t.value.defaultLanguage=c}}}),Be={key:1},v=e.defineComponent({__name:"PLanguage",setup(t){const{select:r,getLanguages:l,getCurrentLanguage:p,getDefaultLanguage:m,getTranslationApiUrl:d}=U(),_=e.ref(),i=e.ref([]),P=async c=>await r(c),y=async()=>{const c=window.translate;c&&(c.selectLanguageTag.show=!1,c.selectLanguageTag.languages=(await l()).map(V=>V.key).join(","),c.ignore.class.push("ignore-translate-flag"),c.ignore.id.push("ignore-translation"),c.language.setLocal(m()),c.request.api.translate="api/v1/translation",c.request.api.connectTest="api/v1/translation/connect-test",c.request.api.init="api/v1/translation/init",c.request.api.language="api/v1/translation/language",c.request.setHost(d()),c.request.listener.start(),c.listener.start(),c.whole.enableAll(),c.execute())};return e.onMounted(async()=>{await e.nextTick(),await y(),_.value=await p(),i.value=await l()}),(c,V)=>{const a=n.NIcon,B=n.NButton;return i.value.length>0?(e.openBlock(),e.createBlock(e.unref(n.NDropdown),{key:0,id:"ignore-translation",placement:"bottom-start",trigger:"hover",class:"flex flex-col justify-center h-full ignore",onSelect:P,options:i.value},{default:e.withCtx(()=>[e.createVNode(B,{quaternary:"",type:"info"},{default:e.withCtx(()=>[_.value?(e.openBlock(),e.createElementBlock("label",Be,e.toDisplayString(_.value?.label),1)):(e.openBlock(),e.createBlock(a,{key:0,size:"18"},{default:e.withCtx(()=>[...V[0]||(V[0]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},[e.createElementVNode("path",{d:"M478.33 433.6l-90-218a22 22 0 0 0-40.67 0l-90 218a22 22 0 1 0 40.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 0 0 458 464a22 22 0 0 0 20.32-30.4zM334.83 362L368 281.65L401.17 362z",fill:"currentColor"}),e.createElementVNode("path",{d:"M267.84 342.92a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73c39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 0 0 0-44H214V70a22 22 0 0 0-44 0v20H54a22 22 0 0 0 0 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36c-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 0 0-40.58 17c.58 1.38 14.55 34.23 52.86 83.93c.92 1.19 1.83 2.35 2.74 3.51c-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1 0 21.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59c22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z",fill:"currentColor"})],-1)])]),_:1}))]),_:1})]),_:1},8,["options"])):e.createCommentVNode("",!0)}}}),Se={class:"layout-header"},Le={class:"layout-header-left"},Ee={class:"link-text"},Te={key:1,class:"link-text"},$e={class:"layout-header-right"},Oe={key:0,class:"layout-header-trigger-min"},De={class:"layout-header-trigger layout-header-trigger-min"},Ie={class:"layout-header-trigger layout-header-trigger-min"},Re={class:"avatar"},Me=M(e.defineComponent({__name:"PHeader",setup(t){const r=n.useMessage(),l=n.useDialog(),p=j(),m=I.useRouter(),d=I.useRoute(),_=e.inject("reloadPage"),i=x=>m.push({name:x}),P=e.computed(()=>y(d.matched)),y=x=>x.map(s=>{const u={key:s.name,label:s.meta.title,icon:s.meta.icon,meta:s.meta,disabled:s.path==="/",children:void 0};return s.children&&s.children.length>0&&(u.children=y(s.children)),u}),c=e.ref(!1),V=()=>{document.fullscreenElement?document.exitFullscreen&&(document.exitFullscreen(),c.value=!1):(document.documentElement.requestFullscreen(),c.value=!0)},a=e.computed(()=>{const x=[];return x.push({label:"退出登录",key:"logout"}),p.state.settingPages&&p.state.settingPages.length>0&&p.state.settingPages.forEach(s=>{x.push({label:s.title,key:s.route})}),x}),B=x=>{x==="logout"?$():m.push({name:x})},$=()=>{l.info({title:"提示",content:"您确定要退出登录吗",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(p.state.logout)try{await p.state.logout(),localStorage.removeItem("TABS-ROUTES"),r.error("退出成功")}catch(x){console.error(x),r.error("退出登录失败")}finally{location.reload()}else r.error("没有配置登出接口, 请配置[usePLayoutStore.logout]方法")},onNegativeClick:()=>{}})};return(x,s)=>{const u=n.NTooltip,N=n.NDivider,S=n.NAvatar;return e.openBlock(),e.createElementBlock("div",Se,[e.createElementVNode("div",Le,[e.createElementVNode("div",{class:"ml-1 layout-header-trigger layout-header-trigger-min",onClick:s[0]||(s[0]=(...g)=>e.unref(p).collapse&&e.unref(p).collapse(...g))},[e.unref(p).state.collapsed?(e.openBlock(),e.createBlock(e.unref(n.NIcon),{key:0,size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.MenuUnfoldOutlined))]),_:1})):(e.openBlock(),e.createBlock(e.unref(n.NIcon),{key:1,size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.MenuFoldOutlined))]),_:1}))]),e.createElementVNode("div",{class:"mr-1 layout-header-trigger layout-header-trigger-min",onClick:s[1]||(s[1]=(...g)=>e.unref(_)&&e.unref(_)(...g))},[e.createVNode(e.unref(n.NIcon),{size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.ReloadOutlined))]),_:1})]),e.createVNode(e.unref(n.NBreadcrumb),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(P.value,g=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g.label},[g.label?(e.openBlock(),e.createBlock(e.unref(n.NBreadcrumbItem),{key:0},{default:e.withCtx(()=>[g.children&&g.children.length?(e.openBlock(),e.createBlock(e.unref(n.NDropdown),{key:0,options:g.children,onSelect:i},{default:e.withCtx(()=>[e.createElementVNode("span",Ee,[g.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(g.label),1)])]),_:2},1032,["options"])):(e.openBlock(),e.createElementBlock("span",Te,[g.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(g.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(g.label),1)]))]),_:2},1024)):e.createCommentVNode("",!0)],64))),128))]),_:1})]),e.createElementVNode("div",$e,[e.unref(p).state.enableLanguage?(e.openBlock(),e.createElementBlock("div",Oe,[e.createVNode(v)])):e.createCommentVNode("",!0),e.createElementVNode("div",De,[e.createVNode(u,{placement:"bottom"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(n.NIcon),{size:"18",onClick:e.withModifiers(V,["stop"])},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createBlock(e.unref(E.FullscreenExitOutlined),{key:1})):(e.openBlock(),e.createBlock(e.unref(E.FullscreenOutlined),{key:0}))]),_:1})]),default:e.withCtx(()=>[s[2]||(s[2]=e.createElementVNode("span",null,"全屏",-1))]),_:1})]),e.createElementVNode("div",Ie,[e.createVNode(e.unref(n.NDropdown),{trigger:"hover",onSelect:B,options:a.value},{default:e.withCtx(()=>[e.createElementVNode("div",Re,[e.createElementVNode("span",null,e.toDisplayString(e.unref(p).state.uname),1),e.createVNode(N,{vertical:""}),e.createVNode(S,{round:"",src:e.unref(p).state.avatar},null,8,["src"])])]),_:1},8,["options"])])])])}}}),[["__scopeId","data-v-563e4e55"]]),Ae={class:"mt-1"},ze=e.defineComponent({__name:"PContent",props:{loading:{type:Boolean,default:!1}},setup(t){return(r,l)=>{const p=e.resolveComponent("RouterView");return e.openBlock(),e.createElementBlock("div",Ae,[t.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(p,{key:0},{default:e.withCtx(({Component:m,route:d})=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m),{key:d.fullPath}))],1024))]),_:1}))])}}}),qe={class:"tabs-view-main"},je=["id","onClick","onContextmenu"],He={class:"tabs-close"},We={class:"tabs-close-btn"},Fe=M(e.defineComponent({__name:"PTabs",setup(t){e.useCssVars(o=>({v4f917f8c:l.value,v1c2fb72a:p.value}));const r=n.useThemeVars(),l=e.computed(()=>r.value.cardColor),p=e.computed(()=>r.value.textColor1),m=n.useMessage(),d=I.useRoute(),_=I.useRouter(),i=e.ref(null),P=e.ref(null),y=e.ref(!1),c=j(),V=e.computed(()=>c.state.tabs),a=e.reactive({activeKey:d.fullPath,scrollable:!0,dropdownX:0,dropdownY:0,showDropdown:!1,isMultiHeaderFixed:!0,multiTabsSetting:!0}),B=["Login","Redirect","ErrorPage"],$=o=>({meta:o.meta,name:o.name,fullPath:o.fullPath??o.path,path:o.path,hash:o.hash??"",query:o.query??{},params:o.params??{}}),x=e.computed(()=>{const h=c.state.collapsed?"64px":"272px";return{left:h,width:`calc(100% - ${h})`}}),s=e.computed(()=>{const o=V.value.length<=1;return[{label:"刷新当前",key:"1",icon:()=>e.h(n.NIcon,null,{default:()=>e.h(E.ReloadOutlined)})},{label:"关闭当前",key:"2",disabled:y.value||o,icon:()=>e.h(n.NIcon,null,{default:()=>e.h(E.CloseOutlined)})},{label:"关闭其他",key:"3",disabled:o,icon:()=>e.h(n.NIcon,null,{default:()=>e.h(E.ColumnWidthOutlined)})},{label:"关闭全部",key:"4",disabled:o,icon:()=>e.h(n.NIcon,null,{default:()=>e.h(E.MinusOutlined)})}]}),u=()=>{let o=[$(d)];_.getRoutes().filter(f=>f.meta.affix).forEach(f=>{const h=$(f);o.every(T=>T.name!==h.name)&&o.push(h)});try{if(c.state.cacheTabs){const f=localStorage.getItem("TABS_ROUTES");o=f?JSON.parse(f):o}}finally{return o}},N=o=>{const f=_.getRoutes();o.forEach(h=>{const T=f.find(q=>q.path===h.path);T&&(h.meta=T.meta||h.meta,h.name=T.name||h.name)}),c.state.cacheTabs&&localStorage.setItem("TABS_ROUTES",JSON.stringify(o))},S=()=>{const o=u();N(o),c.initTabs(o)},g=async o=>{if(await e.nextTick(),!i.value)return;const f=i.value.offsetWidth,h=i.value.scrollWidth;f<h?(a.scrollable=!0,o&&[...i.value.querySelectorAll(".tabs-card-scroll-item")||[]].forEach(q=>{q.id===`tag${a.activeKey.split("/").join("/")}`&&q.scrollIntoView&&q.scrollIntoView()})):a.scrollable=!1},H=o=>!(o.draggedContext.element.meta.affix||o.relatedContext.element.meta.affix),F=()=>{let o;o=he(),o.listenTo(P.value,()=>g(!0))},b=o=>{if(!o||o.fullPath===d.fullPath)return;if(a.activeKey=o.fullPath,toString.call(o)==="[object String]"){_.replace(o).catch(console.error);return}const f=o;_.replace(f).catch(console.error)},k=(o,f)=>{o.preventDefault(),y.value=f.path==="/home",a.showDropdown=!1,e.nextTick().then(()=>{a.showDropdown=!0,a.dropdownX=o.clientX,a.dropdownY=o.clientY})},C=()=>{if(d.meta.keepAlive){var o=_.currentRoute.value.matched.find(f=>f.name==d.name);o&&o.components?.default?.name}},L=o=>{if(V.value.length===1)return m.warning("这已经是最后一页,不能再关闭了!");if(C(),c.closeCurrentTab(o),a.activeKey===o.fullPath){const f=V.value[Math.max(0,V.value.length-1)];a.activeKey=f.fullPath,_.push(f)}g()},O=o=>{const f=V.value.find(h=>h.fullPath==o.fullPath);f&&L(f)},R=o=>{c.closeOtherTabs(o),a.activeKey=o.fullPath,g()},W=()=>{c.closeAllTabs(),g()},A=e.inject("reloadPage"),K=o=>{switch(o){case"1":A();break;case"2":L(d);break;case"3":R(d);break;case"4":W();break}g(),a.showDropdown=!1},z=(o,f)=>{const h=i.value.scrollLeft,T=f>0&&h+f>=o||f<0&&h+f<=o?o:h+f;if(i.value&&i.value.scrollTo(T,0),T!==o)return window.requestAnimationFrame(()=>z(o,f))},X=()=>{const o=i.value.offsetWidth,f=i.value.scrollLeft;if(!f)return;const h=f>o?f-o:0;z(h,(h-f)/20)},J=()=>{const o=i.value.offsetWidth,f=i.value.scrollWidth,h=i.value.scrollLeft;if(f-h<=o)return;const T=f-h>o*2?h+o:f-o;z(T,(T-h)/20)};return window.addEventListener("beforeunload",()=>{c.state.cacheTabs&&localStorage.setItem("TABS_ROUTES",JSON.stringify(V.value))}),window.addEventListener("scroll",o=>{let f=o.target.scrollTop||document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop;a.isMultiHeaderFixed=f>=64},!0),e.watch(()=>d.fullPath,o=>{B.includes(d.name)||(a.activeKey=o,c.addTab($(d)),g(!0))},{immediate:!0}),S(),e.onMounted(()=>F()),(o,f)=>(e.openBlock(),e.createElementBlock("div",{class:"box-border tabs-view tabs-view-fix tabs-view-default-background",style:e.normalizeStyle(x.value)},[e.createElementVNode("div",qe,[e.createElementVNode("div",{ref_key:"navWrap",ref:P,class:e.normalizeClass(["tabs-card",{"tabs-card-scrollable":a.scrollable}])},[e.createElementVNode("span",{class:e.normalizeClass(["tabs-card-prev",{"tabs-card-prev-hide":!a.scrollable}]),onClick:X},[e.createVNode(e.unref(n.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.LeftOutlined))]),_:1})],2),e.createElementVNode("span",{class:e.normalizeClass(["tabs-card-next",{"tabs-card-next-hide":!a.scrollable}]),onClick:J},[e.createVNode(e.unref(n.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.RightOutlined))]),_:1})],2),e.createElementVNode("div",{ref_key:"navScroll",ref:i,class:"tabs-card-scroll"},[e.createVNode(e.unref(_e),{animation:"300","item-key":"fullPath",class:"flex",list:V.value,move:H},{item:e.withCtx(({element:h})=>[e.createElementVNode("div",{class:e.normalizeClass(["tabs-card-scroll-item",{"active-item":a.activeKey===h.fullPath}]),id:`tag${h.fullPath.split("/").join("/")}`,onClick:e.withModifiers(T=>b(h),["stop"]),onContextmenu:T=>k(T,h)},[e.createElementVNode("span",null,e.toDisplayString(h.meta.title),1),h.meta.affix?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(n.NIcon),{key:0,size:"14",onClick:e.withModifiers(T=>O(h),["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(E.CloseOutlined))]),_:1},8,["onClick"]))],42,je)]),_:1},8,["list"])],512)],2),e.createElementVNode("div",He,[e.createVNode(e.unref(n.NDropdown),{trigger:"hover",placement:"bottom-end",options:s.value,onSelect:K},{default:e.withCtx(()=>[e.createElementVNode("div",We,[e.createVNode(e.unref(n.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.DownOutlined))]),_:1})])]),_:1},8,["options"])]),e.createVNode(e.unref(n.NDropdown),{placement:"bottom-start",show:a.showDropdown,x:a.dropdownX,y:a.dropdownY,options:s.value,onClickoutside:f[0]||(f[0]=h=>a.showDropdown=!1),onSelect:K},null,8,["show","x","y","options"])])],4))}}),[["__scopeId","data-v-50f5202c"]]),Ke=e.defineComponent({__name:"PMenus",setup(t){const r=e.ref([]),l=I.useRoute(),p=I.useRouter(),m=j(),d=e.ref(l.name),_=e.ref(l.matched&&l.matched.length?l.matched.map(a=>a.name):[]),i=a=>{l.name!==a&&(/http(s)?:/.test(a)?window.open(a):p.push({name:a}))},P=a=>{if(!a)return;const B=a.find($=>_.value.indexOf($)===-1);_.value=B?[B]:[]},y=()=>{const a=l.matched;_.value=a.map($=>$.name);const B=l.meta?.activeMenu||"";d.value=B||l.name},c=(a,B=[],$=!1)=>{const x=[],s=["/:path(.*)*","/redirect","/redirect/:path(.*)","/login","/oidc-callback"];if(!a||a.length===0)return x;a=a.sort((u,N)=>{let S=(N.children?.length?1:0)-(u.children?.length?1:0);return S===0&&(S=(u.meta?.sort??0)-(N.meta?.sort??0)),S});for(const u of a){if($||u.meta?.hidden||s.includes(u.path.toLowerCase())){B.push(u.name),c(u.children||[],B,!0);continue}const N=u.children?.filter(F=>!F.meta?.hidden)||[],S=u.meta?.alwaysShow!=!0&&N.length===1,g=S?N[0]:u,H={key:g.name,label:g.meta?.title,affix:g.meta?.affix,sort:S?u.meta?.sort??0:g.meta?.sort??0,path:g.path,redirect:g.redirect,icon:S?u.meta?.icon:g.meta?.icon,permissions:g.meta?.permissions,meta:g.meta,children:void 0};B.includes(g.name)||(x.push(H),B.push(g.name)),g.children?.length>0&&(H.children=c(g.children,B,$))}return x},V=()=>{const a=p.getRoutes();r.value=c(a)};return e.watch(()=>l.fullPath,()=>{y()}),e.onMounted(()=>{V(),y()}),(a,B)=>(e.openBlock(),e.createBlock(e.unref(n.NMenu),{class:"h-full",inverted:"",mode:"vertical",options:r.value,collapsed:e.unref(m).state.collapsed,"collapsed-width":64,"collapsed-icon-size":20,indent:24,"expanded-keys":_.value,value:d.value,"onUpdate:value":i,"onUpdate:expandedKeys":P},null,8,["options","collapsed","expanded-keys","value"]))}}),Ye={class:"layout-content-main layout-content-main-fix"},Xe={class:"main-view main-view-fix"},Je=M(e.defineComponent({__name:"PLayout",setup(t){const r=j(),l=e.ref(!1),p=()=>{l.value=!0,e.nextTick(()=>l.value=!1)};return e.provide("reloadPage",p),(m,d)=>{const _=n.NBackTop;return e.openBlock(),e.createBlock(e.unref(n.NLayout),{"has-sider":"",class:"layout",position:"absolute"},{default:e.withCtx(()=>[e.createVNode(e.unref(n.NLayoutSider),{class:"layout-sider",inverted:"","show-trigger":"bar",position:"absolute","collapse-mode":"width","trigger-class":"!-right-5","collapsed-trigger-class":"!-right-5",collapsed:e.unref(r).state.collapsed,"native-scrollbar":!1,"collapsed-width":64,onCollapse:e.unref(r).collapse,onExpand:e.unref(r).collapse},{default:e.withCtx(()=>[e.createVNode(e.unref(n.NFlex),{vertical:""},{default:e.withCtx(()=>[e.createVNode(Pe),e.createVNode(Ke)]),_:1})]),_:1},8,["collapsed","onCollapse","onExpand"]),e.createVNode(e.unref(n.NLayout),null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.NLayoutHeader),{position:"absolute"},{default:e.withCtx(()=>[e.createVNode(Me)]),_:1}),e.createVNode(e.unref(n.NLayoutContent),{class:"layout-content layout-default-background"},{default:e.withCtx(()=>[e.createElementVNode("div",Ye,[e.createVNode(Fe),e.createElementVNode("div",Xe,[e.createVNode(ze,{loading:l.value},null,8,["loading"])])])]),_:1}),e.createVNode(_,{right:20,class:"z-50"})]),_:1})]),_:1})}}}),[["__scopeId","data-v-0bac2e7d"]]),Ze={};function Ge(t,r){const l=e.resolveComponent("router-view");return e.openBlock(),e.createBlock(l)}const ee=D(M(Ze,[["render",Ge]])),te=D(Je),oe=D(e.defineComponent({__name:"PApplication",props:{theme:{},themeOverrides:{default:{common:{primaryColor:"#2d8cf0",primaryColorHover:"#3c9bff",primaryColorPressed:"#3c9bff",primaryColorSuppl:"#2d8cf0"},LoadingBar:{colorLoading:"#2d8cf0"}}}},setup(t){return(r,l)=>{const p=n.NConfigProvider;return e.openBlock(),e.createBlock(p,{locale:e.unref(n.zhCN),theme:t.theme,"theme-overrides":t.themeOverrides,"date-locale":e.unref(n.dateZhCN)},{default:e.withCtx(()=>[e.createVNode(e.unref(n.NDialogProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.NNotificationProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.NMessageProvider),null,{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default")]),_:3})]),_:3})]),_:3})]),_:3},8,["locale","theme","theme-overrides","date-locale"])}}})),ne=D(e.defineComponent({__name:"PModal",props:{saveBtnText:{default:"保存"},cancelBtnText:{default:"取消"},hideCancelBtn:{type:Boolean,default:!1},hideSaveBtn:{type:Boolean,default:!1},title:{},width:{default:800},height:{default:500},visible:{type:Boolean},onSave:{},onClose:{},onAfterEnter:{},onAfterLeave:{},onUpdateVisible:{}},emits:["update:visible","update:loading"],setup(t,{expose:r,emit:l}){const p=n.useMessage(),m=e.ref(!1),d=e.ref(!1),_=l,i=t,P=async()=>{try{m.value=!0,i.onSave&&await i.onSave()&&y()}catch(a){a instanceof Error&&window.$message.error(a.message),console.error(a)}finally{m.value=!1}},y=()=>{m.value=!1,d.value=!1,_("update:visible",!1)},c=async()=>{try{d.value=!0,i.onClose?await i.onClose()&&y():y()}catch(a){p.error(a.message)}finally{d.value=!1}};return r({open:()=>{m.value=!1,d.value=!1,_("update:visible",!0)},close:y}),(a,B)=>{const $=n.NText,x=n.NButton,s=n.NSpace;return e.openBlock(),e.createBlock(e.unref(n.NModal),e.mergeProps({ref:"$modal",preset:"card"},a.$attrs,{"header-class":"bg-gray-50",show:i.visible,draggable:!0,closable:!1,"close-on-esc":!1,"mask-closable":!1,bordered:!1,style:{width:`${i.width}px`},onClose:y,onAfterEnter:i.onAfterEnter,onAfterLeave:i.onAfterLeave,onUpdateVisible:i.onUpdateVisible}),{header:e.withCtx(()=>[a.$slots.header?e.renderSlot(a.$slots,"header",{key:0}):i.title?(e.openBlock(),e.createBlock($,{key:1},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),_:1})):e.createCommentVNode("",!0)]),"header-extra":e.withCtx(()=>[e.renderSlot(a.$slots,"header-extra")]),default:e.withCtx(()=>[e.createElementVNode("div",{class:"overflow-y-auto overflow-hidden mt-5",style:e.normalizeStyle({maxHeight:`${i.height}px`})},[e.renderSlot(a.$slots,"default")],4)]),footer:e.withCtx(()=>[e.renderSlot(a.$slots,"footer")]),action:e.withCtx(()=>[e.createVNode(s,{justify:"end"},{default:e.withCtx(()=>[i.hideSaveBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(x,{key:0,type:"primary",loading:m.value,onClick:P},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.saveBtnText),1)]),_:1},8,["loading"])),e.renderSlot(a.$slots,"action-extra"),i.hideCancelBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(x,{key:1,loading:d.value,onClick:c},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.cancelBtnText),1)]),_:1},8,["loading"]))]),_:3})]),_:3},16,["show","style","onAfterEnter","onAfterLeave","onUpdateVisible"])}}})),ae=D(v),Qe=e.defineComponent({name:"Redirect",setup(){const t=I.useRoute(),r=I.useRouter();return e.onBeforeMount(()=>{const{params:l,query:p}=t,{path:m}=l;r.replace({path:"/"+(Array.isArray(m)?m.join("/"):m),query:p})}),()=>React.createElement(n.NEmpty,null)}}),le=D(Qe),Ue={class:"frame"},ve=["src"],se=D(M(e.defineComponent({__name:"PIframe",setup(t){const r=I.useRoute(),l=e.ref(!1),p=e.ref(null),m=e.ref("");e.unref(r.meta)?.frameSrc&&(m.value=e.unref(r.meta)?.frameSrc);function d(){l.value=!1}function _(){e.nextTick(()=>{const i=e.unref(p);if(!i)return;const P=i;P.attachEvent?P.attachEvent("onload",()=>{d()}):i.onload=()=>{d()}})}return e.onMounted(()=>{l.value=!0,_()}),(i,P)=>{const y=n.NSpin;return e.openBlock(),e.createBlock(y,{show:l.value},{default:e.withCtx(()=>[e.createElementVNode("div",Ue,[e.createElementVNode("iframe",{src:m.value,class:"frame-iframe",ref_key:"frameRef",ref:p},null,8,ve)])]),_:1},8,["show"])}}}),[["__scopeId","data-v-161a378e"]])),et={class:"border border-gray-100 rounded-lg"},tt={class:"text-xl font-semibold text-gray-800"},ot={class:"text-sm text-gray-500 mt-1"},re=D(e.defineComponent({__name:"PPage",props:{icon:{type:Object,required:!1,default:()=>E.AlertOutlined},title:{type:String,required:!0},subtitle:{type:String,required:!1}},setup(t){const r=t;return(l,p)=>{const m=n.NIcon,d=n.NAvatar,_=n.NSpace,i=n.NCard;return e.openBlock(),e.createElementBlock("div",et,[r.title?(e.openBlock(),e.createBlock(i,{key:0,class:"mb-4",bordered:!1,"content-class":"py-4"},{default:e.withCtx(()=>[e.createVNode(_,{align:"center",justify:"space-between"},{default:e.withCtx(()=>[e.createVNode(_,{align:"center",size:16},{default:e.withCtx(()=>[r.icon?(e.openBlock(),e.createBlock(d,{key:0,size:48,class:"bg-linear-to-br from-blue-500 to-indigo-600"},{default:e.withCtx(()=>[e.createVNode(m,{size:24,component:r.icon,color:"#fff"},null,8,["component"])]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",null,[e.createElementVNode("div",tt,e.toDisplayString(r.title),1),e.createElementVNode("div",ot,e.toDisplayString(r.subtitle??r.title+"主页"),1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),l.$slots.search?(e.openBlock(),e.createBlock(i,{key:1,class:"mb-4","content-class":"flex flex-row gap-2",bordered:!1},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"search")]),_:3})):e.createCommentVNode("",!0),l.$slots.default?(e.openBlock(),e.createBlock(i,{key:2,"content-class":"flex flex-row gap-2 p-0!",bordered:!1},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3})):e.createCommentVNode("",!0)])}}})),nt={},at={class:"flex flex-col justify-center page-container"};function lt(t,r){const l=n.NResult;return e.openBlock(),e.createElementBlock("div",at,[e.createVNode(l,{status:"500",title:"服务器错误",description:"抱歉,服务器出错了"})])}const st=M(nt,[["render",lt],["__scopeId","data-v-89cb65c7"]]),rt={},ct={class:"flex flex-col justify-center page-container"};function it(t,r){const l=n.NResult;return e.openBlock(),e.createElementBlock("div",ct,[e.createVNode(l,{status:"404",title:"资源不存在",description:"抱歉,你访问的页面不存在"})])}const dt=M(rt,[["render",it],["__scopeId","data-v-99232671"]]),ft={},pt={class:"flex flex-col justify-center page-container"};function mt(t,r){const l=n.NResult;return e.openBlock(),e.createElementBlock("div",pt,[e.createVNode(l,{status:"403",title:"禁止访问",description:"抱歉,你无权访问该页面"})])}const ut=M(ft,[["render",mt],["__scopeId","data-v-3baa9c16"]]),ce=D(st),ie=D(dt),de=D(ut),fe=Y.defineStore("app-oidc",()=>{const t=e.reactive({});return{setCallback:d=>t.callback=d,callCallback:async d=>await t.callback?.(d),setError:d=>t.error=d,callError:async(d,_)=>await t.error?.(d,_)}}),gt={class:"view-auth-callback"},pe=D(M(e.defineComponent({__name:"POidc",setup(t){const r=I.useRouter(),{callCallback:l,callError:p}=fe();return e.onMounted(async()=>{try{await l(r)}catch(m){await p(r,m)}}),(m,d)=>(e.openBlock(),e.createElementBlock("div",gt,[...d[0]||(d[0]=[e.createElementVNode("div",{class:"view-auth-callback-content"},[e.createElementVNode("div",{class:"view-auth-callback-spinner"},[e.createElementVNode("span",null,"正在处理登录回调...")])],-1)])]))}}),[["__scopeId","data-v-167395ae"]])),ht=Object.freeze(Object.defineProperty({__proto__:null,P403:de,P404:ie,P500:ce,PApplication:oe,PEmptyLayout:ee,PIframe:se,PLanguage:ae,PLayout:te,PModal:ne,POidc:pe,PPage:re,PRedirect:le,PTable:Q},Symbol.toStringTag,{value:"Module"})),me=(t,r)=>(Object.values(ht).forEach(l=>{l.install&&t.use(l)}),r?.(),t),_t={install:me};w.P403=de,w.P404=ie,w.P500=ce,w.PApplication=oe,w.PEmptyLayout=ee,w.PIframe=se,w.PLanguage=ae,w.PLayout=te,w.PModal=ne,w.POidc=pe,w.PPage=re,w.PRedirect=le,w.PTable=Q,w.default=_t,w.install=me,w.useLanguageStore=U,w.useLayoutStore=j,w.useOidcStore=fe,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(w,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("naive-ui"),require("vue"),require("@vicons/antd"),require("pinia"),require("vue-router"),require("element-resize-detector"),require("vuedraggable")):typeof define=="function"&&define.amd?define(["exports","naive-ui","vue","@vicons/antd","pinia","vue-router","element-resize-detector","vuedraggable"],n):(w=typeof globalThis<"u"?globalThis:w||self,n(w.naiveplus={},w.naiveUi,w.Vue,w.antd,w.pinia,w.vueRouter,w.elementResizeDetectorMaker,w.Draggable))})(this,(function(w,n,e,T,Y,I,he,_e){"use strict";const ye={class:"text-lg font-medium"},be={id:"data-content"},ke={key:0,class:"rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-4 mb-4"},we=e.defineComponent({__name:"PTable",props:{title:{},idField:{default:"id"},columns:{},onLoad:{},onDelete:{},onAdd:{},onEdit:{}},setup(t,{expose:s}){const l=e.ref(null),p=n.useDialog(),u=n.useMessage(),i=e.ref(!1),_=e.ref([]),c=e.ref([]),B=e.ref({page:1,itemCount:0,pageSize:10,pageSizes:[10,20,30,50],showSizePicker:!0,onChange:async b=>{B.value.page=b,await L()},onUpdatePageSize:async b=>{B.value.pageSize=b,await L()}}),y=t,r=b=>{const k=x=>{const E=[];return b&&b.forEach(O=>{O.key!=="edit"&&O.key!=="delete"&&E.push({label:O.name,key:O.key,icon:O.icon&&(()=>e.h(n.NIcon,null,{default:()=>e.h(O.icon)})),props:{onClick:()=>O.action(x)}})}),E};return{title:"操作",key:"actions",width:100,fixed:"right",render:x=>{let E=[];if(y.onEdit&&E.push({label:"编辑",key:"edit",icon:()=>e.h(n.NIcon,null,{default:()=>e.h(T.EditOutlined)}),props:{onClick:async()=>await y.onEdit(x)}}),y.onDelete&&E.push({label:"删除",key:"delete",icon:()=>e.h(n.NIcon,null,{default:()=>e.h(T.DeleteOutlined)}),props:{onClick:()=>N(x)}}),E=[...E,...k(x)],!(E.length<=0))return e.h(n.NDropdown,{options:E,placement:"bottom-start"},{default:()=>e.h(n.NButton,{size:"small",type:"primary"},{default:()=>["操作",e.h(n.NIcon,()=>e.h(T.MoreOutlined))]})})}}},V=e.computed(()=>{const b=y.columns.filter(x=>x.key!="action").map(x=>({title:x.title,key:x.key,width:x.width,fixed:x.fixed??!1,render:x.render,ellipsis:x.ellipsis?{tooltip:!0}:!1})),k=y.columns.reduce((x,E)=>E.key==="action"?E:x,void 0)?.action;return k&&k?.length>0||y.onEdit||y.onDelete?[{type:"selection",fixed:"left"},...b,r(k)]:[{type:"selection",fixed:"left"},...b]}),d=async()=>await L(),N=b=>C([b]),S=()=>{const b=a();C(b)},C=b=>{b&&b.length>0&&p.warning({title:"警告",content:"删除数据不可恢复, 确认删除吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(y.onDelete)try{await y.onDelete(b)?(L(),u.success("删除成功")):u.error("删除失败")}catch(k){u.error(k.message)}}})},a=()=>_.value?c.value.filter(k=>_.value.includes(k.id)).map(k=>e.toRaw(k)):[],g=()=>a()[0],P=()=>e.toRaw(c.value),L=async()=>{if(!i.value){i.value=!0;try{if(y.onLoad){var{items:b,totalCount:k}=await y.onLoad(B.value.page,B.value.pageSize);c.value=b,B.value.itemCount=k}}catch(x){u.error(x.message)}finally{i.value=!1}}},m=e.computed(()=>{const b=e.unref(l);if(!b)return;const k=b?.$el,x=k.querySelector(".n-data-table-thead "),{bottomIncludeBody:E}=F(x),O=48;let R=12,W=25;const z=k.querySelector(".n-data-table__pagination");if(z){const q=z.offsetHeight;R+=q||0}else R+=28;return E-(O+R+W)}),A=b=>!b||!b.getBoundingClientRect?0:b.getBoundingClientRect(),F=b=>{const k=document.documentElement,x=k.scrollLeft,E=k.scrollTop,O=k.clientLeft,R=k.clientTop,W=window.pageXOffset,z=window.pageYOffset,K=A(b),{left:q,top:X,width:J,height:o}=K,f=(W||x)-(O||0),h=(z||E)-(R||0),$=q+W,j=X+z,Z=$-f,G=j-h,ue=window.document.documentElement.clientWidth,ge=window.document.documentElement.clientHeight;return{left:Z,top:G,right:ue-J-Z,bottom:ge-o-G,rightIncludeBody:ue-Z,bottomIncludeBody:ge-G}};return e.onMounted(async()=>await L()),s({getData:P,getSelectedRow:g,getSelectedRows:a,refreshData:L,resetPage:()=>{B.value.page=1}}),(b,k)=>{const x=n.NTooltip,E=n.NSpace,O=n.NDataTable;return e.openBlock(),e.createBlock(e.unref(n.NCard),{bordered:!1},{header:e.withCtx(()=>[e.createVNode(E,{justify:"space-between",align:"center",class:"w-full"},{default:e.withCtx(()=>[e.createElementVNode("span",ye,e.toDisplayString(t.title),1),e.createVNode(E,null,{default:e.withCtx(()=>[y.onAdd?(e.openBlock(),e.createBlock(x,{key:0,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(n.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:y.onAdd},{default:e.withCtx(()=>[e.createVNode(e.unref(T.PlusSquareOutlined))]),_:1},8,["onClick"])]),default:e.withCtx(()=>[k[1]||(k[1]=e.createElementVNode("span",null,"新增",-1))]),_:1})):e.createCommentVNode("",!0),y.onDelete?(e.openBlock(),e.createBlock(x,{key:1,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(n.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:S},{default:e.withCtx(()=>[e.createVNode(e.unref(T.DeleteOutlined))]),_:1})]),default:e.withCtx(()=>[k[2]||(k[2]=e.createElementVNode("span",null,"删除",-1))]),_:1})):e.createCommentVNode("",!0),e.createVNode(x,{trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(n.NIcon),{size:"18",class:"cursor-pointer hover:text-blue-600",onClick:d},{default:e.withCtx(()=>[e.createVNode(e.unref(T.ReloadOutlined))]),_:1})]),default:e.withCtx(()=>[k[3]||(k[3]=e.createElementVNode("span",null,"刷新",-1))]),_:1})]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",be,[b.$slots.toolbar?(e.openBlock(),e.createElementBlock("div",ke,[e.renderSlot(b.$slots,"toolbar")])):e.createCommentVNode("",!0),e.createVNode(O,{remote:"",ref_key:"$table",ref:l,"checked-row-keys":_.value,"onUpdate:checkedRowKeys":k[0]||(k[0]=R=>_.value=R),"max-height":m.value,loading:i.value,bordered:!1,"single-line":!1,columns:V.value,data:c.value,pagination:B.value,"row-key":R=>R[t.idField]},null,8,["checked-row-keys","max-height","loading","columns","data","pagination","row-key"])])]),_:3})}}}),D=t=>{const s=t;return s.install=function(l){l.component(s.__name,t)},t},Q=D(we),Ne=["Redirect","RedirectSon","login"],H=Y.defineStore("p-layout",()=>{const t=e.reactive({collapsed:!1,title:"输入项目名称",logo:"https://picsum.photos/id/1/100/100",avatar:"",uid:"",uname:"",tabs:[],cacheTabs:!1,enableLanguage:!1});return{state:t,initTabs:a=>{a.sort((g,P)=>g.meta.affix&&!P.meta.affix?-1:!g.meta.affix&&P.meta.affix?1:Number(P.meta.sort??0)-Number(g.meta.sort??0)),t.tabs=a},addTab:a=>Ne.includes(a.name)?!1:(t.tabs?.some(P=>P.fullPath==a.fullPath)||t.tabs?.push(a),!0),getCurrentTab:()=>{const a=I.useRoute();return t.tabs.find(g=>g.fullPath==a.fullPath)},closeCurrentTab:a=>{const g=t.tabs.findIndex(P=>P.fullPath==a.fullPath);t.tabs.splice(g,1)},closeAllTabs:()=>{t.tabs=t.tabs.filter(a=>a?.meta?.affix??!1)},closeOtherTabs:a=>{t.tabs=t.tabs.filter(g=>g.fullPath==a.fullPath||(g?.meta?.affix??!1))},closeLeftTabs:a=>{const g=t.tabs.findIndex(P=>P.fullPath==a.fullPath);t.tabs=t.tabs.filter((P,L)=>L>=g||(P?.meta?.affix??!1))},closeRightTabs:a=>{const g=t.tabs.findIndex(P=>P.fullPath==a.fullPath);t.tabs=t.tabs.filter((P,L)=>L<=g||(P?.meta?.affix??!1))},collapse:()=>{t.collapsed=!t.collapsed},setTitle:a=>{t.title=a},setLogo:a=>{t.logo=a},setUser:(a,g)=>{t.uid=a,t.uname=g},setSettingPages:a=>{t.settingPages=a},setLogout:a=>{t.logout=a},enableLanguage:a=>{t.enableLanguage=a}}}),Ce={class:"logo"},xe=e.defineComponent({__name:"PLogo",setup(t){const s=H();return(l,p)=>(e.openBlock(),e.createElementBlock("div",Ce,[e.createVNode(e.unref(n.NAvatar),{color:"var(--color-logo)",size:32,src:e.unref(s).state.logo,class:e.normalizeClass({"mr-2":!e.unref(s).state.collapsed})},null,8,["src","class"]),e.withDirectives(e.createElementVNode("h1",{class:"font-bold ease-in-out ml-2 logo-size"},e.toDisplayString(e.unref(s).state.title),513),[[e.vShow,!e.unref(s).state.collapsed]])]))}}),M=(t,s)=>{const l=t.__vccOpts||t;for(const[p,u]of s)l[p]=u;return l},Pe=M(xe,[["__scopeId","data-v-e48aeefa"]]),Ve={translationApiUrl:"https://translate.zvo.cn/api",defaultLanguage:"chinese",currentLanguage:"",options:[],initLanguages:async()=>[],selectLanguage:async t=>{}},U=Y.defineStore("language",()=>{const t=e.ref(Ve),s=async()=>(t.value.options.length===0&&(t.value.options=await t.value.initLanguages()),t.value.options);return{select:async r=>{if(t.value.currentLanguage===r)return;const V=(await s()).find(d=>d.key===r);V&&(t.value.currentLanguage=V.key,t.value.selectLanguage(V))},selectLanguageCallback:async r=>{t.value.selectLanguage=r},initLanguagesCallback:async r=>{t.value.initLanguages=r},getLanguages:s,getCurrentLanguage:async()=>{if(t.value.currentLanguage)return(await s()).find(r=>r.key===t.value.currentLanguage)},setTranslationApiUrl:r=>{t.value.translationApiUrl=r},getTranslationApiUrl:()=>t.value.translationApiUrl,getDefaultLanguage:()=>t.value.defaultLanguage?t.value.defaultLanguage:"chinese_simplified",setDefaultLanguage:r=>{(r==="Chinese"||r==="chinese")&&(r="chinese_simplified"),t.value.defaultLanguage=r}}}),Be={key:1},v=e.defineComponent({__name:"PLanguage",setup(t){const{select:s,getLanguages:l,getCurrentLanguage:p,getDefaultLanguage:u,getTranslationApiUrl:i}=U(),_=e.ref(),c=e.ref([]),B=async r=>await s(r),y=async()=>{const r=window.translate;r&&(r.selectLanguageTag.show=!1,r.selectLanguageTag.languages=(await l()).map(V=>V.key).join(","),r.ignore.class.push("ignore-translate-flag"),r.ignore.id.push("ignore-translation"),r.language.setLocal(u()),r.request.api.translate="api/v1/translation",r.request.api.connectTest="api/v1/translation/connect-test",r.request.api.init="api/v1/translation/init",r.request.api.language="api/v1/translation/language",r.request.setHost(i()),r.request.listener.start(),r.listener.start(),r.whole.enableAll(),r.execute())};return e.onMounted(async()=>{await e.nextTick(),await y(),_.value=await p(),c.value=await l()}),(r,V)=>{const d=n.NIcon,N=n.NButton;return c.value.length>0?(e.openBlock(),e.createBlock(e.unref(n.NDropdown),{key:0,id:"ignore-translation",placement:"bottom-start",trigger:"hover",class:"flex flex-col justify-center h-full ignore",onSelect:B,options:c.value},{default:e.withCtx(()=>[e.createVNode(N,{quaternary:"",type:"info"},{default:e.withCtx(()=>[_.value?(e.openBlock(),e.createElementBlock("label",Be,e.toDisplayString(_.value?.label),1)):(e.openBlock(),e.createBlock(d,{key:0,size:"18"},{default:e.withCtx(()=>[...V[0]||(V[0]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 512 512"},[e.createElementVNode("path",{d:"M478.33 433.6l-90-218a22 22 0 0 0-40.67 0l-90 218a22 22 0 1 0 40.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 0 0 458 464a22 22 0 0 0 20.32-30.4zM334.83 362L368 281.65L401.17 362z",fill:"currentColor"}),e.createElementVNode("path",{d:"M267.84 342.92a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73c39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 0 0 0-44H214V70a22 22 0 0 0-44 0v20H54a22 22 0 0 0 0 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36c-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 0 0-40.58 17c.58 1.38 14.55 34.23 52.86 83.93c.92 1.19 1.83 2.35 2.74 3.51c-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1 0 21.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59c22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z",fill:"currentColor"})],-1)])]),_:1}))]),_:1})]),_:1},8,["options"])):e.createCommentVNode("",!0)}}}),Se={class:"layout-header"},Le={class:"layout-header-left"},Ee={class:"link-text"},Te={key:1,class:"link-text"},$e={class:"layout-header-right"},Oe={key:0,class:"layout-header-trigger-min"},De={class:"layout-header-trigger layout-header-trigger-min"},Ie={class:"layout-header-trigger layout-header-trigger-min"},Re={class:"avatar"},Me=M(e.defineComponent({__name:"PHeader",setup(t){const s=n.useMessage(),l=n.useDialog(),p=H(),u=I.useRouter(),i=I.useRoute(),_=e.inject("reloadPage"),c=C=>u.push({name:C}),B=e.computed(()=>y(i.matched)),y=C=>C.map(a=>{const g={key:a.name,label:a.meta.title,icon:a.meta.icon,meta:a.meta,disabled:a.path==="/",children:void 0};return a.children&&a.children.length>0&&(g.children=y(a.children)),g}),r=e.ref(!1),V=()=>{document.fullscreenElement?document.exitFullscreen&&(document.exitFullscreen(),r.value=!1):(document.documentElement.requestFullscreen(),r.value=!0)},d=e.computed(()=>{const C=[];return C.push({label:"退出登录",key:"logout"}),p.state.settingPages&&p.state.settingPages.length>0&&p.state.settingPages.forEach(a=>{C.push({label:a.title,key:a.route})}),C}),N=C=>{C==="logout"?S():u.push({name:C})},S=()=>{l.info({title:"提示",content:"您确定要退出登录吗",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(p.state.logout)try{await p.state.logout(),localStorage.removeItem("TABS-ROUTES"),s.error("退出成功")}catch(C){console.error(C),s.error("退出登录失败")}finally{location.reload()}else s.error("没有配置登出接口, 请配置[usePLayoutStore.logout]方法")},onNegativeClick:()=>{}})};return(C,a)=>{const g=n.NTooltip,P=n.NDivider,L=n.NAvatar;return e.openBlock(),e.createElementBlock("div",Se,[e.createElementVNode("div",Le,[e.createElementVNode("div",{class:"ml-1 layout-header-trigger layout-header-trigger-min",onClick:a[0]||(a[0]=(...m)=>e.unref(p).collapse&&e.unref(p).collapse(...m))},[e.unref(p).state.collapsed?(e.openBlock(),e.createBlock(e.unref(n.NIcon),{key:0,size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.MenuUnfoldOutlined))]),_:1})):(e.openBlock(),e.createBlock(e.unref(n.NIcon),{key:1,size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.MenuFoldOutlined))]),_:1}))]),e.createElementVNode("div",{class:"mr-1 layout-header-trigger layout-header-trigger-min",onClick:a[1]||(a[1]=(...m)=>e.unref(_)&&e.unref(_)(...m))},[e.createVNode(e.unref(n.NIcon),{size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.ReloadOutlined))]),_:1})]),e.createVNode(e.unref(n.NBreadcrumb),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,m=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:m.label},[m.label?(e.openBlock(),e.createBlock(e.unref(n.NBreadcrumbItem),{key:0},{default:e.withCtx(()=>[m.children&&m.children.length?(e.openBlock(),e.createBlock(e.unref(n.NDropdown),{key:0,options:m.children,onSelect:c},{default:e.withCtx(()=>[e.createElementVNode("span",Ee,[m.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(m.label),1)])]),_:2},1032,["options"])):(e.openBlock(),e.createElementBlock("span",Te,[m.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(m.label),1)]))]),_:2},1024)):e.createCommentVNode("",!0)],64))),128))]),_:1})]),e.createElementVNode("div",$e,[e.unref(p).state.enableLanguage?(e.openBlock(),e.createElementBlock("div",Oe,[e.createVNode(v)])):e.createCommentVNode("",!0),e.createElementVNode("div",De,[e.createVNode(g,{placement:"bottom"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(n.NIcon),{size:"18",onClick:e.withModifiers(V,["stop"])},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createBlock(e.unref(T.FullscreenExitOutlined),{key:1})):(e.openBlock(),e.createBlock(e.unref(T.FullscreenOutlined),{key:0}))]),_:1})]),default:e.withCtx(()=>[a[2]||(a[2]=e.createElementVNode("span",null,"全屏",-1))]),_:1})]),e.createElementVNode("div",Ie,[e.createVNode(e.unref(n.NDropdown),{trigger:"hover",onSelect:N,options:d.value},{default:e.withCtx(()=>[e.createElementVNode("div",Re,[e.createElementVNode("span",null,e.toDisplayString(e.unref(p).state.uname),1),e.createVNode(P,{vertical:""}),e.createVNode(L,{round:"",src:e.unref(p).state.avatar},null,8,["src"])])]),_:1},8,["options"])])])])}}}),[["__scopeId","data-v-563e4e55"]]),Ae={class:"mt-1"},ze=e.defineComponent({__name:"PContent",props:{loading:{type:Boolean,default:!1}},setup(t){return(s,l)=>{const p=e.resolveComponent("RouterView");return e.openBlock(),e.createElementBlock("div",Ae,[t.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(p,{key:0},{default:e.withCtx(({Component:u,route:i})=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u),{key:i.fullPath}))],1024))]),_:1}))])}}}),qe={class:"tabs-view-main"},je=["id","onClick","onContextmenu"],He={class:"tabs-close"},We={class:"tabs-close-btn"},Fe=M(e.defineComponent({__name:"PTabs",setup(t){e.useCssVars(o=>({v4f917f8c:l.value,v1c2fb72a:p.value}));const s=n.useThemeVars(),l=e.computed(()=>s.value.cardColor),p=e.computed(()=>s.value.textColor1),u=n.useMessage(),i=I.useRoute(),_=I.useRouter(),c=e.ref(null),B=e.ref(null),y=e.ref(!1),r=H(),V=e.computed(()=>r.state.tabs),d=e.reactive({activeKey:i.fullPath,scrollable:!0,dropdownX:0,dropdownY:0,showDropdown:!1,isMultiHeaderFixed:!0,multiTabsSetting:!0}),N=["Login","Redirect","ErrorPage"],S=o=>({meta:o.meta,name:o.name,fullPath:o.fullPath??o.path,path:o.path,hash:o.hash??"",query:o.query??{},params:o.params??{}}),C=e.computed(()=>{const h=r.state.collapsed?"64px":"272px";return{left:h,width:`calc(100% - ${h})`}}),a=e.computed(()=>{const o=V.value.length<=1;return[{label:"刷新当前",key:"1",icon:()=>e.h(n.NIcon,null,{default:()=>e.h(T.ReloadOutlined)})},{label:"关闭当前",key:"2",disabled:y.value||o,icon:()=>e.h(n.NIcon,null,{default:()=>e.h(T.CloseOutlined)})},{label:"关闭其他",key:"3",disabled:o,icon:()=>e.h(n.NIcon,null,{default:()=>e.h(T.ColumnWidthOutlined)})},{label:"关闭全部",key:"4",disabled:o,icon:()=>e.h(n.NIcon,null,{default:()=>e.h(T.MinusOutlined)})}]}),g=()=>{let o=[S(i)];_.getRoutes().filter(f=>f.meta.affix).forEach(f=>{const h=S(f);o.every($=>$.name!==h.name)&&o.push(h)});try{if(r.state.cacheTabs){const f=localStorage.getItem("TABS_ROUTES");o=f?JSON.parse(f):o}}finally{return o}},P=o=>{const f=_.getRoutes();o.forEach(h=>{const $=f.find(j=>j.path===h.path);$&&(h.meta=$.meta||h.meta,h.name=$.name||h.name)}),r.state.cacheTabs&&localStorage.setItem("TABS_ROUTES",JSON.stringify(o))},L=()=>{const o=g();P(o),r.initTabs(o)},m=async o=>{if(await e.nextTick(),!c.value)return;const f=c.value.offsetWidth,h=c.value.scrollWidth;f<h?(d.scrollable=!0,o&&[...c.value.querySelectorAll(".tabs-card-scroll-item")||[]].forEach(j=>{j.id===`tag${d.activeKey.split("/").join("/")}`&&j.scrollIntoView&&j.scrollIntoView()})):d.scrollable=!1},A=o=>!(o.draggedContext.element.meta.affix||o.relatedContext.element.meta.affix),F=()=>{let o;o=he(),o.listenTo(B.value,()=>m(!0))},b=o=>{if(!o||o.fullPath===i.fullPath)return;if(d.activeKey=o.fullPath,toString.call(o)==="[object String]"){_.replace(o).catch(console.error);return}const f=o;_.replace(f).catch(console.error)},k=(o,f)=>{o.preventDefault(),y.value=f.path==="/home",d.showDropdown=!1,e.nextTick().then(()=>{d.showDropdown=!0,d.dropdownX=o.clientX,d.dropdownY=o.clientY})},x=()=>{if(i.meta.keepAlive){var o=_.currentRoute.value.matched.find(f=>f.name==i.name);o&&o.components?.default?.name}},E=o=>{if(V.value.length===1)return u.warning("这已经是最后一页,不能再关闭了!");if(x(),r.closeCurrentTab(o),d.activeKey===o.fullPath){const f=V.value[Math.max(0,V.value.length-1)];d.activeKey=f.fullPath,_.push(f)}m()},O=o=>{const f=V.value.find(h=>h.fullPath==o.fullPath);f&&E(f)},R=o=>{r.closeOtherTabs(o),d.activeKey=o.fullPath,m()},W=()=>{r.closeAllTabs(),m()},z=e.inject("reloadPage"),K=o=>{switch(o){case"1":z();break;case"2":E(i);break;case"3":R(i);break;case"4":W();break}m(),d.showDropdown=!1},q=(o,f)=>{const h=c.value.scrollLeft,$=f>0&&h+f>=o||f<0&&h+f<=o?o:h+f;if(c.value&&c.value.scrollTo($,0),$!==o)return window.requestAnimationFrame(()=>q(o,f))},X=()=>{const o=c.value.offsetWidth,f=c.value.scrollLeft;if(!f)return;const h=f>o?f-o:0;q(h,(h-f)/20)},J=()=>{const o=c.value.offsetWidth,f=c.value.scrollWidth,h=c.value.scrollLeft;if(f-h<=o)return;const $=f-h>o*2?h+o:f-o;q($,($-h)/20)};return window.addEventListener("beforeunload",()=>{r.state.cacheTabs&&localStorage.setItem("TABS_ROUTES",JSON.stringify(V.value))}),window.addEventListener("scroll",o=>{let f=o.target.scrollTop||document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop;d.isMultiHeaderFixed=f>=64},!0),e.watch(()=>i.fullPath,o=>{N.includes(i.name)||(d.activeKey=o,r.addTab(S(i)),m(!0))},{immediate:!0}),L(),e.onMounted(()=>F()),(o,f)=>(e.openBlock(),e.createElementBlock("div",{class:"box-border tabs-view tabs-view-fix tabs-view-default-background",style:e.normalizeStyle(C.value)},[e.createElementVNode("div",qe,[e.createElementVNode("div",{ref_key:"navWrap",ref:B,class:e.normalizeClass(["tabs-card",{"tabs-card-scrollable":d.scrollable}])},[e.createElementVNode("span",{class:e.normalizeClass(["tabs-card-prev",{"tabs-card-prev-hide":!d.scrollable}]),onClick:X},[e.createVNode(e.unref(n.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.LeftOutlined))]),_:1})],2),e.createElementVNode("span",{class:e.normalizeClass(["tabs-card-next",{"tabs-card-next-hide":!d.scrollable}]),onClick:J},[e.createVNode(e.unref(n.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.RightOutlined))]),_:1})],2),e.createElementVNode("div",{ref_key:"navScroll",ref:c,class:"tabs-card-scroll"},[e.createVNode(e.unref(_e),{animation:"300","item-key":"fullPath",class:"flex",list:V.value,move:A},{item:e.withCtx(({element:h})=>[e.createElementVNode("div",{class:e.normalizeClass(["tabs-card-scroll-item",{"active-item":d.activeKey===h.fullPath}]),id:`tag${h.fullPath.split("/").join("/")}`,onClick:e.withModifiers($=>b(h),["stop"]),onContextmenu:$=>k($,h)},[e.createElementVNode("span",null,e.toDisplayString(h.meta.title),1),h.meta.affix?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(n.NIcon),{key:0,size:"14",onClick:e.withModifiers($=>O(h),["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(T.CloseOutlined))]),_:1},8,["onClick"]))],42,je)]),_:1},8,["list"])],512)],2),e.createElementVNode("div",He,[e.createVNode(e.unref(n.NDropdown),{trigger:"hover",placement:"bottom-end",options:a.value,onSelect:K},{default:e.withCtx(()=>[e.createElementVNode("div",We,[e.createVNode(e.unref(n.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.DownOutlined))]),_:1})])]),_:1},8,["options"])]),e.createVNode(e.unref(n.NDropdown),{placement:"bottom-start",show:d.showDropdown,x:d.dropdownX,y:d.dropdownY,options:a.value,onClickoutside:f[0]||(f[0]=h=>d.showDropdown=!1),onSelect:K},null,8,["show","x","y","options"])])],4))}}),[["__scopeId","data-v-50f5202c"]]),Ke=e.defineComponent({__name:"PMenus",setup(t){const s=e.ref([]),l=I.useRoute(),p=I.useRouter(),u=H(),i=e.ref(l.name),_=e.ref(l.matched&&l.matched.length?l.matched.map(N=>N.name):[]),c=N=>{l.name!==N&&(/http(s)?:/.test(N)?window.open(N):p.push({name:N}))},B=N=>{if(!N)return;const S=N.find(C=>_.value.indexOf(C)===-1);_.value=S?[S]:[]},y=()=>{const N=l.matched;_.value=N.map(C=>C.name);const S=l.meta?.activeMenu||"";i.value=S||l.name},r=["/:path(.*)*","/redirect","/redirect/:path(.*)","/login","/oidc-callback"],V=(N,S=[],C=!1)=>{const a=[];if(!N||N.length===0)return a;N=N.sort((g,P)=>{let L=(P.children?.length?1:0)-(g.children?.length?1:0);return L===0&&(L=Number(g.meta?.sort??0)-Number(P.meta?.sort??0)),L});for(const g of N){if(C||g.meta?.hidden||r.includes(g.path.toLowerCase())){S.push(g.name),V(g.children||[],S,!0);continue}const P=g.children?.filter(F=>!F.meta?.hidden)||[],L=P.length===1,m=L?P[0]:g,A={key:m.name,label:m.meta?.title,affix:m.meta?.affix,sort:Number(L?g.meta?.sort??0:m.meta?.sort??0),path:m.path,redirect:m.redirect,icon:L?g.meta?.icon:m.meta?.icon,permission:m.meta?.permission,meta:m.meta,children:void 0};if(m.children&&m.children.length>0&&(A.children=V(m.children,S,C),!L&&(!A.children||A.children.length===0))){S.push(m.name);continue}S.includes(m.name)||(a.push(A),S.push(m.name))}return a},d=()=>{const N=p.getRoutes();s.value=V(N)};return e.watch(()=>l.fullPath,()=>{y()}),e.onMounted(()=>{d(),y()}),(N,S)=>(e.openBlock(),e.createBlock(e.unref(n.NMenu),{class:"h-full",inverted:"",mode:"vertical",options:s.value,collapsed:e.unref(u).state.collapsed,"collapsed-width":64,"collapsed-icon-size":20,indent:24,"expanded-keys":_.value,value:i.value,"onUpdate:value":c,"onUpdate:expandedKeys":B},null,8,["options","collapsed","expanded-keys","value"]))}}),Ye={class:"layout-content-main layout-content-main-fix"},Xe={class:"main-view main-view-fix"},Je=M(e.defineComponent({__name:"PLayout",setup(t){const s=H(),l=e.ref(!1),p=()=>{l.value=!0,e.nextTick(()=>l.value=!1)};return e.provide("reloadPage",p),(u,i)=>{const _=n.NBackTop;return e.openBlock(),e.createBlock(e.unref(n.NLayout),{"has-sider":"",class:"layout",position:"absolute"},{default:e.withCtx(()=>[e.createVNode(e.unref(n.NLayoutSider),{class:"layout-sider",inverted:"","show-trigger":"bar",position:"absolute","collapse-mode":"width","trigger-class":"!-right-5","collapsed-trigger-class":"!-right-5",collapsed:e.unref(s).state.collapsed,"native-scrollbar":!1,"collapsed-width":64,onCollapse:e.unref(s).collapse,onExpand:e.unref(s).collapse},{default:e.withCtx(()=>[e.createVNode(e.unref(n.NFlex),{vertical:""},{default:e.withCtx(()=>[e.createVNode(Pe),e.createVNode(Ke)]),_:1})]),_:1},8,["collapsed","onCollapse","onExpand"]),e.createVNode(e.unref(n.NLayout),null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.NLayoutHeader),{position:"absolute"},{default:e.withCtx(()=>[e.createVNode(Me)]),_:1}),e.createVNode(e.unref(n.NLayoutContent),{class:"layout-content layout-default-background"},{default:e.withCtx(()=>[e.createElementVNode("div",Ye,[e.createVNode(Fe),e.createElementVNode("div",Xe,[e.createVNode(ze,{loading:l.value},null,8,["loading"])])])]),_:1}),e.createVNode(_,{right:20,class:"z-50"})]),_:1})]),_:1})}}}),[["__scopeId","data-v-0bac2e7d"]]),Ze={};function Ge(t,s){const l=e.resolveComponent("router-view");return e.openBlock(),e.createBlock(l)}const ee=D(M(Ze,[["render",Ge]])),te=D(Je),oe=D(e.defineComponent({__name:"PApplication",props:{theme:{},themeOverrides:{default:{common:{primaryColor:"#2d8cf0",primaryColorHover:"#3c9bff",primaryColorPressed:"#3c9bff",primaryColorSuppl:"#2d8cf0"},LoadingBar:{colorLoading:"#2d8cf0"}}}},setup(t){return(s,l)=>{const p=n.NConfigProvider;return e.openBlock(),e.createBlock(p,{locale:e.unref(n.zhCN),theme:t.theme,"theme-overrides":t.themeOverrides,"date-locale":e.unref(n.dateZhCN)},{default:e.withCtx(()=>[e.createVNode(e.unref(n.NDialogProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.NNotificationProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.NMessageProvider),null,{default:e.withCtx(()=>[e.renderSlot(s.$slots,"default")]),_:3})]),_:3})]),_:3})]),_:3},8,["locale","theme","theme-overrides","date-locale"])}}})),ne=D(e.defineComponent({__name:"PModal",props:{saveBtnText:{default:"保存"},cancelBtnText:{default:"取消"},hideCancelBtn:{type:Boolean,default:!1},hideSaveBtn:{type:Boolean,default:!1},title:{},width:{default:800},height:{default:500},visible:{type:Boolean},onSave:{},onClose:{},onAfterEnter:{},onAfterLeave:{},onUpdateVisible:{}},emits:["update:visible","update:loading"],setup(t,{expose:s,emit:l}){const p=n.useMessage(),u=e.ref(!1),i=e.ref(!1),_=l,c=t,B=async()=>{try{u.value=!0,c.onSave&&await c.onSave()&&y()}catch(d){d instanceof Error&&window.$message.error(d.message),console.error(d)}finally{u.value=!1}},y=()=>{u.value=!1,i.value=!1,_("update:visible",!1)},r=async()=>{try{i.value=!0,c.onClose?await c.onClose()&&y():y()}catch(d){p.error(d.message)}finally{i.value=!1}};return s({open:()=>{u.value=!1,i.value=!1,_("update:visible",!0)},close:y}),(d,N)=>{const S=n.NText,C=n.NButton,a=n.NSpace;return e.openBlock(),e.createBlock(e.unref(n.NModal),e.mergeProps({ref:"$modal",preset:"card"},d.$attrs,{"header-class":"bg-gray-50",show:c.visible,draggable:!0,closable:!1,"close-on-esc":!1,"mask-closable":!1,bordered:!1,style:{width:`${c.width}px`},onClose:y,onAfterEnter:c.onAfterEnter,onAfterLeave:c.onAfterLeave,onUpdateVisible:c.onUpdateVisible}),{header:e.withCtx(()=>[d.$slots.header?e.renderSlot(d.$slots,"header",{key:0}):c.title?(e.openBlock(),e.createBlock(S,{key:1},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),_:1})):e.createCommentVNode("",!0)]),"header-extra":e.withCtx(()=>[e.renderSlot(d.$slots,"header-extra")]),default:e.withCtx(()=>[e.createElementVNode("div",{class:"overflow-y-auto overflow-hidden mt-5",style:e.normalizeStyle({maxHeight:`${c.height}px`})},[e.renderSlot(d.$slots,"default")],4)]),footer:e.withCtx(()=>[e.renderSlot(d.$slots,"footer")]),action:e.withCtx(()=>[e.createVNode(a,{justify:"end"},{default:e.withCtx(()=>[c.hideSaveBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(C,{key:0,type:"primary",loading:u.value,onClick:B},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.saveBtnText),1)]),_:1},8,["loading"])),e.renderSlot(d.$slots,"action-extra"),c.hideCancelBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(C,{key:1,loading:i.value,onClick:r},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.cancelBtnText),1)]),_:1},8,["loading"]))]),_:3})]),_:3},16,["show","style","onAfterEnter","onAfterLeave","onUpdateVisible"])}}})),ae=D(v),Qe=e.defineComponent({name:"Redirect",setup(){const t=I.useRoute(),s=I.useRouter();return e.onBeforeMount(()=>{const{params:l,query:p}=t,{path:u}=l;s.replace({path:"/"+(Array.isArray(u)?u.join("/"):u),query:p})}),()=>React.createElement(n.NEmpty,null)}}),le=D(Qe),Ue={class:"frame"},ve=["src"],se=D(M(e.defineComponent({__name:"PIframe",setup(t){const s=I.useRoute(),l=e.ref(!1),p=e.ref(null),u=e.ref("");e.unref(s.meta)?.frameSrc&&(u.value=e.unref(s.meta)?.frameSrc);function i(){l.value=!1}function _(){e.nextTick(()=>{const c=e.unref(p);if(!c)return;const B=c;B.attachEvent?B.attachEvent("onload",()=>{i()}):c.onload=()=>{i()}})}return e.onMounted(()=>{l.value=!0,_()}),(c,B)=>{const y=n.NSpin;return e.openBlock(),e.createBlock(y,{show:l.value},{default:e.withCtx(()=>[e.createElementVNode("div",Ue,[e.createElementVNode("iframe",{src:u.value,class:"frame-iframe",ref_key:"frameRef",ref:p},null,8,ve)])]),_:1},8,["show"])}}}),[["__scopeId","data-v-161a378e"]])),et={class:"border border-gray-100 rounded-lg"},tt={class:"text-xl font-semibold text-gray-800"},ot={class:"text-sm text-gray-500 mt-1"},re=D(e.defineComponent({__name:"PPage",props:{icon:{type:Object,required:!1,default:()=>T.AlertOutlined},title:{type:String,required:!0},subtitle:{type:String,required:!1}},setup(t){const s=t;return(l,p)=>{const u=n.NIcon,i=n.NAvatar,_=n.NSpace,c=n.NCard;return e.openBlock(),e.createElementBlock("div",et,[s.title?(e.openBlock(),e.createBlock(c,{key:0,class:"mb-4",bordered:!1,"content-class":"py-4"},{default:e.withCtx(()=>[e.createVNode(_,{align:"center",justify:"space-between"},{default:e.withCtx(()=>[e.createVNode(_,{align:"center",size:16},{default:e.withCtx(()=>[s.icon?(e.openBlock(),e.createBlock(i,{key:0,size:48,class:"bg-linear-to-br from-blue-500 to-indigo-600"},{default:e.withCtx(()=>[e.createVNode(u,{size:24,component:s.icon,color:"#fff"},null,8,["component"])]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",null,[e.createElementVNode("div",tt,e.toDisplayString(s.title),1),e.createElementVNode("div",ot,e.toDisplayString(s.subtitle??s.title+"主页"),1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),l.$slots.search?(e.openBlock(),e.createBlock(c,{key:1,class:"mb-4","content-class":"flex flex-row gap-2",bordered:!1},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"search")]),_:3})):e.createCommentVNode("",!0),l.$slots.default?(e.openBlock(),e.createBlock(c,{key:2,"content-class":"flex flex-row gap-2 p-0!",bordered:!1},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3})):e.createCommentVNode("",!0)])}}})),nt={},at={class:"flex flex-col justify-center page-container"};function lt(t,s){const l=n.NResult;return e.openBlock(),e.createElementBlock("div",at,[e.createVNode(l,{status:"500",title:"服务器错误",description:"抱歉,服务器出错了"})])}const st=M(nt,[["render",lt],["__scopeId","data-v-89cb65c7"]]),rt={},ct={class:"flex flex-col justify-center page-container"};function it(t,s){const l=n.NResult;return e.openBlock(),e.createElementBlock("div",ct,[e.createVNode(l,{status:"404",title:"资源不存在",description:"抱歉,你访问的页面不存在"})])}const dt=M(rt,[["render",it],["__scopeId","data-v-99232671"]]),ft={},pt={class:"flex flex-col justify-center page-container"};function mt(t,s){const l=n.NResult;return e.openBlock(),e.createElementBlock("div",pt,[e.createVNode(l,{status:"403",title:"禁止访问",description:"抱歉,你无权访问该页面"})])}const ut=M(ft,[["render",mt],["__scopeId","data-v-3baa9c16"]]),ce=D(st),ie=D(dt),de=D(ut),fe=Y.defineStore("app-oidc",()=>{const t=e.reactive({});return{setCallback:i=>t.callback=i,callCallback:async i=>await t.callback?.(i),setError:i=>t.error=i,callError:async(i,_)=>await t.error?.(i,_)}}),gt={class:"view-auth-callback"},pe=D(M(e.defineComponent({__name:"POidc",setup(t){const s=I.useRouter(),{callCallback:l,callError:p}=fe();return e.onMounted(async()=>{try{await l(s)}catch(u){await p(s,u)}}),(u,i)=>(e.openBlock(),e.createElementBlock("div",gt,[...i[0]||(i[0]=[e.createElementVNode("div",{class:"view-auth-callback-content"},[e.createElementVNode("div",{class:"view-auth-callback-spinner"},[e.createElementVNode("span",null,"正在处理登录回调...")])],-1)])]))}}),[["__scopeId","data-v-167395ae"]])),ht=Object.freeze(Object.defineProperty({__proto__:null,P403:de,P404:ie,P500:ce,PApplication:oe,PEmptyLayout:ee,PIframe:se,PLanguage:ae,PLayout:te,PModal:ne,POidc:pe,PPage:re,PRedirect:le,PTable:Q},Symbol.toStringTag,{value:"Module"})),me=(t,s)=>(Object.values(ht).forEach(l=>{l.install&&t.use(l)}),s?.(),t),_t={install:me};w.P403=de,w.P404=ie,w.P500=ce,w.PApplication=oe,w.PEmptyLayout=ee,w.PIframe=se,w.PLanguage=ae,w.PLayout=te,w.PModal=ne,w.POidc=pe,w.PPage=re,w.PRedirect=le,w.PTable=Q,w.default=_t,w.install=me,w.useLanguageStore=U,w.useLayoutStore=H,w.useOidcStore=fe,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
@@ -1,86 +1,88 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as N, ref as m, watch as B, onMounted as k, openBlock as C, createBlock as L, unref as g } from "vue";
|
|
2
2
|
import { NMenu as O } from "naive-ui";
|
|
3
|
-
import { useRoute as P, useRouter as
|
|
4
|
-
import { useLayoutStore as
|
|
5
|
-
const
|
|
3
|
+
import { useRoute as P, useRouter as S } from "vue-router";
|
|
4
|
+
import { useLayoutStore as U } from "../store.js";
|
|
5
|
+
const y = /* @__PURE__ */ N({
|
|
6
6
|
__name: "PMenus",
|
|
7
7
|
setup(z) {
|
|
8
|
-
const
|
|
8
|
+
const p = m([]), a = P(), h = S(), M = U(), f = m(a.name), s = m(
|
|
9
9
|
a.matched && a.matched.length ? a.matched.map((e) => e.name) : []
|
|
10
10
|
), _ = (e) => {
|
|
11
|
-
a.name !== e && (/http(s)?:/.test(e) ? window.open(e) :
|
|
12
|
-
},
|
|
11
|
+
a.name !== e && (/http(s)?:/.test(e) ? window.open(e) : h.push({ name: e }));
|
|
12
|
+
}, R = (e) => {
|
|
13
13
|
if (!e) return;
|
|
14
|
-
const n = e.find((
|
|
15
|
-
|
|
16
|
-
},
|
|
14
|
+
const n = e.find((r) => s.value.indexOf(r) === -1);
|
|
15
|
+
s.value = n ? [n] : [];
|
|
16
|
+
}, v = () => {
|
|
17
17
|
const e = a.matched;
|
|
18
|
-
|
|
18
|
+
s.value = e.map((r) => r.name);
|
|
19
19
|
const n = a.meta?.activeMenu || "";
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
];
|
|
20
|
+
f.value = n || a.name;
|
|
21
|
+
}, b = [
|
|
22
|
+
"/:path(.*)*",
|
|
23
|
+
"/redirect",
|
|
24
|
+
"/redirect/:path(.*)",
|
|
25
|
+
"/login",
|
|
26
|
+
"/oidc-callback"
|
|
27
|
+
], u = (e, n = [], r = !1) => {
|
|
28
|
+
const d = [];
|
|
29
29
|
if (!e || e.length === 0)
|
|
30
|
-
return
|
|
31
|
-
e = e.sort((o,
|
|
32
|
-
let c = (
|
|
33
|
-
return c === 0 && (c = (o.meta?.sort ?? 0) - (
|
|
30
|
+
return d;
|
|
31
|
+
e = e.sort((o, l) => {
|
|
32
|
+
let c = (l.children?.length ? 1 : 0) - (o.children?.length ? 1 : 0);
|
|
33
|
+
return c === 0 && (c = Number(o.meta?.sort ?? 0) - Number(l.meta?.sort ?? 0)), c;
|
|
34
34
|
});
|
|
35
35
|
for (const o of e) {
|
|
36
|
-
if (
|
|
37
|
-
n.push(o.name),
|
|
36
|
+
if (r || o.meta?.hidden || b.includes(o.path.toLowerCase())) {
|
|
37
|
+
n.push(o.name), u(o.children || [], n, !0);
|
|
38
38
|
continue;
|
|
39
39
|
}
|
|
40
|
-
const
|
|
41
|
-
(B) => !B.meta?.hidden
|
|
42
|
-
) || [], c = o.meta?.alwaysShow != !0 && r.length === 1, t = c ? r[0] : o, v = {
|
|
40
|
+
const l = o.children?.filter((x) => !x.meta?.hidden) || [], c = l.length === 1, t = c ? l[0] : o, i = {
|
|
43
41
|
key: t.name,
|
|
44
42
|
label: t.meta?.title,
|
|
45
43
|
affix: t.meta?.affix,
|
|
46
|
-
sort: c ? o.meta?.sort ?? 0 : t.meta?.sort ?? 0,
|
|
44
|
+
sort: Number(c ? o.meta?.sort ?? 0 : t.meta?.sort ?? 0),
|
|
47
45
|
path: t.path,
|
|
48
46
|
redirect: t.redirect,
|
|
49
47
|
icon: c ? o.meta?.icon : t.meta?.icon,
|
|
50
|
-
|
|
48
|
+
permission: t.meta?.permission,
|
|
51
49
|
meta: t.meta,
|
|
52
50
|
children: void 0
|
|
53
51
|
};
|
|
54
|
-
|
|
52
|
+
if (t.children && t.children.length > 0 && (i.children = u(t.children, n, r), !c && (!i.children || i.children.length === 0))) {
|
|
53
|
+
n.push(t.name);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
n.includes(t.name) || (d.push(i), n.push(t.name));
|
|
55
57
|
}
|
|
56
|
-
return
|
|
57
|
-
},
|
|
58
|
-
const e =
|
|
59
|
-
|
|
58
|
+
return d;
|
|
59
|
+
}, w = () => {
|
|
60
|
+
const e = h.getRoutes();
|
|
61
|
+
p.value = u(e);
|
|
60
62
|
};
|
|
61
|
-
return
|
|
63
|
+
return B(
|
|
62
64
|
() => a.fullPath,
|
|
63
65
|
() => {
|
|
64
|
-
|
|
66
|
+
v();
|
|
65
67
|
}
|
|
66
|
-
),
|
|
67
|
-
|
|
68
|
+
), k(() => {
|
|
69
|
+
w(), v();
|
|
68
70
|
}), (e, n) => (C(), L(g(O), {
|
|
69
71
|
class: "h-full",
|
|
70
72
|
inverted: "",
|
|
71
73
|
mode: "vertical",
|
|
72
|
-
options:
|
|
74
|
+
options: p.value,
|
|
73
75
|
collapsed: g(M).state.collapsed,
|
|
74
76
|
"collapsed-width": 64,
|
|
75
77
|
"collapsed-icon-size": 20,
|
|
76
78
|
indent: 24,
|
|
77
|
-
"expanded-keys":
|
|
78
|
-
value:
|
|
79
|
+
"expanded-keys": s.value,
|
|
80
|
+
value: f.value,
|
|
79
81
|
"onUpdate:value": _,
|
|
80
|
-
"onUpdate:expandedKeys":
|
|
82
|
+
"onUpdate:expandedKeys": R
|
|
81
83
|
}, null, 8, ["options", "collapsed", "expanded-keys", "value"]));
|
|
82
84
|
}
|
|
83
85
|
});
|
|
84
86
|
export {
|
|
85
|
-
|
|
87
|
+
y as default
|
|
86
88
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),q=require("naive-ui"),g=require("vue-router"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),q=require("naive-ui"),g=require("vue-router"),x=require("../store.cjs"),B=a.defineComponent({__name:"PMenus",setup(S){const h=a.ref([]),c=g.useRoute(),p=g.useRouter(),M=x.useLayoutStore(),f=a.ref(c.name),u=a.ref(c.matched&&c.matched.length?c.matched.map(e=>e.name):[]),_=e=>{c.name!==e&&(/http(s)?:/.test(e)?window.open(e):p.push({name:e}))},b=e=>{if(!e)return;const n=e.find(l=>u.value.indexOf(l)===-1);u.value=n?[n]:[]},v=()=>{const e=c.matched;u.value=e.map(l=>l.name);const n=c.meta?.activeMenu||"";f.value=n||c.name},R=["/:path(.*)*","/redirect","/redirect/:path(.*)","/login","/oidc-callback"],d=(e,n=[],l=!1)=>{const m=[];if(!e||e.length===0)return m;e=e.sort((o,s)=>{let r=(s.children?.length?1:0)-(o.children?.length?1:0);return r===0&&(r=Number(o.meta?.sort??0)-Number(s.meta?.sort??0)),r});for(const o of e){if(l||o.meta?.hidden||R.includes(o.path.toLowerCase())){n.push(o.name),d(o.children||[],n,!0);continue}const s=o.children?.filter(N=>!N.meta?.hidden)||[],r=s.length===1,t=r?s[0]:o,i={key:t.name,label:t.meta?.title,affix:t.meta?.affix,sort:Number(r?o.meta?.sort??0:t.meta?.sort??0),path:t.path,redirect:t.redirect,icon:r?o.meta?.icon:t.meta?.icon,permission:t.meta?.permission,meta:t.meta,children:void 0};if(t.children&&t.children.length>0&&(i.children=d(t.children,n,l),!r&&(!i.children||i.children.length===0))){n.push(t.name);continue}n.includes(t.name)||(m.push(i),n.push(t.name))}return m},w=()=>{const e=p.getRoutes();h.value=d(e)};return a.watch(()=>c.fullPath,()=>{v()}),a.onMounted(()=>{w(),v()}),(e,n)=>(a.openBlock(),a.createBlock(a.unref(q.NMenu),{class:"h-full",inverted:"",mode:"vertical",options:h.value,collapsed:a.unref(M).state.collapsed,"collapsed-width":64,"collapsed-icon-size":20,indent:24,"expanded-keys":u.value,value:f.value,"onUpdate:value":_,"onUpdate:expandedKeys":b},null,8,["options","collapsed","expanded-keys","value"]))}});exports.default=B;
|