@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.
Files changed (116) 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/loader.cjs +1 -0
  4. package/dist/cjs/components/loader/remote/loader.cjs +1 -0
  5. package/dist/cjs/components/loader/remote/render.cjs +1 -0
  6. package/dist/cjs/components/overlay/overlay.cjs +1 -1
  7. package/dist/cjs/components/status/error.cjs +1 -1
  8. package/dist/cjs/components/status/exception.cjs +1 -0
  9. package/dist/cjs/components/status/notAuthorized.cjs +1 -1
  10. package/dist/cjs/components/status/notFound.cjs +1 -1
  11. package/dist/cjs/directive/permission.cjs +1 -1
  12. package/dist/cjs/hooks/auth.cjs +1 -1
  13. package/dist/cjs/hooks/data.cjs +1 -1
  14. package/dist/cjs/hooks/export.cjs +1 -1
  15. package/dist/cjs/hooks/form.cjs +1 -1
  16. package/dist/cjs/hooks/formExtend.cjs +1 -0
  17. package/dist/cjs/hooks/formValidate.cjs +1 -0
  18. package/dist/cjs/hooks/i18n.cjs +1 -1
  19. package/dist/cjs/hooks/importCsv.cjs +1 -1
  20. package/dist/cjs/hooks/json/utils/expressionParser.cjs +1 -1
  21. package/dist/cjs/hooks/json.cjs +1 -1
  22. package/dist/cjs/hooks/list.cjs +1 -0
  23. package/dist/cjs/hooks/manage.cjs +1 -1
  24. package/dist/cjs/hooks/menu.cjs +1 -1
  25. package/dist/cjs/hooks/overlay.cjs +1 -1
  26. package/dist/cjs/hooks/select.cjs +1 -1
  27. package/dist/cjs/hooks/theme.cjs +2 -2
  28. package/dist/cjs/hooks/upload.cjs +1 -1
  29. package/dist/cjs/index.cjs +1 -1
  30. package/dist/cjs/main.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/provider/tab.cjs +1 -1
  35. package/dist/cjs/stores/manage.cjs +1 -1
  36. package/dist/cjs/stores/tab.cjs +1 -1
  37. package/dist/cjs/stores/theme.cjs +1 -1
  38. package/dist/cjs/utils/theme.cjs +9 -1
  39. package/dist/esm/components/auth/can.js +9 -7
  40. package/dist/esm/components/loader/loader.js +48 -0
  41. package/dist/esm/components/loader/remote/loader.js +150 -0
  42. package/dist/esm/components/loader/remote/render.js +19 -0
  43. package/dist/esm/components/overlay/overlay.js +22 -31
  44. package/dist/esm/components/status/error.js +3 -3
  45. package/dist/esm/components/status/exception.js +23 -0
  46. package/dist/esm/components/status/notAuthorized.js +2 -2
  47. package/dist/esm/components/status/notFound.js +4 -4
  48. package/dist/esm/directive/permission.js +5 -3
  49. package/dist/esm/hooks/auth.js +67 -67
  50. package/dist/esm/hooks/data.js +164 -160
  51. package/dist/esm/hooks/export.js +26 -23
  52. package/dist/esm/hooks/form.js +38 -35
  53. package/dist/esm/hooks/formExtend.js +38 -0
  54. package/dist/esm/hooks/formValidate.js +28 -0
  55. package/dist/esm/hooks/i18n.js +16 -8
  56. package/dist/esm/hooks/json/utils/expressionParser.js +1 -1
  57. package/dist/esm/hooks/json.js +57 -57
  58. package/dist/esm/hooks/list.js +179 -0
  59. package/dist/esm/hooks/manage.js +18 -13
  60. package/dist/esm/hooks/overlay.js +6 -4
  61. package/dist/esm/hooks/theme.js +11 -11
  62. package/dist/esm/index.js +129 -113
  63. package/dist/esm/main.js +22 -12
  64. package/dist/esm/preset/i18nProvider.js +17 -18
  65. package/dist/esm/provider/app.js +61 -53
  66. package/dist/esm/provider/tab.js +1 -1
  67. package/dist/esm/stores/manage.js +34 -24
  68. package/dist/esm/stores/tab.js +58 -49
  69. package/dist/esm/stores/theme.js +36 -34
  70. package/dist/esm/utils/theme.js +89 -76
  71. package/dist/types/components/index.d.ts +2 -1
  72. package/dist/types/components/loader/loader.d.ts +2 -0
  73. package/dist/types/components/loader/remote/index.d.ts +2 -0
  74. package/dist/types/components/loader/remote/loader.d.ts +1 -0
  75. package/dist/types/components/loader/remote/render.d.ts +1 -0
  76. package/dist/types/components/status/error.d.ts +1 -2
  77. package/dist/types/components/status/exception.d.ts +3 -0
  78. package/dist/types/components/status/index.d.ts +4 -0
  79. package/dist/types/components/status/notAuthorized.d.ts +1 -2
  80. package/dist/types/components/status/notFound.d.ts +1 -2
  81. package/dist/types/config/index.d.ts +1 -0
  82. package/dist/types/hooks/auth.d.ts +6 -6
  83. package/dist/types/hooks/data.d.ts +216 -216
  84. package/dist/types/hooks/form.d.ts +6 -3
  85. package/dist/types/hooks/formExtend.d.ts +12 -0
  86. package/dist/types/hooks/formValidate.d.ts +14 -0
  87. package/dist/types/hooks/i18n.d.ts +2 -0
  88. package/dist/types/hooks/import.d.ts +1 -2
  89. package/dist/types/hooks/index.d.ts +4 -1
  90. package/dist/types/hooks/json.d.ts +1 -1
  91. package/dist/types/hooks/list.d.ts +66 -0
  92. package/dist/types/hooks/manage.d.ts +1 -0
  93. package/dist/types/hooks/menu.d.ts +1 -1
  94. package/dist/types/hooks/overlay.d.ts +1 -1
  95. package/dist/types/hooks/theme.d.ts +8 -8
  96. package/dist/types/index.d.ts +6 -5
  97. package/dist/types/preset/i18nProvider.d.ts +1 -1
  98. package/dist/types/stores/auth.d.ts +9 -24
  99. package/dist/types/stores/i18n.d.ts +7 -16
  100. package/dist/types/stores/index.d.ts +2 -2
  101. package/dist/types/stores/manage.d.ts +7 -16
  102. package/dist/types/stores/route.d.ts +12 -2538
  103. package/dist/types/stores/tab.d.ts +6 -1030
  104. package/dist/types/stores/theme.d.ts +14 -96
  105. package/dist/types/types/config.d.ts +9 -0
  106. package/dist/types/types/i18n.d.ts +1 -0
  107. package/dist/types/types/manage.d.ts +6 -0
  108. package/dist/types/types/theme.d.ts +2 -0
  109. package/dist/types/utils/index.d.ts +1 -1
  110. package/dist/types/utils/theme.d.ts +4 -49
  111. package/package.json +22 -15
  112. package/dist/cjs/node_modules/jsep/dist/jsep.cjs +0 -2
  113. package/dist/esm/node_modules/jsep/dist/jsep.js +0 -737
  114. /package/dist/cjs/{hooks/themeColor.cjs → config/color.cjs} +0 -0
  115. /package/dist/esm/{hooks/themeColor.js → config/color.js} +0 -0
  116. /package/dist/types/{hooks/themeColor.d.ts → config/color.d.ts} +0 -0
