china-mobile-international-custom-components 0.0.56 → 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,27 +1,27 @@
1
1
  import { w as N } from "./chunks/index.bCzIhWFw.js";
2
- import { ref as S, computed as R, resolveComponent as B, resolveDirective as K, createElementBlock as C, openBlock as c, normalizeStyle as D, normalizeClass as h, withDirectives as j, createBlock as u, unref as o, withCtx as r, createElementVNode as f, createCommentVNode as T, renderSlot as I, resolveDynamicComponent as z, createVNode as O, createTextVNode as M, toDisplayString as m } from "vue";
3
- import { ElUpload as $, ElIcon as v, ElButton as X, ElMessage as E } from "element-plus";
2
+ import { ref as S, computed as R, resolveDirective as B, createElementBlock as C, openBlock as c, normalizeStyle as K, normalizeClass as I, withDirectives as D, createBlock as u, unref as o, withCtx as r, createElementVNode as f, createCommentVNode as T, renderSlot as h, resolveDynamicComponent as j, createVNode as O, createTextVNode as M, toDisplayString as m } from "vue";
3
+ import { ElUpload as z, ElIcon as g, ElImage as $, ElButton as X, ElMessage as E } from "element-plus";
4
4
  import { g as V } from "./chunks/request.24c3shPx.js";
5
5
  import { u as W } from "./chunks/i18n.Bd7hh14j.js";
6
6
  import { m as G } from "./chunks/mcp-tool.Nc4HT9IM.js";
7
7
  import { MySpace as q, Space as Y, Workflow as Z, Model as H, WorkflowIcon3 as J, WorkflowIcon1 as Q, Plugin as ee, IconEdit2 as te, IconAdd as le, IconUpload2 as oe, File as ae } from "color-message-aibox-vue";
