@keyblade/pro-components 1.12.1-alpha.16 → 1.12.1-alpha.18

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.d.ts CHANGED
@@ -13,4 +13,5 @@ export { default as ProPageContainer } from './pro-page-container';
13
13
  export { default as ProReuseTabs } from './pro-reuse-tabs';
14
14
  export type { IProTab } from './pro-reuse-tabs';
15
15
  export { default as ProImageUpload } from './pro-image-upload';
16
+ export * from './pro-image-upload';
16
17
  export type {} from './components';
package/es/index.js CHANGED
@@ -1,29 +1,33 @@
1
1
  import { ProPageHeader as o } from "./pro-page-header/index.js";
2
- import { default as b } from "./pro-page-header/index.js";
2
+ import { default as U } from "./pro-page-header/index.js";
3
3
  import { ProKeepAliveRouterView as r } from "./pro-keep-alive-router-view/index.js";
4
- import { default as w } from "./pro-keep-alive-router-view/index.js";
4
+ import { default as b } from "./pro-keep-alive-router-view/index.js";
5
5
  import { ProLayout as t } from "./pro-layout/index.js";
6
- import { default as A } from "./pro-layout/index.js";
6
+ import { default as w } from "./pro-layout/index.js";
7
7
  import { ProMenu as a } from "./pro-menu/index.js";
8
- import { default as H } from "./pro-menu/index.js";
8
+ import { default as A } from "./pro-menu/index.js";
9
9
  import { ProPageContainer as m } from "./pro-page-container/index.js";
