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