Browse Source

fix: css for fixed row height

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/4966/head
mertmit 2 years ago
parent
commit
fbbe85c455
  1. 24
      packages/nc-gui/components/smartsheet/Cell.vue
  2. 4
      packages/nc-gui/components/smartsheet/Grid.vue

24
packages/nc-gui/components/smartsheet/Cell.vue

@ -1,9 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import type { ColumnType, GridType } from 'nocodb-sdk' import type { ColumnType } from 'nocodb-sdk'
import { isSystemColumn } from 'nocodb-sdk' import { isSystemColumn } from 'nocodb-sdk'
import { import {
ActiveCellInj, ActiveCellInj,
ActiveViewInj,
ColumnInj, ColumnInj,
EditModeInj, EditModeInj,
IsFormInj, IsFormInj,
@ -61,8 +60,6 @@ const props = defineProps<Props>()
const emit = defineEmits(['update:modelValue', 'save', 'navigate', 'update:editEnabled']) const emit = defineEmits(['update:modelValue', 'save', 'navigate', 'update:editEnabled'])
const view = inject(ActiveViewInj, ref())
const column = toRef(props, 'column') const column = toRef(props, 'column')
const active = toRef(props, 'active', false) const active = toRef(props, 'active', false)
@ -127,23 +124,6 @@ const syncAndNavigate = (dir: NavigateDir, e: KeyboardEvent) => {
if (!isForm.value) e.stopImmediatePropagation() if (!isForm.value) e.stopImmediatePropagation()
} }
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
}
}
})
</script> </script>
<template> <template>
@ -152,8 +132,6 @@ const rowHeight = computed(() => {
:class="[ :class="[
`nc-cell-${(column?.uidt || 'default').toLowerCase()}`, `nc-cell-${(column?.uidt || 'default').toLowerCase()}`,
{ 'text-blue-600': isPrimary(column) && !props.virtual && !isForm }, { 'text-blue-600': isPrimary(column) && !props.virtual && !isForm },
{ 'm-y-auto !h-auto': !rowHeight || rowHeight === 1 },
{ '!h-full': rowHeight && rowHeight !== 1 },
]" ]"
@keydown.enter.exact="syncAndNavigate(NavigateDir.NEXT, $event)" @keydown.enter.exact="syncAndNavigate(NavigateDir.NEXT, $event)"
@keydown.shift.enter.exact="syncAndNavigate(NavigateDir.PREV, $event)" @keydown.shift.enter.exact="syncAndNavigate(NavigateDir.PREV, $event)"

4
packages/nc-gui/components/smartsheet/Grid.vue

@ -830,6 +830,8 @@ const rowHeight = computed(() => {
:class="{ :class="{
'active': hasEditPermission && isCellSelected(rowIndex, colIndex), 'active': hasEditPermission && isCellSelected(rowIndex, colIndex),
'nc-required-cell': isColumnRequiredAndNull(columnObj, row.row), 'nc-required-cell': isColumnRequiredAndNull(columnObj, row.row),
'align-middle': !rowHeight || rowHeight === 1,
'align-top': rowHeight && rowHeight !== 1,
}" }"
:data-testid="`cell-${columnObj.title}-${rowIndex}`" :data-testid="`cell-${columnObj.title}-${rowIndex}`"
:data-key="rowIndex + columnObj.id" :data-key="rowIndex + columnObj.id"
@ -982,7 +984,7 @@ const rowHeight = computed(() => {
td:not(:first-child) > div { td:not(:first-child) > div {
overflow: hidden; overflow: hidden;
@apply flex px-1; @apply flex px-1 h-auto;
} }
table, table,

Loading…
Cancel
Save