|
|
|
@ -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` }) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|