@keyblade/pro-components 1.13.8-alpha.44 → 1.13.8-alpha.45

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.
@@ -12,6 +12,7 @@ declare function __VLS_template(): {
12
12
  fileItem: any;
13
13
  }): any;
14
14
  'upload-button'?(_: {}): any;
15
+ 'extra-button'?(_: {}): any;
15
16
  };
16
17
  refs: {
17
18
  uploadInsRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
@@ -1,58 +1,58 @@
1
1
  var ye = Object.defineProperty;
2
- var ee = Object.getOwnPropertySymbols;
2
+ var le = Object.getOwnPropertySymbols;
3
3
  var Ce = Object.prototype.hasOwnProperty, Be = Object.prototype.propertyIsEnumerable;
4
- var ae = (d, s, u) => s in d ? ye(d, s, { enumerable: !0, configurable: !0, writable: !0, value: u }) : d[s] = u, Q = (d, s) => {
5
- for (var u in s || (s = {}))
6
- Ce.call(s, u) && ae(d, u, s[u]);
7
- if (ee)
8
- for (var u of ee(s))
9
- Be.call(s, u) && ae(d, u, s[u]);
10
- return d;
4
+ var oe = (s, c, r) => c in s ? ye(s, c, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[c] = r, T = (s, c) => {
5
+ for (var r in c || (c = {}))
6
+ Ce.call(c, r) && oe(s, r, c[r]);
7
+ if (le)
8
+ for (var r of le(c))
9
+ Be.call(c, r) && oe(s, r, c[r]);
10
+ return s;
11
11
  };
12
- var b = (d, s, u) => new Promise((O, i) => {
12
+ var L = (s, c, r) => new Promise((E, i) => {
13
13
  var e = (v) => {
14
14
  try {
15
- x(u.next(v));
15
+ x(r.next(v));
16
16
  } catch (m) {
17
17
  i(m);
18
18
  }
19
- }, z = (v) => {
19
+ }, j = (v) => {
20
20
  try {
21
- x(u.throw(v));
21
+ x(r.throw(v));
22
22
  } catch (m) {
23
23
  i(m);
24
24
  }
25
- }, x = (v) => v.done ? O(v.value) : Promise.resolve(v.value).then(e, z);
26
- x((u = u.apply(d, s)).next());
25
+ }, x = (v) => v.done ? E(v.value) : Promise.resolve(v.value).then(e, j);
26
+ x((r = r.apply(s, c)).next());
27
27
  });
28
- import { defineComponent as we, mergeModels as le, useSlots as Ee, useModel as Me, ref as U, computed as L, watch as oe, createElementBlock as Se, openBlock as ne, createVNode as be, createBlock as Le, createCommentVNode as Oe, unref as T, normalizeClass as $e, createSlots as ke, withCtx as te, renderSlot as ie } from "vue";
28
+ import { defineComponent as we, mergeModels as ne, useSlots as be, useModel as Ee, ref as U, computed as O, watch as te, createElementBlock as Me, openBlock as ie, createVNode as Se, createBlock as Le, createCommentVNode as Oe, unref as z, normalizeClass as $e, createSlots as ke, withCtx as V, renderSlot as W } from "vue";
29
29
  import { Message as y, Upload as ze } from "@arco-design/web-vue";
30
- import { conclude as V } from "vue-global-config";
30
+ import { conclude as F } from "vue-global-config";
31
31
  import { EImageUploadInnerBeforeUploadStep as I } from "./types.js";
32
- import { defaultImageUploadOptions as E } from "./constant.js";
32
+ import { defaultImageUploadOptions as b } from "./constant.js";
33
33
  import je from "./cropper.vue.js";
34
34
  import { defaultImageUploadCheckOptions as Qe, defaultImageUploadCompressorOptions as Te, defaultImageUploadCropOptions as Ve, oneTravelImageCheckAndTransform as We, oneTravelImageCompressor as Fe } from "@keyblade/one-travel";
35
35
  const He = "keyblade-pro-image-upload";
36
36
  var re, ue, de;
37
37
  const Ne = /* @__PURE__ */ we({
38
38
  __name: "image-upload",
39
- props: /* @__PURE__ */ le({
39
+ props: /* @__PURE__ */ ne({
40
40
  action: {},
41
41
  handlerResponse: {},
42
42
  headers: {},
43
43
  data: {},
44
- name: { default: (re = E) == null ? void 0 : re.name },
44
+ name: { default: (re = b) == null ? void 0 : re.name },
45
45
  tip: {},
46
46
  accept: { default: () => {
47
- var d;
48
- return ((d = E) == null ? void 0 : d.accept) || [];
47
+ var s;
48
+ return ((s = b) == null ? void 0 : s.accept) || [];
49
49
  } },
50
- multiple: { type: Boolean, default: E.multiple },
51
- singleLimit: { default: E.singleLimit },
50
+ multiple: { type: Boolean, default: b.multiple },
51
+ singleLimit: { default: b.singleLimit },
52
52
  limit: {},
53
53
  exceedTip: {},
54
- disabled: { type: Boolean, default: (ue = E) == null ? void 0 : ue.disabled },
55
- hideInnerBeforeUploadLoading: { type: Boolean, default: (de = E) == null ? void 0 : de.hideInnerBeforeUploadLoading },
54
+ disabled: { type: Boolean, default: (ue = b) == null ? void 0 : ue.disabled },
55
+ hideInnerBeforeUploadLoading: { type: Boolean, default: (de = b) == null ? void 0 : de.hideInnerBeforeUploadLoading },
56
56
  checkOptions: {},
57
57
  compressorOptions: {},
58
58
  cropOptions: {},
@@ -67,36 +67,36 @@ const Ne = /* @__PURE__ */ we({
67
67
  modelValue: { required: !0 },
68
68
  modelModifiers: {}
69
69
  }),
70
- emits: /* @__PURE__ */ le(["cropperImgLoad"], ["update:modelValue"]),
71
- setup(d, { expose: s, emit: u }) {
72
- const O = Ee(), i = Me(d, "modelValue"), e = d, z = u, x = U(), v = U(), m = U(), C = U([]), n = U(), p = U(), g = U(), se = L(() => e.accept.map((a) => `.${a}`).join(",")), h = L(() => V([e.checkOptions, Qe]) || {}), M = L(() => V([e.compressorOptions, Te]) || {}), S = L(() => V([e.cropOptions, Ve]) || {}), ce = (a) => {
73
- var t, c, r, f;
74
- const l = (f = (r = (c = (t = x.value) == null ? void 0 : t.$el) == null ? void 0 : c.querySelector) == null ? void 0 : r.call(c, "input")) == null ? void 0 : f.files;
70
+ emits: /* @__PURE__ */ ne(["cropperImgLoad"], ["update:modelValue"]),
71
+ setup(s, { expose: c, emit: r }) {
72
+ const E = be(), i = Ee(s, "modelValue"), e = s, j = r, x = U(), v = U(), m = U(), C = U([]), n = U(), p = U(), g = U(), se = O(() => e.accept.map((a) => `.${a}`).join(",")), h = O(() => F([e.checkOptions, Qe]) || {}), M = O(() => F([e.compressorOptions, Te]) || {}), S = O(() => F([e.cropOptions, Ve]) || {}), ce = (a) => {
73
+ var t, f, u, d;
74
+ const l = (d = (u = (f = (t = x.value) == null ? void 0 : t.$el) == null ? void 0 : f.querySelector) == null ? void 0 : u.call(f, "input")) == null ? void 0 : d.files;
75
75
  return l && l.length > 0 && (g.value = {
76
76
  selectCount: l.length
77
- }), e != null && e.onBeforeUpload ? e == null ? void 0 : e.onBeforeUpload(a) : g.value && (e != null && e.singleLimit) && g.value.selectCount > (e == null ? void 0 : e.singleLimit) ? (g.value.handleIndex === void 0 ? (g.value.handleIndex = 0, y.clear(), y.error(`单次最多可选择${e == null ? void 0 : e.singleLimit}张图片`)) : g.value.handleIndex += 1, g.value.handleIndex === g.value.selectCount - 1 && (g.value = void 0), !1) : new Promise(($, k) => b(null, null, function* () {
77
+ }), e != null && e.onBeforeUpload ? e == null ? void 0 : e.onBeforeUpload(a) : g.value && (e != null && e.singleLimit) && g.value.selectCount > (e == null ? void 0 : e.singleLimit) ? (g.value.handleIndex === void 0 ? (g.value.handleIndex = 0, y.clear(), y.error(`单次最多可选择${e == null ? void 0 : e.singleLimit}张图片`)) : g.value.handleIndex += 1, g.value.handleIndex === g.value.selectCount - 1 && (g.value = void 0), !1) : new Promise(($, k) => L(null, null, function* () {
78
78
  try {
79
79
  $(yield pe(a));
80
- } catch (j) {
80
+ } catch (Q) {
81
81
  k();
82
82
  } finally {
83
- W();
83
+ H();
84
84
  }
85
85
  }));
86
- }, fe = (a) => b(null, null, function* () {
86
+ }, fe = (a) => L(null, null, function* () {
87
87
  const l = i.value.findIndex((t) => t.uid === a.uid);
88
88
  return i.value.splice(l, 1), i.value = [...i.value], !1;
89
89
  }), ve = (a, l) => {
90
90
  var t;
91
91
  e != null && e.onExceed ? e == null || e.onExceed(a, l) : (y.error((t = e.exceedTip) != null ? t : `超过数量上限,最多上传${(e == null ? void 0 : e.limit) || 1}张`), i.value = a);
92
- }, me = (a) => b(null, null, function* () {
92
+ }, me = (a) => L(null, null, function* () {
93
93
  if (e != null && e.onSuccess)
94
94
  e == null || e.onSuccess(a);
95
95
  else {
96
96
  if (!(e != null && e.handlerResponse))
97
97
  return;
98
- const l = yield e.handlerResponse(a.response), t = i.value.findIndex((c) => c.uid === a.uid);
99
- l.success ? i.value[t] && (i.value[t] = Q(Q({}, i.value[t]), l)) : i.value.splice(t, 1);
98
+ const l = yield e.handlerResponse(a.response), t = i.value.findIndex((f) => f.uid === a.uid);
99
+ l.success ? i.value[t] && (i.value[t] = T(T({}, i.value[t]), l)) : i.value.splice(t, 1);
100
100
  }
101
101
  }), ge = (a) => {
102
102
  e != null && e.onError ? e == null || e.onError(a) : setTimeout(() => {
@@ -104,8 +104,8 @@ const Ne = /* @__PURE__ */ we({
104
104
  i.value.splice(l, 1);
105
105
  });
106
106
  }, pe = (a) => new Promise((l, t) => {
107
- C.value.push({ file: a, resolve: l, reject: t }), C.value.length === 1 && !n.value && W();
108
- }), W = () => {
107
+ C.value.push({ file: a, resolve: l, reject: t }), C.value.length === 1 && !n.value && H();
108
+ }), H = () => {
109
109
  n.value === void 0 ? n.value = 0 : n.value + 1 >= C.value.length ? (n.value = void 0, C.value = []) : n.value += 1;
110
110
  }, he = () => {
111
111
  var a;
@@ -114,16 +114,16 @@ const Ne = /* @__PURE__ */ we({
114
114
  var l;
115
115
  (l = m.value) == null || l.resolve(a);
116
116
  }, xe = (a) => {
117
- z("cropperImgLoad", a);
117
+ j("cropperImgLoad", a);
118
118
  };
119
- oe(n, () => b(null, null, function* () {
120
- var $, k, j, F, H, P, q, D, G, J, K, X, Y, Z, N, A, R, _;
119
+ te(n, () => L(null, null, function* () {
120
+ var $, k, Q, P, q, D, G, J, K, X, Y, Z, N, A, R, _, ee, ae;
121
121
  if (n.value === void 0 || C.value.length === 0)
122
122
  return;
123
123
  const a = C.value[n.value];
124
124
  if (!a) return;
125
- const { file: l, resolve: t, reject: c } = a;
126
- let r = l.name, f = l;
125
+ const { file: l, resolve: t, reject: f } = a;
126
+ let u = l.name, d = l;
127
127
  if (($ = h.value) != null && $.enable) {
128
128
  p.value = {
129
129
  loading: !0,
@@ -142,7 +142,7 @@ const Ne = /* @__PURE__ */ we({
142
142
  imageMaxWidth: h.value.maxWidth,
143
143
  imageMaxHeight: h.value.maxHeight
144
144
  });
145
- if (p.value = void 0, (j = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || j.call(
145
+ if (p.value = void 0, (Q = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || Q.call(
146
146
  e,
147
147
  l,
148
148
  n.value,
@@ -153,26 +153,26 @@ const Ne = /* @__PURE__ */ we({
153
153
  errorMessage: o == null ? void 0 : o.errorMessage
154
154
  }
155
155
  ), !o.success)
156
- return (F = h.value) != null && F.showErrorMessage && y.error((o == null ? void 0 : o.errorMessage) || "图片校验及转换失败"), c();
156
+ return (P = h.value) != null && P.showErrorMessage && y.error((o == null ? void 0 : o.errorMessage) || "图片校验及转换失败"), f();
157
157
  if (o != null && o.hasTransform) {
158
- const w = r == null ? void 0 : r.split(".");
159
- w.pop(), r = `${w.join(",")}.jpg`, f = new File([o.file], r, {
158
+ const w = u == null ? void 0 : u.split(".");
159
+ w.pop(), u = `${w.join(",")}.jpg`, d = new File([o.file], u, {
160
160
  type: o.file.type
161
161
  });
162
162
  } else
163
- f = o.file;
163
+ d = o.file;
164
164
  }
165
- if ((H = S.value) != null && H.enable && !((q = (P = r == null ? void 0 : r.toLocaleLowerCase) == null ? void 0 : P.call(r)) != null && q.endsWith(".gif"))) {
166
- (D = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || D.call(
165
+ if ((q = S.value) != null && q.enable && !((G = (D = u == null ? void 0 : u.toLocaleLowerCase) == null ? void 0 : D.call(u)) != null && G.endsWith(".gif"))) {
166
+ (J = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || J.call(
167
167
  e,
168
168
  l,
169
169
  n.value,
170
170
  I.crop
171
171
  );
172
172
  try {
173
- (G = S.value) != null && G.customCrop ? f = yield S.value.customCrop(f) : f = yield new Promise((o, w) => {
174
- m.value = { file: f, resolve: o, reject: w };
175
- }), (J = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || J.call(
173
+ (K = S.value) != null && K.customCrop ? d = yield S.value.customCrop(d) : d = yield new Promise((o, w) => {
174
+ m.value = { file: d, resolve: o, reject: w };
175
+ }), (X = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || X.call(
176
176
  e,
177
177
  l,
178
178
  n.value,
@@ -182,7 +182,7 @@ const Ne = /* @__PURE__ */ we({
182
182
  }
183
183
  );
184
184
  } catch (o) {
185
- return (K = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || K.call(
185
+ return (Y = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || Y.call(
186
186
  e,
187
187
  l,
188
188
  n.value,
@@ -194,27 +194,27 @@ const Ne = /* @__PURE__ */ we({
194
194
  },
195
195
  errorMessage: "图片剪裁失败"
196
196
  }
197
- ), (X = S.value) != null && X.showErrorMessage && y.error("图片剪裁失败"), c();
197
+ ), (Z = S.value) != null && Z.showErrorMessage && y.error("图片剪裁失败"), f();
198
198
  } finally {
199
199
  m.value = void 0;
200
200
  }
201
201
  }
202
- if ((Y = M.value) != null && Y.enable) {
202
+ if ((N = M.value) != null && N.enable) {
203
203
  p.value = {
204
204
  loading: !0,
205
205
  text: `第${n.value + 1}张图片处理中,请稍等`
206
- }, (Z = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || Z.call(
206
+ }, (A = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || A.call(
207
207
  e,
208
208
  l,
209
209
  n.value,
210
210
  I.compress
211
211
  );
212
- const o = yield Fe(f, {
212
+ const o = yield Fe(d, {
213
213
  maxSize: M.value.maxSize,
214
214
  size: M.value.size,
215
- excludeAllowedTypes: (N = M.value.excludeAllowedTypes) == null ? void 0 : N.map((w) => `${w}`)
215
+ excludeAllowedTypes: (R = M.value.excludeAllowedTypes) == null ? void 0 : R.map((w) => `${w}`)
216
216
  });
217
- if (p.value = void 0, (A = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || A.call(
217
+ if (p.value = void 0, (_ = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || _.call(
218
218
  e,
219
219
  l,
220
220
  n.value,
@@ -227,12 +227,12 @@ const Ne = /* @__PURE__ */ we({
227
227
  errorMessage: o == null ? void 0 : o.errorMessage
228
228
  }
229
229
  ), !o.success)
230
- return (R = M.value) != null && R.showErrorMessage && y.error((o == null ? void 0 : o.errorMessage) || "图片压缩失败"), c();
231
- f = new File([o.file], r, {
230
+ return (ee = M.value) != null && ee.showErrorMessage && y.error((o == null ? void 0 : o.errorMessage) || "图片压缩失败"), f();
231
+ d = new File([o.file], u, {
232
232
  type: o.file.type
233
233
  });
234
234
  }
235
- p.value = void 0, (_ = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || _.call(
235
+ p.value = void 0, (ae = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || ae.call(
236
236
  e,
237
237
  l,
238
238
  n.value,
@@ -240,10 +240,10 @@ const Ne = /* @__PURE__ */ we({
240
240
  {
241
241
  success: !0
242
242
  }
243
- ), t(f);
243
+ ), t(d);
244
244
  }));
245
245
  let B;
246
- oe(
246
+ te(
247
247
  () => p.value,
248
248
  () => {
249
249
  var a;
@@ -254,15 +254,15 @@ const Ne = /* @__PURE__ */ we({
254
254
  }) : (a = B == null ? void 0 : B.close) == null || a.call(B);
255
255
  }
256
256
  );
257
- const Ue = L(() => i.value.every((a) => a.status && ["done", "error"].includes(a.status)));
258
- return s({
257
+ const Ue = O(() => i.value.every((a) => a.status && ["done", "error"].includes(a.status)));
258
+ return c({
259
259
  uploadInsRef: x,
260
260
  cropperInsRef: v,
261
261
  isUploadComplete: Ue
262
262
  }), (a, l) => {
263
- var t, c;
264
- return ne(), Se("div", null, [
265
- be(T(ze), {
263
+ var t, f, u;
264
+ return ie(), Me("div", null, [
265
+ Se(z(ze), {
266
266
  class: $e([`${He}-upload`]),
267
267
  ref_key: "uploadInsRef",
268
268
  ref: x,
@@ -270,7 +270,7 @@ const Ne = /* @__PURE__ */ we({
270
270
  tip: a.tip || "上传",
271
271
  "image-preview": "",
272
272
  "file-list": i.value,
273
- "onUpdate:fileList": l[0] || (l[0] = (r) => i.value = r),
273
+ "onUpdate:fileList": l[0] || (l[0] = (d) => i.value = d),
274
274
  action: a.action,
275
275
  headers: a.headers,
276
276
  data: a.data,
@@ -285,22 +285,29 @@ const Ne = /* @__PURE__ */ we({
285
285
  onSuccess: me,
286
286
  onError: ge
287
287
  }, ke({ _: 2 }, [
288
- (t = T(O)) != null && t.image ? {
288
+ (t = z(E)) != null && t.image ? {
289
289
  name: "image",
290
- fn: te(({ fileItem: r }) => [
291
- ie(a.$slots, "image", { fileItem: r })
290
+ fn: V(({ fileItem: d }) => [
291
+ W(a.$slots, "image", { fileItem: d })
292
292
  ]),
293
293
  key: "0"
294
294
  } : void 0,
295
- (c = T(O)) != null && c["upload-button"] ? {
295
+ (f = z(E)) != null && f["upload-button"] ? {
296
296
  name: "upload-button",
297
- fn: te(() => [
298
- ie(a.$slots, "upload-button")
297
+ fn: V(() => [
298
+ W(a.$slots, "upload-button")
299
299
  ]),
300
300
  key: "1"
301
+ } : void 0,
302
+ (u = z(E)) != null && u["extra-button"] ? {
303
+ name: "extra-button",
304
+ fn: V(() => [
305
+ W(a.$slots, "extra-button")
306
+ ]),
307
+ key: "2"
301
308
  } : void 0
302
309
  ]), 1032, ["class", "tip", "file-list", "action", "headers", "data", "name", "accept", "multiple", "limit", "disabled"]),
303
- m.value && n.value !== void 0 ? (ne(), Le(je, {
310
+ m.value && n.value !== void 0 ? (ie(), Le(je, {
304
311
  key: 0,
305
312
  ref_key: "cropperInsRef",
306
313
  ref: v,
@@ -2373,6 +2373,7 @@ declare const ProImageUpload: {
2373
2373
  fileItem: any;
2374
2374
  }): any;
2375
2375
  'upload-button'?(_: {}): any;
2376
+ 'extra-button'?(_: {}): any;
2376
2377
  };
2377
2378
  }) & {
2378
2379
  install: (app: App) => void;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@keyblade/pro-components",
3
3
  "description": "KeyBlade Pro Components",
4
4
  "author": "yangshuai <704807396@qq.com>",
5
- "version": "1.13.8-alpha.44",
5
+ "version": "1.13.8-alpha.45",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",