@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.
Files changed (51) hide show
  1. package/dist/cjs/components/auth/can.cjs +1 -0
  2. package/dist/cjs/directive/permission.cjs +1 -0
  3. package/dist/cjs/hooks/auth.cjs +1 -1
  4. package/dist/cjs/hooks/i18n.cjs +1 -0
  5. package/dist/cjs/hooks/overlay.cjs +1 -1
  6. package/dist/cjs/index.cjs +1 -1
  7. package/dist/cjs/main.cjs +1 -1
  8. package/dist/cjs/preset/authProvider.cjs +1 -0
  9. package/dist/cjs/{simple → preset}/dataProvider.cjs +1 -1
  10. package/dist/cjs/preset/i18nProvider.cjs +1 -0
  11. package/dist/cjs/provider/app.cjs +1 -1
  12. package/dist/cjs/stores/i18n.cjs +1 -0
  13. package/dist/cjs/stores/manage.cjs +1 -1
  14. package/dist/esm/components/auth/can.js +33 -0
  15. package/dist/esm/directive/permission.js +21 -0
  16. package/dist/esm/hooks/auth.js +68 -60
  17. package/dist/esm/hooks/i18n.js +25 -0
  18. package/dist/esm/hooks/overlay.js +6 -2
  19. package/dist/esm/index.js +63 -54
  20. package/dist/esm/main.js +6 -5
  21. package/dist/esm/preset/authProvider.js +117 -0
  22. package/dist/esm/preset/i18nProvider.js +22 -0
  23. package/dist/esm/provider/app.js +66 -50
  24. package/dist/esm/stores/i18n.js +31 -0
  25. package/dist/esm/stores/manage.js +18 -18
  26. package/dist/types/components/auth/can.d.ts +20 -0
  27. package/dist/types/components/auth/index.d.ts +1 -0
  28. package/dist/types/components/index.d.ts +1 -0
  29. package/dist/types/directive/index.d.ts +1 -0
  30. package/dist/types/directive/permission.d.ts +2 -0
  31. package/dist/types/hooks/auth.d.ts +7 -0
  32. package/dist/types/hooks/i18n.d.ts +5 -0
  33. package/dist/types/hooks/index.d.ts +1 -0
  34. package/dist/types/index.d.ts +1 -1
  35. package/dist/types/preset/i18nProvider.d.ts +3 -0
  36. package/dist/types/{simple → preset}/index.d.ts +1 -0
  37. package/dist/types/stores/i18n.d.ts +22 -0
  38. package/dist/types/stores/index.d.ts +1 -0
  39. package/dist/types/stores/route.d.ts +525 -0
  40. package/dist/types/stores/tab.d.ts +210 -0
  41. package/dist/types/types/auth.d.ts +1 -0
  42. package/dist/types/types/config.d.ts +2 -0
  43. package/dist/types/types/i18n.d.ts +10 -0
  44. package/dist/types/types/index.d.ts +1 -0
  45. package/dist/types/types/manage.d.ts +2 -0
  46. package/package.json +2 -1
  47. package/dist/cjs/simple/authProvider.cjs +0 -1
  48. package/dist/esm/simple/authProvider.js +0 -113
  49. package/dist/esm/{simple → preset}/dataProvider.js +1 -1
  50. /package/dist/types/{simple → preset}/authProvider.d.ts +0 -0
  51. /package/dist/types/{simple → preset}/dataProvider.d.ts +0 -0
