@ -2,7 +2,7 @@
import type { UITypes } from 'nocodb-sdk'
import { AllowedColumnTypesForQrAndBarcodes } from 'nocodb-sdk'
import type { SelectProps } from 'ant-design-vue'
import { useVModel } from '#imports'
import { onMounted , useVModel , watch } from '#imports'
const props = defineProps < {
modelValue : any
@ -22,7 +22,7 @@ const vModel = useVModel(props, 'modelValue', emit)
const { setAdditionalValidations , validateInfos , column } = useColumnCreateStoreOrThrow ( )
const columnsAllowedAsQr Value = computed < SelectProps [ ' options ' ] > ( ( ) => {
const columnsAllowedAsBarcode Value = computed < SelectProps [ ' options ' ] > ( ( ) => {
return fields . value
? . filter (
( el ) =>
@ -52,7 +52,18 @@ const supportedBarcodeFormats = [
onMounted ( ( ) => {
/ / s e t d e f a u l t v a l u e
vModel . value . fk _barcode _value _column _id = ( column ? . value ? . colOptions as Record < string , any > ) ? . fk _barcode _value _column _id || ''
vModel . value . meta = {
barcodeFormat : supportedBarcodeFormats [ 0 ] . value ,
... vModel . value . meta ,
}
vModel . value . fk _barcode _value _column _id =
( column ? . value ? . colOptions as Record < string , any > ) ? . fk _barcode _value _column _id || columnsAllowedAsBarcodeValue . value ? . [ 0 ]
} )
watch ( columnsAllowedAsBarcodeValue , ( newColumnsAllowedAsBarcodeValue ) => {
if ( vModel . value . fk _barcode _value _column _id == null ) {
vModel . value . fk _barcode _value _column _id = newColumnsAllowedAsBarcodeValue ? . [ 0 ] . value
}
} )
setAdditionalValidations ( {
@ -61,10 +72,6 @@ setAdditionalValidations({
} )
/ / s e t d e f a u l t m e t a v a l u e
vModel . value . meta = {
barcodeFormat : supportedBarcodeFormats [ 0 ] . value ,
... vModel . value . meta ,
}
< / script >
< template >
@ -77,8 +84,9 @@ vModel.value.meta = {
>
< a -select
v - model : value = "vModel.fk_barcode_value_column_id"
: options = "columnsAllowedAsQr Value"
: options = "columnsAllowedAsBarcode Value"
placeholder = "Select a column for the Barcode value"
not - found - content = "No valid Column Type can be found. The valid Column Types are: Number, Single Line Text, Long Text, Phone Number, URL, Email, Decimal. Please create one first."
@ click . stop
/ >
< / a - f o r m - i t e m >