fix: Missing lookup/rollup icon colour (#8512)

* fix: missing lookup/rollup icon color

* fix: icon color in field menu
This commit is contained in:
Pranav C
2024-05-17 19:29:47 +05:30
committed by GitHub
parent 16cfee5c96
commit 5fcec4308e
5 changed files with 51 additions and 9 deletions

View File

@@ -17,7 +17,7 @@ const renderIcon = (column: ColumnType, relationColumn?: ColumnType) => {
case RelationTypes.BELONGS_TO:
return { icon: iconMap.bt_solid }
case RelationTypes.ONE_TO_ONE:
return { icon: iconMap.oneToOneSolid, color: 'text-blue-500' }
return { icon: iconMap.oneToOneSolid, color: 'text-purple-500' }
}
break
case UITypes.SpecificDBType:
@@ -36,6 +36,8 @@ const renderIcon = (column: ColumnType, relationColumn?: ColumnType) => {
return { icon: iconMap.cellLookup, color: 'text-orange-500' }
case RelationTypes.BELONGS_TO:
return { icon: iconMap.cellLookup, color: 'text-blue-500' }
case RelationTypes.ONE_TO_ONE:
return { icon: iconMap.cellLookup, color: 'text-purple-500' }
}
return { icon: iconMap.cellLookup, color: 'text-grey' }
case UITypes.Rollup:
@@ -46,6 +48,8 @@ const renderIcon = (column: ColumnType, relationColumn?: ColumnType) => {
return { icon: iconMap.cellRollup, color: 'text-orange-500' }
case RelationTypes.BELONGS_TO:
return { icon: iconMap.cellRollup, color: 'text-blue-500' }
case RelationTypes.ONE_TO_ONE:
return { icon: iconMap.cellRollup, color: 'text-purple-500' }
}
return { icon: iconMap.cellRollup, color: 'text-grey' }
case UITypes.Count:
@@ -76,15 +80,16 @@ export default defineComponent({
const column = computed(() => columnMeta.value ?? injectedColumn.value)
const { metas } = useMetas()
let relationColumn: ColumnType
return () => {
if (!column.value) return null
if (column && column.value) {
if (isMm(column.value) || isHm(column.value) || isBt(column.value) || isLookup(column.value) || isRollup(column.value)) {
const meta = inject(MetaInj, ref())
relationColumn = meta.value?.columns?.find(
if (isLookup(column.value) || isRollup(column.value)) {
relationColumn = metas.value?.[column.value.fk_model_id]?.columns?.find(
(c) => c.id === column.value?.colOptions?.fk_relation_column_id,
) as ColumnType
}
@@ -92,7 +97,7 @@ export default defineComponent({
const { icon: Icon, color } = renderIcon(column.value, relationColumn)
return h(Icon, { class: `${color} mx-1 nc-virtual-cell-icon` })
return h(Icon, { class: `${color || 'text-grey'} mx-1 nc-virtual-cell-icon` })
}
},
})