@duxweb/dvha-core 0.1.20 → 0.1.22

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 (116) 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/loader.cjs +1 -0
  4. package/dist/cjs/components/loader/remote/loader.cjs +1 -0
  5. package/dist/cjs/components/loader/remote/render.cjs +1 -0
  6. package/dist/cjs/components/overlay/overlay.cjs +1 -1
  7. package/dist/cjs/components/status/error.cjs +1 -1
  8. package/dist/cjs/components/status/exception.cjs +1 -0
  9. package/dist/cjs/components/status/notAuthorized.cjs +1 -1
  10. package/dist/cjs/components/status/notFound.cjs +1 -1
  11. package/dist/cjs/directive/permission.cjs +1 -1
  12. package/dist/cjs/hooks/auth.cjs +1 -1
  13. package/dist/cjs/hooks/data.cjs +1 -1
  14. package/dist/cjs/hooks/export.cjs +1 -1
  15. package/dist/cjs/hooks/form.cjs +1 -1
  16. package/dist/cjs/hooks/formExtend.cjs +1 -0
  17. package/dist/cjs/hooks/formValidate.cjs +1 -0
  18. package/dist/cjs/hooks/i18n.cjs +1 -1
  19. package/dist/cjs/hooks/importCsv.cjs +1 -1
  20. package/dist/cjs/hooks/json/utils/expressionParser.cjs +1 -1
  21. package/dist/cjs/hooks/json.cjs +1 -1
  22. package/dist/cjs/hooks/list.cjs +1 -0
  23. package/dist/cjs/hooks/manage.cjs +1 -1
  24. package/dist/cjs/hooks/menu.cjs +1 -1
  25. package/dist/cjs/hooks/overlay.cjs +1 -1
  26. package/dist/cjs/hooks/select.cjs +1 -1
  27. package/dist/cjs/hooks/theme.cjs +2 -2
  28. package/dist/cjs/hooks/upload.cjs +1 -1
  29. package/dist/cjs/index.cjs +1 -1
  30. package/dist/cjs/main.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/provider/tab.cjs +1 -1
  35. package/dist/cjs/stores/manage.cjs +1 -1
  36. package/dist/cjs/stores/tab.cjs +1 -1
  37. package/dist/cjs/stores/theme.cjs +1 -1
  38. package/dist/cjs/utils/theme.cjs +9 -1
  39. package/dist/esm/components/auth/can.js +9 -7
  40. package/dist/esm/components/loader/loader.js +48 -0
  41. package/dist/esm/components/loader/remote/loader.js +150 -0
  42. package/dist/esm/components/loader/remote/render.js +19 -0
  43. package/dist/esm/components/overlay/overlay.js +22 -31
  44. package/dist/esm/components/status/error.js +3 -3
  45. package/dist/esm/components/status/exception.js +23 -0
  46. package/dist/esm/components/status/notAuthorized.js +2 -2
  47. package/dist/esm/components/status/notFound.js +4 -4
  48. package/dist/esm/directive/permission.js +5 -3
  49. package/dist/esm/hooks/auth.js +67 -67
  50. package/dist/esm/hooks/data.js +164 -160
  51. package/dist/esm/hooks/export.js +26 -23
  52. package/dist/esm/hooks/form.js +38 -35
  53. package/dist/esm/hooks/formExtend.js +38 -0
  54. package/dist/esm/hooks/formValidate.js +28 -0
  55. package/dist/esm/hooks/i18n.js +16 -8
  56. package/dist/esm/hooks/json/utils/expressionParser.js +1 -1
  57. package/dist/esm/hooks/json.js +57 -57
  58. package/dist/esm/hooks/list.js +179 -0
  59. package/dist/esm/hooks/manage.js +18 -13
  60. package/dist/esm/hooks/overlay.js +6 -4
  61. package/dist/esm/hooks/theme.js +11 -11
  62. package/dist/esm/index.js +129 -113
  63. package/dist/esm/main.js +22 -12
  64. package/dist/esm/preset/i18nProvider.js +17 -18
  65. package/dist/esm/provider/app.js +61 -53
  66. package/dist/esm/provider/tab.js +1 -1
  67. package/dist/esm/stores/manage.js +34 -24
  68. package/dist/esm/stores/tab.js +58 -49
  69. package/dist/esm/stores/theme.js +36 -34
  70. package/dist/esm/utils/theme.js +89 -76
  71. package/dist/types/components/index.d.ts +2 -1
  72. package/dist/types/components/loader/loader.d.ts +2 -0
  73. package/dist/types/components/loader/remote/index.d.ts +2 -0
  74. package/dist/types/components/loader/remote/loader.d.ts +1 -0
  75. package/dist/types/components/loader/remote/render.d.ts +1 -0
  76. package/dist/types/components/status/error.d.ts +1 -2
  77. package/dist/types/components/status/exception.d.ts +3 -0
  78. package/dist/types/components/status/index.d.ts +4 -0
  79. package/dist/types/components/status/notAuthorized.d.ts +1 -2
  80. package/dist/types/components/status/notFound.d.ts +1 -2
  81. package/dist/types/config/index.d.ts +1 -0
  82. package/dist/types/hooks/auth.d.ts +6 -6
  83. package/dist/types/hooks/data.d.ts +216 -216
  84. package/dist/types/hooks/form.d.ts +6 -3
  85. package/dist/types/hooks/formExtend.d.ts +12 -0
  86. package/dist/types/hooks/formValidate.d.ts +14 -0
  87. package/dist/types/hooks/i18n.d.ts +2 -0
  88. package/dist/types/hooks/import.d.ts +1 -2
  89. package/dist/types/hooks/index.d.ts +4 -1
  90. package/dist/types/hooks/json.d.ts +1 -1
  91. package/dist/types/hooks/list.d.ts +66 -0
  92. package/dist/types/hooks/manage.d.ts +1 -0
  93. package/dist/types/hooks/menu.d.ts +1 -1
  94. package/dist/types/hooks/overlay.d.ts +1 -1
  95. package/dist/types/hooks/theme.d.ts +8 -8
  96. package/dist/types/index.d.ts +6 -5
  97. package/dist/types/preset/i18nProvider.d.ts +1 -1
  98. package/dist/types/stores/auth.d.ts +9 -24
  99. package/dist/types/stores/i18n.d.ts +7 -16
  100. package/dist/types/stores/index.d.ts +2 -2
  101. package/dist/types/stores/manage.d.ts +7 -16
  102. package/dist/types/stores/route.d.ts +12 -2538
  103. package/dist/types/stores/tab.d.ts +6 -1030
  104. package/dist/types/stores/theme.d.ts +14 -96
  105. package/dist/types/types/config.d.ts +9 -0
  106. package/dist/types/types/i18n.d.ts +1 -0
  107. package/dist/types/types/manage.d.ts +6 -0
  108. package/dist/types/types/theme.d.ts +2 -0
  109. package/dist/types/utils/index.d.ts +1 -1
  110. package/dist/types/utils/theme.d.ts +4 -49
  111. package/package.json +22 -15
  112. package/dist/cjs/node_modules/jsep/dist/jsep.cjs +0 -2
  113. package/dist/esm/node_modules/jsep/dist/jsep.js +0 -737
  114. /package/dist/cjs/{hooks/themeColor.cjs → config/color.cjs} +0 -0
  115. /package/dist/esm/{hooks/themeColor.js → config/color.js} +0 -0
  116. /package/dist/types/{hooks/themeColor.d.ts → config/color.d.ts} +0 -0
