@keyblade/pro-components 1.13.8-alpha.46 → 1.13.8-alpha.47
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.
|
@@ -12,9 +12,7 @@ declare function __VLS_template(): {
|
|
|
12
12
|
fileItem: any;
|
|
13
13
|
}): any;
|
|
14
14
|
'upload-button'?(_: {}): any;
|
|
15
|
-
'extra-button'?(_:
|
|
16
|
-
fileItem: any;
|
|
17
|
-
}): any;
|
|
15
|
+
'extra-button'?(_: any): any;
|
|
18
16
|
};
|
|
19
17
|
refs: {
|
|
20
18
|
uploadInsRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var ye = Object.defineProperty;
|
|
2
2
|
var le = Object.getOwnPropertySymbols;
|
|
3
3
|
var Ce = Object.prototype.hasOwnProperty, Be = Object.prototype.propertyIsEnumerable;
|
|
4
|
-
var oe = (s, c, u) => c in s ? ye(s, c, { enumerable: !0, configurable: !0, writable: !0, value: u }) : s[c] = u,
|
|
4
|
+
var oe = (s, c, u) => c in s ? ye(s, c, { enumerable: !0, configurable: !0, writable: !0, value: u }) : s[c] = u, Q = (s, c) => {
|
|
5
5
|
for (var u in c || (c = {}))
|
|
6
6
|
Ce.call(c, u) && oe(s, u, c[u]);
|
|
7
7
|
if (le)
|
|
@@ -25,16 +25,16 @@ var L = (s, c, u) => new Promise((E, i) => {
|
|
|
25
25
|
}, x = (v) => v.done ? E(v.value) : Promise.resolve(v.value).then(e, j);
|
|
26
26
|
x((u = u.apply(s, c)).next());
|
|
27
27
|
});
|
|
28
|
-
import { defineComponent as we, mergeModels as ne, useSlots as be, useModel as Ee, ref as U, computed as O, watch as te, createElementBlock as Me, openBlock as ie, createVNode as Se, createBlock as Le, createCommentVNode as Oe, unref as z, normalizeClass as $e, createSlots as ke, withCtx as
|
|
29
|
-
import { Message as y, Upload as
|
|
30
|
-
import { conclude as
|
|
28
|
+
import { defineComponent as we, mergeModels as ne, useSlots as be, useModel as Ee, ref as U, computed as O, watch as te, createElementBlock as Me, openBlock as ie, createVNode as Se, createBlock as Le, createCommentVNode as Oe, unref as z, normalizeClass as $e, createSlots as ke, withCtx as T, renderSlot as V, normalizeProps as ze, guardReactiveProps as je } from "vue";
|
|
29
|
+
import { Message as y, Upload as Pe } from "@arco-design/web-vue";
|
|
30
|
+
import { conclude as W } from "vue-global-config";
|
|
31
31
|
import { EImageUploadInnerBeforeUploadStep as I } from "./types.js";
|
|
32
32
|
import { defaultImageUploadOptions as b } from "./constant.js";
|
|
33
|
-
import
|
|
34
|
-
import { defaultImageUploadCheckOptions as
|
|
35
|
-
const
|
|
33
|
+
import Qe from "./cropper.vue.js";
|
|
34
|
+
import { defaultImageUploadCheckOptions as Te, defaultImageUploadCompressorOptions as Ve, defaultImageUploadCropOptions as We, oneTravelImageCheckAndTransform as Fe, oneTravelImageCompressor as He } from "@keyblade/one-travel";
|
|
35
|
+
const qe = "keyblade-pro-image-upload";
|
|
36
36
|
var re, ue, de;
|
|
37
|
-
const
|
|
37
|
+
const Ae = /* @__PURE__ */ we({
|
|
38
38
|
__name: "image-upload",
|
|
39
39
|
props: /* @__PURE__ */ ne({
|
|
40
40
|
action: {},
|
|
@@ -69,7 +69,7 @@ const Ne = /* @__PURE__ */ we({
|
|
|
69
69
|
}),
|
|
70
70
|
emits: /* @__PURE__ */ ne(["cropperImgLoad"], ["update:modelValue"]),
|
|
71
71
|
setup(s, { expose: c, emit: u }) {
|
|
72
|
-
const E = be(), i = Ee(s, "modelValue"), e = s, j = u, x = U(), v = U(), m = U(), C = U([]), n = U(), p = U(), g = U(), se = O(() => e.accept.map((a) => `.${a}`).join(",")), h = O(() =>
|
|
72
|
+
const E = be(), i = Ee(s, "modelValue"), e = s, j = u, x = U(), v = U(), m = U(), C = U([]), n = U(), p = U(), g = U(), se = O(() => e.accept.map((a) => `.${a}`).join(",")), h = O(() => W([e.checkOptions, Te]) || {}), M = O(() => W([e.compressorOptions, Ve]) || {}), S = O(() => W([e.cropOptions, We]) || {}), ce = (a) => {
|
|
73
73
|
var t, f, d, r;
|
|
74
74
|
const l = (r = (d = (f = (t = x.value) == null ? void 0 : t.$el) == null ? void 0 : f.querySelector) == null ? void 0 : d.call(f, "input")) == null ? void 0 : r.files;
|
|
75
75
|
return l && l.length > 0 && (g.value = {
|
|
@@ -77,10 +77,10 @@ const Ne = /* @__PURE__ */ we({
|
|
|
77
77
|
}), e != null && e.onBeforeUpload ? e == null ? void 0 : e.onBeforeUpload(a) : g.value && (e != null && e.singleLimit) && g.value.selectCount > (e == null ? void 0 : e.singleLimit) ? (g.value.handleIndex === void 0 ? (g.value.handleIndex = 0, y.clear(), y.error(`单次最多可选择${e == null ? void 0 : e.singleLimit}张图片`)) : g.value.handleIndex += 1, g.value.handleIndex === g.value.selectCount - 1 && (g.value = void 0), !1) : new Promise(($, k) => L(null, null, function* () {
|
|
78
78
|
try {
|
|
79
79
|
$(yield pe(a));
|
|
80
|
-
} catch (
|
|
80
|
+
} catch (P) {
|
|
81
81
|
k();
|
|
82
82
|
} finally {
|
|
83
|
-
|
|
83
|
+
F();
|
|
84
84
|
}
|
|
85
85
|
}));
|
|
86
86
|
}, fe = (a) => L(null, null, function* () {
|
|
@@ -96,7 +96,7 @@ const Ne = /* @__PURE__ */ we({
|
|
|
96
96
|
if (!(e != null && e.handlerResponse))
|
|
97
97
|
return;
|
|
98
98
|
const l = yield e.handlerResponse(a.response), t = i.value.findIndex((f) => f.uid === a.uid);
|
|
99
|
-
l.success ? i.value[t] && (i.value[t] =
|
|
99
|
+
l.success ? i.value[t] && (i.value[t] = Q(Q({}, i.value[t]), l)) : i.value.splice(t, 1);
|
|
100
100
|
}
|
|
101
101
|
}), ge = (a) => {
|
|
102
102
|
e != null && e.onError ? e == null || e.onError(a) : setTimeout(() => {
|
|
@@ -104,8 +104,8 @@ const Ne = /* @__PURE__ */ we({
|
|
|
104
104
|
i.value.splice(l, 1);
|
|
105
105
|
});
|
|
106
106
|
}, pe = (a) => new Promise((l, t) => {
|
|
107
|
-
C.value.push({ file: a, resolve: l, reject: t }), C.value.length === 1 && !n.value &&
|
|
108
|
-
}),
|
|
107
|
+
C.value.push({ file: a, resolve: l, reject: t }), C.value.length === 1 && !n.value && F();
|
|
108
|
+
}), F = () => {
|
|
109
109
|
n.value === void 0 ? n.value = 0 : n.value + 1 >= C.value.length ? (n.value = void 0, C.value = []) : n.value += 1;
|
|
110
110
|
}, he = () => {
|
|
111
111
|
var a;
|
|
@@ -117,7 +117,7 @@ const Ne = /* @__PURE__ */ we({
|
|
|
117
117
|
j("cropperImgLoad", a);
|
|
118
118
|
};
|
|
119
119
|
te(n, () => L(null, null, function* () {
|
|
120
|
-
var $, k,
|
|
120
|
+
var $, k, P, H, q, D, G, J, K, X, Y, Z, N, R, A, _, ee, ae;
|
|
121
121
|
if (n.value === void 0 || C.value.length === 0)
|
|
122
122
|
return;
|
|
123
123
|
const a = C.value[n.value];
|
|
@@ -134,7 +134,7 @@ const Ne = /* @__PURE__ */ we({
|
|
|
134
134
|
n.value,
|
|
135
135
|
I.check
|
|
136
136
|
);
|
|
137
|
-
const o = yield
|
|
137
|
+
const o = yield Fe(l, l.name, {
|
|
138
138
|
imageMaxSize: h.value.maxSize,
|
|
139
139
|
imageAllowedType: h.value.allowedType,
|
|
140
140
|
imageMinWidth: h.value.minWidth,
|
|
@@ -142,7 +142,7 @@ const Ne = /* @__PURE__ */ we({
|
|
|
142
142
|
imageMaxWidth: h.value.maxWidth,
|
|
143
143
|
imageMaxHeight: h.value.maxHeight
|
|
144
144
|
});
|
|
145
|
-
if (p.value = void 0, (
|
|
145
|
+
if (p.value = void 0, (P = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || P.call(
|
|
146
146
|
e,
|
|
147
147
|
l,
|
|
148
148
|
n.value,
|
|
@@ -153,7 +153,7 @@ const Ne = /* @__PURE__ */ we({
|
|
|
153
153
|
errorMessage: o == null ? void 0 : o.errorMessage
|
|
154
154
|
}
|
|
155
155
|
), !o.success)
|
|
156
|
-
return (
|
|
156
|
+
return (H = h.value) != null && H.showErrorMessage && y.error((o == null ? void 0 : o.errorMessage) || "图片校验及转换失败"), f();
|
|
157
157
|
if (o != null && o.hasTransform) {
|
|
158
158
|
const w = d == null ? void 0 : d.split(".");
|
|
159
159
|
w.pop(), d = `${w.join(",")}.jpg`, r = new File([o.file], d, {
|
|
@@ -203,16 +203,16 @@ const Ne = /* @__PURE__ */ we({
|
|
|
203
203
|
p.value = {
|
|
204
204
|
loading: !0,
|
|
205
205
|
text: `第${n.value + 1}张图片处理中,请稍等`
|
|
206
|
-
}, (
|
|
206
|
+
}, (R = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || R.call(
|
|
207
207
|
e,
|
|
208
208
|
l,
|
|
209
209
|
n.value,
|
|
210
210
|
I.compress
|
|
211
211
|
);
|
|
212
|
-
const o = yield
|
|
212
|
+
const o = yield He(r, {
|
|
213
213
|
maxSize: M.value.maxSize,
|
|
214
214
|
size: M.value.size,
|
|
215
|
-
excludeAllowedTypes: (
|
|
215
|
+
excludeAllowedTypes: (A = M.value.excludeAllowedTypes) == null ? void 0 : A.map((w) => `${w}`)
|
|
216
216
|
});
|
|
217
217
|
if (p.value = void 0, (_ = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || _.call(
|
|
218
218
|
e,
|
|
@@ -262,8 +262,8 @@ const Ne = /* @__PURE__ */ we({
|
|
|
262
262
|
}), (a, l) => {
|
|
263
263
|
var t, f, d;
|
|
264
264
|
return ie(), Me("div", null, [
|
|
265
|
-
Se(z(
|
|
266
|
-
class: $e([`${
|
|
265
|
+
Se(z(Pe), {
|
|
266
|
+
class: $e([`${qe}-upload`]),
|
|
267
267
|
ref_key: "uploadInsRef",
|
|
268
268
|
ref: x,
|
|
269
269
|
"list-type": "picture-card",
|
|
@@ -287,27 +287,27 @@ const Ne = /* @__PURE__ */ we({
|
|
|
287
287
|
}, ke({ _: 2 }, [
|
|
288
288
|
(t = z(E)) != null && t.image ? {
|
|
289
289
|
name: "image",
|
|
290
|
-
fn:
|
|
291
|
-
|
|
290
|
+
fn: T(({ fileItem: r }) => [
|
|
291
|
+
V(a.$slots, "image", { fileItem: r })
|
|
292
292
|
]),
|
|
293
293
|
key: "0"
|
|
294
294
|
} : void 0,
|
|
295
295
|
(f = z(E)) != null && f["upload-button"] ? {
|
|
296
296
|
name: "upload-button",
|
|
297
|
-
fn:
|
|
298
|
-
|
|
297
|
+
fn: T(() => [
|
|
298
|
+
V(a.$slots, "upload-button")
|
|
299
299
|
]),
|
|
300
300
|
key: "1"
|
|
301
301
|
} : void 0,
|
|
302
302
|
(d = z(E)) != null && d["extra-button"] ? {
|
|
303
303
|
name: "extra-button",
|
|
304
|
-
fn:
|
|
305
|
-
|
|
304
|
+
fn: T((r) => [
|
|
305
|
+
V(a.$slots, "extra-button", ze(je(r)))
|
|
306
306
|
]),
|
|
307
307
|
key: "2"
|
|
308
308
|
} : void 0
|
|
309
309
|
]), 1032, ["class", "tip", "file-list", "action", "headers", "data", "name", "accept", "multiple", "limit", "disabled"]),
|
|
310
|
-
m.value && n.value !== void 0 ? (ie(), Le(
|
|
310
|
+
m.value && n.value !== void 0 ? (ie(), Le(Qe, {
|
|
311
311
|
key: 0,
|
|
312
312
|
ref_key: "cropperInsRef",
|
|
313
313
|
ref: v,
|
|
@@ -323,5 +323,5 @@ const Ne = /* @__PURE__ */ we({
|
|
|
323
323
|
}
|
|
324
324
|
});
|
|
325
325
|
export {
|
|
326
|
-
|
|
326
|
+
Ae as default
|
|
327
327
|
};
|
|
@@ -2373,9 +2373,7 @@ declare const ProImageUpload: {
|
|
|
2373
2373
|
fileItem: any;
|
|
2374
2374
|
}): any;
|
|
2375
2375
|
'upload-button'?(_: {}): any;
|
|
2376
|
-
'extra-button'?(_:
|
|
2377
|
-
fileItem: any;
|
|
2378
|
-
}): any;
|
|
2376
|
+
'extra-button'?(_: any): any;
|
|
2379
2377
|
};
|
|
2380
2378
|
}) & {
|
|
2381
2379
|
install: (app: App) => void;
|
package/package.json
CHANGED