@duxweb/dvha-core 0.1.14 → 0.1.16
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/directive/permission.cjs +1 -1
- package/dist/cjs/hooks/overlay.cjs +1 -1
- package/dist/cjs/hooks/select.cjs +1 -1
- package/dist/cjs/hooks/theme.cjs +8 -1
- package/dist/cjs/hooks/themeColor.cjs +1 -0
- package/dist/cjs/hooks/upload.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/provider/app.cjs +1 -1
- package/dist/cjs/stores/theme.cjs +1 -0
- package/dist/cjs/utils/theme.cjs +1 -0
- package/dist/esm/components/auth/can.js +7 -6
- package/dist/esm/directive/permission.js +3 -2
- package/dist/esm/hooks/overlay.js +3 -2
- package/dist/esm/hooks/select.js +14 -14
- package/dist/esm/hooks/theme.js +177 -23
- package/dist/esm/hooks/themeColor.js +291 -0
- package/dist/esm/hooks/upload.js +53 -53
- package/dist/esm/index.js +55 -49
- package/dist/esm/provider/app.js +8 -7
- package/dist/esm/stores/theme.js +57 -0
- package/dist/esm/utils/theme.js +82 -0
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/theme.d.ts +252 -3
- package/dist/types/hooks/themeColor.d.ts +288 -0
- package/dist/types/hooks/tree.d.ts +18 -0
- package/dist/types/stores/index.d.ts +1 -0
- package/dist/types/stores/theme.d.ts +104 -0
- package/dist/types/types/theme.d.ts +2 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/theme.d.ts +52 -0
- package/package.json +2 -1
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
const f = {
|
|
2
|
+
slate: {
|
|
3
|
+
50: "#f8fafc",
|
|
4
|
+
100: "#f1f5f9",
|
|
5
|
+
200: "#e2e8f0",
|
|
6
|
+
300: "#cbd5e1",
|
|
7
|
+
400: "#94a3b8",
|
|
8
|
+
500: "#64748b",
|
|
9
|
+
600: "#475569",
|
|
10
|
+
700: "#334155",
|
|
11
|
+
800: "#1e293b",
|
|
12
|
+
900: "#0f172a",
|
|
13
|
+
950: "#020617"
|
|
14
|
+
},
|
|
15
|
+
gray: {
|
|
16
|
+
50: "#f9fafb",
|
|
17
|
+
100: "#f3f4f6",
|
|
18
|
+
200: "#e5e7eb",
|
|
19
|
+
300: "#d1d5db",
|
|
20
|
+
400: "#9ca3af",
|
|
21
|
+
500: "#6b7280",
|
|
22
|
+
600: "#4b5563",
|
|
23
|
+
700: "#374151",
|
|
24
|
+
800: "#1f2937",
|
|
25
|
+
900: "#111827",
|
|
26
|
+
950: "#030712"
|
|
27
|
+
},
|
|
28
|
+
zinc: {
|
|
29
|
+
50: "#fafafa",
|
|
30
|
+
100: "#f4f4f5",
|
|
31
|
+
200: "#e4e4e7",
|
|
32
|
+
300: "#d4d4d8",
|
|
33
|
+
400: "#a1a1aa",
|
|
34
|
+
500: "#71717a",
|
|
35
|
+
600: "#52525b",
|
|
36
|
+
700: "#3f3f46",
|
|
37
|
+
800: "#27272a",
|
|
38
|
+
900: "#18181b",
|
|
39
|
+
950: "#09090b"
|
|
40
|
+
},
|
|
41
|
+
neutral: {
|
|
42
|
+
50: "#fafafa",
|
|
43
|
+
100: "#f5f5f5",
|
|
44
|
+
200: "#e5e5e5",
|
|
45
|
+
300: "#d4d4d4",
|
|
46
|
+
400: "#a3a3a3",
|
|
47
|
+
500: "#737373",
|
|
48
|
+
600: "#525252",
|
|
49
|
+
700: "#404040",
|
|
50
|
+
800: "#262626",
|
|
51
|
+
900: "#171717",
|
|
52
|
+
950: "#0a0a0a"
|
|
53
|
+
},
|
|
54
|
+
stone: {
|
|
55
|
+
50: "#fafaf9",
|
|
56
|
+
100: "#f5f5f4",
|
|
57
|
+
200: "#e7e5e4",
|
|
58
|
+
300: "#d6d3d1",
|
|
59
|
+
400: "#a8a29e",
|
|
60
|
+
500: "#78716c",
|
|
61
|
+
600: "#57534e",
|
|
62
|
+
700: "#44403c",
|
|
63
|
+
800: "#292524",
|
|
64
|
+
900: "#1c1917",
|
|
65
|
+
950: "#0c0a09"
|
|
66
|
+
},
|
|
67
|
+
red: {
|
|
68
|
+
50: "#fef2f2",
|
|
69
|
+
100: "#fee2e2",
|
|
70
|
+
200: "#fecaca",
|
|
71
|
+
300: "#fca5a5",
|
|
72
|
+
400: "#f87171",
|
|
73
|
+
500: "#ef4444",
|
|
74
|
+
600: "#dc2626",
|
|
75
|
+
700: "#b91c1c",
|
|
76
|
+
800: "#991b1b",
|
|
77
|
+
900: "#7f1d1d",
|
|
78
|
+
950: "#450a0a"
|
|
79
|
+
},
|
|
80
|
+
orange: {
|
|
81
|
+
50: "#fff7ed",
|
|
82
|
+
100: "#ffedd5",
|
|
83
|
+
200: "#fed7aa",
|
|
84
|
+
300: "#fdba74",
|
|
85
|
+
400: "#fb923c",
|
|
86
|
+
500: "#f97316",
|
|
87
|
+
600: "#ea580c",
|
|
88
|
+
700: "#c2410c",
|
|
89
|
+
800: "#9a3412",
|
|
90
|
+
900: "#7c2d12",
|
|
91
|
+
950: "#431407"
|
|
92
|
+
},
|
|
93
|
+
amber: {
|
|
94
|
+
50: "#fffbeb",
|
|
95
|
+
100: "#fef3c7",
|
|
96
|
+
200: "#fde68a",
|
|
97
|
+
300: "#fcd34d",
|
|
98
|
+
400: "#fbbf24",
|
|
99
|
+
500: "#f59e0b",
|
|
100
|
+
600: "#d97706",
|
|
101
|
+
700: "#b45309",
|
|
102
|
+
800: "#92400e",
|
|
103
|
+
900: "#78350f",
|
|
104
|
+
950: "#451a03"
|
|
105
|
+
},
|
|
106
|
+
yellow: {
|
|
107
|
+
50: "#fefce8",
|
|
108
|
+
100: "#fef9c3",
|
|
109
|
+
200: "#fef08a",
|
|
110
|
+
300: "#fde047",
|
|
111
|
+
400: "#facc15",
|
|
112
|
+
500: "#eab308",
|
|
113
|
+
600: "#ca8a04",
|
|
114
|
+
700: "#a16207",
|
|
115
|
+
800: "#854d0e",
|
|
116
|
+
900: "#713f12",
|
|
117
|
+
950: "#422006"
|
|
118
|
+
},
|
|
119
|
+
lime: {
|
|
120
|
+
50: "#f7fee7",
|
|
121
|
+
100: "#ecfccb",
|
|
122
|
+
200: "#d9f99d",
|
|
123
|
+
300: "#bef264",
|
|
124
|
+
400: "#a3e635",
|
|
125
|
+
500: "#84cc16",
|
|
126
|
+
600: "#65a30d",
|
|
127
|
+
700: "#4d7c0f",
|
|
128
|
+
800: "#3f6212",
|
|
129
|
+
900: "#365314",
|
|
130
|
+
950: "#1a2e05"
|
|
131
|
+
},
|
|
132
|
+
green: {
|
|
133
|
+
50: "#f0fdf4",
|
|
134
|
+
100: "#dcfce7",
|
|
135
|
+
200: "#bbf7d0",
|
|
136
|
+
300: "#86efac",
|
|
137
|
+
400: "#4ade80",
|
|
138
|
+
500: "#22c55e",
|
|
139
|
+
600: "#16a34a",
|
|
140
|
+
700: "#15803d",
|
|
141
|
+
800: "#166534",
|
|
142
|
+
900: "#14532d",
|
|
143
|
+
950: "#052e16"
|
|
144
|
+
},
|
|
145
|
+
emerald: {
|
|
146
|
+
50: "#ecfdf5",
|
|
147
|
+
100: "#d1fae5",
|
|
148
|
+
200: "#a7f3d0",
|
|
149
|
+
300: "#6ee7b7",
|
|
150
|
+
400: "#34d399",
|
|
151
|
+
500: "#10b981",
|
|
152
|
+
600: "#059669",
|
|
153
|
+
700: "#047857",
|
|
154
|
+
800: "#065f46",
|
|
155
|
+
900: "#064e3b",
|
|
156
|
+
950: "#022c22"
|
|
157
|
+
},
|
|
158
|
+
teal: {
|
|
159
|
+
50: "#f0fdfa",
|
|
160
|
+
100: "#ccfbf1",
|
|
161
|
+
200: "#99f6e4",
|
|
162
|
+
300: "#5eead4",
|
|
163
|
+
400: "#2dd4bf",
|
|
164
|
+
500: "#14b8a6",
|
|
165
|
+
600: "#0d9488",
|
|
166
|
+
700: "#0f766e",
|
|
167
|
+
800: "#115e59",
|
|
168
|
+
900: "#134e4a",
|
|
169
|
+
950: "#042f2e"
|
|
170
|
+
},
|
|
171
|
+
cyan: {
|
|
172
|
+
50: "#ecfeff",
|
|
173
|
+
100: "#cffafe",
|
|
174
|
+
200: "#a5f3fc",
|
|
175
|
+
300: "#67e8f9",
|
|
176
|
+
400: "#22d3ee",
|
|
177
|
+
500: "#06b6d4",
|
|
178
|
+
600: "#0891b2",
|
|
179
|
+
700: "#0e7490",
|
|
180
|
+
800: "#155e75",
|
|
181
|
+
900: "#164e63",
|
|
182
|
+
950: "#083344"
|
|
183
|
+
},
|
|
184
|
+
sky: {
|
|
185
|
+
50: "#f0f9ff",
|
|
186
|
+
100: "#e0f2fe",
|
|
187
|
+
200: "#bae6fd",
|
|
188
|
+
300: "#7dd3fc",
|
|
189
|
+
400: "#38bdf8",
|
|
190
|
+
500: "#0ea5e9",
|
|
191
|
+
600: "#0284c7",
|
|
192
|
+
700: "#0369a1",
|
|
193
|
+
800: "#075985",
|
|
194
|
+
900: "#0c4a6e",
|
|
195
|
+
950: "#082f49"
|
|
196
|
+
},
|
|
197
|
+
blue: {
|
|
198
|
+
50: "#eff6ff",
|
|
199
|
+
100: "#dbeafe",
|
|
200
|
+
200: "#bfdbfe",
|
|
201
|
+
300: "#93c5fd",
|
|
202
|
+
400: "#60a5fa",
|
|
203
|
+
500: "#3b82f6",
|
|
204
|
+
600: "#2563eb",
|
|
205
|
+
700: "#1d4ed8",
|
|
206
|
+
800: "#1e40af",
|
|
207
|
+
900: "#1e3a8a",
|
|
208
|
+
950: "#172554"
|
|
209
|
+
},
|
|
210
|
+
indigo: {
|
|
211
|
+
50: "#eef2ff",
|
|
212
|
+
100: "#e0e7ff",
|
|
213
|
+
200: "#c7d2fe",
|
|
214
|
+
300: "#a5b4fc",
|
|
215
|
+
400: "#818cf8",
|
|
216
|
+
500: "#6366f1",
|
|
217
|
+
600: "#4f46e5",
|
|
218
|
+
700: "#4338ca",
|
|
219
|
+
800: "#3730a3",
|
|
220
|
+
900: "#312e81",
|
|
221
|
+
950: "#1e1b4b"
|
|
222
|
+
},
|
|
223
|
+
violet: {
|
|
224
|
+
50: "#f5f3ff",
|
|
225
|
+
100: "#ede9fe",
|
|
226
|
+
200: "#ddd6fe",
|
|
227
|
+
300: "#c4b5fd",
|
|
228
|
+
400: "#a78bfa",
|
|
229
|
+
500: "#8b5cf6",
|
|
230
|
+
600: "#7c3aed",
|
|
231
|
+
700: "#6d28d9",
|
|
232
|
+
800: "#5b21b6",
|
|
233
|
+
900: "#4c1d95",
|
|
234
|
+
950: "#2e1065"
|
|
235
|
+
},
|
|
236
|
+
purple: {
|
|
237
|
+
50: "#faf5ff",
|
|
238
|
+
100: "#f3e8ff",
|
|
239
|
+
200: "#e9d5ff",
|
|
240
|
+
300: "#d8b4fe",
|
|
241
|
+
400: "#c084fc",
|
|
242
|
+
500: "#a855f7",
|
|
243
|
+
600: "#9333ea",
|
|
244
|
+
700: "#7e22ce",
|
|
245
|
+
800: "#6b21a8",
|
|
246
|
+
900: "#581c87",
|
|
247
|
+
950: "#3b0764"
|
|
248
|
+
},
|
|
249
|
+
fuchsia: {
|
|
250
|
+
50: "#fdf4ff",
|
|
251
|
+
100: "#fae8ff",
|
|
252
|
+
200: "#f5d0fe",
|
|
253
|
+
300: "#f0abfc",
|
|
254
|
+
400: "#e879f9",
|
|
255
|
+
500: "#d946ef",
|
|
256
|
+
600: "#c026d3",
|
|
257
|
+
700: "#a21caf",
|
|
258
|
+
800: "#86198f",
|
|
259
|
+
900: "#701a75",
|
|
260
|
+
950: "#4a044e"
|
|
261
|
+
},
|
|
262
|
+
pink: {
|
|
263
|
+
50: "#fdf2f8",
|
|
264
|
+
100: "#fce7f3",
|
|
265
|
+
200: "#fbcfe8",
|
|
266
|
+
300: "#f9a8d4",
|
|
267
|
+
400: "#f472b6",
|
|
268
|
+
500: "#ec4899",
|
|
269
|
+
600: "#db2777",
|
|
270
|
+
700: "#be185d",
|
|
271
|
+
800: "#9d174d",
|
|
272
|
+
900: "#831843",
|
|
273
|
+
950: "#500724"
|
|
274
|
+
},
|
|
275
|
+
rose: {
|
|
276
|
+
50: "#fff1f2",
|
|
277
|
+
100: "#ffe4e6",
|
|
278
|
+
200: "#fecdd3",
|
|
279
|
+
300: "#fda4af",
|
|
280
|
+
400: "#fb7185",
|
|
281
|
+
500: "#f43f5e",
|
|
282
|
+
600: "#e11d48",
|
|
283
|
+
700: "#be123c",
|
|
284
|
+
800: "#9f1239",
|
|
285
|
+
900: "#881337",
|
|
286
|
+
950: "#4c0519"
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
export {
|
|
290
|
+
f as themeColor
|
|
291
|
+
};
|
package/dist/esm/hooks/upload.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { useFileDialog as
|
|
2
|
-
import { uniqueId as
|
|
3
|
-
import { ref as g, computed as v, watch as
|
|
4
|
-
import { createLocalUploadDriver as
|
|
1
|
+
import { useFileDialog as Q } from "@vueuse/core";
|
|
2
|
+
import { uniqueId as R } from "lodash-es";
|
|
3
|
+
import { ref as g, computed as v, watch as V } from "vue";
|
|
4
|
+
import { createLocalUploadDriver as W } from "./upload/local.js";
|
|
5
5
|
function ne(l) {
|
|
6
|
-
const w = g(!1), i = g([]), u = g(-1), d = g(/* @__PURE__ */ new Map()),
|
|
7
|
-
const { onProgress: e, onDataCallback: n, onCancel: a, onComplete: t, maxFileSize: c, maxFileCount:
|
|
8
|
-
return
|
|
9
|
-
}),
|
|
10
|
-
const e = i.value.length, n = i.value.reduce((
|
|
6
|
+
const w = g(!1), i = g([]), u = g(-1), d = g(/* @__PURE__ */ new Map()), A = l.driver || W(), $ = v(() => {
|
|
7
|
+
const { onProgress: e, onDataCallback: n, onCancel: a, onComplete: t, maxFileSize: c, maxFileCount: o, accept: s, multiple: r, autoUpload: f, options: U, onSuccess: P, onError: x, method: Y, driver: Z, ...J } = l;
|
|
8
|
+
return J;
|
|
9
|
+
}), I = v(() => l.method || "POST"), b = v(() => {
|
|
10
|
+
const e = i.value.length, n = i.value.reduce((o, s) => o + (s.filesize || 0), 0);
|
|
11
11
|
let a = 0, t = 0;
|
|
12
|
-
return i.value.forEach((
|
|
12
|
+
return i.value.forEach((o, s) => {
|
|
13
13
|
var r;
|
|
14
|
-
|
|
14
|
+
s < u.value ? a += o.filesize || 0 : s === u.value && (a += ((r = o.progress) == null ? void 0 : r.loaded) || 0);
|
|
15
15
|
}), n > 0 && (t = Math.round(a / n * 100)), {
|
|
16
16
|
index: u.value >= 0 ? u.value + 1 : 0,
|
|
17
17
|
totalFiles: e,
|
|
@@ -30,7 +30,7 @@ function ne(l) {
|
|
|
30
30
|
return "0 B/s";
|
|
31
31
|
const n = 1024, a = ["B/s", "KB/s", "MB/s", "GB/s"], t = Math.floor(Math.log(e) / Math.log(n));
|
|
32
32
|
return `${Number.parseFloat((e / n ** t).toFixed(2))} ${a[t]}`;
|
|
33
|
-
}, T = () =>
|
|
33
|
+
}, T = () => R("upload-"), k = async (e, n, a) => {
|
|
34
34
|
switch (n) {
|
|
35
35
|
case "file": {
|
|
36
36
|
if (!(e instanceof File))
|
|
@@ -45,10 +45,10 @@ function ne(l) {
|
|
|
45
45
|
case "base64": {
|
|
46
46
|
if (typeof e != "string")
|
|
47
47
|
throw new TypeError('Payload must be a string when type is "base64"');
|
|
48
|
-
const t = e.includes(",") ? e.split(",")[1] : e, c = e.includes(",") ? e.split(",")[0].split(":")[1].split(";")[0] : "application/octet-stream",
|
|
49
|
-
for (let f = 0; f <
|
|
50
|
-
|
|
51
|
-
const r = new Blob([
|
|
48
|
+
const t = e.includes(",") ? e.split(",")[1] : e, c = e.includes(",") ? e.split(",")[0].split(":")[1].split(";")[0] : "application/octet-stream", o = atob(t), s = new Uint8Array(o.length);
|
|
49
|
+
for (let f = 0; f < o.length; f++)
|
|
50
|
+
s[f] = o.charCodeAt(f);
|
|
51
|
+
const r = new Blob([s], { type: c });
|
|
52
52
|
return new File([r], "base64-file", { type: c });
|
|
53
53
|
}
|
|
54
54
|
case "arrayBuffer": {
|
|
@@ -65,8 +65,8 @@ function ne(l) {
|
|
|
65
65
|
throw new Error(`File size cannot exceed ${y(l.maxFileSize)}`);
|
|
66
66
|
if (l.maxFileCount && i.value.length >= l.maxFileCount)
|
|
67
67
|
throw new Error(`File count cannot exceed ${l.maxFileCount}`);
|
|
68
|
-
},
|
|
69
|
-
const t = await
|
|
68
|
+
}, D = async (e, n, a) => {
|
|
69
|
+
const t = await k(e, n);
|
|
70
70
|
z(t);
|
|
71
71
|
const c = {
|
|
72
72
|
id: T(),
|
|
@@ -105,40 +105,40 @@ function ne(l) {
|
|
|
105
105
|
return m(e, {
|
|
106
106
|
status: "cancelled"
|
|
107
107
|
}), (a = l.onCancel) == null || a.call(l, e), C(), !0;
|
|
108
|
-
},
|
|
108
|
+
}, G = (e) => {
|
|
109
109
|
e ? e.forEach((n) => F(n)) : i.value.forEach((n) => F(n.id));
|
|
110
|
-
},
|
|
110
|
+
}, K = async (e) => {
|
|
111
111
|
if (!e.file)
|
|
112
112
|
throw new Error("File not found");
|
|
113
113
|
z(e.file);
|
|
114
114
|
const n = new AbortController();
|
|
115
115
|
d.value.set(e.id, n);
|
|
116
116
|
const a = Date.now();
|
|
117
|
-
m(e.id, { status: "uploading" }), await
|
|
118
|
-
|
|
119
|
-
method:
|
|
117
|
+
m(e.id, { status: "uploading" }), await A.upload(e.file, {
|
|
118
|
+
...$.value,
|
|
119
|
+
method: I.value,
|
|
120
120
|
signal: n.signal,
|
|
121
121
|
onUploadProgress: (t) => {
|
|
122
122
|
var x;
|
|
123
|
-
const
|
|
123
|
+
const s = (Date.now() - a) / 1e3, r = s > 0 ? t.loaded / s : 0, f = (t.total || 0) - t.loaded, U = r > 0 ? f / r : 0, P = {
|
|
124
124
|
loaded: t.loaded,
|
|
125
125
|
total: t.total,
|
|
126
126
|
percent: t.percent || 0,
|
|
127
127
|
speed: Math.round(r),
|
|
128
128
|
speedText: h(r),
|
|
129
|
-
uploadTime: Math.round(
|
|
130
|
-
remainingTime: Math.round(
|
|
129
|
+
uploadTime: Math.round(s),
|
|
130
|
+
remainingTime: Math.round(U)
|
|
131
131
|
};
|
|
132
132
|
m(e.id, {
|
|
133
133
|
status: "uploading",
|
|
134
|
-
progress:
|
|
134
|
+
progress: P
|
|
135
135
|
}), (x = l.onProgress) == null || x.call(l, b.value);
|
|
136
136
|
}
|
|
137
137
|
}).then((t) => {
|
|
138
|
-
var
|
|
138
|
+
var s, r;
|
|
139
139
|
if (e.status === "cancelled")
|
|
140
140
|
return;
|
|
141
|
-
const c = ((
|
|
141
|
+
const c = ((s = l.onDataCallback) == null ? void 0 : s.call(l, t, e)) || {}, o = Math.round((Date.now() - a) / 1e3);
|
|
142
142
|
m(e.id, {
|
|
143
143
|
status: "success",
|
|
144
144
|
data: t,
|
|
@@ -149,7 +149,7 @@ function ne(l) {
|
|
|
149
149
|
percent: 100,
|
|
150
150
|
speed: 0,
|
|
151
151
|
speedText: h(0),
|
|
152
|
-
uploadTime:
|
|
152
|
+
uploadTime: o,
|
|
153
153
|
remainingTime: 0
|
|
154
154
|
}
|
|
155
155
|
}), d.value.delete(e.id), (r = l.onSuccess) == null || r.call(l, t);
|
|
@@ -169,8 +169,8 @@ function ne(l) {
|
|
|
169
169
|
w.value = !0;
|
|
170
170
|
try {
|
|
171
171
|
for (let a = 0; a < e.length; a++) {
|
|
172
|
-
const t = e[a], c = i.value.findIndex((
|
|
173
|
-
u.value = c, await
|
|
172
|
+
const t = e[a], c = i.value.findIndex((o) => o.id === t.id);
|
|
173
|
+
u.value = c, await K(t);
|
|
174
174
|
}
|
|
175
175
|
} catch (a) {
|
|
176
176
|
throw (n = l.onError) == null || n.call(l, {
|
|
@@ -184,12 +184,12 @@ function ne(l) {
|
|
|
184
184
|
}, E = async (e, n = "file") => {
|
|
185
185
|
var a;
|
|
186
186
|
try {
|
|
187
|
-
if (
|
|
187
|
+
if (!l.multiple && e.length > 1)
|
|
188
188
|
throw new Error("Single file mode: only one file can be selected");
|
|
189
189
|
if (l.maxFileCount && i.value.length + e.length > l.maxFileCount)
|
|
190
190
|
throw new Error(`Adding ${e.length} files would exceed the maximum limit of ${l.maxFileCount}`);
|
|
191
191
|
for (const t of e)
|
|
192
|
-
await
|
|
192
|
+
await D(t, n);
|
|
193
193
|
} catch (t) {
|
|
194
194
|
throw (a = l.onError) == null || a.call(l, {
|
|
195
195
|
status: (t == null ? void 0 : t.status) || 400,
|
|
@@ -197,14 +197,11 @@ function ne(l) {
|
|
|
197
197
|
}), t;
|
|
198
198
|
}
|
|
199
199
|
l.autoUpload && B();
|
|
200
|
-
},
|
|
201
|
-
const n = e.map((a) => H(a));
|
|
202
|
-
i.value.push(...n);
|
|
203
|
-
}, M = () => {
|
|
200
|
+
}, L = () => {
|
|
204
201
|
i.value.forEach((e) => {
|
|
205
202
|
F(e.id);
|
|
206
203
|
}), d.value.clear(), i.value = [], u.value = -1;
|
|
207
|
-
},
|
|
204
|
+
}, M = (e) => {
|
|
208
205
|
const n = i.value.find((t) => t.id === e);
|
|
209
206
|
if (n && n.status === "uploading") {
|
|
210
207
|
m(e, {
|
|
@@ -217,12 +214,12 @@ function ne(l) {
|
|
|
217
214
|
}
|
|
218
215
|
const a = i.value.findIndex((t) => t.id === e);
|
|
219
216
|
a !== -1 && i.value.splice(a, 1);
|
|
220
|
-
},
|
|
221
|
-
e ? e.forEach((n) =>
|
|
222
|
-
}, { files:
|
|
217
|
+
}, N = (e) => {
|
|
218
|
+
e ? e.forEach((n) => M(n)) : i.value.forEach((n) => M(n.id));
|
|
219
|
+
}, { files: q, open: O, reset: S } = Q({
|
|
223
220
|
accept: l.accept,
|
|
224
221
|
multiple: l.multiple || !1
|
|
225
|
-
}),
|
|
222
|
+
}), j = (e) => ({
|
|
226
223
|
id: T(),
|
|
227
224
|
...e,
|
|
228
225
|
filesizeText: e.filesize ? y(e.filesize) : void 0,
|
|
@@ -237,15 +234,15 @@ function ne(l) {
|
|
|
237
234
|
uploadTime: 0
|
|
238
235
|
}
|
|
239
236
|
});
|
|
240
|
-
|
|
237
|
+
V(q, async (e) => {
|
|
241
238
|
if (e && e.length > 0) {
|
|
242
239
|
const n = Array.from(e);
|
|
243
|
-
|
|
240
|
+
S(), await E(n, "file").catch((a) => {
|
|
244
241
|
console.warn("Failed to add selected files:", a);
|
|
245
242
|
});
|
|
246
243
|
}
|
|
247
244
|
});
|
|
248
|
-
const
|
|
245
|
+
const H = v(() => i.value.filter((e) => e.status === "success").map((e) => ({
|
|
249
246
|
url: e.url,
|
|
250
247
|
filename: e.filename,
|
|
251
248
|
filesize: e.filesize,
|
|
@@ -254,16 +251,19 @@ function ne(l) {
|
|
|
254
251
|
return {
|
|
255
252
|
isUploading: w,
|
|
256
253
|
uploadFiles: i,
|
|
257
|
-
dataFiles:
|
|
254
|
+
dataFiles: H,
|
|
258
255
|
progress: b,
|
|
259
|
-
open:
|
|
256
|
+
open: O,
|
|
260
257
|
trigger: B,
|
|
261
|
-
resetFiles:
|
|
262
|
-
clearFiles:
|
|
263
|
-
removeFiles:
|
|
258
|
+
resetFiles: S,
|
|
259
|
+
clearFiles: L,
|
|
260
|
+
removeFiles: N,
|
|
264
261
|
addFiles: E,
|
|
265
|
-
addDataFiles:
|
|
266
|
-
|
|
262
|
+
addDataFiles: (e) => {
|
|
263
|
+
const n = e.map((a) => j(a));
|
|
264
|
+
i.value.push(...n);
|
|
265
|
+
},
|
|
266
|
+
cancelFiles: G
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
269
|
export {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createDux as o } from "./main.js";
|
|
2
|
-
import { useCan as u, useCheck as s, useError as p, useForgotPassword as m, useGetAuth as x, useIsLogin as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useClient as
|
|
2
|
+
import { useCan as u, useCheck as s, useError as p, useForgotPassword as m, useGetAuth as x, useIsLogin as f, useLogin as a, useLogout as i, useRegister as n, useUpdatePassword as d } from "./hooks/auth.js";
|
|
3
|
+
import { useConfig as C } from "./hooks/config.js";
|
|
4
|
+
import { useClient as v, useCreate as g, useCreateMany as h, useCustom as I, useCustomMutation as L, useDelete as M, useDeleteMany as S, useInfiniteList as T, useInvalidate as c, useList as y, useMany as P, useOne as U, useUpdate as A, useUpdateMany as R } from "./hooks/data.js";
|
|
5
5
|
import { useManage as E } from "./hooks/manage.js";
|
|
6
6
|
import { useMenu as b } from "./hooks/menu.js";
|
|
7
7
|
import { useTheme as k } from "./hooks/theme.js";
|
|
@@ -16,50 +16,55 @@ import { useImportCsv as _ } from "./hooks/importCsv.js";
|
|
|
16
16
|
import { useUpload as ee } from "./hooks/upload.js";
|
|
17
17
|
import { createLocalUploadDriver as oe } from "./hooks/upload/local.js";
|
|
18
18
|
import { createS3UploadDriver as ue } from "./hooks/upload/s3.js";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
19
|
+
import { themeColor as pe } from "./hooks/themeColor.js";
|
|
20
|
+
import { initRouter as xe } from "./router/route.js";
|
|
21
|
+
import { useAuthStore as ae } from "./stores/auth.js";
|
|
22
|
+
import { useRouteStore as ne } from "./stores/route.js";
|
|
23
|
+
import { useTabStore as le } from "./stores/tab.js";
|
|
24
|
+
import { useManageStore as De } from "./stores/manage.js";
|
|
25
|
+
import { useI18nStore as ge } from "./stores/i18n.js";
|
|
26
|
+
import { useThemeStore as Ie } from "./stores/theme.js";
|
|
27
|
+
import { DuxLogo as Me } from "./components/common/logo.js";
|
|
28
|
+
import { default as Te } from "./components/loader/iframe.js";
|
|
29
|
+
import { DuxOverlay as ye } from "./components/overlay/overlay.js";
|
|
30
|
+
import { DuxCan as Ue } from "./components/auth/can.js";
|
|
31
|
+
import { arrayToTree as Re, searchTree as we, treeToArr as Ee } from "./utils/tree.js";
|
|
32
|
+
import { themePreset as be } from "./utils/theme.js";
|
|
33
|
+
import { DuxAppProvider as ke } from "./provider/app.js";
|
|
34
|
+
import { DuxTabRouterView as Ve } from "./provider/tab.js";
|
|
35
|
+
import { simpleAuthProvider as qe } from "./preset/authProvider.js";
|
|
36
|
+
import { simpleDataProvider as Be } from "./preset/dataProvider.js";
|
|
37
|
+
import { i18nProvider as Je } from "./preset/i18nProvider.js";
|
|
35
38
|
export {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
ke as DuxAppProvider,
|
|
40
|
+
Ue as DuxCan,
|
|
41
|
+
Te as DuxLoaderIframe,
|
|
42
|
+
Me as DuxLogo,
|
|
43
|
+
ye as DuxOverlay,
|
|
44
|
+
Ve as DuxTabRouterView,
|
|
45
|
+
Re as arrayToTree,
|
|
43
46
|
o as createDux,
|
|
44
47
|
oe as createLocalUploadDriver,
|
|
45
48
|
ue as createS3UploadDriver,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
Je as i18nProvider,
|
|
50
|
+
xe as initRouter,
|
|
51
|
+
we as searchTree,
|
|
52
|
+
qe as simpleAuthProvider,
|
|
53
|
+
Be as simpleDataProvider,
|
|
54
|
+
pe as themeColor,
|
|
55
|
+
be as themePreset,
|
|
56
|
+
Ee as treeToArr,
|
|
57
|
+
ae as useAuthStore,
|
|
53
58
|
u as useCan,
|
|
54
59
|
s as useCheck,
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
v as useClient,
|
|
61
|
+
C as useConfig,
|
|
57
62
|
g as useCreate,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
h as useCreateMany,
|
|
64
|
+
I as useCustom,
|
|
65
|
+
L as useCustomMutation,
|
|
66
|
+
M as useDelete,
|
|
67
|
+
S as useDeleteMany,
|
|
63
68
|
p as useError,
|
|
64
69
|
N as useExport,
|
|
65
70
|
Y as useExportCsv,
|
|
@@ -67,26 +72,27 @@ export {
|
|
|
67
72
|
J as useForm,
|
|
68
73
|
x as useGetAuth,
|
|
69
74
|
q as useI18n,
|
|
70
|
-
|
|
75
|
+
ge as useI18nStore,
|
|
71
76
|
W as useImport,
|
|
72
77
|
_ as useImportCsv,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
T as useInfiniteList,
|
|
79
|
+
c as useInvalidate,
|
|
80
|
+
f as useIsLogin,
|
|
81
|
+
y as useList,
|
|
82
|
+
a as useLogin,
|
|
78
83
|
i as useLogout,
|
|
79
84
|
E as useManage,
|
|
80
|
-
|
|
85
|
+
De as useManageStore,
|
|
81
86
|
P as useMany,
|
|
82
87
|
b as useMenu,
|
|
83
88
|
U as useOne,
|
|
84
89
|
V as useOverlay,
|
|
85
90
|
n as useRegister,
|
|
86
|
-
|
|
91
|
+
ne as useRouteStore,
|
|
87
92
|
B as useSelect,
|
|
88
|
-
|
|
93
|
+
le as useTabStore,
|
|
89
94
|
k as useTheme,
|
|
95
|
+
Ie as useThemeStore,
|
|
90
96
|
A as useUpdate,
|
|
91
97
|
R as useUpdateMany,
|
|
92
98
|
d as useUpdatePassword,
|