@duxweb/dvha-core 0.1.10 → 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/import.cjs +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/hooks/import.js +56 -0
- package/dist/esm/index.js +44 -42
- package/dist/types/hooks/import.d.ts +29 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue"),S=require("./data.cjs"),k=e=>new Promise(a=>setTimeout(a,e));function y(e){const a=s.ref(!1),n=s.ref({totalItems:0,processedItems:0,totalBatches:0,processedBatches:0,percentage:0}),i=s.computed(()=>{const{onComplete:u,onProgress:l,onError:m,interval:c,chunkSize:o,...r}=e;return r}),{mutate:f}=S.useCustomMutation({path:e.path,method:"POST",...i.value,options:{...i.value.options}}),I=async u=>{var h,g,v;if(a.value)return;const l=e.chunkSize||100,m=e.interval||100,c=u.length,o=[];for(let t=0;t<c;t+=l)o.push(u.slice(t,t+l));const r=o.length;n.value={totalItems:c,processedItems:0,totalBatches:r,processedBatches:0,percentage:0},a.value=!0;try{for(let t=0;t<o.length;t++){const d=o[t];await f({payload:d}),n.value.processedBatches=t+1,n.value.processedItems+=d.length,n.value.percentage=Math.round(n.value.processedItems/c*100),(h=e.onProgress)==null||h.call(e,n.value),t<o.length-1&&await k(m)}a.value=!1,(g=e.onComplete)==null||g.call(e,n.value)}catch(t){a.value=!1,(v=e.onError)==null||v.call(e,t)}};return{isLoading:s.computed(()=>a.value),progress:s.computed(()=>n.value),trigger:I}}exports.useImport=y;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./main.cjs"),r=require("./hooks/auth.cjs"),t=require("./hooks/config.cjs"),e=require("./hooks/data.cjs"),o=require("./hooks/manage.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./main.cjs"),r=require("./hooks/auth.cjs"),t=require("./hooks/config.cjs"),e=require("./hooks/data.cjs"),o=require("./hooks/manage.cjs"),i=require("./hooks/menu.cjs"),n=require("./hooks/theme.cjs"),a=require("./hooks/overlay.cjs"),c=require("./hooks/i18n.cjs"),q=require("./hooks/select.cjs"),d=require("./hooks/form.cjs"),l=require("./hooks/export.cjs"),g=require("./hooks/import.cjs"),m=require("./router/route.cjs"),p=require("./stores/auth.cjs"),v=require("./stores/route.cjs"),D=require("./stores/tab.cjs"),y=require("./stores/manage.cjs"),C=require("./stores/i18n.cjs"),M=require("./components/common/logo.cjs"),h=require("./components/loader/iframe.cjs"),x=require("./components/overlay/overlay.cjs"),P=require("./components/auth/can.cjs"),u=require("./utils/tree.cjs"),T=require("./provider/app.cjs"),S=require("./provider/tab.cjs"),I=require("./preset/authProvider.cjs"),L=require("./preset/dataProvider.cjs"),A=require("./preset/i18nProvider.cjs");exports.createDux=s.createDux;exports.useCan=r.useCan;exports.useCheck=r.useCheck;exports.useError=r.useError;exports.useForgotPassword=r.useForgotPassword;exports.useGetAuth=r.useGetAuth;exports.useIsLogin=r.useIsLogin;exports.useLogin=r.useLogin;exports.useLogout=r.useLogout;exports.useRegister=r.useRegister;exports.useUpdatePassword=r.useUpdatePassword;exports.useConfig=t.useConfig;exports.useClient=e.useClient;exports.useCreate=e.useCreate;exports.useCreateMany=e.useCreateMany;exports.useCustom=e.useCustom;exports.useCustomMutation=e.useCustomMutation;exports.useDelete=e.useDelete;exports.useDeleteMany=e.useDeleteMany;exports.useInfiniteList=e.useInfiniteList;exports.useInvalidate=e.useInvalidate;exports.useList=e.useList;exports.useMany=e.useMany;exports.useOne=e.useOne;exports.useUpdate=e.useUpdate;exports.useUpdateMany=e.useUpdateMany;exports.useManage=o.useManage;exports.useMenu=i.useMenu;exports.useTheme=n.useTheme;exports.useOverlay=a.useOverlay;exports.useI18n=c.useI18n;exports.useSelect=q.useSelect;exports.useForm=d.useForm;exports.useExport=l.useExport;exports.useImport=g.useImport;exports.initRouter=m.initRouter;exports.useAuthStore=p.useAuthStore;exports.useRouteStore=v.useRouteStore;exports.useTabStore=D.useTabStore;exports.useManageStore=y.useManageStore;exports.useI18nStore=C.useI18nStore;exports.DuxLogo=M.DuxLogo;exports.DuxLoaderIframe=h;exports.DuxOverlay=x.DuxOverlay;exports.DuxCan=P.DuxCan;exports.arrayToTree=u.arrayToTree;exports.searchTree=u.searchTree;exports.treeToArr=u.treeToArr;exports.DuxAppProvider=T.DuxAppProvider;exports.DuxTabRouterView=S.DuxTabRouterView;exports.simpleAuthProvider=I.simpleAuthProvider;exports.simpleDataProvider=L.simpleDataProvider;exports.i18nProvider=A.i18nProvider;
|
|
@@ -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/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createDux as o } from "./main.js";
|
|
2
|
-
import { useCan as u, useCheck as s, useError as p, useForgotPassword 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
6
|
import { useMenu as E } from "./hooks/menu.js";
|
|
7
7
|
import { useTheme as k } from "./hooks/theme.js";
|
|
@@ -10,38 +10,39 @@ 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
12
|
import { useExport as N } from "./hooks/export.js";
|
|
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 {
|
|
28
|
-
import {
|
|
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";
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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,
|
|
37
38
|
o as createDux,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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,
|
|
45
46
|
u as useCan,
|
|
46
47
|
s as useCheck,
|
|
47
48
|
C as useClient,
|
|
@@ -49,32 +50,33 @@ export {
|
|
|
49
50
|
M as useCreate,
|
|
50
51
|
v as useCreateMany,
|
|
51
52
|
y as useCustom,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
I as useCustomMutation,
|
|
54
|
+
L as useDelete,
|
|
55
|
+
T as useDeleteMany,
|
|
55
56
|
p as useError,
|
|
56
57
|
N as useExport,
|
|
57
|
-
|
|
58
|
+
m as useForgotPassword,
|
|
58
59
|
J as useForm,
|
|
59
|
-
|
|
60
|
+
x as useGetAuth,
|
|
60
61
|
q as useI18n,
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
pe as useI18nStore,
|
|
63
|
+
W as useImport,
|
|
64
|
+
h as useInfiniteList,
|
|
63
65
|
P as useInvalidate,
|
|
64
66
|
a as useIsLogin,
|
|
65
67
|
S as useList,
|
|
66
68
|
f as useLogin,
|
|
67
69
|
n as useLogout,
|
|
68
70
|
U as useManage,
|
|
69
|
-
|
|
71
|
+
ue as useManageStore,
|
|
70
72
|
A as useMany,
|
|
71
73
|
E as useMenu,
|
|
72
74
|
c as useOne,
|
|
73
75
|
V as useOverlay,
|
|
74
76
|
i as useRegister,
|
|
75
|
-
|
|
77
|
+
ee as useRouteStore,
|
|
76
78
|
B as useSelect,
|
|
77
|
-
|
|
79
|
+
oe as useTabStore,
|
|
78
80
|
k as useTheme,
|
|
79
81
|
R as useUpdate,
|
|
80
82
|
w as useUpdateMany,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { DefaultError, UseMutationOptions } from '@tanstack/vue-query';
|
|
2
|
+
import type { IDataProviderCustomOptions, IDataProviderError, IDataProviderResponse } from '../types';
|
|
3
|
+
interface IImportProgress {
|
|
4
|
+
totalItems: number;
|
|
5
|
+
processedItems: number;
|
|
6
|
+
totalBatches: number;
|
|
7
|
+
processedBatches: number;
|
|
8
|
+
percentage: number;
|
|
9
|
+
}
|
|
10
|
+
interface IUseImportProps extends IDataProviderCustomOptions {
|
|
11
|
+
options?: UseMutationOptions<IDataProviderResponse, DefaultError, IDataProviderCustomOptions>;
|
|
12
|
+
onComplete?: (progress: IImportProgress) => void;
|
|
13
|
+
onProgress?: (progress: IImportProgress) => void;
|
|
14
|
+
onError?: (error: IDataProviderError) => void;
|
|
15
|
+
interval?: number;
|
|
16
|
+
chunkSize?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function useImport(props: IUseImportProps): {
|
|
19
|
+
isLoading: import("vue").ComputedRef<boolean>;
|
|
20
|
+
progress: import("vue").ComputedRef<{
|
|
21
|
+
totalItems: number;
|
|
22
|
+
processedItems: number;
|
|
23
|
+
totalBatches: number;
|
|
24
|
+
processedBatches: number;
|
|
25
|
+
percentage: number;
|
|
26
|
+
}>;
|
|
27
|
+
trigger: (data: Record<string, any>[]) => Promise<void>;
|
|
28
|
+
};
|
|
29
|
+
export {};
|