@keyblade/pro-components 1.12.1-alpha.19 → 1.12.1-alpha.21

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.
@@ -0,0 +1,9 @@
1
+ const s = (t, e) => {
2
+ const o = t.__vccOpts || t;
3
+ for (const [r, c] of e)
4
+ o[r] = c;
5
+ return o;
6
+ };
7
+ export {
8
+ s as default
9
+ };
@@ -0,0 +1,20 @@
1
+ import { ImageUploadCropOptions } from '@keyblade/one-travel';
2
+ type __VLS_Props = {
3
+ file: File;
4
+ index: number;
5
+ options: ImageUploadCropOptions;
6
+ };
7
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {
8
+ cropperInsRef: import('vue').Ref<any, any>;
9
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
10
+ cancel: () => any;
11
+ confirm: (value: File) => any;
12
+ imgLoad: (value: File) => any;
13
+ reUpload: (index: number) => any;
14
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ onCancel?: (() => any) | undefined;
16
+ onConfirm?: ((value: File) => any) | undefined;
17
+ onImgLoad?: ((value: File) => any) | undefined;
18
+ onReUpload?: ((index: number) => any) | undefined;
19
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
20
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import o from "./cropper.vue2.js";
2
+ /* empty css */
3
+ import r from "../_virtual/_plugin-vue_export-helper.js";
4
+ const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-ae8ab9e0"]]);
5
+ export {
6
+ e as default
7
+ };
@@ -0,0 +1,211 @@
1
+ import { defineComponent as D, ref as d, watch as M, resolveComponent as l, openBlock as P, createBlock as q, normalizeClass as m, withCtx as n, createVNode as e, mergeProps as G, createElementVNode as y, createTextVNode as x, nextTick as h } from "vue";
2
+ import "vue-cropper/dist/index.css";
3
+ import J from "vue-cropper/lib/vue-cropper.vue";
4
+ const r = "keyblade-pro-image-upload-cropper", X = /* @__PURE__ */ D({
5
+ __name: "cropper",
6
+ props: {
7
+ file: {},
8
+ index: {},
9
+ options: {}
10
+ },
11
+ emits: ["cancel", "confirm", "imgLoad", "reUpload"],
12
+ setup(H, { expose: R, emit: W }) {
13
+ const s = H, f = W, o = d(), w = d(), u = d(!0), _ = d(!1), g = d({
14
+ autoCropWidth: 100,
15
+ autoCropHeight: 100
16
+ }), z = () => {
17
+ o.value.changeScale(1);
18
+ }, I = () => {
19
+ o.value.changeScale(-1);
20
+ }, L = () => {
21
+ o.value.rotateRight();
22
+ const { w: a, h: t } = v();
23
+ h(() => {
24
+ o.value.goAutoCrop(a, t);
25
+ });
26
+ }, $ = () => {
27
+ o.value.rotateLeft();
28
+ const { w: a, h: t } = v();
29
+ h(() => {
30
+ o.value.goAutoCrop(a, t);
31
+ });
32
+ }, N = () => {
33
+ o.value.reload(), o.value.rotateClear(), h(() => {
34
+ o.value.goAutoCrop();
35
+ });
36
+ }, b = () => {
37
+ f("cancel");
38
+ }, S = () => {
39
+ u.value || _.value || (_.value = !0, o.value.getCropBlob((a) => {
40
+ _.value = !1;
41
+ const t = new File([a], s.file.name, { type: "image/jpeg" });
42
+ f("confirm", t);
43
+ }));
44
+ }, A = () => {
45
+ u.value = !1;
46
+ const { w: a, h: t } = v();
47
+ g.value.autoCropWidth = a, g.value.autoCropHeight = t, f("imgLoad", s.file);
48
+ }, v = () => {
49
+ const a = Math.abs(o.value.rotate) % 2 > 0, t = (a ? o.value.trueHeight : o.value.trueWidth) * o.value.scale, i = (a ? o.value.trueWidth : o.value.trueHeight) * o.value.scale;
50
+ return { w: t, h: i };
51
+ };
52
+ return M(
53
+ () => s.file,
54
+ () => {
55
+ if (s.file) {
56
+ u.value = !0, o.value && o.value.clearCrop();
57
+ const a = new FileReader();
58
+ a.onloadend = () => {
59
+ const t = a.result, i = new Image();
60
+ i.onload = () => {
61
+ const C = i.width, c = i.height;
62
+ w.value = {
63
+ data: t,
64
+ width: C,
65
+ height: c
66
+ };
67
+ }, i.src = t;
68
+ }, a.readAsDataURL(s.file);
69
+ }
70
+ },
71
+ { immediate: !0 }
72
+ ), R({
73
+ cropperInsRef: o
74
+ }), (a, t) => {
75
+ const i = l("a-spin"), C = l("icon-zoom-in"), c = l("a-button"), p = l("a-tooltip"), B = l("icon-zoom-out"), V = l("icon-rotate-right"), E = l("icon-rotate-left"), F = l("icon-sync"), T = l("a-button-group"), U = l("a-space"), j = l("a-modal");
76
+ return P(), q(j, {
77
+ "render-to-body": "",
78
+ class: m(`${r}-dialog`),
79
+ title: "编辑图片",
80
+ width: "675px",
81
+ visible: !0,
82
+ footer: !1,
83
+ "mask-closable": !1,
84
+ "esc-to-close": !1,
85
+ "unmount-on-close": "",
86
+ onClose: b
87
+ }, {
88
+ default: n(() => [
89
+ e(i, {
90
+ class: m(`${r}-dialog-cropper-wrapper`),
91
+ loading: u.value
92
+ }, {
93
+ default: n(() => {
94
+ var k;
95
+ return [
96
+ e(J, G({
97
+ ref_key: "cropperInsRef",
98
+ ref: o,
99
+ class: `${r}-dialog-cropper`,
100
+ img: (k = w.value) == null ? void 0 : k.data,
101
+ info: !1,
102
+ autoCrop: !0,
103
+ autoCropWidth: g.value.autoCropWidth,
104
+ autoCropHeight: g.value.autoCropHeight,
105
+ full: !0
106
+ }, a.options, { onImgLoad: A }), null, 16, ["class", "img", "autoCropWidth", "autoCropHeight"])
107
+ ];
108
+ }),
109
+ _: 1
110
+ }, 8, ["class", "loading"]),
111
+ y("div", {
112
+ class: m(`${r}-dialog-operate`)
113
+ }, [
114
+ e(T, { type: "primary" }, {
115
+ default: n(() => [
116
+ e(p, { content: "放大" }, {
117
+ default: n(() => [
118
+ e(c, { onClick: z }, {
119
+ icon: n(() => [
120
+ e(C)
121
+ ]),
122
+ _: 1
123
+ })
124
+ ]),
125
+ _: 1
126
+ }),
127
+ e(p, { content: "缩小" }, {
128
+ default: n(() => [
129
+ e(c, { onClick: I }, {
130
+ icon: n(() => [
131
+ e(B)
132
+ ]),
133
+ _: 1
134
+ })
135
+ ]),
136
+ _: 1
137
+ }),
138
+ e(p, { content: "向右旋转" }, {
139
+ default: n(() => [
140
+ e(c, { onClick: L }, {
141
+ icon: n(() => [
142
+ e(V)
143
+ ]),
144
+ _: 1
145
+ })
146
+ ]),
147
+ _: 1
148
+ }),
149
+ e(p, { content: "向左旋转" }, {
150
+ default: n(() => [
151
+ e(c, { onClick: $ }, {
152
+ icon: n(() => [
153
+ e(E)
154
+ ]),
155
+ _: 1
156
+ })
157
+ ]),
158
+ _: 1
159
+ }),
160
+ e(p, { content: "重置" }, {
161
+ default: n(() => [
162
+ e(c, { onClick: N }, {
163
+ icon: n(() => [
164
+ e(F)
165
+ ]),
166
+ _: 1
167
+ })
168
+ ]),
169
+ _: 1
170
+ })
171
+ ]),
172
+ _: 1
173
+ })
174
+ ], 2),
175
+ y("div", {
176
+ class: m(`${r}-dialog-footer`)
177
+ }, [
178
+ e(U, {
179
+ class: m(`${r}-dialog-footer-right`)
180
+ }, {
181
+ default: n(() => [
182
+ e(c, { onClick: b }, {
183
+ default: n(() => t[0] || (t[0] = [
184
+ x("取消")
185
+ ])),
186
+ _: 1
187
+ }),
188
+ e(c, {
189
+ disabled: u.value,
190
+ type: "primary",
191
+ onClick: S,
192
+ loading: _.value
193
+ }, {
194
+ default: n(() => t[1] || (t[1] = [
195
+ x("确定")
196
+ ])),
197
+ _: 1
198
+ }, 8, ["disabled", "loading"])
199
+ ]),
200
+ _: 1
201
+ }, 8, ["class"])
202
+ ], 2)
203
+ ]),
204
+ _: 1
205
+ }, 8, ["class"]);
206
+ };
207
+ }
208
+ });
209
+ export {
210
+ X as default
211
+ };
@@ -1,29 +1,30 @@
1
- import { defineComponent as oe, mergeModels as D, useModel as te, ref as m, computed as M, watch as G, resolveComponent as ie, openBlock as ue, createElementBlock as re, createVNode as de, normalizeClass as se } from "vue";
2
- import { Message as U } from "@arco-design/web-vue";
3
- import { conclude as b } from "vue-global-config";
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";
3
+ import { conclude as L } from "vue-global-config";
4
4
  import { EImageUploadInnerBeforeUploadStep as v } from "./types.js";
5
- import { defaultImageUploadOptions as x } from "./constant.js";
6
- import { defaultImageUploadCheckOptions as ce, defaultImageUploadCompressorOptions as fe, defaultImageUploadCropOptions as ve, oneTravelImageCheckAndTransform as me, oneTravelImageCompressor as ge } from "@keyblade/one-travel";
7
- const he = "keyblade-pro-image-upload";
8
- var J, K, X;
9
- const Me = /* @__PURE__ */ oe({
5
+ import { defaultImageUploadOptions as U } from "./constant.js";
6
+ import he from "./cropper.vue.js";
7
+ import { defaultImageUploadCheckOptions as xe, defaultImageUploadCompressorOptions as Ue, defaultImageUploadCropOptions as Ce, oneTravelImageCheckAndTransform as ye, oneTravelImageCompressor as Be } from "@keyblade/one-travel";
8
+ const Ee = "keyblade-pro-image-upload";
9
+ var X, Y, Z;
10
+ const Fe = /* @__PURE__ */ se({
10
11
  __name: "image-upload",
11
- props: /* @__PURE__ */ D({
12
+ props: /* @__PURE__ */ G({
12
13
  action: {},
13
14
  handlerResponse: {},
14
15
  headers: {},
15
16
  data: {},
16
- name: { default: (J = x) == null ? void 0 : J.name },
17
+ name: { default: (X = U) == null ? void 0 : X.name },
17
18
  tip: {},
18
19
  accept: { default: () => {
19
- var B;
20
- return ((B = x) == null ? void 0 : B.accept) || [];
20
+ var C;
21
+ return ((C = U) == null ? void 0 : C.accept) || [];
21
22
  } },
22
- multiple: { type: Boolean, default: x.multiple },
23
- singleLimit: { default: x.singleLimit },
23
+ multiple: { type: Boolean, default: U.multiple },
24
+ singleLimit: { default: U.singleLimit },
24
25
  limit: {},
25
- disabled: { type: Boolean, default: (K = x) == null ? void 0 : K.disabled },
26
- hideInnerBeforeUploadLoading: { type: Boolean, default: (X = x) == null ? void 0 : X.hideInnerBeforeUploadLoading },
26
+ disabled: { type: Boolean, default: (Y = U) == null ? void 0 : Y.disabled },
27
+ hideInnerBeforeUploadLoading: { type: Boolean, default: (Z = U) == null ? void 0 : Z.hideInnerBeforeUploadLoading },
27
28
  checkOptions: {},
28
29
  compressorOptions: {},
29
30
  cropOptions: {},
@@ -37,68 +38,76 @@ const Me = /* @__PURE__ */ oe({
37
38
  modelValue: { required: !0 },
38
39
  modelModifiers: {}
39
40
  }),
40
- emits: /* @__PURE__ */ D(["cropperImgLoad"], ["update:modelValue"]),
41
- setup(B, { expose: Y, emit: Ie }) {
42
- const i = te(B, "modelValue"), e = B, C = m(), Z = m(), O = m(), g = m(
41
+ emits: /* @__PURE__ */ G(["cropperImgLoad"], ["update:modelValue"]),
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
44
  []
44
- ), o = m(), c = m(), d = m(), _ = M(() => e.accept.map((a) => `.${a}`).join(",")), f = M(() => b([e.checkOptions, ce]) || {}), p = M(() => b([e.compressorOptions, fe]) || {}), y = M(() => b([e.cropOptions, ve]) || {}), A = (a) => {
45
- var t, u, s, r;
46
- const n = (r = (s = (u = (t = C.value) == null ? void 0 : t.$el) == null ? void 0 : u.querySelector) == null ? void 0 : s.call(u, "input")) == null ? void 0 : r.files;
47
- return n && n.length > 0 && (d.value = {
48
- selectCount: n.length
49
- }), 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, U.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) => {
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 = {
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
51
  try {
51
- E(await ne(a));
52
+ E(await ie(a));
52
53
  } catch {
53
54
  w();
54
55
  } finally {
55
- L();
56
+ $();
56
57
  }
57
58
  });
58
- }, R = async (a) => {
59
- const n = i.value.findIndex((t) => t.uid === a.uid);
60
- return i.value.splice(n, 1), i.value = [...i.value], !1;
61
- }, ee = (a, n) => {
62
- e != null && e.onExceed ? e == null || e.onExceed(a, n) : (U.error(`单次最多可选择${(e == null ? void 0 : e.limit) || 1}张图片`), i.value = a);
63
- }, ae = async (a) => {
59
+ }, le = async (a) => {
60
+ const l = i.value.findIndex((t) => t.uid === a.uid);
61
+ return i.value.splice(l, 1), i.value = [...i.value], !1;
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);
64
+ }, ne = async (a) => {
64
65
  if (e != null && e.onSuccess)
65
66
  e == null || e.onSuccess(a);
66
67
  else {
67
68
  if (!(e != null && e.handlerResponse))
68
69
  return;
69
- const n = await e.handlerResponse(a.response), t = i.value.findIndex((u) => u.uid === a.uid);
70
- n.success ? i.value[t] = {
70
+ const l = await e.handlerResponse(a.response), t = i.value.findIndex((r) => r.uid === a.uid);
71
+ l.success ? i.value[t] = {
71
72
  ...i.value[t],
72
- ...n
73
+ ...l
73
74
  } : i.value.splice(t, 1);
74
75
  }
75
- }, le = (a) => {
76
+ }, te = (a) => {
76
77
  e != null && e.onError ? e == null || e.onError(a) : setTimeout(() => {
77
- const n = i.value.findIndex((t) => t.uid === a.uid);
78
- i.value.splice(n, 1);
78
+ const l = i.value.findIndex((t) => t.uid === a.uid);
79
+ i.value.splice(l, 1);
79
80
  });
80
- }, ne = (a) => new Promise((n, t) => {
81
- g.value.push({ file: a, resolve: n, reject: t }), g.value.length === 1 && !o.value && L();
82
- }), L = () => {
83
- o.value === void 0 ? o.value = 0 : o.value + 1 >= g.value.length ? (o.value = void 0, g.value = []) : o.value += 1;
81
+ }, ie = (a) => new Promise((l, t) => {
82
+ p.value.push({ file: a, resolve: l, reject: t }), p.value.length === 1 && !n.value && $();
83
+ }), $ = () => {
84
+ n.value === void 0 ? n.value = 0 : n.value + 1 >= p.value.length ? (n.value = void 0, p.value = []) : n.value += 1;
85
+ }, re = () => {
86
+ var a;
87
+ (a = g.value) == null || a.reject();
88
+ }, ue = (a) => {
89
+ var l;
90
+ (l = g.value) == null || l.resolve(a);
91
+ }, de = (a) => {
92
+ _("cropperImgLoad", a);
84
93
  };
85
- G(o, async () => {
86
- var E, w, S, $, F, z, j, k, Q, H, V, W, P, T, q, N;
87
- if (o.value === void 0 || g.value.length === 0)
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)
88
97
  return;
89
- const a = g.value[o.value], { file: n, resolve: t, reject: u } = a;
90
- let s = n.name, r = n;
98
+ const a = p.value[n.value], { file: l, resolve: t, reject: r } = a;
99
+ let s = l.name, u = l;
91
100
  if ((E = f.value) != null && E.enable) {
92
101
  c.value = {
93
102
  loading: !0,
94
- text: `第${o.value + 1}张图片检测中,请稍等`
103
+ text: `第${n.value + 1}张图片检测中,请稍等`
95
104
  }, (w = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || w.call(
96
105
  e,
97
- n,
98
- o.value,
106
+ l,
107
+ n.value,
99
108
  v.check
100
109
  );
101
- const l = await me(n, n.name, {
110
+ const o = await ye(l, l.name, {
102
111
  imageMaxSize: f.value.maxSize,
103
112
  imageAllowedType: f.value.allowedType,
104
113
  imageMinWidth: f.value.minWidth,
@@ -106,50 +115,50 @@ const Me = /* @__PURE__ */ oe({
106
115
  imageMaxWidth: f.value.maxWidth,
107
116
  imageMaxHeight: f.value.maxHeight
108
117
  });
109
- if (c.value = void 0, (S = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || S.call(
118
+ if (c.value = void 0, (b = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || b.call(
110
119
  e,
111
- n,
112
- o.value,
120
+ l,
121
+ n.value,
113
122
  v.check,
114
123
  {
115
- success: l.success,
116
- error: l == null ? void 0 : l.error,
117
- errorMessage: l == null ? void 0 : l.errorMessage
124
+ success: o.success,
125
+ error: o == null ? void 0 : o.error,
126
+ errorMessage: o == null ? void 0 : o.errorMessage
118
127
  }
119
- ), !l.success)
120
- return ($ = f.value) != null && $.showErrorMessage && U.error((l == null ? void 0 : l.errorMessage) || "图片校验及转换失败"), u();
121
- if (l != null && l.hasTransform) {
122
- const I = s == null ? void 0 : s.split(".");
123
- I.pop(), s = `${I.join(",")}.jpg`, r = new File([l.file], s, {
124
- type: l.file.type
128
+ ), !o.success)
129
+ return (k = f.value) != null && k.showErrorMessage && x.error((o == null ? void 0 : o.errorMessage) || "图片校验及转换失败"), r();
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, {
133
+ type: o.file.type
125
134
  });
126
135
  } else
127
- r = l.file;
136
+ u = o.file;
128
137
  }
129
- if ((F = y.value) != null && F.enable) {
138
+ if ((F = B.value) != null && F.enable) {
130
139
  (z = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || z.call(
131
140
  e,
132
- n,
133
- o.value,
141
+ l,
142
+ n.value,
134
143
  v.crop
135
144
  );
136
145
  try {
137
- (j = y.value) != null && j.customCrop ? r = await y.value.customCrop(r) : r = await new Promise((l, I) => {
138
- O.value = { file: r, resolve: l, reject: I };
139
- }), (k = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || k.call(
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 };
148
+ }), (Q = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || Q.call(
140
149
  e,
141
- n,
142
- o.value,
150
+ l,
151
+ n.value,
143
152
  v.crop,
144
153
  {
145
154
  success: !1
146
155
  }
147
156
  );
148
157
  } catch {
149
- return (Q = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || Q.call(
158
+ return (V = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || V.call(
150
159
  e,
151
- n,
152
- o.value,
160
+ l,
161
+ n.value,
153
162
  v.crop,
154
163
  {
155
164
  success: !1,
@@ -158,98 +167,109 @@ const Me = /* @__PURE__ */ oe({
158
167
  },
159
168
  errorMessage: "图片剪裁失败"
160
169
  }
161
- ), (H = y.value) != null && H.showErrorMessage && U.error("图片剪裁失败"), u();
170
+ ), (H = B.value) != null && H.showErrorMessage && x.error("图片剪裁失败"), r();
162
171
  } finally {
163
- O.value = void 0;
172
+ g.value = void 0;
164
173
  }
165
174
  }
166
- if ((V = p.value) != null && V.enable) {
175
+ if ((W = y.value) != null && W.enable) {
167
176
  c.value = {
168
177
  loading: !0,
169
- text: `第${o.value + 1}张图片处理中,请稍等`
170
- }, (W = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || W.call(
178
+ text: `第${n.value + 1}张图片处理中,请稍等`
179
+ }, (N = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || N.call(
171
180
  e,
172
- n,
173
- o.value,
181
+ l,
182
+ n.value,
174
183
  v.compress
175
184
  );
176
- const l = await ge(r, {
177
- maxSize: p.value.maxSize,
178
- size: p.value.size,
179
- excludeAllowedTypes: (P = p.value.excludeAllowedTypes) == null ? void 0 : P.map((I) => `image/${I}`)
185
+ const o = await Be(u, {
186
+ maxSize: y.value.maxSize,
187
+ size: y.value.size,
188
+ excludeAllowedTypes: (P = y.value.excludeAllowedTypes) == null ? void 0 : P.map((h) => `image/${h}`)
180
189
  });
181
190
  if (c.value = void 0, (T = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || T.call(
182
191
  e,
183
- n,
184
- o.value,
192
+ l,
193
+ n.value,
185
194
  v.compress,
186
195
  {
187
- success: l.success,
196
+ success: o.success,
188
197
  error: {
189
198
  compress: !0
190
199
  },
191
- errorMessage: l == null ? void 0 : l.errorMessage
200
+ errorMessage: o == null ? void 0 : o.errorMessage
192
201
  }
193
- ), !l.success)
194
- return (q = p.value) != null && q.showErrorMessage && U.error((l == null ? void 0 : l.errorMessage) || "图片压缩失败"), u();
195
- r = new File([l.file], s, {
196
- type: l.file.type
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, {
205
+ type: o.file.type
197
206
  });
198
207
  }
199
- c.value = void 0, (N = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || N.call(
208
+ c.value = void 0, (D = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || D.call(
200
209
  e,
201
- n,
202
- o.value,
210
+ l,
211
+ n.value,
203
212
  v.all,
204
213
  {
205
214
  success: !0
206
215
  }
207
- ), t(r);
216
+ ), t(u);
208
217
  });
209
- let h;
210
- return G(
218
+ let I;
219
+ return J(
211
220
  () => c.value,
212
221
  () => {
213
222
  var a;
214
- c.value ? h = U.loading({
223
+ c.value ? I = x.loading({
215
224
  content: c.value.text,
216
225
  id: "image-upload-id",
217
226
  duration: 0
218
- }) : (a = h == null ? void 0 : h.close) == null || a.call(h);
227
+ }) : (a = I == null ? void 0 : I.close) == null || a.call(I);
219
228
  }
220
- ), Y({
221
- uploadInsRef: C,
222
- cropperInsRef: Z
223
- }), (a, n) => {
224
- const t = ie("a-upload");
225
- return ue(), re("div", null, [
226
- de(t, {
227
- class: se([`${he}-upload`]),
229
+ ), A({
230
+ uploadInsRef: S,
231
+ cropperInsRef: O
232
+ }), (a, l) => {
233
+ const t = fe("a-upload");
234
+ return K(), ve("div", null, [
235
+ me(t, {
236
+ class: ge([`${Ee}-upload`]),
228
237
  ref_key: "uploadInsRef",
229
- ref: C,
238
+ ref: S,
230
239
  "list-type": "picture-card",
231
240
  tip: a.tip || "上传",
232
241
  "image-preview": "",
233
242
  "file-list": i.value,
234
- "onUpdate:fileList": n[0] || (n[0] = (u) => i.value = u),
243
+ "onUpdate:fileList": l[0] || (l[0] = (r) => i.value = r),
235
244
  action: a.action,
236
245
  headers: a.headers,
237
246
  data: a.data,
238
247
  name: a.name,
239
- accept: _.value,
248
+ accept: ee.value,
240
249
  multiple: a.multiple,
241
250
  limit: a.limit,
242
251
  disabled: a.disabled,
243
- "on-before-upload": A,
244
- "on-before-remove": R,
245
- onExceedLimit: ee,
246
- onSuccess: ae,
247
- onError: le
248
- }, null, 8, ["class", "tip", "file-list", "action", "headers", "data", "name", "accept", "multiple", "limit", "disabled"])
252
+ "on-before-upload": ae,
253
+ "on-before-remove": le,
254
+ onExceedLimit: oe,
255
+ onSuccess: ne,
256
+ onError: te
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, {
259
+ key: 0,
260
+ ref_key: "cropperInsRef",
261
+ ref: O,
262
+ file: g.value.file,
263
+ index: n.value,
264
+ options: B.value,
265
+ onCancel: re,
266
+ onConfirm: ue,
267
+ onImgLoad: de
268
+ }, null, 8, ["file", "index", "options"])) : Ie("", !0)
249
269
  ]);
250
270
  };
251
271
  }
252
272
  });
253
273
  export {
254
- Me as default
274
+ Fe as default
255
275
  };
@@ -1,11 +1,12 @@
1
1
  import e from "./image-upload.vue.js";
2
- import { Modal as s, Upload as t, Button as u, Tooltip as l, Spin as m, Space as n, Message as i } from "@arco-design/web-vue";
3
- const c = Object.assign(e, {
2
+ import { Modal as s, Upload as t, Button as n, Tooltip as u, Spin as m, Space as c, Message as i } from "@arco-design/web-vue";
3
+ import { IconZoomIn as r, IconZoomOut as l, IconRotateLeft as I, IconRotateRight as f, IconSync as d } from "@arco-design/web-vue/es/icon";
4
+ const S = Object.assign(e, {
4
5
  install: (o) => {
5
- o.use(s), o.use(t), o.use(u), o.use(l), o.use(m), o.use(n), o.use(i), o.component("KbProImageUpload", e);
6
+ o.use(s), o.use(t), o.use(n), o.use(u), o.use(m), o.use(c), o.use(i), o.use(r), o.use(l), o.use(I), o.use(f), o.use(d), o.component("KbProImageUpload", e);
6
7
  }
7
8
  });
8
9
  export {
9
- c as ProImageUpload,
10
- c as default
10
+ S as ProImageUpload,
11
+ S as default
11
12
  };
package/es/style.css CHANGED
@@ -1 +1 @@
1
- .keyblade-pro-page-header{background:var(--color-bg-2);padding:16px 32px}.keyblade-pro-page-header .keyblade-pro-page-header-section-breadcrumb .arco-breadcrumb-item:first-child{padding-left:0}.keyblade-pro-page-header .keyblade-pro-page-header-title.arco-typography{padding-top:4px;margin-top:0}.keyblade-pro-layout{width:100%;height:100%}.keyblade-pro-layout .keyblade-pro-layout-header{position:fixed;top:0;left:0;width:100%;height:var(--2156faf3);z-index:100;display:flex;align-items:center;justify-content:space-between;padding:0 20px;background-color:var(--color-bg-2);border-bottom:1px solid var(--color-border);transition:all .2s cubic-bezier(.34,.69,.1,1)}.keyblade-pro-layout .keyblade-pro-layout-header-left{cursor:pointer;display:flex;align-items:center}.keyblade-pro-layout .keyblade-pro-layout-header-left-logo-img{width:28px;height:28px}.keyblade-pro-layout .keyblade-pro-layout-header-left-logo-title.arco-typography{margin:0;font-size:18px}.keyblade-pro-layout .keyblade-pro-layout-header-center{flex:1}.keyblade-pro-layout .keyblade-pro-layout-sider{padding-top:var(--2156faf3);position:fixed;top:0;left:0;z-index:99;height:100%;transition:all .2s cubic-bezier(.34,.69,.1,1)}.keyblade-pro-layout .keyblade-pro-layout-sider-content{position:relative;height:100%;overflow:auto}.keyblade-pro-layout .keyblade-pro-layout-sider-collapse-btn.arco-btn{position:absolute;right:12px;bottom:12px}.keyblade-pro-layout .keyblade-pro-layout-body{padding-top:var(--2156faf3);padding-left:var(--2e3e7e4c);min-height:100vh;overflow-y:hidden;background-color:var(--color-fill-2);transition:padding .2s cubic-bezier(.34,.69,.1,1)}.keyblade-pro-layout .keyblade-pro-layout-body-affix .arco-affix{z-index:98}.keyblade-pro-layout .keyblade-pro-layout-body-footer{display:flex;align-items:center;justify-content:center;height:40px;color:var(--color-text-2);text-align:center}.keyblade-pro-layout .keyblade-pro-layout-body-collapsed{padding-left:var(--a70b89aa)}.keyblade-pro-layout-side .keyblade-pro-layout-header{z-index:98;left:var(--2e3e7e4c);width:calc(100% - var(--2e3e7e4c))}.keyblade-pro-layout-side .keyblade-pro-layout-header-collapsed{left:var(--a70b89aa);width:calc(100% - var(--a70b89aa))}.keyblade-pro-layout-side .keyblade-pro-layout-sider{padding-top:0}.keyblade-pro-layout-side .keyblade-pro-layout-sider-content-logo{position:relative;display:flex;align-items:center;padding:16px;cursor:pointer;transition:padding .3s cubic-bezier(.645,.045,.355,1)}.keyblade-pro-layout-side .keyblade-pro-layout-sider-content-logo-img{width:28px;height:28px}.keyblade-pro-layout-side .keyblade-pro-layout-sider-content-logo-title.arco-typography{margin:0;font-size:18px}.keyblade-pro-layout-side .keyblade-pro-layout-sider-collapsed .keyblade-pro-layout-sider-content-logo{padding:16px 10px}.keyblade-pro-menu .keyblade-pro-menu-item-img{width:14px;height:auto}.keyblade-pro-reuse-tabs{position:relative;background-color:var(--color-bg-2);padding:4px 20px}.keyblade-pro-page-container .keyblade-pro-page-container-content{padding:20px}
1
+ .keyblade-pro-page-header{background:var(--color-bg-2);padding:16px 32px}.keyblade-pro-page-header .keyblade-pro-page-header-section-breadcrumb .arco-breadcrumb-item:first-child{padding-left:0}.keyblade-pro-page-header .keyblade-pro-page-header-title.arco-typography{padding-top:4px;margin-top:0}.keyblade-pro-layout{width:100%;height:100%}.keyblade-pro-layout .keyblade-pro-layout-header{position:fixed;top:0;left:0;width:100%;height:var(--2156faf3);z-index:100;display:flex;align-items:center;justify-content:space-between;padding:0 20px;background-color:var(--color-bg-2);border-bottom:1px solid var(--color-border);transition:all .2s cubic-bezier(.34,.69,.1,1)}.keyblade-pro-layout .keyblade-pro-layout-header-left{cursor:pointer;display:flex;align-items:center}.keyblade-pro-layout .keyblade-pro-layout-header-left-logo-img{width:28px;height:28px}.keyblade-pro-layout .keyblade-pro-layout-header-left-logo-title.arco-typography{margin:0;font-size:18px}.keyblade-pro-layout .keyblade-pro-layout-header-center{flex:1}.keyblade-pro-layout .keyblade-pro-layout-sider{padding-top:var(--2156faf3);position:fixed;top:0;left:0;z-index:99;height:100%;transition:all .2s cubic-bezier(.34,.69,.1,1)}.keyblade-pro-layout .keyblade-pro-layout-sider-content{position:relative;height:100%;overflow:auto}.keyblade-pro-layout .keyblade-pro-layout-sider-collapse-btn.arco-btn{position:absolute;right:12px;bottom:12px}.keyblade-pro-layout .keyblade-pro-layout-body{padding-top:var(--2156faf3);padding-left:var(--2e3e7e4c);min-height:100vh;overflow-y:hidden;background-color:var(--color-fill-2);transition:padding .2s cubic-bezier(.34,.69,.1,1)}.keyblade-pro-layout .keyblade-pro-layout-body-affix .arco-affix{z-index:98}.keyblade-pro-layout .keyblade-pro-layout-body-footer{display:flex;align-items:center;justify-content:center;height:40px;color:var(--color-text-2);text-align:center}.keyblade-pro-layout .keyblade-pro-layout-body-collapsed{padding-left:var(--a70b89aa)}.keyblade-pro-layout-side .keyblade-pro-layout-header{z-index:98;left:var(--2e3e7e4c);width:calc(100% - var(--2e3e7e4c))}.keyblade-pro-layout-side .keyblade-pro-layout-header-collapsed{left:var(--a70b89aa);width:calc(100% - var(--a70b89aa))}.keyblade-pro-layout-side .keyblade-pro-layout-sider{padding-top:0}.keyblade-pro-layout-side .keyblade-pro-layout-sider-content-logo{position:relative;display:flex;align-items:center;padding:16px;cursor:pointer;transition:padding .3s cubic-bezier(.645,.045,.355,1)}.keyblade-pro-layout-side .keyblade-pro-layout-sider-content-logo-img{width:28px;height:28px}.keyblade-pro-layout-side .keyblade-pro-layout-sider-content-logo-title.arco-typography{margin:0;font-size:18px}.keyblade-pro-layout-side .keyblade-pro-layout-sider-collapsed .keyblade-pro-layout-sider-content-logo{padding:16px 10px}.keyblade-pro-menu .keyblade-pro-menu-item-img{width:14px;height:auto}.keyblade-pro-reuse-tabs{position:relative;background-color:var(--color-bg-2);padding:4px 20px}.keyblade-pro-page-container .keyblade-pro-page-container-content{padding:20px}.keyblade-pro-image-upload-cropper-dialog-cropper-wrapper[data-v-ae8ab9e0]{width:100%;height:400px}.keyblade-pro-image-upload-cropper-dialog-operate[data-v-ae8ab9e0]{margin-top:24px;display:flex;align-items:center;justify-content:center}.keyblade-pro-image-upload-cropper-dialog-footer[data-v-ae8ab9e0]{margin-top:24px;display:flex;align-items:center;justify-content:flex-end}.keyblade-pro-image-upload-cropper-dialog-footer-left[data-v-ae8ab9e0]{display:flex;align-items:center;justify-content:flex-start;margin-right:12px}.keyblade-pro-image-upload-cropper-dialog-footer-right[data-v-ae8ab9e0]{flex:1;display:flex;align-items:center;justify-content:flex-end}
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.1-alpha.19",
5
+ "version": "1.12.1-alpha.21",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",