@pantograph/vue 0.25.0 → 0.25.1

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.
@@ -1,16 +1,16 @@
1
- import { defineComponent as D, createElementBlock as O, openBlock as b, Fragment as pe, createBlock as z, createCommentVNode as R, createVNode as E, unref as l, normalizeClass as j, createSlots as je, withCtx as Q, computed as _, h as V, createElementVNode as ye, ref as ie, mergeProps as Ae, renderSlot as ae, normalizeProps as re, guardReactiveProps as le, useSlots as Oe, useAttrs as De, watch as ve, nextTick as qe, watchEffect as Me, readonly as Ne } from "vue";
1
+ import { defineComponent as D, createElementBlock as O, openBlock as b, Fragment as pe, createBlock as z, createCommentVNode as R, createVNode as j, unref as a, normalizeClass as S, createSlots as Ae, withCtx as Q, computed as _, h as V, createElementVNode as ye, ref as ie, mergeProps as Oe, renderSlot as ae, normalizeProps as re, guardReactiveProps as le, useSlots as De, useAttrs as qe, watch as ve, nextTick as Me, watchEffect as Ne, readonly as Ge } from "vue";
2
2
  import { createContext as ke } from "reka-ui";
3
- import { getBemBlock as Ge, getBemElement as U, usePCId as ce, normCls as Ve, generateVariantClassList as N } from "@pantograph/utils";
3
+ import { getBemBlock as Ve, getBemElement as U, usePCId as ce, normCls as be, generateVariantClassList as N } from "@pantograph/utils";
4
4
  import { a as ee, c as J, f as We } from "./index-BTuMaS--.js";
5
5
  import { j as A, E as He, l as Je, t as x } from "./Icon.vue_vue_type_style_index_0_lang-BxthrfMq.js";
6
- import { cva as be } from "class-variance-authority";
7
- import { _ as we } from "./Progress.vue_vue_type_style_index_0_lang-BEHOwYFc.js";
6
+ import { cva as we } from "class-variance-authority";
7
+ import { _ as xe } from "./Progress.vue_vue_type_style_index_0_lang-BEHOwYFc.js";
8
8
  import { _ as Ke } from "./FloatButton.vue_vue_type_script_setup_true_lang-Ck9ilRKa.js";
9
9
  import { _ as G } from "./IconButton.vue_vue_type_script_setup_true_lang-BG-vYXAP.js";
10
10
  import { _ as Xe } from "./Image.vue_vue_type_style_index_0_lang-Bzg_B3NK.js";
11
11
  import { g as q } from "./options-Bh1s18jm.js";
12
12
  import { _ as Ye } from "./GraphicalObject.vue_vue_type_script_setup_true_lang-CEul2ZDZ.js";
13
- const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Upload"), _e = (s, t) => {
13
+ const _e = Ve("upload"), Z = U(_e, "list"), F = U(Z, "item"), [K, Ze] = ke("Upload"), Ce = (s, t) => {
14
14
  if (s && t) {
15
15
  const e = Array.isArray(t) ? t : t.split(","), o = s.name || "", n = s.type || "", c = n.replace(/\/.*$/, "");
16
16
  return e.some((p) => {
@@ -18,9 +18,9 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
18
18
  if (/^\*(?<temp1>\/\*)?$/.test(p))
19
19
  return !0;
20
20
  if (m.charAt(0) === ".") {
21
- const d = o.toLowerCase(), a = m.toLowerCase();
22
- let g = [a];
23
- return (a === ".jpg" || a === ".jpeg") && (g = [".jpg", ".jpeg"]), g.some((u) => d.endsWith(u));
21
+ const d = o.toLowerCase(), r = m.toLowerCase();
22
+ let g = [r];
23
+ return (r === ".jpg" || r === ".jpeg") && (g = [".jpg", ".jpeg"]), g.some((u) => d.endsWith(u));
24
24
  }
25
25
  return /\/\*$/.test(m) ? c === m.replace(/\/.*$/, "") : !!(n === m || /^\w+$/.test(m));
26
26
  });
@@ -40,7 +40,7 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
40
40
  }), n = p, c++;
41
41
  }
42
42
  return o;
