@finema/core 1.4.32 → 1.4.33
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
package/dist/module.mjs
CHANGED
|
@@ -42,16 +42,7 @@
|
|
|
42
42
|
</template>
|
|
43
43
|
|
|
44
44
|
<script lang="tsx" setup>
|
|
45
|
-
import {
|
|
46
|
-
_isEmpty,
|
|
47
|
-
computed,
|
|
48
|
-
ref,
|
|
49
|
-
StringHelper,
|
|
50
|
-
toRef,
|
|
51
|
-
useUI,
|
|
52
|
-
useUiConfig,
|
|
53
|
-
useWatchTrue,
|
|
54
|
-
} from '#imports'
|
|
45
|
+
import { computed, ref, StringHelper, toRef, useUI, useUiConfig, useWatchTrue } from '#imports'
|
|
55
46
|
import { type IUploadFileProps } from './types'
|
|
56
47
|
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
57
48
|
import { useFieldHOC } from '#core/composables/useForm'
|
|
@@ -108,13 +99,6 @@ const handleChange = (e: Event) => {
|
|
|
108
99
|
|
|
109
100
|
const handleCheckFileCondition = (file: File | undefined): boolean => {
|
|
110
101
|
if (!file) return false
|
|
111
|
-
const accept = checkAcceptFile(file)
|
|
112
|
-
|
|
113
|
-
if (!accept) {
|
|
114
|
-
setErrors(i18next.t('custom:invalid_file_type'))
|
|
115
|
-
|
|
116
|
-
return false
|
|
117
|
-
}
|
|
118
102
|
|
|
119
103
|
const maxSize = checkMaxSize(file)
|
|
120
104
|
|
|
@@ -129,18 +113,6 @@ const handleCheckFileCondition = (file: File | undefined): boolean => {
|
|
|
129
113
|
return true
|
|
130
114
|
}
|
|
131
115
|
|
|
132
|
-
const checkAcceptFile = (file: File): boolean => {
|
|
133
|
-
let fileType = ''
|
|
134
|
-
|
|
135
|
-
if (_isEmpty(file.type)) {
|
|
136
|
-
fileType = file.name.split('.').pop() || ''
|
|
137
|
-
} else {
|
|
138
|
-
fileType = file.type.split('/').pop() || ''
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return acceptFile.value ? acceptFile.value.includes(fileType) : true
|
|
142
|
-
}
|
|
143
|
-
|
|
144
116
|
const checkMaxSize = (file: File): boolean => {
|
|
145
117
|
if (acceptFileSize.value) {
|
|
146
118
|
return file.size / 1000 <= acceptFileSize.value
|