From 94bbacf975f315567c773aa3f288c6b6195785a3 Mon Sep 17 00:00:00 2001 From: flisowna Date: Mon, 26 Dec 2022 20:42:50 +0100 Subject: [PATCH] barcode: fix barcode value in cleaner way --- packages/nc-gui/components/virtual-cell/QrCode.vue | 2 ++ packages/nc-gui/components/virtual-cell/barcode/Barcode.vue | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/virtual-cell/QrCode.vue b/packages/nc-gui/components/virtual-cell/QrCode.vue index b4790542bb..b030d24c5f 100644 --- a/packages/nc-gui/components/virtual-cell/QrCode.vue +++ b/packages/nc-gui/components/virtual-cell/QrCode.vue @@ -6,7 +6,9 @@ const maxNumberOfAllowedCharsForQrValue = 2000 const cellValue = inject(CellValueInj) const qrValue = computed(() => String(cellValue?.value)) + const tooManyCharsForQrCode = computed(() => qrValue?.value.length > maxNumberOfAllowedCharsForQrValue) + const showQrCode = computed(() => qrValue?.value?.length > 0 && !tooManyCharsForQrCode.value) const qrCode = useQRCode(qrValue, { diff --git a/packages/nc-gui/components/virtual-cell/barcode/Barcode.vue b/packages/nc-gui/components/virtual-cell/barcode/Barcode.vue index 7b73433962..ad5433da10 100644 --- a/packages/nc-gui/components/virtual-cell/barcode/Barcode.vue +++ b/packages/nc-gui/components/virtual-cell/barcode/Barcode.vue @@ -40,8 +40,7 @@ const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning } = us :footer="null" @ok="handleModalOkClick" > - - +