@duxweb/dvha-core 1.0.23 → 1.0.25

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 (85) hide show
  1. package/dist/cjs/components/auth/can.cjs +1 -1
  2. package/dist/cjs/components/loader/iframe.cjs +1 -1
  3. package/dist/cjs/components/loader/remote/loader.cjs +1 -1
  4. package/dist/cjs/components/loader/remote/render.cjs +1 -1
  5. package/dist/cjs/components/overlay/overlay.cjs +1 -1
  6. package/dist/cjs/components/status/exception.cjs +1 -1
  7. package/dist/cjs/directive/permission.cjs +1 -1
  8. package/dist/cjs/hooks/auth.cjs +1 -1
  9. package/dist/cjs/hooks/data.cjs +1 -1
  10. package/dist/cjs/hooks/export.cjs +1 -1
  11. package/dist/cjs/hooks/exportCsv.cjs +2 -2
  12. package/dist/cjs/hooks/form.cjs +1 -1
  13. package/dist/cjs/hooks/formExtend.cjs +1 -1
  14. package/dist/cjs/hooks/i18n.cjs +1 -1
  15. package/dist/cjs/hooks/import.cjs +1 -1
  16. package/dist/cjs/hooks/importCsv.cjs +2 -2
  17. package/dist/cjs/hooks/json/utils/expressionParser.cjs +1 -1
  18. package/dist/cjs/hooks/json/vFor.cjs +1 -1
  19. package/dist/cjs/hooks/json/vOn.cjs +1 -1
  20. package/dist/cjs/hooks/json/vShow.cjs +1 -1
  21. package/dist/cjs/hooks/json.cjs +1 -1
  22. package/dist/cjs/hooks/list.cjs +1 -1
  23. package/dist/cjs/hooks/manage.cjs +1 -1
  24. package/dist/cjs/hooks/menu.cjs +1 -1
  25. package/dist/cjs/hooks/select.cjs +1 -1
  26. package/dist/cjs/hooks/theme.cjs +3 -3
  27. package/dist/cjs/hooks/tree.cjs +1 -1
  28. package/dist/cjs/hooks/upload/s3.cjs +1 -1
  29. package/dist/cjs/hooks/upload.cjs +1 -1
  30. package/dist/cjs/preset/authProvider.cjs +1 -1
  31. package/dist/cjs/preset/dataProvider.cjs +1 -1
  32. package/dist/cjs/preset/i18nProvider.cjs +1 -1
  33. package/dist/cjs/provider/app.cjs +1 -1
  34. package/dist/cjs/router/route.cjs +1 -1
  35. package/dist/cjs/stores/auth.cjs +1 -1
  36. package/dist/cjs/stores/i18n.cjs +1 -1
  37. package/dist/cjs/stores/jsonSchema.cjs +1 -1
  38. package/dist/cjs/stores/manage.cjs +1 -1
  39. package/dist/cjs/stores/route.cjs +1 -1
  40. package/dist/cjs/stores/tab.cjs +1 -1
  41. package/dist/cjs/stores/theme.cjs +1 -1
  42. package/dist/cjs/utils/tree.cjs +1 -1
  43. package/dist/esm/components/auth/can.js +8 -11
  44. package/dist/esm/components/loader/iframe.js +14 -17
  45. package/dist/esm/components/loader/remote/loader.js +103 -105
  46. package/dist/esm/components/loader/remote/render.js +10 -11
  47. package/dist/esm/components/overlay/overlay.js +7 -7
  48. package/dist/esm/components/status/exception.js +10 -13
  49. package/dist/esm/directive/permission.js +6 -7
  50. package/dist/esm/hooks/auth.js +73 -83
  51. package/dist/esm/hooks/data.js +290 -345
  52. package/dist/esm/hooks/export.js +16 -17
  53. package/dist/esm/hooks/exportCsv.js +26 -27
  54. package/dist/esm/hooks/form.js +49 -54
  55. package/dist/esm/hooks/formExtend.js +24 -25
  56. package/dist/esm/hooks/i18n.js +11 -29
  57. package/dist/esm/hooks/import.js +31 -32
  58. package/dist/esm/hooks/importCsv.js +24 -25
  59. package/dist/esm/hooks/json/utils/expressionParser.js +36 -42
  60. package/dist/esm/hooks/json/vFor.js +15 -16
  61. package/dist/esm/hooks/json/vOn.js +17 -18
  62. package/dist/esm/hooks/json/vShow.js +9 -10
  63. package/dist/esm/hooks/json.js +88 -94
  64. package/dist/esm/hooks/list.js +100 -127
  65. package/dist/esm/hooks/manage.js +13 -17
  66. package/dist/esm/hooks/menu.js +39 -52
  67. package/dist/esm/hooks/select.js +35 -40
  68. package/dist/esm/hooks/theme.js +127 -141
  69. package/dist/esm/hooks/tree.js +22 -28
  70. package/dist/esm/hooks/upload/s3.js +22 -23
  71. package/dist/esm/hooks/upload.js +152 -159
  72. package/dist/esm/preset/authProvider.js +63 -117
  73. package/dist/esm/preset/dataProvider.js +69 -76
  74. package/dist/esm/preset/i18nProvider.js +18 -18
  75. package/dist/esm/provider/app.js +74 -81
  76. package/dist/esm/router/route.js +16 -24
  77. package/dist/esm/stores/auth.js +17 -20
  78. package/dist/esm/stores/i18n.js +10 -10
  79. package/dist/esm/stores/jsonSchema.js +20 -23
  80. package/dist/esm/stores/manage.js +33 -33
  81. package/dist/esm/stores/route.js +38 -50
  82. package/dist/esm/stores/tab.js +38 -54
  83. package/dist/esm/stores/theme.js +28 -29
  84. package/dist/esm/utils/tree.js +23 -24
  85. package/package.json +1 -1
