@keyblade/pro-components 1.12.6 → 1.12.8

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,9 +1,9 @@
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";
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 he } from "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";
6
- import he from "./cropper.vue.js";
6
+ import Ie from "./cropper.vue.js";
7
7
  import { defaultImageUploadCheckOptions as xe, defaultImageUploadCompressorOptions as Ue, defaultImageUploadCropOptions as Ce, oneTravelImageCheckAndTransform as ye, oneTravelImageCompressor as Be } from "@keyblade/one-travel";
8
8
  const Ee = "keyblade-pro-image-upload";
9
9
  var X, Y, Z;
@@ -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(), h = m(
44
44
  []
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
- var t, r, s, u;
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
- return l && l.length > 0 && (d.value = {
45
+ ), n = m(), c = m(), s = 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
+ var t, r, d, u;
47
+ const l = (u = (d = (r = (t = S.value) == null ? void 0 : t.$el) == null ? void 0 : r.querySelector) == null ? void 0 : d.call(r, "input")) == null ? void 0 : u.files;
48
+ return l && l.length > 0 && (s.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) : s.value && (e != null && e.singleLimit) && s.value.selectCount > (e == null ? void 0 : e.singleLimit) ? (s.value.handleIndex === void 0 ? (s.value.handleIndex = 0, g.clear(), g.error(`单次最多可选择${e == null ? void 0 : e.singleLimit}张图片`)) : s.value.handleIndex += 1, s.value.handleIndex === s.value.selectCount - 1 && (s.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,24 +79,24 @@ 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
+ h.value.push({ file: a, resolve: l, reject: t }), h.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 >= h.value.length ? (n.value = void 0, h.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
- 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)
95
+ var E, w, b, k, F, z, j, Q, V, W, H, N, P, T, q, D;
96
+ if (n.value === void 0 || h.value.length === 0)
97
97
  return;
98
- const a = p.value[n.value], { file: l, resolve: t, reject: r } = a;
99
- let s = l.name, u = l;
98
+ const a = h.value[n.value], { file: l, resolve: t, reject: r } = a;
99
+ let d = l.name, u = l;
100
100
  if ((E = f.value) != null && E.enable) {
101
101
  c.value = {
102
102
  loading: !0,
@@ -126,16 +126,16 @@ 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 = d == null ? void 0 : d.split(".");
132
+ x.pop(), d = `${x.join(",")}.jpg`, u = new File([o.file], d, {
133
133
  type: o.file.type
134
134
  });
135
135
  } else
136
136
  u = o.file;
137
137
  }
138
- if ((F = B.value) != null && F.enable) {
138
+ if ((F = B.value) != null && F.enable && !d.endsWith(".gif")) {
139
139
  (z = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || z.call(
140
140
  e,
141
141
  l,
@@ -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,12 +167,12 @@ const Fe = /* @__PURE__ */ se({
167
167
  },
168
168
  errorMessage: "图片剪裁失败"
169
169
  }
170
- ), (H = B.value) != null && H.showErrorMessage && x.error("图片剪裁失败"), r();
170
+ ), (W = B.value) != null && W.showErrorMessage && g.error("图片剪裁失败"), r();
171
171
  } finally {
172
- g.value = void 0;
172
+ p.value = void 0;
173
173
  }
174
174
  }
175
- if ((W = y.value) != null && W.enable) {
175
+ if ((H = y.value) != null && H.enable) {
176
176
  c.value = {
177
177
  loading: !0,
178
178
  text: `第${n.value + 1}张图片处理中,请稍等`
@@ -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,8 +200,8 @@ 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();
204
- u = new File([o.file], s, {
203
+ return (q = y.value) != null && q.showErrorMessage && g.error((o == null ? void 0 : o.errorMessage) || "图片压缩失败"), r();
204
+ u = new File([o.file], d, {
205
205
  type: o.file.type
206
206
  });
207
207
  }
@@ -220,7 +220,7 @@ const Fe = /* @__PURE__ */ se({
220
220
  () => c.value,
221
221
  () => {
222
222
  var a;
223
- c.value ? I = x.loading({
223
+ c.value ? I = g.loading({
224
224
  content: c.value.text,
225
225
  id: "image-upload-id",
226
226
  duration: 0
@@ -255,17 +255,17 @@ 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(Ie, {
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,
266
266
  onConfirm: ue,
267
267
  onImgLoad: de
268
- }, null, 8, ["file", "index", "options"])) : Ie("", !0)
268
+ }, null, 8, ["file", "index", "options"])) : he("", !0)
269
269
  ]);
270
270
  };
271
271
  }
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.6",
5
+ "version": "1.12.8",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",