@duxweb/dvha-core 0.0.6 → 0.0.8
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/cjs/components/common/logo.cjs +1 -0
- package/dist/cjs/components/overlay/overlay.cjs +1 -0
- package/dist/cjs/hooks/auth.cjs +1 -0
- package/dist/cjs/hooks/config.cjs +1 -0
- package/dist/cjs/hooks/data.cjs +1 -0
- package/dist/cjs/hooks/manage.cjs +1 -0
- package/dist/cjs/hooks/menu.cjs +1 -0
- package/dist/cjs/hooks/overlay.cjs +1 -0
- package/dist/cjs/hooks/theme.cjs +1 -0
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/main.cjs +1 -0
- package/dist/cjs/provider/app.cjs +1 -0
- package/dist/cjs/provider/tab.cjs +1 -0
- package/dist/cjs/router/route.cjs +1 -0
- package/dist/cjs/simple/authProvider.cjs +1 -0
- package/dist/cjs/simple/dataProvider.cjs +1 -0
- package/dist/cjs/stores/auth.cjs +1 -0
- package/dist/cjs/stores/route.cjs +1 -0
- package/dist/cjs/stores/tab.cjs +1 -0
- package/dist/cjs/utils/tree.cjs +1 -0
- package/dist/esm/components/common/logo.js +50 -0
- package/dist/esm/components/overlay/overlay.js +72 -0
- package/dist/esm/hooks/auth.js +125 -0
- package/dist/esm/hooks/config.js +10 -0
- package/dist/esm/hooks/data.js +369 -0
- package/dist/esm/hooks/manage.js +24 -0
- package/dist/esm/hooks/menu.js +75 -0
- package/dist/esm/hooks/overlay.js +14 -0
- package/dist/esm/hooks/theme.js +31 -0
- package/dist/esm/index.js +67 -0
- package/dist/esm/main.js +22 -0
- package/dist/esm/provider/app.js +127 -0
- package/dist/esm/provider/tab.js +64 -0
- package/dist/esm/router/route.js +49 -0
- package/dist/esm/simple/authProvider.js +90 -0
- package/dist/esm/simple/dataProvider.js +99 -0
- package/dist/esm/stores/auth.js +50 -0
- package/dist/esm/stores/route.js +65 -0
- package/dist/esm/stores/tab.js +70 -0
- package/dist/esm/utils/tree.js +41 -0
- package/dist/types/components/common/index.d.ts +1 -0
- package/dist/types/components/common/logo.d.ts +22 -0
- package/dist/types/components/index.d.ts +3 -0
- package/dist/types/components/loader/iframe.d.ts +2 -0
- package/dist/types/components/loader/index.d.ts +1 -0
- package/dist/types/components/overlay/index.d.ts +1 -0
- package/dist/types/components/overlay/overlay.d.ts +44 -0
- package/dist/types/hooks/auth.d.ts +109 -0
- package/dist/types/hooks/config.d.ts +7 -0
- package/dist/types/hooks/data.d.ts +1487 -0
- package/dist/types/hooks/index.d.ts +7 -0
- package/dist/types/hooks/manage.d.ts +13 -0
- package/dist/types/hooks/menu.d.ts +16 -0
- package/dist/types/hooks/overlay.d.ts +7 -0
- package/dist/types/hooks/theme.d.ts +12 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/main.d.ts +5 -0
- package/dist/types/provider/app.d.ts +1 -0
- package/dist/types/provider/index.d.ts +2 -0
- package/dist/types/provider/tab.d.ts +1 -0
- package/dist/types/router/index.d.ts +1 -0
- package/dist/types/router/route.d.ts +2 -0
- package/dist/types/simple/authProvider.d.ts +2 -0
- package/dist/types/simple/dataProvider.d.ts +2 -0
- package/dist/types/simple/index.d.ts +2 -0
- package/dist/types/stores/auth.d.ts +31 -0
- package/dist/types/stores/index.d.ts +3 -0
- package/dist/types/stores/route.d.ts +4040 -0
- package/dist/types/stores/tab.d.ts +1660 -0
- package/dist/types/types/auth.d.ts +36 -0
- package/dist/types/types/config.d.ts +32 -0
- package/dist/types/types/data.d.ts +84 -0
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/types/manage.d.ts +29 -0
- package/dist/types/types/menu.d.ts +13 -0
- package/dist/types/types/theme.d.ts +10 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/tree.d.ts +13 -0
- package/package.json +40 -10
- package/CHANGELOG.md +0 -31
- package/src/components/common/index.ts +0 -1
- package/src/components/common/logo.tsx +0 -62
- package/src/components/index.ts +0 -3
- package/src/components/loader/iframe.tsx +0 -12
- package/src/components/loader/index.ts +0 -1
- package/src/components/overlay/index.ts +0 -1
- package/src/components/overlay/overlay.tsx +0 -84
- package/src/hooks/auth.ts +0 -261
- package/src/hooks/config.ts +0 -16
- package/src/hooks/data.ts +0 -647
- package/src/hooks/index.ts +0 -7
- package/src/hooks/manage.ts +0 -71
- package/src/hooks/menu.ts +0 -146
- package/src/hooks/overlay.ts +0 -21
- package/src/hooks/theme.ts +0 -49
- package/src/index.ts +0 -9
- package/src/main.ts +0 -28
- package/src/provider/app.tsx +0 -200
- package/src/provider/index.ts +0 -2
- package/src/provider/tab.tsx +0 -76
- package/src/router/index.ts +0 -1
- package/src/router/route.ts +0 -47
- package/src/simple/authProvider.ts +0 -99
- package/src/simple/dataProvider.ts +0 -153
- package/src/simple/index.ts +0 -2
- package/src/stores/auth.ts +0 -73
- package/src/stores/index.ts +0 -3
- package/src/stores/route.ts +0 -159
- package/src/stores/tab.ts +0 -120
- package/src/types/auth.ts +0 -44
- package/src/types/config.ts +0 -51
- package/src/types/data.ts +0 -108
- package/src/types/index.ts +0 -6
- package/src/types/manage.ts +0 -40
- package/src/types/menu.ts +0 -24
- package/src/types/theme.ts +0 -12
- package/src/utils/index.ts +0 -1
- package/src/utils/tree.ts +0 -63
- package/tsconfig.json +0 -41
- package/typings.d.ts +0 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("clsx"),a=e.defineComponent({name:"DuxLogo",props:{dark:{type:Boolean,default:!1},highlight:{type:String,default:"fill-primary"}},setup(l){return()=>e.createVNode("svg",{class:"w-auto h-full",viewBox:"0 0 400.893 121.787",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[e.createVNode("g",{transform:"translate(-6545.000000, -3038.106602) translate(6345.000000, 2899.000000) translate(200.000000, 132.393398)","fill-rule":"nonzero",stroke:"none","stroke-width":"1",fill:"none"},[e.createVNode("path",{d:"M0 62.607v50c0 8.284 6.716 15 15 15s15-6.716 15-15v-50c0-8.285-6.716-15-15-15s-15 6.715-15 15z",class:t([l.dark?"fill-white/90":"fill-black dark:fill-white/90"])},null),e.createVNode("path",{d:"M60 7.607c33.137 0 60 26.863 60 60s-26.863 60-60 60h-5c-8.284 0-15-6.716-15-15 0-8.285 6.716-15 15-15h5c16.57 0 30-13.432 30-30 0-16.57-13.43-30-30-30H15c-8.284 0-15-6.716-15-15 0-8.285 6.716-15 15-15h45z",class:t([l.dark?"fill-white/90":"fill-black dark:fill-white/90"])},null),e.createVNode("path",{d:"M201 7.607c33.137 0 60 26.863 60 60s-26.863 60-60 60h-46c-8.284 0-15-6.716-15-15 0-8.285 6.716-15 15-15h46c16.57 0 30-13.432 30-30 0-16.57-13.43-30-30-30h-45.5c-8.284 0-15-6.716-15-15 0-8.285 6.716-15 15-15H201z",class:t([l.dark?"fill-white/90":"fill-black dark:fill-white/90"]),transform:"translate(200.500000, 67.606602) rotate(90.000000) translate(-200.500000, -67.606602) "},null),e.createVNode("g",{transform:"translate(279.106602, 6.713203)"},[e.createVNode("path",{d:"M25.607 4.393 52.893 31.68c5.858 5.858 5.858 15.356 0 21.213-5.857 5.858-15.355 5.858-21.213 0L4.393 25.607c-5.857-5.858-5.857-15.356 0-21.214 5.858-5.857 15.356-5.857 21.214 0zm91.786 0c5.858 5.858 5.858 15.356 0 21.214L90.107 52.893c-5.858 5.858-15.356 5.858-21.214 0-5.857-5.857-5.857-15.355 0-21.213L96.18 4.393c5.858-5.857 15.356-5.857 21.213 0zm-64.5 64.5c5.858 5.858 5.858 15.356 0 21.214l-27.286 27.286c-5.858 5.858-15.356 5.858-21.214 0-5.857-5.857-5.857-15.355 0-21.213L31.68 68.893c5.858-5.857 15.356-5.857 21.213 0z",class:t([l.dark?"fill-white/90":"fill-black dark:fill-white/90"])},null),e.createVNode("path",{d:"m90.107 68.893 27.286 27.287c5.858 5.858 5.858 15.356 0 21.213-5.857 5.858-15.355 5.858-21.213 0L68.893 90.107c-5.857-5.858-5.857-15.356 0-21.214 5.858-5.857 15.356-5.857 21.214 0z",class:t([l.highlight])},null)])])])}});exports.DuxLogo=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),c=require("@overlastic/vue"),r=t.defineComponent({name:"DuxOverlay",props:{component:Function,componentProps:Object,mask:{type:Boolean,default:!0},maskClosable:{type:Boolean,default:!0},duration:{type:Number,default:300},zIndex:{type:Number,default:1e3}},setup(e){const{visible:n,resolve:l,reject:o}=c.useExtendOverlay({duration:e.duration}),a=(e==null?void 0:e.componentProps)||{};a.onConfirm=l,a.onClose=o;const s=t.defineAsyncComponent(e.component),i=()=>{e.maskClosable&&o()};return()=>t.createVNode("div",{class:"fixed inset-0 flex items-center justify-center overflow-auto",style:{zIndex:e.zIndex}},[t.createVNode(t.Transition,{enterActiveClass:"transition-opacity",enterFromClass:"opacity-0",enterToClass:"opacity-100",leaveActiveClass:"transition-opacity",leaveFromClass:"opacity-100",leaveToClass:"opacity-0"},{default:()=>[n.value&&e.mask&&t.createVNode("div",{class:"fixed inset-0 bg-black bg-opacity-30",style:{transitionDuration:`${e.duration}ms`},onClick:i,"aria-hidden":"true"},null)]}),t.createVNode(t.Transition,{enterActiveClass:"transition-all",enterFromClass:"opacity-0 scale-95",enterToClass:"opacity-100 scale-100",leaveActiveClass:"transition-all",leaveFromClass:"opacity-100 scale-100",leaveToClass:"opacity-0 scale-95"},{default:()=>[n.value&&t.createVNode(s,a,null)]})])}});exports.DuxOverlay=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("vue"),h=require("vue-router"),c=require("../stores/auth.cjs"),d=require("./manage.cjs");function m({onSuccess:e,onError:a}){const n=d.useManage(),o=c.useAuthStore(),g=h.useRouter(),i=f.ref(!1);return{mutate:async u=>{var r;i.value=!0;const t=await((r=n.config.authProvider)==null?void 0:r.login(u,n));if(i.value=!1,t!=null&&t.success){if(!(t!=null&&t.data))throw new Error("Login response data is undefined");e==null||e(t),o.login(n.config.name,t.data),g.push(n.getRoutePath(t.redirectTo||"/"));return}a==null||a(t)},isLoading:i}}function P({onSuccess:e,onError:a}){const{config:n,getRoutePath:o}=d.useManage(),g=c.useAuthStore(),i=h.useRouter();return{mutate:async u=>{var r;const t=await((r=n.authProvider)==null?void 0:r.logout(u));if(t!=null&&t.success){e==null||e(t),g.logout(n.name),i.push(o(t.redirectTo||"/login"));return}a==null||a(t)}}}function w({onSuccess:e,onError:a}){const{config:n,getRoutePath:o}=d.useManage(),g=c.useAuthStore(),i=h.useRouter();return{mutate:async u=>{var r;const t=await((r=n.authProvider)==null?void 0:r.check(u));if(t!=null&&t.success){if(e==null||e(t),!(t!=null&&t.data))throw new Error("Check response data is undefined");g.update(n.name,t.data);return}a==null||a(t),t!=null&&t.logout&&i.push(o(t.redirectTo||"/login"))}}}function R({onSuccess:e,onError:a}){const{config:n,getRoutePath:o}=d.useManage(),g=c.useAuthStore(),i=h.useRouter();return{mutate:async u=>{var r;const t=await((r=n.authProvider)==null?void 0:r.register(u));if(t!=null&&t.success){if(e==null||e(t),!(t!=null&&t.data))throw new Error("Register response data is undefined");g.login(n.name,t.data),i.push(o(t.redirectTo||""));return}a==null||a(t)}}}function p({onSuccess:e,onError:a}){const{config:n,getRoutePath:o}=d.useManage(),g=h.useRouter();return{mutate:async s=>{var t;const u=await((t=n.authProvider)==null?void 0:t.forgotPassword(s));if(u!=null&&u.success){e==null||e(u),u.redirectTo&&g.push(o(u.redirectTo));return}a==null||a(u)}}}function v({onSuccess:e,onError:a}){const{config:n,getRoutePath:o}=d.useManage(),g=h.useRouter();return{mutate:async s=>{var t;const u=await((t=n.authProvider)==null?void 0:t.updatePassword(s));if(u!=null&&u.success){e==null||e(u),u.redirectTo&&g.push(o(u.redirectTo));return}a==null||a(u)}}}function M(e){const{config:a,getRoutePath:n}=d.useManage(),o=h.useRouter();return{mutate:async i=>{var u;const s=await((u=a.authProvider)==null?void 0:u.onError(i));e==null||e(s),s!=null&&s.logout&&o.push(n(s.redirectTo||"/login"))}}}function T(e){const{config:a}=d.useManage(e);return c.useAuthStore().getUser(a.name)}function y(e){const{config:a}=d.useManage(e);return c.useAuthStore().isLogin(a.name)}exports.useCheck=w;exports.useError=M;exports.useForgotPassword=p;exports.useGetAuth=T;exports.useIsLogin=y;exports.useLogin=m;exports.useLogout=P;exports.useRegister=R;exports.useUpdatePassword=v;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue");function o(){const e=n.inject("dux.config");if(!e)throw new Error("config is not defined");return e}exports.useConfig=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("@tanstack/vue-query"),s=require("vue"),g=require("./auth.cjs"),v=require("./manage.cjs");function l(t){const u=v.useManage(),d=g.useGetAuth(),{mutate:h}=g.useError(),c=s.computed(()=>{const{onError:o,options:n,...r}=t;return r}),e=E.useQuery({queryKey:[t.path,c],queryFn:()=>{var o;return(o=u.config.dataProvider)==null?void 0:o.getList(c.value,u,d)},...t.options}),i=s.computed(()=>e.isFetched?!1:e.isFetching);return s.watch(()=>e.isError,()=>{var o;h(e.error),(o=t.onError)==null||o.call(t,e.error)}),{...e,isLoading:i,data:e.data,refetch:e.refetch}}function y(t){const u=v.useManage(),d=g.useGetAuth(),{mutate:h}=g.useError(),c=s.computed(()=>{const{onError:o,options:n,...r}=t;return r}),e=E.useInfiniteQuery({queryKey:[t.path,c],queryFn:()=>{var o;return(o=u.config.dataProvider)==null?void 0:o.getList(c.value,u,d)},initialPageParam:0,getNextPageParam:(o,n,r)=>{var f;if(!(!(o!=null&&o.data)||((f=o==null?void 0:o.data)==null?void 0:f.length)===0))return r+1},getPreviousPageParam:(o,n,r)=>{if(!(r<=1))return r-1},...t.options}),i=s.computed(()=>e.isFetched?!1:e.isFetching);return s.watch(()=>e.isError,()=>{var o;h(e.error),(o=t.onError)==null||o.call(t,e.error)}),{...e,isLoading:i,data:e.data,fetchNextPage:e.fetchNextPage,hasNextPage:e.hasNextPage,refetch:e.refetch}}function M(t){const u=v.useManage(),d=g.useGetAuth(),{mutate:h}=g.useError(),c=s.computed(()=>{const{onError:o,options:n,...r}=t;return r}),e=E.useQuery({queryKey:[t.path,c],queryFn:()=>{var o;return(o=u.config.dataProvider)==null?void 0:o.getOne(c.value,u,d)},...t.options}),i=s.computed(()=>e.isFetched?!1:e.isFetching);return s.watch(()=>e.isError,()=>{var o;h(e.error),(o=t.onError)==null||o.call(t,e.error)}),{...e,isLoading:i,data:e.data,refetch:e.refetch}}function P(t){const u=v.useManage(),d=g.useGetAuth(),{mutate:h}=g.useError(),c=s.computed(()=>{const{onError:o,options:n,...r}=t;return r}),e=E.useQuery({queryKey:[t.path,c],queryFn:()=>{var o;return(o=u.config.dataProvider)==null?void 0:o.getMany(c.value,u,d)},...t.options}),i=s.computed(()=>e.isFetched?!1:e.isFetching);return s.watch(()=>e.isError,()=>{var o;h(e.error),(o=t.onError)==null||o.call(t,e.error)}),{...e,isLoading:i,data:e.data,refetch:e.refetch}}function q(t){const u=v.useManage(),d=g.useGetAuth(),{mutate:h}=g.useError(),{invalidate:c}=a(),e=s.computed(()=>{const{onError:n,options:r,...f}=t;return f}),i=E.useMutation({mutationFn:n=>{if(!u.config.dataProvider)throw new Error("Data provider is not initialized");return u.config.dataProvider.create({...e.value,...n},u,d)},onSuccess:n=>{var r;(r=t.onSuccess)==null||r.call(t,n),t.path&&c(t.path)},onError:n=>{var r;h(n),(r=t.onError)==null||r.call(t,n)},...t.options}),o=s.computed(()=>i.isPending);return{...i,isLoading:o,mutate:i.mutate}}function A(t){const u=v.useManage(),d=g.useGetAuth(),{mutate:h}=g.useError(),{invalidate:c}=a(),e=s.computed(()=>{const{onError:n,options:r,...f}=t;return f}),i=E.useMutation({mutationFn:n=>{if(!u.config.dataProvider)throw new Error("Data provider is not initialized");return u.config.dataProvider.createMany({...e.value,...n},u,d)},onSuccess:n=>{var r;(r=t.onSuccess)==null||r.call(t,n),t.path&&c(t.path)},onError:n=>{var r;h(n),(r=t.onError)==null||r.call(t,n)},...t.options}),o=s.computed(()=>i.isPending);return{...i,isLoading:o,mutate:i.mutate}}function $(t){const u=v.useManage(),d=g.useGetAuth(),{mutate:h}=g.useError(),{invalidate:c}=a(),e=s.computed(()=>{const{onError:n,options:r,...f}=t;return f}),i=E.useMutation({mutationFn:n=>{if(!u.config.dataProvider)throw new Error("Data provider is not initialized");return u.config.dataProvider.update({...e.value,...n},u,d)},onSuccess:n=>{var r;(r=t.onSuccess)==null||r.call(t,n),t.path&&c(t.path)},onError:n=>{var r;h(n),(r=t.onError)==null||r.call(t,n)},...t.options}),o=s.computed(()=>i.isPending);return{...i,isLoading:o,mutate:i.mutate}}function F(t){const u=v.useManage(),d=g.useGetAuth(),{mutate:h}=g.useError(),{invalidate:c}=a(),e=s.computed(()=>{const{onError:n,options:r,...f}=t;return f}),i=E.useMutation({mutationFn:n=>{if(!u.config.dataProvider)throw new Error("Data provider is not initialized");return u.config.dataProvider.updateMany({...e.value,...n},u,d)},onSuccess:n=>{var r;(r=t.onSuccess)==null||r.call(t,n),t.path&&c(t.path)},onError:n=>{var r;h(n),(r=t.onError)==null||r.call(t,n)},...t.options}),o=s.computed(()=>i.isPending);return{...i,isLoading:o,mutate:i.mutate}}function w(t){const u=v.useManage(),d=g.useGetAuth(),{mutate:h}=g.useError(),{invalidate:c}=a(),e=s.computed(()=>{const{onError:n,options:r,...f}=t;return f}),i=E.useMutation({mutationFn:n=>{if(!u.config.dataProvider)throw new Error("Data provider is not initialized");return u.config.dataProvider.deleteOne({...e.value,...n},u,d)},onSuccess:n=>{var r;(r=t.onSuccess)==null||r.call(t,n),t.path&&c(t.path)},onError:n=>{var r;h(n),(r=t.onError)==null||r.call(t,n)},...t.options}),o=s.computed(()=>i.isPending);return{...i,isLoading:o,mutate:i.mutate}}function L(t){const u=v.useManage(),d=g.useGetAuth(),{mutate:h}=g.useError(),{invalidate:c}=a(),e=s.computed(()=>{const{onError:n,options:r,...f}=t;return f}),i=E.useMutation({mutationFn:n=>{if(!u.config.dataProvider)throw new Error("Data provider is not initialized");return u.config.dataProvider.deleteMany({...e.value,...n},u,d)},onSuccess:n=>{var r;(r=t.onSuccess)==null||r.call(t,n),t.path&&c(t.path)},onError:n=>{var r;h(n),(r=t.onError)==null||r.call(t,n)},...t.options}),o=s.computed(()=>i.isPending);return{...i,isLoading:o,mutate:i.mutate}}function S(t){const u=v.useManage(),d=g.useGetAuth(),{mutate:h}=g.useError(),c=s.computed(()=>{const{onError:o,options:n,...r}=t;return r}),e=E.useQuery({queryKey:[t.path,c],queryFn:()=>{var o;return(o=u.config.dataProvider)==null?void 0:o.custom(c.value,u,d)},...t.options}),i=s.computed(()=>e.isFetched?!1:e.isFetching);return s.watch(()=>e.isError,()=>{var o;h(e.error),(o=t.onError)==null||o.call(t,e.error)}),{...e,isLoading:i,data:e.data,refetch:e.refetch}}function G(t){const u=v.useManage(),d=g.useGetAuth(),{mutate:h}=g.useError(),c=s.computed(()=>{const{onError:o,options:n,...r}=t;return r}),e=E.useMutation({mutationFn:o=>{if(!u.config.dataProvider)throw new Error("Data provider is not initialized");return u.config.dataProvider.custom({...c.value,...o},u,d)},onSuccess:o=>{var n;(n=t.onSuccess)==null||n.call(t,o)},onError:o=>{var n;h(o),(n=t.onError)==null||n.call(t,o)},...t.options}),i=s.computed(()=>e.isPending);return{...e,isLoading:i,mutate:e.mutate}}function C(){const t=v.useManage(),u=g.useGetAuth();return{request:h=>{var c;if(!t.config.dataProvider)throw new Error("Data provider is not initialized");return(c=t.config.dataProvider)==null?void 0:c.custom({...h},t,u)}}}function a(){const t=E.useQueryClient();return{invalidate:d=>{let h=d;Array.isArray(d)||(h=[d]),t.invalidateQueries({queryKey:h})}}}exports.useClient=C;exports.useCreate=q;exports.useCreateMany=A;exports.useCustom=S;exports.useCustomMutation=G;exports.useDelete=w;exports.useDeleteMany=L;exports.useInfiniteList=y;exports.useInvalidate=a;exports.useList=l;exports.useMany=P;exports.useOne=M;exports.useUpdate=$;exports.useUpdateMany=F;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("lodash-es"),l=require("vue"),s=require("./config.cjs");function p(r){var a;const e=s.useConfig(),n=l.inject("dux.manage");if(r||(r=n==null?void 0:n.value),!r)throw new Error("manage name is not defined");const t=o.cloneDeep((a=e.manages)==null?void 0:a.find(i=>i.name===r));if(!t)throw new Error(`manage ${r} is not defined`);const u=[];return t.title&&u.push(t.title),e.title&&u.push(e.title),t.title=u.join(" - "),t.copyright=t.copyright||e.copyright,t.description=t.description||e.description,t.theme={...e==null?void 0:e.theme,...t==null?void 0:t.theme},t.authProvider=(t==null?void 0:t.authProvider)||e.authProvider,t.dataProvider=(t==null?void 0:t.dataProvider)||e.dataProvider,t.layoutComponent={...e.layoutComponent,...t.layoutComponent},t.apiUrl=e!=null&&e.apiUrl?`${e.apiUrl}/${o.trim(t.apiUrl,"/")}`:t.apiUrl,t.apiUrl=o.trim(t.apiUrl,"/"),{config:t,getRoutePath:i=>`${t.routePrefix}/${o.trimStart(i||"","/")}`,getApiUrl:i=>`${t.apiUrl}/${o.trimStart(i||"","/")}`}}exports.useManage=p;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("lodash-es"),w=require("pinia"),r=require("vue"),A=require("vue-router");require("../stores/auth.cjs");const L=require("../stores/route.cjs"),f=require("../utils/tree.cjs");function j(n){const S=L.useRouteStore(),{routes:x}=w.storeToRefs(S),M=(e=!0)=>{var t;return(t=q.cloneDeep(x.value))==null?void 0:t.filter(a=>!!(a!=null&&a.name)).filter(a=>!e||a.hidden===void 0||a.hidden===!1)},y=r.computed(()=>{const e=M(!1);return f.arrayToTree(e,{idKey:"name",parentKey:"parent",childrenKey:"children",sortKey:"sort"},void 0)}),i=r.computed(()=>{const e=M();return f.arrayToTree(e,{idKey:"name",parentKey:"parent",childrenKey:"children",sortKey:"sort"},void 0)}),o=A.useRoute(),s=r.ref(o.name),c=r.ref(o.name),v=r.ref(o.name),R=r.computed(()=>{if(n!=null&&n.doubleMenu)return i.value;const e=q.cloneDeep(i.value);return e==null?void 0:e.map(t=>(delete t.children,t))}),K=r.computed(()=>{var t,a;return n!=null&&n.doubleMenu?[]:((a=(t=i.value)==null?void 0:t.find(d=>d.name===c.value))==null?void 0:a.children)||[]}),D=r.computed(()=>f.searchTree(y.value,t=>(t==null?void 0:t.name)===o.name));r.watch(()=>n==null?void 0:n.doubleMenu,()=>{var e,t,a,d;if(n!=null&&n.doubleMenu){const u=f.searchTree(i.value,l=>(l==null?void 0:l.name)===c.value);c.value=(a=u==null?void 0:u[0])==null?void 0:a.name,v.value=(d=u==null?void 0:u[u.length-1])==null?void 0:d.name}else{const u=f.searchTree(i.value,l=>(l==null?void 0:l.name)===v.value);c.value=(e=u==null?void 0:u[u.length-1])==null?void 0:e.name,v.value=(t=u==null?void 0:u[u.length-1])==null?void 0:t.name}},{immediate:!0});const I=r.computed(()=>n!=null&&n.doubleMenu?(n==null?void 0:n.doubleMenu)||K.value.length>0:!0);return r.watch([o,y,()=>n==null?void 0:n.doubleMenu],()=>{var d,u,l,g,T;const e=f.searchTree(y.value,m=>m.name===o.name),a=(m=>{let h=-1;for(let b=m.length-1;b>=0;b--)if(m[b].hidden===!1||m[b].hidden===void 0){h=b;break}return h})(e);s.value=(d=e==null?void 0:e[a])==null?void 0:d.name,n!=null&&n.doubleMenu?(c.value=(u=e==null?void 0:e[a])==null?void 0:u.name,v.value=(l=e==null?void 0:e[a])==null?void 0:l.name):(c.value=(g=e==null?void 0:e[0])==null?void 0:g.name,v.value=(T=e==null?void 0:e[a])==null?void 0:T.name)},{immediate:!0}),{data:i,originalData:y,getMenu:M,mainMenu:R,subMenu:K,isSubMenu:I,crumbs:D,active:s,appActive:c,subActive:v}}exports.useMenu=j;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("@overlastic/vue");require("vue");require("clsx");require("vue-router");const t=require("../components/overlay/overlay.cjs");function o(){const e=u.useOverlayInject(t.DuxOverlay);return{show:r=>e(r)}}exports.useOverlay=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@vueuse/core"),a=require("vue"),d=require("./manage.cjs");function f(l){const n=i.useColorMode(l),e=d.useManage(),{state:r,next:g}=i.useCycleList(["dark","light","auto"],{initialValue:n});a.watchEffect(()=>n.value=r.value);const u=a.computed(()=>{const{system:t,store:o}=n;return r.value==="auto"?t.value==="dark":o.value==="dark"}),m=a.computed(()=>{var t,o,c,s;return u.value?{logo:(t=e.config.theme)==null?void 0:t.darkLogo,banner:(o=e.config.theme)==null?void 0:o.darkBanner}:{logo:(c=e.config.theme)==null?void 0:c.logo,banner:(s=e.config.theme)==null?void 0:s.banner}});return{toggle:g,mode:r,isDark:u,theme:m}}exports.useTheme=f;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./main.cjs"),u=require("./hooks/auth.cjs"),a=require("./hooks/config.cjs"),e=require("./hooks/data.cjs"),i=require("./hooks/manage.cjs"),n=require("./hooks/menu.cjs"),c=require("./hooks/theme.cjs"),d=require("./hooks/overlay.cjs"),l=require("./router/route.cjs"),g=require("./stores/auth.cjs"),t=require("./stores/route.cjs"),s=require("./stores/tab.cjs"),q=require("./components/common/logo.cjs");require("vue");require("vue-router");const y=require("./components/overlay/overlay.cjs"),r=require("./utils/tree.cjs"),p=require("./provider/app.cjs"),v=require("./provider/tab.cjs"),T=require("./simple/authProvider.cjs"),h=require("./simple/dataProvider.cjs");exports.createDux=o.createDux;exports.useCheck=u.useCheck;exports.useError=u.useError;exports.useForgotPassword=u.useForgotPassword;exports.useGetAuth=u.useGetAuth;exports.useIsLogin=u.useIsLogin;exports.useLogin=u.useLogin;exports.useLogout=u.useLogout;exports.useRegister=u.useRegister;exports.useUpdatePassword=u.useUpdatePassword;exports.useConfig=a.useConfig;exports.useClient=e.useClient;exports.useCreate=e.useCreate;exports.useCreateMany=e.useCreateMany;exports.useCustom=e.useCustom;exports.useCustomMutation=e.useCustomMutation;exports.useDelete=e.useDelete;exports.useDeleteMany=e.useDeleteMany;exports.useInfiniteList=e.useInfiniteList;exports.useInvalidate=e.useInvalidate;exports.useList=e.useList;exports.useMany=e.useMany;exports.useOne=e.useOne;exports.useUpdate=e.useUpdate;exports.useUpdateMany=e.useUpdateMany;exports.useManage=i.useManage;exports.useMenu=n.useMenu;exports.useTheme=c.useTheme;exports.useOverlay=d.useOverlay;exports.initRouter=l.initRouter;exports.useAuthStore=g.useAuthStore;exports.createRouteStore=t.createRouteStore;exports.useRouteStore=t.useRouteStore;exports.createTabStore=s.createTabStore;exports.useTabStore=s.useTabStore;exports.DuxLogo=q.DuxLogo;exports.DuxOverlay=y.DuxOverlay;exports.arrayToTree=r.arrayToTree;exports.searchTree=r.searchTree;exports.treeToArr=r.treeToArr;exports.DuxAppProvider=p.DuxAppProvider;exports.DuxTabRouterView=v.DuxTabRouterView;exports.simpleAuthProvider=T.simpleAuthProvider;exports.simpleDataProvider=h.simpleDataProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("pinia"),o=require("pinia-plugin-persistedstate"),t=require("vue"),c=require("./router/route.cjs");function a(r){const n=i.createPinia();return n.use(o),{install(e){console.log("%c dux-vue %c dux.cn %c","background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#41b883 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent");const u=t.ref();e.provide("dux.config",r),e.provide("dux.manage",u),e.use(c.initRouter(r)),e.use(n)}}}exports.createDux=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue"),z=require("@overlastic/vue"),D=require("pinia"),E=require("vue-router"),F=require("../stores/auth.cjs"),N=require("../hooks/manage.cjs"),_=require("../hooks/config.cjs");require("@tanstack/vue-query");require("lodash-es");const j=require("../stores/route.cjs");require("@vueuse/core");require("clsx");const C=s.defineComponent({name:"DuxAppProvider",props:{},setup(I,{slots:p}){const h=s.inject("dux.manage"),f=_.useConfig(),d=E.useRouter(),l=F.useAuthStore();return d.beforeEach(async(n,O,a)=>{var v,q,P,b,R,$;const r=n.meta.manageName,w=n.meta.authorization===!1;if(!r){const e=f.defaultManage||((q=(v=f.manages)==null?void 0:v[0])==null?void 0:q.name)||"";return a({path:`/${e}`,replace:!0})}h&&(h.value=r);const c=j.useRouteStore(r),{routes:y}=D.storeToRefs(c),o=N.useManage(r);if(!l.isLogin(r))return w?a():a({path:o.getRoutePath("login"),replace:!0});const m=e=>e==null?void 0:e.map(u=>({...u,path:o.getRoutePath(u.path||"")}));if(!c.getRouteInit()){const e=((P=o.config)==null?void 0:P.components)||{},u=[];if(e.notFound&&u.push({name:`${r}.notFound`,label:"404",path:":pathMatch(.*)*",component:e.notFound,hidden:!0}),e.notAuthorized&&u.push({name:`${r}.notAuthorized`,label:"403",path:"notAuthorized",component:e.notAuthorized,hidden:!0}),e.error&&u.push({name:`${r}.error`,label:"500",path:"error",component:e.error,hidden:!0}),c.setRoutes(m(((b=o.config)==null?void 0:b.menus)||[])),(R=o.config)!=null&&R.apiRoutePath)try{await(($=o.config.dataProvider)==null?void 0:$.custom({path:o.config.apiRoutePath,meta:{timeout:5e3}},o,l.getUser(r)).then(t=>{c.appendRoutes(m(t.data||[]))}))}catch(t){console.error(t)}return c.appendRoutes(u),y.value.forEach(t=>{var A,M;if(!t.path)return;const i={name:t.name,path:t.path,meta:t.meta};switch(t.loader){case"iframe":i.component=(M=(A=o.config)==null?void 0:A.components)==null?void 0:M.iframe;break;case"link":i.beforeEnter=()=>{var S;const k=((S=t.meta)==null?void 0:S.url)||t.path;return k&&window.open(k,"_blank"),!1},i.component=()=>Promise.resolve({template:"<div></div>"});break;default:t.component&&(i.component=t.component);break}d.addRoute(`${r}.auth`,i)}),a({path:n.fullPath,replace:!0})}const g=["","/",`/${r}`,`/${r}/`];if(g.includes(n.path)){const e=c.getIndexRoute();return!(e!=null&&e.path)||g.includes(e==null?void 0:e.path)?(console.warn("[Dux] index route not found, skip redirect"),a()):a({path:(e==null?void 0:e.path)||"/",replace:!0})}return a()}),()=>s.createVNode(z.OverlaysProvider,null,{default:()=>{var n;return[(n=p.default)==null?void 0:n.call(p)]}})}});exports.DuxAppProvider=C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),d=require("vue-router");require("../stores/auth.cjs");const l=require("../stores/route.cjs"),b=require("../stores/tab.cjs"),p=t.defineComponent({name:"DuxTabRouterView",props:{},setup(){const u=d.useRoute(),s=b.useTabStore(),c=l.useRouteStore(),n=new Map,m=(e,a)=>{let r;const o=e;return n.has(o)?r=n.get(o):(r={name:o,render(){return a}},n.set(o,r)),r};s.$subscribe((e,a)=>{n.forEach(r=>{a.tabs.some(o=>o.path===r.name)||n.delete(r.name)})});const i=c.getIndexRoute();return i&&s.addTab({...i,meta:{...i.meta,lock:!0}}),t.watch([u,()=>c.routes],()=>{const e=c.searchRouteName(u.name);if(!e)return;const a={label:e.label,path:u.path,name:e.name};s.addTab(a)},{immediate:!0}),()=>t.createVNode(d.RouterView,null,{default:({Component:e})=>t.createVNode(t.Transition,{name:"tab-fade",mode:"out-in",appear:!0},{default:()=>[t.createVNode(t.KeepAlive,{include:s.tabs.map(a=>a.path||"")},[t.createVNode(e,{is:m(u.path,e),key:u.path},null)])]})})}});exports.DuxTabRouterView=p;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("vue-router");function y(o){var a,n,i;const u=[...o.routes||[],{name:"default",path:"/:catchAll(.*)",redirect:`/${o.defaultManage||((n=(a=o.manages)==null?void 0:a[0])==null?void 0:n.name)||""}`}];return(i=o.manages)==null||i.forEach(t=>{var h,s,c,m;const d=((h=t.routes)==null?void 0:h.filter(r=>{var e,l;return((e=r.meta)==null?void 0:e.authorization)===!0||((l=r.meta)==null?void 0:l.authorization)===void 0}))||[],f=((s=t.routes)==null?void 0:s.filter(r=>{var e;return((e=r.meta)==null?void 0:e.authorization)===!1}))||[];u.push({name:t.name,path:t.routePrefix||"",children:[{path:"",name:`${t.name}.auth`,component:(c=t.components)==null?void 0:c.authLayout,children:d},{path:"",name:`${t.name}.noAuth`,component:(m=t.components)==null?void 0:m.noAuthLayout,children:f}],meta:{manageName:t.name}})}),p.createRouter({history:p.createWebHashHistory(),routes:u})}exports.initRouter=y;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("axios"),d={login:async(u,c)=>await e.post(c.getApiUrl("/login"),u).then(t=>{var s,a;return{success:!0,message:(s=t==null?void 0:t.data)==null?void 0:s.message,redirectTo:"/",data:(a=t==null?void 0:t.data)==null?void 0:a.data}}).catch(t=>{var s,a;return{success:!1,message:((a=(s=t==null?void 0:t.response)==null?void 0:s.data)==null?void 0:a.message)||(t==null?void 0:t.message)}}),check:async(u,c)=>await e.get((c==null?void 0:c.getApiUrl("/check"))||"").then(t=>{var s,a;return{success:!0,message:(s=t==null?void 0:t.data)==null?void 0:s.message,data:(a=t==null?void 0:t.data)==null?void 0:a.data}}).catch(t=>{var s,a;return{success:!1,message:((a=(s=t==null?void 0:t.response)==null?void 0:s.data)==null?void 0:a.message)||(t==null?void 0:t.message)}}),onError:async u=>u.status===403?{logout:!0,redirectTo:"/login",error:u}:{logout:!1,error:u},logout:async()=>({success:!0,redirectTo:"/login"}),register:async(u,c)=>await e.post((c==null?void 0:c.getApiUrl("/auth/register"))||"",u).then(t=>{var s,a;return{success:!0,message:(s=t==null?void 0:t.data)==null?void 0:s.message,redirectTo:"/",data:(a=t==null?void 0:t.data)==null?void 0:a.data}}).catch(t=>{var s,a;return{success:!1,message:((a=(s=t==null?void 0:t.response)==null?void 0:s.data)==null?void 0:a.message)||(t==null?void 0:t.message)}}),forgotPassword:async(u,c)=>await e.post((c==null?void 0:c.getApiUrl("/auth/forgot-password"))||"",u).then(t=>{var s;return{success:!0,message:(s=t==null?void 0:t.data)==null?void 0:s.message,redirectTo:"/login"}}).catch(t=>{var s,a;return{success:!1,message:((a=(s=t==null?void 0:t.response)==null?void 0:s.data)==null?void 0:a.message)||(t==null?void 0:t.message)}}),updatePassword:async(u,c)=>await e.post((c==null?void 0:c.getApiUrl("/auth/update-password"))||"",u).then(t=>{var s;return{success:!0,message:(s=t==null?void 0:t.data)==null?void 0:s.message,redirectTo:"/login"}}).catch(t=>{var s,a;return{success:!1,message:((a=(s=t==null?void 0:t.response)==null?void 0:s.data)==null?void 0:a.message)||(t==null?void 0:t.message)}})};exports.simpleAuthProvider=d;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("axios"),A={getList:(e,r,t)=>{const d={};return e.pagination&&typeof e.pagination=="object"&&(d.page=e.pagination.page,d.limit=e.pagination.limit,d.pageSize=e.pagination.pageSize),i.get((r==null?void 0:r.getApiUrl(e.path))||"",{params:{...d,...e.filters,...e.sorters},headers:{Authorization:t==null?void 0:t.token},...e.meta}).then(l=>l.data)},create:(e,r,t)=>i.post((r==null?void 0:r.getApiUrl(e.path))||"",e.data,{headers:{Authorization:t==null?void 0:t.token},...e.meta}).then(d=>d.data),update:(e,r,t)=>i.put((r==null?void 0:r.getApiUrl(e.id?`${e.path}/${e.id}`:e.path))||"",e.data,{headers:{Authorization:t==null?void 0:t.token},...e.meta}).then(d=>d.data),deleteOne:(e,r,t)=>i.delete((r==null?void 0:r.getApiUrl(e.id?`${e.path}/${e.id}`:e.path))||"",{headers:{Authorization:t==null?void 0:t.token},...e.meta}).then(d=>d.data),getOne:(e,r,t)=>i.get((r==null?void 0:r.getApiUrl(e.id?`${e.path}/${e.id}`:e.path))||"",{headers:{Authorization:t==null?void 0:t.token},...e.meta}).then(d=>d.data),getMany:(e,r,t)=>i.get((r==null?void 0:r.getApiUrl(e.path))||"",{params:{ids:e.ids},headers:{Authorization:t==null?void 0:t.token},...e.meta}).then(d=>d.data),createMany:(e,r,t)=>i.post((r==null?void 0:r.getApiUrl(e.path))||"",e.data,{headers:{Authorization:t==null?void 0:t.token},...e.meta}).then(d=>d.data),updateMany:(e,r,t)=>i.put((r==null?void 0:r.getApiUrl(e.path))||"",{ids:e.ids,data:e.data},{headers:{Authorization:t==null?void 0:t.token},...e.meta}).then(d=>d.data),deleteMany:(e,r,t)=>i.delete((r==null?void 0:r.getApiUrl(e.path))||"",{params:{ids:e.ids},headers:{Authorization:t==null?void 0:t.token},...e.meta}).then(d=>d.data),custom:(e,r,t)=>{let d={...e.query};return e.sorters&&typeof e.sorters=="object"&&(d={...d,...e.sorters}),e.filters&&typeof e.filters=="object"&&(d={...d,...e.filters}),i.request({url:r==null?void 0:r.getApiUrl(e.path||""),method:e.method||"GET",data:e.payload,params:d,headers:{Authorization:t==null?void 0:t.token,...e.headers},...e.meta}).then(l=>l.data)}};exports.simpleDataProvider=A;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("pinia"),i=require("vue"),s=u.defineStore("auth",()=>{const t=i.ref({});return{data:t,getUser:o=>t.value[o]||{},login:(o,e)=>{t.value={...t.value,[o]:{token:e.token,id:e.id,info:e.info,permission:e.permission}}},isLogin:o=>!!t.value[o],logout:o=>{const e={...t.value};delete e[o],t.value=e},update:(o,e)=>{t.value={...t.value,[o]:{token:e.token,id:e.id,info:e.info,permission:e.permission}}},updateKey:(o,e,n)=>{t.value={...t.value,[o]:{...t.value[o],[e]:n}}}}},{persist:!0});exports.useAuthStore=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("pinia"),a=require("vue");function x(n){const t=a.inject("dux.manage");if(n||(n=(t==null?void 0:t.value)||""),!n)throw new Error("manage not found");return p(n)()}function p(n){return w.defineStore(`routes-${n}`,()=>{const t=a.ref([]),l=e=>{var o;return(o=t.value)==null?void 0:o.find(u=>u.path===e)},S=e=>{var o;return(o=t.value)==null?void 0:o.find(u=>u.name===e)},h=e=>{var o;(o=t.value)==null||o.push(e)},g=e=>{t.value=[...t.value,...e]},I=e=>{t.value=e},b=()=>t.value,j=()=>{t.value=[]},q=()=>{var u,d;const e=(d=(u=t.value)==null?void 0:u.filter(r=>!r.parent&&!r.name.includes("404")&&!r.name.includes("403")))==null?void 0:d.sort((r,s)=>(r.sort||0)-(s.sort||0)),o=r=>{var v,R;if(r.path)return r;const s=(R=(v=t.value)==null?void 0:v.filter(c=>c.parent===r.name))==null?void 0:R.sort((c,i)=>(c.sort||0)-(i.sort||0));for(const c of s||[]){const i=o(c);if(i)return i}};for(const r of e||[]){const s=o(r);if(s)return s}},f=a.ref(!1);return{routes:t,searchRoute:l,searchRouteName:S,appendRoute:h,appendRoutes:g,setRoutes:I,getRoutes:b,clearRoutes:j,getIndexRoute:q,getRouteInit:()=>{const e=f.value;return f.value=!0,e}}})}exports.createRouteStore=p;exports.useRouteStore=x;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("pinia"),i=require("vue");function h(r){const u=i.inject("dux.manage");if(r||(r=(u==null?void 0:u.value)||""),!r)throw new Error("manage not found");return v(r)()}function v(r){return c.defineStore(`tab-${r}`,()=>{const u=i.ref(),t=i.ref([]);return{current:u,tabs:t,isTab:l=>t.value.some(e=>e.path===l),addTab:(l,e)=>{l.path&&(t.value.some(a=>a.path===l.path)||(t.value.push(l),e==null||e(l)),u.value=l.path)},delTab:(l,e)=>{var s;const a=t.value.findIndex(f=>f.path===l);if(!a||t.value.length<=1)return;const n=t.value[a];if((s=n==null?void 0:n.meta)!=null&&s.lock)return;const o=t.value[a-1],d=t.value[a+1];e==null||e(o||d),setTimeout(()=>{t.value.splice(a,1)},0)},changeTab:(l,e)=>{u.value=l;const a=t.value.find(n=>n.path===l);a&&(e==null||e(a))},delOther:(l,e)=>{t.value=t.value.filter(a=>{var n;return a.path===l||((n=a.meta)==null?void 0:n.lock)}),e==null||e()},delLeft:(l,e)=>{const a=t.value.findIndex(n=>n.path===l);a<=0||(t.value=[...t.value.slice(0,a).filter(n=>{var o;return(o=n.meta)==null?void 0:o.lock}),...t.value.slice(a)],e==null||e())},delRight:(l,e)=>{const a=t.value.findIndex(n=>n.path===l);a===-1||a===t.value.length-1||(t.value=[...t.value.slice(0,a+1),...t.value.slice(a+1).filter(n=>{var o;return(o=n.meta)==null?void 0:o.lock})],e==null||e())},lockTab:l=>{const e=t.value.findIndex(a=>a.path===l);e!==-1&&t.value[e]&&(t.value[e].meta||(t.value[e].meta={}),t.value[e].meta.lock=!t.value[e].meta.lock)},clearTab:()=>{u.value=void 0,t.value=[]}}})}exports.createTabStore=v;exports.useTabStore=h;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function f(h,n,t){let e=[];return h.forEach(r=>{if(r[n.parentKey]===t){const c=f(h,n,r[n.idKey]);c.length>0&&(r[n.childrenKey]=c),e.push(r)}}),e=e.sort((r,c)=>r[n.sortKey]-c[n.sortKey]),e}function l(h,n,t=[]){var e;if(!h||!h.length)return[];for(const r of h){if(t.push(r),n(r))return t;if(r!=null&&r.children&&((e=r==null?void 0:r.children)!=null&&e.length)){const c=l(r.children,n,t);if(c.length)return c}t.pop()}return[]}function o(h,n,t){let e=[];if(!h||!h.length)return e;for(const r of h)if(e.push(r[n]),r[t]&&r[t].length){const c=o(r[t],n,t);c.length&&(e=e.concat(c))}return e}exports.arrayToTree=f;exports.searchTree=l;exports.treeToArr=o;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { defineComponent as e, createVNode as l } from "vue";
|
|
2
|
+
import a from "clsx";
|
|
3
|
+
const c = /* @__PURE__ */ e({
|
|
4
|
+
name: "DuxLogo",
|
|
5
|
+
props: {
|
|
6
|
+
dark: {
|
|
7
|
+
type: Boolean,
|
|
8
|
+
default: !1
|
|
9
|
+
},
|
|
10
|
+
highlight: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: "fill-primary"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
setup(t) {
|
|
16
|
+
return () => l("svg", {
|
|
17
|
+
class: "w-auto h-full",
|
|
18
|
+
viewBox: "0 0 400.893 121.787",
|
|
19
|
+
version: "1.1",
|
|
20
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
21
|
+
}, [l("g", {
|
|
22
|
+
transform: "translate(-6545.000000, -3038.106602) translate(6345.000000, 2899.000000) translate(200.000000, 132.393398)",
|
|
23
|
+
"fill-rule": "nonzero",
|
|
24
|
+
stroke: "none",
|
|
25
|
+
"stroke-width": "1",
|
|
26
|
+
fill: "none"
|
|
27
|
+
}, [l("path", {
|
|
28
|
+
d: "M0 62.607v50c0 8.284 6.716 15 15 15s15-6.716 15-15v-50c0-8.285-6.716-15-15-15s-15 6.715-15 15z",
|
|
29
|
+
class: a([t.dark ? "fill-white/90" : "fill-black dark:fill-white/90"])
|
|
30
|
+
}, null), l("path", {
|
|
31
|
+
d: "M60 7.607c33.137 0 60 26.863 60 60s-26.863 60-60 60h-5c-8.284 0-15-6.716-15-15 0-8.285 6.716-15 15-15h5c16.57 0 30-13.432 30-30 0-16.57-13.43-30-30-30H15c-8.284 0-15-6.716-15-15 0-8.285 6.716-15 15-15h45z",
|
|
32
|
+
class: a([t.dark ? "fill-white/90" : "fill-black dark:fill-white/90"])
|
|
33
|
+
}, null), l("path", {
|
|
34
|
+
d: "M201 7.607c33.137 0 60 26.863 60 60s-26.863 60-60 60h-46c-8.284 0-15-6.716-15-15 0-8.285 6.716-15 15-15h46c16.57 0 30-13.432 30-30 0-16.57-13.43-30-30-30h-45.5c-8.284 0-15-6.716-15-15 0-8.285 6.716-15 15-15H201z",
|
|
35
|
+
class: a([t.dark ? "fill-white/90" : "fill-black dark:fill-white/90"]),
|
|
36
|
+
transform: "translate(200.500000, 67.606602) rotate(90.000000) translate(-200.500000, -67.606602) "
|
|
37
|
+
}, null), l("g", {
|
|
38
|
+
transform: "translate(279.106602, 6.713203)"
|
|
39
|
+
}, [l("path", {
|
|
40
|
+
d: "M25.607 4.393 52.893 31.68c5.858 5.858 5.858 15.356 0 21.213-5.857 5.858-15.355 5.858-21.213 0L4.393 25.607c-5.857-5.858-5.857-15.356 0-21.214 5.858-5.857 15.356-5.857 21.214 0zm91.786 0c5.858 5.858 5.858 15.356 0 21.214L90.107 52.893c-5.858 5.858-15.356 5.858-21.214 0-5.857-5.857-5.857-15.355 0-21.213L96.18 4.393c5.858-5.857 15.356-5.857 21.213 0zm-64.5 64.5c5.858 5.858 5.858 15.356 0 21.214l-27.286 27.286c-5.858 5.858-15.356 5.858-21.214 0-5.857-5.857-5.857-15.355 0-21.213L31.68 68.893c5.858-5.857 15.356-5.857 21.213 0z",
|
|
41
|
+
class: a([t.dark ? "fill-white/90" : "fill-black dark:fill-white/90"])
|
|
42
|
+
}, null), l("path", {
|
|
43
|
+
d: "m90.107 68.893 27.286 27.287c5.858 5.858 5.858 15.356 0 21.213-5.857 5.858-15.355 5.858-21.213 0L68.893 90.107c-5.857-5.858-5.857-15.356 0-21.214 5.858-5.857 15.356-5.857 21.214 0z",
|
|
44
|
+
class: a([t.highlight])
|
|
45
|
+
}, null)])])]);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
export {
|
|
49
|
+
c as DuxLogo
|
|
50
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { defineComponent as r, defineAsyncComponent as u, createVNode as t, Transition as l } from "vue";
|
|
2
|
+
import { useExtendOverlay as d } from "@overlastic/vue";
|
|
3
|
+
const v = /* @__PURE__ */ r({
|
|
4
|
+
name: "DuxOverlay",
|
|
5
|
+
props: {
|
|
6
|
+
component: Function,
|
|
7
|
+
componentProps: Object,
|
|
8
|
+
mask: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: !0
|
|
11
|
+
},
|
|
12
|
+
maskClosable: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: !0
|
|
15
|
+
},
|
|
16
|
+
duration: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: 300
|
|
19
|
+
},
|
|
20
|
+
zIndex: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: 1e3
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
setup(e) {
|
|
26
|
+
const {
|
|
27
|
+
visible: n,
|
|
28
|
+
resolve: s,
|
|
29
|
+
reject: o
|
|
30
|
+
} = d({
|
|
31
|
+
duration: e.duration
|
|
32
|
+
}), a = (e == null ? void 0 : e.componentProps) || {};
|
|
33
|
+
a.onConfirm = s, a.onClose = o;
|
|
34
|
+
const i = u(e.component), c = () => {
|
|
35
|
+
e.maskClosable && o();
|
|
36
|
+
};
|
|
37
|
+
return () => t("div", {
|
|
38
|
+
class: "fixed inset-0 flex items-center justify-center overflow-auto",
|
|
39
|
+
style: {
|
|
40
|
+
zIndex: e.zIndex
|
|
41
|
+
}
|
|
42
|
+
}, [t(l, {
|
|
43
|
+
enterActiveClass: "transition-opacity",
|
|
44
|
+
enterFromClass: "opacity-0",
|
|
45
|
+
enterToClass: "opacity-100",
|
|
46
|
+
leaveActiveClass: "transition-opacity",
|
|
47
|
+
leaveFromClass: "opacity-100",
|
|
48
|
+
leaveToClass: "opacity-0"
|
|
49
|
+
}, {
|
|
50
|
+
default: () => [n.value && e.mask && t("div", {
|
|
51
|
+
class: "fixed inset-0 bg-black bg-opacity-30",
|
|
52
|
+
style: {
|
|
53
|
+
transitionDuration: `${e.duration}ms`
|
|
54
|
+
},
|
|
55
|
+
onClick: c,
|
|
56
|
+
"aria-hidden": "true"
|
|
57
|
+
}, null)]
|
|
58
|
+
}), t(l, {
|
|
59
|
+
enterActiveClass: "transition-all",
|
|
60
|
+
enterFromClass: "opacity-0 scale-95",
|
|
61
|
+
enterToClass: "opacity-100 scale-100",
|
|
62
|
+
leaveActiveClass: "transition-all",
|
|
63
|
+
leaveFromClass: "opacity-100 scale-100",
|
|
64
|
+
leaveToClass: "opacity-0 scale-95"
|
|
65
|
+
}, {
|
|
66
|
+
default: () => [n.value && t(i, a, null)]
|
|
67
|
+
})]);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
export {
|
|
71
|
+
v as DuxOverlay
|
|
72
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { ref as h } from "vue";
|
|
2
|
+
import { useRouter as d } from "vue-router";
|
|
3
|
+
import { useAuthStore as c } from "../stores/auth.js";
|
|
4
|
+
import { useManage as f } from "./manage.js";
|
|
5
|
+
function R({ onSuccess: e, onError: a }) {
|
|
6
|
+
const n = f(), o = c(), s = d(), u = h(!1);
|
|
7
|
+
return {
|
|
8
|
+
mutate: async (i) => {
|
|
9
|
+
var r;
|
|
10
|
+
u.value = !0;
|
|
11
|
+
const t = await ((r = n.config.authProvider) == null ? void 0 : r.login(i, n));
|
|
12
|
+
if (u.value = !1, t != null && t.success) {
|
|
13
|
+
if (!(t != null && t.data))
|
|
14
|
+
throw new Error("Login response data is undefined");
|
|
15
|
+
e == null || e(t), o.login(n.config.name, t.data), s.push(n.getRoutePath(t.redirectTo || "/"));
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
a == null || a(t);
|
|
19
|
+
},
|
|
20
|
+
isLoading: u
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function v({ onSuccess: e, onError: a }) {
|
|
24
|
+
const { config: n, getRoutePath: o } = f(), s = c(), u = d();
|
|
25
|
+
return {
|
|
26
|
+
mutate: async (i) => {
|
|
27
|
+
var r;
|
|
28
|
+
const t = await ((r = n.authProvider) == null ? void 0 : r.logout(i));
|
|
29
|
+
if (t != null && t.success) {
|
|
30
|
+
e == null || e(t), s.logout(n.name), u.push(o(t.redirectTo || "/login"));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
a == null || a(t);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function T({ onSuccess: e, onError: a }) {
|
|
38
|
+
const { config: n, getRoutePath: o } = f(), s = c(), u = d();
|
|
39
|
+
return {
|
|
40
|
+
mutate: async (i) => {
|
|
41
|
+
var r;
|
|
42
|
+
const t = await ((r = n.authProvider) == null ? void 0 : r.check(i));
|
|
43
|
+
if (t != null && t.success) {
|
|
44
|
+
if (e == null || e(t), !(t != null && t.data))
|
|
45
|
+
throw new Error("Check response data is undefined");
|
|
46
|
+
s.update(n.name, t.data);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
a == null || a(t), t != null && t.logout && u.push(o(t.redirectTo || "/login"));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function y({ onSuccess: e, onError: a }) {
|
|
54
|
+
const { config: n, getRoutePath: o } = f(), s = c(), u = d();
|
|
55
|
+
return {
|
|
56
|
+
mutate: async (i) => {
|
|
57
|
+
var r;
|
|
58
|
+
const t = await ((r = n.authProvider) == null ? void 0 : r.register(i));
|
|
59
|
+
if (t != null && t.success) {
|
|
60
|
+
if (e == null || e(t), !(t != null && t.data))
|
|
61
|
+
throw new Error("Register response data is undefined");
|
|
62
|
+
s.login(n.name, t.data), u.push(o(t.redirectTo || ""));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
a == null || a(t);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function L({ onSuccess: e, onError: a }) {
|
|
70
|
+
const { config: n, getRoutePath: o } = f(), s = d();
|
|
71
|
+
return {
|
|
72
|
+
mutate: async (g) => {
|
|
73
|
+
var t;
|
|
74
|
+
const i = await ((t = n.authProvider) == null ? void 0 : t.forgotPassword(g));
|
|
75
|
+
if (i != null && i.success) {
|
|
76
|
+
e == null || e(i), i.redirectTo && s.push(o(i.redirectTo));
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
a == null || a(i);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function A({ onSuccess: e, onError: a }) {
|
|
84
|
+
const { config: n, getRoutePath: o } = f(), s = d();
|
|
85
|
+
return {
|
|
86
|
+
mutate: async (g) => {
|
|
87
|
+
var t;
|
|
88
|
+
const i = await ((t = n.authProvider) == null ? void 0 : t.updatePassword(g));
|
|
89
|
+
if (i != null && i.success) {
|
|
90
|
+
e == null || e(i), i.redirectTo && s.push(o(i.redirectTo));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
a == null || a(i);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function U(e) {
|
|
98
|
+
const { config: a, getRoutePath: n } = f(), o = d();
|
|
99
|
+
return {
|
|
100
|
+
mutate: async (u) => {
|
|
101
|
+
var i;
|
|
102
|
+
const g = await ((i = a.authProvider) == null ? void 0 : i.onError(u));
|
|
103
|
+
e == null || e(g), g != null && g.logout && o.push(n(g.redirectTo || "/login"));
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function x(e) {
|
|
108
|
+
const { config: a } = f(e);
|
|
109
|
+
return c().getUser(a.name);
|
|
110
|
+
}
|
|
111
|
+
function F(e) {
|
|
112
|
+
const { config: a } = f(e);
|
|
113
|
+
return c().isLogin(a.name);
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
T as useCheck,
|
|
117
|
+
U as useError,
|
|
118
|
+
L as useForgotPassword,
|
|
119
|
+
x as useGetAuth,
|
|
120
|
+
F as useIsLogin,
|
|
121
|
+
R as useLogin,
|
|
122
|
+
v as useLogout,
|
|
123
|
+
y as useRegister,
|
|
124
|
+
A as useUpdatePassword
|
|
125
|
+
};
|