@finema/core 3.14.3 → 3.14.4
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/fileState/MultipleFilesState.d.vue.ts +3 -0
- package/dist/runtime/components/Form/fileState/MultipleFilesState.vue.d.ts +3 -0
- package/dist/runtime/components/Form/fileState/useUploadStateMultiple.d.ts +11 -25
- package/dist/runtime/components/Form/fileState/useUploadStateMultiple.js +8 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TemplateRef } from 'vue';
|
|
2
2
|
import type { IUploadDropzoneAutoMultipleProps } from '../InputUploadDropzoneAutoMultiple/types.js';
|
|
3
3
|
import type { IFileValue } from '#core/components/Form/types';
|
|
4
|
-
import { useUploadLoader } from '#core/composables/useUpload';
|
|
5
4
|
export declare enum UploadState {
|
|
6
5
|
EMPTY = "empty",
|
|
7
6
|
UPLOADING = "uploading",
|
|
@@ -14,11 +13,12 @@ export interface FileUploadItem {
|
|
|
14
13
|
progress: number;
|
|
15
14
|
value?: IFileValue;
|
|
16
15
|
error?: string;
|
|
17
|
-
uploadLoader?:
|
|
18
|
-
percentRef?:
|
|
16
|
+
uploadLoader?: any;
|
|
17
|
+
percentRef?: any;
|
|
18
|
+
cleanupWatchers?: (() => void)[];
|
|
19
19
|
}
|
|
20
20
|
export declare const useUploadStateMultiple: (props: IUploadDropzoneAutoMultipleProps, emits: any, onChange: (value: IFileValue[] | undefined) => void, setErrors: (error: string) => void, value: any, acceptedFileTypes: any, wrapperProps: any, dropzoneRef: TemplateRef<HTMLDivElement | undefined>) => {
|
|
21
|
-
fileItems: Ref<{
|
|
21
|
+
fileItems: import("vue").Ref<{
|
|
22
22
|
file: {
|
|
23
23
|
readonly lastModified: number;
|
|
24
24
|
readonly name: string;
|
|
@@ -56,16 +56,9 @@ export declare const useUploadStateMultiple: (props: IUploadDropzoneAutoMultiple
|
|
|
56
56
|
id?: string | undefined;
|
|
57
57
|
} | undefined;
|
|
58
58
|
error?: string | undefined;
|
|
59
|
-
uploadLoader?:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
options: import("#imports").IAPIOptions;
|
|
63
|
-
run: (payload?: import("../../../helpers/apiObjectHelper.js").IObjectRunLoaderOptions<any, any> | undefined) => Promise<void>;
|
|
64
|
-
clear: () => void;
|
|
65
|
-
setLoading: () => void;
|
|
66
|
-
setData: (data: any) => void;
|
|
67
|
-
} | undefined;
|
|
68
|
-
percentRef?: number | undefined;
|
|
59
|
+
uploadLoader?: any;
|
|
60
|
+
percentRef?: any;
|
|
61
|
+
cleanupWatchers?: (() => void)[] | undefined;
|
|
69
62
|
}[], FileUploadItem[] | {
|
|
70
63
|
file: {
|
|
71
64
|
readonly lastModified: number;
|
|
@@ -104,16 +97,9 @@ export declare const useUploadStateMultiple: (props: IUploadDropzoneAutoMultiple
|
|
|
104
97
|
id?: string | undefined;
|
|
105
98
|
} | undefined;
|
|
106
99
|
error?: string | undefined;
|
|
107
|
-
uploadLoader?:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
options: import("#imports").IAPIOptions;
|
|
111
|
-
run: (payload?: import("../../../helpers/apiObjectHelper.js").IObjectRunLoaderOptions<any, any> | undefined) => Promise<void>;
|
|
112
|
-
clear: () => void;
|
|
113
|
-
setLoading: () => void;
|
|
114
|
-
setData: (data: any) => void;
|
|
115
|
-
} | undefined;
|
|
116
|
-
percentRef?: number | undefined;
|
|
100
|
+
uploadLoader?: any;
|
|
101
|
+
percentRef?: any;
|
|
102
|
+
cleanupWatchers?: (() => void)[] | undefined;
|
|
117
103
|
}[]>;
|
|
118
104
|
isEmpty: import("vue").ComputedRef<boolean>;
|
|
119
105
|
hasUploading: import("vue").ComputedRef<boolean>;
|
|
@@ -98,7 +98,7 @@ export const useUploadStateMultiple = (props, emits, onChange, setErrors, value,
|
|
|
98
98
|
size: Number(_get(uploadLoader.data.value, props.responseSize) || fileItem.file.size),
|
|
99
99
|
id: _get(uploadLoader.data.value, props.responseID)
|
|
100
100
|
};
|
|
101
|
-
fileItems.value.
|
|
101
|
+
fileItems.value = fileItems.value.filter((_, i) => i !== index);
|
|
102
102
|
onChange([fileValue, ...ArrayHelper.toArray(value.value)]);
|
|
103
103
|
emits("success", fileValue);
|
|
104
104
|
stopProgressWatch();
|
|
@@ -123,6 +123,9 @@ export const useUploadStateMultiple = (props, emits, onChange, setErrors, value,
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
);
|
|
126
|
+
updateFileItem(index, {
|
|
127
|
+
cleanupWatchers: [stopProgressWatch, stopSuccessWatch, stopErrorWatch]
|
|
128
|
+
});
|
|
126
129
|
return uploadLoader;
|
|
127
130
|
};
|
|
128
131
|
const processFile = (file) => {
|
|
@@ -187,6 +190,10 @@ export const useUploadStateMultiple = (props, emits, onChange, setErrors, value,
|
|
|
187
190
|
fileDialog.open();
|
|
188
191
|
};
|
|
189
192
|
const handleDeleteFile = (index) => {
|
|
193
|
+
const fileItem = fileItems.value[index];
|
|
194
|
+
if (fileItem?.cleanupWatchers) {
|
|
195
|
+
fileItem.cleanupWatchers.forEach((cleanup) => cleanup());
|
|
196
|
+
}
|
|
190
197
|
fileItems.value.splice(index, 1);
|
|
191
198
|
if (fileItems.value.length === 0) {
|
|
192
199
|
setErrors("");
|