@duxweb/dvha-core 0.1.20 → 0.1.21
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/_virtual/_commonjsHelpers.cjs +1 -0
- package/dist/cjs/_virtual/dayjs.min.cjs +1 -0
- package/dist/cjs/_virtual/dayjs.min2.cjs +1 -0
- package/dist/cjs/components/auth/can.cjs +1 -1
- package/dist/cjs/components/loader/iframe.cjs +1 -1
- package/dist/cjs/components/loader/loader.cjs +1 -0
- package/dist/cjs/components/loader/remote/loader.cjs +1 -0
- package/dist/cjs/components/loader/remote/render.cjs +1 -0
- package/dist/cjs/components/overlay/overlay.cjs +1 -1
- package/dist/cjs/components/status/error.cjs +1 -1
- package/dist/cjs/components/status/exception.cjs +1 -0
- package/dist/cjs/components/status/notAuthorized.cjs +1 -1
- package/dist/cjs/components/status/notFound.cjs +1 -1
- package/dist/cjs/directive/permission.cjs +1 -1
- package/dist/cjs/hooks/auth.cjs +1 -1
- package/dist/cjs/hooks/data.cjs +1 -1
- package/dist/cjs/hooks/export.cjs +1 -1
- package/dist/cjs/hooks/form.cjs +1 -1
- package/dist/cjs/hooks/formExtend.cjs +1 -0
- package/dist/cjs/hooks/formValidate.cjs +1 -0
- package/dist/cjs/hooks/i18n.cjs +1 -1
- package/dist/cjs/hooks/importCsv.cjs +1 -1
- package/dist/cjs/hooks/json.cjs +1 -1
- package/dist/cjs/hooks/list.cjs +1 -0
- package/dist/cjs/hooks/manage.cjs +1 -1
- package/dist/cjs/hooks/menu.cjs +1 -1
- package/dist/cjs/hooks/overlay.cjs +1 -1
- package/dist/cjs/hooks/select.cjs +1 -1
- package/dist/cjs/hooks/theme.cjs +2 -2
- 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/node_modules/dayjs/dayjs.min.cjs +1 -0
- package/dist/cjs/node_modules/mitt/dist/mitt.cjs +1 -0
- package/dist/cjs/preset/dataProvider.cjs +1 -1
- package/dist/cjs/preset/i18nProvider.cjs +1 -1
- package/dist/cjs/provider/app.cjs +1 -1
- package/dist/cjs/stores/manage.cjs +1 -1
- package/dist/cjs/stores/tab.cjs +1 -1
- package/dist/cjs/stores/theme.cjs +1 -1
- package/dist/cjs/utils/theme.cjs +9 -1
- package/dist/esm/_virtual/_commonjsHelpers.js +6 -0
- package/dist/esm/_virtual/dayjs.min.js +7 -0
- package/dist/esm/_virtual/dayjs.min2.js +4 -0
- package/dist/esm/components/auth/can.js +9 -7
- package/dist/esm/components/loader/loader.js +47 -0
- package/dist/esm/components/loader/remote/loader.js +150 -0
- package/dist/esm/components/loader/remote/render.js +19 -0
- package/dist/esm/components/overlay/overlay.js +22 -31
- package/dist/esm/components/status/error.js +3 -3
- package/dist/esm/components/status/exception.js +23 -0
- package/dist/esm/components/status/notAuthorized.js +2 -2
- package/dist/esm/components/status/notFound.js +4 -4
- package/dist/esm/directive/permission.js +5 -3
- package/dist/esm/hooks/auth.js +67 -67
- package/dist/esm/hooks/data.js +164 -160
- package/dist/esm/hooks/export.js +26 -23
- package/dist/esm/hooks/form.js +38 -35
- package/dist/esm/hooks/formExtend.js +38 -0
- package/dist/esm/hooks/formValidate.js +28 -0
- package/dist/esm/hooks/i18n.js +16 -8
- package/dist/esm/hooks/json.js +57 -57
- package/dist/esm/hooks/list.js +179 -0
- package/dist/esm/hooks/manage.js +19 -14
- package/dist/esm/hooks/overlay.js +6 -4
- package/dist/esm/hooks/theme.js +11 -11
- package/dist/esm/index.js +129 -113
- package/dist/esm/main.js +22 -12
- package/dist/esm/node_modules/dayjs/dayjs.min.js +282 -0
- package/dist/esm/node_modules/mitt/dist/mitt.js +19 -0
- package/dist/esm/preset/i18nProvider.js +17 -18
- package/dist/esm/provider/app.js +61 -53
- package/dist/esm/stores/manage.js +23 -15
- package/dist/esm/stores/tab.js +58 -49
- package/dist/esm/utils/theme.js +89 -76
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/components/loader/loader.d.ts +2 -0
- package/dist/types/components/loader/remote/index.d.ts +2 -0
- package/dist/types/components/loader/remote/loader.d.ts +1 -0
- package/dist/types/components/loader/remote/render.d.ts +1 -0
- package/dist/types/components/status/error.d.ts +1 -2
- package/dist/types/components/status/exception.d.ts +3 -0
- package/dist/types/components/status/index.d.ts +4 -0
- package/dist/types/components/status/notAuthorized.d.ts +1 -2
- package/dist/types/components/status/notFound.d.ts +1 -2
- package/dist/types/config/index.d.ts +1 -0
- package/dist/types/hooks/auth.d.ts +6 -6
- package/dist/types/hooks/data.d.ts +30 -30
- package/dist/types/hooks/form.d.ts +6 -3
- package/dist/types/hooks/formExtend.d.ts +12 -0
- package/dist/types/hooks/formValidate.d.ts +14 -0
- package/dist/types/hooks/i18n.d.ts +2 -0
- package/dist/types/hooks/import.d.ts +1 -2
- package/dist/types/hooks/index.d.ts +4 -1
- package/dist/types/hooks/json.d.ts +1 -1
- package/dist/types/hooks/list.d.ts +66 -0
- package/dist/types/hooks/manage.d.ts +1 -0
- package/dist/types/index.d.ts +6 -5
- package/dist/types/preset/i18nProvider.d.ts +1 -1
- package/dist/types/stores/route.d.ts +180 -180
- package/dist/types/stores/tab.d.ts +1112 -73
- package/dist/types/types/config.d.ts +9 -0
- package/dist/types/types/i18n.d.ts +1 -0
- package/dist/types/types/manage.d.ts +6 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/theme.d.ts +4 -49
- package/package.json +11 -5
- /package/dist/cjs/{hooks/themeColor.cjs → config/color.cjs} +0 -0
- /package/dist/esm/{hooks/themeColor.js → config/color.js} +0 -0
- /package/dist/types/{hooks/themeColor.d.ts → config/color.d.ts} +0 -0
package/dist/esm/hooks/form.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { cloneDeep as
|
|
2
|
-
import { toRef as N, ref as
|
|
3
|
-
import { useOne as
|
|
4
|
-
function
|
|
5
|
-
const i = N(e
|
|
1
|
+
import { cloneDeep as c } from "lodash-es";
|
|
2
|
+
import { toRef as N, ref as b, computed as o, watch as E } from "vue";
|
|
3
|
+
import { useOne as L, useCreate as O, useUpdate as S } from "./data.js";
|
|
4
|
+
function w(e) {
|
|
5
|
+
const i = N(e, "form", {}), n = b(c(e.form || {})), d = o(() => e.action === "edit" || e.id), { data: v, isLoading: l, refetch: f } = L({
|
|
6
6
|
path: e.path || "",
|
|
7
7
|
id: e.id,
|
|
8
8
|
options: {
|
|
@@ -10,58 +10,61 @@ function x(e) {
|
|
|
10
10
|
},
|
|
11
11
|
providerName: e.providerName
|
|
12
12
|
});
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
if (
|
|
13
|
+
E([() => e.action, () => e.id], async () => {
|
|
14
|
+
var t;
|
|
15
|
+
if (!d.value)
|
|
16
16
|
return;
|
|
17
|
-
await
|
|
18
|
-
const a =
|
|
19
|
-
i.value
|
|
17
|
+
await f();
|
|
18
|
+
const a = c(((t = v.value) == null ? void 0 : t.data) || {});
|
|
19
|
+
Object.assign(i.value, a), Object.assign(n.value, a);
|
|
20
20
|
}, {
|
|
21
21
|
immediate: !0
|
|
22
22
|
});
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const r = () => {
|
|
24
|
+
const a = c(n.value);
|
|
25
|
+
Object.assign(i.value, a);
|
|
26
|
+
}, u = O({
|
|
26
27
|
path: e.path ?? "",
|
|
27
28
|
data: i.value,
|
|
28
|
-
onSuccess: (
|
|
29
|
-
var
|
|
30
|
-
(
|
|
29
|
+
onSuccess: (a) => {
|
|
30
|
+
var t;
|
|
31
|
+
(t = e.onSuccess) == null || t.call(e, a);
|
|
31
32
|
},
|
|
32
|
-
onError: (
|
|
33
|
-
var
|
|
34
|
-
(
|
|
33
|
+
onError: (a) => {
|
|
34
|
+
var t;
|
|
35
|
+
(t = e.onError) == null || t.call(e, a);
|
|
35
36
|
},
|
|
36
37
|
providerName: e.providerName
|
|
37
|
-
}),
|
|
38
|
+
}), m = S({
|
|
38
39
|
path: e.path ?? "",
|
|
39
40
|
id: e.id,
|
|
40
41
|
data: i.value,
|
|
41
|
-
onSuccess: (
|
|
42
|
-
var
|
|
43
|
-
(
|
|
42
|
+
onSuccess: (a) => {
|
|
43
|
+
var t;
|
|
44
|
+
(t = e.onSuccess) == null || t.call(e, a);
|
|
44
45
|
},
|
|
45
|
-
onError: (
|
|
46
|
-
var
|
|
47
|
-
(
|
|
46
|
+
onError: (a) => {
|
|
47
|
+
var t;
|
|
48
|
+
(t = e.onError) == null || t.call(e, a);
|
|
48
49
|
},
|
|
49
50
|
providerName: e.providerName
|
|
50
|
-
}),
|
|
51
|
+
}), g = (a) => {
|
|
51
52
|
e.action === "create" ? u.mutate({
|
|
52
|
-
data: i.value
|
|
53
|
-
}) :
|
|
53
|
+
data: a || i.value
|
|
54
|
+
}) : m.mutate({
|
|
54
55
|
id: e.id,
|
|
55
|
-
data: i.value
|
|
56
|
+
data: a || i.value
|
|
56
57
|
});
|
|
57
|
-
}, h =
|
|
58
|
+
}, h = o(() => l.value || u.isLoading.value || m.isLoading.value);
|
|
58
59
|
return {
|
|
59
60
|
form: i,
|
|
61
|
+
initData: n,
|
|
60
62
|
isLoading: h,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
isEdit: d,
|
|
64
|
+
onSubmit: g,
|
|
65
|
+
onReset: r
|
|
63
66
|
};
|
|
64
67
|
}
|
|
65
68
|
export {
|
|
66
|
-
|
|
69
|
+
w as useForm
|
|
67
70
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { toRef as d, computed as c } from "vue";
|
|
2
|
+
import { useForm as l } from "./form.js";
|
|
3
|
+
import { useValidateForm as E } from "./formValidate.js";
|
|
4
|
+
function F(t) {
|
|
5
|
+
const n = d(t, "form", {}), { validate: m, reset: s } = E({
|
|
6
|
+
data: n,
|
|
7
|
+
rules: t.rules
|
|
8
|
+
}), u = c(() => {
|
|
9
|
+
const { form: o, ...r } = t;
|
|
10
|
+
return {
|
|
11
|
+
...r,
|
|
12
|
+
form: o
|
|
13
|
+
};
|
|
14
|
+
}), e = l(u.value), a = (o) => {
|
|
15
|
+
m().then((r) => {
|
|
16
|
+
var i;
|
|
17
|
+
if (!r.valid) {
|
|
18
|
+
(i = t.onError) == null || i.call(t, {
|
|
19
|
+
message: "表单验证失败"
|
|
20
|
+
});
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
e.onSubmit(o);
|
|
24
|
+
});
|
|
25
|
+
}, f = () => {
|
|
26
|
+
e.onReset(), s();
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
isLoading: e.isLoading,
|
|
30
|
+
isEdit: e.isEdit,
|
|
31
|
+
form: n,
|
|
32
|
+
onSubmit: a,
|
|
33
|
+
onReset: f
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
F as useExtendForm
|
|
38
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { all as m } from "@vee-validate/rules";
|
|
2
|
+
import { cloneDeep as n } from "lodash-es";
|
|
3
|
+
import { useForm as s, defineRule as u } from "vee-validate";
|
|
4
|
+
import { toRef as c, watch as f } from "vue";
|
|
5
|
+
function b(e) {
|
|
6
|
+
const t = c(e, "data"), { setValues: a, validate: o, resetForm: r, handleSubmit: i } = s({
|
|
7
|
+
initialValues: n(t.value || {}),
|
|
8
|
+
validationSchema: e.rules
|
|
9
|
+
});
|
|
10
|
+
return f(t, (l) => {
|
|
11
|
+
a(l || {}, !1);
|
|
12
|
+
}, { deep: !0 }), {
|
|
13
|
+
validate: o,
|
|
14
|
+
reset: () => {
|
|
15
|
+
r();
|
|
16
|
+
},
|
|
17
|
+
submit: i
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function v() {
|
|
21
|
+
Object.entries(m).forEach(([e, t]) => {
|
|
22
|
+
u(e, t);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
v as initFormValidate,
|
|
27
|
+
b as useValidateForm
|
|
28
|
+
};
|
package/dist/esm/hooks/i18n.js
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import "pinia";
|
|
2
2
|
import "vue";
|
|
3
3
|
import "lodash-es";
|
|
4
|
-
import { useI18nStore as
|
|
4
|
+
import { useI18nStore as i } from "../stores/i18n.js";
|
|
5
5
|
import { useManage as g } from "./manage.js";
|
|
6
6
|
function h() {
|
|
7
|
-
const
|
|
7
|
+
const a = i(), c = g();
|
|
8
8
|
return {
|
|
9
|
-
t: (e, o,
|
|
10
|
-
var
|
|
11
|
-
return (
|
|
9
|
+
t: (e, o, r) => {
|
|
10
|
+
var n, t;
|
|
11
|
+
return (t = (n = c.config) == null ? void 0 : n.i18nProvider) == null ? void 0 : t.t(e, o, r);
|
|
12
12
|
},
|
|
13
13
|
changeLocale: (e) => {
|
|
14
|
-
var o,
|
|
15
|
-
return
|
|
14
|
+
var o, r;
|
|
15
|
+
return a.setLocale(e), (r = (o = c.config) == null ? void 0 : o.i18nProvider) == null ? void 0 : r.changeLocale(e);
|
|
16
16
|
},
|
|
17
17
|
getLocale: () => {
|
|
18
18
|
var e, o;
|
|
19
|
-
return (o = (e =
|
|
19
|
+
return (o = (e = c.config) == null ? void 0 : e.i18nProvider) == null ? void 0 : o.getLocale();
|
|
20
|
+
},
|
|
21
|
+
loadLocale: (e, o) => {
|
|
22
|
+
var r, n;
|
|
23
|
+
return (n = (r = c.config) == null ? void 0 : r.i18nProvider) == null ? void 0 : n.loadLocale(e, o);
|
|
24
|
+
},
|
|
25
|
+
mergeLocale: (e, o) => {
|
|
26
|
+
var r, n;
|
|
27
|
+
return (n = (r = c.config) == null ? void 0 : r.i18nProvider) == null ? void 0 : n.mergeLocale(e, o);
|
|
20
28
|
}
|
|
21
29
|
};
|
|
22
30
|
}
|
package/dist/esm/hooks/json.js
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { defaultAdaptors as
|
|
3
|
-
import { injectContext as
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
return (
|
|
1
|
+
import { computed as R, isRef as A, defineComponent as _, h as b, unref as F } from "vue";
|
|
2
|
+
import { defaultAdaptors as G } from "./json/index.js";
|
|
3
|
+
import { injectContext as N } from "./json/utils/contextManager.js";
|
|
4
|
+
function z(t) {
|
|
5
|
+
const O = (t == null ? void 0 : t.adaptors) || G, j = (t == null ? void 0 : t.components) || {}, P = R(() => A(t == null ? void 0 : t.data) ? t == null ? void 0 : t.data.value : t == null ? void 0 : t.data);
|
|
6
|
+
function V() {
|
|
7
|
+
return (A(t == null ? void 0 : t.context) ? t == null ? void 0 : t.context.value : t == null ? void 0 : t.context) || {};
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
return Object.entries(
|
|
12
|
-
if (
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
}),
|
|
9
|
+
function h(e) {
|
|
10
|
+
const r = {};
|
|
11
|
+
return Object.entries(e).forEach(([n, f]) => {
|
|
12
|
+
if (n === "_context") return;
|
|
13
|
+
const l = n === "modelValue" || n.startsWith("modelValue") || n !== "value" && (n.includes("model") || n.includes("Model"));
|
|
14
|
+
r[n] = l && A(f) ? F(f) : f;
|
|
15
|
+
}), r;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return typeof
|
|
17
|
+
function s(e, r, n) {
|
|
18
|
+
return typeof e == "string" ? e : typeof e == "function" ? s(e(r), r, n) : Array.isArray(e) ? e.flatMap((f) => s(f, r, n)).filter(Boolean) : e != null && e.tag ? a(e, !0, n) : e;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
if (
|
|
22
|
-
return typeof
|
|
20
|
+
function E(e, r, n) {
|
|
21
|
+
if (e)
|
|
22
|
+
return typeof e == "string" ? e : Array.isArray(e) ? e.flatMap((f) => typeof f == "string" ? f : a(f, r, n)).filter(Boolean) : a(e, r, n);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function a(e, r = !1, n = {}) {
|
|
25
25
|
const {
|
|
26
|
-
tag:
|
|
27
|
-
attrs:
|
|
28
|
-
children:
|
|
29
|
-
slots:
|
|
30
|
-
} =
|
|
31
|
-
...
|
|
32
|
-
...
|
|
26
|
+
tag: f,
|
|
27
|
+
attrs: l = {},
|
|
28
|
+
children: J,
|
|
29
|
+
slots: B
|
|
30
|
+
} = e, c = {
|
|
31
|
+
...V(),
|
|
32
|
+
...n
|
|
33
33
|
};
|
|
34
|
-
let
|
|
35
|
-
...
|
|
34
|
+
let i = {
|
|
35
|
+
...l
|
|
36
36
|
};
|
|
37
|
-
Object.keys(
|
|
38
|
-
...
|
|
39
|
-
...
|
|
37
|
+
Object.keys(c).length > 0 && (i = {
|
|
38
|
+
...i,
|
|
39
|
+
...N({}, c)
|
|
40
40
|
});
|
|
41
|
-
for (const
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
if (
|
|
45
|
-
if (
|
|
46
|
-
return
|
|
47
|
-
var
|
|
48
|
-
const
|
|
49
|
-
return
|
|
50
|
-
...
|
|
51
|
-
...
|
|
41
|
+
for (const o of O) {
|
|
42
|
+
const u = o.process(e, i);
|
|
43
|
+
if (u) {
|
|
44
|
+
if (i = u.props, u.skip) return null;
|
|
45
|
+
if (u.nodes)
|
|
46
|
+
return u.nodes.map((m) => {
|
|
47
|
+
var v;
|
|
48
|
+
const y = ((v = m.attrs) == null ? void 0 : v._context) || {};
|
|
49
|
+
return a(m, r, {
|
|
50
|
+
...c,
|
|
51
|
+
...y
|
|
52
52
|
});
|
|
53
53
|
}).filter(Boolean);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
const
|
|
59
|
-
return Object.entries(
|
|
60
|
-
|
|
61
|
-
}),
|
|
56
|
+
const d = typeof f == "string" && j[f] ? j[f] : f, M = typeof d != "string", g = h(i);
|
|
57
|
+
if (B && M && !r) {
|
|
58
|
+
const o = {};
|
|
59
|
+
return Object.entries(B).forEach(([u, m]) => {
|
|
60
|
+
o[u] = (y = {}) => s(m, y, c);
|
|
61
|
+
}), b(d, g, o);
|
|
62
62
|
}
|
|
63
|
-
const
|
|
64
|
-
return
|
|
65
|
-
default: () =>
|
|
66
|
-
}) :
|
|
63
|
+
const x = E(J, r, c);
|
|
64
|
+
return M && x !== void 0 ? b(d, g, {
|
|
65
|
+
default: () => x
|
|
66
|
+
}) : b(d, g, x);
|
|
67
67
|
}
|
|
68
68
|
return {
|
|
69
|
-
render: /* @__PURE__ */
|
|
69
|
+
render: /* @__PURE__ */ _({
|
|
70
70
|
name: "JsonSchemaRenderer",
|
|
71
71
|
render() {
|
|
72
|
-
var
|
|
73
|
-
return (
|
|
72
|
+
var e;
|
|
73
|
+
return (e = P.value) == null ? void 0 : e.map((r) => a(r)).filter(Boolean);
|
|
74
74
|
}
|
|
75
75
|
})
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
export {
|
|
79
|
-
|
|
79
|
+
z as useJsonSchema
|
|
80
80
|
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { reactiveComputed as V, useCountdown as W } from "@vueuse/core";
|
|
2
|
+
import { toRef as f, ref as r, watch as P, computed as o } from "vue";
|
|
3
|
+
import { useList as X } from "./data.js";
|
|
4
|
+
import { useExportCsv as I } from "./exportCsv.js";
|
|
5
|
+
import { useImportCsv as Y } from "./importCsv.js";
|
|
6
|
+
function ae(t) {
|
|
7
|
+
const c = f(t, "filters", {}), g = f(t, "sorters", {}), l = f(typeof t.pagination == "object" ? t.pagination : {
|
|
8
|
+
page: 1,
|
|
9
|
+
pageSize: 20
|
|
10
|
+
}), h = [10, 20, 30, 40, 50, 100], x = (e) => h.includes(e) ? h : Array.from({
|
|
11
|
+
length: 5
|
|
12
|
+
}, (a, u) => e * (u + 1)), s = r(x(l.value.pageSize));
|
|
13
|
+
P(() => l.value.pageSize, (e) => {
|
|
14
|
+
s.value.includes(e) || (s.value = x(e));
|
|
15
|
+
});
|
|
16
|
+
const k = (e) => {
|
|
17
|
+
l.value.pageSize = e, l.value.page = 1;
|
|
18
|
+
}, L = (e) => {
|
|
19
|
+
l.value.page = e;
|
|
20
|
+
}, {
|
|
21
|
+
data: i,
|
|
22
|
+
isLoading: R,
|
|
23
|
+
refetch: w
|
|
24
|
+
} = X({
|
|
25
|
+
path: t.path,
|
|
26
|
+
pagination: t.pagination ? l.value : !1,
|
|
27
|
+
filters: c.value,
|
|
28
|
+
sorters: g.value
|
|
29
|
+
}), F = o(() => {
|
|
30
|
+
var e;
|
|
31
|
+
return ((e = i.value) == null ? void 0 : e.data) || [];
|
|
32
|
+
}), S = o(() => {
|
|
33
|
+
var e;
|
|
34
|
+
return ((e = i.value) == null ? void 0 : e.meta) || {};
|
|
35
|
+
}), E = o(() => {
|
|
36
|
+
var e, a;
|
|
37
|
+
return ((e = t.total) == null ? void 0 : e.call(t, i.value)) || ((a = S.value) == null ? void 0 : a[t.totalField || "total"]) || 0;
|
|
38
|
+
}), U = o(() => Math.ceil(E.value / l.value.pageSize) || 0), A = (e) => {
|
|
39
|
+
c.value = e;
|
|
40
|
+
}, y = (e) => {
|
|
41
|
+
g.value = e;
|
|
42
|
+
}, n = r([]), z = o(() => {
|
|
43
|
+
var e, a;
|
|
44
|
+
return n.value.length > 0 && n.value.length === ((a = (e = i.value) == null ? void 0 : e.data) == null ? void 0 : a.length);
|
|
45
|
+
}), M = o(() => {
|
|
46
|
+
var e, a;
|
|
47
|
+
return n.value.length > 0 && n.value.length < (((a = (e = i.value) == null ? void 0 : e.data) == null ? void 0 : a.length) || 0);
|
|
48
|
+
}), b = (e) => {
|
|
49
|
+
const a = n.value.indexOf(e);
|
|
50
|
+
a > -1 ? n.value.splice(a, 1) : n.value.push(e);
|
|
51
|
+
}, j = (e) => {
|
|
52
|
+
n.value = e;
|
|
53
|
+
}, O = (e) => n.value.includes(e), _ = () => {
|
|
54
|
+
var e, a;
|
|
55
|
+
z.value ? n.value = [] : n.value = ((a = (e = i.value) == null ? void 0 : e.data) == null ? void 0 : a.map((u) => u[t.key || "id"]).filter((u) => u != null)) || [];
|
|
56
|
+
};
|
|
57
|
+
P(() => {
|
|
58
|
+
var e;
|
|
59
|
+
return (e = i.value) == null ? void 0 : e.data;
|
|
60
|
+
}, () => {
|
|
61
|
+
n.value = [];
|
|
62
|
+
});
|
|
63
|
+
const d = () => {
|
|
64
|
+
n.value = [], w();
|
|
65
|
+
}, m = r({
|
|
66
|
+
page: 1,
|
|
67
|
+
pageSize: 100
|
|
68
|
+
}), {
|
|
69
|
+
trigger: q,
|
|
70
|
+
isLoading: B
|
|
71
|
+
} = I({
|
|
72
|
+
path: t.path,
|
|
73
|
+
filters: c.value || {},
|
|
74
|
+
sorters: g.value || {},
|
|
75
|
+
maxPage: () => l.value.pageSize || t.exportMaxPage || 10,
|
|
76
|
+
pagination: m.value,
|
|
77
|
+
filename: t.exportFilename || "data.csv",
|
|
78
|
+
onSuccess: (e) => {
|
|
79
|
+
var a;
|
|
80
|
+
(a = t.onExportSuccess) == null || a.call(t, e), m.value.page = 1;
|
|
81
|
+
},
|
|
82
|
+
onProgress: (e) => {
|
|
83
|
+
var a;
|
|
84
|
+
(a = t.onExportProgress) == null || a.call(t, e);
|
|
85
|
+
},
|
|
86
|
+
onError: (e) => {
|
|
87
|
+
var a;
|
|
88
|
+
(a = t.onExportError) == null || a.call(t, e), m.value.page = 1;
|
|
89
|
+
}
|
|
90
|
+
}), D = V(() => ({
|
|
91
|
+
ids: n.value
|
|
92
|
+
})), {
|
|
93
|
+
trigger: G,
|
|
94
|
+
isLoading: H
|
|
95
|
+
} = I({
|
|
96
|
+
path: t.path,
|
|
97
|
+
filters: D,
|
|
98
|
+
maxPage: 1,
|
|
99
|
+
filename: t.exportFilename || "rows.csv",
|
|
100
|
+
onSuccess: (e) => {
|
|
101
|
+
var a;
|
|
102
|
+
(a = t.onExportSuccess) == null || a.call(t, e);
|
|
103
|
+
},
|
|
104
|
+
onError: (e) => {
|
|
105
|
+
var a;
|
|
106
|
+
(a = t.onExportError) == null || a.call(t, e);
|
|
107
|
+
}
|
|
108
|
+
}), {
|
|
109
|
+
open: J,
|
|
110
|
+
isLoading: K
|
|
111
|
+
} = Y({
|
|
112
|
+
path: t.path,
|
|
113
|
+
onComplete: (e) => {
|
|
114
|
+
var a;
|
|
115
|
+
(a = t.onImportSuccess) == null || a.call(t, e);
|
|
116
|
+
},
|
|
117
|
+
onProgress: (e) => {
|
|
118
|
+
var a;
|
|
119
|
+
(a = t.onImportProgress) == null || a.call(t, e);
|
|
120
|
+
},
|
|
121
|
+
onError: (e) => {
|
|
122
|
+
var a;
|
|
123
|
+
(a = t.onImportError) == null || a.call(t, e);
|
|
124
|
+
}
|
|
125
|
+
}), v = r(!1), {
|
|
126
|
+
remaining: N,
|
|
127
|
+
start: C,
|
|
128
|
+
stop: Q
|
|
129
|
+
} = W(10, {
|
|
130
|
+
onComplete: () => {
|
|
131
|
+
d(), C();
|
|
132
|
+
}
|
|
133
|
+
}), T = () => {
|
|
134
|
+
v.value = !v.value, v.value ? (d(), C()) : Q();
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
// 数据
|
|
138
|
+
list: F,
|
|
139
|
+
meta: S,
|
|
140
|
+
isLoading: R,
|
|
141
|
+
pagination: l,
|
|
142
|
+
filters: c,
|
|
143
|
+
sorters: g,
|
|
144
|
+
onRefresh: d,
|
|
145
|
+
onUpdateFilters: A,
|
|
146
|
+
onUpdateSorters: y,
|
|
147
|
+
// 选中
|
|
148
|
+
checkeds: n,
|
|
149
|
+
isAllChecked: z,
|
|
150
|
+
isIndeterminate: M,
|
|
151
|
+
toggleChecked: b,
|
|
152
|
+
isChecked: O,
|
|
153
|
+
toggleSelectAll: _,
|
|
154
|
+
onUpdateChecked: j,
|
|
155
|
+
// 分页
|
|
156
|
+
total: E,
|
|
157
|
+
page: o(() => l.value.page),
|
|
158
|
+
pageSize: o(() => l.value.pageSize),
|
|
159
|
+
pageSizes: s.value,
|
|
160
|
+
pageCount: U,
|
|
161
|
+
onUpdatePage: L,
|
|
162
|
+
onUpdatePageSize: k,
|
|
163
|
+
// 导出
|
|
164
|
+
onExport: q,
|
|
165
|
+
isExporting: B,
|
|
166
|
+
onExportRows: G,
|
|
167
|
+
isExportingRows: H,
|
|
168
|
+
// 导入
|
|
169
|
+
onImport: J,
|
|
170
|
+
isImporting: K,
|
|
171
|
+
// 自动刷新
|
|
172
|
+
autoRefetch: v,
|
|
173
|
+
onAutoRefetch: T,
|
|
174
|
+
autoCountdown: N
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
export {
|
|
178
|
+
ae as useExtendList
|
|
179
|
+
};
|
package/dist/esm/hooks/manage.js
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import { trimStart as c } from "lodash-es";
|
|
2
|
-
import { inject as
|
|
2
|
+
import { inject as h, toRaw as w } from "vue";
|
|
3
|
+
import { useRoute as x } from "vue-router";
|
|
3
4
|
import "pinia";
|
|
4
|
-
import { useManageStore as
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
5
|
+
import { useManageStore as m } from "../stores/manage.js";
|
|
6
|
+
function U(e) {
|
|
7
|
+
const n = h("dux.manage");
|
|
8
|
+
if (e || (e = n == null ? void 0 : n.value), !e)
|
|
8
9
|
throw new Error("manage name is not defined");
|
|
9
|
-
const { config: t } = s(o)
|
|
10
|
+
const { config: t } = m(e), s = (o) => `${t == null ? void 0 : t.routePrefix}/${c(o || "", "/")}`, p = (o, i) => {
|
|
11
|
+
var u, f;
|
|
12
|
+
const r = (u = t == null ? void 0 : t.dataProvider) == null ? void 0 : u[i || "default"];
|
|
13
|
+
return ((f = r == null ? void 0 : r.apiUrl) == null ? void 0 : f.call(r, o)) || "";
|
|
14
|
+
}, l = x(), g = () => {
|
|
15
|
+
const o = l.path, i = (t == null ? void 0 : t.routePrefix) || "";
|
|
16
|
+
return c(o.replace(i, ""), "/");
|
|
17
|
+
};
|
|
10
18
|
return {
|
|
11
|
-
config: t,
|
|
12
|
-
getRoutePath:
|
|
13
|
-
getApiUrl:
|
|
14
|
-
|
|
15
|
-
const r = (n = t == null ? void 0 : t.dataProvider) == null ? void 0 : n[f || "default"];
|
|
16
|
-
return ((u = r == null ? void 0 : r.apiUrl) == null ? void 0 : u.call(r, i)) || "";
|
|
17
|
-
}
|
|
19
|
+
config: w(t),
|
|
20
|
+
getRoutePath: s,
|
|
21
|
+
getApiUrl: p,
|
|
22
|
+
getPath: g
|
|
18
23
|
};
|
|
19
24
|
}
|
|
20
25
|
export {
|
|
21
|
-
|
|
26
|
+
U as useManage
|
|
22
27
|
};
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { useOverlayInject as t } from "@overlastic/vue";
|
|
2
2
|
import "vue";
|
|
3
|
-
import "clsx";
|
|
4
3
|
import "vue-router";
|
|
5
|
-
import { DuxOverlay as m } from "../components/overlay/overlay.js";
|
|
6
4
|
import "pinia";
|
|
7
5
|
import "lodash-es";
|
|
8
6
|
import "@tanstack/vue-query";
|
|
9
7
|
import "json-2-csv";
|
|
8
|
+
import "@vee-validate/rules";
|
|
9
|
+
import "vee-validate";
|
|
10
10
|
import "@vueuse/core";
|
|
11
11
|
import "./json/index.js";
|
|
12
12
|
import "colorizr";
|
|
13
13
|
import "axios";
|
|
14
|
-
|
|
14
|
+
import "clsx";
|
|
15
|
+
import { DuxOverlay as m } from "../components/overlay/overlay.js";
|
|
16
|
+
function j() {
|
|
15
17
|
const r = t(m);
|
|
16
18
|
return {
|
|
17
19
|
show: (o) => r(o)
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
22
|
export {
|
|
21
|
-
|
|
23
|
+
j as useOverlay
|
|
22
24
|
};
|
package/dist/esm/hooks/theme.js
CHANGED
|
@@ -2,15 +2,15 @@ import { useColorMode as Q, useCycleList as W } from "@vueuse/core";
|
|
|
2
2
|
import { hex2rgb as X } from "colorizr";
|
|
3
3
|
import { storeToRefs as Y } from "pinia";
|
|
4
4
|
import { watchEffect as Z, computed as g, watch as _, readonly as I } from "vue";
|
|
5
|
+
import { themeColor as N } from "../config/color.js";
|
|
5
6
|
import "lodash-es";
|
|
6
|
-
import { useThemeStore as
|
|
7
|
-
import { useManage as
|
|
8
|
-
import { themeColor as te } from "./themeColor.js";
|
|
7
|
+
import { useThemeStore as ee } from "../stores/theme.js";
|
|
8
|
+
import { useManage as te } from "./manage.js";
|
|
9
9
|
function de() {
|
|
10
10
|
var V, M;
|
|
11
|
-
const f =
|
|
11
|
+
const f = ee(), { mode: L } = Y(f), C = Q({
|
|
12
12
|
storageRef: L
|
|
13
|
-
}), h =
|
|
13
|
+
}), h = te(), { state: x, next: O, go: p } = W(["dark", "light", "auto"], {
|
|
14
14
|
initialValue: C.store.value
|
|
15
15
|
});
|
|
16
16
|
Z(() => {
|
|
@@ -41,7 +41,7 @@ function de() {
|
|
|
41
41
|
banner: (s = (r = h.config) == null ? void 0 : r.theme) == null ? void 0 : s.banner
|
|
42
42
|
};
|
|
43
43
|
}), n = { ...{
|
|
44
|
-
colors:
|
|
44
|
+
colors: N,
|
|
45
45
|
// 色彩类型
|
|
46
46
|
colorTypes: ["primary", "info", "success", "warning", "error", "gray"],
|
|
47
47
|
// 色彩色阶
|
|
@@ -49,7 +49,7 @@ function de() {
|
|
|
49
49
|
// 色彩场景
|
|
50
50
|
colorScenes: {
|
|
51
51
|
light: {
|
|
52
|
-
default: { default: "
|
|
52
|
+
default: { default: "600", hover: "600", pressed: "700", focus: "500", disabled: "300" }
|
|
53
53
|
},
|
|
54
54
|
dark: {
|
|
55
55
|
default: { default: "500", hover: "400", pressed: "300", focus: "500", disabled: "600" }
|
|
@@ -58,14 +58,14 @@ function de() {
|
|
|
58
58
|
// 语义颜色
|
|
59
59
|
colorSemantic: {
|
|
60
60
|
light: {
|
|
61
|
-
text: { dimmed: "
|
|
61
|
+
text: { dimmed: "300", muted: "400", toned: "600", base: "800", highlighted: "900", inverted: "white" },
|
|
62
62
|
bg: { base: "white", muted: "50", elevated: "100", accented: "200", inverted: "900" },
|
|
63
|
-
border: { base: "
|
|
63
|
+
border: { base: "100", muted: "200", accented: "300", inverted: "900" }
|
|
64
64
|
},
|
|
65
65
|
dark: {
|
|
66
|
-
text: { dimmed: "600", muted: "
|
|
66
|
+
text: { dimmed: "600", muted: "500", toned: "300", base: "400", highlighted: "100", inverted: "black" },
|
|
67
67
|
bg: { base: "950", muted: "900", elevated: "800", accented: "700", inverted: "100" },
|
|
68
|
-
border: { base: "
|
|
68
|
+
border: { base: "600", muted: "800", accented: "700", inverted: "100" }
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
colorBase: { white: "#ffffff", black: "#000000" }
|