Browse Source

feat: in cell show singular/plural label based on text

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5848/head
Pranav C 1 year ago
parent
commit
70e21a132a
  1. 6
      packages/nc-gui/components/virtual-cell/Link.vue

6
packages/nc-gui/components/virtual-cell/Link.vue

@ -1,10 +1,8 @@
<script setup lang="ts">
import { computed } from '@vue/reactivity'
import { inflect } from 'inflection'
import type { ColumnType } from 'nocodb-sdk'
import type { Ref } from 'vue'
import { CellValueInj, inject } from '#imports'
import { pluralize, singularize } from 'inflection'
const value = inject(CellValueInj)
@ -59,9 +57,9 @@ const textVal = computed(() => {
if (!value.value) {
return 'Empty'
} else if (value.value === 1) {
return `1 ${singularize(relatedTableMeta.value?.title ?? '')}`
return `1 ${column.value?.meta?.singular || 'Item'}`
} else {
return `${value.value} ${pluralize(relatedTableMeta.value?.title ?? '')}`
return `${value.value} ${column.value?.meta?.plural || 'Items'}`
}
})

Loading…
Cancel
Save