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