mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.8 KiB
59 lines
1.8 KiB
3 years ago
|
<script setup lang="ts">
|
||
|
import type { ColumnType } from 'nocodb-sdk'
|
||
2 years ago
|
import { ActiveCellInj, CellValueInj, ColumnInj, RowInj, provide, toRef, useVirtualCell } from '#imports'
|
||
2 years ago
|
import type { Row } from '~/composables'
|
||
2 years ago
|
import { NavigateDir } from '~/lib'
|
||
|
|
||
2 years ago
|
const props = defineProps<Props>()
|
||
|
|
||
|
const emit = defineEmits(['update:modelValue', 'navigate'])
|
||
|
|
||
|
const HasMany = defineAsyncComponent(() => import('../virtual-cell/HasMany.vue'))
|
||
|
|
||
|
const ManyToMany = defineAsyncComponent(() => import('../virtual-cell/ManyToMany.vue'))
|
||
|
|
||
|
const BelongsTo = defineAsyncComponent(() => import('../virtual-cell/BelongsTo.vue'))
|
||
|
|
||
2 years ago
|
const Rollup = defineAsyncComponent(() => import('../virtual-cell/Rollup.vue') as any)
|
||
2 years ago
|
|
||
2 years ago
|
const Formula = defineAsyncComponent(() => import('../virtual-cell/Formula.vue'))
|
||
2 years ago
|
|
||
2 years ago
|
const Count = defineAsyncComponent(() => import('../virtual-cell/Count.vue'))
|
||
2 years ago
|
|
||
2 years ago
|
const Lookup = defineAsyncComponent(() => import('../virtual-cell/Lookup.vue') as any)
|
||
2 years ago
|
|
||
3 years ago
|
interface Props {
|
||
|
column: ColumnType
|
||
|
modelValue: any
|
||
2 years ago
|
row: Row
|
||
2 years ago
|
active?: boolean
|
||
3 years ago
|
}
|
||
|
|
||
2 years ago
|
const column = toRef(props, 'column')
|
||
2 years ago
|
const active = toRef(props, 'active', false)
|
||
2 years ago
|
const row = toRef(props, 'row')
|
||
3 years ago
|
|
||
3 years ago
|
provide(ColumnInj, column)
|
||
2 years ago
|
provide(ActiveCellInj, active)
|
||
2 years ago
|
provide(RowInj, row)
|
||
2 years ago
|
provide(CellValueInj, toRef(props, 'modelValue'))
|
||
3 years ago
|
|
||
2 years ago
|
const { isLookup, isBt, isRollup, isMm, isHm, isFormula, isCount } = useVirtualCell(column)
|
||
3 years ago
|
</script>
|
||
|
|
||
|
<template>
|
||
2 years ago
|
<div
|
||
2 years ago
|
class="nc-virtual-cell w-full"
|
||
2 years ago
|
@keydown.stop.enter.exact="emit('navigate', NavigateDir.NEXT)"
|
||
|
@keydown.stop.shift.enter.exact="emit('navigate', NavigateDir.PREV)"
|
||
|
>
|
||
2 years ago
|
<HasMany v-if="isHm" />
|
||
|
<ManyToMany v-else-if="isMm" />
|
||
|
<BelongsTo v-else-if="isBt" />
|
||
|
<Rollup v-else-if="isRollup" />
|
||
|
<Formula v-else-if="isFormula" />
|
||
|
<Count v-else-if="isCount" />
|
||
|
<Lookup v-else-if="isLookup" />
|
||
3 years ago
|
</div>
|
||
|
</template>
|