@keyblade/pro-components 1.12.0-alpha.3 → 1.12.0-alpha.5
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.
- package/es/pro-image-upload/image-upload.vue.d.ts +3 -3
- package/es/pro-image-upload/image-upload.vue.js +92 -176
- package/es/pro-image-upload/index.d.ts +3 -3
- package/es/style.css +1 -1
- package/package.json +1 -1
- package/es/_virtual/_plugin-vue_export-helper.js +0 -9
- package/es/pro-image-upload/cropper.vue.d.ts +0 -41
- package/es/pro-image-upload/cropper.vue.js +0 -7
- package/es/pro-image-upload/cropper.vue2.js +0 -211
- package/es/pro-image-upload/cropper.vue3.js +0 -1
|
@@ -198,7 +198,7 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
198
198
|
}>;
|
|
199
199
|
$root: import('vue').ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import('vue').ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
200
200
|
$parent: import('vue').ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import('vue').ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
201
|
-
$emit: ((event: "error", fileItem: FileItem) => void) & ((event: "success", fileItem: FileItem) => void) & ((event: "progress", fileItem: FileItem, ev?: ProgressEvent<EventTarget> | undefined) => void) & ((event: "
|
|
201
|
+
$emit: ((event: "error", fileItem: FileItem) => void) & ((event: "success", fileItem: FileItem) => void) & ((event: "progress", fileItem: FileItem, ev?: ProgressEvent<EventTarget> | undefined) => void) & ((event: "change", fileList: FileItem[], fileItem: FileItem) => void) & ((event: "update:fileList", fileList: FileItem[]) => void) & ((event: "exceedLimit", fileList: FileItem[], files: File[]) => void) & ((event: "preview", fileItem: FileItem) => void);
|
|
202
202
|
$el: any;
|
|
203
203
|
$options: import('vue').ComponentOptionsBase<Readonly<{
|
|
204
204
|
fileList?: unknown;
|
|
@@ -207,7 +207,7 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
207
207
|
action?: unknown;
|
|
208
208
|
disabled?: unknown;
|
|
209
209
|
multiple?: unknown;
|
|
210
|
-
directory?: unknown;
|
|
210
|
+
directory?: unknown; /** 选择的数量 */
|
|
211
211
|
draggable?: unknown;
|
|
212
212
|
tip?: unknown;
|
|
213
213
|
headers?: unknown;
|
|
@@ -346,7 +346,7 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
346
346
|
action?: unknown;
|
|
347
347
|
disabled?: unknown;
|
|
348
348
|
multiple?: unknown;
|
|
349
|
-
directory?: unknown;
|
|
349
|
+
directory?: unknown; /** 选择的数量 */
|
|
350
350
|
draggable?: unknown;
|
|
351
351
|
tip?: unknown;
|
|
352
352
|
headers?: unknown;
|
|
@@ -1,30 +1,28 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Message as
|
|
3
|
-
import { conclude as
|
|
4
|
-
import { EImageUploadInnerBeforeUploadStep as
|
|
5
|
-
import { defaultImageUploadOptions as
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
var K, X, Y;
|
|
10
|
-
const Oe = /* @__PURE__ */ ue({
|
|
1
|
+
import { defineComponent as V, ref as d, computed as U, watch as F, openBlock as X, createElementBlock as Y } from "vue";
|
|
2
|
+
import { Message as I } from "@arco-design/web-vue";
|
|
3
|
+
import { conclude as x } from "vue-global-config";
|
|
4
|
+
import { EImageUploadInnerBeforeUploadStep as i } from "./types.js";
|
|
5
|
+
import { defaultImageUploadOptions as m } from "./constant.js";
|
|
6
|
+
import { defaultImageUploadCheckOptions as Z, defaultImageUploadCompressorOptions as N, defaultImageUploadCropOptions as A, oneTravelImageCheckAndTransform as R, oneTravelImageCompressor as ee } from "@keyblade/one-travel";
|
|
7
|
+
var T, q, P;
|
|
8
|
+
const de = /* @__PURE__ */ V({
|
|
11
9
|
__name: "image-upload",
|
|
12
10
|
props: {
|
|
13
11
|
action: {},
|
|
14
12
|
handlerResponse: {},
|
|
15
13
|
headers: {},
|
|
16
14
|
data: {},
|
|
17
|
-
name: { default: (
|
|
15
|
+
name: { default: (T = m) == null ? void 0 : T.name },
|
|
18
16
|
tip: {},
|
|
19
17
|
accept: { default: () => {
|
|
20
|
-
var
|
|
21
|
-
return ((
|
|
18
|
+
var g;
|
|
19
|
+
return ((g = m) == null ? void 0 : g.accept) || [];
|
|
22
20
|
} },
|
|
23
|
-
multiple: { type: Boolean, default:
|
|
24
|
-
singleLimit: { default:
|
|
21
|
+
multiple: { type: Boolean, default: m.multiple },
|
|
22
|
+
singleLimit: { default: m.singleLimit },
|
|
25
23
|
limit: {},
|
|
26
|
-
disabled: { type: Boolean, default: (
|
|
27
|
-
hideInnerBeforeUploadLoading: { type: Boolean, default: (
|
|
24
|
+
disabled: { type: Boolean, default: (q = m) == null ? void 0 : q.disabled },
|
|
25
|
+
hideInnerBeforeUploadLoading: { type: Boolean, default: (P = m) == null ? void 0 : P.hideInnerBeforeUploadLoading },
|
|
28
26
|
checkOptions: {},
|
|
29
27
|
compressorOptions: {},
|
|
30
28
|
cropOptions: {},
|
|
@@ -36,127 +34,83 @@ const Oe = /* @__PURE__ */ ue({
|
|
|
36
34
|
onInnerBeforeUploadEnd: {}
|
|
37
35
|
},
|
|
38
36
|
emits: ["cropperImgLoad"],
|
|
39
|
-
setup(
|
|
40
|
-
const e =
|
|
37
|
+
setup(g, { expose: D, emit: ae }) {
|
|
38
|
+
const e = g;
|
|
39
|
+
defineModel({ required: !0 });
|
|
40
|
+
const G = d(), J = d(), B = d(), M = d(
|
|
41
41
|
[]
|
|
42
|
-
), o =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
E(await oe(a));
|
|
50
|
-
} catch {
|
|
51
|
-
w();
|
|
52
|
-
} finally {
|
|
53
|
-
$();
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}, ee = async (a) => {
|
|
57
|
-
const l = i.value.findIndex((t) => t.uid === a.uid);
|
|
58
|
-
return i.value.splice(l, 1), i.value = [...i.value], !1;
|
|
59
|
-
}, ae = (a, l) => {
|
|
60
|
-
e != null && e.onExceed ? e == null || e.onExceed(a, l) : (x.error(`单次最多可选择${(e == null ? void 0 : e.limit) || 1}张图片`), i.value = a);
|
|
61
|
-
}, le = async (a) => {
|
|
62
|
-
if (e != null && e.onSuccess)
|
|
63
|
-
e == null || e.onSuccess(a);
|
|
64
|
-
else {
|
|
65
|
-
if (!(e != null && e.handlerResponse))
|
|
66
|
-
return;
|
|
67
|
-
const l = await e.handlerResponse(a.response), t = i.value.findIndex((r) => r.uid === a.uid);
|
|
68
|
-
l.success ? i.value[t] = {
|
|
69
|
-
...i.value[t],
|
|
70
|
-
...l
|
|
71
|
-
} : i.value.splice(t, 1);
|
|
72
|
-
}
|
|
73
|
-
}, ne = (a) => {
|
|
74
|
-
e != null && e.onError ? e == null || e.onError(a) : setTimeout(() => {
|
|
75
|
-
const l = i.value.findIndex((t) => t.uid === a.uid);
|
|
76
|
-
i.value.splice(l, 1);
|
|
77
|
-
});
|
|
78
|
-
}, oe = (a) => new Promise((l, t) => {
|
|
79
|
-
p.value.push({ file: a, resolve: l, reject: t }), p.value.length === 1 && !o.value && $();
|
|
80
|
-
}), $ = () => {
|
|
81
|
-
o.value === void 0 ? o.value = 0 : o.value + 1 >= p.value.length ? (o.value = void 0, p.value = []) : o.value += 1;
|
|
82
|
-
}, te = () => {
|
|
83
|
-
var a;
|
|
84
|
-
(a = g.value) == null || a.reject();
|
|
85
|
-
}, ie = (a) => {
|
|
86
|
-
var l;
|
|
87
|
-
(l = g.value) == null || l.resolve(a);
|
|
88
|
-
}, re = (a) => {
|
|
89
|
-
_("cropperImgLoad", a);
|
|
90
|
-
};
|
|
91
|
-
G(o, async () => {
|
|
92
|
-
var E, w, b, k, F, z, j, Q, H, W, N, P, T, q, V, D;
|
|
93
|
-
if (o.value === void 0 || p.value.length === 0)
|
|
42
|
+
), o = d(), r = d();
|
|
43
|
+
d(), U(() => e.accept.map((u) => `.${u}`).join(","));
|
|
44
|
+
const n = U(() => x([e.checkOptions, Z]) || {}), v = U(() => x([e.compressorOptions, N]) || {}), p = U(() => x([e.cropOptions, A]) || {});
|
|
45
|
+
F(o, async () => {
|
|
46
|
+
var w, y, E, O, C, S, b, z, _, j, L, $, H, W, k, Q;
|
|
47
|
+
if (o.value === void 0 || M.value.length === 0)
|
|
94
48
|
return;
|
|
95
|
-
const
|
|
96
|
-
let s = l.name,
|
|
97
|
-
if ((
|
|
98
|
-
|
|
49
|
+
const u = M.value[o.value], { file: l, resolve: K, reject: h } = u;
|
|
50
|
+
let s = l.name, t = l;
|
|
51
|
+
if ((w = n.value) != null && w.enable) {
|
|
52
|
+
r.value = {
|
|
99
53
|
loading: !0,
|
|
100
54
|
text: `第${o.value + 1}张图片检测中,请稍等`
|
|
101
|
-
}, (
|
|
55
|
+
}, (y = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || y.call(
|
|
102
56
|
e,
|
|
103
57
|
l,
|
|
104
58
|
o.value,
|
|
105
|
-
|
|
59
|
+
i.check
|
|
106
60
|
);
|
|
107
|
-
const
|
|
108
|
-
imageMaxSize:
|
|
109
|
-
imageAllowedType:
|
|
110
|
-
imageMinWidth:
|
|
111
|
-
imageMinHeight:
|
|
112
|
-
imageMaxWidth:
|
|
113
|
-
imageMaxHeight:
|
|
61
|
+
const a = await R(l, l.name, {
|
|
62
|
+
imageMaxSize: n.value.maxSize,
|
|
63
|
+
imageAllowedType: n.value.allowedType,
|
|
64
|
+
imageMinWidth: n.value.minWidth,
|
|
65
|
+
imageMinHeight: n.value.minHeight,
|
|
66
|
+
imageMaxWidth: n.value.maxWidth,
|
|
67
|
+
imageMaxHeight: n.value.maxHeight
|
|
114
68
|
});
|
|
115
|
-
if (
|
|
69
|
+
if (r.value = void 0, (E = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || E.call(
|
|
116
70
|
e,
|
|
117
71
|
l,
|
|
118
72
|
o.value,
|
|
119
|
-
|
|
73
|
+
i.check,
|
|
120
74
|
{
|
|
121
|
-
success:
|
|
122
|
-
error:
|
|
123
|
-
errorMessage:
|
|
75
|
+
success: a.success,
|
|
76
|
+
error: a == null ? void 0 : a.error,
|
|
77
|
+
errorMessage: a == null ? void 0 : a.errorMessage
|
|
124
78
|
}
|
|
125
|
-
), !
|
|
126
|
-
return (
|
|
127
|
-
if (
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
type:
|
|
79
|
+
), !a.success)
|
|
80
|
+
return (O = n.value) != null && O.showErrorMessage && I.error((a == null ? void 0 : a.errorMessage) || "图片校验及转换失败"), h();
|
|
81
|
+
if (a != null && a.hasTransform) {
|
|
82
|
+
const f = s == null ? void 0 : s.split(".");
|
|
83
|
+
f.pop(), s = `${f.join(",")}.jpg`, t = new File([a.file], s, {
|
|
84
|
+
type: a.file.type
|
|
131
85
|
});
|
|
132
86
|
} else
|
|
133
|
-
|
|
87
|
+
t = a.file;
|
|
134
88
|
}
|
|
135
|
-
if ((
|
|
136
|
-
(
|
|
89
|
+
if ((C = p.value) != null && C.enable) {
|
|
90
|
+
(S = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || S.call(
|
|
137
91
|
e,
|
|
138
92
|
l,
|
|
139
93
|
o.value,
|
|
140
|
-
|
|
94
|
+
i.crop
|
|
141
95
|
);
|
|
142
96
|
try {
|
|
143
|
-
(
|
|
144
|
-
|
|
145
|
-
}), (
|
|
97
|
+
(b = p.value) != null && b.customCrop ? t = await p.value.customCrop(t) : t = await new Promise((a, f) => {
|
|
98
|
+
B.value = { file: t, resolve: a, reject: f };
|
|
99
|
+
}), (z = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || z.call(
|
|
146
100
|
e,
|
|
147
101
|
l,
|
|
148
102
|
o.value,
|
|
149
|
-
|
|
103
|
+
i.crop,
|
|
150
104
|
{
|
|
151
105
|
success: !1
|
|
152
106
|
}
|
|
153
107
|
);
|
|
154
108
|
} catch {
|
|
155
|
-
return (
|
|
109
|
+
return (_ = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || _.call(
|
|
156
110
|
e,
|
|
157
111
|
l,
|
|
158
112
|
o.value,
|
|
159
|
-
|
|
113
|
+
i.crop,
|
|
160
114
|
{
|
|
161
115
|
success: !1,
|
|
162
116
|
error: {
|
|
@@ -164,109 +118,71 @@ const Oe = /* @__PURE__ */ ue({
|
|
|
164
118
|
},
|
|
165
119
|
errorMessage: "图片剪裁失败"
|
|
166
120
|
}
|
|
167
|
-
), (
|
|
121
|
+
), (j = p.value) != null && j.showErrorMessage && I.error("图片剪裁失败"), h();
|
|
168
122
|
} finally {
|
|
169
|
-
|
|
123
|
+
B.value = void 0;
|
|
170
124
|
}
|
|
171
125
|
}
|
|
172
|
-
if ((
|
|
173
|
-
|
|
126
|
+
if ((L = v.value) != null && L.enable) {
|
|
127
|
+
r.value = {
|
|
174
128
|
loading: !0,
|
|
175
129
|
text: `第${o.value + 1}张图片处理中,请稍等`
|
|
176
|
-
}, (
|
|
130
|
+
}, ($ = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || $.call(
|
|
177
131
|
e,
|
|
178
132
|
l,
|
|
179
133
|
o.value,
|
|
180
|
-
|
|
134
|
+
i.compress
|
|
181
135
|
);
|
|
182
|
-
const
|
|
183
|
-
maxSize:
|
|
184
|
-
size:
|
|
185
|
-
excludeAllowedTypes: (
|
|
136
|
+
const a = await ee(t, {
|
|
137
|
+
maxSize: v.value.maxSize,
|
|
138
|
+
size: v.value.size,
|
|
139
|
+
excludeAllowedTypes: (H = v.value.excludeAllowedTypes) == null ? void 0 : H.map((f) => `image/${f}`)
|
|
186
140
|
});
|
|
187
|
-
if (
|
|
141
|
+
if (r.value = void 0, (W = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || W.call(
|
|
188
142
|
e,
|
|
189
143
|
l,
|
|
190
144
|
o.value,
|
|
191
|
-
|
|
145
|
+
i.compress,
|
|
192
146
|
{
|
|
193
|
-
success:
|
|
147
|
+
success: a.success,
|
|
194
148
|
error: {
|
|
195
149
|
compress: !0
|
|
196
150
|
},
|
|
197
|
-
errorMessage:
|
|
151
|
+
errorMessage: a == null ? void 0 : a.errorMessage
|
|
198
152
|
}
|
|
199
|
-
), !
|
|
200
|
-
return (
|
|
201
|
-
|
|
202
|
-
type:
|
|
153
|
+
), !a.success)
|
|
154
|
+
return (k = v.value) != null && k.showErrorMessage && I.error((a == null ? void 0 : a.errorMessage) || "图片压缩失败"), h();
|
|
155
|
+
t = new File([a.file], s, {
|
|
156
|
+
type: a.file.type
|
|
203
157
|
});
|
|
204
158
|
}
|
|
205
|
-
|
|
159
|
+
r.value = void 0, (Q = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || Q.call(
|
|
206
160
|
e,
|
|
207
161
|
l,
|
|
208
162
|
o.value,
|
|
209
|
-
|
|
163
|
+
i.all,
|
|
210
164
|
{
|
|
211
165
|
success: !0
|
|
212
166
|
}
|
|
213
|
-
), t
|
|
167
|
+
), K(t);
|
|
214
168
|
});
|
|
215
|
-
let
|
|
216
|
-
return
|
|
217
|
-
() =>
|
|
169
|
+
let c;
|
|
170
|
+
return F(
|
|
171
|
+
() => r.value,
|
|
218
172
|
() => {
|
|
219
|
-
var
|
|
220
|
-
|
|
221
|
-
content:
|
|
173
|
+
var u;
|
|
174
|
+
r.value ? c = I.loading({
|
|
175
|
+
content: r.value.text,
|
|
222
176
|
id: "image-upload-id",
|
|
223
177
|
duration: 0
|
|
224
|
-
}) : (
|
|
178
|
+
}) : (u = c == null ? void 0 : c.close) == null || u.call(c);
|
|
225
179
|
}
|
|
226
|
-
),
|
|
227
|
-
uploadInsRef:
|
|
228
|
-
cropperInsRef:
|
|
229
|
-
}), (
|
|
230
|
-
const t = de("a-upload");
|
|
231
|
-
return J(), se("div", null, [
|
|
232
|
-
ce(t, {
|
|
233
|
-
class: fe([`${Ce}-upload`]),
|
|
234
|
-
ref_key: "uploadInsRef",
|
|
235
|
-
ref: S,
|
|
236
|
-
"list-type": "picture-card",
|
|
237
|
-
tip: a.tip || "上传",
|
|
238
|
-
"image-preview": "",
|
|
239
|
-
"file-list": i.value,
|
|
240
|
-
"onUpdate:fileList": l[0] || (l[0] = (r) => i.value = r),
|
|
241
|
-
action: a.action,
|
|
242
|
-
headers: a.headers,
|
|
243
|
-
data: a.data,
|
|
244
|
-
name: a.name,
|
|
245
|
-
accept: A.value,
|
|
246
|
-
multiple: a.multiple,
|
|
247
|
-
limit: a.limit,
|
|
248
|
-
disabled: a.disabled,
|
|
249
|
-
"on-before-upload": R,
|
|
250
|
-
"on-before-remove": ee,
|
|
251
|
-
onExceedLimit: ae,
|
|
252
|
-
onSuccess: le,
|
|
253
|
-
onError: ne
|
|
254
|
-
}, null, 8, ["class", "tip", "file-list", "action", "headers", "data", "name", "accept", "multiple", "limit", "disabled"]),
|
|
255
|
-
g.value && o.value !== void 0 ? (J(), ve(ge, {
|
|
256
|
-
key: 0,
|
|
257
|
-
ref_key: "cropperInsRef",
|
|
258
|
-
ref: O,
|
|
259
|
-
file: g.value.file,
|
|
260
|
-
index: o.value,
|
|
261
|
-
options: y.value,
|
|
262
|
-
onCancel: te,
|
|
263
|
-
onConfirm: ie,
|
|
264
|
-
onImgLoad: re
|
|
265
|
-
}, null, 8, ["file", "index", "options"])) : me("", !0)
|
|
266
|
-
]);
|
|
267
|
-
};
|
|
180
|
+
), D({
|
|
181
|
+
uploadInsRef: G,
|
|
182
|
+
cropperInsRef: J
|
|
183
|
+
}), (u, l) => (X(), Y("div"));
|
|
268
184
|
}
|
|
269
185
|
});
|
|
270
186
|
export {
|
|
271
|
-
|
|
187
|
+
de as default
|
|
272
188
|
};
|
|
@@ -297,7 +297,7 @@ declare const ProImageUpload: {
|
|
|
297
297
|
}>;
|
|
298
298
|
$root: import('vue').ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import('vue').ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
299
299
|
$parent: import('vue').ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import('vue').ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
300
|
-
$emit: ((event: "error", fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "success", fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "progress", fileItem: import('@arco-design/web-vue').FileItem, ev?: ProgressEvent<EventTarget> | undefined) => void) & ((event: "
|
|
300
|
+
$emit: ((event: "error", fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "success", fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "progress", fileItem: import('@arco-design/web-vue').FileItem, ev?: ProgressEvent<EventTarget> | undefined) => void) & ((event: "change", fileList: import('@arco-design/web-vue').FileItem[], fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "update:fileList", fileList: import('@arco-design/web-vue').FileItem[]) => void) & ((event: "exceedLimit", fileList: import('@arco-design/web-vue').FileItem[], files: File[]) => void) & ((event: "preview", fileItem: import('@arco-design/web-vue').FileItem) => void);
|
|
301
301
|
$el: any;
|
|
302
302
|
$options: import('vue').ComponentOptionsBase<Readonly<{
|
|
303
303
|
fileList?: unknown;
|
|
@@ -753,7 +753,7 @@ declare const ProImageUpload: {
|
|
|
753
753
|
}>;
|
|
754
754
|
$root: import('vue').ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import('vue').ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
755
755
|
$parent: import('vue').ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import('vue').ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
756
|
-
$emit: ((event: "error", fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "success", fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "progress", fileItem: import('@arco-design/web-vue').FileItem, ev?: ProgressEvent<EventTarget> | undefined) => void) & ((event: "
|
|
756
|
+
$emit: ((event: "error", fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "success", fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "progress", fileItem: import('@arco-design/web-vue').FileItem, ev?: ProgressEvent<EventTarget> | undefined) => void) & ((event: "change", fileList: import('@arco-design/web-vue').FileItem[], fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "update:fileList", fileList: import('@arco-design/web-vue').FileItem[]) => void) & ((event: "exceedLimit", fileList: import('@arco-design/web-vue').FileItem[], files: File[]) => void) & ((event: "preview", fileItem: import('@arco-design/web-vue').FileItem) => void);
|
|
757
757
|
$el: any;
|
|
758
758
|
$options: import('vue').ComponentOptionsBase<Readonly<{
|
|
759
759
|
fileList?: unknown;
|
|
@@ -1184,7 +1184,7 @@ declare const ProImageUpload: {
|
|
|
1184
1184
|
}>;
|
|
1185
1185
|
$root: import('vue').ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import('vue').ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
1186
1186
|
$parent: import('vue').ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import('vue').ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
1187
|
-
$emit: ((event: "error", fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "success", fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "progress", fileItem: import('@arco-design/web-vue').FileItem, ev?: ProgressEvent<EventTarget> | undefined) => void) & ((event: "
|
|
1187
|
+
$emit: ((event: "error", fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "success", fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "progress", fileItem: import('@arco-design/web-vue').FileItem, ev?: ProgressEvent<EventTarget> | undefined) => void) & ((event: "change", fileList: import('@arco-design/web-vue').FileItem[], fileItem: import('@arco-design/web-vue').FileItem) => void) & ((event: "update:fileList", fileList: import('@arco-design/web-vue').FileItem[]) => void) & ((event: "exceedLimit", fileList: import('@arco-design/web-vue').FileItem[], files: File[]) => void) & ((event: "preview", fileItem: import('@arco-design/web-vue').FileItem) => void);
|
|
1188
1188
|
$el: any;
|
|
1189
1189
|
$options: import('vue').ComponentOptionsBase<Readonly<{
|
|
1190
1190
|
fileList?: unknown;
|
package/es/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.keyblade-pro-
|
|
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-page-container .keyblade-pro-page-container-content{padding:20px}.keyblade-pro-reuse-tabs{position:relative;background-color:var(--color-bg-2);padding:4px 20px}.keyblade-pro-menu .keyblade-pro-menu-item-img{width:14px;height:auto}
|
package/package.json
CHANGED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ImageUploadCropOptions } from '@keyblade/one-travel';
|
|
2
|
-
|
|
3
|
-
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
|
-
file: File;
|
|
5
|
-
index: number;
|
|
6
|
-
options: ImageUploadCropOptions;
|
|
7
|
-
}>, {}>, {
|
|
8
|
-
cropperInsRef: import('vue').Ref<any>;
|
|
9
|
-
}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
10
|
-
cancel: () => void;
|
|
11
|
-
confirm: (value: File) => void;
|
|
12
|
-
imgLoad: (value: File) => void;
|
|
13
|
-
reUpload: (index: number) => void;
|
|
14
|
-
}, string, import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
15
|
-
file: File;
|
|
16
|
-
index: number;
|
|
17
|
-
options: ImageUploadCropOptions;
|
|
18
|
-
}>, {}>>> & {
|
|
19
|
-
onCancel?: (() => any) | undefined;
|
|
20
|
-
onConfirm?: ((value: File) => any) | undefined;
|
|
21
|
-
onImgLoad?: ((value: File) => any) | undefined;
|
|
22
|
-
onReUpload?: ((index: number) => any) | undefined;
|
|
23
|
-
}, {}, {}>;
|
|
24
|
-
export default _default;
|
|
25
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
26
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
27
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
28
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
29
|
-
} : {
|
|
30
|
-
type: import('vue').PropType<T[K]>;
|
|
31
|
-
required: true;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
type __VLS_WithDefaults<P, D> = {
|
|
35
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
36
|
-
default: D[K];
|
|
37
|
-
}> : P[K];
|
|
38
|
-
};
|
|
39
|
-
type __VLS_Prettify<T> = {
|
|
40
|
-
[K in keyof T]: T[K];
|
|
41
|
-
} & {};
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { defineComponent as j, ref as d, watch as D, resolveComponent as l, openBlock as M, createBlock as P, normalizeClass as _, withCtx as a, createVNode as e, mergeProps as q, createElementVNode as y, createTextVNode as x, nextTick as C } from "vue";
|
|
2
|
-
import "vue-cropper/dist/index.css";
|
|
3
|
-
import G from "vue-cropper/lib/vue-cropper.vue";
|
|
4
|
-
const i = "keyblade-pro-image-upload-cropper", Q = /* @__PURE__ */ j({
|
|
5
|
-
__name: "cropper",
|
|
6
|
-
props: {
|
|
7
|
-
file: {},
|
|
8
|
-
index: {},
|
|
9
|
-
options: {}
|
|
10
|
-
},
|
|
11
|
-
emits: ["cancel", "confirm", "imgLoad", "reUpload"],
|
|
12
|
-
setup(H, { expose: R, emit: f }) {
|
|
13
|
-
const s = H, o = d(), w = d(), u = d(!0), g = d(!1), m = d({
|
|
14
|
-
autoCropWidth: 100,
|
|
15
|
-
autoCropHeight: 100
|
|
16
|
-
}), W = () => {
|
|
17
|
-
o.value.changeScale(1);
|
|
18
|
-
}, z = () => {
|
|
19
|
-
o.value.changeScale(-1);
|
|
20
|
-
}, I = () => {
|
|
21
|
-
o.value.rotateRight();
|
|
22
|
-
const { w: t, h: n } = v();
|
|
23
|
-
C(() => {
|
|
24
|
-
o.value.goAutoCrop(t, n);
|
|
25
|
-
});
|
|
26
|
-
}, L = () => {
|
|
27
|
-
o.value.rotateLeft();
|
|
28
|
-
const { w: t, h: n } = v();
|
|
29
|
-
C(() => {
|
|
30
|
-
o.value.goAutoCrop(t, n);
|
|
31
|
-
});
|
|
32
|
-
}, $ = () => {
|
|
33
|
-
o.value.reload(), o.value.rotateClear(), C(() => {
|
|
34
|
-
o.value.goAutoCrop();
|
|
35
|
-
});
|
|
36
|
-
}, b = () => {
|
|
37
|
-
f("cancel");
|
|
38
|
-
}, N = () => {
|
|
39
|
-
u.value || g.value || (g.value = !0, o.value.getCropBlob((t) => {
|
|
40
|
-
g.value = !1;
|
|
41
|
-
const n = new File([t], s.file.name, { type: "image/jpeg" });
|
|
42
|
-
f("confirm", n);
|
|
43
|
-
}));
|
|
44
|
-
}, S = () => {
|
|
45
|
-
u.value = !1;
|
|
46
|
-
const { w: t, h: n } = v();
|
|
47
|
-
m.value.autoCropWidth = t, m.value.autoCropHeight = n, f("imgLoad", s.file);
|
|
48
|
-
}, v = () => {
|
|
49
|
-
const t = Math.abs(o.value.rotate) % 2 > 0, n = (t ? o.value.trueHeight : o.value.trueWidth) * o.value.scale, r = (t ? o.value.trueWidth : o.value.trueHeight) * o.value.scale;
|
|
50
|
-
return { w: n, h: r };
|
|
51
|
-
};
|
|
52
|
-
return D(
|
|
53
|
-
() => s.file,
|
|
54
|
-
() => {
|
|
55
|
-
if (s.file) {
|
|
56
|
-
u.value = !0, o.value && o.value.clearCrop();
|
|
57
|
-
const t = new FileReader();
|
|
58
|
-
t.onloadend = () => {
|
|
59
|
-
const n = t.result, r = new Image();
|
|
60
|
-
r.onload = () => {
|
|
61
|
-
const h = r.width, c = r.height;
|
|
62
|
-
w.value = {
|
|
63
|
-
data: n,
|
|
64
|
-
width: h,
|
|
65
|
-
height: c
|
|
66
|
-
};
|
|
67
|
-
}, r.src = n;
|
|
68
|
-
}, t.readAsDataURL(s.file);
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
{ immediate: !0 }
|
|
72
|
-
), R({
|
|
73
|
-
cropperInsRef: o
|
|
74
|
-
}), (t, n) => {
|
|
75
|
-
const r = l("a-spin"), h = l("icon-zoom-in"), c = l("a-button"), p = l("a-tooltip"), A = l("icon-zoom-out"), B = l("icon-rotate-right"), V = l("icon-rotate-left"), E = l("icon-sync"), F = l("a-button-group"), T = l("a-space"), U = l("a-modal");
|
|
76
|
-
return M(), P(U, {
|
|
77
|
-
"render-to-body": "",
|
|
78
|
-
class: _(`${i}-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: a(() => [
|
|
89
|
-
e(r, {
|
|
90
|
-
class: _(`${i}-dialog-cropper-wrapper`),
|
|
91
|
-
loading: u.value
|
|
92
|
-
}, {
|
|
93
|
-
default: a(() => {
|
|
94
|
-
var k;
|
|
95
|
-
return [
|
|
96
|
-
e(G, q({
|
|
97
|
-
ref_key: "cropperInsRef",
|
|
98
|
-
ref: o,
|
|
99
|
-
class: `${i}-dialog-cropper`,
|
|
100
|
-
img: (k = w.value) == null ? void 0 : k.data,
|
|
101
|
-
info: !1,
|
|
102
|
-
autoCrop: !0,
|
|
103
|
-
autoCropWidth: m.value.autoCropWidth,
|
|
104
|
-
autoCropHeight: m.value.autoCropHeight,
|
|
105
|
-
full: !0
|
|
106
|
-
}, t.options, { onImgLoad: S }), null, 16, ["class", "img", "autoCropWidth", "autoCropHeight"])
|
|
107
|
-
];
|
|
108
|
-
}),
|
|
109
|
-
_: 1
|
|
110
|
-
}, 8, ["class", "loading"]),
|
|
111
|
-
y("div", {
|
|
112
|
-
class: _(`${i}-dialog-operate`)
|
|
113
|
-
}, [
|
|
114
|
-
e(F, { type: "primary" }, {
|
|
115
|
-
default: a(() => [
|
|
116
|
-
e(p, { content: "放大" }, {
|
|
117
|
-
default: a(() => [
|
|
118
|
-
e(c, { onClick: W }, {
|
|
119
|
-
icon: a(() => [
|
|
120
|
-
e(h)
|
|
121
|
-
]),
|
|
122
|
-
_: 1
|
|
123
|
-
})
|
|
124
|
-
]),
|
|
125
|
-
_: 1
|
|
126
|
-
}),
|
|
127
|
-
e(p, { content: "缩小" }, {
|
|
128
|
-
default: a(() => [
|
|
129
|
-
e(c, { onClick: z }, {
|
|
130
|
-
icon: a(() => [
|
|
131
|
-
e(A)
|
|
132
|
-
]),
|
|
133
|
-
_: 1
|
|
134
|
-
})
|
|
135
|
-
]),
|
|
136
|
-
_: 1
|
|
137
|
-
}),
|
|
138
|
-
e(p, { content: "向右旋转" }, {
|
|
139
|
-
default: a(() => [
|
|
140
|
-
e(c, { onClick: I }, {
|
|
141
|
-
icon: a(() => [
|
|
142
|
-
e(B)
|
|
143
|
-
]),
|
|
144
|
-
_: 1
|
|
145
|
-
})
|
|
146
|
-
]),
|
|
147
|
-
_: 1
|
|
148
|
-
}),
|
|
149
|
-
e(p, { content: "向左旋转" }, {
|
|
150
|
-
default: a(() => [
|
|
151
|
-
e(c, { onClick: L }, {
|
|
152
|
-
icon: a(() => [
|
|
153
|
-
e(V)
|
|
154
|
-
]),
|
|
155
|
-
_: 1
|
|
156
|
-
})
|
|
157
|
-
]),
|
|
158
|
-
_: 1
|
|
159
|
-
}),
|
|
160
|
-
e(p, { content: "重置" }, {
|
|
161
|
-
default: a(() => [
|
|
162
|
-
e(c, { onClick: $ }, {
|
|
163
|
-
icon: a(() => [
|
|
164
|
-
e(E)
|
|
165
|
-
]),
|
|
166
|
-
_: 1
|
|
167
|
-
})
|
|
168
|
-
]),
|
|
169
|
-
_: 1
|
|
170
|
-
})
|
|
171
|
-
]),
|
|
172
|
-
_: 1
|
|
173
|
-
})
|
|
174
|
-
], 2),
|
|
175
|
-
y("div", {
|
|
176
|
-
class: _(`${i}-dialog-footer`)
|
|
177
|
-
}, [
|
|
178
|
-
e(T, {
|
|
179
|
-
class: _(`${i}-dialog-footer-right`)
|
|
180
|
-
}, {
|
|
181
|
-
default: a(() => [
|
|
182
|
-
e(c, { onClick: b }, {
|
|
183
|
-
default: a(() => [
|
|
184
|
-
x("取消")
|
|
185
|
-
]),
|
|
186
|
-
_: 1
|
|
187
|
-
}),
|
|
188
|
-
e(c, {
|
|
189
|
-
disabled: u.value,
|
|
190
|
-
type: "primary",
|
|
191
|
-
onClick: N,
|
|
192
|
-
loading: g.value
|
|
193
|
-
}, {
|
|
194
|
-
default: a(() => [
|
|
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
|
-
Q as default
|
|
211
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|