@duxweb/dvha-core 0.1.22 → 1.0.14
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/components/auth/can.cjs +1 -1
- package/dist/cjs/components/loader/loader.cjs +1 -1
- package/dist/cjs/components/loader/remote/loader.cjs +1 -1
- package/dist/cjs/components/overlay/overlay.cjs +1 -1
- package/dist/cjs/directive/permission.cjs +1 -1
- package/dist/cjs/hooks/data.cjs +1 -1
- package/dist/cjs/hooks/json/vModel.cjs +1 -1
- package/dist/cjs/hooks/json.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 +1 -1
- package/dist/cjs/hooks/tree.cjs +1 -0
- package/dist/cjs/hooks/upload/local.cjs +1 -1
- 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/preset/dataProvider.cjs +1 -1
- package/dist/cjs/provider/app.cjs +1 -1
- package/dist/cjs/utils/bus.cjs +1 -0
- package/dist/esm/components/auth/can.js +3 -2
- package/dist/esm/components/loader/loader.js +3 -2
- package/dist/esm/components/loader/remote/loader.js +3 -2
- package/dist/esm/components/overlay/overlay.js +3 -4
- package/dist/esm/directive/permission.js +3 -2
- package/dist/esm/hooks/data.js +287 -269
- package/dist/esm/hooks/json/vModel.js +67 -36
- package/dist/esm/hooks/json.js +62 -47
- package/dist/esm/hooks/menu.js +14 -13
- package/dist/esm/hooks/overlay.js +3 -2
- package/dist/esm/hooks/select.js +48 -46
- package/dist/esm/hooks/theme.js +1 -1
- package/dist/esm/hooks/tree.js +42 -0
- package/dist/esm/hooks/upload/local.js +8 -8
- package/dist/esm/hooks/upload.js +123 -115
- package/dist/esm/index.js +68 -64
- package/dist/esm/main.js +7 -6
- package/dist/esm/preset/dataProvider.js +67 -63
- package/dist/esm/provider/app.js +3 -2
- package/dist/esm/utils/bus.js +5 -0
- package/dist/types/hooks/data.d.ts +54 -42
- package/dist/types/hooks/index.d.ts +2 -2
- package/dist/types/hooks/json.d.ts +5 -1
- package/dist/types/hooks/select.d.ts +30 -1
- package/dist/types/hooks/tree.d.ts +2 -3
- package/dist/types/hooks/upload/local.d.ts +1 -1
- package/dist/types/hooks/upload.d.ts +2 -2
- package/dist/types/preset/dataProvider.d.ts +1 -0
- package/dist/types/types/data.d.ts +3 -0
- package/dist/types/utils/bus.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +3 -2
|
@@ -1,99 +1,99 @@
|
|
|
1
1
|
import k from "axios";
|
|
2
|
-
import { trimStart as
|
|
3
|
-
function w(
|
|
4
|
-
const
|
|
2
|
+
import { trimStart as h } from "lodash-es";
|
|
3
|
+
function w(l) {
|
|
4
|
+
const d = (a) => a ? `${l.apiUrl}/${h(a || "", "/")}` : l.apiUrl;
|
|
5
5
|
return {
|
|
6
|
-
apiUrl:
|
|
7
|
-
getList: (a,
|
|
6
|
+
apiUrl: d,
|
|
7
|
+
getList: (a, r, c) => {
|
|
8
8
|
const e = {};
|
|
9
|
-
return a.pagination && typeof a.pagination == "object" && (e.page = a.pagination.page, e.pageSize = a.pagination.pageSize), k.get(
|
|
9
|
+
return a.pagination && typeof a.pagination == "object" && (e.page = a.pagination.page, e.pageSize = a.pagination.pageSize), k.get(d(a.path) || "", {
|
|
10
10
|
params: {
|
|
11
11
|
...e,
|
|
12
12
|
...a.filters,
|
|
13
13
|
...a.sorters
|
|
14
14
|
},
|
|
15
15
|
headers: {
|
|
16
|
-
Authorization:
|
|
16
|
+
Authorization: c == null ? void 0 : c.token
|
|
17
17
|
},
|
|
18
18
|
...a.meta
|
|
19
|
-
}).then((t) =>
|
|
20
|
-
throw
|
|
19
|
+
}).then((t) => l.successCallback ? l.successCallback(t) : n(t)).catch((t) => {
|
|
20
|
+
throw l.errorCallback ? l.errorCallback(t) : m(t);
|
|
21
21
|
});
|
|
22
22
|
},
|
|
23
|
-
create: (a,
|
|
23
|
+
create: (a, r, c) => k.post(d(a.path) || "", a.data, {
|
|
24
24
|
headers: {
|
|
25
|
-
Authorization:
|
|
25
|
+
Authorization: c == null ? void 0 : c.token
|
|
26
26
|
},
|
|
27
27
|
...a.meta
|
|
28
|
-
}).then((e) =>
|
|
29
|
-
throw
|
|
28
|
+
}).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
|
|
29
|
+
throw l.errorCallback ? l.errorCallback(e) : m(e);
|
|
30
30
|
}),
|
|
31
|
-
update: (a,
|
|
31
|
+
update: (a, r, c) => k.put(d(a.id ? `${a.path}/${a.id}` : a.path) || "", a.data, {
|
|
32
32
|
headers: {
|
|
33
|
-
Authorization:
|
|
33
|
+
Authorization: c == null ? void 0 : c.token
|
|
34
34
|
},
|
|
35
35
|
...a.meta
|
|
36
|
-
}).then((e) =>
|
|
37
|
-
throw
|
|
36
|
+
}).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
|
|
37
|
+
throw l.errorCallback ? l.errorCallback(e) : m(e);
|
|
38
38
|
}),
|
|
39
|
-
deleteOne: (a,
|
|
39
|
+
deleteOne: (a, r, c) => k.delete(d(a.id ? `${a.path}/${a.id}` : a.path) || "", {
|
|
40
40
|
headers: {
|
|
41
|
-
Authorization:
|
|
41
|
+
Authorization: c == null ? void 0 : c.token
|
|
42
42
|
},
|
|
43
43
|
...a.meta
|
|
44
|
-
}).then((e) =>
|
|
45
|
-
throw
|
|
44
|
+
}).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
|
|
45
|
+
throw l.errorCallback ? l.errorCallback(e) : m(e);
|
|
46
46
|
}),
|
|
47
|
-
getOne: (a,
|
|
47
|
+
getOne: (a, r, c) => k.get(d(a.id ? `${a.path}/${a.id}` : a.path) || "", {
|
|
48
48
|
headers: {
|
|
49
|
-
Authorization:
|
|
49
|
+
Authorization: c == null ? void 0 : c.token
|
|
50
50
|
},
|
|
51
51
|
...a.meta
|
|
52
|
-
}).then((e) =>
|
|
53
|
-
throw
|
|
52
|
+
}).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
|
|
53
|
+
throw l.errorCallback ? l.errorCallback(e) : m(e);
|
|
54
54
|
}),
|
|
55
|
-
getMany: (a,
|
|
55
|
+
getMany: (a, r, c) => k.get(d(a.path) || "", {
|
|
56
56
|
params: {
|
|
57
57
|
ids: a.ids
|
|
58
58
|
},
|
|
59
59
|
headers: {
|
|
60
|
-
Authorization:
|
|
60
|
+
Authorization: c == null ? void 0 : c.token
|
|
61
61
|
},
|
|
62
62
|
...a.meta
|
|
63
|
-
}).then((e) =>
|
|
64
|
-
throw
|
|
63
|
+
}).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
|
|
64
|
+
throw l.errorCallback ? l.errorCallback(e) : m(e);
|
|
65
65
|
}),
|
|
66
|
-
createMany: (a,
|
|
66
|
+
createMany: (a, r, c) => k.post(d(a.path) || "", a.data, {
|
|
67
67
|
headers: {
|
|
68
|
-
Authorization:
|
|
68
|
+
Authorization: c == null ? void 0 : c.token
|
|
69
69
|
},
|
|
70
70
|
...a.meta
|
|
71
|
-
}).then((e) =>
|
|
72
|
-
throw
|
|
71
|
+
}).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
|
|
72
|
+
throw l.errorCallback ? l.errorCallback(e) : m(e);
|
|
73
73
|
}),
|
|
74
|
-
updateMany: (a,
|
|
74
|
+
updateMany: (a, r, c) => k.put(d(a.path) || "", {
|
|
75
75
|
ids: a.ids,
|
|
76
76
|
data: a.data
|
|
77
77
|
}, {
|
|
78
78
|
headers: {
|
|
79
|
-
Authorization:
|
|
79
|
+
Authorization: c == null ? void 0 : c.token
|
|
80
80
|
},
|
|
81
81
|
...a.meta
|
|
82
|
-
}).then((e) =>
|
|
83
|
-
throw
|
|
82
|
+
}).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
|
|
83
|
+
throw l.errorCallback ? l.errorCallback(e) : m(e);
|
|
84
84
|
}),
|
|
85
|
-
deleteMany: (a,
|
|
85
|
+
deleteMany: (a, r, c) => k.delete(d(a.path) || "", {
|
|
86
86
|
params: {
|
|
87
87
|
ids: a.ids
|
|
88
88
|
},
|
|
89
89
|
headers: {
|
|
90
|
-
Authorization:
|
|
90
|
+
Authorization: c == null ? void 0 : c.token
|
|
91
91
|
},
|
|
92
92
|
...a.meta
|
|
93
|
-
}).then((e) =>
|
|
94
|
-
throw
|
|
93
|
+
}).then((e) => l.successCallback ? l.successCallback(e) : n(e)).catch((e) => {
|
|
94
|
+
throw l.errorCallback ? l.errorCallback(e) : m(e);
|
|
95
95
|
}),
|
|
96
|
-
custom: (a,
|
|
96
|
+
custom: (a, r, c) => {
|
|
97
97
|
let e = {
|
|
98
98
|
...a.query
|
|
99
99
|
};
|
|
@@ -104,57 +104,61 @@ function w(c) {
|
|
|
104
104
|
...e,
|
|
105
105
|
...a.filters
|
|
106
106
|
}), k.request({
|
|
107
|
-
url:
|
|
107
|
+
url: d(a.path || ""),
|
|
108
108
|
method: a.method || "GET",
|
|
109
109
|
data: a.payload,
|
|
110
110
|
params: e,
|
|
111
111
|
signal: a.signal,
|
|
112
112
|
headers: {
|
|
113
|
-
Authorization:
|
|
113
|
+
Authorization: c == null ? void 0 : c.token,
|
|
114
114
|
...a.headers
|
|
115
115
|
},
|
|
116
116
|
onUploadProgress: (t) => {
|
|
117
|
-
var
|
|
117
|
+
var b;
|
|
118
118
|
const C = Math.round(t.loaded * 100 / (t.total || 1));
|
|
119
|
-
(
|
|
119
|
+
(b = a.onUploadProgress) == null || b.call(a, {
|
|
120
120
|
loaded: t.loaded,
|
|
121
121
|
total: t.total,
|
|
122
122
|
percent: C
|
|
123
123
|
});
|
|
124
124
|
},
|
|
125
125
|
onDownloadProgress: (t) => {
|
|
126
|
-
var
|
|
126
|
+
var b;
|
|
127
127
|
const C = Math.round(t.loaded * 100 / (t.total || 1));
|
|
128
|
-
(
|
|
128
|
+
(b = a.onDownloadProgress) == null || b.call(a, {
|
|
129
129
|
loaded: t.loaded,
|
|
130
130
|
total: t.total,
|
|
131
131
|
percent: C
|
|
132
132
|
});
|
|
133
133
|
},
|
|
134
134
|
...a.meta
|
|
135
|
-
}).then((t) =>
|
|
136
|
-
throw
|
|
135
|
+
}).then((t) => l.successCallback ? l.successCallback(t) : n(t)).catch((t) => {
|
|
136
|
+
throw l.errorCallback ? l.errorCallback(t) : m(t);
|
|
137
137
|
});
|
|
138
|
+
},
|
|
139
|
+
getTotal: (a) => {
|
|
140
|
+
var r;
|
|
141
|
+
return l.getTotal ? l.getTotal(a) : ((r = a.meta) == null ? void 0 : r.total) || 0;
|
|
138
142
|
}
|
|
139
143
|
};
|
|
140
144
|
}
|
|
141
|
-
function n(
|
|
142
|
-
var
|
|
145
|
+
function n(l) {
|
|
146
|
+
var d, a, r;
|
|
143
147
|
return {
|
|
144
|
-
message: (
|
|
145
|
-
data: (a =
|
|
146
|
-
meta: (
|
|
147
|
-
raw:
|
|
148
|
+
message: (d = l.data) == null ? void 0 : d.message,
|
|
149
|
+
data: (a = l.data) == null ? void 0 : a.data,
|
|
150
|
+
meta: (r = l.data) == null ? void 0 : r.meta,
|
|
151
|
+
raw: l.data
|
|
148
152
|
};
|
|
149
153
|
}
|
|
150
|
-
function
|
|
151
|
-
var
|
|
154
|
+
function m(l) {
|
|
155
|
+
var d, a, r, c, e, t, C, b, g, u;
|
|
152
156
|
return {
|
|
153
|
-
message: ((a = (
|
|
154
|
-
data: (
|
|
155
|
-
meta: (t = (e =
|
|
156
|
-
status: ((
|
|
157
|
-
raw: (
|
|
157
|
+
message: ((a = (d = l.response) == null ? void 0 : d.data) == null ? void 0 : a.message) || (l == null ? void 0 : l.message),
|
|
158
|
+
data: (c = (r = l.response) == null ? void 0 : r.data) == null ? void 0 : c.data,
|
|
159
|
+
meta: (t = (e = l.response) == null ? void 0 : e.data) == null ? void 0 : t.meta,
|
|
160
|
+
status: ((b = (C = l.response) == null ? void 0 : C.data) == null ? void 0 : b.code) || ((g = l.response) == null ? void 0 : g.status) || 500,
|
|
161
|
+
raw: (u = l.response) == null ? void 0 : u.data
|
|
158
162
|
};
|
|
159
163
|
}
|
|
160
164
|
export {
|
package/dist/esm/provider/app.js
CHANGED
|
@@ -16,13 +16,14 @@ import { useRouteStore as Y } from "../stores/route.js";
|
|
|
16
16
|
import "pinia";
|
|
17
17
|
import "@vueuse/core";
|
|
18
18
|
import "../hooks/json/index.js";
|
|
19
|
+
import "../utils/bus.js";
|
|
19
20
|
import "colorizr";
|
|
20
21
|
import "axios";
|
|
21
22
|
import "clsx";
|
|
22
23
|
import { DuxError as Z } from "../components/status/error.js";
|
|
23
24
|
import { DuxNotAuthorized as x } from "../components/status/notAuthorized.js";
|
|
24
25
|
import { DuxNotFound as ee } from "../components/status/notFound.js";
|
|
25
|
-
const
|
|
26
|
+
const we = /* @__PURE__ */ V({
|
|
26
27
|
name: "DuxAppProvider",
|
|
27
28
|
props: {},
|
|
28
29
|
setup(te, {
|
|
@@ -154,5 +155,5 @@ const De = /* @__PURE__ */ V({
|
|
|
154
155
|
}
|
|
155
156
|
});
|
|
156
157
|
export {
|
|
157
|
-
|
|
158
|
+
we as DuxAppProvider
|
|
158
159
|
};
|
|
@@ -30,10 +30,16 @@ export declare function useList(params: IListParams): {
|
|
|
30
30
|
pagination: import("vue").Ref<{
|
|
31
31
|
page?: number | undefined;
|
|
32
32
|
pageSize?: number | undefined;
|
|
33
|
+
pageCount?: number | undefined;
|
|
34
|
+
total?: number | undefined;
|
|
33
35
|
}, {
|
|
34
36
|
page?: number | undefined;
|
|
35
37
|
pageSize?: number | undefined;
|
|
38
|
+
pageCount?: number | undefined;
|
|
39
|
+
total?: number | undefined;
|
|
36
40
|
}>;
|
|
41
|
+
total: import("vue").Ref<number, number>;
|
|
42
|
+
pageCount: import("vue").Ref<number, number>;
|
|
37
43
|
error: import("vue").Ref<Error, Error>;
|
|
38
44
|
isError: import("vue").Ref<true, true>;
|
|
39
45
|
isPending: import("vue").Ref<false, false>;
|
|
@@ -76,10 +82,16 @@ export declare function useList(params: IListParams): {
|
|
|
76
82
|
pagination: import("vue").Ref<{
|
|
77
83
|
page?: number | undefined;
|
|
78
84
|
pageSize?: number | undefined;
|
|
85
|
+
pageCount?: number | undefined;
|
|
86
|
+
total?: number | undefined;
|
|
79
87
|
}, {
|
|
80
88
|
page?: number | undefined;
|
|
81
89
|
pageSize?: number | undefined;
|
|
90
|
+
pageCount?: number | undefined;
|
|
91
|
+
total?: number | undefined;
|
|
82
92
|
}>;
|
|
93
|
+
total: import("vue").Ref<number, number>;
|
|
94
|
+
pageCount: import("vue").Ref<number, number>;
|
|
83
95
|
error: import("vue").Ref<null, null>;
|
|
84
96
|
isError: import("vue").Ref<false, false>;
|
|
85
97
|
isPending: import("vue").Ref<false, false>;
|
|
@@ -122,10 +134,16 @@ export declare function useList(params: IListParams): {
|
|
|
122
134
|
pagination: import("vue").Ref<{
|
|
123
135
|
page?: number | undefined;
|
|
124
136
|
pageSize?: number | undefined;
|
|
137
|
+
pageCount?: number | undefined;
|
|
138
|
+
total?: number | undefined;
|
|
125
139
|
}, {
|
|
126
140
|
page?: number | undefined;
|
|
127
141
|
pageSize?: number | undefined;
|
|
142
|
+
pageCount?: number | undefined;
|
|
143
|
+
total?: number | undefined;
|
|
128
144
|
}>;
|
|
145
|
+
total: import("vue").Ref<number, number>;
|
|
146
|
+
pageCount: import("vue").Ref<number, number>;
|
|
129
147
|
error: import("vue").Ref<Error, Error>;
|
|
130
148
|
isError: import("vue").Ref<true, true>;
|
|
131
149
|
isPending: import("vue").Ref<false, false>;
|
|
@@ -168,10 +186,16 @@ export declare function useList(params: IListParams): {
|
|
|
168
186
|
pagination: import("vue").Ref<{
|
|
169
187
|
page?: number | undefined;
|
|
170
188
|
pageSize?: number | undefined;
|
|
189
|
+
pageCount?: number | undefined;
|
|
190
|
+
total?: number | undefined;
|
|
171
191
|
}, {
|
|
172
192
|
page?: number | undefined;
|
|
173
193
|
pageSize?: number | undefined;
|
|
194
|
+
pageCount?: number | undefined;
|
|
195
|
+
total?: number | undefined;
|
|
174
196
|
}>;
|
|
197
|
+
total: import("vue").Ref<number, number>;
|
|
198
|
+
pageCount: import("vue").Ref<number, number>;
|
|
175
199
|
error: import("vue").Ref<null, null>;
|
|
176
200
|
isError: import("vue").Ref<false, false>;
|
|
177
201
|
isPending: import("vue").Ref<true, true>;
|
|
@@ -214,10 +238,16 @@ export declare function useList(params: IListParams): {
|
|
|
214
238
|
pagination: import("vue").Ref<{
|
|
215
239
|
page?: number | undefined;
|
|
216
240
|
pageSize?: number | undefined;
|
|
241
|
+
pageCount?: number | undefined;
|
|
242
|
+
total?: number | undefined;
|
|
217
243
|
}, {
|
|
218
244
|
page?: number | undefined;
|
|
219
245
|
pageSize?: number | undefined;
|
|
246
|
+
pageCount?: number | undefined;
|
|
247
|
+
total?: number | undefined;
|
|
220
248
|
}>;
|
|
249
|
+
total: import("vue").Ref<number, number>;
|
|
250
|
+
pageCount: import("vue").Ref<number, number>;
|
|
221
251
|
error: import("vue").Ref<null, null>;
|
|
222
252
|
isError: import("vue").Ref<false, false>;
|
|
223
253
|
isPending: import("vue").Ref<true, true>;
|
|
@@ -260,10 +290,16 @@ export declare function useList(params: IListParams): {
|
|
|
260
290
|
pagination: import("vue").Ref<{
|
|
261
291
|
page?: number | undefined;
|
|
262
292
|
pageSize?: number | undefined;
|
|
293
|
+
pageCount?: number | undefined;
|
|
294
|
+
total?: number | undefined;
|
|
263
295
|
}, {
|
|
264
296
|
page?: number | undefined;
|
|
265
297
|
pageSize?: number | undefined;
|
|
298
|
+
pageCount?: number | undefined;
|
|
299
|
+
total?: number | undefined;
|
|
266
300
|
}>;
|
|
301
|
+
total: import("vue").Ref<number, number>;
|
|
302
|
+
pageCount: import("vue").Ref<number, number>;
|
|
267
303
|
isError: import("vue").Ref<false, false>;
|
|
268
304
|
error: import("vue").Ref<null, null>;
|
|
269
305
|
isPending: import("vue").Ref<false, false>;
|
|
@@ -316,13 +352,9 @@ export declare function useInfiniteList(params: IInfiniteListParams): {
|
|
|
316
352
|
fetchNextPage: () => Promise<import("@tanstack/vue-query").InfiniteQueryObserverResult<InfiniteData<IDataProviderResponse | undefined, unknown>, Error>> | undefined;
|
|
317
353
|
hasNextPage: import("vue").Ref<boolean, boolean>;
|
|
318
354
|
refetch: (options?: import("@tanstack/vue-query").RefetchOptions) => Promise<import("@tanstack/vue-query").QueryObserverResult<InfiniteData<IDataProviderResponse | undefined, unknown>, Error>>;
|
|
319
|
-
pagination: import("vue").Ref<
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}, {
|
|
323
|
-
page?: number | undefined;
|
|
324
|
-
pageSize?: number | undefined;
|
|
325
|
-
}>;
|
|
355
|
+
pagination: import("vue").Ref<IDataProviderPagination, IDataProviderPagination>;
|
|
356
|
+
total: import("vue").Ref<number, number>;
|
|
357
|
+
pageCount: import("vue").Ref<number, number>;
|
|
326
358
|
error: import("vue").Ref<Error, Error>;
|
|
327
359
|
isError: import("vue").Ref<true, true>;
|
|
328
360
|
isPending: import("vue").Ref<false, false>;
|
|
@@ -370,13 +402,9 @@ export declare function useInfiniteList(params: IInfiniteListParams): {
|
|
|
370
402
|
fetchNextPage: () => Promise<import("@tanstack/vue-query").InfiniteQueryObserverResult<InfiniteData<IDataProviderResponse | undefined, unknown>, Error>> | undefined;
|
|
371
403
|
hasNextPage: import("vue").Ref<boolean, boolean>;
|
|
372
404
|
refetch: (options?: import("@tanstack/vue-query").RefetchOptions) => Promise<import("@tanstack/vue-query").QueryObserverResult<InfiniteData<IDataProviderResponse | undefined, unknown>, Error>>;
|
|
373
|
-
pagination: import("vue").Ref<
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
}, {
|
|
377
|
-
page?: number | undefined;
|
|
378
|
-
pageSize?: number | undefined;
|
|
379
|
-
}>;
|
|
405
|
+
pagination: import("vue").Ref<IDataProviderPagination, IDataProviderPagination>;
|
|
406
|
+
total: import("vue").Ref<number, number>;
|
|
407
|
+
pageCount: import("vue").Ref<number, number>;
|
|
380
408
|
error: import("vue").Ref<null, null>;
|
|
381
409
|
isError: import("vue").Ref<false, false>;
|
|
382
410
|
isPending: import("vue").Ref<false, false>;
|
|
@@ -424,13 +452,9 @@ export declare function useInfiniteList(params: IInfiniteListParams): {
|
|
|
424
452
|
fetchNextPage: () => Promise<import("@tanstack/vue-query").InfiniteQueryObserverResult<InfiniteData<IDataProviderResponse | undefined, unknown>, Error>> | undefined;
|
|
425
453
|
hasNextPage: import("vue").Ref<boolean, boolean>;
|
|
426
454
|
refetch: (options?: import("@tanstack/vue-query").RefetchOptions) => Promise<import("@tanstack/vue-query").QueryObserverResult<InfiniteData<IDataProviderResponse | undefined, unknown>, Error>>;
|
|
427
|
-
pagination: import("vue").Ref<
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}, {
|
|
431
|
-
page?: number | undefined;
|
|
432
|
-
pageSize?: number | undefined;
|
|
433
|
-
}>;
|
|
455
|
+
pagination: import("vue").Ref<IDataProviderPagination, IDataProviderPagination>;
|
|
456
|
+
total: import("vue").Ref<number, number>;
|
|
457
|
+
pageCount: import("vue").Ref<number, number>;
|
|
434
458
|
error: import("vue").Ref<Error, Error>;
|
|
435
459
|
isError: import("vue").Ref<true, true>;
|
|
436
460
|
isPending: import("vue").Ref<false, false>;
|
|
@@ -478,13 +502,9 @@ export declare function useInfiniteList(params: IInfiniteListParams): {
|
|
|
478
502
|
fetchNextPage: () => Promise<import("@tanstack/vue-query").InfiniteQueryObserverResult<InfiniteData<IDataProviderResponse | undefined, unknown>, Error>> | undefined;
|
|
479
503
|
hasNextPage: import("vue").Ref<boolean, boolean>;
|
|
480
504
|
refetch: (options?: import("@tanstack/vue-query").RefetchOptions) => Promise<import("@tanstack/vue-query").QueryObserverResult<InfiniteData<IDataProviderResponse | undefined, unknown>, Error>>;
|
|
481
|
-
pagination: import("vue").Ref<
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}, {
|
|
485
|
-
page?: number | undefined;
|
|
486
|
-
pageSize?: number | undefined;
|
|
487
|
-
}>;
|
|
505
|
+
pagination: import("vue").Ref<IDataProviderPagination, IDataProviderPagination>;
|
|
506
|
+
total: import("vue").Ref<number, number>;
|
|
507
|
+
pageCount: import("vue").Ref<number, number>;
|
|
488
508
|
error: import("vue").Ref<null, null>;
|
|
489
509
|
isError: import("vue").Ref<false, false>;
|
|
490
510
|
isPending: import("vue").Ref<true, true>;
|
|
@@ -532,13 +552,9 @@ export declare function useInfiniteList(params: IInfiniteListParams): {
|
|
|
532
552
|
fetchNextPage: () => Promise<import("@tanstack/vue-query").InfiniteQueryObserverResult<InfiniteData<IDataProviderResponse | undefined, unknown>, Error>> | undefined;
|
|
533
553
|
hasNextPage: import("vue").Ref<boolean, boolean>;
|
|
534
554
|
refetch: (options?: import("@tanstack/vue-query").RefetchOptions) => Promise<import("@tanstack/vue-query").QueryObserverResult<InfiniteData<IDataProviderResponse | undefined, unknown>, Error>>;
|
|
535
|
-
pagination: import("vue").Ref<
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}, {
|
|
539
|
-
page?: number | undefined;
|
|
540
|
-
pageSize?: number | undefined;
|
|
541
|
-
}>;
|
|
555
|
+
pagination: import("vue").Ref<IDataProviderPagination, IDataProviderPagination>;
|
|
556
|
+
total: import("vue").Ref<number, number>;
|
|
557
|
+
pageCount: import("vue").Ref<number, number>;
|
|
542
558
|
error: import("vue").Ref<null, null>;
|
|
543
559
|
isError: import("vue").Ref<false, false>;
|
|
544
560
|
isPending: import("vue").Ref<true, true>;
|
|
@@ -586,13 +602,9 @@ export declare function useInfiniteList(params: IInfiniteListParams): {
|
|
|
586
602
|
fetchNextPage: () => Promise<import("@tanstack/vue-query").InfiniteQueryObserverResult<InfiniteData<IDataProviderResponse | undefined, unknown>, Error>> | undefined;
|
|
587
603
|
hasNextPage: import("vue").Ref<boolean, boolean>;
|
|
588
604
|
refetch: (options?: import("@tanstack/vue-query").RefetchOptions) => Promise<import("@tanstack/vue-query").QueryObserverResult<InfiniteData<IDataProviderResponse | undefined, unknown>, Error>>;
|
|
589
|
-
pagination: import("vue").Ref<
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}, {
|
|
593
|
-
page?: number | undefined;
|
|
594
|
-
pageSize?: number | undefined;
|
|
595
|
-
}>;
|
|
605
|
+
pagination: import("vue").Ref<IDataProviderPagination, IDataProviderPagination>;
|
|
606
|
+
total: import("vue").Ref<number, number>;
|
|
607
|
+
pageCount: import("vue").Ref<number, number>;
|
|
596
608
|
isError: import("vue").Ref<false, false>;
|
|
597
609
|
error: import("vue").Ref<null, null>;
|
|
598
610
|
isPending: import("vue").Ref<false, false>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from '../config/color';
|
|
1
2
|
export * from './auth';
|
|
2
3
|
export * from './config';
|
|
3
4
|
export * from './data';
|
|
@@ -17,7 +18,6 @@ export * from './menu';
|
|
|
17
18
|
export * from './overlay';
|
|
18
19
|
export * from './select';
|
|
19
20
|
export * from './theme';
|
|
20
|
-
export * from './
|
|
21
|
-
export * from '../config/color';
|
|
21
|
+
export * from './tree';
|
|
22
22
|
export * from './upload';
|
|
23
23
|
export * from './upload/index';
|
|
@@ -2,7 +2,7 @@ import type { Ref } from 'vue';
|
|
|
2
2
|
import type { JsonAdaptorOptions, JsonSchemaNode } from './json/index';
|
|
3
3
|
export type JsonSchemaData = JsonSchemaNode[] | Ref<JsonSchemaNode[]>;
|
|
4
4
|
export interface UseJsonSchemaProps extends JsonAdaptorOptions {
|
|
5
|
-
data
|
|
5
|
+
data?: JsonSchemaData;
|
|
6
6
|
components?: Record<string, any>;
|
|
7
7
|
context?: Record<string, any> | Ref<Record<string, any>>;
|
|
8
8
|
}
|
|
@@ -11,4 +11,8 @@ export interface UseJsonSchemaProps extends JsonAdaptorOptions {
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function useJsonSchema(props?: UseJsonSchemaProps): {
|
|
13
13
|
render: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
14
|
+
renderAsync: (options: {
|
|
15
|
+
data: JsonSchemaNode[];
|
|
16
|
+
context?: Record<string, any>;
|
|
17
|
+
}) => import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
14
18
|
};
|
|
@@ -1,14 +1,41 @@
|
|
|
1
1
|
type SelectValue = Array<string | number> | string | number | null | undefined;
|
|
2
|
-
interface IUseSelectProps {
|
|
2
|
+
export interface IUseSelectProps {
|
|
3
|
+
/** 默认选中值,可以是单个值或数组 */
|
|
3
4
|
defaultValue?: SelectValue;
|
|
5
|
+
/** 数据请求路径 */
|
|
4
6
|
path?: string;
|
|
7
|
+
/** 请求参数 */
|
|
5
8
|
params?: Record<string, any>;
|
|
9
|
+
/** 分页配置,false表示不分页,true表示默认20条/页,数字表示指定每页条数 */
|
|
6
10
|
pagination?: boolean | number;
|
|
11
|
+
/** 数据提供者名称 */
|
|
7
12
|
providerName?: string;
|
|
13
|
+
/**
|
|
14
|
+
* 选项显示标签配置
|
|
15
|
+
* - 字符串:指定用作显示标签的字段名
|
|
16
|
+
* - 函数:自定义标签生成逻辑
|
|
17
|
+
* - 默认fallback顺序:label -> name -> title -> value/id的字符串形式
|
|
18
|
+
*/
|
|
8
19
|
optionLabel?: string | ((item: Record<string, any>) => string);
|
|
20
|
+
/**
|
|
21
|
+
* 选项值配置
|
|
22
|
+
* - 字符串:指定用作选项值的字段名
|
|
23
|
+
* - 函数:自定义值获取逻辑
|
|
24
|
+
* - 默认fallback顺序:value -> id
|
|
25
|
+
* - 用途:生成最终选项的 value 属性,供外部使用
|
|
26
|
+
*/
|
|
9
27
|
optionValue?: string | ((item: Record<string, any>) => string);
|
|
28
|
+
/**
|
|
29
|
+
* 选项唯一标识字段名
|
|
30
|
+
* - 仅支持字符串类型,指定用于去重比较的字段名
|
|
31
|
+
* - 默认fallback顺序:value -> id
|
|
32
|
+
* - 用途:内部选项去重和比较,防止重复选项
|
|
33
|
+
* - 与 optionValue 的区别:optionField 用于内部去重逻辑,optionValue 用于生成最终选项值
|
|
34
|
+
*/
|
|
10
35
|
optionField?: string;
|
|
36
|
+
/** 搜索关键词字段名,默认为 'keyword' */
|
|
11
37
|
keywordField?: string;
|
|
38
|
+
/** 搜索防抖延迟时间(毫秒),默认300ms */
|
|
12
39
|
debounce?: number;
|
|
13
40
|
}
|
|
14
41
|
export declare function useSelect(props: IUseSelectProps): {
|
|
@@ -30,5 +57,7 @@ export declare function useSelect(props: IUseSelectProps): {
|
|
|
30
57
|
page: number;
|
|
31
58
|
pageSize: number;
|
|
32
59
|
}>;
|
|
60
|
+
total: import("vue").Ref<number, number>;
|
|
61
|
+
pageCount: import("vue").Ref<number, number>;
|
|
33
62
|
};
|
|
34
63
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface IUseTreeProps {
|
|
1
|
+
export interface IUseTreeProps {
|
|
2
2
|
path?: string;
|
|
3
3
|
params?: Record<string, any>;
|
|
4
4
|
treeOptions?: {
|
|
@@ -11,8 +11,7 @@ interface IUseTreeProps {
|
|
|
11
11
|
providerName?: string;
|
|
12
12
|
}
|
|
13
13
|
export declare function useTree(props: IUseTreeProps): {
|
|
14
|
-
options: import("vue").ComputedRef<any>;
|
|
14
|
+
options: import("vue").ComputedRef<any[]>;
|
|
15
15
|
loading: import("vue").ComputedRef<boolean>;
|
|
16
16
|
expanded: import("vue").ComputedRef<unknown[]>;
|
|
17
17
|
};
|
|
18
|
-
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { IUploadDriver } from './types';
|
|
2
|
-
export declare
|
|
2
|
+
export declare function createLocalUploadDriver(): IUploadDriver;
|
|
@@ -51,7 +51,7 @@ export interface IOverallProgress {
|
|
|
51
51
|
totalLoaded: number;
|
|
52
52
|
totalSize: number;
|
|
53
53
|
}
|
|
54
|
-
export declare function useUpload(props
|
|
54
|
+
export declare function useUpload(props?: IUseUploadProps): {
|
|
55
55
|
isUploading: import("vue").Ref<boolean, boolean>;
|
|
56
56
|
uploadFiles: import("vue").Ref<{
|
|
57
57
|
id: string;
|
|
@@ -131,7 +131,7 @@ export declare function useUpload(props: IUseUploadProps): {
|
|
|
131
131
|
dataFiles: import("vue").ComputedRef<IUseUploadFileData[]>;
|
|
132
132
|
progress: import("vue").ComputedRef<IOverallProgress>;
|
|
133
133
|
open: (localOptions?: Partial<import("@vueuse/core").UseFileDialogOptions>) => void;
|
|
134
|
-
trigger: () => Promise<
|
|
134
|
+
trigger: () => Promise<IUseUploadFile[]>;
|
|
135
135
|
resetFiles: () => void;
|
|
136
136
|
clearFiles: () => void;
|
|
137
137
|
removeFiles: (ids?: string[]) => void;
|
|
@@ -3,5 +3,6 @@ export interface ISimpleDataProviderProps {
|
|
|
3
3
|
apiUrl: string;
|
|
4
4
|
successCallback?: (res: any) => IDataProviderResponse;
|
|
5
5
|
errorCallback?: (err: any) => IDataProviderError;
|
|
6
|
+
getTotal?: (options: IDataProviderResponse) => number;
|
|
6
7
|
}
|
|
7
8
|
export declare function simpleDataProvider(props: ISimpleDataProviderProps): IDataProvider;
|
|
@@ -16,6 +16,7 @@ export interface IDataProvider {
|
|
|
16
16
|
updateMany: (options: IDataProviderUpdateManyOptions, manage?: IManageHook, auth?: IUserState) => Promise<IDataProviderResponse>;
|
|
17
17
|
deleteMany: (options: IDataProviderDeleteManyOptions, manage?: IManageHook, auth?: IUserState) => Promise<IDataProviderResponse>;
|
|
18
18
|
custom: (options: IDataProviderCustomOptions, manage?: IManageHook, auth?: IUserState) => Promise<IDataProviderResponse>;
|
|
19
|
+
getTotal: (options: IDataProviderResponse) => number;
|
|
19
20
|
}
|
|
20
21
|
export interface IDataProviderResponse {
|
|
21
22
|
message?: string;
|
|
@@ -35,6 +36,8 @@ export interface IDataProviderError {
|
|
|
35
36
|
export interface IDataProviderPagination {
|
|
36
37
|
page?: number;
|
|
37
38
|
pageSize?: number;
|
|
39
|
+
pageCount?: number;
|
|
40
|
+
total?: number;
|
|
38
41
|
}
|
|
39
42
|
export interface IDataProviderListOptions {
|
|
40
43
|
path: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const emitter: import("mitt").Emitter<Record<import("mitt").EventType, unknown>>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duxweb/dvha-core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.14",
|
|
5
5
|
"author": "DuxWeb",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@overlastic/vue": "^0.8.1",
|
|
32
|
-
"@tanstack/vue-query": "^5.
|
|
32
|
+
"@tanstack/vue-query": "^5.80.7",
|
|
33
33
|
"@vee-validate/rules": "^4.15.1",
|
|
34
34
|
"@vueuse/core": "^13.3.0",
|
|
35
35
|
"@vueuse/integrations": "^13.3.0",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"mitt": "^3.0.1",
|
|
47
47
|
"pinia": "^3.0.3",
|
|
48
48
|
"pinia-plugin-persistedstate": "^4.3.0",
|
|
49
|
+
"tslib": "^2.8.1",
|
|
49
50
|
"vee-validate": "^4.15.1",
|
|
50
51
|
"vue": "^3.5.0",
|
|
51
52
|
"vue-i18n": "^11.1.6",
|