@finema/core 2.13.0 → 2.14.1
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/FlexDeck/Base.vue +1 -1
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/EmptyState.vue +1 -1
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/FailedState.vue +1 -1
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/index.vue +8 -1
- package/dist/runtime/components/Form/InputUploadDropzoneAuto/useUploadState.js +17 -18
- package/dist/runtime/components/Image.vue +1 -1
- package/dist/runtime/components/Table/Base.vue +1 -1
- package/dist/runtime/components/Table/index.vue +1 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -57,7 +57,7 @@ import LoadingState from "./LoadingState.vue";
|
|
|
57
57
|
import SuccessState from "./SuccessState.vue";
|
|
58
58
|
import FailedState from "./FailedState.vue";
|
|
59
59
|
import { useUploadState } from "./useUploadState";
|
|
60
|
-
import { computed, useTemplateRef } from "#imports";
|
|
60
|
+
import { computed, useTemplateRef, useWatchChange } from "#imports";
|
|
61
61
|
import FieldWrapper from "#core/components/Form/FieldWrapper.vue";
|
|
62
62
|
import { useFieldHOC } from "#core/composables/useForm";
|
|
63
63
|
import { uploadFileDropzoneTheme } from "#core/theme/uploadFileDropzone";
|
|
@@ -114,6 +114,13 @@ const uploadState = useUploadState(
|
|
|
114
114
|
wrapperProps,
|
|
115
115
|
dropzoneRef
|
|
116
116
|
);
|
|
117
|
+
useWatchChange(() => value.value, (newValue) => {
|
|
118
|
+
if (typeof newValue === "object" && newValue !== null) {
|
|
119
|
+
onChange(newValue);
|
|
120
|
+
} else {
|
|
121
|
+
onChange(void 0);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
117
124
|
const theme = computed(
|
|
118
125
|
() => useUiConfig(uploadFileDropzoneTheme, "uploadFileDropzone")({
|
|
119
126
|
dragover: uploadState.dropzone.isOverDropZone.value && uploadState.isEmpty.value,
|
|
@@ -32,8 +32,8 @@ export const useUploadState = (props, emits, onChange, setErrors, value, accepte
|
|
|
32
32
|
};
|
|
33
33
|
const upload = useUploadLoader(request);
|
|
34
34
|
const validateFile = (file) => {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
if (props.accept && fileAllocate.acceptFile.value) {
|
|
36
|
+
const acceptedTypes = fileAllocate.acceptFile.value;
|
|
37
37
|
const acceptedTypesList = acceptedTypes.split(",").map((type) => type.trim());
|
|
38
38
|
const fileExtension = file.name.toLowerCase().split(".").pop();
|
|
39
39
|
const isValidFileType = acceptedTypesList.some((acceptedType) => {
|
|
@@ -54,14 +54,16 @@ export const useUploadState = (props, emits, onChange, setErrors, value, accepte
|
|
|
54
54
|
return false;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
if (props.maxSize) {
|
|
58
|
+
const maxSizeBytes = (fileAllocate.acceptFileSizeKb.value || 0) * 1024;
|
|
59
|
+
if (file.size > maxSizeBytes) {
|
|
60
|
+
if (fileAllocate.isAcceptFileUseMb.value) {
|
|
61
|
+
setErrors(`\u0E02\u0E19\u0E32\u0E14\u0E44\u0E1F\u0E25\u0E4C\u0E15\u0E49\u0E2D\u0E07\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 ${fileAllocate.acceptFileSizeMb.value} MB`);
|
|
62
|
+
} else {
|
|
63
|
+
setErrors(`\u0E02\u0E19\u0E32\u0E14\u0E44\u0E1F\u0E25\u0E4C\u0E15\u0E49\u0E2D\u0E07\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 ${fileAllocate.acceptFileSizeKb.value} KB`);
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
63
66
|
}
|
|
64
|
-
return false;
|
|
65
67
|
}
|
|
66
68
|
setErrors("");
|
|
67
69
|
return true;
|
|
@@ -111,6 +113,11 @@ export const useUploadState = (props, emits, onChange, setErrors, value, accepte
|
|
|
111
113
|
processFile(file);
|
|
112
114
|
}
|
|
113
115
|
};
|
|
116
|
+
fileDialog.onChange((files) => {
|
|
117
|
+
if (files?.length) {
|
|
118
|
+
processFile(files[0]);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
114
121
|
const handleOpenFile = () => {
|
|
115
122
|
if (wrapperProps.value.disabled || wrapperProps.value.readonly) return;
|
|
116
123
|
fileDialog.open();
|
|
@@ -134,14 +141,6 @@ export const useUploadState = (props, emits, onChange, setErrors, value, accepte
|
|
|
134
141
|
value: value.value
|
|
135
142
|
});
|
|
136
143
|
};
|
|
137
|
-
watch(
|
|
138
|
-
() => fileDialog.files.value,
|
|
139
|
-
(files) => {
|
|
140
|
-
if (files?.length) {
|
|
141
|
-
processFile(files[0]);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
);
|
|
145
144
|
watch(
|
|
146
145
|
() => upload.status.value.isSuccess,
|
|
147
146
|
(isSuccess2) => {
|
|
@@ -161,7 +160,7 @@ export const useUploadState = (props, emits, onChange, setErrors, value, accepte
|
|
|
161
160
|
() => upload.status.value.isError,
|
|
162
161
|
(isError2) => {
|
|
163
162
|
if (isError2) {
|
|
164
|
-
setErrors(StringHelper.getError(upload.status.value.errorData));
|
|
163
|
+
setErrors("\u0E1E\u0E1A\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14: " + StringHelper.getError(upload.status.value.errorData));
|
|
165
164
|
}
|
|
166
165
|
}
|
|
167
166
|
);
|