@@ -1,102 +1,102 @@
1
- import k from "axios";
2
- import { trim as i } from "lodash-es";
3
- function z(c) {
4
- const d = (a, t) => {
5
- const l = `${i(c.apiUrl, "/")}${t ? `/${i(t, "/")}` : ""}`;
6
- return a ? `${l}/${i(a || "", "/")}` : l;
1
+ import d from "axios";
2
+ import { trim as b } from "lodash-es";
3
+ function i(t) {
4
+ const h = (a, c) => {
5
+ const l = `${b(t.apiUrl, "/")}${c ? `/${b(c, "/")}` : ""}`;
6
+ return a ? `${l}/${b(a || "", "/")}` : l;
7
7
  };
8
8
  return {
9
- apiUrl: d,
10
- getList: (a, t, l) => {
9
+ apiUrl: h,
10
+ getList: (a, c, l) => {
11
11
  const e = {};
12
- return a.pagination && typeof a.pagination == "object" && (e.page = a.pagination.page, e.pageSize = a.pagination.pageSize), k.get(d(a.path, t == null ? void 0 : t.config.apiBasePath) || "", {
12
+ return a.pagination && typeof a.pagination == "object" && (e.page = a.pagination.page, e.pageSize = a.pagination.pageSize), d.get(h(a.path, c?.config.apiBasePath) || "", {
13
13
  params: {
14
14
  ...e,
15
15
  ...a.filters,
16
16
  ...a.sorters
17
17
  },
18
18
  headers: {
19
- Authorization: l == null ? void 0 : l.token
19
+ Authorization: l?.token
20
20
  },
21
21
  ...a.meta
22
- }).then((r) => c.successCallback ? c.successCallback(r) : b(r)).catch((r) => {
23
- throw c.errorCallback ? c.errorCallback(r) : C(r);
22
+ }).then((r) => t.successCallback ? t.successCallback(r) : u(r)).catch((r) => {
23
+ throw t.errorCallback ? t.errorCallback(r) : n(r);
24
24
  });
25
25
  },
26
- create: (a, t, l) => k.post(d(a.path, t == null ? void 0 : t.config.apiBasePath) || "", a.data, {
26
+ create: (a, c, l) => d.post(h(a.path, c?.config.apiBasePath) || "", a.data, {
27
27
  headers: {
28
- Authorization: l == null ? void 0 : l.token
28
+ Authorization: l?.token
29
29
  },
30
30
  ...a.meta
31
- }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
32
- throw c.errorCallback ? c.errorCallback(e) : C(e);
31
+ }).then((e) => t.successCallback ? t.successCallback(e) : u(e)).catch((e) => {
32
+ throw t.errorCallback ? t.errorCallback(e) : n(e);
33
33
  }),
34
- update: (a, t, l) => k.put(d(a.id ? `${a.path}/${a.id}` : a.path, t == null ? void 0 : t.config.apiBasePath) || "", a.data, {
34
+ update: (a, c, l) => d.put(h(a.id ? `${a.path}/${a.id}` : a.path, c?.config.apiBasePath) || "", a.data, {
35
35
  headers: {
36
- Authorization: l == null ? void 0 : l.token
36
+ Authorization: l?.token
37
37
  },
38
38
  ...a.meta
39
- }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
40
- throw c.errorCallback ? c.errorCallback(e) : C(e);
39
+ }).then((e) => t.successCallback ? t.successCallback(e) : u(e)).catch((e) => {
40
+ throw t.errorCallback ? t.errorCallback(e) : n(e);
41
41
  }),
42
- deleteOne: (a, t, l) => k.delete(d(a.id ? `${a.path}/${a.id}` : a.path, t == null ? void 0 : t.config.apiBasePath) || "", {
42
+ deleteOne: (a, c, l) => d.delete(h(a.id ? `${a.path}/${a.id}` : a.path, c?.config.apiBasePath) || "", {
43
43
  headers: {
44
- Authorization: l == null ? void 0 : l.token
44
+ Authorization: l?.token
45
45
  },
46
46
  ...a.meta
47
- }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
48
- throw c.errorCallback ? c.errorCallback(e) : C(e);
47
+ }).then((e) => t.successCallback ? t.successCallback(e) : u(e)).catch((e) => {
48
+ throw t.errorCallback ? t.errorCallback(e) : n(e);
49
49
  }),
50
- getOne: (a, t, l) => k.get(d(a.id ? `${a.path}/${a.id}` : a.path, t == null ? void 0 : t.config.apiBasePath) || "", {
50
+ getOne: (a, c, l) => d.get(h(a.id ? `${a.path}/${a.id}` : a.path, c?.config.apiBasePath) || "", {
51
51
  headers: {
52
- Authorization: l == null ? void 0 : l.token
52
+ Authorization: l?.token
53
53
  },
54
54
  ...a.meta
55
- }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
56
- throw c.errorCallback ? c.errorCallback(e) : C(e);
55
+ }).then((e) => t.successCallback ? t.successCallback(e) : u(e)).catch((e) => {
56
+ throw t.errorCallback ? t.errorCallback(e) : n(e);
57
57
  }),
58
- getMany: (a, t, l) => k.get(d(a.path, t == null ? void 0 : t.config.apiBasePath) || "", {
58
+ getMany: (a, c, l) => d.get(h(a.path, c?.config.apiBasePath) || "", {
59
59
  params: {
60
60
  ids: a.ids
61
61
  },
62
62
  headers: {
63
- Authorization: l == null ? void 0 : l.token
63
+ Authorization: l?.token
64
64
  },
65
65
  ...a.meta
66
- }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
67
- throw c.errorCallback ? c.errorCallback(e) : C(e);
66
+ }).then((e) => t.successCallback ? t.successCallback(e) : u(e)).catch((e) => {
67
+ throw t.errorCallback ? t.errorCallback(e) : n(e);
68
68
  }),
69
- createMany: (a, t, l) => k.post(d(a.path, t == null ? void 0 : t.config.apiBasePath) || "", a.data, {
69
+ createMany: (a, c, l) => d.post(h(a.path, c?.config.apiBasePath) || "", a.data, {
70
70
  headers: {
71
- Authorization: l == null ? void 0 : l.token
71
+ Authorization: l?.token
72
72
  },
73
73
  ...a.meta
74
- }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
75
- throw c.errorCallback ? c.errorCallback(e) : C(e);
74
+ }).then((e) => t.successCallback ? t.successCallback(e) : u(e)).catch((e) => {
75
+ throw t.errorCallback ? t.errorCallback(e) : n(e);
76
76
  }),
77
- updateMany: (a, t, l) => k.put(d(a.path, t == null ? void 0 : t.config.apiBasePath) || "", {
77
+ updateMany: (a, c, l) => d.put(h(a.path, c?.config.apiBasePath) || "", {
78
78
  ids: a.ids,
79
79
  data: a.data
80
80
  }, {
81
81
  headers: {
82
- Authorization: l == null ? void 0 : l.token
82
+ Authorization: l?.token
83
83
  },
84
84
  ...a.meta
85
- }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
86
- throw c.errorCallback ? c.errorCallback(e) : C(e);
85
+ }).then((e) => t.successCallback ? t.successCallback(e) : u(e)).catch((e) => {
86
+ throw t.errorCallback ? t.errorCallback(e) : n(e);
87
87
  }),
88
- deleteMany: (a, t, l) => k.delete(d(a.path, t == null ? void 0 : t.config.apiBasePath) || "", {
88
+ deleteMany: (a, c, l) => d.delete(h(a.path, c?.config.apiBasePath) || "", {
89
89
  params: {
90
90
  ids: a.ids
91
91
  },
92
92
  headers: {
93
- Authorization: l == null ? void 0 : l.token
93
+ Authorization: l?.token
94
94
  },
95
95
  ...a.meta
96
- }).then((e) => c.successCallback ? c.successCallback(e) : b(e)).catch((e) => {
97
- throw c.errorCallback ? c.errorCallback(e) : C(e);
96
+ }).then((e) => t.successCallback ? t.successCallback(e) : u(e)).catch((e) => {
97
+ throw t.errorCallback ? t.errorCallback(e) : n(e);
98
98
  }),
99
- custom: (a, t, l) => {
99
+ custom: (a, c, l) => {
100
100
  let e = {
101
101
  ...a.query
102
102
  };
@@ -106,64 +106,57 @@ function z(c) {
106
106
  }), a.filters && typeof a.filters == "object" && (e = {
107
107
  ...e,
108
108
  ...a.filters
109
- }), k.request({
110
- url: d(a.path, t == null ? void 0 : t.config.apiBasePath) || "",
109
+ }), d.request({
110
+ url: h(a.path, c?.config.apiBasePath) || "",
111
111
  method: a.method || "GET",
112
112
  data: a.payload,
113
113
  params: e,
114
114
  signal: a.signal,
115
115
  headers: {
116
- Authorization: l == null ? void 0 : l.token,
116
+ Authorization: l?.token,
117
117
  ...a.headers
118
118
  },
119
119
  onUploadProgress: (r) => {
120
- var h;
121
- const s = Math.round(r.loaded * 100 / (r.total || 1));
122
- (h = a.onUploadProgress) == null || h.call(a, {
120
+ const k = Math.round(r.loaded * 100 / (r.total || 1));
121
+ a.onUploadProgress?.({
123
122
  loaded: r.loaded,
124
123
  total: r.total,
125
- percent: s
124
+ percent: k
126
125
  });
127
126
  },
128
127
  onDownloadProgress: (r) => {
129
- var h;
130
- const s = Math.round(r.loaded * 100 / (r.total || 1));
131
- (h = a.onDownloadProgress) == null || h.call(a, {
128
+ const k = Math.round(r.loaded * 100 / (r.total || 1));
129
+ a.onDownloadProgress?.({
132
130
  loaded: r.loaded,
133
131
  total: r.total,
134
- percent: s
132
+ percent: k
135
133
  });
136
134
  },
137
135
  ...a.meta
138
- }).then((r) => c.successCallback ? c.successCallback(r) : b(r)).catch((r) => {
139
- throw c.errorCallback ? c.errorCallback(r) : C(r);
136
+ }).then((r) => t.successCallback ? t.successCallback(r) : u(r)).catch((r) => {
137
+ throw t.errorCallback ? t.errorCallback(r) : n(r);
140
138
  });
141
139
  },
142
- getTotal: (a) => {
143
- var t;
144
- return c.getTotal ? c.getTotal(a) : ((t = a.meta) == null ? void 0 : t.total) || 0;
145
- }
140
+ getTotal: (a) => t.getTotal ? t.getTotal(a) : a.meta?.total || 0
146
141
  };
147
142
  }
148
- function b(c) {
149
- var d, a, t;
143
+ function u(t) {
150
144
  return {
151
- message: (d = c.data) == null ? void 0 : d.message,
152
- data: (a = c.data) == null ? void 0 : a.data,
153
- meta: (t = c.data) == null ? void 0 : t.meta,
154
- raw: c.data
145
+ message: t.data?.message,
146
+ data: t.data?.data,
147
+ meta: t.data?.meta,
148
+ raw: t.data
155
149
  };
156
150
  }
157
- function C(c) {
158
- var d, a, t, l, e, r, s, h, u, f;
151
+ function n(t) {
159
152
  return {
160
- message: ((a = (d = c.response) == null ? void 0 : d.data) == null ? void 0 : a.message) || (c == null ? void 0 : c.message),
161
- data: (l = (t = c.response) == null ? void 0 : t.data) == null ? void 0 : l.data,
162
- meta: (r = (e = c.response) == null ? void 0 : e.data) == null ? void 0 : r.meta,
163
- status: ((h = (s = c.response) == null ? void 0 : s.data) == null ? void 0 : h.code) || ((u = c.response) == null ? void 0 : u.status) || 500,
164
- raw: (f = c.response) == null ? void 0 : f.data
153
+ message: t.response?.data?.message || t?.message,
154
+ data: t.response?.data?.data,
155
+ meta: t.response?.data?.meta,
156
+ status: t.response?.data?.code || t.response?.status || 500,
157
+ raw: t.response?.data
165
158
  };
166
159
  }
167
160
  export {
168
- z as simpleDataProvider
161
+ i as simpleDataProvider
169
162
  };
@@ -1,31 +1,31 @@
1
- import { createI18n as o } from "vue-i18n";
2
- function r(l) {
3
- const a = o({
1
+ import { createI18n as s } from "vue-i18n";
2
+ function t(r) {
3
+ const l = s({
4
4
  legacy: !1,
5
- locale: l == null ? void 0 : l.locale,
6
- fallbackLocale: l == null ? void 0 : l.fallbackLocale,
7
- messages: l == null ? void 0 : l.messages,
5
+ locale: r?.locale,
6
+ fallbackLocale: r?.fallbackLocale,
7
+ messages: r?.messages,
8
8
  missingWarn: !1,
9
9
  fallbackWarn: !1
10
10
  });
11
11
  return {
12
- t: (e, c, n) => {
13
- const t = a.global.t(e, c);
14
- return t === e && n ? n : t;
12
+ t: (e, a, o) => {
13
+ const c = l.global.t(e, a);
14
+ return c === e && o ? o : c;
15
15
  },
16
- changeLocale: (e, c) => new Promise((n) => {
17
- a.global.locale.value = e, n(e);
16
+ changeLocale: (e, a) => new Promise((o) => {
17
+ l.global.locale.value = e, o(e);
18
18
  }),
19
- loadLocale: (e, c) => new Promise((n) => {
20
- a.global.setLocaleMessage(e, c), n(e);
19
+ loadLocale: (e, a) => new Promise((o) => {
20
+ l.global.setLocaleMessage(e, a), o(e);
21
21
  }),
22
- mergeLocale: (e, c) => {
23
- a.global.mergeLocaleMessage(e, c);
22
+ mergeLocale: (e, a) => {
23
+ l.global.mergeLocaleMessage(e, a);
24
24
  },
25
- getLocale: () => a.global.locale.value,
26
- getLocales: () => a.global.availableLocales.map((e) => e)
25
+ getLocale: () => l.global.locale.value,
26
+ getLocales: () => l.global.availableLocales.map((e) => e)
27
27
  };
28
28
  }
29
29
  export {
30
- r as i18nProvider
30
+ t as i18nProvider
31
31
  };
@@ -1,159 +1,152 @@
1
- import { defineComponent as T, inject as U, createVNode as V } from "vue";
2
- import { OverlaysProvider as q } from "@overlastic/vue";
3
- import { useRouter as B } from "vue-router";
4
- import { useCan as G } from "../hooks/auth.js";
5
- import { useConfig as H } from "../hooks/config.js";
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
6
  import "@tanstack/vue-query";
7
- import { useManage as K } from "../hooks/manage.js";
7
+ import { useManage as D } from "../hooks/manage.js";
8
8
  import "json-2-csv";
9
9
  import "lodash-es";
10
10
  import "@vee-validate/rules";
11
11
  import "vee-validate";
12
- import { useAuthStore as Q } from "../stores/auth.js";
13
- import { useI18nStore as W } from "../stores/i18n.js";
12
+ import { useAuthStore as C } from "../stores/auth.js";
13
+ import { useI18nStore as E } from "../stores/i18n.js";
14
14
  import "pinia";
15
- import { useManageStore as X } from "../stores/manage.js";
16
- import { useRouteStore as Y } from "../stores/route.js";
15
+ import { useManageStore as I } from "../stores/manage.js";
16
+ import { useRouteStore as N } from "../stores/route.js";
17
17
  import "@vueuse/core";
18
- import { initJsonSchemaComponents as Z } from "../hooks/json.js";
18
+ import { initJsonSchemaComponents as x } from "../hooks/json.js";
19
19
  import "../hooks/json/index.js";
20
20
  import "../utils/bus.js";
21
21
  import "colorizr";
22
22
  import "axios";
23
23
  import "clsx";
24
- import { DuxError as x } from "../components/status/error.js";
25
- import { DuxNotAuthorized as tt } from "../components/status/notAuthorized.js";
26
- import { DuxNotFound as ot } from "../components/status/notFound.js";
27
- const Et = /* @__PURE__ */ T({
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
28
  name: "DuxAppProvider",
29
29
  props: {},
30
- setup(et, {
31
- slots: h
30
+ setup(y, {
31
+ slots: P
32
32
  }) {
33
- const l = U("dux.manage"), f = H(), d = B();
34
- return d.beforeEach(async (n, rt, i) => {
35
- var A, S, $, k, M, w, z, D, C, E, I, N, F, L;
36
- const o = n.meta.manageName, J = n.meta.authorization === !1;
37
- if (!o) {
38
- const t = f.defaultManage || ((S = (A = f.manages) == null ? void 0 : A[0]) == null ? void 0 : S.name) || "";
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 || "";
39
38
  return i({
40
39
  path: `/${t}`,
41
40
  replace: !0
42
41
  });
43
42
  }
44
- l && (l.value = o);
45
- const P = X(o);
46
- P.isInit() || P.setConfig(($ = f.manages) == null ? void 0 : $.find((t) => t.name === o), f);
47
- const c = Y(o), e = K(o), g = Q(o), v = W(o);
48
- if ((k = e.config) != null && k.i18nProvider && !v.isInit()) {
49
- const t = v.getLocale();
50
- t && ((M = e.config) == null || M.i18nProvider.changeLocale(t));
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);
51
50
  }
52
- if (Z(f, o), !g.isLogin())
53
- return J ? i() : i({
54
- path: e.getRoutePath("login"),
51
+ if (x(p, e), !s.isLogin())
52
+ return v ? i() : i({
53
+ path: o.getRoutePath("login"),
55
54
  replace: !0
56
55
  });
57
- const R = (t) => t == null ? void 0 : t.map((p) => ({
58
- ...p,
59
- path: p.path ? e.getRoutePath(p.path) : void 0
56
+ const l = (t) => t?.map((u) => ({
57
+ ...u,
58
+ path: u.path ? o.getRoutePath(u.path) : void 0
60
59
  }));
61
- if (!c.getRouteInit()) {
62
- const t = ((w = e.config) == null ? void 0 : w.components) || {}, p = [];
63
- return p.push({
64
- name: `${o}.notFound`,
60
+ if (!m.getRouteInit()) {
61
+ const t = o.config?.components || {}, u = [];
62
+ return u.push({
63
+ name: `${e}.notFound`,
65
64
  label: "404",
66
65
  path: ":pathMatch(.*)*",
67
- component: t.notFound || ot,
66
+ component: t.notFound || _,
68
67
  hidden: !0,
69
68
  meta: {
70
69
  can: !1
71
70
  }
72
- }), p.push({
73
- name: `${o}.notAuthorized`,
71
+ }), u.push({
72
+ name: `${e}.notAuthorized`,
74
73
  label: "403",
75
74
  path: "notAuthorized",
76
- component: t.notAuthorized || tt,
75
+ component: t.notAuthorized || L,
77
76
  hidden: !0,
78
77
  meta: {
79
78
  can: !1
80
79
  }
81
- }), p.push({
82
- name: `${o}.error`,
80
+ }), u.push({
81
+ name: `${e}.error`,
83
82
  label: "500",
84
83
  path: "error",
85
- component: t.error || x,
84
+ component: t.error || F,
86
85
  hidden: !0,
87
86
  meta: {
88
87
  can: !1
89
88
  }
90
- }), c.setRoutes(R(((z = e.config) == null ? void 0 : z.menus) || [])), (D = e.config) != null && D.apiRoutePath && await ((I = (E = (C = e.config) == null ? void 0 : C.dataProvider) == null ? void 0 : E.default) == null ? void 0 : I.custom({
91
- path: e.config.apiRoutePath,
89
+ }), m.setRoutes(l(o.config?.menus || [])), o.config?.apiRoutePath && await o.config?.dataProvider?.default?.custom({
90
+ path: o.config.apiRoutePath,
92
91
  meta: {
93
92
  timeout: 5e3
94
93
  }
95
- }, e, g.getUser()).then((r) => {
96
- c.appendRoutes(R(r.data || []));
94
+ }, o, s.getUser()).then((r) => {
95
+ m.appendRoutes(l(r.data || []));
97
96
  }).catch((r) => {
98
- var a, m, s;
99
- throw (s = (m = (a = e.config) == null ? void 0 : a.authProvider) == null ? void 0 : m.onError) == null || s.call(m, r).then((u) => {
100
- u != null && u.logout && (g.logout(), d.push(e.getRoutePath(u.redirectTo || "/login")));
97
+ throw o.config?.authProvider?.onError?.(r).then((n) => {
98
+ n?.logout && (s.logout(), c.push(o.getRoutePath(n.redirectTo || "/login")));
101
99
  }), r;
102
- })), c.appendRoutes(p), c.getRoutes().forEach((r) => {
103
- var m, s, u, _;
100
+ }), m.appendRoutes(u), m.getRoutes().forEach((r) => {
104
101
  if (!r.path)
105
102
  return;
106
- const a = {
103
+ const n = {
107
104
  name: r.name,
108
105
  path: r.path,
109
106
  meta: r.meta
110
107
  };
111
108
  switch (r.loader) {
112
109
  case "iframe":
113
- a.component = ((s = (m = e.config) == null ? void 0 : m.components) == null ? void 0 : s.iframe) || (() => import("../components/loader/iframe.js"));
110
+ n.component = o.config?.components?.iframe || (() => import("../components/loader/iframe.js"));
114
111
  break;
115
112
  case "remote":
116
- a.component = ((_ = (u = e.config) == null ? void 0 : u.components) == null ? void 0 : _.remote) || (() => import("../components/loader/loader.js"));
113
+ n.component = o.config?.components?.remote || (() => import("../components/loader/loader.js"));
117
114
  break;
118
115
  case "link":
119
- a.beforeEnter = () => {
120
- var j;
121
- const y = ((j = r.meta) == null ? void 0 : j.url) || r.path;
122
- return y && window.open(y, "_blank"), !1;
123
- }, a.component = () => Promise.resolve({
116
+ n.beforeEnter = () => {
117
+ const R = r.meta?.url || r.path;
118
+ return R && window.open(R, "_blank"), !1;
119
+ }, n.component = () => Promise.resolve({
124
120
  template: "<div></div>"
125
121
  });
126
122
  break;
127
123
  default:
128
- r.component && (a.component = r.component);
124
+ r.component && (n.component = r.component);
129
125
  break;
130
126
  }
131
- d.addRoute(`${o}.auth`, a);
127
+ c.addRoute(`${e}.auth`, n);
132
128
  }), i({
133
- path: ((N = n.redirectedFrom) == null ? void 0 : N.path) || n.path,
129
+ path: a.redirectedFrom?.path || a.path,
134
130
  replace: !0
135
131
  });
136
132
  }
137
- const b = ["", "/", `/${o}`, `/${o}/`];
138
- if (b.includes(n.path)) {
139
- const t = c.getIndexRoute();
140
- return !(t != null && t.path) || b.includes(t == null ? void 0 : t.path) ? (console.warn("[Dux] index route not found, skip redirect"), i()) : i({
141
- path: (t == null ? void 0 : t.path) || "/",
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 || "/",
142
138
  replace: !0
143
139
  });
144
140
  }
145
- const O = G(o);
146
- return (((F = n.meta) == null ? void 0 : F.can) === void 0 || ((L = n.meta) == null ? void 0 : L.can) === !0) && !O(n.name) ? i({
147
- name: `${o}.notAuthorized`
141
+ const b = w(e);
142
+ return (a.meta?.can === void 0 || a.meta?.can === !0) && !b(a.name) ? i({
143
+ name: `${e}.notAuthorized`
148
144
  }) : i();
149
- }), () => V(q, null, {
150
- default: () => {
151
- var n;
152
- return [(n = h.default) == null ? void 0 : n.call(h)];
153
- }
145
+ }), () => $(k, null, {
146
+ default: () => [P.default?.()]
154
147
  });
155
148
  }
156
149
  });
157
150
  export {
158
- Et as DuxAppProvider
151
+ se as DuxAppProvider
159
152
  };
@@ -1,49 +1,41 @@
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 || [],
1
+ import { createRouter as u, createWebHashHistory as h } from "vue-router";
2
+ function i(e) {
3
+ const a = [
4
+ ...e.routes || [],
6
5
  {
7
6
  name: "default",
8
7
  path: "/:catchAll(.*)",
9
- redirect: `/${o.defaultManage || ((u = (n = o.manages) == null ? void 0 : n[0]) == null ? void 0 : u.name) || ""}`
8
+ redirect: `/${e.defaultManage || e.manages?.[0]?.name || ""}`
10
9
  }
11
10
  ];
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({
11
+ return e.manages?.forEach((t) => {
12
+ const r = t.routes?.filter((o) => o.meta?.authorization === !0 || o.meta?.authorization === void 0) || [], n = t.routes?.filter((o) => o.meta?.authorization === !1) || [];
13
+ a.push({
22
14
  name: t.name,
23
15
  path: t.routePrefix || "",
24
16
  children: [
25
17
  {
26
18
  path: "",
27
19
  name: `${t.name}.auth`,
28
- component: (m = t.components) == null ? void 0 : m.authLayout,
29
- children: l
20
+ component: t.components?.authLayout,
21
+ children: r
30
22
  },
31
23
  {
32
24
  path: "",
33
25
  name: `${t.name}.noAuth`,
34
- component: (c = t.components) == null ? void 0 : c.noAuthLayout,
35
- children: d
26
+ component: t.components?.noAuthLayout,
27
+ children: n
36
28
  }
37
29
  ],
38
30
  meta: {
39
31
  manageName: t.name
40
32
  }
41
33
  });
42
- }), f({
43
- history: y(),
44
- routes: r
34
+ }), u({
35
+ history: h(),
36
+ routes: a
45
37
  });
46
38
  }
47
39
  export {
48
- R as initRouter
40
+ i as initRouter
49
41
  };