china-mobile-international-custom-components 0.0.55 → 0.0.57

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.
@@ -1,6 +1,7 @@
1
- import { w as V } from "./chunks/index.bCzIhWFw.js";
2
- import { ref as E, reactive as h, resolveComponent as m, createBlock as I, openBlock as f, withCtx as i, createVNode as r, createCommentVNode as L, createElementVNode as R, unref as n, toDisplayString as d, createTextVNode as y } from "vue";
3
- import { ElMessage as T } from "element-plus";
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";
4
5
  import { o as B } from "./chunks/usePreview.BMkgYO7E.js";
5
6
  import { AuthSection as k } from "./AuthSection.mjs";
6
7
  import { RadioGroup as Y } from "./RadioGroup.mjs";
@@ -11,7 +12,7 @@ import { _ as K } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
11
12
  import './assets/CreateMcpForm.css';const Q = { class: "label-with-icon" }, H = { class: "label-with-icon" }, q = { class: "auth-section-wrapper" }, z = {
12
13
  __name: "CreateMcpForm",
13
14
  setup(X, { expose: O }) {
14
- const { t: o } = S(), { previewImage: F } = B(), M = E(null), A = E(null), l = h({
15
+ const { t: o } = S(), { previewImage: F } = B(), d = R(null), C = R(null), r = y({
15
16
  icon: "",
16
17
  iconUrl: "",
17
18
  name: "",
@@ -20,10 +21,10 @@ import './assets/CreateMcpForm.css';const Q = { class: "label-with-icon" }, H =
20
21
  // 默认值改为与 options 中的 value 匹配
21
22
  address: "",
22
23
  applyLink: ""
23
- }), b = E([
24
+ }), b = R([
24
25
  { label: "SSE", value: "SSE" },
25
26
  { label: "Streamable HTTP", value: "HTTP" }
26
- ]), a = h({
27
+ ]), l = y({
27
28
  auth: {
28
29
  authType: "none",
29
30
  keyType: "custom",
@@ -32,7 +33,7 @@ import './assets/CreateMcpForm.css';const Q = { class: "label-with-icon" }, H =
32
33
  paramValue: "",
33
34
  token: ""
34
35
  }
35
- }), U = E({
36
+ }), U = R({
36
37
  name: [
37
38
  {
38
39
  required: !0,
@@ -79,242 +80,251 @@ import './assets/CreateMcpForm.css';const Q = { class: "label-with-icon" }, H =
79
80
  trigger: ["blur", "change"]
80
81
  }
81
82
  ]
82
- }), c = E([]), N = (e) => {
83
- l.iconUrl = e.url, l.icon = e.bnid, c.value = [e];
83
+ }), m = R([]), N = (a) => {
84
+ r.iconUrl = a.url, r.icon = a.bnid, m.value = [a];
84
85
  }, g = () => {
85
- l.iconUrl = "", l.icon = "", c.value = [];
86
- }, v = (e) => {
87
- F(e.url);
86
+ r.iconUrl = "", r.icon = "", m.value = [];
87
+ }, v = (a) => {
88
+ F(a.url);
88
89
  };
89
- return O({ validate: async (e) => {
90
- if (!M.value) return !1;
91
- if (A.value?.validateField) {
92
- const t = A.value.validateField();
90
+ return O({ validate: async (a) => {
91
+ if (!d.value) return !1;
92
+ if (C.value?.validateField) {
93
+ const t = C.value.validateField();
93
94
  if (Object.keys(t).length > 0)
94
- return t.paramName ? T.error(o("LIBRARY_CREATEMCPFORM.PARAMETER_NAME_REQUIRED") || "请输入密钥参数名") : t.paramValue ? T.error(o("LIBRARY_CREATEMCPFORM.INPUT_API_KEY_REQUIRED") || "请输入密钥值") : t.token ? T.error(o("LIBRARY_CREATEMCPFORM.INPUT_API_KEY_REQUIRED") || "请输入密钥值") : T.error(o("LIBRARY_CREATEMCPFORM.MCP_AUTH_REQUIRED") || "请完善鉴权信息"), e?.(new Error(o("LIBRARY_CREATEMCPFORM.MCP_AUTH_REQUIRED") || "请完善鉴权信息")), !1;
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;
95
108
  }
96
- return M.value.validate(e);
109
+ return d.value.validate(a);
97
110
  }, getFormData: () => ({
98
- name: l.name,
99
- icon: l.icon,
111
+ name: r.name,
112
+ icon: r.icon,
100
113
  // iconUrl: ruleForm.iconUrl,
101
- description: l.description,
102
- address: l.address,
103
- communicationType: l.communicationType,
114
+ description: r.description,
115
+ address: r.address,
116
+ communicationType: r.communicationType,
104
117
  // 鉴权相关字段
105
- authType: a.auth.authType === "none" ? 0 : 1,
118
+ authType: l.auth.authType === "none" ? 0 : 1,
106
119
  // none->0, apiKey->1
107
- authLocation: a.auth.paramLocation === "header" ? 0 : 1,
120
+ authLocation: l.auth.paramLocation === "header" ? 0 : 1,
108
121
  // header->0, query->1
109
- apiKeyName: a.auth.keyType === "bearer" ? "Authorization" : a.auth.paramName || "",
110
- apiKeyValue: a.auth.keyType === "bearer" ? a.auth.token ? `Bearer ${a.auth.token}` : "" : a.auth.paramValue || "",
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 || "",
111
124
  // 可选字段
112
- applyLink: l.applyLink || "",
125
+ applyLink: r.applyLink || "",
113
126
  headerPrefixType: 1,
114
127
  overview: ""
115
- }), setFormData: (e) => {
116
- if (!e) return;
117
- Object.assign(l, {
118
- name: e.name || "",
119
- description: e.description || "",
120
- icon: e.icon || "",
121
- iconUrl: e.iconUrl || "",
122
- communicationType: e.communicationType || "SSE",
123
- address: e.address || "",
124
- applyLink: e.applyLink || ""
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 || ""
125
138
  });
126
- const t = e.authType === 1 || e.authType === "1";
127
- if (a.auth.authType = t ? "apiKey" : "none", a.auth.paramLocation = e.authLocation === 0 || e.authLocation === "0" ? "header" : "query", t) {
128
- const _ = !e.apiKeyName || e.apiKeyName === "Authorization";
129
- if (a.auth.keyType = _ ? "bearer" : "custom", _) {
130
- a.auth.paramName = "", a.auth.paramValue = "";
131
- const u = e.apiKeyValue || "";
132
- a.auth.token = u.startsWith("Bearer ") ? u.substring(7) : u;
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;
133
146
  } else
134
- a.auth.paramName = e.apiKeyName || "", a.auth.paramValue = e.apiKeyValue || "", a.auth.token = "";
147
+ l.auth.paramName = a.apiKeyName || "", l.auth.paramValue = a.apiKeyValue || "", l.auth.token = "";
135
148
  } else
136
- a.auth.keyType = "custom", a.auth.paramName = "", a.auth.paramValue = "", a.auth.token = "";
137
- e.icon && e.icon !== "0" && e.iconUrl && (c.value = [{ bnid: e.icon, url: e.iconUrl }]);
138
- } }), (e, t) => {
139
- const _ = m("IconTip"), u = m("el-icon"), P = m("el-tooltip"), p = m("el-form-item"), C = m("el-input"), D = m("el-form");
140
- return f(), I(D, {
141
- ref_key: "ruleFormRef",
142
- ref: M,
143
- model: l,
144
- rules: U.value,
145
- "label-width": "auto",
146
- "label-position": "top",
147
- class: "scrollable-form"
148
- }, {
149
- default: i(() => [
150
- r(p, {
151
- class: "scrollable-form__item",
152
- label: n(o)("LIBRARY_CREATEMCPFORM.MCP_ICON"),
153
- prop: "icon"
154
- }, {
155
- label: i(() => [
156
- R("div", Q, [
157
- R("span", null, d(n(o)("LIBRARY_CREATEMCPFORM.MCP_ICON")), 1),
158
- r(P, { placement: "top" }, {
159
- content: i(() => [
160
- y(d(n(o)("LIBRARY_CREATEMCPFORM.MCP_ICON_TIP")), 1),
161
- t[6] || (t[6] = R("br", null, null, -1)),
162
- y(" " + d(n(o)("LIBRARY_CREATEMCPFORM.MCP_ICON_SIZE_TIP")), 1)
163
- ]),
164
- default: i(() => [
165
- r(u, {
166
- size: "14px",
167
- color: "#999"
168
- }, {
169
- default: i(() => [
170
- r(_)
171
- ]),
172
- _: 1
173
- })
174
- ]),
175
- _: 1
176
- })
177
- ])
178
- ]),
179
- default: i(() => [
180
- r(n(w), {
181
- fileList: c.value,
182
- previewType: "Card",
183
- isCustom: !0,
184
- onOnRemove: g,
185
- onOnPreview: v
186
- }, {
187
- CardUploader: i(() => [
188
- c.value.length === 0 ? (f(), I(n(x), {
189
- key: 0,
190
- "upload-type": "Card",
191
- onOnSuccess: N,
192
- limitSize: 5,
193
- acceptType: ".jpg,.png",
194
- businessType: "mcp",
195
- defaultUploadIcon: "mcp"
196
- })) : L("", !0)
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
+ })
197
185
  ]),
198
186
  _: 1
199
- }, 8, ["fileList"])
200
- ]),
201
- _: 1
202
- }, 8, ["label"]),
203
- r(p, {
204
- class: "scrollable-form__item",
205
- label: n(o)("LIBRARY_CREATEMCPFORM.MCP_NAME"),
206
- prop: "name"
207
- }, {
208
- default: i(() => [
209
- r(C, {
210
- modelValue: l.name,
211
- "onUpdate:modelValue": t[0] || (t[0] = (s) => l.name = s),
212
- placeholder: n(o)("LIBRARY_CREATEMCPFORM.MCP_NAME_REQUIRED"),
213
- maxlength: "20",
214
- "show-word-limit": ""
215
- }, null, 8, ["modelValue", "placeholder"])
216
- ]),
217
- _: 1
218
- }, 8, ["label"]),
219
- r(p, {
220
- class: "scrollable-form__item",
221
- label: n(o)("LIBRARY_CREATEMCPFORM.MCP_DESCRIPTION"),
222
- prop: "description"
223
- }, {
224
- default: i(() => [
225
- r(C, {
226
- modelValue: l.description,
227
- "onUpdate:modelValue": t[1] || (t[1] = (s) => l.description = s),
228
- type: "textarea",
229
- rows: 3,
230
- placeholder: n(o)("LIBRARY_CREATEMCPFORM.MCP_DESCRIPTION_REQUIRED"),
231
- maxlength: "200",
232
- "show-word-limit": ""
233
- }, null, 8, ["modelValue", "placeholder"])
234
- ]),
235
- _: 1
236
- }, 8, ["label"]),
237
- r(p, {
238
- class: "scrollable-form__item",
239
- label: n(o)("LIBRARY_CREATEMCPFORM.TRANSFER_METHOD"),
240
- prop: "communicationType"
241
- }, {
242
- default: i(() => [
243
- r(n(Y), {
244
- modelValue: l.communicationType,
245
- "onUpdate:modelValue": t[2] || (t[2] = (s) => l.communicationType = s),
246
- options: b.value,
247
- layout: "vertical",
248
- "class-name": "scrollable-form__item-radio"
249
- }, null, 8, ["modelValue", "options"])
250
- ]),
251
- _: 1
252
- }, 8, ["label"]),
253
- r(p, {
254
- class: "scrollable-form__item",
255
- label: n(o)("LIBRARY_CREATEMCPFORM.SERVICE_URL"),
256
- prop: "address"
257
- }, {
258
- default: i(() => [
259
- r(C, {
260
- modelValue: l.address,
261
- "onUpdate:modelValue": t[3] || (t[3] = (s) => l.address = s),
262
- placeholder: n(o)("LIBRARY_CREATEMCPFORM.SERVICE_URL_REQUIRED")
263
- }, null, 8, ["modelValue", "placeholder"])
264
- ]),
265
- _: 1
266
- }, 8, ["label"]),
267
- a.auth.authType === "apiKey" ? (f(), I(p, {
268
- key: 0,
269
- class: "scrollable-form__item",
270
- prop: "applyLink"
271
- }, {
272
- label: i(() => [
273
- R("div", H, [
274
- R("span", null, d(n(o)("LIBRARY_CREATEMCPFORM.DOCUMENTATION_URL")), 1),
275
- r(P, { placement: "top" }, {
276
- content: i(() => [
277
- y(d(n(o)("LIBRARY_CREATEMCPFORM.DOCUMENTATION_URL_TIP")), 1)
278
- ]),
279
- default: i(() => [
280
- r(u, {
281
- size: "14px",
282
- color: "#999"
283
- }, {
284
- default: i(() => [
285
- r(_)
286
- ]),
287
- _: 1
288
- })
289
- ]),
290
- _: 1
291
- })
292
- ])
293
- ]),
294
- default: i(() => [
295
- r(C, {
296
- modelValue: l.applyLink,
297
- "onUpdate:modelValue": t[4] || (t[4] = (s) => l.applyLink = s),
298
- placeholder: n(o)("LIBRARY_CREATEMCPFORM.DOCUMENTATION_URL_REQUIRED")
299
- }, null, 8, ["modelValue", "placeholder"])
300
- ]),
301
- _: 1
302
- })) : L("", !0),
303
- R("div", q, [
304
- r(n(k), {
305
- ref_key: "authSectionRef",
306
- ref: A,
307
- featData: a,
308
- "onUpdate:featData": t[5] || (t[5] = (s) => a = s),
309
- layout: "vertical"
310
- }, null, 8, ["featData"])
311
- ])
312
- ]),
313
- _: 1
314
- }, 8, ["model", "rules"]);
315
- };
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"]));
316
326
  }
317
- }, j = /* @__PURE__ */ K(z, [["__scopeId", "data-v-12ffddd4"]]), se = V(j);
327
+ }, j = /* @__PURE__ */ K(z, [["__scopeId", "data-v-a92d9b79"]]), se = D(j);
318
328
  export {
319
329
  se as CreateMcpForm,
320
330
  se as default