@pantograph/vue 0.30.13 → 0.30.15
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/Alert/index.js +18 -17
- package/dist/Alert/index.umd.cjs +1 -1
- package/dist/Upload/index.js +117 -114
- package/dist/Upload/index.umd.cjs +1 -1
- package/dist/style/index.css +1 -1
- package/dist/use/index.js +1 -1
- package/dist/use/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/Upload/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as V, createElementBlock as G, openBlock as U, Fragment as fe, createBlock as
|
|
1
|
+
import { defineComponent as V, createElementBlock as G, openBlock as U, Fragment as fe, createBlock as B, createCommentVNode as A, createVNode as D, unref as l, normalizeClass as q, createSlots as lt, withCtx as te, withModifiers as N, computed as x, h as K, createElementVNode as Ce, mergeProps as ze, useSlots as _e, useAttrs as Ie, ref as Y, watch as ue, nextTick as we, readonly as it, renderSlot as Le, normalizeProps as Be, guardReactiveProps as Te } from "vue";
|
|
2
2
|
import { createContext as me } from "reka-ui";
|
|
3
|
-
import { getBemBlock as at, getBemElement as
|
|
3
|
+
import { getBemBlock as at, getBemElement as T, getComponentOptions as W, normCls as ge, generateVariantClassList as H, usePCId as de, getComponentName as ve } from "@pantograph/utils";
|
|
4
4
|
import { cva as Se } from "class-variance-authority";
|
|
5
5
|
import { _ as Re } from "../Progress.vue_vue_type_style_index_0_lang-BGm_UZSY.js";
|
|
6
6
|
import { _ as rt } from "../FloatButton.vue_vue_type_script_setup_true_lang-DFZD1E5T.js";
|
|
7
7
|
import { _ as J } from "../IconButton.vue_vue_type_script_setup_true_lang-BR82Bz96.js";
|
|
8
8
|
import { _ as ct } from "../Image.vue_vue_type_style_index_0_lang-D_yC06RN.js";
|
|
9
|
-
import { isFunction as Z, isEqual as ut, throttle as pt, pick as dt, cloneDeep as
|
|
9
|
+
import { isFunction as Z, isEqual as ut, throttle as pt, pick as dt, cloneDeep as C } from "es-toolkit";
|
|
10
10
|
import { _ as ft } from "../GraphicalObject.vue_vue_type_script_setup_true_lang-D8zWdo89.js";
|
|
11
11
|
import { isEmptyElement as M, useFormInput as mt, installComponent as he } from "@pantograph/utils-vue";
|
|
12
12
|
import { _ as gt } from "../FormValidation.vue_vue_type_style_index_0_lang-FGFyFCis.js";
|
|
13
13
|
import { i as se } from "../isObject-vmP43YLW.js";
|
|
14
14
|
import { i as vt } from "../isArray-QlWcxgml.js";
|
|
15
|
-
const Pe = at("upload"), ee =
|
|
15
|
+
const Pe = at("upload"), ee = T(Pe, "list"), I = T(ee, "item"), [ht, yt] = me("BaseUpload"), kt = () => ht(null), [oe, bt] = me("Upload"), wt = ["error", "paused", "done", "uploading", "waiting"], je = ["md", "lg", "xlg"], Ae = ["image", "card"], xt = ["outline", "transparent"], pe = {
|
|
16
16
|
other: {
|
|
17
17
|
icon: "tabler:file-text",
|
|
18
18
|
fg: "primary",
|
|
@@ -213,11 +213,11 @@ const Pe = at("upload"), ee = S(Pe, "list"), L = S(ee, "item"), [ht, yt] = me("B
|
|
|
213
213
|
return (n, r) => {
|
|
214
214
|
var g;
|
|
215
215
|
return U(), G(fe, null, [
|
|
216
|
-
l(t).props.uploadFile.status !== "waiting" ? (U(),
|
|
216
|
+
l(t).props.uploadFile.status !== "waiting" ? (U(), B(ct, {
|
|
217
217
|
key: 0,
|
|
218
218
|
src: l(Ee)(l(t).props.uploadFile) ? l(t).props.uploadFile.thumbUrl ?? l(t).props.uploadFile.url : void 0,
|
|
219
219
|
aspectRatio: "1:1",
|
|
220
|
-
class: q(l(
|
|
220
|
+
class: q(l(T)(l(I), "image")),
|
|
221
221
|
sizeRange: "xsm",
|
|
222
222
|
alt: l(t).label.value,
|
|
223
223
|
hovered: l(t).props.uploadFile.status === "uploading",
|
|
@@ -226,14 +226,14 @@ const Pe = at("upload"), ee = S(Pe, "list"), L = S(ee, "item"), [ht, yt] = me("B
|
|
|
226
226
|
["error", "done"].includes(l(t).props.uploadFile.status) ? {
|
|
227
227
|
name: "actions",
|
|
228
228
|
fn: te(() => [
|
|
229
|
-
l(t).props.uploadFile.status === "done" ? (U(),
|
|
229
|
+
l(t).props.uploadFile.status === "done" ? (U(), B(J, {
|
|
230
230
|
key: 0,
|
|
231
231
|
color: "neutral",
|
|
232
232
|
type: "ghost",
|
|
233
233
|
icon: "tabler:eye",
|
|
234
234
|
size: "sm",
|
|
235
235
|
onClick: r[0] || (r[0] = N((p) => l(s).emit("preview", l(t).props.uploadFile), ["stop"]))
|
|
236
|
-
})) : l(t).props.uploadFile.status === "error" ? (U(),
|
|
236
|
+
})) : l(t).props.uploadFile.status === "error" ? (U(), B(J, {
|
|
237
237
|
key: 1,
|
|
238
238
|
color: "neutral",
|
|
239
239
|
type: "ghost",
|
|
@@ -245,17 +245,17 @@ const Pe = at("upload"), ee = S(Pe, "list"), L = S(ee, "item"), [ht, yt] = me("B
|
|
|
245
245
|
key: "0"
|
|
246
246
|
} : void 0
|
|
247
247
|
]), 1032, ["src", "class", "alt", "hovered"])) : A("", !0),
|
|
248
|
-
["uploading", "waiting"].includes(l(t).props.uploadFile.status) ? (U(),
|
|
248
|
+
["uploading", "waiting"].includes(l(t).props.uploadFile.status) ? (U(), B(Re, {
|
|
249
249
|
key: 1,
|
|
250
250
|
type: "circle",
|
|
251
251
|
size: l(s).progressSize.value,
|
|
252
|
-
class: q(l(
|
|
252
|
+
class: q(l(T)(l(I), "progress")),
|
|
253
253
|
indeterminate: l(t).props.uploadFile.status === "waiting",
|
|
254
254
|
percent: ((g = l(t).props.uploadFile) == null ? void 0 : g.percent) ?? 0
|
|
255
255
|
}, null, 8, ["size", "class", "indeterminate", "percent"])) : A("", !0),
|
|
256
256
|
D(rt, {
|
|
257
257
|
class: q(
|
|
258
|
-
l(ge)(l(
|
|
258
|
+
l(ge)(l(T)(l(I), "cancel"), "pantograph-tokens pantograph-dark")
|
|
259
259
|
),
|
|
260
260
|
color: "neutral",
|
|
261
261
|
icon: "tabler:x",
|
|
@@ -273,12 +273,12 @@ const Pe = at("upload"), ee = S(Pe, "list"), L = S(ee, "item"), [ht, yt] = me("B
|
|
|
273
273
|
Ut(s.props.uploadFile),
|
|
274
274
|
Ct(s.props.uploadFile)
|
|
275
275
|
)), n = x(() => Z(t.props.getFileIcon) ? t.props.getFileIcon(s.props.uploadFile) : pe[d.value].icon), r = x(() => pe[d.value].fg), g = x(() => pe[d.value].bg), p = () => {
|
|
276
|
-
var v, h, f,
|
|
276
|
+
var v, h, f, _;
|
|
277
277
|
const a = (h = (v = t.slots).go) == null ? void 0 : h.call(v, { uploadFile: s.props.uploadFile });
|
|
278
278
|
return M(a) ? Ee(s.props.uploadFile) ? K("img", {
|
|
279
|
-
class:
|
|
279
|
+
class: T(I, "thumb"),
|
|
280
280
|
alt: s.props.uploadFile.name ?? "",
|
|
281
|
-
src: ((f = s.props.uploadFile) == null ? void 0 : f.thumbUrl) ?? ((
|
|
281
|
+
src: ((f = s.props.uploadFile) == null ? void 0 : f.thumbUrl) ?? ((_ = s.props.uploadFile) == null ? void 0 : _.url)
|
|
282
282
|
}) : null : a;
|
|
283
283
|
}, c = () => {
|
|
284
284
|
var v, h;
|
|
@@ -297,7 +297,7 @@ const Pe = at("upload"), ee = S(Pe, "list"), L = S(ee, "item"), [ht, yt] = me("B
|
|
|
297
297
|
icon: c
|
|
298
298
|
}
|
|
299
299
|
);
|
|
300
|
-
return (a, v) => (U(),
|
|
300
|
+
return (a, v) => (U(), B(u));
|
|
301
301
|
}
|
|
302
302
|
}), It = /* @__PURE__ */ V({
|
|
303
303
|
...W("UploadListItemCard"),
|
|
@@ -308,7 +308,7 @@ const Pe = at("upload"), ee = S(Pe, "list"), L = S(ee, "item"), [ht, yt] = me("B
|
|
|
308
308
|
const c = (v = (a = s.slots).description) == null ? void 0 : v.call(a, { uploadFile: t.props.uploadFile });
|
|
309
309
|
let u;
|
|
310
310
|
if (M(c) || (u = c), t.props.uploadFile.description && (u = t.props.uploadFile.description), u)
|
|
311
|
-
return K("div", { class:
|
|
311
|
+
return K("div", { class: T(I, "description") }, u);
|
|
312
312
|
}, n = () => {
|
|
313
313
|
var u, a;
|
|
314
314
|
const c = (a = (u = s.slots).title) == null ? void 0 : a.call(u, { uploadFile: t.props.uploadFile });
|
|
@@ -323,39 +323,39 @@ const Pe = at("upload"), ee = S(Pe, "list"), L = S(ee, "item"), [ht, yt] = me("B
|
|
|
323
323
|
var c, u;
|
|
324
324
|
return (c = t.props.uploadFile) != null && c.percent && ((u = t.props.uploadFile) == null ? void 0 : u.status) !== "waiting" ? `${(t.props.uploadFile.percent ?? 0).toFixed(0)}%` : "waiting...";
|
|
325
325
|
}), p = (c, u) => {
|
|
326
|
-
var v, h, f,
|
|
326
|
+
var v, h, f, _;
|
|
327
327
|
const a = (h = (v = s.slots) == null ? void 0 : v.actions) == null ? void 0 : h.call(v, {
|
|
328
328
|
...s,
|
|
329
329
|
uploadFile: t.props.uploadFile,
|
|
330
330
|
downloadFile: r
|
|
331
331
|
});
|
|
332
|
-
return M(a) ? (
|
|
332
|
+
return M(a) ? (_ = (f = u.slots) == null ? void 0 : f.default) == null ? void 0 : _.call(f, {}) : a;
|
|
333
333
|
};
|
|
334
334
|
return (c, u) => {
|
|
335
335
|
var a;
|
|
336
336
|
return U(), G(fe, null, [
|
|
337
|
-
l(s).props.go ? (U(),
|
|
337
|
+
l(s).props.go ? (U(), B(_t, { key: 0 })) : A("", !0),
|
|
338
338
|
["error", "done"].includes(l(t).props.uploadFile.status) ? (U(), G("div", {
|
|
339
339
|
key: 2,
|
|
340
|
-
class: q(l(
|
|
340
|
+
class: q(l(T)(l(I), "content"))
|
|
341
341
|
}, [
|
|
342
342
|
Ce("div", {
|
|
343
|
-
class: q(l(
|
|
343
|
+
class: q(l(T)(l(I), "title"))
|
|
344
344
|
}, [
|
|
345
345
|
D(n)
|
|
346
346
|
], 2),
|
|
347
|
-
l(t).props.uploadFile.status === "error" ? (U(),
|
|
347
|
+
l(t).props.uploadFile.status === "error" ? (U(), B(gt, {
|
|
348
348
|
key: 0,
|
|
349
349
|
message: "Failed",
|
|
350
350
|
status: "error"
|
|
351
|
-
})) : l(s).props.size !== "md" ? (U(),
|
|
352
|
-
], 2)) : (U(),
|
|
351
|
+
})) : l(s).props.size !== "md" ? (U(), B(d, { key: 1 })) : A("", !0)
|
|
352
|
+
], 2)) : (U(), B(Re, {
|
|
353
353
|
key: 1,
|
|
354
|
-
class: q(l(
|
|
354
|
+
class: q(l(T)(l(I), "progress")),
|
|
355
355
|
percent: ((a = l(t).props.uploadFile) == null ? void 0 : a.percent) ?? 0,
|
|
356
356
|
label: l(t).label.value,
|
|
357
357
|
helperText: g.value,
|
|
358
|
-
helperTextCls: l(
|
|
358
|
+
helperTextCls: l(T)(l(I), "percent")
|
|
359
359
|
}, {
|
|
360
360
|
label: te(() => [
|
|
361
361
|
D(n)
|
|
@@ -366,7 +366,7 @@ const Pe = at("upload"), ee = S(Pe, "list"), L = S(ee, "item"), [ht, yt] = me("B
|
|
|
366
366
|
default: te(() => {
|
|
367
367
|
var v;
|
|
368
368
|
return [
|
|
369
|
-
l(t).props.uploadFile.status === "done" ? (U(),
|
|
369
|
+
l(t).props.uploadFile.status === "done" ? (U(), B(J, {
|
|
370
370
|
key: 0,
|
|
371
371
|
icon: "tabler:download",
|
|
372
372
|
size: "sm",
|
|
@@ -374,14 +374,14 @@ const Pe = at("upload"), ee = S(Pe, "list"), L = S(ee, "item"), [ht, yt] = me("B
|
|
|
374
374
|
color: "neutral",
|
|
375
375
|
onClick: N(r, ["stop"])
|
|
376
376
|
})) : A("", !0),
|
|
377
|
-
l(s).props.pausableChunked && l(t).props.uploadFile.status === "uploading" && ((v = l(t).props.uploadFile.chunks) != null && v.length) && l(Z)(l(t).props.uploadFile.cancel) ? (U(),
|
|
377
|
+
l(s).props.pausableChunked && l(t).props.uploadFile.status === "uploading" && ((v = l(t).props.uploadFile.chunks) != null && v.length) && l(Z)(l(t).props.uploadFile.cancel) ? (U(), B(J, {
|
|
378
378
|
key: 1,
|
|
379
379
|
icon: "tabler:pause",
|
|
380
380
|
size: "sm",
|
|
381
381
|
type: "ghost",
|
|
382
382
|
color: "neutral",
|
|
383
383
|
onClick: N(l(t).props.uploadFile.cancel, ["stop"])
|
|
384
|
-
}, null, 8, ["onClick"])) : l(s).canRunUpload(l(t).props.uploadFile.uid) ? (U(),
|
|
384
|
+
}, null, 8, ["onClick"])) : l(s).canRunUpload(l(t).props.uploadFile.uid) ? (U(), B(J, {
|
|
385
385
|
key: 2,
|
|
386
386
|
icon: ["paused", "waiting"].includes(l(t).props.uploadFile.status) ? "tabler:player-play" : "tabler:reload",
|
|
387
387
|
size: "sm",
|
|
@@ -410,15 +410,15 @@ const Pe = at("upload"), ee = S(Pe, "list"), L = S(ee, "item"), [ht, yt] = me("B
|
|
|
410
410
|
uploadFile: {}
|
|
411
411
|
},
|
|
412
412
|
setup(e) {
|
|
413
|
-
const s = e, t = Se(
|
|
413
|
+
const s = e, t = Se(I, {
|
|
414
414
|
variants: {
|
|
415
|
-
size: H(je,
|
|
415
|
+
size: H(je, I),
|
|
416
416
|
listType: H(
|
|
417
417
|
Ae,
|
|
418
|
-
|
|
418
|
+
I
|
|
419
419
|
),
|
|
420
|
-
type: H(xt,
|
|
421
|
-
status: H(wt,
|
|
420
|
+
type: H(xt, I),
|
|
421
|
+
status: H(wt, I)
|
|
422
422
|
}
|
|
423
423
|
}), d = x(() => {
|
|
424
424
|
var g, p, c;
|
|
@@ -579,28 +579,28 @@ const Ne = /* @__PURE__ */ V({
|
|
|
579
579
|
), h = x(
|
|
580
580
|
() => u.value.accept ?? u.value.listType === "image" ? "image/*" : void 0
|
|
581
581
|
), f = Y([]);
|
|
582
|
-
let
|
|
582
|
+
let _ = !1;
|
|
583
583
|
ue(
|
|
584
584
|
() => u.value.fileList,
|
|
585
585
|
(o) => {
|
|
586
|
-
var m,
|
|
587
|
-
if (!
|
|
588
|
-
const
|
|
589
|
-
if (
|
|
590
|
-
return St(
|
|
586
|
+
var m, b;
|
|
587
|
+
if (!_) {
|
|
588
|
+
const L = (b = (m = o ?? []) == null ? void 0 : m.map) == null ? void 0 : b.call(m, (S) => {
|
|
589
|
+
if (S && se(S))
|
|
590
|
+
return St(S, {
|
|
591
591
|
getUid: Fe,
|
|
592
592
|
chunkFile: v.value,
|
|
593
593
|
chunkSize: u.value.chunkSize
|
|
594
594
|
});
|
|
595
595
|
}).filter(Boolean);
|
|
596
|
-
ut(
|
|
596
|
+
ut(L, f.value) || (_ = !0, f.value = L, we(() => _ = !1));
|
|
597
597
|
}
|
|
598
598
|
},
|
|
599
599
|
{ immediate: !0, deep: !0 }
|
|
600
600
|
), ue(
|
|
601
601
|
f,
|
|
602
602
|
(o) => {
|
|
603
|
-
|
|
603
|
+
_ || (_ = !0, c("update:fileList", o ?? []), we(() => _ = !1));
|
|
604
604
|
},
|
|
605
605
|
{ immediate: !0, deep: !0 }
|
|
606
606
|
);
|
|
@@ -608,8 +608,8 @@ const Ne = /* @__PURE__ */ V({
|
|
|
608
608
|
if (o) {
|
|
609
609
|
const m = ae(o.uid);
|
|
610
610
|
m === -1 && (!a.value || a.value > f.value.length) ? f.value.push(o) : m > -1 && f.value.splice(m, 0, o), c("change", {
|
|
611
|
-
file:
|
|
612
|
-
fileList:
|
|
611
|
+
file: C(o),
|
|
612
|
+
fileList: C(f.value),
|
|
613
613
|
event: "add"
|
|
614
614
|
});
|
|
615
615
|
}
|
|
@@ -628,35 +628,35 @@ const Ne = /* @__PURE__ */ V({
|
|
|
628
628
|
return u.value.uploadOnSelect || u.value.listType === "image" ? ((o = f.value) == null ? void 0 : o.filter((m) => R.value.includes(m.uid) ? !1 : m.status === "waiting" && m.originFileObj)) ?? [] : [];
|
|
629
629
|
}, $ = (o, m) => {
|
|
630
630
|
if (o && m) {
|
|
631
|
-
const
|
|
632
|
-
|
|
633
|
-
...f.value[
|
|
631
|
+
const b = ae(o);
|
|
632
|
+
b > -1 && (f.value[b] = {
|
|
633
|
+
...f.value[b],
|
|
634
634
|
...m
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
637
|
}, We = (o) => {
|
|
638
638
|
R.value = R.value.filter((m) => m !== o);
|
|
639
639
|
}, re = async (o) => {
|
|
640
|
-
var m,
|
|
640
|
+
var m, b, L, S;
|
|
641
641
|
if (o && f.value) {
|
|
642
642
|
const k = ie(o), tt = v.value && ((m = k == null ? void 0 : k.chunks) == null ? void 0 : m.length) && (k == null ? void 0 : k.chunks.length) > 1 && (k == null ? void 0 : k.status) === "uploading" && (k == null ? void 0 : k.chunks.some((Q) => Q.status === "waiting"));
|
|
643
643
|
if (k && Z(u.value.action) && (!R.value.length || u.value.parallelUpload || tt)) {
|
|
644
644
|
R.value.includes(o) || R.value.push(o);
|
|
645
645
|
const Q = new AbortController(), st = () => {
|
|
646
|
-
const
|
|
646
|
+
const z = () => {
|
|
647
647
|
Q.abort();
|
|
648
|
-
}, y =
|
|
648
|
+
}, y = C(k);
|
|
649
649
|
if (v.value && y.chunks && y.chunks.length > 1) {
|
|
650
|
-
const i = y.chunks.findIndex((
|
|
650
|
+
const i = y.chunks.findIndex((w) => w.status === "waiting");
|
|
651
651
|
i > -1 && (y.chunks[i] = {
|
|
652
652
|
...y.chunks[i],
|
|
653
653
|
status: "uploading",
|
|
654
|
-
cancel:
|
|
654
|
+
cancel: z
|
|
655
655
|
});
|
|
656
656
|
}
|
|
657
657
|
$(y.uid, {
|
|
658
658
|
status: "uploading",
|
|
659
|
-
cancel:
|
|
659
|
+
cancel: z
|
|
660
660
|
});
|
|
661
661
|
};
|
|
662
662
|
let F = {
|
|
@@ -665,20 +665,20 @@ const Ne = /* @__PURE__ */ V({
|
|
|
665
665
|
},
|
|
666
666
|
uid: k.uid
|
|
667
667
|
};
|
|
668
|
-
if (v.value && k.chunks && k.chunks.length > 1 && k.chunks.some((
|
|
669
|
-
const
|
|
670
|
-
|
|
668
|
+
if (v.value && k.chunks && k.chunks.length > 1 && k.chunks.some((z) => z.status === "waiting")) {
|
|
669
|
+
const z = k.chunks.find((y) => y.status === "waiting");
|
|
670
|
+
z != null && z.uid && (F = {
|
|
671
671
|
...F,
|
|
672
|
-
...dt(
|
|
673
|
-
chunkUid:
|
|
672
|
+
...dt(z, ["chunk", "chunkSize", "index"]),
|
|
673
|
+
chunkUid: z.uid,
|
|
674
674
|
onUploadProgress(y) {
|
|
675
|
-
var
|
|
676
|
-
const i =
|
|
675
|
+
var w, j, O, be;
|
|
676
|
+
const i = C(
|
|
677
677
|
f.value.find((X) => X.uid === k.uid)
|
|
678
678
|
);
|
|
679
679
|
if (i) {
|
|
680
|
-
const X = (
|
|
681
|
-
(ce) => ce.uid ===
|
|
680
|
+
const X = (w = i.chunks) == null ? void 0 : w.findIndex(
|
|
681
|
+
(ce) => ce.uid === z.uid
|
|
682
682
|
);
|
|
683
683
|
if (X !== void 0 && ((j = i.chunks) != null && j[X]) && (i.chunks[X].percent = Math.round(
|
|
684
684
|
y.loaded * 100 / y.total
|
|
@@ -704,38 +704,38 @@ const Ne = /* @__PURE__ */ V({
|
|
|
704
704
|
F = {
|
|
705
705
|
...F,
|
|
706
706
|
file: k.originFileObj,
|
|
707
|
-
onUploadProgress(
|
|
708
|
-
const y =
|
|
707
|
+
onUploadProgress(z) {
|
|
708
|
+
const y = C(
|
|
709
709
|
f.value.find((i) => i.uid === k.uid)
|
|
710
710
|
);
|
|
711
711
|
y && $(y.uid, {
|
|
712
|
-
percent: Math.round(
|
|
712
|
+
percent: Math.round(z.loaded * 100 / z.total)
|
|
713
713
|
});
|
|
714
714
|
}
|
|
715
715
|
};
|
|
716
716
|
if (st(), F.file || F.chunk) {
|
|
717
717
|
c("createRequest", k), c("change", {
|
|
718
|
-
file:
|
|
719
|
-
fileList:
|
|
718
|
+
file: C(k),
|
|
719
|
+
fileList: C(f.value),
|
|
720
720
|
event: "upload"
|
|
721
721
|
});
|
|
722
|
-
let
|
|
722
|
+
let z = !1;
|
|
723
723
|
try {
|
|
724
724
|
let y = await u.value.action(F);
|
|
725
725
|
try {
|
|
726
726
|
typeof y == "string" && (y = JSON.parse(y));
|
|
727
727
|
} catch {
|
|
728
728
|
}
|
|
729
|
-
let i =
|
|
730
|
-
f.value.find((
|
|
729
|
+
let i = C(
|
|
730
|
+
f.value.find((w) => w.uid === F.uid)
|
|
731
731
|
);
|
|
732
732
|
if (i) {
|
|
733
|
-
if (F.chunkUid && ((
|
|
734
|
-
const
|
|
733
|
+
if (F.chunkUid && ((b = i.chunks) != null && b.length) && i.chunks.length > 1) {
|
|
734
|
+
const w = i.chunks.findIndex(
|
|
735
735
|
(O) => O.uid === F.chunkUid
|
|
736
736
|
);
|
|
737
|
-
i.chunks[
|
|
738
|
-
...i.chunks[
|
|
737
|
+
i.chunks[w] && (i.chunks[w] = {
|
|
738
|
+
...i.chunks[w],
|
|
739
739
|
cancel: void 0,
|
|
740
740
|
status: "done",
|
|
741
741
|
response: y ?? void 0
|
|
@@ -745,7 +745,7 @@ const Ne = /* @__PURE__ */ V({
|
|
|
745
745
|
...i,
|
|
746
746
|
cancel: void 0,
|
|
747
747
|
status: j
|
|
748
|
-
} : i.chunks.some((O) => O.status === "waiting") && (
|
|
748
|
+
} : i.chunks.some((O) => O.status === "waiting") && (z = !0);
|
|
749
749
|
} else
|
|
750
750
|
i = {
|
|
751
751
|
...i,
|
|
@@ -753,20 +753,20 @@ const Ne = /* @__PURE__ */ V({
|
|
|
753
753
|
status: "done",
|
|
754
754
|
response: y ?? void 0
|
|
755
755
|
};
|
|
756
|
-
$(F.uid, i),
|
|
756
|
+
$(F.uid, i), z && await re(o);
|
|
757
757
|
}
|
|
758
758
|
} catch (y) {
|
|
759
759
|
if (y.name === "CanceledError") {
|
|
760
|
-
let i =
|
|
761
|
-
f.value.find((
|
|
760
|
+
let i = C(
|
|
761
|
+
f.value.find((w) => w.uid === F.uid)
|
|
762
762
|
);
|
|
763
763
|
if (i) {
|
|
764
|
-
if (F.chunkUid && ((
|
|
765
|
-
const
|
|
764
|
+
if (F.chunkUid && ((L = i.chunks) != null && L.length) && i.chunks.length > 1) {
|
|
765
|
+
const w = i.chunks.findIndex(
|
|
766
766
|
(j) => j.uid === F.chunkUid
|
|
767
767
|
);
|
|
768
|
-
i.chunks[
|
|
769
|
-
...i.chunks[
|
|
768
|
+
i.chunks[w] && (i.chunks[w] = {
|
|
769
|
+
...i.chunks[w],
|
|
770
770
|
cancel: void 0,
|
|
771
771
|
status: "waiting"
|
|
772
772
|
}), i = {
|
|
@@ -774,8 +774,8 @@ const Ne = /* @__PURE__ */ V({
|
|
|
774
774
|
cancel: void 0,
|
|
775
775
|
status: "paused"
|
|
776
776
|
}, c("change", {
|
|
777
|
-
file:
|
|
778
|
-
fileList:
|
|
777
|
+
file: C(i),
|
|
778
|
+
fileList: C(f.value),
|
|
779
779
|
event: "paused"
|
|
780
780
|
});
|
|
781
781
|
} else
|
|
@@ -784,23 +784,23 @@ const Ne = /* @__PURE__ */ V({
|
|
|
784
784
|
cancel: void 0,
|
|
785
785
|
status: "error"
|
|
786
786
|
}, c("change", {
|
|
787
|
-
file:
|
|
788
|
-
fileList:
|
|
787
|
+
file: C(i),
|
|
788
|
+
fileList: C(f.value),
|
|
789
789
|
event: "cancel"
|
|
790
790
|
});
|
|
791
791
|
$(F.uid, i);
|
|
792
792
|
}
|
|
793
793
|
} else {
|
|
794
|
-
let i =
|
|
795
|
-
f.value.find((
|
|
794
|
+
let i = C(
|
|
795
|
+
f.value.find((w) => w.uid === F.uid)
|
|
796
796
|
);
|
|
797
797
|
if (i) {
|
|
798
|
-
if (F.chunkUid && ((
|
|
799
|
-
const
|
|
798
|
+
if (F.chunkUid && ((S = i.chunks) != null && S.length) && i.chunks.length > 1) {
|
|
799
|
+
const w = i.chunks.findIndex(
|
|
800
800
|
(j) => j.uid === F.chunkUid
|
|
801
801
|
);
|
|
802
|
-
i.chunks[
|
|
803
|
-
...i.chunks[
|
|
802
|
+
i.chunks[w] && (i.chunks[w] = {
|
|
803
|
+
...i.chunks[w],
|
|
804
804
|
cancel: void 0,
|
|
805
805
|
status: "waiting"
|
|
806
806
|
});
|
|
@@ -812,14 +812,14 @@ const Ne = /* @__PURE__ */ V({
|
|
|
812
812
|
error: y,
|
|
813
813
|
percent: 0
|
|
814
814
|
}, c("change", {
|
|
815
|
-
file:
|
|
816
|
-
fileList:
|
|
815
|
+
file: C(i),
|
|
816
|
+
fileList: C(f.value),
|
|
817
817
|
event: "failed"
|
|
818
818
|
}), $(F.uid, i);
|
|
819
819
|
}
|
|
820
820
|
}
|
|
821
821
|
} finally {
|
|
822
|
-
|
|
822
|
+
z || We(o);
|
|
823
823
|
}
|
|
824
824
|
}
|
|
825
825
|
}
|
|
@@ -831,14 +831,17 @@ const Ne = /* @__PURE__ */ V({
|
|
|
831
831
|
return $(o, { status: "waiting" }), c("resetRequest", m), re(o);
|
|
832
832
|
}
|
|
833
833
|
}, Je = async (o) => {
|
|
834
|
-
var m
|
|
834
|
+
var m;
|
|
835
835
|
if (o && f.value) {
|
|
836
|
-
const
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
836
|
+
const b = ae(o), L = C(f.value ?? []);
|
|
837
|
+
if (b > -1 && L[b]) {
|
|
838
|
+
const S = C(L[b]);
|
|
839
|
+
(m = S.cancel) == null || m.call(S), c("remove", S), c("change", {
|
|
840
|
+
file: S,
|
|
841
|
+
fileList: C(f.value),
|
|
842
|
+
event: "remove"
|
|
843
|
+
}), L.splice(b, 1), f.value = L;
|
|
844
|
+
}
|
|
842
845
|
}
|
|
843
846
|
}, Ke = (o) => {
|
|
844
847
|
if (u.value.parallelUpload || !R.value.length) {
|
|
@@ -857,9 +860,9 @@ const Ne = /* @__PURE__ */ V({
|
|
|
857
860
|
}), Ye = pt(() => {
|
|
858
861
|
(u.value.parallelUpload && ke().length || !R.value.length) && ke().forEach((o) => re(o.uid)), (f.value || []).forEach((o) => {
|
|
859
862
|
typeof document > "u" || typeof window > "u" || !window.FileReader || !window.File || !(o.originFileObj instanceof File || o.originFileObj instanceof Blob) || o.thumbUrl !== void 0 || !o.type || !ne(le(o.type)) || (o.thumbUrl = "", Rt(o.originFileObj).then((m) => {
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
thumbUrl:
|
|
863
|
+
const b = m || "";
|
|
864
|
+
b !== o.thumbUrl && $(o == null ? void 0 : o.uid, {
|
|
865
|
+
thumbUrl: b
|
|
863
866
|
});
|
|
864
867
|
}));
|
|
865
868
|
});
|
|
@@ -895,15 +898,15 @@ const Ne = /* @__PURE__ */ V({
|
|
|
895
898
|
listType: H(Ae, ee)
|
|
896
899
|
}
|
|
897
900
|
}), et = () => {
|
|
898
|
-
var m,
|
|
899
|
-
const o = (
|
|
901
|
+
var m, b;
|
|
902
|
+
const o = (b = (m = P.slots).list) == null ? void 0 : b.call(m, P);
|
|
900
903
|
return M(o) ? P.fileList.value.map(
|
|
901
|
-
(
|
|
904
|
+
(L) => K(Bt, { uploadFile: L, key: L.uid })
|
|
902
905
|
) : o;
|
|
903
906
|
};
|
|
904
907
|
return s(P), (o, m) => {
|
|
905
|
-
var
|
|
906
|
-
return (
|
|
908
|
+
var b;
|
|
909
|
+
return (b = P.fileList.value) != null && b.length ? (U(), G("div", {
|
|
907
910
|
key: 0,
|
|
908
911
|
class: q(
|
|
909
912
|
l(ge)(
|
|
@@ -982,7 +985,7 @@ const Ne = /* @__PURE__ */ V({
|
|
|
982
985
|
let f = [];
|
|
983
986
|
h.dataTransfer && (d.directory ? f = await At(Array.prototype.slice.call(h.dataTransfer.items)) : f = Array.prototype.slice.call(h.dataTransfer.files)), d.multiple || (f = f.slice(0, 1)), t(
|
|
984
987
|
"addFiles",
|
|
985
|
-
f.filter((
|
|
988
|
+
f.filter((_) => qe(_, d.accept))
|
|
986
989
|
);
|
|
987
990
|
}, v = x(() => n.value ? {} : {
|
|
988
991
|
onClick: c,
|
|
@@ -1008,7 +1011,7 @@ const Ne = /* @__PURE__ */ V({
|
|
|
1008
1011
|
}, null, 40, $t)
|
|
1009
1012
|
], 16));
|
|
1010
1013
|
}
|
|
1011
|
-
}), Ue =
|
|
1014
|
+
}), Ue = T(Pe, "file"), Fe = (e) => de(e ? T(Ue, "chunk") : Ue, !0), Ot = /* @__PURE__ */ V({
|
|
1012
1015
|
...W("Upload", !1),
|
|
1013
1016
|
__name: "Upload",
|
|
1014
1017
|
props: {
|
|
@@ -1078,7 +1081,7 @@ const Ne = /* @__PURE__ */ V({
|
|
|
1078
1081
|
})
|
|
1079
1082
|
};
|
|
1080
1083
|
return s({ ...p, ...u, listRef: c }), (a, v) => (U(), G(fe, null, [
|
|
1081
|
-
e.noTrigger ? A("", !0) : (U(),
|
|
1084
|
+
e.noTrigger ? A("", !0) : (U(), B(Me, {
|
|
1082
1085
|
key: 0,
|
|
1083
1086
|
multiple: e.multiple,
|
|
1084
1087
|
directory: e.directory,
|
|
@@ -1115,7 +1118,7 @@ export {
|
|
|
1115
1118
|
oe as injectUploadContext,
|
|
1116
1119
|
yt as provideBaseUploadContext,
|
|
1117
1120
|
bt as provideUploadContext,
|
|
1118
|
-
|
|
1121
|
+
I as uploadListItemPrefix,
|
|
1119
1122
|
ee as uploadListPrefix,
|
|
1120
1123
|
Pe as uploadPrefix
|
|
1121
1124
|
};
|