btt-ui 1.0.38 → 1.0.40

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.
@@ -23,8 +23,8 @@ class f {
23
23
  });
24
24
  let s = document.createElement("ul");
25
25
  s.className = "action-item-wapper";
26
- let n = document.createElement("li");
27
- n.className = "action-item rotate-left", n.setAttribute("data-key", "rotateleft"), s.appendChild(n);
26
+ let l = document.createElement("li");
27
+ l.className = "action-item rotate-left", l.setAttribute("data-key", "rotateleft"), s.appendChild(l);
28
28
  let r = document.createElement("li");
29
29
  r.className = "action-item rotate-right", r.setAttribute("data-key", "rotateright"), s.appendChild(r);
30
30
  let o = document.createElement("ul");
@@ -35,19 +35,19 @@ class f {
35
35
  i.className = "";
36
36
  });
37
37
  };
38
- Array.isArray(this._binding.list) ? typeof this._binding.list[0] == "string" ? (this._curImgIndex = this._binding.list.findIndex((i) => i == this._image.src), this._binding.list && this._binding.list.forEach((i, d) => {
39
- let l = document.createElement("li");
40
- l.className = this._curImgIndex == d ? "cur" : "";
38
+ Array.isArray(this._binding.list) ? typeof this._binding.list[0] == "string" ? (this._curImgIndex = this._binding.list.findIndex((i) => i.indexOf(this._image.src) > -1), this._binding.list && this._binding.list.forEach((i, d) => {
39
+ let n = document.createElement("li");
40
+ n.className = this._curImgIndex == d ? "cur" : "";
41
41
  let _ = document.createElement("img");
42
- _.setAttribute("src", i), l.append(_), o.appendChild(l), a.push(l), l.onclick = function() {
43
- t.style.transform = "scale(0)", t.src = i, h(), l.className = "cur";
42
+ _.setAttribute("src", i), n.append(_), o.appendChild(n), a.push(n), n.onclick = function() {
43
+ t.style.transform = "scale(0)", t.src = i, h(), n.className = "cur";
44
44
  };
45
45
  })) : (this._curImgIndex = this._binding.list.findIndex((i) => i.url == this._image.src), this._binding.list && this._binding.list.forEach((i, d) => {
46
- let l = document.createElement("li");
47
- l.className = this._curImgIndex == d ? "cur" : "";
46
+ let n = document.createElement("li");
47
+ n.className = this._curImgIndex == d ? "cur" : "";
48
48
  let _ = document.createElement("img");
49
- _.setAttribute("src", i.url), l.append(_), o.appendChild(l), a.push(l), l.onclick = function() {
50
- t.style.transform = "scale(0)", t.src = i.url, h(), l.className = "cur";
49
+ _.setAttribute("src", i.url), n.append(_), o.appendChild(n), a.push(n), n.onclick = function() {
50
+ t.style.transform = "scale(0)", t.src = i.url, h(), n.className = "cur";
51
51
  };
52
52
  })) : o.style.display = "none";
53
53
  let m = {
@@ -62,10 +62,10 @@ class f {
62
62
  i.target.dataset.key && m[i.target.dataset.key]();
63
63
  }, this._mask.appendChild(s), this._mask.appendChild(o), this._binding.el ? document.querySelector(this._binding.el).appendChild(this._mask) : document.body.appendChild(this._mask);
64
64
  }
65
- _getImgSize(e, t, s, n) {
66
- const r = e / t, o = s / n;
65
+ _getImgSize(e, t, s, l) {
66
+ const r = e / t, o = s / l;
67
67
  let a, h;
68
- return r >= o ? e > s ? (a = s, h = s / e * t) : (a = e, h = t) : t > n ? (a = n / t * e, h = n) : (a = e, h = t), { width: a, height: h };
68
+ return r >= o ? e > s ? (a = s, h = s / e * t) : (a = e, h = t) : t > l ? (a = l / t * e, h = l) : (a = e, h = t), { width: a, height: h };
69
69
  }
70
70
  _drag(e) {
71
71
  e.addEventListener("pointerdown", (t) => {
@@ -86,8 +86,8 @@ class f {
86
86
  this._mask.addEventListener("wheel", (t) => {
87
87
  let s = 1.1;
88
88
  t.deltaY > 0 && (s = 1 / 1.1);
89
- const n = this._scale * s;
90
- if (n > this._maxScale ? (s = this._maxScale / this._scale, this._scale = this._maxScale) : n < this._minScale ? (s = this._minScale / this._scale, this._scale = this._minScale) : this._scale = n, t.target.tagName === "IMG")
89
+ const l = this._scale * s;
90
+ if (l > this._maxScale ? (s = this._maxScale / this._scale, this._scale = this._maxScale) : l < this._minScale ? (s = this._minScale / this._scale, this._scale = this._minScale) : this._scale = l, t.target.tagName === "IMG")
91
91
  if (this._binding.type == "transform") {
92
92
  const r = {
93
93
  x: (s - 1) * this._result.width * 0.5,
@@ -141,4 +141,51 @@
141
141
  border-radius: 4px;
142
142
  cursor: pointer;
143
143
  margin-bottom: 10px;
144
+ }
145
+
146
+ .k-upload-file-progress {
147
+ position: absolute;
148
+ top: 0;
149
+ left: 0;
150
+ z-index: 9999;
151
+ background: rgba(0, 0, 0, 0.5);
152
+ width: 100%;
153
+ height: 100%;
154
+ display: flex;
155
+ justify-content: center;
156
+ padding-top: 160px;
157
+ }
158
+ .k-upload-file-progress .text {
159
+ background: #427fe5;
160
+ height: 50px;
161
+ padding: 0 16px;
162
+ display: flex;
163
+ align-items: center;
164
+ color: #fff;
165
+ font-size: 14px;
166
+ border-radius: 5px;
167
+ box-shadow: 0 2px 8px #6c95d7;
168
+ padding-left: 39px;
169
+ position: relative;
170
+ }
171
+ .k-upload-file-progress .text::after {
172
+ content: "";
173
+ position: absolute;
174
+ width: 19px;
175
+ height: 19px;
176
+ background: url(data:image/png;base64,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) no-repeat;
177
+ background-size: auto 100%;
178
+ top: 15px;
179
+ left: 15px;
180
+ animation: rotateCircle 1s linear forwards infinite;
181
+ transform-origin: center center;
182
+ }
183
+
184
+ @keyframes rotateCircle {
185
+ 0% {
186
+ transform: rotate(0);
187
+ }
188
+ 100% {
189
+ transform: rotate(360deg);
190
+ }
144
191
  }
@@ -1,19 +1,18 @@
1
- import { defineComponent as V, ref as b, reactive as R, watch as q, openBlock as l, createElementBlock as s, renderSlot as m, createElementVNode as c, createVNode as w, unref as f, withModifiers as x, createCommentVNode as u, createBlock as z, Fragment as k, normalizeClass as $, renderList as v, toDisplayString as d, createTextVNode as O, Teleport as U, nextTick as Z } from "vue";
2
- import { Icon as y } from "../../icon/index.mjs";
1
+ import { defineComponent as V, ref as x, reactive as M, watch as q, openBlock as l, createElementBlock as r, renderSlot as m, createElementVNode as c, createVNode as L, unref as g, withModifiers as $, createCommentVNode as u, createBlock as A, Fragment as F, normalizeClass as N, renderList as S, toDisplayString as d, createTextVNode as R, Teleport as U, nextTick as J } from "vue";
2
+ import { Icon as p } from "../../icon/index.mjs";
3
3
  import "./style/index.css";
4
- import { uploadImg as G } from "./uploadFile2.mjs";
5
- import { Dragger as H } from "../../directives/drag.mjs";
6
- import { ZoomIn as J } from "../../directives/zoomIn.mjs";
7
- import "./uploadFile.vue?vue&type=style&index=0&lang.css";
8
- const K = { class: "k-upload-file-wrapper" }, P = { key: 0 }, Q = { class: "upload-btn-section" }, W = { class: "btn-box" }, X = { class: "img-sec-box" }, Y = ["src"], _ = { class: "img-wrapper" }, ee = ["src", "title"], te = ["src", "title"], ie = ["src", "title"], le = ["onClick"], se = ["onClick"], oe = { class: "k-file-extensions-desc" }, re = {
4
+ import { uploadImg as Z } from "./uploadFile2.mjs";
5
+ import { Dragger as G } from "../../directives/drag.mjs";
6
+ import { ZoomIn as H } from "../../directives/zoomIn.mjs";
7
+ const K = { class: "k-upload-file-wrapper" }, P = { key: 0 }, Q = { class: "upload-btn-section" }, W = { class: "btn-box" }, X = { class: "img-sec-box" }, Y = ["src"], _ = { class: "img-wrapper" }, ee = ["src", "title"], te = ["src", "title"], ie = ["src", "title"], le = ["onClick"], se = ["onClick"], re = { class: "k-file-extensions-desc" }, oe = {
9
8
  key: 0,
10
9
  class: "error-tip"
11
10
  }, ne = { key: 0 }, ue = {
12
11
  key: 0,
13
- class: "upload-file-progress"
12
+ class: "k-upload-file-progress"
14
13
  }, ae = V({
15
14
  name: "k-upload-file"
16
- }), ke = V({
15
+ }), pe = V({
17
16
  ...ae,
18
17
  props: {
19
18
  data: {
@@ -61,125 +60,129 @@ const K = { class: "k-upload-file-wrapper" }, P = { key: 0 }, Q = { class: "uplo
61
60
  }
62
61
  },
63
62
  emits: ["limitError", "success", "deleteSuccess", "fileSizeError"],
64
- setup(r, { expose: B, emit: N }) {
65
- const A = b();
66
- let g;
67
- const F = b(!1), a = r;
68
- let j = a.maxSize * 1024 * 1024;
69
- const T = a.loadingFileMaxSize * 1024 * 1024, h = N, i = R({
63
+ setup(n, { expose: B, emit: j }) {
64
+ const v = x();
65
+ let k;
66
+ const h = x(!1), a = n;
67
+ let T = a.maxSize * 1024 * 1024;
68
+ const D = a.loadingFileMaxSize * 1024 * 1024, E = j, i = M({
70
69
  fileList: new Array(),
71
70
  errFiles: new Array()
72
71
  });
73
72
  i.fileList = a.data, q(() => a.data, (e) => {
74
73
  i.fileList = e;
75
74
  }, { deep: !0 });
76
- const D = (e) => {
77
- for (let o = 0; o < e.length; o++)
78
- e[o].size > T && (F.value = !0);
75
+ const O = (e) => {
76
+ for (let s = 0; s < e.length; s++)
77
+ e[s].size > D && (h.value = !0);
79
78
  }, C = () => {
80
- g && g.hide(), G({
79
+ k && k.hide(), Z({
81
80
  acceptType: a.accept,
82
81
  limit: a.limit,
83
- maxSize: j,
82
+ maxSize: T,
84
83
  success: async (e) => {
85
- D(e), i.errFiles = new Array();
86
- let o = new Array();
84
+ a.requestApi && O(e), i.errFiles = new Array();
85
+ let s = new Array();
87
86
  if (a.requestApi) {
88
87
  let t = await a.requestApi(a.params, e);
89
88
  if (t.code == a.successCode) {
90
- F.value && (F.value = !1);
91
- for (let n = 0; n < t.data.length; n++)
92
- o.push(t.data[n]);
93
- o.forEach((n) => {
94
- n.name = n.fileOriginName, n.type = "image/" + n.fileSuffix;
95
- }), S(o);
89
+ h.value && (h.value = !1);
90
+ for (let o = 0; o < t.data.length; o++)
91
+ s.push(t.data[o]);
92
+ s.forEach((o) => {
93
+ o.name = o.fileOriginName, o.type = "image/" + o.fileSuffix;
94
+ }), b(s);
96
95
  } else
97
96
  console.log(t.msg);
98
97
  } else {
99
98
  for (let t = 0; t < e.length; t++)
100
- e[t].url = window.URL.createObjectURL(e[t]), o.push(e[t]);
101
- S(o);
99
+ e[t].url = window.URL.createObjectURL(e[t]), s.push(e[t]);
100
+ b(s);
102
101
  }
103
102
  },
104
103
  limitError: (e) => {
105
- h("limitError"), i.errFiles = new Array();
104
+ E("limitError"), i.errFiles = new Array();
106
105
  },
107
106
  fileSizeError: (e) => {
108
- i.errFiles = e, h("fileSizeError", e);
107
+ i.errFiles = e, E("fileSizeError", e);
109
108
  }
110
109
  });
111
- }, S = (e) => {
112
- a.limit == 1 ? (i.fileList = e, a.type == "image" && Z(() => {
113
- g ? g.updateSrc(p(i.fileList[0].url)) : g = new J(A.value, { type: "margin" });
114
- })) : i.fileList = [...i.fileList, ...e], h("success", i.fileList);
110
+ }, b = (e) => {
111
+ a.limit == 1 ? (i.fileList = e, a.type == "image" && J(() => {
112
+ k ? k.updateSrc(f(i.fileList[0].url)) : k = new H(v.value, { type: "margin" });
113
+ })) : i.fileList = [...i.fileList, ...e], E("success", i.fileList);
115
114
  };
116
115
  function I(e) {
117
- const o = document.cookie.split("; ");
118
- for (let t = 0; t < o.length; t++) {
119
- const n = o[t].split("=");
120
- if (n[0] === e)
121
- return n[1];
116
+ const s = document.cookie.split("; ");
117
+ for (let t = 0; t < s.length; t++) {
118
+ const o = s[t].split("=");
119
+ if (o[0] === e)
120
+ return o[1];
122
121
  }
123
122
  return "";
124
123
  }
125
- const p = (e) => a.hasToken ? `${e}?token=${I("bearer")}` : e, E = (e) => {
126
- let o = i.fileList[e];
127
- i.fileList.splice(e, 1), h("deleteSuccess", { deleteFile: o, result: i.fileList });
128
- }, L = (e) => {
129
- new H(e.target, { type: "margin", list: i.fileList }).build();
124
+ const f = (e) => a.hasToken ? `${e}?token=${I("bearer")}` : e, w = (e) => {
125
+ let s = i.fileList[e];
126
+ i.fileList.splice(e, 1), E("deleteSuccess", { deleteFile: s, result: i.fileList });
127
+ }, z = (e) => {
128
+ let s = new Array();
129
+ i.fileList.forEach((o) => {
130
+ let y = JSON.parse(JSON.stringify(o));
131
+ y.url.indexOf("token=") < 0 && (y.url = f(y.url)), s.push(y);
132
+ }), new G(e.target, { type: "margin", list: s }).build();
130
133
  };
131
134
  return B({
132
135
  clearFiles: () => {
133
136
  i.fileList = new Array();
134
137
  },
135
- deleteFile: E
136
- }), (e, o) => (l(), s("div", K, [
137
- r.isView ? u("", !0) : m(e.$slots, "default", { key: 0 }, () => [
138
- r.type == "file" ? (l(), s("div", P, [
138
+ deleteFile: w
139
+ }), (e, s) => (l(), r("div", K, [
140
+ n.isView ? u("", !0) : m(e.$slots, "default", { key: 0 }, () => [
141
+ n.type == "file" ? (l(), r("div", P, [
139
142
  c("span", { onClick: C }, [
140
143
  m(e.$slots, "icon", {}, () => [
141
144
  c("div", Q, [
142
145
  c("div", W, [
143
- w(f(y), {
146
+ L(g(p), {
144
147
  name: "download",
145
148
  color: "#cccccc",
146
149
  size: "20"
147
150
  }),
148
- o[1] || (o[1] = c("span", null, "\u4E0A\u4F20\u9644\u4EF6", -1))
151
+ s[1] || (s[1] = c("span", null, "\u4E0A\u4F20\u9644\u4EF6", -1))
149
152
  ])
150
153
  ])
151
154
  ])
152
155
  ])
153
- ])) : (l(), s("div", {
156
+ ])) : (l(), r("div", {
154
157
  key: 1,
155
158
  class: "btn-file-image",
156
- onClick: x(C, ["stop"])
159
+ onClick: $(C, ["stop"])
157
160
  }, [
158
161
  c("div", X, [
159
- i.fileList.length > 0 && r.limit == 1 ? (l(), s("img", {
162
+ i.fileList.length > 0 && n.limit == 1 ? (l(), r("img", {
160
163
  key: 0,
161
- src: p(i.fileList[0].url),
164
+ src: f(i.fileList[0].url),
162
165
  ref_key: "imgRef",
163
- ref: A
166
+ ref: v
164
167
  }, null, 8, Y)) : u("", !0)
165
168
  ]),
166
- !r.isView && i.fileList.length > 0 && r.limit == 1 ? (l(), s("span", {
169
+ !n.isView && i.fileList.length > 0 && n.limit == 1 ? (l(), r("span", {
167
170
  key: 0,
168
171
  class: "k-file-icon-close",
169
- onClick: o[0] || (o[0] = x((t) => E(0), ["stop"]))
172
+ onClick: s[0] || (s[0] = $((t) => w(0), ["stop"]))
170
173
  }, [
171
- w(f(y), {
174
+ L(g(p), {
172
175
  name: "close",
173
176
  size: "12"
174
177
  })
175
178
  ])) : u("", !0),
176
179
  m(e.$slots, "icon", {}, () => [
177
- i.fileList.length == 0 && r.limit == 1 ? (l(), z(f(y), {
180
+ i.fileList.length == 0 && n.limit == 1 ? (l(), A(g(p), {
178
181
  key: 0,
179
182
  name: "plus",
180
183
  color: "#409eff"
181
184
  })) : u("", !0),
182
- r.limit > 1 ? (l(), z(f(y), {
185
+ n.limit > 1 ? (l(), A(g(p), {
183
186
  key: 1,
184
187
  name: "plus",
185
188
  color: "#409eff"
@@ -190,36 +193,36 @@ const K = { class: "k-upload-file-wrapper" }, P = { key: 0 }, Q = { class: "uplo
190
193
  m(e.$slots, "files", {
191
194
  data: i.fileList
192
195
  }, () => [
193
- r.type == "image" && r.limit > 1 ? (l(), s(k, { key: 0 }, [
194
- i.fileList.length > 0 ? (l(), s("ul", {
196
+ n.type == "image" && n.limit > 1 ? (l(), r(F, { key: 0 }, [
197
+ i.fileList.length > 0 ? (l(), r("ul", {
195
198
  key: 0,
196
- class: $(["k-image-list", { "can-edit": !r.isView }])
199
+ class: N(["k-image-list", { "can-edit": !n.isView }])
197
200
  }, [
198
- (l(!0), s(k, null, v(i.fileList, (t, n) => (l(), s("li", { key: n }, [
201
+ (l(!0), r(F, null, S(i.fileList, (t, o) => (l(), r("li", { key: o }, [
199
202
  c("div", _, [
200
- t.type == "image/webp" ? (l(), s("img", {
203
+ t.type == "image/webp" ? (l(), r("img", {
201
204
  key: 0,
202
- src: p(t.url),
203
- onClick: L,
205
+ src: f(t.url),
206
+ onClick: z,
204
207
  title: t.name
205
- }, null, 8, ee)) : t.type == "image/png" ? (l(), s("img", {
208
+ }, null, 8, ee)) : t.type == "image/png" ? (l(), r("img", {
206
209
  key: 1,
207
- src: p(t.url),
208
- onClick: L,
210
+ src: f(t.url),
211
+ onClick: z,
209
212
  title: t.name
210
- }, null, 8, te)) : t.type == "image/jpg" || t.type == "image/jpeg" ? (l(), s("img", {
213
+ }, null, 8, te)) : t.type == "image/jpg" || t.type == "image/jpeg" ? (l(), r("img", {
211
214
  key: 2,
212
- src: p(t.url),
213
- onClick: L,
215
+ src: f(t.url),
216
+ onClick: z,
214
217
  title: t.name
215
218
  }, null, 8, ie)) : u("", !0)
216
219
  ]),
217
- r.isView ? u("", !0) : (l(), s("span", {
220
+ n.isView ? u("", !0) : (l(), r("span", {
218
221
  key: 0,
219
222
  class: "k-file-icon-close",
220
- onClick: (M) => E(n)
223
+ onClick: (y) => w(o)
221
224
  }, [
222
- w(f(y), {
225
+ L(g(p), {
223
226
  name: "close",
224
227
  size: "12"
225
228
  })
@@ -227,20 +230,20 @@ const K = { class: "k-upload-file-wrapper" }, P = { key: 0 }, Q = { class: "uplo
227
230
  ]))), 128))
228
231
  ], 2)) : u("", !0)
229
232
  ], 64)) : u("", !0),
230
- r.type == "file" ? (l(), s(k, { key: 1 }, [
231
- i.fileList.length > 0 ? (l(), s("ul", {
233
+ n.type == "file" ? (l(), r(F, { key: 1 }, [
234
+ i.fileList.length > 0 ? (l(), r("ul", {
232
235
  key: 0,
233
- class: $(["k-file-list", { "can-edit": !r.isView }])
236
+ class: N(["k-file-list", { "can-edit": !n.isView }])
234
237
  }, [
235
- (l(!0), s(k, null, v(i.fileList, (t, n) => (l(), s("li", { key: n }, [
238
+ (l(!0), r(F, null, S(i.fileList, (t, o) => (l(), r("li", { key: o }, [
236
239
  m(e.$slots, "file", { data: t }, () => [
237
240
  c("span", null, d(t.name), 1),
238
- r.isView ? u("", !0) : (l(), s("span", {
241
+ n.isView ? u("", !0) : (l(), r("span", {
239
242
  key: 0,
240
243
  class: "k-file-icon-close",
241
- onClick: (M) => E(n)
244
+ onClick: (y) => w(o)
242
245
  }, [
243
- w(f(y), {
246
+ L(g(p), {
244
247
  name: "close",
245
248
  size: "12"
246
249
  })
@@ -251,21 +254,21 @@ const K = { class: "k-upload-file-wrapper" }, P = { key: 0 }, Q = { class: "uplo
251
254
  ], 64)) : u("", !0)
252
255
  ]),
253
256
  m(e.$slots, "tip", {}, () => [
254
- c("div", oe, "\u652F\u6301\u7684" + d(r.type == "file" ? "\u6587\u4EF6" : "\u56FE\u7247") + "\u683C\u5F0F\u6709\uFF1A" + d(r.accept.join(",")) + ",\u6700\u591A\u4E0A\u4F20" + d(r.limit) + "\u4E2A\u6587\u4EF6," + d(r.type == "file" ? "\u5355\u4E2A\u6587\u4EF6" : "\u5355\u5F20\u56FE\u7247") + "\u4E0D\u80FD\u5927\u4E8E" + d(r.maxSize) + "MB", 1)
257
+ c("div", re, "\u652F\u6301\u7684" + d(n.type == "file" ? "\u6587\u4EF6" : "\u56FE\u7247") + "\u683C\u5F0F\u6709\uFF1A" + d(n.accept.join(",")) + ",\u6700\u591A\u4E0A\u4F20" + d(n.limit) + "\u4E2A\u6587\u4EF6," + d(n.type == "file" ? "\u5355\u4E2A\u6587\u4EF6" : "\u5355\u5F20\u56FE\u7247") + "\u4E0D\u80FD\u5927\u4E8E" + d(n.maxSize) + "MB", 1)
255
258
  ]),
256
259
  m(e.$slots, "sizeError", {
257
260
  data: i.errFiles
258
261
  }, () => [
259
- i.errFiles.length > 0 ? (l(), s("div", re, [
260
- c("span", null, " \u8D85\u51FA\u5927\u5C0F\u9650\u5236\u7684" + d(r.type == "file" ? "\u6587\u4EF6" : "\u56FE\u7247") + "\u6709\uFF1A", 1),
261
- (l(!0), s(k, null, v(i.errFiles, (t, n) => (l(), s("span", { key: n }, [
262
- n > 0 ? (l(), s("span", ne, ", ")) : u("", !0),
263
- O(" " + d(t.name), 1)
262
+ i.errFiles.length > 0 ? (l(), r("div", oe, [
263
+ c("span", null, " \u8D85\u51FA\u5927\u5C0F\u9650\u5236\u7684" + d(n.type == "file" ? "\u6587\u4EF6" : "\u56FE\u7247") + "\u6709\uFF1A", 1),
264
+ (l(!0), r(F, null, S(i.errFiles, (t, o) => (l(), r("span", { key: o }, [
265
+ o > 0 ? (l(), r("span", ne, ", ")) : u("", !0),
266
+ R(" " + d(t.name), 1)
264
267
  ]))), 128))
265
268
  ])) : u("", !0)
266
269
  ]),
267
- (l(), z(U, { to: "body" }, [
268
- F.value ? (l(), s("div", ue, [...o[2] || (o[2] = [
270
+ (l(), A(U, { to: "body" }, [
271
+ h.value ? (l(), r("div", ue, [...s[2] || (s[2] = [
269
272
  c("div", { class: "text" }, "\u6587\u4EF6\u4E0A\u4F20\u4E2D,\u8BF7\u8010\u5FC3\u7B49\u5F85...", -1)
270
273
  ])])) : u("", !0)
271
274
  ]))
@@ -273,5 +276,5 @@ const K = { class: "k-upload-file-wrapper" }, P = { key: 0 }, Q = { class: "uplo
273
276
  }
274
277
  });
275
278
  export {
276
- ke as default
279
+ pe as default
277
280
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class m{constructor(e,t){this._result={},this._x=0,this._y=0,this._scale=1,this._minScale=.5,this._angle=0,this._maxScale=4,this._isPointerdown=!1,this._diff={x:0,y:0},this._lastPointermove={x:0,y:0},this._curImgIndex=0,this._mask=document.createElement("div"),this._binding={type:"transform",list:new Array,el:""},this._binding=t!=null?t:{type:"transform",list:new Array,el:""},this._image=e}resetConfig(){this._x=0,this._y=0,this._scale=1}build(){this._mask=document.createElement("div"),this._mask.classList.add("k-img-preview-mask");let e=document.createElement("div");e.className="k-icon-close-btn k-img-close",this._mask.appendChild(e),e.onclick=()=>{this.remove()};let t=new Image;t.onload=()=>{this._mask.appendChild(t),this.resetConfig(),this._result=this._getImgSize(t.naturalWidth,t.naturalHeight,this._mask.offsetWidth,this._mask.offsetHeight),t.style.width=this._result.width+"px",t.style.height=this._result.height+"px",this._x=(this._mask.offsetWidth-this._result.width)*.5,this._y=(this._mask.offsetHeight-this._result.height)*.5,this._binding.type=="transform"?t.style.transform="translate3d("+this._x+"px, "+this._y+"px, 0) scale("+this._scale+")":(t.style.transform=`scale(${this._scale})`,t.style.transition="transform 0.6s ease-out",t.style.marginLeft=this._x+"px",t.style.marginTop=this._y+"px"),this._drag(t),this._wheelZoom(t)},window.addEventListener("keyup",i=>{i.stopPropagation(),i.code=="Escape"&&this.remove()});let s=document.createElement("ul");s.className="action-item-wapper";let a=document.createElement("li");a.className="action-item rotate-left",a.setAttribute("data-key","rotateleft"),s.appendChild(a);let r=document.createElement("li");r.className="action-item rotate-right",r.setAttribute("data-key","rotateright"),s.appendChild(r);let o=document.createElement("ul");o.className="dragger-file-list-wapper",t.src=this._image.src;let n=new Array;const h=()=>{n.forEach(i=>{i.className=""})};Array.isArray(this._binding.list)?typeof this._binding.list[0]=="string"?(this._curImgIndex=this._binding.list.findIndex(i=>i==this._image.src),this._binding.list&&this._binding.list.forEach((i,d)=>{let l=document.createElement("li");l.className=this._curImgIndex==d?"cur":"";let _=document.createElement("img");_.setAttribute("src",i),l.append(_),o.appendChild(l),n.push(l),l.onclick=function(){t.style.transform="scale(0)",t.src=i,h(),l.className="cur"}})):(this._curImgIndex=this._binding.list.findIndex(i=>i.url==this._image.src),this._binding.list&&this._binding.list.forEach((i,d)=>{let l=document.createElement("li");l.className=this._curImgIndex==d?"cur":"";let _=document.createElement("img");_.setAttribute("src",i.url),l.append(_),o.appendChild(l),n.push(l),l.onclick=function(){t.style.transform="scale(0)",t.src=i.url,h(),l.className="cur"}})):o.style.display="none";let f={rotateleft:()=>{this._angle-=90,this._binding.type=="transform"?t.style.transform=`translate3d(${this._x}px, ${this._y}px, 0) scale(${this._scale}) rotate(${this._angle}deg)`:t.style.transform=`rotate(${this._angle}deg)`},rotateright:()=>{this._angle+=90,this._binding.type=="transform"?t.style.transform=`translate3d(${this._x}px, ${this._y}px, 0) scale(${this._scale}) rotate(${this._angle}deg)`:t.style.transform=`rotate(${this._angle}deg)`}};s.onclick=i=>{i.target.dataset.key&&f[i.target.dataset.key]()},this._mask.appendChild(s),this._mask.appendChild(o),this._binding.el?document.querySelector(this._binding.el).appendChild(this._mask):document.body.appendChild(this._mask)}_getImgSize(e,t,s,a){const r=e/t,o=s/a;let n,h;return r>=o?e>s?(n=s,h=s/e*t):(n=e,h=t):t>a?(n=a/t*e,h=a):(n=e,h=t),{width:n,height:h}}_drag(e){e.addEventListener("pointerdown",t=>{this._isPointerdown=!0,e.setPointerCapture(t.pointerId),this._lastPointermove={x:t.clientX,y:t.clientY}}),e.addEventListener("pointermove",t=>{if(this._isPointerdown){const s={x:t.clientX,y:t.clientY};this._diff.x=s.x-this._lastPointermove.x,this._diff.y=s.y-this._lastPointermove.y,this._lastPointermove={x:s.x,y:s.y},this._x+=this._diff.x,this._y+=this._diff.y,this._binding.type=="transform"?e.style.transform=`translate3d(${this._x}px, ${this._y}px, 0) scale(${this._scale}) rotate(${this._angle}deg)`:(e.style.marginLeft=this._x+"px",e.style.marginTop=this._y+"px")}t.preventDefault()}),e.addEventListener("pointerup",t=>{this._isPointerdown&&(this._isPointerdown=!1)}),e.addEventListener("pointercancel",t=>{this._isPointerdown&&(this._isPointerdown=!1)})}_wheelZoom(e){this._mask.addEventListener("wheel",t=>{let s=1.1;t.deltaY>0&&(s=1/1.1);const a=this._scale*s;if(a>this._maxScale?(s=this._maxScale/this._scale,this._scale=this._maxScale):a<this._minScale?(s=this._minScale/this._scale,this._scale=this._minScale):this._scale=a,t.target.tagName==="IMG")if(this._binding.type=="transform"){const r={x:(s-1)*this._result.width*.5,y:(s-1)*this._result.height*.5};this._x-=(s-1)*(t.clientX-this._x)-r.x,this._y-=(s-1)*(t.clientY-this._y)-r.y}else this._x-=(s-1)*(t.clientX-this._x),this._y-=(s-1)*(t.clientY-this._y);this._binding.type=="transform"?e.style.transform=`translate3d(${this._x}px, ${this._y}px, 0) scale(${this._scale}) rotate(${this._angle}deg)`:(e.style.marginLeft=this._x+"px",e.style.marginTop=this._y+"px",e.style.width=this._result.width*this._scale+"px",e.style.height=this._result.height*this._scale+"px"),t.preventDefault()})}reset(){this._scale=.7,this._mask=document.createElement("div")}remove(){this._mask.innerHTML="",this._mask.remove(),this.reset()}}const p={mounted(c,e){let t=e.value,s=new m(c,{...t});c.onclick=()=>{s.build()}},unmounted(){console.log("distory")}};exports.Dragger=m;exports.dragger=p;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class m{constructor(e,t){this._result={},this._x=0,this._y=0,this._scale=1,this._minScale=.5,this._angle=0,this._maxScale=4,this._isPointerdown=!1,this._diff={x:0,y:0},this._lastPointermove={x:0,y:0},this._curImgIndex=0,this._mask=document.createElement("div"),this._binding={type:"transform",list:new Array,el:""},this._binding=t!=null?t:{type:"transform",list:new Array,el:""},this._image=e}resetConfig(){this._x=0,this._y=0,this._scale=1}build(){this._mask=document.createElement("div"),this._mask.classList.add("k-img-preview-mask");let e=document.createElement("div");e.className="k-icon-close-btn k-img-close",this._mask.appendChild(e),e.onclick=()=>{this.remove()};let t=new Image;t.onload=()=>{this._mask.appendChild(t),this.resetConfig(),this._result=this._getImgSize(t.naturalWidth,t.naturalHeight,this._mask.offsetWidth,this._mask.offsetHeight),t.style.width=this._result.width+"px",t.style.height=this._result.height+"px",this._x=(this._mask.offsetWidth-this._result.width)*.5,this._y=(this._mask.offsetHeight-this._result.height)*.5,this._binding.type=="transform"?t.style.transform="translate3d("+this._x+"px, "+this._y+"px, 0) scale("+this._scale+")":(t.style.transform=`scale(${this._scale})`,t.style.transition="transform 0.6s ease-out",t.style.marginLeft=this._x+"px",t.style.marginTop=this._y+"px"),this._drag(t),this._wheelZoom(t)},window.addEventListener("keyup",i=>{i.stopPropagation(),i.code=="Escape"&&this.remove()});let s=document.createElement("ul");s.className="action-item-wapper";let a=document.createElement("li");a.className="action-item rotate-left",a.setAttribute("data-key","rotateleft"),s.appendChild(a);let r=document.createElement("li");r.className="action-item rotate-right",r.setAttribute("data-key","rotateright"),s.appendChild(r);let o=document.createElement("ul");o.className="dragger-file-list-wapper",t.src=this._image.src;let n=new Array;const h=()=>{n.forEach(i=>{i.className=""})};Array.isArray(this._binding.list)?typeof this._binding.list[0]=="string"?(this._curImgIndex=this._binding.list.findIndex(i=>i.indexOf(this._image.src)>-1),this._binding.list&&this._binding.list.forEach((i,d)=>{let l=document.createElement("li");l.className=this._curImgIndex==d?"cur":"";let _=document.createElement("img");_.setAttribute("src",i),l.append(_),o.appendChild(l),n.push(l),l.onclick=function(){t.style.transform="scale(0)",t.src=i,h(),l.className="cur"}})):(this._curImgIndex=this._binding.list.findIndex(i=>i.url==this._image.src),this._binding.list&&this._binding.list.forEach((i,d)=>{let l=document.createElement("li");l.className=this._curImgIndex==d?"cur":"";let _=document.createElement("img");_.setAttribute("src",i.url),l.append(_),o.appendChild(l),n.push(l),l.onclick=function(){t.style.transform="scale(0)",t.src=i.url,h(),l.className="cur"}})):o.style.display="none";let f={rotateleft:()=>{this._angle-=90,this._binding.type=="transform"?t.style.transform=`translate3d(${this._x}px, ${this._y}px, 0) scale(${this._scale}) rotate(${this._angle}deg)`:t.style.transform=`rotate(${this._angle}deg)`},rotateright:()=>{this._angle+=90,this._binding.type=="transform"?t.style.transform=`translate3d(${this._x}px, ${this._y}px, 0) scale(${this._scale}) rotate(${this._angle}deg)`:t.style.transform=`rotate(${this._angle}deg)`}};s.onclick=i=>{i.target.dataset.key&&f[i.target.dataset.key]()},this._mask.appendChild(s),this._mask.appendChild(o),this._binding.el?document.querySelector(this._binding.el).appendChild(this._mask):document.body.appendChild(this._mask)}_getImgSize(e,t,s,a){const r=e/t,o=s/a;let n,h;return r>=o?e>s?(n=s,h=s/e*t):(n=e,h=t):t>a?(n=a/t*e,h=a):(n=e,h=t),{width:n,height:h}}_drag(e){e.addEventListener("pointerdown",t=>{this._isPointerdown=!0,e.setPointerCapture(t.pointerId),this._lastPointermove={x:t.clientX,y:t.clientY}}),e.addEventListener("pointermove",t=>{if(this._isPointerdown){const s={x:t.clientX,y:t.clientY};this._diff.x=s.x-this._lastPointermove.x,this._diff.y=s.y-this._lastPointermove.y,this._lastPointermove={x:s.x,y:s.y},this._x+=this._diff.x,this._y+=this._diff.y,this._binding.type=="transform"?e.style.transform=`translate3d(${this._x}px, ${this._y}px, 0) scale(${this._scale}) rotate(${this._angle}deg)`:(e.style.marginLeft=this._x+"px",e.style.marginTop=this._y+"px")}t.preventDefault()}),e.addEventListener("pointerup",t=>{this._isPointerdown&&(this._isPointerdown=!1)}),e.addEventListener("pointercancel",t=>{this._isPointerdown&&(this._isPointerdown=!1)})}_wheelZoom(e){this._mask.addEventListener("wheel",t=>{let s=1.1;t.deltaY>0&&(s=1/1.1);const a=this._scale*s;if(a>this._maxScale?(s=this._maxScale/this._scale,this._scale=this._maxScale):a<this._minScale?(s=this._minScale/this._scale,this._scale=this._minScale):this._scale=a,t.target.tagName==="IMG")if(this._binding.type=="transform"){const r={x:(s-1)*this._result.width*.5,y:(s-1)*this._result.height*.5};this._x-=(s-1)*(t.clientX-this._x)-r.x,this._y-=(s-1)*(t.clientY-this._y)-r.y}else this._x-=(s-1)*(t.clientX-this._x),this._y-=(s-1)*(t.clientY-this._y);this._binding.type=="transform"?e.style.transform=`translate3d(${this._x}px, ${this._y}px, 0) scale(${this._scale}) rotate(${this._angle}deg)`:(e.style.marginLeft=this._x+"px",e.style.marginTop=this._y+"px",e.style.width=this._result.width*this._scale+"px",e.style.height=this._result.height*this._scale+"px"),t.preventDefault()})}reset(){this._scale=.7,this._mask=document.createElement("div")}remove(){this._mask.innerHTML="",this._mask.remove(),this.reset()}}const p={mounted(c,e){let t=e.value,s=new m(c,{...t});c.onclick=()=>{s.build()}},unmounted(){console.log("distory")}};exports.Dragger=m;exports.dragger=p;
@@ -141,4 +141,51 @@
141
141
  border-radius: 4px;
142
142
  cursor: pointer;
143
143
  margin-bottom: 10px;
144
+ }
145
+
146
+ .k-upload-file-progress {
147
+ position: absolute;
148
+ top: 0;
149
+ left: 0;
150
+ z-index: 9999;
151
+ background: rgba(0, 0, 0, 0.5);
152
+ width: 100%;
153
+ height: 100%;
154
+ display: flex;
155
+ justify-content: center;
156
+ padding-top: 160px;
157
+ }
158
+ .k-upload-file-progress .text {
159
+ background: #427fe5;
160
+ height: 50px;
161
+ padding: 0 16px;
162
+ display: flex;
163
+ align-items: center;
164
+ color: #fff;
165
+ font-size: 14px;
166
+ border-radius: 5px;
167
+ box-shadow: 0 2px 8px #6c95d7;
168
+ padding-left: 39px;
169
+ position: relative;
170
+ }
171
+ .k-upload-file-progress .text::after {
172
+ content: "";
173
+ position: absolute;
174
+ width: 19px;
175
+ height: 19px;
176
+ background: url(data:image/png;base64,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) no-repeat;
177
+ background-size: auto 100%;
178
+ top: 15px;
179
+ left: 15px;
180
+ animation: rotateCircle 1s linear forwards infinite;
181
+ transform-origin: center center;
182
+ }
183
+
184
+ @keyframes rotateCircle {
185
+ 0% {
186
+ transform: rotate(0);
187
+ }
188
+ 100% {
189
+ transform: rotate(360deg);
190
+ }
144
191
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),s=require("../../icon/index.js");require("./style/index.css");const h=require("./uploadFile2.js"),v=require("../../directives/drag.js"),L=require("../../directives/zoomIn.js");require("./uploadFile.vue?vue&type=style&index=0&lang.css");const w={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},P={key:0,class:"upload-file-progress"},Z=e.defineComponent({name:"k-upload-file"}),G=e.defineComponent({...Z,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(n,{expose:E,emit:B}){const f=e.ref();let a;const m=e.ref(!1),c=n;let F=c.maxSize*1024*1024;const V=c.loadingFileMaxSize*1024*1024,d=B,o=e.reactive({fileList:new Array,errFiles:new Array});o.fileList=c.data,e.watch(()=>c.data,t=>{o.fileList=t},{deep:!0});const C=t=>{for(let i=0;i<t.length;i++)t[i].size>V&&(m.value=!0)},g=()=>{a&&a.hide(),h.uploadImg({acceptType:c.accept,limit:c.limit,maxSize:F,success:async t=>{C(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){m.value&&(m.value=!1);for(let r=0;r<l.data.length;r++)i.push(l.data[r]);i.forEach(r=>{r.name=r.fileOriginName,r.type="image/"+r.fileSuffix}),y(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]);y(i)}},limitError:t=>{d("limitError"),o.errFiles=new Array},fileSizeError:t=>{o.errFiles=t,d("fileSizeError",t)}})},y=t=>{c.limit==1?(o.fileList=t,c.type=="image"&&e.nextTick(()=>{a?a.updateSrc(u(o.fileList[0].url)):a=new L.ZoomIn(f.value,{type:"margin"})})):o.fileList=[...o.fileList,...t],d("success",o.fileList)};function N(t){const i=document.cookie.split("; ");for(let l=0;l<i.length;l++){const r=i[l].split("=");if(r[0]===t)return r[1]}return""}const u=t=>c.hasToken?`${t}?token=${N("bearer")}`:t,k=t=>{let i=o.fileList[t];o.fileList.splice(t,1),d("deleteSuccess",{deleteFile:i,result:o.fileList})},p=t=>{new v.Dragger(t.target,{type:"margin",list:o.fileList}).build()};return E({clearFiles:()=>{o.fileList=new Array},deleteFile:k}),(t,i)=>(e.openBlock(),e.createElementBlock("div",w,[n.isView?e.createCommentVNode("",!0):e.renderSlot(t.$slots,"default",{key:0},()=>[n.type=="file"?(e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("span",{onClick:g},[e.renderSlot(t.$slots,"icon",{},()=>[e.createElementVNode("div",A,[e.createElementVNode("div",b,[e.createVNode(e.unref(s.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(g,["stop"])},[e.createElementVNode("div",x,[o.fileList.length>0&&n.limit==1?(e.openBlock(),e.createElementBlock("img",{key:0,src:u(o.fileList[0].url),ref_key:"imgRef",ref:f},null,8,D)):e.createCommentVNode("",!0)]),!n.isView&&o.fileList.length>0&&n.limit==1?(e.openBlock(),e.createElementBlock("span",{key:0,class:"k-file-icon-close",onClick:i[0]||(i[0]=e.withModifiers(l=>k(0),["stop"]))},[e.createVNode(e.unref(s.Icon),{name:"close",size:"12"})])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"icon",{},()=>[o.fileList.length==0&&n.limit==1?(e.openBlock(),e.createBlock(e.unref(s.Icon),{key:0,name:"plus",color:"#409eff"})):e.createCommentVNode("",!0),n.limit>1?(e.openBlock(),e.createBlock(e.unref(s.Icon),{key:1,name:"plus",color:"#409eff"})):e.createCommentVNode("",!0)])]))]),e.renderSlot(t.$slots,"files",{data:o.fileList},()=>[n.type=="image"&&n.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":!n.isView}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.fileList,(l,r)=>(e.openBlock(),e.createElementBlock("li",{key:r},[e.createElementVNode("div",$,[l.type=="image/webp"?(e.openBlock(),e.createElementBlock("img",{key:0,src:u(l.url),onClick:p,title:l.name},null,8,j)):l.type=="image/png"?(e.openBlock(),e.createElementBlock("img",{key:1,src:u(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:u(l.url),onClick:p,title:l.name},null,8,q)):e.createCommentVNode("",!0)]),n.isView?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:"k-file-icon-close",onClick:S=>k(r)},[e.createVNode(e.unref(s.Icon),{name:"close",size:"12"})],8,M))]))),128))],2)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),n.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":!n.isView}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.fileList,(l,r)=>(e.openBlock(),e.createElementBlock("li",{key:r},[e.renderSlot(t.$slots,"file",{data:l},()=>[e.createElementVNode("span",null,e.toDisplayString(l.name),1),n.isView?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:"k-file-icon-close",onClick:S=>k(r)},[e.createVNode(e.unref(s.Icon),{name:"close",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(n.type=="file"?"\u6587\u4EF6":"\u56FE\u7247")+"\u683C\u5F0F\u6709\uFF1A"+e.toDisplayString(n.accept.join(","))+",\u6700\u591A\u4E0A\u4F20"+e.toDisplayString(n.limit)+"\u4E2A\u6587\u4EF6,"+e.toDisplayString(n.type=="file"?"\u5355\u4E2A\u6587\u4EF6":"\u5355\u5F20\u56FE\u7247")+"\u4E0D\u80FD\u5927\u4E8E"+e.toDisplayString(n.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(n.type=="file"?"\u6587\u4EF6":"\u56FE\u7247")+"\u6709\uFF1A",1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.errFiles,(l,r)=>(e.openBlock(),e.createElementBlock("span",{key:r},[r>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"},[m.value?(e.openBlock(),e.createElementBlock("div",P,[...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=G;
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",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:"close",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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btt-ui",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [