@pantograph/vue 0.24.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.
- package/dist/ActionButton/index.js +1 -1
- package/dist/{ActionButton.vue_vue_type_script_setup_true_lang-jhaE9j9X.js → ActionButton.vue_vue_type_script_setup_true_lang-CZTRz3hl.js} +2 -2
- package/dist/Alert/index.js +1 -1
- package/dist/{Alert.vue_vue_type_style_index_0_lang-89bXo9jG.js → Alert.vue_vue_type_style_index_0_lang-BNoDGnDR.js} +3 -3
- package/dist/Avatar/index.js +1 -1
- package/dist/{Avatar.vue_vue_type_style_index_0_lang-kaq1iN2X.js → Avatar.vue_vue_type_style_index_0_lang--OU5sgDR.js} +3 -3
- package/dist/AvatarGroup/index.js +1 -1
- package/dist/Badge/index.js +1 -1
- package/dist/{Badge.vue_vue_type_script_setup_true_lang-C6x4r-P7.js → Badge.vue_vue_type_script_setup_true_lang-ov_fhvSB.js} +2 -2
- package/dist/{BaseBadge.vue_vue_type_style_index_0_lang-CAdrPXmH.js → BaseBadge.vue_vue_type_style_index_0_lang-Cwko3Hlm.js} +1 -1
- package/dist/{BaseButton.vue_vue_type_style_index_0_lang-favf_C7t.js → BaseButton.vue_vue_type_style_index_0_lang-DV59KCrZ.js} +4 -4
- package/dist/Button/index.js +1 -1
- package/dist/{Button.vue_vue_type_script_setup_true_lang-DTZUw0pf.js → Button.vue_vue_type_script_setup_true_lang-CYE9whgK.js} +2 -2
- package/dist/Checkbox/index.js +1 -1
- package/dist/{Checkbox.vue_vue_type_style_index_0_lang-Dzren1pf.js → Checkbox.vue_vue_type_style_index_0_lang-B37LXBOT.js} +2 -2
- package/dist/CheckboxGroup/index.js +1 -1
- package/dist/Chip/index.js +2 -2
- package/dist/{Chip.vue_vue_type_style_index_0_lang-BPdU3Pgk.js → Chip.vue_vue_type_style_index_0_lang-B8XnEjIk.js} +2 -2
- package/dist/ChipGroup/index.js +1 -1
- package/dist/{ChipGroup.vue_vue_type_style_index_0_lang-D4A14AxB.js → ChipGroup.vue_vue_type_style_index_0_lang-CYarh7Jx.js} +2 -2
- package/dist/ColorPicker/index.js +1 -1
- package/dist/{ColorPicker.vue_vue_type_style_index_0_lang-CAzVW3da.js → ColorPicker.vue_vue_type_style_index_0_lang-BhznZQOS.js} +3 -3
- package/dist/ColorSwatch/index.js +1 -1
- package/dist/{ColorSwatch-LVdDBugO.js → ColorSwatch-GhXGfFR9.js} +1 -1
- package/dist/{ColorSwatch.vue_vue_type_style_index_0_lang-htOyCGxU.js → ColorSwatch.vue_vue_type_style_index_0_lang-CXh-dgyg.js} +3 -3
- package/dist/ColorSwatchGroup/index.js +1 -1
- package/dist/{ColorSwatchGroup.vue_vue_type_style_index_0_lang-Cv2D2XJ5.js → ColorSwatchGroup.vue_vue_type_style_index_0_lang-DMWiKVRG.js} +4 -4
- package/dist/ColorTrigger/index.js +1 -1
- package/dist/{ColorTrigger.vue_vue_type_style_index_0_lang-CNeFfFIE.js → ColorTrigger.vue_vue_type_style_index_0_lang-Cu8MO8RU.js} +3 -3
- package/dist/Combobox/index.js +1 -1
- package/dist/{Combobox.vue_vue_type_style_index_0_lang-Cj3maBpd.js → Combobox.vue_vue_type_style_index_0_lang-BsO5vzLB.js} +15 -15
- package/dist/Comment/CommentEditor.d.ts +14 -13
- package/dist/Comment/index.js +340 -1751
- package/dist/Comment/index.umd.cjs +1 -1
- package/dist/DataTable/index.js +1 -1
- package/dist/{DataTable.vue_vue_type_style_index_0_lang-CW2i09wf.js → DataTable.vue_vue_type_style_index_0_lang-DE97OF7f.js} +13 -13
- package/dist/DropZone/index.js +1 -1
- package/dist/{DropZone.vue_vue_type_style_index_0_lang-CF9qXlg0.js → DropZone.vue_vue_type_style_index_0_lang-gguAkRve.js} +2 -2
- package/dist/Empty/index.js +1 -1
- package/dist/{Empty.vue_vue_type_style_index_0_lang-BAbEBeZo.js → Empty.vue_vue_type_style_index_0_lang-YvYjr_zz.js} +1 -1
- package/dist/FloatButton/index.js +1 -1
- package/dist/{FloatButton.vue_vue_type_script_setup_true_lang-PYw1Yz9o.js → FloatButton.vue_vue_type_script_setup_true_lang-Ck9ilRKa.js} +2 -2
- package/dist/Form/index.js +1 -1
- package/dist/GOPicker/index.js +1 -1
- package/dist/{GOPicker.vue_vue_type_style_index_0_lang-DVZ2wSgV.js → GOPicker.vue_vue_type_style_index_0_lang-D9A9w-Pa.js} +11 -11
- package/dist/GraphicalObject/index.js +1 -1
- package/dist/{GraphicalObject.vue_vue_type_script_setup_true_lang-C949W-Ro.js → GraphicalObject.vue_vue_type_script_setup_true_lang-CEul2ZDZ.js} +3 -3
- package/dist/GraphicalObjectGroup/index.js +1 -1
- package/dist/{GraphicalObjectGroup.vue_vue_type_style_index_0_lang-CYUJM_Vv.js → GraphicalObjectGroup.vue_vue_type_style_index_0_lang-lN6Gzj19.js} +2 -2
- package/dist/Icon/index.js +1 -1
- package/dist/{Icon.vue_vue_type_style_index_0_lang-BUvEzzua.js → Icon.vue_vue_type_style_index_0_lang-BxthrfMq.js} +13 -13
- package/dist/IconButton/index.js +1 -1
- package/dist/{IconButton.vue_vue_type_script_setup_true_lang-BBnCpnF1.js → IconButton.vue_vue_type_script_setup_true_lang-BG-vYXAP.js} +2 -2
- package/dist/Image/index.js +1 -1
- package/dist/{Image.vue_vue_type_style_index_0_lang-UVOAmZXt.js → Image.vue_vue_type_style_index_0_lang-Bzg_B3NK.js} +2 -2
- package/dist/IndentLevel/index.js +1 -1
- package/dist/{IndentLevel.vue_vue_type_style_index_0_lang-59akXJBr.js → IndentLevel.vue_vue_type_style_index_0_lang-C7d2_3hI.js} +3 -3
- package/dist/Indicator/index.js +1 -1
- package/dist/{Indicator.vue_vue_type_script_setup_true_lang-AJV4EFOO.js → Indicator.vue_vue_type_script_setup_true_lang-DMYJ5Fn6.js} +2 -2
- package/dist/Input/index.js +1 -1
- package/dist/{Input.vue_vue_type_style_index_0_lang-D4aCRGW6.js → Input.vue_vue_type_style_index_0_lang-DkuxhdXR.js} +2 -2
- package/dist/Kbd/index.js +1 -1
- package/dist/{Kbd.vue_vue_type_style_index_0_lang-DpjuML9o.js → Kbd.vue_vue_type_style_index_0_lang-iUfSP9TC.js} +1 -1
- package/dist/Label/index.js +1 -1
- package/dist/Link/index.js +1 -1
- package/dist/{Link.vue_vue_type_style_index_0_lang-CsBkek74.js → Link.vue_vue_type_style_index_0_lang-TePg8XgW.js} +1 -1
- package/dist/Menu/index.js +1 -1
- package/dist/MenuItem/index.js +1 -1
- package/dist/{MenuItem.vue_vue_type_style_index_0_lang-DNlGDoyp.js → MenuItem.vue_vue_type_style_index_0_lang-D_lWThP0.js} +3 -3
- package/dist/Pagination/Pagination.d.ts +60 -0
- package/dist/Pagination/index.d.ts +2 -1
- package/dist/Pagination/index.js +6 -1
- package/dist/Pagination/index.umd.cjs +1 -1
- package/dist/Pagination.vue_vue_type_style_index_0_lang-CDaeQOJb.js +1 -0
- package/dist/Pagination.vue_vue_type_style_index_0_lang-D8oCaF6X.js +224 -0
- package/dist/Popover/index.js +1 -1
- package/dist/{Popover.vue_vue_type_style_index_0_lang-Bdu86hho.js → Popover.vue_vue_type_style_index_0_lang-DLboppFN.js} +1 -1
- package/dist/Progress/index.d.ts +3 -0
- package/dist/Progress/index.js +15 -0
- package/dist/Progress/index.umd.cjs +1 -0
- package/dist/Progress.vue_vue_type_style_index_0_lang-BEHOwYFc.js +447 -0
- package/dist/Progress.vue_vue_type_style_index_0_lang-WHi3Gv1W.js +1 -0
- package/dist/RadioGroup/index.js +1 -1
- package/dist/{RadioGroup.vue_vue_type_script_setup_true_lang-BVfQx8wD.js → RadioGroup.vue_vue_type_script_setup_true_lang-BEPTbeyN.js} +2 -2
- package/dist/ScrollContainer/index.js +1 -1
- package/dist/{ScrollContainer.vue_vue_type_style_index_0_lang-DGUSuq_n.js → ScrollContainer.vue_vue_type_style_index_0_lang-DqLbpFbD.js} +1 -1
- package/dist/Segmented/index.js +1 -1
- package/dist/{Segmented.vue_vue_type_style_index_0_lang-MoP3QO8x.js → Segmented.vue_vue_type_style_index_0_lang-B52Fuc2U.js} +1 -1
- package/dist/Select/index.js +1 -1
- package/dist/{Select.vue_vue_type_style_index_0_lang-D-dLDaBy.js → Select.vue_vue_type_style_index_0_lang-NsFWEuv3.js} +7 -7
- package/dist/Shortcut/index.js +1 -1
- package/dist/{Shortcut.vue_vue_type_style_index_0_lang-BXy0S1__.js → Shortcut.vue_vue_type_style_index_0_lang-D0pRaguA.js} +2 -2
- package/dist/Spinner/index.js +1 -1
- package/dist/{Spinner.vue_vue_type_style_index_0_lang-BacaASPe.js → Spinner.vue_vue_type_style_index_0_lang-Bx_MQ7lE.js} +1 -1
- package/dist/SubMenu/index.js +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/{Switch.vue_vue_type_style_index_0_lang--RYeL-jW.js → Switch.vue_vue_type_style_index_0_lang-CnwcbtZs.js} +2 -2
- package/dist/{THead.vue_vue_type_style_index_0_lang-DfOi9-Nh.js → THead.vue_vue_type_style_index_0_lang-BEFUWFjk.js} +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/Textarea/index.js +1 -1
- package/dist/{Textarea.vue_vue_type_style_index_0_lang-CPto-5VY.js → Textarea.vue_vue_type_style_index_0_lang-DPWaIFuD.js} +3 -3
- package/dist/Tree/index.js +1 -1
- package/dist/{Tree.vue_vue_type_style_index_0_lang-D-mTy1Es.js → Tree.vue_vue_type_style_index_0_lang-Dh0qoB5W.js} +5 -5
- package/dist/Upload/UploadTrigger.d.ts +2 -2
- package/dist/Upload/index.d.ts +4 -1
- package/dist/Upload/index.js +14 -1
- package/dist/Upload/index.umd.cjs +1 -1
- package/dist/Upload/types.d.ts +4 -1
- package/dist/Upload.vue_vue_type_style_index_0_lang-DC0jVRjM.js +1012 -0
- package/dist/Upload.vue_vue_type_style_index_0_lang-oVgy1020.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +198 -171
- package/dist/index.umd.cjs +1 -1
- package/dist/{sortBy-BoHPhPoZ.js → sortBy-CUiSA46K.js} +16 -16
- package/dist/style/index.css +1 -1
- package/dist/{uniq-iuU6YkEW.js → uniq-Bk9D4jYg.js} +1 -1
- package/dist/{useInputDataStates-CJoP9BXy.js → useInputDataStates-RRZVY4Vg.js} +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +6 -1
|
@@ -0,0 +1,1012 @@
|
|
|
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
|
+
import { createContext as ke } from "reka-ui";
|
|
3
|
+
import { getBemBlock as Ve, getBemElement as U, usePCId as ce, normCls as be, generateVariantClassList as N } from "@pantograph/utils";
|
|
4
|
+
import { a as ee, c as J, f as We } from "./index-BTuMaS--.js";
|
|
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 we } from "class-variance-authority";
|
|
7
|
+
import { _ as xe } from "./Progress.vue_vue_type_style_index_0_lang-BEHOwYFc.js";
|
|
8
|
+
import { _ as Ke } from "./FloatButton.vue_vue_type_script_setup_true_lang-Ck9ilRKa.js";
|
|
9
|
+
import { _ as G } from "./IconButton.vue_vue_type_script_setup_true_lang-BG-vYXAP.js";
|
|
10
|
+
import { _ as Xe } from "./Image.vue_vue_type_style_index_0_lang-Bzg_B3NK.js";
|
|
11
|
+
import { g as q } from "./options-Bh1s18jm.js";
|
|
12
|
+
import { _ as Ye } from "./GraphicalObject.vue_vue_type_script_setup_true_lang-CEul2ZDZ.js";
|
|
13
|
+
const _e = Ve("upload"), Z = U(_e, "list"), F = U(Z, "item"), [K, Ze] = ke("Upload"), Ce = (s, t) => {
|
|
14
|
+
if (s && t) {
|
|
15
|
+
const e = Array.isArray(t) ? t : t.split(","), o = s.name || "", n = s.type || "", c = n.replace(/\/.*$/, "");
|
|
16
|
+
return e.some((p) => {
|
|
17
|
+
const m = p.trim();
|
|
18
|
+
if (/^\*(?<temp1>\/\*)?$/.test(p))
|
|
19
|
+
return !0;
|
|
20
|
+
if (m.charAt(0) === ".") {
|
|
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
|
+
}
|
|
25
|
+
return /\/\*$/.test(m) ? c === m.replace(/\/.*$/, "") : !!(n === m || /^\w+$/.test(m));
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return !0;
|
|
29
|
+
}, Qe = (s, t, e = 1 * 1024 * 1024) => {
|
|
30
|
+
const o = [];
|
|
31
|
+
let n = 0, c = 0;
|
|
32
|
+
for (; n < s.size; ) {
|
|
33
|
+
const p = Math.min(n + e, s.size), m = s.slice(n, p);
|
|
34
|
+
o.push({
|
|
35
|
+
chunk: m,
|
|
36
|
+
chunkSize: p - n,
|
|
37
|
+
index: c,
|
|
38
|
+
uid: t(),
|
|
39
|
+
status: "waiting"
|
|
40
|
+
}), n = p, c++;
|
|
41
|
+
}
|
|
42
|
+
return o;
|
|
43
|
+
}, ze = (s, { getUid: t, chunkFile: e, chunkSize: o }) => {
|
|
44
|
+
if (ee(s)) {
|
|
45
|
+
let n;
|
|
46
|
+
if (s instanceof File)
|
|
47
|
+
n = s;
|
|
48
|
+
else
|
|
49
|
+
try {
|
|
50
|
+
n = new File(
|
|
51
|
+
[s],
|
|
52
|
+
s.name ?? "",
|
|
53
|
+
{
|
|
54
|
+
type: s.type ?? ""
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
} catch {
|
|
58
|
+
n = new Blob([s], {
|
|
59
|
+
type: s.type ?? ""
|
|
60
|
+
}), n.lastModified = (/* @__PURE__ */ new Date()).getTime(), n.name = s.name ?? "", n.webkitRelativePath = "";
|
|
61
|
+
}
|
|
62
|
+
if (ee(n) && n instanceof Blob) {
|
|
63
|
+
let c = [];
|
|
64
|
+
return e && (c = Qe(
|
|
65
|
+
n,
|
|
66
|
+
() => (t == null ? void 0 : t(!0)) ?? ce(void 0, !0),
|
|
67
|
+
o
|
|
68
|
+
)), {
|
|
69
|
+
uid: s.uid ?? (t == null ? void 0 : t()) ?? ce(void 0, !0),
|
|
70
|
+
originFileObj: n,
|
|
71
|
+
status: "waiting",
|
|
72
|
+
chunks: c != null && c.length && (c == null ? void 0 : c.length) > 1 ? c : void 0,
|
|
73
|
+
chunksCount: c != null && c.length && (c == null ? void 0 : c.length) > 1 ? c.length : void 0,
|
|
74
|
+
name: n == null ? void 0 : n.name,
|
|
75
|
+
type: n == null ? void 0 : n.type,
|
|
76
|
+
size: n == null ? void 0 : n.size,
|
|
77
|
+
lastModified: n == null ? void 0 : n.lastModified,
|
|
78
|
+
thumbUrl: void 0
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}, et = (s, t) => {
|
|
83
|
+
if (ee(s))
|
|
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
|
+
other: {
|
|
87
|
+
icon: "tabler:file-text",
|
|
88
|
+
fg: "primary",
|
|
89
|
+
bg: "primary-subtle"
|
|
90
|
+
},
|
|
91
|
+
text: {
|
|
92
|
+
icon: "tabler:file-typography",
|
|
93
|
+
fg: "primary",
|
|
94
|
+
bg: "primary-subtle"
|
|
95
|
+
},
|
|
96
|
+
image: {
|
|
97
|
+
icon: "tabler:photo",
|
|
98
|
+
fg: "primary",
|
|
99
|
+
bg: "primary-subtle"
|
|
100
|
+
},
|
|
101
|
+
video: {
|
|
102
|
+
icon: "tabler:video",
|
|
103
|
+
fg: "primary",
|
|
104
|
+
bg: "primary-subtle"
|
|
105
|
+
},
|
|
106
|
+
zip: {
|
|
107
|
+
icon: "tabler:file-zip",
|
|
108
|
+
fg: "primary",
|
|
109
|
+
bg: "primary-subtle"
|
|
110
|
+
},
|
|
111
|
+
pdf: {
|
|
112
|
+
icon: "tabler:file-type-pdf",
|
|
113
|
+
fg: "red",
|
|
114
|
+
bg: "red-subtle"
|
|
115
|
+
},
|
|
116
|
+
document: {
|
|
117
|
+
icon: "tabler:file-type-docx",
|
|
118
|
+
fg: "primary",
|
|
119
|
+
bg: "primary-subtle"
|
|
120
|
+
},
|
|
121
|
+
excel: {
|
|
122
|
+
icon: "tabler:file-type-csv",
|
|
123
|
+
fg: "green",
|
|
124
|
+
bg: "green-subtle"
|
|
125
|
+
}
|
|
126
|
+
}, nt = {
|
|
127
|
+
image: [
|
|
128
|
+
"3fr",
|
|
129
|
+
"arw",
|
|
130
|
+
"bmp",
|
|
131
|
+
"dib",
|
|
132
|
+
"cr2",
|
|
133
|
+
"crw",
|
|
134
|
+
"dng",
|
|
135
|
+
"gif",
|
|
136
|
+
"heic",
|
|
137
|
+
"heif",
|
|
138
|
+
"ico",
|
|
139
|
+
"jfif",
|
|
140
|
+
"jpe",
|
|
141
|
+
"jpeg",
|
|
142
|
+
"jpg",
|
|
143
|
+
"jp2",
|
|
144
|
+
"nef",
|
|
145
|
+
"png",
|
|
146
|
+
"raf",
|
|
147
|
+
"raw",
|
|
148
|
+
"rw2",
|
|
149
|
+
"sr2",
|
|
150
|
+
"svg",
|
|
151
|
+
"svg",
|
|
152
|
+
"tga",
|
|
153
|
+
"tif",
|
|
154
|
+
"tiff",
|
|
155
|
+
"wdp",
|
|
156
|
+
"webp"
|
|
157
|
+
],
|
|
158
|
+
video: [
|
|
159
|
+
"3g2",
|
|
160
|
+
"3gp2",
|
|
161
|
+
"3gp",
|
|
162
|
+
"3gpp",
|
|
163
|
+
"asf",
|
|
164
|
+
"asx",
|
|
165
|
+
"avi",
|
|
166
|
+
"flv",
|
|
167
|
+
"m1v",
|
|
168
|
+
"m2v",
|
|
169
|
+
"mod",
|
|
170
|
+
"mp2v",
|
|
171
|
+
"mpa",
|
|
172
|
+
"mpe",
|
|
173
|
+
"mpv2",
|
|
174
|
+
"mpeg",
|
|
175
|
+
"mpegvideo",
|
|
176
|
+
"m2t",
|
|
177
|
+
"m2ts",
|
|
178
|
+
"tts",
|
|
179
|
+
"ts",
|
|
180
|
+
"mkv",
|
|
181
|
+
"mp4v",
|
|
182
|
+
"mp4",
|
|
183
|
+
"mov",
|
|
184
|
+
"m4v",
|
|
185
|
+
"mjpeg",
|
|
186
|
+
"mts",
|
|
187
|
+
"ogv",
|
|
188
|
+
"webm",
|
|
189
|
+
"wm",
|
|
190
|
+
"wmv",
|
|
191
|
+
"wmx",
|
|
192
|
+
"wvx"
|
|
193
|
+
],
|
|
194
|
+
text: [
|
|
195
|
+
"addin",
|
|
196
|
+
"dtsconfig",
|
|
197
|
+
"vssettings",
|
|
198
|
+
"vstemplate",
|
|
199
|
+
"xml",
|
|
200
|
+
"xrm-ms",
|
|
201
|
+
"xsd",
|
|
202
|
+
"xsl",
|
|
203
|
+
"cd",
|
|
204
|
+
"cs",
|
|
205
|
+
"csproj",
|
|
206
|
+
"iss",
|
|
207
|
+
"py",
|
|
208
|
+
"pyw",
|
|
209
|
+
"rc",
|
|
210
|
+
"rc2",
|
|
211
|
+
"rct",
|
|
212
|
+
"sln",
|
|
213
|
+
"srt",
|
|
214
|
+
"txt",
|
|
215
|
+
"user",
|
|
216
|
+
"vb",
|
|
217
|
+
"vbproj",
|
|
218
|
+
"vdp",
|
|
219
|
+
"vdproj",
|
|
220
|
+
"vspscc",
|
|
221
|
+
"vsscc",
|
|
222
|
+
"vssscc",
|
|
223
|
+
"contact",
|
|
224
|
+
"css",
|
|
225
|
+
"group",
|
|
226
|
+
"html",
|
|
227
|
+
"htm",
|
|
228
|
+
"shtml",
|
|
229
|
+
"htc",
|
|
230
|
+
"ics",
|
|
231
|
+
"iqy",
|
|
232
|
+
"odc",
|
|
233
|
+
"sct",
|
|
234
|
+
"wsc",
|
|
235
|
+
"vcf",
|
|
236
|
+
"vtt"
|
|
237
|
+
],
|
|
238
|
+
zip: ["zip", "7z", "rar", "tar.gz"],
|
|
239
|
+
document: ["doc", "docx", "odt", "rtf"],
|
|
240
|
+
excel: ["xls", "xlsx", "csv", "ods"],
|
|
241
|
+
pdf: ["pdf"]
|
|
242
|
+
}, Ue = (s) => {
|
|
243
|
+
if (s) {
|
|
244
|
+
for (const [t, e] of Object.entries(nt))
|
|
245
|
+
if (e.includes(s.toLowerCase()))
|
|
246
|
+
return t;
|
|
247
|
+
}
|
|
248
|
+
return "other";
|
|
249
|
+
}, Le = (s = "") => {
|
|
250
|
+
const t = s.split("/"), o = t[t.length - 1].split(/#|\?/)[0];
|
|
251
|
+
return (/\.[^./\\]*$/.exec(o) || [""])[0];
|
|
252
|
+
}, de = (s) => {
|
|
253
|
+
var t, e, o;
|
|
254
|
+
return (o = (e = (t = s == null ? void 0 : s.split) == null ? void 0 : t.call(s, "/")) == null ? void 0 : e.pop) == null ? void 0 : o.call(e);
|
|
255
|
+
}, ot = (s) => {
|
|
256
|
+
var e;
|
|
257
|
+
let t = de((s == null ? void 0 : s.type) || ((e = s == null ? void 0 : s.originFileObj) == null ? void 0 : e.type));
|
|
258
|
+
if (s != null && s.url && !t)
|
|
259
|
+
try {
|
|
260
|
+
t = Le(s == null ? void 0 : s.url);
|
|
261
|
+
} catch {
|
|
262
|
+
}
|
|
263
|
+
return t;
|
|
264
|
+
}, ue = (s) => Ue(s) === "image", Te = (s) => {
|
|
265
|
+
if (s.type && !s.thumbUrl)
|
|
266
|
+
return ue(de(s.type));
|
|
267
|
+
const t = s.thumbUrl || s.url || "", e = Le(t);
|
|
268
|
+
return /^data:image\//.test(t) || ue(e) ? !0 : !(/^data:/.test(t) || e);
|
|
269
|
+
}, it = /* @__PURE__ */ D({
|
|
270
|
+
...q("UploadListItemImage"),
|
|
271
|
+
__name: "UploadListItemImage",
|
|
272
|
+
setup(s) {
|
|
273
|
+
const t = K(), e = fe(), o = () => {
|
|
274
|
+
var n, c, p;
|
|
275
|
+
J((n = e.props.uploadFile) == null ? void 0 : n.cancel) && ((p = (c = e.props.uploadFile).cancel) == null || p.call(c)), t.remove(e.props.uploadFile);
|
|
276
|
+
};
|
|
277
|
+
return (n, c) => {
|
|
278
|
+
var p;
|
|
279
|
+
return b(), O(pe, null, [
|
|
280
|
+
a(e).props.uploadFile.status !== "waiting" ? (b(), z(Xe, {
|
|
281
|
+
key: 0,
|
|
282
|
+
src: a(Te)(a(e).props.uploadFile) ? a(e).props.uploadFile.thumbUrl ?? a(e).props.uploadFile.url : void 0,
|
|
283
|
+
aspectRatio: "1:1",
|
|
284
|
+
class: S(a(U)(a(F), "image")),
|
|
285
|
+
sizeRange: "xsm",
|
|
286
|
+
alt: a(e).label.value,
|
|
287
|
+
hovered: a(e).props.uploadFile.status === "uploading",
|
|
288
|
+
width: "100%"
|
|
289
|
+
}, Ae({ _: 2 }, [
|
|
290
|
+
["error", "done"].includes(a(e).props.uploadFile.status) ? {
|
|
291
|
+
name: "actions",
|
|
292
|
+
fn: Q(() => [
|
|
293
|
+
a(e).props.uploadFile.status === "done" ? (b(), z(G, {
|
|
294
|
+
key: 0,
|
|
295
|
+
color: "neutral",
|
|
296
|
+
type: "ghost",
|
|
297
|
+
icon: "tabler:eye",
|
|
298
|
+
size: "sm",
|
|
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
|
+
key: 1,
|
|
302
|
+
color: "neutral",
|
|
303
|
+
type: "ghost",
|
|
304
|
+
icon: "tabler:reload",
|
|
305
|
+
size: "sm",
|
|
306
|
+
onClick: c[1] || (c[1] = (m) => a(t).resetRequest(a(e).props.uploadFile))
|
|
307
|
+
})) : R("", !0)
|
|
308
|
+
]),
|
|
309
|
+
key: "0"
|
|
310
|
+
} : void 0
|
|
311
|
+
]), 1032, ["src", "class", "alt", "hovered"])) : R("", !0),
|
|
312
|
+
["uploading", "waiting"].includes(a(e).props.uploadFile.status) ? (b(), z(xe, {
|
|
313
|
+
key: 1,
|
|
314
|
+
type: "circle",
|
|
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
|
+
}, null, 8, ["size", "class", "indeterminate", "percent"])) : R("", !0),
|
|
320
|
+
j(Ke, {
|
|
321
|
+
class: S(
|
|
322
|
+
a(be)(a(U)(a(F), "cancel"), "pantograph-tokens pantograph-dark")
|
|
323
|
+
),
|
|
324
|
+
color: "neutral",
|
|
325
|
+
icon: "tabler:x",
|
|
326
|
+
size: "sm",
|
|
327
|
+
onClick: o
|
|
328
|
+
}, null, 8, ["class"])
|
|
329
|
+
], 64);
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
}), at = /* @__PURE__ */ D({
|
|
333
|
+
...q("UploadFileGO"),
|
|
334
|
+
__name: "UploadFileGO",
|
|
335
|
+
setup(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
|
+
const g = (y = (u = e.slots).go) == null ? void 0 : y.call(u, { uploadFile: t.props.uploadFile });
|
|
339
|
+
return A(g) ? Te(t.props.uploadFile) ? V("img", {
|
|
340
|
+
class: U(F, "thumb"),
|
|
341
|
+
alt: t.props.uploadFile.name ?? "",
|
|
342
|
+
src: ((L = t.props.uploadFile) == null ? void 0 : L.thumbUrl) ?? (($ = t.props.uploadFile) == null ? void 0 : $.url)
|
|
343
|
+
}) : null : g;
|
|
344
|
+
}, d = () => {
|
|
345
|
+
var u, y;
|
|
346
|
+
const g = (y = (u = e.slots).goIcon) == null ? void 0 : y.call(u, { uploadFile: t.props.uploadFile });
|
|
347
|
+
return A(g) ? null : g;
|
|
348
|
+
}, r = () => V(
|
|
349
|
+
Ye,
|
|
350
|
+
{
|
|
351
|
+
size: e.goSize.value,
|
|
352
|
+
icon: n.value,
|
|
353
|
+
fg: c.value,
|
|
354
|
+
bg: p.value
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
default: m,
|
|
358
|
+
icon: d
|
|
359
|
+
}
|
|
360
|
+
);
|
|
361
|
+
return (g, u) => (b(), z(r));
|
|
362
|
+
}
|
|
363
|
+
}), rt = /* @__PURE__ */ D({
|
|
364
|
+
...q("UploadListItemCard"),
|
|
365
|
+
__name: "UploadListItemCard",
|
|
366
|
+
setup(s) {
|
|
367
|
+
const t = K(), e = fe(), o = () => {
|
|
368
|
+
var g, u;
|
|
369
|
+
const d = (u = (g = t.slots).description) == null ? void 0 : u.call(g, { uploadFile: e.props.uploadFile });
|
|
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
|
+
}, n = () => {
|
|
374
|
+
var r, g;
|
|
375
|
+
const d = (g = (r = t.slots).title) == null ? void 0 : g.call(r, { uploadFile: e.props.uploadFile });
|
|
376
|
+
return A(d) ? e.label.value : d;
|
|
377
|
+
}, c = () => {
|
|
378
|
+
var d;
|
|
379
|
+
if (J(t.props.onDownload))
|
|
380
|
+
return t.props.onDownload(e.props.uploadFile);
|
|
381
|
+
if ((d = e.props.uploadFile) != null && d.url && typeof window < "u")
|
|
382
|
+
return window.open(e.props.uploadFile.url);
|
|
383
|
+
}, p = _(() => {
|
|
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
|
+
const g = (y = (u = t.slots) == null ? void 0 : u.actions) == null ? void 0 : y.call(u, {
|
|
389
|
+
...t,
|
|
390
|
+
uploadFile: e.props.uploadFile,
|
|
391
|
+
downloadFile: c
|
|
392
|
+
});
|
|
393
|
+
return A(g) ? ($ = (L = r.slots) == null ? void 0 : L.default) == null ? void 0 : $.call(L, {}) : g;
|
|
394
|
+
};
|
|
395
|
+
return (d, r) => {
|
|
396
|
+
var g;
|
|
397
|
+
return b(), O(pe, null, [
|
|
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
|
+
key: 2,
|
|
401
|
+
class: S(a(U)(a(F), "content"))
|
|
402
|
+
}, [
|
|
403
|
+
ye("div", {
|
|
404
|
+
class: S(a(U)(a(F), "title"))
|
|
405
|
+
}, [
|
|
406
|
+
j(n)
|
|
407
|
+
], 2),
|
|
408
|
+
a(e).props.uploadFile.status === "error" ? (b(), z(He, {
|
|
409
|
+
key: 0,
|
|
410
|
+
message: "Failed",
|
|
411
|
+
status: "error"
|
|
412
|
+
})) : a(t).props.size !== "md" ? (b(), z(o, { key: 1 })) : R("", !0)
|
|
413
|
+
], 2)) : (b(), z(xe, {
|
|
414
|
+
key: 1,
|
|
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
|
+
helperText: p.value
|
|
419
|
+
}, {
|
|
420
|
+
label: Q(() => [
|
|
421
|
+
j(n)
|
|
422
|
+
]),
|
|
423
|
+
_: 1
|
|
424
|
+
}, 8, ["class", "percent", "label", "helperText"])),
|
|
425
|
+
j(m, null, {
|
|
426
|
+
default: Q(() => {
|
|
427
|
+
var u;
|
|
428
|
+
return [
|
|
429
|
+
a(e).props.uploadFile.status === "done" ? (b(), z(G, {
|
|
430
|
+
key: 0,
|
|
431
|
+
icon: "tabler:download",
|
|
432
|
+
size: "sm",
|
|
433
|
+
type: "ghost",
|
|
434
|
+
color: "neutral",
|
|
435
|
+
onClick: c
|
|
436
|
+
})) : R("", !0),
|
|
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
|
+
key: 1,
|
|
439
|
+
icon: "tabler:pause",
|
|
440
|
+
size: "sm",
|
|
441
|
+
type: "ghost",
|
|
442
|
+
color: "neutral",
|
|
443
|
+
onClick: a(e).props.uploadFile.cancel
|
|
444
|
+
}, null, 8, ["onClick"])) : a(t).canRunUpload(a(e).props.uploadFile) ? (b(), z(G, {
|
|
445
|
+
key: 2,
|
|
446
|
+
icon: ["paused", "waiting"].includes(a(e).props.uploadFile.status) ? "tabler:player-play" : "tabler:reload",
|
|
447
|
+
size: "sm",
|
|
448
|
+
type: "ghost",
|
|
449
|
+
color: "neutral",
|
|
450
|
+
onClick: r[0] || (r[0] = (y) => a(t).resetRequest(a(e).props.uploadFile))
|
|
451
|
+
}, null, 8, ["icon"])) : R("", !0),
|
|
452
|
+
j(G, {
|
|
453
|
+
icon: ["done", "error"].includes(a(e).props.uploadFile.status) ? "tabler:trash" : "tabler:x",
|
|
454
|
+
size: "sm",
|
|
455
|
+
type: "ghost",
|
|
456
|
+
color: "neutral",
|
|
457
|
+
onClick: r[1] || (r[1] = (y) => a(t).remove(a(e).props.uploadFile))
|
|
458
|
+
}, null, 8, ["icon"])
|
|
459
|
+
];
|
|
460
|
+
}),
|
|
461
|
+
_: 1
|
|
462
|
+
})
|
|
463
|
+
], 64);
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
}), [fe, lt] = ke("UploadItem"), ct = /* @__PURE__ */ D({
|
|
467
|
+
...q("UploadListItem"),
|
|
468
|
+
__name: "UploadListItem",
|
|
469
|
+
props: {
|
|
470
|
+
uploadFile: {}
|
|
471
|
+
},
|
|
472
|
+
setup(s) {
|
|
473
|
+
const t = s, e = we(F, {
|
|
474
|
+
variants: {
|
|
475
|
+
size: N(Fe, F),
|
|
476
|
+
listType: N(
|
|
477
|
+
Ie,
|
|
478
|
+
F
|
|
479
|
+
),
|
|
480
|
+
type: N(st, F),
|
|
481
|
+
status: N(tt, F)
|
|
482
|
+
}
|
|
483
|
+
}), o = _(() => {
|
|
484
|
+
var p, m, d;
|
|
485
|
+
return ((p = t.uploadFile) == null ? void 0 : p.name) ?? ((d = (m = t.uploadFile) == null ? void 0 : m.originFileObj) == null ? void 0 : d.name);
|
|
486
|
+
}), n = K();
|
|
487
|
+
lt({
|
|
488
|
+
props: t,
|
|
489
|
+
label: o
|
|
490
|
+
});
|
|
491
|
+
const c = () => {
|
|
492
|
+
var m, d;
|
|
493
|
+
const p = (d = (m = n.slots).listItem) == null ? void 0 : d.call(m, { ...n, uploadFile: t.uploadFile });
|
|
494
|
+
return A(p) ? n.props.listType === "card" ? V(rt) : V(it) : p;
|
|
495
|
+
};
|
|
496
|
+
return (p, m) => {
|
|
497
|
+
var d;
|
|
498
|
+
return b(), O("div", {
|
|
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
|
+
status: (d = p.uploadFile) == null ? void 0 : d.status
|
|
505
|
+
})
|
|
506
|
+
)
|
|
507
|
+
}, [
|
|
508
|
+
j(c)
|
|
509
|
+
], 2);
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
}), ut = /* @__PURE__ */ D({
|
|
513
|
+
...q("UploadList"),
|
|
514
|
+
__name: "UploadList",
|
|
515
|
+
setup(s) {
|
|
516
|
+
const t = K(), e = we(Z, {
|
|
517
|
+
variants: {
|
|
518
|
+
size: N(Fe, Z),
|
|
519
|
+
listType: N(Ie, Z)
|
|
520
|
+
}
|
|
521
|
+
}), o = () => {
|
|
522
|
+
var c, p;
|
|
523
|
+
const n = (p = (c = t.slots).list) == null ? void 0 : p.call(c, t);
|
|
524
|
+
return A(n) ? t.fileList.value.map(
|
|
525
|
+
(m) => V(ct, { uploadFile: m, key: m.uid })
|
|
526
|
+
) : n;
|
|
527
|
+
};
|
|
528
|
+
return (n, c) => {
|
|
529
|
+
var p;
|
|
530
|
+
return (p = a(t).fileList.value) != null && p.length ? (b(), O("div", {
|
|
531
|
+
key: 0,
|
|
532
|
+
class: S(
|
|
533
|
+
a(e)({
|
|
534
|
+
size: a(t).props.size,
|
|
535
|
+
listType: a(t).props.listType
|
|
536
|
+
})
|
|
537
|
+
)
|
|
538
|
+
}, [
|
|
539
|
+
j(o)
|
|
540
|
+
], 2)) : R("", !0);
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
}), pt = (s) => new Promise((t) => {
|
|
544
|
+
s.file((e) => {
|
|
545
|
+
s.fullPath && !e.webkitRelativePath && Object.defineProperty(e, "webkitRelativePath", {
|
|
546
|
+
value: s.fullPath.replace(/^\//, ""),
|
|
547
|
+
writable: !1
|
|
548
|
+
}), t(e);
|
|
549
|
+
});
|
|
550
|
+
}), dt = (s) => {
|
|
551
|
+
const t = s.createReader(), e = [];
|
|
552
|
+
return new Promise((o) => {
|
|
553
|
+
const n = () => {
|
|
554
|
+
t.readEntries((c) => {
|
|
555
|
+
c.length === 0 ? o(e) : (e.push(...c), n());
|
|
556
|
+
});
|
|
557
|
+
};
|
|
558
|
+
n();
|
|
559
|
+
});
|
|
560
|
+
}, ft = async (s) => {
|
|
561
|
+
const t = [], e = async (o) => {
|
|
562
|
+
if (o.isFile) {
|
|
563
|
+
const n = await pt(o);
|
|
564
|
+
t.push(n);
|
|
565
|
+
} else if (o.isDirectory) {
|
|
566
|
+
const n = await dt(o);
|
|
567
|
+
await Promise.all(n.map(e));
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
return await Promise.all(
|
|
571
|
+
s.map((o) => {
|
|
572
|
+
var c;
|
|
573
|
+
const n = (c = o.webkitGetAsEntry) == null ? void 0 : c.call(o);
|
|
574
|
+
if (n)
|
|
575
|
+
return e(n);
|
|
576
|
+
})
|
|
577
|
+
), t;
|
|
578
|
+
}, mt = ["accept", "webkitdirectory", "multiple", "value"], gt = /* @__PURE__ */ D({
|
|
579
|
+
...q("UploadTrigger"),
|
|
580
|
+
__name: "UploadTrigger",
|
|
581
|
+
props: {
|
|
582
|
+
directory: { type: Boolean },
|
|
583
|
+
multiple: { type: Boolean },
|
|
584
|
+
disabled: { type: Boolean },
|
|
585
|
+
accept: {},
|
|
586
|
+
class: {}
|
|
587
|
+
},
|
|
588
|
+
emits: ["addFiles"],
|
|
589
|
+
setup(s, { emit: t }) {
|
|
590
|
+
const e = t, o = s, n = ie(), c = (u) => {
|
|
591
|
+
const { files: y } = u.target;
|
|
592
|
+
e("addFiles", Array.prototype.slice.call(y)), p.value && (p.value.value = "");
|
|
593
|
+
}, p = ie(), m = () => {
|
|
594
|
+
var u;
|
|
595
|
+
(u = p.value) == null || u.click();
|
|
596
|
+
}, d = (u) => {
|
|
597
|
+
u.key === "Enter" && m();
|
|
598
|
+
}, r = async (u) => {
|
|
599
|
+
if (u.preventDefault(), u.type === "dragover")
|
|
600
|
+
return;
|
|
601
|
+
let y = [];
|
|
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(
|
|
603
|
+
"addFiles",
|
|
604
|
+
y.filter((L) => Ce(L, o.accept))
|
|
605
|
+
);
|
|
606
|
+
}, g = _(() => o.disabled ? {} : {
|
|
607
|
+
onClick: m,
|
|
608
|
+
onKeydown: d,
|
|
609
|
+
onDrop: r,
|
|
610
|
+
onDragover: r
|
|
611
|
+
});
|
|
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" }))),
|
|
616
|
+
ye("input", {
|
|
617
|
+
type: "file",
|
|
618
|
+
accept: u.accept,
|
|
619
|
+
webkitdirectory: u.directory,
|
|
620
|
+
multiple: u.multiple,
|
|
621
|
+
value: n.value,
|
|
622
|
+
onChange: c,
|
|
623
|
+
ref_key: "inputRef",
|
|
624
|
+
ref: p,
|
|
625
|
+
style: { display: "none" }
|
|
626
|
+
}, null, 40, mt)
|
|
627
|
+
], 16));
|
|
628
|
+
}
|
|
629
|
+
}), E = 200;
|
|
630
|
+
function ht(s) {
|
|
631
|
+
return new Promise((t) => {
|
|
632
|
+
if (!s.type || !ue(de(s.type))) {
|
|
633
|
+
t("");
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
const e = document.createElement("canvas");
|
|
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);
|
|
638
|
+
const o = e.getContext("2d"), n = new Image();
|
|
639
|
+
if (n.onload = () => {
|
|
640
|
+
const { width: c, height: p } = n;
|
|
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);
|
|
643
|
+
const u = e.toDataURL();
|
|
644
|
+
document.body.removeChild(e), t(u);
|
|
645
|
+
}, n.crossOrigin = "anonymous", s.type.startsWith("image/svg+xml")) {
|
|
646
|
+
const c = new FileReader();
|
|
647
|
+
c.addEventListener("load", () => {
|
|
648
|
+
c.result && (n.src = c.result);
|
|
649
|
+
}), c.readAsDataURL(s);
|
|
650
|
+
} else
|
|
651
|
+
n.src = window.URL.createObjectURL(s);
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
const Lt = /* @__PURE__ */ D({
|
|
655
|
+
...q("Upload", !1),
|
|
656
|
+
__name: "Upload",
|
|
657
|
+
props: {
|
|
658
|
+
onDownload: {},
|
|
659
|
+
parallelUpload: { type: Boolean },
|
|
660
|
+
uploadOnSelect: { type: Boolean, default: !0 },
|
|
661
|
+
pausableChunked: { type: Boolean },
|
|
662
|
+
noTrigger: { type: Boolean },
|
|
663
|
+
fileList: {},
|
|
664
|
+
size: { default: "md" },
|
|
665
|
+
chunkSize: {},
|
|
666
|
+
listType: { default: "card" },
|
|
667
|
+
type: { default: "outline" },
|
|
668
|
+
go: { type: Boolean, default: !0 },
|
|
669
|
+
maxCount: {},
|
|
670
|
+
action: {},
|
|
671
|
+
getFileIcon: {},
|
|
672
|
+
triggerCls: {},
|
|
673
|
+
directory: { type: Boolean },
|
|
674
|
+
multiple: { type: Boolean, default: !0 },
|
|
675
|
+
disabled: { type: Boolean },
|
|
676
|
+
accept: {}
|
|
677
|
+
},
|
|
678
|
+
emits: ["update:fileList", "change", "preview", "createRequest", "resetRequest", "remove"],
|
|
679
|
+
setup(s, { expose: t, emit: e }) {
|
|
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);
|
|
681
|
+
let u = !1;
|
|
682
|
+
ve(
|
|
683
|
+
() => o.fileList,
|
|
684
|
+
(i) => {
|
|
685
|
+
var h, k;
|
|
686
|
+
u = !0, r.value = (k = (h = i ?? []) == null ? void 0 : h.map) == null ? void 0 : k.call(h, (C) => {
|
|
687
|
+
if (C && ee(C))
|
|
688
|
+
return et(C, {
|
|
689
|
+
getUid: d,
|
|
690
|
+
chunkFile: g.value,
|
|
691
|
+
chunkSize: o.chunkSize
|
|
692
|
+
});
|
|
693
|
+
}).filter(Boolean), Me(() => u = !1);
|
|
694
|
+
},
|
|
695
|
+
{ immediate: !0, deep: !0 }
|
|
696
|
+
), ve(
|
|
697
|
+
r,
|
|
698
|
+
(i) => {
|
|
699
|
+
u || n("update:fileList", i ?? []);
|
|
700
|
+
},
|
|
701
|
+
{ immediate: !0, deep: !0 }
|
|
702
|
+
);
|
|
703
|
+
const y = _(() => o.maxCount ? Number(o.maxCount) : 0), L = (i) => {
|
|
704
|
+
if (i) {
|
|
705
|
+
const h = r.value.findIndex(
|
|
706
|
+
(k) => k.uid && i.uid && k.uid === i.uid
|
|
707
|
+
);
|
|
708
|
+
h === -1 && (!y.value || y.value > r.value.length) ? r.value.push(i) : h > -1 && r.value.splice(h, 0, i), n("change", {
|
|
709
|
+
file: x(i),
|
|
710
|
+
fileList: x(r.value),
|
|
711
|
+
event: "add"
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
}, $ = _(
|
|
715
|
+
() => o.accept ?? o.listType === "image" ? "image/*" : void 0
|
|
716
|
+
), me = (i) => {
|
|
717
|
+
We(i) && i.filter((h) => !o.directory || Ce(h, $.value)).forEach((h) => {
|
|
718
|
+
L(
|
|
719
|
+
ze(h, {
|
|
720
|
+
getUid: d,
|
|
721
|
+
chunkFile: g.value,
|
|
722
|
+
chunkSize: o.chunkSize
|
|
723
|
+
})
|
|
724
|
+
);
|
|
725
|
+
});
|
|
726
|
+
}, te = _(
|
|
727
|
+
() => {
|
|
728
|
+
var i;
|
|
729
|
+
return o.uploadOnSelect || o.listType === "image" ? ((i = r.value) == null ? void 0 : i.filter(
|
|
730
|
+
(h) => h.status === "waiting" && h.originFileObj
|
|
731
|
+
)) ?? [] : [];
|
|
732
|
+
}
|
|
733
|
+
), X = _(
|
|
734
|
+
() => {
|
|
735
|
+
var i;
|
|
736
|
+
return ((i = r.value) == null ? void 0 : i.filter(
|
|
737
|
+
(h) => h.status === "uploading" && (h == null ? void 0 : h.cancel)
|
|
738
|
+
)) ?? [];
|
|
739
|
+
}
|
|
740
|
+
), P = (i, h) => {
|
|
741
|
+
if (i && h) {
|
|
742
|
+
const k = r.value.findIndex((C) => C.uid === i);
|
|
743
|
+
k > -1 && (r.value[k] = {
|
|
744
|
+
...r.value[k],
|
|
745
|
+
...h
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
}, Y = async (i) => {
|
|
749
|
+
var h, k, C, ge;
|
|
750
|
+
if (i.uid && r.value) {
|
|
751
|
+
const T = r.value.find((M) => M.uid === i.uid);
|
|
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"))) {
|
|
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],
|
|
759
|
+
status: "uploading",
|
|
760
|
+
cancel: v
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
P(l.uid, {
|
|
764
|
+
...l,
|
|
765
|
+
status: "uploading",
|
|
766
|
+
cancel: v
|
|
767
|
+
});
|
|
768
|
+
};
|
|
769
|
+
let w = {
|
|
770
|
+
signal: M.signal,
|
|
771
|
+
onUploadProgress(v) {
|
|
772
|
+
},
|
|
773
|
+
uid: i.uid
|
|
774
|
+
};
|
|
775
|
+
if (g.value && T.chunks && T.chunks.length > 1 && T.chunks.some((v) => v.status === "waiting")) {
|
|
776
|
+
const v = T.chunks.find((l) => l.status === "waiting");
|
|
777
|
+
v != null && v.uid && (w = {
|
|
778
|
+
...w,
|
|
779
|
+
...Je(v, "chunk", "chunkSiz", "index"),
|
|
780
|
+
chunk_uid: v.uid,
|
|
781
|
+
onUploadProgress(l) {
|
|
782
|
+
var I, W, B, he;
|
|
783
|
+
const f = x(
|
|
784
|
+
r.value.find((H) => H.uid === i.uid)
|
|
785
|
+
);
|
|
786
|
+
if (f) {
|
|
787
|
+
const H = (I = f.chunks) == null ? void 0 : I.findIndex(
|
|
788
|
+
(ne) => ne.uid === v.uid
|
|
789
|
+
);
|
|
790
|
+
H !== void 0 && ((W = f.chunks) != null && W[H]) && (f.chunks[H].percent = Math.round(
|
|
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(
|
|
793
|
+
Math.max(
|
|
794
|
+
f.chunks.reduce((ne, je) => ne + (je.percent ?? 0), 0) / (100 * f.chunks.length),
|
|
795
|
+
0
|
|
796
|
+
),
|
|
797
|
+
100
|
|
798
|
+
) : f.percent = Math.round(l.loaded * 100 / l.total), P(f.uid, f);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
});
|
|
802
|
+
} else
|
|
803
|
+
w = {
|
|
804
|
+
...w,
|
|
805
|
+
file: T.originFileObj,
|
|
806
|
+
onUploadProgress(v) {
|
|
807
|
+
const l = x(
|
|
808
|
+
r.value.find((f) => f.uid === i.uid)
|
|
809
|
+
);
|
|
810
|
+
l && P(l.uid, {
|
|
811
|
+
percent: Math.round(v.loaded * 100 / v.total)
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
if (Ee(), w.file || w.chunk) {
|
|
816
|
+
n("createRequest", i), n("change", {
|
|
817
|
+
file: x(i),
|
|
818
|
+
fileList: x(r.value),
|
|
819
|
+
event: "upload"
|
|
820
|
+
});
|
|
821
|
+
try {
|
|
822
|
+
let v = await o.action(w);
|
|
823
|
+
try {
|
|
824
|
+
typeof v == "string" && (v = JSON.parse(v));
|
|
825
|
+
} catch {
|
|
826
|
+
}
|
|
827
|
+
let l = x(
|
|
828
|
+
r.value.find((f) => f.uid === w.uid)
|
|
829
|
+
);
|
|
830
|
+
if (l) {
|
|
831
|
+
let f = !1;
|
|
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
|
|
835
|
+
);
|
|
836
|
+
l.chunks[I] && (l.chunks[I] = {
|
|
837
|
+
...l.chunks[I],
|
|
838
|
+
cancel: void 0,
|
|
839
|
+
status: "done",
|
|
840
|
+
response: v ?? void 0
|
|
841
|
+
});
|
|
842
|
+
const W = l.chunks.every((B) => B.status === "done") ? "done" : "uploading";
|
|
843
|
+
W === "done" ? l = {
|
|
844
|
+
...l,
|
|
845
|
+
cancel: void 0,
|
|
846
|
+
status: W
|
|
847
|
+
} : l.chunks.some((B) => B.status === "waiting") && (f = !0);
|
|
848
|
+
} else
|
|
849
|
+
l = {
|
|
850
|
+
...l,
|
|
851
|
+
cancel: void 0,
|
|
852
|
+
status: "done",
|
|
853
|
+
response: v ?? void 0
|
|
854
|
+
};
|
|
855
|
+
P(w.uid, l), f && await Y(l);
|
|
856
|
+
}
|
|
857
|
+
} catch (v) {
|
|
858
|
+
if (v.name === "CanceledError") {
|
|
859
|
+
let l = x(
|
|
860
|
+
r.value.find((f) => f.uid === w.uid)
|
|
861
|
+
);
|
|
862
|
+
if (l) {
|
|
863
|
+
if (w.chunk_uid && ((C = l.chunks) != null && C.length) && l.chunks.length > 1) {
|
|
864
|
+
const f = l.chunks.findIndex(
|
|
865
|
+
(I) => I.uid === w.chunk_uid
|
|
866
|
+
);
|
|
867
|
+
l.chunks[f] && (l.chunks[f] = {
|
|
868
|
+
...l.chunks[f],
|
|
869
|
+
cancel: void 0,
|
|
870
|
+
status: "waiting"
|
|
871
|
+
}), l = {
|
|
872
|
+
...l,
|
|
873
|
+
cancel: void 0,
|
|
874
|
+
status: "paused"
|
|
875
|
+
}, n("change", {
|
|
876
|
+
file: x(l),
|
|
877
|
+
fileList: x(r.value),
|
|
878
|
+
event: "paused"
|
|
879
|
+
});
|
|
880
|
+
} else
|
|
881
|
+
l = {
|
|
882
|
+
...l,
|
|
883
|
+
cancel: void 0,
|
|
884
|
+
status: "error"
|
|
885
|
+
}, n("change", {
|
|
886
|
+
file: x(l),
|
|
887
|
+
fileList: x(r.value),
|
|
888
|
+
event: "cancel"
|
|
889
|
+
});
|
|
890
|
+
P(w.uid, l);
|
|
891
|
+
}
|
|
892
|
+
} else {
|
|
893
|
+
let l = x(
|
|
894
|
+
r.value.find((f) => f.uid === w.uid)
|
|
895
|
+
);
|
|
896
|
+
if (l) {
|
|
897
|
+
if (w.chunk_uid && ((ge = l.chunks) != null && ge.length) && l.chunks.length > 1) {
|
|
898
|
+
const f = l.chunks.findIndex(
|
|
899
|
+
(I) => I.uid === w.chunk_uid
|
|
900
|
+
);
|
|
901
|
+
l.chunks[f] && (l.chunks[f] = {
|
|
902
|
+
...l.chunks[f],
|
|
903
|
+
cancel: void 0,
|
|
904
|
+
status: "waiting"
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
l = {
|
|
908
|
+
...l,
|
|
909
|
+
cancel: void 0,
|
|
910
|
+
status: "error",
|
|
911
|
+
error: v,
|
|
912
|
+
percent: 0
|
|
913
|
+
}, n("change", {
|
|
914
|
+
file: x(l),
|
|
915
|
+
fileList: x(r.value),
|
|
916
|
+
event: "failed"
|
|
917
|
+
}), P(w.uid, l);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
}, Re = async (i) => {
|
|
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", {
|
|
931
|
+
file: x(i),
|
|
932
|
+
fileList: x(r.value),
|
|
933
|
+
event: "remove"
|
|
934
|
+
}));
|
|
935
|
+
}
|
|
936
|
+
}, $e = (i) => !!((o.parallelUpload || !X.value.length) && (i.status === "paused" || i.status === "error" || (!o.uploadOnSelect || o.listType === "image") && i.status === "waiting")), Pe = _(() => {
|
|
937
|
+
switch (o.size) {
|
|
938
|
+
case "xlg":
|
|
939
|
+
return "md";
|
|
940
|
+
default:
|
|
941
|
+
return "sm";
|
|
942
|
+
}
|
|
943
|
+
});
|
|
944
|
+
Ne(() => {
|
|
945
|
+
(o.parallelUpload && te.value.length || !X.value.length) && te.value.forEach(Y), (r.value || []).forEach((i, h) => {
|
|
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) => {
|
|
947
|
+
const C = k || "";
|
|
948
|
+
C !== i.thumbUrl && P(i == null ? void 0 : i.uid, {
|
|
949
|
+
thumbUrl: C
|
|
950
|
+
});
|
|
951
|
+
}));
|
|
952
|
+
});
|
|
953
|
+
});
|
|
954
|
+
const Be = _(() => {
|
|
955
|
+
switch (o.size) {
|
|
956
|
+
case "xlg":
|
|
957
|
+
return "sm";
|
|
958
|
+
case "lg":
|
|
959
|
+
return "xsm";
|
|
960
|
+
default:
|
|
961
|
+
return "x2sm";
|
|
962
|
+
}
|
|
963
|
+
}), se = {
|
|
964
|
+
props: o,
|
|
965
|
+
attrs: p,
|
|
966
|
+
slots: c,
|
|
967
|
+
emit: n,
|
|
968
|
+
fileList: Ge(r),
|
|
969
|
+
progressSize: Be,
|
|
970
|
+
uploadableFiles: te,
|
|
971
|
+
uploadingFiles: X,
|
|
972
|
+
createRequest: Y,
|
|
973
|
+
resetRequest: Re,
|
|
974
|
+
canRunUpload: $e,
|
|
975
|
+
remove: Se,
|
|
976
|
+
goSize: Pe,
|
|
977
|
+
addFiles: me
|
|
978
|
+
};
|
|
979
|
+
return Ze(se), t(se), (i, h) => (b(), O(pe, null, [
|
|
980
|
+
i.noTrigger ? R("", !0) : (b(), z(gt, {
|
|
981
|
+
key: 0,
|
|
982
|
+
multiple: i.multiple,
|
|
983
|
+
directory: i.directory,
|
|
984
|
+
disabled: i.disabled,
|
|
985
|
+
accept: $.value,
|
|
986
|
+
onAddFiles: me,
|
|
987
|
+
class: S(i.triggerCls)
|
|
988
|
+
}, {
|
|
989
|
+
default: Q((k) => [
|
|
990
|
+
ae(i.$slots, "default", re(le(k)))
|
|
991
|
+
]),
|
|
992
|
+
_: 3
|
|
993
|
+
}, 8, ["multiple", "directory", "disabled", "accept", "class"])),
|
|
994
|
+
ae(i.$slots, "list", re(le(se)), () => [
|
|
995
|
+
j(ut)
|
|
996
|
+
])
|
|
997
|
+
], 64));
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
export {
|
|
1001
|
+
tt as U,
|
|
1002
|
+
Lt as _,
|
|
1003
|
+
gt as a,
|
|
1004
|
+
Z as b,
|
|
1005
|
+
F as c,
|
|
1006
|
+
Fe as d,
|
|
1007
|
+
Ie as e,
|
|
1008
|
+
st as f,
|
|
1009
|
+
K as i,
|
|
1010
|
+
Ze as p,
|
|
1011
|
+
_e as u
|
|
1012
|
+
};
|