@@ -0,0 +1,117 @@
1
+ import u from "axios";
2
+ function l(a) {
3
+ return {
4
+ login: async (d, c) => {
5
+ var n;
6
+ return await u.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) => {
7
+ var e, i, g;
8
+ return {
9
+ success: !0,
10
+ message: (e = t == null ? void 0 : t.data) == null ? void 0 : e.message,
11
+ redirectTo: ((i = a == null ? void 0 : a.routePath) == null ? void 0 : i.index) || "/",
12
+ data: (g = t == null ? void 0 : t.data) == null ? void 0 : g.data
13
+ };
14
+ }).catch((t) => {
15
+ var e, i;
16
+ return {
17
+ success: !1,
18
+ 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)
19
+ };
20
+ });
21
+ },
22
+ check: async (d, c) => {
23
+ var n;
24
+ return await u.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) => {
25
+ var e, i;
26
+ return {
27
+ success: !0,
28
+ message: (e = t == null ? void 0 : t.data) == null ? void 0 : e.message,
29
+ data: (i = t == null ? void 0 : t.data) == null ? void 0 : i.data
30
+ };
31
+ }).catch((t) => {
32
+ var e, i;
33
+ return {
34
+ success: !1,
35
+ 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)
36
+ };
37
+ });
38
+ },
39
+ onError: async (d) => {
40
+ var c;
41
+ return d.status === 403 ? {
42
+ logout: !0,
43
+ redirectTo: ((c = a == null ? void 0 : a.routePath) == null ? void 0 : c.login) || "/login",
44
+ error: d
45
+ } : {
46
+ logout: !1,
47
+ error: d
48
+ };
49
+ },
50
+ logout: async () => {
51
+ var d;
52
+ return {
53
+ success: !0,
54
+ redirectTo: ((d = a == null ? void 0 : a.routePath) == null ? void 0 : d.login) || "/login"
55
+ };
56
+ },
57
+ register: async (d, c) => {
58
+ var n;
59
+ return await u.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) => {
60
+ var e, i, g;
61
+ return {
62
+ success: !0,
63
+ message: (e = t == null ? void 0 : t.data) == null ? void 0 : e.message,
64
+ redirectTo: ((i = a == null ? void 0 : a.routePath) == null ? void 0 : i.index) || "/",
65
+ data: (g = t == null ? void 0 : t.data) == null ? void 0 : g.data
66
+ };
67
+ }).catch((t) => {
68
+ var e, i;
69
+ return {
70
+ success: !1,
71
+ 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)
72
+ };
73
+ });
74
+ },
75
+ forgotPassword: async (d, c) => {
76
+ var n;
77
+ return await u.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) => {
78
+ var e, i;
79
+ return {
80
+ success: !0,
81
+ message: (e = t == null ? void 0 : t.data) == null ? void 0 : e.message,
82
+ redirectTo: ((i = a == null ? void 0 : a.routePath) == null ? void 0 : i.login) || "/login"
83
+ };
84
+ }).catch((t) => {
85
+ var e, i;
86
+ return {
87
+ success: !1,
88
+ 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)
89
+ };
90
+ });
91
+ },
92
+ updatePassword: async (d, c) => {
93
+ var n;
94
+ return await u.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) => {
95
+ var e, i;
96
+ return {
97
+ success: !0,
98
+ message: (e = t == null ? void 0 : t.data) == null ? void 0 : e.message,
99
+ redirectTo: ((i = a == null ? void 0 : a.routePath) == null ? void 0 : i.login) || "/login"
100
+ };
101
+ }).catch((t) => {
102
+ var e, i;
103
+ return {
104
+ success: !1,
105
+ 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)
106
+ };
107
+ });
108
+ },
109
+ can: (d, c, n, t) => {
110
+ var e;
111
+ 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);
112
+ }
113
+ };
114
+ }
115
+ export {
116
+ l as simpleAuthProvider
117
+ };
@@ -0,0 +1,22 @@
1
+ import { createI18n as n } from "petite-vue-i18n";
2
+ function g(e) {
3
+ const c = n({
4
+ legacy: !1,
5
+ locale: e == null ? void 0 : e.locale,
6
+ fallbackLocale: e == null ? void 0 : e.fallbackLocale,
7
+ messages: e == null ? void 0 : e.messages
8
+ });
9
+ return {
10
+ t: (l, t, a) => c.global.t(l, t) || a || "",
11
+ changeLocale: (l, t) => new Promise((a) => {
12
+ c.global.locale.value = l, a(l);
13
+ }),
14
+ loadLocale: (l, t) => new Promise((a) => {
15
+ c.global.setLocaleMessage(l, t), a(l);
16
+ }),
17
+ getLocale: () => c.global.locale.value
18
+ };
19
+ }
20
+ export {
21
+ g as i18nProvider
22
+ };
@@ -1,123 +1,139 @@
1
- import { defineComponent as E, inject as F, createVNode as I } from "vue";
2
- import { OverlaysProvider as N } from "@overlastic/vue";
3
- import { useRouter as _ } from "vue-router";
4
- import { useAuthStore as j } from "../stores/auth.js";
5
- import { useManage as L } from "../hooks/manage.js";
6
- import { useConfig as O } from "../hooks/config.js";
1
+ import { defineComponent as j, inject as O, createVNode as U } from "vue";
2
+ import { OverlaysProvider as V } from "@overlastic/vue";
3
+ import { useRouter as q } from "vue-router";
4
+ import { useCan as B } from "../hooks/auth.js";
5
+ import { useConfig as G } from "../hooks/config.js";
7
6
  import "@tanstack/vue-query";
