@chewel611/naive-ui-plus 0.0.3 → 0.0.5
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 +537 -532
- package/dist/index.umd.cjs +1 -1
- package/es/modal/PModal.d.ts +1 -0
- package/es/modal/PModal.vue.js +23 -22
- package/es/modal/index.d.ts +3 -0
- package/es/modal/typing.d.ts +1 -0
- package/es/table/PTable.vue.js +62 -61
- package/es/utils/helper.d.ts +1 -0
- package/es/utils/helper.js +8 -0
- package/lib/modal/PModal.d.ts +1 -0
- package/lib/modal/PModal.vue.cjs +1 -1
- package/lib/modal/index.d.ts +3 -0
- package/lib/modal/typing.d.ts +1 -0
- package/lib/table/PTable.vue.cjs +1 -1
- package/lib/utils/helper.cjs +1 -0
- package/lib/utils/helper.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(T,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("naive-ui"),require("vue"),require("@vicons/antd"),require("pinia"),require("vue-router"),require("element-resize-detector"),require("vuedraggable")):typeof define=="function"&&define.amd?define(["exports","naive-ui","vue","@vicons/antd","pinia","vue-router","element-resize-detector","vuedraggable"],o):(T=typeof globalThis<"u"?globalThis:T||self,o(T.naiveplus={},T.naiveUi,T.Vue,T.antd,T.pinia,T.vueRouter,T.elementResizeDetectorMaker,T.Draggable))})(this,function(T,o,e,E,v,D,de,fe){"use strict";const pe={id:"data-content"},he={key:0,class:"rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-5 mb-5"},me={key:1},ue={key:2},ge=e.defineComponent({__name:"PTable",props:{idField:{default:"id"},item:{},columns:{},modalWidth:{default:800},hiddenAdd:{type:Boolean,default:!1},hiddenEdit:{type:Boolean,default:!1},hiddenDelete:{type:Boolean,default:!1},onLoad:{},onGet:{},onOpenModal:{},onCloseModal:{},onSave:{},onDelete:{}},setup(a,{expose:d}){const _=e.ref(null),g=o.useDialog(),x=o.useMessage(),m=e.ref(!1),y=e.ref([]),b=e.ref([]),S=e.ref(null),B=e.ref(!1),f=e.ref(!1),k=e.ref(!1),n=e.ref({page:1,itemCount:0,pageSize:10,pageSizes:[10,20,30,50],showSizePicker:!0,onChange:async l=>{n.value.page=l,await O()},onUpdatePageSize:async l=>{n.value.pageSize=l,await O()}}),r=a,p=l=>{const i=C=>{const L=[];return l&&l.forEach(t=>{t.key!=="edit"&&t.key!=="delete"&&L.push({label:t.name,key:t.key,props:{onClick:()=>t.action(C)}})}),L};return{title:"操作",key:"actions",width:100,fixed:"right",render:C=>{let L=[];if(r.hiddenEdit||L.push({label:"编辑",key:"edit",props:{onClick:()=>A(C)}}),r.hiddenDelete||L.push({label:"删除",key:"delete",props:{onClick:()=>w(C)}}),L=[...L,...i(C)],!(L.length<=0))return e.h(o.NDropdown,{options:L,placement:"bottom-start"},{default:()=>e.h(o.NButton,{size:"small",type:"primary"},{default:()=>["操作",e.h(o.NIcon,()=>e.h(E.MoreOutlined))]})})}}},u=e.computed(()=>{const l=r.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})),i=r.columns.reduce((C,L)=>L.key==="action"?L:C,void 0)?.action;return i&&i?.length>0||!r.hiddenDelete||!r.hiddenEdit?[{type:"selection",fixed:"left"},...l,p(i)]:[{type:"selection",fixed:"left"},...l]}),h=async()=>{await O()},w=l=>{P([l])},M=()=>{const l=W();P(l)},P=l=>{l&&l.length>0&&g.warning({title:"警告",content:"删除数据不可恢复, 确认删除吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(r.onDelete)try{await r.onDelete(l)?(O(),x.success("删除成功")):x.error("删除失败")}catch(i){x.error(i.message)}}})},N=()=>{if(r.onOpenModal){r.onOpenModal();return}f.value=!1,B.value=!0},A=async l=>{if(r.onOpenModal){r.onOpenModal(l);return}r.onGet&&(l=await r.onGet(l[r.idField])),S.value=l,Object.assign(r.item,l),B.value=!1,f.value=!0},F=async()=>{if(r.onSave)try{k.value=!0,(B.value?await r.onSave():await r.onSave(S.value[r.idField]))&&(R(),await O())}catch(l){x.error(l.message)}finally{k.value=!1}},R=()=>{r.onCloseModal&&r.onCloseModal(),Object.keys(r.item).forEach(l=>r.item[l]=void 0),S.value=null,B.value=!1,f.value=!1},W=()=>y.value?b.value.filter(i=>y.value.includes(i.id)).map(i=>e.toRaw(i)):[],K=()=>W()[0],j=()=>e.toRaw(b.value),O=async()=>{if(!m.value){m.value=!0;try{if(r.onLoad){var{data:l,total:i}=await r.onLoad(n.value.page,n.value.pageSize);b.value=l,n.value.itemCount=i}}catch(C){x.error(C.message)}finally{m.value=!1}}},Y=e.computed(()=>{const l=e.unref(_);if(!l)return;const i=l?.$el,C=i.querySelector(".n-data-table-thead "),{bottomIncludeBody:L}=G(C),t=64;let c=2,s=24;const V=i.querySelector(".n-data-table__pagination");if(V){const q=V.offsetHeight;c+=q||0}else c+=28;let $=L-(t+c+s);return console.log("height",$),$}),X=l=>!l||!l.getBoundingClientRect?0:l.getBoundingClientRect(),G=l=>{const i=document.documentElement,C=i.scrollLeft,L=i.scrollTop,t=i.clientLeft,c=i.clientTop,s=window.pageXOffset,V=window.pageYOffset,$=X(l),{left:q,top:J,width:Z,height:Ye}=$,Xe=(s||C)-(t||0),Ge=(V||L)-(c||0),Je=q+s,Ze=J+V,Q=Je-Xe,U=Ze-Ge,ce=window.document.documentElement.clientWidth,ie=window.document.documentElement.clientHeight;return{left:Q,top:U,right:ce-Z-Q,bottom:ie-Ye-U,rightIncludeBody:ce-Q,bottomIncludeBody:ie-U}};return e.onMounted(async()=>await h()),d({getData:j,getSelectedRow:K,getSelectedRows:W,closeModal:R,refreshData:O,resetPage:()=>{n.value.page=1}}),(l,i)=>{const C=o.NTooltip,L=o.NDataTable,t=o.NSpace,c=o.NModal;return e.openBlock(),e.createBlock(e.unref(o.NCard),{title:" ","header-class":"p-4","content-class":"pl-4 pr-4",bordered:!1},{"header-extra":e.withCtx(()=>[l.hiddenAdd?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(C,{key:0,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(o.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:N},{default:e.withCtx(()=>[e.createVNode(e.unref(E.PlusSquareOutlined))]),_:1})]),default:e.withCtx(()=>[i[3]||(i[3]=e.createElementVNode("span",null,"新增",-1))]),_:1,__:[3]})),l.hiddenDelete?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(C,{key:1,trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(o.NIcon),{size:"18",class:"mr-1 cursor-pointer hover:text-blue-600",onClick:M},{default:e.withCtx(()=>[e.createVNode(e.unref(E.DeleteOutlined))]),_:1})]),default:e.withCtx(()=>[i[4]||(i[4]=e.createElementVNode("span",null,"删除",-1))]),_:1,__:[4]})),e.createVNode(C,{trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(o.NIcon),{size:"18",class:"cursor-pointer hover:text-blue-600",onClick:h},{default:e.withCtx(()=>[e.createVNode(e.unref(E.ReloadOutlined))]),_:1})]),default:e.withCtx(()=>[i[5]||(i[5]=e.createElementVNode("span",null,"刷新",-1))]),_:1,__:[5]})]),default:e.withCtx(()=>[e.createElementVNode("div",pe,[l.$slots.toolbar?(e.openBlock(),e.createElementBlock("div",he,[e.renderSlot(l.$slots,"toolbar")])):e.createCommentVNode("",!0),e.createVNode(L,{remote:"",ref_key:"$table",ref:_,"checked-row-keys":y.value,"onUpdate:checkedRowKeys":i[0]||(i[0]=s=>y.value=s),"max-height":Y.value,loading:m.value,bordered:!1,"single-line":!1,columns:u.value,data:b.value,pagination:n.value,"row-key":s=>s[l.idField]},null,8,["checked-row-keys","max-height","loading","columns","data","pagination","row-key"]),l.$slots.addModal?(e.openBlock(),e.createElementBlock("div",me,[e.createVNode(c,{title:"新增",preset:"dialog",show:B.value,"onUpdate:show":i[1]||(i[1]=s=>B.value=s),closable:!1,"close-on-esc":!1,"mask-closable":!1,style:e.normalizeStyle({width:`${l.modalWidth}px`})},{action:e.withCtx(()=>[e.createVNode(t,null,{default:e.withCtx(()=>[e.createVNode(e.unref(o.NButton),{type:"primary",loading:k.value,onClick:F},{default:e.withCtx(()=>i[6]||(i[6]=[e.createTextVNode("保存",-1)])),_:1,__:[6]},8,["loading"]),e.createVNode(e.unref(o.NButton),{onClick:R},{default:e.withCtx(()=>i[7]||(i[7]=[e.createTextVNode("取消",-1)])),_:1,__:[7]})]),_:1})]),default:e.withCtx(()=>[e.renderSlot(l.$slots,"addModal")]),_:3},8,["show","style"])])):e.createCommentVNode("",!0),l.$slots.editModal?(e.openBlock(),e.createElementBlock("div",ue,[e.createVNode(c,{title:"编辑",show:f.value,"onUpdate:show":i[2]||(i[2]=s=>f.value=s),preset:"dialog",closable:!1,"close-on-esc":!1,"mask-closable":!1,style:e.normalizeStyle({width:`${l.modalWidth}px`})},{action:e.withCtx(()=>[e.createVNode(t,null,{default:e.withCtx(()=>[e.createVNode(e.unref(o.NButton),{type:"primary",loading:k.value,onClick:F},{default:e.withCtx(()=>i[8]||(i[8]=[e.createTextVNode("保存",-1)])),_:1,__:[8]},8,["loading"]),e.createVNode(e.unref(o.NButton),{onClick:R},{default:e.withCtx(()=>i[9]||(i[9]=[e.createTextVNode("取消",-1)])),_:1,__:[9]})]),_:1})]),default:e.withCtx(()=>[e.renderSlot(l.$slots,"editModal")]),_:3},8,["show","style"])])):e.createCommentVNode("",!0)])]),_:3})}}}),I=a=>{const d=a;return d.install=function(_){_.component(d.__name,a)},a},ee=I(ge),_e=["Redirect","RedirectSon","login"],z=v.defineStore("p-layout",()=>{const a=e.reactive({collapsed:!1,title:"输入项目名称",logo:"https://picsum.photos/id/1/100/100",avatar:"",uid:"",uname:"",tabs:[],cacheTabs:!1});return{state:a,initTabs:p=>{p.sort((u,h)=>(h.meta.affix?1:0)-(u.meta.affix?1:0)),a.tabs=p},addTab:p=>_e.includes(p.name)?!1:(a.tabs?.some(h=>h.fullPath==p.fullPath)||a.tabs?.push(p),!0),closeCurrentTab:p=>{const u=a.tabs.findIndex(h=>h.fullPath==p.fullPath);a.tabs.splice(u,1)},closeAllTabs:()=>{a.tabs=a.tabs.filter(p=>p?.meta?.affix??!1)},closeOtherTabs:p=>{a.tabs=a.tabs.filter(u=>u.fullPath==p.fullPath||(u?.meta?.affix??!1))},closeLeftTabs:p=>{const u=a.tabs.findIndex(h=>h.fullPath==p.fullPath);a.tabs=a.tabs.filter((h,w)=>w>=u||(h?.meta?.affix??!1))},closeRightTabs:p=>{const u=a.tabs.findIndex(h=>h.fullPath==p.fullPath);a.tabs=a.tabs.filter((h,w)=>w<=u||(h?.meta?.affix??!1))},collapse:()=>{a.collapsed=!a.collapsed},setTitle:p=>{a.title=p},setLogo:p=>{a.logo=p},setUser:(p,u)=>{a.uid=p,a.uname=u},setSettingPages:p=>{a.settingPages=p},setLogout:p=>{a.logout=p}}}),we={class:"logo"},ye=e.defineComponent({__name:"PLogo",setup(a){const d=z();return(_,g)=>(e.openBlock(),e.createElementBlock("div",we,[e.createVNode(e.unref(o.NAvatar),{color:"var(--color-logo)",size:32,src:e.unref(d).state.logo,class:e.normalizeClass({"mr-2":!e.unref(d).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(d).state.title),513),[[e.vShow,!e.unref(d).state.collapsed]])]))}}),H=(a,d)=>{const _=a.__vccOpts||a;for(const[g,x]of d)_[g]=x;return _},be=H(ye,[["__scopeId","data-v-c9496d2e"]]),ke={translationApiUrl:"https://translate.zvo.cn/api",defaultLanguage:"chinese",currentLanguage:"",options:[],selectCallback:a=>{},initLanguage:a=>{}},te=v.defineStore("language",()=>{const a=e.ref(ke),d=f=>{f.forEach(k=>{(k.key==="Chinese"||k.key==="chinese")&&(k.key="chinese_simplified")}),a.value.options=[...f]},_=()=>a.value.options,g=f=>{if(a.value.currentLanguage===f)return;const k=a.value.options.find(n=>n.key===f);k&&(a.value.currentLanguage=k.key,a.value.selectCallback(k))},x=()=>{if(a.value.currentLanguage)return a.value.options.find(f=>f.key===a.value.currentLanguage)},m=f=>{a.value.selectCallback=f},y=()=>a.value.translationApiUrl,b=f=>{a.value.translationApiUrl=f},S=f=>{(f==="Chinese"||f==="chinese")&&(f="chinese_simplified"),a.value.defaultLanguage=f},B=()=>a.value.defaultLanguage?a.value.defaultLanguage:"chinese_simplified";return e.onMounted(()=>{a.value.initLanguage(a.value)}),{state:a,select:g,setLanguages:d,getLanguages:_,getCurrentLanguage:x,setSelectCallback:m,setTranslationApiUrl:b,getTranslationApiUrl:y,setDefaultLanguage:S,getDefaultLanguage:B}}),Ce={key:1},oe=e.defineComponent({__name:"PLanguage",setup(a){const{select:d,getLanguages:_,getCurrentLanguage:g,getDefaultLanguage:x,getTranslationApiUrl:m}=te(),y=S=>d(S),b=()=>{window.translate.selectLanguageTag.show=!1,window.translate.selectLanguageTag.languages=_().map(S=>S.key).join(","),window.translate.ignore.class.push("ignore-translate-flag"),window.translate.ignore.id.push("ignore-translation"),window.translate.language.setLocal(x()),window.translate.request.api.translate="api/v1/translation",window.translate.request.api.connectTest="api/v1/translation/connect-test",window.translate.request.api.init="api/v1/translation/init",window.translate.request.api.language="api/v1/translation/language",window.translate.request.setHost(m()),window.translate.request.listener.start(),window.translate.listener.start(),window.translate.whole.enableAll(),window.translate.execute()};return e.onMounted(async()=>await e.nextTick(()=>b())),(S,B)=>{const f=o.NIcon,k=o.NButton;return e.unref(_)().length>0?(e.openBlock(),e.createBlock(e.unref(o.NDropdown),{key:0,id:"ignore-translation",placement:"bottom-start",trigger:"hover",class:"flex flex-col justify-center h-full ignore",onSelect:y,options:e.unref(_)()},{default:e.withCtx(()=>[e.createVNode(k,{quaternary:"",type:"info"},{default:e.withCtx(()=>[e.unref(g)()?(e.openBlock(),e.createElementBlock("label",Ce,e.toDisplayString(e.unref(g)()?.label),1)):(e.openBlock(),e.createBlock(f,{key:0,size:"18"},{default:e.withCtx(()=>B[0]||(B[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,__:[0]}))]),_:1})]),_:1},8,["options"])):e.createCommentVNode("",!0)}}}),Ne={class:"layout-header"},xe={class:"layout-header-left"},Ve={class:"link-text"},Se={key:1,class:"link-text"},Be={class:"layout-header-right"},Te={class:"layout-header-trigger-min"},Pe={class:"layout-header-trigger layout-header-trigger-min"},Le={class:"layout-header-trigger layout-header-trigger-min"},Ee={class:"avatar"},Me=H(e.defineComponent({__name:"PHeader",setup(a){const d=o.useMessage(),_=o.useDialog(),g=z(),x=D.useRouter(),m=D.useRoute(),y=e.inject("reloadPage"),b=u=>x.push({name:u}),S=e.computed(()=>B(m.matched)),B=u=>u.map(h=>{const w={key:h.name,label:h.meta.title,icon:h.meta.icon,meta:h.meta,disabled:h.path==="/",children:void 0};return h.children&&h.children.length>0&&(w.children=B(h.children)),w}),f=e.ref(!1),k=()=>{document.fullscreenElement?document.exitFullscreen&&(document.exitFullscreen(),f.value=!1):(document.documentElement.requestFullscreen(),f.value=!0)},n=e.computed(()=>{const u=[];return u.push({label:"退出登录",key:"logout"}),g.state.settingPages&&g.state.settingPages.length>0&&g.state.settingPages.forEach(h=>{u.push({label:h.title,key:h.route})}),u}),r=u=>{switch(u){case"logout":p();break;default:x.push({name:u})}},p=()=>{_.info({title:"提示",content:"您确定要退出登录吗",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(g.state.logout)try{await g.state.logout(),localStorage.removeItem("TABS-ROUTES"),d.error("退出成功")}catch(u){console.error(u),d.error("退出登录失败")}finally{location.reload()}else d.error("没有配置登出接口, 请配置[usePLayoutStore.logout]方法")},onNegativeClick:()=>{}})};return(u,h)=>{const w=o.NTooltip,M=o.NDivider,P=o.NAvatar;return e.openBlock(),e.createElementBlock("div",Ne,[e.createElementVNode("div",xe,[e.createElementVNode("div",{class:"ml-1 layout-header-trigger layout-header-trigger-min",onClick:h[0]||(h[0]=(...N)=>e.unref(g).collapse&&e.unref(g).collapse(...N))},[e.unref(g).state.collapsed?(e.openBlock(),e.createBlock(e.unref(o.NIcon),{key:0,size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.MenuUnfoldOutlined))]),_:1})):(e.openBlock(),e.createBlock(e.unref(o.NIcon),{key:1,size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.MenuFoldOutlined))]),_:1}))]),e.createElementVNode("div",{class:"mr-1 layout-header-trigger layout-header-trigger-min",onClick:h[1]||(h[1]=(...N)=>e.unref(y)&&e.unref(y)(...N))},[e.createVNode(e.unref(o.NIcon),{size:"18"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.ReloadOutlined))]),_:1})]),e.createVNode(e.unref(o.NBreadcrumb),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.value,N=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:N.label},[N.label?(e.openBlock(),e.createBlock(e.unref(o.NBreadcrumbItem),{key:0},{default:e.withCtx(()=>[N.children&&N.children.length?(e.openBlock(),e.createBlock(e.unref(o.NDropdown),{key:0,options:N.children,onSelect:b},{default:e.withCtx(()=>[e.createElementVNode("span",Ve,[N.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(N.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(N.label),1)])]),_:2},1032,["options"])):(e.openBlock(),e.createElementBlock("span",Se,[N.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(N.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(N.label),1)]))]),_:2},1024)):e.createCommentVNode("",!0)],64))),128))]),_:1})]),e.createElementVNode("div",Be,[e.createElementVNode("div",Te,[e.createVNode(oe)]),e.createElementVNode("div",Pe,[e.createVNode(w,{placement:"bottom"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(o.NIcon),{size:"18",onClick:e.withModifiers(k,["stop"])},{default:e.withCtx(()=>[f.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(()=>[h[2]||(h[2]=e.createElementVNode("span",null,"全屏",-1))]),_:1,__:[2]})]),e.createElementVNode("div",Le,[e.createVNode(e.unref(o.NDropdown),{trigger:"hover",onSelect:r,options:n.value},{default:e.withCtx(()=>[e.createElementVNode("div",Ee,[e.createElementVNode("span",null,e.toDisplayString(e.unref(g).state.uname),1),e.createVNode(M,{vertical:""}),e.createVNode(P,{round:"",src:e.unref(g).state.avatar},null,8,["src"])])]),_:1},8,["options"])])])])}}}),[["__scopeId","data-v-93589779"]]),$e={class:"mt-1"},Oe=e.defineComponent({__name:"PContent",props:{loading:{type:Boolean,default:!1}},setup(a){return(d,_)=>{const g=e.resolveComponent("RouterView");return e.openBlock(),e.createElementBlock("div",$e,[d.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(g,{key:0},{default:e.withCtx(({Component:x,route:m})=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x),{key:m.fullPath}))],1024))]),_:1}))])}}}),De={class:"tabs-view-main"},ze=["id","onClick","onContextmenu"],Re={class:"tabs-close"},Ie={class:"tabs-close-btn"},Ae=H(e.defineComponent({__name:"PTabs",setup(a){e.useCssVars(t=>({"4cb4fdc8":_.value,"21e8bab2":g.value}));const d=o.useThemeVars(),_=e.computed(()=>d.value.cardColor),g=e.computed(()=>d.value.textColor1),x=o.useMessage(),m=D.useRoute(),y=D.useRouter(),b=e.ref(null),S=e.ref(null),B=e.ref(!1),f=z(),k=e.computed(()=>f.state.tabs),n=e.reactive({activeKey:m.fullPath,scrollable:!0,dropdownX:0,dropdownY:0,showDropdown:!1,isMultiHeaderFixed:!0,multiTabsSetting:!0}),r=["Login","Redirect","ErrorPage"],p=t=>{const{fullPath:c,hash:s,meta:V,name:$,params:q,path:J,query:Z}=t;return{fullPath:c,hash:s,meta:V,name:$,params:q,path:J,query:Z}},u=e.computed(()=>{const s=f.state.collapsed?"64px":"272px";return{left:s,width:`calc(100% - ${s})`}}),h=e.computed(()=>{const t=k.value.length<=1;return[{label:"刷新当前",key:"1",icon:()=>e.h(o.NIcon,null,{default:()=>e.h(E.ReloadOutlined)})},{label:"关闭当前",key:"2",disabled:B.value||t,icon:()=>e.h(o.NIcon,null,{default:()=>e.h(E.CloseOutlined)})},{label:"关闭其他",key:"3",disabled:t,icon:()=>e.h(o.NIcon,null,{default:()=>e.h(E.ColumnWidthOutlined)})},{label:"关闭全部",key:"4",disabled:t,icon:()=>e.h(o.NIcon,null,{default:()=>e.h(E.MinusOutlined)})}]}),w=()=>{let t=[];const c=p(m);try{if(f.state.cacheTabs){const s=localStorage.getItem("TABS_ROUTES");t=s?JSON.parse(s):[c]}}catch{t=[c]}finally{return t}},M=t=>{const c=y.getRoutes();t.forEach(s=>{const V=c.find($=>$.path===s.path);V&&(s.meta=V.meta||s.meta,s.name=V.name||s.name)}),f.state.cacheTabs&&localStorage.setItem("TABS_ROUTES",JSON.stringify(t))},P=()=>{const t=w();M(t),f.initTabs(t)},N=async t=>{if(await e.nextTick(),!b.value)return;const c=b.value.offsetWidth,s=b.value.scrollWidth;c<s?(n.scrollable=!0,t&&[...b.value.querySelectorAll(".tabs-card-scroll-item")||[]].forEach($=>{$.id===`tag${n.activeKey.split("/").join("/")}`&&$.scrollIntoView&&$.scrollIntoView()})):n.scrollable=!1},A=t=>!(t.draggedContext.element.meta.affix||t.relatedContext.element.meta.affix),F=()=>{let t;t=de(),t.listenTo(S.value,()=>N(!0))},R=t=>{const{fullPath:c}=t;if(c===m.fullPath||(n.activeKey=c,!t))return;const{replace:s}=y;toString.call(t),s(t).catch(console.error)},W=(t,c)=>{t.preventDefault(),B.value=c.path==="/home",n.showDropdown=!1,e.nextTick().then(()=>{n.showDropdown=!0,n.dropdownX=t.clientX,n.dropdownY=t.clientY})},K=()=>{m.meta.keepAlive&&y.currentRoute.value.matched.find(t=>t.name==m.name)?.components?.default.name},j=t=>{if(k.value.length===1)return x.warning("这已经是最后一页,不能再关闭了!");if(K(),f.closeCurrentTab(t),n.activeKey===t.fullPath){const c=k.value[Math.max(0,k.value.length-1)];n.activeKey=c.fullPath,y.push(c)}N()},O=t=>{const{fullPath:c}=t,s=k.value.find(V=>V.fullPath==c);j(s)},Y=t=>{f.closeOtherTabs(t),n.activeKey=t.fullPath,y.replace(t.fullPath),N()},X=()=>{f.closeAllTabs(),N()},G=e.inject("reloadPage"),l=t=>{switch(t){case"1":G();break;case"2":j(m);break;case"3":Y(m);break;case"4":X();break}N(),n.showDropdown=!1},i=(t,c)=>{const s=b.value.scrollLeft,V=c>0&&s+c>=t||c<0&&s+c<=t?t:s+c;if(b.value&&b.value.scrollTo(V,0),V!==t)return window.requestAnimationFrame(()=>i(t,c))},C=()=>{const t=b.value.offsetWidth,c=b.value.scrollLeft;if(!c)return;const s=c>t?c-t:0;i(s,(s-c)/20)},L=()=>{const t=b.value.offsetWidth,c=b.value.scrollWidth,s=b.value.scrollLeft;if(c-s<=t)return;const V=c-s>t*2?s+t:c-t;i(V,(V-s)/20)};return window.addEventListener("beforeunload",()=>{localStorage.setItem("TABS_ROUTES",JSON.stringify(k.value))}),window.addEventListener("scroll",t=>{let c=t.target.scrollTop||document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop;n.isMultiHeaderFixed=c>=64},!0),e.watch(()=>m.fullPath,t=>{r.includes(m.name)||(n.activeKey=t,f.addTab(p(m)),N(!0))},{immediate:!0}),P(),e.onMounted(()=>F()),(t,c)=>(e.openBlock(),e.createElementBlock("div",{class:"box-border tabs-view tabs-view-fix tabs-view-default-background",style:e.normalizeStyle(u.value)},[e.createElementVNode("div",De,[e.createElementVNode("div",{ref_key:"navWrap",ref:S,class:e.normalizeClass(["tabs-card",{"tabs-card-scrollable":n.scrollable}])},[e.createElementVNode("span",{class:e.normalizeClass(["tabs-card-prev",{"tabs-card-prev-hide":!n.scrollable}]),onClick:C},[e.createVNode(e.unref(o.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.LeftOutlined))]),_:1})],2),e.createElementVNode("span",{class:e.normalizeClass(["tabs-card-next",{"tabs-card-next-hide":!n.scrollable}]),onClick:L},[e.createVNode(e.unref(o.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.RightOutlined))]),_:1})],2),e.createElementVNode("div",{ref_key:"navScroll",ref:b,class:"tabs-card-scroll"},[e.createVNode(e.unref(fe),{list:k.value,animation:"300","item-key":"fullPath",class:"flex",move:A},{item:e.withCtx(({element:s})=>[e.createElementVNode("div",{id:`tag${s.fullPath.split("/").join("/")}`,class:e.normalizeClass(["tabs-card-scroll-item",{"active-item":n.activeKey===s.fullPath}]),onClick:e.withModifiers(V=>R(s),["stop"]),onContextmenu:V=>W(V,s)},[e.createElementVNode("span",null,e.toDisplayString(s.meta.title),1),s.meta.affix?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(o.NIcon),{key:0,size:"14",onClick:e.withModifiers(V=>O(s),["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(E.CloseOutlined))]),_:2},1032,["onClick"]))],42,ze)]),_:1},8,["list"])],512)],2),e.createElementVNode("div",Re,[e.createVNode(e.unref(o.NDropdown),{trigger:"hover",onSelect:l,placement:"bottom-end",options:h.value},{default:e.withCtx(()=>[e.createElementVNode("div",Ie,[e.createVNode(e.unref(o.NIcon),{size:"16",color:"#515a6e"},{default:e.withCtx(()=>[e.createVNode(e.unref(E.DownOutlined))]),_:1})])]),_:1},8,["options"])]),e.createVNode(e.unref(o.NDropdown),{show:n.showDropdown,x:n.dropdownX,y:n.dropdownY,onClickoutside:c[0]||(c[0]=s=>n.showDropdown=!1),placement:"bottom-start",onSelect:l,options:h.value},null,8,["show","x","y","options"])])],4))}}),[["__scopeId","data-v-f0706f46"]]),We=e.defineComponent({__name:"PMenus",setup(a){const d=D.useRoute(),_=D.useRouter(),g=z(),x=e.ref(d.name),m=e.ref(d.matched&&d.matched.length?d.matched.map(n=>n.name):[]),y=e.ref([]),b=n=>{/http(s)?:/.test(n)?window.open(n):_.push({name:n})},S=n=>{if(!n)return;const r=n.find(p=>m.value.indexOf(p)===-1);m.value=r?[r]:[]},B=()=>{const n=d.matched;m.value=n.map(p=>p.name);const r=d.meta?.activeMenu||"";x.value=r||d.name},f=(n,r=[],p=!1)=>{const u=[],h=["/:path(.*)*","/redirect","/redirect/:path(.*)","/login","/oidc-callback"];if(!n||n.length===0)return u;n=n.sort((w,M)=>{let P=(M.children?.length?1:0)-(w.children?.length?1:0);return P===0&&(P=(w.meta?.sort??0)-(M.meta?.sort??0)),P});for(const w of n){if(p||(w.meta?.hidden||!1)==!0||h.includes(w.path)){r.push(w.name),w.children&&w.children.length>0&&f(w.children,r,!0);continue}const M=w.meta?.alwaysShow!=!0&&w?.children?.filter(A=>!A?.meta?.hidden)?.length===1,P=M?w.children[0]:w,N={key:P.name,label:P.meta?.title,affix:P.meta?.affix,sort:P.meta?.sort,path:P.path,redirect:P.redirect,icon:M?w.meta?.icon:P.meta?.icon,permissions:P.meta?.permissions,meta:P.meta,children:void 0};if(!r.includes(w.name)){if(u.push(N),r.push(w.name),M){f(w.children,r,p);continue}w.children&&w.children.length>0&&(N.children=f(w.children,r,p))}}return u},k=()=>{const n=_.getRoutes();y.value=f(n)};return e.watch(()=>d.fullPath,()=>{B()}),e.onMounted(()=>{k(),B()}),(n,r)=>(e.openBlock(),e.createBlock(e.unref(o.NMenu),{class:"h-full",inverted:"",mode:"vertical",options:y.value,collapsed:e.unref(g).state.collapsed,"collapsed-width":64,"collapsed-icon-size":20,indent:24,"expanded-keys":m.value,value:x.value,"onUpdate:value":b,"onUpdate:expandedKeys":S},null,8,["options","collapsed","expanded-keys","value"]))}}),qe={class:"layout-content-main layout-content-main-fix"},He={class:"main-view main-view-fix"},ne=I(H(e.defineComponent({__name:"PLayout",setup(a){const d=z(),_=e.ref(!1),g=()=>{_.value=!0,e.nextTick(()=>_.value=!1)};return e.provide("reloadPage",g),(x,m)=>{const y=o.NBackTop;return e.openBlock(),e.createBlock(e.unref(o.NLayout),{"has-sider":"",class:"layout",position:"absolute"},{default:e.withCtx(()=>[e.createVNode(e.unref(o.NLayoutSider),{class:"layout-sider",inverted:"","show-trigger":"bar",position:"absolute","collapse-mode":"width",collapsed:e.unref(d).state.collapsed,"native-scrollbar":!1,"collapsed-width":64,onCollapse:e.unref(d).collapse,onExpand:e.unref(d).collapse},{default:e.withCtx(()=>[e.createVNode(e.unref(o.NFlex),{vertical:""},{default:e.withCtx(()=>[e.createVNode(be),e.createVNode(We)]),_:1})]),_:1},8,["collapsed","onCollapse","onExpand"]),e.createVNode(e.unref(o.NLayout),null,{default:e.withCtx(()=>[e.createVNode(e.unref(o.NLayoutHeader),{position:"absolute"},{default:e.withCtx(()=>[e.createVNode(Me)]),_:1}),e.createVNode(e.unref(o.NLayoutContent),{class:"layout-content layout-default-background"},{default:e.withCtx(()=>[e.createElementVNode("div",qe,[e.createVNode(Ae),e.createElementVNode("div",He,[e.createVNode(Oe,{loading:_.value},null,8,["loading"])])])]),_:1}),e.createVNode(y,{right:20,class:"z-50"})]),_:1})]),_:1})}}}),[["__scopeId","data-v-87dcb433"]])),ae=I(e.defineComponent({__name:"PApplication",props:{theme:{},themeOverrides:{default:{common:{primaryColor:"#2d8cf0",primaryColorHover:"#3c9bff",primaryColorPressed:"#3c9bff",primaryColorSuppl:"#2d8cf0"},LoadingBar:{colorLoading:"#2d8cf0"}}}},setup(a){return(d,_)=>{const g=o.NConfigProvider;return e.openBlock(),e.createBlock(g,{locale:e.unref(o.zhCN),theme:d.theme,"theme-overrides":d.themeOverrides,"date-locale":e.unref(o.dateZhCN)},{default:e.withCtx(()=>[e.createVNode(e.unref(o.NDialogProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(o.NNotificationProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(o.NMessageProvider),null,{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default")]),_:3})]),_:3})]),_:3})]),_:3},8,["locale","theme","theme-overrides","date-locale"])}}})),Fe={class:"w-full cursor-move",id:"basic-modal-bar"},le=I(e.defineComponent({__name:"PModal",props:{saveBtnText:{default:"保 存"},closable:{type:Boolean,default:!1},preset:{default:"dialog"},title:{default:"操作"},onSave:{},onClose:{}},setup(a,{expose:d}){const _=o.useMessage(),g=a,x=e.ref(null),m=e.ref(!1),y=e.ref(!1),b=async()=>{m.value=!0;try{g.onSave&&await g.onSave()&&S()}catch(n){_.error(n.message)}finally{m.value=!1}},S=()=>{y.value=!1,m.value=!1},B=async()=>{try{g.onClose?await g.onClose()&&S():S()}catch(n){_.error(n.message)}};return d({open:()=>{m.value=!1,y.value=!0},close:()=>{y.value=!1,m.value=!1}}),(n,r)=>{const p=o.NButton,u=o.NSpace;return e.openBlock(),e.createBlock(e.unref(o.NModal),e.mergeProps({ref_key:"$modal",ref:x,preset:"dialog",show:y.value,"onUpdate:show":r[0]||(r[0]=h=>y.value=h)},n.$attrs,{draggable:!0,closable:!1,"close-on-esc":!1,"mask-closable":!1,style:{width:"800px"},onClose:S}),e.createSlots({header:e.withCtx(()=>[e.createElementVNode("div",Fe,e.toDisplayString(n.title),1)]),default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:2},[n.$slots.action?{name:"action",fn:e.withCtx(()=>[e.renderSlot(n.$slots,"action")]),key:"1"}:{name:"action",fn:e.withCtx(()=>[e.createVNode(u,null,{default:e.withCtx(()=>[e.createVNode(p,{type:"primary",loading:m.value,onClick:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.saveBtnText),1)]),_:1},8,["loading"]),e.createVNode(p,{onClick:B},{default:e.withCtx(()=>r[1]||(r[1]=[e.createTextVNode("取 消",-1)])),_:1,__:[1]})]),_:1})]),key:"0"}]),1040,["show"])}}})),se=I(oe),je=Object.freeze(Object.defineProperty({__proto__:null,PApplication:ae,PLanguage:se,PLayout:ne,PModal:le,PTable:ee},Symbol.toStringTag,{value:"Module"})),re=(a,d)=>(Object.values(je).forEach(_=>{_.install&&a.use(_)}),d?.(),a),Ke={install:re};T.PApplication=ae,T.PLanguage=se,T.PLayout=ne,T.PModal=le,T.PTable=ee,T.default=Ke,T.install=re,T.usePLanguageStore=te,T.usePLayoutStore=z,Object.defineProperties(T,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(T,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):(T=typeof globalThis<"u"?globalThis:T||self,n(T.naiveplus={},T.naiveUi,T.Vue,T.antd,T.pinia,T.vueRouter,T.elementResizeDetectorMaker,T.Draggable))})(this,function(T,n,e,E,v,D,fe,pe){"use strict";const ee=(o,s={})=>{Object.keys(o).forEach(c=>{Array.isArray(o[c])?o[c]=[]:o[c]&&typeof o[c]=="object"&&!Array.isArray(o[c])?s[c]&&typeof s[c]=="object"&&!Array.isArray(s[c])?ee(o[c],s[c]):o[c]=void 0:o[c]=s[c]!==void 0?s[c]:void 0})},he={id:"data-content"},me={key:0,class:"rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-5 mb-5"},ue={key:1},ge={key:2},_e=e.defineComponent({__name:"PTable",props:{idField:{default:"id"},item:{},columns:{},modalWidth:{default:800},hiddenAdd:{type:Boolean,default:!1},hiddenEdit:{type:Boolean,default:!1},hiddenDelete:{type:Boolean,default:!1},onLoad:{},onGet:{},onOpenModal:{},onCloseModal:{},onSave:{},onDelete:{}},setup(o,{expose:s}){const c=e.ref(null),u=n.useDialog(),x=n.useMessage(),g=e.ref(!1),y=e.ref([]),C=e.ref([]),S=e.ref(null),B=e.ref(!1),p=e.ref(!1),b=e.ref(!1),a=e.ref({page:1,itemCount:0,pageSize:10,pageSizes:[10,20,30,50],showSizePicker:!0,onChange:async r=>{a.value.page=r,await O()},onUpdatePageSize:async r=>{a.value.pageSize=r,await O()}}),i=o,h=r=>{const f=N=>{const L=[];return r&&r.forEach(t=>{t.key!=="edit"&&t.key!=="delete"&&L.push({label:t.name,key:t.key,props:{onClick:()=>t.action(N)}})}),L};return{title:"操作",key:"actions",width:100,fixed:"right",render:N=>{let L=[];if(i.hiddenEdit||L.push({label:"编辑",key:"edit",props:{onClick:()=>A(N)}}),i.hiddenDelete||L.push({label:"删除",key:"delete",props:{onClick:()=>w(N)}}),L=[...L,...f(N)],!(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))]})})}}},_=e.computed(()=>{const r=i.columns.filter(N=>N.key!="action").map(N=>({title:N.title,key:N.key,width:N.width,fixed:N.fixed??!1,render:N.render,ellipsis:N.ellipsis?{tooltip:!0}:!1})),f=i.columns.reduce((N,L)=>L.key==="action"?L:N,void 0)?.action;return f&&f?.length>0||!i.hiddenDelete||!i.hiddenEdit?[{type:"selection",fixed:"left"},...r,h(f)]:[{type:"selection",fixed:"left"},...r]}),m=async()=>{await O()},w=r=>{P([r])},$=()=>{const r=W();P(r)},P=r=>{r&&r.length>0&&u.warning({title:"警告",content:"删除数据不可恢复, 确认删除吗?",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(i.onDelete)try{await i.onDelete(r)?(O(),x.success("删除成功")):x.error("删除失败")}catch(f){x.error(f.message)}}})},k=()=>{if(i.onOpenModal){i.onOpenModal();return}p.value=!1,B.value=!0},A=async r=>{if(i.onOpenModal){i.onOpenModal(r);return}i.onGet&&(r=await i.onGet(r[i.idField])),S.value=r,Object.assign(i.item,r),B.value=!1,p.value=!0},F=async()=>{if(i.onSave)try{b.value=!0,(B.value?await i.onSave():await i.onSave(S.value[i.idField]))&&(R(),await O())}catch(r){x.error(r.message)}finally{b.value=!1}},R=()=>{i.onCloseModal&&i.onCloseModal(),ee(i.item),S.value=null,B.value=!1,p.value=!1},W=()=>y.value?C.value.filter(f=>y.value.includes(f.id)).map(f=>e.toRaw(f)):[],j=()=>W()[0],K=()=>e.toRaw(C.value),O=async()=>{if(!g.value){g.value=!0;try{if(i.onLoad){var{data:r,total:f}=await i.onLoad(a.value.page,a.value.pageSize);C.value=r,a.value.itemCount=f}}catch(N){x.error(N.message)}finally{g.value=!1}}},Y=e.computed(()=>{const r=e.unref(c);if(!r)return;const f=r?.$el,N=f.querySelector(".n-data-table-thead "),{bottomIncludeBody:L}=G(N),t=64;let d=2,l=24;const V=f.querySelector(".n-data-table__pagination");if(V){const q=V.offsetHeight;d+=q||0}else d+=28;let M=L-(t+d+l);return console.log("height",M),M}),X=r=>!r||!r.getBoundingClientRect?0:r.getBoundingClientRect(),G=r=>{const f=document.documentElement,N=f.scrollLeft,L=f.scrollTop,t=f.clientLeft,d=f.clientTop,l=window.pageXOffset,V=window.pageYOffset,M=X(r),{left:q,top:J,width:Z,height:Xe}=M,Ge=(l||N)-(t||0),Je=(V||L)-(d||0),Ze=q+l,Qe=J+V,Q=Ze-Ge,U=Qe-Je,ie=window.document.documentElement.clientWidth,de=window.document.documentElement.clientHeight;return{left:Q,top:U,right:ie-Z-Q,bottom:de-Xe-U,rightIncludeBody:ie-Q,bottomIncludeBody:de-U}};return e.onMounted(async()=>await m()),s({getData:K,getSelectedRow:j,getSelectedRows:W,closeModal:R,refreshData:O,resetPage:()=>{a.value.page=1}}),(r,f)=>{const N=n.NTooltip,L=n.NDataTable,t=n.NSpace,d=n.NModal;return e.openBlock(),e.createBlock(e.unref(n.NCard),{title:" ","header-class":"p-4","content-class":"pl-4 pr-4",bordered:!1},{"header-extra":e.withCtx(()=>[r.hiddenAdd?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(N,{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:k},{default:e.withCtx(()=>[e.createVNode(e.unref(E.PlusSquareOutlined))]),_:1})]),default:e.withCtx(()=>[f[3]||(f[3]=e.createElementVNode("span",null,"新增",-1))]),_:1,__:[3]})),r.hiddenDelete?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(N,{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(()=>[f[4]||(f[4]=e.createElementVNode("span",null,"删除",-1))]),_:1,__:[4]})),e.createVNode(N,{trigger:"hover"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(n.NIcon),{size:"18",class:"cursor-pointer hover:text-blue-600",onClick:m},{default:e.withCtx(()=>[e.createVNode(e.unref(E.ReloadOutlined))]),_:1})]),default:e.withCtx(()=>[f[5]||(f[5]=e.createElementVNode("span",null,"刷新",-1))]),_:1,__:[5]})]),default:e.withCtx(()=>[e.createElementVNode("div",he,[r.$slots.toolbar?(e.openBlock(),e.createElementBlock("div",me,[e.renderSlot(r.$slots,"toolbar")])):e.createCommentVNode("",!0),e.createVNode(L,{remote:"",ref_key:"$table",ref:c,"checked-row-keys":y.value,"onUpdate:checkedRowKeys":f[0]||(f[0]=l=>y.value=l),"max-height":Y.value,loading:g.value,bordered:!1,"single-line":!1,columns:_.value,data:C.value,pagination:a.value,"row-key":l=>l[r.idField]},null,8,["checked-row-keys","max-height","loading","columns","data","pagination","row-key"]),r.$slots.addModal?(e.openBlock(),e.createElementBlock("div",ue,[e.createVNode(d,{title:"新增",preset:"dialog",show:B.value,"onUpdate:show":f[1]||(f[1]=l=>B.value=l),closable:!1,"close-on-esc":!1,"mask-closable":!1,style:e.normalizeStyle({width:`${r.modalWidth}px`})},{action:e.withCtx(()=>[e.createVNode(t,null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.NButton),{type:"primary",loading:b.value,onClick:F},{default:e.withCtx(()=>f[6]||(f[6]=[e.createTextVNode("保存",-1)])),_:1,__:[6]},8,["loading"]),e.createVNode(e.unref(n.NButton),{onClick:R},{default:e.withCtx(()=>f[7]||(f[7]=[e.createTextVNode("取消",-1)])),_:1,__:[7]})]),_:1})]),default:e.withCtx(()=>[e.renderSlot(r.$slots,"addModal")]),_:3},8,["show","style"])])):e.createCommentVNode("",!0),r.$slots.editModal?(e.openBlock(),e.createElementBlock("div",ge,[e.createVNode(d,{title:"编辑",show:p.value,"onUpdate:show":f[2]||(f[2]=l=>p.value=l),preset:"dialog",closable:!1,"close-on-esc":!1,"mask-closable":!1,style:e.normalizeStyle({width:`${r.modalWidth}px`})},{action:e.withCtx(()=>[e.createVNode(t,null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.NButton),{type:"primary",loading:b.value,onClick:F},{default:e.withCtx(()=>f[8]||(f[8]=[e.createTextVNode("保存",-1)])),_:1,__:[8]},8,["loading"]),e.createVNode(e.unref(n.NButton),{onClick:R},{default:e.withCtx(()=>f[9]||(f[9]=[e.createTextVNode("取消",-1)])),_:1,__:[9]})]),_:1})]),default:e.withCtx(()=>[e.renderSlot(r.$slots,"editModal")]),_:3},8,["show","style"])])):e.createCommentVNode("",!0)])]),_:3})}}}),I=o=>{const s=o;return s.install=function(c){c.component(s.__name,o)},o},te=I(_e),we=["Redirect","RedirectSon","login"],z=v.defineStore("p-layout",()=>{const o=e.reactive({collapsed:!1,title:"输入项目名称",logo:"https://picsum.photos/id/1/100/100",avatar:"",uid:"",uname:"",tabs:[],cacheTabs:!1});return{state:o,initTabs:h=>{h.sort((_,m)=>(m.meta.affix?1:0)-(_.meta.affix?1:0)),o.tabs=h},addTab:h=>we.includes(h.name)?!1:(o.tabs?.some(m=>m.fullPath==h.fullPath)||o.tabs?.push(h),!0),closeCurrentTab:h=>{const _=o.tabs.findIndex(m=>m.fullPath==h.fullPath);o.tabs.splice(_,1)},closeAllTabs:()=>{o.tabs=o.tabs.filter(h=>h?.meta?.affix??!1)},closeOtherTabs:h=>{o.tabs=o.tabs.filter(_=>_.fullPath==h.fullPath||(_?.meta?.affix??!1))},closeLeftTabs:h=>{const _=o.tabs.findIndex(m=>m.fullPath==h.fullPath);o.tabs=o.tabs.filter((m,w)=>w>=_||(m?.meta?.affix??!1))},closeRightTabs:h=>{const _=o.tabs.findIndex(m=>m.fullPath==h.fullPath);o.tabs=o.tabs.filter((m,w)=>w<=_||(m?.meta?.affix??!1))},collapse:()=>{o.collapsed=!o.collapsed},setTitle:h=>{o.title=h},setLogo:h=>{o.logo=h},setUser:(h,_)=>{o.uid=h,o.uname=_},setSettingPages:h=>{o.settingPages=h},setLogout:h=>{o.logout=h}}}),ye={class:"logo"},Ce=e.defineComponent({__name:"PLogo",setup(o){const s=z();return(c,u)=>(e.openBlock(),e.createElementBlock("div",ye,[e.createVNode(e.unref(n.NAvatar),{color:"var(--color-logo)",size:32,src:e.unref(s).state.logo,class:e.normalizeClass({"mr-2":!e.unref(s).state.collapsed})},null,8,["src","class"]),e.withDirectives(e.createElementVNode("h1",{class:"font-bold ease-in-out ml-2 logo-size"},e.toDisplayString(e.unref(s).state.title),513),[[e.vShow,!e.unref(s).state.collapsed]])]))}}),H=(o,s)=>{const c=o.__vccOpts||o;for(const[u,x]of s)c[u]=x;return c},be=H(Ce,[["__scopeId","data-v-c9496d2e"]]),Ne={translationApiUrl:"https://translate.zvo.cn/api",defaultLanguage:"chinese",currentLanguage:"",options:[],selectCallback:o=>{},initLanguage:o=>{}},oe=v.defineStore("language",()=>{const o=e.ref(Ne),s=p=>{p.forEach(b=>{(b.key==="Chinese"||b.key==="chinese")&&(b.key="chinese_simplified")}),o.value.options=[...p]},c=()=>o.value.options,u=p=>{if(o.value.currentLanguage===p)return;const b=o.value.options.find(a=>a.key===p);b&&(o.value.currentLanguage=b.key,o.value.selectCallback(b))},x=()=>{if(o.value.currentLanguage)return o.value.options.find(p=>p.key===o.value.currentLanguage)},g=p=>{o.value.selectCallback=p},y=()=>o.value.translationApiUrl,C=p=>{o.value.translationApiUrl=p},S=p=>{(p==="Chinese"||p==="chinese")&&(p="chinese_simplified"),o.value.defaultLanguage=p},B=()=>o.value.defaultLanguage?o.value.defaultLanguage:"chinese_simplified";return e.onMounted(()=>{o.value.initLanguage(o.value)}),{state:o,select:u,setLanguages:s,getLanguages:c,getCurrentLanguage:x,setSelectCallback:g,setTranslationApiUrl:C,getTranslationApiUrl:y,setDefaultLanguage:S,getDefaultLanguage:B}}),ke={key:1},ne=e.defineComponent({__name:"PLanguage",setup(o){const{select:s,getLanguages:c,getCurrentLanguage:u,getDefaultLanguage:x,getTranslationApiUrl:g}=oe(),y=S=>s(S),C=()=>{window.translate.selectLanguageTag.show=!1,window.translate.selectLanguageTag.languages=c().map(S=>S.key).join(","),window.translate.ignore.class.push("ignore-translate-flag"),window.translate.ignore.id.push("ignore-translation"),window.translate.language.setLocal(x()),window.translate.request.api.translate="api/v1/translation",window.translate.request.api.connectTest="api/v1/translation/connect-test",window.translate.request.api.init="api/v1/translation/init",window.translate.request.api.language="api/v1/translation/language",window.translate.request.setHost(g()),window.translate.request.listener.start(),window.translate.listener.start(),window.translate.whole.enableAll(),window.translate.execute()};return e.onMounted(async()=>await e.nextTick(()=>C())),(S,B)=>{const p=n.NIcon,b=n.NButton;return e.unref(c)().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:y,options:e.unref(c)()},{default:e.withCtx(()=>[e.createVNode(b,{quaternary:"",type:"info"},{default:e.withCtx(()=>[e.unref(u)()?(e.openBlock(),e.createElementBlock("label",ke,e.toDisplayString(e.unref(u)()?.label),1)):(e.openBlock(),e.createBlock(p,{key:0,size:"18"},{default:e.withCtx(()=>B[0]||(B[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,__:[0]}))]),_:1})]),_:1},8,["options"])):e.createCommentVNode("",!0)}}}),xe={class:"layout-header"},Ve={class:"layout-header-left"},Se={class:"link-text"},Be={key:1,class:"link-text"},Te={class:"layout-header-right"},Pe={class:"layout-header-trigger-min"},Le={class:"layout-header-trigger layout-header-trigger-min"},Ee={class:"layout-header-trigger layout-header-trigger-min"},$e={class:"avatar"},Me=H(e.defineComponent({__name:"PHeader",setup(o){const s=n.useMessage(),c=n.useDialog(),u=z(),x=D.useRouter(),g=D.useRoute(),y=e.inject("reloadPage"),C=_=>x.push({name:_}),S=e.computed(()=>B(g.matched)),B=_=>_.map(m=>{const w={key:m.name,label:m.meta.title,icon:m.meta.icon,meta:m.meta,disabled:m.path==="/",children:void 0};return m.children&&m.children.length>0&&(w.children=B(m.children)),w}),p=e.ref(!1),b=()=>{document.fullscreenElement?document.exitFullscreen&&(document.exitFullscreen(),p.value=!1):(document.documentElement.requestFullscreen(),p.value=!0)},a=e.computed(()=>{const _=[];return _.push({label:"退出登录",key:"logout"}),u.state.settingPages&&u.state.settingPages.length>0&&u.state.settingPages.forEach(m=>{_.push({label:m.title,key:m.route})}),_}),i=_=>{switch(_){case"logout":h();break;default:x.push({name:_})}},h=()=>{c.info({title:"提示",content:"您确定要退出登录吗",positiveText:"确定",negativeText:"取消",onPositiveClick:async()=>{if(u.state.logout)try{await u.state.logout(),localStorage.removeItem("TABS-ROUTES"),s.error("退出成功")}catch(_){console.error(_),s.error("退出登录失败")}finally{location.reload()}else s.error("没有配置登出接口, 请配置[usePLayoutStore.logout]方法")},onNegativeClick:()=>{}})};return(_,m)=>{const w=n.NTooltip,$=n.NDivider,P=n.NAvatar;return e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",Ve,[e.createElementVNode("div",{class:"ml-1 layout-header-trigger layout-header-trigger-min",onClick:m[0]||(m[0]=(...k)=>e.unref(u).collapse&&e.unref(u).collapse(...k))},[e.unref(u).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:m[1]||(m[1]=(...k)=>e.unref(y)&&e.unref(y)(...k))},[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(S.value,k=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:k.label},[k.label?(e.openBlock(),e.createBlock(e.unref(n.NBreadcrumbItem),{key:0},{default:e.withCtx(()=>[k.children&&k.children.length?(e.openBlock(),e.createBlock(e.unref(n.NDropdown),{key:0,options:k.children,onSelect:C},{default:e.withCtx(()=>[e.createElementVNode("span",Se,[k.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(k.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(k.label),1)])]),_:2},1032,["options"])):(e.openBlock(),e.createElementBlock("span",Be,[k.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(k.icon),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(k.label),1)]))]),_:2},1024)):e.createCommentVNode("",!0)],64))),128))]),_:1})]),e.createElementVNode("div",Te,[e.createElementVNode("div",Pe,[e.createVNode(ne)]),e.createElementVNode("div",Le,[e.createVNode(w,{placement:"bottom"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(n.NIcon),{size:"18",onClick:e.withModifiers(b,["stop"])},{default:e.withCtx(()=>[p.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(()=>[m[2]||(m[2]=e.createElementVNode("span",null,"全屏",-1))]),_:1,__:[2]})]),e.createElementVNode("div",Ee,[e.createVNode(e.unref(n.NDropdown),{trigger:"hover",onSelect:i,options:a.value},{default:e.withCtx(()=>[e.createElementVNode("div",$e,[e.createElementVNode("span",null,e.toDisplayString(e.unref(u).state.uname),1),e.createVNode($,{vertical:""}),e.createVNode(P,{round:"",src:e.unref(u).state.avatar},null,8,["src"])])]),_:1},8,["options"])])])])}}}),[["__scopeId","data-v-93589779"]]),Oe={class:"mt-1"},De=e.defineComponent({__name:"PContent",props:{loading:{type:Boolean,default:!1}},setup(o){return(s,c)=>{const u=e.resolveComponent("RouterView");return e.openBlock(),e.createElementBlock("div",Oe,[s.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(u,{key:0},{default:e.withCtx(({Component:x,route:g})=>[(e.openBlock(),e.createBlock(e.KeepAlive,null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x),{key:g.fullPath}))],1024))]),_:1}))])}}}),ze={class:"tabs-view-main"},Re=["id","onClick","onContextmenu"],Ie={class:"tabs-close"},Ae={class:"tabs-close-btn"},We=H(e.defineComponent({__name:"PTabs",setup(o){e.useCssVars(t=>({"4cb4fdc8":c.value,"21e8bab2":u.value}));const s=n.useThemeVars(),c=e.computed(()=>s.value.cardColor),u=e.computed(()=>s.value.textColor1),x=n.useMessage(),g=D.useRoute(),y=D.useRouter(),C=e.ref(null),S=e.ref(null),B=e.ref(!1),p=z(),b=e.computed(()=>p.state.tabs),a=e.reactive({activeKey:g.fullPath,scrollable:!0,dropdownX:0,dropdownY:0,showDropdown:!1,isMultiHeaderFixed:!0,multiTabsSetting:!0}),i=["Login","Redirect","ErrorPage"],h=t=>{const{fullPath:d,hash:l,meta:V,name:M,params:q,path:J,query:Z}=t;return{fullPath:d,hash:l,meta:V,name:M,params:q,path:J,query:Z}},_=e.computed(()=>{const l=p.state.collapsed?"64px":"272px";return{left:l,width:`calc(100% - ${l})`}}),m=e.computed(()=>{const t=b.value.length<=1;return[{label:"刷新当前",key:"1",icon:()=>e.h(n.NIcon,null,{default:()=>e.h(E.ReloadOutlined)})},{label:"关闭当前",key:"2",disabled:B.value||t,icon:()=>e.h(n.NIcon,null,{default:()=>e.h(E.CloseOutlined)})},{label:"关闭其他",key:"3",disabled:t,icon:()=>e.h(n.NIcon,null,{default:()=>e.h(E.ColumnWidthOutlined)})},{label:"关闭全部",key:"4",disabled:t,icon:()=>e.h(n.NIcon,null,{default:()=>e.h(E.MinusOutlined)})}]}),w=()=>{let t=[];const d=h(g);try{if(p.state.cacheTabs){const l=localStorage.getItem("TABS_ROUTES");t=l?JSON.parse(l):[d]}}catch{t=[d]}finally{return t}},$=t=>{const d=y.getRoutes();t.forEach(l=>{const V=d.find(M=>M.path===l.path);V&&(l.meta=V.meta||l.meta,l.name=V.name||l.name)}),p.state.cacheTabs&&localStorage.setItem("TABS_ROUTES",JSON.stringify(t))},P=()=>{const t=w();$(t),p.initTabs(t)},k=async t=>{if(await e.nextTick(),!C.value)return;const d=C.value.offsetWidth,l=C.value.scrollWidth;d<l?(a.scrollable=!0,t&&[...C.value.querySelectorAll(".tabs-card-scroll-item")||[]].forEach(M=>{M.id===`tag${a.activeKey.split("/").join("/")}`&&M.scrollIntoView&&M.scrollIntoView()})):a.scrollable=!1},A=t=>!(t.draggedContext.element.meta.affix||t.relatedContext.element.meta.affix),F=()=>{let t;t=fe(),t.listenTo(S.value,()=>k(!0))},R=t=>{const{fullPath:d}=t;if(d===g.fullPath||(a.activeKey=d,!t))return;const{replace:l}=y;toString.call(t),l(t).catch(console.error)},W=(t,d)=>{t.preventDefault(),B.value=d.path==="/home",a.showDropdown=!1,e.nextTick().then(()=>{a.showDropdown=!0,a.dropdownX=t.clientX,a.dropdownY=t.clientY})},j=()=>{g.meta.keepAlive&&y.currentRoute.value.matched.find(t=>t.name==g.name)?.components?.default.name},K=t=>{if(b.value.length===1)return x.warning("这已经是最后一页,不能再关闭了!");if(j(),p.closeCurrentTab(t),a.activeKey===t.fullPath){const d=b.value[Math.max(0,b.value.length-1)];a.activeKey=d.fullPath,y.push(d)}k()},O=t=>{const{fullPath:d}=t,l=b.value.find(V=>V.fullPath==d);K(l)},Y=t=>{p.closeOtherTabs(t),a.activeKey=t.fullPath,y.replace(t.fullPath),k()},X=()=>{p.closeAllTabs(),k()},G=e.inject("reloadPage"),r=t=>{switch(t){case"1":G();break;case"2":K(g);break;case"3":Y(g);break;case"4":X();break}k(),a.showDropdown=!1},f=(t,d)=>{const l=C.value.scrollLeft,V=d>0&&l+d>=t||d<0&&l+d<=t?t:l+d;if(C.value&&C.value.scrollTo(V,0),V!==t)return window.requestAnimationFrame(()=>f(t,d))},N=()=>{const t=C.value.offsetWidth,d=C.value.scrollLeft;if(!d)return;const l=d>t?d-t:0;f(l,(l-d)/20)},L=()=>{const t=C.value.offsetWidth,d=C.value.scrollWidth,l=C.value.scrollLeft;if(d-l<=t)return;const V=d-l>t*2?l+t:d-t;f(V,(V-l)/20)};return window.addEventListener("beforeunload",()=>{localStorage.setItem("TABS_ROUTES",JSON.stringify(b.value))}),window.addEventListener("scroll",t=>{let d=t.target.scrollTop||document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop;a.isMultiHeaderFixed=d>=64},!0),e.watch(()=>g.fullPath,t=>{i.includes(g.name)||(a.activeKey=t,p.addTab(h(g)),k(!0))},{immediate:!0}),P(),e.onMounted(()=>F()),(t,d)=>(e.openBlock(),e.createElementBlock("div",{class:"box-border tabs-view tabs-view-fix tabs-view-default-background",style:e.normalizeStyle(_.value)},[e.createElementVNode("div",ze,[e.createElementVNode("div",{ref_key:"navWrap",ref:S,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:N},[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:L},[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:C,class:"tabs-card-scroll"},[e.createVNode(e.unref(pe),{list:b.value,animation:"300","item-key":"fullPath",class:"flex",move:A},{item:e.withCtx(({element:l})=>[e.createElementVNode("div",{id:`tag${l.fullPath.split("/").join("/")}`,class:e.normalizeClass(["tabs-card-scroll-item",{"active-item":a.activeKey===l.fullPath}]),onClick:e.withModifiers(V=>R(l),["stop"]),onContextmenu:V=>W(V,l)},[e.createElementVNode("span",null,e.toDisplayString(l.meta.title),1),l.meta.affix?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(n.NIcon),{key:0,size:"14",onClick:e.withModifiers(V=>O(l),["stop"])},{default:e.withCtx(()=>[e.createVNode(e.unref(E.CloseOutlined))]),_:2},1032,["onClick"]))],42,Re)]),_:1},8,["list"])],512)],2),e.createElementVNode("div",Ie,[e.createVNode(e.unref(n.NDropdown),{trigger:"hover",onSelect:r,placement:"bottom-end",options:m.value},{default:e.withCtx(()=>[e.createElementVNode("div",Ae,[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),{show:a.showDropdown,x:a.dropdownX,y:a.dropdownY,onClickoutside:d[0]||(d[0]=l=>a.showDropdown=!1),placement:"bottom-start",onSelect:r,options:m.value},null,8,["show","x","y","options"])])],4))}}),[["__scopeId","data-v-f0706f46"]]),qe=e.defineComponent({__name:"PMenus",setup(o){const s=D.useRoute(),c=D.useRouter(),u=z(),x=e.ref(s.name),g=e.ref(s.matched&&s.matched.length?s.matched.map(a=>a.name):[]),y=e.ref([]),C=a=>{/http(s)?:/.test(a)?window.open(a):c.push({name:a})},S=a=>{if(!a)return;const i=a.find(h=>g.value.indexOf(h)===-1);g.value=i?[i]:[]},B=()=>{const a=s.matched;g.value=a.map(h=>h.name);const i=s.meta?.activeMenu||"";x.value=i||s.name},p=(a,i=[],h=!1)=>{const _=[],m=["/:path(.*)*","/redirect","/redirect/:path(.*)","/login","/oidc-callback"];if(!a||a.length===0)return _;a=a.sort((w,$)=>{let P=($.children?.length?1:0)-(w.children?.length?1:0);return P===0&&(P=(w.meta?.sort??0)-($.meta?.sort??0)),P});for(const w of a){if(h||(w.meta?.hidden||!1)==!0||m.includes(w.path)){i.push(w.name),w.children&&w.children.length>0&&p(w.children,i,!0);continue}const $=w.meta?.alwaysShow!=!0&&w?.children?.filter(A=>!A?.meta?.hidden)?.length===1,P=$?w.children[0]:w,k={key:P.name,label:P.meta?.title,affix:P.meta?.affix,sort:P.meta?.sort,path:P.path,redirect:P.redirect,icon:$?w.meta?.icon:P.meta?.icon,permissions:P.meta?.permissions,meta:P.meta,children:void 0};if(!i.includes(w.name)){if(_.push(k),i.push(w.name),$){p(w.children,i,h);continue}w.children&&w.children.length>0&&(k.children=p(w.children,i,h))}}return _},b=()=>{const a=c.getRoutes();y.value=p(a)};return e.watch(()=>s.fullPath,()=>{B()}),e.onMounted(()=>{b(),B()}),(a,i)=>(e.openBlock(),e.createBlock(e.unref(n.NMenu),{class:"h-full",inverted:"",mode:"vertical",options:y.value,collapsed:e.unref(u).state.collapsed,"collapsed-width":64,"collapsed-icon-size":20,indent:24,"expanded-keys":g.value,value:x.value,"onUpdate:value":C,"onUpdate:expandedKeys":S},null,8,["options","collapsed","expanded-keys","value"]))}}),He={class:"layout-content-main layout-content-main-fix"},Fe={class:"main-view main-view-fix"},ae=I(H(e.defineComponent({__name:"PLayout",setup(o){const s=z(),c=e.ref(!1),u=()=>{c.value=!0,e.nextTick(()=>c.value=!1)};return e.provide("reloadPage",u),(x,g)=>{const y=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",collapsed:e.unref(s).state.collapsed,"native-scrollbar":!1,"collapsed-width":64,onCollapse:e.unref(s).collapse,onExpand:e.unref(s).collapse},{default:e.withCtx(()=>[e.createVNode(e.unref(n.NFlex),{vertical:""},{default:e.withCtx(()=>[e.createVNode(be),e.createVNode(qe)]),_: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",He,[e.createVNode(We),e.createElementVNode("div",Fe,[e.createVNode(De,{loading:c.value},null,8,["loading"])])])]),_:1}),e.createVNode(y,{right:20,class:"z-50"})]),_:1})]),_:1})}}}),[["__scopeId","data-v-87dcb433"]])),le=I(e.defineComponent({__name:"PApplication",props:{theme:{},themeOverrides:{default:{common:{primaryColor:"#2d8cf0",primaryColorHover:"#3c9bff",primaryColorPressed:"#3c9bff",primaryColorSuppl:"#2d8cf0"},LoadingBar:{colorLoading:"#2d8cf0"}}}},setup(o){return(s,c)=>{const u=n.NConfigProvider;return e.openBlock(),e.createBlock(u,{locale:e.unref(n.zhCN),theme:s.theme,"theme-overrides":s.themeOverrides,"date-locale":e.unref(n.dateZhCN)},{default:e.withCtx(()=>[e.createVNode(e.unref(n.NDialogProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.NNotificationProvider),null,{default:e.withCtx(()=>[e.createVNode(e.unref(n.NMessageProvider),null,{default:e.withCtx(()=>[e.renderSlot(s.$slots,"default")]),_:3})]),_:3})]),_:3})]),_:3},8,["locale","theme","theme-overrides","date-locale"])}}})),Ke={class:"w-full cursor-move",id:"basic-modal-bar"},se=I(e.defineComponent({__name:"PModal",props:{saveBtnText:{default:"保 存"},closable:{type:Boolean,default:!1},preset:{default:"dialog"},title:{default:"操作"},width:{default:800},onSave:{},onClose:{}},setup(o,{expose:s}){const c=n.useMessage(),u=o,x=e.ref(null),g=e.ref(!1),y=e.ref(!1),C=async()=>{g.value=!0;try{u.onSave&&await u.onSave()&&S()}catch(a){c.error(a.message)}finally{g.value=!1}},S=()=>{y.value=!1,g.value=!1},B=async()=>{try{u.onClose?await u.onClose()&&S():S()}catch(a){c.error(a.message)}};return s({open:()=>{g.value=!1,y.value=!0},close:()=>{y.value=!1,g.value=!1}}),(a,i)=>{const h=n.NButton,_=n.NSpace;return e.openBlock(),e.createBlock(e.unref(n.NModal),e.mergeProps({ref_key:"$modal",ref:x,preset:"dialog",show:y.value,"onUpdate:show":i[0]||(i[0]=m=>y.value=m)},a.$attrs,{draggable:!0,closable:!1,"close-on-esc":!1,"mask-closable":!1,style:{width:`${u.width}px`},onClose:S}),e.createSlots({header:e.withCtx(()=>[e.createElementVNode("div",Ke,e.toDisplayString(a.title),1)]),default:e.withCtx(()=>[e.renderSlot(a.$slots,"default")]),_:2},[a.$slots.action?{name:"action",fn:e.withCtx(()=>[e.renderSlot(a.$slots,"action")]),key:"1"}:{name:"action",fn:e.withCtx(()=>[e.createVNode(_,null,{default:e.withCtx(()=>[e.createVNode(h,{type:"primary",loading:g.value,onClick:C},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.saveBtnText),1)]),_:1},8,["loading"]),e.createVNode(h,{onClick:B},{default:e.withCtx(()=>i[1]||(i[1]=[e.createTextVNode("取 消",-1)])),_:1,__:[1]})]),_:1})]),key:"0"}]),1040,["show","style"])}}})),re=I(ne),je=Object.freeze(Object.defineProperty({__proto__:null,PApplication:le,PLanguage:re,PLayout:ae,PModal:se,PTable:te},Symbol.toStringTag,{value:"Module"})),ce=(o,s)=>(Object.values(je).forEach(c=>{c.install&&o.use(c)}),s?.(),o),Ye={install:ce};T.PApplication=le,T.PLanguage=re,T.PLayout=ae,T.PModal=se,T.PTable=te,T.default=Ye,T.install=ce,T.usePLanguageStore=oe,T.usePLayoutStore=z,Object.defineProperties(T,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/es/modal/PModal.d.ts
CHANGED
|
@@ -2086,6 +2086,7 @@ declare const __VLS_component: import('vue').DefineComponent<PModalProps, {
|
|
|
2086
2086
|
open: () => void;
|
|
2087
2087
|
close: () => void;
|
|
2088
2088
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<PModalProps> & Readonly<{}>, {
|
|
2089
|
+
width: number;
|
|
2089
2090
|
title: string;
|
|
2090
2091
|
closable: boolean;
|
|
2091
2092
|
preset: "dialog" | "card";
|
package/es/modal/PModal.vue.js
CHANGED
|
@@ -1,86 +1,87 @@
|
|
|
1
|
-
import { useMessage as
|
|
2
|
-
import { defineComponent as
|
|
1
|
+
import { useMessage as b, NModal as h, NSpace as k, NButton as S } from "naive-ui";
|
|
2
|
+
import { defineComponent as $, ref as r, createBlock as B, openBlock as N, unref as M, mergeProps as T, createSlots as V, withCtx as o, renderSlot as i, createElementVNode as x, toDisplayString as u, createVNode as c, createTextVNode as p } from "vue";
|
|
3
3
|
const P = {
|
|
4
4
|
class: "w-full cursor-move",
|
|
5
5
|
id: "basic-modal-bar"
|
|
6
|
-
}, j = /* @__PURE__ */
|
|
6
|
+
}, j = /* @__PURE__ */ $({
|
|
7
7
|
__name: "PModal",
|
|
8
8
|
props: {
|
|
9
9
|
saveBtnText: { default: "保 存" },
|
|
10
10
|
closable: { type: Boolean, default: !1 },
|
|
11
11
|
preset: { default: "dialog" },
|
|
12
12
|
title: { default: "操作" },
|
|
13
|
+
width: { default: 800 },
|
|
13
14
|
onSave: {},
|
|
14
15
|
onClose: {}
|
|
15
16
|
},
|
|
16
17
|
setup(m, { expose: v }) {
|
|
17
|
-
const f =
|
|
18
|
+
const f = b(), s = m, y = r(null), a = r(!1), l = r(!1), g = async () => {
|
|
18
19
|
a.value = !0;
|
|
19
20
|
try {
|
|
20
|
-
|
|
21
|
+
s.onSave && await s.onSave() && t();
|
|
21
22
|
} catch (e) {
|
|
22
23
|
f.error(e.message);
|
|
23
24
|
} finally {
|
|
24
25
|
a.value = !1;
|
|
25
26
|
}
|
|
26
27
|
}, t = () => {
|
|
27
|
-
|
|
28
|
+
l.value = !1, a.value = !1;
|
|
28
29
|
}, _ = async () => {
|
|
29
30
|
try {
|
|
30
|
-
|
|
31
|
+
s.onClose ? await s.onClose() && t() : t();
|
|
31
32
|
} catch (e) {
|
|
32
33
|
f.error(e.message);
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
return v({
|
|
36
37
|
open: () => {
|
|
37
|
-
a.value = !1,
|
|
38
|
+
a.value = !1, l.value = !0;
|
|
38
39
|
},
|
|
39
40
|
close: () => {
|
|
40
|
-
|
|
41
|
+
l.value = !1, a.value = !1;
|
|
41
42
|
}
|
|
42
43
|
}), (e, n) => {
|
|
43
|
-
const d =
|
|
44
|
-
return N(), B(M(
|
|
44
|
+
const d = S, w = k;
|
|
45
|
+
return N(), B(M(h), T({
|
|
45
46
|
ref_key: "$modal",
|
|
46
|
-
ref:
|
|
47
|
+
ref: y,
|
|
47
48
|
preset: "dialog",
|
|
48
|
-
show:
|
|
49
|
-
"onUpdate:show": n[0] || (n[0] = (
|
|
49
|
+
show: l.value,
|
|
50
|
+
"onUpdate:show": n[0] || (n[0] = (C) => l.value = C)
|
|
50
51
|
}, e.$attrs, {
|
|
51
52
|
draggable: !0,
|
|
52
53
|
closable: !1,
|
|
53
54
|
"close-on-esc": !1,
|
|
54
55
|
"mask-closable": !1,
|
|
55
|
-
style: { width:
|
|
56
|
+
style: { width: `${s.width}px` },
|
|
56
57
|
onClose: t
|
|
57
58
|
}), V({
|
|
58
59
|
header: o(() => [
|
|
59
|
-
x("div", P,
|
|
60
|
+
x("div", P, u(e.title), 1)
|
|
60
61
|
]),
|
|
61
62
|
default: o(() => [
|
|
62
|
-
|
|
63
|
+
i(e.$slots, "default")
|
|
63
64
|
]),
|
|
64
65
|
_: 2
|
|
65
66
|
}, [
|
|
66
67
|
e.$slots.action ? {
|
|
67
68
|
name: "action",
|
|
68
69
|
fn: o(() => [
|
|
69
|
-
|
|
70
|
+
i(e.$slots, "action")
|
|
70
71
|
]),
|
|
71
72
|
key: "1"
|
|
72
73
|
} : {
|
|
73
74
|
name: "action",
|
|
74
75
|
fn: o(() => [
|
|
75
|
-
c(
|
|
76
|
+
c(w, null, {
|
|
76
77
|
default: o(() => [
|
|
77
78
|
c(d, {
|
|
78
79
|
type: "primary",
|
|
79
80
|
loading: a.value,
|
|
80
|
-
onClick:
|
|
81
|
+
onClick: g
|
|
81
82
|
}, {
|
|
82
83
|
default: o(() => [
|
|
83
|
-
p(
|
|
84
|
+
p(u(e.saveBtnText), 1)
|
|
84
85
|
]),
|
|
85
86
|
_: 1
|
|
86
87
|
}, 8, ["loading"]),
|
|
@@ -97,7 +98,7 @@ const P = {
|
|
|
97
98
|
]),
|
|
98
99
|
key: "0"
|
|
99
100
|
}
|
|
100
|
-
]), 1040, ["show"]);
|
|
101
|
+
]), 1040, ["show", "style"]);
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
104
|
});
|
package/es/modal/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ declare const _default: {
|
|
|
3
3
|
open: () => void;
|
|
4
4
|
close: () => void;
|
|
5
5
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {
|
|
6
|
+
width: number;
|
|
6
7
|
title: string;
|
|
7
8
|
closable: boolean;
|
|
8
9
|
preset: "dialog" | "card";
|
|
@@ -2091,6 +2092,7 @@ declare const _default: {
|
|
|
2091
2092
|
open: () => void;
|
|
2092
2093
|
close: () => void;
|
|
2093
2094
|
}, {}, {}, {}, {
|
|
2095
|
+
width: number;
|
|
2094
2096
|
title: string;
|
|
2095
2097
|
closable: boolean;
|
|
2096
2098
|
preset: "dialog" | "card";
|
|
@@ -2103,6 +2105,7 @@ declare const _default: {
|
|
|
2103
2105
|
open: () => void;
|
|
2104
2106
|
close: () => void;
|
|
2105
2107
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {
|
|
2108
|
+
width: number;
|
|
2106
2109
|
title: string;
|
|
2107
2110
|
closable: boolean;
|
|
2108
2111
|
preset: "dialog" | "card";
|
package/es/modal/typing.d.ts
CHANGED
package/es/table/PTable.vue.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { useDialog as
|
|
2
|
-
import { defineComponent as Ce, ref as c, computed as j, unref as r, onMounted as Se, createBlock as H, openBlock as
|
|
1
|
+
import { useDialog as me, useMessage as he, NCard as ve, NDataTable as ye, NModal as we, NSpace as ke, NButton as w, NTooltip as be, NIcon as D, NDropdown as _e } from "naive-ui";
|
|
2
|
+
import { defineComponent as Ce, ref as c, computed as j, unref as r, onMounted as Se, createBlock as H, openBlock as m, withCtx as n, createElementVNode as E, createElementBlock as x, createCommentVNode as k, createVNode as s, renderSlot as P, normalizeStyle as q, createTextVNode as B, h as T, toRaw as G } from "vue";
|
|
3
3
|
import { PlusSquareOutlined as Me, DeleteOutlined as Oe, ReloadOutlined as De, MoreOutlined as Ee } from "@vicons/antd";
|
|
4
|
-
|
|
4
|
+
import { resetObject as Be } from "../utils/helper.js";
|
|
5
|
+
const Te = { id: "data-content" }, $e = {
|
|
5
6
|
key: 0,
|
|
6
7
|
class: "rounded-lg bg-gray-50 flex flex-row gap-2 items-center justify-end p-5 mb-5"
|
|
7
|
-
},
|
|
8
|
+
}, Ne = { key: 1 }, Re = { key: 2 }, Pe = /* @__PURE__ */ Ce({
|
|
8
9
|
__name: "PTable",
|
|
9
10
|
props: {
|
|
10
11
|
idField: { default: "id" },
|
|
@@ -22,7 +23,7 @@ const Be = { id: "data-content" }, Te = {
|
|
|
22
23
|
onDelete: {}
|
|
23
24
|
},
|
|
24
25
|
setup(K, { expose: X }) {
|
|
25
|
-
const W = c(null), Y =
|
|
26
|
+
const W = c(null), Y = me(), h = he(), b = c(!1), _ = c([]), C = c([]), $ = c(null), p = c(!1), v = c(!1), S = c(!1), f = c({
|
|
26
27
|
page: 1,
|
|
27
28
|
itemCount: 0,
|
|
28
29
|
pageSize: 10,
|
|
@@ -34,14 +35,14 @@ const Be = { id: "data-content" }, Te = {
|
|
|
34
35
|
onUpdatePageSize: async (e) => {
|
|
35
36
|
f.value.pageSize = e, await g();
|
|
36
37
|
}
|
|
37
|
-
}),
|
|
38
|
-
const t = (
|
|
38
|
+
}), l = K, J = (e) => {
|
|
39
|
+
const t = (o) => {
|
|
39
40
|
const a = [];
|
|
40
41
|
return e && e.forEach((i) => {
|
|
41
42
|
i.key !== "edit" && i.key !== "delete" && a.push({
|
|
42
43
|
label: i.name,
|
|
43
44
|
key: i.key,
|
|
44
|
-
props: { onClick: () => i.action(
|
|
45
|
+
props: { onClick: () => i.action(o) }
|
|
45
46
|
});
|
|
46
47
|
}), a;
|
|
47
48
|
};
|
|
@@ -50,17 +51,17 @@ const Be = { id: "data-content" }, Te = {
|
|
|
50
51
|
key: "actions",
|
|
51
52
|
width: 100,
|
|
52
53
|
fixed: "right",
|
|
53
|
-
render: (
|
|
54
|
+
render: (o) => {
|
|
54
55
|
let a = [];
|
|
55
|
-
if (
|
|
56
|
+
if (l.hiddenEdit || a.push({
|
|
56
57
|
label: "编辑",
|
|
57
58
|
key: "edit",
|
|
58
|
-
props: { onClick: () => oe(
|
|
59
|
-
}),
|
|
59
|
+
props: { onClick: () => oe(o) }
|
|
60
|
+
}), l.hiddenDelete || a.push({
|
|
60
61
|
label: "删除",
|
|
61
62
|
key: "delete",
|
|
62
|
-
props: { onClick: () => Z(
|
|
63
|
-
}), a = [...a, ...t(
|
|
63
|
+
props: { onClick: () => Z(o) }
|
|
64
|
+
}), a = [...a, ...t(o)], !(a.length <= 0))
|
|
64
65
|
return T(
|
|
65
66
|
_e,
|
|
66
67
|
{
|
|
@@ -69,7 +70,7 @@ const Be = { id: "data-content" }, Te = {
|
|
|
69
70
|
},
|
|
70
71
|
{
|
|
71
72
|
default: () => T(
|
|
72
|
-
|
|
73
|
+
w,
|
|
73
74
|
{ size: "small", type: "primary" },
|
|
74
75
|
{ default: () => ["操作", T(D, () => T(Ee))] }
|
|
75
76
|
)
|
|
@@ -78,18 +79,18 @@ const Be = { id: "data-content" }, Te = {
|
|
|
78
79
|
}
|
|
79
80
|
};
|
|
80
81
|
}, Q = j(() => {
|
|
81
|
-
const e =
|
|
82
|
-
title:
|
|
83
|
-
key:
|
|
84
|
-
width:
|
|
85
|
-
fixed:
|
|
86
|
-
render:
|
|
87
|
-
ellipsis:
|
|
88
|
-
})), t =
|
|
89
|
-
(
|
|
82
|
+
const e = l.columns.filter((o) => o.key != "action").map((o) => ({
|
|
83
|
+
title: o.title,
|
|
84
|
+
key: o.key,
|
|
85
|
+
width: o.width,
|
|
86
|
+
fixed: o.fixed ?? !1,
|
|
87
|
+
render: o.render,
|
|
88
|
+
ellipsis: o.ellipsis ? { tooltip: !0 } : !1
|
|
89
|
+
})), t = l.columns.reduce(
|
|
90
|
+
(o, a) => a.key === "action" ? a : o,
|
|
90
91
|
void 0
|
|
91
92
|
)?.action;
|
|
92
|
-
return t && t?.length > 0 || !
|
|
93
|
+
return t && t?.length > 0 || !l.hiddenDelete || !l.hiddenEdit ? [
|
|
93
94
|
{ type: "selection", fixed: "left" },
|
|
94
95
|
...e,
|
|
95
96
|
J(t)
|
|
@@ -108,50 +109,50 @@ const Be = { id: "data-content" }, Te = {
|
|
|
108
109
|
positiveText: "确定",
|
|
109
110
|
negativeText: "取消",
|
|
110
111
|
onPositiveClick: async () => {
|
|
111
|
-
if (
|
|
112
|
+
if (l.onDelete)
|
|
112
113
|
try {
|
|
113
|
-
await
|
|
114
|
+
await l.onDelete(e) ? (g(), h.success("删除成功")) : h.error("删除失败");
|
|
114
115
|
} catch (t) {
|
|
115
|
-
|
|
116
|
+
h.error(t.message);
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
119
|
});
|
|
119
120
|
}, te = () => {
|
|
120
|
-
if (
|
|
121
|
-
|
|
121
|
+
if (l.onOpenModal) {
|
|
122
|
+
l.onOpenModal();
|
|
122
123
|
return;
|
|
123
124
|
}
|
|
124
125
|
v.value = !1, p.value = !0;
|
|
125
126
|
}, oe = async (e) => {
|
|
126
|
-
if (
|
|
127
|
-
|
|
127
|
+
if (l.onOpenModal) {
|
|
128
|
+
l.onOpenModal(e);
|
|
128
129
|
return;
|
|
129
130
|
}
|
|
130
|
-
|
|
131
|
+
l.onGet && (e = await l.onGet(e[l.idField])), $.value = e, Object.assign(l.item, e), p.value = !1, v.value = !0;
|
|
131
132
|
}, V = async () => {
|
|
132
|
-
if (
|
|
133
|
+
if (l.onSave)
|
|
133
134
|
try {
|
|
134
|
-
S.value = !0, (p.value ? await
|
|
135
|
+
S.value = !0, (p.value ? await l.onSave() : await l.onSave($.value[l.idField])) && (M(), await g());
|
|
135
136
|
} catch (e) {
|
|
136
|
-
|
|
137
|
+
h.error(e.message);
|
|
137
138
|
} finally {
|
|
138
139
|
S.value = !1;
|
|
139
140
|
}
|
|
140
141
|
}, M = () => {
|
|
141
|
-
|
|
142
|
+
l.onCloseModal && l.onCloseModal(), Be(l.item), $.value = null, p.value = !1, v.value = !1;
|
|
142
143
|
}, N = () => _.value ? C.value.filter((t) => _.value.includes(t.id)).map((t) => G(t)) : [], le = () => N()[0], ne = () => G(C.value), g = async () => {
|
|
143
144
|
if (!b.value) {
|
|
144
145
|
b.value = !0;
|
|
145
146
|
try {
|
|
146
|
-
if (
|
|
147
|
-
var { data: e, total: t } = await
|
|
147
|
+
if (l.onLoad) {
|
|
148
|
+
var { data: e, total: t } = await l.onLoad(
|
|
148
149
|
f.value.page,
|
|
149
150
|
f.value.pageSize
|
|
150
151
|
);
|
|
151
152
|
C.value = e, f.value.itemCount = t;
|
|
152
153
|
}
|
|
153
|
-
} catch (
|
|
154
|
-
|
|
154
|
+
} catch (o) {
|
|
155
|
+
h.error(o.message);
|
|
155
156
|
} finally {
|
|
156
157
|
b.value = !1;
|
|
157
158
|
}
|
|
@@ -159,7 +160,7 @@ const Be = { id: "data-content" }, Te = {
|
|
|
159
160
|
}, ae = j(() => {
|
|
160
161
|
const e = r(W);
|
|
161
162
|
if (!e) return;
|
|
162
|
-
const t = e?.$el,
|
|
163
|
+
const t = e?.$el, o = t.querySelector(".n-data-table-thead "), { bottomIncludeBody: a } = ie(o), i = 64;
|
|
163
164
|
let u = 2, d = 24;
|
|
164
165
|
const y = t.querySelector(
|
|
165
166
|
".n-data-table__pagination"
|
|
@@ -172,12 +173,12 @@ const Be = { id: "data-content" }, Te = {
|
|
|
172
173
|
let O = a - (i + u + d);
|
|
173
174
|
return console.log("height", O), O;
|
|
174
175
|
}), se = (e) => !e || !e.getBoundingClientRect ? 0 : e.getBoundingClientRect(), ie = (e) => {
|
|
175
|
-
const t = document.documentElement,
|
|
176
|
+
const t = document.documentElement, o = t.scrollLeft, a = t.scrollTop, i = t.clientLeft, u = t.clientTop, d = window.pageXOffset, y = window.pageYOffset, O = se(e), {
|
|
176
177
|
left: R,
|
|
177
178
|
top: de,
|
|
178
179
|
width: re,
|
|
179
180
|
height: ce
|
|
180
|
-
} = O, ue = (d ||
|
|
181
|
+
} = O, ue = (d || o) - (i || 0), fe = (y || a) - (u || 0), pe = R + d, ge = de + y, z = pe - ue, L = ge - fe, F = window.document.documentElement.clientWidth, U = window.document.documentElement.clientHeight;
|
|
181
182
|
return {
|
|
182
183
|
left: z,
|
|
183
184
|
top: L,
|
|
@@ -197,15 +198,15 @@ const Be = { id: "data-content" }, Te = {
|
|
|
197
198
|
f.value.page = 1;
|
|
198
199
|
}
|
|
199
200
|
}), (e, t) => {
|
|
200
|
-
const
|
|
201
|
-
return
|
|
201
|
+
const o = be, a = ye, i = ke, u = we;
|
|
202
|
+
return m(), H(r(ve), {
|
|
202
203
|
title: " ",
|
|
203
204
|
"header-class": "p-4",
|
|
204
205
|
"content-class": "pl-4 pr-4",
|
|
205
206
|
bordered: !1
|
|
206
207
|
}, {
|
|
207
208
|
"header-extra": n(() => [
|
|
208
|
-
e.hiddenAdd ?
|
|
209
|
+
e.hiddenAdd ? k("", !0) : (m(), H(o, {
|
|
209
210
|
key: 0,
|
|
210
211
|
trigger: "hover"
|
|
211
212
|
}, {
|
|
@@ -227,7 +228,7 @@ const Be = { id: "data-content" }, Te = {
|
|
|
227
228
|
_: 1,
|
|
228
229
|
__: [3]
|
|
229
230
|
})),
|
|
230
|
-
e.hiddenDelete ?
|
|
231
|
+
e.hiddenDelete ? k("", !0) : (m(), H(o, {
|
|
231
232
|
key: 1,
|
|
232
233
|
trigger: "hover"
|
|
233
234
|
}, {
|
|
@@ -249,7 +250,7 @@ const Be = { id: "data-content" }, Te = {
|
|
|
249
250
|
_: 1,
|
|
250
251
|
__: [4]
|
|
251
252
|
})),
|
|
252
|
-
s(
|
|
253
|
+
s(o, { trigger: "hover" }, {
|
|
253
254
|
trigger: n(() => [
|
|
254
255
|
s(r(D), {
|
|
255
256
|
size: "18",
|
|
@@ -270,10 +271,10 @@ const Be = { id: "data-content" }, Te = {
|
|
|
270
271
|
})
|
|
271
272
|
]),
|
|
272
273
|
default: n(() => [
|
|
273
|
-
E("div",
|
|
274
|
-
e.$slots.toolbar ? (
|
|
274
|
+
E("div", Te, [
|
|
275
|
+
e.$slots.toolbar ? (m(), x("div", $e, [
|
|
275
276
|
P(e.$slots, "toolbar")
|
|
276
|
-
])) :
|
|
277
|
+
])) : k("", !0),
|
|
277
278
|
s(a, {
|
|
278
279
|
remote: "",
|
|
279
280
|
ref_key: "$table",
|
|
@@ -289,7 +290,7 @@ const Be = { id: "data-content" }, Te = {
|
|
|
289
290
|
pagination: f.value,
|
|
290
291
|
"row-key": (d) => d[e.idField]
|
|
291
292
|
}, null, 8, ["checked-row-keys", "max-height", "loading", "columns", "data", "pagination", "row-key"]),
|
|
292
|
-
e.$slots.addModal ? (
|
|
293
|
+
e.$slots.addModal ? (m(), x("div", Ne, [
|
|
293
294
|
s(u, {
|
|
294
295
|
title: "新增",
|
|
295
296
|
preset: "dialog",
|
|
@@ -303,7 +304,7 @@ const Be = { id: "data-content" }, Te = {
|
|
|
303
304
|
action: n(() => [
|
|
304
305
|
s(i, null, {
|
|
305
306
|
default: n(() => [
|
|
306
|
-
s(r(
|
|
307
|
+
s(r(w), {
|
|
307
308
|
type: "primary",
|
|
308
309
|
loading: S.value,
|
|
309
310
|
onClick: V
|
|
@@ -314,7 +315,7 @@ const Be = { id: "data-content" }, Te = {
|
|
|
314
315
|
_: 1,
|
|
315
316
|
__: [6]
|
|
316
317
|
}, 8, ["loading"]),
|
|
317
|
-
s(r(
|
|
318
|
+
s(r(w), { onClick: M }, {
|
|
318
319
|
default: n(() => t[7] || (t[7] = [
|
|
319
320
|
B("取消", -1)
|
|
320
321
|
])),
|
|
@@ -330,8 +331,8 @@ const Be = { id: "data-content" }, Te = {
|
|
|
330
331
|
]),
|
|
331
332
|
_: 3
|
|
332
333
|
}, 8, ["show", "style"])
|
|
333
|
-
])) :
|
|
334
|
-
e.$slots.editModal ? (
|
|
334
|
+
])) : k("", !0),
|
|
335
|
+
e.$slots.editModal ? (m(), x("div", Re, [
|
|
335
336
|
s(u, {
|
|
336
337
|
title: "编辑",
|
|
337
338
|
show: v.value,
|
|
@@ -345,7 +346,7 @@ const Be = { id: "data-content" }, Te = {
|
|
|
345
346
|
action: n(() => [
|
|
346
347
|
s(i, null, {
|
|
347
348
|
default: n(() => [
|
|
348
|
-
s(r(
|
|
349
|
+
s(r(w), {
|
|
349
350
|
type: "primary",
|
|
350
351
|
loading: S.value,
|
|
351
352
|
onClick: V
|
|
@@ -356,7 +357,7 @@ const Be = { id: "data-content" }, Te = {
|
|
|
356
357
|
_: 1,
|
|
357
358
|
__: [8]
|
|
358
359
|
}, 8, ["loading"]),
|
|
359
|
-
s(r(
|
|
360
|
+
s(r(w), { onClick: M }, {
|
|
360
361
|
default: n(() => t[9] || (t[9] = [
|
|
361
362
|
B("取消", -1)
|
|
362
363
|
])),
|
|
@@ -372,7 +373,7 @@ const Be = { id: "data-content" }, Te = {
|
|
|
372
373
|
]),
|
|
373
374
|
_: 3
|
|
374
375
|
}, 8, ["show", "style"])
|
|
375
|
-
])) :
|
|
376
|
+
])) : k("", !0)
|
|
376
377
|
])
|
|
377
378
|
]),
|
|
378
379
|
_: 3
|
|
@@ -381,5 +382,5 @@ const Be = { id: "data-content" }, Te = {
|
|
|
381
382
|
}
|
|
382
383
|
});
|
|
383
384
|
export {
|
|
384
|
-
|
|
385
|
+
Pe as default
|
|
385
386
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const resetObject: (obj: any, defaults?: any) => void;
|