Browse Source

fix(nc-gui): json & virtual fields spacing issue

pull/7466/head
Ramesh Mane 7 months ago
parent
commit
9a39e84676
  1. 11
      packages/nc-gui/components/cell/Json.vue
  2. 5
      packages/nc-gui/components/virtual-cell/BelongsTo.vue
  3. 4
      packages/nc-gui/components/virtual-cell/Links.vue
  4. 4
      packages/nc-gui/components/virtual-cell/Lookup.vue
  5. 17
      packages/nc-gui/components/virtual-cell/Rollup.vue
  6. 18
      packages/nc-gui/components/virtual-cell/barcode/Barcode.vue

11
packages/nc-gui/components/cell/Json.vue

@ -13,6 +13,7 @@ import {
useSelectedCellKeyupListener, useSelectedCellKeyupListener,
useVModel, useVModel,
watch, watch,
IsExpandedFormOpenInj,
} from '#imports' } from '#imports'
interface Props { interface Props {
@ -37,6 +38,8 @@ const isForm = inject(IsFormInj, ref(false))
const readOnly = inject(ReadonlyInj, ref(false)) const readOnly = inject(ReadonlyInj, ref(false))
const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))!
const vModel = useVModel(props, 'modelValue', emits) const vModel = useVModel(props, 'modelValue', emits)
const localValueState = ref<string | undefined>() const localValueState = ref<string | undefined>()
@ -187,14 +190,16 @@ watch(isExpanded, () => {
@update:model-value="localValue = $event" @update:model-value="localValue = $event"
/> />
<span v-if="error" class="text-xs w-full py-1 text-red-500"> <span v-if="error" class="text-xs w-full py-1 text-red-500" :class="isExpandedFormOpen ? 'px-2' : 'px-0'">
{{ error.toString() }} {{ error.toString() }}
</span> </span>
</div> </div>
<span v-else-if="vModel === null && showNull" class="nc-null uppercase">{{ $t('general.null') }}</span> <span v-else-if="vModel === null && showNull" class="nc-null uppercase" :class="isExpandedFormOpen ? 'px-2' : 'px-0'">{{
$t('general.null')
}}</span>
<LazyCellClampedText v-else :value="vModel" :lines="rowHeight" /> <LazyCellClampedText v-else :value="vModel" :lines="rowHeight" :class="isExpandedFormOpen ? 'px-2' : 'px-0'" />
</component> </component>
</template> </template>

5
packages/nc-gui/components/virtual-cell/BelongsTo.vue

@ -18,6 +18,7 @@ import {
useRoles, useRoles,
useSelectedCellKeyupListener, useSelectedCellKeyupListener,
useSmartsheetRowStoreOrThrow, useSmartsheetRowStoreOrThrow,
IsExpandedFormOpenInj,
} from '#imports' } from '#imports'
const column = inject(ColumnInj)! const column = inject(ColumnInj)!
@ -36,6 +37,8 @@ const isForm = inject(IsFormInj, ref(false))
const isUnderLookup = inject(IsUnderLookupInj, ref(false)) const isUnderLookup = inject(IsUnderLookupInj, ref(false))
const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))!
const { isUIAllowed } = useRoles() const { isUIAllowed } = useRoles()
const listItemsDlg = ref(false) const listItemsDlg = ref(false)
@ -95,7 +98,7 @@ watch([listItemsDlg], () => {
<template> <template>
<div class="flex w-full chips-wrapper items-center" :class="{ active }"> <div class="flex w-full chips-wrapper items-center" :class="{ active }">
<div class="chips flex items-center flex-1"> <div class="chips flex items-center flex-1" :class="isExpandedFormOpen ? 'px-2' : 'px-0'">
<template v-if="value && relatedTableDisplayValueProp"> <template v-if="value && relatedTableDisplayValueProp">
<VirtualCellComponentsItemChip <VirtualCellComponentsItemChip
:item="value" :item="value"

4
packages/nc-gui/components/virtual-cell/Links.vue

@ -145,7 +145,7 @@ watch([listItemsDlg], () => {
:title="textVal" :title="textVal"
class="text-center nc-datatype-link underline-transparent" class="text-center nc-datatype-link underline-transparent"
:class="{ '!text-gray-300': !textVal }" :class="{ '!text-gray-300': !textVal }"
tabindex="0" :tabindex="readOnly ? -1 : 0"
@click.stop.prevent="openChildList" @click.stop.prevent="openChildList"
@keydown.enter.stop.prevent="openChildList" @keydown.enter.stop.prevent="openChildList"
> >
@ -157,7 +157,7 @@ watch([listItemsDlg], () => {
<div <div
v-if="!isUnderLookup" v-if="!isUnderLookup"
ref="plusBtnRef" ref="plusBtnRef"
tabindex="0" :tabindex="readOnly ? -1 : 0"
class="!xs:hidden flex group justify-end group-hover:flex items-center" class="!xs:hidden flex group justify-end group-hover:flex items-center"
@keydown.enter.stop="openListDlg" @keydown.enter.stop="openListDlg"
> >

4
packages/nc-gui/components/virtual-cell/Lookup.vue

@ -15,6 +15,7 @@ import {
useMetas, useMetas,
useShowNotEditableWarning, useShowNotEditableWarning,
watch, watch,
IsExpandedFormOpenInj,
} from '#imports' } from '#imports'
const { metas, getMeta } = useMetas() const { metas, getMeta } = useMetas()
@ -27,6 +28,8 @@ const cellValue = inject(CellValueInj, ref())
const isGroupByLabel = inject(IsGroupByLabelInj, ref(false)) const isGroupByLabel = inject(IsGroupByLabelInj, ref(false))
const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))!
// Change the row height of the child cell under lookup // Change the row height of the child cell under lookup
// Other wise things like text will can take multi line tag // Other wise things like text will can take multi line tag
const providedHeightRef = ref(1) as any const providedHeightRef = ref(1) as any
@ -101,6 +104,7 @@ const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning, activ
<template> <template>
<div <div
class="h-full w-full nc-lookup-cell" class="h-full w-full nc-lookup-cell"
:class="isExpandedFormOpen ? 'px-2' : 'px-0'"
tabindex="-1" tabindex="-1"
:style="{ height: isGroupByLabel ? undefined : rowHeight && rowHeight !== 1 ? `${rowHeight * 2}rem` : `2.85rem` }" :style="{ height: isGroupByLabel ? undefined : rowHeight && rowHeight !== 1 ? `${rowHeight * 2}rem` : `2.85rem` }"
@dblclick="activateShowEditNonEditableFieldWarning" @dblclick="activateShowEditNonEditableFieldWarning"

17
packages/nc-gui/components/virtual-cell/Rollup.vue

@ -1,6 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import type { ColumnType, LinkToAnotherRecordType, RollupType } from 'nocodb-sdk' import type { ColumnType, LinkToAnotherRecordType, RollupType } from 'nocodb-sdk'
import { CellValueInj, ColumnInj, MetaInj, computed, inject, isRollup, ref, useMetas, useShowNotEditableWarning } from '#imports' import {
CellValueInj,
ColumnInj,
MetaInj,
computed,
inject,
isRollup,
ref,
useMetas,
useShowNotEditableWarning,
IsExpandedFormOpenInj,
} from '#imports'
const { metas } = useMetas() const { metas } = useMetas()
@ -10,6 +21,8 @@ const column = inject(ColumnInj)!
const meta = inject(MetaInj, ref()) const meta = inject(MetaInj, ref())
const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))!
const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning, activateShowEditNonEditableFieldWarning } = const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning, activateShowEditNonEditableFieldWarning } =
useShowNotEditableWarning() useShowNotEditableWarning()
@ -41,7 +54,7 @@ const childColumn = computed(() => {
</script> </script>
<template> <template>
<div @dblclick="activateShowEditNonEditableFieldWarning"> <div @dblclick="activateShowEditNonEditableFieldWarning" :class="isExpandedFormOpen ? 'px-2' : 'px-0'">
<div v-if="['count', 'avg', 'sum', 'countDistinct', 'sumDistinct', 'avgDistinct'].includes(colOptions.rollup_function)"> <div v-if="['count', 'avg', 'sum', 'countDistinct', 'sumDistinct', 'avgDistinct'].includes(colOptions.rollup_function)">
{{ value }} {{ value }}
</div> </div>

18
packages/nc-gui/components/virtual-cell/barcode/Barcode.vue

@ -90,13 +90,25 @@ const rowHeight = inject(RowHeightInj, ref(undefined))
</JsBarcodeWrapper> </JsBarcodeWrapper>
</div> </div>
<div v-if="tooManyCharsForBarcode" class="text-left text-wrap mt-2 text-[#e65100] text-xs"> <div
v-if="tooManyCharsForBarcode"
class="text-left text-wrap text-[#e65100] text-xs"
:class="isExpandedFormOpen ? 'px-2' : 'px-0'"
>
{{ $t('labels.barcodeValueTooLong') }} {{ $t('labels.barcodeValueTooLong') }}
</div> </div>
<div v-if="showEditNonEditableFieldWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs"> <div
v-if="showEditNonEditableFieldWarning"
class="text-left text-wrap mt-2 text-[#e65100] text-xs"
:class="isExpandedFormOpen ? 'px-2' : 'px-0'"
>
{{ $t('msg.warning.nonEditableFields.computedFieldUnableToClear') }} {{ $t('msg.warning.nonEditableFields.computedFieldUnableToClear') }}
</div> </div>
<div v-if="showClearNonEditableFieldWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs"> <div
v-if="showClearNonEditableFieldWarning"
class="text-left text-wrap mt-2 text-[#e65100] text-xs"
:class="isExpandedFormOpen ? 'px-2' : 'px-0'"
>
{{ $t('msg.warning.nonEditableFields.barcodeFieldsCannotBeDirectlyChanged') }} {{ $t('msg.warning.nonEditableFields.barcodeFieldsCannotBeDirectlyChanged') }}
</div> </div>
</template> </template>

Loading…
Cancel
Save