43
- }, Ce = (s, { getUid: t, chunkFile: e, chunkSize: o }) => {
43
+ }, ze = (s, { getUid: t, chunkFile: e, chunkSize: o }) => {
44
44
  if (ee(s)) {
45
45
  let n;
46
46
  if (s instanceof File)
@@ -81,8 +81,8 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
81
81
  }
82
82
  }, et = (s, t) => {
83
83
  if (ee(s))
84
- return s instanceof Blob || s instanceof File ? Ce(s, t) : (!s.uid && !Object.isFrozen(s) && (s.uid = t.getUid()), s);
85
- }, tt = ["error", "paused", "done", "uploading", "waiting"], ze = ["md", "lg", "xlg"], Fe = ["image", "card"], st = ["outline", "transparent"], oe = {
84
+ return s instanceof Blob || s instanceof File ? ze(s, t) : (!s.uid && !Object.isFrozen(s) && (s.uid = t.getUid()), s);
85
+ }, tt = ["error", "paused", "done", "uploading", "waiting"], Fe = ["md", "lg", "xlg"], Ie = ["image", "card"], st = ["outline", "transparent"], oe = {
86
86
  other: {
87
87
  icon: "tabler:file-text",
88
88
  fg: "primary",
@@ -239,14 +239,14 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
239
239
  document: ["doc", "docx", "odt", "rtf"],
240
240
  excel: ["xls", "xlsx", "csv", "ods"],
241
241
  pdf: ["pdf"]
242
- }, Ie = (s) => {
242
+ }, Ue = (s) => {
243
243
  if (s) {
244
244
  for (const [t, e] of Object.entries(nt))
245
245
  if (e.includes(s.toLowerCase()))
246
246
  return t;
247
247
  }
248
248
  return "other";
249
- }, Ue = (s = "") => {
249
+ }, Le = (s = "") => {
250
250
  const t = s.split("/"), o = t[t.length - 1].split(/#|\?/)[0];
251
251
  return (/\.[^./\\]*$/.exec(o) || [""])[0];
252
252
  }, de = (s) => {
@@ -257,14 +257,14 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
257
257
  let t = de((s == null ? void 0 : s.type) || ((e = s == null ? void 0 : s.originFileObj) == null ? void 0 : e.type));
258
258
  if (s != null && s.url && !t)
259
259
  try {
260
- t = Ue(s == null ? void 0 : s.url);
260
+ t = Le(s == null ? void 0 : s.url);
261
261
  } catch {
262
262
  }
263
263
  return t;
264
- }, ue = (s) => Ie(s) === "image", Le = (s) => {
264
+ }, ue = (s) => Ue(s) === "image", Te = (s) => {
265
265
  if (s.type && !s.thumbUrl)
266
266
  return ue(de(s.type));
267
- const t = s.thumbUrl || s.url || "", e = Ue(t);
267
+ const t = s.thumbUrl || s.url || "", e = Le(t);
268
268
  return /^data:image\//.test(t) || ue(e) ? !0 : !(/^data:/.test(t) || e);
269
269
  }, it = /* @__PURE__ */ D({
270
270
  ...q("UploadListItemImage"),
@@ -277,49 +277,49 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
277
277
  return (n, c) => {
278
278
  var p;
279
279
  return b(), O(pe, null, [
280
- l(e).props.uploadFile.status !== "waiting" ? (b(), z(Xe, {
280
+ a(e).props.uploadFile.status !== "waiting" ? (b(), z(Xe, {
281
281
  key: 0,
282
- src: l(Le)(l(e).props.uploadFile) ? l(e).props.uploadFile.thumbUrl ?? l(e).props.uploadFile.url : void 0,
282
+ src: a(Te)(a(e).props.uploadFile) ? a(e).props.uploadFile.thumbUrl ?? a(e).props.uploadFile.url : void 0,
283
283
  aspectRatio: "1:1",
284
- class: j(l(U)(l(F), "image")),
284
+ class: S(a(U)(a(F), "image")),
285
285
  sizeRange: "xsm",
286
- alt: l(e).label.value,
287
- hovered: l(e).props.uploadFile.status === "uploading",
286
+ alt: a(e).label.value,
287
+ hovered: a(e).props.uploadFile.status === "uploading",
288
288
  width: "100%"
289
- }, je({ _: 2 }, [
290
- ["error", "done"].includes(l(e).props.uploadFile.status) ? {
289
+ }, Ae({ _: 2 }, [
290
+ ["error", "done"].includes(a(e).props.uploadFile.status) ? {
291
291
  name: "actions",
292
292
  fn: Q(() => [
293
- l(e).props.uploadFile.status === "done" ? (b(), z(G, {
293
+ a(e).props.uploadFile.status === "done" ? (b(), z(G, {
294
294
  key: 0,
295
295
  color: "neutral",
296
296
  type: "ghost",
297
297
  icon: "tabler:eye",
298
298
  size: "sm",
299
- onClick: c[0] || (c[0] = (m) => l(t).emit("preview", l(e).props.uploadFile))
300
- })) : l(e).props.uploadFile.status === "error" ? (b(), z(G, {
299
+ onClick: c[0] || (c[0] = (m) => a(t).emit("preview", a(e).props.uploadFile))
300
+ })) : a(e).props.uploadFile.status === "error" ? (b(), z(G, {
301
301
  key: 1,
302
302
  color: "neutral",
303
303
  type: "ghost",
304
304
  icon: "tabler:reload",
305
305
  size: "sm",
306
- onClick: c[1] || (c[1] = (m) => l(t).resetRequest(l(e).props.uploadFile))
306
+ onClick: c[1] || (c[1] = (m) => a(t).resetRequest(a(e).props.uploadFile))
307
307
  })) : R("", !0)
308
308
  ]),
309
309
  key: "0"
310
310
  } : void 0
311
311
  ]), 1032, ["src", "class", "alt", "hovered"])) : R("", !0),
312
- ["uploading", "waiting"].includes(l(e).props.uploadFile.status) ? (b(), z(we, {
312
+ ["uploading", "waiting"].includes(a(e).props.uploadFile.status) ? (b(), z(xe, {
313
313
  key: 1,
314
314
  type: "circle",
315
- size: l(t).progressSize.value,
316
- class: j(l(U)(l(F), "progress")),
317
- indeterminate: l(e).props.uploadFile.status === "waiting",
318
- percent: ((p = l(e).props.uploadFile) == null ? void 0 : p.percent) ?? 0
315
+ size: a(t).progressSize.value,
316
+ class: S(a(U)(a(F), "progress")),
317
+ indeterminate: a(e).props.uploadFile.status === "waiting",
318
+ percent: ((p = a(e).props.uploadFile) == null ? void 0 : p.percent) ?? 0
319
319
  }, null, 8, ["size", "class", "indeterminate", "percent"])) : R("", !0),
320
- E(Ke, {
321
- class: j(
322
- l(Ve)(l(U)(l(F), "cancel"), "pantograph-tokens pantograph-dark")
320
+ j(Ke, {
321
+ class: S(
322
+ a(be)(a(U)(a(F), "cancel"), "pantograph-tokens pantograph-dark")
323
323
  ),
324
324
  color: "neutral",
325
325
  icon: "tabler:x",
@@ -333,19 +333,19 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
333
333
  ...q("UploadFileGO"),
334
334
  __name: "UploadFileGO",
335
335
  setup(s) {
336
- const t = fe(), e = K(), o = _(() => Ie(ot(t.props.uploadFile))), n = _(() => J(e.props.getFileIcon) ? e.props.getFileIcon(t.props.uploadFile) : oe[o.value].icon), c = _(() => oe[o.value].fg), p = _(() => oe[o.value].bg), m = () => {
337
- var u, y, L, S;
336
+ const t = fe(), e = K(), o = _(() => Ue(ot(t.props.uploadFile))), n = _(() => J(e.props.getFileIcon) ? e.props.getFileIcon(t.props.uploadFile) : oe[o.value].icon), c = _(() => oe[o.value].fg), p = _(() => oe[o.value].bg), m = () => {
337
+ var u, y, L, $;
338
338
  const g = (y = (u = e.slots).go) == null ? void 0 : y.call(u, { uploadFile: t.props.uploadFile });
339
- return A(g) ? Le(t.props.uploadFile) ? V("img", {
339
+ return A(g) ? Te(t.props.uploadFile) ? V("img", {
340
340
  class: U(F, "thumb"),
341
341
  alt: t.props.uploadFile.name ?? "",
342
- src: ((L = t.props.uploadFile) == null ? void 0 : L.thumbUrl) ?? ((S = t.props.uploadFile) == null ? void 0 : S.url)
342
+ src: ((L = t.props.uploadFile) == null ? void 0 : L.thumbUrl) ?? (($ = t.props.uploadFile) == null ? void 0 : $.url)
343
343
  }) : null : g;
344
344
  }, d = () => {
345
345
  var u, y;
346
346
  const g = (y = (u = e.slots).goIcon) == null ? void 0 : y.call(u, { uploadFile: t.props.uploadFile });
347
347
  return A(g) ? null : g;
348
- }, a = () => V(
348
+ }, r = () => V(
349
349
  Ye,
350
350
  {
351
351
  size: e.goSize.value,
@@ -358,7 +358,7 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
358
358
  icon: d
359
359
  }
360
360
  );
361
- return (g, u) => (b(), z(a));
361
+ return (g, u) => (b(), z(r));
362
362
  }
363
363
  }), rt = /* @__PURE__ */ D({
364
364
  ...q("UploadListItemCard"),
@@ -367,12 +367,12 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
367
367
  const t = K(), e = fe(), o = () => {
368
368
  var g, u;
369
369
  const d = (u = (g = t.slots).description) == null ? void 0 : u.call(g, { uploadFile: e.props.uploadFile });
370
- let a;
371
- if (A(d) || (a = d), e.props.uploadFile.description && (a = e.props.uploadFile.description), a)
372
- return V("div", { class: U(F, "description") }, a);
370
+ let r;
371
+ if (A(d) || (r = d), e.props.uploadFile.description && (r = e.props.uploadFile.description), r)
372
+ return V("div", { class: U(F, "description") }, r);
373
373
  }, n = () => {
374
- var a, g;
375
- const d = (g = (a = t.slots).title) == null ? void 0 : g.call(a, { uploadFile: e.props.uploadFile });
374
+ var r, g;
375
+ const d = (g = (r = t.slots).title) == null ? void 0 : g.call(r, { uploadFile: e.props.uploadFile });
376
376
  return A(d) ? e.label.value : d;
377
377
  }, c = () => {
378
378
  var d;
@@ -381,52 +381,52 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
381
381
  if ((d = e.props.uploadFile) != null && d.url && typeof window < "u")
382
382
  return window.open(e.props.uploadFile.url);
383
383
  }, p = _(() => {
384
- var d, a;
385
- return (d = e.props.uploadFile) != null && d.percent && ((a = e.props.uploadFile) == null ? void 0 : a.status) !== "waiting" ? `${(e.props.uploadFile.percent ?? 0).toFixed(0)}%` : "waiting...";
386
- }), m = (d, a) => {
387
- var u, y, L, S;
384
+ var d, r;
385
+ return (d = e.props.uploadFile) != null && d.percent && ((r = e.props.uploadFile) == null ? void 0 : r.status) !== "waiting" ? `${(e.props.uploadFile.percent ?? 0).toFixed(0)}%` : "waiting...";
386
+ }), m = (d, r) => {
387
+ var u, y, L, $;
388
388
  const g = (y = (u = t.slots) == null ? void 0 : u.actions) == null ? void 0 : y.call(u, {
389
389
  ...t,
390
390
  uploadFile: e.props.uploadFile,
391
391
  downloadFile: c
392
392
  });
393
- return A(g) ? (S = (L = a.slots) == null ? void 0 : L.default) == null ? void 0 : S.call(L, {}) : g;
393
+ return A(g) ? ($ = (L = r.slots) == null ? void 0 : L.default) == null ? void 0 : $.call(L, {}) : g;
394
394
  };
395
- return (d, a) => {
395
+ return (d, r) => {
396
396
  var g;
397
397
  return b(), O(pe, null, [
398
- l(t).props.go ? (b(), z(at, { key: 0 })) : R("", !0),
399
- ["error", "done"].includes(l(e).props.uploadFile.status) ? (b(), O("div", {
398
+ a(t).props.go ? (b(), z(at, { key: 0 })) : R("", !0),
399
+ ["error", "done"].includes(a(e).props.uploadFile.status) ? (b(), O("div", {
400
400
  key: 2,
401
- class: j(l(U)(l(F), "content"))
401
+ class: S(a(U)(a(F), "content"))
402
402
  }, [
403
403
  ye("div", {
404
- class: j(l(U)(l(F), "title"))
404
+ class: S(a(U)(a(F), "title"))
405
405
  }, [
406
- E(n)
406
+ j(n)
407
407
  ], 2),
408
- l(e).props.uploadFile.status === "error" ? (b(), z(He, {
408
+ a(e).props.uploadFile.status === "error" ? (b(), z(He, {
409
409
  key: 0,
410
410
  message: "Failed",
411
411
  status: "error"
412
- })) : l(t).props.size !== "md" ? (b(), z(o, { key: 1 })) : R("", !0)
413
- ], 2)) : (b(), z(we, {
412
+ })) : a(t).props.size !== "md" ? (b(), z(o, { key: 1 })) : R("", !0)
413
+ ], 2)) : (b(), z(xe, {
414
414
  key: 1,
415
- class: j(l(U)(l(F), "progress")),
416
- percent: ((g = l(e).props.uploadFile) == null ? void 0 : g.percent) ?? 0,
417
- label: l(e).label.value,
415
+ class: S(a(U)(a(F), "progress")),
416
+ percent: ((g = a(e).props.uploadFile) == null ? void 0 : g.percent) ?? 0,
417
+ label: a(e).label.value,
418
418
  helperText: p.value
419
419
  }, {
420
420
  label: Q(() => [
421
- E(n)
421
+ j(n)
422
422
  ]),
423
423
  _: 1
424
424
  }, 8, ["class", "percent", "label", "helperText"])),
425
- E(m, null, {
425
+ j(m, null, {
426
426
  default: Q(() => {
427
427
  var u;
428
428
  return [
429
- l(e).props.uploadFile.status === "done" ? (b(), z(G, {
429
+ a(e).props.uploadFile.status === "done" ? (b(), z(G, {
430
430
  key: 0,
431
431
  icon: "tabler:download",
432
432
  size: "sm",
@@ -434,27 +434,27 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
434
434
  color: "neutral",
435
435
  onClick: c
436
436
  })) : R("", !0),
437
- l(t).props.pausableChunked && l(e).props.uploadFile.status === "uploading" && ((u = l(e).props.uploadFile.chunks) != null && u.length) && l(J)(l(e).props.uploadFile.cancel) ? (b(), z(G, {
437
+ a(t).props.pausableChunked && a(e).props.uploadFile.status === "uploading" && ((u = a(e).props.uploadFile.chunks) != null && u.length) && a(J)(a(e).props.uploadFile.cancel) ? (b(), z(G, {
438
438
  key: 1,
439
439
  icon: "tabler:pause",
440
440
  size: "sm",
441
441
  type: "ghost",
442
442
  color: "neutral",
443
- onClick: l(e).props.uploadFile.cancel
444
- }, null, 8, ["onClick"])) : l(t).canRunUpload(l(e).props.uploadFile) ? (b(), z(G, {
443
+ onClick: a(e).props.uploadFile.cancel
444
+ }, null, 8, ["onClick"])) : a(t).canRunUpload(a(e).props.uploadFile) ? (b(), z(G, {
445
445
  key: 2,
446
- icon: ["paused", "waiting"].includes(l(e).props.uploadFile.status) ? "tabler:player-play" : "tabler:reload",
446
+ icon: ["paused", "waiting"].includes(a(e).props.uploadFile.status) ? "tabler:player-play" : "tabler:reload",
447
447
  size: "sm",
448
448
  type: "ghost",
449
449
  color: "neutral",
450
- onClick: a[0] || (a[0] = (y) => l(t).resetRequest(l(e).props.uploadFile))
450
+ onClick: r[0] || (r[0] = (y) => a(t).resetRequest(a(e).props.uploadFile))
451
451
  }, null, 8, ["icon"])) : R("", !0),
452
- E(G, {
453
- icon: ["done", "error"].includes(l(e).props.uploadFile.status) ? "tabler:trash" : "tabler:x",
452
+ j(G, {
453
+ icon: ["done", "error"].includes(a(e).props.uploadFile.status) ? "tabler:trash" : "tabler:x",
454
454
  size: "sm",
455
455
  type: "ghost",
456
456
  color: "neutral",
457
- onClick: a[1] || (a[1] = (y) => l(t).remove(l(e).props.uploadFile))
457
+ onClick: r[1] || (r[1] = (y) => a(t).remove(a(e).props.uploadFile))
458
458
  }, null, 8, ["icon"])
459
459
  ];
460
460
  }),
@@ -470,11 +470,11 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
470
470
  uploadFile: {}
471
471
  },
472
472
  setup(s) {
473
- const t = s, e = be(F, {
473
+ const t = s, e = we(F, {
474
474
  variants: {
475
- size: N(ze, F),
475
+ size: N(Fe, F),
476
476
  listType: N(
477
- Fe,
477
+ Ie,
478
478
  F
479
479
  ),
480
480
  type: N(st, F),
@@ -496,16 +496,16 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
496
496
  return (p, m) => {
497
497
  var d;
498
498
  return b(), O("div", {
499
- class: j(
500
- l(e)({
501
- size: l(n).props.size,
502
- listType: l(n).props.listType,
503
- type: l(n).props.type,
499
+ class: S(
500
+ a(e)({
501
+ size: a(n).props.size,
502
+ listType: a(n).props.listType,
503
+ type: a(n).props.type,
504
504
  status: (d = p.uploadFile) == null ? void 0 : d.status
505
505
  })
506
506
  )
507
507
  }, [
508
- E(c)
508
+ j(c)
509
509
  ], 2);
510
510
  };
511
511
  }
@@ -513,10 +513,10 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
513
513
  ...q("UploadList"),
514
514
  __name: "UploadList",
515
515
  setup(s) {
516
- const t = K(), e = be(Z, {
516
+ const t = K(), e = we(Z, {
517
517
  variants: {
518
- size: N(ze, Z),
519
- listType: N(Fe, Z)
518
+ size: N(Fe, Z),
519
+ listType: N(Ie, Z)
520
520
  }
521
521
  }), o = () => {
522
522
  var c, p;
@@ -527,16 +527,16 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
527
527
  };
528
528
  return (n, c) => {
529
529
  var p;
530
- return (p = l(t).fileList.value) != null && p.length ? (b(), O("div", {
530
+ return (p = a(t).fileList.value) != null && p.length ? (b(), O("div", {
531
531
  key: 0,
532
- class: j(
533
- l(e)({
534
- size: l(t).props.size,
535
- listType: l(t).props.listType
532
+ class: S(
533
+ a(e)({
534
+ size: a(t).props.size,
535
+ listType: a(t).props.listType
536
536
  })
537
537
  )
538
538
  }, [
539
- E(o)
539
+ j(o)
540
540
  ], 2)) : R("", !0);
541
541
  };
542
542
  }
@@ -582,7 +582,8 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
582
582
  directory: { type: Boolean },
583
583
  multiple: { type: Boolean },
584
584
  disabled: { type: Boolean },
585
- accept: {}
585
+ accept: {},
586
+ class: {}
586
587
  },
587
588
  emits: ["addFiles"],
588
589
  setup(s, { emit: t }) {
@@ -594,23 +595,24 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
594
595
  (u = p.value) == null || u.click();
595
596
  }, d = (u) => {
596
597
  u.key === "Enter" && m();
597
- }, a = async (u) => {
598
+ }, r = async (u) => {
598
599
  if (u.preventDefault(), u.type === "dragover")
599
600
  return;
600
601
  let y = [];
601
602
  u.dataTransfer && (o.directory ? y = await ft(Array.prototype.slice.call(u.dataTransfer.items)) : y = Array.prototype.slice.call(u.dataTransfer.files)), o.multiple || (y = y.slice(0, 1)), e(
602
603
  "addFiles",
603
- y.filter((L) => _e(L, o.accept))
604
+ y.filter((L) => Ce(L, o.accept))
604
605
  );
605
606
  }, g = _(() => o.disabled ? {} : {
606
607
  onClick: m,
607
608
  onKeydown: d,
608
- onDrop: a,
609
- onDragover: a,
610
- tabindex: "0"
609
+ onDrop: r,
610
+ onDragover: r
611
611
  });
612
- return (u, y) => (b(), O("div", Ae({ class: "uploadTrigger w-fit inline" }, g.value), [
613
- ae(u.$slots, "default", re(le({ ...g.value, disabled: u.disabled }))),
612
+ return (u, y) => (b(), O("div", Oe({
613
+ class: a(be)(o.class)
614
+ }, g.value), [
615
+ ae(u.$slots, "default", re(le({ ...g.value, disabled: u.disabled, tabindex: "0" }))),
614
616
  ye("input", {
615
617
  type: "file",
616
618
  accept: u.accept,
@@ -624,7 +626,7 @@ const xe = Ge("upload"), Z = U(xe, "list"), F = U(Z, "item"), [K, Ze] = ke("Uplo
624
626
  }, null, 40, mt)
625
627
  ], 16));
626
628
  }
627
- }), B = 200;
629
+ }), E = 200;
628
630
  function ht(s) {
629
631
  return new Promise((t) => {
630
632
  if (!s.type || !ue(de(s.type))) {
@@ -632,12 +634,12 @@ function ht(s) {
632
634
  return;
633
635
  }
634
636
  const e = document.createElement("canvas");
635
- e.width = B, e.height = B, e.style.cssText = `position: fixed; left: 0; top: 0; width: ${B}px; height: ${B}px; z-index: 9999; display: none;`, document.body.appendChild(e);
637
+ e.width = E, e.height = E, e.style.cssText = `position: fixed; left: 0; top: 0; width: ${E}px; height: ${E}px; z-index: 9999; display: none;`, document.body.appendChild(e);
636
638
  const o = e.getContext("2d"), n = new Image();
637
639
  if (n.onload = () => {
638
640
  const { width: c, height: p } = n;
639
- let m = B, d = B, a = 0, g = 0;
640
- c > p ? (d = p * (B / c), g = -(d - m) / 2) : (m = c * (B / p), a = -(m - d) / 2), o.drawImage(n, a, g, m, d);
641
+ let m = E, d = E, r = 0, g = 0;
642
+ c > p ? (d = p * (E / c), g = -(d - m) / 2) : (m = c * (E / p), r = -(m - d) / 2), o.drawImage(n, r, g, m, d);
641
643
  const u = e.toDataURL();
642
644
  document.body.removeChild(e), t(u);
643
645
  }, n.crossOrigin = "anonymous", s.type.startsWith("image/svg+xml")) {
@@ -667,6 +669,7 @@ const Lt = /* @__PURE__ */ D({
667
669
  maxCount: {},
668
670
  action: {},
669
671
  getFileIcon: {},
672
+ triggerCls: {},
670
673
  directory: { type: Boolean },
671
674
  multiple: { type: Boolean, default: !0 },
672
675
  disabled: { type: Boolean },
@@ -674,24 +677,24 @@ const Lt = /* @__PURE__ */ D({
674
677
  },
675
678
  emits: ["update:fileList", "change", "preview", "createRequest", "resetRequest", "remove"],
676
679
  setup(s, { expose: t, emit: e }) {
677
- const o = s, n = e, c = Oe(), p = De(), m = U(xe, "file"), d = (i) => ce(i ? U(m, "chunk") : m, !0), a = ie([]), g = _(() => o.listType !== "image" && o.pausableChunked);
680
+ const o = s, n = e, c = De(), p = qe(), m = U(_e, "file"), d = (i) => ce(i ? U(m, "chunk") : m, !0), r = ie([]), g = _(() => o.listType !== "image" && o.pausableChunked);
678
681
  let u = !1;
679
682
  ve(
680
683
  () => o.fileList,
681
684
  (i) => {
682
685
  var h, k;
683
- u = !0, a.value = (k = (h = i ?? []) == null ? void 0 : h.map) == null ? void 0 : k.call(h, (C) => {
686
+ u = !0, r.value = (k = (h = i ?? []) == null ? void 0 : h.map) == null ? void 0 : k.call(h, (C) => {
684
687
  if (C && ee(C))
685
688
  return et(C, {
686
689
  getUid: d,
687
690
  chunkFile: g.value,
688
691
  chunkSize: o.chunkSize
689
692
  });
690
- }).filter(Boolean), qe(() => u = !1);
693
+ }).filter(Boolean), Me(() => u = !1);
691
694
  },
692
695
  { immediate: !0, deep: !0 }
693
696
  ), ve(
694
- a,
697
+ r,
695
698
  (i) => {
696
699
  u || n("update:fileList", i ?? []);
697
700
  },
@@ -699,21 +702,21 @@ const Lt = /* @__PURE__ */ D({
699
702
  );
700
703
  const y = _(() => o.maxCount ? Number(o.maxCount) : 0), L = (i) => {
701
704
  if (i) {
702
- const h = a.value.findIndex(
705
+ const h = r.value.findIndex(
703
706
  (k) => k.uid && i.uid && k.uid === i.uid
704
707
  );
705
- h === -1 && (!y.value || y.value > a.value.length) ? a.value.push(i) : h > -1 && a.value.splice(h, 0, i), n("change", {
708
+ h === -1 && (!y.value || y.value > r.value.length) ? r.value.push(i) : h > -1 && r.value.splice(h, 0, i), n("change", {
706
709
  file: x(i),
707
- fileList: x(a.value),
710
+ fileList: x(r.value),
708
711
  event: "add"
709
712
  });
710
713
  }
711
- }, S = _(
714
+ }, $ = _(
712
715
  () => o.accept ?? o.listType === "image" ? "image/*" : void 0
713
716
  ), me = (i) => {
714
- We(i) && i.filter((h) => !o.directory || _e(h, S.value)).forEach((h) => {
717
+ We(i) && i.filter((h) => !o.directory || Ce(h, $.value)).forEach((h) => {
715
718
  L(
716
- Ce(h, {
719
+ ze(h, {
717
720
  getUid: d,
718
721
  chunkFile: g.value,
719
722
  chunkSize: o.chunkSize
@@ -723,42 +726,42 @@ const Lt = /* @__PURE__ */ D({
723
726
  }, te = _(
724
727
  () => {
725
728
  var i;
726
- return o.uploadOnSelect || o.listType === "image" ? ((i = a.value) == null ? void 0 : i.filter(
729
+ return o.uploadOnSelect || o.listType === "image" ? ((i = r.value) == null ? void 0 : i.filter(
727
730
  (h) => h.status === "waiting" && h.originFileObj
728
731
  )) ?? [] : [];
729
732
  }
730
733
  ), X = _(
731
734
  () => {
732
735
  var i;
733
- return ((i = a.value) == null ? void 0 : i.filter(
736
+ return ((i = r.value) == null ? void 0 : i.filter(
734
737
  (h) => h.status === "uploading" && (h == null ? void 0 : h.cancel)
735
738
  )) ?? [];
736
739
  }
737
- ), $ = (i, h) => {
740
+ ), P = (i, h) => {
738
741
  if (i && h) {
739
- const k = a.value.findIndex((C) => C.uid === i);
740
- k > -1 && (a.value[k] = {
741
- ...a.value[k],
742
+ const k = r.value.findIndex((C) => C.uid === i);
743
+ k > -1 && (r.value[k] = {
744
+ ...r.value[k],
742
745
  ...h
743
746
  });
744
747
  }
745
748
  }, Y = async (i) => {
746
749
  var h, k, C, ge;
747
- if (i.uid && a.value) {
748
- const T = a.value.find((M) => M.uid === i.uid);
750
+ if (i.uid && r.value) {
751
+ const T = r.value.find((M) => M.uid === i.uid);
749
752
  if (T && J(o.action) && (!X.value.length || o.parallelUpload || g.value && ((h = T.chunks) != null && h.length) && T.chunks.length > 1 && T.status === "uploading" && T.chunks.some((M) => M.status === "waiting"))) {
750
- const M = new AbortController(), Be = () => {
751
- const v = () => M.abort(), r = x(T);
752
- if (g.value && r.chunks && r.chunks.length > 1) {
753
- const f = r.chunks.findIndex((I) => I.status === "waiting");
754
- f > -1 && (r.chunks[f] = {
755
- ...r.chunks[f],
753
+ const M = new AbortController(), Ee = () => {
754
+ const v = () => M.abort(), l = x(T);
755
+ if (g.value && l.chunks && l.chunks.length > 1) {
756
+ const f = l.chunks.findIndex((I) => I.status === "waiting");
757
+ f > -1 && (l.chunks[f] = {
758
+ ...l.chunks[f],
756
759
  status: "uploading",
757
760
  cancel: v
758
761
  });
759
762
  }
760
- $(r.uid, {
761
- ...r,
763
+ P(l.uid, {
764
+ ...l,
762
765
  status: "uploading",
763
766
  cancel: v
764
767
  });
@@ -770,29 +773,29 @@ const Lt = /* @__PURE__ */ D({
770
773
  uid: i.uid
771
774
  };
772
775
  if (g.value && T.chunks && T.chunks.length > 1 && T.chunks.some((v) => v.status === "waiting")) {
773
- const v = T.chunks.find((r) => r.status === "waiting");
776
+ const v = T.chunks.find((l) => l.status === "waiting");
774
777
  v != null && v.uid && (w = {
775
778
  ...w,
776
779
  ...Je(v, "chunk", "chunkSiz", "index"),
777
780
  chunk_uid: v.uid,
778
- onUploadProgress(r) {
779
- var I, W, P, he;
781
+ onUploadProgress(l) {
782
+ var I, W, B, he;
780
783
  const f = x(
781
- a.value.find((H) => H.uid === i.uid)
784
+ r.value.find((H) => H.uid === i.uid)
782
785
  );
783
786
  if (f) {
784
787
  const H = (I = f.chunks) == null ? void 0 : I.findIndex(
785
788
  (ne) => ne.uid === v.uid
786
789
  );
787
790
  H !== void 0 && ((W = f.chunks) != null && W[H]) && (f.chunks[H].percent = Math.round(
788
- r.loaded * 100 / r.total
789
- )), (P = f.chunks) != null && P.length && ((he = f.chunks) == null ? void 0 : he.length) > 1 ? f.percent = Math.min(
791
+ l.loaded * 100 / l.total
792
+ )), (B = f.chunks) != null && B.length && ((he = f.chunks) == null ? void 0 : he.length) > 1 ? f.percent = Math.min(
790
793
  Math.max(
791
- f.chunks.reduce((ne, Ee) => ne + (Ee.percent ?? 0), 0) / (100 * f.chunks.length),
794
+ f.chunks.reduce((ne, je) => ne + (je.percent ?? 0), 0) / (100 * f.chunks.length),
792
795
  0
793
796
  ),
794
797
  100
795
- ) : f.percent = Math.round(r.loaded * 100 / r.total), $(f.uid, f);
798
+ ) : f.percent = Math.round(l.loaded * 100 / l.total), P(f.uid, f);
796
799
  }
797
800
  }
798
801
  });
@@ -801,18 +804,18 @@ const Lt = /* @__PURE__ */ D({
801
804
  ...w,
802
805
  file: T.originFileObj,
803
806
  onUploadProgress(v) {
804
- const r = x(
805
- a.value.find((f) => f.uid === i.uid)
807
+ const l = x(
808
+ r.value.find((f) => f.uid === i.uid)
806
809
  );
807
- r && $(r.uid, {
810
+ l && P(l.uid, {
808
811
  percent: Math.round(v.loaded * 100 / v.total)
809
812
  });
810
813
  }
811
814
  };
812
- if (Be(), w.file || w.chunk) {
815
+ if (Ee(), w.file || w.chunk) {
813
816
  n("createRequest", i), n("change", {
814
817
  file: x(i),
815
- fileList: x(a.value),
818
+ fileList: x(r.value),
816
819
  event: "upload"
817
820
  });
818
821
  try {
@@ -821,116 +824,116 @@ const Lt = /* @__PURE__ */ D({
821
824
  typeof v == "string" && (v = JSON.parse(v));
822
825
  } catch {
823
826
  }
824
- let r = x(
825
- a.value.find((f) => f.uid === w.uid)
827
+ let l = x(
828
+ r.value.find((f) => f.uid === w.uid)
826
829
  );
827
- if (r) {
830
+ if (l) {
828
831
  let f = !1;
829
- if (w.chunk_uid && ((k = r.chunks) != null && k.length) && r.chunks.length > 1) {
830
- const I = r.chunks.findIndex(
831
- (P) => P.uid === w.chunk_uid
832
+ if (w.chunk_uid && ((k = l.chunks) != null && k.length) && l.chunks.length > 1) {
833
+ const I = l.chunks.findIndex(
834
+ (B) => B.uid === w.chunk_uid
832
835
  );
833
- r.chunks[I] && (r.chunks[I] = {
834
- ...r.chunks[I],
836
+ l.chunks[I] && (l.chunks[I] = {
837
+ ...l.chunks[I],
835
838
  cancel: void 0,
836
839
  status: "done",
837
840
  response: v ?? void 0
838
841
  });
839
- const W = r.chunks.every((P) => P.status === "done") ? "done" : "uploading";
840
- W === "done" ? r = {
841
- ...r,
842
+ const W = l.chunks.every((B) => B.status === "done") ? "done" : "uploading";
843
+ W === "done" ? l = {
844
+ ...l,
842
845
  cancel: void 0,
843
846
  status: W
844
- } : r.chunks.some((P) => P.status === "waiting") && (f = !0);
847
+ } : l.chunks.some((B) => B.status === "waiting") && (f = !0);
845
848
  } else
846
- r = {
847
- ...r,
849
+ l = {
850
+ ...l,
848
851
  cancel: void 0,
849
852
  status: "done",
850
853
  response: v ?? void 0
851
854
  };
852
- $(w.uid, r), f && await Y(r);
855
+ P(w.uid, l), f && await Y(l);
853
856
  }
854
857
  } catch (v) {
855
858
  if (v.name === "CanceledError") {
856
- let r = x(
857
- a.value.find((f) => f.uid === w.uid)
859
+ let l = x(
860
+ r.value.find((f) => f.uid === w.uid)
858
861
  );
859
- if (r) {
860
- if (w.chunk_uid && ((C = r.chunks) != null && C.length) && r.chunks.length > 1) {
861
- const f = r.chunks.findIndex(
862
+ if (l) {
863
+ if (w.chunk_uid && ((C = l.chunks) != null && C.length) && l.chunks.length > 1) {
864
+ const f = l.chunks.findIndex(
862
865
  (I) => I.uid === w.chunk_uid
863
866
  );
864
- r.chunks[f] && (r.chunks[f] = {
865
- ...r.chunks[f],
867
+ l.chunks[f] && (l.chunks[f] = {
868
+ ...l.chunks[f],
866
869
  cancel: void 0,
867
870
  status: "waiting"
868
- }), r = {
869
- ...r,
871
+ }), l = {
872
+ ...l,
870
873
  cancel: void 0,
871
874
  status: "paused"
872
875
  }, n("change", {
873
- file: x(r),
874
- fileList: x(a.value),
876
+ file: x(l),
877
+ fileList: x(r.value),
875
878
  event: "paused"
876
879
  });
877
880
  } else
878
- r = {
879
- ...r,
881
+ l = {
882
+ ...l,
880
883
  cancel: void 0,
881
884
  status: "error"
882
885
  }, n("change", {
883
- file: x(r),
884
- fileList: x(a.value),
886
+ file: x(l),
887
+ fileList: x(r.value),
885
888
  event: "cancel"
886
889
  });
887
- $(w.uid, r);
890
+ P(w.uid, l);
888
891
  }
889
892
  } else {
890
- let r = x(
891
- a.value.find((f) => f.uid === w.uid)
893
+ let l = x(
894
+ r.value.find((f) => f.uid === w.uid)
892
895
  );
893
- if (r) {
894
- if (w.chunk_uid && ((ge = r.chunks) != null && ge.length) && r.chunks.length > 1) {
895
- const f = r.chunks.findIndex(
896
+ if (l) {
897
+ if (w.chunk_uid && ((ge = l.chunks) != null && ge.length) && l.chunks.length > 1) {
898
+ const f = l.chunks.findIndex(
896
899
  (I) => I.uid === w.chunk_uid
897
900
  );
898
- r.chunks[f] && (r.chunks[f] = {
899
- ...r.chunks[f],
901
+ l.chunks[f] && (l.chunks[f] = {
902
+ ...l.chunks[f],
900
903
  cancel: void 0,
901
904
  status: "waiting"
902
905
  });
903
906
  }
904
- r = {
905
- ...r,
907
+ l = {
908
+ ...l,
906
909
  cancel: void 0,
907
910
  status: "error",
908
911
  error: v,
909
912
  percent: 0
910
913
  }, n("change", {
911
- file: x(r),
912
- fileList: x(a.value),
914
+ file: x(l),
915
+ fileList: x(r.value),
913
916
  event: "failed"
914
- }), $(w.uid, r);
917
+ }), P(w.uid, l);
915
918
  }
916
919
  }
917
920
  }
918
921
  }
919
922
  }
920
923
  }
921
- }, Te = async (i) => {
922
- if (i.uid && a.value)
923
- return $(i.uid, { status: "waiting" }), n("resetRequest", i), Y(i);
924
924
  }, Re = async (i) => {
925
- if (i.uid && a.value) {
926
- const h = x(a.value ?? []), k = h.findIndex((C) => C.uid === i.uid);
927
- k > -1 && h[k] && (h.splice(k, 1), a.value = h, n("remove", i), n("change", {
925
+ if (i.uid && r.value)
926
+ return P(i.uid, { status: "waiting" }), n("resetRequest", i), Y(i);
927
+ }, Se = async (i) => {
928
+ if (i.uid && r.value) {
929
+ const h = x(r.value ?? []), k = h.findIndex((C) => C.uid === i.uid);
930
+ k > -1 && h[k] && (h.splice(k, 1), r.value = h, n("remove", i), n("change", {
928
931
  file: x(i),
929
- fileList: x(a.value),
932
+ fileList: x(r.value),
930
933
  event: "remove"
931
934
  }));
932
935
  }
933
- }, Se = (i) => !!((o.parallelUpload || !X.value.length) && (i.status === "paused" || i.status === "error" || (!o.uploadOnSelect || o.listType === "image") && i.status === "waiting")), $e = _(() => {
936
+ }, $e = (i) => !!((o.parallelUpload || !X.value.length) && (i.status === "paused" || i.status === "error" || (!o.uploadOnSelect || o.listType === "image") && i.status === "waiting")), Pe = _(() => {
934
937
  switch (o.size) {
935
938
  case "xlg":
936
939
  return "md";
@@ -938,17 +941,17 @@ const Lt = /* @__PURE__ */ D({
938
941
  return "sm";
939
942
  }
940
943
  });
941
- Me(() => {
942
- (o.parallelUpload && te.value.length || !X.value.length) && te.value.forEach(Y), (a.value || []).forEach((i, h) => {
944
+ Ne(() => {
945
+ (o.parallelUpload && te.value.length || !X.value.length) && te.value.forEach(Y), (r.value || []).forEach((i, h) => {
943
946
  typeof document > "u" || typeof window > "u" || !window.FileReader || !window.File || !(i.originFileObj instanceof File || i.originFileObj instanceof Blob) || i.thumbUrl !== void 0 || (i.thumbUrl = "", ht(i.originFileObj).then((k) => {
944
947
  const C = k || "";
945
- C !== i.thumbUrl && $(i == null ? void 0 : i.uid, {
948
+ C !== i.thumbUrl && P(i == null ? void 0 : i.uid, {
946
949
  thumbUrl: C
947
950
  });
948
951
  }));
949
952
  });
950
953
  });
951
- const Pe = _(() => {
954
+ const Be = _(() => {
952
955
  switch (o.size) {
953
956
  case "xlg":
954
957
  return "sm";
@@ -962,15 +965,15 @@ const Lt = /* @__PURE__ */ D({
962
965
  attrs: p,
963
966
  slots: c,
964
967
  emit: n,
965
- fileList: Ne(a),
966
- progressSize: Pe,
968
+ fileList: Ge(r),
969
+ progressSize: Be,
967
970
  uploadableFiles: te,
968
971
  uploadingFiles: X,
969
972
  createRequest: Y,
970
- resetRequest: Te,
971
- canRunUpload: Se,
972
- remove: Re,
973
- goSize: $e,
973
+ resetRequest: Re,
974
+ canRunUpload: $e,
975
+ remove: Se,
976
+ goSize: Pe,
974
977
  addFiles: me
975
978
  };
976
979
  return Ze(se), t(se), (i, h) => (b(), O(pe, null, [
@@ -979,16 +982,17 @@ const Lt = /* @__PURE__ */ D({
979
982
  multiple: i.multiple,
980
983
  directory: i.directory,
981
984
  disabled: i.disabled,
982
- accept: S.value,
983
- onAddFiles: me
985
+ accept: $.value,
986
+ onAddFiles: me,
987
+ class: S(i.triggerCls)
984
988
  }, {
985
989
  default: Q((k) => [
986
990
  ae(i.$slots, "default", re(le(k)))
987
991
  ]),
988
992
  _: 3
989
- }, 8, ["multiple", "directory", "disabled", "accept"])),
993
+ }, 8, ["multiple", "directory", "disabled", "accept", "class"])),
990
994
  ae(i.$slots, "list", re(le(se)), () => [
991
- E(ut)
995
+ j(ut)
992
996
  ])
993
997
  ], 64));
994
998
  }
@@ -999,10 +1003,10 @@ export {
999
1003
  gt as a,
1000
1004
  Z as b,
1001
1005
  F as c,
1002
- ze as d,
1003
- Fe as e,
1006
+ Fe as d,
1007
+ Ie as e,
1004
1008
  st as f,
1005
1009
  K as i,
1006
1010
  Ze as p,
1007
- xe as u
1011
+ _e as u
1008
1012
  };