@duxweb/dvha-core 0.0.6 → 0.0.7

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 (120) hide show
  1. package/dist/cjs/components/common/logo.cjs +1 -0
  2. package/dist/cjs/components/overlay/overlay.cjs +1 -0
  3. package/dist/cjs/hooks/auth.cjs +1 -0
  4. package/dist/cjs/hooks/config.cjs +1 -0
  5. package/dist/cjs/hooks/data.cjs +1 -0
  6. package/dist/cjs/hooks/manage.cjs +1 -0
  7. package/dist/cjs/hooks/menu.cjs +1 -0
  8. package/dist/cjs/hooks/overlay.cjs +1 -0
  9. package/dist/cjs/hooks/theme.cjs +1 -0
  10. package/dist/cjs/index.cjs +1 -0
  11. package/dist/cjs/main.cjs +1 -0
  12. package/dist/cjs/provider/app.cjs +1 -0
  13. package/dist/cjs/provider/tab.cjs +1 -0
  14. package/dist/cjs/router/route.cjs +1 -0
  15. package/dist/cjs/simple/authProvider.cjs +1 -0
  16. package/dist/cjs/simple/dataProvider.cjs +1 -0
  17. package/dist/cjs/stores/auth.cjs +1 -0
  18. package/dist/cjs/stores/route.cjs +1 -0
  19. package/dist/cjs/stores/tab.cjs +1 -0
  20. package/dist/cjs/utils/tree.cjs +1 -0
  21. package/dist/esm/components/common/logo.js +50 -0
  22. package/dist/esm/components/overlay/overlay.js +72 -0
  23. package/dist/esm/hooks/auth.js +125 -0
  24. package/dist/esm/hooks/config.js +10 -0
  25. package/dist/esm/hooks/data.js +369 -0
  26. package/dist/esm/hooks/manage.js +24 -0
  27. package/dist/esm/hooks/menu.js +75 -0
  28. package/dist/esm/hooks/overlay.js +14 -0
  29. package/dist/esm/hooks/theme.js +31 -0
  30. package/dist/esm/index.js +67 -0
  31. package/dist/esm/main.js +22 -0
  32. package/dist/esm/provider/app.js +127 -0
  33. package/dist/esm/provider/tab.js +64 -0
  34. package/dist/esm/router/route.js +49 -0
  35. package/dist/esm/simple/authProvider.js +90 -0
  36. package/dist/esm/simple/dataProvider.js +99 -0
  37. package/dist/esm/stores/auth.js +50 -0
  38. package/dist/esm/stores/route.js +65 -0
  39. package/dist/esm/stores/tab.js +70 -0
  40. package/dist/esm/utils/tree.js +41 -0
  41. package/dist/types/components/common/index.d.ts +1 -0
  42. package/dist/types/components/common/logo.d.ts +22 -0
  43. package/dist/types/components/index.d.ts +3 -0
  44. package/dist/types/components/loader/iframe.d.ts +2 -0
  45. package/dist/types/components/loader/index.d.ts +1 -0
  46. package/dist/types/components/overlay/index.d.ts +1 -0
  47. package/dist/types/components/overlay/overlay.d.ts +44 -0
  48. package/dist/types/hooks/auth.d.ts +109 -0
  49. package/dist/types/hooks/config.d.ts +7 -0
  50. package/dist/types/hooks/data.d.ts +1487 -0
  51. package/dist/types/hooks/index.d.ts +7 -0
  52. package/dist/types/hooks/manage.d.ts +13 -0
  53. package/dist/types/hooks/menu.d.ts +16 -0
  54. package/dist/types/hooks/overlay.d.ts +7 -0
  55. package/dist/types/hooks/theme.d.ts +12 -0
  56. package/dist/types/index.d.ts +9 -0
  57. package/dist/types/main.d.ts +5 -0
  58. package/dist/types/provider/app.d.ts +1 -0
  59. package/dist/types/provider/index.d.ts +2 -0
  60. package/dist/types/provider/tab.d.ts +1 -0
  61. package/dist/types/router/index.d.ts +1 -0
  62. package/dist/types/router/route.d.ts +2 -0
  63. package/dist/types/simple/authProvider.d.ts +2 -0
  64. package/dist/types/simple/dataProvider.d.ts +2 -0
  65. package/dist/types/simple/index.d.ts +2 -0
  66. package/dist/types/stores/auth.d.ts +31 -0
  67. package/dist/types/stores/index.d.ts +3 -0
  68. package/dist/types/stores/route.d.ts +4040 -0
  69. package/dist/types/stores/tab.d.ts +1660 -0
  70. package/dist/types/types/auth.d.ts +36 -0
  71. package/dist/types/types/config.d.ts +32 -0
  72. package/dist/types/types/data.d.ts +84 -0
  73. package/dist/types/types/index.d.ts +6 -0
  74. package/dist/types/types/manage.d.ts +29 -0
  75. package/dist/types/types/menu.d.ts +13 -0
  76. package/dist/types/types/theme.d.ts +10 -0
  77. package/dist/types/utils/index.d.ts +1 -0
  78. package/dist/types/utils/tree.d.ts +13 -0
  79. package/package.json +36 -9
  80. package/CHANGELOG.md +0 -31
  81. package/src/components/common/index.ts +0 -1
  82. package/src/components/common/logo.tsx +0 -62
  83. package/src/components/index.ts +0 -3
  84. package/src/components/loader/iframe.tsx +0 -12
  85. package/src/components/loader/index.ts +0 -1
  86. package/src/components/overlay/index.ts +0 -1
  87. package/src/components/overlay/overlay.tsx +0 -84
  88. package/src/hooks/auth.ts +0 -261
  89. package/src/hooks/config.ts +0 -16
  90. package/src/hooks/data.ts +0 -647
  91. package/src/hooks/index.ts +0 -7
  92. package/src/hooks/manage.ts +0 -71
  93. package/src/hooks/menu.ts +0 -146
  94. package/src/hooks/overlay.ts +0 -21
  95. package/src/hooks/theme.ts +0 -49
  96. package/src/index.ts +0 -9
  97. package/src/main.ts +0 -28
  98. package/src/provider/app.tsx +0 -200
  99. package/src/provider/index.ts +0 -2
  100. package/src/provider/tab.tsx +0 -76
  101. package/src/router/index.ts +0 -1
  102. package/src/router/route.ts +0 -47
  103. package/src/simple/authProvider.ts +0 -99
  104. package/src/simple/dataProvider.ts +0 -153
  105. package/src/simple/index.ts +0 -2
  106. package/src/stores/auth.ts +0 -73
  107. package/src/stores/index.ts +0 -3
  108. package/src/stores/route.ts +0 -159
  109. package/src/stores/tab.ts +0 -120
  110. package/src/types/auth.ts +0 -44
  111. package/src/types/config.ts +0 -51
  112. package/src/types/data.ts +0 -108
  113. package/src/types/index.ts +0 -6
  114. package/src/types/manage.ts +0 -40
  115. package/src/types/menu.ts +0 -24
  116. package/src/types/theme.ts +0 -12
  117. package/src/utils/index.ts +0 -1
  118. package/src/utils/tree.ts +0 -63
  119. package/tsconfig.json +0 -41
  120. package/typings.d.ts +0 -10
