@duxweb/dvha-core 0.1.1 → 0.1.3
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/auth/can.cjs +1 -0
- package/dist/cjs/directive/permission.cjs +1 -0
- package/dist/cjs/hooks/auth.cjs +1 -1
- package/dist/cjs/hooks/i18n.cjs +1 -0
- package/dist/cjs/hooks/overlay.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/main.cjs +1 -1
- package/dist/cjs/preset/authProvider.cjs +1 -0
- package/dist/cjs/{simple → preset}/dataProvider.cjs +1 -1
- package/dist/cjs/preset/i18nProvider.cjs +1 -0
- package/dist/cjs/provider/app.cjs +1 -1
- package/dist/cjs/stores/i18n.cjs +1 -0
- package/dist/cjs/stores/manage.cjs +1 -1
- package/dist/esm/components/auth/can.js +33 -0
- package/dist/esm/directive/permission.js +21 -0
- package/dist/esm/hooks/auth.js +68 -60
- package/dist/esm/hooks/i18n.js +25 -0
- package/dist/esm/hooks/overlay.js +6 -2
- package/dist/esm/index.js +63 -54
- package/dist/esm/main.js +6 -5
- package/dist/esm/preset/authProvider.js +117 -0
- package/dist/esm/preset/i18nProvider.js +22 -0
- package/dist/esm/provider/app.js +66 -50
- package/dist/esm/stores/i18n.js +31 -0
- package/dist/esm/stores/manage.js +18 -18
- package/dist/types/components/auth/can.d.ts +20 -0
- package/dist/types/components/auth/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/directive/index.d.ts +1 -0
- package/dist/types/directive/permission.d.ts +2 -0
- package/dist/types/hooks/auth.d.ts +7 -0
- package/dist/types/hooks/i18n.d.ts +5 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/preset/i18nProvider.d.ts +3 -0
- package/dist/types/{simple → preset}/index.d.ts +1 -0
- package/dist/types/stores/i18n.d.ts +22 -0
- package/dist/types/stores/index.d.ts +1 -0
- package/dist/types/stores/route.d.ts +525 -0
- package/dist/types/stores/tab.d.ts +210 -0
- package/dist/types/types/auth.d.ts +1 -0
- package/dist/types/types/config.d.ts +2 -0
- package/dist/types/types/i18n.d.ts +10 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/manage.d.ts +2 -0
- package/package.json +2 -1
- package/dist/cjs/simple/authProvider.cjs +0 -1
- package/dist/esm/simple/authProvider.js +0 -113
- package/dist/esm/{simple → preset}/dataProvider.js +1 -1
- /package/dist/types/{simple → preset}/authProvider.d.ts +0 -0
- /package/dist/types/{simple → preset}/dataProvider.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),t=require("../../hooks/auth.cjs");require("@tanstack/vue-query");require("lodash-es");require("pinia");require("vue-router");require("@vueuse/core");require("@overlastic/vue");require("clsx");const q=i.defineComponent({name:"DuxCan",props:{name:{type:String,required:!0},params:{type:Object}},setup(r,{slots:e}){const a=t.useCan();return()=>{var u,n;return a(r.name,r.params)?(u=e.default)==null?void 0:u.call(e):((n=e.fallback)==null?void 0:n.call(e))||null}}});exports.DuxCan=q;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../hooks/auth.cjs");require("vue");require("@tanstack/vue-query");require("lodash-es");require("pinia");require("vue-router");require("@vueuse/core");require("@overlastic/vue");require("clsx");const n={mounted(e,t){var i;const{value:r}=t;if(!r)return;u.useCan()(r)||(i=e.parentElement)==null||i.removeChild(e)}};exports.permissionDirective=n;
|
package/dist/cjs/hooks/auth.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("vue"),c=require("vue-router"),h=require("../stores/auth.cjs"),g=require("./manage.cjs");function P({onSuccess:e,onError:u}){const o=g.useManage(),s=h.useAuthStore(),r=c.useRouter(),i=f.ref(!1);return{mutate:async t=>{var d;i.value=!0;const n=await((d=o.config.authProvider)==null?void 0:d.login(t,o));if(i.value=!1,n!=null&&n.success){if(!(n!=null&&n.data))throw new Error("Login response data is undefined");e==null||e(n),s.login(n.data),r.push(o.getRoutePath(n.redirectTo||"/"));return}u==null||u(n)},isLoading:i}}function m({onSuccess:e,onError:u}){const o=g.useManage(),s=h.useAuthStore(),r=c.useRouter();return{mutate:async a=>{var n;const t=await((n=o.config.authProvider)==null?void 0:n.logout(a,o));if(t!=null&&t.success){e==null||e(t),s.logout(),r.push(o.getRoutePath(t.redirectTo||"/login"));return}u==null||u(t)}}}function w({onSuccess:e,onError:u}){const o=g.useManage(),s=h.useAuthStore(),r=c.useRouter();return{mutate:async a=>{var n;const t=await((n=o.config.authProvider)==null?void 0:n.check(a,o));if(t!=null&&t.success){if(e==null||e(t),!(t!=null&&t.data))throw new Error("Check response data is undefined");s.update(t.data);return}u==null||u(t),t!=null&&t.logout&&r.push(o.getRoutePath(t.redirectTo||"/login"))}}}function R({onSuccess:e,onError:u}){const o=g.useManage(),s=h.useAuthStore(),r=c.useRouter();return{mutate:async a=>{var n;const t=await((n=o.config.authProvider)==null?void 0:n.register(a,o));if(t!=null&&t.success){if(e==null||e(t),!(t!=null&&t.data))throw new Error("Register response data is undefined");s.login(t.data),r.push(o.getRoutePath(t.redirectTo||""));return}u==null||u(t)}}}function p({onSuccess:e,onError:u}){const o=g.useManage(),s=c.useRouter();return{mutate:async i=>{var t;const a=await((t=o.config.authProvider)==null?void 0:t.forgotPassword(i,o));if(a!=null&&a.success){e==null||e(a),a.redirectTo&&s.push(o.getRoutePath(a.redirectTo));return}u==null||u(a)}}}function v({onSuccess:e,onError:u}){const o=g.useManage(),s=c.useRouter();return{mutate:async i=>{var t;const a=await((t=o.config.authProvider)==null?void 0:t.updatePassword(i,o));if(a!=null&&a.success){e==null||e(a),a.redirectTo&&s.push(o.getRoutePath(a.redirectTo));return}u==null||u(a)}}}function T(e){const{config:u,getRoutePath:o}=g.useManage(),s=c.useRouter();return{mutate:async i=>{var t;const a=await((t=u.authProvider)==null?void 0:t.onError(i));e==null||e(a),a!=null&&a.logout&&s.push(o(a.redirectTo||"/login"))}}}function y(e){return h.useAuthStore(e).getUser()}function A(e){return h.useAuthStore(e).isLogin()}function L(e){const u=g.useManage(e),s=h.useAuthStore(e).getUser();return(i,a)=>{var t;return(t=u.config.authProvider)!=null&&t.can?u.config.authProvider.can(i,a,u,s)||!1:!0}}exports.useCan=L;exports.useCheck=w;exports.useError=T;exports.useForgotPassword=p;exports.useGetAuth=y;exports.useIsLogin=A;exports.useLogin=P;exports.useLogout=m;exports.useRegister=R;exports.useUpdatePassword=v;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("pinia");require("vue");require("lodash-es");const a=require("../stores/i18n.cjs"),u=require("./manage.cjs");function s(){const i=a.useI18nStore(),o=u.useManage();return{t:(e,n,r)=>{var t,c;return(c=(t=o.config)==null?void 0:t.i18nProvider)==null?void 0:c.t(e,n,r)},changeLocale:e=>{var n,r;return i.setLocale(e),(r=(n=o.config)==null?void 0:n.i18nProvider)==null?void 0:r.changeLocale(e)},getLocale:()=>{var e,n;return(n=(e=o.config)==null?void 0:e.i18nProvider)==null?void 0:n.getLocale()}}}exports.useI18n=s;
|
|
@@ -1 +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
|
|
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");require("pinia");require("lodash-es");require("@tanstack/vue-query");require("@vueuse/core");function i(){const e=u.useOverlayInject(t.DuxOverlay);return{show:r=>e(r)}}exports.useOverlay=i;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./main.cjs"),u=require("./hooks/auth.cjs"),t=require("./hooks/config.cjs"),e=require("./hooks/data.cjs"),o=require("./hooks/manage.cjs"),a=require("./hooks/menu.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./main.cjs"),u=require("./hooks/auth.cjs"),t=require("./hooks/config.cjs"),e=require("./hooks/data.cjs"),o=require("./hooks/manage.cjs"),a=require("./hooks/menu.cjs"),n=require("./hooks/theme.cjs"),i=require("./hooks/overlay.cjs"),c=require("./hooks/i18n.cjs"),d=require("./router/route.cjs"),q=require("./stores/auth.cjs"),g=require("./stores/route.cjs"),l=require("./stores/tab.cjs"),v=require("./stores/manage.cjs"),D=require("./stores/i18n.cjs"),m=require("./components/common/logo.cjs"),y=require("./components/loader/iframe.cjs"),C=require("./components/overlay/overlay.cjs"),p=require("./components/auth/can.cjs"),r=require("./utils/tree.cjs"),M=require("./provider/app.cjs"),h=require("./provider/tab.cjs"),P=require("./preset/authProvider.cjs"),T=require("./preset/dataProvider.cjs"),x=require("./preset/i18nProvider.cjs");exports.createDux=s.createDux;exports.useCan=u.useCan;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=t.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=o.useManage;exports.useMenu=a.useMenu;exports.useTheme=n.useTheme;exports.useOverlay=i.useOverlay;exports.useI18n=c.useI18n;exports.initRouter=d.initRouter;exports.useAuthStore=q.useAuthStore;exports.useRouteStore=g.useRouteStore;exports.useTabStore=l.useTabStore;exports.useManageStore=v.useManageStore;exports.useI18nStore=D.useI18nStore;exports.DuxLogo=m.DuxLogo;exports.DuxLoaderIframe=y;exports.DuxOverlay=C.DuxOverlay;exports.DuxCan=p.DuxCan;exports.arrayToTree=r.arrayToTree;exports.searchTree=r.searchTree;exports.treeToArr=r.treeToArr;exports.DuxAppProvider=M.DuxAppProvider;exports.DuxTabRouterView=h.DuxTabRouterView;exports.simpleAuthProvider=P.simpleAuthProvider;exports.simpleDataProvider=T.simpleDataProvider;exports.i18nProvider=x.i18nProvider;
|
package/dist/cjs/main.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("pinia"),t=require("pinia-plugin-persistedstate"),u=require("vue"),c=require("./directive/permission.cjs"),s=require("./router/route.cjs");function a(r){const i=o.createPinia();return i.use(t),{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 n=u.ref();e.provide("dux.config",r),e.provide("dux.manage",n),e.directive("can",c.permissionDirective),e.use(s.initRouter(r)),e.use(i)}}}exports.createDux=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("axios");function s(a){return{login:async(d,c)=>{var n;return await g.post(c.getApiUrl(((n=a==null?void 0:a.apiPath)==null?void 0:n.login)||"/login",a==null?void 0:a.dataProviderName),d).then(t=>{var e,i,u;return{success:!0,message:(e=t==null?void 0:t.data)==null?void 0:e.message,redirectTo:((i=a==null?void 0:a.routePath)==null?void 0:i.index)||"/",data:(u=t==null?void 0:t.data)==null?void 0:u.data}}).catch(t=>{var e,i;return{success:!1,message:((i=(e=t==null?void 0:t.response)==null?void 0:e.data)==null?void 0:i.message)||(t==null?void 0:t.message)}})},check:async(d,c)=>{var n;return await g.get((c==null?void 0:c.getApiUrl(((n=a==null?void 0:a.apiPath)==null?void 0:n.check)||"/check",a==null?void 0:a.dataProviderName))||"").then(t=>{var e,i;return{success:!0,message:(e=t==null?void 0:t.data)==null?void 0:e.message,data:(i=t==null?void 0:t.data)==null?void 0:i.data}}).catch(t=>{var e,i;return{success:!1,message:((i=(e=t==null?void 0:t.response)==null?void 0:e.data)==null?void 0:i.message)||(t==null?void 0:t.message)}})},onError:async d=>{var c;return d.status===403?{logout:!0,redirectTo:((c=a==null?void 0:a.routePath)==null?void 0:c.login)||"/login",error:d}:{logout:!1,error:d}},logout:async()=>{var d;return{success:!0,redirectTo:((d=a==null?void 0:a.routePath)==null?void 0:d.login)||"/login"}},register:async(d,c)=>{var n;return await g.post((c==null?void 0:c.getApiUrl(((n=a==null?void 0:a.apiPath)==null?void 0:n.register)||"/register",a==null?void 0:a.dataProviderName))||"",d).then(t=>{var e,i,u;return{success:!0,message:(e=t==null?void 0:t.data)==null?void 0:e.message,redirectTo:((i=a==null?void 0:a.routePath)==null?void 0:i.index)||"/",data:(u=t==null?void 0:t.data)==null?void 0:u.data}}).catch(t=>{var e,i;return{success:!1,message:((i=(e=t==null?void 0:t.response)==null?void 0:e.data)==null?void 0:i.message)||(t==null?void 0:t.message)}})},forgotPassword:async(d,c)=>{var n;return await g.post((c==null?void 0:c.getApiUrl(((n=a==null?void 0:a.apiPath)==null?void 0:n.forgotPassword)||"/forgot-password",a==null?void 0:a.dataProviderName))||"",d).then(t=>{var e,i;return{success:!0,message:(e=t==null?void 0:t.data)==null?void 0:e.message,redirectTo:((i=a==null?void 0:a.routePath)==null?void 0:i.login)||"/login"}}).catch(t=>{var e,i;return{success:!1,message:((i=(e=t==null?void 0:t.response)==null?void 0:e.data)==null?void 0:i.message)||(t==null?void 0:t.message)}})},updatePassword:async(d,c)=>{var n;return await g.post((c==null?void 0:c.getApiUrl(((n=a==null?void 0:a.apiPath)==null?void 0:n.updatePassword)||"/update-password",a==null?void 0:a.dataProviderName))||"",d).then(t=>{var e,i;return{success:!0,message:(e=t==null?void 0:t.data)==null?void 0:e.message,redirectTo:((i=a==null?void 0:a.routePath)==null?void 0:i.login)||"/login"}}).catch(t=>{var e,i;return{success:!1,message:((i=(e=t==null?void 0:t.response)==null?void 0:e.data)==null?void 0:i.message)||(t==null?void 0:t.message)}})},can:(d,c,n,t)=>{var e;return!(!(t!=null&&t.permission)||Array.isArray(t==null?void 0:t.permission)&&!((e=t==null?void 0:t.permission)!=null&&e.includes(d))||typeof(t==null?void 0:t.permission)=="object"&&(t==null?void 0:t.permission[d])===!1)}}}exports.simpleAuthProvider=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("axios"),g=require("lodash-es");function l(i){const t=e=>e?`${i.apiUrl}/${g.trimStart(e||"","/")}`:i.apiUrl;return{apiUrl:t,getList:(e,n,r)=>{const a={};return e.pagination&&typeof e.pagination=="object"&&(a.page=e.pagination.page,a.limit=e.pagination.limit,a.pageSize=e.pagination.pageSize),d.get(t(e.path)||"",{params:{...a,...e.filters,...e.sorters},headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(m=>m.data)},create:(e,n,r)=>d.post(t(e.path)||"",e.data,{headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),update:(e,n,r)=>d.put(t(e.id?`${e.path}/${e.id}`:e.path)||"",e.data,{headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),deleteOne:(e,n,r)=>d.delete(t(e.id?`${e.path}/${e.id}`:e.path)||"",{headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),getOne:(e,n,r)=>d.get(t(e.id?`${e.path}/${e.id}`:e.path)||"",{headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),getMany:(e,n,r)=>d.get(t(e.path)||"",{params:{ids:e.ids},headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),createMany:(e,n,r)=>d.post(t(e.path)||"",e.data,{headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),updateMany:(e,n,r)=>d.put(t(e.path)||"",{ids:e.ids,data:e.data},{headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),deleteMany:(e,n,r)=>d.delete(t(e.path)||"",{params:{ids:e.ids},headers:{Authorization:r==null?void 0:r.token},...e.meta}).then(a=>a.data),custom:(e,n,r)=>{let a={...e.query};return e.sorters&&typeof e.sorters=="object"&&(a={...a,...e.sorters}),e.filters&&typeof e.filters=="object"&&(a={...a,...e.filters}),d.request({url:t(e.path||""),method:e.method||"GET",data:e.payload,params:a,headers:{Authorization:r==null?void 0:r.token,...e.headers},...e.meta}).then(m=>m.data)}}}exports.simpleDataProvider=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("petite-vue-i18n");function i(e){const t=n.createI18n({legacy:!1,locale:e==null?void 0:e.locale,fallbackLocale:e==null?void 0:e.fallbackLocale,messages:e==null?void 0:e.messages});return{t:(l,c,a)=>t.global.t(l,c)||a||"",changeLocale:(l,c)=>new Promise(a=>{t.global.locale.value=l,a(l)}),loadLocale:(l,c)=>new Promise(a=>{t.global.setLocaleMessage(l,c),a(l)}),getLocale:()=>t.global.locale.value}}exports.i18nProvider=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("vue"),L=require("@overlastic/vue"),T=require("vue-router"),U=require("../hooks/auth.cjs"),V=require("../hooks/config.cjs");require("@tanstack/vue-query");const B=require("../hooks/manage.cjs");require("lodash-es");require("pinia");const G=require("../stores/auth.cjs"),H=require("../stores/route.cjs"),J=require("../stores/manage.cjs"),K=require("../stores/i18n.cjs");require("@vueuse/core");require("clsx");const Q=h=>Object.freeze(Object.defineProperty({__proto__:null,default:h},Symbol.toStringTag,{value:"Module"})),W=f.defineComponent({name:"DuxAppProvider",props:{},setup(h,{slots:p}){const l=f.inject("dux.manage"),s=V.useConfig(),d=T.useRouter();return d.beforeEach(async(o,X,a)=>{var b,$,S,R,A,M,y,_,z,k,w,D,I;const t=o.meta.manageName,E=o.meta.authorization===!1;if(!t){const e=s.defaultManage||(($=(b=s.manages)==null?void 0:b[0])==null?void 0:$.name)||"";return a({path:`/${e}`,replace:!0})}l&&(l.value=t);const m=J.useManageStore(t);m.isInit()||m.setConfig((S=s.manages)==null?void 0:S.find(e=>e.name===t),s);const c=H.useRouteStore(t),n=B.useManage(t),g=G.useAuthStore(t),v=K.useI18nStore(t);if((R=n.config)!=null&&R.i18nProvider&&!v.isInit()){const e=v.getLocale();e&&((A=n.config)==null||A.i18nProvider.changeLocale(e))}if(!g.isLogin())return E?a():a({path:n.getRoutePath("login"),replace:!0});const q=e=>e==null?void 0:e.map(u=>({...u,path:n.getRoutePath(u.path||"")}));if(!c.getRouteInit()){const e=((M=n.config)==null?void 0:M.components)||{},u=[];if(e.notFound&&u.push({name:`${t}.notFound`,label:"404",path:":pathMatch(.*)*",component:e.notFound,hidden:!0,meta:{can:!1}}),e.notAuthorized&&u.push({name:`${t}.notAuthorized`,label:"403",path:"notAuthorized",component:e.notAuthorized,hidden:!0,meta:{can:!1}}),e.error&&u.push({name:`${t}.error`,label:"500",path:"error",component:e.error,hidden:!0,meta:{can:!1}}),c.setRoutes(q(((y=n.config)==null?void 0:y.menus)||[])),(_=n.config)!=null&&_.apiRoutePath)try{await((w=(k=(z=n.config)==null?void 0:z.dataProvider)==null?void 0:k.default)==null?void 0:w.custom({path:n.config.apiRoutePath,meta:{timeout:5e3}},n,g.getUser()).then(r=>{c.appendRoutes(q(r.data||[]))}))}catch(r){console.error(r)}return c.appendRoutes(u),c.getRoutes().forEach(r=>{var O,j;if(!r.path)return;const i={name:r.name,path:r.path,meta:r.meta};switch(r.loader){case"iframe":i.component=((j=(O=n.config)==null?void 0:O.components)==null?void 0:j.iframe)||(()=>Promise.resolve().then(()=>Q(require("../components/loader/iframe.cjs"))));break;case"link":i.beforeEnter=()=>{var N;const C=((N=r.meta)==null?void 0:N.url)||r.path;return C&&window.open(C,"_blank"),!1},i.component=()=>Promise.resolve({template:"<div></div>"});break;default:r.component&&(i.component=r.component);break}d.addRoute(`${t}.auth`,i)}),a({path:o.fullPath,replace:!0})}const P=["","/",`/${t}`,`/${t}/`];if(P.includes(o.path)){const e=c.getIndexRoute();return!(e!=null&&e.path)||P.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})}const F=U.useCan(t);return(((D=o.meta)==null?void 0:D.can)===void 0||((I=o.meta)==null?void 0:I.can)===!0)&&!F(o.name)?a({name:`${t}.notAuthorized`}):a()}),()=>f.createVNode(L.OverlaysProvider,null,{default:()=>{var o;return[(o=p.default)==null?void 0:o.call(p)]}})}});exports.DuxAppProvider=W;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("pinia"),o=require("vue");function u(t){const e=o.inject("dux.manage");if(t||(t=(e==null?void 0:e.value)||""),!t)throw new Error("manage not found");return c(t)()}function c(t){return i.defineStore(`i18n-${t}`,()=>{const e=o.ref(""),n=o.ref(!1);return{lang:e,isInit:()=>{const r=n.value;return n.value=!0,r},setLocale:r=>{e.value=r},getLocale:()=>e.value}},{persist:{pick:["lang"]}})}exports.useI18nStore=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("lodash-es"),p=require("pinia"),o=require("vue");function v(r){return r!=null&&typeof r=="object"&&!Array.isArray(r)&&typeof r.getList!="function"}function h(r){const i=o.inject("dux.manage");if(r||(r=(i==null?void 0:i.value)||""),!r)throw new Error("manage not found");return y(r)()}function y(r){return p.defineStore(`manages-${r}`,()=>{const i=o.ref(),c=o.ref(!1);return{config:i,isInit:()=>{const u=c.value;return c.value=!0,u},setConfig:(u,e)=>{const t=P.cloneDeep(u),n=[];t.title&&n.push(t.title),e.title&&n.push(e.title),t.title=n.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};const d={};e!=null&&e.dataProvider&&(v(e.dataProvider)?Object.keys(e.dataProvider).forEach(s=>{d[s]=e.dataProvider[s]}):d.default=e.dataProvider),t!=null&&t.dataProvider&&(v(t.dataProvider)?Object.keys(t.dataProvider).forEach(s=>{d[s]=t.dataProvider[s]}):d.default=t.dataProvider),t.authProvider=(e==null?void 0:e.authProvider)||(t==null?void 0:t.authProvider),t.dataProvider=d,t.i18nProvider=(e==null?void 0:e.i18nProvider)||(t==null?void 0:t.i18nProvider),t.layoutComponent={...e.layoutComponent,...t.layoutComponent},i.value=t},getConfig:()=>i.value}})}exports.useManageStore=h;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineComponent as a } from "vue";
|
|
2
|
+
import { useCan as i } from "../../hooks/auth.js";
|
|
3
|
+
import "@tanstack/vue-query";
|
|
4
|
+
import "lodash-es";
|
|
5
|
+
import "pinia";
|
|
6
|
+
import "vue-router";
|
|
7
|
+
import "@vueuse/core";
|
|
8
|
+
import "@overlastic/vue";
|
|
9
|
+
import "clsx";
|
|
10
|
+
const y = /* @__PURE__ */ a({
|
|
11
|
+
name: "DuxCan",
|
|
12
|
+
props: {
|
|
13
|
+
name: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: !0
|
|
16
|
+
},
|
|
17
|
+
params: {
|
|
18
|
+
type: Object
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
setup(e, {
|
|
22
|
+
slots: r
|
|
23
|
+
}) {
|
|
24
|
+
const n = i();
|
|
25
|
+
return () => {
|
|
26
|
+
var m, p;
|
|
27
|
+
return n(e.name, e.params) ? (m = r.default) == null ? void 0 : m.call(r) : ((p = r.fallback) == null ? void 0 : p.call(r)) || null;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
export {
|
|
32
|
+
y as DuxCan
|
|
33
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useCan as m } from "../hooks/auth.js";
|
|
2
|
+
import "vue";
|
|
3
|
+
import "@tanstack/vue-query";
|
|
4
|
+
import "lodash-es";
|
|
5
|
+
import "pinia";
|
|
6
|
+
import "vue-router";
|
|
7
|
+
import "@vueuse/core";
|
|
8
|
+
import "@overlastic/vue";
|
|
9
|
+
import "clsx";
|
|
10
|
+
const l = {
|
|
11
|
+
mounted(t, i) {
|
|
12
|
+
var r;
|
|
13
|
+
const { value: o } = i;
|
|
14
|
+
if (!o)
|
|
15
|
+
return;
|
|
16
|
+
m()(o) || (r = t.parentElement) == null || r.removeChild(t);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
l as permissionDirective
|
|
21
|
+
};
|
package/dist/esm/hooks/auth.js
CHANGED
|
@@ -1,123 +1,131 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { useRouter as
|
|
3
|
-
import { useAuthStore as
|
|
4
|
-
import { useManage as
|
|
5
|
-
function
|
|
6
|
-
const u =
|
|
1
|
+
import { ref as h } from "vue";
|
|
2
|
+
import { useRouter as f } from "vue-router";
|
|
3
|
+
import { useAuthStore as c } from "../stores/auth.js";
|
|
4
|
+
import { useManage as g } from "./manage.js";
|
|
5
|
+
function v({ onSuccess: e, onError: a }) {
|
|
6
|
+
const u = g(), o = c(), s = f(), r = h(!1);
|
|
7
7
|
return {
|
|
8
8
|
mutate: async (t) => {
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
if (!(
|
|
9
|
+
var d;
|
|
10
|
+
r.value = !0;
|
|
11
|
+
const n = await ((d = u.config.authProvider) == null ? void 0 : d.login(t, u));
|
|
12
|
+
if (r.value = !1, n != null && n.success) {
|
|
13
|
+
if (!(n != null && n.data))
|
|
14
14
|
throw new Error("Login response data is undefined");
|
|
15
|
-
e == null || e(
|
|
15
|
+
e == null || e(n), o.login(n.data), s.push(u.getRoutePath(n.redirectTo || "/"));
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
a == null || a(n);
|
|
19
19
|
},
|
|
20
|
-
isLoading:
|
|
20
|
+
isLoading: r
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
function
|
|
24
|
-
const u =
|
|
23
|
+
function R({ onSuccess: e, onError: a }) {
|
|
24
|
+
const u = g(), o = c(), s = f();
|
|
25
25
|
return {
|
|
26
|
-
mutate: async (
|
|
27
|
-
var
|
|
28
|
-
const t = await ((
|
|
26
|
+
mutate: async (i) => {
|
|
27
|
+
var n;
|
|
28
|
+
const t = await ((n = u.config.authProvider) == null ? void 0 : n.logout(i, u));
|
|
29
29
|
if (t != null && t.success) {
|
|
30
|
-
e == null || e(t),
|
|
30
|
+
e == null || e(t), o.logout(), s.push(u.getRoutePath(t.redirectTo || "/login"));
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
a == null || a(t);
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
function T({ onSuccess: e, onError:
|
|
38
|
-
const u =
|
|
37
|
+
function T({ onSuccess: e, onError: a }) {
|
|
38
|
+
const u = g(), o = c(), s = f();
|
|
39
39
|
return {
|
|
40
|
-
mutate: async (
|
|
41
|
-
var
|
|
42
|
-
const t = await ((
|
|
40
|
+
mutate: async (i) => {
|
|
41
|
+
var n;
|
|
42
|
+
const t = await ((n = u.config.authProvider) == null ? void 0 : n.check(i, u));
|
|
43
43
|
if (t != null && t.success) {
|
|
44
44
|
if (e == null || e(t), !(t != null && t.data))
|
|
45
45
|
throw new Error("Check response data is undefined");
|
|
46
|
-
|
|
46
|
+
o.update(t.data);
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
a == null || a(t), t != null && t.logout && s.push(u.getRoutePath(t.redirectTo || "/login"));
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
function y({ onSuccess: e, onError:
|
|
54
|
-
const u =
|
|
53
|
+
function y({ onSuccess: e, onError: a }) {
|
|
54
|
+
const u = g(), o = c(), s = f();
|
|
55
55
|
return {
|
|
56
|
-
mutate: async (
|
|
57
|
-
var
|
|
58
|
-
const t = await ((
|
|
56
|
+
mutate: async (i) => {
|
|
57
|
+
var n;
|
|
58
|
+
const t = await ((n = u.config.authProvider) == null ? void 0 : n.register(i, u));
|
|
59
59
|
if (t != null && t.success) {
|
|
60
60
|
if (e == null || e(t), !(t != null && t.data))
|
|
61
61
|
throw new Error("Register response data is undefined");
|
|
62
|
-
|
|
62
|
+
o.login(t.data), s.push(u.getRoutePath(t.redirectTo || ""));
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
a == null || a(t);
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
function L({ onSuccess: e, onError:
|
|
70
|
-
const u =
|
|
69
|
+
function L({ onSuccess: e, onError: a }) {
|
|
70
|
+
const u = g(), o = f();
|
|
71
71
|
return {
|
|
72
|
-
mutate: async (
|
|
72
|
+
mutate: async (r) => {
|
|
73
73
|
var t;
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
e == null || e(
|
|
74
|
+
const i = await ((t = u.config.authProvider) == null ? void 0 : t.forgotPassword(r, u));
|
|
75
|
+
if (i != null && i.success) {
|
|
76
|
+
e == null || e(i), i.redirectTo && o.push(u.getRoutePath(i.redirectTo));
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
a == null || a(i);
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
const u =
|
|
83
|
+
function U({ onSuccess: e, onError: a }) {
|
|
84
|
+
const u = g(), o = f();
|
|
85
85
|
return {
|
|
86
|
-
mutate: async (
|
|
86
|
+
mutate: async (r) => {
|
|
87
87
|
var t;
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
e == null || e(
|
|
88
|
+
const i = await ((t = u.config.authProvider) == null ? void 0 : t.updatePassword(r, u));
|
|
89
|
+
if (i != null && i.success) {
|
|
90
|
+
e == null || e(i), i.redirectTo && o.push(u.getRoutePath(i.redirectTo));
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
a == null || a(i);
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
const { config:
|
|
97
|
+
function A(e) {
|
|
98
|
+
const { config: a, getRoutePath: u } = g(), o = f();
|
|
99
99
|
return {
|
|
100
|
-
mutate: async (
|
|
100
|
+
mutate: async (r) => {
|
|
101
101
|
var t;
|
|
102
|
-
const
|
|
103
|
-
e == null || e(
|
|
102
|
+
const i = await ((t = a.authProvider) == null ? void 0 : t.onError(r));
|
|
103
|
+
e == null || e(i), i != null && i.logout && o.push(u(i.redirectTo || "/login"));
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
function x(e) {
|
|
108
|
-
return
|
|
108
|
+
return c(e).getUser();
|
|
109
109
|
}
|
|
110
110
|
function F(e) {
|
|
111
|
-
return
|
|
111
|
+
return c(e).isLogin();
|
|
112
|
+
}
|
|
113
|
+
function G(e) {
|
|
114
|
+
const a = g(e), o = c(e).getUser();
|
|
115
|
+
return (r, i) => {
|
|
116
|
+
var t;
|
|
117
|
+
return (t = a.config.authProvider) != null && t.can ? a.config.authProvider.can(r, i, a, o) || !1 : !0;
|
|
118
|
+
};
|
|
112
119
|
}
|
|
113
120
|
export {
|
|
121
|
+
G as useCan,
|
|
114
122
|
T as useCheck,
|
|
115
|
-
|
|
123
|
+
A as useError,
|
|
116
124
|
L as useForgotPassword,
|
|
117
125
|
x as useGetAuth,
|
|
118
126
|
F as useIsLogin,
|
|
119
|
-
|
|
120
|
-
|
|
127
|
+
v as useLogin,
|
|
128
|
+
R as useLogout,
|
|
121
129
|
y as useRegister,
|
|
122
|
-
|
|
130
|
+
U as useUpdatePassword
|
|
123
131
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "pinia";
|
|
2
|
+
import "vue";
|
|
3
|
+
import "lodash-es";
|
|
4
|
+
import { useI18nStore as a } from "../stores/i18n.js";
|
|
5
|
+
import { useManage as g } from "./manage.js";
|
|
6
|
+
function h() {
|
|
7
|
+
const i = a(), n = g();
|
|
8
|
+
return {
|
|
9
|
+
t: (e, o, t) => {
|
|
10
|
+
var r, c;
|
|
11
|
+
return (c = (r = n.config) == null ? void 0 : r.i18nProvider) == null ? void 0 : c.t(e, o, t);
|
|
12
|
+
},
|
|
13
|
+
changeLocale: (e) => {
|
|
14
|
+
var o, t;
|
|
15
|
+
return i.setLocale(e), (t = (o = n.config) == null ? void 0 : o.i18nProvider) == null ? void 0 : t.changeLocale(e);
|
|
16
|
+
},
|
|
17
|
+
getLocale: () => {
|
|
18
|
+
var e, o;
|
|
19
|
+
return (o = (e = n.config) == null ? void 0 : e.i18nProvider) == null ? void 0 : o.getLocale();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
h as useI18n
|
|
25
|
+
};
|
|
@@ -3,12 +3,16 @@ import "vue";
|
|
|
3
3
|
import "clsx";
|
|
4
4
|
import "vue-router";
|
|
5
5
|
import { DuxOverlay as e } from "../components/overlay/overlay.js";
|
|
6
|
-
|
|
6
|
+
import "pinia";
|
|
7
|
+
import "lodash-es";
|
|
8
|
+
import "@tanstack/vue-query";
|
|
9
|
+
import "@vueuse/core";
|
|
10
|
+
function v() {
|
|
7
11
|
const r = t(e);
|
|
8
12
|
return {
|
|
9
13
|
show: (o) => r(o)
|
|
10
14
|
};
|
|
11
15
|
}
|
|
12
16
|
export {
|
|
13
|
-
|
|
17
|
+
v as useOverlay
|
|
14
18
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,67 +1,76 @@
|
|
|
1
1
|
import { createDux as o } from "./main.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useCan as u, useCheck as s, useError as a, useForgotPassword as p, useGetAuth as x, useIsLogin as m, useLogin as f, useLogout as n, useRegister as i, useUpdatePassword as d } from "./hooks/auth.js";
|
|
3
3
|
import { useConfig as g } from "./hooks/config.js";
|
|
4
|
-
import { useClient as
|
|
5
|
-
import { useManage as
|
|
6
|
-
import { useMenu as
|
|
7
|
-
import { useTheme as
|
|
8
|
-
import { useOverlay as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
4
|
+
import { useClient as C, useCreate as M, useCreateMany as v, useCustom as y, useCustomMutation as L, useDelete as T, useDeleteMany as h, useInfiniteList as I, useInvalidate as P, useList as A, useMany as S, useOne as R, useUpdate as c, useUpdateMany as w } from "./hooks/data.js";
|
|
5
|
+
import { useManage as U } from "./hooks/manage.js";
|
|
6
|
+
import { useMenu as k } from "./hooks/menu.js";
|
|
7
|
+
import { useTheme as F } from "./hooks/theme.js";
|
|
8
|
+
import { useOverlay as V } from "./hooks/overlay.js";
|
|
9
|
+
import { useI18n as q } from "./hooks/i18n.js";
|
|
10
|
+
import { initRouter as B } from "./router/route.js";
|
|
11
|
+
import { useAuthStore as J } from "./stores/auth.js";
|
|
12
|
+
import { useRouteStore as N } from "./stores/route.js";
|
|
13
|
+
import { useTabStore as W } from "./stores/tab.js";
|
|
14
|
+
import { useManageStore as Y } from "./stores/manage.js";
|
|
15
|
+
import { useI18nStore as _ } from "./stores/i18n.js";
|
|
16
|
+
import { DuxLogo as ee } from "./components/common/logo.js";
|
|
17
|
+
import { default as oe } from "./components/loader/iframe.js";
|
|
18
|
+
import { DuxOverlay as ue } from "./components/overlay/overlay.js";
|
|
19
|
+
import { DuxCan as ae } from "./components/auth/can.js";
|
|
20
|
+
import { arrayToTree as xe, searchTree as me, treeToArr as fe } from "./utils/tree.js";
|
|
21
|
+
import { DuxAppProvider as ie } from "./provider/app.js";
|
|
22
|
+
import { DuxTabRouterView as De } from "./provider/tab.js";
|
|
23
|
+
import { simpleAuthProvider as le } from "./preset/authProvider.js";
|
|
24
|
+
import { simpleDataProvider as Me } from "./preset/dataProvider.js";
|
|
25
|
+
import { i18nProvider as ye } from "./preset/i18nProvider.js";
|
|
22
26
|
export {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
ie as DuxAppProvider,
|
|
28
|
+
ae as DuxCan,
|
|
29
|
+
oe as DuxLoaderIframe,
|
|
30
|
+
ee as DuxLogo,
|
|
31
|
+
ue as DuxOverlay,
|
|
32
|
+
De as DuxTabRouterView,
|
|
33
|
+
xe as arrayToTree,
|
|
29
34
|
o as createDux,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
ye as i18nProvider,
|
|
36
|
+
B as initRouter,
|
|
37
|
+
me as searchTree,
|
|
38
|
+
le as simpleAuthProvider,
|
|
39
|
+
Me as simpleDataProvider,
|
|
40
|
+
fe as treeToArr,
|
|
41
|
+
J as useAuthStore,
|
|
42
|
+
u as useCan,
|
|
43
|
+
s as useCheck,
|
|
44
|
+
C as useClient,
|
|
38
45
|
g as useConfig,
|
|
39
46
|
M as useCreate,
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
v as useCreateMany,
|
|
48
|
+
y as useCustom,
|
|
42
49
|
L as useCustomMutation,
|
|
43
50
|
T as useDelete,
|
|
44
51
|
h as useDeleteMany,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
a as useError,
|
|
53
|
+
p as useForgotPassword,
|
|
54
|
+
x as useGetAuth,
|
|
55
|
+
q as useI18n,
|
|
56
|
+
_ as useI18nStore,
|
|
57
|
+
I as useInfiniteList,
|
|
58
|
+
P as useInvalidate,
|
|
50
59
|
m as useIsLogin,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
A as useList,
|
|
61
|
+
f as useLogin,
|
|
62
|
+
n as useLogout,
|
|
63
|
+
U as useManage,
|
|
64
|
+
Y as useManageStore,
|
|
65
|
+
S as useMany,
|
|
66
|
+
k as useMenu,
|
|
58
67
|
R as useOne,
|
|
59
|
-
|
|
68
|
+
V as useOverlay,
|
|
60
69
|
i as useRegister,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
N as useRouteStore,
|
|
71
|
+
W as useTabStore,
|
|
72
|
+
F as useTheme,
|
|
73
|
+
c as useUpdate,
|
|
74
|
+
w as useUpdateMany,
|
|
75
|
+
d as useUpdatePassword
|
|
67
76
|
};
|
package/dist/esm/main.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createPinia as n } from "pinia";
|
|
2
2
|
import t from "pinia-plugin-persistedstate";
|
|
3
3
|
import { ref as d } from "vue";
|
|
4
|
+
import { permissionDirective as c } from "./directive/permission.js";
|
|
4
5
|
import { initRouter as u } from "./router/route.js";
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
return
|
|
6
|
+
function x(e) {
|
|
7
|
+
const o = n();
|
|
8
|
+
return o.use(t), {
|
|
8
9
|
install(r) {
|
|
9
10
|
console.log(
|
|
10
11
|
"%c dux-vue %c dux.cn %c",
|
|
@@ -13,10 +14,10 @@ function p(o) {
|
|
|
13
14
|
"background:transparent"
|
|
14
15
|
);
|
|
15
16
|
const i = d();
|
|
16
|
-
r.provide("dux.config",
|
|
17
|
+
r.provide("dux.config", e), r.provide("dux.manage", i), r.directive("can", c), r.use(u(e)), r.use(o);
|
|
17
18
|
}
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
+
x as createDux
|
|
22
23
|
};
|