@duxweb/dvha-core 1.1.30 → 1.1.31

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 (159) hide show
  1. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -0
  2. package/dist/cjs/components/auth/can.cjs +1 -1
  3. package/dist/cjs/components/auth/index.cjs +1 -0
  4. package/dist/cjs/components/common/icon.cjs +1 -1
  5. package/dist/cjs/components/common/index.cjs +1 -0
  6. package/dist/cjs/components/common/logo.cjs +1 -1
  7. package/dist/cjs/components/index.cjs +1 -0
  8. package/dist/cjs/components/loader/iframe.cjs +1 -1
  9. package/dist/cjs/components/loader/index.cjs +1 -0
  10. package/dist/cjs/components/loader/loader.cjs +1 -1
  11. package/dist/cjs/components/loader/remote/index.cjs +1 -0
  12. package/dist/cjs/components/loader/remote/loader.cjs +1 -1
  13. package/dist/cjs/components/loader/remote/render.cjs +1 -1
  14. package/dist/cjs/components/overlay/index.cjs +1 -0
  15. package/dist/cjs/components/overlay/overlay.cjs +1 -1
  16. package/dist/cjs/components/status/error.cjs +1 -1
  17. package/dist/cjs/components/status/exception.cjs +1 -1
  18. package/dist/cjs/components/status/index.cjs +1 -0
  19. package/dist/cjs/components/status/notAuthorized.cjs +1 -1
  20. package/dist/cjs/components/status/notFound.cjs +1 -1
  21. package/dist/cjs/config/color.cjs +1 -1
  22. package/dist/cjs/directive/index.cjs +1 -0
  23. package/dist/cjs/directive/permission.cjs +1 -1
  24. package/dist/cjs/hooks/auth.cjs +1 -1
  25. package/dist/cjs/hooks/config.cjs +1 -1
  26. package/dist/cjs/hooks/data.cjs +1 -1
  27. package/dist/cjs/hooks/export.cjs +1 -1
  28. package/dist/cjs/hooks/exportCsv.cjs +2 -2
  29. package/dist/cjs/hooks/form.cjs +1 -1
  30. package/dist/cjs/hooks/formExtend.cjs +1 -1
  31. package/dist/cjs/hooks/formValidate.cjs +1 -1
  32. package/dist/cjs/hooks/i18n.cjs +1 -1
  33. package/dist/cjs/hooks/import.cjs +1 -1
  34. package/dist/cjs/hooks/importCsv.cjs +2 -2
  35. package/dist/cjs/hooks/index.cjs +1 -0
  36. package/dist/cjs/hooks/json/index.cjs +1 -1
  37. package/dist/cjs/hooks/json/utils/contextManager.cjs +1 -1
  38. package/dist/cjs/hooks/json/utils/expressionParser.cjs +1 -1
  39. package/dist/cjs/hooks/json/vFor.cjs +1 -1
  40. package/dist/cjs/hooks/json/vIf.cjs +1 -1
  41. package/dist/cjs/hooks/json/vModel.cjs +1 -1
  42. package/dist/cjs/hooks/json/vOn.cjs +1 -1
  43. package/dist/cjs/hooks/json/vShow.cjs +1 -1
  44. package/dist/cjs/hooks/json/vText.cjs +1 -1
  45. package/dist/cjs/hooks/json.cjs +1 -1
  46. package/dist/cjs/hooks/list.cjs +1 -1
  47. package/dist/cjs/hooks/manage.cjs +1 -1
  48. package/dist/cjs/hooks/menu.cjs +1 -1
  49. package/dist/cjs/hooks/overlay.cjs +1 -1
  50. package/dist/cjs/hooks/select.cjs +1 -1
  51. package/dist/cjs/hooks/theme.cjs +4 -8
  52. package/dist/cjs/hooks/tree.cjs +1 -1
  53. package/dist/cjs/hooks/upload/index.cjs +1 -0
  54. package/dist/cjs/hooks/upload/local.cjs +1 -1
  55. package/dist/cjs/hooks/upload/s3.cjs +1 -1
  56. package/dist/cjs/hooks/upload.cjs +1 -1
  57. package/dist/cjs/index.cjs +1 -1
  58. package/dist/cjs/main.cjs +1 -1
  59. package/dist/cjs/preset/authProvider.cjs +1 -1
  60. package/dist/cjs/preset/dataProvider.cjs +1 -1
  61. package/dist/cjs/preset/i18nProvider.cjs +1 -1
  62. package/dist/cjs/preset/index.cjs +1 -0
  63. package/dist/cjs/provider/app.cjs +1 -1
  64. package/dist/cjs/provider/index.cjs +1 -0
  65. package/dist/cjs/provider/tab.cjs +1 -1
  66. package/dist/cjs/router/index.cjs +1 -0
  67. package/dist/cjs/router/route.cjs +1 -1
  68. package/dist/cjs/stores/auth.cjs +1 -1
  69. package/dist/cjs/stores/i18n.cjs +1 -1
  70. package/dist/cjs/stores/index.cjs +1 -0
  71. package/dist/cjs/stores/jsonSchema.cjs +1 -1
  72. package/dist/cjs/stores/manage.cjs +1 -1
  73. package/dist/cjs/stores/route.cjs +1 -1
  74. package/dist/cjs/stores/tab.cjs +1 -1
  75. package/dist/cjs/stores/theme.cjs +1 -1
  76. package/dist/cjs/utils/bus.cjs +1 -1
  77. package/dist/cjs/utils/index.cjs +1 -0
  78. package/dist/cjs/utils/theme.cjs +8 -8
  79. package/dist/cjs/utils/tree.cjs +1 -1
  80. package/dist/esm/_virtual/_rolldown/runtime.js +9 -0
  81. package/dist/esm/components/auth/can.js +17 -36
  82. package/dist/esm/components/auth/index.js +1 -0
  83. package/dist/esm/components/common/icon.js +16 -24
  84. package/dist/esm/components/common/index.js +2 -0
  85. package/dist/esm/components/common/logo.js +50 -49
  86. package/dist/esm/components/index.js +14 -0
  87. package/dist/esm/components/loader/iframe.js +16 -18
  88. package/dist/esm/components/loader/index.js +1 -0
  89. package/dist/esm/components/loader/loader.js +11 -40
  90. package/dist/esm/components/loader/remote/index.js +2 -0
  91. package/dist/esm/components/loader/remote/loader.js +118 -156
  92. package/dist/esm/components/loader/remote/render.js +12 -17
  93. package/dist/esm/components/overlay/index.js +1 -0
  94. package/dist/esm/components/overlay/overlay.js +54 -70
  95. package/dist/esm/components/status/error.js +7 -9
  96. package/dist/esm/components/status/exception.js +21 -37
  97. package/dist/esm/components/status/index.js +4 -0
  98. package/dist/esm/components/status/notAuthorized.js +7 -9
  99. package/dist/esm/components/status/notFound.js +7 -9
  100. package/dist/esm/config/color.js +288 -290
  101. package/dist/esm/directive/index.js +1 -0
  102. package/dist/esm/directive/permission.js +7 -27
  103. package/dist/esm/hooks/auth.js +154 -120
  104. package/dist/esm/hooks/config.js +11 -9
  105. package/dist/esm/hooks/data.js +416 -415
  106. package/dist/esm/hooks/export.js +32 -36
  107. package/dist/esm/hooks/exportCsv.js +42 -46
  108. package/dist/esm/hooks/form.js +86 -95
  109. package/dist/esm/hooks/formExtend.js +36 -40
  110. package/dist/esm/hooks/formValidate.js +22 -25
  111. package/dist/esm/hooks/i18n.js +14 -18
  112. package/dist/esm/hooks/import.js +45 -54
  113. package/dist/esm/hooks/importCsv.js +90 -83
  114. package/dist/esm/hooks/index.js +31 -0
  115. package/dist/esm/hooks/json/index.js +14 -22
  116. package/dist/esm/hooks/json/utils/contextManager.js +35 -26
  117. package/dist/esm/hooks/json/utils/expressionParser.js +100 -123
  118. package/dist/esm/hooks/json/vFor.js +50 -55
  119. package/dist/esm/hooks/json/vIf.js +17 -16
  120. package/dist/esm/hooks/json/vModel.js +96 -106
  121. package/dist/esm/hooks/json/vOn.js +30 -32
  122. package/dist/esm/hooks/json/vShow.js +20 -22
  123. package/dist/esm/hooks/json/vText.js +44 -51
  124. package/dist/esm/hooks/json.js +131 -132
  125. package/dist/esm/hooks/list.js +150 -184
  126. package/dist/esm/hooks/manage.js +25 -22
  127. package/dist/esm/hooks/menu.js +57 -61
  128. package/dist/esm/hooks/overlay.js +6 -23
  129. package/dist/esm/hooks/select.js +84 -94
  130. package/dist/esm/hooks/theme.js +289 -219
  131. package/dist/esm/hooks/tree.js +43 -47
  132. package/dist/esm/hooks/upload/index.js +2 -0
  133. package/dist/esm/hooks/upload/local.js +24 -30
  134. package/dist/esm/hooks/upload/s3.js +70 -80
  135. package/dist/esm/hooks/upload.js +256 -272
  136. package/dist/esm/index.js +150 -141
  137. package/dist/esm/main.js +24 -45
  138. package/dist/esm/preset/authProvider.js +62 -68
  139. package/dist/esm/preset/dataProvider.js +154 -180
  140. package/dist/esm/preset/i18nProvider.js +28 -30
  141. package/dist/esm/preset/index.js +3 -0
  142. package/dist/esm/provider/app.js +124 -151
  143. package/dist/esm/provider/index.js +2 -0
  144. package/dist/esm/provider/tab.js +49 -66
  145. package/dist/esm/router/index.js +1 -0
  146. package/dist/esm/router/route.js +39 -46
  147. package/dist/esm/stores/auth.js +51 -46
  148. package/dist/esm/stores/i18n.js +32 -29
  149. package/dist/esm/stores/index.js +7 -0
  150. package/dist/esm/stores/jsonSchema.js +47 -34
  151. package/dist/esm/stores/manage.js +63 -48
  152. package/dist/esm/stores/route.js +60 -56
  153. package/dist/esm/stores/tab.js +55 -60
  154. package/dist/esm/stores/theme.js +48 -55
  155. package/dist/esm/utils/bus.js +3 -5
  156. package/dist/esm/utils/index.js +3 -0
  157. package/dist/esm/utils/theme.js +110 -93
  158. package/dist/esm/utils/tree.js +28 -37
  159. package/package.json +1 -1
