@finema/core 1.4.132 → 1.4.134
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
|
@@ -67,14 +67,10 @@
|
|
|
67
67
|
</div>
|
|
68
68
|
|
|
69
69
|
<!-- Success State -->
|
|
70
|
-
<div v-if="
|
|
70
|
+
<div v-if="value" :class="[ui.onPreview.wrapper]">
|
|
71
71
|
<div :class="[ui.onPreview.previewImgWrapper]">
|
|
72
|
-
<div v-if="
|
|
73
|
-
<img
|
|
74
|
-
:src="upload.data.value[responseURL || 'url']"
|
|
75
|
-
:class="[ui.onPreview.previewImgClass]"
|
|
76
|
-
alt="img-preview"
|
|
77
|
-
/>
|
|
72
|
+
<div v-if="isImageFromPath(value.path)" class="size-full overflow-hidden">
|
|
73
|
+
<img :src="value.url" :class="[ui.onPreview.previewImgClass]" alt="img-preview" />
|
|
78
74
|
</div>
|
|
79
75
|
<div v-else>
|
|
80
76
|
<Icon
|
|
@@ -85,18 +81,18 @@
|
|
|
85
81
|
</div>
|
|
86
82
|
<div :class="[ui.onPreview.textWrapper]">
|
|
87
83
|
<div class="truncate">
|
|
88
|
-
<h1 class="truncate font-bold">{{
|
|
84
|
+
<h1 class="truncate font-bold">{{ value.name }}</h1>
|
|
89
85
|
<p class="truncate text-sm font-light text-gray-400">
|
|
90
86
|
{{
|
|
91
|
-
|
|
87
|
+
fileAllocateFromPath.isSelectedFileUseMb.value
|
|
92
88
|
? `${fileAllocate.selectedFileSizeMb.value} MB`
|
|
93
|
-
: `${
|
|
89
|
+
: `${fileAllocateFromPath.selectedFileSizeKb.value} KB`
|
|
94
90
|
}}
|
|
95
91
|
</p>
|
|
96
92
|
</div>
|
|
97
93
|
<div :class="[ui.action.wrapper]">
|
|
98
94
|
<Icon
|
|
99
|
-
v-if="
|
|
95
|
+
v-if="isImageFromPath(value.path)"
|
|
100
96
|
:name="ui.action.previewIcon"
|
|
101
97
|
:class="[ui.action.iconClass]"
|
|
102
98
|
title="ดูตัวอย่าง"
|
|
@@ -114,8 +110,8 @@
|
|
|
114
110
|
title="ลบไฟล์"
|
|
115
111
|
@click="handleDeleteFile"
|
|
116
112
|
/>
|
|
117
|
-
<Modal v-model="isPreviewOpen" :title="
|
|
118
|
-
<img :src="
|
|
113
|
+
<Modal v-model="isPreviewOpen" :title="value.name">
|
|
114
|
+
<img :src="value.url" alt="img-preview" />
|
|
119
115
|
</Modal>
|
|
120
116
|
</div>
|
|
121
117
|
</div>
|
|
@@ -173,12 +169,15 @@ import {
|
|
|
173
169
|
downloadFileFromURL,
|
|
174
170
|
useFileAllocate,
|
|
175
171
|
useFileProgress,
|
|
172
|
+
isImageFromPath,
|
|
173
|
+
useFileSize,
|
|
176
174
|
} from '#core/helpers/componentHelper'
|
|
177
175
|
import FieldWrapper from '#core/components/Form/FieldWrapper.vue'
|
|
178
176
|
import { useFieldHOC } from '#core/composables/useForm'
|
|
179
177
|
import {
|
|
180
178
|
type IUploadRequest,
|
|
181
179
|
ref,
|
|
180
|
+
computed,
|
|
182
181
|
toRef,
|
|
183
182
|
useUI,
|
|
184
183
|
useUiConfig,
|
|
@@ -223,6 +222,7 @@ const isPreviewOpen = ref<boolean>(false)
|
|
|
223
222
|
|
|
224
223
|
const { onUploadProgress, onDownloadProgress, percent } = useFileProgress()
|
|
225
224
|
const fileAllocate = useFileAllocate(selectedFile, props)
|
|
225
|
+
const fileAllocateFromPath = computed(() => useFileSize(value.value?.size))
|
|
226
226
|
|
|
227
227
|
const onDrop = (files: File[] | null) => {
|
|
228
228
|
if (props.isDisabled || files?.length === 0 || !files) return
|
|
@@ -306,7 +306,7 @@ const handleCheckFileCondition = (file: File | undefined): boolean => {
|
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
const handleDownloadFile = () => {
|
|
309
|
-
downloadFileFromURL(
|
|
309
|
+
downloadFileFromURL(value.value?.url, value.value?.name)
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
const handleRetryUpload = () => {
|