@opentiny/tiny-robot 0.3.0-alpha.8 → 0.3.0-rc.0
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 +19 -19
- package/dist/attachments/index.js +266 -266
- package/dist/base-popper/index.js +1 -1
- package/dist/bubble/index.js +1460 -1435
- package/dist/container/index.js +35 -35
- package/dist/drag-overlay/index.js +1 -1
- package/dist/dropdown-menu/index.js +123 -51
- package/dist/feedback/index.js +72 -72
- package/dist/flow-layout-buttons/index.js +15 -15
- package/dist/history/index.js +72 -73
- package/dist/index.d.ts +210 -202
- package/dist/index.js +98 -98
- package/dist/index2.js +680 -608
- package/dist/index3.js +148 -675
- package/dist/mcp-server-picker/index.js +572 -29518
- package/dist/no-data.js +4 -0
- package/dist/sender/index.js +883 -815
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +31 -31
- package/dist/suggestion-popover/index.js +169 -162
- package/dist/useSlotRefs.js +13 -13
- package/dist/utils.js +8 -2
- package/package.json +4 -14
- package/dist/close.js +0 -29
- package/dist/index4.js +0 -146
- 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 -1139
|
@@ -1,64 +1,64 @@
|
|
|
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:
|
|
10
|
-
ppt:
|
|
4
|
+
import { TinyTooltip as le } from "@opentiny/vue";
|
|
5
|
+
const A = {
|
|
6
|
+
image: J,
|
|
7
|
+
pdf: H,
|
|
8
|
+
word: G,
|
|
9
|
+
excel: K,
|
|
10
|
+
ppt: q,
|
|
11
11
|
folder: V,
|
|
12
|
-
other:
|
|
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
|
-
icon:
|
|
61
|
+
icon: q
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
type: "folder",
|
|
@@ -66,251 +66,251 @@ const T = {
|
|
|
66
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
|
|
78
|
-
}),
|
|
79
|
-
const
|
|
80
|
-
for (const
|
|
81
|
-
if (
|
|
82
|
-
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
|
+
}), v = (e) => {
|
|
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 (b(
|
|
86
|
-
return
|
|
87
|
-
if (
|
|
88
|
-
return
|
|
89
|
-
}),
|
|
90
|
-
id: e.id ||
|
|
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
|
+
}), h = (e) => ({
|
|
90
|
+
id: e.id || g(),
|
|
91
91
|
name: e.name || "",
|
|
92
92
|
status: e.status || "success",
|
|
93
93
|
message: e.message || ""
|
|
94
|
-
}),
|
|
95
|
-
const
|
|
94
|
+
}), c = (e) => {
|
|
95
|
+
const a = h(e), r = e.url, _ = e.size, M = r.split("/").pop() || "";
|
|
96
96
|
return {
|
|
97
|
-
...
|
|
98
|
-
name:
|
|
99
|
-
fileType:
|
|
100
|
-
size:
|
|
101
|
-
url:
|
|
97
|
+
...a,
|
|
98
|
+
name: a.name || M,
|
|
99
|
+
fileType: v(M),
|
|
100
|
+
size: _,
|
|
101
|
+
url: r
|
|
102
102
|
};
|
|
103
|
-
},
|
|
104
|
-
const
|
|
103
|
+
}, m = (e) => {
|
|
104
|
+
const a = h(e), r = e.rawFile;
|
|
105
105
|
return {
|
|
106
|
-
...
|
|
107
|
-
name:
|
|
108
|
-
fileType:
|
|
109
|
-
rawFile:
|
|
110
|
-
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
|
-
detectFileType:
|
|
116
|
-
generateID:
|
|
117
|
-
formatFileSize:
|
|
118
|
-
|
|
115
|
+
detectFileType: v,
|
|
116
|
+
generateID: g,
|
|
117
|
+
formatFileSize: I,
|
|
118
|
+
normalizeAttachments: l,
|
|
119
119
|
getIconComponent: i
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
|
-
const ce = (t,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
const ce = (t, s) => {
|
|
123
|
+
if (t.startsWith("blob:") || t.startsWith("data:")) {
|
|
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
|
-
document.body.removeChild(s);
|
|
129
129
|
};
|
|
130
|
-
function de(t,
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
return
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
},
|
|
137
|
-
if (t.file.rawFile && !t.file.url) {
|
|
138
|
-
const
|
|
139
|
-
ce(
|
|
130
|
+
function de(t, s) {
|
|
131
|
+
const n = R([]), u = C(() => t.file.fileType === "image"), i = (l) => {
|
|
132
|
+
const h = URL.createObjectURL(l);
|
|
133
|
+
return n.value.push(h), h;
|
|
134
|
+
}, v = (l) => {
|
|
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
|
+
const h = i(t.file.rawFile);
|
|
139
|
+
ce(h, t.file.name || t.file.rawFile.name);
|
|
140
140
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
n("remove", t.file);
|
|
141
|
+
}, I = () => {
|
|
142
|
+
s("remove", t.file);
|
|
144
143
|
}, b = () => {
|
|
145
|
-
|
|
146
|
-
},
|
|
147
|
-
|
|
144
|
+
s("retry", t.file);
|
|
145
|
+
}, w = (l, h) => {
|
|
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 });
|
|
148
147
|
};
|
|
149
148
|
return Y(() => {
|
|
150
|
-
|
|
151
|
-
URL.revokeObjectURL(
|
|
152
|
-
}),
|
|
149
|
+
n.value.forEach((l) => {
|
|
150
|
+
URL.revokeObjectURL(l);
|
|
151
|
+
}), n.value = [];
|
|
153
152
|
}), {
|
|
154
|
-
isImage:
|
|
155
|
-
handlePreview:
|
|
156
|
-
downloadFile:
|
|
157
|
-
handleRemove:
|
|
153
|
+
isImage: u,
|
|
154
|
+
handlePreview: v,
|
|
155
|
+
downloadFile: g,
|
|
156
|
+
handleRemove: I,
|
|
158
157
|
handleRetry: b,
|
|
159
|
-
handleCustomAction:
|
|
158
|
+
handleCustomAction: w
|
|
160
159
|
};
|
|
161
160
|
}
|
|
162
|
-
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({
|
|
163
162
|
__name: "ImagePreview",
|
|
164
|
-
props: /* @__PURE__ */
|
|
163
|
+
props: /* @__PURE__ */ W({
|
|
165
164
|
images: {}
|
|
166
165
|
}, {
|
|
167
166
|
currentIndex: { required: !0 },
|
|
168
167
|
currentIndexModifiers: {}
|
|
169
168
|
}),
|
|
170
|
-
emits: /* @__PURE__ */
|
|
171
|
-
setup(t, { emit:
|
|
172
|
-
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 = () => {
|
|
173
172
|
i.value > 0 && i.value--;
|
|
174
|
-
},
|
|
175
|
-
i.value <
|
|
176
|
-
}, b = (
|
|
177
|
-
i.value =
|
|
173
|
+
}, I = () => {
|
|
174
|
+
i.value < n.images.length - 1 && i.value++;
|
|
175
|
+
}, b = (l) => {
|
|
176
|
+
i.value = l;
|
|
178
177
|
};
|
|
179
|
-
function
|
|
180
|
-
|
|
178
|
+
function w() {
|
|
179
|
+
u("close");
|
|
181
180
|
}
|
|
182
|
-
return (
|
|
183
|
-
var
|
|
184
|
-
return
|
|
181
|
+
return (l, h) => {
|
|
182
|
+
var c, m;
|
|
183
|
+
return o(), d("div", {
|
|
185
184
|
class: "tr-image-preview",
|
|
186
|
-
onClick:
|
|
185
|
+
onClick: P(w, ["self"])
|
|
187
186
|
}, [
|
|
188
187
|
p("button", {
|
|
189
188
|
class: "tr-image-preview__close",
|
|
190
|
-
onClick:
|
|
189
|
+
onClick: w
|
|
191
190
|
}, [
|
|
192
|
-
F(f(
|
|
191
|
+
F(f(se))
|
|
193
192
|
]),
|
|
194
193
|
p("div", ue, [
|
|
195
194
|
p("button", {
|
|
196
195
|
class: "tr-image-preview__nav tr-image-preview__nav--left",
|
|
197
|
-
onClick:
|
|
196
|
+
onClick: P(g, ["stop"]),
|
|
198
197
|
disabled: i.value === 0
|
|
199
198
|
}, [
|
|
200
|
-
F(f(
|
|
199
|
+
F(f(ae))
|
|
201
200
|
], 8, fe),
|
|
202
201
|
p("div", pe, [
|
|
203
202
|
p("img", {
|
|
204
|
-
src: (
|
|
205
|
-
alt: (
|
|
203
|
+
src: (c = v.value) == null ? void 0 : c.url,
|
|
204
|
+
alt: (m = v.value) == null ? void 0 : m.name,
|
|
206
205
|
class: "tr-image-preview__image"
|
|
207
206
|
}, null, 8, me)
|
|
208
207
|
]),
|
|
209
208
|
p("button", {
|
|
210
209
|
class: "tr-image-preview__nav tr-image-preview__nav--right",
|
|
211
|
-
onClick:
|
|
212
|
-
disabled: i.value ===
|
|
210
|
+
onClick: P(I, ["stop"]),
|
|
211
|
+
disabled: i.value === l.images.length - 1
|
|
213
212
|
}, [
|
|
214
213
|
F(f(oe))
|
|
215
214
|
], 8, _e)
|
|
216
215
|
]),
|
|
217
216
|
p("div", ve, [
|
|
218
217
|
p("div", he, [
|
|
219
|
-
(
|
|
218
|
+
(o(!0), d(z, null, D(l.images, (e, a) => (o(), d("div", {
|
|
220
219
|
key: e.id,
|
|
221
|
-
class: U(["tr-image-preview__thumbnail", { "tr-image-preview__thumbnail--active":
|
|
222
|
-
onClick: (
|
|
220
|
+
class: U(["tr-image-preview__thumbnail", { "tr-image-preview__thumbnail--active": a === i.value }]),
|
|
221
|
+
onClick: (r) => b(a)
|
|
223
222
|
}, [
|
|
224
223
|
p("img", {
|
|
225
224
|
src: e.url,
|
|
226
225
|
alt: e.name
|
|
227
|
-
}, null, 8,
|
|
228
|
-
], 10,
|
|
226
|
+
}, null, 8, ye)
|
|
227
|
+
], 10, ge))), 128))
|
|
229
228
|
])
|
|
230
229
|
])
|
|
231
230
|
]);
|
|
232
231
|
};
|
|
233
232
|
}
|
|
234
|
-
}),
|
|
235
|
-
function
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
},
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
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
|
+
v.value = c;
|
|
237
|
+
}, I = (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") {
|
|
241
240
|
i.value = t.value.filter(
|
|
242
|
-
(
|
|
241
|
+
(a) => a.fileType === "image" && a.status !== "error" && a.status !== "uploading"
|
|
243
242
|
);
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
243
|
+
const e = i.value.findIndex((a) => a.id === c.id);
|
|
244
|
+
e !== -1 && (v.value = e, u.value = !0);
|
|
245
|
+
}
|
|
246
|
+
}, b = (c, m) => {
|
|
247
|
+
s("preview", c, m), !c.defaultPrevented && I(m);
|
|
248
|
+
}, w = () => {
|
|
249
|
+
u.value = !1;
|
|
250
|
+
}, l = (c, m) => {
|
|
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: () =>
|
|
257
|
+
renderPreview: () => u.value ? ee(Ie, {
|
|
258
258
|
images: i.value,
|
|
259
|
-
currentIndex:
|
|
260
|
-
"onUpdate:currentIndex":
|
|
261
|
-
onClose:
|
|
262
|
-
onDownload:
|
|
259
|
+
currentIndex: v.value,
|
|
260
|
+
"onUpdate:currentIndex": g,
|
|
261
|
+
onClose: w,
|
|
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
|
-
}, je = { class: "tr-file-card__status-info" },
|
|
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
|
-
}, Ve = ["href", "target", "onClick"],
|
|
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
|
-
"tr-file-card--uploading":
|
|
333
|
+
"tr-file-card--uploading": c.value,
|
|
334
334
|
"tr-file-card--error": e.value,
|
|
335
|
-
"tr-file-card--success":
|
|
335
|
+
"tr-file-card--success": m.value
|
|
336
336
|
}
|
|
337
337
|
]);
|
|
338
|
-
return (
|
|
339
|
-
var
|
|
340
|
-
return
|
|
341
|
-
class: U(
|
|
342
|
-
"data-file-type":
|
|
343
|
-
onClick:
|
|
338
|
+
return (r, _) => {
|
|
339
|
+
var M;
|
|
340
|
+
return o(), d("div", {
|
|
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:
|
|
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
|
-
|
|
363
|
+
m.value ? (o(), d("div", Pe, _[4] || (_[4] = [
|
|
364
364
|
p("span", { class: "tr-file-card__picture-overlay-text" }, "预览", -1)
|
|
365
|
-
]))) :
|
|
366
|
-
|
|
367
|
-
|
|
365
|
+
]))) : k("", !0),
|
|
366
|
+
c.value || e.value ? (o(), d("div", Me, [
|
|
367
|
+
c.value ? (o(), d("div", Re, [
|
|
368
368
|
F(f(j)),
|
|
369
|
-
|
|
370
|
-
])) : e.value ? (
|
|
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
|
-
])) : (
|
|
380
|
+
})) : k("", !0)
|
|
381
|
+
])) : k("", !0)
|
|
382
|
+
])) : (o(), d("div", Le, [
|
|
383
383
|
p("div", {
|
|
384
|
-
class: U(["tr-file-card__icon", { "tr-file-card__icon--clickable": f(
|
|
385
|
-
onClick:
|
|
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
|
-
(
|
|
389
|
-
|
|
390
|
-
|
|
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
391
|
F(f(j))
|
|
392
|
-
])) : e.value ? (
|
|
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
|
-
|
|
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
407
|
p("div", je, [
|
|
408
|
-
p("span",
|
|
409
|
-
|
|
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
|
-
(
|
|
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: U(`tr-file-card__action-btn--${
|
|
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
|
-
])) :
|
|
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 ? (
|
|
432
|
-
|
|
431
|
+
]))) : e.value ? (o(), d("div", Ge, [
|
|
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
|
-
onClick:
|
|
436
|
-
(...
|
|
435
|
+
onClick: _[2] || (_[2] = //@ts-ignore
|
|
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,63 +464,63 @@ 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
|
|
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
469
|
function b(e) {
|
|
470
|
-
if (
|
|
471
|
-
const
|
|
472
|
-
|
|
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
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
function d(e) {
|
|
478
|
-
o("retry", e);
|
|
474
|
+
function w(e, a) {
|
|
475
|
+
u("download", e, a);
|
|
479
476
|
}
|
|
480
477
|
function l(e) {
|
|
481
|
-
|
|
478
|
+
u("retry", e);
|
|
479
|
+
}
|
|
480
|
+
function h(e) {
|
|
481
|
+
u("action", e);
|
|
482
482
|
}
|
|
483
|
-
const
|
|
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
|
-
e && e.length > 0 && (i.value =
|
|
489
|
+
e && e.length > 0 && (i.value = m(e));
|
|
490
490
|
},
|
|
491
491
|
{ deep: !0, immediate: !0 }
|
|
492
|
-
), (e,
|
|
493
|
-
i.value.length > 0 ? (
|
|
492
|
+
), (e, a) => (o(), d("div", Qe, [
|
|
493
|
+
i.value.length > 0 ? (o(), d("div", {
|
|
494
494
|
key: 0,
|
|
495
|
-
class: U(["tr-attachments__file-list",
|
|
496
|
-
onClick:
|
|
495
|
+
class: U(["tr-attachments__file-list", c.value]),
|
|
496
|
+
onClick: a[0] || (a[0] = P(() => {
|
|
497
497
|
}, ["stop"]))
|
|
498
498
|
}, [
|
|
499
|
-
(
|
|
500
|
-
key:
|
|
501
|
-
file:
|
|
502
|
-
variant: f(
|
|
499
|
+
(o(!0), d(z, null, D(i.value, (r) => (o(), L(Je, {
|
|
500
|
+
key: r.id,
|
|
501
|
+
file: r,
|
|
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
508
|
onRemove: b,
|
|
509
|
-
onPreview: f(
|
|
510
|
-
onDownload:
|
|
511
|
-
onRetry:
|
|
512
|
-
onAction:
|
|
509
|
+
onPreview: f(g),
|
|
510
|
+
onDownload: w,
|
|
511
|
+
onRetry: l,
|
|
512
|
+
onAction: h
|
|
513
513
|
}, null, 8, ["file", "variant", "file-icons", "disabled", "actions", "file-matchers", "onPreview"]))), 128))
|
|
514
|
-
], 2)) :
|
|
515
|
-
(
|
|
514
|
+
], 2)) : k("", !0),
|
|
515
|
+
(o(), L(O(f(I)())))
|
|
516
516
|
]));
|
|
517
517
|
}
|
|
518
|
-
}),
|
|
519
|
-
|
|
518
|
+
}), $ = /* @__PURE__ */ S(Xe, [["__scopeId", "data-v-e09559ac"]]);
|
|
519
|
+
$.name = "TrAttachments";
|
|
520
520
|
const Ye = function(t) {
|
|
521
|
-
t.component(
|
|
521
|
+
t.component($.name, $);
|
|
522
522
|
};
|
|
523
|
-
|
|
523
|
+
$.install = Ye;
|
|
524
524
|
export {
|
|
525
|
-
|
|
525
|
+
$ as default
|
|
526
526
|
};
|