@opentiny/tiny-robot 0.3.0-alpha.8 → 0.3.0-alpha.9
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 +15 -15
- package/dist/base-popper/index.js +1 -1
- package/dist/bubble/index.js +1229 -1949
- package/dist/container/index.js +12 -12
- package/dist/dropdown-menu/index.js +38 -33
- package/dist/feedback/index.js +55 -55
- package/dist/flow-layout-buttons/index.js +24 -24
- package/dist/history/index.js +46 -46
- package/dist/index.d.ts +405 -975
- package/dist/index.js +63 -207
- package/dist/index2.js +593 -610
- package/dist/index3.js +139 -676
- package/dist/index4.js +306 -137
- package/dist/index5.js +591 -270
- package/dist/index6.js +599 -795
- package/dist/index7.js +1717 -3622
- package/dist/question/index.js +28 -28
- package/dist/sender/index.js +659 -709
- package/dist/style.css +1 -1
- package/dist/suggestion/index.js +22 -22
- package/dist/suggestion-pills/index.js +25 -25
- package/dist/suggestion-popover/index.js +185 -180
- package/dist/tiny-robot-svgs.js +178 -727
- package/dist/useSlotRefs.js +12 -12
- package/package.json +3 -9
- package/dist/attachments/index.js +0 -526
- package/dist/drag-overlay/index.js +0 -57
- package/dist/loading.js +0 -4
- package/dist/mcp-server-picker/index.js +0 -29682
package/dist/useSlotRefs.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { computed as
|
|
1
|
+
import { d } from "./index2.js";
|
|
2
|
+
import { computed as f, Fragment as v, ref as h, watch as p } from "vue";
|
|
3
3
|
function E(l, i) {
|
|
4
|
-
const u =
|
|
4
|
+
const u = f(() => {
|
|
5
5
|
const t = (l == null ? void 0 : l()) || [];
|
|
6
|
-
let
|
|
7
|
-
const
|
|
6
|
+
let o = 0;
|
|
7
|
+
const s = (e) => typeof e == "symbol" || e == null ? e : `fg${o}-${e}`;
|
|
8
8
|
return t.map((e) => {
|
|
9
|
-
if (e.type ===
|
|
9
|
+
if (e.type === v && Array.isArray(e.children)) {
|
|
10
10
|
for (const r of e.children)
|
|
11
|
-
r && typeof r == "object" && "key" in r && (r.key =
|
|
12
|
-
return
|
|
11
|
+
r && typeof r == "object" && "key" in r && (r.key = s(r.key));
|
|
12
|
+
return o++, e.children;
|
|
13
13
|
}
|
|
14
14
|
return e;
|
|
15
15
|
}).flat();
|
|
16
|
-
}), c =
|
|
17
|
-
const
|
|
18
|
-
|
|
16
|
+
}), c = f(() => i ? u.value.length : 1), m = f(() => u.value.slice(0, c.value)), n = h([]), a = (t, o) => {
|
|
17
|
+
const s = d(t);
|
|
18
|
+
s instanceof Element && (n.value[o] = s);
|
|
19
19
|
};
|
|
20
20
|
return p(
|
|
21
21
|
c,
|
|
@@ -25,7 +25,7 @@ function E(l, i) {
|
|
|
25
25
|
{ flush: "post" }
|
|
26
26
|
), {
|
|
27
27
|
vnodes: m,
|
|
28
|
-
ref:
|
|
28
|
+
ref: f(() => n.value.at(0)),
|
|
29
29
|
refs: n,
|
|
30
30
|
setRef: (t) => a(t, 0),
|
|
31
31
|
setRefs: a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/tiny-robot",
|
|
3
|
-
"version": "0.3.0-alpha.
|
|
3
|
+
"version": "0.3.0-alpha.9",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -20,19 +20,13 @@
|
|
|
20
20
|
"vue": "^3.3.11"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@opentiny/tiny-robot-svgs": "0.3.0-alpha.
|
|
23
|
+
"@opentiny/tiny-robot-svgs": "0.3.0-alpha.9",
|
|
24
24
|
"@opentiny/vue": "^3.21.0",
|
|
25
25
|
"@opentiny/vue-button": "^3.21.0",
|
|
26
26
|
"@opentiny/vue-icon": "^3.22.0",
|
|
27
27
|
"@opentiny/vue-input": "^3.21.0",
|
|
28
|
-
"@opentiny/vue-option": "^3.21.0",
|
|
29
|
-
"@opentiny/vue-select": "^3.21.0",
|
|
30
|
-
"@opentiny/vue-switch": "^3.21.0",
|
|
31
|
-
"@opentiny/vue-tab-item": "^3.21.0",
|
|
32
|
-
"@opentiny/vue-tabs": "^3.21.0",
|
|
33
28
|
"@opentiny/vue-tooltip": "^3.22.0",
|
|
34
29
|
"@vueuse/core": "^13.1.0",
|
|
35
|
-
"dompurify": "^3.2.6",
|
|
36
30
|
"markdown-it": "^14.1.0"
|
|
37
31
|
},
|
|
38
32
|
"devDependencies": {
|
|
@@ -50,5 +44,5 @@
|
|
|
50
44
|
"vue": "^3.3.11",
|
|
51
45
|
"vue-tsc": "^2.2.8"
|
|
52
46
|
},
|
|
53
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "e712c09e6a218b895f64ca284e2b2c2731e56707"
|
|
54
48
|
}
|
|
@@ -1,526 +0,0 @@
|
|
|
1
|
-
import { computed as I, ref as $, onUnmounted as Y, defineComponent as D, mergeModels as E, useModel as Z, createElementBlock as c, openBlock as r, withModifiers as M, createElementVNode as p, createVNode as F, unref as f, Fragment as L, renderList as A, normalizeClass as U, h as ee, createCommentVNode as C, createBlock as P, toDisplayString as x, withCtx as te, resolveDynamicComponent as O, watch as se } from "vue";
|
|
2
|
-
import { y as ae, O as V, F as H, x as X, H as q, k as K, X as G, a as ne, p as re, C as oe, B as ie, D as j, M 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 T = {
|
|
6
|
-
image: G,
|
|
7
|
-
pdf: K,
|
|
8
|
-
word: q,
|
|
9
|
-
excel: X,
|
|
10
|
-
ppt: H,
|
|
11
|
-
folder: V,
|
|
12
|
-
other: ae
|
|
13
|
-
}, N = [
|
|
14
|
-
{
|
|
15
|
-
type: "image",
|
|
16
|
-
matcher: (t) => {
|
|
17
|
-
var s, o;
|
|
18
|
-
if (typeof t != "string")
|
|
19
|
-
return ((s = t.type) == null ? void 0 : s.startsWith("image/")) || !1;
|
|
20
|
-
const n = ((o = t.split(".").pop()) == null ? void 0 : o.toLowerCase()) || "";
|
|
21
|
-
return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(n);
|
|
22
|
-
},
|
|
23
|
-
icon: G
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
type: "pdf",
|
|
27
|
-
matcher: (t) => typeof t != "string" ? t.type === "application/pdf" : t.toLowerCase().endsWith(".pdf"),
|
|
28
|
-
icon: K
|
|
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 n = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
|
|
37
|
-
return ["doc", "docx"].includes(n);
|
|
38
|
-
},
|
|
39
|
-
icon: q
|
|
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 n = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
|
|
48
|
-
return ["xls", "xlsx"].includes(n);
|
|
49
|
-
},
|
|
50
|
-
icon: X
|
|
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 n = ((s = t.split(".").pop()) == null ? void 0 : s.toLowerCase()) || "";
|
|
59
|
-
return ["ppt", "pptx"].includes(n);
|
|
60
|
-
},
|
|
61
|
-
icon: H
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
type: "folder",
|
|
65
|
-
matcher: (t) => typeof t != "string" ? !1 : t.toLowerCase().endsWith("folder"),
|
|
66
|
-
icon: V
|
|
67
|
-
}
|
|
68
|
-
];
|
|
69
|
-
function J(t = {}) {
|
|
70
|
-
const { customIcons: n, fileMatchers: s } = t, o = () => {
|
|
71
|
-
let e = [];
|
|
72
|
-
return s ? e = s.concat(N) : e = N, e;
|
|
73
|
-
}, i = (e = "other") => I(() => {
|
|
74
|
-
if (n != null && n[e])
|
|
75
|
-
return n[e];
|
|
76
|
-
const a = o().find((v) => v.type === e);
|
|
77
|
-
return a != null && a.icon ? a.icon : T[e] ? T[e] : T.other;
|
|
78
|
-
}), m = (e) => {
|
|
79
|
-
const u = o();
|
|
80
|
-
for (const a of u)
|
|
81
|
-
if (a.matcher(e))
|
|
82
|
-
return a.type;
|
|
83
|
-
return "other";
|
|
84
|
-
}, h = () => Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15), w = (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", g = (e) => e.rawFile instanceof File, d = (e) => e.map((u) => {
|
|
85
|
-
if (b(u))
|
|
86
|
-
return _(u);
|
|
87
|
-
if (g(u))
|
|
88
|
-
return y(u);
|
|
89
|
-
}), l = (e) => ({
|
|
90
|
-
id: e.id || h(),
|
|
91
|
-
name: e.name || "",
|
|
92
|
-
status: e.status || "success",
|
|
93
|
-
message: e.message || ""
|
|
94
|
-
}), _ = (e) => {
|
|
95
|
-
const u = l(e), a = e.url.split("/").pop() || "";
|
|
96
|
-
return {
|
|
97
|
-
...u,
|
|
98
|
-
name: u.name || a,
|
|
99
|
-
fileType: m(a),
|
|
100
|
-
size: e.size,
|
|
101
|
-
url: e.url
|
|
102
|
-
};
|
|
103
|
-
}, y = (e) => {
|
|
104
|
-
const u = l(e), { rawFile: a } = e;
|
|
105
|
-
return {
|
|
106
|
-
...u,
|
|
107
|
-
name: u.name || a.name,
|
|
108
|
-
fileType: m(a),
|
|
109
|
-
rawFile: a,
|
|
110
|
-
size: a.size,
|
|
111
|
-
url: e.url
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
return {
|
|
115
|
-
detectFileType: m,
|
|
116
|
-
generateID: h,
|
|
117
|
-
formatFileSize: w,
|
|
118
|
-
uploadAttachments: d,
|
|
119
|
-
getIconComponent: i
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
const ce = (t, n) => {
|
|
123
|
-
const s = document.createElement("iframe");
|
|
124
|
-
if (s.style.display = "none", document.body.appendChild(s), t.startsWith("blob:") || t.startsWith("data:")) {
|
|
125
|
-
const o = document.createElement("a");
|
|
126
|
-
o.href = t, o.download = n, o.style.display = "none", document.body.appendChild(o), o.click(), document.body.removeChild(o);
|
|
127
|
-
}
|
|
128
|
-
document.body.removeChild(s);
|
|
129
|
-
};
|
|
130
|
-
function de(t, n) {
|
|
131
|
-
const s = $([]), o = I(() => t.file.fileType === "image"), i = (d) => {
|
|
132
|
-
const l = URL.createObjectURL(d);
|
|
133
|
-
return s.value.push(l), l;
|
|
134
|
-
}, m = () => {
|
|
135
|
-
n("preview", t.file);
|
|
136
|
-
}, h = (d) => {
|
|
137
|
-
if (t.file.rawFile && !t.file.url) {
|
|
138
|
-
const l = i(t.file.rawFile);
|
|
139
|
-
ce(l, t.file.name || "");
|
|
140
|
-
}
|
|
141
|
-
n("download", { event: d, file: t.file });
|
|
142
|
-
}, w = () => {
|
|
143
|
-
n("remove", t.file);
|
|
144
|
-
}, b = () => {
|
|
145
|
-
n("retry", t.file);
|
|
146
|
-
}, g = (d, l) => {
|
|
147
|
-
l.stopPropagation(), d.handler && d.handler(t.file), d.type === "preview" ? m() : d.type === "download" ? h(l) : n("action", { action: d, file: t.file });
|
|
148
|
-
};
|
|
149
|
-
return Y(() => {
|
|
150
|
-
s.value.forEach((d) => {
|
|
151
|
-
URL.revokeObjectURL(d);
|
|
152
|
-
}), s.value = [];
|
|
153
|
-
}), {
|
|
154
|
-
isImage: o,
|
|
155
|
-
handlePreview: m,
|
|
156
|
-
downloadFile: h,
|
|
157
|
-
handleRemove: w,
|
|
158
|
-
handleRetry: b,
|
|
159
|
-
handleCustomAction: g
|
|
160
|
-
};
|
|
161
|
-
}
|
|
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" }, ye = ["onClick"], ge = ["src", "alt"], we = /* @__PURE__ */ D({
|
|
163
|
-
__name: "ImagePreview",
|
|
164
|
-
props: /* @__PURE__ */ E({
|
|
165
|
-
images: {}
|
|
166
|
-
}, {
|
|
167
|
-
currentIndex: { required: !0 },
|
|
168
|
-
currentIndexModifiers: {}
|
|
169
|
-
}),
|
|
170
|
-
emits: /* @__PURE__ */ E(["close"], ["update:currentIndex"]),
|
|
171
|
-
setup(t, { emit: n }) {
|
|
172
|
-
const s = t, o = n, i = Z(t, "currentIndex"), m = I(() => s.images[i.value]), h = () => {
|
|
173
|
-
i.value > 0 && i.value--;
|
|
174
|
-
}, w = () => {
|
|
175
|
-
i.value < s.images.length - 1 && i.value++;
|
|
176
|
-
}, b = (d) => {
|
|
177
|
-
i.value = d;
|
|
178
|
-
};
|
|
179
|
-
function g() {
|
|
180
|
-
o("close");
|
|
181
|
-
}
|
|
182
|
-
return (d, l) => {
|
|
183
|
-
var _, y;
|
|
184
|
-
return r(), c("div", {
|
|
185
|
-
class: "tr-image-preview",
|
|
186
|
-
onClick: M(g, ["self"])
|
|
187
|
-
}, [
|
|
188
|
-
p("button", {
|
|
189
|
-
class: "tr-image-preview__close",
|
|
190
|
-
onClick: g
|
|
191
|
-
}, [
|
|
192
|
-
F(f(ne))
|
|
193
|
-
]),
|
|
194
|
-
p("div", ue, [
|
|
195
|
-
p("button", {
|
|
196
|
-
class: "tr-image-preview__nav tr-image-preview__nav--left",
|
|
197
|
-
onClick: M(h, ["stop"]),
|
|
198
|
-
disabled: i.value === 0
|
|
199
|
-
}, [
|
|
200
|
-
F(f(re))
|
|
201
|
-
], 8, fe),
|
|
202
|
-
p("div", pe, [
|
|
203
|
-
p("img", {
|
|
204
|
-
src: (_ = m.value) == null ? void 0 : _.url,
|
|
205
|
-
alt: (y = m.value) == null ? void 0 : y.name,
|
|
206
|
-
class: "tr-image-preview__image"
|
|
207
|
-
}, null, 8, me)
|
|
208
|
-
]),
|
|
209
|
-
p("button", {
|
|
210
|
-
class: "tr-image-preview__nav tr-image-preview__nav--right",
|
|
211
|
-
onClick: M(w, ["stop"]),
|
|
212
|
-
disabled: i.value === d.images.length - 1
|
|
213
|
-
}, [
|
|
214
|
-
F(f(oe))
|
|
215
|
-
], 8, _e)
|
|
216
|
-
]),
|
|
217
|
-
p("div", ve, [
|
|
218
|
-
p("div", he, [
|
|
219
|
-
(r(!0), c(L, null, A(d.images, (e, u) => (r(), c("div", {
|
|
220
|
-
key: e.id,
|
|
221
|
-
class: U(["tr-image-preview__thumbnail", { "tr-image-preview__thumbnail--active": u === i.value }]),
|
|
222
|
-
onClick: (a) => b(u)
|
|
223
|
-
}, [
|
|
224
|
-
p("img", {
|
|
225
|
-
src: e.url,
|
|
226
|
-
alt: e.name
|
|
227
|
-
}, null, 8, ge)
|
|
228
|
-
], 10, ye))), 128))
|
|
229
|
-
])
|
|
230
|
-
])
|
|
231
|
-
]);
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
}), be = /* @__PURE__ */ S(we, [["__scopeId", "data-v-027af77c"]]);
|
|
235
|
-
function ke(t, n, s = {}) {
|
|
236
|
-
const o = $(!1), i = $([]), m = $(0), h = (l) => {
|
|
237
|
-
m.value = l;
|
|
238
|
-
}, w = (l) => {
|
|
239
|
-
const _ = t.value.findIndex((y) => y.id === l.id);
|
|
240
|
-
if (_ !== -1 && l.url && t.value.splice(_, 1, l), l.fileType === "image") {
|
|
241
|
-
i.value = t.value.filter(
|
|
242
|
-
(e) => e.fileType === "image" && e.status !== "error" && e.status !== "uploading"
|
|
243
|
-
);
|
|
244
|
-
const y = i.value.findIndex((e) => e.id === l.id);
|
|
245
|
-
y !== -1 && (m.value = y, o.value = !0);
|
|
246
|
-
} else
|
|
247
|
-
n("preview", l);
|
|
248
|
-
}, b = () => {
|
|
249
|
-
o.value = !1;
|
|
250
|
-
}, g = (l) => {
|
|
251
|
-
s.onDownload ? s.onDownload(l) : n("download", l);
|
|
252
|
-
};
|
|
253
|
-
return {
|
|
254
|
-
// 显示预览
|
|
255
|
-
handlePreview: w,
|
|
256
|
-
// 渲染预览组件
|
|
257
|
-
renderPreview: () => o.value ? ee(be, {
|
|
258
|
-
images: i.value,
|
|
259
|
-
currentIndex: m.value,
|
|
260
|
-
"onUpdate:currentIndex": h,
|
|
261
|
-
onClose: b,
|
|
262
|
-
onDownload: g
|
|
263
|
-
}) : null
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
function Ce(t, n) {
|
|
267
|
-
return {
|
|
268
|
-
actualListType: I(() => n && n !== "auto" ? n : 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
|
-
}, xe = ["src", "alt"], Me = {
|
|
275
|
-
key: 0,
|
|
276
|
-
class: "tr-file-card__picture-overlay"
|
|
277
|
-
}, $e = {
|
|
278
|
-
key: 1,
|
|
279
|
-
class: "tr-file-card__status-overlay tr-file-card__status-overlay--picture"
|
|
280
|
-
}, Ue = {
|
|
281
|
-
key: 0,
|
|
282
|
-
class: "tr-file-card__status-icon tr-file-card__status-icon--loading"
|
|
283
|
-
}, Pe = {
|
|
284
|
-
key: 0,
|
|
285
|
-
class: "tr-file-card__status-icon--loading-text"
|
|
286
|
-
}, Be = {
|
|
287
|
-
key: 2,
|
|
288
|
-
class: "tr-file-card__default-container"
|
|
289
|
-
}, Re = { class: "tr-file-card__icon-wrapper" }, Te = {
|
|
290
|
-
key: 0,
|
|
291
|
-
class: "tr-file-card__status-overlay tr-file-card__status-overlay--icon"
|
|
292
|
-
}, De = {
|
|
293
|
-
key: 0,
|
|
294
|
-
class: "tr-file-card__status-icon tr-file-card__status-icon--loading"
|
|
295
|
-
}, Le = { class: "tr-file-card__content" }, Ae = { class: "tr-file-card__info" }, Se = ["title"], ze = {
|
|
296
|
-
key: 0,
|
|
297
|
-
class: "tr-file-card__status"
|
|
298
|
-
}, Ee = {
|
|
299
|
-
key: 0,
|
|
300
|
-
class: "tr-file-card__status-success"
|
|
301
|
-
}, je = { class: "tr-file-card__status-info" }, We = { class: "tr-file-card__file-type" }, Ne = {
|
|
302
|
-
key: 0,
|
|
303
|
-
class: "tr-file-card__file-size"
|
|
304
|
-
}, Oe = {
|
|
305
|
-
key: 0,
|
|
306
|
-
class: "tr-file-card__actions"
|
|
307
|
-
}, Ve = ["href", "target", "onClick"], He = ["onClick"], Xe = {
|
|
308
|
-
key: 1,
|
|
309
|
-
class: "tr-file-card__status-uploading"
|
|
310
|
-
}, qe = {
|
|
311
|
-
key: 2,
|
|
312
|
-
class: "tr-file-card__status-error"
|
|
313
|
-
}, Ke = /* @__PURE__ */ D({
|
|
314
|
-
__name: "FileCard",
|
|
315
|
-
props: {
|
|
316
|
-
file: {},
|
|
317
|
-
variant: { default: "card" },
|
|
318
|
-
showStatus: { type: Boolean, default: !0 },
|
|
319
|
-
fileIcons: {},
|
|
320
|
-
disabled: { type: Boolean },
|
|
321
|
-
actions: {},
|
|
322
|
-
fileMatchers: {}
|
|
323
|
-
},
|
|
324
|
-
emits: ["remove", "preview", "action", "retry", "download"],
|
|
325
|
-
setup(t, { emit: n }) {
|
|
326
|
-
const s = t, o = n, { formatFileSize: i, getIconComponent: m } = J({
|
|
327
|
-
customIcons: s.fileIcons,
|
|
328
|
-
fileMatchers: s.fileMatchers
|
|
329
|
-
}), { isImage: h, handlePreview: w, handleRemove: b, handleCustomAction: g, handleRetry: d } = de(s, o), l = I(() => m(s.file.fileType).value), _ = I(() => s.file.status === "uploading"), y = I(() => s.file.status === "success"), e = I(() => s.file.status === "error"), u = 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": _.value,
|
|
334
|
-
"tr-file-card--error": e.value,
|
|
335
|
-
"tr-file-card--success": y.value
|
|
336
|
-
}
|
|
337
|
-
]);
|
|
338
|
-
return (a, v) => {
|
|
339
|
-
var z;
|
|
340
|
-
return r(), c("div", {
|
|
341
|
-
class: U(u.value),
|
|
342
|
-
"data-file-type": a.file.fileType || "other",
|
|
343
|
-
onClick: v[3] || (v[3] = (k) => a.variant === "picture" ? f(w)() : void 0)
|
|
344
|
-
}, [
|
|
345
|
-
a.disabled ? C("", !0) : (r(), c("button", {
|
|
346
|
-
key: 0,
|
|
347
|
-
class: "tr-file-card__close-btn",
|
|
348
|
-
onClick: v[0] || (v[0] = M(
|
|
349
|
-
//@ts-ignore
|
|
350
|
-
(...k) => f(b) && f(b)(...k),
|
|
351
|
-
["stop"]
|
|
352
|
-
)),
|
|
353
|
-
"aria-label": "移除文件"
|
|
354
|
-
}, [
|
|
355
|
-
F(f(ie))
|
|
356
|
-
])),
|
|
357
|
-
a.variant === "picture" ? (r(), c("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, xe),
|
|
363
|
-
y.value ? (r(), c("div", Me, v[4] || (v[4] = [
|
|
364
|
-
p("span", { class: "tr-file-card__picture-overlay-text" }, "预览", -1)
|
|
365
|
-
]))) : C("", !0),
|
|
366
|
-
_.value || e.value ? (r(), c("div", $e, [
|
|
367
|
-
_.value ? (r(), c("div", Ue, [
|
|
368
|
-
F(f(j)),
|
|
369
|
-
a.file.message ? (r(), c("span", Pe, x(a.file.message), 1)) : C("", !0)
|
|
370
|
-
])) : e.value ? (r(), P(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
|
-
])) : (r(), c("div", Be, [
|
|
383
|
-
p("div", {
|
|
384
|
-
class: U(["tr-file-card__icon", { "tr-file-card__icon--clickable": f(h) }]),
|
|
385
|
-
onClick: v[1] || (v[1] = M((k) => f(h) ? f(w)() : null, ["stop"]))
|
|
386
|
-
}, [
|
|
387
|
-
p("div", Re, [
|
|
388
|
-
(r(), P(O(l.value), { class: "tr-file-card__file-icon" })),
|
|
389
|
-
_.value || e.value ? (r(), c("div", Te, [
|
|
390
|
-
_.value ? (r(), c("div", De, [
|
|
391
|
-
F(f(j))
|
|
392
|
-
])) : e.value ? (r(), P(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", Le, [
|
|
400
|
-
p("div", Ae, [
|
|
401
|
-
p("div", {
|
|
402
|
-
class: "tr-file-card__name",
|
|
403
|
-
title: a.file.name
|
|
404
|
-
}, x(a.file.name), 9, Se),
|
|
405
|
-
a.showStatus ? (r(), c("div", ze, [
|
|
406
|
-
y.value ? (r(), c("div", Ee, [
|
|
407
|
-
p("div", je, [
|
|
408
|
-
p("span", We, x(((z = a.file.fileType) == null ? void 0 : z.toUpperCase()) || "FILE"), 1),
|
|
409
|
-
a.file.size ? (r(), c("span", Ne, x(f(i)(a.file.size)), 1)) : C("", !0)
|
|
410
|
-
]),
|
|
411
|
-
a.actions ? (r(), c("div", Oe, [
|
|
412
|
-
(r(!0), c(L, null, A(a.actions, (k, Q) => (r(), c("div", {
|
|
413
|
-
key: Q,
|
|
414
|
-
class: "tr-file-card__action-btn"
|
|
415
|
-
}, [
|
|
416
|
-
k.type === "download" ? (r(), c("a", {
|
|
417
|
-
key: 0,
|
|
418
|
-
class: "tr-file-card__action-btn--download",
|
|
419
|
-
href: a.file.url ?? "javascript:void(0)",
|
|
420
|
-
target: f(h) ? "_blank" : "_self",
|
|
421
|
-
onClick: (R) => f(g)(k, R)
|
|
422
|
-
}, x(k.label), 9, Ve)) : (r(), c("button", {
|
|
423
|
-
key: 1,
|
|
424
|
-
class: U(`tr-file-card__action-btn--${k.type}`),
|
|
425
|
-
onClick: (R) => f(g)(k, R)
|
|
426
|
-
}, x(k.label), 11, He))
|
|
427
|
-
]))), 128))
|
|
428
|
-
])) : C("", !0)
|
|
429
|
-
])) : _.value ? (r(), c("div", Xe, v[5] || (v[5] = [
|
|
430
|
-
p("span", { class: "tr-file-card__uploading-text" }, "上传中...", -1)
|
|
431
|
-
]))) : e.value ? (r(), c("div", qe, [
|
|
432
|
-
v[6] || (v[6] = p("span", { class: "tr-file-card__error-text" }, "上传失败", -1)),
|
|
433
|
-
p("button", {
|
|
434
|
-
class: "tr-file-card__retry-btn",
|
|
435
|
-
onClick: v[2] || (v[2] = //@ts-ignore
|
|
436
|
-
(...k) => f(d) && f(d)(...k))
|
|
437
|
-
}, "重试")
|
|
438
|
-
])) : C("", !0)
|
|
439
|
-
])) : C("", !0)
|
|
440
|
-
])
|
|
441
|
-
])
|
|
442
|
-
]))
|
|
443
|
-
], 10, Ie);
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
}), Ge = /* @__PURE__ */ S(Ke, [["__scopeId", "data-v-194fe961"]]), Je = { class: "tr-attachments" }, Qe = /* @__PURE__ */ D({
|
|
447
|
-
__name: "index",
|
|
448
|
-
props: {
|
|
449
|
-
items: {},
|
|
450
|
-
disabled: { type: Boolean },
|
|
451
|
-
wrap: { type: Boolean },
|
|
452
|
-
fileIcons: {},
|
|
453
|
-
actions: { default: () => [
|
|
454
|
-
{
|
|
455
|
-
label: "下载",
|
|
456
|
-
type: "download"
|
|
457
|
-
},
|
|
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: n }) {
|
|
468
|
-
const s = t, o = n, i = $(s.items || []), { actualListType: m } = Ce(i, s.variant), { handlePreview: h, renderPreview: w } = ke(i, o, { enableDownload: !0 });
|
|
469
|
-
function b(e) {
|
|
470
|
-
if (s.disabled) return;
|
|
471
|
-
const u = i.value.findIndex((a) => a.id === e.id);
|
|
472
|
-
u !== -1 && (i.value.splice(u, 1), o("remove", e), o("update:items", i.value));
|
|
473
|
-
}
|
|
474
|
-
function g(e) {
|
|
475
|
-
o("download", e);
|
|
476
|
-
}
|
|
477
|
-
function d(e) {
|
|
478
|
-
o("retry", e);
|
|
479
|
-
}
|
|
480
|
-
function l(e) {
|
|
481
|
-
o("action", e);
|
|
482
|
-
}
|
|
483
|
-
const _ = I(() => s.wrap ? "wrap" : "no-wrap"), { uploadAttachments: y } = J({
|
|
484
|
-
fileMatchers: s.fileMatchers
|
|
485
|
-
});
|
|
486
|
-
return se(
|
|
487
|
-
() => s.items,
|
|
488
|
-
(e) => {
|
|
489
|
-
e && e.length > 0 && (i.value = y(e));
|
|
490
|
-
},
|
|
491
|
-
{ deep: !0, immediate: !0 }
|
|
492
|
-
), (e, u) => (r(), c("div", Je, [
|
|
493
|
-
i.value.length > 0 ? (r(), c("div", {
|
|
494
|
-
key: 0,
|
|
495
|
-
class: U(["tr-attachments__file-list", _.value]),
|
|
496
|
-
onClick: u[0] || (u[0] = M(() => {
|
|
497
|
-
}, ["stop"]))
|
|
498
|
-
}, [
|
|
499
|
-
(r(!0), c(L, null, A(i.value, (a) => (r(), P(Ge, {
|
|
500
|
-
key: a.id,
|
|
501
|
-
file: a,
|
|
502
|
-
variant: f(m),
|
|
503
|
-
"file-icons": e.fileIcons,
|
|
504
|
-
disabled: e.disabled,
|
|
505
|
-
actions: e.actions,
|
|
506
|
-
"show-status": !0,
|
|
507
|
-
"file-matchers": e.fileMatchers,
|
|
508
|
-
onRemove: b,
|
|
509
|
-
onPreview: f(h),
|
|
510
|
-
onDownload: g,
|
|
511
|
-
onRetry: d,
|
|
512
|
-
onAction: l
|
|
513
|
-
}, null, 8, ["file", "variant", "file-icons", "disabled", "actions", "file-matchers", "onPreview"]))), 128))
|
|
514
|
-
], 2)) : C("", !0),
|
|
515
|
-
(r(), P(O(f(w)())))
|
|
516
|
-
]));
|
|
517
|
-
}
|
|
518
|
-
}), B = /* @__PURE__ */ S(Qe, [["__scopeId", "data-v-3b44a028"]]);
|
|
519
|
-
B.name = "TrAttachments";
|
|
520
|
-
const Ye = function(t) {
|
|
521
|
-
t.component(B.name, B);
|
|
522
|
-
};
|
|
523
|
-
B.install = Ye;
|
|
524
|
-
export {
|
|
525
|
-
B as default
|
|
526
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { defineComponent as v, computed as y, createBlock as u, openBlock as t, Transition as F, withCtx as m, createElementBlock as o, createCommentVNode as h, normalizeStyle as _, normalizeClass as w, renderSlot as x, createElementVNode as l, toDisplayString as s, Fragment as D, renderList as B } from "vue";
|
|
2
|
-
import { a as M } from "../index3.js";
|
|
3
|
-
import { _ as Z } from "../_plugin-vue_export-helper.js";
|
|
4
|
-
const k = "data:image/svg+xml,%3csvg%20width='80.000000'%20height='80.000000'%20viewBox='0%200%2080%2080'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cdefs/%3e%3crect%20width='80.000000'%20height='80.000000'%20fill='%23FFFFFF'%20fill-opacity='0'/%3e%3cpath%20d='M10%2014L70%2014C72.2%2014%2074%2015.79%2074%2018L74%2063C74%2065.2%2072.2%2067%2070%2067L10%2067C7.79%2067%206%2065.2%206%2063L6%2018C6%2015.79%207.79%2014%2010%2014Z'%20fill='%23FFFFFF'%20fill-opacity='1.000000'%20fill-rule='evenodd'/%3e%3cpath%20d='M10%2014L70%2014C72.2%2014%2074%2015.79%2074%2018L74%2063C74%2065.2%2072.2%2067%2070%2067L10%2067C7.79%2067%206%2065.2%206%2063L6%2018C6%2015.79%207.79%2014%2010%2014ZM10%2015L70%2015C71%2015%2071.75%2015.25%2072.25%2015.75C72.75%2016.25%2073%2017%2073%2018L73%2063C73%2064%2072.75%2064.75%2072.25%2065.25C71.75%2065.75%2071%2066%2070%2066L10%2066C9%2066%208.25%2065.75%207.75%2065.25C7.25%2064.75%207%2064%207%2063L7%2018C7%2017%207.25%2016.25%207.75%2015.75C8.25%2015.25%209%2015%2010%2015Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='evenodd'/%3e%3cpath%20d='M6%2047.27L24.56%2029.06C25.73%2027.91%2027.6%2027.91%2028.77%2029.06L44.52%2044.51C45.69%2045.66%2047.56%2045.66%2048.72%2044.51L56.64%2036.75C57.8%2035.6%2059.67%2035.6%2060.84%2036.75L74%2049.67L74%2062C74%2064.76%2071.76%2067%2069%2067L11%2067C8.23%2067%206%2064.76%206%2062L6%2047.27Z'%20fill='%23F0F0F0'%20fill-opacity='1.000000'%20fill-rule='evenodd'/%3e%3cpath%20d=''%20fill='%23808080'%20fill-opacity='0'%20fill-rule='evenodd'/%3e%3cellipse%20cx='40.000000'%20cy='40.000000'%20rx='8.000001'%20ry='8.000002'%20fill='%231476FF'%20fill-opacity='1.000000'/%3e%3cpath%20d='M40%2035.5C40.27%2035.5%2040.5%2035.72%2040.5%2036L40.5%2039.49L44%2039.5C44.27%2039.5%2044.5%2039.72%2044.5%2040C44.5%2040.27%2044.27%2040.5%2044%2040.5L40.5%2040.5L40.5%2044C40.5%2044.27%2040.27%2044.5%2040%2044.5C39.72%2044.5%2039.5%2044.27%2039.5%2044L39.5%2040.5L36%2040.5C35.72%2040.5%2035.5%2040.27%2035.5%2040C35.5%2039.72%2035.72%2039.5%2036%2039.5L39.5%2039.5L39.5%2036C39.5%2035.72%2039.72%2035.5%2040%2035.5Z'%20fill='%23FFFFFF'%20fill-opacity='1.000000'%20fill-rule='evenodd'/%3e%3cpath%20d='M10%2014L70%2014C72.2%2014%2074%2015.79%2074%2018L74%2063C74%2065.2%2072.2%2067%2070%2067L10%2067C7.79%2067%206%2065.2%206%2063L6%2018C6%2015.79%207.79%2014%2010%2014Z'%20fill='%23FFFFFF'%20fill-opacity='0'%20fill-rule='evenodd'/%3e%3cpath%20d='M10%2014L70%2014C72.2%2014%2074%2015.79%2074%2018L74%2063C74%2065.2%2072.2%2067%2070%2067L10%2067C7.79%2067%206%2065.2%206%2063L6%2018C6%2015.79%207.79%2014%2010%2014ZM10%2015L70%2015C71%2015%2071.75%2015.25%2072.25%2015.75C72.75%2016.25%2073%2017%2073%2018L73%2063C73%2064%2072.75%2064.75%2072.25%2065.25C71.75%2065.75%2071%2066%2070%2066L10%2066C9%2066%208.25%2065.75%207.75%2065.25C7.25%2064.75%207%2064%207%2063L7%2018C7%2017%207.25%2016.25%207.75%2015.75C8.25%2015.25%209%2015%2010%2015Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='evenodd'/%3e%3ccircle%20cx='58.000000'%20cy='27.000000'%20r='5.000000'%20fill='%23DBDBDB'%20fill-opacity='1.000000'/%3e%3c/svg%3e", T = { class: "tr-drag-overlay__content" }, $ = { class: "tr-drag-overlay__text" }, S = { class: "tr-drag-overlay__title" }, E = { class: "tr-drag-overlay__description" }, z = /* @__PURE__ */ v({
|
|
5
|
-
__name: "index",
|
|
6
|
-
props: {
|
|
7
|
-
overlayTitle: {},
|
|
8
|
-
overlayDescription: {},
|
|
9
|
-
isDragging: { type: Boolean },
|
|
10
|
-
dragTarget: {},
|
|
11
|
-
fullscreen: { type: Boolean }
|
|
12
|
-
},
|
|
13
|
-
setup(r) {
|
|
14
|
-
const a = r, { top: d, left: c, width: p, height: C } = M(() => a.dragTarget), f = y(() => !a.isDragging || !a.dragTarget ? { display: "none" } : {
|
|
15
|
-
position: "fixed",
|
|
16
|
-
top: `${d.value}px`,
|
|
17
|
-
left: `${c.value}px`,
|
|
18
|
-
width: `${p.value}px`,
|
|
19
|
-
height: `${C.value}px`
|
|
20
|
-
});
|
|
21
|
-
return (e, n) => (t(), u(F, { name: "tr-fade" }, {
|
|
22
|
-
default: m(() => [
|
|
23
|
-
e.isDragging ? (t(), o("div", {
|
|
24
|
-
key: 0,
|
|
25
|
-
class: w(["tr-drag-overlay", { "tr-drag-overlay--fullscreen": e.fullscreen }]),
|
|
26
|
-
style: _(f.value)
|
|
27
|
-
}, [
|
|
28
|
-
x(e.$slots, "overlay", { isDragging: e.isDragging }, () => [
|
|
29
|
-
l("div", T, [
|
|
30
|
-
n[0] || (n[0] = l("div", { class: "tr-drag-overlay__icon" }, [
|
|
31
|
-
l("img", {
|
|
32
|
-
src: k,
|
|
33
|
-
alt: "上传文件"
|
|
34
|
-
})
|
|
35
|
-
], -1)),
|
|
36
|
-
l("div", $, [
|
|
37
|
-
l("div", S, s(e.overlayTitle), 1),
|
|
38
|
-
l("div", E, [
|
|
39
|
-
(t(!0), o(D, null, B(e.overlayDescription, (g, L) => (t(), o("span", { key: L }, s(g), 1))), 128))
|
|
40
|
-
])
|
|
41
|
-
])
|
|
42
|
-
])
|
|
43
|
-
], !0)
|
|
44
|
-
], 6)) : h("", !0)
|
|
45
|
-
]),
|
|
46
|
-
_: 3
|
|
47
|
-
}));
|
|
48
|
-
}
|
|
49
|
-
}), i = /* @__PURE__ */ Z(z, [["__scopeId", "data-v-92021e6b"]]);
|
|
50
|
-
i.name = "TrDragOverlay";
|
|
51
|
-
const N = function(r) {
|
|
52
|
-
r.component(i.name, i);
|
|
53
|
-
};
|
|
54
|
-
i.install = N;
|
|
55
|
-
export {
|
|
56
|
-
i as default
|
|
57
|
-
};
|