mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-02 23:17:23 +00:00
fix: RowHeighInj for sharing row height between components
Signed-off-by: mertmit <mertmit99@gmail.com>
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { ComputedRef } from 'vue'
|
||||
import type { GridType } from 'nocodb-sdk'
|
||||
import JsBarcodeWrapper from './JsBarcodeWrapper.vue'
|
||||
import { ActiveViewInj } from '#imports'
|
||||
import { RowHeightInj } from '#imports'
|
||||
|
||||
const maxNumberOfAllowedCharsForBarcodeValue = 100
|
||||
|
||||
const view = inject(ActiveViewInj, ref())
|
||||
|
||||
const cellValue = inject(CellValueInj)
|
||||
|
||||
const column = inject(ColumnInj)
|
||||
@@ -35,22 +32,7 @@ const showBarcode = computed(() => barcodeValue?.value.length > 0 && !tooManyCha
|
||||
|
||||
const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning } = useShowNotEditableWarning()
|
||||
|
||||
const rowHeight = computed(() => {
|
||||
if ((view.value?.view as GridType)?.row_height !== undefined) {
|
||||
switch ((view.value?.view as GridType)?.row_height) {
|
||||
case 0:
|
||||
return 1
|
||||
case 1:
|
||||
return 2
|
||||
case 2:
|
||||
return 4
|
||||
case 3:
|
||||
return 6
|
||||
default:
|
||||
return 1
|
||||
}
|
||||
}
|
||||
})
|
||||
const rowHeight = inject(RowHeightInj)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -65,7 +47,7 @@ const rowHeight = computed(() => {
|
||||
<JsBarcodeWrapper v-if="showBarcode" :barcode-value="barcodeValue" :barcode-format="barcodeMeta.barcodeFormat" />
|
||||
</a-modal>
|
||||
<JsBarcodeWrapper
|
||||
v-if="showBarcode"
|
||||
v-if="showBarcode && rowHeight"
|
||||
:barcode-value="barcodeValue"
|
||||
:barcode-format="barcodeMeta.barcodeFormat"
|
||||
:custom-style="{ height: rowHeight ? `${rowHeight * 1.4}rem` : `1.4rem` }"
|
||||
@@ -77,6 +59,18 @@ const rowHeight = computed(() => {
|
||||
</div>
|
||||
</template>
|
||||
</JsBarcodeWrapper>
|
||||
<JsBarcodeWrapper
|
||||
v-else-if="showBarcode"
|
||||
:barcode-value="barcodeValue"
|
||||
:barcode-format="barcodeMeta.barcodeFormat"
|
||||
@on-click-barcode="showBarcodeModal"
|
||||
>
|
||||
<template #barcodeRenderError>
|
||||
<div class="text-left text-wrap mt-2 text-[#e65100] text-xs" data-testid="barcode-invalid-input-message">
|
||||
{{ $t('msg.warning.barcode.renderError') }}
|
||||
</div>
|
||||
</template>
|
||||
</JsBarcodeWrapper>
|
||||
|
||||
<div v-if="tooManyCharsForBarcode" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
|
||||
{{ $t('labels.barcodeValueTooLong') }}
|
||||
|
||||
Reference in New Issue
Block a user