@@ -1,35 +1,35 @@
1
- import { useQuery as L, useInfiniteQuery as A, useMutation as F, useQueryClient as M } from "@tanstack/vue-query";
2
- import { toRef as S, computed as a, watch as N, ref as w } from "vue";
3
- import { useGetAuth as E, useError as P } from "./auth.js";
4
- import { useManage as h } from "./manage.js";
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 = h(), l = E(), v = t.providerName || "default", { mutate: f } = P(), s = S(t.pagination ? t.pagination : { page: 1, pageSize: 20 }), r = a(() => {
8
- const { onError: n, options: g, pagination: y, ...q } = t;
9
- return q;
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
- N(r, () => {
12
- t.pagination && (s.value.page = 1);
11
+ P(i, () => {
12
+ t.pagination && (f.value.page = 1);
13
13
  }, {
14
14
  deep: !0
15
15
  });
16
- const i = a(() => ({
17
- ...r.value,
18
- pagination: t.pagination ? s.value : void 0
19
- })), d = L({
20
- queryKey: [`${(c = u.config) == null ? void 0 : c.name}:${v}:${t.path}`, i],
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, y;
23
- return (y = (g = (n = u.config) == null ? void 0 : n.dataProvider) == null ? void 0 : g[v]) == null ? void 0 : y.getList(i.value, u, l);
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 = a(() => d.isFetching.value);
27
- N(() => d.isError, () => {
26
+ }), o = h(() => d.isFetching.value);
27
+ P(() => d.isError, () => {
28
28
  var n;
29
- f(d.error), (n = t.onError) == null || n.call(t, d.error);
29
+ s(d.error), (n = t.onError) == null || n.call(t, d.error);
30
30
  });
31
- const e = w(void 0);
32
- return N(d.data, (n) => {
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: s
41
+ pagination: f
42
42
  };
43
43
  }
44
44
  function Q(t) {
45
45
  var c;
46
- const u = h(), l = E(), v = t.providerName || "default", { mutate: f } = P(), s = S(t.pagination || { page: 1, pageSize: 20 }), r = a(() => {
47
- const { onError: n, options: g, pagination: y, ...q } = t;
48
- return q;
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
- N(r, () => {
51
- t.pagination && (s.value.page = 1);
50
+ P(i, () => {
51
+ t.pagination && (f.value.page = 1);
52
52
  }, {
53
53
  deep: !0
54
54
  });
55
- const i = A({
56
- queryKey: [`${(c = u.config) == null ? void 0 : c.name}:${v}:${t.path}`, r],
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, y, q;
59
- return s.value.page = n, (q = (y = (g = u.config) == null ? void 0 : g.dataProvider) == null ? void 0 : y[v]) == null ? void 0 : q.getList({
60
- ...r.value,
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
- ...s.value,
62
+ ...f.value,
63
63
  page: n
64
64
  }
65
65
  }, u, l);
66
66
  },
67
67
  initialPageParam: 1,
68
- getNextPageParam: (n, g, y) => {
69
- var q;
70
- if (!(!(n != null && n.data) || ((q = n == null ? void 0 : n.data) == null ? void 0 : q.length) === 0))
71
- return y + 1;
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, y) => {
74
- if (!(y <= 1))
75
- return y - 1;
73
+ getPreviousPageParam: (n, g, N) => {
74
+ if (!(N <= 1))
75
+ return N - 1;
76
76
  },
77
77
  ...t.options
78
- }), d = a(() => i.isFetching.value);
79
- N(() => i.isError, () => {
78
+ }), d = h(() => r.isFetching.value);
79
+ P(() => r.isError, () => {
80
80
  var n;
81
- f(i.error), (n = t.onError) == null || n.call(t, i.error);
81
+ s(r.error), (n = t.onError) == null || n.call(t, r.error);
82
82
  });
83
83
  const o = () => {
84
- if (!(!i.hasNextPage.value || i.isFetching.value))
85
- return i.fetchNextPage();
86
- }, e = w(void 0);
87
- return N(i.data, (n) => {
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
- ...i,
92
+ ...r,
93
93
  isLoading: d,
94
94
  data: e,
95
95
  fetchNextPage: o,
96
- hasNextPage: i.hasNextPage,
97
- refetch: i.refetch,
98
- pagination: s
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 = h(), l = E(), v = t.providerName || "default", { mutate: f } = P(), s = a(() => {
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
- }), r = L({
107
- queryKey: [`${(o = u.config) == null ? void 0 : o.name}:${v}:${t.path}`, s],
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(s.value, u, l);
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
- }), i = a(() => r.isFetched.value ? !1 : r.isFetching.value);
114
- N(() => r.isError, () => {
113
+ }), r = h(() => i.isFetched.value ? !1 : i.isFetching.value);
114
+ P(() => i.isError, () => {
115
115
  var e;
116
- f(r.error), (e = t.onError) == null || e.call(t, r.error);
116
+ s(i.error), (e = t.onError) == null || e.call(t, i.error);
117
117
  });
118
- const d = w(void 0);
119
- return N(r.data, (e) => {
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
- ...r,
125
- isLoading: i,
124
+ ...i,
125
+ isLoading: r,
126
126
  data: d,
127
- refetch: r.refetch
127
+ refetch: i.refetch
128
128
  };
129
129
  }
130
130
  function I(t) {
131
131
  var o;
132
- const u = h(), l = E(), v = t.providerName || "default", { mutate: f } = P(), s = a(() => {
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
- }), r = L({
136
- queryKey: [`${(o = u.config) == null ? void 0 : o.name}:${v}:${t.path}`, s],
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(s.value, u, l);
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
- }), i = a(() => r.isFetched.value ? !1 : r.isFetching.value);
143
- N(() => r.isError, () => {
142
+ }), r = h(() => i.isFetched.value ? !1 : i.isFetching.value);
143
+ P(() => i.isError, () => {
144
144
  var e;
145
- f(r.error), (e = t.onError) == null || e.call(t, r.error);
145
+ s(i.error), (e = t.onError) == null || e.call(t, i.error);
146
146
  });
147
- const d = w(void 0);
148
- return N(r.data, (e) => {
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
- ...r,
154
- isLoading: i,
153
+ ...i,
154
+ isLoading: r,
155
155
  data: d,
156
- refetch: r.refetch
156
+ refetch: i.refetch
157
157
  };
158
158
  }
159
159
  function O(t) {
160
- const u = h(), l = E(), v = t.providerName || "default", { mutate: f } = P(), { invalidate: s } = $(), r = a(() => {
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
- }), i = F({
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
- ...r.value,
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 && s(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
- f(o), (e = t.onError) == null || e.call(t, o);
179
+ s(o), (e = t.onError) == null || e.call(t, o);
180
180
  },
181
181
  ...t.options
182
- }), d = a(() => i.isPending.value);
182
+ }), d = h(() => r.isPending.value);
183
183
  return {
184
- ...i,
184
+ ...r,
185
185
  isLoading: d,
186
- mutate: i.mutate
186
+ mutate: r.mutate
187
187
  };
188
188
  }
189
189
  function _(t) {
190
- const u = h(), l = E(), v = t.providerName || "default", { mutate: f } = P(), { invalidate: s } = $(), r = a(() => {
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
- }), i = F({
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
- ...r.value,
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 && s(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
- f(o), (e = t.onError) == null || e.call(t, o);
209
+ s(o), (e = t.onError) == null || e.call(t, o);
210
210
  },
211
211
  ...t.options
212
- }), d = a(() => i.isPending.value);
212
+ }), d = h(() => r.isPending.value);
213
213
  return {
214
- ...i,
214
+ ...r,
215
215
  isLoading: d,
216
- mutate: i.mutate
216
+ mutate: r.mutate
217
217
  };
218
218
  }
219
219
  function U(t) {
220
- const u = h(), l = E(), v = t.providerName || "default", { mutate: f } = P(), { invalidate: s } = $(), r = a(() => {
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
- }), i = F({
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
- ...r.value,
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 && s(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
- f(o), (e = t.onError) == null || e.call(t, o);
239
+ s(o), (e = t.onError) == null || e.call(t, o);
240
240
  },
241
241
  ...t.options
242
- }), d = a(() => i.isPending.value);
242
+ }), d = h(() => r.isPending.value);
243
243
  return {
244
- ...i,
244
+ ...r,
245
245
  isLoading: d,
246
- mutate: i.mutate
246
+ mutate: r.mutate
247
247
  };
248
248
  }
249
249
  function G(t) {
250
- const u = h(), l = E(), v = t.providerName || "default", { mutate: f } = P(), { invalidate: s } = $(), r = a(() => {
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
- }), i = F({
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
- ...r.value,
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 && s(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
- f(o), (e = t.onError) == null || e.call(t, o);
269
+ s(o), (e = t.onError) == null || e.call(t, o);
270
270
  },
271
271
  ...t.options
272
- }), d = a(() => i.isPending.value);
272
+ }), d = h(() => r.isPending.value);
273
273
  return {
274
- ...i,
274
+ ...r,
275
275
  isLoading: d,
276
- mutate: i.mutate
276
+ mutate: r.mutate
277
277
  };
278
278
  }
279
279
  function R(t) {
280
- const u = h(), l = E(), v = t.providerName || "default", { mutate: f } = P(), { invalidate: s } = $(), r = a(() => {
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
- }), i = F({
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
- ...r.value,
289
+ ...i.value,
290
290
  ...o
291
291
  }, u, l);
292
292
  },
293
293
  onSuccess: (o) => {
294
294
  var e;
295
- i.reset(), (e = t.onSuccess) == null || e.call(t, o), t.path && s(t.path);
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
- f(o), (e = t.onError) == null || e.call(t, o);
299
+ s(o), (e = t.onError) == null || e.call(t, o);
300
300
  },
301
301
  ...t.options
302
- }), d = a(() => i.isPending.value);
302
+ }), d = h(() => r.isPending.value);
303
303
  return {
304
- ...i,
304
+ ...r,
305
305
  isLoading: d,
306
- mutate: i.mutate
306
+ mutate: r.mutate
307
307
  };
308
308
  }