8
- import './assets/FileUploader.css';const y = {
8
+ import './assets/FileUploader.css';const v = {
9
9
  卡片: "Card",
10
10
  按钮: "Button",
11
11
  面板: "Panel",
12
12
  自定义: "Custom"
13
- }, ne = () => {
13
+ }, se = () => {
14
14
  const { $request: t, $env: e } = V();
15
15
  return {
16
- commonUpload: (n, l = "common") => t({
16
+ commonUpload: (s, l = "common") => t({
17
17
  method: "post",
18
18
  url: `${e.VITE_APP_AIBOX_BASE_URL}/api/v1/common/file/upload?type=${l}`,
19
- data: n,
19
+ data: s,
20
20
  dataType: "formData",
21
21
  skipCamelToKebab: !0
22
22
  })
23
23
  };
24
- }, se = { class: "card-uploader__mask" }, ie = { key: 4 }, ce = { class: "panel-uploader__text" }, de = { class: "panel-uploader__text--tip" }, pe = {
24
+ }, ne = { class: "card-uploader__mask" }, ie = { key: 4 }, ce = { class: "panel-uploader__text" }, de = { class: "panel-uploader__text--tip" }, pe = {
25
25
  key: 0,
26
26
  class: "panel-uploader__text--tip font-style"
27
27
  }, ue = { class: "panel-uploader__text--tip font-style" }, re = {
@@ -70,24 +70,24 @@ import './assets/FileUploader.css';const y = {
70
70
  },
71
71
  emits: ["on-success"],
72
72
  setup(t, { emit: e }) {
73
- const { t: a } = W(), n = S(!1), l = S(null), { commonUpload: _ } = ne(), d = t, U = e, b = (s) => {
74
- const p = /\.([^.]+)$/, i = s.match(p);
73
+ const { t: a } = W(), s = S(!1), l = S(null), { commonUpload: x } = se(), d = t, U = e, b = (n) => {
74
+ const p = /\.([^.]+)$/, i = n.match(p);
75
75
  return i ? i[1] : null;
76
- }, k = (s, p, i) => {
77
- let g = !0;
78
- const P = s.name && s.name.toLowerCase();
79
- if (console.log(s.name, P, "fileName"), p && p.indexOf(b(P)) === -1) {
76
+ }, k = (n, p, i) => {
77
+ let _ = !0;
78
+ const P = n.name && n.name.toLowerCase();
79
+ if (console.log(n.name, P, "fileName"), p && p.indexOf(b(P)) === -1) {
80
80
  const w = a("COMPONENTS.UPLOAD_TYPE_TIP", { type: p });
81
81
  E({
82
82
  type: "warning",
83
83
  message: w
84
- }), g = !1;
84
+ }), _ = !1;
85
85
  }
86
- if (s.size > 1024 * 1024 * i) {
86
+ if (n.size > 1024 * 1024 * i) {
87
87
  const w = a("COMPONENTS.UPLOAD_SIZE_TIP", { size: i });
88
- E.warning(w), g = !1;
88
+ E.warning(w), _ = !1;
89
89
  }
90
- return g;
90
+ return _;
91
91
  }, F = {
92
92
  plugin: ee,
93
93
  agent: Q,
@@ -100,65 +100,65 @@ import './assets/FileUploader.css';const y = {
100
100
  Card: "card-uploader",
101
101
  Button: "button-uploader",
102
102
  Panel: "panel-uploader"
103
- })[d.uploadType]), x = R(() => d.defaultUploadIcon ? F[d.defaultUploadIcon] : ""), L = async (s) => {
104
- if (k(s, d.acceptType, d.limitSize))
103
+ })[d.uploadType]), y = R(() => d.defaultUploadIcon ? F[d.defaultUploadIcon] : ""), L = async (n) => {
104
+ if (k(n, d.acceptType, d.limitSize))
105
105
  if (d.isMiio) {
106
- n.value = !0;
107
- const { data: i } = await _(
106
+ s.value = !0;
107
+ const { data: i } = await x(
108
108
  {
109
- file: s.raw
109
+ file: n.raw
110
110
  },
111
111
  d.businessType
112
112
  ).finally(() => {
113
- n.value = !1;
113
+ s.value = !1;
114
114
  });
115
115
  console.log(i, "data"), U("on-success", i);
116
116
  } else
117
- U("on-success", s);
117
+ U("on-success", n);
118
118
  else
119
- l.value.handleRemove(s);
119
+ l.value.handleRemove(n);
120
120
  };
121
- return (s, p) => {
122
- const i = B("el-image"), g = K("loading");
121
+ return (n, p) => {
122
+ const i = B("loading");
123
123
  return c(), C("div", {
124
- class: h(["file-uploader", t.defaultUploadIcon]),
125
- style: D({
124
+ class: I(["file-uploader", t.defaultUploadIcon]),
125
+ style: K({
126
126
  border: !t.defaultUploadIcon && t.uploadType === "Card" ? "1px dashed var(--el-border-color)" : "none",
127
127
  "border-radius": !t.defaultUploadIcon && t.uploadType === "Card" ? "8px" : "0",
128
- "background-image": x.value ? `url('${x.value}')` : "none"
128
+ "background-image": y.value ? `url('${y.value}')` : "none"
129
129
  })
130
130
  }, [
131
- j((c(), u(o($), {
131
+ D((c(), u(o(z), {
132
132
  ref_key: "uploader",
133
133
  ref: l,
134
- class: h(A.value),
134
+ class: I(A.value),
135
135
  action: "",
136
136
  "auto-upload": !1,
137
137
  limit: t.limitCount,
138
138
  "show-file-list": !1,
139
139
  accept: t.acceptType,
140
140
  multiple: t.multiple,
141
- drag: t.uploadType === o(y).面板,
141
+ drag: t.uploadType === o(v).面板,
142
142
  "on-change": L
143
143
  }, {
144
144
  default: r(() => [
145
- x.value ? (c(), u(o(v), {
145
+ y.value ? (c(), u(o(g), {
146
146
  key: 0,
147
147
  size: "64",
148
148
  class: "absolute"
149
149
  }, {
150
150
  default: r(() => [
151
- (c(), u(z(x.value)))
151
+ (c(), u(j(y.value)))
152
152
  ]),
153
153
  _: 1
154
- })) : (c(), u(i, {
154
+ })) : (c(), u(o($), {
155
155
  key: 1,
156
156
  style: { width: "64px", height: "64px" },
157
157
  src: o(G),
158
158
  class: "absolute"
159
159
  }, null, 8, ["src"])),
160
- f("div", se, [
161
- O(o(v), {
160
+ f("div", ne, [
161
+ O(o(g), {
162
162
  color: "#fff",
163
163
  size: "16px"
164
164
  }, {
@@ -168,22 +168,22 @@ import './assets/FileUploader.css';const y = {
168
168
  _: 1
169
169
  })
170
170
  ]),
171
- t.uploadType === o(y).卡片 ? (c(), u(o(v), {
171
+ t.uploadType === o(v).卡片 ? (c(), u(o(g), {
172
172
  key: 2,
173
173
  class: "card-uploader__icon"
174
174
  }, {
175
175
  default: r(() => [
176
176
  t.defaultUploadIcon ? T("", !0) : (c(), u(o(le), { key: 0 })),
177
- I(s.$slots, "text-slot")
177
+ h(n.$slots, "text-slot")
178
178
  ]),
179
179
  _: 3
180
180
  })) : T("", !0),
181
- t.uploadType === o(y).按钮 ? (c(), u(o(X), {
181
+ t.uploadType === o(v).按钮 ? (c(), u(o(X), {
182
182
  key: 3,
183
183
  type: "primary"
184
184
  }, {
185
185
  default: r(() => [
186
- O(o(v), { style: { "margin-right": "5px" } }, {
186
+ O(o(g), { style: { "margin-right": "5px" } }, {
187
187
  default: r(() => [
188
188
  O(o(oe))
189
189
  ]),
@@ -193,8 +193,8 @@ import './assets/FileUploader.css';const y = {
193
193
  ]),
194
194
  _: 1
195
195
  })) : T("", !0),
196
- t.uploadType === o(y).面板 ? (c(), C("div", ie, [
197
- O(o(v), { size: "48px" }, {
196
+ t.uploadType === o(v).面板 ? (c(), C("div", ie, [
197
+ O(o(g), { size: "48px" }, {
198
198
  default: r(() => [
199
199
  O(o(ae))
200
200
  ]),
@@ -211,20 +211,20 @@ import './assets/FileUploader.css';const y = {
211
211
  f("div", ue, m(t.warnTips), 1)
212
212
  ])
213
213
  ])) : T("", !0),
214
- t.uploadType === o(y).自定义 ? I(s.$slots, "upload-box", { key: 5 }) : T("", !0)
214
+ t.uploadType === o(v).自定义 ? h(n.$slots, "upload-box", { key: 5 }) : T("", !0)
215
215
  ]),
216
216
  _: 3
217
217
  }, 8, ["class", "limit", "accept", "multiple", "drag"])), [
218
- [g, n.value]
218
+ [i, s.value]
219
219
  ])
220
220
  ], 6);
221
221
  };
222
222
  }
223
223
  }, xe = (t) => {
224
224
  const { t: e } = W();
225
- let a = t.toLowerCase(), n = "", l = "";
226
- const _ = e("WORKFLOW_COM.TIP_TEXT_3");
227
- return a.includes("file") ? (l = "jpg、jpeg、png、webp、doc、docx、ppt、pptx、pdf、txt、xls、xlsx、csv、mp4、mkv、webm、ts、avi、mov、flv、3gp、ogv、mp3、wav、aac、flac、ogg", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("image") ? (l = "jpg、jpeg、png、webp", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("doc") ? (l = "doc、docx", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("ppt") ? (l = "ppt、pptx", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("pdf") ? (l = "pdf", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("txt") ? (l = "txt", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("excel") ? (l = "xls、xlsx、csv", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("audio") ? (l = "mp3、wav、aac、flac、ogg", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("video") && (l = "mp4、mkv、webm、ts、avi、mov、flv、3gp、ogv", n = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })), n + _;
225
+ let a = t.toLowerCase(), s = "", l = "";
226
+ const x = e("WORKFLOW_COM.TIP_TEXT_3");
227
+ return a.includes("file") ? (l = "jpg、jpeg、png、webp、doc、docx、ppt、pptx、pdf、txt、xls、xlsx、csv、mp4、mkv、webm、ts、avi、mov、flv、3gp、ogv、mp3、wav、aac、flac、ogg", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("image") ? (l = "jpg、jpeg、png、webp", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("doc") ? (l = "doc、docx", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("ppt") ? (l = "ppt、pptx", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("pdf") ? (l = "pdf", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("txt") ? (l = "txt", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("excel") ? (l = "xls、xlsx、csv", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("audio") ? (l = "mp3、wav、aac、flac、ogg", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })) : a.includes("video") && (l = "mp4、mkv、webm、ts、avi、mov、flv、3gp、ogv", s = e("WORKFLOW_COM.SUPPORT_FORMATS", { formats: l })), s + x;
228
228
  }, _e = (t) => {
229
229
  let e = t.toLowerCase();
230
230
  if (e.includes("file"))
@@ -251,7 +251,7 @@ import './assets/FileUploader.css';const y = {
251
251
  }, Ce = N(re);
252
252
  export {
253
253
  Ce as FileUploader,
254
- y as UploadTypesEnum,
254
+ v as UploadTypesEnum,
255
255
  Ce as default,
256
256
  we as extractAndLowerCaseArrayType,
257
257
  _e as getAcceptType,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./assets/FileUploader.css');const k=require("./chunks/index.CkihWzK6.js"),e=require("vue"),i=require("element-plus"),N=require("./chunks/request.D8T4MgGX.js"),v=require("./chunks/i18n.D3L1FBDI.js"),E=require("./chunks/mcp-tool.fb1SS2wA.js"),s=require("color-message-aibox-vue"),p={卡片:"Card",按钮:"Button",面板:"Panel",自定义:"Custom"},U=()=>{const{$request:o,$env:t}=N.getGlobalProperties();return{commonUpload:(n,l="common")=>o({method:"post",url:`${t.VITE_APP_AIBOX_BASE_URL}/api/v1/common/file/upload?type=${l}`,data:n,dataType:"formData",skipCamelToKebab:!0})}},P={class:"card-uploader__mask"},B={key:4},R={class:"panel-uploader__text"},h={class:"panel-uploader__text--tip"},I={key:0,class:"panel-uploader__text--tip font-style"},b={class:"panel-uploader__text--tip font-style"},A={__name:"index",props:{uploadType:{type:String,default:"Card"},acceptType:{type:String,default:""},multiple:{type:Boolean,default:!1},limitCount:{type:Number,default:1e3},limitSize:{type:Number,default:8},warnTips:{type:String,default:""},warnTips2:{type:String,default:""},isMiio:{type:Boolean,default:!0},businessType:{type:String,default:"common"},defaultUploadIcon:{type:String,default:""}},emits:["on-success"],setup(o,{emit:t}){const{t:a}=v.useI18n(),n=e.ref(!1),l=e.ref(null),{commonUpload:T}=U(),u=o,O=t,C=c=>{const d=/\.([^.]+)$/,r=c.match(d);return r?r[1]:null},_=(c,d,r)=>{let f=!0;const y=c.name&&c.name.toLowerCase();if(console.log(c.name,y,"fileName"),d&&d.indexOf(C(y))===-1){const g=a("COMPONENTS.UPLOAD_TYPE_TIP",{type:d});i.ElMessage({type:"warning",message:g}),f=!1}if(c.size>1024*1024*r){const g=a("COMPONENTS.UPLOAD_SIZE_TIP",{size:r});i.ElMessage.warning(g),f=!1}return f},w={plugin:s.Plugin,agent:s.WorkflowIcon1,dialogue:s.WorkflowIcon3,model:s.Model,workflow:s.Workflow,space:s.Space,"my-space":s.MySpace},S=e.computed(()=>({Card:"card-uploader",Button:"button-uploader",Panel:"panel-uploader"})[u.uploadType]),m=e.computed(()=>u.defaultUploadIcon?w[u.defaultUploadIcon]:""),M=async c=>{if(_(c,u.acceptType,u.limitSize))if(u.isMiio){n.value=!0;const{data:r}=await T({file:c.raw},u.businessType).finally(()=>{n.value=!1});console.log(r,"data"),O("on-success",r)}else O("on-success",c);else l.value.handleRemove(c)};return(c,d)=>{const r=e.resolveComponent("el-image"),f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["file-uploader",o.defaultUploadIcon]),style:e.normalizeStyle({border:!o.defaultUploadIcon&&o.uploadType==="Card"?"1px dashed var(--el-border-color)":"none","border-radius":!o.defaultUploadIcon&&o.uploadType==="Card"?"8px":"0","background-image":m.value?`url('${m.value}')`:"none"})},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(i.ElUpload),{ref_key:"uploader",ref:l,class:e.normalizeClass(S.value),action:"","auto-upload":!1,limit:o.limitCount,"show-file-list":!1,accept:o.acceptType,multiple:o.multiple,drag:o.uploadType===e.unref(p).面板,"on-change":M},{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createBlock(e.unref(i.ElIcon),{key:0,size:"64",class:"absolute"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.value)))]),_:1})):(e.openBlock(),e.createBlock(r,{key:1,style:{width:"64px",height:"64px"},src:e.unref(E.mcpToolIcon),class:"absolute"},null,8,["src"])),e.createElementVNode("div",P,[e.createVNode(e.unref(i.ElIcon),{color:"#fff",size:"16px"},{default:e.withCtx(()=>[e.createVNode(e.unref(s.IconEdit2))]),_:1})]),o.uploadType===e.unref(p).卡片?(e.openBlock(),e.createBlock(e.unref(i.ElIcon),{key:2,class:"card-uploader__icon"},{default:e.withCtx(()=>[o.defaultUploadIcon?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(s.IconAdd),{key:0})),e.renderSlot(c.$slots,"text-slot")]),_:3})):e.createCommentVNode("",!0),o.uploadType===e.unref(p).按钮?(e.openBlock(),e.createBlock(e.unref(i.ElButton),{key:3,type:"primary"},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElIcon),{style:{"margin-right":"5px"}},{default:e.withCtx(()=>[e.createVNode(e.unref(s.IconUpload2))]),_:1}),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("COMMON_BUTTON.UPLOAD_TEXT")),1)]),_:1})):e.createCommentVNode("",!0),o.uploadType===e.unref(p).面板?(e.openBlock(),e.createElementBlock("div",B,[e.createVNode(e.unref(i.ElIcon),{size:"48px"},{default:e.withCtx(()=>[e.createVNode(e.unref(s.File))]),_:1}),e.createElementVNode("div",R,[e.createElementVNode("div",h,[e.createElementVNode("span",null,e.toDisplayString(e.unref(a)("COMMON_BUTTON.CLICK_TEXT")),1),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("COMMON_BUTTON.OR_TEXT"))+" ",1),e.createElementVNode("span",null,e.toDisplayString(e.unref(a)("COMMON_BUTTON.DRAG_TEXT")),1),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("COMMON_BUTTON.FILE_UPLOAD_TEXT")),1)]),o.warnTips2?(e.openBlock(),e.createElementBlock("div",I,e.toDisplayString(o.warnTips2),1)):e.createCommentVNode("",!0),e.createElementVNode("div",b,e.toDisplayString(o.warnTips),1)])])):e.createCommentVNode("",!0),o.uploadType===e.unref(p).自定义?e.renderSlot(c.$slots,"upload-box",{key:5}):e.createCommentVNode("",!0)]),_:3},8,["class","limit","accept","multiple","drag"])),[[f,n.value]])],6)}}},W=o=>{const{t}=v.useI18n();let a=o.toLowerCase(),n="",l="";const T=t("WORKFLOW_COM.TIP_TEXT_3");return a.includes("file")?(l="jpg、jpeg、png、webp、doc、docx、ppt、pptx、pdf、txt、xls、xlsx、csv、mp4、mkv、webm、ts、avi、mov、flv、3gp、ogv、mp3、wav、aac、flac、ogg",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:l})):a.includes("image")?(l="jpg、jpeg、png、webp",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:l})):a.includes("doc")?(l="doc、docx",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:l})):a.includes("ppt")?(l="ppt、pptx",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:l})):a.includes("pdf")?(l="pdf",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:l})):a.includes("txt")?(l="txt",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:l})):a.includes("excel")?(l="xls、xlsx、csv",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:l})):a.includes("audio")?(l="mp3、wav、aac、flac、ogg",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:l})):a.includes("video")&&(l="mp4、mkv、webm、ts、avi、mov、flv、3gp、ogv",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:l})),n+T},F=o=>{let t=o.toLowerCase();if(t.includes("file"))return".jpg,.jpeg,.png,.webp,.doc,.docx,.ppt,.pptx,.pdf,.txt,.xls,.xlsx,.csv,.mp4,.mkv,.webm,.ts,.avi,.mov,.flv,.3gp,.ogv,.mp3,.wav,.aac,.flac,.ogg";if(t.includes("image"))return".jpg,.jpeg,.png,.webp";if(t.includes("doc"))return".doc,.docx";if(t.includes("ppt"))return".ppt,.pptx";if(t.includes("pdf"))return".pdf";if(t.includes("txt"))return".txt";if(t.includes("excel"))return".xls,.xlsx,.csv";if(t.includes("audio"))return".mp3,.wav,.aac,.flac,.ogg";if(t.includes("video"))return".mp4,.mkv,.webm,.ts,.avi,.mov,.flv,.3gp,.ogv"},V=o=>{const t=o.match(/array(\w+)/);return t&&t[1]?t[1].toLowerCase():null},x=k.withInstall(A);exports.FileUploader=x;exports.UploadTypesEnum=p;exports.default=x;exports.extractAndLowerCaseArrayType=V;exports.getAcceptType=F;exports.getWarnTips=W;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('./assets/FileUploader.css');const k=require("./chunks/index.CkihWzK6.js"),e=require("vue"),i=require("element-plus"),N=require("./chunks/request.D8T4MgGX.js"),v=require("./chunks/i18n.D3L1FBDI.js"),E=require("./chunks/mcp-tool.fb1SS2wA.js"),s=require("color-message-aibox-vue"),p={卡片:"Card",按钮:"Button",面板:"Panel",自定义:"Custom"},U=()=>{const{$request:l,$env:t}=N.getGlobalProperties();return{commonUpload:(n,o="common")=>l({method:"post",url:`${t.VITE_APP_AIBOX_BASE_URL}/api/v1/common/file/upload?type=${o}`,data:n,dataType:"formData",skipCamelToKebab:!0})}},P={class:"card-uploader__mask"},B={key:4},R={class:"panel-uploader__text"},h={class:"panel-uploader__text--tip"},I={key:0,class:"panel-uploader__text--tip font-style"},b={class:"panel-uploader__text--tip font-style"},A={__name:"index",props:{uploadType:{type:String,default:"Card"},acceptType:{type:String,default:""},multiple:{type:Boolean,default:!1},limitCount:{type:Number,default:1e3},limitSize:{type:Number,default:8},warnTips:{type:String,default:""},warnTips2:{type:String,default:""},isMiio:{type:Boolean,default:!0},businessType:{type:String,default:"common"},defaultUploadIcon:{type:String,default:""}},emits:["on-success"],setup(l,{emit:t}){const{t:a}=v.useI18n(),n=e.ref(!1),o=e.ref(null),{commonUpload:m}=U(),u=l,O=t,C=c=>{const d=/\.([^.]+)$/,r=c.match(d);return r?r[1]:null},w=(c,d,r)=>{let T=!0;const y=c.name&&c.name.toLowerCase();if(console.log(c.name,y,"fileName"),d&&d.indexOf(C(y))===-1){const g=a("COMPONENTS.UPLOAD_TYPE_TIP",{type:d});i.ElMessage({type:"warning",message:g}),T=!1}if(c.size>1024*1024*r){const g=a("COMPONENTS.UPLOAD_SIZE_TIP",{size:r});i.ElMessage.warning(g),T=!1}return T},_={plugin:s.Plugin,agent:s.WorkflowIcon1,dialogue:s.WorkflowIcon3,model:s.Model,workflow:s.Workflow,space:s.Space,"my-space":s.MySpace},S=e.computed(()=>({Card:"card-uploader",Button:"button-uploader",Panel:"panel-uploader"})[u.uploadType]),f=e.computed(()=>u.defaultUploadIcon?_[u.defaultUploadIcon]:""),M=async c=>{if(w(c,u.acceptType,u.limitSize))if(u.isMiio){n.value=!0;const{data:r}=await m({file:c.raw},u.businessType).finally(()=>{n.value=!1});console.log(r,"data"),O("on-success",r)}else O("on-success",c);else o.value.handleRemove(c)};return(c,d)=>{const r=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["file-uploader",l.defaultUploadIcon]),style:e.normalizeStyle({border:!l.defaultUploadIcon&&l.uploadType==="Card"?"1px dashed var(--el-border-color)":"none","border-radius":!l.defaultUploadIcon&&l.uploadType==="Card"?"8px":"0","background-image":f.value?`url('${f.value}')`:"none"})},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(i.ElUpload),{ref_key:"uploader",ref:o,class:e.normalizeClass(S.value),action:"","auto-upload":!1,limit:l.limitCount,"show-file-list":!1,accept:l.acceptType,multiple:l.multiple,drag:l.uploadType===e.unref(p).面板,"on-change":M},{default:e.withCtx(()=>[f.value?(e.openBlock(),e.createBlock(e.unref(i.ElIcon),{key:0,size:"64",class:"absolute"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(f.value)))]),_:1})):(e.openBlock(),e.createBlock(e.unref(i.ElImage),{key:1,style:{width:"64px",height:"64px"},src:e.unref(E.mcpToolIcon),class:"absolute"},null,8,["src"])),e.createElementVNode("div",P,[e.createVNode(e.unref(i.ElIcon),{color:"#fff",size:"16px"},{default:e.withCtx(()=>[e.createVNode(e.unref(s.IconEdit2))]),_:1})]),l.uploadType===e.unref(p).卡片?(e.openBlock(),e.createBlock(e.unref(i.ElIcon),{key:2,class:"card-uploader__icon"},{default:e.withCtx(()=>[l.defaultUploadIcon?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(s.IconAdd),{key:0})),e.renderSlot(c.$slots,"text-slot")]),_:3})):e.createCommentVNode("",!0),l.uploadType===e.unref(p).按钮?(e.openBlock(),e.createBlock(e.unref(i.ElButton),{key:3,type:"primary"},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ElIcon),{style:{"margin-right":"5px"}},{default:e.withCtx(()=>[e.createVNode(e.unref(s.IconUpload2))]),_:1}),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("COMMON_BUTTON.UPLOAD_TEXT")),1)]),_:1})):e.createCommentVNode("",!0),l.uploadType===e.unref(p).面板?(e.openBlock(),e.createElementBlock("div",B,[e.createVNode(e.unref(i.ElIcon),{size:"48px"},{default:e.withCtx(()=>[e.createVNode(e.unref(s.File))]),_:1}),e.createElementVNode("div",R,[e.createElementVNode("div",h,[e.createElementVNode("span",null,e.toDisplayString(e.unref(a)("COMMON_BUTTON.CLICK_TEXT")),1),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("COMMON_BUTTON.OR_TEXT"))+" ",1),e.createElementVNode("span",null,e.toDisplayString(e.unref(a)("COMMON_BUTTON.DRAG_TEXT")),1),e.createTextVNode(" "+e.toDisplayString(e.unref(a)("COMMON_BUTTON.FILE_UPLOAD_TEXT")),1)]),l.warnTips2?(e.openBlock(),e.createElementBlock("div",I,e.toDisplayString(l.warnTips2),1)):e.createCommentVNode("",!0),e.createElementVNode("div",b,e.toDisplayString(l.warnTips),1)])])):e.createCommentVNode("",!0),l.uploadType===e.unref(p).自定义?e.renderSlot(c.$slots,"upload-box",{key:5}):e.createCommentVNode("",!0)]),_:3},8,["class","limit","accept","multiple","drag"])),[[r,n.value]])],6)}}},W=l=>{const{t}=v.useI18n();let a=l.toLowerCase(),n="",o="";const m=t("WORKFLOW_COM.TIP_TEXT_3");return a.includes("file")?(o="jpg、jpeg、png、webp、doc、docx、ppt、pptx、pdf、txt、xls、xlsx、csv、mp4、mkv、webm、ts、avi、mov、flv、3gp、ogv、mp3、wav、aac、flac、ogg",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:o})):a.includes("image")?(o="jpg、jpeg、png、webp",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:o})):a.includes("doc")?(o="doc、docx",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:o})):a.includes("ppt")?(o="ppt、pptx",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:o})):a.includes("pdf")?(o="pdf",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:o})):a.includes("txt")?(o="txt",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:o})):a.includes("excel")?(o="xls、xlsx、csv",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:o})):a.includes("audio")?(o="mp3、wav、aac、flac、ogg",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:o})):a.includes("video")&&(o="mp4、mkv、webm、ts、avi、mov、flv、3gp、ogv",n=t("WORKFLOW_COM.SUPPORT_FORMATS",{formats:o})),n+m},F=l=>{let t=l.toLowerCase();if(t.includes("file"))return".jpg,.jpeg,.png,.webp,.doc,.docx,.ppt,.pptx,.pdf,.txt,.xls,.xlsx,.csv,.mp4,.mkv,.webm,.ts,.avi,.mov,.flv,.3gp,.ogv,.mp3,.wav,.aac,.flac,.ogg";if(t.includes("image"))return".jpg,.jpeg,.png,.webp";if(t.includes("doc"))return".doc,.docx";if(t.includes("ppt"))return".ppt,.pptx";if(t.includes("pdf"))return".pdf";if(t.includes("txt"))return".txt";if(t.includes("excel"))return".xls,.xlsx,.csv";if(t.includes("audio"))return".mp3,.wav,.aac,.flac,.ogg";if(t.includes("video"))return".mp4,.mkv,.webm,.ts,.avi,.mov,.flv,.3gp,.ogv"},V=l=>{const t=l.match(/array(\w+)/);return t&&t[1]?t[1].toLowerCase():null},x=k.withInstall(A);exports.FileUploader=x;exports.UploadTypesEnum=p;exports.default=x;exports.extractAndLowerCaseArrayType=V;exports.getAcceptType=F;exports.getWarnTips=W;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "china-mobile-international-custom-components",
3
- "version": "0.0.56",
3
+ "version": "0.0.57",
4
4
  "keywords": [
5
5
  "components",
6
6
  "vue",
@@ -115,10 +115,10 @@
115
115
  "axios": "^1.8.2",
116
116
  "vue": "^3.5.26",
117
117
  "color-message-lingyun-vue": "0.0.30",
118
- "color-message-aibox-vue": "0.0.80",
119
118
  "color-star-atom-style": "0.0.2",
120
- "color-star-custom-methods": "0.0.17",
121
- "color-star-custom-components": "0.0.22"
119
+ "color-message-aibox-vue": "0.0.80",
120
+ "color-star-custom-components": "0.0.22",
121
+ "color-star-custom-methods": "0.0.17"
122
122
  },
123
123
  "optionalDependencies": {
124
124
  "@ast-grep/napi-linux-x64-musl": "^0.39.6",