10
- import { default as K } from "./pro-page-container/index.js";
11
- import { ProReuseTabs as u } from "./pro-reuse-tabs/index.js";
12
- import { default as M } from "./pro-reuse-tabs/index.js";
13
- import { ProImageUpload as f } from "./pro-image-upload/index.js";
14
- import { default as U } from "./pro-image-upload/index.js";
15
- const p = {
10
+ import { default as H } from "./pro-page-container/index.js";
11
+ import { ProReuseTabs as f } from "./pro-reuse-tabs/index.js";
12
+ import { default as L } from "./pro-reuse-tabs/index.js";
13
+ import { ProImageUpload as u } from "./pro-image-upload/index.js";
14
+ import { default as T } from "./pro-image-upload/index.js";
15
+ import { EImageUploadInnerBeforeUploadStep as c } from "./pro-image-upload/types.js";
16
+ import { defaultImageUploadOptions as E } from "./pro-image-upload/constant.js";
17
+ const x = {
16
18
  install(e) {
17
- e.use(f), e.use(o), e.use(r), e.use(t), e.use(a), e.use(m), e.use(u);
19
+ e.use(o), e.use(r), e.use(t), e.use(a), e.use(m), e.use(f), e.use(u);
18
20
  }
19
21
  };
20
22
  export {
21
- U as ProImageUpload,
22
- w as ProKeepAliveRouterView,
23
- A as ProLayout,
24
- H as ProMenu,
25
- K as ProPageContainer,
26
- b as ProPageHeader,
27
- M as ProReuseTabs,
28
- p as default
23
+ c as EImageUploadInnerBeforeUploadStep,
24
+ T as ProImageUpload,
25
+ b as ProKeepAliveRouterView,
26
+ w as ProLayout,
27
+ A as ProMenu,
28
+ H as ProPageContainer,
29
+ U as ProPageHeader,
30
+ L as ProReuseTabs,
31
+ x as default,
32
+ E as defaultImageUploadOptions
29
33
  };
@@ -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
- modelValue: {
7
- required: true;
8
- type: import('vue').PropType<FileItem[]>;
9
- };
10
- data: {
11
- type: import('vue').PropType<Record<string, any>>;
12
- };
13
- onError: {
14
- type: import('vue').PropType<(fileItem: FileItem) => void>;
15
- };
16
- action: {
17
- type: import('vue').PropType<string>;
18
- required: true;
19
- };
20
- handlerResponse: {
21
- type: import('vue').PropType<(response: any) => Promise<{
22
- [key: string]: any;
23
- /** 是否成功 */
24
- success: boolean;
25
- /** 图片地址 */
26
- url?: string | undefined;
27
- /** 错误消息(如果不传,请自行提示错误消息) */
28
- errorMessage?: string | undefined;
29
- }>>;
30
- };
31
- headers: {
32
- type: import('vue').PropType<Record<string, any>>;
33
- };
34
- name: {
35
- type: import('vue').PropType<string>;
36
- default: string | undefined;
37
- };
38
- tip: {
39
- type: import('vue').PropType<string>;
40
- };
41
- accept: {
42
- type: import('vue').PropType<string[]>;
43
- default: () => string[];
44
- };
45
- multiple: {
46
- type: import('vue').PropType<boolean>;
47
- default: boolean | undefined;
48
- };
49
- singleLimit: {
50
- type: import('vue').PropType<number>;
51
- default: number | undefined;
52
- };
53
- limit: {
54
- type: import('vue').PropType<number>;
55
- };
56
- disabled: {
57
- type: import('vue').PropType<boolean>;
58
- default: boolean | undefined;
59
- };
60
- hideInnerBeforeUploadLoading: {
61
- type: import('vue').PropType<boolean>;
62
- default: boolean | undefined;
63
- };
64
- checkOptions: {
65
- type: import('vue').PropType<ImageUploadCheckOptions>;
66
- };
67
- compressorOptions: {
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
- modelValue: {
580
- required: true;
581
- type: import('vue').PropType<FileItem[]>;
582
- };
583
- data: {
584
- type: import('vue').PropType<Record<string, any>>;
585
- };
586
- onError: {
587
- type: import('vue').PropType<(fileItem: FileItem) => void>;
588
- };
589
- action: {
590
- type: import('vue').PropType<string>;
591
- required: true;
592
- };
593
- handlerResponse: {
594
- type: import('vue').PropType<(response: any) => Promise<{
595
- [key: string]: any;
596
- /** 是否成功 */
597
- success: boolean;
598
- /** 图片地址 */
599
- url?: string | undefined;
600
- /** 错误消息(如果不传,请自行提示错误消息) */
601
- errorMessage?: string | undefined;
602
- }>>;
603
- };
604
- headers: {
605
- type: import('vue').PropType<Record<string, any>>;
606
- };
607
- name: {
608
- type: import('vue').PropType<string>;
609
- default: string | undefined;
610
- };
611
- tip: {
612
- type: import('vue').PropType<string>;
613
- };
614
- accept: {
615
- type: import('vue').PropType<string[]>;
616
- default: () => string[];
617
- };
618
- multiple: {
619
- type: import('vue').PropType<boolean>;
620
- default: boolean | undefined;
621
- };
622
- singleLimit: {
623
- type: import('vue').PropType<number>;
624
- default: number | undefined;
625
- };
626
- limit: {
627
- type: import('vue').PropType<number>;
628
- };
629
- disabled: {
630
- type: import('vue').PropType<boolean>;
631
- default: boolean | undefined;
632
- };
633
- hideInnerBeforeUploadLoading: {
634
- type: import('vue').PropType<boolean>;
635
- default: boolean | undefined;
636
- };
637
- checkOptions: {
638
- type: import('vue').PropType<ImageUploadCheckOptions>;
639
- };
640
- compressorOptions: {
641
- type: import('vue').PropType<ImageUploadCompressorOptions>;
642
- };
643
- cropOptions: {
644
- type: import('vue').PropType<ImageUploadCropOptions>;
645
- };
646
- onSuccess: {
647
- type: import('vue').PropType<(fileItem: FileItem) => void>;
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 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
- import { Message as I } from "@arco-design/web-vue";
3
- import { conclude as B } from "vue-global-config";
4
- import { EImageUploadInnerBeforeUploadStep as u } from "./types.js";
5
- import { defaultImageUploadOptions as f } from "./constant.js";
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({
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: /* @__PURE__ */ F({
11
+ props: {
11
12
  action: {},
12
13
  handlerResponse: {},
13
14
  headers: {},
14
15
  data: {},
15
- name: { default: (q = f) == null ? void 0 : q.name },
16
+ name: { default: (D = x) == null ? void 0 : D.name },
16
17
  tip: {},
17
18
  accept: { default: () => {
18
- var v;
19
- return ((v = f) == null ? void 0 : v.accept) || [];
19
+ var B;
20
+ return ((B = x) == null ? void 0 : B.accept) || [];
20
21
  } },
21
- multiple: { type: Boolean, default: f.multiple },
22
- singleLimit: { default: f.singleLimit },
22
+ multiple: { type: Boolean, default: x.multiple },
23
+ singleLimit: { default: x.singleLimit },
23
24
  limit: {},
24
- disabled: { type: Boolean, default: (P = f) == null ? void 0 : P.disabled },
25
- hideInnerBeforeUploadLoading: { type: Boolean, default: (D = f) == null ? void 0 : D.hideInnerBeforeUploadLoading },
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
- modelValue: { required: !0 },
37
- modelModifiers: {}
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 = d(), r = d();
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)
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 i = w.value[o.value], { file: l, resolve: h, reject: x } = i;
52
- let s = l.name, t = l;
53
- if ((y = n.value) != null && y.enable) {
54
- r.value = {
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
- }, (E = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || E.call(
92
+ }, (w = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || w.call(
58
93
  e,
59
- l,
94
+ n,
60
95
  o.value,
61
- u.check
96
+ m.check
62
97
  );
63
- const a = await le(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
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 (r.value = void 0, (O = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || O.call(
106
+ if (c.value = void 0, (S = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || S.call(
72
107
  e,
73
- l,
108
+ n,
74
109
  o.value,
75
- u.check,
110
+ m.check,
76
111
  {
77
- success: a.success,
78
- error: a == null ? void 0 : a.error,
79
- errorMessage: a == null ? void 0 : a.errorMessage
112
+ success: l.success,
113
+ error: l == null ? void 0 : l.error,
114
+ errorMessage: l == null ? void 0 : l.errorMessage
80
115
  }
81
- ), !a.success)
82
- return (C = n.value) != null && C.showErrorMessage && I.error((a == null ? void 0 : a.errorMessage) || "图片校验及转换失败"), x();
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
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
- t = a.file;
124
+ r = l.file;
90
125
  }
91
- if ((S = p.value) != null && S.enable) {
92
- (b = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || b.call(
126
+ if ((F = y.value) != null && F.enable) {
127
+ (z = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || z.call(
93
128
  e,
94
- l,
129
+ n,
95
130
  o.value,
96
- u.crop
131
+ m.crop
97
132
  );
98
133
  try {
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
- }), (z = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || z.call(
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
- l,
138
+ n,
104
139
  o.value,
105
- u.crop,
140
+ m.crop,
106
141
  {
107
142
  success: !1
108
143
  }
109
144
  );
110
145
  } catch {
111
- return (j = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || j.call(
146
+ return (Q = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || Q.call(
112
147
  e,
113
- l,
148
+ n,
114
149
  o.value,
115
- u.crop,
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
- ), (L = p.value) != null && L.showErrorMessage && I.error("图片剪裁失败"), x();
158
+ ), (H = y.value) != null && H.showErrorMessage && U.error("图片剪裁失败"), u();
124
159
  } finally {
125
- M.value = void 0;
160
+ O.value = void 0;
126
161
  }
127
162
  }
128
- if (($ = g.value) != null && $.enable) {
129
- r.value = {
163
+ if ((W = p.value) != null && W.enable) {
164
+ c.value = {
130
165
  loading: !0,
131
166
  text: `第${o.value + 1}张图片处理中,请稍等`
132
- }, (H = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || H.call(
167
+ }, (P = e == null ? void 0 : e.onInnerBeforeUploadStart) == null || P.call(
133
168
  e,
134
- l,
169
+ n,
135
170
  o.value,
136
- u.compress
171
+ m.compress
137
172
  );
138
- const a = await te(t, {
139
- maxSize: g.value.maxSize,
140
- size: g.value.size,
141
- excludeAllowedTypes: (V = g.value.excludeAllowedTypes) == null ? void 0 : V.map((m) => `image/${m}`)
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 (r.value = void 0, (W = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || W.call(
178
+ if (c.value = void 0, (N = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || N.call(
144
179
  e,
145
- l,
180
+ n,
146
181
  o.value,
147
- u.compress,
182
+ m.compress,
148
183
  {
149
- success: a.success,
184
+ success: l.success,
150
185
  error: {
151
186
  compress: !0
152
187
  },
153
- errorMessage: a == null ? void 0 : a.errorMessage
188
+ errorMessage: l == null ? void 0 : l.errorMessage
154
189
  }
155
- ), !a.success)
156
- return (k = g.value) != null && k.showErrorMessage && I.error((a == null ? void 0 : a.errorMessage) || "图片压缩失败"), x();
157
- t = new File([a.file], s, {
158
- type: a.file.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
- r.value = void 0, (Q = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || Q.call(
196
+ c.value = void 0, (V = e == null ? void 0 : e.onInnerBeforeUploadEnd) == null || V.call(
162
197
  e,
163
- l,
198
+ n,
164
199
  o.value,
165
- u.all,
200
+ m.all,
166
201
  {
167
202
  success: !0
168
203
  }
169
- ), h(t);
204
+ ), t(r);
170
205
  });
171
- let c;
172
- return T(
173
- () => r.value,
206
+ let h;
207
+ return _(
208
+ () => c.value,
174
209
  () => {
175
- var i;
176
- r.value ? c = I.loading({
177
- content: r.value.text,
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
- }) : (i = c == null ? void 0 : c.close) == null || i.call(c);
215
+ }) : (a = h == null ? void 0 : h.close) == null || a.call(h);
181
216
  }
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"])
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
- fe as default
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
  };
@@ -1750,5 +1738,7 @@ declare const ProImageUpload: {
1750
1738
  }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & {
1751
1739
  install: (app: App) => void;
1752
1740
  };
1741
+ export * from './types';
1742
+ export * from './constant';
1753
1743
  export { ProImageUpload };
1754
1744
  export default ProImageUpload;
@@ -1,11 +1,11 @@
1
- import a from "./image-upload.vue.js";
2
- import { Upload as m } from "@arco-design/web-vue";
3
- const t = Object.assign(a, {
1
+ import e from "./image-upload.vue.js";
2
+ import { Modal as s, Upload as t, Button as l, Tooltip as m, Spin as n, Space as u, Message as a } from "@arco-design/web-vue";
3
+ const r = Object.assign(e, {
4
4
  install: (o) => {
5
- o.use(m), o.component("KbProImageUpload", a);
5
+ o.use(s), o.use(t), o.use(l), o.use(m), o.use(n), o.use(u), o.use(a), o.component("KbProImageUpload", e);
6
6
  }
7
- }), s = t;
7
+ }), d = r;
8
8
  export {
9
- t as ProImageUpload,
10
- s as default
9
+ r as ProImageUpload,
10
+ d as default
11
11
  };
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-menu .keyblade-pro-menu-item-img{width:14px;height:auto}.keyblade-pro-page-container .keyblade-pro-page-container-content{padding:20px}.keyblade-pro-reuse-tabs{position:relative;background-color:var(--color-bg-2);padding:4px 20px}.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}
1
+ .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-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-reuse-tabs{position:relative;background-color:var(--color-bg-2);padding:4px 20px}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@keyblade/pro-components",
3
3
  "description": "KeyBlade Pro Components",
4
4
  "author": "yangshuai <704807396@qq.com>",
5
- "version": "1.12.1-alpha.16",
5
+ "version": "1.12.1-alpha.18",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",