diff --git a/packages/nc-gui/components/smartsheet/Form.vue b/packages/nc-gui/components/smartsheet/Form.vue index c6c977f330..04402944bb 100644 --- a/packages/nc-gui/components/smartsheet/Form.vue +++ b/packages/nc-gui/components/smartsheet/Form.vue @@ -361,7 +361,7 @@ function handleMouseUp(col: Record, hiddenColIndex: number) { } } -const columnSupportsScanning = (elementType: UITypes) => [UITypes.SingleLineText].includes(elementType) +const columnSupportsScanning = (elementType: UITypes) => [UITypes.SingleLineText, UITypes.Number].includes(elementType) onClickOutside(draggableRef, () => { activeRow.value = '' diff --git a/packages/nc-gui/composables/useSharedFormViewStore.ts b/packages/nc-gui/composables/useSharedFormViewStore.ts index f231a82be0..73ef2a957d 100644 --- a/packages/nc-gui/composables/useSharedFormViewStore.ts +++ b/packages/nc-gui/composables/useSharedFormViewStore.ts @@ -35,7 +35,7 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share const sharedView = ref() const sharedFormView = ref() const meta = ref() - const columns = ref<(ColumnType & { required?: boolean; show?: boolean; label?: string })[]>() + const columns = ref<(ColumnType & { required?: boolean; show?: boolean; label?: string; enable_scanner?: boolean })[]>() const sharedViewMeta = ref({}) const formResetHook = createEventHook() diff --git a/packages/nc-gui/pages/[projectType]/form/[viewId]/index/index.vue b/packages/nc-gui/pages/[projectType]/form/[viewId]/index/index.vue index 14724ad45d..3a3a34dbc8 100644 --- a/packages/nc-gui/pages/[projectType]/form/[viewId]/index/index.vue +++ b/packages/nc-gui/pages/[projectType]/form/[viewId]/index/index.vue @@ -32,10 +32,13 @@ const onLoaded = async () => { } const showCodeScannerForFieldTitle = (fieldTitle: string) => { + // findColumnByTitle(fieldTitle)?.enable_scanner showCodeScannerOverlay.value = true fieldTitleForCurrentScan.value = fieldTitle } +const findColumnByTitle = (title: string) => formColumns.value?.find((el: ColumnType) => el.title === title) + const getScannedValueTransformerByFieldType = (fieldType: UITypes) => { switch (fieldType) { case UITypes.Number: @@ -50,7 +53,7 @@ const onDecode = async (scannedCodeValue: string) => { return } try { - const fieldForCurrentScan = formColumns.value?.find((el: ColumnType) => el.title === fieldTitleForCurrentScan.value) + const fieldForCurrentScan = findColumnByTitle(fieldTitleForCurrentScan.value) if (fieldForCurrentScan == null) { throw new Error(`Field with title ${fieldTitleForCurrentScan.value} not found`) } @@ -170,7 +173,7 @@ const onDecode = async (scannedCodeValue: string) => { {{ field.description }} -
+