@duxweb/dvha-core 1.1.30 → 1.1.31

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 (159) hide show
  1. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -0
  2. package/dist/cjs/components/auth/can.cjs +1 -1
  3. package/dist/cjs/components/auth/index.cjs +1 -0
  4. package/dist/cjs/components/common/icon.cjs +1 -1
  5. package/dist/cjs/components/common/index.cjs +1 -0
  6. package/dist/cjs/components/common/logo.cjs +1 -1
  7. package/dist/cjs/components/index.cjs +1 -0
  8. package/dist/cjs/components/loader/iframe.cjs +1 -1
  9. package/dist/cjs/components/loader/index.cjs +1 -0
  10. package/dist/cjs/components/loader/loader.cjs +1 -1
  11. package/dist/cjs/components/loader/remote/index.cjs +1 -0
  12. package/dist/cjs/components/loader/remote/loader.cjs +1 -1
  13. package/dist/cjs/components/loader/remote/render.cjs +1 -1
  14. package/dist/cjs/components/overlay/index.cjs +1 -0
  15. package/dist/cjs/components/overlay/overlay.cjs +1 -1
  16. package/dist/cjs/components/status/error.cjs +1 -1
  17. package/dist/cjs/components/status/exception.cjs +1 -1
  18. package/dist/cjs/components/status/index.cjs +1 -0
  19. package/dist/cjs/components/status/notAuthorized.cjs +1 -1
  20. package/dist/cjs/components/status/notFound.cjs +1 -1
  21. package/dist/cjs/config/color.cjs +1 -1
  22. package/dist/cjs/directive/index.cjs +1 -0
  23. package/dist/cjs/directive/permission.cjs +1 -1
  24. package/dist/cjs/hooks/auth.cjs +1 -1
  25. package/dist/cjs/hooks/config.cjs +1 -1
  26. package/dist/cjs/hooks/data.cjs +1 -1
  27. package/dist/cjs/hooks/export.cjs +1 -1
  28. package/dist/cjs/hooks/exportCsv.cjs +2 -2
  29. package/dist/cjs/hooks/form.cjs +1 -1
  30. package/dist/cjs/hooks/formExtend.cjs +1 -1
  31. package/dist/cjs/hooks/formValidate.cjs +1 -1
  32. package/dist/cjs/hooks/i18n.cjs +1 -1
  33. package/dist/cjs/hooks/import.cjs +1 -1
  34. package/dist/cjs/hooks/importCsv.cjs +2 -2
  35. package/dist/cjs/hooks/index.cjs +1 -0
  36. package/dist/cjs/hooks/json/index.cjs +1 -1
  37. package/dist/cjs/hooks/json/utils/contextManager.cjs +1 -1
  38. package/dist/cjs/hooks/json/utils/expressionParser.cjs +1 -1
  39. package/dist/cjs/hooks/json/vFor.cjs +1 -1
  40. package/dist/cjs/hooks/json/vIf.cjs +1 -1
  41. package/dist/cjs/hooks/json/vModel.cjs +1 -1
  42. package/dist/cjs/hooks/json/vOn.cjs +1 -1
  43. package/dist/cjs/hooks/json/vShow.cjs +1 -1
  44. package/dist/cjs/hooks/json/vText.cjs +1 -1
  45. package/dist/cjs/hooks/json.cjs +1 -1
  46. package/dist/cjs/hooks/list.cjs +1 -1
  47. package/dist/cjs/hooks/manage.cjs +1 -1
  48. package/dist/cjs/hooks/menu.cjs +1 -1
  49. package/dist/cjs/hooks/overlay.cjs +1 -1
  50. package/dist/cjs/hooks/select.cjs +1 -1
  51. package/dist/cjs/hooks/theme.cjs +4 -8
  52. package/dist/cjs/hooks/tree.cjs +1 -1
  53. package/dist/cjs/hooks/upload/index.cjs +1 -0
  54. package/dist/cjs/hooks/upload/local.cjs +1 -1
  55. package/dist/cjs/hooks/upload/s3.cjs +1 -1
  56. package/dist/cjs/hooks/upload.cjs +1 -1
  57. package/dist/cjs/index.cjs +1 -1
  58. package/dist/cjs/main.cjs +1 -1
  59. package/dist/cjs/preset/authProvider.cjs +1 -1
  60. package/dist/cjs/preset/dataProvider.cjs +1 -1
  61. package/dist/cjs/preset/i18nProvider.cjs +1 -1
  62. package/dist/cjs/preset/index.cjs +1 -0
  63. package/dist/cjs/provider/app.cjs +1 -1
  64. package/dist/cjs/provider/index.cjs +1 -0
  65. package/dist/cjs/provider/tab.cjs +1 -1
  66. package/dist/cjs/router/index.cjs +1 -0
  67. package/dist/cjs/router/route.cjs +1 -1
  68. package/dist/cjs/stores/auth.cjs +1 -1
  69. package/dist/cjs/stores/i18n.cjs +1 -1
  70. package/dist/cjs/stores/index.cjs +1 -0
  71. package/dist/cjs/stores/jsonSchema.cjs +1 -1
  72. package/dist/cjs/stores/manage.cjs +1 -1
  73. package/dist/cjs/stores/route.cjs +1 -1
  74. package/dist/cjs/stores/tab.cjs +1 -1
  75. package/dist/cjs/stores/theme.cjs +1 -1
  76. package/dist/cjs/utils/bus.cjs +1 -1
  77. package/dist/cjs/utils/index.cjs +1 -0
  78. package/dist/cjs/utils/theme.cjs +8 -8
  79. package/dist/cjs/utils/tree.cjs +1 -1
  80. package/dist/esm/_virtual/_rolldown/runtime.js +9 -0
  81. package/dist/esm/components/auth/can.js +17 -36
  82. package/dist/esm/components/auth/index.js +1 -0
  83. package/dist/esm/components/common/icon.js +16 -24
  84. package/dist/esm/components/common/index.js +2 -0
  85. package/dist/esm/components/common/logo.js +50 -49
  86. package/dist/esm/components/index.js +14 -0
  87. package/dist/esm/components/loader/iframe.js +16 -18
  88. package/dist/esm/components/loader/index.js +1 -0
  89. package/dist/esm/components/loader/loader.js +11 -40
  90. package/dist/esm/components/loader/remote/index.js +2 -0
  91. package/dist/esm/components/loader/remote/loader.js +118 -156
  92. package/dist/esm/components/loader/remote/render.js +12 -17
  93. package/dist/esm/components/overlay/index.js +1 -0
  94. package/dist/esm/components/overlay/overlay.js +54 -70
  95. package/dist/esm/components/status/error.js +7 -9
  96. package/dist/esm/components/status/exception.js +21 -37
  97. package/dist/esm/components/status/index.js +4 -0
  98. package/dist/esm/components/status/notAuthorized.js +7 -9
  99. package/dist/esm/components/status/notFound.js +7 -9
  100. package/dist/esm/config/color.js +288 -290
  101. package/dist/esm/directive/index.js +1 -0
  102. package/dist/esm/directive/permission.js +7 -27
  103. package/dist/esm/hooks/auth.js +154 -120
  104. package/dist/esm/hooks/config.js +11 -9
  105. package/dist/esm/hooks/data.js +416 -415
  106. package/dist/esm/hooks/export.js +32 -36
  107. package/dist/esm/hooks/exportCsv.js +42 -46
  108. package/dist/esm/hooks/form.js +86 -95
  109. package/dist/esm/hooks/formExtend.js +36 -40
  110. package/dist/esm/hooks/formValidate.js +22 -25
  111. package/dist/esm/hooks/i18n.js +14 -18
  112. package/dist/esm/hooks/import.js +45 -54
  113. package/dist/esm/hooks/importCsv.js +90 -83
  114. package/dist/esm/hooks/index.js +31 -0
  115. package/dist/esm/hooks/json/index.js +14 -22
  116. package/dist/esm/hooks/json/utils/contextManager.js +35 -26
  117. package/dist/esm/hooks/json/utils/expressionParser.js +100 -123
  118. package/dist/esm/hooks/json/vFor.js +50 -55
  119. package/dist/esm/hooks/json/vIf.js +17 -16
  120. package/dist/esm/hooks/json/vModel.js +96 -106
  121. package/dist/esm/hooks/json/vOn.js +30 -32
  122. package/dist/esm/hooks/json/vShow.js +20 -22
  123. package/dist/esm/hooks/json/vText.js +44 -51
  124. package/dist/esm/hooks/json.js +131 -132
  125. package/dist/esm/hooks/list.js +150 -184
  126. package/dist/esm/hooks/manage.js +25 -22
  127. package/dist/esm/hooks/menu.js +57 -61
  128. package/dist/esm/hooks/overlay.js +6 -23
  129. package/dist/esm/hooks/select.js +84 -94
  130. package/dist/esm/hooks/theme.js +289 -219
  131. package/dist/esm/hooks/tree.js +43 -47
  132. package/dist/esm/hooks/upload/index.js +2 -0
  133. package/dist/esm/hooks/upload/local.js +24 -30
  134. package/dist/esm/hooks/upload/s3.js +70 -80
  135. package/dist/esm/hooks/upload.js +256 -272
  136. package/dist/esm/index.js +150 -141
  137. package/dist/esm/main.js +24 -45
  138. package/dist/esm/preset/authProvider.js +62 -68
  139. package/dist/esm/preset/dataProvider.js +154 -180
  140. package/dist/esm/preset/i18nProvider.js +28 -30
  141. package/dist/esm/preset/index.js +3 -0
  142. package/dist/esm/provider/app.js +124 -151
  143. package/dist/esm/provider/index.js +2 -0
  144. package/dist/esm/provider/tab.js +49 -66
  145. package/dist/esm/router/index.js +1 -0
  146. package/dist/esm/router/route.js +39 -46
  147. package/dist/esm/stores/auth.js +51 -46
  148. package/dist/esm/stores/i18n.js +32 -29
  149. package/dist/esm/stores/index.js +7 -0
  150. package/dist/esm/stores/jsonSchema.js +47 -34
  151. package/dist/esm/stores/manage.js +63 -48
  152. package/dist/esm/stores/route.js +60 -56
  153. package/dist/esm/stores/tab.js +55 -60
  154. package/dist/esm/stores/theme.js +48 -55
  155. package/dist/esm/utils/bus.js +3 -5
  156. package/dist/esm/utils/index.js +3 -0
  157. package/dist/esm/utils/theme.js +110 -93
  158. package/dist/esm/utils/tree.js +28 -37
  159. package/package.json +1 -1
