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