@opentiny/tiny-robot 0.3.0-alpha.17 → 0.3.0-alpha.19
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 +12 -12
- package/dist/attachments/index.js +221 -221
- package/dist/base-popper/index.js +1 -1
- package/dist/bubble/index.js +2 -2
- package/dist/container/index.js +27 -27
- package/dist/drag-overlay/index.js +1 -1
- package/dist/dropdown-menu/index.js +2 -2
- package/dist/feedback/index.js +75 -75
- package/dist/flow-layout-buttons/index.js +18 -18
- package/dist/history/index.js +76 -77
- package/dist/index2.js +680 -608
- package/dist/index3.js +148 -697
- package/dist/mcp-server-picker/index.js +377 -29675
- package/dist/sender/index.js +745 -728
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +19 -19
- package/dist/suggestion-popover/index.js +31 -31
- package/dist/useSlotRefs.js +1 -1
- package/dist/utils.js +1 -1
- package/package.json +3 -15
- package/dist/close.js +0 -29
- package/dist/index4.js +0 -161
- package/dist/index5.js +0 -316
- package/dist/index6.js +0 -2352
- package/dist/index7.js +0 -6654
- package/dist/question/index.js +0 -429
- package/dist/suggestion/index.js +0 -497
- package/dist/tiny-robot-svgs.js +0 -1142
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import {
|
|
1
|
+
import { computed as C, ref as R, onUnmounted as Y, defineComponent as B, mergeModels as W, useModel as Z, createElementBlock as d, openBlock as o, withModifiers as P, createElementVNode as p, createVNode as F, unref as f, Fragment as z, renderList as D, normalizeClass as U, h as ee, createCommentVNode as k, createBlock as L, toDisplayString as x, withCtx as te, resolveDynamicComponent as O, watch as ne } from "vue";
|
|
2
|
+
import { IconFileOther as re, IconFileFolder as V, IconFilePpt as q, IconFileExcel as K, IconFileWord as G, IconFilePdf as H, IconFileImage as J, IconClose as se, IconArrowLeft as ae, IconArrowRight as oe, IconFileRemove as ie, IconImageLoading as j, IconImageWarning as E } from "@opentiny/tiny-robot-svgs";
|
|
3
3
|
import { _ as S } from "../_plugin-vue_export-helper.js";
|
|
4
|
-
import {
|
|
5
|
-
const
|
|
6
|
-
image:
|
|
7
|
-
pdf:
|
|
8
|
-
word:
|
|
9
|
-
excel:
|
|
4
|
+
import { TinyTooltip as le } from "@opentiny/vue";
|
|
5
|
+
const A = {
|
|
6
|
+
image: J,
|
|
7
|
+
pdf: H,
|
|
8
|
+
word: G,
|
|
9
|
+
excel: K,
|
|
10
10
|
ppt: q,
|
|
11
|
-
folder:
|
|
12
|
-
other:
|
|
11
|
+
folder: V,
|
|
12
|
+
other: re
|
|
13
13
|
}, N = [
|
|
14
14
|
{
|
|
15
15
|
type: "image",
|
|
16
16
|
matcher: (t) => {
|
|
17
|
-
var
|
|
17
|
+
var n, u;
|
|
18
18
|
if (typeof t != "string")
|
|
19
|
-
return ((
|
|
20
|
-
const
|
|
21
|
-
return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(
|
|
19
|
+
return ((n = t.type) == null ? void 0 : n.startsWith("image/")) || !1;
|
|
20
|
+
const s = ((u = t.split(".").pop()) == null ? void 0 : u.toLowerCase()) || "";
|
|
21
|
+
return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(s);
|
|
22
22
|
},
|
|
23
|
-
icon:
|
|
23
|
+
icon: J
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
type: "pdf",
|
|
27
27
|
matcher: (t) => typeof t != "string" ? t.type === "application/pdf" : t.toLowerCase().endsWith(".pdf"),
|
|
28
|
-
icon:
|
|
28
|
+
icon: H
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
type: "word",
|
|
32
32
|
matcher: (t) => {
|
|
33
|
-
var
|
|
33
|
+
var n;
|
|
34
34
|
if (typeof t != "string")
|
|
35
35
|
return t.type === "application/msword" || t.type === "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
36
|
-
const
|
|
37
|
-
return ["doc", "docx"].includes(
|
|
36
|
+
const s = ((n = t.split(".").pop()) == null ? void 0 : n.toLowerCase()) || "";
|
|
37
|
+
return ["doc", "docx"].includes(s);
|
|
38
38
|
},
|
|
39
|
-
icon:
|
|
39
|
+
icon: G
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
type: "excel",
|
|
43
43
|
matcher: (t) => {
|
|
44
|
-
var
|
|
44
|
+
var n;
|
|
45
45
|
if (typeof t != "string")
|
|
46
46
|
return t.type === "application/vnd.ms-excel" || t.type === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
47
|
-
const
|
|
48
|
-
return ["xls", "xlsx"].includes(
|
|
47
|
+
const s = ((n = t.split(".").pop()) == null ? void 0 : n.toLowerCase()) || "";
|
|
48
|
+
return ["xls", "xlsx"].includes(s);
|
|
49
49
|
},
|
|
50
|
-
icon:
|
|
50
|
+
icon: K
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
type: "ppt",
|
|
54
54
|
matcher: (t) => {
|
|
55
|
-
var
|
|
55
|
+
var n;
|
|
56
56
|
if (typeof t != "string")
|
|
57
57
|
return t.type === "application/vnd.ms-powerpoint" || t.type === "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
58
|
-
const
|
|
59
|
-
return ["ppt", "pptx"].includes(
|
|
58
|
+
const s = ((n = t.split(".").pop()) == null ? void 0 : n.toLowerCase()) || "";
|
|
59
|
+
return ["ppt", "pptx"].includes(s);
|
|
60
60
|
},
|
|
61
61
|
icon: q
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
type: "folder",
|
|
65
65
|
matcher: (t) => typeof t != "string" ? !1 : t.toLowerCase().endsWith("folder"),
|
|
66
|
-
icon:
|
|
66
|
+
icon: V
|
|
67
67
|
}
|
|
68
68
|
];
|
|
69
|
-
function
|
|
70
|
-
const { customIcons:
|
|
69
|
+
function Q(t = {}) {
|
|
70
|
+
const { customIcons: s, fileMatchers: n } = t, u = () => {
|
|
71
71
|
let e = [];
|
|
72
|
-
return
|
|
73
|
-
}, i = (e = "other") =>
|
|
74
|
-
if (
|
|
75
|
-
return
|
|
76
|
-
const
|
|
77
|
-
return
|
|
72
|
+
return n ? e = n.concat(N) : e = N, e;
|
|
73
|
+
}, i = (e = "other") => C(() => {
|
|
74
|
+
if (s != null && s[e])
|
|
75
|
+
return s[e];
|
|
76
|
+
const r = u().find((_) => _.type === e);
|
|
77
|
+
return r != null && r.icon ? r.icon : A[e] ? A[e] : A.other;
|
|
78
78
|
}), v = (e) => {
|
|
79
|
-
const
|
|
80
|
-
for (const
|
|
81
|
-
if (
|
|
82
|
-
return
|
|
79
|
+
const a = u();
|
|
80
|
+
for (const r of a)
|
|
81
|
+
if (r.matcher(e))
|
|
82
|
+
return r.type;
|
|
83
83
|
return "other";
|
|
84
|
-
},
|
|
85
|
-
if (
|
|
86
|
-
return c(
|
|
87
|
-
if (w(
|
|
88
|
-
return m(
|
|
84
|
+
}, g = () => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15), I = (e) => e < 1024 ? e + " B" : e < 1024 * 1024 ? (e / 1024).toFixed(2) + " KB" : (e / (1024 * 1024)).toFixed(2) + " MB", b = (e) => typeof e.url == "string" && !!e.url && typeof e.size == "number", w = (e) => e.rawFile instanceof File, l = (e) => e.map((a) => {
|
|
85
|
+
if (b(a))
|
|
86
|
+
return c(a);
|
|
87
|
+
if (w(a))
|
|
88
|
+
return m(a);
|
|
89
89
|
}), h = (e) => ({
|
|
90
|
-
id: e.id ||
|
|
90
|
+
id: e.id || g(),
|
|
91
91
|
name: e.name || "",
|
|
92
92
|
status: e.status || "success",
|
|
93
93
|
message: e.message || ""
|
|
94
94
|
}), c = (e) => {
|
|
95
|
-
const
|
|
95
|
+
const a = h(e), r = e.url, _ = e.size, M = r.split("/").pop() || "";
|
|
96
96
|
return {
|
|
97
|
-
...
|
|
98
|
-
name:
|
|
99
|
-
fileType: v(
|
|
97
|
+
...a,
|
|
98
|
+
name: a.name || M,
|
|
99
|
+
fileType: v(M),
|
|
100
100
|
size: _,
|
|
101
|
-
url:
|
|
101
|
+
url: r
|
|
102
102
|
};
|
|
103
103
|
}, m = (e) => {
|
|
104
|
-
const
|
|
104
|
+
const a = h(e), r = e.rawFile;
|
|
105
105
|
return {
|
|
106
|
-
...
|
|
107
|
-
name:
|
|
108
|
-
fileType: v(
|
|
109
|
-
rawFile:
|
|
110
|
-
size: e.size ||
|
|
106
|
+
...a,
|
|
107
|
+
name: a.name || r.name,
|
|
108
|
+
fileType: v(r),
|
|
109
|
+
rawFile: r,
|
|
110
|
+
size: e.size || r.size,
|
|
111
111
|
url: e.url
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
114
|
return {
|
|
115
115
|
detectFileType: v,
|
|
116
|
-
generateID:
|
|
117
|
-
formatFileSize:
|
|
116
|
+
generateID: g,
|
|
117
|
+
formatFileSize: I,
|
|
118
118
|
normalizeAttachments: l,
|
|
119
119
|
getIconComponent: i
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
const ce = (t,
|
|
122
|
+
const ce = (t, s) => {
|
|
123
123
|
if (t.startsWith("blob:") || t.startsWith("data:")) {
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
const n = document.createElement("a");
|
|
125
|
+
n.href = t, n.download = s, document.body.appendChild(n), requestAnimationFrame(() => {
|
|
126
|
+
n.click(), document.body.removeChild(n), URL.revokeObjectURL(t);
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
|
-
function de(t,
|
|
131
|
-
const
|
|
130
|
+
function de(t, s) {
|
|
131
|
+
const n = R([]), u = C(() => t.file.fileType === "image"), i = (l) => {
|
|
132
132
|
const h = URL.createObjectURL(l);
|
|
133
|
-
return
|
|
133
|
+
return n.value.push(h), h;
|
|
134
134
|
}, v = (l) => {
|
|
135
|
-
|
|
136
|
-
},
|
|
137
|
-
if (
|
|
135
|
+
s("preview", l, t.file);
|
|
136
|
+
}, g = (l) => {
|
|
137
|
+
if (s("download", l, t.file), !l.defaultPrevented && t.file.rawFile && !t.file.url) {
|
|
138
138
|
const h = i(t.file.rawFile);
|
|
139
139
|
ce(h, t.file.name || t.file.rawFile.name);
|
|
140
140
|
}
|
|
141
|
+
}, I = () => {
|
|
142
|
+
s("remove", t.file);
|
|
141
143
|
}, b = () => {
|
|
142
|
-
|
|
143
|
-
}, k = () => {
|
|
144
|
-
r("retry", t.file);
|
|
144
|
+
s("retry", t.file);
|
|
145
145
|
}, w = (l, h) => {
|
|
146
|
-
h.stopPropagation(), l.handler && l.handler(t.file), l.type === "preview" ? v(h) : l.type === "download" ?
|
|
146
|
+
h.stopPropagation(), l.handler && l.handler(t.file), l.type === "preview" ? v(h) : l.type === "download" ? g(h) : s("action", { action: l, file: t.file });
|
|
147
147
|
};
|
|
148
|
-
return
|
|
149
|
-
|
|
148
|
+
return Y(() => {
|
|
149
|
+
n.value.forEach((l) => {
|
|
150
150
|
URL.revokeObjectURL(l);
|
|
151
|
-
}),
|
|
151
|
+
}), n.value = [];
|
|
152
152
|
}), {
|
|
153
153
|
isImage: u,
|
|
154
154
|
handlePreview: v,
|
|
155
|
-
downloadFile:
|
|
156
|
-
handleRemove:
|
|
157
|
-
handleRetry:
|
|
155
|
+
downloadFile: g,
|
|
156
|
+
handleRemove: I,
|
|
157
|
+
handleRetry: b,
|
|
158
158
|
handleCustomAction: w
|
|
159
159
|
};
|
|
160
160
|
}
|
|
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" },
|
|
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" }, ge = ["onClick"], ye = ["src", "alt"], we = /* @__PURE__ */ B({
|
|
162
162
|
__name: "ImagePreview",
|
|
163
|
-
props: /* @__PURE__ */
|
|
163
|
+
props: /* @__PURE__ */ W({
|
|
164
164
|
images: {}
|
|
165
165
|
}, {
|
|
166
166
|
currentIndex: { required: !0 },
|
|
167
167
|
currentIndexModifiers: {}
|
|
168
168
|
}),
|
|
169
|
-
emits: /* @__PURE__ */
|
|
170
|
-
setup(t, { emit:
|
|
171
|
-
const
|
|
169
|
+
emits: /* @__PURE__ */ W(["close"], ["update:currentIndex"]),
|
|
170
|
+
setup(t, { emit: s }) {
|
|
171
|
+
const n = t, u = s, i = Z(t, "currentIndex"), v = C(() => n.images[i.value]), g = () => {
|
|
172
172
|
i.value > 0 && i.value--;
|
|
173
|
-
},
|
|
174
|
-
i.value <
|
|
175
|
-
},
|
|
173
|
+
}, I = () => {
|
|
174
|
+
i.value < n.images.length - 1 && i.value++;
|
|
175
|
+
}, b = (l) => {
|
|
176
176
|
i.value = l;
|
|
177
177
|
};
|
|
178
178
|
function w() {
|
|
@@ -182,21 +182,21 @@ const ue = { class: "tr-image-preview__main" }, fe = ["disabled"], pe = { class:
|
|
|
182
182
|
var c, m;
|
|
183
183
|
return o(), d("div", {
|
|
184
184
|
class: "tr-image-preview",
|
|
185
|
-
onClick:
|
|
185
|
+
onClick: P(w, ["self"])
|
|
186
186
|
}, [
|
|
187
187
|
p("button", {
|
|
188
188
|
class: "tr-image-preview__close",
|
|
189
189
|
onClick: w
|
|
190
190
|
}, [
|
|
191
|
-
F(f(
|
|
191
|
+
F(f(se))
|
|
192
192
|
]),
|
|
193
193
|
p("div", ue, [
|
|
194
194
|
p("button", {
|
|
195
195
|
class: "tr-image-preview__nav tr-image-preview__nav--left",
|
|
196
|
-
onClick:
|
|
196
|
+
onClick: P(g, ["stop"]),
|
|
197
197
|
disabled: i.value === 0
|
|
198
198
|
}, [
|
|
199
|
-
F(f(
|
|
199
|
+
F(f(ae))
|
|
200
200
|
], 8, fe),
|
|
201
201
|
p("div", pe, [
|
|
202
202
|
p("img", {
|
|
@@ -207,7 +207,7 @@ const ue = { class: "tr-image-preview__main" }, fe = ["disabled"], pe = { class:
|
|
|
207
207
|
]),
|
|
208
208
|
p("button", {
|
|
209
209
|
class: "tr-image-preview__nav tr-image-preview__nav--right",
|
|
210
|
-
onClick:
|
|
210
|
+
onClick: P(I, ["stop"]),
|
|
211
211
|
disabled: i.value === l.images.length - 1
|
|
212
212
|
}, [
|
|
213
213
|
F(f(oe))
|
|
@@ -215,102 +215,102 @@ const ue = { class: "tr-image-preview__main" }, fe = ["disabled"], pe = { class:
|
|
|
215
215
|
]),
|
|
216
216
|
p("div", ve, [
|
|
217
217
|
p("div", he, [
|
|
218
|
-
(o(!0), d(
|
|
218
|
+
(o(!0), d(z, null, D(l.images, (e, a) => (o(), d("div", {
|
|
219
219
|
key: e.id,
|
|
220
|
-
class:
|
|
221
|
-
onClick: (
|
|
220
|
+
class: U(["tr-image-preview__thumbnail", { "tr-image-preview__thumbnail--active": a === i.value }]),
|
|
221
|
+
onClick: (r) => b(a)
|
|
222
222
|
}, [
|
|
223
223
|
p("img", {
|
|
224
224
|
src: e.url,
|
|
225
225
|
alt: e.name
|
|
226
|
-
}, null, 8,
|
|
227
|
-
], 10,
|
|
226
|
+
}, null, 8, ye)
|
|
227
|
+
], 10, ge))), 128))
|
|
228
228
|
])
|
|
229
229
|
])
|
|
230
230
|
]);
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
}),
|
|
234
|
-
function
|
|
235
|
-
const u =
|
|
233
|
+
}), Ie = /* @__PURE__ */ S(we, [["__scopeId", "data-v-027af77c"]]);
|
|
234
|
+
function be(t, s, n = {}) {
|
|
235
|
+
const u = R(!1), i = R([]), v = R(0), g = (c) => {
|
|
236
236
|
v.value = c;
|
|
237
|
-
},
|
|
237
|
+
}, I = (c) => {
|
|
238
238
|
const m = t.value.findIndex((e) => e.id === c.id);
|
|
239
239
|
if (m !== -1 && c.url && t.value.splice(m, 1, c), c.fileType === "image") {
|
|
240
240
|
i.value = t.value.filter(
|
|
241
|
-
(
|
|
241
|
+
(a) => a.fileType === "image" && a.status !== "error" && a.status !== "uploading"
|
|
242
242
|
);
|
|
243
|
-
const e = i.value.findIndex((
|
|
243
|
+
const e = i.value.findIndex((a) => a.id === c.id);
|
|
244
244
|
e !== -1 && (v.value = e, u.value = !0);
|
|
245
245
|
}
|
|
246
|
-
},
|
|
247
|
-
|
|
246
|
+
}, b = (c, m) => {
|
|
247
|
+
s("preview", c, m), !c.defaultPrevented && I(m);
|
|
248
248
|
}, w = () => {
|
|
249
249
|
u.value = !1;
|
|
250
250
|
}, l = (c, m) => {
|
|
251
|
-
|
|
251
|
+
n.onDownload ? n.onDownload(c, m) : s("download", c, m);
|
|
252
252
|
};
|
|
253
253
|
return {
|
|
254
254
|
// 显示预览
|
|
255
|
-
handlePreview:
|
|
255
|
+
handlePreview: b,
|
|
256
256
|
// 渲染预览组件
|
|
257
|
-
renderPreview: () => u.value ? ee(
|
|
257
|
+
renderPreview: () => u.value ? ee(Ie, {
|
|
258
258
|
images: i.value,
|
|
259
259
|
currentIndex: v.value,
|
|
260
|
-
"onUpdate:currentIndex":
|
|
260
|
+
"onUpdate:currentIndex": g,
|
|
261
261
|
onClose: w,
|
|
262
262
|
onDownload: l
|
|
263
263
|
}) : null
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function ke(t, s) {
|
|
267
267
|
return {
|
|
268
|
-
actualListType:
|
|
268
|
+
actualListType: C(() => s && s !== "auto" ? s : t.value.length === 0 ? "card" : t.value.every((i) => i.fileType === "image") ? "picture" : "card")
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
|
-
const
|
|
271
|
+
const Ce = ["data-file-type"], Fe = {
|
|
272
272
|
key: 1,
|
|
273
273
|
class: "tr-file-card__picture-container"
|
|
274
|
-
}, xe = ["src", "alt"],
|
|
274
|
+
}, xe = ["src", "alt"], Pe = {
|
|
275
275
|
key: 0,
|
|
276
276
|
class: "tr-file-card__picture-overlay"
|
|
277
|
-
},
|
|
277
|
+
}, Me = {
|
|
278
278
|
key: 1,
|
|
279
279
|
class: "tr-file-card__status-overlay tr-file-card__status-overlay--picture"
|
|
280
|
-
},
|
|
280
|
+
}, Re = {
|
|
281
281
|
key: 0,
|
|
282
282
|
class: "tr-file-card__status-icon tr-file-card__status-icon--loading"
|
|
283
|
-
},
|
|
283
|
+
}, Ue = {
|
|
284
284
|
key: 0,
|
|
285
285
|
class: "tr-file-card__status-icon--loading-text"
|
|
286
|
-
},
|
|
286
|
+
}, Le = {
|
|
287
287
|
key: 2,
|
|
288
288
|
class: "tr-file-card__default-container"
|
|
289
|
-
},
|
|
289
|
+
}, $e = { class: "tr-file-card__icon-wrapper" }, Te = {
|
|
290
290
|
key: 0,
|
|
291
291
|
class: "tr-file-card__status-overlay tr-file-card__status-overlay--icon"
|
|
292
|
-
},
|
|
292
|
+
}, Ae = {
|
|
293
293
|
key: 0,
|
|
294
294
|
class: "tr-file-card__status-icon tr-file-card__status-icon--loading"
|
|
295
|
-
},
|
|
295
|
+
}, Be = { class: "tr-file-card__content" }, ze = { class: "tr-file-card__info" }, De = ["title"], Se = {
|
|
296
296
|
key: 0,
|
|
297
297
|
class: "tr-file-card__status"
|
|
298
|
-
},
|
|
298
|
+
}, We = {
|
|
299
299
|
key: 0,
|
|
300
300
|
class: "tr-file-card__status-success"
|
|
301
|
-
},
|
|
301
|
+
}, je = { class: "tr-file-card__status-info" }, Ee = { class: "tr-file-card__file-type" }, Ne = {
|
|
302
302
|
key: 0,
|
|
303
303
|
class: "tr-file-card__file-size"
|
|
304
|
-
},
|
|
304
|
+
}, Oe = {
|
|
305
305
|
key: 0,
|
|
306
306
|
class: "tr-file-card__actions"
|
|
307
|
-
},
|
|
307
|
+
}, Ve = ["href", "target", "onClick"], qe = ["onClick"], Ke = {
|
|
308
308
|
key: 1,
|
|
309
309
|
class: "tr-file-card__status-uploading"
|
|
310
|
-
},
|
|
310
|
+
}, Ge = {
|
|
311
311
|
key: 2,
|
|
312
312
|
class: "tr-file-card__status-error"
|
|
313
|
-
},
|
|
313
|
+
}, He = /* @__PURE__ */ B({
|
|
314
314
|
__name: "FileCard",
|
|
315
315
|
props: {
|
|
316
316
|
file: {},
|
|
@@ -322,128 +322,128 @@ const Ie = ["data-file-type"], Fe = {
|
|
|
322
322
|
fileMatchers: {}
|
|
323
323
|
},
|
|
324
324
|
emits: ["remove", "preview", "action", "retry", "download"],
|
|
325
|
-
setup(t, { emit:
|
|
326
|
-
const
|
|
327
|
-
customIcons:
|
|
328
|
-
fileMatchers:
|
|
329
|
-
}), { isImage:
|
|
330
|
-
|
|
331
|
-
`tr-file-card--${
|
|
325
|
+
setup(t, { emit: s }) {
|
|
326
|
+
const n = t, u = s, { formatFileSize: i, getIconComponent: v } = Q({
|
|
327
|
+
customIcons: n.fileIcons,
|
|
328
|
+
fileMatchers: n.fileMatchers
|
|
329
|
+
}), { isImage: g, handlePreview: I, handleRemove: b, handleCustomAction: w, handleRetry: l } = de(n, u), h = C(() => v(n.file.fileType).value), c = C(() => n.file.status === "uploading"), m = C(() => n.file.status === "success"), e = C(() => n.file.status === "error"), a = C(() => [
|
|
330
|
+
n.variant === "picture" ? "tr-file-card--picture" : "tr-file-card",
|
|
331
|
+
`tr-file-card--${n.file.fileType || "other"}`,
|
|
332
332
|
{
|
|
333
333
|
"tr-file-card--uploading": c.value,
|
|
334
334
|
"tr-file-card--error": e.value,
|
|
335
335
|
"tr-file-card--success": m.value
|
|
336
336
|
}
|
|
337
337
|
]);
|
|
338
|
-
return (
|
|
339
|
-
var
|
|
338
|
+
return (r, _) => {
|
|
339
|
+
var M;
|
|
340
340
|
return o(), d("div", {
|
|
341
|
-
class:
|
|
342
|
-
"data-file-type":
|
|
343
|
-
onClick: _[3] || (_[3] = (
|
|
341
|
+
class: U(a.value),
|
|
342
|
+
"data-file-type": r.file.fileType || "other",
|
|
343
|
+
onClick: _[3] || (_[3] = (y) => r.variant === "picture" ? f(I)(y) : void 0)
|
|
344
344
|
}, [
|
|
345
|
-
|
|
345
|
+
r.disabled ? k("", !0) : (o(), d("button", {
|
|
346
346
|
key: 0,
|
|
347
347
|
class: "tr-file-card__close-btn",
|
|
348
|
-
onClick: _[0] || (_[0] =
|
|
348
|
+
onClick: _[0] || (_[0] = P(
|
|
349
349
|
//@ts-ignore
|
|
350
|
-
(...
|
|
350
|
+
(...y) => f(b) && f(b)(...y),
|
|
351
351
|
["stop"]
|
|
352
352
|
)),
|
|
353
353
|
"aria-label": "移除文件"
|
|
354
354
|
}, [
|
|
355
355
|
F(f(ie))
|
|
356
356
|
])),
|
|
357
|
-
|
|
357
|
+
r.variant === "picture" ? (o(), d("div", Fe, [
|
|
358
358
|
p("img", {
|
|
359
|
-
src:
|
|
360
|
-
alt:
|
|
359
|
+
src: r.file.url,
|
|
360
|
+
alt: r.file.name,
|
|
361
361
|
class: "tr-file-card__picture-img"
|
|
362
362
|
}, null, 8, xe),
|
|
363
|
-
m.value ? (o(), d("div",
|
|
363
|
+
m.value ? (o(), d("div", Pe, _[4] || (_[4] = [
|
|
364
364
|
p("span", { class: "tr-file-card__picture-overlay-text" }, "预览", -1)
|
|
365
|
-
]))) :
|
|
366
|
-
c.value || e.value ? (o(), d("div",
|
|
367
|
-
c.value ? (o(), d("div",
|
|
368
|
-
F(f(
|
|
369
|
-
|
|
370
|
-
])) : e.value ? (o(),
|
|
365
|
+
]))) : k("", !0),
|
|
366
|
+
c.value || e.value ? (o(), d("div", Me, [
|
|
367
|
+
c.value ? (o(), d("div", Re, [
|
|
368
|
+
F(f(j)),
|
|
369
|
+
r.file.message ? (o(), d("span", Ue, x(r.file.message), 1)) : k("", !0)
|
|
370
|
+
])) : e.value ? (o(), L(f(le), {
|
|
371
371
|
key: 1,
|
|
372
372
|
content: "解析失败",
|
|
373
373
|
placement: "top",
|
|
374
374
|
effect: "light"
|
|
375
375
|
}, {
|
|
376
376
|
default: te(() => [
|
|
377
|
-
F(f(
|
|
377
|
+
F(f(E), { class: "tr-file-card__status-icon tr-file-card__status-icon--error" })
|
|
378
378
|
]),
|
|
379
379
|
_: 1
|
|
380
|
-
})) :
|
|
381
|
-
])) :
|
|
382
|
-
])) : (o(), d("div",
|
|
380
|
+
})) : k("", !0)
|
|
381
|
+
])) : k("", !0)
|
|
382
|
+
])) : (o(), d("div", Le, [
|
|
383
383
|
p("div", {
|
|
384
|
-
class:
|
|
385
|
-
onClick: _[1] || (_[1] =
|
|
384
|
+
class: U(["tr-file-card__icon", { "tr-file-card__icon--clickable": f(g) }]),
|
|
385
|
+
onClick: _[1] || (_[1] = P((y) => f(g) ? f(I)(y) : null, ["stop"]))
|
|
386
386
|
}, [
|
|
387
|
-
p("div",
|
|
388
|
-
(o(),
|
|
389
|
-
c.value || e.value ? (o(), d("div",
|
|
390
|
-
c.value ? (o(), d("div",
|
|
391
|
-
F(f(
|
|
392
|
-
])) : e.value ? (o(),
|
|
387
|
+
p("div", $e, [
|
|
388
|
+
(o(), L(O(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(j))
|
|
392
|
+
])) : e.value ? (o(), L(f(E), {
|
|
393
393
|
key: 1,
|
|
394
394
|
class: "tr-file-card__status-icon tr-file-card__status-icon--error"
|
|
395
|
-
})) :
|
|
396
|
-
])) :
|
|
395
|
+
})) : k("", !0)
|
|
396
|
+
])) : k("", !0)
|
|
397
397
|
])
|
|
398
398
|
], 2),
|
|
399
|
-
p("div",
|
|
400
|
-
p("div",
|
|
399
|
+
p("div", Be, [
|
|
400
|
+
p("div", ze, [
|
|
401
401
|
p("div", {
|
|
402
402
|
class: "tr-file-card__name",
|
|
403
|
-
title:
|
|
404
|
-
}, x(
|
|
405
|
-
|
|
406
|
-
m.value ? (o(), d("div",
|
|
407
|
-
p("div",
|
|
408
|
-
p("span",
|
|
409
|
-
|
|
403
|
+
title: r.file.name
|
|
404
|
+
}, x(r.file.name), 9, De),
|
|
405
|
+
r.showStatus ? (o(), d("div", Se, [
|
|
406
|
+
m.value ? (o(), d("div", We, [
|
|
407
|
+
p("div", je, [
|
|
408
|
+
p("span", Ee, x(((M = r.file.fileType) == null ? void 0 : M.toUpperCase()) || "FILE"), 1),
|
|
409
|
+
r.file.size ? (o(), d("span", Ne, x(f(i)(r.file.size)), 1)) : k("", !0)
|
|
410
410
|
]),
|
|
411
|
-
|
|
412
|
-
(o(!0), d(
|
|
413
|
-
key:
|
|
411
|
+
r.actions ? (o(), d("div", Oe, [
|
|
412
|
+
(o(!0), d(z, null, D(r.actions, (y, X) => (o(), d("div", {
|
|
413
|
+
key: X,
|
|
414
414
|
class: "tr-file-card__action-btn"
|
|
415
415
|
}, [
|
|
416
|
-
|
|
416
|
+
y.type === "download" ? (o(), d("a", {
|
|
417
417
|
key: 0,
|
|
418
418
|
class: "tr-file-card__action-btn--download",
|
|
419
|
-
href:
|
|
420
|
-
target:
|
|
421
|
-
onClick: (
|
|
422
|
-
}, x(
|
|
419
|
+
href: r.file.url ?? "javascript:void(0)",
|
|
420
|
+
target: r.file.url ? "_blank" : "_self",
|
|
421
|
+
onClick: (T) => f(w)(y, T)
|
|
422
|
+
}, x(y.label), 9, Ve)) : (o(), d("button", {
|
|
423
423
|
key: 1,
|
|
424
|
-
class:
|
|
425
|
-
onClick: (
|
|
426
|
-
}, x(
|
|
424
|
+
class: U(`tr-file-card__action-btn--${y.type}`),
|
|
425
|
+
onClick: (T) => f(w)(y, T)
|
|
426
|
+
}, x(y.label), 11, qe))
|
|
427
427
|
]))), 128))
|
|
428
|
-
])) :
|
|
429
|
-
])) : c.value ? (o(), d("div",
|
|
428
|
+
])) : k("", !0)
|
|
429
|
+
])) : c.value ? (o(), d("div", Ke, _[5] || (_[5] = [
|
|
430
430
|
p("span", { class: "tr-file-card__uploading-text" }, "上传中...", -1)
|
|
431
|
-
]))) : e.value ? (o(), d("div",
|
|
431
|
+
]))) : e.value ? (o(), d("div", Ge, [
|
|
432
432
|
_[6] || (_[6] = p("span", { class: "tr-file-card__error-text" }, "上传失败", -1)),
|
|
433
433
|
p("button", {
|
|
434
434
|
class: "tr-file-card__retry-btn",
|
|
435
435
|
onClick: _[2] || (_[2] = //@ts-ignore
|
|
436
|
-
(...
|
|
436
|
+
(...y) => f(l) && f(l)(...y))
|
|
437
437
|
}, "重试")
|
|
438
|
-
])) :
|
|
439
|
-
])) :
|
|
438
|
+
])) : k("", !0)
|
|
439
|
+
])) : k("", !0)
|
|
440
440
|
])
|
|
441
441
|
])
|
|
442
442
|
]))
|
|
443
|
-
], 10,
|
|
443
|
+
], 10, Ce);
|
|
444
444
|
};
|
|
445
445
|
}
|
|
446
|
-
}),
|
|
446
|
+
}), Je = /* @__PURE__ */ S(He, [["__scopeId", "data-v-a569c028"]]), Qe = { class: "tr-attachments" }, Xe = /* @__PURE__ */ B({
|
|
447
447
|
__name: "index",
|
|
448
448
|
props: {
|
|
449
449
|
items: {},
|
|
@@ -464,15 +464,15 @@ const Ie = ["data-file-type"], Fe = {
|
|
|
464
464
|
fileMatchers: { default: () => [] }
|
|
465
465
|
},
|
|
466
466
|
emits: ["update:items", "remove", "download", "retry", "preview", "action"],
|
|
467
|
-
setup(t, { emit:
|
|
468
|
-
const
|
|
469
|
-
function
|
|
470
|
-
if (
|
|
471
|
-
const
|
|
472
|
-
|
|
467
|
+
setup(t, { emit: s }) {
|
|
468
|
+
const n = t, u = s, i = R(n.items || []), { actualListType: v } = ke(i, n.variant), { handlePreview: g, renderPreview: I } = be(i, u, { enableDownload: !0 });
|
|
469
|
+
function b(e) {
|
|
470
|
+
if (n.disabled) return;
|
|
471
|
+
const a = i.value.findIndex((r) => r.id === e.id);
|
|
472
|
+
a !== -1 && (i.value.splice(a, 1), u("remove", e), u("update:items", i.value));
|
|
473
473
|
}
|
|
474
|
-
function w(e,
|
|
475
|
-
u("download", e,
|
|
474
|
+
function w(e, a) {
|
|
475
|
+
u("download", e, a);
|
|
476
476
|
}
|
|
477
477
|
function l(e) {
|
|
478
478
|
u("retry", e);
|
|
@@ -480,47 +480,47 @@ const Ie = ["data-file-type"], Fe = {
|
|
|
480
480
|
function h(e) {
|
|
481
481
|
u("action", e);
|
|
482
482
|
}
|
|
483
|
-
const c =
|
|
484
|
-
fileMatchers:
|
|
483
|
+
const c = C(() => n.wrap ? "wrap" : "no-wrap"), { normalizeAttachments: m } = Q({
|
|
484
|
+
fileMatchers: n.fileMatchers
|
|
485
485
|
});
|
|
486
|
-
return
|
|
487
|
-
() =>
|
|
486
|
+
return ne(
|
|
487
|
+
() => n.items,
|
|
488
488
|
(e) => {
|
|
489
489
|
e && e.length > 0 && (i.value = m(e));
|
|
490
490
|
},
|
|
491
491
|
{ deep: !0, immediate: !0 }
|
|
492
|
-
), (e,
|
|
492
|
+
), (e, a) => (o(), d("div", Qe, [
|
|
493
493
|
i.value.length > 0 ? (o(), d("div", {
|
|
494
494
|
key: 0,
|
|
495
|
-
class:
|
|
496
|
-
onClick:
|
|
495
|
+
class: U(["tr-attachments__file-list", c.value]),
|
|
496
|
+
onClick: a[0] || (a[0] = P(() => {
|
|
497
497
|
}, ["stop"]))
|
|
498
498
|
}, [
|
|
499
|
-
(o(!0), d(
|
|
500
|
-
key:
|
|
501
|
-
file:
|
|
499
|
+
(o(!0), d(z, null, D(i.value, (r) => (o(), L(Je, {
|
|
500
|
+
key: r.id,
|
|
501
|
+
file: r,
|
|
502
502
|
variant: f(v),
|
|
503
503
|
"file-icons": e.fileIcons,
|
|
504
504
|
disabled: e.disabled,
|
|
505
505
|
actions: e.actions,
|
|
506
506
|
"show-status": !0,
|
|
507
507
|
"file-matchers": e.fileMatchers,
|
|
508
|
-
onRemove:
|
|
509
|
-
onPreview: f(
|
|
508
|
+
onRemove: b,
|
|
509
|
+
onPreview: f(g),
|
|
510
510
|
onDownload: w,
|
|
511
511
|
onRetry: l,
|
|
512
512
|
onAction: h
|
|
513
513
|
}, null, 8, ["file", "variant", "file-icons", "disabled", "actions", "file-matchers", "onPreview"]))), 128))
|
|
514
|
-
], 2)) :
|
|
515
|
-
(o(),
|
|
514
|
+
], 2)) : k("", !0),
|
|
515
|
+
(o(), L(O(f(I)())))
|
|
516
516
|
]));
|
|
517
517
|
}
|
|
518
|
-
}),
|
|
519
|
-
|
|
520
|
-
const
|
|
521
|
-
t.component(
|
|
518
|
+
}), $ = /* @__PURE__ */ S(Xe, [["__scopeId", "data-v-e09559ac"]]);
|
|
519
|
+
$.name = "TrAttachments";
|
|
520
|
+
const Ye = function(t) {
|
|
521
|
+
t.component($.name, $);
|
|
522
522
|
};
|
|
523
|
-
|
|
523
|
+
$.install = Ye;
|
|
524
524
|
export {
|
|
525
|
-
|
|
525
|
+
$ as default
|
|
526
526
|
};
|