@keyblade/pro-components 1.12.0-alpha.2 → 1.12.0-alpha.4
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/index.d.ts +1 -0
- package/es/index.js +23 -19
- package/es/pro-image-upload/image-upload.vue.js +105 -125
- package/es/pro-image-upload/index.d.ts +2 -0
- package/es/pro-image-upload/index.js +2 -2
- 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
package/es/index.d.ts
CHANGED
|
@@ -13,4 +13,5 @@ export { default as ProPageContainer } from './pro-page-container';
|
|
|
13
13
|
export { default as ProReuseTabs } from './pro-reuse-tabs';
|
|
14
14
|
export type { IProTab } from './pro-reuse-tabs';
|
|
15
15
|
export { default as ProImageUpload } from './pro-image-upload';
|
|
16
|
+
export * from './pro-image-upload';
|
|
16
17
|
export type {} from './components';
|
package/es/index.js
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
import { ProPageHeader as o } from "./pro-page-header/index.js";
|
|
2
|
-
import { default as
|
|
2
|
+
import { default as U } from "./pro-page-header/index.js";
|
|
3
3
|
import { ProKeepAliveRouterView as r } from "./pro-keep-alive-router-view/index.js";
|
|
4
|
-
import { default as
|
|
4
|
+
import { default as b } from "./pro-keep-alive-router-view/index.js";
|
|
5
5
|
import { ProLayout as t } from "./pro-layout/index.js";
|
|
6
|
-
import { default as
|
|
6
|
+
import { default as w } from "./pro-layout/index.js";
|
|
7
7
|
import { ProMenu as a } from "./pro-menu/index.js";
|
|
8
|
-
import { default as
|
|
8
|
+
import { default as A } from "./pro-menu/index.js";
|
|
9
9
|
import { ProPageContainer as m } from "./pro-page-container/index.js";
|
|
10
|
-
import { default as
|
|
11
|
-
import { ProReuseTabs as
|
|
12
|
-
import { default as
|
|
13
|
-
import { ProImageUpload as
|
|
14
|
-
import { default as
|
|
15
|
-
|
|
10
|
+
import { default as H } from "./pro-page-container/index.js";
|
|
11
|
+
import { ProReuseTabs as f } from "./pro-reuse-tabs/index.js";
|
|
12
|
+
import { default as L } from "./pro-reuse-tabs/index.js";
|
|
13
|
+
import { ProImageUpload as u } from "./pro-image-upload/index.js";
|
|
14
|
+
import { default as T } from "./pro-image-upload/index.js";
|
|
15
|
+
import { EImageUploadInnerBeforeUploadStep as c } from "./pro-image-upload/types.js";
|
|
16
|
+
import { defaultImageUploadOptions as E } from "./pro-image-upload/constant.js";
|
|
17
|
+
const x = {
|
|
16
18
|
install(e) {
|
|
17
|
-
e.use(o), e.use(r), e.use(t), e.use(a), e.use(m), e.use(
|
|
19
|
+
e.use(o), e.use(r), e.use(t), e.use(a), e.use(m), e.use(f), e.use(u);
|
|
18
20
|
}
|
|
19
21
|
};
|
|
20
22
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
c as EImageUploadInnerBeforeUploadStep,
|
|
24
|
+
T as ProImageUpload,
|
|
25
|
+
b as ProKeepAliveRouterView,
|
|
26
|
+
w as ProLayout,
|
|
27
|
+
A as ProMenu,
|
|
28
|
+
H as ProPageContainer,
|
|
29
|
+
U as ProPageHeader,
|
|
30
|
+
L as ProReuseTabs,
|
|
31
|
+
x as default,
|
|
32
|
+
E as defaultImageUploadOptions
|
|
29
33
|
};
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Message as
|
|
3
|
-
import { conclude as
|
|
1
|
+
import { defineComponent as ne, ref as m, computed as C, watch as D, resolveComponent as oe, openBlock as te, createElementBlock as ie, createVNode as ue, normalizeClass as re } from "vue";
|
|
2
|
+
import { Message as U } from "@arco-design/web-vue";
|
|
3
|
+
import { conclude as b } from "vue-global-config";
|
|
4
4
|
import { EImageUploadInnerBeforeUploadStep as v } from "./types.js";
|
|
5
|
-
import { defaultImageUploadOptions as
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const Oe = /* @__PURE__ */ ue({
|
|
5
|
+
import { defaultImageUploadOptions as x } from "./constant.js";
|
|
6
|
+
import { defaultImageUploadCheckOptions as de, defaultImageUploadCompressorOptions as se, defaultImageUploadCropOptions as ce, oneTravelImageCheckAndTransform as fe, oneTravelImageCompressor as ve } from "@keyblade/one-travel";
|
|
7
|
+
const me = "keyblade-pro-image-upload";
|
|
8
|
+
var G, J, K;
|
|
9
|
+
const Ee = /* @__PURE__ */ ne({
|
|
11
10
|
__name: "image-upload",
|
|
12
11
|
props: {
|
|
13
12
|
action: {},
|
|
14
13
|
handlerResponse: {},
|
|
15
14
|
headers: {},
|
|
16
15
|
data: {},
|
|
17
|
-
name: { default: (
|
|
16
|
+
name: { default: (G = x) == null ? void 0 : G.name },
|
|
18
17
|
tip: {},
|
|
19
18
|
accept: { default: () => {
|
|
20
19
|
var B;
|
|
21
|
-
return ((B =
|
|
20
|
+
return ((B = x) == null ? void 0 : B.accept) || [];
|
|
22
21
|
} },
|
|
23
|
-
multiple: { type: Boolean, default:
|
|
24
|
-
singleLimit: { default:
|
|
22
|
+
multiple: { type: Boolean, default: x.multiple },
|
|
23
|
+
singleLimit: { default: x.singleLimit },
|
|
25
24
|
limit: {},
|
|
26
|
-
disabled: { type: Boolean, default: (
|
|
27
|
-
hideInnerBeforeUploadLoading: { type: Boolean, default: (
|
|
25
|
+
disabled: { type: Boolean, default: (J = x) == null ? void 0 : J.disabled },
|
|
26
|
+
hideInnerBeforeUploadLoading: { type: Boolean, default: (K = x) == null ? void 0 : K.hideInnerBeforeUploadLoading },
|
|
28
27
|
checkOptions: {},
|
|
29
28
|
compressorOptions: {},
|
|
30
29
|
cropOptions: {},
|
|
@@ -36,75 +35,67 @@ const Oe = /* @__PURE__ */ ue({
|
|
|
36
35
|
onInnerBeforeUploadEnd: {}
|
|
37
36
|
},
|
|
38
37
|
emits: ["cropperImgLoad"],
|
|
39
|
-
setup(B, { expose:
|
|
40
|
-
const e = B, i = defineModel({ required: !0 }),
|
|
38
|
+
setup(B, { expose: X, emit: ge }) {
|
|
39
|
+
const e = B, i = defineModel({ required: !0 }), M = m(), Y = m(), O = m(), g = m(
|
|
41
40
|
[]
|
|
42
|
-
), o = m(), c = m(), d = m(),
|
|
43
|
-
var t,
|
|
44
|
-
const
|
|
45
|
-
return
|
|
46
|
-
selectCount:
|
|
47
|
-
}), 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,
|
|
41
|
+
), o = m(), c = m(), d = m(), Z = C(() => e.accept.map((a) => `.${a}`).join(",")), f = C(() => b([e.checkOptions, de]) || {}), p = C(() => b([e.compressorOptions, se]) || {}), y = C(() => b([e.cropOptions, ce]) || {}), _ = (a) => {
|
|
42
|
+
var t, u, s, r;
|
|
43
|
+
const n = (r = (s = (u = (t = M.value) == null ? void 0 : t.$el) == null ? void 0 : u.querySelector) == null ? void 0 : s.call(u, "input")) == null ? void 0 : r.files;
|
|
44
|
+
return n && n.length > 0 && (d.value = {
|
|
45
|
+
selectCount: n.length
|
|
46
|
+
}), 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) => {
|
|
48
47
|
try {
|
|
49
|
-
E(await
|
|
48
|
+
E(await le(a));
|
|
50
49
|
} catch {
|
|
51
50
|
w();
|
|
52
51
|
} finally {
|
|
53
|
-
|
|
52
|
+
L();
|
|
54
53
|
}
|
|
55
54
|
});
|
|
55
|
+
}, A = async (a) => {
|
|
56
|
+
const n = i.value.findIndex((t) => t.uid === a.uid);
|
|
57
|
+
return i.value.splice(n, 1), i.value = [...i.value], !1;
|
|
58
|
+
}, R = (a, n) => {
|
|
59
|
+
e != null && e.onExceed ? e == null || e.onExceed(a, n) : (U.error(`单次最多可选择${(e == null ? void 0 : e.limit) || 1}张图片`), i.value = a);
|
|
56
60
|
}, 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
61
|
if (e != null && e.onSuccess)
|
|
63
62
|
e == null || e.onSuccess(a);
|
|
64
63
|
else {
|
|
65
64
|
if (!(e != null && e.handlerResponse))
|
|
66
65
|
return;
|
|
67
|
-
const
|
|
68
|
-
|
|
66
|
+
const n = await e.handlerResponse(a.response), t = i.value.findIndex((u) => u.uid === a.uid);
|
|
67
|
+
n.success ? i.value[t] = {
|
|
69
68
|
...i.value[t],
|
|
70
|
-
...
|
|
69
|
+
...n
|
|
71
70
|
} : i.value.splice(t, 1);
|
|
72
71
|
}
|
|
73
|
-
},
|
|
72
|
+
}, ae = (a) => {
|
|
74
73
|
e != null && e.onError ? e == null || e.onError(a) : setTimeout(() => {
|
|
75
|
-
const
|
|
76
|
-
i.value.splice(
|
|
74
|
+
const n = i.value.findIndex((t) => t.uid === a.uid);
|
|
75
|
+
i.value.splice(n, 1);
|
|
77
76
|
});
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
}),
|
|
81
|
-
o.value === void 0 ? o.value = 0 : 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);
|
|
77
|
+
}, le = (a) => new Promise((n, t) => {
|
|
78
|
+
g.value.push({ file: a, resolve: n, reject: t }), g.value.length === 1 && !o.value && L();
|
|
79
|
+
}), L = () => {
|
|
80
|
+
o.value === void 0 ? o.value = 0 : o.value + 1 >= g.value.length ? (o.value = void 0, g.value = []) : o.value += 1;
|
|
90
81
|
};
|
|
91
|
-
|
|
92
|
-
var E, w,
|
|
93
|
-
if (o.value === void 0 ||
|
|
82
|
+
D(o, async () => {
|
|
83
|
+
var E, w, S, $, F, z, j, k, Q, H, W, P, T, q, N, V;
|
|
84
|
+
if (o.value === void 0 || g.value.length === 0)
|
|
94
85
|
return;
|
|
95
|
-
const a =
|
|
96
|
-
let s =
|
|
86
|
+
const a = g.value[o.value], { file: n, resolve: t, reject: u } = a;
|
|
87
|
+
let s = n.name, r = n;
|
|
97
88
|
if ((E = f.value) != null && E.enable) {
|
|
98
89
|
c.value = {
|
|
99
90
|
loading: !0,
|
|
100
91
|
text: `第${o.value + 1}张图片检测中,请稍等`
|
|
101
92
|
}, (w = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || w.call(
|
|
102
93
|
e,
|
|
103
|
-
|
|
94
|
+
n,
|
|
104
95
|
o.value,
|
|
105
96
|
v.check
|
|
106
97
|
);
|
|
107
|
-
const
|
|
98
|
+
const l = await fe(n, n.name, {
|
|
108
99
|
imageMaxSize: f.value.maxSize,
|
|
109
100
|
imageAllowedType: f.value.allowedType,
|
|
110
101
|
imageMinWidth: f.value.minWidth,
|
|
@@ -112,39 +103,39 @@ const Oe = /* @__PURE__ */ ue({
|
|
|
112
103
|
imageMaxWidth: f.value.maxWidth,
|
|
113
104
|
imageMaxHeight: f.value.maxHeight
|
|
114
105
|
});
|
|
115
|
-
if (c.value = void 0, (
|
|
106
|
+
if (c.value = void 0, (S = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || S.call(
|
|
116
107
|
e,
|
|
117
|
-
|
|
108
|
+
n,
|
|
118
109
|
o.value,
|
|
119
110
|
v.check,
|
|
120
111
|
{
|
|
121
|
-
success:
|
|
122
|
-
error:
|
|
123
|
-
errorMessage:
|
|
112
|
+
success: l.success,
|
|
113
|
+
error: l == null ? void 0 : l.error,
|
|
114
|
+
errorMessage: l == null ? void 0 : l.errorMessage
|
|
124
115
|
}
|
|
125
|
-
), !
|
|
126
|
-
return (
|
|
127
|
-
if (
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
type:
|
|
116
|
+
), !l.success)
|
|
117
|
+
return ($ = f.value) != null && $.showErrorMessage && U.error((l == null ? void 0 : l.errorMessage) || "图片校验及转换失败"), u();
|
|
118
|
+
if (l != null && l.hasTransform) {
|
|
119
|
+
const I = s == null ? void 0 : s.split(".");
|
|
120
|
+
I.pop(), s = `${I.join(",")}.jpg`, r = new File([l.file], s, {
|
|
121
|
+
type: l.file.type
|
|
131
122
|
});
|
|
132
123
|
} else
|
|
133
|
-
|
|
124
|
+
r = l.file;
|
|
134
125
|
}
|
|
135
126
|
if ((F = y.value) != null && F.enable) {
|
|
136
127
|
(z = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || z.call(
|
|
137
128
|
e,
|
|
138
|
-
|
|
129
|
+
n,
|
|
139
130
|
o.value,
|
|
140
131
|
v.crop
|
|
141
132
|
);
|
|
142
133
|
try {
|
|
143
|
-
(j = y.value) != null && j.customCrop ?
|
|
144
|
-
|
|
145
|
-
}), (
|
|
134
|
+
(j = y.value) != null && j.customCrop ? r = await y.value.customCrop(r) : r = await new Promise((l, I) => {
|
|
135
|
+
O.value = { file: r, resolve: l, reject: I };
|
|
136
|
+
}), (k = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || k.call(
|
|
146
137
|
e,
|
|
147
|
-
|
|
138
|
+
n,
|
|
148
139
|
o.value,
|
|
149
140
|
v.crop,
|
|
150
141
|
{
|
|
@@ -152,9 +143,9 @@ const Oe = /* @__PURE__ */ ue({
|
|
|
152
143
|
}
|
|
153
144
|
);
|
|
154
145
|
} catch {
|
|
155
|
-
return (
|
|
146
|
+
return (Q = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || Q.call(
|
|
156
147
|
e,
|
|
157
|
-
|
|
148
|
+
n,
|
|
158
149
|
o.value,
|
|
159
150
|
v.crop,
|
|
160
151
|
{
|
|
@@ -164,109 +155,98 @@ const Oe = /* @__PURE__ */ ue({
|
|
|
164
155
|
},
|
|
165
156
|
errorMessage: "图片剪裁失败"
|
|
166
157
|
}
|
|
167
|
-
), (
|
|
158
|
+
), (H = y.value) != null && H.showErrorMessage && U.error("图片剪裁失败"), u();
|
|
168
159
|
} finally {
|
|
169
|
-
|
|
160
|
+
O.value = void 0;
|
|
170
161
|
}
|
|
171
162
|
}
|
|
172
|
-
if ((
|
|
163
|
+
if ((W = p.value) != null && W.enable) {
|
|
173
164
|
c.value = {
|
|
174
165
|
loading: !0,
|
|
175
166
|
text: `第${o.value + 1}张图片处理中,请稍等`
|
|
176
167
|
}, (P = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || P.call(
|
|
177
168
|
e,
|
|
178
|
-
|
|
169
|
+
n,
|
|
179
170
|
o.value,
|
|
180
171
|
v.compress
|
|
181
172
|
);
|
|
182
|
-
const
|
|
183
|
-
maxSize:
|
|
184
|
-
size:
|
|
185
|
-
excludeAllowedTypes: (T =
|
|
173
|
+
const l = await ve(r, {
|
|
174
|
+
maxSize: p.value.maxSize,
|
|
175
|
+
size: p.value.size,
|
|
176
|
+
excludeAllowedTypes: (T = p.value.excludeAllowedTypes) == null ? void 0 : T.map((I) => `image/${I}`)
|
|
186
177
|
});
|
|
187
178
|
if (c.value = void 0, (q = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || q.call(
|
|
188
179
|
e,
|
|
189
|
-
|
|
180
|
+
n,
|
|
190
181
|
o.value,
|
|
191
182
|
v.compress,
|
|
192
183
|
{
|
|
193
|
-
success:
|
|
184
|
+
success: l.success,
|
|
194
185
|
error: {
|
|
195
186
|
compress: !0
|
|
196
187
|
},
|
|
197
|
-
errorMessage:
|
|
188
|
+
errorMessage: l == null ? void 0 : l.errorMessage
|
|
198
189
|
}
|
|
199
|
-
), !
|
|
200
|
-
return (
|
|
201
|
-
|
|
202
|
-
type:
|
|
190
|
+
), !l.success)
|
|
191
|
+
return (N = p.value) != null && N.showErrorMessage && U.error((l == null ? void 0 : l.errorMessage) || "图片压缩失败"), u();
|
|
192
|
+
r = new File([l.file], s, {
|
|
193
|
+
type: l.file.type
|
|
203
194
|
});
|
|
204
195
|
}
|
|
205
|
-
c.value = void 0, (
|
|
196
|
+
c.value = void 0, (V = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || V.call(
|
|
206
197
|
e,
|
|
207
|
-
|
|
198
|
+
n,
|
|
208
199
|
o.value,
|
|
209
200
|
v.all,
|
|
210
201
|
{
|
|
211
202
|
success: !0
|
|
212
203
|
}
|
|
213
|
-
), t(
|
|
204
|
+
), t(r);
|
|
214
205
|
});
|
|
215
|
-
let
|
|
216
|
-
return
|
|
206
|
+
let h;
|
|
207
|
+
return D(
|
|
217
208
|
() => c.value,
|
|
218
209
|
() => {
|
|
219
210
|
var a;
|
|
220
|
-
c.value ?
|
|
211
|
+
c.value ? h = U.loading({
|
|
221
212
|
content: c.value.text,
|
|
222
213
|
id: "image-upload-id",
|
|
223
214
|
duration: 0
|
|
224
|
-
}) : (a =
|
|
215
|
+
}) : (a = h == null ? void 0 : h.close) == null || a.call(h);
|
|
225
216
|
}
|
|
226
|
-
),
|
|
227
|
-
uploadInsRef:
|
|
228
|
-
cropperInsRef:
|
|
229
|
-
}), (a,
|
|
230
|
-
const t =
|
|
231
|
-
return
|
|
232
|
-
|
|
233
|
-
class:
|
|
217
|
+
), X({
|
|
218
|
+
uploadInsRef: M,
|
|
219
|
+
cropperInsRef: Y
|
|
220
|
+
}), (a, n) => {
|
|
221
|
+
const t = oe("a-upload");
|
|
222
|
+
return te(), ie("div", null, [
|
|
223
|
+
ue(t, {
|
|
224
|
+
class: re([`${me}-upload`]),
|
|
234
225
|
ref_key: "uploadInsRef",
|
|
235
|
-
ref:
|
|
226
|
+
ref: M,
|
|
236
227
|
"list-type": "picture-card",
|
|
237
228
|
tip: a.tip || "上传",
|
|
238
229
|
"image-preview": "",
|
|
239
230
|
"file-list": i.value,
|
|
240
|
-
"onUpdate:fileList":
|
|
231
|
+
"onUpdate:fileList": n[0] || (n[0] = (u) => i.value = u),
|
|
241
232
|
action: a.action,
|
|
242
233
|
headers: a.headers,
|
|
243
234
|
data: a.data,
|
|
244
235
|
name: a.name,
|
|
245
|
-
accept:
|
|
236
|
+
accept: Z.value,
|
|
246
237
|
multiple: a.multiple,
|
|
247
238
|
limit: a.limit,
|
|
248
239
|
disabled: a.disabled,
|
|
249
|
-
"on-before-upload":
|
|
250
|
-
"on-before-remove":
|
|
251
|
-
onExceedLimit:
|
|
252
|
-
onSuccess:
|
|
253
|
-
onError:
|
|
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)
|
|
240
|
+
"on-before-upload": _,
|
|
241
|
+
"on-before-remove": A,
|
|
242
|
+
onExceedLimit: R,
|
|
243
|
+
onSuccess: ee,
|
|
244
|
+
onError: ae
|
|
245
|
+
}, null, 8, ["class", "tip", "file-list", "action", "headers", "data", "name", "accept", "multiple", "limit", "disabled"])
|
|
266
246
|
]);
|
|
267
247
|
};
|
|
268
248
|
}
|
|
269
249
|
});
|
|
270
250
|
export {
|
|
271
|
-
|
|
251
|
+
Ee as default
|
|
272
252
|
};
|
|
@@ -1428,5 +1428,7 @@ declare const ProImageUpload: {
|
|
|
1428
1428
|
}, {}, string, {}> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & {
|
|
1429
1429
|
install: (app: App) => void;
|
|
1430
1430
|
};
|
|
1431
|
+
export * from './types';
|
|
1432
|
+
export * from './constant';
|
|
1431
1433
|
export { ProImageUpload };
|
|
1432
1434
|
export default ProImageUpload;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import e from "./image-upload.vue.js";
|
|
2
|
-
import { Modal as s, Upload as t, Button as l, Tooltip as m,
|
|
2
|
+
import { Modal as s, Upload as t, Button as l, Tooltip as m, Spin as n, Space as u, Message as a } from "@arco-design/web-vue";
|
|
3
3
|
const r = Object.assign(e, {
|
|
4
4
|
install: (o) => {
|
|
5
|
-
o
|
|
5
|
+
o.use(s), o.use(t), o.use(l), o.use(m), o.use(n), o.use(u), o.use(a), o.component("KbProImageUpload", e);
|
|
6
6
|
}
|
|
7
7
|
}), d = r;
|
|
8
8
|
export {
|
package/es/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.keyblade-pro-page-container .keyblade-pro-page-container-content{padding:20px}.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-
|
|
1
|
+
.keyblade-pro-page-container .keyblade-pro-page-container-content{padding:20px}.keyblade-pro-menu .keyblade-pro-menu-item-img{width:14px;height:auto}.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-reuse-tabs{position:relative;background-color:var(--color-bg-2);padding:4px 20px}.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}
|
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
|
-
|