@pantograph/vue 0.29.5 → 0.29.6
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/Upload/index.js +422 -422
- package/dist/Upload/index.umd.cjs +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
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { getBemBlock as at, getBemElement as
|
|
4
|
-
import { cva as
|
|
5
|
-
import { _ as
|
|
1
|
+
import { defineComponent as V, createElementBlock as G, openBlock as U, Fragment as fe, createBlock as R, createCommentVNode as j, createVNode as q, unref as i, normalizeClass as D, createSlots as lt, withCtx as te, withModifiers as M, computed as x, h as K, createElementVNode as _e, mergeProps as Ce, useSlots as ze, useAttrs as Ie, ref as Y, watch as ce, nextTick as be, readonly as it, renderSlot as Le, normalizeProps as Te, guardReactiveProps as Re } from "vue";
|
|
2
|
+
import { createContext as me } from "reka-ui";
|
|
3
|
+
import { getBemBlock as at, getBemElement as B, getComponentOptions as W, normCls as ge, generateVariantClassList as H, usePCId as de, getComponentName as ve } from "@pantograph/utils";
|
|
4
|
+
import { cva as Be } from "class-variance-authority";
|
|
5
|
+
import { _ as Se } from "../Progress.vue_vue_type_style_index_0_lang-VcaWRb-o.js";
|
|
6
6
|
import { _ as rt } from "../FloatButton.vue_vue_type_script_setup_true_lang-CjWleMQR.js";
|
|
7
|
-
import { _ as
|
|
8
|
-
import { _ as
|
|
9
|
-
import { isFunction as
|
|
7
|
+
import { _ as J } from "../IconButton.vue_vue_type_script_setup_true_lang-DBDmWePu.js";
|
|
8
|
+
import { _ as ut } from "../Image.vue_vue_type_style_index_0_lang-DyZjQGcE.js";
|
|
9
|
+
import { isFunction as Z, isEqual as ct, 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-Cw-dYlrK.js";
|
|
11
|
-
import { isEmptyElement as
|
|
11
|
+
import { isEmptyElement as N, useFormInput as mt, installComponent as he } from "@pantograph/utils-vue";
|
|
12
12
|
import { _ as gt } from "../FormValidation.vue_vue_type_style_index_0_lang-4DQfQtme.js";
|
|
13
|
-
import { i as
|
|
13
|
+
import { i as se } from "../isObject-vmP43YLW.js";
|
|
14
14
|
import { i as vt } from "../isArray-QlWcxgml.js";
|
|
15
|
-
const
|
|
15
|
+
const Pe = at("upload"), ee = B(Pe, "list"), L = B(ee, "item"), [ht, yt] = me("BaseUpload"), kt = () => ht(null), [oe, wt] = me("Upload"), bt = ["error", "paused", "done", "uploading", "waiting"], $e = ["md", "lg", "xlg"], je = ["image", "card"], xt = ["outline", "transparent"], pe = {
|
|
16
16
|
other: {
|
|
17
17
|
icon: "tabler:file-text",
|
|
18
18
|
fg: "primary",
|
|
@@ -53,7 +53,7 @@ const $e = at("upload"), ee = R($e, "list"), I = R(ee, "item"), [ht, yt] = ge("B
|
|
|
53
53
|
fg: "green",
|
|
54
54
|
bg: "green-subtle"
|
|
55
55
|
}
|
|
56
|
-
},
|
|
56
|
+
}, xe = {
|
|
57
57
|
image: [
|
|
58
58
|
"3fr",
|
|
59
59
|
"arw",
|
|
@@ -169,14 +169,14 @@ const $e = at("upload"), ee = R($e, "list"), I = R(ee, "item"), [ht, yt] = ge("B
|
|
|
169
169
|
document: ["doc", "docx", "odt", "rtf"],
|
|
170
170
|
excel: ["xls", "xlsx", "csv", "ods"],
|
|
171
171
|
pdf: ["pdf"]
|
|
172
|
-
},
|
|
172
|
+
}, Ae = (e, s) => {
|
|
173
173
|
if (e) {
|
|
174
|
-
for (const [t, d] of Object.entries(
|
|
174
|
+
for (const [t, d] of Object.entries(xe))
|
|
175
175
|
if (d.includes(e.toLowerCase()))
|
|
176
176
|
return t;
|
|
177
177
|
}
|
|
178
|
-
return s && Object.keys(
|
|
179
|
-
},
|
|
178
|
+
return s && Object.keys(xe).includes(s) ? s : "other";
|
|
179
|
+
}, Ee = (e = "") => {
|
|
180
180
|
const s = e.split("/"), d = s[s.length - 1].split(/#|\?/)[0];
|
|
181
181
|
return (/\.[^./\\]*$/.exec(d) || [""])[0];
|
|
182
182
|
}, le = (e) => {
|
|
@@ -187,7 +187,7 @@ const $e = at("upload"), ee = R($e, "list"), I = R(ee, "item"), [ht, yt] = ge("B
|
|
|
187
187
|
let s = le((e == null ? void 0 : e.type) || ((t = e == null ? void 0 : e.originFileObj) == null ? void 0 : t.type));
|
|
188
188
|
if (e != null && e.url && !s)
|
|
189
189
|
try {
|
|
190
|
-
s =
|
|
190
|
+
s = Ee(e == null ? void 0 : e.url);
|
|
191
191
|
} catch {
|
|
192
192
|
}
|
|
193
193
|
return s;
|
|
@@ -197,204 +197,204 @@ const $e = at("upload"), ee = R($e, "list"), I = R(ee, "item"), [ht, yt] = ge("B
|
|
|
197
197
|
}, _t = (e) => {
|
|
198
198
|
var s;
|
|
199
199
|
return Ft((e == null ? void 0 : e.type) || ((s = e == null ? void 0 : e.originFileObj) == null ? void 0 : s.type));
|
|
200
|
-
},
|
|
200
|
+
}, ne = (e) => Ae(e) === "image", Oe = (e) => {
|
|
201
201
|
if (e.type && !e.thumbUrl)
|
|
202
|
-
return
|
|
203
|
-
const s = e.thumbUrl || e.url || "", t =
|
|
204
|
-
return /^data:image\//.test(s) ||
|
|
205
|
-
}, Ct = /* @__PURE__ */
|
|
206
|
-
...
|
|
202
|
+
return ne(le(e.type));
|
|
203
|
+
const s = e.thumbUrl || e.url || "", t = Ee(s);
|
|
204
|
+
return /^data:image\//.test(s) || ne(t) ? !0 : !(/^data:/.test(s) || t);
|
|
205
|
+
}, Ct = /* @__PURE__ */ V({
|
|
206
|
+
...W("UploadListItemImage"),
|
|
207
207
|
__name: "UploadListItemImage",
|
|
208
208
|
setup(e) {
|
|
209
|
-
const s =
|
|
210
|
-
var n, r,
|
|
211
|
-
|
|
209
|
+
const s = oe(), t = ye(), d = () => {
|
|
210
|
+
var n, r, g;
|
|
211
|
+
Z((n = t.props.uploadFile) == null ? void 0 : n.cancel) && ((g = (r = t.props.uploadFile).cancel) == null || g.call(r)), s.remove(t.props.uploadFile.uid);
|
|
212
212
|
};
|
|
213
213
|
return (n, r) => {
|
|
214
|
-
var
|
|
215
|
-
return U(),
|
|
216
|
-
|
|
214
|
+
var g;
|
|
215
|
+
return U(), G(fe, null, [
|
|
216
|
+
i(t).props.uploadFile.status !== "waiting" ? (U(), R(ut, {
|
|
217
217
|
key: 0,
|
|
218
|
-
src:
|
|
218
|
+
src: i(Oe)(i(t).props.uploadFile) ? i(t).props.uploadFile.thumbUrl ?? i(t).props.uploadFile.url : void 0,
|
|
219
219
|
aspectRatio: "1:1",
|
|
220
|
-
class:
|
|
220
|
+
class: D(i(B)(i(L), "image")),
|
|
221
221
|
sizeRange: "xsm",
|
|
222
|
-
alt:
|
|
223
|
-
hovered:
|
|
222
|
+
alt: i(t).label.value,
|
|
223
|
+
hovered: i(t).props.uploadFile.status === "uploading",
|
|
224
224
|
width: "100%"
|
|
225
|
-
},
|
|
226
|
-
["error", "done"].includes(
|
|
225
|
+
}, lt({ _: 2 }, [
|
|
226
|
+
["error", "done"].includes(i(t).props.uploadFile.status) ? {
|
|
227
227
|
name: "actions",
|
|
228
228
|
fn: te(() => [
|
|
229
|
-
|
|
229
|
+
i(t).props.uploadFile.status === "done" ? (U(), R(J, {
|
|
230
230
|
key: 0,
|
|
231
231
|
color: "neutral",
|
|
232
232
|
type: "ghost",
|
|
233
233
|
icon: "tabler:eye",
|
|
234
234
|
size: "sm",
|
|
235
|
-
onClick: r[0] || (r[0] =
|
|
236
|
-
})) :
|
|
235
|
+
onClick: r[0] || (r[0] = M((p) => i(s).emit("preview", i(t).props.uploadFile), ["stop"]))
|
|
236
|
+
})) : i(t).props.uploadFile.status === "error" ? (U(), R(J, {
|
|
237
237
|
key: 1,
|
|
238
238
|
color: "neutral",
|
|
239
239
|
type: "ghost",
|
|
240
240
|
icon: "tabler:reload",
|
|
241
241
|
size: "sm",
|
|
242
|
-
onClick: r[1] || (r[1] =
|
|
243
|
-
})) :
|
|
242
|
+
onClick: r[1] || (r[1] = M((p) => i(s).resetRequest(i(t).props.uploadFile.uid), ["stop"]))
|
|
243
|
+
})) : j("", !0)
|
|
244
244
|
]),
|
|
245
245
|
key: "0"
|
|
246
246
|
} : void 0
|
|
247
|
-
]), 1032, ["src", "class", "alt", "hovered"])) :
|
|
248
|
-
["uploading", "waiting"].includes(
|
|
247
|
+
]), 1032, ["src", "class", "alt", "hovered"])) : j("", !0),
|
|
248
|
+
["uploading", "waiting"].includes(i(t).props.uploadFile.status) ? (U(), R(Se, {
|
|
249
249
|
key: 1,
|
|
250
250
|
type: "circle",
|
|
251
|
-
size:
|
|
252
|
-
class:
|
|
253
|
-
indeterminate:
|
|
254
|
-
percent: ((
|
|
255
|
-
}, null, 8, ["size", "class", "indeterminate", "percent"])) :
|
|
256
|
-
|
|
257
|
-
class:
|
|
258
|
-
|
|
251
|
+
size: i(s).progressSize.value,
|
|
252
|
+
class: D(i(B)(i(L), "progress")),
|
|
253
|
+
indeterminate: i(t).props.uploadFile.status === "waiting",
|
|
254
|
+
percent: ((g = i(t).props.uploadFile) == null ? void 0 : g.percent) ?? 0
|
|
255
|
+
}, null, 8, ["size", "class", "indeterminate", "percent"])) : j("", !0),
|
|
256
|
+
q(rt, {
|
|
257
|
+
class: D(
|
|
258
|
+
i(ge)(i(B)(i(L), "cancel"), "pantograph-tokens pantograph-dark")
|
|
259
259
|
),
|
|
260
260
|
color: "neutral",
|
|
261
261
|
icon: "tabler:x",
|
|
262
262
|
size: "sm",
|
|
263
|
-
onClick:
|
|
263
|
+
onClick: M(d, ["stop"])
|
|
264
264
|
}, null, 8, ["class"])
|
|
265
265
|
], 64);
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
|
-
}), zt = /* @__PURE__ */
|
|
269
|
-
...
|
|
268
|
+
}), zt = /* @__PURE__ */ V({
|
|
269
|
+
...W("UploadFileGO"),
|
|
270
270
|
__name: "UploadFileGO",
|
|
271
271
|
setup(e) {
|
|
272
|
-
const s =
|
|
272
|
+
const s = ye(), t = oe(), d = x(() => Ae(
|
|
273
273
|
Ut(s.props.uploadFile),
|
|
274
274
|
_t(s.props.uploadFile)
|
|
275
|
-
)), n = x(() =>
|
|
276
|
-
var
|
|
277
|
-
const
|
|
278
|
-
return
|
|
279
|
-
class:
|
|
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 h, v, f, I;
|
|
277
|
+
const o = (v = (h = t.slots).go) == null ? void 0 : v.call(h, { uploadFile: s.props.uploadFile });
|
|
278
|
+
return N(o) ? Oe(s.props.uploadFile) ? K("img", {
|
|
279
|
+
class: B(L, "thumb"),
|
|
280
280
|
alt: s.props.uploadFile.name ?? "",
|
|
281
|
-
src: ((f = s.props.uploadFile) == null ? void 0 : f.thumbUrl) ?? ((
|
|
282
|
-
}) : null :
|
|
283
|
-
},
|
|
284
|
-
var
|
|
285
|
-
const
|
|
286
|
-
return
|
|
287
|
-
},
|
|
281
|
+
src: ((f = s.props.uploadFile) == null ? void 0 : f.thumbUrl) ?? ((I = s.props.uploadFile) == null ? void 0 : I.url)
|
|
282
|
+
}) : null : o;
|
|
283
|
+
}, u = () => {
|
|
284
|
+
var h, v;
|
|
285
|
+
const o = (v = (h = t.slots).goIcon) == null ? void 0 : v.call(h, { uploadFile: s.props.uploadFile });
|
|
286
|
+
return N(o) ? null : o;
|
|
287
|
+
}, c = () => K(
|
|
288
288
|
ft,
|
|
289
289
|
{
|
|
290
290
|
size: t.goSize.value,
|
|
291
291
|
icon: n.value,
|
|
292
292
|
fg: r.value,
|
|
293
|
-
bg:
|
|
293
|
+
bg: g.value
|
|
294
294
|
},
|
|
295
295
|
{
|
|
296
296
|
default: p,
|
|
297
|
-
icon:
|
|
297
|
+
icon: u
|
|
298
298
|
}
|
|
299
299
|
);
|
|
300
|
-
return (
|
|
300
|
+
return (o, h) => (U(), R(c));
|
|
301
301
|
}
|
|
302
|
-
}), It = /* @__PURE__ */
|
|
303
|
-
...
|
|
302
|
+
}), It = /* @__PURE__ */ V({
|
|
303
|
+
...W("UploadListItemCard"),
|
|
304
304
|
__name: "UploadListItemCard",
|
|
305
305
|
setup(e) {
|
|
306
|
-
const s =
|
|
307
|
-
var
|
|
308
|
-
const
|
|
309
|
-
let
|
|
310
|
-
if (
|
|
311
|
-
return
|
|
306
|
+
const s = oe(), t = ye(), d = () => {
|
|
307
|
+
var o, h;
|
|
308
|
+
const u = (h = (o = s.slots).description) == null ? void 0 : h.call(o, { uploadFile: t.props.uploadFile });
|
|
309
|
+
let c;
|
|
310
|
+
if (N(u) || (c = u), t.props.uploadFile.description && (c = t.props.uploadFile.description), c)
|
|
311
|
+
return K("div", { class: B(L, "description") }, c);
|
|
312
312
|
}, n = () => {
|
|
313
|
-
var
|
|
314
|
-
const
|
|
315
|
-
return
|
|
313
|
+
var c, o;
|
|
314
|
+
const u = (o = (c = s.slots).title) == null ? void 0 : o.call(c, { uploadFile: t.props.uploadFile });
|
|
315
|
+
return N(u) ? t.label.value : u;
|
|
316
316
|
}, r = () => {
|
|
317
|
-
var
|
|
318
|
-
if (
|
|
317
|
+
var u;
|
|
318
|
+
if (Z(s.props.onDownload))
|
|
319
319
|
return s.props.onDownload(t.props.uploadFile);
|
|
320
|
-
if ((
|
|
320
|
+
if ((u = t.props.uploadFile) != null && u.url && typeof window < "u")
|
|
321
321
|
return window.open(t.props.uploadFile.url);
|
|
322
|
-
},
|
|
323
|
-
var
|
|
324
|
-
return (
|
|
325
|
-
}), p = (
|
|
326
|
-
var
|
|
327
|
-
const
|
|
322
|
+
}, g = x(() => {
|
|
323
|
+
var u, c;
|
|
324
|
+
return (u = t.props.uploadFile) != null && u.percent && ((c = t.props.uploadFile) == null ? void 0 : c.status) !== "waiting" ? `${(t.props.uploadFile.percent ?? 0).toFixed(0)}%` : "waiting...";
|
|
325
|
+
}), p = (u, c) => {
|
|
326
|
+
var h, v, f, I;
|
|
327
|
+
const o = (v = (h = s.slots) == null ? void 0 : h.actions) == null ? void 0 : v.call(h, {
|
|
328
328
|
...s,
|
|
329
329
|
uploadFile: t.props.uploadFile,
|
|
330
330
|
downloadFile: r
|
|
331
331
|
});
|
|
332
|
-
return
|
|
332
|
+
return N(o) ? (I = (f = c.slots) == null ? void 0 : f.default) == null ? void 0 : I.call(f, {}) : o;
|
|
333
333
|
};
|
|
334
|
-
return (
|
|
335
|
-
var
|
|
336
|
-
return U(),
|
|
337
|
-
|
|
338
|
-
["error", "done"].includes(
|
|
334
|
+
return (u, c) => {
|
|
335
|
+
var o;
|
|
336
|
+
return U(), G(fe, null, [
|
|
337
|
+
i(s).props.go ? (U(), R(zt, { key: 0 })) : j("", !0),
|
|
338
|
+
["error", "done"].includes(i(t).props.uploadFile.status) ? (U(), G("div", {
|
|
339
339
|
key: 2,
|
|
340
|
-
class:
|
|
340
|
+
class: D(i(B)(i(L), "content"))
|
|
341
341
|
}, [
|
|
342
|
-
|
|
343
|
-
class:
|
|
342
|
+
_e("div", {
|
|
343
|
+
class: D(i(B)(i(L), "title"))
|
|
344
344
|
}, [
|
|
345
|
-
|
|
345
|
+
q(n)
|
|
346
346
|
], 2),
|
|
347
|
-
|
|
347
|
+
i(t).props.uploadFile.status === "error" ? (U(), R(gt, {
|
|
348
348
|
key: 0,
|
|
349
349
|
message: "Failed",
|
|
350
350
|
status: "error"
|
|
351
|
-
})) :
|
|
352
|
-
], 2)) : (U(),
|
|
351
|
+
})) : i(s).props.size !== "md" ? (U(), R(d, { key: 1 })) : j("", !0)
|
|
352
|
+
], 2)) : (U(), R(Se, {
|
|
353
353
|
key: 1,
|
|
354
|
-
class:
|
|
355
|
-
percent: ((
|
|
356
|
-
label:
|
|
357
|
-
helperText:
|
|
358
|
-
helperTextCls:
|
|
354
|
+
class: D(i(B)(i(L), "progress")),
|
|
355
|
+
percent: ((o = i(t).props.uploadFile) == null ? void 0 : o.percent) ?? 0,
|
|
356
|
+
label: i(t).label.value,
|
|
357
|
+
helperText: g.value,
|
|
358
|
+
helperTextCls: i(B)(i(L), "percent")
|
|
359
359
|
}, {
|
|
360
360
|
label: te(() => [
|
|
361
|
-
|
|
361
|
+
q(n)
|
|
362
362
|
]),
|
|
363
363
|
_: 1
|
|
364
364
|
}, 8, ["class", "percent", "label", "helperText", "helperTextCls"])),
|
|
365
|
-
|
|
365
|
+
q(p, null, {
|
|
366
366
|
default: te(() => {
|
|
367
|
-
var
|
|
367
|
+
var h;
|
|
368
368
|
return [
|
|
369
|
-
|
|
369
|
+
i(t).props.uploadFile.status === "done" ? (U(), R(J, {
|
|
370
370
|
key: 0,
|
|
371
371
|
icon: "tabler:download",
|
|
372
372
|
size: "sm",
|
|
373
373
|
type: "ghost",
|
|
374
374
|
color: "neutral",
|
|
375
|
-
onClick:
|
|
376
|
-
})) :
|
|
377
|
-
|
|
375
|
+
onClick: M(r, ["stop"])
|
|
376
|
+
})) : j("", !0),
|
|
377
|
+
i(s).props.pausableChunked && i(t).props.uploadFile.status === "uploading" && ((h = i(t).props.uploadFile.chunks) != null && h.length) && i(Z)(i(t).props.uploadFile.cancel) ? (U(), R(J, {
|
|
378
378
|
key: 1,
|
|
379
379
|
icon: "tabler:pause",
|
|
380
380
|
size: "sm",
|
|
381
381
|
type: "ghost",
|
|
382
382
|
color: "neutral",
|
|
383
|
-
onClick:
|
|
384
|
-
}, null, 8, ["onClick"])) :
|
|
383
|
+
onClick: M(i(t).props.uploadFile.cancel, ["stop"])
|
|
384
|
+
}, null, 8, ["onClick"])) : i(s).canRunUpload(i(t).props.uploadFile.uid) ? (U(), R(J, {
|
|
385
385
|
key: 2,
|
|
386
|
-
icon: ["paused", "waiting"].includes(
|
|
386
|
+
icon: ["paused", "waiting"].includes(i(t).props.uploadFile.status) ? "tabler:player-play" : "tabler:reload",
|
|
387
387
|
size: "sm",
|
|
388
388
|
type: "ghost",
|
|
389
389
|
color: "neutral",
|
|
390
|
-
onClick:
|
|
391
|
-
}, null, 8, ["icon"])) :
|
|
392
|
-
|
|
393
|
-
icon: ["done", "error"].includes(
|
|
390
|
+
onClick: c[0] || (c[0] = M((v) => i(s).resetRequest(i(t).props.uploadFile.uid), ["stop"]))
|
|
391
|
+
}, null, 8, ["icon"])) : j("", !0),
|
|
392
|
+
q(J, {
|
|
393
|
+
icon: ["done", "error"].includes(i(t).props.uploadFile.status) ? "tabler:trash" : "tabler:x",
|
|
394
394
|
size: "sm",
|
|
395
395
|
type: "ghost",
|
|
396
396
|
color: "neutral",
|
|
397
|
-
onClick:
|
|
397
|
+
onClick: c[1] || (c[1] = M((v) => i(s).remove(i(t).props.uploadFile.uid), ["stop"]))
|
|
398
398
|
}, null, 8, ["icon"])
|
|
399
399
|
];
|
|
400
400
|
}),
|
|
@@ -403,47 +403,47 @@ const $e = at("upload"), ee = R($e, "list"), I = R(ee, "item"), [ht, yt] = ge("B
|
|
|
403
403
|
], 64);
|
|
404
404
|
};
|
|
405
405
|
}
|
|
406
|
-
}), [
|
|
407
|
-
...
|
|
406
|
+
}), [ye, Lt] = me("UploadItem"), Tt = /* @__PURE__ */ V({
|
|
407
|
+
...W("UploadListItem"),
|
|
408
408
|
__name: "UploadListItem",
|
|
409
409
|
props: {
|
|
410
410
|
uploadFile: {}
|
|
411
411
|
},
|
|
412
412
|
setup(e) {
|
|
413
|
-
const s = e, t =
|
|
413
|
+
const s = e, t = Be(L, {
|
|
414
414
|
variants: {
|
|
415
|
-
size:
|
|
416
|
-
listType:
|
|
417
|
-
|
|
418
|
-
|
|
415
|
+
size: H($e, L),
|
|
416
|
+
listType: H(
|
|
417
|
+
je,
|
|
418
|
+
L
|
|
419
419
|
),
|
|
420
|
-
type:
|
|
421
|
-
status:
|
|
420
|
+
type: H(xt, L),
|
|
421
|
+
status: H(bt, L)
|
|
422
422
|
}
|
|
423
423
|
}), d = x(() => {
|
|
424
|
-
var
|
|
425
|
-
return ((
|
|
426
|
-
}), n =
|
|
424
|
+
var g, p, u;
|
|
425
|
+
return ((g = s.uploadFile) == null ? void 0 : g.name) ?? ((u = (p = s.uploadFile) == null ? void 0 : p.originFileObj) == null ? void 0 : u.name);
|
|
426
|
+
}), n = oe();
|
|
427
427
|
Lt({
|
|
428
428
|
props: s,
|
|
429
429
|
label: d
|
|
430
430
|
});
|
|
431
431
|
const r = () => {
|
|
432
|
-
var p,
|
|
433
|
-
const
|
|
434
|
-
return
|
|
432
|
+
var p, u;
|
|
433
|
+
const g = (u = (p = n.slots).listItem) == null ? void 0 : u.call(p, { ...n, uploadFile: s.uploadFile });
|
|
434
|
+
return N(g) ? n.props.listType === "card" ? K(It) : K(Ct) : g;
|
|
435
435
|
};
|
|
436
|
-
return (
|
|
437
|
-
var
|
|
438
|
-
return U(),
|
|
439
|
-
class:
|
|
440
|
-
size:
|
|
441
|
-
listType:
|
|
442
|
-
type:
|
|
443
|
-
status: (
|
|
436
|
+
return (g, p) => {
|
|
437
|
+
var u, c, o;
|
|
438
|
+
return U(), G("div", Ce({
|
|
439
|
+
class: i(t)({
|
|
440
|
+
size: i(n).props.size,
|
|
441
|
+
listType: i(n).props.listType,
|
|
442
|
+
type: i(n).props.type,
|
|
443
|
+
status: (u = g.uploadFile) == null ? void 0 : u.status
|
|
444
444
|
})
|
|
445
|
-
}, { ...((
|
|
446
|
-
|
|
445
|
+
}, { ...((o = (c = i(n).props).getUploadItemProps) == null ? void 0 : o.call(c, g.uploadFile)) ?? {} }), [
|
|
446
|
+
q(r)
|
|
447
447
|
], 16);
|
|
448
448
|
};
|
|
449
449
|
}
|
|
@@ -451,18 +451,18 @@ const $e = at("upload"), ee = R($e, "list"), I = R(ee, "item"), [ht, yt] = ge("B
|
|
|
451
451
|
const d = [];
|
|
452
452
|
let n = 0, r = 0;
|
|
453
453
|
for (; n < e.size; ) {
|
|
454
|
-
const
|
|
454
|
+
const g = Math.min(n + t, e.size), p = e.slice(n, g);
|
|
455
455
|
d.push({
|
|
456
456
|
chunk: p,
|
|
457
|
-
chunkSize:
|
|
457
|
+
chunkSize: g - n,
|
|
458
458
|
index: r,
|
|
459
459
|
uid: s(),
|
|
460
460
|
status: "waiting"
|
|
461
|
-
}), n =
|
|
461
|
+
}), n = g, r++;
|
|
462
462
|
}
|
|
463
463
|
return d;
|
|
464
|
-
},
|
|
465
|
-
if (
|
|
464
|
+
}, qe = (e, { getUid: s, chunkFile: t, chunkSize: d }) => {
|
|
465
|
+
if (se(e)) {
|
|
466
466
|
let n;
|
|
467
467
|
if (e instanceof File)
|
|
468
468
|
n = e;
|
|
@@ -480,14 +480,14 @@ const $e = at("upload"), ee = R($e, "list"), I = R(ee, "item"), [ht, yt] = ge("B
|
|
|
480
480
|
type: e.type ?? ""
|
|
481
481
|
}), n.lastModified = (/* @__PURE__ */ new Date()).getTime(), n.name = e.name ?? "", n.webkitRelativePath = "";
|
|
482
482
|
}
|
|
483
|
-
if (
|
|
483
|
+
if (se(n) && n instanceof Blob) {
|
|
484
484
|
let r = [];
|
|
485
485
|
return t && (r = Rt(
|
|
486
486
|
n,
|
|
487
|
-
() => (s == null ? void 0 : s(!0)) ??
|
|
487
|
+
() => (s == null ? void 0 : s(!0)) ?? de(void 0, !0),
|
|
488
488
|
d
|
|
489
489
|
)), {
|
|
490
|
-
uid: e.uid ?? (s == null ? void 0 : s()) ??
|
|
490
|
+
uid: e.uid ?? (s == null ? void 0 : s()) ?? de(void 0, !0),
|
|
491
491
|
originFileObj: n,
|
|
492
492
|
status: "waiting",
|
|
493
493
|
chunks: r != null && r.length && (r == null ? void 0 : r.length) > 1 ? r : void 0,
|
|
@@ -501,40 +501,40 @@ const $e = at("upload"), ee = R($e, "list"), I = R(ee, "item"), [ht, yt] = ge("B
|
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
503
|
}, Bt = (e, s) => {
|
|
504
|
-
if (
|
|
505
|
-
return e instanceof Blob || e instanceof File ?
|
|
506
|
-
},
|
|
504
|
+
if (se(e))
|
|
505
|
+
return e instanceof Blob || e instanceof File ? qe(e, s) : (!e.uid && !Object.isFrozen(e) && (e.uid = s.getUid()), e);
|
|
506
|
+
}, De = (e, s) => {
|
|
507
507
|
if (e && s) {
|
|
508
508
|
const t = Array.isArray(s) ? s : s.split(","), d = (e == null ? void 0 : e.name) || "", n = (e == null ? void 0 : e.type) || "", r = n.replace(/\/.*$/, "");
|
|
509
|
-
return t.some((
|
|
510
|
-
const p =
|
|
511
|
-
if (/^\*(?<temp1>\/\*)?$/.test(
|
|
509
|
+
return t.some((g) => {
|
|
510
|
+
const p = g.trim();
|
|
511
|
+
if (/^\*(?<temp1>\/\*)?$/.test(g))
|
|
512
512
|
return !0;
|
|
513
513
|
if (p.charAt(0) === ".") {
|
|
514
|
-
const
|
|
515
|
-
let
|
|
516
|
-
return (
|
|
514
|
+
const u = d.toLowerCase(), c = p.toLowerCase();
|
|
515
|
+
let o = [c];
|
|
516
|
+
return (c === ".jpg" || c === ".jpeg") && (o = [".jpg", ".jpeg"]), o.some((h) => u.endsWith(h));
|
|
517
517
|
}
|
|
518
518
|
return /\/\*$/.test(p) ? r === p.replace(/\/.*$/, "") : !!(n === p || /^\w+$/.test(p));
|
|
519
519
|
});
|
|
520
520
|
}
|
|
521
521
|
return !0;
|
|
522
|
-
},
|
|
522
|
+
}, O = 200;
|
|
523
523
|
function St(e) {
|
|
524
524
|
return new Promise((s) => {
|
|
525
|
-
if (!e.type || !
|
|
525
|
+
if (!e.type || !ne(le(e.type))) {
|
|
526
526
|
s("");
|
|
527
527
|
return;
|
|
528
528
|
}
|
|
529
529
|
const t = document.createElement("canvas");
|
|
530
|
-
t.width =
|
|
530
|
+
t.width = O, t.height = O, t.style.cssText = `position: fixed; left: 0; top: 0; width: ${O}px; height: ${O}px; z-index: 9999; display: none;`, document.body.appendChild(t);
|
|
531
531
|
const d = t.getContext("2d"), n = new Image();
|
|
532
532
|
if (n.onload = () => {
|
|
533
|
-
const { width: r, height:
|
|
534
|
-
let p =
|
|
535
|
-
r >
|
|
536
|
-
const
|
|
537
|
-
document.body.removeChild(t), s(
|
|
533
|
+
const { width: r, height: g } = n;
|
|
534
|
+
let p = O, u = O, c = 0, o = 0;
|
|
535
|
+
r > g ? (u = g * (O / r), o = -(u - p) / 2) : (p = r * (O / g), c = -(p - u) / 2), d.drawImage(n, c, o, p, u);
|
|
536
|
+
const h = t.toDataURL();
|
|
537
|
+
document.body.removeChild(t), s(h);
|
|
538
538
|
}, n.crossOrigin = "anonymous", e.type.startsWith("image/svg+xml")) {
|
|
539
539
|
const r = new FileReader();
|
|
540
540
|
r.addEventListener("load", () => {
|
|
@@ -544,8 +544,8 @@ function St(e) {
|
|
|
544
544
|
n.src = window.URL.createObjectURL(e);
|
|
545
545
|
});
|
|
546
546
|
}
|
|
547
|
-
const
|
|
548
|
-
...
|
|
547
|
+
const Me = /* @__PURE__ */ V({
|
|
548
|
+
...W("UploadList"),
|
|
549
549
|
__name: "UploadList",
|
|
550
550
|
props: {
|
|
551
551
|
onDownload: {},
|
|
@@ -572,93 +572,91 @@ const Ne = /* @__PURE__ */ G({
|
|
|
572
572
|
},
|
|
573
573
|
emits: ["update:fileList", "change", "preview", "createRequest", "resetRequest", "remove"],
|
|
574
574
|
setup(e, { expose: s, emit: t }) {
|
|
575
|
-
const d = e, n = t, r =
|
|
576
|
-
n(...
|
|
577
|
-
},
|
|
578
|
-
() =>
|
|
579
|
-
),
|
|
580
|
-
() =>
|
|
581
|
-
), f =
|
|
582
|
-
let
|
|
583
|
-
|
|
584
|
-
() =>
|
|
585
|
-
(
|
|
575
|
+
const d = e, n = t, r = ze(), g = Ie(), p = kt(), u = (...l) => {
|
|
576
|
+
n(...l), p == null || p.emit(...l);
|
|
577
|
+
}, c = x(() => (p == null ? void 0 : p.props) ?? d), o = x(() => c.value.maxCount ? Number(c.value.maxCount) : 0), h = x(
|
|
578
|
+
() => c.value.listType !== "image" && c.value.pausableChunked
|
|
579
|
+
), v = x(
|
|
580
|
+
() => c.value.accept ?? c.value.listType === "image" ? "image/*" : void 0
|
|
581
|
+
), f = Y([]);
|
|
582
|
+
let I = !1;
|
|
583
|
+
ce(
|
|
584
|
+
() => c.value.fileList,
|
|
585
|
+
(l) => {
|
|
586
586
|
var m, b;
|
|
587
|
-
if (!
|
|
588
|
-
const
|
|
589
|
-
if (
|
|
590
|
-
return Bt(
|
|
591
|
-
getUid:
|
|
592
|
-
chunkFile:
|
|
593
|
-
chunkSize:
|
|
587
|
+
if (!I) {
|
|
588
|
+
const z = (b = (m = l ?? []) == null ? void 0 : m.map) == null ? void 0 : b.call(m, (T) => {
|
|
589
|
+
if (T && se(T))
|
|
590
|
+
return Bt(T, {
|
|
591
|
+
getUid: Fe,
|
|
592
|
+
chunkFile: h.value,
|
|
593
|
+
chunkSize: c.value.chunkSize
|
|
594
594
|
});
|
|
595
595
|
}).filter(Boolean);
|
|
596
|
-
|
|
596
|
+
ct(z, f.value) || (I = !0, f.value = z, be(() => I = !1));
|
|
597
597
|
}
|
|
598
598
|
},
|
|
599
599
|
{ immediate: !0, deep: !0 }
|
|
600
|
-
),
|
|
600
|
+
), ce(
|
|
601
601
|
f,
|
|
602
|
-
(
|
|
603
|
-
|
|
602
|
+
(l) => {
|
|
603
|
+
I || (I = !0, u("update:fileList", l ?? []), be(() => I = !1));
|
|
604
604
|
},
|
|
605
605
|
{ immediate: !0, deep: !0 }
|
|
606
606
|
);
|
|
607
|
-
const
|
|
608
|
-
if (
|
|
609
|
-
const m =
|
|
610
|
-
m === -1 && (!
|
|
611
|
-
file:
|
|
612
|
-
fileList:
|
|
607
|
+
const ie = (l) => f.value.find((m) => l && m.uid === l), ae = (l) => f.value.findIndex((m) => l && m.uid === l), Ge = (l) => {
|
|
608
|
+
if (l) {
|
|
609
|
+
const m = ae(l.uid);
|
|
610
|
+
m === -1 && (!o.value || o.value > f.value.length) ? f.value.push(l) : m > -1 && f.value.splice(m, 0, l), u("change", {
|
|
611
|
+
file: C(l),
|
|
612
|
+
fileList: C(f.value),
|
|
613
613
|
event: "add"
|
|
614
614
|
});
|
|
615
615
|
}
|
|
616
|
-
},
|
|
617
|
-
vt(
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
getUid:
|
|
621
|
-
chunkFile:
|
|
622
|
-
chunkSize:
|
|
616
|
+
}, Ve = (l) => {
|
|
617
|
+
vt(l) && l.filter((m) => !c.value.directory || De(m, v.value)).forEach((m) => {
|
|
618
|
+
Ge(
|
|
619
|
+
qe(m, {
|
|
620
|
+
getUid: Fe,
|
|
621
|
+
chunkFile: h.value,
|
|
622
|
+
chunkSize: c.value.chunkSize
|
|
623
623
|
})
|
|
624
624
|
);
|
|
625
625
|
});
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
if (o && m) {
|
|
633
|
-
const b = re(o);
|
|
626
|
+
}, S = Y([]), ke = () => {
|
|
627
|
+
var l;
|
|
628
|
+
return c.value.uploadOnSelect || c.value.listType === "image" ? ((l = f.value) == null ? void 0 : l.filter((m) => S.value.includes(m.uid) ? !1 : m.status === "waiting" && m.originFileObj)) ?? [] : [];
|
|
629
|
+
}, A = (l, m) => {
|
|
630
|
+
if (l && m) {
|
|
631
|
+
const b = ae(l);
|
|
634
632
|
b > -1 && (f.value[b] = {
|
|
635
633
|
...f.value[b],
|
|
636
634
|
...m
|
|
637
635
|
});
|
|
638
636
|
}
|
|
639
|
-
},
|
|
640
|
-
|
|
641
|
-
},
|
|
642
|
-
var m, b,
|
|
643
|
-
if (
|
|
644
|
-
const k =
|
|
645
|
-
if (k &&
|
|
646
|
-
|
|
637
|
+
}, We = (l) => {
|
|
638
|
+
S.value = S.value.filter((m) => m !== l);
|
|
639
|
+
}, re = async (l) => {
|
|
640
|
+
var m, b, z, T;
|
|
641
|
+
if (l && f.value) {
|
|
642
|
+
const k = ie(l), tt = h.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
|
+
if (k && Z(c.value.action) && (!S.value.length || c.value.parallelUpload || tt)) {
|
|
644
|
+
S.value.includes(l) || S.value.push(l);
|
|
647
645
|
const Q = new AbortController(), st = () => {
|
|
648
|
-
const
|
|
649
|
-
|
|
650
|
-
},
|
|
651
|
-
if (
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
-
...
|
|
646
|
+
const _ = () => {
|
|
647
|
+
Q.abort();
|
|
648
|
+
}, y = C(k);
|
|
649
|
+
if (h.value && y.chunks && y.chunks.length > 1) {
|
|
650
|
+
const a = y.chunks.findIndex((w) => w.status === "waiting");
|
|
651
|
+
a > -1 && (y.chunks[a] = {
|
|
652
|
+
...y.chunks[a],
|
|
655
653
|
status: "uploading",
|
|
656
|
-
cancel:
|
|
654
|
+
cancel: _
|
|
657
655
|
});
|
|
658
656
|
}
|
|
659
|
-
|
|
657
|
+
A(y.uid, {
|
|
660
658
|
status: "uploading",
|
|
661
|
-
cancel:
|
|
659
|
+
cancel: _
|
|
662
660
|
});
|
|
663
661
|
};
|
|
664
662
|
let F = {
|
|
@@ -667,37 +665,37 @@ const Ne = /* @__PURE__ */ G({
|
|
|
667
665
|
},
|
|
668
666
|
uid: k.uid
|
|
669
667
|
};
|
|
670
|
-
if (
|
|
671
|
-
const
|
|
672
|
-
|
|
668
|
+
if (h.value && k.chunks && k.chunks.length > 1 && k.chunks.some((_) => _.status === "waiting")) {
|
|
669
|
+
const _ = k.chunks.find((y) => y.status === "waiting");
|
|
670
|
+
_ != null && _.uid && (F = {
|
|
673
671
|
...F,
|
|
674
|
-
...dt(
|
|
675
|
-
chunkUid:
|
|
676
|
-
onUploadProgress(
|
|
677
|
-
var
|
|
678
|
-
const
|
|
672
|
+
...dt(_, ["chunk", "chunkSize", "index"]),
|
|
673
|
+
chunkUid: _.uid,
|
|
674
|
+
onUploadProgress(y) {
|
|
675
|
+
var w, $, E, we;
|
|
676
|
+
const a = C(
|
|
679
677
|
f.value.find((X) => X.uid === k.uid)
|
|
680
678
|
);
|
|
681
|
-
if (
|
|
682
|
-
const X = (
|
|
683
|
-
(ue) => ue.uid ===
|
|
679
|
+
if (a) {
|
|
680
|
+
const X = (w = a.chunks) == null ? void 0 : w.findIndex(
|
|
681
|
+
(ue) => ue.uid === _.uid
|
|
684
682
|
);
|
|
685
|
-
if (X !== void 0 && ((
|
|
686
|
-
|
|
687
|
-
)), (
|
|
688
|
-
const ue =
|
|
683
|
+
if (X !== void 0 && (($ = a.chunks) != null && $[X]) && (a.chunks[X].percent = Math.round(
|
|
684
|
+
y.loaded * 100 / y.total
|
|
685
|
+
)), (E = a.chunks) != null && E.length && ((we = a.chunks) == null ? void 0 : we.length) > 1) {
|
|
686
|
+
const ue = a.chunks.reduce(
|
|
689
687
|
(nt, ot) => nt + (ot.percent ?? 0),
|
|
690
688
|
0
|
|
691
689
|
);
|
|
692
|
-
|
|
693
|
-
Math.max(ue /
|
|
690
|
+
a.percent = Math.min(
|
|
691
|
+
Math.max(ue / a.chunks.length, 0),
|
|
694
692
|
100
|
|
695
693
|
);
|
|
696
694
|
} else
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
chunks:
|
|
700
|
-
percent:
|
|
695
|
+
a.percent = Math.round(y.loaded * 100 / y.total);
|
|
696
|
+
A(a.uid, {
|
|
697
|
+
chunks: a.chunks,
|
|
698
|
+
percent: a.percent
|
|
701
699
|
});
|
|
702
700
|
}
|
|
703
701
|
}
|
|
@@ -706,78 +704,78 @@ const Ne = /* @__PURE__ */ G({
|
|
|
706
704
|
F = {
|
|
707
705
|
...F,
|
|
708
706
|
file: k.originFileObj,
|
|
709
|
-
onUploadProgress(
|
|
710
|
-
const
|
|
711
|
-
f.value.find((
|
|
707
|
+
onUploadProgress(_) {
|
|
708
|
+
const y = C(
|
|
709
|
+
f.value.find((a) => a.uid === k.uid)
|
|
712
710
|
);
|
|
713
|
-
|
|
714
|
-
percent: Math.round(
|
|
711
|
+
y && A(y.uid, {
|
|
712
|
+
percent: Math.round(_.loaded * 100 / _.total)
|
|
715
713
|
});
|
|
716
714
|
}
|
|
717
715
|
};
|
|
718
716
|
if (st(), F.file || F.chunk) {
|
|
719
|
-
|
|
720
|
-
file:
|
|
721
|
-
fileList:
|
|
717
|
+
u("createRequest", k), u("change", {
|
|
718
|
+
file: C(k),
|
|
719
|
+
fileList: C(f.value),
|
|
722
720
|
event: "upload"
|
|
723
721
|
});
|
|
722
|
+
let _ = !1;
|
|
724
723
|
try {
|
|
725
|
-
let
|
|
724
|
+
let y = await c.value.action(F);
|
|
726
725
|
try {
|
|
727
|
-
typeof
|
|
726
|
+
typeof y == "string" && (y = JSON.parse(y));
|
|
728
727
|
} catch {
|
|
729
728
|
}
|
|
730
|
-
let a =
|
|
731
|
-
f.value.find((
|
|
729
|
+
let a = C(
|
|
730
|
+
f.value.find((w) => w.uid === F.uid)
|
|
732
731
|
);
|
|
733
732
|
if (a) {
|
|
734
|
-
let g = !1;
|
|
735
733
|
if (F.chunkUid && ((b = a.chunks) != null && b.length) && a.chunks.length > 1) {
|
|
736
|
-
const
|
|
737
|
-
(
|
|
734
|
+
const w = a.chunks.findIndex(
|
|
735
|
+
(E) => E.uid === F.chunkUid
|
|
738
736
|
);
|
|
739
|
-
a.chunks[
|
|
740
|
-
...a.chunks[
|
|
737
|
+
a.chunks[w] && (a.chunks[w] = {
|
|
738
|
+
...a.chunks[w],
|
|
741
739
|
cancel: void 0,
|
|
742
740
|
status: "done",
|
|
743
|
-
response:
|
|
741
|
+
response: y ?? void 0
|
|
744
742
|
});
|
|
745
|
-
const
|
|
746
|
-
|
|
743
|
+
const $ = a.chunks.every((E) => E.status === "done") ? "done" : "uploading";
|
|
744
|
+
$ === "done" ? a = {
|
|
747
745
|
...a,
|
|
748
746
|
cancel: void 0,
|
|
749
|
-
status:
|
|
750
|
-
} : a.chunks.some((
|
|
747
|
+
status: $
|
|
748
|
+
} : a.chunks.some((E) => E.status === "waiting") && (_ = !0);
|
|
751
749
|
} else
|
|
752
750
|
a = {
|
|
753
751
|
...a,
|
|
754
752
|
cancel: void 0,
|
|
755
753
|
status: "done",
|
|
756
|
-
response:
|
|
754
|
+
response: y ?? void 0
|
|
757
755
|
};
|
|
758
|
-
|
|
756
|
+
A(F.uid, a), _ && await re(l);
|
|
759
757
|
}
|
|
760
|
-
} catch (
|
|
761
|
-
if (
|
|
762
|
-
let a =
|
|
763
|
-
f.value.find((
|
|
758
|
+
} catch (y) {
|
|
759
|
+
if (y.name === "CanceledError") {
|
|
760
|
+
let a = C(
|
|
761
|
+
f.value.find((w) => w.uid === F.uid)
|
|
764
762
|
);
|
|
765
763
|
if (a) {
|
|
766
|
-
if (F.chunkUid && ((
|
|
767
|
-
const
|
|
768
|
-
(
|
|
764
|
+
if (F.chunkUid && ((z = a.chunks) != null && z.length) && a.chunks.length > 1) {
|
|
765
|
+
const w = a.chunks.findIndex(
|
|
766
|
+
($) => $.uid === F.chunkUid
|
|
769
767
|
);
|
|
770
|
-
a.chunks[
|
|
771
|
-
...a.chunks[
|
|
768
|
+
a.chunks[w] && (a.chunks[w] = {
|
|
769
|
+
...a.chunks[w],
|
|
772
770
|
cancel: void 0,
|
|
773
771
|
status: "waiting"
|
|
774
772
|
}), a = {
|
|
775
773
|
...a,
|
|
776
774
|
cancel: void 0,
|
|
777
775
|
status: "paused"
|
|
778
|
-
},
|
|
779
|
-
file:
|
|
780
|
-
fileList:
|
|
776
|
+
}, u("change", {
|
|
777
|
+
file: C(a),
|
|
778
|
+
fileList: C(f.value),
|
|
781
779
|
event: "paused"
|
|
782
780
|
});
|
|
783
781
|
} else
|
|
@@ -785,24 +783,24 @@ const Ne = /* @__PURE__ */ G({
|
|
|
785
783
|
...a,
|
|
786
784
|
cancel: void 0,
|
|
787
785
|
status: "error"
|
|
788
|
-
},
|
|
789
|
-
file:
|
|
790
|
-
fileList:
|
|
786
|
+
}, u("change", {
|
|
787
|
+
file: C(a),
|
|
788
|
+
fileList: C(f.value),
|
|
791
789
|
event: "cancel"
|
|
792
790
|
});
|
|
793
|
-
|
|
791
|
+
A(F.uid, a);
|
|
794
792
|
}
|
|
795
793
|
} else {
|
|
796
|
-
let a =
|
|
797
|
-
f.value.find((
|
|
794
|
+
let a = C(
|
|
795
|
+
f.value.find((w) => w.uid === F.uid)
|
|
798
796
|
);
|
|
799
797
|
if (a) {
|
|
800
|
-
if (F.chunkUid && ((
|
|
801
|
-
const
|
|
802
|
-
(
|
|
798
|
+
if (F.chunkUid && ((T = a.chunks) != null && T.length) && a.chunks.length > 1) {
|
|
799
|
+
const w = a.chunks.findIndex(
|
|
800
|
+
($) => $.uid === F.chunkUid
|
|
803
801
|
);
|
|
804
|
-
a.chunks[
|
|
805
|
-
...a.chunks[
|
|
802
|
+
a.chunks[w] && (a.chunks[w] = {
|
|
803
|
+
...a.chunks[w],
|
|
806
804
|
cancel: void 0,
|
|
807
805
|
status: "waiting"
|
|
808
806
|
});
|
|
@@ -811,62 +809,64 @@ const Ne = /* @__PURE__ */ G({
|
|
|
811
809
|
...a,
|
|
812
810
|
cancel: void 0,
|
|
813
811
|
status: "error",
|
|
814
|
-
error:
|
|
812
|
+
error: y,
|
|
815
813
|
percent: 0
|
|
816
|
-
},
|
|
817
|
-
file:
|
|
818
|
-
fileList:
|
|
814
|
+
}, u("change", {
|
|
815
|
+
file: C(a),
|
|
816
|
+
fileList: C(f.value),
|
|
819
817
|
event: "failed"
|
|
820
|
-
}),
|
|
818
|
+
}), A(F.uid, a);
|
|
821
819
|
}
|
|
822
820
|
}
|
|
821
|
+
} finally {
|
|
822
|
+
_ || We(l);
|
|
823
823
|
}
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
|
-
}, He = async (
|
|
828
|
-
if (
|
|
829
|
-
const m =
|
|
827
|
+
}, He = async (l) => {
|
|
828
|
+
if (l && f.value) {
|
|
829
|
+
const m = ie(l);
|
|
830
830
|
if (m)
|
|
831
|
-
return
|
|
831
|
+
return A(l, { status: "waiting" }), u("resetRequest", m), re(l);
|
|
832
832
|
}
|
|
833
|
-
}, Je = async (
|
|
833
|
+
}, Je = async (l) => {
|
|
834
834
|
var m, b;
|
|
835
|
-
if (
|
|
836
|
-
const
|
|
837
|
-
|
|
838
|
-
file:
|
|
839
|
-
fileList:
|
|
835
|
+
if (l && f.value) {
|
|
836
|
+
const z = ae(l), T = C(f.value ?? []);
|
|
837
|
+
z > -1 && T[z] && ((b = (m = T[z]).cancel) == null || b.call(m), T.splice(z, 1), f.value = T, u("remove", T[z]), u("change", {
|
|
838
|
+
file: T[z],
|
|
839
|
+
fileList: C(f.value),
|
|
840
840
|
event: "remove"
|
|
841
841
|
}));
|
|
842
842
|
}
|
|
843
|
-
}, Ke = (
|
|
844
|
-
if (
|
|
845
|
-
const m =
|
|
846
|
-
if (m && (m.status === "paused" || m.status === "error" || (!
|
|
843
|
+
}, Ke = (l) => {
|
|
844
|
+
if (c.value.parallelUpload || !S.value.length) {
|
|
845
|
+
const m = ie(l);
|
|
846
|
+
if (m && (m.status === "paused" || m.status === "error" || (!c.value.uploadOnSelect || c.value.listType === "image") && m.status === "waiting"))
|
|
847
847
|
return !0;
|
|
848
848
|
}
|
|
849
849
|
return !1;
|
|
850
850
|
}, Xe = x(() => {
|
|
851
|
-
switch (
|
|
851
|
+
switch (c.value.size) {
|
|
852
852
|
case "xlg":
|
|
853
853
|
return "md";
|
|
854
854
|
default:
|
|
855
855
|
return "sm";
|
|
856
856
|
}
|
|
857
857
|
}), Ye = pt(() => {
|
|
858
|
-
(
|
|
859
|
-
typeof document > "u" || typeof window > "u" || !window.FileReader || !window.File || !(
|
|
858
|
+
(c.value.parallelUpload && ke().length || !S.value.length) && ke().forEach((l) => re(l.uid)), (f.value || []).forEach((l) => {
|
|
859
|
+
typeof document > "u" || typeof window > "u" || !window.FileReader || !window.File || !(l.originFileObj instanceof File || l.originFileObj instanceof Blob) || l.thumbUrl !== void 0 || !l.type || !ne(le(l.type)) || (l.thumbUrl = "", St(l.originFileObj).then((m) => {
|
|
860
860
|
const b = m || "";
|
|
861
|
-
b !==
|
|
861
|
+
b !== l.thumbUrl && A(l == null ? void 0 : l.uid, {
|
|
862
862
|
thumbUrl: b
|
|
863
863
|
});
|
|
864
864
|
}));
|
|
865
865
|
});
|
|
866
866
|
}, 50);
|
|
867
|
-
|
|
867
|
+
ce([f, S], Ye, { deep: !0 });
|
|
868
868
|
const Ze = x(() => {
|
|
869
|
-
switch (
|
|
869
|
+
switch (c.value.size) {
|
|
870
870
|
case "xlg":
|
|
871
871
|
return "sm";
|
|
872
872
|
case "lg":
|
|
@@ -874,49 +874,49 @@ const Ne = /* @__PURE__ */ G({
|
|
|
874
874
|
default:
|
|
875
875
|
return "x2sm";
|
|
876
876
|
}
|
|
877
|
-
}),
|
|
877
|
+
}), P = {
|
|
878
878
|
props: (p == null ? void 0 : p.props) ?? d,
|
|
879
|
-
attrs: (p == null ? void 0 : p.attrs) ??
|
|
879
|
+
attrs: (p == null ? void 0 : p.attrs) ?? g,
|
|
880
880
|
slots: (p == null ? void 0 : p.slots) ?? r,
|
|
881
|
-
emit: (p == null ? void 0 : p.emit) ??
|
|
882
|
-
fileList:
|
|
881
|
+
emit: (p == null ? void 0 : p.emit) ?? u,
|
|
882
|
+
fileList: it(f),
|
|
883
883
|
progressSize: Ze,
|
|
884
|
-
getAccept:
|
|
884
|
+
getAccept: v,
|
|
885
885
|
goSize: Xe,
|
|
886
886
|
resetRequest: He,
|
|
887
887
|
canRunUpload: Ke,
|
|
888
888
|
remove: Je,
|
|
889
|
-
addFiles:
|
|
889
|
+
addFiles: Ve
|
|
890
890
|
};
|
|
891
|
-
wt(
|
|
892
|
-
const Qe =
|
|
891
|
+
wt(P);
|
|
892
|
+
const Qe = Be(ee, {
|
|
893
893
|
variants: {
|
|
894
|
-
size:
|
|
895
|
-
listType:
|
|
894
|
+
size: H($e, ee),
|
|
895
|
+
listType: H(je, ee)
|
|
896
896
|
}
|
|
897
897
|
}), et = () => {
|
|
898
898
|
var m, b;
|
|
899
|
-
const
|
|
900
|
-
return
|
|
901
|
-
(
|
|
902
|
-
) :
|
|
899
|
+
const l = (b = (m = P.slots).list) == null ? void 0 : b.call(m, P);
|
|
900
|
+
return N(l) ? P.fileList.value.map(
|
|
901
|
+
(z) => K(Tt, { uploadFile: z, key: z.uid })
|
|
902
|
+
) : l;
|
|
903
903
|
};
|
|
904
|
-
return s(
|
|
904
|
+
return s(P), (l, m) => {
|
|
905
905
|
var b;
|
|
906
|
-
return (b =
|
|
906
|
+
return (b = P.fileList.value) != null && b.length ? (U(), G("div", {
|
|
907
907
|
key: 0,
|
|
908
|
-
class:
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
size:
|
|
912
|
-
listType:
|
|
908
|
+
class: D(
|
|
909
|
+
i(ge)(
|
|
910
|
+
i(Qe)({
|
|
911
|
+
size: P.props.size,
|
|
912
|
+
listType: P.props.listType
|
|
913
913
|
}),
|
|
914
|
-
|
|
914
|
+
P.props.fileListCls
|
|
915
915
|
)
|
|
916
916
|
)
|
|
917
917
|
}, [
|
|
918
|
-
|
|
919
|
-
], 2)) :
|
|
918
|
+
q(et)
|
|
919
|
+
], 2)) : j("", !0);
|
|
920
920
|
};
|
|
921
921
|
}
|
|
922
922
|
}), Pt = (e) => new Promise((s) => {
|
|
@@ -954,8 +954,8 @@ const Ne = /* @__PURE__ */ G({
|
|
|
954
954
|
return t(n);
|
|
955
955
|
}).filter(Boolean)
|
|
956
956
|
), s;
|
|
957
|
-
}, At = ["accept", "webkitdirectory", "multiple", "value", "disabled"],
|
|
958
|
-
...
|
|
957
|
+
}, At = ["accept", "webkitdirectory", "multiple", "value", "disabled"], Ne = /* @__PURE__ */ V({
|
|
958
|
+
...W("UploadTrigger"),
|
|
959
959
|
__name: "UploadTrigger",
|
|
960
960
|
props: {
|
|
961
961
|
directory: { type: Boolean },
|
|
@@ -966,48 +966,48 @@ const Ne = /* @__PURE__ */ G({
|
|
|
966
966
|
},
|
|
967
967
|
emits: ["addFiles"],
|
|
968
968
|
setup(e, { emit: s }) {
|
|
969
|
-
const t = s, d = e, { getDisabled: n } = mt(), r =
|
|
970
|
-
const { files: f } =
|
|
969
|
+
const t = s, d = e, { getDisabled: n } = mt(), r = Y(), g = (v) => {
|
|
970
|
+
const { files: f } = v.target;
|
|
971
971
|
t("addFiles", Array.prototype.slice.call(f)), p.value && (p.value.value = "");
|
|
972
|
-
}, p =
|
|
973
|
-
var
|
|
974
|
-
(
|
|
975
|
-
},
|
|
976
|
-
|
|
977
|
-
},
|
|
978
|
-
if (
|
|
972
|
+
}, p = Y(), u = () => {
|
|
973
|
+
var v;
|
|
974
|
+
(v = p.value) == null || v.click();
|
|
975
|
+
}, c = (v) => {
|
|
976
|
+
v.key === "Enter" && u();
|
|
977
|
+
}, o = async (v) => {
|
|
978
|
+
if (v.preventDefault(), v.type === "dragover")
|
|
979
979
|
return;
|
|
980
980
|
let f = [];
|
|
981
|
-
|
|
981
|
+
v.dataTransfer && (d.directory ? f = await jt(Array.prototype.slice.call(v.dataTransfer.items)) : f = Array.prototype.slice.call(v.dataTransfer.files)), d.multiple || (f = f.slice(0, 1)), t(
|
|
982
982
|
"addFiles",
|
|
983
|
-
f.filter((
|
|
983
|
+
f.filter((I) => De(I, d.accept))
|
|
984
984
|
);
|
|
985
|
-
},
|
|
986
|
-
onClick:
|
|
987
|
-
onKeydown:
|
|
988
|
-
onDrop:
|
|
989
|
-
onDragover:
|
|
985
|
+
}, h = x(() => n.value ? {} : {
|
|
986
|
+
onClick: u,
|
|
987
|
+
onKeydown: c,
|
|
988
|
+
onDrop: o,
|
|
989
|
+
onDragover: o
|
|
990
990
|
});
|
|
991
|
-
return (
|
|
992
|
-
class:
|
|
993
|
-
},
|
|
994
|
-
|
|
995
|
-
|
|
991
|
+
return (v, f) => (U(), G("div", Ce({
|
|
992
|
+
class: i(ge)(d.class)
|
|
993
|
+
}, h.value), [
|
|
994
|
+
Le(v.$slots, "default", Te(Re({ ...h.value, disabled: i(n), tabindex: "0" }))),
|
|
995
|
+
_e("input", {
|
|
996
996
|
type: "file",
|
|
997
|
-
accept:
|
|
998
|
-
webkitdirectory:
|
|
999
|
-
multiple:
|
|
997
|
+
accept: v.accept,
|
|
998
|
+
webkitdirectory: v.directory,
|
|
999
|
+
multiple: v.multiple,
|
|
1000
1000
|
value: r.value,
|
|
1001
|
-
disabled:
|
|
1002
|
-
onChange:
|
|
1001
|
+
disabled: i(n),
|
|
1002
|
+
onChange: g,
|
|
1003
1003
|
ref_key: "inputRef",
|
|
1004
1004
|
ref: p,
|
|
1005
1005
|
style: { display: "none" }
|
|
1006
1006
|
}, null, 40, At)
|
|
1007
1007
|
], 16));
|
|
1008
1008
|
}
|
|
1009
|
-
}),
|
|
1010
|
-
...
|
|
1009
|
+
}), Ue = B(Pe, "file"), Fe = (e) => de(e ? B(Ue, "chunk") : Ue, !0), Et = /* @__PURE__ */ V({
|
|
1010
|
+
...W("Upload", !1),
|
|
1011
1011
|
__name: "Upload",
|
|
1012
1012
|
props: {
|
|
1013
1013
|
onDownload: {},
|
|
@@ -1034,86 +1034,86 @@ const Ne = /* @__PURE__ */ G({
|
|
|
1034
1034
|
},
|
|
1035
1035
|
emits: ["update:fileList", "change", "preview", "createRequest", "resetRequest", "remove"],
|
|
1036
1036
|
setup(e, { expose: s, emit: t }) {
|
|
1037
|
-
const d = e, n = t, r =
|
|
1037
|
+
const d = e, n = t, r = ze(), g = Ie(), p = {
|
|
1038
1038
|
props: d,
|
|
1039
|
-
attrs:
|
|
1039
|
+
attrs: g,
|
|
1040
1040
|
slots: r,
|
|
1041
1041
|
emit: n
|
|
1042
1042
|
};
|
|
1043
1043
|
yt(p);
|
|
1044
|
-
const
|
|
1044
|
+
const u = Y(), c = {
|
|
1045
1045
|
progressSize: x(() => {
|
|
1046
|
-
var
|
|
1047
|
-
return (
|
|
1046
|
+
var o;
|
|
1047
|
+
return (o = u.value) == null ? void 0 : o.progressSize;
|
|
1048
1048
|
}),
|
|
1049
1049
|
resetRequest: x(() => {
|
|
1050
|
-
var
|
|
1051
|
-
return (
|
|
1050
|
+
var o;
|
|
1051
|
+
return (o = u.value) == null ? void 0 : o.resetRequest;
|
|
1052
1052
|
}),
|
|
1053
1053
|
canRunUpload: x(() => {
|
|
1054
|
-
var
|
|
1055
|
-
return (
|
|
1054
|
+
var o;
|
|
1055
|
+
return (o = u.value) == null ? void 0 : o.canRunUpload;
|
|
1056
1056
|
}),
|
|
1057
1057
|
remove: x(() => {
|
|
1058
|
-
var
|
|
1059
|
-
return (
|
|
1058
|
+
var o;
|
|
1059
|
+
return (o = u.value) == null ? void 0 : o.remove;
|
|
1060
1060
|
}),
|
|
1061
1061
|
goSize: x(() => {
|
|
1062
|
-
var
|
|
1063
|
-
return (
|
|
1062
|
+
var o;
|
|
1063
|
+
return (o = u.value) == null ? void 0 : o.goSize;
|
|
1064
1064
|
}),
|
|
1065
1065
|
addFiles: x(() => {
|
|
1066
|
-
var
|
|
1067
|
-
return (
|
|
1066
|
+
var o;
|
|
1067
|
+
return (o = u.value) == null ? void 0 : o.addFiles;
|
|
1068
1068
|
}),
|
|
1069
1069
|
fileList: x(() => {
|
|
1070
|
-
var
|
|
1071
|
-
return (
|
|
1070
|
+
var o;
|
|
1071
|
+
return (o = u.value) == null ? void 0 : o.fileList;
|
|
1072
1072
|
}),
|
|
1073
1073
|
getAccept: x(() => {
|
|
1074
|
-
var
|
|
1075
|
-
return (
|
|
1074
|
+
var o;
|
|
1075
|
+
return (o = u.value) == null ? void 0 : o.getAccept;
|
|
1076
1076
|
})
|
|
1077
1077
|
};
|
|
1078
|
-
return s({ ...p, ...
|
|
1079
|
-
|
|
1078
|
+
return s({ ...p, ...c, listRef: u }), (o, h) => (U(), G(fe, null, [
|
|
1079
|
+
o.noTrigger ? j("", !0) : (U(), R(Ne, {
|
|
1080
1080
|
key: 0,
|
|
1081
|
-
multiple:
|
|
1082
|
-
directory:
|
|
1083
|
-
disabled:
|
|
1084
|
-
accept:
|
|
1085
|
-
onAddFiles:
|
|
1086
|
-
class:
|
|
1081
|
+
multiple: o.multiple,
|
|
1082
|
+
directory: o.directory,
|
|
1083
|
+
disabled: o.disabled,
|
|
1084
|
+
accept: c.getAccept.value,
|
|
1085
|
+
onAddFiles: c.addFiles.value,
|
|
1086
|
+
class: D(o.triggerCls)
|
|
1087
1087
|
}, {
|
|
1088
|
-
default: te((
|
|
1089
|
-
|
|
1088
|
+
default: te((v) => [
|
|
1089
|
+
Le(o.$slots, "default", Te(Re(v)))
|
|
1090
1090
|
]),
|
|
1091
1091
|
_: 3
|
|
1092
1092
|
}, 8, ["multiple", "directory", "disabled", "accept", "onAddFiles", "class"])),
|
|
1093
|
-
|
|
1094
|
-
action:
|
|
1093
|
+
q(Me, {
|
|
1094
|
+
action: o.action,
|
|
1095
1095
|
ref_key: "listRef",
|
|
1096
|
-
ref:
|
|
1096
|
+
ref: u
|
|
1097
1097
|
}, null, 8, ["action"])
|
|
1098
1098
|
], 64));
|
|
1099
1099
|
}
|
|
1100
|
-
}), Qt =
|
|
1100
|
+
}), Qt = he(Et, ve("Upload")), es = he(Me, ve("UploadList")), ts = he(Ne, ve("UploadTrigger"));
|
|
1101
1101
|
export {
|
|
1102
1102
|
Et as Upload,
|
|
1103
|
-
|
|
1103
|
+
Me as UploadList,
|
|
1104
1104
|
es as UploadListPlugin,
|
|
1105
|
-
|
|
1105
|
+
je as UploadListTypes,
|
|
1106
1106
|
Qt as UploadPlugin,
|
|
1107
|
-
|
|
1107
|
+
$e as UploadSizes,
|
|
1108
1108
|
bt as UploadStatuses,
|
|
1109
|
-
|
|
1109
|
+
Ne as UploadTrigger,
|
|
1110
1110
|
ts as UploadTriggerPlugin,
|
|
1111
1111
|
xt as UploadTypes,
|
|
1112
1112
|
kt as injectBaseUploadContext,
|
|
1113
|
-
|
|
1113
|
+
oe as injectUploadContext,
|
|
1114
1114
|
yt as provideBaseUploadContext,
|
|
1115
1115
|
wt as provideUploadContext,
|
|
1116
|
-
|
|
1116
|
+
L as uploadListItemPrefix,
|
|
1117
1117
|
ee as uploadListPrefix,
|
|
1118
|
-
|
|
1118
|
+
Pe as uploadPrefix
|
|
1119
1119
|
};
|