@finema/core 1.4.30 → 1.4.32
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/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Form/InputUploadFileClassicAuto/index.vue +5 -6
- package/dist/runtime/components/Form/InputUploadFileClassicAuto/types.d.ts +5 -1
- package/dist/runtime/composables/useUpload.d.ts +1 -8
- package/dist/runtime/ui.config/uploadFileInputClassicAuto.mjs +1 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -64,9 +64,10 @@ const config = useUiConfig<typeof uploadFileInputClassicAuto>(
|
|
|
64
64
|
'uploadFileInputClassicAuto'
|
|
65
65
|
)
|
|
66
66
|
|
|
67
|
+
const emits = defineEmits(['success'])
|
|
67
68
|
const props = withDefaults(defineProps<IUploadFileProps>(), {})
|
|
68
69
|
|
|
69
|
-
const { wrapperProps,
|
|
70
|
+
const { wrapperProps, setErrors, value } = useFieldHOC<string>(props)
|
|
70
71
|
|
|
71
72
|
const request: IUploadRequest = {
|
|
72
73
|
pathURL: props.uploadPathURL,
|
|
@@ -100,7 +101,7 @@ const handleChange = (e: Event) => {
|
|
|
100
101
|
selectedFile.value = file
|
|
101
102
|
const formData = new FormData()
|
|
102
103
|
|
|
103
|
-
formData.append('file', file)
|
|
104
|
+
formData.append(props.bodyKey || 'file', file)
|
|
104
105
|
upload.run(formData, { data: { onUploadProgress, onDownloadProgress } })
|
|
105
106
|
}
|
|
106
107
|
}
|
|
@@ -165,10 +166,8 @@ const onDownloadProgress = (progressEvent: ProgressEvent) => {
|
|
|
165
166
|
useWatchTrue(
|
|
166
167
|
() => upload.status.value.isSuccess,
|
|
167
168
|
() => {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
onChange(upload.data.value?.url)
|
|
171
|
-
}
|
|
169
|
+
value.value = upload.data.value[props.responseKey || 'url']
|
|
170
|
+
emits('success', upload.data.value)
|
|
172
171
|
}
|
|
173
172
|
)
|
|
174
173
|
|
|
@@ -7,7 +7,11 @@ export interface IUploadFileProps extends IFieldProps {
|
|
|
7
7
|
uploadPathURL?: string;
|
|
8
8
|
selectFileLabel?: string;
|
|
9
9
|
accept?: string[] | string;
|
|
10
|
+
bodyKey?: string;
|
|
11
|
+
responseKey?: string;
|
|
10
12
|
maxSize?: number;
|
|
11
13
|
imagePreviewURL?: string;
|
|
12
14
|
}
|
|
13
|
-
export type IUploadFileField = IFormFieldBase<INPUT_TYPES.UPLOAD_FILE_CLASSIC_AUTO, IUploadFileProps,
|
|
15
|
+
export type IUploadFileField = IFormFieldBase<INPUT_TYPES.UPLOAD_FILE_CLASSIC_AUTO, IUploadFileProps, {
|
|
16
|
+
success?: (res: any) => void;
|
|
17
|
+
}>;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { type AxiosRequestConfig } from 'axios';
|
|
2
|
-
export interface IUploadData {
|
|
3
|
-
name: string;
|
|
4
|
-
url: string;
|
|
5
|
-
path: string;
|
|
6
|
-
size: number;
|
|
7
|
-
content_type: string;
|
|
8
|
-
}
|
|
9
2
|
export interface IUploadRequest {
|
|
10
3
|
requestOptions: Omit<AxiosRequestConfig, 'baseURL'> & {
|
|
11
4
|
baseURL: string;
|
|
12
5
|
};
|
|
13
6
|
pathURL?: string;
|
|
14
7
|
}
|
|
15
|
-
export declare const useUploadLoader: (request: IUploadRequest) => import("../helpers/apiObjectHelper").IUseObjectLoader<
|
|
8
|
+
export declare const useUploadLoader: (request: IUploadRequest) => import("../helpers/apiObjectHelper").IUseObjectLoader<any, any, Record<string, any>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const uploadFileInputClassicAuto = {
|
|
2
|
-
base: "rounded-
|
|
2
|
+
base: "rounded-md ring-1 ring-inset ring-gray-300 shadow-sm bg-white px-3 py-2",
|
|
3
3
|
wrapper: "flex items-center justify-between gap-4",
|
|
4
4
|
selectFileBox: "flex items-center gap-2 truncate",
|
|
5
5
|
placeholder: "truncate text-gray-400 text-sm",
|