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