@finema/core 1.4.31 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.4.31",
3
+ "version": "1.4.32",
4
4
  "configKey": "core",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.7.4"
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import { defineNuxtModule, createResolver, installModule, addPlugin, addComponen
2
2
  import 'lodash-es';
3
3
 
4
4
  const name = "@finema/core";
5
- const version = "1.4.31";
5
+ const version = "1.4.32";
6
6
 
7
7
  const colors = {
8
8
  black: "#20243E",
@@ -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, handleChange: onChange, setErrors, value } = useFieldHOC<string>(props)
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
- if (upload.data.value?.url) {
169
- value.value = upload.data.value?.url
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, never>;
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<IUploadData, any, Record<string, any>>;
8
+ export declare const useUploadLoader: (request: IUploadRequest) => import("../helpers/apiObjectHelper").IUseObjectLoader<any, any, Record<string, any>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.4.31",
3
+ "version": "1.4.32",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",