@opentiny/tiny-robot 0.3.0-alpha.0 → 0.3.0-alpha.10
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/action-group/index.js +44 -41
- package/dist/attachments/index.js +472 -548
- package/dist/base-popper/index.js +4 -0
- package/dist/bubble/index.js +3 -4
- package/dist/close.js +1 -1
- package/dist/container/index.js +9 -9
- package/dist/drag-overlay/index.js +57 -0
- package/dist/dropdown-menu/index.js +84 -63
- package/dist/feedback/index.js +39 -38
- package/dist/flow-layout-buttons/index.js +29 -26
- package/dist/history/index.js +36 -37
- package/dist/icon-button/index.js +18 -19
- package/dist/index.d.ts +950 -885
- package/dist/index.js +196 -74
- package/dist/index2.js +608 -574
- package/dist/index3.js +626 -3833
- package/dist/index4.js +136 -622
- package/dist/index5.js +251 -3173
- package/dist/index6.js +2072 -4539
- package/dist/index7.js +4749 -0
- package/dist/prompts/index.js +2 -3
- package/dist/question/index.js +83 -83
- package/dist/sender/index.js +1106 -1209
- package/dist/style.css +1 -1
- package/dist/suggestion/index.js +27 -27
- package/dist/suggestion-pills/index.js +140 -143
- package/dist/suggestion-popover/index.js +292 -146
- package/dist/tiny-robot-svgs.js +319 -271
- package/dist/useSlotRefs.js +36 -0
- package/package.json +3 -3
|
@@ -1,602 +1,526 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { u as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
import { computed as I, ref as P, onUnmounted as Y, defineComponent as B, mergeModels as j, useModel as Z, createElementBlock as d, openBlock as o, withModifiers as x, createElementVNode as p, createVNode as F, unref as f, Fragment as z, renderList as D, normalizeClass as R, h as ee, createCommentVNode as C, createBlock as L, toDisplayString as U, withCtx as te, resolveDynamicComponent as V, watch as se } from "vue";
|
|
2
|
+
import { o as ae, r as O, s as q, d as J, c as K, f as G, i as H, U as re, J as ne, I as oe, A as ie, C as E, u as W } from "../tiny-robot-svgs.js";
|
|
3
|
+
import { _ as S } from "../_plugin-vue_export-helper.js";
|
|
4
|
+
import { T as le } from "../index2.js";
|
|
5
|
+
const A = {
|
|
6
|
+
image: H,
|
|
7
|
+
pdf: G,
|
|
8
|
+
word: K,
|
|
9
|
+
excel: J,
|
|
10
|
+
ppt: q,
|
|
11
|
+
folder: O,
|
|
12
|
+
other: ae
|
|
13
|
+
}, N = [
|
|
14
|
+
{
|
|
15
|
+
type: "image",
|
|
16
|
+
matcher: (t) => {
|
|
17
|
+
var s, u;
|
|
18
|
+
if (typeof t != "string")
|
|
19
|
+
return ((s = t.type) == null ? void 0 : s.startsWith("image/")) || !1;
|
|
20
|
+
const r = ((u = t.split(".").pop()) == null ? void 0 : u.toLowerCase()) || "";
|
|
21
|
+
return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(r);
|
|
22
|
+
},
|
|
23
|
+
icon: H
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: "pdf",
|
|
27
|
+
matcher: (t) => typeof t != "string" ? t.type === "application/pdf" : t.toLowerCase().endsWith(".pdf"),
|
|
28
|
+
icon: G
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "word",
|
|
32
|
+
matcher: (t) => {
|
|
33
|
+
var s;
|
|
34
|
+
if (typeof t != "string")
|
|
35
|
+
return t.type === "application/msword" || t.type === "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
36
|
+
const r = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
|
|
37
|
+
return ["doc", "docx"].includes(r);
|
|
38
|
+
},
|
|
39
|
+
icon: K
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: "excel",
|
|
43
|
+
matcher: (t) => {
|
|
44
|
+
var s;
|
|
45
|
+
if (typeof t != "string")
|
|
46
|
+
return t.type === "application/vnd.ms-excel" || t.type === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
47
|
+
const r = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
|
|
48
|
+
return ["xls", "xlsx"].includes(r);
|
|
49
|
+
},
|
|
50
|
+
icon: J
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: "ppt",
|
|
54
|
+
matcher: (t) => {
|
|
55
|
+
var s;
|
|
56
|
+
if (typeof t != "string")
|
|
57
|
+
return t.type === "application/vnd.ms-powerpoint" || t.type === "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
58
|
+
const r = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
|
|
59
|
+
return ["ppt", "pptx"].includes(r);
|
|
60
|
+
},
|
|
61
|
+
icon: q
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: "folder",
|
|
65
|
+
matcher: (t) => typeof t != "string" ? !1 : t.toLowerCase().endsWith("folder"),
|
|
66
|
+
icon: O
|
|
67
|
+
}
|
|
68
|
+
];
|
|
69
|
+
function Q(t = {}) {
|
|
70
|
+
const { customIcons: r, fileMatchers: s } = t, u = () => {
|
|
71
|
+
let e = [];
|
|
72
|
+
return s ? e = s.concat(N) : e = N, e;
|
|
73
|
+
}, i = (e = "other") => I(() => {
|
|
74
|
+
if (r != null && r[e])
|
|
75
|
+
return r[e];
|
|
76
|
+
const a = u().find((_) => _.type === e);
|
|
77
|
+
return a != null && a.icon ? a.icon : A[e] ? A[e] : A.other;
|
|
78
|
+
}), v = (e) => {
|
|
79
|
+
const n = u();
|
|
80
|
+
for (const a of n)
|
|
81
|
+
if (a.matcher(e))
|
|
82
|
+
return a.type;
|
|
83
|
+
return "other";
|
|
84
|
+
}, y = () => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15), b = (e) => e < 1024 ? e + " B" : e < 1024 * 1024 ? (e / 1024).toFixed(2) + " KB" : (e / (1024 * 1024)).toFixed(2) + " MB", k = (e) => typeof e.url == "string" && !!e.url && typeof e.size == "number", w = (e) => e.rawFile instanceof File, l = (e) => e.map((n) => {
|
|
85
|
+
if (k(n))
|
|
86
|
+
return c(n);
|
|
87
|
+
if (w(n))
|
|
88
|
+
return m(n);
|
|
89
|
+
}), h = (e) => ({
|
|
90
|
+
id: e.id || y(),
|
|
91
|
+
name: e.name || "",
|
|
92
|
+
status: e.status || "success",
|
|
93
|
+
message: e.message || ""
|
|
94
|
+
}), c = (e) => {
|
|
95
|
+
const n = h(e), a = e.url, _ = e.size, M = a.split("/").pop() || "";
|
|
96
|
+
return {
|
|
97
|
+
...n,
|
|
98
|
+
name: n.name || M,
|
|
99
|
+
fileType: v(M),
|
|
100
|
+
size: _,
|
|
101
|
+
url: a
|
|
40
102
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
103
|
+
}, m = (e) => {
|
|
104
|
+
const n = h(e), a = e.rawFile;
|
|
105
|
+
return {
|
|
106
|
+
...n,
|
|
107
|
+
name: n.name || a.name,
|
|
108
|
+
fileType: v(a),
|
|
109
|
+
rawFile: a,
|
|
110
|
+
size: e.size || a.size,
|
|
111
|
+
url: e.url
|
|
47
112
|
};
|
|
48
|
-
}, y = (u) => {
|
|
49
|
-
e && (e(), e = void 0), u && !c && (e = _());
|
|
50
113
|
};
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
), ie(() => {
|
|
58
|
-
e && (e(), e = void 0);
|
|
59
|
-
}), {
|
|
60
|
-
dragState: s,
|
|
61
|
-
dropZone: () => o,
|
|
62
|
-
initDrag: () => {
|
|
63
|
-
!c && p.enabled && y(!0);
|
|
64
|
-
},
|
|
65
|
-
cleanupDrag: () => y(!1)
|
|
114
|
+
return {
|
|
115
|
+
detectFileType: v,
|
|
116
|
+
generateID: y,
|
|
117
|
+
formatFileSize: b,
|
|
118
|
+
normalizeAttachments: l,
|
|
119
|
+
getIconComponent: i
|
|
66
120
|
};
|
|
67
121
|
}
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
bmp: "image",
|
|
76
|
-
svg: "image",
|
|
77
|
-
// 文档类型
|
|
78
|
-
pdf: "pdf",
|
|
79
|
-
doc: "word",
|
|
80
|
-
docx: "word",
|
|
81
|
-
xls: "excel",
|
|
82
|
-
xlsx: "excel",
|
|
83
|
-
ppt: "ppt",
|
|
84
|
-
pptx: "ppt",
|
|
85
|
-
// 文件夹
|
|
86
|
-
folder: "folder"
|
|
87
|
-
}, ke = {
|
|
88
|
-
"image/": "image",
|
|
89
|
-
"application/pdf": "pdf",
|
|
90
|
-
"application/msword": "word",
|
|
91
|
-
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "word",
|
|
92
|
-
"application/vnd.ms-excel": "excel",
|
|
93
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "excel",
|
|
94
|
-
"application/vnd.ms-powerpoint": "ppt",
|
|
95
|
-
"application/vnd.openxmlformats-officedocument.presentationml.presentation": "ppt"
|
|
122
|
+
const ce = (t, r) => {
|
|
123
|
+
if (t.startsWith("blob:") || t.startsWith("data:")) {
|
|
124
|
+
const s = document.createElement("a");
|
|
125
|
+
s.href = t, s.download = r, document.body.appendChild(s), requestAnimationFrame(() => {
|
|
126
|
+
s.click(), document.body.removeChild(s), URL.revokeObjectURL(t);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
96
129
|
};
|
|
97
|
-
function
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
130
|
+
function de(t, r) {
|
|
131
|
+
const s = P([]), u = I(() => t.file.fileType === "image"), i = (l) => {
|
|
132
|
+
const h = URL.createObjectURL(l);
|
|
133
|
+
return s.value.push(h), h;
|
|
134
|
+
}, v = (l) => {
|
|
135
|
+
r("preview", l, t.file);
|
|
136
|
+
}, y = (l) => {
|
|
137
|
+
if (r("download", l, t.file), !l.defaultPrevented && t.file.rawFile && !t.file.url) {
|
|
138
|
+
const h = i(t.file.rawFile);
|
|
139
|
+
ce(h, t.file.name || t.file.rawFile.name);
|
|
105
140
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
formatFileSize: s,
|
|
113
|
-
createPreviewUrl: n,
|
|
114
|
-
createAttachments: (e) => e.map((c) => ({
|
|
115
|
-
uid: g(),
|
|
116
|
-
name: c.name,
|
|
117
|
-
status: "success",
|
|
118
|
-
fileType: p(c),
|
|
119
|
-
rawFile: c,
|
|
120
|
-
size: c.size,
|
|
121
|
-
previewUrl: n(c)
|
|
122
|
-
}))
|
|
141
|
+
}, b = () => {
|
|
142
|
+
r("remove", t.file);
|
|
143
|
+
}, k = () => {
|
|
144
|
+
r("retry", t.file);
|
|
145
|
+
}, w = (l, h) => {
|
|
146
|
+
h.stopPropagation(), l.handler && l.handler(t.file), l.type === "preview" ? v(h) : l.type === "download" ? y(h) : r("action", { action: l, file: t.file });
|
|
123
147
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return {
|
|
136
|
-
getIconComponent: (s = "other") => k(() => p != null && p[s] ? p[s] : W == null ? void 0 : W[s])
|
|
148
|
+
return Y(() => {
|
|
149
|
+
s.value.forEach((l) => {
|
|
150
|
+
URL.revokeObjectURL(l);
|
|
151
|
+
}), s.value = [];
|
|
152
|
+
}), {
|
|
153
|
+
isImage: u,
|
|
154
|
+
handlePreview: v,
|
|
155
|
+
downloadFile: y,
|
|
156
|
+
handleRemove: b,
|
|
157
|
+
handleRetry: k,
|
|
158
|
+
handleCustomAction: w
|
|
137
159
|
};
|
|
138
160
|
}
|
|
139
|
-
const
|
|
161
|
+
const ue = { class: "tr-image-preview__main" }, fe = ["disabled"], pe = { class: "tr-image-preview__content" }, me = ["src", "alt"], _e = ["disabled"], ve = { class: "tr-image-preview__footer" }, he = { class: "tr-image-preview__thumbnails" }, ye = ["onClick"], ge = ["src", "alt"], we = /* @__PURE__ */ B({
|
|
140
162
|
__name: "ImagePreview",
|
|
141
|
-
props: {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const y = document.querySelector(".tr-image-preview__image");
|
|
159
|
-
y && (y.style.transform = `scale(${n.value})`);
|
|
160
|
-
}
|
|
161
|
-
function b() {
|
|
162
|
-
s("close");
|
|
163
|
-
}
|
|
164
|
-
function _() {
|
|
165
|
-
s("download");
|
|
163
|
+
props: /* @__PURE__ */ j({
|
|
164
|
+
images: {}
|
|
165
|
+
}, {
|
|
166
|
+
currentIndex: { required: !0 },
|
|
167
|
+
currentIndexModifiers: {}
|
|
168
|
+
}),
|
|
169
|
+
emits: /* @__PURE__ */ j(["close"], ["update:currentIndex"]),
|
|
170
|
+
setup(t, { emit: r }) {
|
|
171
|
+
const s = t, u = r, i = Z(t, "currentIndex"), v = I(() => s.images[i.value]), y = () => {
|
|
172
|
+
i.value > 0 && i.value--;
|
|
173
|
+
}, b = () => {
|
|
174
|
+
i.value < s.images.length - 1 && i.value++;
|
|
175
|
+
}, k = (l) => {
|
|
176
|
+
i.value = l;
|
|
177
|
+
};
|
|
178
|
+
function w() {
|
|
179
|
+
u("close");
|
|
166
180
|
}
|
|
167
|
-
return (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
src: y.imageUrl,
|
|
175
|
-
alt: "预览图片",
|
|
176
|
-
class: "tr-image-preview__image"
|
|
177
|
-
}, null, 8, Ce),
|
|
178
|
-
l("div", { class: "tr-image-preview__tools" }, [
|
|
179
|
-
l("button", {
|
|
180
|
-
class: "tr-image-preview__btn",
|
|
181
|
-
onClick: o
|
|
182
|
-
}, u[0] || (u[0] = [
|
|
183
|
-
l("span", null, "+", -1)
|
|
184
|
-
])),
|
|
185
|
-
l("button", {
|
|
186
|
-
class: "tr-image-preview__btn",
|
|
187
|
-
onClick: c
|
|
188
|
-
}, u[1] || (u[1] = [
|
|
189
|
-
l("span", null, "100%", -1)
|
|
190
|
-
])),
|
|
191
|
-
l("button", {
|
|
192
|
-
class: "tr-image-preview__btn",
|
|
193
|
-
onClick: e
|
|
194
|
-
}, u[2] || (u[2] = [
|
|
195
|
-
l("span", null, "-", -1)
|
|
196
|
-
])),
|
|
197
|
-
l("button", {
|
|
198
|
-
class: "tr-image-preview__btn tr-image-preview__btn--download",
|
|
199
|
-
onClick: _
|
|
200
|
-
}, u[3] || (u[3] = [
|
|
201
|
-
l("span", null, "下载", -1)
|
|
202
|
-
]))
|
|
203
|
-
]),
|
|
204
|
-
l("button", {
|
|
181
|
+
return (l, h) => {
|
|
182
|
+
var c, m;
|
|
183
|
+
return o(), d("div", {
|
|
184
|
+
class: "tr-image-preview",
|
|
185
|
+
onClick: x(w, ["self"])
|
|
186
|
+
}, [
|
|
187
|
+
p("button", {
|
|
205
188
|
class: "tr-image-preview__close",
|
|
206
|
-
onClick:
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
|
|
189
|
+
onClick: w
|
|
190
|
+
}, [
|
|
191
|
+
F(f(re))
|
|
192
|
+
]),
|
|
193
|
+
p("div", ue, [
|
|
194
|
+
p("button", {
|
|
195
|
+
class: "tr-image-preview__nav tr-image-preview__nav--left",
|
|
196
|
+
onClick: x(y, ["stop"]),
|
|
197
|
+
disabled: i.value === 0
|
|
198
|
+
}, [
|
|
199
|
+
F(f(ne))
|
|
200
|
+
], 8, fe),
|
|
201
|
+
p("div", pe, [
|
|
202
|
+
p("img", {
|
|
203
|
+
src: (c = v.value) == null ? void 0 : c.url,
|
|
204
|
+
alt: (m = v.value) == null ? void 0 : m.name,
|
|
205
|
+
class: "tr-image-preview__image"
|
|
206
|
+
}, null, 8, me)
|
|
207
|
+
]),
|
|
208
|
+
p("button", {
|
|
209
|
+
class: "tr-image-preview__nav tr-image-preview__nav--right",
|
|
210
|
+
onClick: x(b, ["stop"]),
|
|
211
|
+
disabled: i.value === l.images.length - 1
|
|
212
|
+
}, [
|
|
213
|
+
F(f(oe))
|
|
214
|
+
], 8, _e)
|
|
215
|
+
]),
|
|
216
|
+
p("div", ve, [
|
|
217
|
+
p("div", he, [
|
|
218
|
+
(o(!0), d(z, null, D(l.images, (e, n) => (o(), d("div", {
|
|
219
|
+
key: e.id,
|
|
220
|
+
class: R(["tr-image-preview__thumbnail", { "tr-image-preview__thumbnail--active": n === i.value }]),
|
|
221
|
+
onClick: (a) => k(n)
|
|
222
|
+
}, [
|
|
223
|
+
p("img", {
|
|
224
|
+
src: e.url,
|
|
225
|
+
alt: e.name
|
|
226
|
+
}, null, 8, ge)
|
|
227
|
+
], 10, ye))), 128))
|
|
228
|
+
])
|
|
229
|
+
])
|
|
230
|
+
]);
|
|
231
|
+
};
|
|
210
232
|
}
|
|
211
|
-
}),
|
|
233
|
+
}), be = /* @__PURE__ */ S(we, [["__scopeId", "data-v-027af77c"]]);
|
|
234
|
+
function ke(t, r, s = {}) {
|
|
235
|
+
const u = P(!1), i = P([]), v = P(0), y = (c) => {
|
|
236
|
+
v.value = c;
|
|
237
|
+
}, b = (c) => {
|
|
238
|
+
const m = t.value.findIndex((e) => e.id === c.id);
|
|
239
|
+
if (m !== -1 && c.url && t.value.splice(m, 1, c), c.fileType === "image") {
|
|
240
|
+
i.value = t.value.filter(
|
|
241
|
+
(n) => n.fileType === "image" && n.status !== "error" && n.status !== "uploading"
|
|
242
|
+
);
|
|
243
|
+
const e = i.value.findIndex((n) => n.id === c.id);
|
|
244
|
+
e !== -1 && (v.value = e, u.value = !0);
|
|
245
|
+
}
|
|
246
|
+
}, k = (c, m) => {
|
|
247
|
+
r("preview", c, m), !c.defaultPrevented && b(m);
|
|
248
|
+
}, w = () => {
|
|
249
|
+
u.value = !1;
|
|
250
|
+
}, l = (c, m) => {
|
|
251
|
+
s.onDownload ? s.onDownload(c, m) : r("download", c, m);
|
|
252
|
+
};
|
|
253
|
+
return {
|
|
254
|
+
// 显示预览
|
|
255
|
+
handlePreview: k,
|
|
256
|
+
// 渲染预览组件
|
|
257
|
+
renderPreview: () => u.value ? ee(be, {
|
|
258
|
+
images: i.value,
|
|
259
|
+
currentIndex: v.value,
|
|
260
|
+
"onUpdate:currentIndex": y,
|
|
261
|
+
onClose: w,
|
|
262
|
+
onDownload: l
|
|
263
|
+
}) : null
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
function Ce(t, r) {
|
|
267
|
+
return {
|
|
268
|
+
actualListType: I(() => r && r !== "auto" ? r : t.value.length === 0 ? "card" : t.value.every((i) => i.fileType === "image") ? "picture" : "card")
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
const Ie = ["data-file-type"], Fe = {
|
|
272
|
+
key: 1,
|
|
273
|
+
class: "tr-file-card__picture-container"
|
|
274
|
+
}, Ue = ["src", "alt"], xe = {
|
|
212
275
|
key: 0,
|
|
213
|
-
class: "tr-file-
|
|
214
|
-
},
|
|
276
|
+
class: "tr-file-card__picture-overlay"
|
|
277
|
+
}, Me = {
|
|
278
|
+
key: 1,
|
|
279
|
+
class: "tr-file-card__status-overlay tr-file-card__status-overlay--picture"
|
|
280
|
+
}, Pe = {
|
|
215
281
|
key: 0,
|
|
216
|
-
class: "tr-file-
|
|
217
|
-
},
|
|
282
|
+
class: "tr-file-card__status-icon tr-file-card__status-icon--loading"
|
|
283
|
+
}, Re = {
|
|
284
|
+
key: 0,
|
|
285
|
+
class: "tr-file-card__status-icon--loading-text"
|
|
286
|
+
}, Le = {
|
|
287
|
+
key: 2,
|
|
288
|
+
class: "tr-file-card__default-container"
|
|
289
|
+
}, $e = { class: "tr-file-card__icon-wrapper" }, Te = {
|
|
290
|
+
key: 0,
|
|
291
|
+
class: "tr-file-card__status-overlay tr-file-card__status-overlay--icon"
|
|
292
|
+
}, Ae = {
|
|
293
|
+
key: 0,
|
|
294
|
+
class: "tr-file-card__status-icon tr-file-card__status-icon--loading"
|
|
295
|
+
}, Be = { class: "tr-file-card__content" }, ze = { class: "tr-file-card__info" }, De = ["title"], Se = {
|
|
218
296
|
key: 0,
|
|
219
297
|
class: "tr-file-card__status"
|
|
220
|
-
},
|
|
298
|
+
}, je = {
|
|
299
|
+
key: 0,
|
|
300
|
+
class: "tr-file-card__status-success"
|
|
301
|
+
}, Ee = { class: "tr-file-card__status-info" }, We = { class: "tr-file-card__file-type" }, Ne = {
|
|
221
302
|
key: 0,
|
|
222
303
|
class: "tr-file-card__file-size"
|
|
223
|
-
},
|
|
304
|
+
}, Ve = {
|
|
305
|
+
key: 0,
|
|
306
|
+
class: "tr-file-card__actions"
|
|
307
|
+
}, Oe = ["href", "target", "onClick"], qe = ["onClick"], Je = {
|
|
224
308
|
key: 1,
|
|
225
|
-
class: "tr-file-
|
|
226
|
-
},
|
|
309
|
+
class: "tr-file-card__status-uploading"
|
|
310
|
+
}, Ke = {
|
|
227
311
|
key: 2,
|
|
228
|
-
class: "tr-file-
|
|
229
|
-
},
|
|
230
|
-
key: 0,
|
|
231
|
-
class: "tr-file-card__retry"
|
|
232
|
-
}, Xe = { key: 0 }, Ye = { key: 1 }, qe = { key: 2 }, He = { key: 3 }, Je = { key: 4 }, Ke = { key: 5 }, Ge = /* @__PURE__ */ E({
|
|
312
|
+
class: "tr-file-card__status-error"
|
|
313
|
+
}, Ge = /* @__PURE__ */ B({
|
|
233
314
|
__name: "FileCard",
|
|
234
315
|
props: {
|
|
235
316
|
file: {},
|
|
236
|
-
|
|
237
|
-
disabled: { type: Boolean, default: !1 },
|
|
238
|
-
showPreview: { type: Boolean, default: !0 },
|
|
317
|
+
variant: { default: "card" },
|
|
239
318
|
showStatus: { type: Boolean, default: !0 },
|
|
240
|
-
|
|
241
|
-
|
|
319
|
+
fileIcons: {},
|
|
320
|
+
disabled: { type: Boolean },
|
|
321
|
+
actions: {},
|
|
322
|
+
fileMatchers: {}
|
|
242
323
|
},
|
|
243
324
|
emits: ["remove", "preview", "action", "retry", "download"],
|
|
244
|
-
setup(
|
|
245
|
-
const s =
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
v.href = t, v.download = s.file.name, v.target = "_blank", document.body.appendChild(v), v.click(), document.body.removeChild(v), URL.revokeObjectURL(t);
|
|
325
|
+
setup(t, { emit: r }) {
|
|
326
|
+
const s = t, u = r, { formatFileSize: i, getIconComponent: v } = Q({
|
|
327
|
+
customIcons: s.fileIcons,
|
|
328
|
+
fileMatchers: s.fileMatchers
|
|
329
|
+
}), { isImage: y, handlePreview: b, handleRemove: k, handleCustomAction: w, handleRetry: l } = de(s, u), h = I(() => v(s.file.fileType).value), c = I(() => s.file.status === "uploading"), m = I(() => s.file.status === "success"), e = I(() => s.file.status === "error"), n = I(() => [
|
|
330
|
+
s.variant === "picture" ? "tr-file-card--picture" : "tr-file-card",
|
|
331
|
+
`tr-file-card--${s.file.fileType || "other"}`,
|
|
332
|
+
{
|
|
333
|
+
"tr-file-card--uploading": c.value,
|
|
334
|
+
"tr-file-card--error": e.value,
|
|
335
|
+
"tr-file-card--success": m.value
|
|
256
336
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
};
|
|
265
|
-
return (t, v) => {
|
|
266
|
-
var T;
|
|
267
|
-
return r(), d("div", {
|
|
268
|
-
class: F(["tr-file-card", [
|
|
269
|
-
`tr-file-card--${t.file.fileType || "other"}`,
|
|
270
|
-
t.file.status,
|
|
271
|
-
{
|
|
272
|
-
"tr-file-card--uploading": y.value,
|
|
273
|
-
"tr-file-card--error": u.value
|
|
274
|
-
}
|
|
275
|
-
]]),
|
|
276
|
-
"data-file-type": t.file.fileType || "other"
|
|
337
|
+
]);
|
|
338
|
+
return (a, _) => {
|
|
339
|
+
var M;
|
|
340
|
+
return o(), d("div", {
|
|
341
|
+
class: R(n.value),
|
|
342
|
+
"data-file-type": a.file.fileType || "other",
|
|
343
|
+
onClick: _[3] || (_[3] = (g) => a.variant === "picture" ? f(b)(g) : void 0)
|
|
277
344
|
}, [
|
|
278
|
-
|
|
345
|
+
a.disabled ? C("", !0) : (o(), d("button", {
|
|
279
346
|
key: 0,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
347
|
+
class: "tr-file-card__close-btn",
|
|
348
|
+
onClick: _[0] || (_[0] = x(
|
|
349
|
+
//@ts-ignore
|
|
350
|
+
(...g) => f(k) && f(k)(...g),
|
|
351
|
+
["stop"]
|
|
352
|
+
)),
|
|
283
353
|
"aria-label": "移除文件"
|
|
284
|
-
}, v[1] || (v[1] = [
|
|
285
|
-
l("span", { class: "tr-file-card__close-icon" }, "×", -1)
|
|
286
|
-
]))),
|
|
287
|
-
l("div", {
|
|
288
|
-
class: F(["tr-file-card__icon", { "tr-file-card__icon--preview": _.value && t.showPreview }]),
|
|
289
|
-
onClick: v[0] || (v[0] = (R) => _.value && t.showPreview ? U() : null)
|
|
290
354
|
}, [
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
355
|
+
F(f(ie))
|
|
356
|
+
])),
|
|
357
|
+
a.variant === "picture" ? (o(), d("div", Fe, [
|
|
358
|
+
p("img", {
|
|
359
|
+
src: a.file.url,
|
|
360
|
+
alt: a.file.name,
|
|
361
|
+
class: "tr-file-card__picture-img"
|
|
362
|
+
}, null, 8, Ue),
|
|
363
|
+
m.value ? (o(), d("div", xe, _[4] || (_[4] = [
|
|
364
|
+
p("span", { class: "tr-file-card__picture-overlay-text" }, "预览", -1)
|
|
365
|
+
]))) : C("", !0),
|
|
366
|
+
c.value || e.value ? (o(), d("div", Me, [
|
|
367
|
+
c.value ? (o(), d("div", Pe, [
|
|
368
|
+
F(f(E)),
|
|
369
|
+
a.file.message ? (o(), d("span", Re, U(a.file.message), 1)) : C("", !0)
|
|
370
|
+
])) : e.value ? (o(), L(f(le), {
|
|
371
|
+
key: 1,
|
|
372
|
+
content: "解析失败",
|
|
373
|
+
placement: "top",
|
|
374
|
+
effect: "light"
|
|
375
|
+
}, {
|
|
376
|
+
default: te(() => [
|
|
377
|
+
F(f(W), { class: "tr-file-card__status-icon tr-file-card__status-icon--error" })
|
|
378
|
+
]),
|
|
379
|
+
_: 1
|
|
380
|
+
})) : C("", !0)
|
|
381
|
+
])) : C("", !0)
|
|
382
|
+
])) : (o(), d("div", Le, [
|
|
383
|
+
p("div", {
|
|
384
|
+
class: R(["tr-file-card__icon", { "tr-file-card__icon--clickable": f(y) }]),
|
|
385
|
+
onClick: _[1] || (_[1] = x((g) => f(y) ? f(b)(g) : null, ["stop"]))
|
|
386
|
+
}, [
|
|
387
|
+
p("div", $e, [
|
|
388
|
+
(o(), L(V(h.value), { class: "tr-file-card__file-icon" })),
|
|
389
|
+
c.value || e.value ? (o(), d("div", Te, [
|
|
390
|
+
c.value ? (o(), d("div", Ae, [
|
|
391
|
+
F(f(E))
|
|
392
|
+
])) : e.value ? (o(), L(f(W), {
|
|
393
|
+
key: 1,
|
|
394
|
+
class: "tr-file-card__status-icon tr-file-card__status-icon--error"
|
|
395
|
+
})) : C("", !0)
|
|
396
|
+
])) : C("", !0)
|
|
397
|
+
])
|
|
398
|
+
], 2),
|
|
399
|
+
p("div", Be, [
|
|
400
|
+
p("div", ze, [
|
|
401
|
+
p("div", {
|
|
402
|
+
class: "tr-file-card__name",
|
|
403
|
+
title: a.file.name
|
|
404
|
+
}, U(a.file.name), 9, De),
|
|
405
|
+
a.showStatus ? (o(), d("div", Se, [
|
|
406
|
+
m.value ? (o(), d("div", je, [
|
|
407
|
+
p("div", Ee, [
|
|
408
|
+
p("span", We, U(((M = a.file.fileType) == null ? void 0 : M.toUpperCase()) || "FILE"), 1),
|
|
409
|
+
a.file.size ? (o(), d("span", Ne, U(f(i)(a.file.size)), 1)) : C("", !0)
|
|
410
|
+
]),
|
|
411
|
+
a.actions ? (o(), d("div", Ve, [
|
|
412
|
+
(o(!0), d(z, null, D(a.actions, (g, X) => (o(), d("div", {
|
|
413
|
+
key: X,
|
|
414
|
+
class: "tr-file-card__action-btn"
|
|
415
|
+
}, [
|
|
416
|
+
g.type === "download" ? (o(), d("a", {
|
|
417
|
+
key: 0,
|
|
418
|
+
class: "tr-file-card__action-btn--download",
|
|
419
|
+
href: a.file.url ?? "javascript:void(0)",
|
|
420
|
+
target: a.file.url ? "_blank" : "_self",
|
|
421
|
+
onClick: (T) => f(w)(g, T)
|
|
422
|
+
}, U(g.label), 9, Oe)) : (o(), d("button", {
|
|
423
|
+
key: 1,
|
|
424
|
+
class: R(`tr-file-card__action-btn--${g.type}`),
|
|
425
|
+
onClick: (T) => f(w)(g, T)
|
|
426
|
+
}, U(g.label), 11, qe))
|
|
427
|
+
]))), 128))
|
|
428
|
+
])) : C("", !0)
|
|
429
|
+
])) : c.value ? (o(), d("div", Je, _[5] || (_[5] = [
|
|
430
|
+
p("span", { class: "tr-file-card__uploading-text" }, "上传中...", -1)
|
|
431
|
+
]))) : e.value ? (o(), d("div", Ke, [
|
|
432
|
+
_[6] || (_[6] = p("span", { class: "tr-file-card__error-text" }, "上传失败", -1)),
|
|
433
|
+
p("button", {
|
|
338
434
|
class: "tr-file-card__retry-btn",
|
|
339
|
-
onClick:
|
|
435
|
+
onClick: _[2] || (_[2] = //@ts-ignore
|
|
436
|
+
(...g) => f(l) && f(l)(...g))
|
|
340
437
|
}, "重试")
|
|
341
|
-
])) : (
|
|
342
|
-
|
|
343
|
-
class: F(["tr-file-card__message", `tr-file-card__message--${t.file.messageType || "info"}`])
|
|
344
|
-
}, [
|
|
345
|
-
t.file.messageType === "error" ? (r(), d("span", Xe, "上传失败")) : m("", !0),
|
|
346
|
-
t.file.messageType === "warning" ? (r(), d("span", Ye, "上传警告")) : m("", !0),
|
|
347
|
-
t.file.messageType === "success" ? (r(), d("span", qe, "上传成功")) : m("", !0),
|
|
348
|
-
t.file.messageType === "info" ? (r(), d("span", He, "处理中...")) : m("", !0),
|
|
349
|
-
t.file.messageType === "uploading" ? (r(), d("span", Je, "上传中...")) : m("", !0),
|
|
350
|
-
t.file.messageType ? m("", !0) : (r(), d("span", Ke, D(t.file.status || "状态信息"), 1))
|
|
351
|
-
], 2))
|
|
352
|
-
], 64)) : (r(), d(z, { key: 4 }, [
|
|
353
|
-
K(D(t.file.status), 1)
|
|
354
|
-
], 64))
|
|
355
|
-
])) : m("", !0)
|
|
356
|
-
])
|
|
357
|
-
]),
|
|
358
|
-
_.value ? (r(), L(Fe, {
|
|
359
|
-
key: 1,
|
|
360
|
-
visible: e.value,
|
|
361
|
-
"image-url": c.value,
|
|
362
|
-
onClose: A,
|
|
363
|
-
onDownload: S
|
|
364
|
-
}, null, 8, ["visible", "image-url"])) : m("", !0)
|
|
365
|
-
], 10, Re);
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
}), Qe = { class: "tr-fullscreen-overlay__content" }, xe = { class: "tr-fullscreen-overlay__text" }, et = { class: "tr-fullscreen-overlay__title" }, tt = { class: "tr-fullscreen-overlay__description" }, st = /* @__PURE__ */ E({
|
|
369
|
-
__name: "FullscreenOverlay",
|
|
370
|
-
props: {
|
|
371
|
-
visible: { type: Boolean },
|
|
372
|
-
config: {}
|
|
373
|
-
},
|
|
374
|
-
setup(p) {
|
|
375
|
-
const g = p, s = k(() => {
|
|
376
|
-
var o, e, c;
|
|
377
|
-
return {
|
|
378
|
-
zIndex: ((o = g.config) == null ? void 0 : o.zIndex) || 1e3,
|
|
379
|
-
"--enter-delay": `${((e = g.config) == null ? void 0 : e.enterDelay) || 200}ms`,
|
|
380
|
-
"--leave-delay": `${((c = g.config) == null ? void 0 : c.leaveDelay) || 200}ms`
|
|
381
|
-
};
|
|
382
|
-
}), n = k(() => {
|
|
383
|
-
var o;
|
|
384
|
-
return ((o = g.config) == null ? void 0 : o.className) || "";
|
|
385
|
-
});
|
|
386
|
-
return (o, e) => (r(), L(re, { name: "tr-fade" }, {
|
|
387
|
-
default: oe(() => [
|
|
388
|
-
o.visible ? (r(), d("div", {
|
|
389
|
-
key: 0,
|
|
390
|
-
class: F(["tr-fullscreen-overlay", [n.value]]),
|
|
391
|
-
style: B(s.value)
|
|
392
|
-
}, [
|
|
393
|
-
l("div", Qe, [
|
|
394
|
-
e[3] || (e[3] = l("div", { class: "tr-fullscreen-overlay__icon" }, [
|
|
395
|
-
l("svg", {
|
|
396
|
-
width: "64",
|
|
397
|
-
height: "64",
|
|
398
|
-
viewBox: "0 0 24 24",
|
|
399
|
-
fill: "currentColor"
|
|
400
|
-
}, [
|
|
401
|
-
l("path", { d: "M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z" })
|
|
402
|
-
])
|
|
403
|
-
], -1)),
|
|
404
|
-
l("div", xe, [
|
|
405
|
-
l("div", et, [
|
|
406
|
-
H(o.$slots, "header", {}, () => [
|
|
407
|
-
e[0] || (e[0] = K(" 将附件拖到此处完成上传 "))
|
|
408
|
-
], !0)
|
|
409
|
-
]),
|
|
410
|
-
l("div", tt, [
|
|
411
|
-
H(o.$slots, "description", {}, () => [
|
|
412
|
-
e[1] || (e[1] = l("span", null, "总计最多上传50个附件(每个100MB以内)", -1)),
|
|
413
|
-
e[2] || (e[2] = l("span", null, "支持附件格式 PDF/Word/Excel/PPT/Markdown", -1))
|
|
414
|
-
], !0)
|
|
415
|
-
])
|
|
438
|
+
])) : C("", !0)
|
|
439
|
+
])) : C("", !0)
|
|
416
440
|
])
|
|
417
441
|
])
|
|
418
|
-
]
|
|
419
|
-
])
|
|
420
|
-
|
|
421
|
-
}));
|
|
442
|
+
]))
|
|
443
|
+
], 10, Ie);
|
|
444
|
+
};
|
|
422
445
|
}
|
|
423
|
-
}),
|
|
424
|
-
key: 1,
|
|
425
|
-
class: "tr-attachments__empty"
|
|
426
|
-
}, j = /* @__PURE__ */ E({
|
|
446
|
+
}), He = /* @__PURE__ */ S(Ge, [["__scopeId", "data-v-06df896e"]]), Qe = { class: "tr-attachments" }, Xe = /* @__PURE__ */ B({
|
|
427
447
|
__name: "index",
|
|
428
448
|
props: {
|
|
429
449
|
items: {},
|
|
430
|
-
disabled: { type: Boolean
|
|
431
|
-
|
|
432
|
-
drag: { type: [Boolean, Object] },
|
|
450
|
+
disabled: { type: Boolean },
|
|
451
|
+
wrap: { type: Boolean },
|
|
433
452
|
fileIcons: {},
|
|
434
|
-
|
|
435
|
-
styles: {},
|
|
436
|
-
statusType: { default: "info" },
|
|
437
|
-
customActions: {},
|
|
438
|
-
triggerUpload: { default: 0 }
|
|
439
|
-
},
|
|
440
|
-
emits: [
|
|
441
|
-
"update:items",
|
|
442
|
-
"files-dropped",
|
|
443
|
-
"file-remove",
|
|
444
|
-
"file-preview",
|
|
445
|
-
"file-download",
|
|
446
|
-
"file-retry",
|
|
447
|
-
"action"
|
|
448
|
-
],
|
|
449
|
-
setup(p, { expose: g, emit: s }) {
|
|
450
|
-
const n = p, o = s, e = P(n.items || []), { detectFileType: c, generateUID: h, formatFileSize: b, createPreviewUrl: _, createAttachments: y } = Q(), u = P(null), {
|
|
451
|
-
open: U,
|
|
452
|
-
reset: A,
|
|
453
|
-
onChange: S
|
|
454
|
-
} = ce({
|
|
455
|
-
multiple: !0,
|
|
456
|
-
accept: "*",
|
|
457
|
-
reset: !0
|
|
458
|
-
});
|
|
459
|
-
S((i) => {
|
|
460
|
-
if (i && i.length > 0) {
|
|
461
|
-
const f = Array.from(i);
|
|
462
|
-
v(f);
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
const $ = k(() => !!n.drag && !n.disabled), C = k(() => typeof n.drag == "object" && n.drag.mode === "fullscreen"), { dragState: a, initDrag: t } = we(
|
|
453
|
+
actions: { default: () => [
|
|
466
454
|
{
|
|
467
|
-
|
|
468
|
-
|
|
455
|
+
label: "下载",
|
|
456
|
+
type: "download"
|
|
469
457
|
},
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
);
|
|
485
|
-
e.value = [...e.value, ...f], o("files-dropped", f), o("update:items", e.value);
|
|
486
|
-
}
|
|
487
|
-
function T() {
|
|
488
|
-
n.disabled || U();
|
|
489
|
-
}
|
|
490
|
-
function R(i) {
|
|
491
|
-
if (n.disabled) return;
|
|
492
|
-
const f = e.value.findIndex((w) => w.uid === i.uid);
|
|
493
|
-
f !== -1 && (i.previewUrl && i.previewUrl.startsWith("blob:") && URL.revokeObjectURL(i.previewUrl), e.value.splice(f, 1), o("file-remove", i), o("update:items", e.value));
|
|
494
|
-
}
|
|
495
|
-
function M(i) {
|
|
496
|
-
o("file-preview", i);
|
|
458
|
+
{
|
|
459
|
+
label: "预览",
|
|
460
|
+
type: "preview"
|
|
461
|
+
}
|
|
462
|
+
] },
|
|
463
|
+
variant: { default: "auto" },
|
|
464
|
+
fileMatchers: { default: () => [] }
|
|
465
|
+
},
|
|
466
|
+
emits: ["update:items", "remove", "download", "retry", "preview", "action"],
|
|
467
|
+
setup(t, { emit: r }) {
|
|
468
|
+
const s = t, u = r, i = P(s.items || []), { actualListType: v } = Ce(i, s.variant), { handlePreview: y, renderPreview: b } = ke(i, u, { enableDownload: !0 });
|
|
469
|
+
function k(e) {
|
|
470
|
+
if (s.disabled) return;
|
|
471
|
+
const n = i.value.findIndex((a) => a.id === e.id);
|
|
472
|
+
n !== -1 && (i.value.splice(n, 1), u("remove", e), u("update:items", i.value));
|
|
497
473
|
}
|
|
498
|
-
function
|
|
499
|
-
|
|
474
|
+
function w(e, n) {
|
|
475
|
+
u("download", e, n);
|
|
500
476
|
}
|
|
501
|
-
function
|
|
502
|
-
|
|
503
|
-
f !== -1 && (e.value[f].status = "uploading", e.value[f].messageType = void 0, e.value[f].isUploading = !0, o("file-retry", i), o("update:items", e.value));
|
|
477
|
+
function l(e) {
|
|
478
|
+
u("retry", e);
|
|
504
479
|
}
|
|
505
|
-
function
|
|
506
|
-
|
|
480
|
+
function h(e) {
|
|
481
|
+
u("action", e);
|
|
507
482
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
483
|
+
const c = I(() => s.wrap ? "wrap" : "no-wrap"), { normalizeAttachments: m } = Q({
|
|
484
|
+
fileMatchers: s.fileMatchers
|
|
485
|
+
});
|
|
486
|
+
return se(
|
|
487
|
+
() => s.items,
|
|
488
|
+
(e) => {
|
|
489
|
+
e && e.length > 0 && (i.value = m(e));
|
|
512
490
|
},
|
|
513
|
-
{ deep: !0 }
|
|
514
|
-
),
|
|
515
|
-
()
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
const te = () => {
|
|
521
|
-
e.value.forEach((i) => {
|
|
522
|
-
i.previewUrl && i.previewUrl.startsWith("blob:") && URL.revokeObjectURL(i.previewUrl);
|
|
523
|
-
}), e.value = [], A(), o("update:items", e.value);
|
|
524
|
-
};
|
|
525
|
-
return ae(() => {
|
|
526
|
-
u.value && $.value && setTimeout(() => {
|
|
527
|
-
t();
|
|
528
|
-
}, 0);
|
|
529
|
-
}), g({
|
|
530
|
-
triggerUpload: T,
|
|
531
|
-
addFiles: v,
|
|
532
|
-
clearFiles: te,
|
|
533
|
-
getFiles: () => e.value,
|
|
534
|
-
getFileCount: () => e.value.length,
|
|
535
|
-
hasFiles: () => e.value.length > 0,
|
|
536
|
-
formatFileSize: b,
|
|
537
|
-
createAttachments: y
|
|
538
|
-
}), (i, f) => {
|
|
539
|
-
var w, X;
|
|
540
|
-
return r(), d("div", {
|
|
541
|
-
class: F(["tr-attachments", [i.rootClass, { "tr-attachments--dragging": I(a).active && !C.value }]]),
|
|
542
|
-
style: B((w = i.styles) == null ? void 0 : w.root)
|
|
491
|
+
{ deep: !0, immediate: !0 }
|
|
492
|
+
), (e, n) => (o(), d("div", Qe, [
|
|
493
|
+
i.value.length > 0 ? (o(), d("div", {
|
|
494
|
+
key: 0,
|
|
495
|
+
class: R(["tr-attachments__file-list", c.value]),
|
|
496
|
+
onClick: n[0] || (n[0] = x(() => {
|
|
497
|
+
}, ["stop"]))
|
|
543
498
|
}, [
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
e.
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
disabled: i.disabled,
|
|
563
|
-
style: B((q = i.styles) == null ? void 0 : q.card),
|
|
564
|
-
"status-type": i.statusType,
|
|
565
|
-
"custom-actions": i.customActions,
|
|
566
|
-
"show-status": !0,
|
|
567
|
-
onRemove: R,
|
|
568
|
-
onPreview: M,
|
|
569
|
-
onDownload: V,
|
|
570
|
-
onRetry: x,
|
|
571
|
-
onAction: ee
|
|
572
|
-
}, null, 8, ["file", "file-icons", "disabled", "style", "status-type", "custom-actions"]);
|
|
573
|
-
}), 128)),
|
|
574
|
-
i.disabled ? m("", !0) : (r(), d("div", {
|
|
575
|
-
key: 0,
|
|
576
|
-
class: "tr-attachments__add-button",
|
|
577
|
-
onClick: N(T, ["stop"])
|
|
578
|
-
}, f[1] || (f[1] = [
|
|
579
|
-
l("div", { class: "tr-attachments__add-icon" }, "+", -1)
|
|
580
|
-
])))
|
|
581
|
-
], 2)) : (r(), d("div", lt, f[2] || (f[2] = [
|
|
582
|
-
de('<div class="tr-attachments__empty-icon"><svg width="24" height="24" viewBox="0 0 24 24" fill="#bdbdbd"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path></svg></div><div class="tr-attachments__empty-text">暂无文件</div><div class="tr-attachments__empty-hint">将文件拖拽到此处,或点击上传</div>', 3)
|
|
583
|
-
])))
|
|
584
|
-
], 512),
|
|
585
|
-
C.value ? (r(), L(it, {
|
|
586
|
-
key: 0,
|
|
587
|
-
visible: I(a).active,
|
|
588
|
-
config: typeof i.drag == "object" ? i.drag.overlay : void 0,
|
|
589
|
-
style: B((X = i.styles) == null ? void 0 : X.overlay)
|
|
590
|
-
}, null, 8, ["visible", "config", "style"])) : m("", !0)
|
|
591
|
-
], 6);
|
|
592
|
-
};
|
|
499
|
+
(o(!0), d(z, null, D(i.value, (a) => (o(), L(He, {
|
|
500
|
+
key: a.id,
|
|
501
|
+
file: a,
|
|
502
|
+
variant: f(v),
|
|
503
|
+
"file-icons": e.fileIcons,
|
|
504
|
+
disabled: e.disabled,
|
|
505
|
+
actions: e.actions,
|
|
506
|
+
"show-status": !0,
|
|
507
|
+
"file-matchers": e.fileMatchers,
|
|
508
|
+
onRemove: k,
|
|
509
|
+
onPreview: f(y),
|
|
510
|
+
onDownload: w,
|
|
511
|
+
onRetry: l,
|
|
512
|
+
onAction: h
|
|
513
|
+
}, null, 8, ["file", "variant", "file-icons", "disabled", "actions", "file-matchers", "onPreview"]))), 128))
|
|
514
|
+
], 2)) : C("", !0),
|
|
515
|
+
(o(), L(V(f(b)())))
|
|
516
|
+
]));
|
|
593
517
|
}
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
const
|
|
597
|
-
|
|
518
|
+
}), $ = /* @__PURE__ */ S(Xe, [["__scopeId", "data-v-e09559ac"]]);
|
|
519
|
+
$.name = "TrAttachments";
|
|
520
|
+
const Ye = function(t) {
|
|
521
|
+
t.component($.name, $);
|
|
598
522
|
};
|
|
599
|
-
|
|
523
|
+
$.install = Ye;
|
|
600
524
|
export {
|
|
601
|
-
|
|
525
|
+
$ as default
|
|
602
526
|
};
|