@chewel611/naive-ui-plus 0.0.51 → 0.0.52

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 CHANGED
@@ -52,10 +52,8 @@ const Lt = (e) => !e || !e.getBoundingClientRect ? 0 : e.getBoundingClientRect()
52
52
  if (h && h.action)
53
53
  for (const w of h.action) {
54
54
  if (!w.permission) continue;
55
- const L = await $(
56
- w.permission.toLowerCase()
57
- );
58
- L && (u.value[w.permission] = L);
55
+ const L = await $(w.permission);
56
+ u.value[w.permission] = L;
59
57
  }
60
58
  },
61
59
  { immediate: !0 }
@@ -127,32 +125,29 @@ const Lt = (e) => !e || !e.getBoundingClientRect ? 0 : e.getBoundingClientRect()
127
125
  )
128
126
  }
129
127
  );
130
- }, b = async (h, w) => {
128
+ }, b = (h, w) => {
131
129
  l.value && h.push({
132
130
  label: "编辑",
133
131
  key: "edit",
134
132
  icon: () => D(A, null, { default: () => D(ut) }),
135
133
  props: { onClick: async () => await a.onEdit(w) }
136
134
  });
137
- }, s = async (h, w) => {
135
+ }, s = (h, w) => {
138
136
  T.value && h.push({
139
137
  label: "删除",
140
138
  key: "delete",
141
139
  icon: () => D(A, null, { default: () => D(xe) }),
142
140
  props: { onClick: () => re(w) }
143
141
  });
144
- }, W = async (h, w, L) => {
142
+ }, W = (h, w, L) => {
145
143
  if (L)
146
- for (const B of L) {
147
- if (B.key === "edit" || B.key === "delete" || !B.permission || !u.value[B.permission])
148
- return;
149
- h.push({
144
+ for (const B of L)
145
+ B.key === "edit" || B.key === "delete" || B.permission && !u.value[B.permission] || h.push({
150
146
  label: B.name,
151
147
  key: B.key,
152
148
  icon: B.icon && (() => D(A, null, { default: () => D(B.icon) })),
153
149
  props: { onClick: () => B.action(w) }
154
150
  });
155
- }
156
151
  }, G = async () => await F(), re = (h) => se([h]), ce = () => se(Q()), se = (h) => {
157
152
  !h || h.length === 0 || P.warning({
158
153
  title: "警告",
@@ -1 +1 @@
1
- (function(x,a){typeof exports=="object"&&typeof module<"u"?a(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"],a):(x=typeof globalThis<"u"?globalThis:x||self,a(x.naiveplus={},x.naiveUi,x.Vue,x.antd,x.pinia,x.vueRouter,x.elementResizeDetectorMaker,x.Draggable))})(this,(function(x,a,e,E,F,I,me,ue){"use strict";const pe=t=>!t||!t.getBoundingClientRect?0:t.getBoundingClientRect(),he=t=>{const l=document.documentElement,n=l.scrollLeft,m=l.scrollTop,y=l.clientLeft,d=l.clientTop,h=window.pageXOffset,c=window.pageYOffset,S=pe(t),{left:V,top:r,width:P,height:i}=S,C=(h||n)-(y||0),B=(c||m)-(d||0),k=V+h,N=r+c,L=k-C,f=N-B,g=window.document.documentElement.clientWidth,s=window.document.documentElement.clientHeight;return{left:L,top:f,right:g-P-L,bottom:s-i-f,rightIncludeBody:g-L,bottomIncludeBody:s-f}},ge={class:"text-lg font-medium"},_e={id:"data-content"},ye={key:0,class:"rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-4 mb-4"},be=e.defineComponent({__name:"PTable",props:{title:{},idField:{default:"id"},addPermission:{},editPermission:{},deletePermission:{},columns:{},onLoad:{},onDelete:{},onAdd:{},onEdit:{},onCheckPermission:{}},setup(t,{expose:l}){const n=t,m=e.ref(),y=a.useDialog(),d=a.useMessage(),h=e.ref(!1),c=e.ref([]),S=e.ref([]),V=e.ref(!1),r=e.ref(!1),P=e.ref(!1),i=e.ref({}),C=e.computed(()=>r.value||P.value),B=async p=>!p||!n.onCheckPermission?!0:await n.onCheckPermission(p)??!1;e.watch(n,async()=>{V.value=!!n.onAdd&&await B(n.addPermission),r.value=!!n.onEdit&&await B(n.editPermission),P.value=!!n.onDelete&&await B(n.deletePermission);const p=n.columns.find(b=>b.key==="action");if(p&&p.action)for(const b of p.action){if(!b.permission)continue;const w=await B(b.permission.toLowerCase());w&&(i.value[b.permission]=w)}},{immediate:!0});const k=e.ref({page:1,itemCount:0,pageSize:10,pageSizes:[10,20,30,50],showSizePicker:!0,onChange:async p=>{k.value.page=p,await R()},onUpdatePageSize:async p=>{k.value.pageSize=p,await R()}}),N=e.computed(()=>{const p=e.unref(m);if(!p)return;let b=12,w=25;const T=48,z=p?.$el,o=z.querySelector(".n-data-table-thead "),{bottomIncludeBody:u}=he(o),_=z.querySelector(".n-data-table__pagination");if(_){const $=_.offsetHeight;b+=$||0}else b+=28;return u-(T+b+w)}),L=e.computed(()=>{const p=[{type:"selection",fixed:"left"}];n.columns.forEach(w=>{if(w.key!=="action"){p.push({title:w.title,key:w.key,width:w.width,fixed:w.fixed??!1,render:w.render,ellipsis:w.ellipsis?{tooltip:!0}:!1});return}});const b=n.columns.reduce((w,T)=>T.key==="action"?T:w,void 0);return(b||C.value)&&p.push({title:"操作",key:"actions",width:100,fixed:"right",render:w=>f(w,b?.action)}),p}),f=(p,b)=>{const w=[];return g(w,p),s(w,p),D(w,p,b),w.length<=0?null:e.h(a.NDropdown,{options:w,placement:"bottom-start"},{default:()=>e.h(a.NButton,{size:"small",type:"primary"},{default:()=>["操作",e.h(a.NIcon,()=>e.h(E.MoreOutlined))]})})},g=async(p,b)=>{r.value&&p.push({label:"编辑",key:"edit",icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.EditOutlined)}),props:{onClick:async()=>await n.onEdit(b)}})},s=async(p,b)=>{P.value&&p.push({label:"删除",key:"delete",icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.DeleteOutlined)}),props:{onClick:()=>K(b)}})},D=async(p,b,w)=>{if(w)for(const T of w){if(T.key==="edit"||T.key==="delete"||!T.permission||!i.value[T.permission])return;p.push({label:T.name,key:T.key,icon:T.icon&&(()=>e.h(a.NIcon,null,{default:()=>e.h(T.icon)})),props:{onClick:()=>T.action(b)}})}},q=async()=>await R(),K=p=>W([p]),Y=()=>W(j()),W=p=>{!p||p.length===0||y.warning({title:"警告",content:"删除数据不可恢复, 确认删除吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(n.onDelete)try{await n.onDelete(p)?(R(),d.success("删除成功")):d.error("删除失败")}catch(b){d.error(b.message)}}})},R=async()=>{if(n.onLoad&&!h.value){h.value=!0;try{var{items:p,totalCount:b}=await n.onLoad(k.value.page,k.value.pageSize);S.value=p,k.value.itemCount=b}catch(w){d.error(w.message)}finally{h.value=!1}}},j=()=>c.value?S.value.filter(p=>c.value.includes(p.id)).map(p=>e.toRaw(p)):[],X=()=>j()[0],J=()=>e.toRaw(S.value);return e.onMounted(async()=>await R()),l({getData:J,getSelectedRow:X,getSelectedRows:j,refreshData:R,resetPage:()=>{k.value.page=1}}),(p,b)=>{const w=a.NTooltip,T=a.NSpace,z=a.NDataTable;return e.openBlock(),e.createBlock(e.unref(a.NCard),{bordered:!1},{header:e.withCtx(()=>[e.createVNode(T,{justify:"space-between",align:"center",class:"w-full"},{default:e.withCtx(()=>[e.createElementVNode("span",ge,e.toDisplayString(t.title),1),e.createVNode(T,null,{default:e.withCtx(()=>[V.value?(e.openBlock(),e.createBlock(w,{key:0,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(a.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:n.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),P.value?(e.openBlock(),e.createBlock(w,{key:1,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(a.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:Y},{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(w,{trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(a.NIcon),{size:"18",class:"cursor-pointer hover:text-blue-600",onClick:q},{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",_e,[p.$slots.toolbar?(e.openBlock(),e.createElementBlock("div",ye,[e.renderSlot(p.$slots,"toolbar")])):e.createCommentVNode("",!0),e.createVNode(z,{remote:"",ref_key:"$table",ref:m,"checked-row-keys":c.value,"onUpdate:checkedRowKeys":b[0]||(b[0]=o=>c.value=o),"max-height":N.value,loading:h.value,bordered:!1,"single-line":!1,columns:L.value,data:S.value,pagination:k.value,"row-key":o=>o[t.idField]},null,8,["checked-row-keys","max-height","loading","columns","data","pagination","row-key"])])]),_:3})}}}),O=(t,l)=>{const n=l;return n.install=function(m){m.component(t,l)},l},Z=O("PTable",be),ke=["Redirect","RedirectSon","login"],A=F.defineStore("p-layout",()=>{const t=e.reactive({collapsed:!1,title:"输入项目名称",logo:"https://picsum.photos/id/1/100/100",avatar:"",uid:"",uname:"",tabs:[],menus:[],cacheTabs:!1,enableLanguage:!1});return{state:t,initMenus:f=>{f.sort((g,s)=>g.affix&&!s.affix?-1:!g.affix&&s.affix?1:Number(s.sort??0)-Number(g.sort??0)),t.menus=f},getMenus:()=>t.menus,initTabs:f=>{f.sort((g,s)=>g.meta.affix&&!s.meta.affix?-1:!g.meta.affix&&s.meta.affix?1:Number(s.meta.sort??0)-Number(g.meta.sort??0)),t.tabs=f},addTab:f=>ke.includes(f.name)?!1:(t.tabs?.some(s=>s.fullPath==f.fullPath)||t.tabs?.push(f),!0),getCurrentTab:()=>{const f=I.useRoute();return t.tabs.find(g=>g.fullPath==f.fullPath)},closeCurrentTab:f=>{const g=t.tabs.findIndex(s=>s.fullPath==f.fullPath);t.tabs.splice(g,1)},closeAllTabs:()=>{t.tabs=t.tabs.filter(f=>f?.meta?.affix??!1)},closeOtherTabs:f=>{t.tabs=t.tabs.filter(g=>g.fullPath==f.fullPath||(g?.meta?.affix??!1))},closeLeftTabs:f=>{const g=t.tabs.findIndex(s=>s.fullPath==f.fullPath);t.tabs=t.tabs.filter((s,D)=>D>=g||(s?.meta?.affix??!1))},closeRightTabs:f=>{const g=t.tabs.findIndex(s=>s.fullPath==f.fullPath);t.tabs=t.tabs.filter((s,D)=>D<=g||(s?.meta?.affix??!1))},collapse:()=>{t.collapsed=!t.collapsed},setTitle:f=>{t.title=f},setLogo:f=>{t.logo=f},setUser:(f,g)=>{t.uid=f,t.uname=g},setSettingPages:f=>{t.settingPages=f},setLogout:f=>{t.logout=f},enableLanguage:f=>{t.enableLanguage=f}}}),we={class:"logo"},Ce=e.defineComponent({__name:"PLogo",setup(t){const l=A();return(n,m)=>(e.openBlock(),e.createElementBlock("div",we,[e.createVNode(e.unref(a.NAvatar),{color:"var(--color-logo)",size:32,src:e.unref(l).state.logo,class:e.normalizeClass({"mr-2":!e.unref(l).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(l).state.title),513),[[e.vShow,!e.unref(l).state.collapsed]])]))}}),M=(t,l)=>{const n=t.__vccOpts||t;for(const[m,y]of l)n[m]=y;return n},Ne=M(Ce,[["__scopeId","data-v-e48aeefa"]]),Pe={translationApiUrl:"https://translate.zvo.cn/api",defaultLanguage:"chinese",currentLanguage:"",options:[],initLanguages:async()=>[],selectLanguage:async t=>{}},G=F.defineStore("language",()=>{const t=e.ref(Pe),l=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 P=(await l()).find(i=>i.key===r);P&&(t.value.currentLanguage=P.key,t.value.selectLanguage(P))},selectLanguageCallback:async r=>{t.value.selectLanguage=r},initLanguagesCallback:async r=>{t.value.initLanguages=r},getLanguages:l,getCurrentLanguage:async()=>{if(t.value.currentLanguage)return(await l()).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}}}),xe={key:1},Q=e.defineComponent({__name:"PLanguage",setup(t){const{select:l,getLanguages:n,getCurrentLanguage:m,getDefaultLanguage:y,getTranslationApiUrl:d}=G(),h=e.ref(),c=e.ref([]),S=async r=>await l(r),V=async()=>{const r=window.translate;r&&(r.selectLanguageTag.show=!1,r.selectLanguageTag.languages=(await n()).map(P=>P.key).join(","),r.ignore.class.push("ignore-translate-flag"),r.ignore.id.push("ignore-translation"),r.language.setLocal(y()),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(d()),r.request.listener.start(),r.listener.start(),r.whole.enableAll(),r.execute())};return e.onMounted(async()=>{await e.nextTick(),await V(),h.value=await m(),c.value=await n()}),(r,P)=>{const i=a.NIcon,C=a.NButton;return c.value.length>0?(e.openBlock(),e.createBlock(e.unref(a.NDropdown),{key:0,id:"ignore-translation",placement:"bottom-start",trigger:"hover",class:"flex flex-col justify-center h-full ignore",onSelect:S,options:c.value},{default:e.withCtx(()=>[e.createVNode(C,{quaternary:"",type:"info"},{default:e.withCtx(()=>[h.value?(e.openBlock(),e.createElementBlock("label",xe,e.toDisplayString(h.value?.label),1)):(e.openBlock(),e.createBlock(i,{key:0,size:"18"},{default:e.withCtx(()=>[...P[0]||(P[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)}}}),Be={class:"layout-header"},Ve={class:"layout-header-left"},Le={class:"link-text"},Se={key:1,class:"link-text"},Ee={class:"layout-header-right"},Te={key:0,class:"layout-header-trigger-min"},$e={class:"layout-header-trigger layout-header-trigger-min"},Oe={class:"layout-header-trigger layout-header-trigger-min"},De={class:"avatar"},Ie=M(e.defineComponent({__name:"PHeader",setup(t){const l=a.useMessage(),n=a.useDialog(),m=A(),y=I.useRouter(),d=I.useRoute(),h=e.inject("reloadPage"),c=k=>y.push({name:k}),S=e.computed(()=>V(d.matched)),V=k=>k.map(N=>{const L={key:N.name,label:N.meta.title,icon:N.meta.icon,meta:N.meta,disabled:N.path==="/",children:void 0};return N.children&&N.children.length>0&&(L.children=V(N.children)),L}),r=e.ref(!1),P=()=>{document.fullscreenElement?document.exitFullscreen&&(document.exitFullscreen(),r.value=!1):(document.documentElement.requestFullscreen(),r.value=!0)},i=e.computed(()=>{const k=[];return k.push({label:"退出登录",key:"logout"}),m.state.settingPages&&m.state.settingPages.length>0&&m.state.settingPages.forEach(N=>{k.push({label:N.title,key:N.route})}),k}),C=k=>{k==="logout"?B():y.push({name:k})},B=()=>{n.info({title:"提示",content:"您确定要退出登录吗",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(m.state.logout)try{await m.state.logout(),localStorage.removeItem("TABS-ROUTES"),l.error("退出成功")}catch(k){console.error(k),l.error("退出登录失败")}finally{location.reload()}else l.error("没有配置登出接口, 请配置[usePLayoutStore.logout]方法")},onNegativeClick:()=>{}})};return(k,N)=>{const L=a.NTooltip,f=a.NDivider,g=a.NAvatar;return e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("div",Ve,[e.createElementVNode("div",{class:"ml-1 layout-header-trigger layout-header-trigger-min",onClick:N[0]||(N[0]=(...s)=>e.unref(m).collapse&&e.unref(m).collapse(...s))},[e.unref(m).state.collapsed?(e.openBlock(),e.createBlock(e.unref(a.NIcon),{key:0,size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.MenuUnfoldOutlined))]),_:1})):(e.openBlock(),e.createBlock(e.unref(a.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:N[1]||(N[1]=(...s)=>e.unref(h)&&e.unref(h)(...s))},[e.createVNode(e.unref(a.NIcon),{size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.ReloadOutlined))]),_:1})]),e.createVNode(e.unref(a.NBreadcrumb),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,s=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:s.label},[s.label?(e.openBlock(),e.createBlock(e.unref(a.NBreadcrumbItem),{key:0},{default:e.withCtx(()=>[s.children&&s.children.length?(e.openBlock(),e.createBlock(e.unref(a.NDropdown),{key:0,options:s.children,onSelect:c},{default:e.withCtx(()=>[e.createElementVNode("span",Le,[s.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(s.label),1)])]),_:2},1032,["options"])):(e.openBlock(),e.createElementBlock("span",Se,[s.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(s.label),1)]))]),_:2},1024)):e.createCommentVNode("",!0)],64))),128))]),_:1})]),e.createElementVNode("div",Ee,[e.unref(m).state.enableLanguage?(e.openBlock(),e.createElementBlock("div",Te,[e.createVNode(Q)])):e.createCommentVNode("",!0),e.createElementVNode("div",$e,[e.createVNode(L,{placement:"bottom"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(a.NIcon),{size:"18",onClick:e.withModifiers(P,["stop"])},{default:e.withCtx(()=>[r.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(()=>[N[2]||(N[2]=e.createElementVNode("span",null,"全屏",-1))]),_:1})]),e.createElementVNode("div",Oe,[e.createVNode(e.unref(a.NDropdown),{trigger:"hover",onSelect:C,options:i.value},{default:e.withCtx(()=>[e.createElementVNode("div",De,[e.createElementVNode("span",null,e.toDisplayString(e.unref(m).state.uname),1),e.createVNode(f,{vertical:""}),e.createVNode(g,{round:"",src:e.unref(m).state.avatar},null,8,["src"])])]),_:1},8,["options"])])])])}}}),[["__scopeId","data-v-563e4e55"]]),Me={class:"mt-1"},Re=e.defineComponent({__name:"PContent",props:{loading:{type:Boolean,default:!1}},setup(t){return(l,n)=>{const m=e.resolveComponent("RouterView");return e.openBlock(),e.createElementBlock("div",Me,[t.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(m,{key:0},{default:e.withCtx(({Component:y,route:d})=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(y),{key:d.fullPath}))],1024))]),_:1}))])}}}),Ae={class:"tabs-view-main"},ze=["id","onClick","onContextmenu"],qe={class:"tabs-close"},je={class:"tabs-close-btn"},He=M(e.defineComponent({__name:"PTabs",setup(t){e.useCssVars(o=>({v4f917f8c:n.value,v1c2fb72a:m.value}));const l=a.useThemeVars(),n=e.computed(()=>l.value.cardColor),m=e.computed(()=>l.value.textColor1),y=a.useMessage(),d=I.useRoute(),h=I.useRouter(),c=e.ref(null),S=e.ref(null),V=e.ref(!1),r=A(),P=e.computed(()=>r.state.tabs),i=e.reactive({activeKey:d.fullPath,scrollable:!0,dropdownX:0,dropdownY:0,showDropdown:!1,isMultiHeaderFixed:!0,multiTabsSetting:!0}),C=["Login","Redirect","ErrorPage"],B=o=>({meta:o.meta,name:o.name,fullPath:o.fullPath??o.path,path:o.path,hash:o.hash??"",query:o.query??{},params:o.params??{}}),k=e.computed(()=>{const _=r.state.collapsed?"64px":"272px";return{left:_,width:`calc(100% - ${_})`}}),N=e.computed(()=>{const o=P.value.length<=1;return[{label:"刷新当前",key:"1",icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.ReloadOutlined)})},{label:"关闭当前",key:"2",disabled:V.value||o,icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.CloseOutlined)})},{label:"关闭其他",key:"3",disabled:o,icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.ColumnWidthOutlined)})},{label:"关闭全部",key:"4",disabled:o,icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.MinusOutlined)})}]}),L=()=>{let o=[B(d)];h.getRoutes().filter(u=>u.meta.affix).forEach(u=>{const _=B(u);o.every($=>$.name!==_.name)&&o.push(_)});try{if(r.state.cacheTabs){const u=localStorage.getItem("TABS_ROUTES");o=u?JSON.parse(u):o}}finally{return o}},f=o=>{const u=h.getRoutes();o.forEach(_=>{const $=u.find(H=>H.path===_.path);$&&(_.meta=$.meta||_.meta,_.name=$.name||_.name)}),r.state.cacheTabs&&localStorage.setItem("TABS_ROUTES",JSON.stringify(o))},g=()=>{const o=L();f(o),r.initTabs(o)},s=async o=>{if(await e.nextTick(),!c.value)return;const u=c.value.offsetWidth,_=c.value.scrollWidth;u<_?(i.scrollable=!0,o&&[...c.value.querySelectorAll(".tabs-card-scroll-item")||[]].forEach(H=>{H.id===`tag${i.activeKey.split("/").join("/")}`&&H.scrollIntoView&&H.scrollIntoView()})):i.scrollable=!1},D=o=>!(o.draggedContext.element.meta.affix||o.relatedContext.element.meta.affix),q=()=>{let o;o=me(),o.listenTo(S.value,()=>s(!0))},K=o=>{if(!o||o.fullPath===d.fullPath)return;if(i.activeKey=o.fullPath,toString.call(o)==="[object String]"){h.replace(o).catch(console.error);return}const u=o;h.replace(u).catch(console.error)},Y=(o,u)=>{o.preventDefault(),V.value=u.path==="/home",i.showDropdown=!1,e.nextTick().then(()=>{i.showDropdown=!0,i.dropdownX=o.clientX,i.dropdownY=o.clientY})},W=()=>{if(d.meta.keepAlive){var o=h.currentRoute.value.matched.find(u=>u.name==d.name);o&&o.components?.default?.name}},R=o=>{if(P.value.length===1)return y.warning("这已经是最后一页,不能再关闭了!");if(W(),r.closeCurrentTab(o),i.activeKey===o.fullPath){const u=P.value[Math.max(0,P.value.length-1)];i.activeKey=u.fullPath,h.push(u)}s()},j=o=>{const u=P.value.find(_=>_.fullPath==o.fullPath);u&&R(u)},X=o=>{r.closeOtherTabs(o),i.activeKey=o.fullPath,s()},J=()=>{r.closeAllTabs(),s()},p=e.inject("reloadPage"),b=o=>{switch(o){case"1":p();break;case"2":R(d);break;case"3":X(d);break;case"4":J();break}s(),i.showDropdown=!1},w=(o,u)=>{const _=c.value.scrollLeft,$=u>0&&_+u>=o||u<0&&_+u<=o?o:_+u;if(c.value&&c.value.scrollTo($,0),$!==o)return window.requestAnimationFrame(()=>w(o,u))},T=()=>{const o=c.value.offsetWidth,u=c.value.scrollLeft;if(!u)return;const _=u>o?u-o:0;w(_,(_-u)/20)},z=()=>{const o=c.value.offsetWidth,u=c.value.scrollWidth,_=c.value.scrollLeft;if(u-_<=o)return;const $=u-_>o*2?_+o:u-o;w($,($-_)/20)};return window.addEventListener("beforeunload",()=>{r.state.cacheTabs&&localStorage.setItem("TABS_ROUTES",JSON.stringify(P.value))}),window.addEventListener("scroll",o=>{let u=o.target.scrollTop||document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop;i.isMultiHeaderFixed=u>=64},!0),e.watch(()=>d.fullPath,o=>{C.includes(d.name)||(i.activeKey=o,r.addTab(B(d)),s(!0))},{immediate:!0}),g(),e.onMounted(()=>q()),(o,u)=>(e.openBlock(),e.createElementBlock("div",{class:"box-border tabs-view tabs-view-fix tabs-view-default-background",style:e.normalizeStyle(k.value)},[e.createElementVNode("div",Ae,[e.createElementVNode("div",{ref_key:"navWrap",ref:S,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:T},[e.createVNode(e.unref(a.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:z},[e.createVNode(e.unref(a.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.RightOutlined))]),_:1})],2),e.createElementVNode("div",{ref_key:"navScroll",ref:c,class:"tabs-card-scroll"},[e.createVNode(e.unref(ue),{animation:"300","item-key":"fullPath",class:"flex",list:P.value,move:D},{item:e.withCtx(({element:_})=>[e.createElementVNode("div",{class:e.normalizeClass(["tabs-card-scroll-item",{"active-item":i.activeKey===_.fullPath}]),id:`tag${_.fullPath.split("/").join("/")}`,onClick:e.withModifiers($=>K(_),["stop"]),onContextmenu:$=>Y($,_)},[e.createElementVNode("span",null,e.toDisplayString(_.meta.title),1),_.meta.affix?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(a.NIcon),{key:0,size:"14",onClick:e.withModifiers($=>j(_),["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(E.CloseOutlined))]),_:1},8,["onClick"]))],42,ze)]),_:1},8,["list"])],512)],2),e.createElementVNode("div",qe,[e.createVNode(e.unref(a.NDropdown),{trigger:"hover",placement:"bottom-end",options:N.value,onSelect:b},{default:e.withCtx(()=>[e.createElementVNode("div",je,[e.createVNode(e.unref(a.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.DownOutlined))]),_:1})])]),_:1},8,["options"])]),e.createVNode(e.unref(a.NDropdown),{placement:"bottom-start",show:i.showDropdown,x:i.dropdownX,y:i.dropdownY,options:N.value,onClickoutside:u[0]||(u[0]=_=>i.showDropdown=!1),onSelect:b},null,8,["show","x","y","options"])])],4))}}),[["__scopeId","data-v-50f5202c"]]),We=e.defineComponent({__name:"PMenus",setup(t){const l=e.ref([]),n=I.useRoute(),m=I.useRouter(),y=A(),d=e.ref(n.name),h=e.ref(n.matched&&n.matched.length?n.matched.map(C=>C.name):[]),c=C=>{n.name!==C&&(/http(s)?:/.test(C)?window.open(C):m.push({name:C}))},S=C=>{if(!C)return;const B=C.find(k=>h.value.indexOf(k)===-1);h.value=B?[B]:[]},V=()=>{const C=n.matched;h.value=C.map(k=>k.name);const B=n.meta?.activeMenu||"";d.value=B||n.name},r=["/:path(.*)*","/redirect","/redirect/:path(.*)","/login","/oidc-callback"],P=(C,B=[],k=!1)=>{const N=[];if(!C||C.length===0)return N;C=C.sort((L,f)=>{let g=(f.children?.length?1:0)-(L.children?.length?1:0);return g===0&&(g=Number(L.meta?.sort??0)-Number(f.meta?.sort??0)),g});for(const L of C){if(k||L.meta?.hidden||r.includes(L.path.toLowerCase())){B.push(L.name),P(L.children||[],B,!0);continue}const f=L.children?.filter(q=>!q.meta?.hidden)||[],g=f.length===1,s=g?f[0]:L,D={key:s.name,label:s.meta?.title,affix:s.meta?.affix,sort:Number(g?L.meta?.sort??0:s.meta?.sort??0),path:s.path,redirect:s.redirect,icon:g?L.meta?.icon:s.meta?.icon,permission:s.meta?.permission,meta:s.meta,children:void 0};if(s.children&&s.children.length>0&&(D.children=P(s.children,B,k),!g&&(!D.children||D.children.length===0))){B.push(s.name);continue}B.includes(s.name)||(N.push(D),B.push(s.name))}return N},i=()=>{const C=m.getRoutes();l.value=P(C)};return e.watch(()=>n.fullPath,()=>{V()}),e.onMounted(()=>{i(),V()}),(C,B)=>(e.openBlock(),e.createBlock(e.unref(a.NMenu),{class:"h-full",inverted:"",mode:"vertical",options:l.value,collapsed:e.unref(y).state.collapsed,"collapsed-width":64,"collapsed-icon-size":20,indent:24,"expanded-keys":h.value,value:d.value,"onUpdate:value":c,"onUpdate:expandedKeys":S},null,8,["options","collapsed","expanded-keys","value"]))}}),Fe={class:"layout-content-main layout-content-main-fix"},Ke={class:"main-view main-view-fix"},Ye=M(e.defineComponent({__name:"PLayout",setup(t){const l=A(),n=e.ref(!1),m=()=>{n.value=!0,e.nextTick(()=>n.value=!1)};return e.provide("reloadPage",m),(y,d)=>{const h=a.NBackTop;return e.openBlock(),e.createBlock(e.unref(a.NLayout),{"has-sider":"",class:"layout",position:"absolute"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.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(l).state.collapsed,"native-scrollbar":!1,"collapsed-width":64,onCollapse:e.unref(l).collapse,onExpand:e.unref(l).collapse},{default:e.withCtx(()=>[e.createVNode(e.unref(a.NFlex),{vertical:""},{default:e.withCtx(()=>[e.createVNode(Ne),e.createVNode(We)]),_:1})]),_:1},8,["collapsed","onCollapse","onExpand"]),e.createVNode(e.unref(a.NLayout),null,{default:e.withCtx(()=>[e.createVNode(e.unref(a.NLayoutHeader),{position:"absolute"},{default:e.withCtx(()=>[e.createVNode(Ie)]),_:1}),e.createVNode(e.unref(a.NLayoutContent),{class:"layout-content layout-default-background"},{default:e.withCtx(()=>[e.createElementVNode("div",Fe,[e.createVNode(He),e.createElementVNode("div",Ke,[e.createVNode(Re,{loading:n.value},null,8,["loading"])])])]),_:1}),e.createVNode(h,{right:20,class:"z-50"})]),_:1})]),_:1})}}}),[["__scopeId","data-v-0bac2e7d"]]),Xe={};function Je(t,l){const n=e.resolveComponent("router-view");return e.openBlock(),e.createBlock(n)}const U=O("PEmptyLayout",M(Xe,[["render",Je]])),v=O("PLayout",Ye),ee=O("PApplication",e.defineComponent({__name:"PApplication",props:{theme:{},themeOverrides:{default:{common:{primaryColor:"#2d8cf0",primaryColorHover:"#3c9bff",primaryColorPressed:"#3c9bff",primaryColorSuppl:"#2d8cf0"},LoadingBar:{colorLoading:"#2d8cf0"}}}},setup(t){return(l,n)=>{const m=a.NConfigProvider;return e.openBlock(),e.createBlock(m,{locale:e.unref(a.zhCN),theme:t.theme,"theme-overrides":t.themeOverrides,"date-locale":e.unref(a.dateZhCN)},{default:e.withCtx(()=>[e.createVNode(e.unref(a.NDialogProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(a.NNotificationProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(a.NMessageProvider),null,{default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3})]),_:3})]),_:3})]),_:3},8,["locale","theme","theme-overrides","date-locale"])}}})),te=O("PModal",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:l,emit:n}){const m=a.useMessage(),y=e.ref(!1),d=e.ref(!1),h=n,c=t,S=async()=>{try{y.value=!0,c.onSave&&await c.onSave()&&V()}catch(i){i instanceof Error&&m.error(i.message),console.error(i)}finally{y.value=!1}},V=()=>{y.value=!1,d.value=!1,h("update:visible",!1)},r=async()=>{try{d.value=!0,c.onClose?await c.onClose()&&V():V()}catch(i){m.error(i.message)}finally{d.value=!1}};return l({open:()=>{y.value=!1,d.value=!1,h("update:visible",!0)},close:V}),(i,C)=>{const B=a.NText,k=a.NButton,N=a.NSpace;return e.openBlock(),e.createBlock(e.unref(a.NModal),e.mergeProps({ref:"$modal",preset:"card"},i.$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:V,onAfterEnter:c.onAfterEnter,onAfterLeave:c.onAfterLeave,onUpdateVisible:c.onUpdateVisible}),{header:e.withCtx(()=>[i.$slots.header?e.renderSlot(i.$slots,"header",{key:0}):c.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(i.$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(i.$slots,"default")],4)]),footer:e.withCtx(()=>[e.renderSlot(i.$slots,"footer")]),action:e.withCtx(()=>[e.createVNode(N,{justify:"end"},{default:e.withCtx(()=>[c.hideSaveBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(k,{key:0,type:"primary",loading:y.value,onClick:S},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.saveBtnText),1)]),_:1},8,["loading"])),e.renderSlot(i.$slots,"action-extra"),c.hideCancelBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(k,{key:1,loading:d.value,onClick:r},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.cancelBtnText),1)]),_:1},8,["loading"]))]),_:3})]),_:3},16,["show","style","onAfterEnter","onAfterLeave","onUpdateVisible"])}}})),oe=O("PLanguage",Q),Ze=e.defineComponent({name:"Redirect",setup(){const t=I.useRoute(),l=I.useRouter();return e.onBeforeMount(()=>{const{params:n,query:m}=t,{path:y}=n;l.replace({path:"/"+(Array.isArray(y)?y.join("/"):y),query:m})}),()=>React.createElement(a.NEmpty,null)}}),ne=O("PRedirect",Ze),Ge={class:"frame"},Qe=["src"],ae=O("PIframe",M(e.defineComponent({__name:"PIframe",setup(t){const l=I.useRoute(),n=e.ref(!1),m=e.ref(null),y=e.ref("");e.unref(l.meta)?.frameSrc&&(y.value=e.unref(l.meta)?.frameSrc);function d(){n.value=!1}function h(){e.nextTick(()=>{const c=e.unref(m);if(!c)return;const S=c;S.attachEvent?S.attachEvent("onload",()=>{d()}):c.onload=()=>{d()}})}return e.onMounted(()=>{n.value=!0,h()}),(c,S)=>{const V=a.NSpin;return e.openBlock(),e.createBlock(V,{show:n.value},{default:e.withCtx(()=>[e.createElementVNode("div",Ge,[e.createElementVNode("iframe",{src:y.value,class:"frame-iframe",ref_key:"frameRef",ref:m},null,8,Qe)])]),_:1},8,["show"])}}}),[["__scopeId","data-v-161a378e"]])),Ue={class:"border border-gray-100 rounded-lg"},ve={class:"text-xl font-semibold text-gray-800"},et={class:"text-sm text-gray-500 mt-1"},le=O("PPage",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 l=t;return(n,m)=>{const y=a.NIcon,d=a.NAvatar,h=a.NSpace,c=a.NCard;return e.openBlock(),e.createElementBlock("div",Ue,[l.title?(e.openBlock(),e.createBlock(c,{key:0,class:"mb-4",bordered:!1,"content-class":"py-4"},{default:e.withCtx(()=>[e.createVNode(h,{align:"center",justify:"space-between"},{default:e.withCtx(()=>[e.createVNode(h,{align:"center",size:16},{default:e.withCtx(()=>[l.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(y,{size:24,component:l.icon,color:"#fff"},null,8,["component"])]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",null,[e.createElementVNode("div",ve,e.toDisplayString(l.title),1),e.createElementVNode("div",et,e.toDisplayString(l.subtitle??l.title+"主页"),1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),n.$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(n.$slots,"search")]),_:3})):e.createCommentVNode("",!0),n.$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(n.$slots,"default")]),_:3})):e.createCommentVNode("",!0)])}}})),tt={},ot={class:"flex flex-col justify-center page-container"};function nt(t,l){const n=a.NResult;return e.openBlock(),e.createElementBlock("div",ot,[e.createVNode(n,{status:"500",title:"服务器错误",description:"抱歉,服务器出错了"})])}const at=M(tt,[["render",nt],["__scopeId","data-v-89cb65c7"]]),lt={},st={class:"flex flex-col justify-center page-container"};function rt(t,l){const n=a.NResult;return e.openBlock(),e.createElementBlock("div",st,[e.createVNode(n,{status:"404",title:"资源不存在",description:"抱歉,你访问的页面不存在"})])}const ct=M(lt,[["render",rt],["__scopeId","data-v-99232671"]]),it={},dt={class:"flex flex-col justify-center page-container"};function ft(t,l){const n=a.NResult;return e.openBlock(),e.createElementBlock("div",dt,[e.createVNode(n,{status:"403",title:"禁止访问",description:"抱歉,你无权访问该页面"})])}const mt=M(it,[["render",ft],["__scopeId","data-v-3baa9c16"]]),se=O("P500",at),re=O("P404",ct),ce=O("P403",mt),ie=F.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,h)=>await t.error?.(d,h)}}),ut={class:"view-auth-callback"},de=O("POidc",M(e.defineComponent({__name:"POidc",setup(t){const l=I.useRouter(),{callCallback:n,callError:m}=ie();return e.onMounted(async()=>{try{await n(l)}catch(y){await m(l,y)}}),(y,d)=>(e.openBlock(),e.createElementBlock("div",ut,[...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"]])),pt=Object.freeze(Object.defineProperty({__proto__:null,P403:ce,P404:re,P500:se,PApplication:ee,PEmptyLayout:U,PIframe:ae,PLanguage:oe,PLayout:v,PModal:te,POidc:de,PPage:le,PRedirect:ne,PTable:Z},Symbol.toStringTag,{value:"Module"})),fe=(t,l)=>(Object.values(pt).forEach(n=>{n.install&&t.use(n)}),l?.(),t),ht={install:fe};x.P403=ce,x.P404=re,x.P500=se,x.PApplication=ee,x.PEmptyLayout=U,x.PIframe=ae,x.PLanguage=oe,x.PLayout=v,x.PModal=te,x.POidc=de,x.PPage=le,x.PRedirect=ne,x.PTable=Z,x.default=ht,x.install=fe,x.useLanguageStore=G,x.useLayoutStore=A,x.useOidcStore=ie,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(x,a){typeof exports=="object"&&typeof module<"u"?a(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"],a):(x=typeof globalThis<"u"?globalThis:x||self,a(x.naiveplus={},x.naiveUi,x.Vue,x.antd,x.pinia,x.vueRouter,x.elementResizeDetectorMaker,x.Draggable))})(this,(function(x,a,e,E,F,I,me,ue){"use strict";const pe=t=>!t||!t.getBoundingClientRect?0:t.getBoundingClientRect(),he=t=>{const l=document.documentElement,n=l.scrollLeft,m=l.scrollTop,y=l.clientLeft,d=l.clientTop,h=window.pageXOffset,c=window.pageYOffset,S=pe(t),{left:V,top:r,width:P,height:i}=S,C=(h||n)-(y||0),B=(c||m)-(d||0),k=V+h,N=r+c,L=k-C,f=N-B,g=window.document.documentElement.clientWidth,s=window.document.documentElement.clientHeight;return{left:L,top:f,right:g-P-L,bottom:s-i-f,rightIncludeBody:g-L,bottomIncludeBody:s-f}},ge={class:"text-lg font-medium"},_e={id:"data-content"},ye={key:0,class:"rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-4 mb-4"},be=e.defineComponent({__name:"PTable",props:{title:{},idField:{default:"id"},addPermission:{},editPermission:{},deletePermission:{},columns:{},onLoad:{},onDelete:{},onAdd:{},onEdit:{},onCheckPermission:{}},setup(t,{expose:l}){const n=t,m=e.ref(),y=a.useDialog(),d=a.useMessage(),h=e.ref(!1),c=e.ref([]),S=e.ref([]),V=e.ref(!1),r=e.ref(!1),P=e.ref(!1),i=e.ref({}),C=e.computed(()=>r.value||P.value),B=async p=>!p||!n.onCheckPermission?!0:await n.onCheckPermission(p)??!1;e.watch(n,async()=>{V.value=!!n.onAdd&&await B(n.addPermission),r.value=!!n.onEdit&&await B(n.editPermission),P.value=!!n.onDelete&&await B(n.deletePermission);const p=n.columns.find(b=>b.key==="action");if(p&&p.action)for(const b of p.action){if(!b.permission)continue;const w=await B(b.permission);i.value[b.permission]=w}},{immediate:!0});const k=e.ref({page:1,itemCount:0,pageSize:10,pageSizes:[10,20,30,50],showSizePicker:!0,onChange:async p=>{k.value.page=p,await R()},onUpdatePageSize:async p=>{k.value.pageSize=p,await R()}}),N=e.computed(()=>{const p=e.unref(m);if(!p)return;let b=12,w=25;const T=48,z=p?.$el,o=z.querySelector(".n-data-table-thead "),{bottomIncludeBody:u}=he(o),_=z.querySelector(".n-data-table__pagination");if(_){const $=_.offsetHeight;b+=$||0}else b+=28;return u-(T+b+w)}),L=e.computed(()=>{const p=[{type:"selection",fixed:"left"}];n.columns.forEach(w=>{if(w.key!=="action"){p.push({title:w.title,key:w.key,width:w.width,fixed:w.fixed??!1,render:w.render,ellipsis:w.ellipsis?{tooltip:!0}:!1});return}});const b=n.columns.reduce((w,T)=>T.key==="action"?T:w,void 0);return(b||C.value)&&p.push({title:"操作",key:"actions",width:100,fixed:"right",render:w=>f(w,b?.action)}),p}),f=(p,b)=>{const w=[];return g(w,p),s(w,p),D(w,p,b),w.length<=0?null:e.h(a.NDropdown,{options:w,placement:"bottom-start"},{default:()=>e.h(a.NButton,{size:"small",type:"primary"},{default:()=>["操作",e.h(a.NIcon,()=>e.h(E.MoreOutlined))]})})},g=(p,b)=>{r.value&&p.push({label:"编辑",key:"edit",icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.EditOutlined)}),props:{onClick:async()=>await n.onEdit(b)}})},s=(p,b)=>{P.value&&p.push({label:"删除",key:"delete",icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.DeleteOutlined)}),props:{onClick:()=>K(b)}})},D=(p,b,w)=>{if(w)for(const T of w)T.key==="edit"||T.key==="delete"||T.permission&&!i.value[T.permission]||p.push({label:T.name,key:T.key,icon:T.icon&&(()=>e.h(a.NIcon,null,{default:()=>e.h(T.icon)})),props:{onClick:()=>T.action(b)}})},q=async()=>await R(),K=p=>W([p]),Y=()=>W(j()),W=p=>{!p||p.length===0||y.warning({title:"警告",content:"删除数据不可恢复, 确认删除吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(n.onDelete)try{await n.onDelete(p)?(R(),d.success("删除成功")):d.error("删除失败")}catch(b){d.error(b.message)}}})},R=async()=>{if(n.onLoad&&!h.value){h.value=!0;try{var{items:p,totalCount:b}=await n.onLoad(k.value.page,k.value.pageSize);S.value=p,k.value.itemCount=b}catch(w){d.error(w.message)}finally{h.value=!1}}},j=()=>c.value?S.value.filter(p=>c.value.includes(p.id)).map(p=>e.toRaw(p)):[],X=()=>j()[0],J=()=>e.toRaw(S.value);return e.onMounted(async()=>await R()),l({getData:J,getSelectedRow:X,getSelectedRows:j,refreshData:R,resetPage:()=>{k.value.page=1}}),(p,b)=>{const w=a.NTooltip,T=a.NSpace,z=a.NDataTable;return e.openBlock(),e.createBlock(e.unref(a.NCard),{bordered:!1},{header:e.withCtx(()=>[e.createVNode(T,{justify:"space-between",align:"center",class:"w-full"},{default:e.withCtx(()=>[e.createElementVNode("span",ge,e.toDisplayString(t.title),1),e.createVNode(T,null,{default:e.withCtx(()=>[V.value?(e.openBlock(),e.createBlock(w,{key:0,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(a.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:n.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),P.value?(e.openBlock(),e.createBlock(w,{key:1,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(a.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:Y},{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(w,{trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(a.NIcon),{size:"18",class:"cursor-pointer hover:text-blue-600",onClick:q},{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",_e,[p.$slots.toolbar?(e.openBlock(),e.createElementBlock("div",ye,[e.renderSlot(p.$slots,"toolbar")])):e.createCommentVNode("",!0),e.createVNode(z,{remote:"",ref_key:"$table",ref:m,"checked-row-keys":c.value,"onUpdate:checkedRowKeys":b[0]||(b[0]=o=>c.value=o),"max-height":N.value,loading:h.value,bordered:!1,"single-line":!1,columns:L.value,data:S.value,pagination:k.value,"row-key":o=>o[t.idField]},null,8,["checked-row-keys","max-height","loading","columns","data","pagination","row-key"])])]),_:3})}}}),O=(t,l)=>{const n=l;return n.install=function(m){m.component(t,l)},l},Z=O("PTable",be),ke=["Redirect","RedirectSon","login"],A=F.defineStore("p-layout",()=>{const t=e.reactive({collapsed:!1,title:"输入项目名称",logo:"https://picsum.photos/id/1/100/100",avatar:"",uid:"",uname:"",tabs:[],menus:[],cacheTabs:!1,enableLanguage:!1});return{state:t,initMenus:f=>{f.sort((g,s)=>g.affix&&!s.affix?-1:!g.affix&&s.affix?1:Number(s.sort??0)-Number(g.sort??0)),t.menus=f},getMenus:()=>t.menus,initTabs:f=>{f.sort((g,s)=>g.meta.affix&&!s.meta.affix?-1:!g.meta.affix&&s.meta.affix?1:Number(s.meta.sort??0)-Number(g.meta.sort??0)),t.tabs=f},addTab:f=>ke.includes(f.name)?!1:(t.tabs?.some(s=>s.fullPath==f.fullPath)||t.tabs?.push(f),!0),getCurrentTab:()=>{const f=I.useRoute();return t.tabs.find(g=>g.fullPath==f.fullPath)},closeCurrentTab:f=>{const g=t.tabs.findIndex(s=>s.fullPath==f.fullPath);t.tabs.splice(g,1)},closeAllTabs:()=>{t.tabs=t.tabs.filter(f=>f?.meta?.affix??!1)},closeOtherTabs:f=>{t.tabs=t.tabs.filter(g=>g.fullPath==f.fullPath||(g?.meta?.affix??!1))},closeLeftTabs:f=>{const g=t.tabs.findIndex(s=>s.fullPath==f.fullPath);t.tabs=t.tabs.filter((s,D)=>D>=g||(s?.meta?.affix??!1))},closeRightTabs:f=>{const g=t.tabs.findIndex(s=>s.fullPath==f.fullPath);t.tabs=t.tabs.filter((s,D)=>D<=g||(s?.meta?.affix??!1))},collapse:()=>{t.collapsed=!t.collapsed},setTitle:f=>{t.title=f},setLogo:f=>{t.logo=f},setUser:(f,g)=>{t.uid=f,t.uname=g},setSettingPages:f=>{t.settingPages=f},setLogout:f=>{t.logout=f},enableLanguage:f=>{t.enableLanguage=f}}}),we={class:"logo"},Ce=e.defineComponent({__name:"PLogo",setup(t){const l=A();return(n,m)=>(e.openBlock(),e.createElementBlock("div",we,[e.createVNode(e.unref(a.NAvatar),{color:"var(--color-logo)",size:32,src:e.unref(l).state.logo,class:e.normalizeClass({"mr-2":!e.unref(l).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(l).state.title),513),[[e.vShow,!e.unref(l).state.collapsed]])]))}}),M=(t,l)=>{const n=t.__vccOpts||t;for(const[m,y]of l)n[m]=y;return n},Ne=M(Ce,[["__scopeId","data-v-e48aeefa"]]),Pe={translationApiUrl:"https://translate.zvo.cn/api",defaultLanguage:"chinese",currentLanguage:"",options:[],initLanguages:async()=>[],selectLanguage:async t=>{}},G=F.defineStore("language",()=>{const t=e.ref(Pe),l=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 P=(await l()).find(i=>i.key===r);P&&(t.value.currentLanguage=P.key,t.value.selectLanguage(P))},selectLanguageCallback:async r=>{t.value.selectLanguage=r},initLanguagesCallback:async r=>{t.value.initLanguages=r},getLanguages:l,getCurrentLanguage:async()=>{if(t.value.currentLanguage)return(await l()).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}}}),xe={key:1},Q=e.defineComponent({__name:"PLanguage",setup(t){const{select:l,getLanguages:n,getCurrentLanguage:m,getDefaultLanguage:y,getTranslationApiUrl:d}=G(),h=e.ref(),c=e.ref([]),S=async r=>await l(r),V=async()=>{const r=window.translate;r&&(r.selectLanguageTag.show=!1,r.selectLanguageTag.languages=(await n()).map(P=>P.key).join(","),r.ignore.class.push("ignore-translate-flag"),r.ignore.id.push("ignore-translation"),r.language.setLocal(y()),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(d()),r.request.listener.start(),r.listener.start(),r.whole.enableAll(),r.execute())};return e.onMounted(async()=>{await e.nextTick(),await V(),h.value=await m(),c.value=await n()}),(r,P)=>{const i=a.NIcon,C=a.NButton;return c.value.length>0?(e.openBlock(),e.createBlock(e.unref(a.NDropdown),{key:0,id:"ignore-translation",placement:"bottom-start",trigger:"hover",class:"flex flex-col justify-center h-full ignore",onSelect:S,options:c.value},{default:e.withCtx(()=>[e.createVNode(C,{quaternary:"",type:"info"},{default:e.withCtx(()=>[h.value?(e.openBlock(),e.createElementBlock("label",xe,e.toDisplayString(h.value?.label),1)):(e.openBlock(),e.createBlock(i,{key:0,size:"18"},{default:e.withCtx(()=>[...P[0]||(P[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)}}}),Be={class:"layout-header"},Ve={class:"layout-header-left"},Le={class:"link-text"},Se={key:1,class:"link-text"},Ee={class:"layout-header-right"},Te={key:0,class:"layout-header-trigger-min"},$e={class:"layout-header-trigger layout-header-trigger-min"},Oe={class:"layout-header-trigger layout-header-trigger-min"},De={class:"avatar"},Ie=M(e.defineComponent({__name:"PHeader",setup(t){const l=a.useMessage(),n=a.useDialog(),m=A(),y=I.useRouter(),d=I.useRoute(),h=e.inject("reloadPage"),c=k=>y.push({name:k}),S=e.computed(()=>V(d.matched)),V=k=>k.map(N=>{const L={key:N.name,label:N.meta.title,icon:N.meta.icon,meta:N.meta,disabled:N.path==="/",children:void 0};return N.children&&N.children.length>0&&(L.children=V(N.children)),L}),r=e.ref(!1),P=()=>{document.fullscreenElement?document.exitFullscreen&&(document.exitFullscreen(),r.value=!1):(document.documentElement.requestFullscreen(),r.value=!0)},i=e.computed(()=>{const k=[];return k.push({label:"退出登录",key:"logout"}),m.state.settingPages&&m.state.settingPages.length>0&&m.state.settingPages.forEach(N=>{k.push({label:N.title,key:N.route})}),k}),C=k=>{k==="logout"?B():y.push({name:k})},B=()=>{n.info({title:"提示",content:"您确定要退出登录吗",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(m.state.logout)try{await m.state.logout(),localStorage.removeItem("TABS-ROUTES"),l.error("退出成功")}catch(k){console.error(k),l.error("退出登录失败")}finally{location.reload()}else l.error("没有配置登出接口, 请配置[usePLayoutStore.logout]方法")},onNegativeClick:()=>{}})};return(k,N)=>{const L=a.NTooltip,f=a.NDivider,g=a.NAvatar;return e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("div",Ve,[e.createElementVNode("div",{class:"ml-1 layout-header-trigger layout-header-trigger-min",onClick:N[0]||(N[0]=(...s)=>e.unref(m).collapse&&e.unref(m).collapse(...s))},[e.unref(m).state.collapsed?(e.openBlock(),e.createBlock(e.unref(a.NIcon),{key:0,size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.MenuUnfoldOutlined))]),_:1})):(e.openBlock(),e.createBlock(e.unref(a.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:N[1]||(N[1]=(...s)=>e.unref(h)&&e.unref(h)(...s))},[e.createVNode(e.unref(a.NIcon),{size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.ReloadOutlined))]),_:1})]),e.createVNode(e.unref(a.NBreadcrumb),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,s=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:s.label},[s.label?(e.openBlock(),e.createBlock(e.unref(a.NBreadcrumbItem),{key:0},{default:e.withCtx(()=>[s.children&&s.children.length?(e.openBlock(),e.createBlock(e.unref(a.NDropdown),{key:0,options:s.children,onSelect:c},{default:e.withCtx(()=>[e.createElementVNode("span",Le,[s.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(s.label),1)])]),_:2},1032,["options"])):(e.openBlock(),e.createElementBlock("span",Se,[s.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(s.label),1)]))]),_:2},1024)):e.createCommentVNode("",!0)],64))),128))]),_:1})]),e.createElementVNode("div",Ee,[e.unref(m).state.enableLanguage?(e.openBlock(),e.createElementBlock("div",Te,[e.createVNode(Q)])):e.createCommentVNode("",!0),e.createElementVNode("div",$e,[e.createVNode(L,{placement:"bottom"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(a.NIcon),{size:"18",onClick:e.withModifiers(P,["stop"])},{default:e.withCtx(()=>[r.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(()=>[N[2]||(N[2]=e.createElementVNode("span",null,"全屏",-1))]),_:1})]),e.createElementVNode("div",Oe,[e.createVNode(e.unref(a.NDropdown),{trigger:"hover",onSelect:C,options:i.value},{default:e.withCtx(()=>[e.createElementVNode("div",De,[e.createElementVNode("span",null,e.toDisplayString(e.unref(m).state.uname),1),e.createVNode(f,{vertical:""}),e.createVNode(g,{round:"",src:e.unref(m).state.avatar},null,8,["src"])])]),_:1},8,["options"])])])])}}}),[["__scopeId","data-v-563e4e55"]]),Me={class:"mt-1"},Re=e.defineComponent({__name:"PContent",props:{loading:{type:Boolean,default:!1}},setup(t){return(l,n)=>{const m=e.resolveComponent("RouterView");return e.openBlock(),e.createElementBlock("div",Me,[t.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(m,{key:0},{default:e.withCtx(({Component:y,route:d})=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(y),{key:d.fullPath}))],1024))]),_:1}))])}}}),Ae={class:"tabs-view-main"},ze=["id","onClick","onContextmenu"],qe={class:"tabs-close"},je={class:"tabs-close-btn"},He=M(e.defineComponent({__name:"PTabs",setup(t){e.useCssVars(o=>({v4f917f8c:n.value,v1c2fb72a:m.value}));const l=a.useThemeVars(),n=e.computed(()=>l.value.cardColor),m=e.computed(()=>l.value.textColor1),y=a.useMessage(),d=I.useRoute(),h=I.useRouter(),c=e.ref(null),S=e.ref(null),V=e.ref(!1),r=A(),P=e.computed(()=>r.state.tabs),i=e.reactive({activeKey:d.fullPath,scrollable:!0,dropdownX:0,dropdownY:0,showDropdown:!1,isMultiHeaderFixed:!0,multiTabsSetting:!0}),C=["Login","Redirect","ErrorPage"],B=o=>({meta:o.meta,name:o.name,fullPath:o.fullPath??o.path,path:o.path,hash:o.hash??"",query:o.query??{},params:o.params??{}}),k=e.computed(()=>{const _=r.state.collapsed?"64px":"272px";return{left:_,width:`calc(100% - ${_})`}}),N=e.computed(()=>{const o=P.value.length<=1;return[{label:"刷新当前",key:"1",icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.ReloadOutlined)})},{label:"关闭当前",key:"2",disabled:V.value||o,icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.CloseOutlined)})},{label:"关闭其他",key:"3",disabled:o,icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.ColumnWidthOutlined)})},{label:"关闭全部",key:"4",disabled:o,icon:()=>e.h(a.NIcon,null,{default:()=>e.h(E.MinusOutlined)})}]}),L=()=>{let o=[B(d)];h.getRoutes().filter(u=>u.meta.affix).forEach(u=>{const _=B(u);o.every($=>$.name!==_.name)&&o.push(_)});try{if(r.state.cacheTabs){const u=localStorage.getItem("TABS_ROUTES");o=u?JSON.parse(u):o}}finally{return o}},f=o=>{const u=h.getRoutes();o.forEach(_=>{const $=u.find(H=>H.path===_.path);$&&(_.meta=$.meta||_.meta,_.name=$.name||_.name)}),r.state.cacheTabs&&localStorage.setItem("TABS_ROUTES",JSON.stringify(o))},g=()=>{const o=L();f(o),r.initTabs(o)},s=async o=>{if(await e.nextTick(),!c.value)return;const u=c.value.offsetWidth,_=c.value.scrollWidth;u<_?(i.scrollable=!0,o&&[...c.value.querySelectorAll(".tabs-card-scroll-item")||[]].forEach(H=>{H.id===`tag${i.activeKey.split("/").join("/")}`&&H.scrollIntoView&&H.scrollIntoView()})):i.scrollable=!1},D=o=>!(o.draggedContext.element.meta.affix||o.relatedContext.element.meta.affix),q=()=>{let o;o=me(),o.listenTo(S.value,()=>s(!0))},K=o=>{if(!o||o.fullPath===d.fullPath)return;if(i.activeKey=o.fullPath,toString.call(o)==="[object String]"){h.replace(o).catch(console.error);return}const u=o;h.replace(u).catch(console.error)},Y=(o,u)=>{o.preventDefault(),V.value=u.path==="/home",i.showDropdown=!1,e.nextTick().then(()=>{i.showDropdown=!0,i.dropdownX=o.clientX,i.dropdownY=o.clientY})},W=()=>{if(d.meta.keepAlive){var o=h.currentRoute.value.matched.find(u=>u.name==d.name);o&&o.components?.default?.name}},R=o=>{if(P.value.length===1)return y.warning("这已经是最后一页,不能再关闭了!");if(W(),r.closeCurrentTab(o),i.activeKey===o.fullPath){const u=P.value[Math.max(0,P.value.length-1)];i.activeKey=u.fullPath,h.push(u)}s()},j=o=>{const u=P.value.find(_=>_.fullPath==o.fullPath);u&&R(u)},X=o=>{r.closeOtherTabs(o),i.activeKey=o.fullPath,s()},J=()=>{r.closeAllTabs(),s()},p=e.inject("reloadPage"),b=o=>{switch(o){case"1":p();break;case"2":R(d);break;case"3":X(d);break;case"4":J();break}s(),i.showDropdown=!1},w=(o,u)=>{const _=c.value.scrollLeft,$=u>0&&_+u>=o||u<0&&_+u<=o?o:_+u;if(c.value&&c.value.scrollTo($,0),$!==o)return window.requestAnimationFrame(()=>w(o,u))},T=()=>{const o=c.value.offsetWidth,u=c.value.scrollLeft;if(!u)return;const _=u>o?u-o:0;w(_,(_-u)/20)},z=()=>{const o=c.value.offsetWidth,u=c.value.scrollWidth,_=c.value.scrollLeft;if(u-_<=o)return;const $=u-_>o*2?_+o:u-o;w($,($-_)/20)};return window.addEventListener("beforeunload",()=>{r.state.cacheTabs&&localStorage.setItem("TABS_ROUTES",JSON.stringify(P.value))}),window.addEventListener("scroll",o=>{let u=o.target.scrollTop||document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop;i.isMultiHeaderFixed=u>=64},!0),e.watch(()=>d.fullPath,o=>{C.includes(d.name)||(i.activeKey=o,r.addTab(B(d)),s(!0))},{immediate:!0}),g(),e.onMounted(()=>q()),(o,u)=>(e.openBlock(),e.createElementBlock("div",{class:"box-border tabs-view tabs-view-fix tabs-view-default-background",style:e.normalizeStyle(k.value)},[e.createElementVNode("div",Ae,[e.createElementVNode("div",{ref_key:"navWrap",ref:S,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:T},[e.createVNode(e.unref(a.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:z},[e.createVNode(e.unref(a.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.RightOutlined))]),_:1})],2),e.createElementVNode("div",{ref_key:"navScroll",ref:c,class:"tabs-card-scroll"},[e.createVNode(e.unref(ue),{animation:"300","item-key":"fullPath",class:"flex",list:P.value,move:D},{item:e.withCtx(({element:_})=>[e.createElementVNode("div",{class:e.normalizeClass(["tabs-card-scroll-item",{"active-item":i.activeKey===_.fullPath}]),id:`tag${_.fullPath.split("/").join("/")}`,onClick:e.withModifiers($=>K(_),["stop"]),onContextmenu:$=>Y($,_)},[e.createElementVNode("span",null,e.toDisplayString(_.meta.title),1),_.meta.affix?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(a.NIcon),{key:0,size:"14",onClick:e.withModifiers($=>j(_),["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(E.CloseOutlined))]),_:1},8,["onClick"]))],42,ze)]),_:1},8,["list"])],512)],2),e.createElementVNode("div",qe,[e.createVNode(e.unref(a.NDropdown),{trigger:"hover",placement:"bottom-end",options:N.value,onSelect:b},{default:e.withCtx(()=>[e.createElementVNode("div",je,[e.createVNode(e.unref(a.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.DownOutlined))]),_:1})])]),_:1},8,["options"])]),e.createVNode(e.unref(a.NDropdown),{placement:"bottom-start",show:i.showDropdown,x:i.dropdownX,y:i.dropdownY,options:N.value,onClickoutside:u[0]||(u[0]=_=>i.showDropdown=!1),onSelect:b},null,8,["show","x","y","options"])])],4))}}),[["__scopeId","data-v-50f5202c"]]),We=e.defineComponent({__name:"PMenus",setup(t){const l=e.ref([]),n=I.useRoute(),m=I.useRouter(),y=A(),d=e.ref(n.name),h=e.ref(n.matched&&n.matched.length?n.matched.map(C=>C.name):[]),c=C=>{n.name!==C&&(/http(s)?:/.test(C)?window.open(C):m.push({name:C}))},S=C=>{if(!C)return;const B=C.find(k=>h.value.indexOf(k)===-1);h.value=B?[B]:[]},V=()=>{const C=n.matched;h.value=C.map(k=>k.name);const B=n.meta?.activeMenu||"";d.value=B||n.name},r=["/:path(.*)*","/redirect","/redirect/:path(.*)","/login","/oidc-callback"],P=(C,B=[],k=!1)=>{const N=[];if(!C||C.length===0)return N;C=C.sort((L,f)=>{let g=(f.children?.length?1:0)-(L.children?.length?1:0);return g===0&&(g=Number(L.meta?.sort??0)-Number(f.meta?.sort??0)),g});for(const L of C){if(k||L.meta?.hidden||r.includes(L.path.toLowerCase())){B.push(L.name),P(L.children||[],B,!0);continue}const f=L.children?.filter(q=>!q.meta?.hidden)||[],g=f.length===1,s=g?f[0]:L,D={key:s.name,label:s.meta?.title,affix:s.meta?.affix,sort:Number(g?L.meta?.sort??0:s.meta?.sort??0),path:s.path,redirect:s.redirect,icon:g?L.meta?.icon:s.meta?.icon,permission:s.meta?.permission,meta:s.meta,children:void 0};if(s.children&&s.children.length>0&&(D.children=P(s.children,B,k),!g&&(!D.children||D.children.length===0))){B.push(s.name);continue}B.includes(s.name)||(N.push(D),B.push(s.name))}return N},i=()=>{const C=m.getRoutes();l.value=P(C)};return e.watch(()=>n.fullPath,()=>{V()}),e.onMounted(()=>{i(),V()}),(C,B)=>(e.openBlock(),e.createBlock(e.unref(a.NMenu),{class:"h-full",inverted:"",mode:"vertical",options:l.value,collapsed:e.unref(y).state.collapsed,"collapsed-width":64,"collapsed-icon-size":20,indent:24,"expanded-keys":h.value,value:d.value,"onUpdate:value":c,"onUpdate:expandedKeys":S},null,8,["options","collapsed","expanded-keys","value"]))}}),Fe={class:"layout-content-main layout-content-main-fix"},Ke={class:"main-view main-view-fix"},Ye=M(e.defineComponent({__name:"PLayout",setup(t){const l=A(),n=e.ref(!1),m=()=>{n.value=!0,e.nextTick(()=>n.value=!1)};return e.provide("reloadPage",m),(y,d)=>{const h=a.NBackTop;return e.openBlock(),e.createBlock(e.unref(a.NLayout),{"has-sider":"",class:"layout",position:"absolute"},{default:e.withCtx(()=>[e.createVNode(e.unref(a.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(l).state.collapsed,"native-scrollbar":!1,"collapsed-width":64,onCollapse:e.unref(l).collapse,onExpand:e.unref(l).collapse},{default:e.withCtx(()=>[e.createVNode(e.unref(a.NFlex),{vertical:""},{default:e.withCtx(()=>[e.createVNode(Ne),e.createVNode(We)]),_:1})]),_:1},8,["collapsed","onCollapse","onExpand"]),e.createVNode(e.unref(a.NLayout),null,{default:e.withCtx(()=>[e.createVNode(e.unref(a.NLayoutHeader),{position:"absolute"},{default:e.withCtx(()=>[e.createVNode(Ie)]),_:1}),e.createVNode(e.unref(a.NLayoutContent),{class:"layout-content layout-default-background"},{default:e.withCtx(()=>[e.createElementVNode("div",Fe,[e.createVNode(He),e.createElementVNode("div",Ke,[e.createVNode(Re,{loading:n.value},null,8,["loading"])])])]),_:1}),e.createVNode(h,{right:20,class:"z-50"})]),_:1})]),_:1})}}}),[["__scopeId","data-v-0bac2e7d"]]),Xe={};function Je(t,l){const n=e.resolveComponent("router-view");return e.openBlock(),e.createBlock(n)}const U=O("PEmptyLayout",M(Xe,[["render",Je]])),v=O("PLayout",Ye),ee=O("PApplication",e.defineComponent({__name:"PApplication",props:{theme:{},themeOverrides:{default:{common:{primaryColor:"#2d8cf0",primaryColorHover:"#3c9bff",primaryColorPressed:"#3c9bff",primaryColorSuppl:"#2d8cf0"},LoadingBar:{colorLoading:"#2d8cf0"}}}},setup(t){return(l,n)=>{const m=a.NConfigProvider;return e.openBlock(),e.createBlock(m,{locale:e.unref(a.zhCN),theme:t.theme,"theme-overrides":t.themeOverrides,"date-locale":e.unref(a.dateZhCN)},{default:e.withCtx(()=>[e.createVNode(e.unref(a.NDialogProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(a.NNotificationProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(a.NMessageProvider),null,{default:e.withCtx(()=>[e.renderSlot(l.$slots,"default")]),_:3})]),_:3})]),_:3})]),_:3},8,["locale","theme","theme-overrides","date-locale"])}}})),te=O("PModal",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:l,emit:n}){const m=a.useMessage(),y=e.ref(!1),d=e.ref(!1),h=n,c=t,S=async()=>{try{y.value=!0,c.onSave&&await c.onSave()&&V()}catch(i){i instanceof Error&&m.error(i.message),console.error(i)}finally{y.value=!1}},V=()=>{y.value=!1,d.value=!1,h("update:visible",!1)},r=async()=>{try{d.value=!0,c.onClose?await c.onClose()&&V():V()}catch(i){m.error(i.message)}finally{d.value=!1}};return l({open:()=>{y.value=!1,d.value=!1,h("update:visible",!0)},close:V}),(i,C)=>{const B=a.NText,k=a.NButton,N=a.NSpace;return e.openBlock(),e.createBlock(e.unref(a.NModal),e.mergeProps({ref:"$modal",preset:"card"},i.$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:V,onAfterEnter:c.onAfterEnter,onAfterLeave:c.onAfterLeave,onUpdateVisible:c.onUpdateVisible}),{header:e.withCtx(()=>[i.$slots.header?e.renderSlot(i.$slots,"header",{key:0}):c.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(i.$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(i.$slots,"default")],4)]),footer:e.withCtx(()=>[e.renderSlot(i.$slots,"footer")]),action:e.withCtx(()=>[e.createVNode(N,{justify:"end"},{default:e.withCtx(()=>[c.hideSaveBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(k,{key:0,type:"primary",loading:y.value,onClick:S},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.saveBtnText),1)]),_:1},8,["loading"])),e.renderSlot(i.$slots,"action-extra"),c.hideCancelBtn?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(k,{key:1,loading:d.value,onClick:r},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.cancelBtnText),1)]),_:1},8,["loading"]))]),_:3})]),_:3},16,["show","style","onAfterEnter","onAfterLeave","onUpdateVisible"])}}})),oe=O("PLanguage",Q),Ze=e.defineComponent({name:"Redirect",setup(){const t=I.useRoute(),l=I.useRouter();return e.onBeforeMount(()=>{const{params:n,query:m}=t,{path:y}=n;l.replace({path:"/"+(Array.isArray(y)?y.join("/"):y),query:m})}),()=>React.createElement(a.NEmpty,null)}}),ne=O("PRedirect",Ze),Ge={class:"frame"},Qe=["src"],ae=O("PIframe",M(e.defineComponent({__name:"PIframe",setup(t){const l=I.useRoute(),n=e.ref(!1),m=e.ref(null),y=e.ref("");e.unref(l.meta)?.frameSrc&&(y.value=e.unref(l.meta)?.frameSrc);function d(){n.value=!1}function h(){e.nextTick(()=>{const c=e.unref(m);if(!c)return;const S=c;S.attachEvent?S.attachEvent("onload",()=>{d()}):c.onload=()=>{d()}})}return e.onMounted(()=>{n.value=!0,h()}),(c,S)=>{const V=a.NSpin;return e.openBlock(),e.createBlock(V,{show:n.value},{default:e.withCtx(()=>[e.createElementVNode("div",Ge,[e.createElementVNode("iframe",{src:y.value,class:"frame-iframe",ref_key:"frameRef",ref:m},null,8,Qe)])]),_:1},8,["show"])}}}),[["__scopeId","data-v-161a378e"]])),Ue={class:"border border-gray-100 rounded-lg"},ve={class:"text-xl font-semibold text-gray-800"},et={class:"text-sm text-gray-500 mt-1"},le=O("PPage",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 l=t;return(n,m)=>{const y=a.NIcon,d=a.NAvatar,h=a.NSpace,c=a.NCard;return e.openBlock(),e.createElementBlock("div",Ue,[l.title?(e.openBlock(),e.createBlock(c,{key:0,class:"mb-4",bordered:!1,"content-class":"py-4"},{default:e.withCtx(()=>[e.createVNode(h,{align:"center",justify:"space-between"},{default:e.withCtx(()=>[e.createVNode(h,{align:"center",size:16},{default:e.withCtx(()=>[l.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(y,{size:24,component:l.icon,color:"#fff"},null,8,["component"])]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",null,[e.createElementVNode("div",ve,e.toDisplayString(l.title),1),e.createElementVNode("div",et,e.toDisplayString(l.subtitle??l.title+"主页"),1)])]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),n.$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(n.$slots,"search")]),_:3})):e.createCommentVNode("",!0),n.$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(n.$slots,"default")]),_:3})):e.createCommentVNode("",!0)])}}})),tt={},ot={class:"flex flex-col justify-center page-container"};function nt(t,l){const n=a.NResult;return e.openBlock(),e.createElementBlock("div",ot,[e.createVNode(n,{status:"500",title:"服务器错误",description:"抱歉,服务器出错了"})])}const at=M(tt,[["render",nt],["__scopeId","data-v-89cb65c7"]]),lt={},st={class:"flex flex-col justify-center page-container"};function rt(t,l){const n=a.NResult;return e.openBlock(),e.createElementBlock("div",st,[e.createVNode(n,{status:"404",title:"资源不存在",description:"抱歉,你访问的页面不存在"})])}const ct=M(lt,[["render",rt],["__scopeId","data-v-99232671"]]),it={},dt={class:"flex flex-col justify-center page-container"};function ft(t,l){const n=a.NResult;return e.openBlock(),e.createElementBlock("div",dt,[e.createVNode(n,{status:"403",title:"禁止访问",description:"抱歉,你无权访问该页面"})])}const mt=M(it,[["render",ft],["__scopeId","data-v-3baa9c16"]]),se=O("P500",at),re=O("P404",ct),ce=O("P403",mt),ie=F.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,h)=>await t.error?.(d,h)}}),ut={class:"view-auth-callback"},de=O("POidc",M(e.defineComponent({__name:"POidc",setup(t){const l=I.useRouter(),{callCallback:n,callError:m}=ie();return e.onMounted(async()=>{try{await n(l)}catch(y){await m(l,y)}}),(y,d)=>(e.openBlock(),e.createElementBlock("div",ut,[...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"]])),pt=Object.freeze(Object.defineProperty({__proto__:null,P403:ce,P404:re,P500:se,PApplication:ee,PEmptyLayout:U,PIframe:ae,PLanguage:oe,PLayout:v,PModal:te,POidc:de,PPage:le,PRedirect:ne,PTable:Z},Symbol.toStringTag,{value:"Module"})),fe=(t,l)=>(Object.values(pt).forEach(n=>{n.install&&t.use(n)}),l?.(),t),ht={install:fe};x.P403=ce,x.P404=re,x.P500=se,x.PApplication=ee,x.PEmptyLayout=U,x.PIframe=ae,x.PLanguage=oe,x.PLayout=v,x.PModal=te,x.POidc=de,x.PPage=le,x.PRedirect=ne,x.PTable=Z,x.default=ht,x.install=fe,x.useLanguageStore=G,x.useLayoutStore=A,x.useOidcStore=ie,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
@@ -2,7 +2,7 @@ import { useDialog as Y, useMessage as Z, NDropdown as ee, NButton as te, NIcon
2
2
  import { defineComponent as se, ref as r, computed as S, watch as le, unref as u, h as s, onMounted as re, openBlock as C, createBlock as E, withCtx as i, createElementVNode as p, createElementBlock as ue, renderSlot as ce, createCommentVNode as x, createVNode as l, toDisplayString as de, toRaw as H } from "vue";
3
3
  import { getViewportOffset as fe } from "../utils/helper.js";
4
4
  import { MoreOutlined as me, EditOutlined as pe, DeleteOutlined as O, PlusSquareOutlined as ge, ReloadOutlined as he } from "@vicons/antd";
5
- const ye = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ke = {
5
+ const ve = { class: "text-lg font-medium" }, ye = { id: "data-content" }, ke = {
6
6
  key: 0,
7
7
  class: "rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-4 mb-4"
8
8
  }, _e = /* @__PURE__ */ se({
@@ -21,7 +21,7 @@ const ye = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ke = {
21
21
  onCheckPermission: {}
22
22
  },
23
23
  setup(P, { expose: A }) {
24
- const o = P, z = r(), T = Y(), g = Z(), h = r(!1), y = r([]), v = r([]), N = r(!1), _ = r(!1), k = r(!1), B = r({}), L = S(
24
+ const o = P, z = r(), T = Y(), g = Z(), h = r(!1), v = r([]), y = r([]), N = r(!1), _ = r(!1), k = r(!1), B = r({}), M = S(
25
25
  () => _.value || k.value
26
26
  ), w = async (e) => !e || !o.onCheckPermission ? !0 : await o.onCheckPermission(e) ?? !1;
27
27
  le(
@@ -34,10 +34,8 @@ const ye = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ke = {
34
34
  if (e && e.action)
35
35
  for (const t of e.action) {
36
36
  if (!t.permission) continue;
37
- const n = await w(
38
- t.permission.toLowerCase()
39
- );
40
- n && (B.value[t.permission] = n);
37
+ const n = await w(t.permission);
38
+ B.value[t.permission] = n;
41
39
  }
42
40
  },
43
41
  { immediate: !0 }
@@ -54,7 +52,7 @@ const ye = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ke = {
54
52
  onUpdatePageSize: async (e) => {
55
53
  c.value.pageSize = e, await f();
56
54
  }
57
- }), M = S(() => {
55
+ }), V = S(() => {
58
56
  const e = u(z);
59
57
  if (!e) return;
60
58
  let t = 12, n = 25;
@@ -67,7 +65,7 @@ const ye = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ke = {
67
65
  } else
68
66
  t += 28;
69
67
  return W - (a + t + n);
70
- }), V = S(() => {
68
+ }), q = S(() => {
71
69
  const e = [{ type: "selection", fixed: "left" }];
72
70
  o.columns.forEach((n) => {
73
71
  if (n.key !== "action") {
@@ -86,16 +84,16 @@ const ye = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ke = {
86
84
  (n, a) => a.key === "action" ? a : n,
87
85
  void 0
88
86
  );
89
- return (t || L.value) && e.push({
87
+ return (t || M.value) && e.push({
90
88
  title: "操作",
91
89
  key: "actions",
92
90
  width: 100,
93
91
  fixed: "right",
94
- render: (n) => q(n, t?.action)
92
+ render: (n) => I(n, t?.action)
95
93
  }), e;
96
- }), q = (e, t) => {
94
+ }), I = (e, t) => {
97
95
  const n = [];
98
- return I(n, e), j(n, e), F(n, e, t), n.length <= 0 ? null : s(
96
+ return L(n, e), j(n, e), F(n, e, t), n.length <= 0 ? null : s(
99
97
  ee,
100
98
  {
101
99
  options: n,
@@ -109,32 +107,29 @@ const ye = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ke = {
109
107
  )
110
108
  }
111
109
  );
112
- }, I = async (e, t) => {
110
+ }, L = (e, t) => {
113
111
  _.value && e.push({
114
112
  label: "编辑",
115
113
  key: "edit",
116
114
  icon: () => s(d, null, { default: () => s(pe) }),
117
115
  props: { onClick: async () => await o.onEdit(t) }
118
116
  });
119
- }, j = async (e, t) => {
117
+ }, j = (e, t) => {
120
118
  k.value && e.push({
121
119
  label: "删除",
122
120
  key: "delete",
123
121
  icon: () => s(d, null, { default: () => s(O) }),
124
122
  props: { onClick: () => U(t) }
125
123
  });
126
- }, F = async (e, t, n) => {
124
+ }, F = (e, t, n) => {
127
125
  if (n)
128
- for (const a of n) {
129
- if (a.key === "edit" || a.key === "delete" || !a.permission || !B.value[a.permission])
130
- return;
131
- e.push({
126
+ for (const a of n)
127
+ a.key === "edit" || a.key === "delete" || a.permission && !B.value[a.permission] || e.push({
132
128
  label: a.name,
133
129
  key: a.key,
134
130
  icon: a.icon && (() => s(d, null, { default: () => s(a.icon) })),
135
131
  props: { onClick: () => a.action(t) }
136
132
  });
137
- }
138
133
  }, K = async () => await f(), U = (e) => R([e]), G = () => R(D()), R = (e) => {
139
134
  !e || e.length === 0 || T.warning({
140
135
  title: "警告",
@@ -158,14 +153,14 @@ const ye = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ke = {
158
153
  c.value.page,
159
154
  c.value.pageSize
160
155
  );
161
- v.value = e, c.value.itemCount = t;
156
+ y.value = e, c.value.itemCount = t;
162
157
  } catch (n) {
163
158
  g.error(n.message);
164
159
  } finally {
165
160
  h.value = !1;
166
161
  }
167
162
  }
168
- }, D = () => y.value ? v.value.filter((e) => y.value.includes(e.id)).map((e) => H(e)) : [], J = () => D()[0], Q = () => H(v.value);
163
+ }, D = () => v.value ? y.value.filter((e) => v.value.includes(e.id)).map((e) => H(e)) : [], J = () => D()[0], Q = () => H(y.value);
169
164
  return re(async () => await f()), A({
170
165
  getData: Q,
171
166
  getSelectedRow: J,
@@ -184,7 +179,7 @@ const ye = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ke = {
184
179
  class: "w-full"
185
180
  }, {
186
181
  default: i(() => [
187
- p("span", ye, de(P.title), 1),
182
+ p("span", ve, de(P.title), 1),
188
183
  l(a, null, {
189
184
  default: i(() => [
190
185
  N.value ? (C(), E(n, {
@@ -255,7 +250,7 @@ const ye = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ke = {
255
250
  })
256
251
  ]),
257
252
  default: i(() => [
258
- p("div", ve, [
253
+ p("div", ye, [
259
254
  e.$slots.toolbar ? (C(), ue("div", ke, [
260
255
  ce(e.$slots, "toolbar")
261
256
  ])) : x("", !0),
@@ -263,14 +258,14 @@ const ye = { class: "text-lg font-medium" }, ve = { id: "data-content" }, ke = {
263
258
  remote: "",
264
259
  ref_key: "$table",
265
260
  ref: z,
266
- "checked-row-keys": y.value,
267
- "onUpdate:checkedRowKeys": t[0] || (t[0] = (m) => y.value = m),
268
- "max-height": M.value,
261
+ "checked-row-keys": v.value,
262
+ "onUpdate:checkedRowKeys": t[0] || (t[0] = (m) => v.value = m),
263
+ "max-height": V.value,
269
264
  loading: h.value,
270
265
  bordered: !1,
271
266
  "single-line": !1,
272
- columns: V.value,
273
- data: v.value,
267
+ columns: q.value,
268
+ data: y.value,
274
269
  pagination: c.value,
275
270
  "row-key": (m) => m[P.idField]
276
271
  }, null, 8, ["checked-row-keys", "max-height", "loading", "columns", "data", "pagination", "row-key"])
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("naive-ui"),e=require("vue"),L=require("../utils/helper.cjs"),c=require("@vicons/antd"),j={class:"text-lg font-medium"},U={id:"data-content"},F={key:0,class:"rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-4 mb-4"},K=e.defineComponent({__name:"PTable",props:{title:{},idField:{default:"id"},addPermission:{},editPermission:{},deletePermission:{},columns:{},onLoad:{},onDelete:{},onAdd:{},onEdit:{},onCheckPermission:{}},setup(y,{expose:_}){const a=y,C=e.ref(),V=l.useDialog(),d=l.useMessage(),f=e.ref(!1),m=e.ref([]),p=e.ref([]),N=e.ref(!1),k=e.ref(!1),h=e.ref(!1),b=e.ref({}),D=e.computed(()=>k.value||h.value),g=async t=>!t||!a.onCheckPermission?!0:await a.onCheckPermission(t)??!1;e.watch(a,async()=>{N.value=!!a.onAdd&&await g(a.addPermission),k.value=!!a.onEdit&&await g(a.editPermission),h.value=!!a.onDelete&&await g(a.deletePermission);const t=a.columns.find(n=>n.key==="action");if(t&&t.action)for(const n of t.action){if(!n.permission)continue;const o=await g(n.permission.toLowerCase());o&&(b.value[n.permission]=o)}},{immediate:!0});const s=e.ref({page:1,itemCount:0,pageSize:10,pageSizes:[10,20,30,50],showSizePicker:!0,onChange:async t=>{s.value.page=t,await r()},onUpdatePageSize:async t=>{s.value.pageSize=t,await r()}}),E=e.computed(()=>{const t=e.unref(C);if(!t)return;let n=12,o=25;const i=48,v=t?.$el,u=v.querySelector(".n-data-table-thead "),{bottomIncludeBody:T}=L.getViewportOffset(u),P=v.querySelector(".n-data-table__pagination");if(P){const A=P.offsetHeight;n+=A||0}else n+=28;return T-(i+n+o)}),S=e.computed(()=>{const t=[{type:"selection",fixed:"left"}];a.columns.forEach(o=>{if(o.key!=="action"){t.push({title:o.title,key:o.key,width:o.width,fixed:o.fixed??!1,render:o.render,ellipsis:o.ellipsis?{tooltip:!0}:!1});return}});const n=a.columns.reduce((o,i)=>i.key==="action"?i:o,void 0);return(n||D.value)&&t.push({title:"操作",key:"actions",width:100,fixed:"right",render:o=>B(o,n?.action)}),t}),B=(t,n)=>{const o=[];return z(o,t),I(o,t),R(o,t,n),o.length<=0?null:e.h(l.NDropdown,{options:o,placement:"bottom-start"},{default:()=>e.h(l.NButton,{size:"small",type:"primary"},{default:()=>["操作",e.h(l.NIcon,()=>e.h(c.MoreOutlined))]})})},z=async(t,n)=>{k.value&&t.push({label:"编辑",key:"edit",icon:()=>e.h(l.NIcon,null,{default:()=>e.h(c.EditOutlined)}),props:{onClick:async()=>await a.onEdit(n)}})},I=async(t,n)=>{h.value&&t.push({label:"删除",key:"delete",icon:()=>e.h(l.NIcon,null,{default:()=>e.h(c.DeleteOutlined)}),props:{onClick:()=>q(n)}})},R=async(t,n,o)=>{if(o)for(const i of o){if(i.key==="edit"||i.key==="delete"||!i.permission||!b.value[i.permission])return;t.push({label:i.name,key:i.key,icon:i.icon&&(()=>e.h(l.NIcon,null,{default:()=>e.h(i.icon)})),props:{onClick:()=>i.action(n)}})}},O=async()=>await r(),q=t=>x([t]),$=()=>x(w()),x=t=>{!t||t.length===0||V.warning({title:"警告",content:"删除数据不可恢复, 确认删除吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(a.onDelete)try{await a.onDelete(t)?(r(),d.success("删除成功")):d.error("删除失败")}catch(n){d.error(n.message)}}})},r=async()=>{if(a.onLoad&&!f.value){f.value=!0;try{var{items:t,totalCount:n}=await a.onLoad(s.value.page,s.value.pageSize);p.value=t,s.value.itemCount=n}catch(o){d.error(o.message)}finally{f.value=!1}}},w=()=>m.value?p.value.filter(t=>m.value.includes(t.id)).map(t=>e.toRaw(t)):[],H=()=>w()[0],M=()=>e.toRaw(p.value);return e.onMounted(async()=>await r()),_({getData:M,getSelectedRow:H,getSelectedRows:w,refreshData:r,resetPage:()=>{s.value.page=1}}),(t,n)=>{const o=l.NTooltip,i=l.NSpace,v=l.NDataTable;return e.openBlock(),e.createBlock(e.unref(l.NCard),{bordered:!1},{header:e.withCtx(()=>[e.createVNode(i,{justify:"space-between",align:"center",class:"w-full"},{default:e.withCtx(()=>[e.createElementVNode("span",j,e.toDisplayString(y.title),1),e.createVNode(i,null,{default:e.withCtx(()=>[N.value?(e.openBlock(),e.createBlock(o,{key:0,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(l.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:a.onAdd},{default:e.withCtx(()=>[e.createVNode(e.unref(c.PlusSquareOutlined))]),_:1},8,["onClick"])]),default:e.withCtx(()=>[n[1]||(n[1]=e.createElementVNode("span",null,"新增",-1))]),_:1})):e.createCommentVNode("",!0),h.value?(e.openBlock(),e.createBlock(o,{key:1,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(l.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:$},{default:e.withCtx(()=>[e.createVNode(e.unref(c.DeleteOutlined))]),_:1})]),default:e.withCtx(()=>[n[2]||(n[2]=e.createElementVNode("span",null,"删除",-1))]),_:1})):e.createCommentVNode("",!0),e.createVNode(o,{trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(l.NIcon),{size:"18",class:"cursor-pointer hover:text-blue-600",onClick:O},{default:e.withCtx(()=>[e.createVNode(e.unref(c.ReloadOutlined))]),_:1})]),default:e.withCtx(()=>[n[3]||(n[3]=e.createElementVNode("span",null,"刷新",-1))]),_:1})]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",U,[t.$slots.toolbar?(e.openBlock(),e.createElementBlock("div",F,[e.renderSlot(t.$slots,"toolbar")])):e.createCommentVNode("",!0),e.createVNode(v,{remote:"",ref_key:"$table",ref:C,"checked-row-keys":m.value,"onUpdate:checkedRowKeys":n[0]||(n[0]=u=>m.value=u),"max-height":E.value,loading:f.value,bordered:!1,"single-line":!1,columns:S.value,data:p.value,pagination:s.value,"row-key":u=>u[y.idField]},null,8,["checked-row-keys","max-height","loading","columns","data","pagination","row-key"])])]),_:3})}}});exports.default=K;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("naive-ui"),e=require("vue"),j=require("../utils/helper.cjs"),c=require("@vicons/antd"),L={class:"text-lg font-medium"},U={id:"data-content"},F={key:0,class:"rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-4 mb-4"},K=e.defineComponent({__name:"PTable",props:{title:{},idField:{default:"id"},addPermission:{},editPermission:{},deletePermission:{},columns:{},onLoad:{},onDelete:{},onAdd:{},onEdit:{},onCheckPermission:{}},setup(y,{expose:_}){const a=y,C=e.ref(),V=l.useDialog(),d=l.useMessage(),f=e.ref(!1),m=e.ref([]),p=e.ref([]),N=e.ref(!1),k=e.ref(!1),h=e.ref(!1),b=e.ref({}),D=e.computed(()=>k.value||h.value),g=async t=>!t||!a.onCheckPermission?!0:await a.onCheckPermission(t)??!1;e.watch(a,async()=>{N.value=!!a.onAdd&&await g(a.addPermission),k.value=!!a.onEdit&&await g(a.editPermission),h.value=!!a.onDelete&&await g(a.deletePermission);const t=a.columns.find(n=>n.key==="action");if(t&&t.action)for(const n of t.action){if(!n.permission)continue;const o=await g(n.permission);b.value[n.permission]=o}},{immediate:!0});const s=e.ref({page:1,itemCount:0,pageSize:10,pageSizes:[10,20,30,50],showSizePicker:!0,onChange:async t=>{s.value.page=t,await r()},onUpdatePageSize:async t=>{s.value.pageSize=t,await r()}}),E=e.computed(()=>{const t=e.unref(C);if(!t)return;let n=12,o=25;const i=48,v=t?.$el,u=v.querySelector(".n-data-table-thead "),{bottomIncludeBody:T}=j.getViewportOffset(u),P=v.querySelector(".n-data-table__pagination");if(P){const A=P.offsetHeight;n+=A||0}else n+=28;return T-(i+n+o)}),S=e.computed(()=>{const t=[{type:"selection",fixed:"left"}];a.columns.forEach(o=>{if(o.key!=="action"){t.push({title:o.title,key:o.key,width:o.width,fixed:o.fixed??!1,render:o.render,ellipsis:o.ellipsis?{tooltip:!0}:!1});return}});const n=a.columns.reduce((o,i)=>i.key==="action"?i:o,void 0);return(n||D.value)&&t.push({title:"操作",key:"actions",width:100,fixed:"right",render:o=>B(o,n?.action)}),t}),B=(t,n)=>{const o=[];return z(o,t),I(o,t),R(o,t,n),o.length<=0?null:e.h(l.NDropdown,{options:o,placement:"bottom-start"},{default:()=>e.h(l.NButton,{size:"small",type:"primary"},{default:()=>["操作",e.h(l.NIcon,()=>e.h(c.MoreOutlined))]})})},z=(t,n)=>{k.value&&t.push({label:"编辑",key:"edit",icon:()=>e.h(l.NIcon,null,{default:()=>e.h(c.EditOutlined)}),props:{onClick:async()=>await a.onEdit(n)}})},I=(t,n)=>{h.value&&t.push({label:"删除",key:"delete",icon:()=>e.h(l.NIcon,null,{default:()=>e.h(c.DeleteOutlined)}),props:{onClick:()=>q(n)}})},R=(t,n,o)=>{if(o)for(const i of o)i.key==="edit"||i.key==="delete"||i.permission&&!b.value[i.permission]||t.push({label:i.name,key:i.key,icon:i.icon&&(()=>e.h(l.NIcon,null,{default:()=>e.h(i.icon)})),props:{onClick:()=>i.action(n)}})},O=async()=>await r(),q=t=>x([t]),$=()=>x(w()),x=t=>{!t||t.length===0||V.warning({title:"警告",content:"删除数据不可恢复, 确认删除吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(a.onDelete)try{await a.onDelete(t)?(r(),d.success("删除成功")):d.error("删除失败")}catch(n){d.error(n.message)}}})},r=async()=>{if(a.onLoad&&!f.value){f.value=!0;try{var{items:t,totalCount:n}=await a.onLoad(s.value.page,s.value.pageSize);p.value=t,s.value.itemCount=n}catch(o){d.error(o.message)}finally{f.value=!1}}},w=()=>m.value?p.value.filter(t=>m.value.includes(t.id)).map(t=>e.toRaw(t)):[],H=()=>w()[0],M=()=>e.toRaw(p.value);return e.onMounted(async()=>await r()),_({getData:M,getSelectedRow:H,getSelectedRows:w,refreshData:r,resetPage:()=>{s.value.page=1}}),(t,n)=>{const o=l.NTooltip,i=l.NSpace,v=l.NDataTable;return e.openBlock(),e.createBlock(e.unref(l.NCard),{bordered:!1},{header:e.withCtx(()=>[e.createVNode(i,{justify:"space-between",align:"center",class:"w-full"},{default:e.withCtx(()=>[e.createElementVNode("span",L,e.toDisplayString(y.title),1),e.createVNode(i,null,{default:e.withCtx(()=>[N.value?(e.openBlock(),e.createBlock(o,{key:0,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(l.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:a.onAdd},{default:e.withCtx(()=>[e.createVNode(e.unref(c.PlusSquareOutlined))]),_:1},8,["onClick"])]),default:e.withCtx(()=>[n[1]||(n[1]=e.createElementVNode("span",null,"新增",-1))]),_:1})):e.createCommentVNode("",!0),h.value?(e.openBlock(),e.createBlock(o,{key:1,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(l.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:$},{default:e.withCtx(()=>[e.createVNode(e.unref(c.DeleteOutlined))]),_:1})]),default:e.withCtx(()=>[n[2]||(n[2]=e.createElementVNode("span",null,"删除",-1))]),_:1})):e.createCommentVNode("",!0),e.createVNode(o,{trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(l.NIcon),{size:"18",class:"cursor-pointer hover:text-blue-600",onClick:O},{default:e.withCtx(()=>[e.createVNode(e.unref(c.ReloadOutlined))]),_:1})]),default:e.withCtx(()=>[n[3]||(n[3]=e.createElementVNode("span",null,"刷新",-1))]),_:1})]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",U,[t.$slots.toolbar?(e.openBlock(),e.createElementBlock("div",F,[e.renderSlot(t.$slots,"toolbar")])):e.createCommentVNode("",!0),e.createVNode(v,{remote:"",ref_key:"$table",ref:C,"checked-row-keys":m.value,"onUpdate:checkedRowKeys":n[0]||(n[0]=u=>m.value=u),"max-height":E.value,loading:f.value,bordered:!1,"single-line":!1,columns:S.value,data:p.value,pagination:s.value,"row-key":u=>u[y.idField]},null,8,["checked-row-keys","max-height","loading","columns","data","pagination","row-key"])])]),_:3})}}});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.51",
4
+ "version": "0.0.52",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "sideEffects": false,