@chewel611/naive-ui-plus 0.0.34 → 0.0.35

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