Browse Source

Merge pull request #2949 from nocodb/feat/gui-v2-count-cell

feat(gui-v2): Count Cell
pull/2982/head
աɨռɢӄաօռɢ 2 years ago committed by GitHub
parent
commit
54428f6c42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      packages/nc-gui-v2/components/smartsheet-header/VirtualCellIcon.vue
  2. 3
      packages/nc-gui-v2/components/smartsheet/VirtualCell.vue
  3. 9
      packages/nc-gui-v2/components/virtual-cell/Count.vue
  4. 2
      packages/nc-gui-v2/composables/useVirtualCell.ts
  5. 1
      packages/nocodb-sdk/src/lib/UITypes.ts

3
packages/nc-gui-v2/components/smartsheet-header/VirtualCellIcon.vue

@ -8,6 +8,7 @@ import BTIcon from '~icons/mdi/table-arrow-left'
import MMIcon from '~icons/mdi/table-network' import MMIcon from '~icons/mdi/table-network'
import FormulaIcon from '~icons/mdi/math-integral' import FormulaIcon from '~icons/mdi/math-integral'
import RollupIcon from '~icons/mdi/movie-roll' import RollupIcon from '~icons/mdi/movie-roll'
import CountIcon from '~icons/mdi/counter'
const { columnMeta } = defineProps<{ columnMeta?: ColumnType }>() const { columnMeta } = defineProps<{ columnMeta?: ColumnType }>()
@ -31,6 +32,8 @@ const icon = computed(() => {
return GenericIcon return GenericIcon
case UITypes.Rollup: case UITypes.Rollup:
return RollupIcon return RollupIcon
case UITypes.Count:
return CountIcon
} }
return GenericIcon return GenericIcon
}) })

3
packages/nc-gui-v2/components/smartsheet/VirtualCell.vue

@ -15,7 +15,7 @@ const emit = defineEmits(['update:modelValue'])
provide(ColumnInj, column) provide(ColumnInj, column)
provide('value', value) provide('value', value)
const { isLookup, isBt, isRollup, isMm, isHm, isFormula } = useVirtualCell(column) const { isLookup, isBt, isRollup, isMm, isHm, isFormula, isCount } = useVirtualCell(column)
</script> </script>
<template> <template>
@ -25,6 +25,7 @@ const { isLookup, isBt, isRollup, isMm, isHm, isFormula } = useVirtualCell(colum
<VirtualCellBelongsTo v-else-if="isBt" /> <VirtualCellBelongsTo v-else-if="isBt" />
<VirtualCellRollup v-else-if="isRollup" /> <VirtualCellRollup v-else-if="isRollup" />
<VirtualCellFormula v-else-if="isFormula" /> <VirtualCellFormula v-else-if="isFormula" />
<VirtualCellCount v-else-if="isCount" />
<!-- <v-lazy> --> <!-- <v-lazy> -->
<!-- <has-many-cell <!-- <has-many-cell

9
packages/nc-gui-v2/components/virtual-cell/Count.vue

@ -0,0 +1,9 @@
<script setup lang="ts">
// TODO: wait for Count Column implementation
</script>
<template>
<span class="prose-sm"></span>
</template>
<style scoped lang="scss"></style>

2
packages/nc-gui-v2/composables/useVirtualCell.ts

@ -20,6 +20,7 @@ export function useVirtualCell(column: ColumnType) {
const isLookup = computed(() => column.uidt === UITypes.Lookup) const isLookup = computed(() => column.uidt === UITypes.Lookup)
const isRollup = computed(() => column.uidt === UITypes.Rollup) const isRollup = computed(() => column.uidt === UITypes.Rollup)
const isFormula = computed(() => column.uidt === UITypes.Formula) const isFormula = computed(() => column.uidt === UITypes.Formula)
const isCount = computed(() => column.uidt === UITypes.Count)
return { return {
isHm, isHm,
@ -28,5 +29,6 @@ export function useVirtualCell(column: ColumnType) {
isLookup, isLookup,
isRollup, isRollup,
isFormula, isFormula,
isCount,
} }
} }

1
packages/nocodb-sdk/src/lib/UITypes.ts

@ -50,6 +50,7 @@ export function isVirtualCol(
UITypes.Formula, UITypes.Formula,
UITypes.Rollup, UITypes.Rollup,
UITypes.Lookup, UITypes.Lookup,
UITypes.Count,
].includes(<UITypes>(typeof col === 'object' ? col?.uidt : col)); ].includes(<UITypes>(typeof col === 'object' ? col?.uidt : col));
} }

Loading…
Cancel
Save