@keyblade/pro-components 1.12.1-alpha.14 → 1.12.1-alpha.15
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.js +59 -54
- package/es/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as N, mergeModels as F, useModel as X, ref as d, computed as U, watch as T, resolveComponent as Y, openBlock as Z, createElementBlock as A, createVNode as R } from "vue";
|
|
2
2
|
import { Message as I } from "@arco-design/web-vue";
|
|
3
|
-
import { conclude as
|
|
4
|
-
import { EImageUploadInnerBeforeUploadStep as
|
|
3
|
+
import { conclude as B } from "vue-global-config";
|
|
4
|
+
import { EImageUploadInnerBeforeUploadStep as u } from "./types.js";
|
|
5
5
|
import { defaultImageUploadOptions as f } from "./constant.js";
|
|
6
|
-
import { defaultImageUploadCheckOptions as
|
|
7
|
-
var
|
|
8
|
-
const
|
|
6
|
+
import { defaultImageUploadCheckOptions as ee, defaultImageUploadCompressorOptions as ae, defaultImageUploadCropOptions as oe, oneTravelImageCheckAndTransform as le, oneTravelImageCompressor as te } from "@keyblade/one-travel";
|
|
7
|
+
var q, P, D;
|
|
8
|
+
const fe = /* @__PURE__ */ N({
|
|
9
9
|
__name: "image-upload",
|
|
10
|
-
props: /* @__PURE__ */
|
|
10
|
+
props: /* @__PURE__ */ F({
|
|
11
11
|
action: {},
|
|
12
12
|
handlerResponse: {},
|
|
13
13
|
headers: {},
|
|
14
14
|
data: {},
|
|
15
|
-
name: { default: (
|
|
15
|
+
name: { default: (q = f) == null ? void 0 : q.name },
|
|
16
16
|
tip: {},
|
|
17
17
|
accept: { default: () => {
|
|
18
18
|
var v;
|
|
@@ -21,8 +21,8 @@ const se = /* @__PURE__ */ X({
|
|
|
21
21
|
multiple: { type: Boolean, default: f.multiple },
|
|
22
22
|
singleLimit: { default: f.singleLimit },
|
|
23
23
|
limit: {},
|
|
24
|
-
disabled: { type: Boolean, default: (
|
|
25
|
-
hideInnerBeforeUploadLoading: { type: Boolean, default: (
|
|
24
|
+
disabled: { type: Boolean, default: (P = f) == null ? void 0 : P.disabled },
|
|
25
|
+
hideInnerBeforeUploadLoading: { type: Boolean, default: (D = f) == null ? void 0 : D.hideInnerBeforeUploadLoading },
|
|
26
26
|
checkOptions: {},
|
|
27
27
|
compressorOptions: {},
|
|
28
28
|
cropOptions: {},
|
|
@@ -36,31 +36,31 @@ const se = /* @__PURE__ */ X({
|
|
|
36
36
|
modelValue: { required: !0 },
|
|
37
37
|
modelModifiers: {}
|
|
38
38
|
}),
|
|
39
|
-
emits: /* @__PURE__ */
|
|
40
|
-
setup(v, { expose:
|
|
41
|
-
|
|
42
|
-
const e = v,
|
|
39
|
+
emits: /* @__PURE__ */ F(["cropperImgLoad"], ["update:modelValue"]),
|
|
40
|
+
setup(v, { expose: G, emit: re }) {
|
|
41
|
+
X(v, "modelValue");
|
|
42
|
+
const e = v, J = d(), K = d(), M = d(), w = d(
|
|
43
43
|
[]
|
|
44
44
|
), o = d(), r = d();
|
|
45
|
-
d(), U(() => e.accept.map((
|
|
46
|
-
const n = U(() =>
|
|
47
|
-
|
|
48
|
-
var
|
|
49
|
-
if (o.value === void 0 ||
|
|
45
|
+
d(), U(() => e.accept.map((i) => `.${i}`).join(","));
|
|
46
|
+
const n = U(() => B([e.checkOptions, ee]) || {}), g = U(() => B([e.compressorOptions, ae]) || {}), p = U(() => B([e.cropOptions, oe]) || {});
|
|
47
|
+
T(o, async () => {
|
|
48
|
+
var y, E, O, C, S, b, _, z, j, L, $, H, V, W, k, Q;
|
|
49
|
+
if (o.value === void 0 || w.value.length === 0)
|
|
50
50
|
return;
|
|
51
|
-
const
|
|
51
|
+
const i = w.value[o.value], { file: l, resolve: h, reject: x } = i;
|
|
52
52
|
let s = l.name, t = l;
|
|
53
|
-
if ((
|
|
53
|
+
if ((y = n.value) != null && y.enable) {
|
|
54
54
|
r.value = {
|
|
55
55
|
loading: !0,
|
|
56
56
|
text: `第${o.value + 1}张图片检测中,请稍等`
|
|
57
|
-
}, (
|
|
57
|
+
}, (E = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || E.call(
|
|
58
58
|
e,
|
|
59
59
|
l,
|
|
60
60
|
o.value,
|
|
61
|
-
|
|
61
|
+
u.check
|
|
62
62
|
);
|
|
63
|
-
const a = await
|
|
63
|
+
const a = await le(l, l.name, {
|
|
64
64
|
imageMaxSize: n.value.maxSize,
|
|
65
65
|
imageAllowedType: n.value.allowedType,
|
|
66
66
|
imageMinWidth: n.value.minWidth,
|
|
@@ -68,18 +68,18 @@ const se = /* @__PURE__ */ X({
|
|
|
68
68
|
imageMaxWidth: n.value.maxWidth,
|
|
69
69
|
imageMaxHeight: n.value.maxHeight
|
|
70
70
|
});
|
|
71
|
-
if (r.value = void 0, (
|
|
71
|
+
if (r.value = void 0, (O = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || O.call(
|
|
72
72
|
e,
|
|
73
73
|
l,
|
|
74
74
|
o.value,
|
|
75
|
-
|
|
75
|
+
u.check,
|
|
76
76
|
{
|
|
77
77
|
success: a.success,
|
|
78
78
|
error: a == null ? void 0 : a.error,
|
|
79
79
|
errorMessage: a == null ? void 0 : a.errorMessage
|
|
80
80
|
}
|
|
81
81
|
), !a.success)
|
|
82
|
-
return (
|
|
82
|
+
return (C = n.value) != null && C.showErrorMessage && I.error((a == null ? void 0 : a.errorMessage) || "图片校验及转换失败"), x();
|
|
83
83
|
if (a != null && a.hasTransform) {
|
|
84
84
|
const m = s == null ? void 0 : s.split(".");
|
|
85
85
|
m.pop(), s = `${m.join(",")}.jpg`, t = new File([a.file], s, {
|
|
@@ -88,31 +88,31 @@ const se = /* @__PURE__ */ X({
|
|
|
88
88
|
} else
|
|
89
89
|
t = a.file;
|
|
90
90
|
}
|
|
91
|
-
if ((
|
|
92
|
-
(
|
|
91
|
+
if ((S = p.value) != null && S.enable) {
|
|
92
|
+
(b = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || b.call(
|
|
93
93
|
e,
|
|
94
94
|
l,
|
|
95
95
|
o.value,
|
|
96
|
-
|
|
96
|
+
u.crop
|
|
97
97
|
);
|
|
98
98
|
try {
|
|
99
|
-
(
|
|
100
|
-
|
|
99
|
+
(_ = p.value) != null && _.customCrop ? t = await p.value.customCrop(t) : t = await new Promise((a, m) => {
|
|
100
|
+
M.value = { file: t, resolve: a, reject: m };
|
|
101
101
|
}), (z = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || z.call(
|
|
102
102
|
e,
|
|
103
103
|
l,
|
|
104
104
|
o.value,
|
|
105
|
-
|
|
105
|
+
u.crop,
|
|
106
106
|
{
|
|
107
107
|
success: !1
|
|
108
108
|
}
|
|
109
109
|
);
|
|
110
110
|
} catch {
|
|
111
|
-
return (
|
|
111
|
+
return (j = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || j.call(
|
|
112
112
|
e,
|
|
113
113
|
l,
|
|
114
114
|
o.value,
|
|
115
|
-
|
|
115
|
+
u.crop,
|
|
116
116
|
{
|
|
117
117
|
success: !1,
|
|
118
118
|
error: {
|
|
@@ -120,31 +120,31 @@ const se = /* @__PURE__ */ X({
|
|
|
120
120
|
},
|
|
121
121
|
errorMessage: "图片剪裁失败"
|
|
122
122
|
}
|
|
123
|
-
), (
|
|
123
|
+
), (L = p.value) != null && L.showErrorMessage && I.error("图片剪裁失败"), x();
|
|
124
124
|
} finally {
|
|
125
|
-
|
|
125
|
+
M.value = void 0;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
if ((
|
|
128
|
+
if (($ = g.value) != null && $.enable) {
|
|
129
129
|
r.value = {
|
|
130
130
|
loading: !0,
|
|
131
131
|
text: `第${o.value + 1}张图片处理中,请稍等`
|
|
132
|
-
}, (
|
|
132
|
+
}, (H = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || H.call(
|
|
133
133
|
e,
|
|
134
134
|
l,
|
|
135
135
|
o.value,
|
|
136
|
-
|
|
136
|
+
u.compress
|
|
137
137
|
);
|
|
138
|
-
const a = await
|
|
138
|
+
const a = await te(t, {
|
|
139
139
|
maxSize: g.value.maxSize,
|
|
140
140
|
size: g.value.size,
|
|
141
|
-
excludeAllowedTypes: (
|
|
141
|
+
excludeAllowedTypes: (V = g.value.excludeAllowedTypes) == null ? void 0 : V.map((m) => `image/${m}`)
|
|
142
142
|
});
|
|
143
143
|
if (r.value = void 0, (W = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || W.call(
|
|
144
144
|
e,
|
|
145
145
|
l,
|
|
146
146
|
o.value,
|
|
147
|
-
|
|
147
|
+
u.compress,
|
|
148
148
|
{
|
|
149
149
|
success: a.success,
|
|
150
150
|
error: {
|
|
@@ -153,7 +153,7 @@ const se = /* @__PURE__ */ X({
|
|
|
153
153
|
errorMessage: a == null ? void 0 : a.errorMessage
|
|
154
154
|
}
|
|
155
155
|
), !a.success)
|
|
156
|
-
return (k = g.value) != null && k.showErrorMessage && I.error((a == null ? void 0 : a.errorMessage) || "图片压缩失败"),
|
|
156
|
+
return (k = g.value) != null && k.showErrorMessage && I.error((a == null ? void 0 : a.errorMessage) || "图片压缩失败"), x();
|
|
157
157
|
t = new File([a.file], s, {
|
|
158
158
|
type: a.file.type
|
|
159
159
|
});
|
|
@@ -162,29 +162,34 @@ const se = /* @__PURE__ */ X({
|
|
|
162
162
|
e,
|
|
163
163
|
l,
|
|
164
164
|
o.value,
|
|
165
|
-
|
|
165
|
+
u.all,
|
|
166
166
|
{
|
|
167
167
|
success: !0
|
|
168
168
|
}
|
|
169
|
-
),
|
|
169
|
+
), h(t);
|
|
170
170
|
});
|
|
171
171
|
let c;
|
|
172
|
-
return
|
|
172
|
+
return T(
|
|
173
173
|
() => r.value,
|
|
174
174
|
() => {
|
|
175
|
-
var
|
|
175
|
+
var i;
|
|
176
176
|
r.value ? c = I.loading({
|
|
177
177
|
content: r.value.text,
|
|
178
178
|
id: "image-upload-id",
|
|
179
179
|
duration: 0
|
|
180
|
-
}) : (
|
|
180
|
+
}) : (i = c == null ? void 0 : c.close) == null || i.call(c);
|
|
181
181
|
}
|
|
182
|
-
),
|
|
183
|
-
uploadInsRef:
|
|
184
|
-
cropperInsRef:
|
|
185
|
-
}), (
|
|
182
|
+
), G({
|
|
183
|
+
uploadInsRef: J,
|
|
184
|
+
cropperInsRef: K
|
|
185
|
+
}), (i, l) => {
|
|
186
|
+
const h = Y("a-upload");
|
|
187
|
+
return Z(), A("div", null, [
|
|
188
|
+
R(h, { action: i.action }, null, 8, ["action"])
|
|
189
|
+
]);
|
|
190
|
+
};
|
|
186
191
|
}
|
|
187
192
|
});
|
|
188
193
|
export {
|
|
189
|
-
|
|
194
|
+
fe as default
|
|
190
195
|
};
|
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-
|
|
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-page-container .keyblade-pro-page-container-content{padding:20px}.keyblade-pro-menu .keyblade-pro-menu-item-img{width:14px;height:auto}.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-reuse-tabs{position:relative;background-color:var(--color-bg-2);padding:4px 20px}
|
package/package.json
CHANGED