From 80f3735b025dcb4a7c04ffda8cd5719374d7a3d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Fri, 17 Jun 2022 17:23:41 +0200 Subject: [PATCH] Image InputComponent add file size --- .../ts/components/bo/ImageInputComponent.vue | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/resources/ts/components/bo/ImageInputComponent.vue b/resources/ts/components/bo/ImageInputComponent.vue index a64854a..5b9f732 100644 --- a/resources/ts/components/bo/ImageInputComponent.vue +++ b/resources/ts/components/bo/ImageInputComponent.vue @@ -89,7 +89,10 @@ v-if="_value" :id="`PreviewHelp${_id}`" class="form-text text-muted d-block" - >{{ __("PrĂ©visualisation de l'image") }}{{ __("PrĂ©visualisation de l'image") + }} {{ humanFileSize(_originalFile.size) }}  = BYTES_PER_KB && u < UNITS.length - 1) { + size /= BYTES_PER_KB; + ++u; + } + + return new Intl.NumberFormat([], { + style: "unit", + unit: UNITS[u], + unitDisplay: "short", + maximumFractionDigits: 1, + }).format(size); + }, }, }); @@ -743,12 +768,6 @@ export default defineComponent({ left: 50%; transform: translateX(-50%) translateY(-50%); } - - @include media-breakpoint-up(md) { - & > div { - position: absolute; - } - } } input.rightAligned { direction: ltr !important;