309
309
  function b(t) {
310
- const u = h(), l = E(), v = t.providerName || "default", { mutate: f } = P(), { invalidate: s } = $(), r = a(() => {
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
- }), i = F({
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
- ...r.value,
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 && s(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
- f(o), (e = t.onError) == null || e.call(t, o);
329
+ s(o), (e = t.onError) == null || e.call(t, o);
330
330
  },
331
331
  ...t.options
332
- }), d = a(() => i.isPending.value);
332
+ }), d = h(() => r.isPending.value);
333
333
  return {
334
- ...i,
334
+ ...r,
335
335
  isLoading: d,
336
- mutate: i.mutate
336
+ mutate: r.mutate
337
337
  };
338
338
  }
339
339
  function j(t) {
340
340
  var o;
341
- const u = h(), l = E(), v = t.providerName || "default", { mutate: f } = P(), s = a(() => {
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
- }), r = L({
345
- queryKey: [`${(o = u.config) == null ? void 0 : o.name}:${v}:${t.path}`, s],
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(s.value, u, l);
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
- }), i = a(() => r.isFetched.value ? !1 : r.isFetching.value);
352
- N(() => r.isError, () => {
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
- f(r.error), (e = t.onError) == null || e.call(t, r.error);
356
+ s(i.error), (e = t == null ? void 0 : t.onError) == null || e.call(t, i.error);
355
357
  });
356
- const d = w(void 0);
357
- return N(r.data, (e) => {
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
- ...r,
363
- isLoading: i,
364
+ ...i,
365
+ isLoading: r,
364
366
  data: d,
365
- refetch: r.refetch
367
+ refetch: i.refetch
366
368
  };
367
369
  }
368
370
  function B(t) {
369
- const u = h(), l = E(), v = t.providerName || "default", { mutate: f } = P(), s = a(() => {
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
- }), r = F({
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
- ...s.value,
382
+ ...f.value,
379
383
  ...d
380
384
  }, u, l);
381
385
  },
382
386
  onSuccess: (d) => {
383
387
  var o;
384
- r.reset(), (o = t.onSuccess) == null || o.call(t, d);
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
- f(d), (o = t.onError) == null || o.call(t, d);
392
+ s(d), (o = t == null ? void 0 : t.onError) == null || o.call(t, d);
389
393
  },
390
- ...t.options
391
- }), i = a(() => r.isPending.value);
394
+ ...t == null ? void 0 : t.options
395
+ }), r = h(() => i.isPending.value);
392
396
  return {
393
- ...r,
394
- isLoading: i,
395
- mutate: r.mutate
397
+ ...i,
398
+ isLoading: r,
399
+ mutate: i.mutate
396
400
  };