7
+ import { useManage as H } from "../hooks/manage.js";
8
8
  import "lodash-es";
9
9
  import "pinia";
10
- import { useRouteStore as U } from "../stores/route.js";
11
- import { useManageStore as V } from "../stores/manage.js";
10
+ import { useAuthStore as J } from "../stores/auth.js";
11
+ import { useRouteStore as K } from "../stores/route.js";
12
+ import { useManageStore as Q } from "../stores/manage.js";
13
+ import { useI18nStore as T } from "../stores/i18n.js";
12
14
  import "@vueuse/core";
13
15
  import "clsx";
14
- const oe = /* @__PURE__ */ E({
16
+ const se = /* @__PURE__ */ j({
15
17
  name: "DuxAppProvider",
16
18
  props: {},
17
- setup(q, {
19
+ setup(W, {
18
20
  slots: m
19
21
  }) {
20
- const f = F("dux.manage"), c = O(), s = _();
21
- return s.beforeEach(async (a, B, n) => {
22
- var P, R, b, v, A, M, $, k, S;
23
- const t = a.meta.manageName, D = a.meta.authorization === !1;
22
+ const f = O("dux.manage"), c = G(), s = q();
23
+ return s.beforeEach(async (a, X, n) => {
24
+ var v, R, b, A, S, $, M, k, z, w, I, C, y;
25
+ const t = a.meta.manageName, N = a.meta.authorization === !1;
24
26
  if (!t) {
25
- const e = c.defaultManage || ((R = (P = c.manages) == null ? void 0 : P[0]) == null ? void 0 : R.name) || "";
27
+ const e = c.defaultManage || ((R = (v = c.manages) == null ? void 0 : v[0]) == null ? void 0 : R.name) || "";
26
28
  return n({
27
29
  path: `/${e}`,
28
30
  replace: !0
29
31
  });
30
32
  }
31
33
  f && (f.value = t);
32
- const h = V(t);
34
+ const h = Q(t);
33
35
  h.isInit() || h.setConfig((b = c.manages) == null ? void 0 : b.find((e) => e.name === t), c);
34
- const u = U(t), r = L(t), d = j(t);
36
+ const u = K(t), r = H(t), d = J(t), l = T(t);
37
+ if ((A = r.config) != null && A.i18nProvider && !l.isInit()) {
38
+ const e = l.getLocale();
39
+ e && ((S = r.config) == null || S.i18nProvider.changeLocale(e));
40
+ }
35
41
  if (!d.isLogin())
36
- return D ? n() : n({
42
+ return N ? n() : n({
37
43
  path: r.getRoutePath("login"),
38
44
  replace: !0
39
45
  });
40
- const l = (e) => e == null ? void 0 : e.map((p) => ({
41
- ...p,
42
- path: r.getRoutePath(p.path || "")
46
+ const g = (e) => e == null ? void 0 : e.map((i) => ({
47
+ ...i,
48
+ path: r.getRoutePath(i.path || "")
43
49
  }));
44
50
  if (!u.getRouteInit()) {
45
- const e = ((v = r.config) == null ? void 0 : v.components) || {}, p = [];
46
- if (e.notFound && p.push({
51
+ const e = (($ = r.config) == null ? void 0 : $.components) || {}, i = [];
52
+ if (e.notFound && i.push({
47
53
  name: `${t}.notFound`,
48
54
  label: "404",
49
55
  path: ":pathMatch(.*)*",
50
56
  component: e.notFound,
51
- hidden: !0
52
- }), e.notAuthorized && p.push({
57
+ hidden: !0,
58
+ meta: {
59
+ can: !1
60
+ }
61
+ }), e.notAuthorized && i.push({
53
62
  name: `${t}.notAuthorized`,
54
63
  label: "403",
55
64
  path: "notAuthorized",
56
65
  component: e.notAuthorized,
57
- hidden: !0
58
- }), e.error && p.push({
66
+ hidden: !0,
67
+ meta: {
68
+ can: !1
69
+ }
70
+ }), e.error && i.push({
59
71
  name: `${t}.error`,
60
72
  label: "500",
61
73
  path: "error",
62
74
  component: e.error,
63
- hidden: !0
64
- }), u.setRoutes(l(((A = r.config) == null ? void 0 : A.menus) || [])), (M = r.config) != null && M.apiRoutePath) {
65
- console.log("config", r.config.default);
75
+ hidden: !0,
76
+ meta: {
77
+ can: !1
78
+ }
79
+ }), u.setRoutes(g(((M = r.config) == null ? void 0 : M.menus) || [])), (k = r.config) != null && k.apiRoutePath)
66
80
  try {
67
- await ((S = (k = ($ = r.config) == null ? void 0 : $.dataProvider) == null ? void 0 : k.default) == null ? void 0 : S.custom({
81
+ await ((I = (w = (z = r.config) == null ? void 0 : z.dataProvider) == null ? void 0 : w.default) == null ? void 0 : I.custom({
68
82
  path: r.config.apiRoutePath,
69
83
  meta: {
70
84
  timeout: 5e3
71
85
  }
72
86
  }, r, d.getUser()).then((o) => {
73
- u.appendRoutes(l(o.data || []));
87
+ u.appendRoutes(g(o.data || []));
74
88
  }));
75
89
  } catch (o) {
76
90
  console.error(o);
77
91
  }
78
- }
79
- return u.appendRoutes(p), u.getRoutes().forEach((o) => {
80
- var w, z;
92
+ return u.appendRoutes(i), u.getRoutes().forEach((o) => {
93
+ var D, E;
81
94
  if (!o.path)
82
95
  return;
83
- const i = {
96
+ const p = {
84
97
  name: o.name,
85
98
  path: o.path,
86
99
  meta: o.meta
87
100
  };
88
101
  switch (o.loader) {
89
102
  case "iframe":
90
- i.component = ((z = (w = r.config) == null ? void 0 : w.components) == null ? void 0 : z.iframe) || (() => import("../components/loader/iframe.js"));
103
+ p.component = ((E = (D = r.config) == null ? void 0 : D.components) == null ? void 0 : E.iframe) || (() => import("../components/loader/iframe.js"));
91
104
  break;
92
105
  case "link":
93
- i.beforeEnter = () => {
94
- var C;
95
- const y = ((C = o.meta) == null ? void 0 : C.url) || o.path;
96
- return y && window.open(y, "_blank"), !1;
97
- }, i.component = () => Promise.resolve({
106
+ p.beforeEnter = () => {
107
+ var L;
108
+ const F = ((L = o.meta) == null ? void 0 : L.url) || o.path;
109
+ return F && window.open(F, "_blank"), !1;
110
+ }, p.component = () => Promise.resolve({
98
111
  template: "<div></div>"
99
112
  });
100
113
  break;
101
114
  default:
102
- o.component && (i.component = o.component);
115
+ o.component && (p.component = o.component);
103
116
  break;
104
117
  }
105
- s.addRoute(`${t}.auth`, i);
118
+ s.addRoute(`${t}.auth`, p);
106
119
  }), n({
107
120
  path: a.fullPath,
108
121
  replace: !0
109
122
  });
110
123
  }
111
- const g = ["", "/", `/${t}`, `/${t}/`];
112
- if (g.includes(a.path)) {
124
+ const P = ["", "/", `/${t}`, `/${t}/`];
125
+ if (P.includes(a.path)) {
113
126
  const e = u.getIndexRoute();
114
- return !(e != null && e.path) || g.includes(e == null ? void 0 : e.path) ? (console.warn("[Dux] index route not found, skip redirect"), n()) : n({
127
+ return !(e != null && e.path) || P.includes(e == null ? void 0 : e.path) ? (console.warn("[Dux] index route not found, skip redirect"), n()) : n({
115
128
  path: (e == null ? void 0 : e.path) || "/",
116
129
  replace: !0
117
130
  });
118
131
  }
119
- return n();
120
- }), () => I(N, null, {
132
+ const _ = B(t);
133
+ return (((C = a.meta) == null ? void 0 : C.can) === void 0 || ((y = a.meta) == null ? void 0 : y.can) === !0) && !_(a.name) ? n({
134
+ name: `${t}.notAuthorized`
135
+ }) : n();
136
+ }), () => U(V, null, {
121
137
  default: () => {
122
138
  var a;
123
139
  return [(a = m.default) == null ? void 0 : a.call(m)];
@@ -126,5 +142,5 @@ const oe = /* @__PURE__ */ E({
126
142
  }
127
143
  });
128
144
  export {
129
- oe as DuxAppProvider
145
+ se as DuxAppProvider
130
146
  };
@@ -0,0 +1,31 @@
1
+ import { defineStore as i } from "pinia";
2
+ import { inject as c, ref as r } from "vue";
3
+ function p(e) {
4
+ const t = c("dux.manage");
5
+ if (e || (e = (t == null ? void 0 : t.value) || ""), !e)
6
+ throw new Error("manage not found");
7
+ return u(e)();
8
+ }
9
+ function u(e) {
10
+ return i(`i18n-${e}`, () => {
11
+ const t = r(""), n = r(!1);
12
+ return {
13
+ lang: t,
14
+ isInit: () => {
15
+ const o = n.value;
16
+ return n.value = !0, o;
17
+ },
18
+ setLocale: (o) => {
19
+ t.value = o;
20
+ },
21
+ getLocale: () => t.value
22
+ };
23
+ }, {
24
+ persist: {
25
+ pick: ["lang"]
26
+ }
27
+ });
28
+ }
29
+ export {
30
+ p as useI18nStore
31
+ };
@@ -1,33 +1,33 @@
1
- import { cloneDeep as v } from "lodash-es";
2
- import { defineStore as P } from "pinia";
3
- import { inject as h, ref as u } from "vue";
4
- function p(e) {
1
+ import { cloneDeep as P } from "lodash-es";
2
+ import { defineStore as p } from "pinia";
3
+ import { inject as h, ref as n } from "vue";
4
+ function v(e) {
5
5
  return e != null && typeof e == "object" && !Array.isArray(e) && typeof e.getList != "function";
6
6
  }
7
- function I(e) {
7
+ function a(e) {
8
8
  const i = h("dux.manage");
9
9
  if (e || (e = (i == null ? void 0 : i.value) || ""), !e)
10
10
  throw new Error("manage not found");
11
- return a(e)();
11
+ return y(e)();
12
12
  }
13
- function a(e) {
14
- return P(`manages-${e}`, () => {
15
- const i = u(), o = u(!1);
13
+ function y(e) {
14
+ return p(`manages-${e}`, () => {
15
+ const i = n(), s = n(!1);
16
16
  return {
17
17
  config: i,
18
18
  isInit: () => {
19
- const s = o.value;
20
- return o.value = !0, s;
19
+ const u = s.value;
20
+ return s.value = !0, u;
21
21
  },
22
- setConfig: (s, r) => {
23
- const t = v(s), n = [];
24
- t.title && n.push(t.title), r.title && n.push(r.title), t.title = n.join(" - "), t.copyright = t.copyright || r.copyright, t.description = t.description || r.description, t.theme = { ...r == null ? void 0 : r.theme, ...t == null ? void 0 : t.theme };
22
+ setConfig: (u, r) => {
23
+ const t = P(u), o = [];
24
+ t.title && o.push(t.title), r.title && o.push(r.title), t.title = o.join(" - "), t.copyright = t.copyright || r.copyright, t.description = t.description || r.description, t.theme = { ...r == null ? void 0 : r.theme, ...t == null ? void 0 : t.theme };
25
25
  const d = {};
26
- r != null && r.dataProvider && (p(r.dataProvider) ? Object.keys(r.dataProvider).forEach((c) => {
26
+ r != null && r.dataProvider && (v(r.dataProvider) ? Object.keys(r.dataProvider).forEach((c) => {
27
27
  d[c] = r.dataProvider[c];
28
- }) : d.default = r.dataProvider), t != null && t.dataProvider && (p(t.dataProvider) ? Object.keys(t.dataProvider).forEach((c) => {
28
+ }) : d.default = r.dataProvider), t != null && t.dataProvider && (v(t.dataProvider) ? Object.keys(t.dataProvider).forEach((c) => {
29
29
  d[c] = t.dataProvider[c];
30
- }) : d.default = t.dataProvider), t.authProvider = (r == null ? void 0 : r.authProvider) || (t == null ? void 0 : t.authProvider), t.dataProvider = d, t.layoutComponent = {
30
+ }) : d.default = t.dataProvider), t.authProvider = (r == null ? void 0 : r.authProvider) || (t == null ? void 0 : t.authProvider), t.dataProvider = d, t.i18nProvider = (r == null ? void 0 : r.i18nProvider) || (t == null ? void 0 : t.i18nProvider), t.layoutComponent = {
31
31
  ...r.layoutComponent,
32
32
  ...t.layoutComponent
33
33
  }, i.value = t;
@@ -37,5 +37,5 @@ function a(e) {
37
37
  });
38
38
  }
39
39
  export {
40
- I as useManageStore
40
+ a as useManageStore
41
41
  };
@@ -0,0 +1,20 @@
1
+ import type { PropType } from 'vue';
2
+ export declare const DuxCan: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ name: {
4
+ type: StringConstructor;
5
+ required: true;
6
+ };
7
+ params: {
8
+ type: PropType<any>;
9
+ };
10
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
11
+ [key: string]: any;
12
+ }>[] | null | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
13
+ name: {
14
+ type: StringConstructor;
15
+ required: true;
16
+ };
17
+ params: {
18
+ type: PropType<any>;
19
+ };
20
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1 @@
1
+ export * from './can';
@@ -1,3 +1,4 @@
1
1
  export * from './common';
2
2
  export * from './loader';
3
3
  export * from './overlay';
4
+ export * from './auth';
@@ -0,0 +1 @@
1
+ export * from './permission';
@@ -0,0 +1,2 @@
1
+ import type { Directive } from 'vue';
2
+ export declare const permissionDirective: Directive;
@@ -107,3 +107,10 @@ export declare function useGetAuth(manageName?: string): import("..").IUserState
107
107
  * @returns Is login
108
108
  */
109
109
  export declare function useIsLogin(manageName?: string): boolean;
110
+ /**
111
+ * Can
112
+ * check if user can access the route
113
+ * @param manageName Manage name
114
+ * @returns Can method
115
+ */
116
+ export declare function useCan(manageName?: string): (name: string, params?: any) => boolean;
@@ -0,0 +1,5 @@
1
+ export declare function useI18n(): {
2
+ t: (key: string, options?: any, defaultMessage?: string) => string | undefined;
3
+ changeLocale: (lang: string) => Promise<any> | undefined;
4
+ getLocale: () => string | undefined;
5
+ };
@@ -5,3 +5,4 @@ export * from './manage';
5
5
  export * from './menu';
6
6
  export * from './theme';
7
7
  export * from './overlay';
8
+ export * from './i18n';
@@ -6,4 +6,4 @@ export * from './stores';
6
6
  export * from './components';
7
7
  export * from './utils';
8
8
  export * from './provider';
9
- export * from './simple';
9
+ export * from './preset';
@@ -0,0 +1,3 @@
1
+ import type { I18nOptions } from 'petite-vue-i18n';
2
+ import type { I18nProvider } from '../types';
3
+ export declare function i18nProvider(props?: I18nOptions): I18nProvider;
@@ -1,2 +1,3 @@
1
1
  export * from './authProvider';
2
2
  export * from './dataProvider';
3
+ export * from './i18nProvider';
@@ -0,0 +1,22 @@
1
+ import type { Ref } from 'vue';
2
+ /**
3
+ * use i18n store
4
+ * @param manageName manage name
5
+ * @returns i18n store
6
+ */
7
+ export declare function useI18nStore(manageName?: string): import("pinia").Store<`i18n-${string}`, Pick<{
8
+ lang: Ref<string, string>;
9
+ isInit: () => boolean;
10
+ setLocale: (value: string) => void;
11
+ getLocale: () => string;
12
+ }, "lang">, Pick<{
13
+ lang: Ref<string, string>;
14
+ isInit: () => boolean;
15
+ setLocale: (value: string) => void;
16
+ getLocale: () => string;
17
+ }, never>, Pick<{
18
+ lang: Ref<string, string>;
19
+ isInit: () => boolean;
20
+ setLocale: (value: string) => void;
21
+ getLocale: () => string;
22
+ }, "isInit" | "setLocale" | "getLocale">>;
@@ -2,3 +2,4 @@ export * from './auth';
2
2
  export * from './route';
3
3
  export * from './tab';
4
4
  export * from './manage';
5
+ export * from './i18n';