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.
61 lines
1.9 KiB
61 lines
1.9 KiB
2 years ago
|
<script setup lang="ts">
|
||
|
import type { ColumnType } from 'nocodb-sdk'
|
||
|
import { ColumnInj } from '~/components'
|
||
|
import useColumn from '~/composables/useColumn'
|
||
|
import KeyIcon from '~icons/mdi/key-variant'
|
||
|
import JSONIcon from '~icons/mdi/code-json'
|
||
|
// import FKIcon from '~icons/mdi/link-variant'
|
||
|
import TextAreaIcon from '~icons/mdi/card-text-outline'
|
||
|
import StringIcon from '~icons/mdi/alpha-a'
|
||
|
import BooleanIcon from '~icons/mdi/check-box-outline'
|
||
|
import SingleSelectIcon from '~icons/mdi/radiobox-marked'
|
||
|
import MultiSelectIcon from '~icons/mdi/checkbox-multiple-marked'
|
||
|
import DatetimeIcon from '~icons/mdi/calendar-clock'
|
||
|
import DateIcon from '~icons/mdi/calendar'
|
||
|
import RatingIcon from '~icons/mdi/star'
|
||
|
import GenericIcon from '~icons/mdi/square-rounded'
|
||
|
import AttachmentIcon from '~icons/mdi/image-multiple-outline'
|
||
|
|
||
|
const column = inject(ColumnInj)
|
||
|
|
||
|
const additionalColMeta = useColumn(column as ColumnType)
|
||
|
|
||
|
const icon = computed(() => {
|
||
|
if (column?.pk) {
|
||
|
return KeyIcon
|
||
|
} else if (additionalColMeta.isJSON) {
|
||
|
return JSONIcon
|
||
|
} else if (additionalColMeta.isDate) {
|
||
|
return DateIcon
|
||
|
} else if (additionalColMeta.isDateTime) {
|
||
|
return DatetimeIcon
|
||
|
} else if (additionalColMeta.isSet) {
|
||
|
return MultiSelectIcon
|
||
|
} else if (additionalColMeta.isSingleSelect) {
|
||
|
return SingleSelectIcon
|
||
|
} else if (additionalColMeta.isBoolean) {
|
||
|
return BooleanIcon
|
||
|
} else if (additionalColMeta.isString) {
|
||
|
return h(StringIcon, {
|
||
|
class: 'text-[1.5rem]',
|
||
|
})
|
||
|
} else if (additionalColMeta.isTextArea) {
|
||
|
return TextAreaIcon
|
||
|
} else if (additionalColMeta.isRating) {
|
||
|
return RatingIcon
|
||
|
} else if (additionalColMeta.isAttachment) {
|
||
|
return AttachmentIcon
|
||
|
}
|
||
|
// else if(additionalColMeta.isForeignKey) {
|
||
|
// return FKIcon
|
||
|
// }
|
||
|
else {
|
||
|
return GenericIcon
|
||
|
}
|
||
|
})
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
|
<component :is="icon" class="text-grey mx-1" />
|
||
|
</template>
|