@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.4.132",
3
+ "version": "1.4.134",
4
4
  "configKey": "core",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.7.4"
package/dist/module.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defineNuxtModule, createResolver, installModule, addPlugin, addComponentsDir, addImportsDir } from '@nuxt/kit';
2
2
 
3
3
  const name = "@finema/core";
4
- const version = "1.4.132";
4
+ const version = "1.4.134";
5
5
 
6
6
  const colors = {
7
7
  black: "#20243E",
@@ -67,14 +67,10 @@
67
67
  </div>
68
68
 
69
69
  <!-- Success State -->
70
- <div v-if="selectedFile && upload.status.value.isSuccess" :class="[ui.onPreview.wrapper]">
70
+ <div v-if="value" :class="[ui.onPreview.wrapper]">
71
71
  <div :class="[ui.onPreview.previewImgWrapper]">
72
- <div v-if="isImage(selectedFile)" class="size-full overflow-hidden">
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">{{ selectedFile?.name }}</h1>
84
+ <h1 class="truncate font-bold">{{ value.name }}</h1>
89
85
  <p class="truncate text-sm font-light text-gray-400">
90
86
  {{
91
- fileAllocate.isSelectedFileUseMb.value
87
+ fileAllocateFromPath.isSelectedFileUseMb.value
92
88
  ? `${fileAllocate.selectedFileSizeMb.value} MB`
93
- : `${fileAllocate.selectedFileSizeKb.value} KB`
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="isImage(selectedFile)"
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="selectedFile?.name">
118
- <img :src="_get(upload.data.value, responseURL)" alt="img-preview" />
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(_get(upload.data.value, props.responseURL), selectedFile.value?.name)
309
+ downloadFileFromURL(value.value?.url, value.value?.name)
310
310
  }
311
311
 
312
312
  const handleRetryUpload = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "1.4.132",
3
+ "version": "1.4.134",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",