@@ -0,0 +1,127 @@
1
+ import { defineComponent as y, inject as D, createVNode as E } from "vue";
2
+ import { OverlaysProvider as F } from "@overlastic/vue";
3
+ import { storeToRefs as N } from "pinia";
4
+ import { useRouter as _ } from "vue-router";
5
+ import { useAuthStore as C } from "../stores/auth.js";
6
+ import { useManage as I } from "../hooks/manage.js";
7
+ import { useConfig as j } from "../hooks/config.js";
8
+ import "@tanstack/vue-query";
9
+ import "lodash-es";
10
+ import { useRouteStore as L } from "../stores/route.js";
11
+ import "@vueuse/core";
12
+ import "clsx";
13
+ const Z = /* @__PURE__ */ y({
14
+ name: "DuxAppProvider",
15
+ props: {},
16
+ setup(O, {
17
+ slots: i
18
+ }) {
19
+ const m = D("dux.manage"), f = j(), s = _(), h = C();
20
+ return s.beforeEach(async (a, T, n) => {
21
+ var g, v, P, R, b, A;
22
+ const o = a.meta.manageName, z = a.meta.authorization === !1;
23
+ if (!o) {
24
+ const e = f.defaultManage || ((v = (g = f.manages) == null ? void 0 : g[0]) == null ? void 0 : v.name) || "";
25
+ return n({
26
+ path: `/${e}`,
27
+ replace: !0
28
+ });
29
+ }
30
+ m && (m.value = o);
31
+ const u = L(o), {
32
+ routes: S
33
+ } = N(u), r = I(o);
34
+ if (!h.isLogin(o))
35
+ return z ? n() : n({
36
+ path: r.getRoutePath("login"),
37
+ replace: !0
38
+ });
39
+ const d = (e) => e == null ? void 0 : e.map((p) => ({
40
+ ...p,
41
+ path: r.getRoutePath(p.path || "")
42
+ }));
43
+ if (!u.getRouteInit()) {
44
+ const e = ((P = r.config) == null ? void 0 : P.components) || {}, p = [];
45
+ if (e.notFound && p.push({
46
+ name: `${o}.notFound`,
47
+ label: "404",
48
+ path: ":pathMatch(.*)*",
49
+ component: e.notFound,
50
+ hidden: !0
51
+ }), e.notAuthorized && p.push({
52
+ name: `${o}.notAuthorized`,
53
+ label: "403",
54
+ path: "notAuthorized",
55
+ component: e.notAuthorized,
56
+ hidden: !0
57
+ }), e.error && p.push({
58
+ name: `${o}.error`,
59
+ label: "500",
60
+ path: "error",
61
+ component: e.error,
62
+ hidden: !0
63
+ }), u.setRoutes(d(((R = r.config) == null ? void 0 : R.menus) || [])), (b = r.config) != null && b.apiRoutePath)
64
+ try {
65
+ await ((A = r.config.dataProvider) == null ? void 0 : A.custom({
66
+ path: r.config.apiRoutePath,
67
+ meta: {
68
+ timeout: 5e3
69
+ }
70
+ }, r, h.getUser(o)).then((t) => {
71
+ u.appendRoutes(d(t.data || []));
72
+ }));
73
+ } catch (t) {
74
+ console.error(t);
75
+ }
76
+ return u.appendRoutes(p), S.value.forEach((t) => {
77
+ var $, k;
78
+ if (!t.path)
79
+ return;
80
+ const c = {
81
+ name: t.name,
82
+ path: t.path,
83
+ meta: t.meta
84
+ };
85
+ switch (t.loader) {
86
+ case "iframe":
87
+ c.component = (k = ($ = r.config) == null ? void 0 : $.components) == null ? void 0 : k.iframe;
88
+ break;
89
+ case "link":
90
+ c.beforeEnter = () => {
91
+ var w;
92
+ const M = ((w = t.meta) == null ? void 0 : w.url) || t.path;
93
+ return M && window.open(M, "_blank"), !1;
94
+ }, c.component = () => Promise.resolve({
95
+ template: "<div></div>"
96
+ });
97
+ break;
98
+ default:
99
+ t.component && (c.component = t.component);
100
+ break;
101
+ }
102
+ s.addRoute(`${o}.auth`, c);
103
+ }), n({
104
+ path: a.fullPath,
105
+ replace: !0
106
+ });
107
+ }
108
+ const l = ["", "/", `/${o}`, `/${o}/`];
109
+ if (l.includes(a.path)) {
110
+ const e = u.getIndexRoute();
111
+ return !(e != null && e.path) || l.includes(e == null ? void 0 : e.path) ? (console.warn("[Dux] index route not found, skip redirect"), n()) : n({
112
+ path: (e == null ? void 0 : e.path) || "/",
113
+ replace: !0
114
+ });
115
+ }
116
+ return n();
117
+ }), () => E(F, null, {
118
+ default: () => {
119
+ var a;
120
+ return [(a = i.default) == null ? void 0 : a.call(i)];
121
+ }
122
+ });
123
+ }
124
+ });
125
+ export {
126
+ Z as DuxAppProvider
127
+ };
@@ -0,0 +1,64 @@
1
+ import { defineComponent as c, watch as d, createVNode as m, Transition as l, KeepAlive as f } from "vue";
2
+ import { useRoute as b, RouterView as h } from "vue-router";
3
+ import "../stores/auth.js";
4
+ import { useRouteStore as R } from "../stores/route.js";
5
+ import { useTabStore as w } from "../stores/tab.js";
6
+ const g = /* @__PURE__ */ c({
7
+ name: "DuxTabRouterView",
8
+ props: {},
9
+ setup() {
10
+ const r = b(), u = w(), s = R(), n = /* @__PURE__ */ new Map(), p = (e, t) => {
11
+ let a;
12
+ const o = e;
13
+ return n.has(o) ? a = n.get(o) : (a = {
14
+ name: o,
15
+ render() {
16
+ return t;
17
+ }
18
+ }, n.set(o, a)), a;
19
+ };
20
+ u.$subscribe((e, t) => {
21
+ n.forEach((a) => {
22
+ t.tabs.some((o) => o.path === a.name) || n.delete(a.name);
23
+ });
24
+ });
25
+ const i = s.getIndexRoute();
26
+ return i && u.addTab({
27
+ ...i,
28
+ meta: {
29
+ ...i.meta,
30
+ lock: !0
31
+ }
32
+ }), d([r, () => s.routes], () => {
33
+ const e = s.searchRouteName(r.name);
34
+ if (!e)
35
+ return;
36
+ const t = {
37
+ label: e.label,
38
+ path: r.path,
39
+ name: e.name
40
+ };
41
+ u.addTab(t);
42
+ }, {
43
+ immediate: !0
44
+ }), () => m(h, null, {
45
+ default: ({
46
+ Component: e
47
+ }) => m(l, {
48
+ name: "tab-fade",
49
+ mode: "out-in",
50
+ appear: !0
51
+ }, {
52
+ default: () => [m(f, {
53
+ include: u.tabs.map((t) => t.path || "")
54
+ }, [m(e, {
55
+ is: p(r.path, e),
56
+ key: r.path
57
+ }, null)])]
58
+ })
59
+ });
60
+ }
61
+ });
62
+ export {
63
+ g as DuxTabRouterView
64
+ };
@@ -0,0 +1,49 @@
1
+ import { createRouter as f, createWebHashHistory as y } from "vue-router";
2
+ function R(o) {
3
+ var n, u, h;
4
+ const r = [
5
+ ...o.routes || [],
6
+ {
7
+ name: "default",
8
+ path: "/:catchAll(.*)",
9
+ redirect: `/${o.defaultManage || ((u = (n = o.manages) == null ? void 0 : n[0]) == null ? void 0 : u.name) || ""}`
10
+ }
11
+ ];
12
+ return (h = o.manages) == null || h.forEach((t) => {
13
+ var s, i, m, c;
14
+ const l = ((s = t.routes) == null ? void 0 : s.filter((a) => {
15
+ var e, p;
16
+ return ((e = a.meta) == null ? void 0 : e.authorization) === !0 || ((p = a.meta) == null ? void 0 : p.authorization) === void 0;
17
+ })) || [], d = ((i = t.routes) == null ? void 0 : i.filter((a) => {
18
+ var e;
19
+ return ((e = a.meta) == null ? void 0 : e.authorization) === !1;
20
+ })) || [];
21
+ r.push({
22
+ name: t.name,
23
+ path: t.routePrefix || "",
24
+ children: [
25
+ {
26
+ path: "",
27
+ name: `${t.name}.auth`,
28
+ component: (m = t.components) == null ? void 0 : m.authLayout,
29
+ children: l
30
+ },
31
+ {
32
+ path: "",
33
+ name: `${t.name}.noAuth`,
34
+ component: (c = t.components) == null ? void 0 : c.noAuthLayout,
35
+ children: d
36
+ }
37
+ ],
38
+ meta: {
39
+ manageName: t.name
40
+ }
41
+ });
42
+ }), f({
43
+ history: y(),
44
+ routes: r
45
+ });
46
+ }
47
+ export {
48
+ R as initRouter
49
+ };
@@ -0,0 +1,90 @@
1
+ import e from "axios";
2
+ const i = {
3
+ login: async (u, c) => await e.post(c.getApiUrl("/login"), u).then((t) => {
4
+ var s, a;
5
+ return {
6
+ success: !0,
7
+ message: (s = t == null ? void 0 : t.data) == null ? void 0 : s.message,
8
+ redirectTo: "/",
9
+ data: (a = t == null ? void 0 : t.data) == null ? void 0 : a.data
10
+ };
11
+ }).catch((t) => {
12
+ var s, a;
13
+ return {
14
+ success: !1,
15
+ 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)
16
+ };
17
+ }),
18
+ check: async (u, c) => await e.get((c == null ? void 0 : c.getApiUrl("/check")) || "").then((t) => {
19
+ var s, a;
20
+ return {
21
+ success: !0,
22
+ message: (s = t == null ? void 0 : t.data) == null ? void 0 : s.message,
23
+ data: (a = t == null ? void 0 : t.data) == null ? void 0 : a.data
24
+ };
25
+ }).catch((t) => {
26
+ var s, a;
27
+ return {
28
+ success: !1,
29
+ 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)
30
+ };
31
+ }),
32
+ onError: async (u) => u.status === 403 ? {
33
+ logout: !0,
34
+ redirectTo: "/login",
35
+ error: u
36
+ } : {
37
+ logout: !1,
38
+ error: u
39
+ },
40
+ logout: async () => ({
41
+ success: !0,
42
+ redirectTo: "/login"
43
+ }),
44
+ register: async (u, c) => await e.post((c == null ? void 0 : c.getApiUrl("/auth/register")) || "", u).then((t) => {
45
+ var s, a;
46
+ return {
47
+ success: !0,
48
+ message: (s = t == null ? void 0 : t.data) == null ? void 0 : s.message,
49
+ redirectTo: "/",
50
+ data: (a = t == null ? void 0 : t.data) == null ? void 0 : a.data
51
+ };
52
+ }).catch((t) => {
53
+ var s, a;
54
+ return {
55
+ success: !1,
56
+ 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)
57
+ };
58
+ }),
59
+ forgotPassword: async (u, c) => await e.post((c == null ? void 0 : c.getApiUrl("/auth/forgot-password")) || "", u).then((t) => {
60
+ var s;
61
+ return {
62
+ success: !0,
63
+ message: (s = t == null ? void 0 : t.data) == null ? void 0 : s.message,
64
+ redirectTo: "/login"
65
+ };
66
+ }).catch((t) => {
67
+ var s, a;
68
+ return {
69
+ success: !1,
70
+ 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)
71
+ };
72
+ }),
73
+ updatePassword: async (u, c) => await e.post((c == null ? void 0 : c.getApiUrl("/auth/update-password")) || "", u).then((t) => {
74
+ var s;
75
+ return {
76
+ success: !0,
77
+ message: (s = t == null ? void 0 : t.data) == null ? void 0 : s.message,
78
+ redirectTo: "/login"
79
+ };
80
+ }).catch((t) => {
81
+ var s, a;
82
+ return {
83
+ success: !1,
84
+ 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)
85
+ };
86
+ })
87
+ };
88
+ export {
89
+ i as simpleAuthProvider
90
+ };
@@ -0,0 +1,99 @@
1
+ import i from "axios";
2
+ const z = {
3
+ getList: (r, e, t) => {
4
+ const d = {};
5
+ return r.pagination && typeof r.pagination == "object" && (d.page = r.pagination.page, d.limit = r.pagination.limit, d.pageSize = r.pagination.pageSize), i.get((e == null ? void 0 : e.getApiUrl(r.path)) || "", {
6
+ params: {
7
+ ...d,
8
+ ...r.filters,
9
+ ...r.sorters
10
+ },
11
+ headers: {
12
+ Authorization: t == null ? void 0 : t.token
13
+ },
14
+ ...r.meta
15
+ }).then((l) => l.data);
16
+ },
17
+ create: (r, e, t) => i.post((e == null ? void 0 : e.getApiUrl(r.path)) || "", r.data, {
18
+ headers: {
19
+ Authorization: t == null ? void 0 : t.token
20
+ },
21
+ ...r.meta
22
+ }).then((d) => d.data),
23
+ update: (r, e, t) => i.put((e == null ? void 0 : e.getApiUrl(r.id ? `${r.path}/${r.id}` : r.path)) || "", r.data, {
24
+ headers: {
25
+ Authorization: t == null ? void 0 : t.token
26
+ },
27
+ ...r.meta
28
+ }).then((d) => d.data),
29
+ deleteOne: (r, e, t) => i.delete((e == null ? void 0 : e.getApiUrl(r.id ? `${r.path}/${r.id}` : r.path)) || "", {
30
+ headers: {
31
+ Authorization: t == null ? void 0 : t.token
32
+ },
33
+ ...r.meta
34
+ }).then((d) => d.data),
35
+ getOne: (r, e, t) => i.get((e == null ? void 0 : e.getApiUrl(r.id ? `${r.path}/${r.id}` : r.path)) || "", {
36
+ headers: {
37
+ Authorization: t == null ? void 0 : t.token
38
+ },
39
+ ...r.meta
40
+ }).then((d) => d.data),
41
+ getMany: (r, e, t) => i.get((e == null ? void 0 : e.getApiUrl(r.path)) || "", {
42
+ params: {
43
+ ids: r.ids
44
+ },
45
+ headers: {
46
+ Authorization: t == null ? void 0 : t.token
47
+ },
48
+ ...r.meta
49
+ }).then((d) => d.data),
50
+ createMany: (r, e, t) => i.post((e == null ? void 0 : e.getApiUrl(r.path)) || "", r.data, {
51
+ headers: {
52
+ Authorization: t == null ? void 0 : t.token
53
+ },
54
+ ...r.meta
55
+ }).then((d) => d.data),
56
+ updateMany: (r, e, t) => i.put((e == null ? void 0 : e.getApiUrl(r.path)) || "", {
57
+ ids: r.ids,
58
+ data: r.data
59
+ }, {
60
+ headers: {
61
+ Authorization: t == null ? void 0 : t.token
62
+ },
63
+ ...r.meta
64
+ }).then((d) => d.data),
65
+ deleteMany: (r, e, t) => i.delete((e == null ? void 0 : e.getApiUrl(r.path)) || "", {
66
+ params: {
67
+ ids: r.ids
68
+ },
69
+ headers: {
70
+ Authorization: t == null ? void 0 : t.token
71
+ },
72
+ ...r.meta
73
+ }).then((d) => d.data),
74
+ custom: (r, e, t) => {
75
+ let d = {
76
+ ...r.query
77
+ };
78
+ return r.sorters && typeof r.sorters == "object" && (d = {
79
+ ...d,
80
+ ...r.sorters
81
+ }), r.filters && typeof r.filters == "object" && (d = {
82
+ ...d,
83
+ ...r.filters
84
+ }), i.request({
85
+ url: e == null ? void 0 : e.getApiUrl(r.path || ""),
86
+ method: r.method || "GET",
87
+ data: r.payload,
88
+ params: d,
89
+ headers: {
90
+ Authorization: t == null ? void 0 : t.token,
91
+ ...r.headers
92
+ },
93
+ ...r.meta
94
+ }).then((l) => l.data);
95
+ }
96
+ };
97
+ export {
98
+ z as simpleDataProvider
99
+ };
@@ -0,0 +1,50 @@
1
+ import { defineStore as i } from "pinia";
2
+ import { ref as u } from "vue";
3
+ const p = i("auth", () => {
4
+ const o = u({});
5
+ return {
6
+ data: o,
7
+ getUser: (t) => o.value[t] || {},
8
+ login: (t, e) => {
9
+ o.value = {
10
+ ...o.value,
11
+ [t]: {
12
+ token: e.token,
13
+ id: e.id,
14
+ info: e.info,
15
+ permission: e.permission
16
+ }
17
+ };
18
+ },
19
+ isLogin: (t) => !!o.value[t],
20
+ logout: (t) => {
21
+ const e = { ...o.value };
22
+ delete e[t], o.value = e;
23
+ },
24
+ update: (t, e) => {
25
+ o.value = {
26
+ ...o.value,
27
+ [t]: {
28
+ token: e.token,
29
+ id: e.id,
30
+ info: e.info,
31
+ permission: e.permission
32
+ }
33
+ };
34
+ },
35
+ updateKey: (t, e, n) => {
36
+ o.value = {
37
+ ...o.value,
38
+ [t]: {
39
+ ...o.value[t],
40
+ [e]: n
41
+ }
42
+ };
43
+ }
44
+ };
45
+ }, {
46
+ persist: !0
47
+ });
48
+ export {
49
+ p as useAuthStore
50
+ };
@@ -0,0 +1,65 @@
1
+ import { defineStore as w } from "pinia";
2
+ import { inject as j, ref as R } from "vue";
3
+ function b(n) {
4
+ const t = j("dux.manage");
5
+ if (n || (n = (t == null ? void 0 : t.value) || ""), !n)
6
+ throw new Error("manage not found");
7
+ return E(n)();
8
+ }
9
+ function E(n) {
10
+ return w(`routes-${n}`, () => {
11
+ const t = R([]), a = (e) => {
12
+ var o;
13
+ return (o = t.value) == null ? void 0 : o.find((u) => u.path === e);
14
+ }, p = (e) => {
15
+ var o;
16
+ return (o = t.value) == null ? void 0 : o.find((u) => u.name === e);
17
+ }, h = (e) => {
18
+ var o;
19
+ (o = t.value) == null || o.push(e);
20
+ }, S = (e) => {
21
+ t.value = [...t.value, ...e];
22
+ }, I = (e) => {
23
+ t.value = e;
24
+ }, x = () => t.value, g = () => {
25
+ t.value = [];
26
+ }, m = () => {
27
+ var u, f;
28
+ const e = (f = (u = t.value) == null ? void 0 : u.filter((r) => !r.parent && !r.name.includes("404") && !r.name.includes("403"))) == null ? void 0 : f.sort((r, s) => (r.sort || 0) - (s.sort || 0)), o = (r) => {
29
+ var d, v;
30
+ if (r.path)
31
+ return r;
32
+ const s = (v = (d = t.value) == null ? void 0 : d.filter((c) => c.parent === r.name)) == null ? void 0 : v.sort((c, i) => (c.sort || 0) - (i.sort || 0));
33
+ for (const c of s || []) {
34
+ const i = o(c);
35
+ if (i)
36
+ return i;
37
+ }
38
+ };
39
+ for (const r of e || []) {
40
+ const s = o(r);
41
+ if (s)
42
+ return s;
43
+ }
44
+ }, l = R(!1);
45
+ return {
46
+ routes: t,
47
+ searchRoute: a,
48
+ searchRouteName: p,
49
+ appendRoute: h,
50
+ appendRoutes: S,
51
+ setRoutes: I,
52
+ getRoutes: x,
53
+ clearRoutes: g,
54
+ getIndexRoute: m,
55
+ getRouteInit: () => {
56
+ const e = l.value;
57
+ return l.value = !0, e;
58
+ }
59
+ };
60
+ });
61
+ }
62
+ export {
63
+ E as createRouteStore,
64
+ b as useRouteStore
65
+ };
@@ -0,0 +1,70 @@
1
+ import { defineStore as f } from "pinia";
2
+ import { inject as h, ref as s } from "vue";
3
+ function R(r) {
4
+ const o = h("dux.manage");
5
+ if (r || (r = (o == null ? void 0 : o.value) || ""), !r)
6
+ throw new Error("manage not found");
7
+ return c(r)();
8
+ }
9
+ function c(r) {
10
+ return f(`tab-${r}`, () => {
11
+ const o = s(), t = s([]);
12
+ return {
13
+ current: o,
14
+ tabs: t,
15
+ isTab: (l) => t.value.some((e) => e.path === l),
16
+ addTab: (l, e) => {
17
+ l.path && (t.value.some((a) => a.path === l.path) || (t.value.push(l), e == null || e(l)), o.value = l.path);
18
+ },
19
+ delTab: (l, e) => {
20
+ var i;
21
+ const a = t.value.findIndex((d) => d.path === l);
22
+ if (!a || t.value.length <= 1)
23
+ return;
24
+ const n = t.value[a];
25
+ if ((i = n == null ? void 0 : n.meta) != null && i.lock)
26
+ return;
27
+ const u = t.value[a - 1], v = t.value[a + 1];
28
+ e == null || e(u || v), setTimeout(() => {
29
+ t.value.splice(a, 1);
30
+ }, 0);
31
+ },
32
+ changeTab: (l, e) => {
33
+ o.value = l;
34
+ const a = t.value.find((n) => n.path === l);
35
+ a && (e == null || e(a));
36
+ },
37
+ delOther: (l, e) => {
38
+ t.value = t.value.filter((a) => {
39
+ var n;
40
+ return a.path === l || ((n = a.meta) == null ? void 0 : n.lock);
41
+ }), e == null || e();
42
+ },
43
+ delLeft: (l, e) => {
44
+ const a = t.value.findIndex((n) => n.path === l);
45
+ a <= 0 || (t.value = [...t.value.slice(0, a).filter((n) => {
46
+ var u;
47
+ return (u = n.meta) == null ? void 0 : u.lock;
48
+ }), ...t.value.slice(a)], e == null || e());
49
+ },
50
+ delRight: (l, e) => {
51
+ const a = t.value.findIndex((n) => n.path === l);
52
+ a === -1 || a === t.value.length - 1 || (t.value = [...t.value.slice(0, a + 1), ...t.value.slice(a + 1).filter((n) => {
53
+ var u;
54
+ return (u = n.meta) == null ? void 0 : u.lock;
55
+ })], e == null || e());
56
+ },
57
+ lockTab: (l) => {
58
+ const e = t.value.findIndex((a) => a.path === l);
59
+ e !== -1 && t.value[e] && (t.value[e].meta || (t.value[e].meta = {}), t.value[e].meta.lock = !t.value[e].meta.lock);
60
+ },
61
+ clearTab: () => {
62
+ o.value = void 0, t.value = [];
63
+ }
64
+ };
65
+ });
66
+ }
67
+ export {
68
+ c as createTabStore,
69
+ R as useTabStore
70
+ };
@@ -0,0 +1,41 @@
1
+ function c(h, e, t) {
2
+ let n = [];
3
+ return h.forEach((r) => {
4
+ if (r[e.parentKey] === t) {
5
+ const f = c(h, e, r[e.idKey]);
6
+ f.length > 0 && (r[e.childrenKey] = f), n.push(r);
7
+ }
8
+ }), n = n.sort((r, f) => r[e.sortKey] - f[e.sortKey]), n;
9
+ }
10
+ function l(h, e, t = []) {
11
+ var n;
12
+ if (!h || !h.length)
13
+ return [];
14
+ for (const r of h) {
15
+ if (t.push(r), e(r))
16
+ return t;
17
+ if (r != null && r.children && ((n = r == null ? void 0 : r.children) != null && n.length)) {
18
+ const f = l(r.children, e, t);
19
+ if (f.length)
20
+ return f;
21
+ }
22
+ t.pop();
23
+ }
24
+ return [];
25
+ }
26
+ function u(h, e, t) {
27
+ let n = [];
28
+ if (!h || !h.length)
29
+ return n;
30
+ for (const r of h)
31
+ if (n.push(r[e]), r[t] && r[t].length) {
32
+ const f = u(r[t], e, t);
33
+ f.length && (n = n.concat(f));
34
+ }
35
+ return n;
36
+ }
37
+ export {
38
+ c as arrayToTree,
39
+ l as searchTree,
40
+ u as treeToArr
41
+ };
@@ -0,0 +1 @@
1
+ export * from './logo';
@@ -0,0 +1,22 @@
1
+ export declare const DuxLogo: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ dark: {
3
+ type: BooleanConstructor;
4
+ default: boolean;
5
+ };
6
+ highlight: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
11
+ dark: {
12
+ type: BooleanConstructor;
13
+ default: boolean;
14
+ };
15
+ highlight: {
16
+ type: StringConstructor;
17
+ default: string;
18
+ };
19
+ }>> & Readonly<{}>, {
20
+ dark: boolean;
21
+ highlight: string;
22
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,3 @@
1
+ export * from './common';
2
+ export * from './loader';
3
+ export * from './overlay';
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export * from './iframe';