china-mobile-international-custom-components 0.0.54 → 0.0.56
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/es/AddOrEditSupplierDialog.mjs +920 -22
- package/es/ApplicationIcon.mjs +38 -37
- package/es/AuthSection.mjs +191 -0
- package/es/CodeView.mjs +170 -0
- package/es/CommonTagsList.mjs +31 -30
- package/es/CreateMcpForm.mjs +331 -0
- package/es/FilePreview.mjs +229 -0
- package/es/FileUploader.mjs +92 -87
- package/es/McpFormDialog.mjs +187 -0
- package/es/RadioGroup.mjs +119 -0
- package/es/SourcePublish.mjs +2 -2
- package/es/assets/AddOrEditSupplierDialog.css +1 -1
- package/es/assets/AuthSection.css +1 -0
- package/es/assets/CodeView.css +1 -0
- package/es/assets/CreateMcpForm.css +1 -0
- package/es/assets/FilePreview.css +1 -0
- package/es/assets/McpFormDialog.css +1 -0
- package/es/assets/RadioGroup.css +1 -0
- package/es/assets/usePreview.css +1 -0
- package/es/chunks/config.CgrPt4Zx.js +435 -0
- package/es/chunks/mcp-tool.Nc4HT9IM.js +4 -0
- package/es/chunks/usePreview.BMkgYO7E.js +124 -0
- package/es/index.mjs +167 -149
- package/lib/AddOrEditSupplierDialog.js +1 -1
- package/lib/ApplicationIcon.js +1 -1
- package/lib/AuthSection.js +1 -0
- package/lib/CodeView.js +1 -0
- package/lib/CommonTagsList.js +1 -1
- package/lib/CreateMcpForm.js +1 -0
- package/lib/FilePreview.js +1 -0
- package/lib/FileUploader.js +1 -1
- package/lib/McpFormDialog.js +1 -0
- package/lib/RadioGroup.js +1 -0
- package/lib/SourcePublish.js +1 -1
- package/lib/assets/AddOrEditSupplierDialog.css +1 -1
- package/lib/assets/AuthSection.css +1 -0
- package/lib/assets/CodeView.css +1 -0
- package/lib/assets/CreateMcpForm.css +1 -0
- package/lib/assets/FilePreview.css +1 -0
- package/lib/assets/McpFormDialog.css +1 -0
- package/lib/assets/RadioGroup.css +1 -0
- package/lib/assets/usePreview.css +1 -0
- package/lib/chunks/config.BvBtwI1A.js +1 -0
- package/lib/chunks/mcp-tool.fb1SS2wA.js +1 -0
- package/lib/chunks/usePreview.BzTCNJfE.js +1 -0
- package/lib/index.js +1 -1
- package/package.json +7 -1
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { w as D } from "./chunks/index.bCzIhWFw.js";
|
|
2
|
+
import { ref as R, reactive as y, createBlock as M, openBlock as A, unref as e, withCtx as n, createVNode as i, createCommentVNode as f, createElementVNode as s, toDisplayString as c, createTextVNode as I } from "vue";
|
|
3
|
+
import { ElForm as V, ElFormItem as p, ElTooltip as P, ElIcon as h, ElInput as E, ElMessage as _ } from "element-plus";
|
|
4
|
+
import { IconTip as L } from "color-message-aibox-vue";
|
|
5
|
+
import { o as B } from "./chunks/usePreview.BMkgYO7E.js";
|
|
6
|
+
import { AuthSection as k } from "./AuthSection.mjs";
|
|
7
|
+
import { RadioGroup as Y } from "./RadioGroup.mjs";
|
|
8
|
+
import { u as S } from "./chunks/i18n.Bd7hh14j.js";
|
|
9
|
+
import { FilePreview as w } from "./AddOrEditSupplierDialog.mjs";
|
|
10
|
+
import { FileUploader as x } from "./FileUploader.mjs";
|
|
11
|
+
import { _ as K } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
|
|
12
|
+
import './assets/CreateMcpForm.css';const Q = { class: "label-with-icon" }, H = { class: "label-with-icon" }, q = { class: "auth-section-wrapper" }, z = {
|
|
13
|
+
__name: "CreateMcpForm",
|
|
14
|
+
setup(X, { expose: O }) {
|
|
15
|
+
const { t: o } = S(), { previewImage: F } = B(), d = R(null), C = R(null), r = y({
|
|
16
|
+
icon: "",
|
|
17
|
+
iconUrl: "",
|
|
18
|
+
name: "",
|
|
19
|
+
description: "",
|
|
20
|
+
communicationType: "HTTP",
|
|
21
|
+
// 默认值改为与 options 中的 value 匹配
|
|
22
|
+
address: "",
|
|
23
|
+
applyLink: ""
|
|
24
|
+
}), b = R([
|
|
25
|
+
{ label: "SSE", value: "SSE" },
|
|
26
|
+
{ label: "Streamable HTTP", value: "HTTP" }
|
|
27
|
+
]), l = y({
|
|
28
|
+
auth: {
|
|
29
|
+
authType: "none",
|
|
30
|
+
keyType: "custom",
|
|
31
|
+
paramLocation: "header",
|
|
32
|
+
paramName: "",
|
|
33
|
+
paramValue: "",
|
|
34
|
+
token: ""
|
|
35
|
+
}
|
|
36
|
+
}), U = R({
|
|
37
|
+
name: [
|
|
38
|
+
{
|
|
39
|
+
required: !0,
|
|
40
|
+
message: o("LIBRARY_CREATEMCPFORM.MCP_NAME_PLACEHOLDER"),
|
|
41
|
+
trigger: "blur"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
max: 20,
|
|
45
|
+
message: o("LIBRARY_CREATEMCPFORM.MCP_NAME_MAX"),
|
|
46
|
+
trigger: "blur"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
description: [
|
|
50
|
+
{
|
|
51
|
+
required: !0,
|
|
52
|
+
message: o("LIBRARY_CREATEMCPFORM.MCP_DESCRIPTION_REQUIRED"),
|
|
53
|
+
trigger: "blur"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
max: 200,
|
|
57
|
+
message: o("LIBRARY_CREATEMCPFORM.MCP_DESCRIPTION_MAX"),
|
|
58
|
+
trigger: "blur"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
address: [
|
|
62
|
+
{
|
|
63
|
+
type: "url",
|
|
64
|
+
required: !0,
|
|
65
|
+
message: o("LIBRARY_CREATEMCPFORM.SERVICE_URL_INVALID"),
|
|
66
|
+
trigger: ["blur", "change"]
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
communicationType: [
|
|
70
|
+
{
|
|
71
|
+
required: !0,
|
|
72
|
+
message: o("LIBRARY_CREATEMCPFORM.TRANSFER_METHOD_REQUIRED"),
|
|
73
|
+
trigger: "change"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
applyLink: [
|
|
77
|
+
{
|
|
78
|
+
type: "url",
|
|
79
|
+
message: o("LIBRARY_CREATEMCPFORM.DOCUMENTATION_URL_INVALID"),
|
|
80
|
+
trigger: ["blur", "change"]
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}), m = R([]), N = (a) => {
|
|
84
|
+
r.iconUrl = a.url, r.icon = a.bnid, m.value = [a];
|
|
85
|
+
}, g = () => {
|
|
86
|
+
r.iconUrl = "", r.icon = "", m.value = [];
|
|
87
|
+
}, v = (a) => {
|
|
88
|
+
F(a.url);
|
|
89
|
+
};
|
|
90
|
+
return O({ validate: async (a) => {
|
|
91
|
+
if (!d.value) return !1;
|
|
92
|
+
if (C.value?.validateField) {
|
|
93
|
+
const t = C.value.validateField();
|
|
94
|
+
if (Object.keys(t).length > 0)
|
|
95
|
+
return t.paramName ? _.error(
|
|
96
|
+
o("LIBRARY_CREATEMCPFORM.PARAMETER_NAME_REQUIRED") || "请输入密钥参数名"
|
|
97
|
+
) : t.paramValue ? _.error(
|
|
98
|
+
o("LIBRARY_CREATEMCPFORM.INPUT_API_KEY_REQUIRED") || "请输入密钥值"
|
|
99
|
+
) : t.token ? _.error(
|
|
100
|
+
o("LIBRARY_CREATEMCPFORM.INPUT_API_KEY_REQUIRED") || "请输入密钥值"
|
|
101
|
+
) : _.error(
|
|
102
|
+
o("LIBRARY_CREATEMCPFORM.MCP_AUTH_REQUIRED") || "请完善鉴权信息"
|
|
103
|
+
), a?.(
|
|
104
|
+
new Error(
|
|
105
|
+
o("LIBRARY_CREATEMCPFORM.MCP_AUTH_REQUIRED") || "请完善鉴权信息"
|
|
106
|
+
)
|
|
107
|
+
), !1;
|
|
108
|
+
}
|
|
109
|
+
return d.value.validate(a);
|
|
110
|
+
}, getFormData: () => ({
|
|
111
|
+
name: r.name,
|
|
112
|
+
icon: r.icon,
|
|
113
|
+
// iconUrl: ruleForm.iconUrl,
|
|
114
|
+
description: r.description,
|
|
115
|
+
address: r.address,
|
|
116
|
+
communicationType: r.communicationType,
|
|
117
|
+
// 鉴权相关字段
|
|
118
|
+
authType: l.auth.authType === "none" ? 0 : 1,
|
|
119
|
+
// none->0, apiKey->1
|
|
120
|
+
authLocation: l.auth.paramLocation === "header" ? 0 : 1,
|
|
121
|
+
// header->0, query->1
|
|
122
|
+
apiKeyName: l.auth.keyType === "bearer" ? "Authorization" : l.auth.paramName || "",
|
|
123
|
+
apiKeyValue: l.auth.keyType === "bearer" ? l.auth.token ? `Bearer ${l.auth.token}` : "" : l.auth.paramValue || "",
|
|
124
|
+
// 可选字段
|
|
125
|
+
applyLink: r.applyLink || "",
|
|
126
|
+
headerPrefixType: 1,
|
|
127
|
+
overview: ""
|
|
128
|
+
}), setFormData: (a) => {
|
|
129
|
+
if (!a) return;
|
|
130
|
+
Object.assign(r, {
|
|
131
|
+
name: a.name || "",
|
|
132
|
+
description: a.description || "",
|
|
133
|
+
icon: a.icon || "",
|
|
134
|
+
iconUrl: a.iconUrl || "",
|
|
135
|
+
communicationType: a.communicationType || "SSE",
|
|
136
|
+
address: a.address || "",
|
|
137
|
+
applyLink: a.applyLink || ""
|
|
138
|
+
});
|
|
139
|
+
const t = a.authType === 1 || a.authType === "1";
|
|
140
|
+
if (l.auth.authType = t ? "apiKey" : "none", l.auth.paramLocation = a.authLocation === 0 || a.authLocation === "0" ? "header" : "query", t) {
|
|
141
|
+
const u = !a.apiKeyName || a.apiKeyName === "Authorization";
|
|
142
|
+
if (l.auth.keyType = u ? "bearer" : "custom", u) {
|
|
143
|
+
l.auth.paramName = "", l.auth.paramValue = "";
|
|
144
|
+
const T = a.apiKeyValue || "";
|
|
145
|
+
l.auth.token = T.startsWith("Bearer ") ? T.substring(7) : T;
|
|
146
|
+
} else
|
|
147
|
+
l.auth.paramName = a.apiKeyName || "", l.auth.paramValue = a.apiKeyValue || "", l.auth.token = "";
|
|
148
|
+
} else
|
|
149
|
+
l.auth.keyType = "custom", l.auth.paramName = "", l.auth.paramValue = "", l.auth.token = "";
|
|
150
|
+
a.icon && a.icon !== "0" && a.iconUrl && (m.value = [{ bnid: a.icon, url: a.iconUrl }]);
|
|
151
|
+
} }), (a, t) => (A(), M(e(V), {
|
|
152
|
+
ref_key: "ruleFormRef",
|
|
153
|
+
ref: d,
|
|
154
|
+
model: r,
|
|
155
|
+
rules: U.value,
|
|
156
|
+
"label-width": "auto",
|
|
157
|
+
"label-position": "top",
|
|
158
|
+
class: "scrollable-form"
|
|
159
|
+
}, {
|
|
160
|
+
default: n(() => [
|
|
161
|
+
i(e(p), {
|
|
162
|
+
class: "scrollable-form__item",
|
|
163
|
+
label: e(o)("LIBRARY_CREATEMCPFORM.MCP_ICON"),
|
|
164
|
+
prop: "icon"
|
|
165
|
+
}, {
|
|
166
|
+
label: n(() => [
|
|
167
|
+
s("div", Q, [
|
|
168
|
+
s("span", null, c(e(o)("LIBRARY_CREATEMCPFORM.MCP_ICON")), 1),
|
|
169
|
+
i(e(P), { placement: "top" }, {
|
|
170
|
+
content: n(() => [
|
|
171
|
+
I(c(e(o)("LIBRARY_CREATEMCPFORM.MCP_ICON_TIP")), 1),
|
|
172
|
+
t[6] || (t[6] = s("br", null, null, -1)),
|
|
173
|
+
I(" " + c(e(o)("LIBRARY_CREATEMCPFORM.MCP_ICON_SIZE_TIP")), 1)
|
|
174
|
+
]),
|
|
175
|
+
default: n(() => [
|
|
176
|
+
i(e(h), {
|
|
177
|
+
size: "14px",
|
|
178
|
+
color: "#999"
|
|
179
|
+
}, {
|
|
180
|
+
default: n(() => [
|
|
181
|
+
i(e(L))
|
|
182
|
+
]),
|
|
183
|
+
_: 1
|
|
184
|
+
})
|
|
185
|
+
]),
|
|
186
|
+
_: 1
|
|
187
|
+
})
|
|
188
|
+
])
|
|
189
|
+
]),
|
|
190
|
+
default: n(() => [
|
|
191
|
+
i(e(w), {
|
|
192
|
+
fileList: m.value,
|
|
193
|
+
previewType: "Card",
|
|
194
|
+
isCustom: !0,
|
|
195
|
+
onOnRemove: g,
|
|
196
|
+
onOnPreview: v
|
|
197
|
+
}, {
|
|
198
|
+
CardUploader: n(() => [
|
|
199
|
+
m.value.length === 0 ? (A(), M(e(x), {
|
|
200
|
+
key: 0,
|
|
201
|
+
"upload-type": "Card",
|
|
202
|
+
onOnSuccess: N,
|
|
203
|
+
limitSize: 5,
|
|
204
|
+
acceptType: ".jpg,.png",
|
|
205
|
+
businessType: "mcp",
|
|
206
|
+
defaultUploadIcon: "mcp"
|
|
207
|
+
})) : f("", !0)
|
|
208
|
+
]),
|
|
209
|
+
_: 1
|
|
210
|
+
}, 8, ["fileList"])
|
|
211
|
+
]),
|
|
212
|
+
_: 1
|
|
213
|
+
}, 8, ["label"]),
|
|
214
|
+
i(e(p), {
|
|
215
|
+
class: "scrollable-form__item",
|
|
216
|
+
label: e(o)("LIBRARY_CREATEMCPFORM.MCP_NAME"),
|
|
217
|
+
prop: "name"
|
|
218
|
+
}, {
|
|
219
|
+
default: n(() => [
|
|
220
|
+
i(e(E), {
|
|
221
|
+
modelValue: r.name,
|
|
222
|
+
"onUpdate:modelValue": t[0] || (t[0] = (u) => r.name = u),
|
|
223
|
+
placeholder: e(o)("LIBRARY_CREATEMCPFORM.MCP_NAME_REQUIRED"),
|
|
224
|
+
maxlength: "20",
|
|
225
|
+
"show-word-limit": ""
|
|
226
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
227
|
+
]),
|
|
228
|
+
_: 1
|
|
229
|
+
}, 8, ["label"]),
|
|
230
|
+
i(e(p), {
|
|
231
|
+
class: "scrollable-form__item",
|
|
232
|
+
label: e(o)("LIBRARY_CREATEMCPFORM.MCP_DESCRIPTION"),
|
|
233
|
+
prop: "description"
|
|
234
|
+
}, {
|
|
235
|
+
default: n(() => [
|
|
236
|
+
i(e(E), {
|
|
237
|
+
modelValue: r.description,
|
|
238
|
+
"onUpdate:modelValue": t[1] || (t[1] = (u) => r.description = u),
|
|
239
|
+
type: "textarea",
|
|
240
|
+
rows: 3,
|
|
241
|
+
placeholder: e(o)("LIBRARY_CREATEMCPFORM.MCP_DESCRIPTION_REQUIRED"),
|
|
242
|
+
maxlength: "200",
|
|
243
|
+
"show-word-limit": ""
|
|
244
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
245
|
+
]),
|
|
246
|
+
_: 1
|
|
247
|
+
}, 8, ["label"]),
|
|
248
|
+
i(e(p), {
|
|
249
|
+
class: "scrollable-form__item",
|
|
250
|
+
label: e(o)("LIBRARY_CREATEMCPFORM.TRANSFER_METHOD"),
|
|
251
|
+
prop: "communicationType"
|
|
252
|
+
}, {
|
|
253
|
+
default: n(() => [
|
|
254
|
+
i(e(Y), {
|
|
255
|
+
modelValue: r.communicationType,
|
|
256
|
+
"onUpdate:modelValue": t[2] || (t[2] = (u) => r.communicationType = u),
|
|
257
|
+
options: b.value,
|
|
258
|
+
layout: "vertical",
|
|
259
|
+
"class-name": "scrollable-form__item-radio"
|
|
260
|
+
}, null, 8, ["modelValue", "options"])
|
|
261
|
+
]),
|
|
262
|
+
_: 1
|
|
263
|
+
}, 8, ["label"]),
|
|
264
|
+
i(e(p), {
|
|
265
|
+
class: "scrollable-form__item",
|
|
266
|
+
label: e(o)("LIBRARY_CREATEMCPFORM.SERVICE_URL"),
|
|
267
|
+
prop: "address"
|
|
268
|
+
}, {
|
|
269
|
+
default: n(() => [
|
|
270
|
+
i(e(E), {
|
|
271
|
+
modelValue: r.address,
|
|
272
|
+
"onUpdate:modelValue": t[3] || (t[3] = (u) => r.address = u),
|
|
273
|
+
placeholder: e(o)("LIBRARY_CREATEMCPFORM.SERVICE_URL_REQUIRED")
|
|
274
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
275
|
+
]),
|
|
276
|
+
_: 1
|
|
277
|
+
}, 8, ["label"]),
|
|
278
|
+
l.auth.authType === "apiKey" ? (A(), M(e(p), {
|
|
279
|
+
key: 0,
|
|
280
|
+
class: "scrollable-form__item",
|
|
281
|
+
prop: "applyLink"
|
|
282
|
+
}, {
|
|
283
|
+
label: n(() => [
|
|
284
|
+
s("div", H, [
|
|
285
|
+
s("span", null, c(e(o)("LIBRARY_CREATEMCPFORM.DOCUMENTATION_URL")), 1),
|
|
286
|
+
i(e(P), { placement: "top" }, {
|
|
287
|
+
content: n(() => [
|
|
288
|
+
I(c(e(o)("LIBRARY_CREATEMCPFORM.DOCUMENTATION_URL_TIP")), 1)
|
|
289
|
+
]),
|
|
290
|
+
default: n(() => [
|
|
291
|
+
i(e(h), {
|
|
292
|
+
size: "14px",
|
|
293
|
+
color: "#999"
|
|
294
|
+
}, {
|
|
295
|
+
default: n(() => [
|
|
296
|
+
i(e(L))
|
|
297
|
+
]),
|
|
298
|
+
_: 1
|
|
299
|
+
})
|
|
300
|
+
]),
|
|
301
|
+
_: 1
|
|
302
|
+
})
|
|
303
|
+
])
|
|
304
|
+
]),
|
|
305
|
+
default: n(() => [
|
|
306
|
+
i(e(E), {
|
|
307
|
+
modelValue: r.applyLink,
|
|
308
|
+
"onUpdate:modelValue": t[4] || (t[4] = (u) => r.applyLink = u),
|
|
309
|
+
placeholder: e(o)("LIBRARY_CREATEMCPFORM.DOCUMENTATION_URL_REQUIRED")
|
|
310
|
+
}, null, 8, ["modelValue", "placeholder"])
|
|
311
|
+
]),
|
|
312
|
+
_: 1
|
|
313
|
+
})) : f("", !0),
|
|
314
|
+
s("div", q, [
|
|
315
|
+
i(e(k), {
|
|
316
|
+
ref_key: "authSectionRef",
|
|
317
|
+
ref: C,
|
|
318
|
+
featData: l,
|
|
319
|
+
"onUpdate:featData": t[5] || (t[5] = (u) => l = u),
|
|
320
|
+
layout: "vertical"
|
|
321
|
+
}, null, 8, ["featData"])
|
|
322
|
+
])
|
|
323
|
+
]),
|
|
324
|
+
_: 1
|
|
325
|
+
}, 8, ["model", "rules"]));
|
|
326
|
+
}
|
|
327
|
+
}, j = /* @__PURE__ */ K(z, [["__scopeId", "data-v-a92d9b79"]]), se = D(j);
|
|
328
|
+
export {
|
|
329
|
+
se as CreateMcpForm,
|
|
330
|
+
se as default
|
|
331
|
+
};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { w as U } from "./chunks/index.bCzIhWFw.js";
|
|
2
|
+
import { resolveComponent as c, createElementBlock as r, openBlock as n, createCommentVNode as w, unref as _, renderSlot as C, createVNode as u, withCtx as i, Fragment as D, renderList as b, createBlock as a, createElementVNode as x, resolveDynamicComponent as S, toDisplayString as V, createTextVNode as L } from "vue";
|
|
3
|
+
import { o as H } from "./chunks/usePreview.BMkgYO7E.js";
|
|
4
|
+
import { _ as N } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
|
|
5
|
+
import './assets/FilePreview.css';const g = {
|
|
6
|
+
卡片: "Card",
|
|
7
|
+
按钮: "Button",
|
|
8
|
+
面板: "Panel",
|
|
9
|
+
自定义: "Custom"
|
|
10
|
+
}, M = (e) => /(txt|yaml)/i.test(e), j = (e) => /ppt|pptx/i.test(e), A = (e) => /pdf/i.test(e);
|
|
11
|
+
function O(e) {
|
|
12
|
+
return /(docx|doc|msword)/i.test(e);
|
|
13
|
+
}
|
|
14
|
+
function J(e) {
|
|
15
|
+
return /(xlsx|xls|sheet|csv)/i.test(e);
|
|
16
|
+
}
|
|
17
|
+
function W(e) {
|
|
18
|
+
return /(zip|rar|7z)$/i.test(e);
|
|
19
|
+
}
|
|
20
|
+
const k = (e) => /(jpe?g|png|bmp|gif|webp|svg|ico)(\?.*)?$/i.test(e), Z = (e) => /(mp4|avi|rmvb|rm|wmv|flv|3gp|mkv|mov)(\?.*)?$/i.test(e), q = (e) => /(mp3|wav|wma|aac|flac)(\?.*)?$/i.test(e), G = (e) => /(md|markdown)/i.test(e), K = (e) => /(html|htm|xhtml|xml)/i.test(e), Q = (e) => /(json)/i.test(e), R = (e) => {
|
|
21
|
+
if (A(e.suffix))
|
|
22
|
+
return "Pdf1";
|
|
23
|
+
if (O(e.suffix))
|
|
24
|
+
return "Doc";
|
|
25
|
+
if (J(e.suffix))
|
|
26
|
+
return "Excel1";
|
|
27
|
+
if (Z(e.suffix))
|
|
28
|
+
return "Video";
|
|
29
|
+
if (q(e.suffix))
|
|
30
|
+
return "Music";
|
|
31
|
+
if (j(e.suffix))
|
|
32
|
+
return "Ppt1";
|
|
33
|
+
if (G(e.suffix))
|
|
34
|
+
return "Md";
|
|
35
|
+
if (K(e.suffix))
|
|
36
|
+
return "Html";
|
|
37
|
+
if (M(e.suffix))
|
|
38
|
+
return "Txt1";
|
|
39
|
+
if (Q(e.suffix))
|
|
40
|
+
return "Other";
|
|
41
|
+
if (W(e.suffix))
|
|
42
|
+
return "Other";
|
|
43
|
+
if (k(e.suffix))
|
|
44
|
+
return "Pic";
|
|
45
|
+
}, X = { class: "file-preview-wrapper" }, Y = {
|
|
46
|
+
key: 0,
|
|
47
|
+
class: "panel-preview"
|
|
48
|
+
}, ee = { class: "panel-preview__item" }, te = ["onClick"], ne = ["src", "alt"], oe = { class: "panel-preview__name ellipsis" }, se = { key: 0 }, re = { key: 1 }, le = {
|
|
49
|
+
key: 1,
|
|
50
|
+
class: "upload-preview"
|
|
51
|
+
}, ie = ["src", "alt"], ae = { class: "preview-item__mask" }, ce = {
|
|
52
|
+
__name: "index",
|
|
53
|
+
props: {
|
|
54
|
+
fileList: {
|
|
55
|
+
type: Array,
|
|
56
|
+
default: () => []
|
|
57
|
+
},
|
|
58
|
+
canEdit: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: !0
|
|
61
|
+
},
|
|
62
|
+
previewType: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: g.面板
|
|
65
|
+
},
|
|
66
|
+
isStream: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: !1
|
|
69
|
+
},
|
|
70
|
+
isCustom: {
|
|
71
|
+
type: Boolean,
|
|
72
|
+
default: !1
|
|
73
|
+
},
|
|
74
|
+
// 下载文件函数,接收 (item) => Promise<Array<{ url, suffix }>>
|
|
75
|
+
onDownload: {
|
|
76
|
+
type: Function,
|
|
77
|
+
default: null
|
|
78
|
+
},
|
|
79
|
+
// 下载文件流函数,接收 (item) => Promise<Blob>
|
|
80
|
+
onDownloadStream: {
|
|
81
|
+
type: Function,
|
|
82
|
+
default: null
|
|
83
|
+
},
|
|
84
|
+
// 预览图片函数,接收 (url) => void
|
|
85
|
+
onPreviewImage: {
|
|
86
|
+
type: Function,
|
|
87
|
+
default: null
|
|
88
|
+
},
|
|
89
|
+
// 下载 Blob 文件函数,接收 (blob, name, type) => string
|
|
90
|
+
downloadBlobFile: {
|
|
91
|
+
type: Function,
|
|
92
|
+
default: null
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
emits: ["on-remove", "on-preview"],
|
|
96
|
+
setup(e, { emit: s }) {
|
|
97
|
+
const l = e, f = s, { downloadPrew: B, downloadStreamPrew: I } = H({
|
|
98
|
+
onDownload: l.onDownload,
|
|
99
|
+
onDownloadStream: l.onDownloadStream,
|
|
100
|
+
onPreviewImage: l.onPreviewImage || ((o) => window.open(o, "_blank")),
|
|
101
|
+
downloadBlobFile: l.downloadBlobFile
|
|
102
|
+
}), y = (o) => R(o);
|
|
103
|
+
function F(o) {
|
|
104
|
+
l.isCustom ? f("on-preview", o) : l.isStream ? l.onDownloadStream ? I(o) : (console.warn("FilePreview: isStream 为 true 但未提供 onDownloadStream 函数"), f("on-preview", o)) : l.onDownload ? B(o) : f("on-preview", o);
|
|
105
|
+
}
|
|
106
|
+
function h(o, p) {
|
|
107
|
+
f("on-remove", o, p);
|
|
108
|
+
}
|
|
109
|
+
return (o, p) => {
|
|
110
|
+
const d = c("el-icon"), $ = c("el-button"), P = c("IconDelete"), E = c("el-col"), T = c("el-row"), z = c("IconHide");
|
|
111
|
+
return n(), r("div", X, [
|
|
112
|
+
e.previewType === _(g).面板 ? (n(), r("div", Y, [
|
|
113
|
+
C(o.$slots, "PanelUploader", {}, void 0, !0),
|
|
114
|
+
u(T, {
|
|
115
|
+
gutter: 20,
|
|
116
|
+
class: "panel-preview__row"
|
|
117
|
+
}, {
|
|
118
|
+
default: i(() => [
|
|
119
|
+
(n(!0), r(D, null, b(e.fileList, (t, m) => (n(), a(E, {
|
|
120
|
+
span: 8,
|
|
121
|
+
key: t.bnid
|
|
122
|
+
}, {
|
|
123
|
+
default: i(() => [
|
|
124
|
+
x("div", ee, [
|
|
125
|
+
x("div", {
|
|
126
|
+
class: "panel-preview__box",
|
|
127
|
+
onClick: (v) => F(t)
|
|
128
|
+
}, [
|
|
129
|
+
_(k)(t.suffix) ? (n(), r("img", {
|
|
130
|
+
key: 0,
|
|
131
|
+
src: t.url,
|
|
132
|
+
alt: t.name,
|
|
133
|
+
class: "panel-preview__img"
|
|
134
|
+
}, null, 8, ne)) : (n(), a(d, {
|
|
135
|
+
key: 1,
|
|
136
|
+
size: "32px",
|
|
137
|
+
class: "panel-preview__img"
|
|
138
|
+
}, {
|
|
139
|
+
default: i(() => [
|
|
140
|
+
(n(), a(S(y(t))))
|
|
141
|
+
]),
|
|
142
|
+
_: 2
|
|
143
|
+
}, 1024)),
|
|
144
|
+
x("span", oe, V(t.name), 1)
|
|
145
|
+
], 8, te),
|
|
146
|
+
t.isUploading ? (n(), r("div", se, [
|
|
147
|
+
u($, {
|
|
148
|
+
text: "",
|
|
149
|
+
size: "small",
|
|
150
|
+
loading: ""
|
|
151
|
+
}, {
|
|
152
|
+
default: i(() => [...p[0] || (p[0] = [
|
|
153
|
+
L("上传中...", -1)
|
|
154
|
+
])]),
|
|
155
|
+
_: 1
|
|
156
|
+
})
|
|
157
|
+
])) : (n(), r("div", re, [
|
|
158
|
+
e.canEdit ? (n(), a(d, {
|
|
159
|
+
key: 0,
|
|
160
|
+
size: "18",
|
|
161
|
+
style: { cursor: "pointer" },
|
|
162
|
+
onClick: (v) => h(m, t)
|
|
163
|
+
}, {
|
|
164
|
+
default: i(() => [
|
|
165
|
+
u(P)
|
|
166
|
+
]),
|
|
167
|
+
_: 1
|
|
168
|
+
}, 8, ["onClick"])) : w("", !0)
|
|
169
|
+
]))
|
|
170
|
+
])
|
|
171
|
+
]),
|
|
172
|
+
_: 2
|
|
173
|
+
}, 1024))), 128))
|
|
174
|
+
]),
|
|
175
|
+
_: 1
|
|
176
|
+
})
|
|
177
|
+
])) : w("", !0),
|
|
178
|
+
e.previewType === _(g).卡片 ? (n(), r("ul", le, [
|
|
179
|
+
(n(!0), r(D, null, b(e.fileList, (t, m) => (n(), r("li", {
|
|
180
|
+
class: "preview-item",
|
|
181
|
+
key: t.bnid
|
|
182
|
+
}, [
|
|
183
|
+
_(k)(t.suffix) ? (n(), r("img", {
|
|
184
|
+
key: 0,
|
|
185
|
+
src: t.url,
|
|
186
|
+
alt: t.name,
|
|
187
|
+
class: "preview-item__img"
|
|
188
|
+
}, null, 8, ie)) : (n(), a(d, {
|
|
189
|
+
key: 1,
|
|
190
|
+
size: "32px",
|
|
191
|
+
class: "preview-item__img"
|
|
192
|
+
}, {
|
|
193
|
+
default: i(() => [
|
|
194
|
+
(n(), a(S(y(t))))
|
|
195
|
+
]),
|
|
196
|
+
_: 2
|
|
197
|
+
}, 1024)),
|
|
198
|
+
x("div", ae, [
|
|
199
|
+
u(d, {
|
|
200
|
+
class: "preview-item__mask--view",
|
|
201
|
+
onClick: (v) => F(t)
|
|
202
|
+
}, {
|
|
203
|
+
default: i(() => [
|
|
204
|
+
u(z)
|
|
205
|
+
]),
|
|
206
|
+
_: 1
|
|
207
|
+
}, 8, ["onClick"]),
|
|
208
|
+
e.canEdit ? (n(), a(d, {
|
|
209
|
+
key: 0,
|
|
210
|
+
class: "preview-item__mask--delete",
|
|
211
|
+
onClick: (v) => h(m, t)
|
|
212
|
+
}, {
|
|
213
|
+
default: i(() => [
|
|
214
|
+
u(P)
|
|
215
|
+
]),
|
|
216
|
+
_: 1
|
|
217
|
+
}, 8, ["onClick"])) : w("", !0)
|
|
218
|
+
])
|
|
219
|
+
]))), 128)),
|
|
220
|
+
C(o.$slots, "CardUploader", {}, void 0, !0)
|
|
221
|
+
])) : w("", !0)
|
|
222
|
+
]);
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
}, ue = /* @__PURE__ */ N(ce, [["__scopeId", "data-v-fe542fce"]]), _e = U(ue);
|
|
226
|
+
export {
|
|
227
|
+
_e as FilePreview,
|
|
228
|
+
_e as default
|
|
229
|
+
};
|