@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.
- package/dist/cjs/components/auth/can.cjs +1 -1
- package/dist/cjs/components/loader/iframe.cjs +1 -1
- package/dist/cjs/components/loader/loader.cjs +1 -0
- package/dist/cjs/components/loader/remote/loader.cjs +1 -0
- package/dist/cjs/components/loader/remote/render.cjs +1 -0
- package/dist/cjs/components/overlay/overlay.cjs +1 -1
- package/dist/cjs/components/status/error.cjs +1 -1
- package/dist/cjs/components/status/exception.cjs +1 -0
- package/dist/cjs/components/status/notAuthorized.cjs +1 -1
- package/dist/cjs/components/status/notFound.cjs +1 -1
- package/dist/cjs/directive/permission.cjs +1 -1
- package/dist/cjs/hooks/auth.cjs +1 -1
- package/dist/cjs/hooks/data.cjs +1 -1
- package/dist/cjs/hooks/export.cjs +1 -1
- package/dist/cjs/hooks/form.cjs +1 -1
- package/dist/cjs/hooks/formExtend.cjs +1 -0
- package/dist/cjs/hooks/formValidate.cjs +1 -0
- package/dist/cjs/hooks/i18n.cjs +1 -1
- package/dist/cjs/hooks/importCsv.cjs +1 -1
- package/dist/cjs/hooks/json/utils/expressionParser.cjs +1 -1
- package/dist/cjs/hooks/json.cjs +1 -1
- package/dist/cjs/hooks/list.cjs +1 -0
- package/dist/cjs/hooks/manage.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 +2 -2
- 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/preset/i18nProvider.cjs +1 -1
- package/dist/cjs/provider/app.cjs +1 -1
- package/dist/cjs/provider/tab.cjs +1 -1
- package/dist/cjs/stores/manage.cjs +1 -1
- package/dist/cjs/stores/tab.cjs +1 -1
- package/dist/cjs/stores/theme.cjs +1 -1
- package/dist/cjs/utils/theme.cjs +9 -1
- package/dist/esm/components/auth/can.js +9 -7
- package/dist/esm/components/loader/loader.js +48 -0
- package/dist/esm/components/loader/remote/loader.js +150 -0
- package/dist/esm/components/loader/remote/render.js +19 -0
- package/dist/esm/components/overlay/overlay.js +22 -31
- package/dist/esm/components/status/error.js +3 -3
- package/dist/esm/components/status/exception.js +23 -0
- package/dist/esm/components/status/notAuthorized.js +2 -2
- package/dist/esm/components/status/notFound.js +4 -4
- package/dist/esm/directive/permission.js +5 -3
- package/dist/esm/hooks/auth.js +67 -67
- package/dist/esm/hooks/data.js +164 -160
- package/dist/esm/hooks/export.js +26 -23
- package/dist/esm/hooks/form.js +38 -35
- package/dist/esm/hooks/formExtend.js +38 -0
- package/dist/esm/hooks/formValidate.js +28 -0
- package/dist/esm/hooks/i18n.js +16 -8
- package/dist/esm/hooks/json/utils/expressionParser.js +1 -1
- package/dist/esm/hooks/json.js +57 -57
- package/dist/esm/hooks/list.js +179 -0
- package/dist/esm/hooks/manage.js +18 -13
- package/dist/esm/hooks/overlay.js +6 -4
- package/dist/esm/hooks/theme.js +11 -11
- package/dist/esm/index.js +129 -113
- package/dist/esm/main.js +22 -12
- package/dist/esm/preset/i18nProvider.js +17 -18
- package/dist/esm/provider/app.js +61 -53
- package/dist/esm/provider/tab.js +1 -1
- package/dist/esm/stores/manage.js +34 -24
- package/dist/esm/stores/tab.js +58 -49
- package/dist/esm/stores/theme.js +36 -34
- package/dist/esm/utils/theme.js +89 -76
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/components/loader/loader.d.ts +2 -0
- package/dist/types/components/loader/remote/index.d.ts +2 -0
- package/dist/types/components/loader/remote/loader.d.ts +1 -0
- package/dist/types/components/loader/remote/render.d.ts +1 -0
- package/dist/types/components/status/error.d.ts +1 -2
- package/dist/types/components/status/exception.d.ts +3 -0
- package/dist/types/components/status/index.d.ts +4 -0
- package/dist/types/components/status/notAuthorized.d.ts +1 -2
- package/dist/types/components/status/notFound.d.ts +1 -2
- package/dist/types/config/index.d.ts +1 -0
- package/dist/types/hooks/auth.d.ts +6 -6
- package/dist/types/hooks/data.d.ts +216 -216
- package/dist/types/hooks/form.d.ts +6 -3
- package/dist/types/hooks/formExtend.d.ts +12 -0
- package/dist/types/hooks/formValidate.d.ts +14 -0
- package/dist/types/hooks/i18n.d.ts +2 -0
- package/dist/types/hooks/import.d.ts +1 -2
- package/dist/types/hooks/index.d.ts +4 -1
- package/dist/types/hooks/json.d.ts +1 -1
- package/dist/types/hooks/list.d.ts +66 -0
- package/dist/types/hooks/manage.d.ts +1 -0
- package/dist/types/hooks/menu.d.ts +1 -1
- package/dist/types/hooks/overlay.d.ts +1 -1
- package/dist/types/hooks/theme.d.ts +8 -8
- package/dist/types/index.d.ts +6 -5
- package/dist/types/preset/i18nProvider.d.ts +1 -1
- package/dist/types/stores/auth.d.ts +9 -24
- package/dist/types/stores/i18n.d.ts +7 -16
- package/dist/types/stores/index.d.ts +2 -2
- package/dist/types/stores/manage.d.ts +7 -16
- package/dist/types/stores/route.d.ts +12 -2538
- package/dist/types/stores/tab.d.ts +6 -1030
- package/dist/types/stores/theme.d.ts +14 -96
- package/dist/types/types/config.d.ts +9 -0
- package/dist/types/types/i18n.d.ts +1 -0
- package/dist/types/types/manage.d.ts +6 -0
- package/dist/types/types/theme.d.ts +2 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/theme.d.ts +4 -49
- package/package.json +22 -15
- package/dist/cjs/node_modules/jsep/dist/jsep.cjs +0 -2
- package/dist/esm/node_modules/jsep/dist/jsep.js +0 -737
- /package/dist/cjs/{hooks/themeColor.cjs → config/color.cjs} +0 -0
- /package/dist/esm/{hooks/themeColor.js → config/color.js} +0 -0
- /package/dist/types/{hooks/themeColor.d.ts → config/color.d.ts} +0 -0
package/dist/esm/hooks/data.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { useQuery as
|
|
2
|
-
import { toRef as
|
|
3
|
-
import { useGetAuth as
|
|
4
|
-
import { useManage as
|
|
1
|
+
import { useQuery as S, useInfiniteQuery as a, useMutation as $, useQueryClient as M } from "@tanstack/vue-query";
|
|
2
|
+
import { toRef as A, computed as h, watch as P, ref as L } from "vue";
|
|
3
|
+
import { useGetAuth as y, useError as q } from "./auth.js";
|
|
4
|
+
import { useManage as E } from "./manage.js";
|
|
5
5
|
function K(t) {
|
|
6
6
|
var c;
|
|
7
|
-
const u =
|
|
8
|
-
const { onError: n, options: g, pagination:
|
|
9
|
-
return
|
|
7
|
+
const u = E(), l = y(), v = t.providerName || "default", { mutate: s } = q(), f = A(t.pagination ? t.pagination : { page: 1, pageSize: 20 }), i = h(() => {
|
|
8
|
+
const { onError: n, options: g, pagination: N, ...F } = t;
|
|
9
|
+
return F;
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
t.pagination && (
|
|
11
|
+
P(i, () => {
|
|
12
|
+
t.pagination && (f.value.page = 1);
|
|
13
13
|
}, {
|
|
14
14
|
deep: !0
|
|
15
15
|
});
|
|
16
|
-
const
|
|
17
|
-
...
|
|
18
|
-
pagination: t.pagination ?
|
|
19
|
-
})), d =
|
|
20
|
-
queryKey: [`${(c = u.config) == null ? void 0 : c.name}:${v}:${t.path}`,
|
|
16
|
+
const r = h(() => ({
|
|
17
|
+
...i.value,
|
|
18
|
+
pagination: t.pagination ? f.value : void 0
|
|
19
|
+
})), d = S({
|
|
20
|
+
queryKey: [`${(c = u.config) == null ? void 0 : c.name}:${v}:${t.path}`, r],
|
|
21
21
|
queryFn: () => {
|
|
22
|
-
var n, g,
|
|
23
|
-
return (
|
|
22
|
+
var n, g, N;
|
|
23
|
+
return (N = (g = (n = u.config) == null ? void 0 : n.dataProvider) == null ? void 0 : g[v]) == null ? void 0 : N.getList(r.value, u, l);
|
|
24
24
|
},
|
|
25
25
|
...t.options
|
|
26
|
-
}), o =
|
|
27
|
-
|
|
26
|
+
}), o = h(() => d.isFetching.value);
|
|
27
|
+
P(() => d.isError, () => {
|
|
28
28
|
var n;
|
|
29
|
-
|
|
29
|
+
s(d.error), (n = t.onError) == null || n.call(t, d.error);
|
|
30
30
|
});
|
|
31
|
-
const e =
|
|
32
|
-
return
|
|
31
|
+
const e = L(void 0);
|
|
32
|
+
return P(d.data, (n) => {
|
|
33
33
|
n && (e.value = n);
|
|
34
34
|
}, {
|
|
35
35
|
immediate: !0
|
|
@@ -38,386 +38,390 @@ function K(t) {
|
|
|
38
38
|
isLoading: o,
|
|
39
39
|
data: e,
|
|
40
40
|
refetch: d.refetch,
|
|
41
|
-
pagination:
|
|
41
|
+
pagination: f
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
function Q(t) {
|
|
45
45
|
var c;
|
|
46
|
-
const u =
|
|
47
|
-
const { onError: n, options: g, pagination:
|
|
48
|
-
return
|
|
46
|
+
const u = E(), l = y(), v = t.providerName || "default", { mutate: s } = q(), f = A(t.pagination || { page: 1, pageSize: 20 }), i = h(() => {
|
|
47
|
+
const { onError: n, options: g, pagination: N, ...F } = t;
|
|
48
|
+
return F;
|
|
49
49
|
});
|
|
50
|
-
|
|
51
|
-
t.pagination && (
|
|
50
|
+
P(i, () => {
|
|
51
|
+
t.pagination && (f.value.page = 1);
|
|
52
52
|
}, {
|
|
53
53
|
deep: !0
|
|
54
54
|
});
|
|
55
|
-
const
|
|
56
|
-
queryKey: [`${(c = u.config) == null ? void 0 : c.name}:${v}:${t.path}`,
|
|
55
|
+
const r = a({
|
|
56
|
+
queryKey: [`${(c = u.config) == null ? void 0 : c.name}:${v}:${t.path}`, i],
|
|
57
57
|
queryFn: ({ pageParam: n }) => {
|
|
58
|
-
var g,
|
|
59
|
-
return
|
|
60
|
-
...
|
|
58
|
+
var g, N, F;
|
|
59
|
+
return f.value.page = n, (F = (N = (g = u.config) == null ? void 0 : g.dataProvider) == null ? void 0 : N[v]) == null ? void 0 : F.getList({
|
|
60
|
+
...i.value,
|
|
61
61
|
pagination: {
|
|
62
|
-
...
|
|
62
|
+
...f.value,
|
|
63
63
|
page: n
|
|
64
64
|
}
|
|
65
65
|
}, u, l);
|
|
66
66
|
},
|
|
67
67
|
initialPageParam: 1,
|
|
68
|
-
getNextPageParam: (n, g,
|
|
69
|
-
var
|
|
70
|
-
if (!(!(n != null && n.data) || ((
|
|
71
|
-
return
|
|
68
|
+
getNextPageParam: (n, g, N) => {
|
|
69
|
+
var F;
|
|
70
|
+
if (!(!(n != null && n.data) || ((F = n == null ? void 0 : n.data) == null ? void 0 : F.length) === 0))
|
|
71
|
+
return N + 1;
|
|
72
72
|
},
|
|
73
|
-
getPreviousPageParam: (n, g,
|
|
74
|
-
if (!(
|
|
75
|
-
return
|
|
73
|
+
getPreviousPageParam: (n, g, N) => {
|
|
74
|
+
if (!(N <= 1))
|
|
75
|
+
return N - 1;
|
|
76
76
|
},
|
|
77
77
|
...t.options
|
|
78
|
-
}), d =
|
|
79
|
-
|
|
78
|
+
}), d = h(() => r.isFetching.value);
|
|
79
|
+
P(() => r.isError, () => {
|
|
80
80
|
var n;
|
|
81
|
-
|
|
81
|
+
s(r.error), (n = t.onError) == null || n.call(t, r.error);
|
|
82
82
|
});
|
|
83
83
|
const o = () => {
|
|
84
|
-
if (!(!
|
|
85
|
-
return
|
|
86
|
-
}, e =
|
|
87
|
-
return
|
|
84
|
+
if (!(!r.hasNextPage.value || r.isFetching.value))
|
|
85
|
+
return r.fetchNextPage();
|
|
86
|
+
}, e = L(void 0);
|
|
87
|
+
return P(r.data, (n) => {
|
|
88
88
|
n && (e.value = n);
|
|
89
89
|
}, {
|
|
90
90
|
immediate: !0
|
|
91
91
|
}), {
|
|
92
|
-
...
|
|
92
|
+
...r,
|
|
93
93
|
isLoading: d,
|
|
94
94
|
data: e,
|
|
95
95
|
fetchNextPage: o,
|
|
96
|
-
hasNextPage:
|
|
97
|
-
refetch:
|
|
98
|
-
pagination:
|
|
96
|
+
hasNextPage: r.hasNextPage,
|
|
97
|
+
refetch: r.refetch,
|
|
98
|
+
pagination: f
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
function k(t) {
|
|
102
102
|
var o;
|
|
103
|
-
const u =
|
|
103
|
+
const u = E(), l = y(), v = t.providerName || "default", { mutate: s } = q(), f = h(() => {
|
|
104
104
|
const { onError: e, options: c, ...n } = t;
|
|
105
105
|
return n;
|
|
106
|
-
}),
|
|
107
|
-
queryKey: [`${(o = u.config) == null ? void 0 : o.name}:${v}:${t.path}`,
|
|
106
|
+
}), i = S({
|
|
107
|
+
queryKey: [`${(o = u.config) == null ? void 0 : o.name}:${v}:${t.path}`, f],
|
|
108
108
|
queryFn: () => {
|
|
109
109
|
var e, c, n;
|
|
110
|
-
return (n = (c = (e = u.config) == null ? void 0 : e.dataProvider) == null ? void 0 : c[v]) == null ? void 0 : n.getOne(
|
|
110
|
+
return (n = (c = (e = u.config) == null ? void 0 : e.dataProvider) == null ? void 0 : c[v]) == null ? void 0 : n.getOne(f.value, u, l);
|
|
111
111
|
},
|
|
112
112
|
...t.options
|
|
113
|
-
}),
|
|
114
|
-
|
|
113
|
+
}), r = h(() => i.isFetched.value ? !1 : i.isFetching.value);
|
|
114
|
+
P(() => i.isError, () => {
|
|
115
115
|
var e;
|
|
116
|
-
|
|
116
|
+
s(i.error), (e = t.onError) == null || e.call(t, i.error);
|
|
117
117
|
});
|
|
118
|
-
const d =
|
|
119
|
-
return
|
|
118
|
+
const d = L(void 0);
|
|
119
|
+
return P(i.data, (e) => {
|
|
120
120
|
e && (d.value = e);
|
|
121
121
|
}, {
|
|
122
122
|
immediate: !0
|
|
123
123
|
}), {
|
|
124
|
-
...
|
|
125
|
-
isLoading:
|
|
124
|
+
...i,
|
|
125
|
+
isLoading: r,
|
|
126
126
|
data: d,
|
|
127
|
-
refetch:
|
|
127
|
+
refetch: i.refetch
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
function I(t) {
|
|
131
131
|
var o;
|
|
132
|
-
const u =
|
|
132
|
+
const u = E(), l = y(), v = t.providerName || "default", { mutate: s } = q(), f = h(() => {
|
|
133
133
|
const { onError: e, options: c, ...n } = t;
|
|
134
134
|
return n;
|
|
135
|
-
}),
|
|
136
|
-
queryKey: [`${(o = u.config) == null ? void 0 : o.name}:${v}:${t.path}`,
|
|
135
|
+
}), i = S({
|
|
136
|
+
queryKey: [`${(o = u.config) == null ? void 0 : o.name}:${v}:${t.path}`, f],
|
|
137
137
|
queryFn: () => {
|
|
138
138
|
var e, c, n;
|
|
139
|
-
return (n = (c = (e = u.config) == null ? void 0 : e.dataProvider) == null ? void 0 : c[v]) == null ? void 0 : n.getMany(
|
|
139
|
+
return (n = (c = (e = u.config) == null ? void 0 : e.dataProvider) == null ? void 0 : c[v]) == null ? void 0 : n.getMany(f.value, u, l);
|
|
140
140
|
},
|
|
141
141
|
...t.options
|
|
142
|
-
}),
|
|
143
|
-
|
|
142
|
+
}), r = h(() => i.isFetched.value ? !1 : i.isFetching.value);
|
|
143
|
+
P(() => i.isError, () => {
|
|
144
144
|
var e;
|
|
145
|
-
|
|
145
|
+
s(i.error), (e = t.onError) == null || e.call(t, i.error);
|
|
146
146
|
});
|
|
147
|
-
const d =
|
|
148
|
-
return
|
|
147
|
+
const d = L(void 0);
|
|
148
|
+
return P(i.data, (e) => {
|
|
149
149
|
e && (d.value = e);
|
|
150
150
|
}, {
|
|
151
151
|
immediate: !0
|
|
152
152
|
}), {
|
|
153
|
-
...
|
|
154
|
-
isLoading:
|
|
153
|
+
...i,
|
|
154
|
+
isLoading: r,
|
|
155
155
|
data: d,
|
|
156
|
-
refetch:
|
|
156
|
+
refetch: i.refetch
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
function O(t) {
|
|
160
|
-
const u =
|
|
160
|
+
const u = E(), l = y(), v = t.providerName || "default", { mutate: s } = q(), { invalidate: f } = w(), i = h(() => {
|
|
161
161
|
const { onError: o, options: e, ...c } = t;
|
|
162
162
|
return c;
|
|
163
|
-
}),
|
|
163
|
+
}), r = $({
|
|
164
164
|
mutationFn: (o) => {
|
|
165
165
|
var e, c, n, g;
|
|
166
166
|
if (!((e = u.config) != null && e.dataProvider))
|
|
167
167
|
throw new Error("Data provider is not initialized");
|
|
168
168
|
return (g = (n = (c = u.config) == null ? void 0 : c.dataProvider) == null ? void 0 : n[v]) == null ? void 0 : g.create({
|
|
169
|
-
...
|
|
169
|
+
...i.value,
|
|
170
170
|
...o
|
|
171
171
|
}, u, l);
|
|
172
172
|
},
|
|
173
173
|
onSuccess: (o) => {
|
|
174
174
|
var e;
|
|
175
|
-
(e = t.onSuccess) == null || e.call(t, o), t.path &&
|
|
175
|
+
(e = t.onSuccess) == null || e.call(t, o), t.path && f(t.path);
|
|
176
176
|
},
|
|
177
177
|
onError: (o) => {
|
|
178
178
|
var e;
|
|
179
|
-
|
|
179
|
+
s(o), (e = t.onError) == null || e.call(t, o);
|
|
180
180
|
},
|
|
181
181
|
...t.options
|
|
182
|
-
}), d =
|
|
182
|
+
}), d = h(() => r.isPending.value);
|
|
183
183
|
return {
|
|
184
|
-
...
|
|
184
|
+
...r,
|
|
185
185
|
isLoading: d,
|
|
186
|
-
mutate:
|
|
186
|
+
mutate: r.mutate
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
189
|
function _(t) {
|
|
190
|
-
const u =
|
|
190
|
+
const u = E(), l = y(), v = t.providerName || "default", { mutate: s } = q(), { invalidate: f } = w(), i = h(() => {
|
|
191
191
|
const { onError: o, options: e, ...c } = t;
|
|
192
192
|
return c;
|
|
193
|
-
}),
|
|
193
|
+
}), r = $({
|
|
194
194
|
mutationFn: (o) => {
|
|
195
195
|
var e, c, n, g;
|
|
196
196
|
if (!((e = u.config) != null && e.dataProvider))
|
|
197
197
|
throw new Error("Data provider is not initialized");
|
|
198
198
|
return (g = (n = (c = u.config) == null ? void 0 : c.dataProvider) == null ? void 0 : n[v]) == null ? void 0 : g.createMany({
|
|
199
|
-
...
|
|
199
|
+
...i.value,
|
|
200
200
|
...o
|
|
201
201
|
}, u, l);
|
|
202
202
|
},
|
|
203
203
|
onSuccess: (o) => {
|
|
204
204
|
var e;
|
|
205
|
-
(e = t.onSuccess) == null || e.call(t, o), t.path &&
|
|
205
|
+
(e = t.onSuccess) == null || e.call(t, o), t.path && f(t.path);
|
|
206
206
|
},
|
|
207
207
|
onError: (o) => {
|
|
208
208
|
var e;
|
|
209
|
-
|
|
209
|
+
s(o), (e = t.onError) == null || e.call(t, o);
|
|
210
210
|
},
|
|
211
211
|
...t.options
|
|
212
|
-
}), d =
|
|
212
|
+
}), d = h(() => r.isPending.value);
|
|
213
213
|
return {
|
|
214
|
-
...
|
|
214
|
+
...r,
|
|
215
215
|
isLoading: d,
|
|
216
|
-
mutate:
|
|
216
|
+
mutate: r.mutate
|
|
217
217
|
};
|
|
218
218
|
}
|
|
219
219
|
function U(t) {
|
|
220
|
-
const u =
|
|
220
|
+
const u = E(), l = y(), v = t.providerName || "default", { mutate: s } = q(), { invalidate: f } = w(), i = h(() => {
|
|
221
221
|
const { onError: o, options: e, ...c } = t;
|
|
222
222
|
return c;
|
|
223
|
-
}),
|
|
223
|
+
}), r = $({
|
|
224
224
|
mutationFn: (o) => {
|
|
225
225
|
var e, c, n, g;
|
|
226
226
|
if (!((e = u.config) != null && e.dataProvider))
|
|
227
227
|
throw new Error("Data provider is not initialized");
|
|
228
228
|
return (g = (n = (c = u.config) == null ? void 0 : c.dataProvider) == null ? void 0 : n[v]) == null ? void 0 : g.update({
|
|
229
|
-
...
|
|
229
|
+
...i.value,
|
|
230
230
|
...o
|
|
231
231
|
}, u, l);
|
|
232
232
|
},
|
|
233
233
|
onSuccess: (o) => {
|
|
234
234
|
var e;
|
|
235
|
-
(e = t.onSuccess) == null || e.call(t, o), t.path &&
|
|
235
|
+
(e = t.onSuccess) == null || e.call(t, o), t.path && f(t.path);
|
|
236
236
|
},
|
|
237
237
|
onError: (o) => {
|
|
238
238
|
var e;
|
|
239
|
-
|
|
239
|
+
s(o), (e = t.onError) == null || e.call(t, o);
|
|
240
240
|
},
|
|
241
241
|
...t.options
|
|
242
|
-
}), d =
|
|
242
|
+
}), d = h(() => r.isPending.value);
|
|
243
243
|
return {
|
|
244
|
-
...
|
|
244
|
+
...r,
|
|
245
245
|
isLoading: d,
|
|
246
|
-
mutate:
|
|
246
|
+
mutate: r.mutate
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
249
|
function G(t) {
|
|
250
|
-
const u =
|
|
250
|
+
const u = E(), l = y(), v = t.providerName || "default", { mutate: s } = q(), { invalidate: f } = w(), i = h(() => {
|
|
251
251
|
const { onError: o, options: e, ...c } = t;
|
|
252
252
|
return c;
|
|
253
|
-
}),
|
|
253
|
+
}), r = $({
|
|
254
254
|
mutationFn: (o) => {
|
|
255
255
|
var e, c, n, g;
|
|
256
256
|
if (!((e = u.config) != null && e.dataProvider))
|
|
257
257
|
throw new Error("Data provider is not initialized");
|
|
258
258
|
return (g = (n = (c = u.config) == null ? void 0 : c.dataProvider) == null ? void 0 : n[v]) == null ? void 0 : g.updateMany({
|
|
259
|
-
...
|
|
259
|
+
...i.value,
|
|
260
260
|
...o
|
|
261
261
|
}, u, l);
|
|
262
262
|
},
|
|
263
263
|
onSuccess: (o) => {
|
|
264
264
|
var e;
|
|
265
|
-
(e = t.onSuccess) == null || e.call(t, o), t.path &&
|
|
265
|
+
(e = t.onSuccess) == null || e.call(t, o), t.path && f(t.path);
|
|
266
266
|
},
|
|
267
267
|
onError: (o) => {
|
|
268
268
|
var e;
|
|
269
|
-
|
|
269
|
+
s(o), (e = t.onError) == null || e.call(t, o);
|
|
270
270
|
},
|
|
271
271
|
...t.options
|
|
272
|
-
}), d =
|
|
272
|
+
}), d = h(() => r.isPending.value);
|
|
273
273
|
return {
|
|
274
|
-
...
|
|
274
|
+
...r,
|
|
275
275
|
isLoading: d,
|
|
276
|
-
mutate:
|
|
276
|
+
mutate: r.mutate
|
|
277
277
|
};
|
|
278
278
|
}
|
|
279
279
|
function R(t) {
|
|
280
|
-
const u =
|
|
280
|
+
const u = E(), l = y(), v = t.providerName || "default", { mutate: s } = q(), { invalidate: f } = w(), i = h(() => {
|
|
281
281
|
const { onError: o, options: e, ...c } = t;
|
|
282
282
|
return c;
|
|
283
|
-
}),
|
|
283
|
+
}), r = $({
|
|
284
284
|
mutationFn: (o) => {
|
|
285
285
|
var e, c, n, g;
|
|
286
286
|
if (!((e = u.config) != null && e.dataProvider))
|
|
287
287
|
throw new Error("Data provider is not initialized");
|
|
288
288
|
return (g = (n = (c = u.config) == null ? void 0 : c.dataProvider) == null ? void 0 : n[v]) == null ? void 0 : g.deleteOne({
|
|
289
|
-
...
|
|
289
|
+
...i.value,
|
|
290
290
|
...o
|
|
291
291
|
}, u, l);
|
|
292
292
|
},
|
|
293
293
|
onSuccess: (o) => {
|
|
294
294
|
var e;
|
|
295
|
-
|
|
295
|
+
r.reset(), (e = t.onSuccess) == null || e.call(t, o), t.path && f(t.path);
|
|
296
296
|
},
|
|
297
297
|
onError: (o) => {
|
|
298
298
|
var e;
|
|
299
|
-
|
|
299
|
+
s(o), (e = t.onError) == null || e.call(t, o);
|
|
300
300
|
},
|
|
301
301
|
...t.options
|
|
302
|
-
}), d =
|
|
302
|
+
}), d = h(() => r.isPending.value);
|
|
303
303
|
return {
|
|
304
|
-
...
|
|
304
|
+
...r,
|
|
305
305
|
isLoading: d,
|
|
306
|
-
mutate:
|
|
306
|
+
mutate: r.mutate
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
309
|
function b(t) {
|
|
310
|
-
const u =
|
|
310
|
+
const u = E(), l = y(), v = t.providerName || "default", { mutate: s } = q(), { invalidate: f } = w(), i = h(() => {
|
|
311
311
|
const { onError: o, options: e, ...c } = t;
|
|
312
312
|
return c;
|
|
313
|
-
}),
|
|
313
|
+
}), r = $({
|
|
314
314
|
mutationFn: (o) => {
|
|
315
315
|
var e, c, n, g;
|
|
316
316
|
if (!((e = u.config) != null && e.dataProvider))
|
|
317
317
|
throw new Error("Data provider is not initialized");
|
|
318
318
|
return (g = (n = (c = u.config) == null ? void 0 : c.dataProvider) == null ? void 0 : n[v]) == null ? void 0 : g.deleteMany({
|
|
319
|
-
...
|
|
319
|
+
...i.value,
|
|
320
320
|
...o
|
|
321
321
|
}, u, l);
|
|
322
322
|
},
|
|
323
323
|
onSuccess: (o) => {
|
|
324
324
|
var e;
|
|
325
|
-
(e = t.onSuccess) == null || e.call(t, o), t.path &&
|
|
325
|
+
(e = t.onSuccess) == null || e.call(t, o), t.path && f(t.path);
|
|
326
326
|
},
|
|
327
327
|
onError: (o) => {
|
|
328
328
|
var e;
|
|
329
|
-
|
|
329
|
+
s(o), (e = t.onError) == null || e.call(t, o);
|
|
330
330
|
},
|
|
331
331
|
...t.options
|
|
332
|
-
}), d =
|
|
332
|
+
}), d = h(() => r.isPending.value);
|
|
333
333
|
return {
|
|
334
|
-
...
|
|
334
|
+
...r,
|
|
335
335
|
isLoading: d,
|
|
336
|
-
mutate:
|
|
336
|
+
mutate: r.mutate
|
|
337
337
|
};
|
|
338
338
|
}
|
|
339
339
|
function j(t) {
|
|
340
340
|
var o;
|
|
341
|
-
const u =
|
|
341
|
+
const u = E(), l = y(), v = (t == null ? void 0 : t.providerName) || "default", { mutate: s } = q(), f = h(() => {
|
|
342
|
+
if (!t)
|
|
343
|
+
return {};
|
|
342
344
|
const { onError: e, options: c, ...n } = t;
|
|
343
345
|
return n;
|
|
344
|
-
}),
|
|
345
|
-
queryKey: [`${(o = u.config) == null ? void 0 : o.name}:${v}:${t.path}`,
|
|
346
|
+
}), i = S({
|
|
347
|
+
queryKey: [`${(o = u.config) == null ? void 0 : o.name}:${v}:${t == null ? void 0 : t.path}`, f],
|
|
346
348
|
queryFn: () => {
|
|
347
349
|
var e, c, n;
|
|
348
|
-
return (n = (c = (e = u.config) == null ? void 0 : e.dataProvider) == null ? void 0 : c[v]) == null ? void 0 : n.custom(
|
|
350
|
+
return (n = (c = (e = u.config) == null ? void 0 : e.dataProvider) == null ? void 0 : c[v]) == null ? void 0 : n.custom(f.value, u, l);
|
|
349
351
|
},
|
|
350
|
-
...t.options
|
|
351
|
-
}),
|
|
352
|
-
|
|
352
|
+
...t == null ? void 0 : t.options
|
|
353
|
+
}), r = h(() => i.isFetched.value ? !1 : i.isFetching.value);
|
|
354
|
+
P(() => i.isError, () => {
|
|
353
355
|
var e;
|
|
354
|
-
|
|
356
|
+
s(i.error), (e = t == null ? void 0 : t.onError) == null || e.call(t, i.error);
|
|
355
357
|
});
|
|
356
|
-
const d =
|
|
357
|
-
return
|
|
358
|
+
const d = L(void 0);
|
|
359
|
+
return P(i.data, (e) => {
|
|
358
360
|
e && (d.value = e);
|
|
359
361
|
}, {
|
|
360
362
|
immediate: !0
|
|
361
363
|
}), {
|
|
362
|
-
...
|
|
363
|
-
isLoading:
|
|
364
|
+
...i,
|
|
365
|
+
isLoading: r,
|
|
364
366
|
data: d,
|
|
365
|
-
refetch:
|
|
367
|
+
refetch: i.refetch
|
|
366
368
|
};
|
|
367
369
|
}
|
|
368
370
|
function B(t) {
|
|
369
|
-
const u =
|
|
371
|
+
const u = E(), l = y(), v = (t == null ? void 0 : t.providerName) || "default", { mutate: s } = q(), f = h(() => {
|
|
372
|
+
if (!t)
|
|
373
|
+
return {};
|
|
370
374
|
const { onError: d, options: o, ...e } = t;
|
|
371
375
|
return e;
|
|
372
|
-
}),
|
|
376
|
+
}), i = $({
|
|
373
377
|
mutationFn: (d) => {
|
|
374
378
|
var o, e, c, n;
|
|
375
379
|
if (!((o = u.config) != null && o.dataProvider))
|
|
376
380
|
throw new Error("Data provider is not initialized");
|
|
377
381
|
return (n = (c = (e = u.config) == null ? void 0 : e.dataProvider) == null ? void 0 : c[v]) == null ? void 0 : n.custom({
|
|
378
|
-
...
|
|
382
|
+
...f.value,
|
|
379
383
|
...d
|
|
380
384
|
}, u, l);
|
|
381
385
|
},
|
|
382
386
|
onSuccess: (d) => {
|
|
383
387
|
var o;
|
|
384
|
-
|
|
388
|
+
i.reset(), (o = t == null ? void 0 : t.onSuccess) == null || o.call(t, d);
|
|
385
389
|
},
|
|
386
390
|
onError: (d) => {
|
|
387
391
|
var o;
|
|
388
|
-
|
|
392
|
+
s(d), (o = t == null ? void 0 : t.onError) == null || o.call(t, d);
|
|
389
393
|
},
|
|
390
|
-
...t.options
|
|
391
|
-
}),
|
|
394
|
+
...t == null ? void 0 : t.options
|
|
395
|
+
}), r = h(() => i.isPending.value);
|
|
392
396
|
return {
|
|
393
|
-
...
|
|
394
|
-
isLoading:
|
|
395
|
-
mutate:
|
|
397
|
+
...i,
|
|
398
|
+
isLoading: r,
|
|
399
|
+
mutate: i.mutate
|
|
396
400
|
};
|
|
397
401
|
}
|
|
398
402
|
function H() {
|
|
399
|
-
const t =
|
|
403
|
+
const t = E(), u = y();
|
|
400
404
|
return {
|
|
401
405
|
request: (v) => {
|
|
402
|
-
var
|
|
403
|
-
if (!((
|
|
406
|
+
var f, i, r, d;
|
|
407
|
+
if (!((f = t.config) != null && f.dataProvider))
|
|
404
408
|
throw new Error("Data provider is not initialized");
|
|
405
|
-
const
|
|
406
|
-
return (d = (
|
|
409
|
+
const s = v.providerName || "default";
|
|
410
|
+
return (d = (r = (i = t.config) == null ? void 0 : i.dataProvider) == null ? void 0 : r[s]) == null ? void 0 : d.custom({
|
|
407
411
|
...v
|
|
408
412
|
}, t, u);
|
|
409
413
|
}
|
|
410
414
|
};
|
|
411
415
|
}
|
|
412
|
-
function
|
|
413
|
-
const t = M(), u =
|
|
416
|
+
function w() {
|
|
417
|
+
const t = M(), u = E();
|
|
414
418
|
return {
|
|
415
|
-
invalidate: (v,
|
|
416
|
-
var
|
|
417
|
-
let
|
|
418
|
-
Array.isArray(v) || (
|
|
419
|
-
for (const
|
|
420
|
-
const d = `${(
|
|
419
|
+
invalidate: (v, s) => {
|
|
420
|
+
var i;
|
|
421
|
+
let f = v;
|
|
422
|
+
Array.isArray(v) || (f = [v]);
|
|
423
|
+
for (const r of f) {
|
|
424
|
+
const d = `${(i = u.config) == null ? void 0 : i.name}:${s || "default"}:${r}`;
|
|
421
425
|
t.invalidateQueries({
|
|
422
426
|
queryKey: [d]
|
|
423
427
|
});
|
|
@@ -434,7 +438,7 @@ export {
|
|
|
434
438
|
R as useDelete,
|
|
435
439
|
b as useDeleteMany,
|
|
436
440
|
Q as useInfiniteList,
|
|
437
|
-
|
|
441
|
+
w as useInvalidate,
|
|
438
442
|
K as useList,
|
|
439
443
|
I as useMany,
|
|
440
444
|
k as useOne,
|
package/dist/esm/hooks/export.js
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { useInfiniteList as
|
|
1
|
+
import { ref as h, computed as u } from "vue";
|
|
2
|
+
import { useInfiniteList as w } from "./data.js";
|
|
3
3
|
const y = (e) => new Promise((a) => setTimeout(a, e));
|
|
4
|
-
function
|
|
5
|
-
const a =
|
|
6
|
-
const { onSuccess: n, onProgress: i, interval: l, maxPage:
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
function E(e) {
|
|
5
|
+
const a = h(!1), r = u(() => {
|
|
6
|
+
const { onSuccess: n, onProgress: i, interval: l, maxPage: s, ...f } = e;
|
|
7
|
+
return {
|
|
8
|
+
...f,
|
|
9
|
+
options: {
|
|
10
|
+
...f.options,
|
|
11
|
+
enabled: !1,
|
|
12
|
+
refetchOnMount: !1,
|
|
13
|
+
refetchOnWindowFocus: !1,
|
|
14
|
+
refetchOnReconnect: !1
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}), c = u(() => e.interval || 300), { data: o, isLoading: g, fetchNextPage: v, hasNextPage: m, refetch: P, pagination: t } = w(r.value), x = async () => {
|
|
15
18
|
var n, i, l;
|
|
16
19
|
if (!a.value)
|
|
17
20
|
try {
|
|
18
|
-
a.value = !0, t.value.page = 1, (n = e.onProgress) == null || n.call(e, t.value), await
|
|
19
|
-
const
|
|
20
|
-
for (;
|
|
21
|
-
c.value > 0 && await y(c.value), await
|
|
22
|
-
(l = e.onSuccess) == null || l.call(e,
|
|
21
|
+
a.value = !0, t.value.page = 1, (n = e.onProgress) == null || n.call(e, t.value), await P();
|
|
22
|
+
const s = typeof e.maxPage == "function" ? e.maxPage() : e.maxPage || 100;
|
|
23
|
+
for (; m.value && t.value.page < s; )
|
|
24
|
+
c.value > 0 && await y(c.value), await v(), (i = e.onProgress) == null || i.call(e, t.value);
|
|
25
|
+
(l = e.onSuccess) == null || l.call(e, o.value);
|
|
23
26
|
} finally {
|
|
24
27
|
a.value = !1;
|
|
25
28
|
}
|
|
26
|
-
},
|
|
29
|
+
}, d = u(() => g.value || a.value);
|
|
27
30
|
return {
|
|
28
|
-
data:
|
|
29
|
-
isLoading:
|
|
30
|
-
trigger:
|
|
31
|
+
data: o,
|
|
32
|
+
isLoading: d,
|
|
33
|
+
trigger: x
|
|
31
34
|
};
|
|
32
35
|
}
|
|
33
36
|
export {
|
|
34
|
-
|
|
37
|
+
E as useExport
|
|
35
38
|
};
|