397
401
  }
398
402
  function H() {
399
- const t = h(), u = E();
403
+ const t = E(), u = y();
400
404
  return {
401
405
  request: (v) => {
402
- var s, r, i, d;
403
- if (!((s = t.config) != null && s.dataProvider))
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 f = v.providerName || "default";
406
- return (d = (i = (r = t.config) == null ? void 0 : r.dataProvider) == null ? void 0 : i[f]) == null ? void 0 : d.custom({
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 = h();
416
+ function w() {
417
+ const t = M(), u = E();
414
418
  return {
415
- invalidate: (v, f) => {
416
- var r;
417
- let s = v;
418
- Array.isArray(v) || (s = [v]);
419
- for (const i of s) {
420
- const d = `${(r = u.config) == null ? void 0 : r.name}:${f || "default"}:${i}`;
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
- $ as useInvalidate,
441
+ w as useInvalidate,
438
442
  K as useList,
439
443
  I as useMany,
440
444
  k as useOne,
@@ -1,35 +1,38 @@
1
- import { ref as w, computed as u } from "vue";
2
- import { useInfiniteList as h } from "./data.js";
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 N(e) {
5
- const a = w(!1), o = u(() => {
6
- const { onSuccess: n, onProgress: i, interval: l, maxPage: v, ...d } = e;
7
- return d;
8
- }), c = u(() => e.interval || 300), { data: s, isLoading: g, fetchNextPage: f, hasNextPage: r, refetch: m, pagination: t } = h({
9
- ...o.value,
10
- options: {
11
- ...o.value.options,
12
- enabled: !1
13
- }
14
- }), P = async () => {
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 m();
19
- const v = typeof e.maxPage == "function" ? e.maxPage() : e.maxPage || 100;
20
- for (; r.value && t.value.page < v; )
21
- c.value > 0 && await y(c.value), await f(), (i = e.onProgress) == null || i.call(e, t.value);
22
- (l = e.onSuccess) == null || l.call(e, s.value);
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
- }, x = u(() => g.value || a.value);
29
+ }, d = u(() => g.value || a.value);
27
30
  return {
28
- data: s,
29
- isLoading: x,
30
- trigger: P
31
+ data: o,
32
+ isLoading: d,
33
+ trigger: x
31
34
  };
32
35
  }
33
36
  export {
34
- N as useExport
37
+ E as useExport
35
38
  };