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

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,7 +12,7 @@ declare function __VLS_template(): {
12
12
  fileItem: any;
13
13
  }): any;
14
14
  'upload-button'?(_: {}): any;
15
- 'extra-button'?(_: {}): any;
15
+ 'extra-button'?(_: any): any;
16
16
  };
17
17
  refs: {
18
18
  uploadInsRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
@@ -1,40 +1,40 @@
1
1
  var ye = Object.defineProperty;
2
2
  var le = Object.getOwnPropertySymbols;
3
3
  var Ce = Object.prototype.hasOwnProperty, Be = Object.prototype.propertyIsEnumerable;
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]);
4
+ var oe = (s, c, u) => c in s ? ye(s, c, { enumerable: !0, configurable: !0, writable: !0, value: u }) : s[c] = u, Q = (s, c) => {
5
+ for (var u in c || (c = {}))
6
+ Ce.call(c, u) && oe(s, u, c[u]);
7
7
  if (le)
8
- for (var r of le(c))
9
- Be.call(c, r) && oe(s, r, c[r]);
8
+ for (var u of le(c))
9
+ Be.call(c, u) && oe(s, u, c[u]);
10
10
  return s;
11
11
  };
12
- var L = (s, c, r) => new Promise((E, i) => {
12
+ var L = (s, c, u) => new Promise((E, i) => {
13
13
  var e = (v) => {
14
14
  try {
15
- x(r.next(v));
15
+ x(u.next(v));
16
16
  } catch (m) {
17
17
  i(m);
18
18
  }
19
19
  }, j = (v) => {
20
20
  try {
21
- x(r.throw(v));
21
+ x(u.throw(v));
22
22
  } catch (m) {
23
23
  i(m);
24
24
  }
25
25
  }, x = (v) => v.done ? E(v.value) : Promise.resolve(v.value).then(e, j);
26
- x((r = r.apply(s, c)).next());
26
+ x((u = u.apply(s, c)).next());
27
27
  });
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
- import { Message as y, Upload as ze } from "@arco-design/web-vue";
30
- import { conclude as F } from "vue-global-config";
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 T, renderSlot as V, normalizeProps as ze, guardReactiveProps as je } from "vue";
29
+ import { Message as y, Upload as Pe } from "@arco-design/web-vue";
30
+ import { conclude as W } from "vue-global-config";
31
31
  import { EImageUploadInnerBeforeUploadStep as I } from "./types.js";
32
32
  import { defaultImageUploadOptions as b } from "./constant.js";
33
- import je from "./cropper.vue.js";
34
- import { defaultImageUploadCheckOptions as Qe, defaultImageUploadCompressorOptions as Te, defaultImageUploadCropOptions as Ve, oneTravelImageCheckAndTransform as We, oneTravelImageCompressor as Fe } from "@keyblade/one-travel";
35
- const He = "keyblade-pro-image-upload";
33
+ import Qe from "./cropper.vue.js";
34
+ import { defaultImageUploadCheckOptions as Te, defaultImageUploadCompressorOptions as Ve, defaultImageUploadCropOptions as We, oneTravelImageCheckAndTransform as Fe, oneTravelImageCompressor as He } from "@keyblade/one-travel";
35
+ const qe = "keyblade-pro-image-upload";
36
36
  var re, ue, de;
37
- const Ne = /* @__PURE__ */ we({
37
+ const Ae = /* @__PURE__ */ we({
38
38
  __name: "image-upload",
39
39
  props: /* @__PURE__ */ ne({
40
40
  action: {},
@@ -68,19 +68,19 @@ const Ne = /* @__PURE__ */ we({
68
68
  modelModifiers: {}
69
69
  }),
70
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;
71
+ setup(s, { expose: c, emit: u }) {
72
+ const E = be(), i = Ee(s, "modelValue"), e = s, j = u, x = U(), v = U(), m = U(), C = U([]), n = U(), p = U(), g = U(), se = O(() => e.accept.map((a) => `.${a}`).join(",")), h = O(() => W([e.checkOptions, Te]) || {}), M = O(() => W([e.compressorOptions, Ve]) || {}), S = O(() => W([e.cropOptions, We]) || {}), ce = (a) => {
73
+ var t, f, d, r;
74
+ const l = (r = (d = (f = (t = x.value) == null ? void 0 : t.$el) == null ? void 0 : f.querySelector) == null ? void 0 : d.call(f, "input")) == null ? void 0 : r.files;
75
75
  return l && l.length > 0 && (g.value = {
76
76
  selectCount: l.length
77
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 (Q) {
80
+ } catch (P) {
81
81
  k();
82
82
  } finally {
83
- H();
83
+ F();
84
84
  }
85
85
  }));
86
86
  }, fe = (a) => L(null, null, function* () {
@@ -96,7 +96,7 @@ const Ne = /* @__PURE__ */ we({
96
96
  if (!(e != null && e.handlerResponse))
97
97
  return;
98
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);
99
+ l.success ? i.value[t] && (i.value[t] = Q(Q({}, 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 && H();
108
- }), H = () => {
107
+ C.value.push({ file: a, resolve: l, reject: t }), C.value.length === 1 && !n.value && F();
108
+ }), F = () => {
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;
@@ -117,13 +117,13 @@ const Ne = /* @__PURE__ */ we({
117
117
  j("cropperImgLoad", a);
118
118
  };
119
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;
120
+ var $, k, P, H, q, D, G, J, K, X, Y, Z, N, R, A, _, 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
125
  const { file: l, resolve: t, reject: f } = a;
126
- let u = l.name, d = l;
126
+ let d = l.name, r = l;
127
127
  if (($ = h.value) != null && $.enable) {
128
128
  p.value = {
129
129
  loading: !0,
@@ -134,7 +134,7 @@ const Ne = /* @__PURE__ */ we({
134
134
  n.value,
135
135
  I.check
136
136
  );
137
- const o = yield We(l, l.name, {
137
+ const o = yield Fe(l, l.name, {
138
138
  imageMaxSize: h.value.maxSize,
139
139
  imageAllowedType: h.value.allowedType,
140
140
  imageMinWidth: h.value.minWidth,
@@ -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, (Q = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || Q.call(
145
+ if (p.value = void 0, (P = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || P.call(
146
146
  e,
147
147
  l,
148
148
  n.value,
@@ -153,16 +153,16 @@ const Ne = /* @__PURE__ */ we({
153
153
  errorMessage: o == null ? void 0 : o.errorMessage
154
154
  }
155
155
  ), !o.success)
156
- return (P = h.value) != null && P.showErrorMessage && y.error((o == null ? void 0 : o.errorMessage) || "图片校验及转换失败"), f();
156
+ return (H = h.value) != null && H.showErrorMessage && y.error((o == null ? void 0 : o.errorMessage) || "图片校验及转换失败"), f();
157
157
  if (o != null && o.hasTransform) {
158
- const w = u == null ? void 0 : u.split(".");
159
- w.pop(), u = `${w.join(",")}.jpg`, d = new File([o.file], u, {
158
+ const w = d == null ? void 0 : d.split(".");
159
+ w.pop(), d = `${w.join(",")}.jpg`, r = new File([o.file], d, {
160
160
  type: o.file.type
161
161
  });
162
162
  } else
163
- d = o.file;
163
+ r = o.file;
164
164
  }
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"))) {
165
+ if ((q = S.value) != null && q.enable && !((G = (D = d == null ? void 0 : d.toLocaleLowerCase) == null ? void 0 : D.call(d)) != null && G.endsWith(".gif"))) {
166
166
  (J = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || J.call(
167
167
  e,
168
168
  l,
@@ -170,8 +170,8 @@ const Ne = /* @__PURE__ */ we({
170
170
  I.crop
171
171
  );
172
172
  try {
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 };
173
+ (K = S.value) != null && K.customCrop ? r = yield S.value.customCrop(r) : r = yield new Promise((o, w) => {
174
+ m.value = { file: r, resolve: o, reject: w };
175
175
  }), (X = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || X.call(
176
176
  e,
177
177
  l,
@@ -203,16 +203,16 @@ const Ne = /* @__PURE__ */ we({
203
203
  p.value = {
204
204
  loading: !0,
205
205
  text: `第${n.value + 1}张图片处理中,请稍等`
206
- }, (A = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || A.call(
206
+ }, (R = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || R.call(
207
207
  e,
208
208
  l,
209
209
  n.value,
210
210
  I.compress
211
211
  );
212
- const o = yield Fe(d, {
212
+ const o = yield He(r, {
213
213
  maxSize: M.value.maxSize,
214
214
  size: M.value.size,
215
- excludeAllowedTypes: (R = M.value.excludeAllowedTypes) == null ? void 0 : R.map((w) => `${w}`)
215
+ excludeAllowedTypes: (A = M.value.excludeAllowedTypes) == null ? void 0 : A.map((w) => `${w}`)
216
216
  });
217
217
  if (p.value = void 0, (_ = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || _.call(
218
218
  e,
@@ -228,7 +228,7 @@ const Ne = /* @__PURE__ */ we({
228
228
  }
229
229
  ), !o.success)
230
230
  return (ee = M.value) != null && ee.showErrorMessage && y.error((o == null ? void 0 : o.errorMessage) || "图片压缩失败"), f();
231
- d = new File([o.file], u, {
231
+ r = new File([o.file], d, {
232
232
  type: o.file.type
233
233
  });
234
234
  }
@@ -240,7 +240,7 @@ const Ne = /* @__PURE__ */ we({
240
240
  {
241
241
  success: !0
242
242
  }
243
- ), t(d);
243
+ ), t(r);
244
244
  }));
245
245
  let B;
246
246
  te(
@@ -260,17 +260,17 @@ const Ne = /* @__PURE__ */ we({
260
260
  cropperInsRef: v,
261
261
  isUploadComplete: Ue
262
262
  }), (a, l) => {
263
- var t, f, u;
263
+ var t, f, d;
264
264
  return ie(), Me("div", null, [
265
- Se(z(ze), {
266
- class: $e([`${He}-upload`]),
265
+ Se(z(Pe), {
266
+ class: $e([`${qe}-upload`]),
267
267
  ref_key: "uploadInsRef",
268
268
  ref: x,
269
269
  "list-type": "picture-card",
270
270
  tip: a.tip || "上传",
271
271
  "image-preview": "",
272
272
  "file-list": i.value,
273
- "onUpdate:fileList": l[0] || (l[0] = (d) => i.value = d),
273
+ "onUpdate:fileList": l[0] || (l[0] = (r) => i.value = r),
274
274
  action: a.action,
275
275
  headers: a.headers,
276
276
  data: a.data,
@@ -287,27 +287,27 @@ const Ne = /* @__PURE__ */ we({
287
287
  }, ke({ _: 2 }, [
288
288
  (t = z(E)) != null && t.image ? {
289
289
  name: "image",
290
- fn: V(({ fileItem: d }) => [
291
- W(a.$slots, "image", { fileItem: d })
290
+ fn: T(({ fileItem: r }) => [
291
+ V(a.$slots, "image", { fileItem: r })
292
292
  ]),
293
293
  key: "0"
294
294
  } : void 0,
295
295
  (f = z(E)) != null && f["upload-button"] ? {
296
296
  name: "upload-button",
297
- fn: V(() => [
298
- W(a.$slots, "upload-button")
297
+ fn: T(() => [
298
+ V(a.$slots, "upload-button")
299
299
  ]),
300
300
  key: "1"
301
301
  } : void 0,
302
- (u = z(E)) != null && u["extra-button"] ? {
302
+ (d = z(E)) != null && d["extra-button"] ? {
303
303
  name: "extra-button",
304
- fn: V(() => [
305
- W(a.$slots, "extra-button")
304
+ fn: T((r) => [
305
+ V(a.$slots, "extra-button", ze(je(r)))
306
306
  ]),
307
307
  key: "2"
308
308
  } : void 0
309
309
  ]), 1032, ["class", "tip", "file-list", "action", "headers", "data", "name", "accept", "multiple", "limit", "disabled"]),
310
- m.value && n.value !== void 0 ? (ie(), Le(je, {
310
+ m.value && n.value !== void 0 ? (ie(), Le(Qe, {
311
311
  key: 0,
312
312
  ref_key: "cropperInsRef",
313
313
  ref: v,
@@ -323,5 +323,5 @@ const Ne = /* @__PURE__ */ we({
323
323
  }
324
324
  });
325
325
  export {
326
- Ne as default
326
+ Ae as default
327
327
  };
@@ -2373,7 +2373,7 @@ declare const ProImageUpload: {
2373
2373
  fileItem: any;
2374
2374
  }): any;
2375
2375
  'upload-button'?(_: {}): any;
2376
- 'extra-button'?(_: {}): any;
2376
+ 'extra-button'?(_: any): any;
2377
2377
  };
2378
2378
  }) & {
2379
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.45",
5
+ "version": "1.13.8-alpha.47",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",