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