@keyblade/pro-components 1.12.5 → 1.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as se, mergeModels as G, useModel as ce, ref as m, computed as M, watch as J, resolveComponent as fe, openBlock as K, createElementBlock as ve, createVNode as me, normalizeClass as ge, createBlock as pe, createCommentVNode as Ie } from "vue";
2
- import { Message as x } from "@arco-design/web-vue";
2
+ import { Message as g } from "@arco-design/web-vue";
3
3
  import { conclude as L } from "vue-global-config";
4
4
  import { EImageUploadInnerBeforeUploadStep as v } from "./types.js";
5
5
  import { defaultImageUploadOptions as U } from "./constant.js";
@@ -40,14 +40,14 @@ const Fe = /* @__PURE__ */ se({
40
40
  }),
41
41
  emits: /* @__PURE__ */ G(["cropperImgLoad"], ["update:modelValue"]),
42
42
  setup(C, { expose: A, emit: R }) {
43
- const i = ce(C, "modelValue"), e = C, _ = R, S = m(), O = m(), g = m(), p = m(
43
+ const i = ce(C, "modelValue"), e = C, _ = R, S = m(), O = m(), p = m(), I = m(
44
44
  []
45
45
  ), n = m(), c = m(), d = m(), ee = M(() => e.accept.map((a) => `.${a}`).join(",")), f = M(() => L([e.checkOptions, xe]) || {}), y = M(() => L([e.compressorOptions, Ue]) || {}), B = M(() => L([e.cropOptions, Ce]) || {}), ae = (a) => {
46
46
  var t, r, s, u;
47
47
  const l = (u = (s = (r = (t = S.value) == null ? void 0 : t.$el) == null ? void 0 : r.querySelector) == null ? void 0 : s.call(r, "input")) == null ? void 0 : u.files;
48
48
  return l && l.length > 0 && (d.value = {
49
49
  selectCount: l.length
50
- }), e != null && e.onBeforeUpload ? e == null ? void 0 : e.onBeforeUpload(a) : d.value && (e != null && e.singleLimit) && d.value.selectCount > (e == null ? void 0 : e.singleLimit) ? (d.value.handleIndex === void 0 ? (d.value.handleIndex = 0, x.error(`单次最多可选择${e == null ? void 0 : e.singleLimit}张图片`)) : d.value.handleIndex += 1, d.value.handleIndex === d.value.selectCount - 1 && (d.value = void 0), !1) : new Promise(async (E, w) => {
50
+ }), e != null && e.onBeforeUpload ? e == null ? void 0 : e.onBeforeUpload(a) : d.value && (e != null && e.singleLimit) && d.value.selectCount > (e == null ? void 0 : e.singleLimit) ? (d.value.handleIndex === void 0 ? (d.value.handleIndex = 0, g.clear(), g.error(`单次最多可选择${e == null ? void 0 : e.singleLimit}张图片`)) : d.value.handleIndex += 1, d.value.handleIndex === d.value.selectCount - 1 && (d.value = void 0), !1) : new Promise(async (E, w) => {
51
51
  try {
52
52
  E(await ie(a));
53
53
  } catch {
@@ -60,7 +60,7 @@ const Fe = /* @__PURE__ */ se({
60
60
  const l = i.value.findIndex((t) => t.uid === a.uid);
61
61
  return i.value.splice(l, 1), i.value = [...i.value], !1;
62
62
  }, oe = (a, l) => {
63
- e != null && e.onExceed ? e == null || e.onExceed(a, l) : (x.error(`单次最多可选择${(e == null ? void 0 : e.limit) || 1}张图片`), i.value = a);
63
+ e != null && e.onExceed ? e == null || e.onExceed(a, l) : (g.error(`单次最多可选择${(e == null ? void 0 : e.limit) || 1}张图片`), i.value = a);
64
64
  }, ne = async (a) => {
65
65
  if (e != null && e.onSuccess)
66
66
  e == null || e.onSuccess(a);
@@ -79,23 +79,23 @@ const Fe = /* @__PURE__ */ se({
79
79
  i.value.splice(l, 1);
80
80
  });
81
81
  }, ie = (a) => new Promise((l, t) => {
82
- p.value.push({ file: a, resolve: l, reject: t }), p.value.length === 1 && !n.value && $();
82
+ I.value.push({ file: a, resolve: l, reject: t }), I.value.length === 1 && !n.value && $();
83
83
  }), $ = () => {
84
- n.value === void 0 ? n.value = 0 : n.value + 1 >= p.value.length ? (n.value = void 0, p.value = []) : n.value += 1;
84
+ n.value === void 0 ? n.value = 0 : n.value + 1 >= I.value.length ? (n.value = void 0, I.value = []) : n.value += 1;
85
85
  }, re = () => {
86
86
  var a;
87
- (a = g.value) == null || a.reject();
87
+ (a = p.value) == null || a.reject();
88
88
  }, ue = (a) => {
89
89
  var l;
90
- (l = g.value) == null || l.resolve(a);
90
+ (l = p.value) == null || l.resolve(a);
91
91
  }, de = (a) => {
92
92
  _("cropperImgLoad", a);
93
93
  };
94
94
  J(n, async () => {
95
95
  var E, w, b, k, F, z, j, Q, V, H, W, N, P, T, q, D;
96
- if (n.value === void 0 || p.value.length === 0)
96
+ if (n.value === void 0 || I.value.length === 0)
97
97
  return;
98
- const a = p.value[n.value], { file: l, resolve: t, reject: r } = a;
98
+ const a = I.value[n.value], { file: l, resolve: t, reject: r } = a;
99
99
  let s = l.name, u = l;
100
100
  if ((E = f.value) != null && E.enable) {
101
101
  c.value = {
@@ -126,10 +126,10 @@ const Fe = /* @__PURE__ */ se({
126
126
  errorMessage: o == null ? void 0 : o.errorMessage
127
127
  }
128
128
  ), !o.success)
129
- return (k = f.value) != null && k.showErrorMessage && x.error((o == null ? void 0 : o.errorMessage) || "图片校验及转换失败"), r();
129
+ return (k = f.value) != null && k.showErrorMessage && g.error((o == null ? void 0 : o.errorMessage) || "图片校验及转换失败"), r();
130
130
  if (o != null && o.hasTransform) {
131
- const h = s == null ? void 0 : s.split(".");
132
- h.pop(), s = `${h.join(",")}.jpg`, u = new File([o.file], s, {
131
+ const x = s == null ? void 0 : s.split(".");
132
+ x.pop(), s = `${x.join(",")}.jpg`, u = new File([o.file], s, {
133
133
  type: o.file.type
134
134
  });
135
135
  } else
@@ -143,8 +143,8 @@ const Fe = /* @__PURE__ */ se({
143
143
  v.crop
144
144
  );
145
145
  try {
146
- (j = B.value) != null && j.customCrop ? u = await B.value.customCrop(u) : u = await new Promise((o, h) => {
147
- g.value = { file: u, resolve: o, reject: h };
146
+ (j = B.value) != null && j.customCrop ? u = await B.value.customCrop(u) : u = await new Promise((o, x) => {
147
+ p.value = { file: u, resolve: o, reject: x };
148
148
  }), (Q = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || Q.call(
149
149
  e,
150
150
  l,
@@ -167,9 +167,9 @@ const Fe = /* @__PURE__ */ se({
167
167
  },
168
168
  errorMessage: "图片剪裁失败"
169
169
  }
170
- ), (H = B.value) != null && H.showErrorMessage && x.error("图片剪裁失败"), r();
170
+ ), (H = B.value) != null && H.showErrorMessage && g.error("图片剪裁失败"), r();
171
171
  } finally {
172
- g.value = void 0;
172
+ p.value = void 0;
173
173
  }
174
174
  }
175
175
  if ((W = y.value) != null && W.enable) {
@@ -185,7 +185,7 @@ const Fe = /* @__PURE__ */ se({
185
185
  const o = await Be(u, {
186
186
  maxSize: y.value.maxSize,
187
187
  size: y.value.size,
188
- excludeAllowedTypes: (P = y.value.excludeAllowedTypes) == null ? void 0 : P.map((h) => `image/${h}`)
188
+ excludeAllowedTypes: (P = y.value.excludeAllowedTypes) == null ? void 0 : P.map((x) => `image/${x}`)
189
189
  });
190
190
  if (c.value = void 0, (T = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || T.call(
191
191
  e,
@@ -200,7 +200,7 @@ const Fe = /* @__PURE__ */ se({
200
200
  errorMessage: o == null ? void 0 : o.errorMessage
201
201
  }
202
202
  ), !o.success)
203
- return (q = y.value) != null && q.showErrorMessage && x.error((o == null ? void 0 : o.errorMessage) || "图片压缩失败"), r();
203
+ return (q = y.value) != null && q.showErrorMessage && g.error((o == null ? void 0 : o.errorMessage) || "图片压缩失败"), r();
204
204
  u = new File([o.file], s, {
205
205
  type: o.file.type
206
206
  });
@@ -215,16 +215,16 @@ const Fe = /* @__PURE__ */ se({
215
215
  }
216
216
  ), t(u);
217
217
  });
218
- let I;
218
+ let h;
219
219
  return J(
220
220
  () => c.value,
221
221
  () => {
222
222
  var a;
223
- c.value ? I = x.loading({
223
+ c.value ? h = g.loading({
224
224
  content: c.value.text,
225
225
  id: "image-upload-id",
226
226
  duration: 0
227
- }) : (a = I == null ? void 0 : I.close) == null || a.call(I);
227
+ }) : (a = h == null ? void 0 : h.close) == null || a.call(h);
228
228
  }
229
229
  ), A({
230
230
  uploadInsRef: S,
@@ -255,11 +255,11 @@ const Fe = /* @__PURE__ */ se({
255
255
  onSuccess: ne,
256
256
  onError: te
257
257
  }, null, 8, ["class", "tip", "file-list", "action", "headers", "data", "name", "accept", "multiple", "limit", "disabled"]),
258
- g.value && n.value !== void 0 ? (K(), pe(he, {
258
+ p.value && n.value !== void 0 ? (K(), pe(he, {
259
259
  key: 0,
260
260
  ref_key: "cropperInsRef",
261
261
  ref: O,
262
- file: g.value.file,
262
+ file: p.value.file,
263
263
  index: n.value,
264
264
  options: B.value,
265
265
  onCancel: re,
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.12.5",
5
+ "version": "1.12.7",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",
File without changes