@keyblade/pro-components 1.12.1-alpha.16 → 1.12.1-alpha.17
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.
|
@@ -2,101 +2,77 @@ import { FileItem } from '@arco-design/web-vue';
|
|
|
2
2
|
import { EImageUploadInnerBeforeUploadStep } from './types';
|
|
3
3
|
import { ImageUploadCheckOptions, ImageUploadCompressorOptions, ImageUploadCropOptions } from '@keyblade/one-travel';
|
|
4
4
|
|
|
5
|
-
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
type: import('vue').PropType<ImageUploadCompressorOptions>;
|
|
69
|
-
};
|
|
70
|
-
cropOptions: {
|
|
71
|
-
type: import('vue').PropType<ImageUploadCropOptions>;
|
|
72
|
-
};
|
|
73
|
-
onSuccess: {
|
|
74
|
-
type: import('vue').PropType<(fileItem: FileItem) => void>;
|
|
75
|
-
};
|
|
76
|
-
onExceed: {
|
|
77
|
-
type: import('vue').PropType<(fileList: FileItem[], files: File[]) => void>;
|
|
78
|
-
};
|
|
79
|
-
onBeforeUpload: {
|
|
80
|
-
type: import('vue').PropType<(file: File) => boolean | Promise<any>>;
|
|
81
|
-
};
|
|
82
|
-
onInnerBeforeUploadStart: {
|
|
83
|
-
type: import('vue').PropType<(file: File, index: number, type: EImageUploadInnerBeforeUploadStep) => void>;
|
|
84
|
-
};
|
|
85
|
-
onInnerBeforeUploadEnd: {
|
|
86
|
-
type: import('vue').PropType<(file: File, index: number, type: EImageUploadInnerBeforeUploadStep, result: {
|
|
87
|
-
success: boolean;
|
|
88
|
-
error?: {
|
|
89
|
-
size?: boolean;
|
|
90
|
-
format?: boolean;
|
|
91
|
-
transform?: boolean;
|
|
92
|
-
pixel?: boolean;
|
|
93
|
-
compress?: boolean;
|
|
94
|
-
crop?: boolean;
|
|
95
|
-
};
|
|
96
|
-
errorMessage?: string;
|
|
97
|
-
}) => void>;
|
|
98
|
-
};
|
|
5
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
6
|
+
/** 上传地址 */
|
|
7
|
+
action: string;
|
|
8
|
+
/** 处理响应 */
|
|
9
|
+
handlerResponse?: ((response: any) => Promise<{
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
/** 是否成功 */
|
|
12
|
+
success: boolean;
|
|
13
|
+
/** 图片地址 */
|
|
14
|
+
url?: string | undefined;
|
|
15
|
+
/** 错误消息(如果不传,请自行提示错误消息) */
|
|
16
|
+
errorMessage?: string | undefined;
|
|
17
|
+
}>) | undefined;
|
|
18
|
+
/** 设置上传的请求头部 */
|
|
19
|
+
headers?: Record<string, any> | undefined;
|
|
20
|
+
/** 上传时附带的额外参数 */
|
|
21
|
+
data?: Record<string, any> | undefined;
|
|
22
|
+
/** 上传的文件字段名 - 默认: file */
|
|
23
|
+
name?: string | undefined;
|
|
24
|
+
/** 提示文字 */
|
|
25
|
+
tip?: string | undefined;
|
|
26
|
+
/** 接受上传的文件类型 - 默认: ['jpg', 'jpeg', 'png', 'bmp', 'heif', 'heic', 'gif', 'webp'] */
|
|
27
|
+
accept?: string[] | undefined;
|
|
28
|
+
/** 是否支持多选文件 - 默认: true */
|
|
29
|
+
multiple?: boolean | undefined;
|
|
30
|
+
/** 单次最大限制 - 默认: 10 */
|
|
31
|
+
singleLimit?: number | undefined;
|
|
32
|
+
/** 最大允许上传个数 */
|
|
33
|
+
limit?: number | undefined;
|
|
34
|
+
/** 是否禁用 - 默认: false */
|
|
35
|
+
disabled?: boolean | undefined;
|
|
36
|
+
/** 隐藏内置上传文件之前的loading效果 - 默认: false */
|
|
37
|
+
hideInnerBeforeUploadLoading?: boolean | undefined;
|
|
38
|
+
/** 校验选项 */
|
|
39
|
+
checkOptions?: ImageUploadCheckOptions | undefined;
|
|
40
|
+
/** 压缩选项 */
|
|
41
|
+
compressorOptions?: ImageUploadCompressorOptions | undefined;
|
|
42
|
+
/** 剪裁选项 */
|
|
43
|
+
cropOptions?: ImageUploadCropOptions | undefined;
|
|
44
|
+
/** 文件列表移除文件时的钩子 */
|
|
45
|
+
/** 文件上传成功时的钩子 */
|
|
46
|
+
onSuccess?: ((fileItem: FileItem) => void) | undefined;
|
|
47
|
+
/** 文件上传失败时的钩子 */
|
|
48
|
+
onError?: ((fileItem: FileItem) => void) | undefined;
|
|
49
|
+
/** 文件超出个数限制时的钩子 */
|
|
50
|
+
onExceed?: ((fileList: FileItem[], files: File[]) => void) | undefined;
|
|
51
|
+
/** 上传文件之前的钩子,参数为上传的文件,若返回 false 或者返回 Promise 且被 reject,则停止上传。*/
|
|
52
|
+
onBeforeUpload?: ((file: File) => boolean | Promise<any>) | undefined;
|
|
53
|
+
/** 内置上传文件之前开始 */
|
|
54
|
+
onInnerBeforeUploadStart?: ((file: File, index: number, type: EImageUploadInnerBeforeUploadStep) => void) | undefined;
|
|
55
|
+
/** 内置上传文件之前结束 */
|
|
56
|
+
onInnerBeforeUploadEnd?: ((file: File, index: number, type: EImageUploadInnerBeforeUploadStep, result: {
|
|
57
|
+
success: boolean;
|
|
58
|
+
error?: {
|
|
59
|
+
size?: boolean;
|
|
60
|
+
format?: boolean;
|
|
61
|
+
transform?: boolean;
|
|
62
|
+
pixel?: boolean;
|
|
63
|
+
compress?: boolean;
|
|
64
|
+
crop?: boolean;
|
|
65
|
+
};
|
|
66
|
+
errorMessage?: string;
|
|
67
|
+
}) => void) | undefined;
|
|
99
68
|
}>, {
|
|
69
|
+
name: string | undefined;
|
|
70
|
+
accept: () => string[];
|
|
71
|
+
multiple: boolean | undefined;
|
|
72
|
+
singleLimit: number | undefined;
|
|
73
|
+
disabled: boolean | undefined;
|
|
74
|
+
hideInnerBeforeUploadLoading: boolean | undefined;
|
|
75
|
+
}>>, {
|
|
100
76
|
uploadInsRef: import('vue').Ref<import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
101
77
|
fileList?: unknown;
|
|
102
78
|
defaultFileList?: unknown;
|
|
@@ -575,101 +551,77 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
575
551
|
cropperInsRef: import('vue').Ref<any, any>;
|
|
576
552
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
577
553
|
cropperImgLoad: (value: File) => void;
|
|
578
|
-
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
onExceed: {
|
|
650
|
-
type: import('vue').PropType<(fileList: FileItem[], files: File[]) => void>;
|
|
651
|
-
};
|
|
652
|
-
onBeforeUpload: {
|
|
653
|
-
type: import('vue').PropType<(file: File) => boolean | Promise<any>>;
|
|
654
|
-
};
|
|
655
|
-
onInnerBeforeUploadStart: {
|
|
656
|
-
type: import('vue').PropType<(file: File, index: number, type: EImageUploadInnerBeforeUploadStep) => void>;
|
|
657
|
-
};
|
|
658
|
-
onInnerBeforeUploadEnd: {
|
|
659
|
-
type: import('vue').PropType<(file: File, index: number, type: EImageUploadInnerBeforeUploadStep, result: {
|
|
660
|
-
success: boolean;
|
|
661
|
-
error?: {
|
|
662
|
-
size?: boolean;
|
|
663
|
-
format?: boolean;
|
|
664
|
-
transform?: boolean;
|
|
665
|
-
pixel?: boolean;
|
|
666
|
-
compress?: boolean;
|
|
667
|
-
crop?: boolean;
|
|
668
|
-
};
|
|
669
|
-
errorMessage?: string;
|
|
670
|
-
}) => void>;
|
|
671
|
-
};
|
|
672
|
-
}>> & Readonly<{
|
|
554
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
555
|
+
/** 上传地址 */
|
|
556
|
+
action: string;
|
|
557
|
+
/** 处理响应 */
|
|
558
|
+
handlerResponse?: ((response: any) => Promise<{
|
|
559
|
+
[key: string]: any;
|
|
560
|
+
/** 是否成功 */
|
|
561
|
+
success: boolean;
|
|
562
|
+
/** 图片地址 */
|
|
563
|
+
url?: string | undefined;
|
|
564
|
+
/** 错误消息(如果不传,请自行提示错误消息) */
|
|
565
|
+
errorMessage?: string | undefined;
|
|
566
|
+
}>) | undefined;
|
|
567
|
+
/** 设置上传的请求头部 */
|
|
568
|
+
headers?: Record<string, any> | undefined;
|
|
569
|
+
/** 上传时附带的额外参数 */
|
|
570
|
+
data?: Record<string, any> | undefined;
|
|
571
|
+
/** 上传的文件字段名 - 默认: file */
|
|
572
|
+
name?: string | undefined;
|
|
573
|
+
/** 提示文字 */
|
|
574
|
+
tip?: string | undefined;
|
|
575
|
+
/** 接受上传的文件类型 - 默认: ['jpg', 'jpeg', 'png', 'bmp', 'heif', 'heic', 'gif', 'webp'] */
|
|
576
|
+
accept?: string[] | undefined;
|
|
577
|
+
/** 是否支持多选文件 - 默认: true */
|
|
578
|
+
multiple?: boolean | undefined;
|
|
579
|
+
/** 单次最大限制 - 默认: 10 */
|
|
580
|
+
singleLimit?: number | undefined;
|
|
581
|
+
/** 最大允许上传个数 */
|
|
582
|
+
limit?: number | undefined;
|
|
583
|
+
/** 是否禁用 - 默认: false */
|
|
584
|
+
disabled?: boolean | undefined;
|
|
585
|
+
/** 隐藏内置上传文件之前的loading效果 - 默认: false */
|
|
586
|
+
hideInnerBeforeUploadLoading?: boolean | undefined;
|
|
587
|
+
/** 校验选项 */
|
|
588
|
+
checkOptions?: ImageUploadCheckOptions | undefined;
|
|
589
|
+
/** 压缩选项 */
|
|
590
|
+
compressorOptions?: ImageUploadCompressorOptions | undefined;
|
|
591
|
+
/** 剪裁选项 */
|
|
592
|
+
cropOptions?: ImageUploadCropOptions | undefined;
|
|
593
|
+
/** 文件列表移除文件时的钩子 */
|
|
594
|
+
/** 文件上传成功时的钩子 */
|
|
595
|
+
onSuccess?: ((fileItem: FileItem) => void) | undefined;
|
|
596
|
+
/** 文件上传失败时的钩子 */
|
|
597
|
+
onError?: ((fileItem: FileItem) => void) | undefined;
|
|
598
|
+
/** 文件超出个数限制时的钩子 */
|
|
599
|
+
onExceed?: ((fileList: FileItem[], files: File[]) => void) | undefined;
|
|
600
|
+
/** 上传文件之前的钩子,参数为上传的文件,若返回 false 或者返回 Promise 且被 reject,则停止上传。*/
|
|
601
|
+
onBeforeUpload?: ((file: File) => boolean | Promise<any>) | undefined;
|
|
602
|
+
/** 内置上传文件之前开始 */
|
|
603
|
+
onInnerBeforeUploadStart?: ((file: File, index: number, type: EImageUploadInnerBeforeUploadStep) => void) | undefined;
|
|
604
|
+
/** 内置上传文件之前结束 */
|
|
605
|
+
onInnerBeforeUploadEnd?: ((file: File, index: number, type: EImageUploadInnerBeforeUploadStep, result: {
|
|
606
|
+
success: boolean;
|
|
607
|
+
error?: {
|
|
608
|
+
size?: boolean;
|
|
609
|
+
format?: boolean;
|
|
610
|
+
transform?: boolean;
|
|
611
|
+
pixel?: boolean;
|
|
612
|
+
compress?: boolean;
|
|
613
|
+
crop?: boolean;
|
|
614
|
+
};
|
|
615
|
+
errorMessage?: string;
|
|
616
|
+
}) => void) | undefined;
|
|
617
|
+
}>, {
|
|
618
|
+
name: string | undefined;
|
|
619
|
+
accept: () => string[];
|
|
620
|
+
multiple: boolean | undefined;
|
|
621
|
+
singleLimit: number | undefined;
|
|
622
|
+
disabled: boolean | undefined;
|
|
623
|
+
hideInnerBeforeUploadLoading: boolean | undefined;
|
|
624
|
+
}>>> & Readonly<{
|
|
673
625
|
onCropperImgLoad?: ((value: File) => any) | undefined;
|
|
674
626
|
}>, {
|
|
675
627
|
name: string;
|
|
@@ -680,3 +632,20 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
680
632
|
hideInnerBeforeUploadLoading: boolean;
|
|
681
633
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
682
634
|
export default _default;
|
|
635
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
636
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
637
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
638
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
639
|
+
} : {
|
|
640
|
+
type: import('vue').PropType<T[K]>;
|
|
641
|
+
required: true;
|
|
642
|
+
};
|
|
643
|
+
};
|
|
644
|
+
type __VLS_WithDefaults<P, D> = {
|
|
645
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
646
|
+
default: D[K];
|
|
647
|
+
}> : P[K];
|
|
648
|
+
};
|
|
649
|
+
type __VLS_Prettify<T> = {
|
|
650
|
+
[K in keyof T]: T[K];
|
|
651
|
+
} & {};
|
|
@@ -1,28 +1,29 @@
|
|
|
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
|
-
|
|
1
|
+
import { defineComponent as ne, ref as v, computed as C, watch as _, 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
|
+
import { EImageUploadInnerBeforeUploadStep as m } from "./types.js";
|
|
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 D, G, J;
|
|
9
|
+
const Ee = /* @__PURE__ */ ne({
|
|
9
10
|
__name: "image-upload",
|
|
10
|
-
props:
|
|
11
|
+
props: {
|
|
11
12
|
action: {},
|
|
12
13
|
handlerResponse: {},
|
|
13
14
|
headers: {},
|
|
14
15
|
data: {},
|
|
15
|
-
name: { default: (
|
|
16
|
+
name: { default: (D = x) == null ? void 0 : D.name },
|
|
16
17
|
tip: {},
|
|
17
18
|
accept: { default: () => {
|
|
18
|
-
var
|
|
19
|
-
return ((
|
|
19
|
+
var B;
|
|
20
|
+
return ((B = x) == null ? void 0 : B.accept) || [];
|
|
20
21
|
} },
|
|
21
|
-
multiple: { type: Boolean, default:
|
|
22
|
-
singleLimit: { default:
|
|
22
|
+
multiple: { type: Boolean, default: x.multiple },
|
|
23
|
+
singleLimit: { default: x.singleLimit },
|
|
23
24
|
limit: {},
|
|
24
|
-
disabled: { type: Boolean, default: (
|
|
25
|
-
hideInnerBeforeUploadLoading: { type: Boolean, default: (
|
|
25
|
+
disabled: { type: Boolean, default: (G = x) == null ? void 0 : G.disabled },
|
|
26
|
+
hideInnerBeforeUploadLoading: { type: Boolean, default: (J = x) == null ? void 0 : J.hideInnerBeforeUploadLoading },
|
|
26
27
|
checkOptions: {},
|
|
27
28
|
compressorOptions: {},
|
|
28
29
|
cropOptions: {},
|
|
@@ -32,87 +33,121 @@ const fe = /* @__PURE__ */ N({
|
|
|
32
33
|
onBeforeUpload: {},
|
|
33
34
|
onInnerBeforeUploadStart: {},
|
|
34
35
|
onInnerBeforeUploadEnd: {}
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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(
|
|
36
|
+
},
|
|
37
|
+
emits: ["cropperImgLoad"],
|
|
38
|
+
setup(B, { expose: K, emit: ge }) {
|
|
39
|
+
const i = v([]), e = B, M = v(), X = v(), O = v(), g = v(
|
|
43
40
|
[]
|
|
44
|
-
), o =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
), o = v(), c = v(), d = v(), Y = 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]) || {}), Z = (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) => {
|
|
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
|
+
_(o, async () => {
|
|
83
|
+
var E, w, S, $, F, z, j, k, Q, H, W, P, T, N, q, V;
|
|
84
|
+
if (o.value === void 0 || g.value.length === 0)
|
|
50
85
|
return;
|
|
51
|
-
const
|
|
52
|
-
let s =
|
|
53
|
-
if ((
|
|
54
|
-
|
|
86
|
+
const a = g.value[o.value], { file: n, resolve: t, reject: u } = a;
|
|
87
|
+
let s = n.name, r = n;
|
|
88
|
+
if ((E = f.value) != null && E.enable) {
|
|
89
|
+
c.value = {
|
|
55
90
|
loading: !0,
|
|
56
91
|
text: `第${o.value + 1}张图片检测中,请稍等`
|
|
57
|
-
}, (
|
|
92
|
+
}, (w = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || w.call(
|
|
58
93
|
e,
|
|
59
|
-
|
|
94
|
+
n,
|
|
60
95
|
o.value,
|
|
61
|
-
|
|
96
|
+
m.check
|
|
62
97
|
);
|
|
63
|
-
const
|
|
64
|
-
imageMaxSize:
|
|
65
|
-
imageAllowedType:
|
|
66
|
-
imageMinWidth:
|
|
67
|
-
imageMinHeight:
|
|
68
|
-
imageMaxWidth:
|
|
69
|
-
imageMaxHeight:
|
|
98
|
+
const l = await fe(n, n.name, {
|
|
99
|
+
imageMaxSize: f.value.maxSize,
|
|
100
|
+
imageAllowedType: f.value.allowedType,
|
|
101
|
+
imageMinWidth: f.value.minWidth,
|
|
102
|
+
imageMinHeight: f.value.minHeight,
|
|
103
|
+
imageMaxWidth: f.value.maxWidth,
|
|
104
|
+
imageMaxHeight: f.value.maxHeight
|
|
70
105
|
});
|
|
71
|
-
if (
|
|
106
|
+
if (c.value = void 0, (S = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || S.call(
|
|
72
107
|
e,
|
|
73
|
-
|
|
108
|
+
n,
|
|
74
109
|
o.value,
|
|
75
|
-
|
|
110
|
+
m.check,
|
|
76
111
|
{
|
|
77
|
-
success:
|
|
78
|
-
error:
|
|
79
|
-
errorMessage:
|
|
112
|
+
success: l.success,
|
|
113
|
+
error: l == null ? void 0 : l.error,
|
|
114
|
+
errorMessage: l == null ? void 0 : l.errorMessage
|
|
80
115
|
}
|
|
81
|
-
), !
|
|
82
|
-
return (
|
|
83
|
-
if (
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
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
|
|
87
122
|
});
|
|
88
123
|
} else
|
|
89
|
-
|
|
124
|
+
r = l.file;
|
|
90
125
|
}
|
|
91
|
-
if ((
|
|
92
|
-
(
|
|
126
|
+
if ((F = y.value) != null && F.enable) {
|
|
127
|
+
(z = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || z.call(
|
|
93
128
|
e,
|
|
94
|
-
|
|
129
|
+
n,
|
|
95
130
|
o.value,
|
|
96
|
-
|
|
131
|
+
m.crop
|
|
97
132
|
);
|
|
98
133
|
try {
|
|
99
|
-
(
|
|
100
|
-
|
|
101
|
-
}), (
|
|
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(
|
|
102
137
|
e,
|
|
103
|
-
|
|
138
|
+
n,
|
|
104
139
|
o.value,
|
|
105
|
-
|
|
140
|
+
m.crop,
|
|
106
141
|
{
|
|
107
142
|
success: !1
|
|
108
143
|
}
|
|
109
144
|
);
|
|
110
145
|
} catch {
|
|
111
|
-
return (
|
|
146
|
+
return (Q = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || Q.call(
|
|
112
147
|
e,
|
|
113
|
-
|
|
148
|
+
n,
|
|
114
149
|
o.value,
|
|
115
|
-
|
|
150
|
+
m.crop,
|
|
116
151
|
{
|
|
117
152
|
success: !1,
|
|
118
153
|
error: {
|
|
@@ -120,76 +155,98 @@ const fe = /* @__PURE__ */ N({
|
|
|
120
155
|
},
|
|
121
156
|
errorMessage: "图片剪裁失败"
|
|
122
157
|
}
|
|
123
|
-
), (
|
|
158
|
+
), (H = y.value) != null && H.showErrorMessage && U.error("图片剪裁失败"), u();
|
|
124
159
|
} finally {
|
|
125
|
-
|
|
160
|
+
O.value = void 0;
|
|
126
161
|
}
|
|
127
162
|
}
|
|
128
|
-
if ((
|
|
129
|
-
|
|
163
|
+
if ((W = p.value) != null && W.enable) {
|
|
164
|
+
c.value = {
|
|
130
165
|
loading: !0,
|
|
131
166
|
text: `第${o.value + 1}张图片处理中,请稍等`
|
|
132
|
-
}, (
|
|
167
|
+
}, (P = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || P.call(
|
|
133
168
|
e,
|
|
134
|
-
|
|
169
|
+
n,
|
|
135
170
|
o.value,
|
|
136
|
-
|
|
171
|
+
m.compress
|
|
137
172
|
);
|
|
138
|
-
const
|
|
139
|
-
maxSize:
|
|
140
|
-
size:
|
|
141
|
-
excludeAllowedTypes: (
|
|
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}`)
|
|
142
177
|
});
|
|
143
|
-
if (
|
|
178
|
+
if (c.value = void 0, (N = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || N.call(
|
|
144
179
|
e,
|
|
145
|
-
|
|
180
|
+
n,
|
|
146
181
|
o.value,
|
|
147
|
-
|
|
182
|
+
m.compress,
|
|
148
183
|
{
|
|
149
|
-
success:
|
|
184
|
+
success: l.success,
|
|
150
185
|
error: {
|
|
151
186
|
compress: !0
|
|
152
187
|
},
|
|
153
|
-
errorMessage:
|
|
188
|
+
errorMessage: l == null ? void 0 : l.errorMessage
|
|
154
189
|
}
|
|
155
|
-
), !
|
|
156
|
-
return (
|
|
157
|
-
|
|
158
|
-
type:
|
|
190
|
+
), !l.success)
|
|
191
|
+
return (q = p.value) != null && q.showErrorMessage && U.error((l == null ? void 0 : l.errorMessage) || "图片压缩失败"), u();
|
|
192
|
+
r = new File([l.file], s, {
|
|
193
|
+
type: l.file.type
|
|
159
194
|
});
|
|
160
195
|
}
|
|
161
|
-
|
|
196
|
+
c.value = void 0, (V = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || V.call(
|
|
162
197
|
e,
|
|
163
|
-
|
|
198
|
+
n,
|
|
164
199
|
o.value,
|
|
165
|
-
|
|
200
|
+
m.all,
|
|
166
201
|
{
|
|
167
202
|
success: !0
|
|
168
203
|
}
|
|
169
|
-
),
|
|
204
|
+
), t(r);
|
|
170
205
|
});
|
|
171
|
-
let
|
|
172
|
-
return
|
|
173
|
-
() =>
|
|
206
|
+
let h;
|
|
207
|
+
return _(
|
|
208
|
+
() => c.value,
|
|
174
209
|
() => {
|
|
175
|
-
var
|
|
176
|
-
|
|
177
|
-
content:
|
|
210
|
+
var a;
|
|
211
|
+
c.value ? h = U.loading({
|
|
212
|
+
content: c.value.text,
|
|
178
213
|
id: "image-upload-id",
|
|
179
214
|
duration: 0
|
|
180
|
-
}) : (
|
|
215
|
+
}) : (a = h == null ? void 0 : h.close) == null || a.call(h);
|
|
181
216
|
}
|
|
182
|
-
),
|
|
183
|
-
uploadInsRef:
|
|
184
|
-
cropperInsRef:
|
|
185
|
-
}), (
|
|
186
|
-
const
|
|
187
|
-
return
|
|
188
|
-
|
|
217
|
+
), K({
|
|
218
|
+
uploadInsRef: M,
|
|
219
|
+
cropperInsRef: X
|
|
220
|
+
}), (a, n) => {
|
|
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: Y.value,
|
|
237
|
+
multiple: a.multiple,
|
|
238
|
+
limit: a.limit,
|
|
239
|
+
disabled: a.disabled,
|
|
240
|
+
"on-before-upload": Z,
|
|
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"])
|
|
189
246
|
]);
|
|
190
247
|
};
|
|
191
248
|
}
|
|
192
249
|
});
|
|
193
250
|
export {
|
|
194
|
-
|
|
251
|
+
Ee as default
|
|
195
252
|
};
|
|
@@ -2,10 +2,6 @@ import { App } from 'vue';
|
|
|
2
2
|
|
|
3
3
|
declare const ProImageUpload: {
|
|
4
4
|
new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
|
|
5
|
-
modelValue: {
|
|
6
|
-
required: true;
|
|
7
|
-
type: import('vue').PropType<import('@arco-design/web-vue').FileItem[]>;
|
|
8
|
-
};
|
|
9
5
|
data: {
|
|
10
6
|
type: import('vue').PropType<Record<string, any>>;
|
|
11
7
|
};
|
|
@@ -588,10 +584,6 @@ declare const ProImageUpload: {
|
|
|
588
584
|
M: {};
|
|
589
585
|
Defaults: {};
|
|
590
586
|
}, Readonly<import('vue').ExtractPropTypes<{
|
|
591
|
-
modelValue: {
|
|
592
|
-
required: true;
|
|
593
|
-
type: import('vue').PropType<import('@arco-design/web-vue').FileItem[]>;
|
|
594
|
-
};
|
|
595
587
|
data: {
|
|
596
588
|
type: import('vue').PropType<Record<string, any>>;
|
|
597
589
|
};
|
|
@@ -1169,10 +1161,6 @@ declare const ProImageUpload: {
|
|
|
1169
1161
|
__isTeleport?: undefined;
|
|
1170
1162
|
__isSuspense?: undefined;
|
|
1171
1163
|
} & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
|
|
1172
|
-
modelValue: {
|
|
1173
|
-
required: true;
|
|
1174
|
-
type: import('vue').PropType<import('@arco-design/web-vue').FileItem[]>;
|
|
1175
|
-
};
|
|
1176
1164
|
data: {
|
|
1177
1165
|
type: import('vue').PropType<Record<string, any>>;
|
|
1178
1166
|
};
|
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-
|
|
1
|
+
.keyblade-pro-reuse-tabs{position:relative;background-color:var(--color-bg-2);padding:4px 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-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-menu .keyblade-pro-menu-item-img{width:14px;height:auto}.keyblade-pro-page-container .keyblade-pro-page-container-content{padding:20px}
|
package/package.json
CHANGED