@@ -1,37 +1,33 @@
1
- import { ref as P, computed as o } from "vue";
2
- import { useInfiniteList as x } from "./data.js";
3
- const d = (e) => new Promise((a) => setTimeout(a, e));
4
- function b(e) {
5
- const a = P(!1), l = o(() => {
6
- const { onSuccess: n, onProgress: h, interval: w, maxPage: y, ...r } = e;
7
- return {
8
- ...r,
9
- options: {
10
- ...r.options,
11
- enabled: !1,
12
- refetchOnMount: !1,
13
- refetchOnWindowFocus: !1,
14
- refetchOnReconnect: !1
15
- }
16
- };
17
- }), i = o(() => e.interval || 300), { data: s, isLoading: u, fetchNextPage: c, hasNextPage: f, refetch: g, pagination: t } = x(l.value), v = async () => {
18
- if (!a.value)
19
- try {
20
- a.value = !0, t.value.page = 1, e.onProgress?.(t.value), await g();
21
- const n = typeof e.maxPage == "function" ? e.maxPage() : e.maxPage || 0;
22
- for (; f.value && !(n > 0 && t.value.page >= n); )
23
- i.value > 0 && await d(i.value), await c(), e.onProgress?.(t.value);
24
- e.onSuccess?.(s.value);
25
- } finally {
26
- a.value = !1;
27
- }
28
- }, m = o(() => u.value || a.value);
29
- return {
30
- data: s,
31
- isLoading: m,
32
- trigger: v
33
- };
1
+ import { useInfiniteList as e } from "./data.js";
2
+ import { computed as t, ref as n } from "vue";
3
+ var r = (e) => new Promise((t) => setTimeout(t, e));
4
+ function i(i) {
5
+ let a = n(!1), o = t(() => {
6
+ let { onSuccess: e, onProgress: t, interval: n, maxPage: r, ...a } = i;
7
+ return {
8
+ ...a,
9
+ options: {
10
+ ...a.options,
11
+ enabled: !1,
12
+ refetchOnMount: !1,
13
+ refetchOnWindowFocus: !1,
14
+ refetchOnReconnect: !1
15
+ }
16
+ };
17
+ }), s = t(() => i.interval || 300), { data: c, isLoading: l, fetchNextPage: u, hasNextPage: d, refetch: f, pagination: p } = e(o.value);
18
+ return {
19
+ data: c,
20
+ isLoading: t(() => l.value || a.value),
21
+ trigger: async () => {
22
+ if (!a.value) try {
23
+ a.value = !0, p.value.page = 1, i.onProgress?.(p.value), await f();
24
+ let e = typeof i.maxPage == "function" ? i.maxPage() : i.maxPage || 0;
25
+ for (; d.value && !(e > 0 && p.value.page >= e);) s.value > 0 && await r(s.value), await u(), i.onProgress?.(p.value);
26
+ i.onSuccess?.(c.value);
27
+ } finally {
28
+ a.value = !1;
29
+ }
30
+ }
31
+ };
34
32
  }
35
- export {
36
- b as useExport
37
- };
33
+ export { i as useExport };
@@ -1,47 +1,43 @@
1
- import { json2csv as d } from "json-2-csv";
2
- import { computed as a } from "vue";
3
- import { useExport as l } from "./export.js";
4
- function h(t) {
5
- const c = a(() => {
6
- const { filename: e, headers: o, csvOptions: n, ...s } = t;
7
- return s;
8
- }), i = a(() => {
9
- const e = t.csvOptions || {}, o = e.quote;
10
- return {
11
- prependHeader: t.headers !== !1,
12
- keys: Array.isArray(t.headers) ? t.headers : void 0,
13
- delimiter: {
14
- field: e.delimiter || ",",
15
- wrap: typeof o == "string" ? o : '"',
16
- eol: e.eol || `
17
- `
18
- },
19
- // 默认为 Excel 加上 UTF-8 BOM,避免中文在 Excel 中出现乱码
20
- excelBOM: e.writeBOM !== !1
21
- };
22
- });
23
- return l({
24
- ...c.value,
25
- onSuccess: async (e) => {
26
- if (!e?.data || !e?.data?.length) {
27
- t.onError?.({
28
- message: "No data to export",
29
- status: 400
30
- });
31
- return;
32
- }
33
- try {
34
- const o = await d(e.data, i.value), n = new Blob([o], { type: "text/csv;charset=utf-8;" }), s = URL.createObjectURL(n), r = document.createElement("a");
35
- r.href = s, r.download = t.filename || "export.csv", r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(s), t.onSuccess?.(e);
36
- } catch (o) {
37
- t.onError?.({
38
- message: `CSV Export Error: ${o}`,
39
- status: 500
40
- });
41
- }
42
- }
43
- });
1
+ import { useExport as e } from "./export.js";
2
+ import { computed as t } from "vue";
3
+ import { json2csv as n } from "json-2-csv";
4
+ function r(r) {
5
+ let i = t(() => {
6
+ let { filename: e, headers: t, csvOptions: n, ...i } = r;
7
+ return i;
8
+ }), a = t(() => {
9
+ let e = r.csvOptions || {}, t = e.quote;
10
+ return {
11
+ prependHeader: r.headers !== !1,
12
+ keys: Array.isArray(r.headers) ? r.headers : void 0,
13
+ delimiter: {
14
+ field: e.delimiter || ",",
15
+ wrap: typeof t == "string" ? t : "\"",
16
+ eol: e.eol || "\n"
17
+ },
18
+ excelBOM: e.writeBOM !== !1
19
+ };
20
+ });
21
+ return e({
22
+ ...i.value,
23
+ onSuccess: async (e) => {
24
+ if (!e?.data || !e?.data?.length) {
25
+ r.onError?.({
26
+ message: "No data to export",
27
+ status: 400
28
+ });
29
+ return;
30
+ }
31
+ try {
32
+ let t = await n(e.data, a.value), i = new Blob([t], { type: "text/csv;charset=utf-8;" }), o = URL.createObjectURL(i), s = document.createElement("a");
33
+ s.href = o, s.download = r.filename || "export.csv", s.style.display = "none", document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(o), r.onSuccess?.(e);
34
+ } catch (e) {
35
+ r.onError?.({
36
+ message: `CSV Export Error: ${e}`,
37
+ status: 500
38
+ });
39
+ }
40
+ }
41
+ });
44
42
  }
45
- export {
46
- h as useExportCsv
47
- };
43
+ export { r as useExportCsv };
@@ -1,96 +1,87 @@
1
- import { cloneDeep as n } from "lodash-es";
2
- import { toRef as s, ref as h, computed as b, watch as O } from "vue";
3
- import { useOne as E, useCreate as L, useUpdate as S } from "./data.js";
4
- function x(a) {
5
- const t = s(a, "form", {}), r = s(a, "id", void 0), i = s(a, "meta", {}), l = s(a, "params", {}), o = h(n(t.value || {})), c = h(n(t.value || {})), u = b(() => a.action === "edit" || !!r.value), { data: d, isLoading: D, refetch: m } = E({
6
- get path() {
7
- return a.path || "";
8
- },
9
- get id() {
10
- return r.value;
11
- },
12
- get meta() {
13
- return {
14
- params: {
15
- ...l.value
16
- },
17
- ...i.value
18
- };
19
- },
20
- options: {
21
- enabled: !1
22
- },
23
- providerName: a.providerName
24
- }), v = () => {
25
- let e = {};
26
- u.value ? e = n(o.value) : e = n(c.value), Object.assign(t.value, e);
27
- };
28
- O([r, u], async () => {
29
- if (!u.value) {
30
- v();
31
- return;
32
- }
33
- await m();
34
- const e = n(d.value?.data || {});
35
- Object.assign(t.value, e), Object.assign(o.value, e);
36
- }, {
37
- immediate: !0,
38
- deep: !0
39
- }), O([l, i], async () => {
40
- if (!u.value)
41
- return;
42
- await m();
43
- const e = n(d.value?.data || {});
44
- Object.assign(t.value, e), Object.assign(o.value, e);
45
- }, { deep: !0 });
46
- const g = L({
47
- path: a.path ?? "",
48
- data: t.value,
49
- get meta() {
50
- return i.value || {};
51
- },
52
- onSuccess: (e) => {
53
- v(), a.onSuccess?.(e);
54
- },
55
- onError: (e) => {
56
- a.onError?.(e);
57
- },
58
- providerName: a.providerName
59
- }), f = S({
60
- get path() {
61
- return a.path ?? "";
62
- },
63
- get id() {
64
- return r.value;
65
- },
66
- data: t.value,
67
- get meta() {
68
- return i.value || {};
69
- },
70
- onSuccess: (e) => {
71
- a.onSuccess?.(e);
72
- },
73
- onError: (e) => {
74
- a.onError?.(e);
75
- },
76
- providerName: a.providerName
77
- }), N = (e) => {
78
- u.value ? f.mutate({
79
- id: r.value,
80
- data: e || t.value
81
- }) : g.mutate({
82
- data: e || t.value
83
- });
84
- }, j = b(() => D.value || g.isLoading.value || f.isLoading.value);
85
- return {
86
- form: t,
87
- initData: u.value ? o.value : c.value,
88
- isLoading: j,
89
- isEdit: u,
90
- onSubmit: N,
91
- onReset: v
92
- };
1
+ import { useCreate as e, useOne as t, useUpdate as n } from "./data.js";
2
+ import { computed as r, ref as i, toRef as a, watch as o } from "vue";
3
+ import { cloneDeep as s } from "lodash-es";
4
+ function c(c) {
5
+ let l = a(c, "form", {}), u = a(c, "id", void 0), d = a(c, "meta", {}), f = a(c, "params", {}), p = i(s(l.value || {})), m = i(s(l.value || {})), h = r(() => c.action === "edit" || !!u.value), { data: g, isLoading: _, refetch: v } = t({
6
+ get path() {
7
+ return c.path || "";
8
+ },
9
+ get id() {
10
+ return u.value;
11
+ },
12
+ get meta() {
13
+ return {
14
+ params: { ...f.value },
15
+ ...d.value
16
+ };
17
+ },
18
+ options: { enabled: !1 },
19
+ providerName: c.providerName
20
+ }), y = () => {
21
+ let e = {};
22
+ e = h.value ? s(p.value) : s(m.value), Object.assign(l.value, e);
23
+ };
24
+ o([u, h], async () => {
25
+ if (!h.value) {
26
+ y();
27
+ return;
28
+ }
29
+ await v();
30
+ let e = s(g.value?.data || {});
31
+ Object.assign(l.value, e), Object.assign(p.value, e);
32
+ }, {
33
+ immediate: !0,
34
+ deep: !0
35
+ }), o([f, d], async () => {
36
+ if (!h.value) return;
37
+ await v();
38
+ let e = s(g.value?.data || {});
39
+ Object.assign(l.value, e), Object.assign(p.value, e);
40
+ }, { deep: !0 });
41
+ let b = e({
42
+ path: c.path ?? "",
43
+ data: l.value,
44
+ get meta() {
45
+ return d.value || {};
46
+ },
47
+ onSuccess: (e) => {
48
+ y(), c.onSuccess?.(e);
49
+ },
50
+ onError: (e) => {
51
+ c.onError?.(e);
52
+ },
53
+ providerName: c.providerName
54
+ }), x = n({
55
+ get path() {
56
+ return c.path ?? "";
57
+ },
58
+ get id() {
59
+ return u.value;
60
+ },
61
+ data: l.value,
62
+ get meta() {
63
+ return d.value || {};
64
+ },
65
+ onSuccess: (e) => {
66
+ c.onSuccess?.(e);
67
+ },
68
+ onError: (e) => {
69
+ c.onError?.(e);
70
+ },
71
+ providerName: c.providerName
72
+ }), S = (e) => {
73
+ h.value ? x.mutate({
74
+ id: u.value,
75
+ data: e || l.value
76
+ }) : b.mutate({ data: e || l.value });
77
+ }, C = r(() => _.value || b.isLoading.value || x.isLoading.value);
78
+ return {
79
+ form: l,
80
+ initData: h.value ? p.value : m.value,
81
+ isLoading: C,
82
+ isEdit: h,
83
+ onSubmit: S,
84
+ onReset: y
85
+ };
93
86
  }
94
- export {
95
- x as useForm
96
- };
87
+ export { c as useForm };
@@ -1,41 +1,37 @@
1
- import { toRef as d } from "vue";
2
- import { useForm as u } from "./form.js";
3
- import { useValidateForm as c } from "./formValidate.js";
4
- function v(t) {
5
- const o = d(t, "form", {}), { validate: i, reset: n } = c({
6
- data: o,
7
- rules: t.rules
8
- }), e = u({
9
- id: t.id,
10
- path: t.path,
11
- form: o,
12
- action: t.action,
13
- onSuccess: t.onSuccess,
14
- onError: t.onError,
15
- providerName: t.providerName,
16
- meta: t.meta,
17
- params: t.params
18
- }), r = (m) => {
19
- i().then((s) => {
20
- if (!s.valid) {
21
- t.onError?.({
22
- message: "表单验证失败"
23
- });
24
- return;
25
- }
26
- e.onSubmit(m);
27
- });
28
- }, a = () => {
29
- e.onReset(), n();
30
- };
31
- return {
32
- isLoading: e.isLoading,
33
- isEdit: e.isEdit,
34
- form: o,
35
- onSubmit: r,
36
- onReset: a
37
- };
1
+ import { useForm as e } from "./form.js";
2
+ import { useValidateForm as t } from "./formValidate.js";
3
+ import { toRef as n } from "vue";
4
+ function r(r) {
5
+ let i = n(r, "form", {}), { validate: a, reset: o } = t({
6
+ data: i,
7
+ rules: r.rules
8
+ }), s = e({
9
+ id: r.id,
10
+ path: r.path,
11
+ form: i,
12
+ action: r.action,
13
+ onSuccess: r.onSuccess,
14
+ onError: r.onError,
15
+ providerName: r.providerName,
16
+ meta: r.meta,
17
+ params: r.params
18
+ });
19
+ return {
20
+ isLoading: s.isLoading,
21
+ isEdit: s.isEdit,
22
+ form: i,
23
+ onSubmit: (e) => {
24
+ a().then((t) => {
25
+ if (!t.valid) {
26
+ r.onError?.({ message: "表单验证失败" });
27
+ return;
28
+ }
29
+ s.onSubmit(e);
30
+ });
31
+ },
32
+ onReset: () => {
33
+ s.onReset(), o();
34
+ }
35
+ };
38
36
  }
39
- export {
40
- v as useExtendForm
41
- };
37
+ export { r as useExtendForm };
@@ -1,28 +1,25 @@
1
- import { all as m } from "@vee-validate/rules";
1
+ import { toRef as e, watch as t } from "vue";
2
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
- };
3
+ import { all as r } from "@vee-validate/rules";
4
+ import { defineRule as i, useForm as a } from "vee-validate";
5
+ function o(r) {
6
+ let i = e(r, "data"), { setValues: o, validate: s, resetForm: c, handleSubmit: l } = a({
7
+ initialValues: n(i.value || {}),
8
+ validationSchema: r.rules
9
+ });
10
+ return t(i, (e) => {
11
+ o(e || {}, !1);
12
+ }, { deep: !0 }), {
13
+ validate: s,
14
+ reset: () => {
15
+ c();
16
+ },
17
+ submit: l
18
+ };
19
19
  }
20
- function v() {
21
- Object.entries(m).forEach(([e, t]) => {
22
- u(e, t);
23
- });
20
+ function s() {
21
+ Object.entries(r).forEach(([e, t]) => {
22
+ i(e, t);
23
+ });
24
24
  }
25
- export {
26
- v as initFormValidate,
27
- b as useValidateForm
28
- };
25
+ export { s as initFormValidate, o as useValidateForm };
@@ -1,19 +1,15 @@
1
- import "pinia";
2
- import "vue";
3
- import { useI18nStore as t } from "../stores/i18n.js";
4
- import "lodash-es";
5
- import { useManage as a } from "./manage.js";
6
- function P() {
7
- const n = t(), o = a();
8
- return {
9
- t: (e, r, c) => o.config?.i18nProvider?.t(e, r, c),
10
- changeLocale: (e) => (n.setLocale(e), o.config?.i18nProvider?.changeLocale(e)),
11
- getLocale: () => o.config?.i18nProvider?.getLocale(),
12
- loadLocale: (e, r) => o.config?.i18nProvider?.loadLocale(e, r),
13
- mergeLocale: (e, r) => o.config?.i18nProvider?.mergeLocale(e, r),
14
- getLocales: () => o.config?.i18nProvider?.getLocales()
15
- };
1
+ import { useI18nStore as e } from "../stores/i18n.js";
2
+ import "../stores/index.js";
3
+ import { useManage as t } from "./manage.js";
4
+ function n() {
5
+ let n = e(), r = t();
6
+ return {
7
+ t: (e, t, n) => r.config?.i18nProvider?.t(e, t, n),
8
+ changeLocale: (e) => (n.setLocale(e), r.config?.i18nProvider?.changeLocale(e)),
9
+ getLocale: () => r.config?.i18nProvider?.getLocale(),
10
+ loadLocale: (e, t) => r.config?.i18nProvider?.loadLocale(e, t),
11
+ mergeLocale: (e, t) => r.config?.i18nProvider?.mergeLocale(e, t),
12
+ getLocales: () => r.config?.i18nProvider?.getLocales()
13
+ };
16
14
  }
17
- export {
18
- P as useI18n
19
- };
15
+ export { n as useI18n };
@@ -1,55 +1,46 @@
1
- import { ref as g, computed as u } from "vue";
2
- import { useCustomMutation as d } from "./data.js";
3
- const f = (t) => new Promise((s) => setTimeout(s, t));
4
- function P(t) {
5
- const s = g(!1), o = g({
6
- totalItems: 0,
7
- processedItems: 0,
8
- totalBatches: 0,
9
- processedBatches: 0,
10
- percentage: 0
11
- }), i = u(() => {
12
- const { onComplete: r, onProgress: c, onError: m, interval: a, chunkSize: n, ...l } = t;
13
- return l;
14
- }), { mutate: v } = d({
15
- path: t.path,
16
- method: "POST",
17
- ...i.value,
18
- options: {
19
- ...i.value.options
20
- }
21
- }), p = async (r) => {
22
- if (s.value)
23
- return;
24
- const c = t.chunkSize || 100, m = t.interval || 100, a = r.length, n = [];
25
- for (let e = 0; e < a; e += c)
26
- n.push(r.slice(e, e + c));
27
- const l = n.length;
28
- o.value = {
29
- totalItems: a,
30
- processedItems: 0,
31
- totalBatches: l,
32
- processedBatches: 0,
33
- percentage: 0
34
- }, s.value = !0;
35
- try {
36
- for (let e = 0; e < n.length; e++) {
37
- const h = n[e];
38
- await v({
39
- payload: h
40
- }), o.value.processedBatches = e + 1, o.value.processedItems += h.length, o.value.percentage = Math.round(o.value.processedItems / a * 100), t.onProgress?.(o.value), e < n.length - 1 && await f(m);
41
- }
42
- s.value = !1, t.onComplete?.(o.value);
43
- } catch (e) {
44
- s.value = !1, t.onError?.(e);
45
- }
46
- };
47
- return {
48
- isLoading: u(() => s.value),
49
- progress: u(() => o.value),
50
- trigger: p
51
- };
1
+ import { useCustomMutation as e } from "./data.js";
2
+ import { computed as t, ref as n } from "vue";
3
+ var r = (e) => new Promise((t) => setTimeout(t, e));
4
+ function i(i) {
5
+ let a = n(!1), o = n({
6
+ totalItems: 0,
7
+ processedItems: 0,
8
+ totalBatches: 0,
9
+ processedBatches: 0,
10
+ percentage: 0
11
+ }), s = t(() => {
12
+ let { onComplete: e, onProgress: t, onError: n, interval: r, chunkSize: a, ...o } = i;
13
+ return o;
14
+ }), { mutate: c } = e({
15
+ path: i.path,
16
+ method: "POST",
17
+ ...s.value,
18
+ options: { ...s.value.options }
19
+ });
20
+ return {
21
+ isLoading: t(() => a.value),
22
+ progress: t(() => o.value),
23
+ trigger: async (e) => {
24
+ if (a.value) return;
25
+ let t = i.chunkSize || 100, n = i.interval || 100, s = e.length, l = [];
26
+ for (let n = 0; n < s; n += t) l.push(e.slice(n, n + t));
27
+ o.value = {
28
+ totalItems: s,
29
+ processedItems: 0,
30
+ totalBatches: l.length,
31
+ processedBatches: 0,
32
+ percentage: 0
33
+ }, a.value = !0;
34
+ try {
35
+ for (let e = 0; e < l.length; e++) {
36
+ let t = l[e];
37
+ await c({ payload: t }), o.value.processedBatches = e + 1, o.value.processedItems += t.length, o.value.percentage = Math.round(o.value.processedItems / s * 100), i.onProgress?.(o.value), e < l.length - 1 && await r(n);
38
+ }
39
+ a.value = !1, i.onComplete?.(o.value);
40
+ } catch (e) {
41
+ a.value = !1, i.onError?.(e);
42
+ }
43
+ }
44
+ };
52
45
  }
53
- export {
54
- P as useImport
55
- };
46
+ export { i as useImport };