Browse Source

feat(nc-gui): Improved types in table node and removed unnecassry type addition to column type in Virtual cell

pull/3612/head
Muhammed Mustafa 2 years ago
parent
commit
94b57f2bb7
  1. 26
      packages/nc-gui/components/erd/TableNode.vue
  2. 2
      packages/nc-gui/components/smartsheet-header/VirtualCell.vue

26
packages/nc-gui/components/erd/TableNode.vue

@ -1,32 +1,34 @@
<script setup>
<script lang="ts" setup>
import type { NodeProps } from '@braks/vue-flow'
import { Handle, Position } from '@braks/vue-flow'
import type { TableType } from 'nocodb-sdk'
import { UITypes, isVirtualCol } from 'nocodb-sdk'
import type { Ref } from 'vue'
const props = defineProps({
data: {
type: Object,
required: true,
},
})
interface Props extends NodeProps {
data: TableType & { showPkAndFk: boolean }
}
const props = defineProps<Props>()
const { data } = toRefs(props)
provide(MetaInj, data)
provide(MetaInj, data as Ref<TableType>)
const columns = computed(() => {
// Hide hm ltar created for `mm` relations
return data.value.columns.filter((col) => !(col.uidt === UITypes.LinkToAnotherRecord && col.system === 1))
return data.value.columns?.filter((col) => !(col.uidt === UITypes.LinkToAnotherRecord && col.system === 1))
})
const pkAndFkColumns = computed(() => {
return columns.value.filter(() => data.value.showPkAndFk).filter((col) => col.pk || col.uidt === UITypes.ForeignKey)
return columns.value?.filter(() => data.value.showPkAndFk).filter((col) => col.pk || col.uidt === UITypes.ForeignKey)
})
const nonPkColumns = computed(() => {
return columns.value.filter((col) => !col.pk && col.uidt !== UITypes.ForeignKey)
return columns.value?.filter((col) => !col.pk && col.uidt !== UITypes.ForeignKey)
})
const relatedColumnId = (col) =>
const relatedColumnId = (col: Record<string, any>) =>
col.colOptions.type === 'mm' ? col.colOptions.fk_parent_column_id : col.colOptions.fk_child_column_id
</script>

2
packages/nc-gui/components/smartsheet-header/VirtualCell.vue

@ -16,7 +16,7 @@ import {
useVirtualCell,
} from '#imports'
const props = defineProps<{ column: ColumnType & { meta: any }; hideMenu?: boolean; required?: boolean | number }>()
const props = defineProps<{ column: ColumnType; hideMenu?: boolean; required?: boolean | number }>()
const { t } = useI18n()

Loading…
Cancel
Save