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