@keyblade/pro-components 1.12.1-alpha.13 → 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/pro-image-upload/constant.js +15 -0
- package/es/pro-image-upload/image-upload.vue.d.ts +681 -1
- package/es/pro-image-upload/image-upload.vue.js +185 -5
- package/es/pro-image-upload/index.d.ts +1742 -82
- package/es/pro-image-upload/types.js +4 -0
- 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,10 +1,190 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
|
|
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({
|
|
3
9
|
__name: "image-upload",
|
|
4
|
-
|
|
5
|
-
|
|
10
|
+
props: /* @__PURE__ */ V({
|
|
11
|
+
action: {},
|
|
12
|
+
handlerResponse: {},
|
|
13
|
+
headers: {},
|
|
14
|
+
data: {},
|
|
15
|
+
name: { default: (T = f) == null ? void 0 : T.name },
|
|
16
|
+
tip: {},
|
|
17
|
+
accept: { default: () => {
|
|
18
|
+
var v;
|
|
19
|
+
return ((v = f) == null ? void 0 : v.accept) || [];
|
|
20
|
+
} },
|
|
21
|
+
multiple: { type: Boolean, default: f.multiple },
|
|
22
|
+
singleLimit: { default: f.singleLimit },
|
|
23
|
+
limit: {},
|
|
24
|
+
disabled: { type: Boolean, default: (q = f) == null ? void 0 : q.disabled },
|
|
25
|
+
hideInnerBeforeUploadLoading: { type: Boolean, default: (P = f) == null ? void 0 : P.hideInnerBeforeUploadLoading },
|
|
26
|
+
checkOptions: {},
|
|
27
|
+
compressorOptions: {},
|
|
28
|
+
cropOptions: {},
|
|
29
|
+
onSuccess: {},
|
|
30
|
+
onError: {},
|
|
31
|
+
onExceed: {},
|
|
32
|
+
onBeforeUpload: {},
|
|
33
|
+
onInnerBeforeUploadStart: {},
|
|
34
|
+
onInnerBeforeUploadEnd: {}
|
|
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(
|
|
43
|
+
[]
|
|
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)
|
|
50
|
+
return;
|
|
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 = {
|
|
55
|
+
loading: !0,
|
|
56
|
+
text: `第${o.value + 1}张图片检测中,请稍等`
|
|
57
|
+
}, (y = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || y.call(
|
|
58
|
+
e,
|
|
59
|
+
l,
|
|
60
|
+
o.value,
|
|
61
|
+
i.check
|
|
62
|
+
);
|
|
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
|
|
70
|
+
});
|
|
71
|
+
if (r.value = void 0, (E = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || E.call(
|
|
72
|
+
e,
|
|
73
|
+
l,
|
|
74
|
+
o.value,
|
|
75
|
+
i.check,
|
|
76
|
+
{
|
|
77
|
+
success: a.success,
|
|
78
|
+
error: a == null ? void 0 : a.error,
|
|
79
|
+
errorMessage: a == null ? void 0 : a.errorMessage
|
|
80
|
+
}
|
|
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
|
|
87
|
+
});
|
|
88
|
+
} else
|
|
89
|
+
t = a.file;
|
|
90
|
+
}
|
|
91
|
+
if ((C = p.value) != null && C.enable) {
|
|
92
|
+
(S = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || S.call(
|
|
93
|
+
e,
|
|
94
|
+
l,
|
|
95
|
+
o.value,
|
|
96
|
+
i.crop
|
|
97
|
+
);
|
|
98
|
+
try {
|
|
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(
|
|
102
|
+
e,
|
|
103
|
+
l,
|
|
104
|
+
o.value,
|
|
105
|
+
i.crop,
|
|
106
|
+
{
|
|
107
|
+
success: !1
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
} catch {
|
|
111
|
+
return (_ = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || _.call(
|
|
112
|
+
e,
|
|
113
|
+
l,
|
|
114
|
+
o.value,
|
|
115
|
+
i.crop,
|
|
116
|
+
{
|
|
117
|
+
success: !1,
|
|
118
|
+
error: {
|
|
119
|
+
crop: !0
|
|
120
|
+
},
|
|
121
|
+
errorMessage: "图片剪裁失败"
|
|
122
|
+
}
|
|
123
|
+
), (j = p.value) != null && j.showErrorMessage && I.error("图片剪裁失败"), h();
|
|
124
|
+
} finally {
|
|
125
|
+
B.value = void 0;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if ((L = g.value) != null && L.enable) {
|
|
129
|
+
r.value = {
|
|
130
|
+
loading: !0,
|
|
131
|
+
text: `第${o.value + 1}张图片处理中,请稍等`
|
|
132
|
+
}, ($ = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || $.call(
|
|
133
|
+
e,
|
|
134
|
+
l,
|
|
135
|
+
o.value,
|
|
136
|
+
i.compress
|
|
137
|
+
);
|
|
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}`)
|
|
142
|
+
});
|
|
143
|
+
if (r.value = void 0, (W = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || W.call(
|
|
144
|
+
e,
|
|
145
|
+
l,
|
|
146
|
+
o.value,
|
|
147
|
+
i.compress,
|
|
148
|
+
{
|
|
149
|
+
success: a.success,
|
|
150
|
+
error: {
|
|
151
|
+
compress: !0
|
|
152
|
+
},
|
|
153
|
+
errorMessage: a == null ? void 0 : a.errorMessage
|
|
154
|
+
}
|
|
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
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
r.value = void 0, (Q = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || Q.call(
|
|
162
|
+
e,
|
|
163
|
+
l,
|
|
164
|
+
o.value,
|
|
165
|
+
i.all,
|
|
166
|
+
{
|
|
167
|
+
success: !0
|
|
168
|
+
}
|
|
169
|
+
), K(t);
|
|
170
|
+
});
|
|
171
|
+
let c;
|
|
172
|
+
return F(
|
|
173
|
+
() => r.value,
|
|
174
|
+
() => {
|
|
175
|
+
var u;
|
|
176
|
+
r.value ? c = I.loading({
|
|
177
|
+
content: r.value.text,
|
|
178
|
+
id: "image-upload-id",
|
|
179
|
+
duration: 0
|
|
180
|
+
}) : (u = c == null ? void 0 : c.close) == null || u.call(c);
|
|
181
|
+
}
|
|
182
|
+
), D({
|
|
183
|
+
uploadInsRef: G,
|
|
184
|
+
cropperInsRef: J
|
|
185
|
+
}), (u, l) => (Z(), N("div"));
|
|
6
186
|
}
|
|
7
187
|
});
|
|
8
188
|
export {
|
|
9
|
-
|
|
189
|
+
se as default
|
|
10
190
|
};
|