knt-shared 1.2.1 → 1.2.3
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/dist/components/Form/componentMap.d.ts +29 -3
- package/dist/components/Form/componentMap.d.ts.map +1 -1
- package/dist/components/Form/useForm.d.ts +1 -4
- package/dist/components/Form/useForm.d.ts.map +1 -1
- package/dist/components/Modal/useModal.d.ts.map +1 -1
- package/dist/components/Upload/BasicUpload.vue.d.ts +5 -0
- package/dist/components/Upload/BasicUpload.vue.d.ts.map +1 -1
- package/dist/components/Upload/types.d.ts +11 -12
- package/dist/components/Upload/types.d.ts.map +1 -1
- package/dist/index.cjs.js +53 -20
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +53 -20
- package/dist/index.esm.js.map +1 -1
- package/dist/style.css +5 -5
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Component } from 'vue';
|
|
2
|
+
import { Input } from '@arco-design/web-vue';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* 组件映射表(使用对象以获得更好的类型推断)
|
|
@@ -749,7 +750,7 @@ export declare const componentMap: {
|
|
|
749
750
|
default: boolean;
|
|
750
751
|
};
|
|
751
752
|
customRequest: {
|
|
752
|
-
type: import('vue').PropType<(options: import('..').CustomRequestOptions) =>
|
|
753
|
+
type: import('vue').PropType<(options: import('..').CustomRequestOptions) => void | Promise<void>>;
|
|
753
754
|
};
|
|
754
755
|
beforeUpload: {
|
|
755
756
|
type: import('vue').PropType<(file: File) => boolean | Promise<boolean>>;
|
|
@@ -827,6 +828,10 @@ export declare const componentMap: {
|
|
|
827
828
|
type: import('vue').PropType<"text" | "outline" | "dashed" | "primary" | "secondary">;
|
|
828
829
|
default: string;
|
|
829
830
|
};
|
|
831
|
+
responseUrlKey: {
|
|
832
|
+
type: import('vue').PropType<string | ((fileItem: Input) => string)>;
|
|
833
|
+
default: undefined;
|
|
834
|
+
};
|
|
830
835
|
}>> & Readonly<{
|
|
831
836
|
onRegister?: ((uploadInstance: any) => any) | undefined;
|
|
832
837
|
onProgress?: ((percent: number, fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
@@ -834,6 +839,8 @@ export declare const componentMap: {
|
|
|
834
839
|
"onUpdate:modelValue"?: ((value: string | string[] | import('..').UploadFileItem[]) => any) | undefined;
|
|
835
840
|
onChange?: ((fileList: import('..').UploadFileItem[]) => any) | undefined;
|
|
836
841
|
onSuccess?: ((response: any, fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
842
|
+
onHandleSuccess?: ((response: any, fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
843
|
+
onHandlError?: ((error: Error, fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
837
844
|
onRemove?: ((fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
838
845
|
onPreview?: ((fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
839
846
|
onExceed?: ((files: File[], fileList: import('..').UploadFileItem[]) => any) | undefined;
|
|
@@ -853,7 +860,9 @@ export declare const componentMap: {
|
|
|
853
860
|
"update:modelValue": (value: string | string[] | import('..').UploadFileItem[]) => void;
|
|
854
861
|
change: (fileList: import('..').UploadFileItem[]) => void;
|
|
855
862
|
success: (response: any, fileItem: import('..').UploadFileItem) => void;
|
|
863
|
+
handleSuccess: (response: any, fileItem: import('..').UploadFileItem) => void;
|
|
856
864
|
error: (error: Error, fileItem: import('..').UploadFileItem) => void;
|
|
865
|
+
handlError: (error: Error, fileItem: import('..').UploadFileItem) => void;
|
|
857
866
|
progress: (percent: number, fileItem: import('..').UploadFileItem) => void;
|
|
858
867
|
remove: (fileItem: import('..').UploadFileItem) => void;
|
|
859
868
|
preview: (fileItem: import('..').UploadFileItem) => void;
|
|
@@ -881,6 +890,7 @@ export declare const componentMap: {
|
|
|
881
890
|
autoUpload: boolean;
|
|
882
891
|
resultType: "fileList" | "url" | "string";
|
|
883
892
|
uploadButtonType: "primary" | "secondary" | "outline" | "dashed" | "text";
|
|
893
|
+
responseUrlKey: string | ((fileItem: Input) => string);
|
|
884
894
|
}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
885
895
|
P: {};
|
|
886
896
|
B: {};
|
|
@@ -944,7 +954,7 @@ export declare const componentMap: {
|
|
|
944
954
|
default: boolean;
|
|
945
955
|
};
|
|
946
956
|
customRequest: {
|
|
947
|
-
type: import('vue').PropType<(options: import('..').CustomRequestOptions) =>
|
|
957
|
+
type: import('vue').PropType<(options: import('..').CustomRequestOptions) => void | Promise<void>>;
|
|
948
958
|
};
|
|
949
959
|
beforeUpload: {
|
|
950
960
|
type: import('vue').PropType<(file: File) => boolean | Promise<boolean>>;
|
|
@@ -1022,6 +1032,10 @@ export declare const componentMap: {
|
|
|
1022
1032
|
type: import('vue').PropType<"text" | "outline" | "dashed" | "primary" | "secondary">;
|
|
1023
1033
|
default: string;
|
|
1024
1034
|
};
|
|
1035
|
+
responseUrlKey: {
|
|
1036
|
+
type: import('vue').PropType<string | ((fileItem: Input) => string)>;
|
|
1037
|
+
default: undefined;
|
|
1038
|
+
};
|
|
1025
1039
|
}>> & Readonly<{
|
|
1026
1040
|
onRegister?: ((uploadInstance: any) => any) | undefined;
|
|
1027
1041
|
onProgress?: ((percent: number, fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
@@ -1029,6 +1043,8 @@ export declare const componentMap: {
|
|
|
1029
1043
|
"onUpdate:modelValue"?: ((value: string | string[] | import('..').UploadFileItem[]) => any) | undefined;
|
|
1030
1044
|
onChange?: ((fileList: import('..').UploadFileItem[]) => any) | undefined;
|
|
1031
1045
|
onSuccess?: ((response: any, fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
1046
|
+
onHandleSuccess?: ((response: any, fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
1047
|
+
onHandlError?: ((error: Error, fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
1032
1048
|
onRemove?: ((fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
1033
1049
|
onPreview?: ((fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
1034
1050
|
onExceed?: ((files: File[], fileList: import('..').UploadFileItem[]) => any) | undefined;
|
|
@@ -1066,6 +1082,7 @@ export declare const componentMap: {
|
|
|
1066
1082
|
autoUpload: boolean;
|
|
1067
1083
|
resultType: "fileList" | "url" | "string";
|
|
1068
1084
|
uploadButtonType: "primary" | "secondary" | "outline" | "dashed" | "text";
|
|
1085
|
+
responseUrlKey: string | ((fileItem: Input) => string);
|
|
1069
1086
|
}>;
|
|
1070
1087
|
__isFragment?: never;
|
|
1071
1088
|
__isTeleport?: never;
|
|
@@ -1126,7 +1143,7 @@ export declare const componentMap: {
|
|
|
1126
1143
|
default: boolean;
|
|
1127
1144
|
};
|
|
1128
1145
|
customRequest: {
|
|
1129
|
-
type: import('vue').PropType<(options: import('..').CustomRequestOptions) =>
|
|
1146
|
+
type: import('vue').PropType<(options: import('..').CustomRequestOptions) => void | Promise<void>>;
|
|
1130
1147
|
};
|
|
1131
1148
|
beforeUpload: {
|
|
1132
1149
|
type: import('vue').PropType<(file: File) => boolean | Promise<boolean>>;
|
|
@@ -1204,6 +1221,10 @@ export declare const componentMap: {
|
|
|
1204
1221
|
type: import('vue').PropType<"text" | "outline" | "dashed" | "primary" | "secondary">;
|
|
1205
1222
|
default: string;
|
|
1206
1223
|
};
|
|
1224
|
+
responseUrlKey: {
|
|
1225
|
+
type: import('vue').PropType<string | ((fileItem: Input) => string)>;
|
|
1226
|
+
default: undefined;
|
|
1227
|
+
};
|
|
1207
1228
|
}>> & Readonly<{
|
|
1208
1229
|
onRegister?: ((uploadInstance: any) => any) | undefined;
|
|
1209
1230
|
onProgress?: ((percent: number, fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
@@ -1211,6 +1232,8 @@ export declare const componentMap: {
|
|
|
1211
1232
|
"onUpdate:modelValue"?: ((value: string | string[] | import('..').UploadFileItem[]) => any) | undefined;
|
|
1212
1233
|
onChange?: ((fileList: import('..').UploadFileItem[]) => any) | undefined;
|
|
1213
1234
|
onSuccess?: ((response: any, fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
1235
|
+
onHandleSuccess?: ((response: any, fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
1236
|
+
onHandlError?: ((error: Error, fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
1214
1237
|
onRemove?: ((fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
1215
1238
|
onPreview?: ((fileItem: import('..').UploadFileItem) => any) | undefined;
|
|
1216
1239
|
onExceed?: ((files: File[], fileList: import('..').UploadFileItem[]) => any) | undefined;
|
|
@@ -1230,7 +1253,9 @@ export declare const componentMap: {
|
|
|
1230
1253
|
"update:modelValue": (value: string | string[] | import('..').UploadFileItem[]) => void;
|
|
1231
1254
|
change: (fileList: import('..').UploadFileItem[]) => void;
|
|
1232
1255
|
success: (response: any, fileItem: import('..').UploadFileItem) => void;
|
|
1256
|
+
handleSuccess: (response: any, fileItem: import('..').UploadFileItem) => void;
|
|
1233
1257
|
error: (error: Error, fileItem: import('..').UploadFileItem) => void;
|
|
1258
|
+
handlError: (error: Error, fileItem: import('..').UploadFileItem) => void;
|
|
1234
1259
|
progress: (percent: number, fileItem: import('..').UploadFileItem) => void;
|
|
1235
1260
|
remove: (fileItem: import('..').UploadFileItem) => void;
|
|
1236
1261
|
preview: (fileItem: import('..').UploadFileItem) => void;
|
|
@@ -1258,6 +1283,7 @@ export declare const componentMap: {
|
|
|
1258
1283
|
autoUpload: boolean;
|
|
1259
1284
|
resultType: "fileList" | "url" | "string";
|
|
1260
1285
|
uploadButtonType: "primary" | "secondary" | "outline" | "dashed" | "text";
|
|
1286
|
+
responseUrlKey: string | ((fileItem: Input) => string);
|
|
1261
1287
|
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
|
|
1262
1288
|
$slots: {
|
|
1263
1289
|
"upload-button"?(_: {}): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentMap.d.ts","sourceRoot":"","sources":["../../../src/components/Form/componentMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"componentMap.d.ts","sourceRoot":"","sources":["../../../src/components/Form/componentMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EACL,KAAK,EAqBN,MAAM,sBAAsB,CAAC;AAG9B;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;oBAyBzB;;uBAEG;oBACH,CAJA;;;;;;;;;;;;;;2BAsBG,CAAC;2BAGD,CAAC;;;;;;;;;;;;;;mBAmBK,CAAC;mBAMP,CAAC;oBACA,CAAC;kBAII,CAAC;mBAMT,CAAC;iCAIG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAS+7D,CAAC;;;;uBAAmH,CAAC;uBAAyC,CAAC;;;;;;wBAAib,CAAC,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAAmlE,CAAC;;;;;;;;;;;;;;2BAA4X,CAAC;2BAA6C,CAAC;;;;;;;;;;;;;;mBAAob,CAAC;mBAAwD,CAAC;oBAAyD,CAAC;kBAAiE,CAAC;mBAAwD,CAAC;iCAAgF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAA0zD,CAAC;;;;uBAAmH,CAAC;uBAAyC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;yBAAqoB,CAAC;;;;;;;;;;;;;;uBAAoU,CAAC;uBAAyC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA3E3uO,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,YAAY,CAAC;AAOtD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,QAEnE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAU5E;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,aAKpC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,+BAA+B,aAO1C,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQvE"}
|
|
@@ -6,10 +6,7 @@ import { FormSchema, UseFormOptions, UseFormReturn } from './types';
|
|
|
6
6
|
* @param options 表单配置选项
|
|
7
7
|
* @returns [register, formMethods]
|
|
8
8
|
*/
|
|
9
|
-
export declare function useForm(options?: UseFormOptions): [
|
|
10
|
-
(formInstance: any) => void,
|
|
11
|
-
Omit<UseFormReturn, 'register'>
|
|
12
|
-
];
|
|
9
|
+
export declare function useForm(options?: UseFormOptions): [(formInstance: any) => void, Omit<UseFormReturn, 'register'>];
|
|
13
10
|
/**
|
|
14
11
|
* 创建表单配置
|
|
15
12
|
* 用于快速创建表单 schema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../src/components/Form/useForm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAkB,MAAM,SAAS,CAAC;AAEzF;;;;;GAKG;AACH,wBAAgB,OAAO,
|
|
1
|
+
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../src/components/Form/useForm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAkB,MAAM,SAAS,CAAC;AAEzF;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,OAAO,GAAE,cAAmB,GAC3B,CAAC,CAAC,YAAY,EAAE,GAAG,KAAK,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAmWhE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAKpE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,EAAE,GAAG,UAAU,EAAE,CAEzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/useModal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAA0B,MAAM,SAAS,CAAC;AAE3F;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,kBAAkB,
|
|
1
|
+
{"version":3,"file":"useModal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/useModal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAA0B,MAAM,SAAS,CAAC;AAE3F;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,kBAAkB,CA2F7E"}
|
|
@@ -48,7 +48,9 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
48
48
|
"update:modelValue": (value: string | string[] | UploadFileItem[]) => void;
|
|
49
49
|
change: (fileList: UploadFileItem[]) => void;
|
|
50
50
|
success: (response: any, fileItem: UploadFileItem) => void;
|
|
51
|
+
handleSuccess: (response: any, fileItem: UploadFileItem) => void;
|
|
51
52
|
error: (error: Error, fileItem: UploadFileItem) => void;
|
|
53
|
+
handlError: (error: Error, fileItem: UploadFileItem) => void;
|
|
52
54
|
progress: (percent: number, fileItem: UploadFileItem) => void;
|
|
53
55
|
remove: (fileItem: UploadFileItem) => void;
|
|
54
56
|
preview: (fileItem: UploadFileItem) => void;
|
|
@@ -84,6 +86,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
84
86
|
"onUpdate:modelValue"?: ((value: string | string[] | UploadFileItem[]) => any) | undefined;
|
|
85
87
|
onChange?: ((fileList: UploadFileItem[]) => any) | undefined;
|
|
86
88
|
onSuccess?: ((response: any, fileItem: UploadFileItem) => any) | undefined;
|
|
89
|
+
onHandleSuccess?: ((response: any, fileItem: UploadFileItem) => any) | undefined;
|
|
90
|
+
onHandlError?: ((error: Error, fileItem: UploadFileItem) => any) | undefined;
|
|
87
91
|
onRemove?: ((fileItem: UploadFileItem) => any) | undefined;
|
|
88
92
|
onPreview?: ((fileItem: UploadFileItem) => any) | undefined;
|
|
89
93
|
onExceed?: ((files: File[], fileList: UploadFileItem[]) => any) | undefined;
|
|
@@ -110,6 +114,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
110
114
|
autoUpload: boolean;
|
|
111
115
|
resultType: "fileList" | "url" | "string";
|
|
112
116
|
uploadButtonType: "primary" | "secondary" | "outline" | "dashed" | "text";
|
|
117
|
+
responseUrlKey: string | ((fileItem: FileItem) => string);
|
|
113
118
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
114
119
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
115
120
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicUpload.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Upload/BasicUpload.vue"],"names":[],"mappings":"AA0DA;AAKE,OAAO,KAAK,EACV,gBAAgB,EAEhB,cAAc,EAEf,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"BasicUpload.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Upload/BasicUpload.vue"],"names":[],"mappings":"AA0DA;AAKE,OAAO,KAAK,EACV,gBAAgB,EAEhB,cAAc,EAEf,MAAM,SAAS,CAAC;AA6oBnB,iBAAS,cAAc;6BAqPe,GAAG;qBACX,GAAG;iBACP,GAAG;;;QACF,GAAG;EAG7B;AAqBD,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;uBA1aO,cAAc;;uBAiBhB,cAAc,EAAE;uBAOd,cAAc;4BAOT,OAAO,CAAC,gBAAgB,CAAC;yBAO5B,cAAc,EAAE;oBAQrB,cAAc;2BAQP,cAAc;2BAWd,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAiX5C,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAAvG,wBAAwG;AACxG,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AACN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC;AACxD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
|
|
@@ -6,13 +6,13 @@ import { FileItem } from '@arco-design/web-vue';
|
|
|
6
6
|
*/
|
|
7
7
|
export interface UploadFileItem extends FileItem {
|
|
8
8
|
/** 文件唯一标识 */
|
|
9
|
-
uid
|
|
9
|
+
uid?: string;
|
|
10
10
|
/** 文件名 */
|
|
11
|
-
name
|
|
11
|
+
name?: string;
|
|
12
12
|
/** 文件URL(上传成功后才有) */
|
|
13
13
|
url?: string;
|
|
14
14
|
/** 文件状态 */
|
|
15
|
-
status
|
|
15
|
+
status?: 'init' | 'uploading' | 'done' | 'error';
|
|
16
16
|
/** 上传进度 */
|
|
17
17
|
percent?: number;
|
|
18
18
|
/** 服务端响应数据 */
|
|
@@ -33,13 +33,6 @@ export interface CompressOptions {
|
|
|
33
33
|
/** 是否保持宽高比 */
|
|
34
34
|
keepRatio?: boolean;
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
37
|
-
* customRequest 返回值类型
|
|
38
|
-
*/
|
|
39
|
-
export interface CustomRequestReturn {
|
|
40
|
-
/** 取消上传方法 */
|
|
41
|
-
abort: () => void;
|
|
42
|
-
}
|
|
43
36
|
/**
|
|
44
37
|
* 自定义上传请求配置
|
|
45
38
|
*/
|
|
@@ -95,8 +88,8 @@ export interface BasicUploadProps {
|
|
|
95
88
|
name?: string;
|
|
96
89
|
/** 是否携带cookie */
|
|
97
90
|
withCredentials?: boolean;
|
|
98
|
-
/**
|
|
99
|
-
customRequest?: (options: CustomRequestOptions) =>
|
|
91
|
+
/** 自定义上传实现 */
|
|
92
|
+
customRequest?: (options: CustomRequestOptions) => void | Promise<void>;
|
|
100
93
|
/** 上传前的钩子 */
|
|
101
94
|
beforeUpload?: (file: File) => boolean | Promise<boolean>;
|
|
102
95
|
/** 上传成功的回调 */
|
|
@@ -143,6 +136,8 @@ export interface BasicUploadProps {
|
|
|
143
136
|
uploadButtonText?: string;
|
|
144
137
|
/** 上传按钮类型 */
|
|
145
138
|
uploadButtonType?: 'primary' | 'secondary' | 'outline' | 'dashed' | 'text';
|
|
139
|
+
/** Response中获取图片URL的key,开启后会用上传的图片替换预加载的图片 */
|
|
140
|
+
responseUrlKey?: string | ((fileItem: FileItem) => string);
|
|
146
141
|
}
|
|
147
142
|
/**
|
|
148
143
|
* BasicUpload 组件事件
|
|
@@ -155,8 +150,12 @@ export interface BasicUploadEmits {
|
|
|
155
150
|
(e: 'change', fileList: UploadFileItem[]): void;
|
|
156
151
|
/** 上传成功 */
|
|
157
152
|
(e: 'success', response: any, fileItem: UploadFileItem): void;
|
|
153
|
+
/** 自定义上传成功 */
|
|
154
|
+
(e: 'handleSuccess', response: any, fileItem: UploadFileItem): void;
|
|
158
155
|
/** 上传失败 */
|
|
159
156
|
(e: 'error', error: Error, fileItem: UploadFileItem): void;
|
|
157
|
+
/** 自定义上传失败事件 */
|
|
158
|
+
(e: 'handlError', error: Error, fileItem: UploadFileItem): void;
|
|
160
159
|
/** 上传进度 */
|
|
161
160
|
(e: 'progress', percent: number, fileItem: UploadFileItem): void;
|
|
162
161
|
/** 删除文件 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Upload/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,aAAa;IACb,GAAG,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Upload/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,aAAa;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW;IACX,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;IACjD,WAAW;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc;IACd,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,aAAa;IACb,aAAa,CAAC,EAAE,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,eAAe;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,YAAY;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W;IACX,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,aAAa;IACb,WAAW,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;IAC/C,WAAW;IACX,OAAO,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IACxC,WAAW;IACX,UAAU,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;IAC/C,WAAW;IACX,UAAU,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,CAAC;IAC/C,qBAAqB;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CACtD;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;CACtB"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -705,9 +705,10 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
705
705
|
autoUpload: { type: Boolean, default: true },
|
|
706
706
|
resultType: { default: "fileList" },
|
|
707
707
|
uploadButtonText: {},
|
|
708
|
-
uploadButtonType: { default: "primary" }
|
|
708
|
+
uploadButtonType: { default: "primary" },
|
|
709
|
+
responseUrlKey: { type: [String, Function], default: void 0 }
|
|
709
710
|
},
|
|
710
|
-
emits: ["register", "update:modelValue", "change", "success", "error", "progress", "remove", "preview", "exceed"],
|
|
711
|
+
emits: ["register", "update:modelValue", "change", "success", "handleSuccess", "error", "handlError", "progress", "remove", "preview", "exceed"],
|
|
711
712
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
712
713
|
const props = __props;
|
|
713
714
|
const emit = __emit;
|
|
@@ -715,7 +716,6 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
715
716
|
const fileListRef = vue.ref([]);
|
|
716
717
|
const propsRef = vue.ref({});
|
|
717
718
|
const hasShownActionError = vue.ref(false);
|
|
718
|
-
const isInternalUpdate = vue.ref(false);
|
|
719
719
|
const processedFiles = vue.ref(/* @__PURE__ */ new Map());
|
|
720
720
|
const getProps = vue.computed(() => {
|
|
721
721
|
return { ...props, ...vue.unref(propsRef) };
|
|
@@ -932,7 +932,6 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
932
932
|
};
|
|
933
933
|
};
|
|
934
934
|
const handleChange = (fileList, currentFile) => {
|
|
935
|
-
if (isInternalUpdate.value) return;
|
|
936
935
|
const oldLength = fileListRef.value.length;
|
|
937
936
|
const newLength = fileList.length;
|
|
938
937
|
fileListRef.value = fileList;
|
|
@@ -942,11 +941,11 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
942
941
|
const lastStatus = processedFiles.value.get(fileKey);
|
|
943
942
|
if (currentFile.status === "done" && lastStatus !== "done" && !isRemove) {
|
|
944
943
|
processedFiles.value.set(fileKey, "done");
|
|
945
|
-
emit("
|
|
944
|
+
emit("handleSuccess", currentFile.response, currentFile);
|
|
946
945
|
} else if (currentFile.status === "error" && lastStatus !== "error") {
|
|
947
946
|
processedFiles.value.set(fileKey, "error");
|
|
948
947
|
const error = new Error("上传失败");
|
|
949
|
-
emit("
|
|
948
|
+
emit("handlError", error, currentFile);
|
|
950
949
|
}
|
|
951
950
|
if (isRemove) {
|
|
952
951
|
const fileUids = new Set(fileList.map((f) => f.uid));
|
|
@@ -972,7 +971,6 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
972
971
|
const updateModelValue = (fileList) => {
|
|
973
972
|
var _a;
|
|
974
973
|
const propsData = vue.unref(getProps);
|
|
975
|
-
isInternalUpdate.value = true;
|
|
976
974
|
switch (propsData.resultType) {
|
|
977
975
|
case "fileList":
|
|
978
976
|
emit("update:modelValue", fileList);
|
|
@@ -993,11 +991,6 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
993
991
|
default:
|
|
994
992
|
emit("update:modelValue", fileList);
|
|
995
993
|
}
|
|
996
|
-
vue.nextTick(() => {
|
|
997
|
-
setTimeout(() => {
|
|
998
|
-
isInternalUpdate.value = false;
|
|
999
|
-
}, 50);
|
|
1000
|
-
});
|
|
1001
994
|
};
|
|
1002
995
|
const parseModelValue = (value) => {
|
|
1003
996
|
if (!value) return [];
|
|
@@ -1083,8 +1076,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
1083
1076
|
});
|
|
1084
1077
|
vue.watch(
|
|
1085
1078
|
() => props.modelValue,
|
|
1086
|
-
(val
|
|
1087
|
-
if (isInternalUpdate.value) return;
|
|
1079
|
+
(val) => {
|
|
1088
1080
|
fileListRef.value = parseModelValue(val);
|
|
1089
1081
|
},
|
|
1090
1082
|
{ immediate: true }
|
|
@@ -1185,7 +1177,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
1185
1177
|
}
|
|
1186
1178
|
return target;
|
|
1187
1179
|
};
|
|
1188
|
-
const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
1180
|
+
const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-1a5a7ff7"]]);
|
|
1189
1181
|
const componentMap = {
|
|
1190
1182
|
Input: webVue.Input,
|
|
1191
1183
|
InputNumber: webVue.InputNumber,
|
|
@@ -1629,6 +1621,8 @@ function useForm(options = {}) {
|
|
|
1629
1621
|
const formModel = vue.reactive({});
|
|
1630
1622
|
const loadedRef = vue.ref(false);
|
|
1631
1623
|
const propsRef = vue.ref({});
|
|
1624
|
+
const pendingValues = vue.ref(null);
|
|
1625
|
+
let unwatchFormRef = null;
|
|
1632
1626
|
const initFormModel = () => {
|
|
1633
1627
|
var _a, _b;
|
|
1634
1628
|
const schemas = vue.unref(((_b = (_a = formRef.value) == null ? void 0 : _a.getSchema) == null ? void 0 : _b.call(_a)) || options.schemas || []);
|
|
@@ -1640,12 +1634,38 @@ function useForm(options = {}) {
|
|
|
1640
1634
|
};
|
|
1641
1635
|
const register = async (formInstance) => {
|
|
1642
1636
|
await vue.nextTick();
|
|
1637
|
+
if (unwatchFormRef) {
|
|
1638
|
+
unwatchFormRef();
|
|
1639
|
+
unwatchFormRef = null;
|
|
1640
|
+
}
|
|
1643
1641
|
formRef.value = formInstance;
|
|
1644
1642
|
loadedRef.value = true;
|
|
1645
1643
|
if (options && Object.keys(options).length > 0) {
|
|
1646
1644
|
await setProps(options);
|
|
1647
1645
|
}
|
|
1648
1646
|
initFormModel();
|
|
1647
|
+
if (formInstance.formRef) {
|
|
1648
|
+
unwatchFormRef = vue.watch(
|
|
1649
|
+
() => formInstance.formRef.value,
|
|
1650
|
+
(val) => {
|
|
1651
|
+
if (val === null) {
|
|
1652
|
+
console.log("表单组件已卸载,重置 useForm 状态");
|
|
1653
|
+
formRef.value = null;
|
|
1654
|
+
loadedRef.value = false;
|
|
1655
|
+
if (unwatchFormRef) {
|
|
1656
|
+
unwatchFormRef();
|
|
1657
|
+
unwatchFormRef = null;
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
},
|
|
1661
|
+
{ flush: "sync" }
|
|
1662
|
+
// 同步执行,确保及时清理
|
|
1663
|
+
);
|
|
1664
|
+
}
|
|
1665
|
+
if (pendingValues.value) {
|
|
1666
|
+
await setFieldsValue(pendingValues.value);
|
|
1667
|
+
pendingValues.value = null;
|
|
1668
|
+
}
|
|
1649
1669
|
};
|
|
1650
1670
|
const getForm = () => {
|
|
1651
1671
|
const form = vue.unref(formRef);
|
|
@@ -1657,7 +1677,16 @@ function useForm(options = {}) {
|
|
|
1657
1677
|
return form;
|
|
1658
1678
|
};
|
|
1659
1679
|
const getFormSafe = () => {
|
|
1660
|
-
|
|
1680
|
+
var _a;
|
|
1681
|
+
const form = vue.unref(formRef);
|
|
1682
|
+
if (!form) return null;
|
|
1683
|
+
if (((_a = form.formRef) == null ? void 0 : _a.value) === null) {
|
|
1684
|
+
console.log("检测到失效的表单实例,清理引用");
|
|
1685
|
+
formRef.value = null;
|
|
1686
|
+
loadedRef.value = false;
|
|
1687
|
+
return null;
|
|
1688
|
+
}
|
|
1689
|
+
return form;
|
|
1661
1690
|
};
|
|
1662
1691
|
const getFieldsValue = () => {
|
|
1663
1692
|
const form = getFormSafe();
|
|
@@ -1669,7 +1698,10 @@ function useForm(options = {}) {
|
|
|
1669
1698
|
};
|
|
1670
1699
|
const setFieldsValue = async (values) => {
|
|
1671
1700
|
const form = getFormSafe();
|
|
1672
|
-
if (!form)
|
|
1701
|
+
if (!form) {
|
|
1702
|
+
pendingValues.value = { ...pendingValues.value, ...values };
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1673
1705
|
if (form.setFieldsValue) {
|
|
1674
1706
|
await form.setFieldsValue(values);
|
|
1675
1707
|
} else {
|
|
@@ -3741,9 +3773,7 @@ function useModal(props) {
|
|
|
3741
3773
|
const openModal = (visible = true, data) => {
|
|
3742
3774
|
const modal = getModal();
|
|
3743
3775
|
if (!modal) return;
|
|
3744
|
-
|
|
3745
|
-
modal.setModalProps({ _data: data });
|
|
3746
|
-
}
|
|
3776
|
+
modal.setModalProps({ _data: data });
|
|
3747
3777
|
if (visible) {
|
|
3748
3778
|
modal.openModal();
|
|
3749
3779
|
} else {
|
|
@@ -3754,6 +3784,9 @@ function useModal(props) {
|
|
|
3754
3784
|
const modal = getModal();
|
|
3755
3785
|
if (!modal) return;
|
|
3756
3786
|
modal.closeModal();
|
|
3787
|
+
setTimeout(() => {
|
|
3788
|
+
modal.setModalProps({ _data: void 0 });
|
|
3789
|
+
});
|
|
3757
3790
|
};
|
|
3758
3791
|
const setModalProps = (modalProps) => {
|
|
3759
3792
|
const modal = getModal();
|