@duxweb/dvha-core 1.0.17 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/loader/loader.cjs +1 -1
- package/dist/cjs/components/loader/remote/loader.cjs +1 -1
- package/dist/cjs/hooks/auth.cjs +1 -1
- package/dist/cjs/hooks/data.cjs +1 -1
- package/dist/cjs/hooks/exportCsv.cjs +2 -2
- package/dist/cjs/hooks/form.cjs +1 -1
- package/dist/cjs/hooks/formExtend.cjs +1 -1
- package/dist/cjs/hooks/tree.cjs +1 -1
- package/dist/cjs/provider/app.cjs +1 -1
- package/dist/cjs/stores/jsonSchema.cjs +1 -1
- package/dist/cjs/stores/route.cjs +1 -1
- package/dist/esm/components/loader/loader.js +19 -30
- package/dist/esm/components/loader/remote/loader.js +22 -24
- package/dist/esm/hooks/auth.js +26 -24
- package/dist/esm/hooks/data.js +272 -258
- package/dist/esm/hooks/exportCsv.js +7 -7
- package/dist/esm/hooks/form.js +47 -37
- package/dist/esm/hooks/formExtend.js +11 -9
- package/dist/esm/hooks/tree.js +21 -27
- package/dist/esm/provider/app.js +76 -77
- package/dist/esm/stores/jsonSchema.js +22 -26
- package/dist/esm/stores/route.js +26 -23
- package/dist/types/hooks/auth.d.ts +1 -1
- package/dist/types/hooks/form.d.ts +4 -2
- package/dist/types/hooks/formExtend.d.ts +1 -1
- package/dist/types/types/config.d.ts +0 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { json2csv as v } from "json-2-csv";
|
|
2
2
|
import { computed as u } from "vue";
|
|
3
|
-
import { useExport as
|
|
3
|
+
import { useExport as y } from "./export.js";
|
|
4
4
|
function b(e) {
|
|
5
5
|
const d = u(() => {
|
|
6
6
|
const { filename: t, headers: r, csvOptions: s, ...c } = e;
|
|
@@ -19,10 +19,10 @@ function b(e) {
|
|
|
19
19
|
excelBOM: t.writeBOM || !1
|
|
20
20
|
};
|
|
21
21
|
});
|
|
22
|
-
return
|
|
22
|
+
return y({
|
|
23
23
|
...d.value,
|
|
24
24
|
onSuccess: async (t) => {
|
|
25
|
-
var s, c,
|
|
25
|
+
var s, c, i, a;
|
|
26
26
|
if (!(t != null && t.pages)) {
|
|
27
27
|
(s = e.onError) == null || s.call(e, {
|
|
28
28
|
message: "No data to export",
|
|
@@ -30,8 +30,8 @@ function b(e) {
|
|
|
30
30
|
});
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
const r = t.pages.flatMap((n) => (n == null ? void 0 : n.data)
|
|
34
|
-
if (r.length
|
|
33
|
+
const r = t.pages.flatMap((n) => Array.isArray(n == null ? void 0 : n.data) ? n.data : []);
|
|
34
|
+
if (!r || !(r != null && r.length)) {
|
|
35
35
|
(c = e.onError) == null || c.call(e, {
|
|
36
36
|
message: "No data to export",
|
|
37
37
|
status: 400
|
|
@@ -40,9 +40,9 @@ function b(e) {
|
|
|
40
40
|
}
|
|
41
41
|
try {
|
|
42
42
|
const n = await v(r, m.value), f = new Blob([n], { type: "text/csv;charset=utf-8;" }), l = URL.createObjectURL(f), o = document.createElement("a");
|
|
43
|
-
o.href = l, o.download = e.filename || "export.csv", o.style.display = "none", document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(l), (
|
|
43
|
+
o.href = l, o.download = e.filename || "export.csv", o.style.display = "none", document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(l), (i = e.onSuccess) == null || i.call(e, t);
|
|
44
44
|
} catch (n) {
|
|
45
|
-
(
|
|
45
|
+
(a = e.onError) == null || a.call(e, {
|
|
46
46
|
message: `CSV Export Error: ${n}`,
|
|
47
47
|
status: 500
|
|
48
48
|
});
|
package/dist/esm/hooks/form.js
CHANGED
|
@@ -1,44 +1,54 @@
|
|
|
1
|
-
import { cloneDeep as
|
|
2
|
-
import { toRef as
|
|
1
|
+
import { cloneDeep as v } from "lodash-es";
|
|
2
|
+
import { toRef as m, ref as s, computed as f, watch as E } from "vue";
|
|
3
3
|
import { useOne as L, useCreate as O, useUpdate as S } from "./data.js";
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
function x(e) {
|
|
5
|
+
const n = m(e, "form", {}), i = m(e, "id", void 0), c = s(v(n.value || {})), l = s(v(n.value || {})), u = f(() => e.action === "edit" || !!i.value), { data: g, isLoading: h, refetch: D } = L({
|
|
6
|
+
get path() {
|
|
7
|
+
return e.path || "";
|
|
8
|
+
},
|
|
9
|
+
get id() {
|
|
10
|
+
return i.value;
|
|
11
|
+
},
|
|
8
12
|
options: {
|
|
9
|
-
enabled:
|
|
13
|
+
enabled: u.value
|
|
10
14
|
},
|
|
11
15
|
providerName: e.providerName
|
|
12
|
-
})
|
|
13
|
-
|
|
16
|
+
}), d = () => {
|
|
17
|
+
let a = {};
|
|
18
|
+
u.value ? a = v(c.value) : a = v(l.value), Object.assign(n.value, a);
|
|
19
|
+
};
|
|
20
|
+
E([i, u], async () => {
|
|
14
21
|
var t;
|
|
15
|
-
if (!
|
|
22
|
+
if (!u.value) {
|
|
23
|
+
d();
|
|
16
24
|
return;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
}
|
|
26
|
+
await D();
|
|
27
|
+
const a = v(((t = g.value) == null ? void 0 : t.data) || {});
|
|
28
|
+
Object.assign(n.value, a), Object.assign(c.value, a);
|
|
20
29
|
}, {
|
|
21
30
|
immediate: !0
|
|
22
31
|
});
|
|
23
|
-
const
|
|
24
|
-
const a = c(n.value);
|
|
25
|
-
Object.assign(i.value, a);
|
|
26
|
-
}, u = O({
|
|
32
|
+
const o = O({
|
|
27
33
|
path: e.path ?? "",
|
|
28
|
-
data:
|
|
34
|
+
data: n.value,
|
|
29
35
|
onSuccess: (a) => {
|
|
30
36
|
var t;
|
|
31
|
-
(t = e.onSuccess) == null || t.call(e, a);
|
|
37
|
+
d(), (t = e.onSuccess) == null || t.call(e, a);
|
|
32
38
|
},
|
|
33
39
|
onError: (a) => {
|
|
34
40
|
var t;
|
|
35
41
|
(t = e.onError) == null || t.call(e, a);
|
|
36
42
|
},
|
|
37
43
|
providerName: e.providerName
|
|
38
|
-
}),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
}), r = S({
|
|
45
|
+
get path() {
|
|
46
|
+
return e.path ?? "";
|
|
47
|
+
},
|
|
48
|
+
get id() {
|
|
49
|
+
return i.value;
|
|
50
|
+
},
|
|
51
|
+
data: n.value,
|
|
42
52
|
onSuccess: (a) => {
|
|
43
53
|
var t;
|
|
44
54
|
(t = e.onSuccess) == null || t.call(e, a);
|
|
@@ -48,23 +58,23 @@ function w(e) {
|
|
|
48
58
|
(t = e.onError) == null || t.call(e, a);
|
|
49
59
|
},
|
|
50
60
|
providerName: e.providerName
|
|
51
|
-
}),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
data: a ||
|
|
61
|
+
}), N = (a) => {
|
|
62
|
+
u.value ? r.mutate({
|
|
63
|
+
id: i.value,
|
|
64
|
+
data: a || n.value
|
|
65
|
+
}) : o.mutate({
|
|
66
|
+
data: a || n.value
|
|
57
67
|
});
|
|
58
|
-
},
|
|
68
|
+
}, b = f(() => h.value || o.isLoading.value || r.isLoading.value);
|
|
59
69
|
return {
|
|
60
|
-
form:
|
|
61
|
-
initData:
|
|
62
|
-
isLoading:
|
|
63
|
-
isEdit:
|
|
64
|
-
onSubmit:
|
|
65
|
-
onReset:
|
|
70
|
+
form: n,
|
|
71
|
+
initData: u.value ? c.value : l.value,
|
|
72
|
+
isLoading: b,
|
|
73
|
+
isEdit: u,
|
|
74
|
+
onSubmit: N,
|
|
75
|
+
onReset: d
|
|
66
76
|
};
|
|
67
77
|
}
|
|
68
78
|
export {
|
|
69
|
-
|
|
79
|
+
x as useForm
|
|
70
80
|
};
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { toRef as d, computed as c } from "vue";
|
|
2
2
|
import { useForm as l } from "./form.js";
|
|
3
|
-
import { useValidateForm as
|
|
3
|
+
import { useValidateForm as v } from "./formValidate.js";
|
|
4
4
|
function F(t) {
|
|
5
|
-
const
|
|
6
|
-
data:
|
|
5
|
+
const o = d(t, "form", {}), { validate: m, reset: s } = v({
|
|
6
|
+
data: o,
|
|
7
7
|
rules: t.rules
|
|
8
8
|
}), u = c(() => {
|
|
9
|
-
const { form:
|
|
9
|
+
const { form: n, ...r } = t;
|
|
10
10
|
return {
|
|
11
|
-
...r
|
|
12
|
-
form: o
|
|
11
|
+
...r
|
|
13
12
|
};
|
|
14
|
-
}), e = l(
|
|
13
|
+
}), e = l({
|
|
14
|
+
...u.value,
|
|
15
|
+
form: o.value
|
|
16
|
+
}), a = (n) => {
|
|
15
17
|
m().then((r) => {
|
|
16
18
|
var i;
|
|
17
19
|
if (!r.valid) {
|
|
@@ -20,7 +22,7 @@ function F(t) {
|
|
|
20
22
|
});
|
|
21
23
|
return;
|
|
22
24
|
}
|
|
23
|
-
e.onSubmit(
|
|
25
|
+
e.onSubmit(n);
|
|
24
26
|
});
|
|
25
27
|
}, f = () => {
|
|
26
28
|
e.onReset(), s();
|
|
@@ -28,7 +30,7 @@ function F(t) {
|
|
|
28
30
|
return {
|
|
29
31
|
isLoading: e.isLoading,
|
|
30
32
|
isEdit: e.isEdit,
|
|
31
|
-
form:
|
|
33
|
+
form: o,
|
|
32
34
|
onSubmit: a,
|
|
33
35
|
onReset: f
|
|
34
36
|
};
|
package/dist/esm/hooks/tree.js
CHANGED
|
@@ -1,42 +1,36 @@
|
|
|
1
|
-
import { computed as a } from "vue";
|
|
1
|
+
import { toRef as o, computed as a } from "vue";
|
|
2
2
|
import "../utils/bus.js";
|
|
3
|
-
import { arrayToTree as
|
|
4
|
-
import { useList as
|
|
5
|
-
function
|
|
6
|
-
const { data:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
get providerName() {
|
|
14
|
-
return e.providerName;
|
|
15
|
-
}
|
|
16
|
-
}), d = a(() => {
|
|
17
|
-
var r, n, i, t, l, s;
|
|
18
|
-
return e.converTree ? m(((n = o.value) == null ? void 0 : n.data) || [], {
|
|
3
|
+
import { arrayToTree as K, treeToArr as f } from "../utils/tree.js";
|
|
4
|
+
import { useList as O } from "./data.js";
|
|
5
|
+
function D(e) {
|
|
6
|
+
const u = o(e, "path"), m = o(e, "params"), h = o(e, "providerName"), { data: d, isLoading: v } = O({
|
|
7
|
+
path: u.value || "",
|
|
8
|
+
filters: m.value,
|
|
9
|
+
providerName: h.value
|
|
10
|
+
}), s = a(() => {
|
|
11
|
+
var r, n, i, t, l, c;
|
|
12
|
+
return e.converTree ? K(((n = d.value) == null ? void 0 : n.data) || [], {
|
|
19
13
|
idKey: ((i = e.treeOptions) == null ? void 0 : i.valueKey) || "id",
|
|
20
|
-
parentKey: ((t = e.treeOptions) == null ? void 0 : t.parentKey) || "
|
|
14
|
+
parentKey: ((t = e.treeOptions) == null ? void 0 : t.parentKey) || "parent_id",
|
|
21
15
|
sortKey: ((l = e.treeOptions) == null ? void 0 : l.sortKey) || "sort",
|
|
22
|
-
childrenKey: ((
|
|
23
|
-
}) : ((r =
|
|
24
|
-
}),
|
|
16
|
+
childrenKey: ((c = e.treeOptions) == null ? void 0 : c.childrenKey) || "children"
|
|
17
|
+
}) : ((r = d.value) == null ? void 0 : r.data) || [];
|
|
18
|
+
}), p = a(() => {
|
|
25
19
|
var r, n;
|
|
26
|
-
return
|
|
27
|
-
}),
|
|
20
|
+
return f(s.value, ((r = e.treeOptions) == null ? void 0 : r.valueKey) || "id", ((n = e.treeOptions) == null ? void 0 : n.childrenKey) || "children");
|
|
21
|
+
}), y = a(() => v.value);
|
|
28
22
|
return {
|
|
29
23
|
options: a(() => {
|
|
30
24
|
const r = (n) => n.map((i) => {
|
|
31
25
|
const t = { ...i };
|
|
32
26
|
return Array.isArray(t.children) && (t.children.length === 0 ? delete t.children : t.children = r(t.children)), t;
|
|
33
27
|
});
|
|
34
|
-
return r(
|
|
28
|
+
return r(s.value || []);
|
|
35
29
|
}),
|
|
36
|
-
loading:
|
|
37
|
-
expanded:
|
|
30
|
+
loading: y,
|
|
31
|
+
expanded: p
|
|
38
32
|
};
|
|
39
33
|
}
|
|
40
34
|
export {
|
|
41
|
-
|
|
35
|
+
D as useTree
|
|
42
36
|
};
|
package/dist/esm/provider/app.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { OverlaysProvider as
|
|
3
|
-
import { useRouter as
|
|
4
|
-
import { useCan as
|
|
5
|
-
import { useConfig as
|
|
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";
|
|
6
6
|
import "@tanstack/vue-query";
|
|
7
|
-
import { useManage as
|
|
7
|
+
import { useManage as K } 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
|
|
12
|
+
import { useAuthStore as Q } from "../stores/auth.js";
|
|
13
13
|
import { useI18nStore as W } from "../stores/i18n.js";
|
|
14
14
|
import "pinia";
|
|
15
15
|
import { useManageStore as X } from "../stores/manage.js";
|
|
@@ -22,49 +22,49 @@ import "colorizr";
|
|
|
22
22
|
import "axios";
|
|
23
23
|
import "clsx";
|
|
24
24
|
import { DuxError as x } from "../components/status/error.js";
|
|
25
|
-
import { DuxNotAuthorized as
|
|
26
|
-
import { DuxNotFound as
|
|
27
|
-
const
|
|
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({
|
|
28
28
|
name: "DuxAppProvider",
|
|
29
29
|
props: {},
|
|
30
|
-
setup(
|
|
31
|
-
slots:
|
|
30
|
+
setup(et, {
|
|
31
|
+
slots: h
|
|
32
32
|
}) {
|
|
33
|
-
const
|
|
34
|
-
return
|
|
35
|
-
var
|
|
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
36
|
const o = n.meta.manageName, J = n.meta.authorization === !1;
|
|
37
37
|
if (!o) {
|
|
38
|
-
const
|
|
39
|
-
return
|
|
40
|
-
path: `/${
|
|
38
|
+
const t = f.defaultManage || ((S = (A = f.manages) == null ? void 0 : A[0]) == null ? void 0 : S.name) || "";
|
|
39
|
+
return i({
|
|
40
|
+
path: `/${t}`,
|
|
41
41
|
replace: !0
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
if ((
|
|
49
|
-
const
|
|
50
|
-
|
|
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));
|
|
51
51
|
}
|
|
52
|
-
if (Z(
|
|
53
|
-
return J ?
|
|
54
|
-
path:
|
|
52
|
+
if (Z(f, o), !g.isLogin())
|
|
53
|
+
return J ? i() : i({
|
|
54
|
+
path: e.getRoutePath("login"),
|
|
55
55
|
replace: !0
|
|
56
56
|
});
|
|
57
|
-
const
|
|
57
|
+
const R = (t) => t == null ? void 0 : t.map((p) => ({
|
|
58
58
|
...p,
|
|
59
|
-
path: p.path ?
|
|
59
|
+
path: p.path ? e.getRoutePath(p.path) : void 0
|
|
60
60
|
}));
|
|
61
|
-
if (!
|
|
62
|
-
const
|
|
63
|
-
|
|
61
|
+
if (!c.getRouteInit()) {
|
|
62
|
+
const t = ((w = e.config) == null ? void 0 : w.components) || {}, p = [];
|
|
63
|
+
return p.push({
|
|
64
64
|
name: `${o}.notFound`,
|
|
65
65
|
label: "404",
|
|
66
66
|
path: ":pathMatch(.*)*",
|
|
67
|
-
component:
|
|
67
|
+
component: t.notFound || ot,
|
|
68
68
|
hidden: !0,
|
|
69
69
|
meta: {
|
|
70
70
|
can: !1
|
|
@@ -73,7 +73,7 @@ const Ie = /* @__PURE__ */ U({
|
|
|
73
73
|
name: `${o}.notAuthorized`,
|
|
74
74
|
label: "403",
|
|
75
75
|
path: "notAuthorized",
|
|
76
|
-
component:
|
|
76
|
+
component: t.notAuthorized || tt,
|
|
77
77
|
hidden: !0,
|
|
78
78
|
meta: {
|
|
79
79
|
can: !1
|
|
@@ -82,79 +82,78 @@ const Ie = /* @__PURE__ */ U({
|
|
|
82
82
|
name: `${o}.error`,
|
|
83
83
|
label: "500",
|
|
84
84
|
path: "error",
|
|
85
|
-
component:
|
|
85
|
+
component: t.error || x,
|
|
86
86
|
hidden: !0,
|
|
87
87
|
meta: {
|
|
88
88
|
can: !1
|
|
89
89
|
}
|
|
90
|
-
}),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
meta: {
|
|
95
|
-
timeout: 5e3
|
|
96
|
-
}
|
|
97
|
-
}, r, d.getUser()).then((t) => {
|
|
98
|
-
i.appendRoutes(g(t.data || []));
|
|
99
|
-
}));
|
|
100
|
-
} catch (t) {
|
|
101
|
-
console.error(t);
|
|
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,
|
|
92
|
+
meta: {
|
|
93
|
+
timeout: 5e3
|
|
102
94
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
95
|
+
}, e, g.getUser()).then((r) => {
|
|
96
|
+
c.appendRoutes(R(r.data || []));
|
|
97
|
+
}).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")));
|
|
101
|
+
}), r;
|
|
102
|
+
})), c.appendRoutes(p), c.getRoutes().forEach((r) => {
|
|
103
|
+
var m, s, u, _;
|
|
104
|
+
if (!r.path)
|
|
106
105
|
return;
|
|
107
|
-
const
|
|
108
|
-
name:
|
|
109
|
-
path:
|
|
110
|
-
meta:
|
|
106
|
+
const a = {
|
|
107
|
+
name: r.name,
|
|
108
|
+
path: r.path,
|
|
109
|
+
meta: r.meta
|
|
111
110
|
};
|
|
112
|
-
switch (
|
|
111
|
+
switch (r.loader) {
|
|
113
112
|
case "iframe":
|
|
114
|
-
|
|
113
|
+
a.component = ((s = (m = e.config) == null ? void 0 : m.components) == null ? void 0 : s.iframe) || (() => import("../components/loader/iframe.js"));
|
|
115
114
|
break;
|
|
116
115
|
case "remote":
|
|
117
|
-
|
|
116
|
+
a.component = ((_ = (u = e.config) == null ? void 0 : u.components) == null ? void 0 : _.remote) || (() => import("../components/loader/loader.js"));
|
|
118
117
|
break;
|
|
119
118
|
case "link":
|
|
120
|
-
|
|
119
|
+
a.beforeEnter = () => {
|
|
121
120
|
var j;
|
|
122
|
-
const
|
|
123
|
-
return
|
|
124
|
-
},
|
|
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({
|
|
125
124
|
template: "<div></div>"
|
|
126
125
|
});
|
|
127
126
|
break;
|
|
128
127
|
default:
|
|
129
|
-
|
|
128
|
+
r.component && (a.component = r.component);
|
|
130
129
|
break;
|
|
131
130
|
}
|
|
132
|
-
|
|
133
|
-
}),
|
|
134
|
-
path: ((
|
|
131
|
+
d.addRoute(`${o}.auth`, a);
|
|
132
|
+
}), i({
|
|
133
|
+
path: ((N = n.redirectedFrom) == null ? void 0 : N.path) || n.path,
|
|
135
134
|
replace: !0
|
|
136
135
|
});
|
|
137
136
|
}
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
140
|
-
const
|
|
141
|
-
return !(
|
|
142
|
-
path: (
|
|
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) || "/",
|
|
143
142
|
replace: !0
|
|
144
143
|
});
|
|
145
144
|
}
|
|
146
|
-
const O =
|
|
147
|
-
return (((
|
|
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({
|
|
148
147
|
name: `${o}.notAuthorized`
|
|
149
|
-
}) :
|
|
150
|
-
}), () => q
|
|
148
|
+
}) : i();
|
|
149
|
+
}), () => V(q, null, {
|
|
151
150
|
default: () => {
|
|
152
151
|
var n;
|
|
153
|
-
return [(n =
|
|
152
|
+
return [(n = h.default) == null ? void 0 : n.call(h)];
|
|
154
153
|
}
|
|
155
154
|
});
|
|
156
155
|
}
|
|
157
156
|
});
|
|
158
157
|
export {
|
|
159
|
-
|
|
158
|
+
Et as DuxAppProvider
|
|
160
159
|
};
|
|
@@ -1,43 +1,39 @@
|
|
|
1
1
|
import { defineStore as u } from "pinia";
|
|
2
|
-
import { inject as
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
function y(t) {
|
|
8
|
-
const e = i("dux.manage");
|
|
9
|
-
if (t || (t = (e == null ? void 0 : e.value) || ""), !t)
|
|
2
|
+
import { inject as h, ref as a } from "vue";
|
|
3
|
+
function d(o) {
|
|
4
|
+
const e = h("dux.manage");
|
|
5
|
+
if (o || (o = (e == null ? void 0 : e.value) || ""), !o)
|
|
10
6
|
throw new Error("manage not found");
|
|
11
|
-
return
|
|
7
|
+
return i(o)();
|
|
12
8
|
}
|
|
13
|
-
function
|
|
14
|
-
return u(`jsonSchema-${
|
|
15
|
-
const e = a(/* @__PURE__ */ new Map()),
|
|
9
|
+
function i(o) {
|
|
10
|
+
return u(`jsonSchema-${o}`, () => {
|
|
11
|
+
const e = a(/* @__PURE__ */ new Map()), r = a(/* @__PURE__ */ new Map());
|
|
16
12
|
return {
|
|
17
13
|
componentCache: e,
|
|
18
|
-
componentsByName:
|
|
19
|
-
addComponent: (
|
|
20
|
-
const c =
|
|
14
|
+
componentsByName: r,
|
|
15
|
+
addComponent: (t, n, s) => {
|
|
16
|
+
const c = n;
|
|
21
17
|
return e.value.has(c) || (e.value.set(c, {
|
|
22
|
-
component:
|
|
23
|
-
name:
|
|
24
|
-
originalName: s ||
|
|
18
|
+
component: t,
|
|
19
|
+
name: n,
|
|
20
|
+
originalName: s || n,
|
|
25
21
|
cacheKey: c
|
|
26
|
-
}),
|
|
22
|
+
}), r.value.set(n, t)), c;
|
|
27
23
|
},
|
|
28
|
-
getComponent: (
|
|
29
|
-
var
|
|
30
|
-
return (
|
|
24
|
+
getComponent: (t) => {
|
|
25
|
+
var n;
|
|
26
|
+
return (n = e.value.get(t)) == null ? void 0 : n.component;
|
|
31
27
|
},
|
|
32
|
-
getComponentByName: (
|
|
33
|
-
hasComponent: (
|
|
28
|
+
getComponentByName: (t) => r.value.get(t),
|
|
29
|
+
hasComponent: (t) => e.value.has(t),
|
|
34
30
|
clearCache: () => {
|
|
35
|
-
e.value.clear(),
|
|
31
|
+
e.value.clear(), r.value.clear();
|
|
36
32
|
},
|
|
37
33
|
getCacheSize: () => e.value.size
|
|
38
34
|
};
|
|
39
35
|
});
|
|
40
36
|
}
|
|
41
37
|
export {
|
|
42
|
-
|
|
38
|
+
d as useJsonSchemaStore
|
|
43
39
|
};
|
package/dist/esm/stores/route.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { defineStore as w } from "pinia";
|
|
2
2
|
import { inject as j, ref as R } from "vue";
|
|
3
|
-
function b(
|
|
3
|
+
function b(u) {
|
|
4
4
|
const t = j("dux.manage");
|
|
5
|
-
if (
|
|
5
|
+
if (u || (u = (t == null ? void 0 : t.value) || ""), !u)
|
|
6
6
|
throw new Error("manage not found");
|
|
7
|
-
return E(
|
|
7
|
+
return E(u)();
|
|
8
8
|
}
|
|
9
|
-
function E(
|
|
10
|
-
return w(`routes-${
|
|
11
|
-
const t = R([]),
|
|
9
|
+
function E(u) {
|
|
10
|
+
return w(`routes-${u}`, () => {
|
|
11
|
+
const t = R([]), l = (e) => {
|
|
12
12
|
var o;
|
|
13
|
-
return (o = t.value) == null ? void 0 : o.find((
|
|
13
|
+
return (o = t.value) == null ? void 0 : o.find((s) => s.path === e);
|
|
14
14
|
}, p = (e) => {
|
|
15
15
|
var o;
|
|
16
|
-
return (o = t.value) == null ? void 0 : o.find((
|
|
16
|
+
return (o = t.value) == null ? void 0 : o.find((s) => s.name === e);
|
|
17
17
|
}, h = (e) => {
|
|
18
18
|
var o;
|
|
19
19
|
(o = t.value) == null || o.push(e);
|
|
@@ -24,27 +24,30 @@ function E(n) {
|
|
|
24
24
|
}, x = () => t.value, g = () => {
|
|
25
25
|
t.value = [];
|
|
26
26
|
}, m = () => {
|
|
27
|
-
var
|
|
28
|
-
const e = (
|
|
29
|
-
var
|
|
27
|
+
var s, d;
|
|
28
|
+
const e = (d = (s = t.value) == null ? void 0 : s.filter((r) => {
|
|
29
|
+
var n, c;
|
|
30
|
+
return !r.parent && !((n = r.name) != null && n.includes("404")) && !((c = r.name) != null && c.includes("403"));
|
|
31
|
+
})) == null ? void 0 : d.sort((r, n) => (r.sort || 0) - (n.sort || 0)), o = (r) => {
|
|
32
|
+
var c, v;
|
|
30
33
|
if (r.path)
|
|
31
34
|
return r;
|
|
32
|
-
const
|
|
33
|
-
for (const
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
return
|
|
35
|
+
const n = (v = (c = t.value) == null ? void 0 : c.filter((i) => i.parent === r.name)) == null ? void 0 : v.sort((i, a) => (i.sort || 0) - (a.sort || 0));
|
|
36
|
+
for (const i of n || []) {
|
|
37
|
+
const a = o(i);
|
|
38
|
+
if (a)
|
|
39
|
+
return a;
|
|
37
40
|
}
|
|
38
41
|
};
|
|
39
42
|
for (const r of e || []) {
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
return
|
|
43
|
+
const n = o(r);
|
|
44
|
+
if (n)
|
|
45
|
+
return n;
|
|
43
46
|
}
|
|
44
|
-
},
|
|
47
|
+
}, f = R(!1);
|
|
45
48
|
return {
|
|
46
49
|
routes: t,
|
|
47
|
-
searchRoute:
|
|
50
|
+
searchRoute: l,
|
|
48
51
|
searchRouteName: p,
|
|
49
52
|
appendRoute: h,
|
|
50
53
|
appendRoutes: S,
|
|
@@ -53,8 +56,8 @@ function E(n) {
|
|
|
53
56
|
clearRoutes: g,
|
|
54
57
|
getIndexRoute: m,
|
|
55
58
|
getRouteInit: () => {
|
|
56
|
-
const e =
|
|
57
|
-
return
|
|
59
|
+
const e = f.value;
|
|
60
|
+
return f.value = !0, e;
|
|
58
61
|
}
|
|
59
62
|
};
|
|
60
63
|
});
|