@@ -1,152 +1,125 @@
1
- import { defineComponent as A, inject as S, createVNode as $ } from "vue";
2
- import { OverlaysProvider as k } from "@overlastic/vue";
3
- import { useRouter as M } from "vue-router";
4
- import { useCan as w } from "../hooks/auth.js";
5
- import { useConfig as z } from "../hooks/config.js";
6
- import "@tanstack/vue-query";
7
- import "lodash-es";
8
- import { useManage as D } from "../hooks/manage.js";
9
- import "json-2-csv";
10
- import "@vee-validate/rules";
11
- import "vee-validate";
12
- import { useAuthStore as C } from "../stores/auth.js";
13
- import { useI18nStore as E } from "../stores/i18n.js";
14
- import "pinia";
15
- import { useManageStore as I } from "../stores/manage.js";
16
- import { useRouteStore as N } from "../stores/route.js";
17
- import "@vueuse/core";
18
- import { initJsonSchemaComponents as x } from "../hooks/json.js";
19
- import "../hooks/json/index.js";
20
- import "../utils/bus.js";
21
- import "colorizr";
22
- import "axios";
23
- import "clsx";
24
- import { DuxError as F } from "../components/status/error.js";
25
- import { DuxNotAuthorized as L } from "../components/status/notAuthorized.js";
26
- import { DuxNotFound as _ } from "../components/status/notFound.js";
27
- const se = /* @__PURE__ */ A({
28
- name: "DuxAppProvider",
29
- props: {},
30
- setup(y, {
31
- slots: P
32
- }) {
33
- const f = S("dux.manage"), p = z(), c = M();
34
- return c.beforeEach(async (a, j, i) => {
35
- const e = a.meta.manageName, v = a.meta.authorization === !1;
36
- if (!e) {
37
- const t = p.defaultManage || p.manages?.[0]?.name || "";
38
- return i({
39
- path: `/${t}`,
40
- replace: !0
41
- });
42
- }
43
- f && (f.value = e);
44
- const h = I(e);
45
- h.isInit() || h.setConfig(p.manages?.find((t) => t.name === e), p);
46
- const m = N(e), o = D(e), s = C(e), d = E(e);
47
- if (o.config?.i18nProvider && !d.isInit()) {
48
- const t = d.getLocale();
49
- t && o.config?.i18nProvider.changeLocale(t);
50
- }
51
- if (x(p, e), !s.isLogin())
52
- return v ? i() : i({
53
- path: o.getRoutePath("login"),
54
- replace: !0
55
- });
56
- const l = (t) => t?.map((u) => ({
57
- ...u,
58
- path: u.path ? o.getRoutePath(u.path) : void 0
59
- }));
60
- if (!m.getRouteInit()) {
61
- const t = o.config?.components || {}, u = [];
62
- return u.push({
63
- name: `${e}.notFound`,
64
- label: "404",
65
- path: ":pathMatch(.*)*",
66
- component: t.notFound || _,
67
- hidden: !0,
68
- meta: {
69
- can: !1
70
- }
71
- }), u.push({
72
- name: `${e}.notAuthorized`,
73
- label: "403",
74
- path: "notAuthorized",
75
- component: t.notAuthorized || L,
76
- hidden: !0,
77
- meta: {
78
- can: !1
79
- }
80
- }), u.push({
81
- name: `${e}.error`,
82
- label: "500",
83
- path: "error",
84
- component: t.error || F,
85
- hidden: !0,
86
- meta: {
87
- can: !1
88
- }
89
- }), m.setRoutes(l(o.config?.menus || [])), o.config?.apiRoutePath && await o.config?.dataProvider?.default?.custom({
90
- path: o.config.apiRoutePath,
91
- meta: {
92
- timeout: 5e3
93
- }
94
- }, o, s.getUser()).then((r) => {
95
- m.appendRoutes(l(r.data || []));
96
- }).catch((r) => {
97
- throw o.config?.authProvider?.onError?.(r).then((n) => {
98
- n?.logout && (s.logout(), c.push(o.getRoutePath(n.redirectTo || "/login")));
99
- }), r;
100
- }), m.appendRoutes(u), m.getRoutes().forEach((r) => {
101
- if (!r.path)
102
- return;
103
- const n = {
104
- name: r.name,
105
- path: r.path,
106
- meta: r.meta
107
- };
108
- switch (r.loader) {
109
- case "iframe":
110
- n.component = o.config?.components?.iframe || (() => import("../components/loader/iframe.js"));
111
- break;
112
- case "remote":
113
- n.component = o.config?.components?.remote || (() => import("../components/loader/loader.js"));
114
- break;
115
- case "link":
116
- n.beforeEnter = () => {
117
- const R = r.meta?.url || r.path;
118
- return R && window.open(R, "_blank"), !1;
119
- }, n.component = () => Promise.resolve({
120
- template: "<div></div>"
121
- });
122
- break;
123
- default:
124
- r.component && (n.component = r.component);
125
- break;
126
- }
127
- c.addRoute(`${e}.auth`, n);
128
- }), i({
129
- path: a.redirectedFrom?.path || a.path,
130
- replace: !0
131
- });
132
- }
133
- const g = ["", "/", `/${e}`, `/${e}/`];
134
- if (g.includes(a.path)) {
135
- const t = m.getIndexRoute();
136
- return !t?.path || g.includes(t?.path) ? (console.warn("[Dux] index route not found, skip redirect"), i()) : i({
137
- path: t?.path || "/",
138
- replace: !0
139
- });
140
- }
141
- const b = w(e);
142
- return (a.meta?.can === void 0 || a.meta?.can === !0) && !b(a.name) ? i({
143
- name: `${e}.notAuthorized`
144
- }) : i();
145
- }), () => $(k, null, {
146
- default: () => [P.default?.()]
147
- });
148
- }
1
+ import { useAuthStore as e } from "../stores/auth.js";
2
+ import { useI18nStore as t } from "../stores/i18n.js";
3
+ import { useManageStore as n } from "../stores/manage.js";
4
+ import { useRouteStore as r } from "../stores/route.js";
5
+ import "../stores/index.js";
6
+ import { useManage as i } from "../hooks/manage.js";
7
+ import { useCan as a } from "../hooks/auth.js";
8
+ import { useConfig as o } from "../hooks/config.js";
9
+ import { initJsonSchemaComponents as s } from "../hooks/json.js";
10
+ import "../hooks/index.js";
11
+ import { DuxError as c } from "../components/status/error.js";
12
+ import { DuxNotAuthorized as l } from "../components/status/notAuthorized.js";
13
+ import { DuxNotFound as u } from "../components/status/notFound.js";
14
+ import "../components/index.js";
15
+ import { createVNode as d, defineComponent as f, inject as p } from "vue";
16
+ import { useRouter as m } from "vue-router";
17
+ import { OverlaysProvider as h } from "@overlastic/vue";
18
+ const g = /* @__PURE__ */ f({
19
+ name: "DuxAppProvider",
20
+ props: {},
21
+ setup(f, { slots: g }) {
22
+ let _ = p("dux.manage"), v = o(), y = m();
23
+ return y.beforeEach(async (o, d, f) => {
24
+ let p = o.meta.manageName, m = o.meta.authorization === !1;
25
+ if (!p) return f({
26
+ path: `/${v.defaultManage || v.manages?.[0]?.name || ""}`,
27
+ replace: !0
28
+ });
29
+ _ && (_.value = p);
30
+ let h = n(p);
31
+ h.isInit() || h.setConfig(v.manages?.find((e) => e.name === p), v);
32
+ let g = r(p), b = i(p), x = e(p), S = t(p);
33
+ if (b.config?.i18nProvider && !S.isInit()) {
34
+ let e = S.getLocale();
35
+ e && b.config?.i18nProvider.changeLocale(e);
36
+ }
37
+ if (s(v, p), !x.isLogin()) return m ? f() : f({
38
+ path: b.getRoutePath("login"),
39
+ replace: !0
40
+ });
41
+ let C = (e) => e?.map((e) => ({
42
+ ...e,
43
+ path: e.path ? b.getRoutePath(e.path) : void 0
44
+ }));
45
+ if (!g.getRouteInit()) {
46
+ let e = b.config?.components || {}, t = [];
47
+ return t.push({
48
+ name: `${p}.notFound`,
49
+ label: "404",
50
+ path: ":pathMatch(.*)*",
51
+ component: e.notFound || u,
52
+ hidden: !0,
53
+ meta: { can: !1 }
54
+ }), t.push({
55
+ name: `${p}.notAuthorized`,
56
+ label: "403",
57
+ path: "notAuthorized",
58
+ component: e.notAuthorized || l,
59
+ hidden: !0,
60
+ meta: { can: !1 }
61
+ }), t.push({
62
+ name: `${p}.error`,
63
+ label: "500",
64
+ path: "error",
65
+ component: e.error || c,
66
+ hidden: !0,
67
+ meta: { can: !1 }
68
+ }), g.setRoutes(C(b.config?.menus || [])), b.config?.apiRoutePath && await b.config?.dataProvider?.default?.custom({
69
+ path: b.config.apiRoutePath,
70
+ meta: { timeout: 5e3 }
71
+ }, b, x.getUser()).then((e) => {
72
+ g.appendRoutes(C(e.data || []));
73
+ }).catch((e) => {
74
+ throw b.config?.authProvider?.onError?.(e).then((e) => {
75
+ e?.logout && (x.logout(), y.push(b.getRoutePath(e.redirectTo || "/login")));
76
+ }), e;
77
+ }), g.appendRoutes(t), g.getRoutes().forEach((e) => {
78
+ if (!e.path) return;
79
+ let t = {
80
+ name: e.name,
81
+ path: e.path,
82
+ meta: e.meta
83
+ };
84
+ switch (e.loader) {
85
+ case "iframe":
86
+ t.component = b.config?.components?.iframe || (() => import("../components/loader/iframe.js"));
87
+ break;
88
+ case "remote":
89
+ t.component = b.config?.components?.remote || (() => import("../components/loader/loader.js"));
90
+ break;
91
+ case "link":
92
+ t.beforeEnter = () => {
93
+ let t = e.meta?.url || e.path;
94
+ return t && window.open(t, "_blank"), !1;
95
+ }, t.component = () => Promise.resolve({ template: "<div></div>" });
96
+ break;
97
+ default:
98
+ e.component && (t.component = e.component);
99
+ break;
100
+ }
101
+ y.addRoute(`${p}.auth`, t);
102
+ }), f({
103
+ path: o.redirectedFrom?.path || o.path,
104
+ replace: !0
105
+ });
106
+ }
107
+ let w = [
108
+ "",
109
+ "/",
110
+ `/${p}`,
111
+ `/${p}/`
112
+ ];
113
+ if (w.includes(o.path)) {
114
+ let e = g.getIndexRoute();
115
+ return !e?.path || w.includes(e?.path) ? (console.warn("[Dux] index route not found, skip redirect"), f()) : f({
116
+ path: e?.path || "/",
117
+ replace: !0
118
+ });
119
+ }
120
+ let T = a(p);
121
+ return (o.meta?.can === void 0 || o.meta?.can === !0) && !T(o.name) ? f({ name: `${p}.notAuthorized` }) : f();
122
+ }), () => d(h, null, { default: () => [g.default?.()] });
123
+ }
149
124
  });
150
- export {
151
- se as DuxAppProvider
152
- };
125
+ export { g as DuxAppProvider };
@@ -0,0 +1,2 @@
1
+ import "./app.js";
2
+ import "./tab.js";
@@ -1,67 +1,50 @@
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 "pinia";
4
- import "lodash-es";
5
- import { useRouteStore as R } from "../stores/route.js";
6
- import { useTabStore as w } from "../stores/tab.js";
7
- const k = /* @__PURE__ */ c({
8
- name: "DuxTabRouterView",
9
- props: {},
10
- setup() {
11
- const r = b(), u = w(), p = R(), n = /* @__PURE__ */ new Map(), i = (t, a) => {
12
- let e;
13
- const o = t;
14
- return n.has(o) ? e = n.get(o) : (e = {
15
- name: o,
16
- render() {
17
- return a;
18
- }
19
- }, n.set(o, e)), e;
20
- };
21
- u.$subscribe((t, a) => {
22
- n.forEach((e) => {
23
- a.tabs.some((o) => o.path === e.name) || n.delete(e.name);
24
- });
25
- });
26
- const s = p.getIndexRoute();
27
- return s && u.addTab({
28
- ...s,
29
- meta: {
30
- ...s.meta,
31
- lock: !0
32
- }
33
- }), d([r, () => p.routes], () => {
34
- const t = p.searchRouteName(r.name);
35
- if (!t)
36
- return;
37
- const a = {
38
- label: t.label,
39
- path: r.path,
40
- name: t.name
41
- };
42
- u.addTab(a);
43
- }, {
44
- immediate: !0
45
- }), () => m(h, null, {
46
- default: ({
47
- Component: t
48
- }) => {
49
- const a = i(r.path, t);
50
- return m(l, {
51
- name: "tab-fade",
52
- mode: "out-in",
53
- appear: !0
54
- }, {
55
- default: () => [m(f, {
56
- include: u.tabs.map((e) => e.path || "")
57
- }, [m(a, {
58
- key: r.path
59
- }, null)])]
60
- });
61
- }
62
- });
63
- }
1
+ import { useRouteStore as e } from "../stores/route.js";
2
+ import { useTabStore as t } from "../stores/tab.js";
3
+ import "../stores/index.js";
4
+ import { KeepAlive as n, Transition as r, createVNode as i, defineComponent as a, watch as o } from "vue";
5
+ import { RouterView as s, useRoute as c } from "vue-router";
6
+ const l = /* @__PURE__ */ a({
7
+ name: "DuxTabRouterView",
8
+ props: {},
9
+ setup() {
10
+ let a = c(), l = t(), u = e(), d = /* @__PURE__ */ new Map(), f = (e, t) => {
11
+ let n, r = e;
12
+ return d.has(r) ? n = d.get(r) : (n = {
13
+ name: r,
14
+ render() {
15
+ return t;
16
+ }
17
+ }, d.set(r, n)), n;
18
+ };
19
+ l.$subscribe((e, t) => {
20
+ d.forEach((e) => {
21
+ t.tabs.some((t) => t.path === e.name) || d.delete(e.name);
22
+ });
23
+ });
24
+ let p = u.getIndexRoute();
25
+ return p && l.addTab({
26
+ ...p,
27
+ meta: {
28
+ ...p.meta,
29
+ lock: !0
30
+ }
31
+ }), o([a, () => u.routes], () => {
32
+ let e = u.searchRouteName(a.name);
33
+ if (!e) return;
34
+ let t = {
35
+ label: e.label,
36
+ path: a.path,
37
+ name: e.name
38
+ };
39
+ l.addTab(t);
40
+ }, { immediate: !0 }), () => i(s, null, { default: ({ Component: e }) => {
41
+ let t = f(a.path, e);
42
+ return i(r, {
43
+ name: "tab-fade",
44
+ mode: "out-in",
45
+ appear: !0
46
+ }, { default: () => [i(n, { include: l.tabs.map((e) => e.path || "") }, [i(t, { key: a.path }, null)])] });
47
+ } });
48
+ }
64
49
  });
65
- export {
66
- k as DuxTabRouterView
67
- };
50
+ export { l as DuxTabRouterView };
@@ -0,0 +1 @@
1
+ import "./route.js";
@@ -1,47 +1,40 @@
1
- import { createRouter as h, createWebHashHistory as u } from "vue-router";
2
- function s(e) {
3
- const a = [
4
- ...e.routes || [],
5
- {
6
- name: "default",
7
- path: "/:catchAll(.*)",
8
- redirect: `/${e.defaultManage || e.manages?.[0]?.name || ""}`
9
- }
10
- ];
11
- return e.manages?.forEach((t) => {
12
- const n = t.routes?.filter((o) => o.meta?.authorization === !0 || o.meta?.authorization === void 0) || [], r = t.routes?.filter((o) => o.meta?.authorization === !1) || [];
13
- a.push({
14
- name: t.name,
15
- path: t.routePrefix || "",
16
- children: [
17
- {
18
- path: "",
19
- name: `${t.name}.auth`,
20
- component: t.components?.authLayout,
21
- children: n
22
- },
23
- {
24
- path: "",
25
- name: `${t.name}.noAuth`,
26
- component: t.components?.noAuthLayout,
27
- children: r
28
- },
29
- {
30
- path: ":pathMatch(.*)*",
31
- name: `${t.name}.placeholder`,
32
- component: t.components?.authLayout,
33
- children: []
34
- }
35
- ],
36
- meta: {
37
- manageName: t.name
38
- }
39
- });
40
- }), h({
41
- history: u(),
42
- routes: a
43
- });
1
+ import { createRouter as e, createWebHashHistory as t } from "vue-router";
2
+ function n(n) {
3
+ let r = [...n.routes || [], {
4
+ name: "default",
5
+ path: "/:catchAll(.*)",
6
+ redirect: `/${n.defaultManage || n.manages?.[0]?.name || ""}`
7
+ }];
8
+ return n.manages?.forEach((e) => {
9
+ let t = e.routes?.filter((e) => e.meta?.authorization === !0 || e.meta?.authorization === void 0) || [], n = e.routes?.filter((e) => e.meta?.authorization === !1) || [];
10
+ r.push({
11
+ name: e.name,
12
+ path: e.routePrefix || "",
13
+ children: [
14
+ {
15
+ path: "",
16
+ name: `${e.name}.auth`,
17
+ component: e.components?.authLayout,
18
+ children: t
19
+ },
20
+ {
21
+ path: "",
22
+ name: `${e.name}.noAuth`,
23
+ component: e.components?.noAuthLayout,
24
+ children: n
25
+ },
26
+ {
27
+ path: ":pathMatch(.*)*",
28
+ name: `${e.name}.placeholder`,
29
+ component: e.components?.authLayout,
30
+ children: []
31
+ }
32
+ ],
33
+ meta: { manageName: e.name }
34
+ });
35
+ }), e({
36
+ history: t(),
37
+ routes: r
38
+ });
44
39
  }
45
- export {
46
- s as initRouter
47
- };
40
+ export { n as initRouter };
@@ -1,48 +1,53 @@
1
- import { defineStore as u } from "pinia";
2
- import { inject as r, ref as s } from "vue";
3
- function k(e) {
4
- const o = r("dux.manage");
5
- if (e || (e = o?.value || ""), !e)
6
- throw new Error("manage not found");
7
- return c(e)();
1
+ import { inject as e, ref as t } from "vue";
2
+ import { defineStore as n } from "pinia";
3
+ /**
4
+ * use auth store
5
+ * @param manageName manage name
6
+ * @returns auth store
7
+ */
8
+ function r(t) {
9
+ let n = e("dux.manage");
10
+ if (t ||= n?.value || "", !t) throw Error("manage not found");
11
+ return i(t)();
8
12
  }
9
- function c(e) {
10
- return u(`auths-${e}`, () => {
11
- const o = s();
12
- return {
13
- data: o,
14
- getUser: () => o.value || {},
15
- login: (t) => {
16
- o.value = {
17
- token: t?.token,
18
- id: t?.id,
19
- info: t?.info,
20
- permission: t?.permission
21
- };
22
- },
23
- isLogin: () => !!o.value?.token,
24
- logout: () => {
25
- o.value = void 0;
26
- },
27
- update: (t) => {
28
- o.value = {
29
- token: t?.token,
30
- id: t?.id,
31
- info: t?.info,
32
- permission: t?.permission
33
- };
34
- },
35
- updateKey: (t, i) => {
36
- o.value = {
37
- ...o.value,
38
- [t]: i
39
- };
40
- }
41
- };
42
- }, {
43
- persist: !0
44
- });
13
+ /**
14
+ * create auth store
15
+ * @param manageName manage name
16
+ * @returns auth store
17
+ */
18
+ function i(e) {
19
+ return n(`auths-${e}`, () => {
20
+ let e = t();
21
+ return {
22
+ data: e,
23
+ getUser: () => e.value || {},
24
+ login: (t) => {
25
+ e.value = {
26
+ token: t?.token,
27
+ id: t?.id,
28
+ info: t?.info,
29
+ permission: t?.permission
30
+ };
31
+ },
32
+ isLogin: () => !!e.value?.token,
33
+ logout: () => {
34
+ e.value = void 0;
35
+ },
36
+ update: (t) => {
37
+ e.value = {
38
+ token: t?.token,
39
+ id: t?.id,
40
+ info: t?.info,
41
+ permission: t?.permission
42
+ };
43
+ },
44
+ updateKey: (t, n) => {
45
+ e.value = {
46
+ ...e.value,
47
+ [t]: n
48
+ };
49
+ }
50
+ };
51
+ }, { persist: !0 });
45
52
  }
46
- export {
47
- k as useAuthStore
48
- };
53
+ export { r as useAuthStore };