@duxweb/dvha-core 0.1.9 → 0.1.11
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/hooks/data.cjs +1 -1
- package/dist/cjs/hooks/export.cjs +1 -0
- package/dist/cjs/hooks/import.cjs +1 -0
- package/dist/cjs/hooks/select.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/provider/tab.cjs +1 -1
- package/dist/esm/hooks/data.js +253 -225
- package/dist/esm/hooks/export.js +33 -0
- package/dist/esm/hooks/import.js +56 -0
- package/dist/esm/hooks/select.js +39 -41
- package/dist/esm/index.js +51 -47
- package/dist/esm/provider/tab.js +32 -30
- package/dist/types/hooks/data.d.ts +104 -19
- package/dist/types/hooks/export.d.ts +14 -0
- package/dist/types/hooks/import.d.ts +29 -0
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/select.d.ts +12 -4
- package/dist/types/types/data.d.ts +5 -4
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ref as P, computed as t } from "vue";
|
|
2
|
+
import { useInfiniteList as d } from "./data.js";
|
|
3
|
+
const w = (e) => new Promise((a) => setTimeout(a, e));
|
|
4
|
+
function N(e) {
|
|
5
|
+
const a = P(!1), i = t(() => {
|
|
6
|
+
const { onSuccess: n, interval: h, maxPage: y, ...x } = e;
|
|
7
|
+
return x;
|
|
8
|
+
}), o = t(() => e.maxPage || 100), l = t(() => e.interval || 300), { data: u, isLoading: r, fetchNextPage: c, hasNextPage: v, refetch: g, pagination: s } = d({
|
|
9
|
+
...i.value,
|
|
10
|
+
options: {
|
|
11
|
+
...i.value.options,
|
|
12
|
+
enabled: !1
|
|
13
|
+
}
|
|
14
|
+
}), f = async () => {
|
|
15
|
+
var n;
|
|
16
|
+
if (!a.value)
|
|
17
|
+
try {
|
|
18
|
+
for (a.value = !0, s.value.page = 1, await g(); v.value && s.value.page < o.value; )
|
|
19
|
+
l.value > 0 && await w(l.value), await c();
|
|
20
|
+
(n = e.onSuccess) == null || n.call(e, u.value);
|
|
21
|
+
} finally {
|
|
22
|
+
a.value = !1;
|
|
23
|
+
}
|
|
24
|
+
}, m = t(() => r.value || a.value);
|
|
25
|
+
return {
|
|
26
|
+
data: u,
|
|
27
|
+
isLoading: m,
|
|
28
|
+
trigger: f
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
N as useExport
|
|
33
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ref as f, computed as u } from "vue";
|
|
2
|
+
import { useCustomMutation as B } from "./data.js";
|
|
3
|
+
const P = (e) => new Promise((a) => setTimeout(a, e));
|
|
4
|
+
function z(e) {
|
|
5
|
+
const a = f(!1), n = f({
|
|
6
|
+
totalItems: 0,
|
|
7
|
+
processedItems: 0,
|
|
8
|
+
totalBatches: 0,
|
|
9
|
+
processedBatches: 0,
|
|
10
|
+
percentage: 0
|
|
11
|
+
}), i = u(() => {
|
|
12
|
+
const { onComplete: c, onProgress: l, onError: m, interval: s, chunkSize: o, ...r } = e;
|
|
13
|
+
return r;
|
|
14
|
+
}), { mutate: I } = B({
|
|
15
|
+
path: e.path,
|
|
16
|
+
method: "POST",
|
|
17
|
+
...i.value,
|
|
18
|
+
options: {
|
|
19
|
+
...i.value.options
|
|
20
|
+
}
|
|
21
|
+
}), k = async (c) => {
|
|
22
|
+
var h, g, v;
|
|
23
|
+
if (a.value)
|
|
24
|
+
return;
|
|
25
|
+
const l = e.chunkSize || 100, m = e.interval || 100, s = c.length, o = [];
|
|
26
|
+
for (let t = 0; t < s; t += l)
|
|
27
|
+
o.push(c.slice(t, t + l));
|
|
28
|
+
const r = o.length;
|
|
29
|
+
n.value = {
|
|
30
|
+
totalItems: s,
|
|
31
|
+
processedItems: 0,
|
|
32
|
+
totalBatches: r,
|
|
33
|
+
processedBatches: 0,
|
|
34
|
+
percentage: 0
|
|
35
|
+
}, a.value = !0;
|
|
36
|
+
try {
|
|
37
|
+
for (let t = 0; t < o.length; t++) {
|
|
38
|
+
const d = o[t];
|
|
39
|
+
await I({
|
|
40
|
+
payload: d
|
|
41
|
+
}), n.value.processedBatches = t + 1, n.value.processedItems += d.length, n.value.percentage = Math.round(n.value.processedItems / s * 100), (h = e.onProgress) == null || h.call(e, n.value), t < o.length - 1 && await P(m);
|
|
42
|
+
}
|
|
43
|
+
a.value = !1, (g = e.onComplete) == null || g.call(e, n.value);
|
|
44
|
+
} catch (t) {
|
|
45
|
+
a.value = !1, (v = e.onError) == null || v.call(e, t);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
isLoading: u(() => a.value),
|
|
50
|
+
progress: u(() => n.value),
|
|
51
|
+
trigger: k
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
z as useImport
|
|
56
|
+
};
|
package/dist/esm/hooks/select.js
CHANGED
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import { debounce as N, isArray as
|
|
2
|
-
import { ref as o,
|
|
3
|
-
import {
|
|
4
|
-
function
|
|
5
|
-
const r = o(),
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { debounce as N, isArray as k } from "lodash-es";
|
|
2
|
+
import { ref as o, computed as s, watch as m } from "vue";
|
|
3
|
+
import { useList as p, useMany as A } from "./data.js";
|
|
4
|
+
function z(a) {
|
|
5
|
+
const r = o(), d = o({
|
|
6
|
+
page: 1,
|
|
7
|
+
pageSize: typeof a.pagination == "number" ? a.pagination : a.pagination ? 20 : 0
|
|
8
|
+
}), f = o(!1), h = N((e) => {
|
|
8
9
|
r.value = e;
|
|
9
|
-
}, a.debounce || 300),
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
b([() => a.path, () => a.params, r], () => {
|
|
13
|
-
a.pagination && (i.value = 1);
|
|
14
|
-
}, { deep: !0 });
|
|
15
|
-
const { data: c, isLoading: w } = A({
|
|
10
|
+
}, a.debounce || 300), b = (e) => {
|
|
11
|
+
h(e);
|
|
12
|
+
}, { data: i, isLoading: V } = p({
|
|
16
13
|
get path() {
|
|
17
14
|
return a.path || "";
|
|
18
15
|
},
|
|
19
16
|
get filters() {
|
|
20
|
-
|
|
17
|
+
const e = { ...a.params };
|
|
18
|
+
return r.value && (e[a.keywordField || "keyword"] = r.value), e;
|
|
21
19
|
},
|
|
22
|
-
get
|
|
23
|
-
|
|
24
|
-
return a.pagination && (e.page = i.value, e.pageSize = f.value), r.value && (e[a.keywordField || "keyword"] = r.value), Object.keys(e).length ? e : void 0;
|
|
20
|
+
get pagination() {
|
|
21
|
+
return a.pagination ? d.value : void 0;
|
|
25
22
|
},
|
|
26
|
-
providerName
|
|
27
|
-
|
|
23
|
+
get providerName() {
|
|
24
|
+
return a.providerName;
|
|
25
|
+
}
|
|
26
|
+
}), v = o([]), g = (e) => {
|
|
28
27
|
const { optionField: n } = a;
|
|
29
28
|
return typeof n == "string" ? e[n] || e.value || e.id : e.value || e.id;
|
|
30
|
-
},
|
|
29
|
+
}, w = (e) => {
|
|
31
30
|
const { optionLabel: n = "label", optionValue: u = "value" } = a;
|
|
32
31
|
let l;
|
|
33
32
|
typeof n == "function" ? l = n(e) : typeof n == "string" ? l = e[n] || e.label || e.name || e.title || String(e.value || e.id || "") : l = e.label || e.name || e.title || String(e.value || e.id || "");
|
|
@@ -37,51 +36,50 @@ function j(a) {
|
|
|
37
36
|
value: t,
|
|
38
37
|
raw: e
|
|
39
38
|
};
|
|
40
|
-
},
|
|
39
|
+
}, y = s(() => {
|
|
41
40
|
var u;
|
|
42
|
-
const e = ((u =
|
|
41
|
+
const e = ((u = i.value) == null ? void 0 : u.data) || [], n = [...v.value];
|
|
43
42
|
return e.forEach((l) => {
|
|
44
43
|
n.some(
|
|
45
|
-
(
|
|
44
|
+
(c) => g(c) === g(l)
|
|
46
45
|
) || n.push(l);
|
|
47
|
-
}), n.map((l) =>
|
|
48
|
-
}),
|
|
46
|
+
}), n.map((l) => w(l));
|
|
47
|
+
}), S = s(() => {
|
|
49
48
|
var e;
|
|
50
|
-
return ((e =
|
|
51
|
-
}), { refetch:
|
|
49
|
+
return ((e = i.value) == null ? void 0 : e.meta) || {};
|
|
50
|
+
}), { refetch: x } = A({
|
|
52
51
|
get path() {
|
|
53
52
|
return a.path || "";
|
|
54
53
|
},
|
|
55
54
|
get ids() {
|
|
56
|
-
return a.defaultValue ?
|
|
55
|
+
return a.defaultValue ? k(a.defaultValue) ? a.defaultValue : [a.defaultValue] : [];
|
|
57
56
|
},
|
|
58
57
|
options: {
|
|
59
58
|
enabled: !1
|
|
60
59
|
},
|
|
61
60
|
providerName: a.providerName
|
|
62
61
|
});
|
|
63
|
-
|
|
62
|
+
m(() => a.defaultValue, async (e) => {
|
|
64
63
|
var l;
|
|
65
|
-
if (!(
|
|
66
|
-
(t) =>
|
|
64
|
+
if (!(f.value || !e || (f.value = !0, (Array.isArray(e) ? e : [e]).every(
|
|
65
|
+
(t) => y.value.some((c) => c.value === t)
|
|
67
66
|
))))
|
|
68
67
|
try {
|
|
69
|
-
const t = await
|
|
70
|
-
|
|
68
|
+
const t = await x();
|
|
69
|
+
v.value = ((l = t == null ? void 0 : t.data) == null ? void 0 : l.data) || [];
|
|
71
70
|
} catch (t) {
|
|
72
71
|
console.warn("Failed to fetch selected items:", t);
|
|
73
72
|
}
|
|
74
73
|
}, { immediate: !0 });
|
|
75
|
-
const F =
|
|
74
|
+
const F = s(() => V.value && !i.value);
|
|
76
75
|
return {
|
|
77
|
-
onSearch:
|
|
78
|
-
options:
|
|
79
|
-
meta:
|
|
76
|
+
onSearch: b,
|
|
77
|
+
options: y,
|
|
78
|
+
meta: S,
|
|
80
79
|
loading: F,
|
|
81
|
-
|
|
82
|
-
pageSize: f
|
|
80
|
+
pagination: d
|
|
83
81
|
};
|
|
84
82
|
}
|
|
85
83
|
export {
|
|
86
|
-
|
|
84
|
+
z as useSelect
|
|
87
85
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,46 +1,48 @@
|
|
|
1
1
|
import { createDux as o } from "./main.js";
|
|
2
|
-
import { useCan as u, useCheck as s, useError as
|
|
2
|
+
import { useCan as u, useCheck as s, useError as p, useForgotPassword as m, useGetAuth as x, useIsLogin as a, useLogin as f, useLogout as n, useRegister as i, useUpdatePassword as d } from "./hooks/auth.js";
|
|
3
3
|
import { useConfig as D } from "./hooks/config.js";
|
|
4
|
-
import { useClient as C, useCreate as M, useCreateMany as v, useCustom as y, useCustomMutation as
|
|
4
|
+
import { useClient as C, useCreate as M, useCreateMany as v, useCustom as y, useCustomMutation as I, useDelete as L, useDeleteMany as T, useInfiniteList as h, useInvalidate as P, useList as S, useMany as A, useOne as c, useUpdate as R, useUpdateMany as w } from "./hooks/data.js";
|
|
5
5
|
import { useManage as U } from "./hooks/manage.js";
|
|
6
|
-
import { useMenu as
|
|
7
|
-
import { useTheme as
|
|
6
|
+
import { useMenu as E } from "./hooks/menu.js";
|
|
7
|
+
import { useTheme as k } from "./hooks/theme.js";
|
|
8
8
|
import { useOverlay as V } from "./hooks/overlay.js";
|
|
9
9
|
import { useI18n as q } from "./hooks/i18n.js";
|
|
10
10
|
import { useSelect as B } from "./hooks/select.js";
|
|
11
11
|
import { useForm as J } from "./hooks/form.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
12
|
+
import { useExport as N } from "./hooks/export.js";
|
|
13
|
+
import { useImport as W } from "./hooks/import.js";
|
|
14
|
+
import { initRouter as Y } from "./router/route.js";
|
|
15
|
+
import { useAuthStore as _ } from "./stores/auth.js";
|
|
16
|
+
import { useRouteStore as ee } from "./stores/route.js";
|
|
17
|
+
import { useTabStore as oe } from "./stores/tab.js";
|
|
18
|
+
import { useManageStore as ue } from "./stores/manage.js";
|
|
19
|
+
import { useI18nStore as pe } from "./stores/i18n.js";
|
|
20
|
+
import { DuxLogo as xe } from "./components/common/logo.js";
|
|
21
|
+
import { default as fe } from "./components/loader/iframe.js";
|
|
22
|
+
import { DuxOverlay as ie } from "./components/overlay/overlay.js";
|
|
23
|
+
import { DuxCan as le } from "./components/auth/can.js";
|
|
24
|
+
import { arrayToTree as ge, searchTree as Ce, treeToArr as Me } from "./utils/tree.js";
|
|
25
|
+
import { DuxAppProvider as ye } from "./provider/app.js";
|
|
26
|
+
import { DuxTabRouterView as Le } from "./provider/tab.js";
|
|
27
|
+
import { simpleAuthProvider as he } from "./preset/authProvider.js";
|
|
28
|
+
import { simpleDataProvider as Se } from "./preset/dataProvider.js";
|
|
29
|
+
import { i18nProvider as ce } from "./preset/i18nProvider.js";
|
|
28
30
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
ye as DuxAppProvider,
|
|
32
|
+
le as DuxCan,
|
|
33
|
+
fe as DuxLoaderIframe,
|
|
34
|
+
xe as DuxLogo,
|
|
35
|
+
ie as DuxOverlay,
|
|
36
|
+
Le as DuxTabRouterView,
|
|
37
|
+
ge as arrayToTree,
|
|
36
38
|
o as createDux,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
ce as i18nProvider,
|
|
40
|
+
Y as initRouter,
|
|
41
|
+
Ce as searchTree,
|
|
42
|
+
he as simpleAuthProvider,
|
|
43
|
+
Se as simpleDataProvider,
|
|
44
|
+
Me as treeToArr,
|
|
45
|
+
_ as useAuthStore,
|
|
44
46
|
u as useCan,
|
|
45
47
|
s as useCheck,
|
|
46
48
|
C as useClient,
|
|
@@ -48,32 +50,34 @@ export {
|
|
|
48
50
|
M as useCreate,
|
|
49
51
|
v as useCreateMany,
|
|
50
52
|
y as useCustom,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
I as useCustomMutation,
|
|
54
|
+
L as useDelete,
|
|
55
|
+
T as useDeleteMany,
|
|
56
|
+
p as useError,
|
|
57
|
+
N as useExport,
|
|
55
58
|
m as useForgotPassword,
|
|
56
59
|
J as useForm,
|
|
57
|
-
|
|
60
|
+
x as useGetAuth,
|
|
58
61
|
q as useI18n,
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
pe as useI18nStore,
|
|
63
|
+
W as useImport,
|
|
64
|
+
h as useInfiniteList,
|
|
61
65
|
P as useInvalidate,
|
|
62
|
-
|
|
66
|
+
a as useIsLogin,
|
|
63
67
|
S as useList,
|
|
64
68
|
f as useLogin,
|
|
65
69
|
n as useLogout,
|
|
66
70
|
U as useManage,
|
|
67
|
-
|
|
71
|
+
ue as useManageStore,
|
|
68
72
|
A as useMany,
|
|
69
|
-
|
|
73
|
+
E as useMenu,
|
|
70
74
|
c as useOne,
|
|
71
75
|
V as useOverlay,
|
|
72
76
|
i as useRegister,
|
|
73
|
-
|
|
77
|
+
ee as useRouteStore,
|
|
74
78
|
B as useSelect,
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
oe as useTabStore,
|
|
80
|
+
k as useTheme,
|
|
77
81
|
R as useUpdate,
|
|
78
82
|
w as useUpdateMany,
|
|
79
83
|
d as useUpdatePassword
|
package/dist/esm/provider/tab.js
CHANGED
|
@@ -8,55 +8,57 @@ const k = /* @__PURE__ */ c({
|
|
|
8
8
|
name: "DuxTabRouterView",
|
|
9
9
|
props: {},
|
|
10
10
|
setup() {
|
|
11
|
-
const r = b(), u = w(),
|
|
12
|
-
let
|
|
13
|
-
const o =
|
|
14
|
-
return n.has(o) ?
|
|
11
|
+
const r = b(), u = w(), p = R(), n = /* @__PURE__ */ new Map(), i = (t, a) => {
|
|
12
|
+
let e;
|
|
13
|
+
const o = t;
|
|
14
|
+
return n.has(o) ? e = n.get(o) : (e = {
|
|
15
15
|
name: o,
|
|
16
16
|
render() {
|
|
17
|
-
return
|
|
17
|
+
return a;
|
|
18
18
|
}
|
|
19
|
-
}, n.set(o,
|
|
19
|
+
}, n.set(o, e)), e;
|
|
20
20
|
};
|
|
21
|
-
u.$subscribe((
|
|
22
|
-
n.forEach((
|
|
23
|
-
|
|
21
|
+
u.$subscribe((t, a) => {
|
|
22
|
+
n.forEach((e) => {
|
|
23
|
+
a.tabs.some((o) => o.path === e.name) || n.delete(e.name);
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
|
-
const s =
|
|
26
|
+
const s = p.getIndexRoute();
|
|
27
27
|
return s && u.addTab({
|
|
28
28
|
...s,
|
|
29
29
|
meta: {
|
|
30
30
|
...s.meta,
|
|
31
31
|
lock: !0
|
|
32
32
|
}
|
|
33
|
-
}), d([r, () =>
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
33
|
+
}), d([r, () => p.routes], () => {
|
|
34
|
+
const t = p.searchRouteName(r.name);
|
|
35
|
+
if (!t)
|
|
36
36
|
return;
|
|
37
|
-
const
|
|
38
|
-
label:
|
|
37
|
+
const a = {
|
|
38
|
+
label: t.label,
|
|
39
39
|
path: r.path,
|
|
40
|
-
name:
|
|
40
|
+
name: t.name
|
|
41
41
|
};
|
|
42
|
-
u.addTab(
|
|
42
|
+
u.addTab(a);
|
|
43
43
|
}, {
|
|
44
44
|
immediate: !0
|
|
45
45
|
}), () => m(h, null, {
|
|
46
46
|
default: ({
|
|
47
|
-
Component:
|
|
48
|
-
}) =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
Component: t
|
|
48
|
+
}) => {
|
|
49
|
+
const a = i(r.path, t);
|
|
50
|
+
return m(l, {
|
|
51
|
+
name: "tab-fade",
|
|
52
|
+
mode: "out-in",
|
|
53
|
+
appear: !0
|
|
54
|
+
}, {
|
|
55
|
+
default: () => [m(f, {
|
|
56
|
+
include: u.tabs.map((e) => e.path || "")
|
|
57
|
+
}, [m(a, {
|
|
58
|
+
key: r.path
|
|
59
|
+
}, null)])]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
60
62
|
});
|
|
61
63
|
}
|
|
62
64
|
});
|