barcode: fix all the issues from PR review

This commit is contained in:
flisowna
2022-12-26 16:25:18 +01:00
parent 1ed99e8445
commit 9886e67ce3
5 changed files with 11 additions and 10 deletions

View File

@@ -7,9 +7,14 @@ const cellValue = inject(CellValueInj)
const column = inject(ColumnInj)
const barcodeValue = computed(() => String(cellValue?.value))
const barcodeValue = computed(() => {
if (cellValue?.value === undefined) {
return undefined
}
return String(cellValue.value)
})
const tooManyCharsForBarcode = computed(() => barcodeValue?.value.length > maxNumberOfAllowedCharsForBarcodeValue)
const tooManyCharsForBarcode = computed(() => barcodeValue?.value?.length > maxNumberOfAllowedCharsForBarcodeValue)
const modalVisible = ref(false)
@@ -27,7 +32,7 @@ const barcodeMeta = $computed(() => {
const handleModalOkClick = () => (modalVisible.value = false)
const showBarcode = computed(() => {
return cellValue?.value?.length > 0 && !tooManyCharsForBarcode.value
return barcodeValue && barcodeValue?.value?.length > 0 && !tooManyCharsForBarcode.value
})
const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning } = useShowNotEditableWarning()