@@ -1,8 +1,8 @@
1
- import { cloneDeep as n } from "lodash-es";
2
- import { toRef as N, ref as g, watch as L, computed as S } from "vue";
3
- import { useOne as E, useCreate as D, useUpdate as b } from "./data.js";
4
- function x(e) {
5
- const i = N(e.form || {}), d = g(n(e.form || {})), { data: o, isLoading: v, refetch: l } = 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
- L([() => e.action, () => e.id], async ([t]) => {
14
- var m;
15
- if (t !== "edit")
13
+ E([() => e.action, () => e.id], async () => {
14
+ var t;
15
+ if (!d.value)
16
16
  return;
17
- await l();
18
- const a = n(((m = o.value) == null ? void 0 : m.data) || {});
19
- i.value = a, d.value = a;
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 f = () => {
24
- i.value = n(d.value);
25
- }, u = D({
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: (t) => {
29
- var a;
30
- (a = e.onSuccess) == null || a.call(e, t);
29
+ onSuccess: (a) => {
30
+ var t;
31
+ (t = e.onSuccess) == null || t.call(e, a);
31
32
  },
32
- onError: (t) => {
33
- var a;
34
- (a = e.onError) == null || a.call(e, t);
33
+ onError: (a) => {
34
+ var t;
35
+ (t = e.onError) == null || t.call(e, a);
35
36
  },
36
37
  providerName: e.providerName
37
- }), c = b({
38
+ }), m = S({
38
39
  path: e.path ?? "",
39
40
  id: e.id,
40
41
  data: i.value,
41
- onSuccess: (t) => {
42
- var a;
43
- (a = e.onSuccess) == null || a.call(e, t);
42
+ onSuccess: (a) => {
43
+ var t;
44
+ (t = e.onSuccess) == null || t.call(e, a);
44
45
  },
45
- onError: (t) => {
46
- var a;
47
- (a = e.onError) == null || a.call(e, t);
46
+ onError: (a) => {
47
+ var t;
48
+ (t = e.onError) == null || t.call(e, a);
48
49
  },
49
50
  providerName: e.providerName
50
- }), r = () => {
51
+ }), g = (a) => {
51
52
  e.action === "create" ? u.mutate({
52
- data: i.value
53
- }) : c.mutate({
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 = S(() => v.value || u.isLoading.value || c.isLoading.value);
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
- onSubmit: r,
62
- onReset: f
63
+ isEdit: d,
64
+ onSubmit: g,
65
+ onReset: r
63
66
  };
64
67
  }
65
68
  export {
66
- x as useForm
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
+ };
@@ -1,22 +1,30 @@
1
1
  import "pinia";
2
2
  import "vue";
3
+ import { useI18nStore as i } from "../stores/i18n.js";
3
4
  import "lodash-es";
4
- import { useI18nStore as a } from "../stores/i18n.js";
5
5
  import { useManage as g } from "./manage.js";
6
6
  function h() {
7
- const i = a(), n = g();
7
+ const a = i(), c = g();
8
8
  return {
9
- t: (e, o, t) => {
10
- var r, c;
11
- return (c = (r = n.config) == null ? void 0 : r.i18nProvider) == null ? void 0 : c.t(e, o, t);
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, t;
15
- return i.setLocale(e), (t = (o = n.config) == null ? void 0 : o.i18nProvider) == null ? void 0 : t.changeLocale(e);
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 = n.config) == null ? void 0 : e.i18nProvider) == null ? void 0 : o.getLocale();
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
  }
@@ -1,4 +1,4 @@
1
- import p from "../../../node_modules/jsep/dist/jsep.js";
1
+ import p from "jsep";
2
2
  import { unref as c } from "vue";
3
3
  p.addIdentifierChar("$");
4
4
  p.addIdentifierChar("@");
@@ -1,80 +1,80 @@
1
- import { computed as J, isRef as y, defineComponent as R, h as A, unref as _ } from "vue";
2
- import { defaultAdaptors as F } from "./json/index.js";
3
- import { injectContext as G } from "./json/utils/contextManager.js";
4
- function w(o) {
5
- const v = o.adaptors || F, b = o.components || {}, O = J(() => y(o.data) ? o.data.value : o.data);
6
- function P() {
7
- return (y(o.context) ? o.context.value : o.context) || {};
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 V(r) {
10
- const t = {};
11
- return Object.entries(r).forEach(([e, n]) => {
12
- if (e === "_context") return;
13
- const m = e === "modelValue" || e.startsWith("modelValue") || e !== "value" && (e.includes("model") || e.includes("Model"));
14
- t[e] = m && y(n) ? _(n) : n;
15
- }), t;
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 p(r, t, e) {
18
- return typeof r == "string" ? r : typeof r == "function" ? p(r(t), t, e) : Array.isArray(r) ? r.flatMap((n) => p(n, t, e)).filter(Boolean) : r != null && r.tag ? s(r, !0, e) : r;
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 h(r, t, e) {
21
- if (r)
22
- return typeof r == "string" ? r : Array.isArray(r) ? r.flatMap((n) => typeof n == "string" ? n : s(n, t, e)).filter(Boolean) : s(r, t, e);
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 s(r, t = !1, e = {}) {
24
+ function a(e, r = !1, n = {}) {
25
25
  const {
26
- tag: n,
27
- attrs: m = {},
28
- children: E,
29
- slots: j
30
- } = r, u = {
31
- ...P(),
32
- ...e
26
+ tag: f,
27
+ attrs: l = {},
28
+ children: J,
29
+ slots: B
30
+ } = e, c = {
31
+ ...V(),
32
+ ...n
33
33
  };
34
- let a = {
35
- ...m
34
+ let i = {
35
+ ...l
36
36
  };
37
- Object.keys(u).length > 0 && (a = {
38
- ...a,
39
- ...G({}, u)
37
+ Object.keys(c).length > 0 && (i = {
38
+ ...i,
39
+ ...N({}, c)
40
40
  });
41
- for (const i of v) {
42
- const f = i.process(r, a);
43
- if (f) {
44
- if (a = f.props, f.skip) return null;
45
- if (f.nodes)
46
- return f.nodes.map((d) => {
47
- var M;
48
- const x = ((M = d.attrs) == null ? void 0 : M._context) || {};
49
- return s(d, t, {
50
- ...u,
51
- ...x
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 c = typeof n == "string" && b[n] ? b[n] : n, B = typeof c != "string", l = V(a);
57
- if (j && B && !t) {
58
- const i = {};
59
- return Object.entries(j).forEach(([f, d]) => {
60
- i[f] = (x = {}) => p(d, x, u);
61
- }), A(c, l, i);
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 g = h(E, t, u);
64
- return B && g !== void 0 ? A(c, l, {
65
- default: () => g
66
- }) : A(c, l, g);
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__ */ R({
69
+ render: /* @__PURE__ */ _({
70
70
  name: "JsonSchemaRenderer",
71
71
  render() {
72
- var r;
73
- return (r = O.value) == null ? void 0 : r.map((t) => s(t)).filter(Boolean);
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
- w as useJsonSchema
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
+ };
@@ -1,22 +1,27 @@
1
- import { trimStart as c } from "lodash-es";
2
- import { inject as p } from "vue";
1
+ import { trimStart as f } from "lodash-es";
2
+ import { inject as h } from "vue";
3
+ import { useRoute as x } from "vue-router";
3
4
  import "pinia";
4
- import { useManageStore as s } from "../stores/manage.js";
5
- function w(o) {
6
- const e = p("dux.manage");
7
- if (o || (o = e == null ? void 0 : e.value), !o)
5
+ import { useManageStore as g } from "../stores/manage.js";
6
+ function $(e) {
7
+ const i = h("dux.manage");
8
+ if (e || (e = i == null ? void 0 : i.value), !e)
8
9
  throw new Error("manage name is not defined");
9
- const { config: t } = s(o);
10
+ const { config: t } = g(e), s = (r) => `${t == null ? void 0 : t.routePrefix}/${f(r || "", "/")}`, p = (r, n) => {
11
+ var u, c;
12
+ const o = (u = t == null ? void 0 : t.dataProvider) == null ? void 0 : u[n || "default"];
13
+ return ((c = o == null ? void 0 : o.apiUrl) == null ? void 0 : c.call(o, r)) || "";
14
+ }, l = x();
10
15
  return {
11
16
  config: t,
12
- getRoutePath: (i) => `${t == null ? void 0 : t.routePrefix}/${c(i || "", "/")}`,
13
- getApiUrl: (i, f) => {
14
- var n, u;
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
+ getRoutePath: s,
18
+ getApiUrl: p,
19
+ getPath: () => {
20
+ const r = l.path, n = (t == null ? void 0 : t.routePrefix) || "";
21
+ return f(r.replace(n, ""), "/");
17
22
  }
18
23
  };
19
24
  }
20
25
  export {
21
- w as useManage
26
+ $ 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
- function w() {
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
- w as useOverlay
23
+ j as useOverlay
22
24
  };
@@ -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 N } from "../stores/theme.js";
7
- import { useManage as ee } from "./manage.js";
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 = N(), { mode: L } = Y(f), C = Q({
11
+ const f = ee(), { mode: L } = Y(f), C = Q({
12
12
  storageRef: L
13
- }), h = ee(), { state: x, next: O, go: p } = W(["dark", "light", "auto"], {
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: te,
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: "500", hover: "600", pressed: "700", focus: "500", disabled: "300" }
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: "400", muted: "500", toned: "600", base: "700", highlighted: "900", inverted: "white" },
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: "200", muted: "200", accented: "300", inverted: "900" }
63
+ border: { base: "100", muted: "200", accented: "300", inverted: "900" }
64
64
  },
65
65
  dark: {
66
- text: { dimmed: "600", muted: "400", toned: "300", base: "500", highlighted: "100", inverted: "black" },
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: "900", muted: "800", accented: "700", inverted: "100" }
68
+ border: { base: "600", muted: "800", accented: "700", inverted: "100" }
69
69
  }
70
70
  },
71
71
  colorBase: { white: "#ffffff", black: "#000000" }