@volverjs/ui-vue 0.0.10-beta.46 → 0.0.10-beta.47
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/components/VvInputFile/VvInputFile.es.js +10 -4
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/index.es.js +10 -4
- package/dist/components/index.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/package.json +1 -1
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvInputFile/VvInputFile.vue +10 -4
|
@@ -224,11 +224,17 @@ onBeforeUnmount(() => {
|
|
|
224
224
|
}
|
|
225
225
|
})
|
|
226
226
|
|
|
227
|
-
function
|
|
228
|
-
if (!
|
|
227
|
+
function formatBytes(bytes?: number, decimals?: number) {
|
|
228
|
+
if (!bytes) {
|
|
229
229
|
return
|
|
230
230
|
}
|
|
231
|
-
|
|
231
|
+
if (bytes === 0)
|
|
232
|
+
return '0 Bytes'
|
|
233
|
+
const k = 1024
|
|
234
|
+
const dm = !decimals ? 2 : decimals <= 0 ? 0 : decimals
|
|
235
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
|
236
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
|
237
|
+
return `${Number.parseFloat((bytes / (k ** i)).toFixed(dm))} ${sizes[i]}`
|
|
232
238
|
}
|
|
233
239
|
|
|
234
240
|
function onClickDownloadFile(file: File | UploadedFile) {
|
|
@@ -376,7 +382,7 @@ export default {
|
|
|
376
382
|
{{ file.name }}
|
|
377
383
|
</div>
|
|
378
384
|
<small class="vv-input-file__item-info">
|
|
379
|
-
{{
|
|
385
|
+
{{ formatBytes(file.size) }}
|
|
380
386
|
</small>
|
|
381
387
|
<button
|
|
382
388
|
v-if="!readonly"
|