@duxweb/dvha-core 0.0.6 → 0.0.7
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/common/logo.cjs +1 -0
- package/dist/cjs/components/overlay/overlay.cjs +1 -0
- package/dist/cjs/hooks/auth.cjs +1 -0
- package/dist/cjs/hooks/config.cjs +1 -0
- package/dist/cjs/hooks/data.cjs +1 -0
- package/dist/cjs/hooks/manage.cjs +1 -0
- package/dist/cjs/hooks/menu.cjs +1 -0
- package/dist/cjs/hooks/overlay.cjs +1 -0
- package/dist/cjs/hooks/theme.cjs +1 -0
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/main.cjs +1 -0
- package/dist/cjs/provider/app.cjs +1 -0
- package/dist/cjs/provider/tab.cjs +1 -0
- package/dist/cjs/router/route.cjs +1 -0
- package/dist/cjs/simple/authProvider.cjs +1 -0
- package/dist/cjs/simple/dataProvider.cjs +1 -0
- package/dist/cjs/stores/auth.cjs +1 -0
- package/dist/cjs/stores/route.cjs +1 -0
- package/dist/cjs/stores/tab.cjs +1 -0
- package/dist/cjs/utils/tree.cjs +1 -0
- package/dist/esm/components/common/logo.js +50 -0
- package/dist/esm/components/overlay/overlay.js +72 -0
- package/dist/esm/hooks/auth.js +125 -0
- package/dist/esm/hooks/config.js +10 -0
- package/dist/esm/hooks/data.js +369 -0
- package/dist/esm/hooks/manage.js +24 -0
- package/dist/esm/hooks/menu.js +75 -0
- package/dist/esm/hooks/overlay.js +14 -0
- package/dist/esm/hooks/theme.js +31 -0
- package/dist/esm/index.js +67 -0
- package/dist/esm/main.js +22 -0
- package/dist/esm/provider/app.js +127 -0
- package/dist/esm/provider/tab.js +64 -0
- package/dist/esm/router/route.js +49 -0
- package/dist/esm/simple/authProvider.js +90 -0
- package/dist/esm/simple/dataProvider.js +99 -0
- package/dist/esm/stores/auth.js +50 -0
- package/dist/esm/stores/route.js +65 -0
- package/dist/esm/stores/tab.js +70 -0
- package/dist/esm/utils/tree.js +41 -0
- package/dist/types/components/common/index.d.ts +1 -0
- package/dist/types/components/common/logo.d.ts +22 -0
- package/dist/types/components/index.d.ts +3 -0
- package/dist/types/components/loader/iframe.d.ts +2 -0
- package/dist/types/components/loader/index.d.ts +1 -0
- package/dist/types/components/overlay/index.d.ts +1 -0
- package/dist/types/components/overlay/overlay.d.ts +44 -0
- package/dist/types/hooks/auth.d.ts +109 -0
- package/dist/types/hooks/config.d.ts +7 -0
- package/dist/types/hooks/data.d.ts +1487 -0
- package/dist/types/hooks/index.d.ts +7 -0
- package/dist/types/hooks/manage.d.ts +13 -0
- package/dist/types/hooks/menu.d.ts +16 -0
- package/dist/types/hooks/overlay.d.ts +7 -0
- package/dist/types/hooks/theme.d.ts +12 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/main.d.ts +5 -0
- package/dist/types/provider/app.d.ts +1 -0
- package/dist/types/provider/index.d.ts +2 -0
- package/dist/types/provider/tab.d.ts +1 -0
- package/dist/types/router/index.d.ts +1 -0
- package/dist/types/router/route.d.ts +2 -0
- package/dist/types/simple/authProvider.d.ts +2 -0
- package/dist/types/simple/dataProvider.d.ts +2 -0
- package/dist/types/simple/index.d.ts +2 -0
- package/dist/types/stores/auth.d.ts +31 -0
- package/dist/types/stores/index.d.ts +3 -0
- package/dist/types/stores/route.d.ts +4040 -0
- package/dist/types/stores/tab.d.ts +1660 -0
- package/dist/types/types/auth.d.ts +36 -0
- package/dist/types/types/config.d.ts +32 -0
- package/dist/types/types/data.d.ts +84 -0
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/types/manage.d.ts +29 -0
- package/dist/types/types/menu.d.ts +13 -0
- package/dist/types/types/theme.d.ts +10 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/tree.d.ts +13 -0
- package/package.json +36 -9
- package/CHANGELOG.md +0 -31
- package/src/components/common/index.ts +0 -1
- package/src/components/common/logo.tsx +0 -62
- package/src/components/index.ts +0 -3
- package/src/components/loader/iframe.tsx +0 -12
- package/src/components/loader/index.ts +0 -1
- package/src/components/overlay/index.ts +0 -1
- package/src/components/overlay/overlay.tsx +0 -84
- package/src/hooks/auth.ts +0 -261
- package/src/hooks/config.ts +0 -16
- package/src/hooks/data.ts +0 -647
- package/src/hooks/index.ts +0 -7
- package/src/hooks/manage.ts +0 -71
- package/src/hooks/menu.ts +0 -146
- package/src/hooks/overlay.ts +0 -21
- package/src/hooks/theme.ts +0 -49
- package/src/index.ts +0 -9
- package/src/main.ts +0 -28
- package/src/provider/app.tsx +0 -200
- package/src/provider/index.ts +0 -2
- package/src/provider/tab.tsx +0 -76
- package/src/router/index.ts +0 -1
- package/src/router/route.ts +0 -47
- package/src/simple/authProvider.ts +0 -99
- package/src/simple/dataProvider.ts +0 -153
- package/src/simple/index.ts +0 -2
- package/src/stores/auth.ts +0 -73
- package/src/stores/index.ts +0 -3
- package/src/stores/route.ts +0 -159
- package/src/stores/tab.ts +0 -120
- package/src/types/auth.ts +0 -44
- package/src/types/config.ts +0 -51
- package/src/types/data.ts +0 -108
- package/src/types/index.ts +0 -6
- package/src/types/manage.ts +0 -40
- package/src/types/menu.ts +0 -24
- package/src/types/theme.ts +0 -12
- package/src/utils/index.ts +0 -1
- package/src/utils/tree.ts +0 -63
- package/tsconfig.json +0 -41
- package/typings.d.ts +0 -10
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import { useQuery as q, useInfiniteQuery as F, useMutation as l, useQueryClient as w } from "@tanstack/vue-query";
|
|
2
|
+
import { computed as f, watch as P } from "vue";
|
|
3
|
+
import { useGetAuth as g, useError as v } from "./auth.js";
|
|
4
|
+
import { useManage as E } from "./manage.js";
|
|
5
|
+
function D(t) {
|
|
6
|
+
const i = E(), s = g(), { mutate: d } = v(), c = f(() => {
|
|
7
|
+
const { onError: o, options: e, ...r } = t;
|
|
8
|
+
return r;
|
|
9
|
+
}), n = q({
|
|
10
|
+
queryKey: [t.path, c],
|
|
11
|
+
queryFn: () => {
|
|
12
|
+
var o;
|
|
13
|
+
return (o = i.config.dataProvider) == null ? void 0 : o.getList(c.value, i, s);
|
|
14
|
+
},
|
|
15
|
+
...t.options
|
|
16
|
+
}), u = f(() => n.isFetched ? !1 : n.isFetching);
|
|
17
|
+
return P(() => n.isError, () => {
|
|
18
|
+
var o;
|
|
19
|
+
d(n.error), (o = t.onError) == null || o.call(t, n.error);
|
|
20
|
+
}), {
|
|
21
|
+
...n,
|
|
22
|
+
isLoading: u,
|
|
23
|
+
data: n.data,
|
|
24
|
+
refetch: n.refetch
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function z(t) {
|
|
28
|
+
const i = E(), s = g(), { mutate: d } = v(), c = f(() => {
|
|
29
|
+
const { onError: o, options: e, ...r } = t;
|
|
30
|
+
return r;
|
|
31
|
+
}), n = F({
|
|
32
|
+
queryKey: [t.path, c],
|
|
33
|
+
queryFn: () => {
|
|
34
|
+
var o;
|
|
35
|
+
return (o = i.config.dataProvider) == null ? void 0 : o.getList(c.value, i, s);
|
|
36
|
+
},
|
|
37
|
+
initialPageParam: 0,
|
|
38
|
+
getNextPageParam: (o, e, r) => {
|
|
39
|
+
var h;
|
|
40
|
+
if (!(!(o != null && o.data) || ((h = o == null ? void 0 : o.data) == null ? void 0 : h.length) === 0))
|
|
41
|
+
return r + 1;
|
|
42
|
+
},
|
|
43
|
+
getPreviousPageParam: (o, e, r) => {
|
|
44
|
+
if (!(r <= 1))
|
|
45
|
+
return r - 1;
|
|
46
|
+
},
|
|
47
|
+
...t.options
|
|
48
|
+
}), u = f(() => n.isFetched ? !1 : n.isFetching);
|
|
49
|
+
return P(() => n.isError, () => {
|
|
50
|
+
var o;
|
|
51
|
+
d(n.error), (o = t.onError) == null || o.call(t, n.error);
|
|
52
|
+
}), {
|
|
53
|
+
...n,
|
|
54
|
+
isLoading: u,
|
|
55
|
+
data: n.data,
|
|
56
|
+
fetchNextPage: n.fetchNextPage,
|
|
57
|
+
hasNextPage: n.hasNextPage,
|
|
58
|
+
refetch: n.refetch
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function C(t) {
|
|
62
|
+
const i = E(), s = g(), { mutate: d } = v(), c = f(() => {
|
|
63
|
+
const { onError: o, options: e, ...r } = t;
|
|
64
|
+
return r;
|
|
65
|
+
}), n = q({
|
|
66
|
+
queryKey: [t.path, c],
|
|
67
|
+
queryFn: () => {
|
|
68
|
+
var o;
|
|
69
|
+
return (o = i.config.dataProvider) == null ? void 0 : o.getOne(c.value, i, s);
|
|
70
|
+
},
|
|
71
|
+
...t.options
|
|
72
|
+
}), u = f(() => n.isFetched ? !1 : n.isFetching);
|
|
73
|
+
return P(() => n.isError, () => {
|
|
74
|
+
var o;
|
|
75
|
+
d(n.error), (o = t.onError) == null || o.call(t, n.error);
|
|
76
|
+
}), {
|
|
77
|
+
...n,
|
|
78
|
+
isLoading: u,
|
|
79
|
+
data: n.data,
|
|
80
|
+
refetch: n.refetch
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function x(t) {
|
|
84
|
+
const i = E(), s = g(), { mutate: d } = v(), c = f(() => {
|
|
85
|
+
const { onError: o, options: e, ...r } = t;
|
|
86
|
+
return r;
|
|
87
|
+
}), n = q({
|
|
88
|
+
queryKey: [t.path, c],
|
|
89
|
+
queryFn: () => {
|
|
90
|
+
var o;
|
|
91
|
+
return (o = i.config.dataProvider) == null ? void 0 : o.getMany(c.value, i, s);
|
|
92
|
+
},
|
|
93
|
+
...t.options
|
|
94
|
+
}), u = f(() => n.isFetched ? !1 : n.isFetching);
|
|
95
|
+
return P(() => n.isError, () => {
|
|
96
|
+
var o;
|
|
97
|
+
d(n.error), (o = t.onError) == null || o.call(t, n.error);
|
|
98
|
+
}), {
|
|
99
|
+
...n,
|
|
100
|
+
isLoading: u,
|
|
101
|
+
data: n.data,
|
|
102
|
+
refetch: n.refetch
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function K(t) {
|
|
106
|
+
const i = E(), s = g(), { mutate: d } = v(), { invalidate: c } = y(), n = f(() => {
|
|
107
|
+
const { onError: e, options: r, ...h } = t;
|
|
108
|
+
return h;
|
|
109
|
+
}), u = l({
|
|
110
|
+
mutationFn: (e) => {
|
|
111
|
+
if (!i.config.dataProvider)
|
|
112
|
+
throw new Error("Data provider is not initialized");
|
|
113
|
+
return i.config.dataProvider.create({
|
|
114
|
+
...n.value,
|
|
115
|
+
...e
|
|
116
|
+
}, i, s);
|
|
117
|
+
},
|
|
118
|
+
onSuccess: (e) => {
|
|
119
|
+
var r;
|
|
120
|
+
(r = t.onSuccess) == null || r.call(t, e), t.path && c(t.path);
|
|
121
|
+
},
|
|
122
|
+
onError: (e) => {
|
|
123
|
+
var r;
|
|
124
|
+
d(e), (r = t.onError) == null || r.call(t, e);
|
|
125
|
+
},
|
|
126
|
+
...t.options
|
|
127
|
+
}), o = f(() => u.isPending);
|
|
128
|
+
return {
|
|
129
|
+
...u,
|
|
130
|
+
isLoading: o,
|
|
131
|
+
mutate: u.mutate
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function N(t) {
|
|
135
|
+
const i = E(), s = g(), { mutate: d } = v(), { invalidate: c } = y(), n = f(() => {
|
|
136
|
+
const { onError: e, options: r, ...h } = t;
|
|
137
|
+
return h;
|
|
138
|
+
}), u = l({
|
|
139
|
+
mutationFn: (e) => {
|
|
140
|
+
if (!i.config.dataProvider)
|
|
141
|
+
throw new Error("Data provider is not initialized");
|
|
142
|
+
return i.config.dataProvider.createMany({
|
|
143
|
+
...n.value,
|
|
144
|
+
...e
|
|
145
|
+
}, i, s);
|
|
146
|
+
},
|
|
147
|
+
onSuccess: (e) => {
|
|
148
|
+
var r;
|
|
149
|
+
(r = t.onSuccess) == null || r.call(t, e), t.path && c(t.path);
|
|
150
|
+
},
|
|
151
|
+
onError: (e) => {
|
|
152
|
+
var r;
|
|
153
|
+
d(e), (r = t.onError) == null || r.call(t, e);
|
|
154
|
+
},
|
|
155
|
+
...t.options
|
|
156
|
+
}), o = f(() => u.isPending);
|
|
157
|
+
return {
|
|
158
|
+
...u,
|
|
159
|
+
isLoading: o,
|
|
160
|
+
mutate: u.mutate
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function Q(t) {
|
|
164
|
+
const i = E(), s = g(), { mutate: d } = v(), { invalidate: c } = y(), n = f(() => {
|
|
165
|
+
const { onError: e, options: r, ...h } = t;
|
|
166
|
+
return h;
|
|
167
|
+
}), u = l({
|
|
168
|
+
mutationFn: (e) => {
|
|
169
|
+
if (!i.config.dataProvider)
|
|
170
|
+
throw new Error("Data provider is not initialized");
|
|
171
|
+
return i.config.dataProvider.update({
|
|
172
|
+
...n.value,
|
|
173
|
+
...e
|
|
174
|
+
}, i, s);
|
|
175
|
+
},
|
|
176
|
+
onSuccess: (e) => {
|
|
177
|
+
var r;
|
|
178
|
+
(r = t.onSuccess) == null || r.call(t, e), t.path && c(t.path);
|
|
179
|
+
},
|
|
180
|
+
onError: (e) => {
|
|
181
|
+
var r;
|
|
182
|
+
d(e), (r = t.onError) == null || r.call(t, e);
|
|
183
|
+
},
|
|
184
|
+
...t.options
|
|
185
|
+
}), o = f(() => u.isPending);
|
|
186
|
+
return {
|
|
187
|
+
...u,
|
|
188
|
+
isLoading: o,
|
|
189
|
+
mutate: u.mutate
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function I(t) {
|
|
193
|
+
const i = E(), s = g(), { mutate: d } = v(), { invalidate: c } = y(), n = f(() => {
|
|
194
|
+
const { onError: e, options: r, ...h } = t;
|
|
195
|
+
return h;
|
|
196
|
+
}), u = l({
|
|
197
|
+
mutationFn: (e) => {
|
|
198
|
+
if (!i.config.dataProvider)
|
|
199
|
+
throw new Error("Data provider is not initialized");
|
|
200
|
+
return i.config.dataProvider.updateMany({
|
|
201
|
+
...n.value,
|
|
202
|
+
...e
|
|
203
|
+
}, i, s);
|
|
204
|
+
},
|
|
205
|
+
onSuccess: (e) => {
|
|
206
|
+
var r;
|
|
207
|
+
(r = t.onSuccess) == null || r.call(t, e), t.path && c(t.path);
|
|
208
|
+
},
|
|
209
|
+
onError: (e) => {
|
|
210
|
+
var r;
|
|
211
|
+
d(e), (r = t.onError) == null || r.call(t, e);
|
|
212
|
+
},
|
|
213
|
+
...t.options
|
|
214
|
+
}), o = f(() => u.isPending);
|
|
215
|
+
return {
|
|
216
|
+
...u,
|
|
217
|
+
isLoading: o,
|
|
218
|
+
mutate: u.mutate
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function O(t) {
|
|
222
|
+
const i = E(), s = g(), { mutate: d } = v(), { invalidate: c } = y(), n = f(() => {
|
|
223
|
+
const { onError: e, options: r, ...h } = t;
|
|
224
|
+
return h;
|
|
225
|
+
}), u = l({
|
|
226
|
+
mutationFn: (e) => {
|
|
227
|
+
if (!i.config.dataProvider)
|
|
228
|
+
throw new Error("Data provider is not initialized");
|
|
229
|
+
return i.config.dataProvider.deleteOne({
|
|
230
|
+
...n.value,
|
|
231
|
+
...e
|
|
232
|
+
}, i, s);
|
|
233
|
+
},
|
|
234
|
+
onSuccess: (e) => {
|
|
235
|
+
var r;
|
|
236
|
+
(r = t.onSuccess) == null || r.call(t, e), t.path && c(t.path);
|
|
237
|
+
},
|
|
238
|
+
onError: (e) => {
|
|
239
|
+
var r;
|
|
240
|
+
d(e), (r = t.onError) == null || r.call(t, e);
|
|
241
|
+
},
|
|
242
|
+
...t.options
|
|
243
|
+
}), o = f(() => u.isPending);
|
|
244
|
+
return {
|
|
245
|
+
...u,
|
|
246
|
+
isLoading: o,
|
|
247
|
+
mutate: u.mutate
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function _(t) {
|
|
251
|
+
const i = E(), s = g(), { mutate: d } = v(), { invalidate: c } = y(), n = f(() => {
|
|
252
|
+
const { onError: e, options: r, ...h } = t;
|
|
253
|
+
return h;
|
|
254
|
+
}), u = l({
|
|
255
|
+
mutationFn: (e) => {
|
|
256
|
+
if (!i.config.dataProvider)
|
|
257
|
+
throw new Error("Data provider is not initialized");
|
|
258
|
+
return i.config.dataProvider.deleteMany({
|
|
259
|
+
...n.value,
|
|
260
|
+
...e
|
|
261
|
+
}, i, s);
|
|
262
|
+
},
|
|
263
|
+
onSuccess: (e) => {
|
|
264
|
+
var r;
|
|
265
|
+
(r = t.onSuccess) == null || r.call(t, e), t.path && c(t.path);
|
|
266
|
+
},
|
|
267
|
+
onError: (e) => {
|
|
268
|
+
var r;
|
|
269
|
+
d(e), (r = t.onError) == null || r.call(t, e);
|
|
270
|
+
},
|
|
271
|
+
...t.options
|
|
272
|
+
}), o = f(() => u.isPending);
|
|
273
|
+
return {
|
|
274
|
+
...u,
|
|
275
|
+
isLoading: o,
|
|
276
|
+
mutate: u.mutate
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function a(t) {
|
|
280
|
+
const i = E(), s = g(), { mutate: d } = v(), c = f(() => {
|
|
281
|
+
const { onError: o, options: e, ...r } = t;
|
|
282
|
+
return r;
|
|
283
|
+
}), n = q({
|
|
284
|
+
queryKey: [t.path, c],
|
|
285
|
+
queryFn: () => {
|
|
286
|
+
var o;
|
|
287
|
+
return (o = i.config.dataProvider) == null ? void 0 : o.custom(c.value, i, s);
|
|
288
|
+
},
|
|
289
|
+
...t.options
|
|
290
|
+
}), u = f(() => n.isFetched ? !1 : n.isFetching);
|
|
291
|
+
return P(() => n.isError, () => {
|
|
292
|
+
var o;
|
|
293
|
+
d(n.error), (o = t.onError) == null || o.call(t, n.error);
|
|
294
|
+
}), {
|
|
295
|
+
...n,
|
|
296
|
+
isLoading: u,
|
|
297
|
+
data: n.data,
|
|
298
|
+
refetch: n.refetch
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function U(t) {
|
|
302
|
+
const i = E(), s = g(), { mutate: d } = v(), c = f(() => {
|
|
303
|
+
const { onError: o, options: e, ...r } = t;
|
|
304
|
+
return r;
|
|
305
|
+
}), n = l({
|
|
306
|
+
mutationFn: (o) => {
|
|
307
|
+
if (!i.config.dataProvider)
|
|
308
|
+
throw new Error("Data provider is not initialized");
|
|
309
|
+
return i.config.dataProvider.custom({
|
|
310
|
+
...c.value,
|
|
311
|
+
...o
|
|
312
|
+
}, i, s);
|
|
313
|
+
},
|
|
314
|
+
onSuccess: (o) => {
|
|
315
|
+
var e;
|
|
316
|
+
(e = t.onSuccess) == null || e.call(t, o);
|
|
317
|
+
},
|
|
318
|
+
onError: (o) => {
|
|
319
|
+
var e;
|
|
320
|
+
d(o), (e = t.onError) == null || e.call(t, o);
|
|
321
|
+
},
|
|
322
|
+
...t.options
|
|
323
|
+
}), u = f(() => n.isPending);
|
|
324
|
+
return {
|
|
325
|
+
...n,
|
|
326
|
+
isLoading: u,
|
|
327
|
+
mutate: n.mutate
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
function k() {
|
|
331
|
+
const t = E(), i = g();
|
|
332
|
+
return {
|
|
333
|
+
request: (d) => {
|
|
334
|
+
var c;
|
|
335
|
+
if (!t.config.dataProvider)
|
|
336
|
+
throw new Error("Data provider is not initialized");
|
|
337
|
+
return (c = t.config.dataProvider) == null ? void 0 : c.custom({
|
|
338
|
+
...d
|
|
339
|
+
}, t, i);
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
function y() {
|
|
344
|
+
const t = w();
|
|
345
|
+
return {
|
|
346
|
+
invalidate: (s) => {
|
|
347
|
+
let d = s;
|
|
348
|
+
Array.isArray(s) || (d = [s]), t.invalidateQueries({
|
|
349
|
+
queryKey: d
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
export {
|
|
355
|
+
k as useClient,
|
|
356
|
+
K as useCreate,
|
|
357
|
+
N as useCreateMany,
|
|
358
|
+
a as useCustom,
|
|
359
|
+
U as useCustomMutation,
|
|
360
|
+
O as useDelete,
|
|
361
|
+
_ as useDeleteMany,
|
|
362
|
+
z as useInfiniteList,
|
|
363
|
+
y as useInvalidate,
|
|
364
|
+
D as useList,
|
|
365
|
+
x as useMany,
|
|
366
|
+
C as useOne,
|
|
367
|
+
Q as useUpdate,
|
|
368
|
+
I as useUpdateMany
|
|
369
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cloneDeep as u, trim as l, trimStart as a } from "lodash-es";
|
|
2
|
+
import { inject as d } from "vue";
|
|
3
|
+
import { useConfig as s } from "./config.js";
|
|
4
|
+
function P(i) {
|
|
5
|
+
var p;
|
|
6
|
+
const r = s(), o = d("dux.manage");
|
|
7
|
+
if (i || (i = o == null ? void 0 : o.value), !i)
|
|
8
|
+
throw new Error("manage name is not defined");
|
|
9
|
+
const t = u((p = r.manages) == null ? void 0 : p.find((e) => e.name === i));
|
|
10
|
+
if (!t)
|
|
11
|
+
throw new Error(`manage ${i} is not defined`);
|
|
12
|
+
const n = [];
|
|
13
|
+
return t.title && n.push(t.title), r.title && n.push(r.title), t.title = n.join(" - "), t.copyright = t.copyright || r.copyright, t.description = t.description || r.description, t.theme = { ...r == null ? void 0 : r.theme, ...t == null ? void 0 : t.theme }, t.authProvider = (t == null ? void 0 : t.authProvider) || r.authProvider, t.dataProvider = (t == null ? void 0 : t.dataProvider) || r.dataProvider, t.layoutComponent = {
|
|
14
|
+
...r.layoutComponent,
|
|
15
|
+
...t.layoutComponent
|
|
16
|
+
}, t.apiUrl = r != null && r.apiUrl ? `${r.apiUrl}/${l(t.apiUrl, "/")}` : t.apiUrl, t.apiUrl = l(t.apiUrl, "/"), {
|
|
17
|
+
config: t,
|
|
18
|
+
getRoutePath: (e) => `${t.routePrefix}/${a(e || "", "/")}`,
|
|
19
|
+
getApiUrl: (e) => `${t.apiUrl}/${a(e || "", "/")}`
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
P as useManage
|
|
24
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { cloneDeep as S } from "lodash-es";
|
|
2
|
+
import { storeToRefs as q } from "pinia";
|
|
3
|
+
import { computed as v, ref as K, watch as h } from "vue";
|
|
4
|
+
import { useRoute as z } from "vue-router";
|
|
5
|
+
import "../stores/auth.js";
|
|
6
|
+
import { useRouteStore as B } from "../stores/route.js";
|
|
7
|
+
import { arrayToTree as A, searchTree as M } from "../utils/tree.js";
|
|
8
|
+
function O(n) {
|
|
9
|
+
const D = B(), { routes: L } = q(D), y = (e = !0) => {
|
|
10
|
+
var t;
|
|
11
|
+
return (t = S(L.value)) == null ? void 0 : t.filter((a) => !!(a != null && a.name)).filter((a) => !e || a.hidden === void 0 || a.hidden === !1);
|
|
12
|
+
}, b = v(() => {
|
|
13
|
+
const e = y(!1);
|
|
14
|
+
return A(e, {
|
|
15
|
+
idKey: "name",
|
|
16
|
+
parentKey: "parent",
|
|
17
|
+
childrenKey: "children",
|
|
18
|
+
sortKey: "sort"
|
|
19
|
+
}, void 0);
|
|
20
|
+
}), c = v(() => {
|
|
21
|
+
const e = y();
|
|
22
|
+
return A(e, {
|
|
23
|
+
idKey: "name",
|
|
24
|
+
parentKey: "parent",
|
|
25
|
+
childrenKey: "children",
|
|
26
|
+
sortKey: "sort"
|
|
27
|
+
}, void 0);
|
|
28
|
+
}), i = z(), g = K(i.name), r = K(i.name), o = K(i.name), k = v(() => {
|
|
29
|
+
if (n != null && n.doubleMenu)
|
|
30
|
+
return c.value;
|
|
31
|
+
const e = S(c.value);
|
|
32
|
+
return e == null ? void 0 : e.map((t) => (delete t.children, t));
|
|
33
|
+
}), x = v(() => {
|
|
34
|
+
var t, a;
|
|
35
|
+
return n != null && n.doubleMenu ? [] : ((a = (t = c.value) == null ? void 0 : t.find((d) => d.name === r.value)) == null ? void 0 : a.children) || [];
|
|
36
|
+
}), w = v(() => M(b.value, (t) => (t == null ? void 0 : t.name) === i.name));
|
|
37
|
+
h(() => n == null ? void 0 : n.doubleMenu, () => {
|
|
38
|
+
var e, t, a, d;
|
|
39
|
+
if (n != null && n.doubleMenu) {
|
|
40
|
+
const u = M(c.value, (l) => (l == null ? void 0 : l.name) === r.value);
|
|
41
|
+
r.value = (a = u == null ? void 0 : u[0]) == null ? void 0 : a.name, o.value = (d = u == null ? void 0 : u[u.length - 1]) == null ? void 0 : d.name;
|
|
42
|
+
} else {
|
|
43
|
+
const u = M(c.value, (l) => (l == null ? void 0 : l.name) === o.value);
|
|
44
|
+
r.value = (e = u == null ? void 0 : u[u.length - 1]) == null ? void 0 : e.name, o.value = (t = u == null ? void 0 : u[u.length - 1]) == null ? void 0 : t.name;
|
|
45
|
+
}
|
|
46
|
+
}, { immediate: !0 });
|
|
47
|
+
const j = v(() => n != null && n.doubleMenu ? (n == null ? void 0 : n.doubleMenu) || x.value.length > 0 : !0);
|
|
48
|
+
return h([i, b, () => n == null ? void 0 : n.doubleMenu], () => {
|
|
49
|
+
var d, u, l, T, I;
|
|
50
|
+
const e = M(b.value, (m) => m.name === i.name), a = ((m) => {
|
|
51
|
+
let R = -1;
|
|
52
|
+
for (let f = m.length - 1; f >= 0; f--)
|
|
53
|
+
if (m[f].hidden === !1 || m[f].hidden === void 0) {
|
|
54
|
+
R = f;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
return R;
|
|
58
|
+
})(e);
|
|
59
|
+
g.value = (d = e == null ? void 0 : e[a]) == null ? void 0 : d.name, n != null && n.doubleMenu ? (r.value = (u = e == null ? void 0 : e[a]) == null ? void 0 : u.name, o.value = (l = e == null ? void 0 : e[a]) == null ? void 0 : l.name) : (r.value = (T = e == null ? void 0 : e[0]) == null ? void 0 : T.name, o.value = (I = e == null ? void 0 : e[a]) == null ? void 0 : I.name);
|
|
60
|
+
}, { immediate: !0 }), {
|
|
61
|
+
data: c,
|
|
62
|
+
originalData: b,
|
|
63
|
+
getMenu: y,
|
|
64
|
+
mainMenu: k,
|
|
65
|
+
subMenu: x,
|
|
66
|
+
isSubMenu: j,
|
|
67
|
+
crumbs: w,
|
|
68
|
+
active: g,
|
|
69
|
+
appActive: r,
|
|
70
|
+
subActive: o
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
O as useMenu
|
|
75
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useOverlayInject as t } from "@overlastic/vue";
|
|
2
|
+
import "vue";
|
|
3
|
+
import "clsx";
|
|
4
|
+
import "vue-router";
|
|
5
|
+
import { DuxOverlay as e } from "../components/overlay/overlay.js";
|
|
6
|
+
function c() {
|
|
7
|
+
const r = t(e);
|
|
8
|
+
return {
|
|
9
|
+
show: (o) => r(o)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
c as useOverlay
|
|
14
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useColorMode as g, useCycleList as f } from "@vueuse/core";
|
|
2
|
+
import { watchEffect as d, computed as i } from "vue";
|
|
3
|
+
import { useManage as h } from "./manage.js";
|
|
4
|
+
function b(l) {
|
|
5
|
+
const r = g(l), e = h(), { state: n, next: m } = f(["dark", "light", "auto"], {
|
|
6
|
+
initialValue: r
|
|
7
|
+
});
|
|
8
|
+
d(() => r.value = n.value);
|
|
9
|
+
const a = i(() => {
|
|
10
|
+
const { system: o, store: t } = r;
|
|
11
|
+
return n.value === "auto" ? o.value === "dark" : t.value === "dark";
|
|
12
|
+
}), s = i(() => {
|
|
13
|
+
var o, t, u, c;
|
|
14
|
+
return a.value ? {
|
|
15
|
+
logo: (o = e.config.theme) == null ? void 0 : o.darkLogo,
|
|
16
|
+
banner: (t = e.config.theme) == null ? void 0 : t.darkBanner
|
|
17
|
+
} : {
|
|
18
|
+
logo: (u = e.config.theme) == null ? void 0 : u.logo,
|
|
19
|
+
banner: (c = e.config.theme) == null ? void 0 : c.banner
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
toggle: m,
|
|
24
|
+
mode: n,
|
|
25
|
+
isDark: a,
|
|
26
|
+
theme: s
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
b as useTheme
|
|
31
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createDux as u } from "./main.js";
|
|
2
|
+
import { useCheck as a, useError as p, useForgotPassword as m, useGetAuth as x, useIsLogin as f, useLogin as i, useLogout as n, useRegister as d, useUpdatePassword as g } from "./hooks/auth.js";
|
|
3
|
+
import { useConfig as D } from "./hooks/config.js";
|
|
4
|
+
import { useClient as y, useCreate as C, useCreateMany as M, useCustom as h, useCustomMutation as v, useDelete as L, useDeleteMany as c, useInfiniteList as A, useInvalidate as P, useList as R, useMany as S, useOne as b, useUpdate as w, useUpdateMany as I } from "./hooks/data.js";
|
|
5
|
+
import { useManage as U } from "./hooks/manage.js";
|
|
6
|
+
import { useMenu as E } from "./hooks/menu.js";
|
|
7
|
+
import { useTheme as G } from "./hooks/theme.js";
|
|
8
|
+
import { useOverlay as j } from "./hooks/overlay.js";
|
|
9
|
+
import { initRouter as z } from "./router/route.js";
|
|
10
|
+
import { useAuthStore as H } from "./stores/auth.js";
|
|
11
|
+
import { createRouteStore as K, useRouteStore as N } from "./stores/route.js";
|
|
12
|
+
import { createTabStore as W, useTabStore as X } from "./stores/tab.js";
|
|
13
|
+
import { DuxLogo as Z } from "./components/common/logo.js";
|
|
14
|
+
import "vue";
|
|
15
|
+
import "vue-router";
|
|
16
|
+
import { DuxOverlay as $ } from "./components/overlay/overlay.js";
|
|
17
|
+
import { arrayToTree as re, searchTree as oe, treeToArr as te } from "./utils/tree.js";
|
|
18
|
+
import { DuxAppProvider as se } from "./provider/app.js";
|
|
19
|
+
import { DuxTabRouterView as pe } from "./provider/tab.js";
|
|
20
|
+
import { simpleAuthProvider as xe } from "./simple/authProvider.js";
|
|
21
|
+
import { simpleDataProvider as ie } from "./simple/dataProvider.js";
|
|
22
|
+
export {
|
|
23
|
+
se as DuxAppProvider,
|
|
24
|
+
Z as DuxLogo,
|
|
25
|
+
$ as DuxOverlay,
|
|
26
|
+
pe as DuxTabRouterView,
|
|
27
|
+
re as arrayToTree,
|
|
28
|
+
u as createDux,
|
|
29
|
+
K as createRouteStore,
|
|
30
|
+
W as createTabStore,
|
|
31
|
+
z as initRouter,
|
|
32
|
+
oe as searchTree,
|
|
33
|
+
xe as simpleAuthProvider,
|
|
34
|
+
ie as simpleDataProvider,
|
|
35
|
+
te as treeToArr,
|
|
36
|
+
H as useAuthStore,
|
|
37
|
+
a as useCheck,
|
|
38
|
+
y as useClient,
|
|
39
|
+
D as useConfig,
|
|
40
|
+
C as useCreate,
|
|
41
|
+
M as useCreateMany,
|
|
42
|
+
h as useCustom,
|
|
43
|
+
v as useCustomMutation,
|
|
44
|
+
L as useDelete,
|
|
45
|
+
c as useDeleteMany,
|
|
46
|
+
p as useError,
|
|
47
|
+
m as useForgotPassword,
|
|
48
|
+
x as useGetAuth,
|
|
49
|
+
A as useInfiniteList,
|
|
50
|
+
P as useInvalidate,
|
|
51
|
+
f as useIsLogin,
|
|
52
|
+
R as useList,
|
|
53
|
+
i as useLogin,
|
|
54
|
+
n as useLogout,
|
|
55
|
+
U as useManage,
|
|
56
|
+
S as useMany,
|
|
57
|
+
E as useMenu,
|
|
58
|
+
b as useOne,
|
|
59
|
+
j as useOverlay,
|
|
60
|
+
d as useRegister,
|
|
61
|
+
N as useRouteStore,
|
|
62
|
+
X as useTabStore,
|
|
63
|
+
G as useTheme,
|
|
64
|
+
w as useUpdate,
|
|
65
|
+
I as useUpdateMany,
|
|
66
|
+
g as useUpdatePassword
|
|
67
|
+
};
|
package/dist/esm/main.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createPinia as n } from "pinia";
|
|
2
|
+
import t from "pinia-plugin-persistedstate";
|
|
3
|
+
import { ref as d } from "vue";
|
|
4
|
+
import { initRouter as u } from "./router/route.js";
|
|
5
|
+
function p(o) {
|
|
6
|
+
const e = n();
|
|
7
|
+
return e.use(t), {
|
|
8
|
+
install(r) {
|
|
9
|
+
console.log(
|
|
10
|
+
"%c dux-vue %c dux.cn %c",
|
|
11
|
+
"background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",
|
|
12
|
+
"background:#41b883 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff",
|
|
13
|
+
"background:transparent"
|
|
14
|
+
);
|
|
15
|
+
const i = d();
|
|
16
|
+
r.provide("dux.config", o), r.provide("dux.manage", i), r.use(u(o)), r.use(e);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
p as createDux
|
|
22
|
+
};
|