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