@duxweb/dvha-core 0.1.23 → 1.0.15
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/auth/can.cjs +1 -1
- package/dist/cjs/components/loader/loader.cjs +1 -1
- package/dist/cjs/components/loader/remote/loader.cjs +1 -1
- package/dist/cjs/directive/permission.cjs +1 -1
- package/dist/cjs/hooks/data.cjs +1 -1
- package/dist/cjs/hooks/json/vModel.cjs +1 -1
- package/dist/cjs/hooks/json.cjs +1 -1
- package/dist/cjs/hooks/menu.cjs +1 -1
- package/dist/cjs/hooks/overlay.cjs +1 -1
- package/dist/cjs/hooks/tree.cjs +1 -1
- package/dist/cjs/hooks/upload/local.cjs +1 -1
- package/dist/cjs/hooks/upload.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/main.cjs +1 -1
- package/dist/cjs/provider/app.cjs +1 -1
- package/dist/cjs/stores/jsonSchema.cjs +1 -0
- package/dist/cjs/utils/bus.cjs +1 -0
- package/dist/esm/components/auth/can.js +3 -2
- package/dist/esm/components/loader/loader.js +3 -2
- package/dist/esm/components/loader/remote/loader.js +3 -2
- package/dist/esm/directive/permission.js +3 -2
- package/dist/esm/hooks/data.js +166 -158
- package/dist/esm/hooks/json/vModel.js +67 -36
- package/dist/esm/hooks/json.js +109 -57
- package/dist/esm/hooks/menu.js +14 -13
- package/dist/esm/hooks/overlay.js +3 -2
- package/dist/esm/hooks/tree.js +8 -7
- package/dist/esm/hooks/upload/local.js +8 -8
- package/dist/esm/hooks/upload.js +123 -116
- package/dist/esm/index.js +93 -88
- package/dist/esm/main.js +7 -6
- package/dist/esm/provider/app.js +55 -53
- package/dist/esm/stores/jsonSchema.js +43 -0
- package/dist/esm/utils/bus.js +5 -0
- package/dist/types/hooks/data.d.ts +6 -66
- package/dist/types/hooks/json.d.ts +13 -3
- package/dist/types/hooks/upload/local.d.ts +1 -1
- package/dist/types/hooks/upload.d.ts +1 -1
- package/dist/types/stores/index.d.ts +1 -0
- package/dist/types/stores/jsonSchema.d.ts +27 -0
- package/dist/types/types/config.d.ts +6 -0
- package/dist/types/types/manage.d.ts +6 -0
- package/dist/types/utils/bus.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,65 +1,96 @@
|
|
|
1
|
-
import { toRef as
|
|
2
|
-
|
|
1
|
+
import { toRef as m } from "vue";
|
|
2
|
+
import { extractContext as b } from "./utils/contextManager.js";
|
|
3
|
+
import { evaluateExpression as f } from "./utils/expressionParser.js";
|
|
4
|
+
const w = {
|
|
3
5
|
name: "v-model",
|
|
4
6
|
priority: 70,
|
|
5
|
-
process(e,
|
|
6
|
-
const t = {},
|
|
7
|
+
process(e, l) {
|
|
8
|
+
const t = {}, i = {};
|
|
7
9
|
let o = !1;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
const a = b(l);
|
|
11
|
+
return Object.entries(l).forEach(([r, n]) => {
|
|
12
|
+
if (r.startsWith("v-model") || r.startsWith("vModel")) {
|
|
10
13
|
o = !0;
|
|
11
|
-
const [
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
+
const [c, ...p] = r.split(".");
|
|
15
|
+
let s;
|
|
16
|
+
c === "v-model" || c === "vModel" ? s = "modelValue" : c.startsWith("v-model:") ? s = c.slice(8) : c.startsWith("vModel:") ? s = c.slice(7) : s = "modelValue";
|
|
14
17
|
try {
|
|
15
|
-
const { modelValue:
|
|
16
|
-
t[
|
|
17
|
-
} catch (
|
|
18
|
-
console.error(`v-model binding error (${
|
|
18
|
+
const { modelValue: u, updateFn: h } = g(n, p, a);
|
|
19
|
+
t[s] = u, t[`onUpdate:${s}`] = h;
|
|
20
|
+
} catch (u) {
|
|
21
|
+
console.error(`v-model binding error (${s}):`, u);
|
|
19
22
|
}
|
|
20
23
|
} else
|
|
21
|
-
r
|
|
22
|
-
}), o ? { props: { ...
|
|
24
|
+
i[r] = n;
|
|
25
|
+
}), o ? { props: { ...i, ...t } } : null;
|
|
23
26
|
}
|
|
24
27
|
};
|
|
25
|
-
function
|
|
28
|
+
function g(e, l, t) {
|
|
29
|
+
if (typeof e == "string") {
|
|
30
|
+
const o = () => {
|
|
31
|
+
try {
|
|
32
|
+
return f(e, t);
|
|
33
|
+
} catch (r) {
|
|
34
|
+
console.warn(`v-model: Failed to evaluate expression "${e}"`, r);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}, a = (r) => {
|
|
38
|
+
try {
|
|
39
|
+
const n = e.split(".");
|
|
40
|
+
if (n.length >= 2) {
|
|
41
|
+
const c = n.slice(0, -1).join("."), p = n[n.length - 1], s = f(c, t);
|
|
42
|
+
if (s && typeof s == "object") {
|
|
43
|
+
s[p] = d(r, l);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
console.warn(`v-model: Cannot update expression "${e}". Target object not found.`);
|
|
48
|
+
} catch (n) {
|
|
49
|
+
console.warn(`v-model: Failed to update expression "${e}"`, n);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
modelValue: o(),
|
|
54
|
+
updateFn: a
|
|
55
|
+
};
|
|
56
|
+
}
|
|
26
57
|
if (Array.isArray(e) && e.length === 2 && typeof e[0] == "function" && typeof e[1] == "function") {
|
|
27
|
-
const [
|
|
58
|
+
const [o, a] = e;
|
|
28
59
|
return {
|
|
29
|
-
modelValue:
|
|
30
|
-
updateFn: (
|
|
31
|
-
|
|
60
|
+
modelValue: o(),
|
|
61
|
+
updateFn: (r) => {
|
|
62
|
+
a(d(r, l));
|
|
32
63
|
}
|
|
33
64
|
};
|
|
34
65
|
}
|
|
35
66
|
if (Array.isArray(e) && e.length === 2) {
|
|
36
|
-
const [
|
|
37
|
-
if (!
|
|
67
|
+
const [o, a] = e;
|
|
68
|
+
if (!o || typeof a != "string")
|
|
38
69
|
throw new Error("Invalid v-model binding format: [obj, prop] expected");
|
|
39
|
-
const
|
|
70
|
+
const r = m(o, a);
|
|
40
71
|
return {
|
|
41
|
-
modelValue:
|
|
42
|
-
updateFn: (
|
|
43
|
-
|
|
72
|
+
modelValue: r.value,
|
|
73
|
+
updateFn: (n) => {
|
|
74
|
+
r.value = d(n, l);
|
|
44
75
|
}
|
|
45
76
|
};
|
|
46
77
|
}
|
|
47
|
-
const
|
|
48
|
-
return
|
|
78
|
+
const i = m(e);
|
|
79
|
+
return i === e && typeof e != "object" ? {
|
|
49
80
|
modelValue: e,
|
|
50
81
|
updateFn: () => {
|
|
51
82
|
console.warn("v-model: Cannot update non-reactive value. Please use ref, [obj, prop], or [getter, setter] format.");
|
|
52
83
|
}
|
|
53
84
|
} : {
|
|
54
|
-
modelValue:
|
|
55
|
-
updateFn: (
|
|
56
|
-
|
|
85
|
+
modelValue: i.value,
|
|
86
|
+
updateFn: (o) => {
|
|
87
|
+
i.value = d(o, l);
|
|
57
88
|
}
|
|
58
89
|
};
|
|
59
90
|
}
|
|
60
|
-
function
|
|
61
|
-
return
|
|
62
|
-
switch (
|
|
91
|
+
function d(e, l) {
|
|
92
|
+
return l.reduce((t, i) => {
|
|
93
|
+
switch (i) {
|
|
63
94
|
case "trim":
|
|
64
95
|
return typeof t == "string" ? t.trim() : t;
|
|
65
96
|
case "number": {
|
|
@@ -69,10 +100,10 @@ function c(e, s) {
|
|
|
69
100
|
case "lazy":
|
|
70
101
|
return t;
|
|
71
102
|
default:
|
|
72
|
-
return console.warn(`Unknown v-model modifier: ${
|
|
103
|
+
return console.warn(`Unknown v-model modifier: ${i}`), t;
|
|
73
104
|
}
|
|
74
105
|
}, e);
|
|
75
106
|
}
|
|
76
107
|
export {
|
|
77
|
-
|
|
108
|
+
w as vModelAdaptor
|
|
78
109
|
};
|
package/dist/esm/hooks/json.js
CHANGED
|
@@ -1,80 +1,132 @@
|
|
|
1
|
-
import { computed as
|
|
1
|
+
import { computed as U, isRef as _, defineComponent as R, markRaw as E, h as v, unref as D } from "vue";
|
|
2
|
+
import { useJsonSchemaStore as z } from "../stores/jsonSchema.js";
|
|
3
|
+
import { useConfig as F } from "./config.js";
|
|
2
4
|
import { defaultAdaptors as G } from "./json/index.js";
|
|
3
|
-
import { injectContext as
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { injectContext as L } from "./json/utils/contextManager.js";
|
|
6
|
+
function W(e) {
|
|
7
|
+
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
8
|
+
}
|
|
9
|
+
function J(e, s) {
|
|
10
|
+
Array.isArray(e) ? e.forEach((c) => {
|
|
11
|
+
const f = c;
|
|
12
|
+
let i = f.name;
|
|
13
|
+
!i && f.__name && (i = f.__name.replace(/\.(vue|ts|tsx|js|jsx)$/, "").split("/").pop()), i && s.addComponent(E(c), i);
|
|
14
|
+
}) : typeof e == "object" && e !== null && Object.entries(e).forEach(([c, f]) => {
|
|
15
|
+
s.addComponent(E(f), c);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function X(e, s) {
|
|
19
|
+
var f, i;
|
|
20
|
+
const c = z(s);
|
|
21
|
+
(f = e.jsonSchema) != null && f.components && J(e.jsonSchema.components, c), (i = e.manages) == null || i.forEach((y) => {
|
|
22
|
+
var S;
|
|
23
|
+
(S = y.jsonSchema) != null && S.components && J(y.jsonSchema.components, c);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function Y(e) {
|
|
27
|
+
var M;
|
|
28
|
+
const s = F(), c = z(), f = [...G, ...((M = s.jsonSchema) == null ? void 0 : M.adaptors) || [], ...(e == null ? void 0 : e.adaptors) || []];
|
|
29
|
+
e != null && e.components && J(e.components, c);
|
|
30
|
+
const i = U(() => _(e == null ? void 0 : e.data) ? e == null ? void 0 : e.data.value : e == null ? void 0 : e.data);
|
|
31
|
+
function y() {
|
|
32
|
+
return (_(e == null ? void 0 : e.context) ? e == null ? void 0 : e.context.value : e == null ? void 0 : e.context) || {};
|
|
8
33
|
}
|
|
9
|
-
function
|
|
34
|
+
function S(n) {
|
|
10
35
|
const r = {};
|
|
11
|
-
return Object.entries(
|
|
12
|
-
if (
|
|
13
|
-
const
|
|
14
|
-
r[
|
|
36
|
+
return Object.entries(n).forEach(([t, a]) => {
|
|
37
|
+
if (t === "_context") return;
|
|
38
|
+
const A = t === "modelValue" || t.startsWith("modelValue") || t !== "value" && (t.includes("model") || t.includes("Model"));
|
|
39
|
+
r[t] = A && _(a) ? D(a) : a;
|
|
15
40
|
}), r;
|
|
16
41
|
}
|
|
17
|
-
function
|
|
18
|
-
return typeof
|
|
42
|
+
function b(n, r, t) {
|
|
43
|
+
return typeof n == "string" ? n : typeof n == "function" ? b(n(r), r, t) : Array.isArray(n) ? n.flatMap((a) => b(a, r, t)).filter(Boolean) : n != null && n.tag ? d(n, !0, t) : n;
|
|
19
44
|
}
|
|
20
|
-
function
|
|
21
|
-
if (
|
|
22
|
-
return typeof
|
|
45
|
+
function P(n, r, t) {
|
|
46
|
+
if (n)
|
|
47
|
+
return typeof n == "string" ? n : Array.isArray(n) ? n.flatMap((a) => typeof a == "string" ? a : d(a, r, t)).filter(Boolean) : d(n, r, t);
|
|
23
48
|
}
|
|
24
|
-
function
|
|
49
|
+
function d(n, r = !1, t = {}) {
|
|
25
50
|
const {
|
|
26
|
-
tag:
|
|
27
|
-
attrs:
|
|
28
|
-
children:
|
|
29
|
-
slots:
|
|
30
|
-
} =
|
|
31
|
-
...
|
|
32
|
-
...
|
|
51
|
+
tag: a,
|
|
52
|
+
attrs: A = {},
|
|
53
|
+
children: w,
|
|
54
|
+
slots: N
|
|
55
|
+
} = n, g = {
|
|
56
|
+
...y(),
|
|
57
|
+
...t
|
|
33
58
|
};
|
|
34
|
-
let
|
|
35
|
-
...
|
|
59
|
+
let j = {
|
|
60
|
+
...A
|
|
36
61
|
};
|
|
37
|
-
Object.keys(
|
|
38
|
-
...
|
|
39
|
-
...
|
|
62
|
+
Object.keys(g).length > 0 && (j = {
|
|
63
|
+
...j,
|
|
64
|
+
...L({}, g)
|
|
40
65
|
});
|
|
41
|
-
for (const
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
if (
|
|
45
|
-
if (
|
|
46
|
-
return
|
|
47
|
-
var
|
|
48
|
-
const
|
|
49
|
-
return
|
|
50
|
-
...
|
|
51
|
-
...
|
|
66
|
+
for (const m of f) {
|
|
67
|
+
const o = m.process(n, j);
|
|
68
|
+
if (o) {
|
|
69
|
+
if (j = o.props, o.skip) return null;
|
|
70
|
+
if (o.nodes)
|
|
71
|
+
return o.nodes.map((l) => {
|
|
72
|
+
var x;
|
|
73
|
+
const h = ((x = l.attrs) == null ? void 0 : x._context) || {};
|
|
74
|
+
return d(l, r, {
|
|
75
|
+
...g,
|
|
76
|
+
...h
|
|
52
77
|
});
|
|
53
78
|
}).filter(Boolean);
|
|
54
79
|
}
|
|
55
80
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
81
|
+
let u = typeof a == "string" && ((m) => {
|
|
82
|
+
let o = c.getComponentByName(m);
|
|
83
|
+
if (o)
|
|
84
|
+
return o;
|
|
85
|
+
const l = W(m);
|
|
86
|
+
if (o = c.getComponentByName(l), o)
|
|
87
|
+
return o;
|
|
88
|
+
const h = m.replace(/-([a-z])/g, (x, T) => T.toUpperCase()).replace(/^[a-z]/, (x) => x.toUpperCase());
|
|
89
|
+
return o = c.getComponentByName(h), o || null;
|
|
90
|
+
})(a) || a;
|
|
91
|
+
typeof u != "string" && typeof u == "object" && (u = E(u));
|
|
92
|
+
const O = typeof u != "string", C = S(j);
|
|
93
|
+
if (N && O && !r) {
|
|
94
|
+
const m = {};
|
|
95
|
+
return Object.entries(N).forEach(([o, l]) => {
|
|
96
|
+
m[o] = (h = {}) => b(l, h, g);
|
|
97
|
+
}), v(u, C, m);
|
|
62
98
|
}
|
|
63
|
-
const
|
|
64
|
-
return
|
|
65
|
-
default: () =>
|
|
66
|
-
}) :
|
|
99
|
+
const B = P(w, r, g);
|
|
100
|
+
return O && B !== void 0 ? v(u, C, {
|
|
101
|
+
default: () => B
|
|
102
|
+
}) : v(u, C, B);
|
|
67
103
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
104
|
+
const V = /* @__PURE__ */ R({
|
|
105
|
+
name: "JsonSchemaRenderer",
|
|
106
|
+
render() {
|
|
107
|
+
var n;
|
|
108
|
+
return ((n = i.value) == null ? void 0 : n.map((r) => d(r)).filter(Boolean)) || [];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
function $(n) {
|
|
112
|
+
return /* @__PURE__ */ R({
|
|
113
|
+
name: "DynamicJsonSchemaRenderer",
|
|
71
114
|
render() {
|
|
72
|
-
var
|
|
73
|
-
|
|
115
|
+
var t;
|
|
116
|
+
const r = {
|
|
117
|
+
...y(),
|
|
118
|
+
...n.context
|
|
119
|
+
};
|
|
120
|
+
return (t = n.data) == null ? void 0 : t.map((a) => d(a, !1, r)).filter(Boolean);
|
|
74
121
|
}
|
|
75
|
-
})
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
render: V,
|
|
126
|
+
renderAsync: $
|
|
76
127
|
};
|
|
77
128
|
}
|
|
78
129
|
export {
|
|
79
|
-
|
|
130
|
+
X as initJsonSchemaComponents,
|
|
131
|
+
Y as useJsonSchema
|
|
80
132
|
};
|
package/dist/esm/hooks/menu.js
CHANGED
|
@@ -3,11 +3,12 @@ import { storeToRefs as q } from "pinia";
|
|
|
3
3
|
import { computed as v, ref as K, watch as h } from "vue";
|
|
4
4
|
import { useRoute as z } from "vue-router";
|
|
5
5
|
import { useRouteStore as B } from "../stores/route.js";
|
|
6
|
+
import "../utils/bus.js";
|
|
6
7
|
import { arrayToTree as A, searchTree as M } from "../utils/tree.js";
|
|
7
|
-
function
|
|
8
|
+
function O(n) {
|
|
8
9
|
const D = B(), { routes: L } = q(D), y = (e = !0) => {
|
|
9
|
-
var
|
|
10
|
-
return (
|
|
10
|
+
var t;
|
|
11
|
+
return (t = S(L.value)) == null ? void 0 : t.filter((a) => !!(a != null && a.name)).filter((a) => !e || a.hidden === void 0 || a.hidden === !1);
|
|
11
12
|
}, b = v(() => {
|
|
12
13
|
const e = y(!1);
|
|
13
14
|
return A(e, {
|
|
@@ -28,25 +29,25 @@ function N(n) {
|
|
|
28
29
|
if (n != null && n.doubleMenu)
|
|
29
30
|
return c.value;
|
|
30
31
|
const e = S(c.value);
|
|
31
|
-
return e == null ? void 0 : e.map((
|
|
32
|
+
return e == null ? void 0 : e.map((t) => (delete t.children, t));
|
|
32
33
|
}), x = v(() => {
|
|
33
|
-
var
|
|
34
|
-
return n != null && n.doubleMenu ? [] : ((
|
|
35
|
-
}), w = v(() => M(b.value, (
|
|
34
|
+
var t, a;
|
|
35
|
+
return n != null && n.doubleMenu ? [] : ((a = (t = c.value) == null ? void 0 : t.find((d) => d.name === r.value)) == null ? void 0 : a.children) || [];
|
|
36
|
+
}), w = v(() => M(b.value, (t) => (t == null ? void 0 : t.name) === i.name));
|
|
36
37
|
h(() => n == null ? void 0 : n.doubleMenu, () => {
|
|
37
|
-
var e,
|
|
38
|
+
var e, t, a, d;
|
|
38
39
|
if (n != null && n.doubleMenu) {
|
|
39
40
|
const u = M(c.value, (l) => (l == null ? void 0 : l.name) === r.value);
|
|
40
|
-
r.value = (
|
|
41
|
+
r.value = (a = u == null ? void 0 : u[0]) == null ? void 0 : a.name, o.value = (d = u == null ? void 0 : u[u.length - 1]) == null ? void 0 : d.name;
|
|
41
42
|
} else {
|
|
42
43
|
const u = M(c.value, (l) => (l == null ? void 0 : l.name) === o.value);
|
|
43
|
-
r.value = (e = u == null ? void 0 : u[u.length - 1]) == null ? void 0 : e.name, o.value = (
|
|
44
|
+
r.value = (e = u == null ? void 0 : u[u.length - 1]) == null ? void 0 : e.name, o.value = (t = u == null ? void 0 : u[u.length - 1]) == null ? void 0 : t.name;
|
|
44
45
|
}
|
|
45
46
|
}, { immediate: !0 });
|
|
46
47
|
const j = v(() => n != null && n.doubleMenu ? (n == null ? void 0 : n.doubleMenu) || x.value.length > 0 : !0);
|
|
47
48
|
return h([i, b, () => n == null ? void 0 : n.doubleMenu], () => {
|
|
48
49
|
var d, u, l, T, I;
|
|
49
|
-
const e = M(b.value, (m) => m.name === i.name),
|
|
50
|
+
const e = M(b.value, (m) => m.name === i.name), a = ((m) => {
|
|
50
51
|
let R = -1;
|
|
51
52
|
for (let f = m.length - 1; f >= 0; f--)
|
|
52
53
|
if (m[f].hidden === !1 || m[f].hidden === void 0) {
|
|
@@ -55,7 +56,7 @@ function N(n) {
|
|
|
55
56
|
}
|
|
56
57
|
return R;
|
|
57
58
|
})(e);
|
|
58
|
-
g.value = (d = e == null ? void 0 : e[
|
|
59
|
+
g.value = (d = e == null ? void 0 : e[a]) == null ? void 0 : d.name, n != null && n.doubleMenu ? (r.value = (u = e == null ? void 0 : e[a]) == null ? void 0 : u.name, o.value = (l = e == null ? void 0 : e[a]) == null ? void 0 : l.name) : (r.value = (T = e == null ? void 0 : e[0]) == null ? void 0 : T.name, o.value = (I = e == null ? void 0 : e[a]) == null ? void 0 : I.name);
|
|
59
60
|
}, { immediate: !0 }), {
|
|
60
61
|
data: c,
|
|
61
62
|
originalData: b,
|
|
@@ -70,5 +71,5 @@ function N(n) {
|
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
73
|
export {
|
|
73
|
-
|
|
74
|
+
O as useMenu
|
|
74
75
|
};
|
|
@@ -9,16 +9,17 @@ import "@vee-validate/rules";
|
|
|
9
9
|
import "vee-validate";
|
|
10
10
|
import "@vueuse/core";
|
|
11
11
|
import "./json/index.js";
|
|
12
|
+
import "../utils/bus.js";
|
|
12
13
|
import "colorizr";
|
|
13
14
|
import "axios";
|
|
14
15
|
import "clsx";
|
|
15
16
|
import { DuxOverlay as m } from "../components/overlay/overlay.js";
|
|
16
|
-
function
|
|
17
|
+
function D() {
|
|
17
18
|
const r = t(m);
|
|
18
19
|
return {
|
|
19
20
|
show: (o) => r(o)
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
export {
|
|
23
|
-
|
|
24
|
+
D as useOverlay
|
|
24
25
|
};
|
package/dist/esm/hooks/tree.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { computed as a } from "vue";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import "../utils/bus.js";
|
|
3
|
+
import { arrayToTree as m, treeToArr as y } from "../utils/tree.js";
|
|
4
|
+
import { useList as p } from "./data.js";
|
|
5
|
+
function T(e) {
|
|
6
|
+
const { data: o, isLoading: c } = p({
|
|
6
7
|
get path() {
|
|
7
8
|
return e.path || "";
|
|
8
9
|
},
|
|
@@ -14,7 +15,7 @@ function g(e) {
|
|
|
14
15
|
}
|
|
15
16
|
}), d = a(() => {
|
|
16
17
|
var r, n, i, t, l, s;
|
|
17
|
-
return e.converTree ?
|
|
18
|
+
return e.converTree ? m(((n = o.value) == null ? void 0 : n.data) || [], {
|
|
18
19
|
idKey: ((i = e.treeOptions) == null ? void 0 : i.valueKey) || "id",
|
|
19
20
|
parentKey: ((t = e.treeOptions) == null ? void 0 : t.parentKey) || "parentId",
|
|
20
21
|
sortKey: ((l = e.treeOptions) == null ? void 0 : l.sortKey) || "sort",
|
|
@@ -22,7 +23,7 @@ function g(e) {
|
|
|
22
23
|
}) : ((r = o.value) == null ? void 0 : r.data) || [];
|
|
23
24
|
}), u = a(() => {
|
|
24
25
|
var r, n;
|
|
25
|
-
return
|
|
26
|
+
return y(d.value, ((r = e.treeOptions) == null ? void 0 : r.valueKey) || "id", ((n = e.treeOptions) == null ? void 0 : n.childrenKey) || "children");
|
|
26
27
|
}), h = a(() => c.value);
|
|
27
28
|
return {
|
|
28
29
|
options: a(() => {
|
|
@@ -37,5 +38,5 @@ function g(e) {
|
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
40
|
export {
|
|
40
|
-
|
|
41
|
+
T as useTree
|
|
41
42
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useClient as o } from "../data.js";
|
|
2
|
-
|
|
3
|
-
const
|
|
2
|
+
function s() {
|
|
3
|
+
const c = o();
|
|
4
4
|
return {
|
|
5
5
|
upload(l, e) {
|
|
6
|
-
const
|
|
6
|
+
const n = e.query || {};
|
|
7
7
|
let a = null;
|
|
8
8
|
if (e.method === "PUT")
|
|
9
9
|
Object.entries(e.params || {}).forEach(([r, t]) => {
|
|
10
|
-
|
|
10
|
+
n[r] = t;
|
|
11
11
|
}), a = l;
|
|
12
12
|
else {
|
|
13
13
|
const r = new FormData();
|
|
@@ -15,9 +15,9 @@ const m = () => {
|
|
|
15
15
|
r.append(t, d);
|
|
16
16
|
}), a = r;
|
|
17
17
|
}
|
|
18
|
-
return
|
|
18
|
+
return c.request({
|
|
19
19
|
...e,
|
|
20
|
-
query:
|
|
20
|
+
query: n,
|
|
21
21
|
method: e.method || "POST",
|
|
22
22
|
payload: a,
|
|
23
23
|
signal: e.signal,
|
|
@@ -25,7 +25,7 @@ const m = () => {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
}
|
|
28
|
+
}
|
|
29
29
|
export {
|
|
30
|
-
|
|
30
|
+
s as createLocalUploadDriver
|
|
31
31
|
};
|