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.
93 lines
3.3 KiB
93 lines
3.3 KiB
3 years ago
|
<script setup lang="ts">
|
||
|
import type { ColumnType } from 'nocodb-sdk'
|
||
2 years ago
|
import type { Ref } from 'vue'
|
||
|
import { toRef } from 'vue'
|
||
2 years ago
|
import { ColumnInj } from '~/context'
|
||
2 years ago
|
import FilePhoneIcon from '~icons/mdi/file-phone'
|
||
2 years ago
|
import { useColumn } from '#imports'
|
||
3 years ago
|
import KeyIcon from '~icons/mdi/key-variant'
|
||
|
import JSONIcon from '~icons/mdi/code-json'
|
||
2 years ago
|
import ClockIcon from '~icons/mdi/clock-time-five'
|
||
3 years ago
|
// import FKIcon from '~icons/mdi/link-variant'
|
||
2 years ago
|
import WebIcon from '~icons/mdi/web'
|
||
3 years ago
|
import TextAreaIcon from '~icons/mdi/card-text-outline'
|
||
2 years ago
|
import StringIcon from '~icons/mdi/alpha-a-box-outline'
|
||
3 years ago
|
import BooleanIcon from '~icons/mdi/check-box-outline'
|
||
2 years ago
|
import CalendarIcon from '~icons/mdi/calendar'
|
||
3 years ago
|
import SingleSelectIcon from '~icons/mdi/radiobox-marked'
|
||
|
import MultiSelectIcon from '~icons/mdi/checkbox-multiple-marked'
|
||
|
import DatetimeIcon from '~icons/mdi/calendar-clock'
|
||
|
import RatingIcon from '~icons/mdi/star'
|
||
|
import GenericIcon from '~icons/mdi/square-rounded'
|
||
2 years ago
|
import NumericIcon from '~icons/mdi/numeric'
|
||
3 years ago
|
import AttachmentIcon from '~icons/mdi/image-multiple-outline'
|
||
2 years ago
|
import EmailIcon from '~icons/mdi/email'
|
||
2 years ago
|
import CurrencyIcon from '~icons/mdi/currency-usd-circle-outline'
|
||
2 years ago
|
import PercentIcon from '~icons/mdi/percent-outline'
|
||
2 years ago
|
import DecimalIcon from '~icons/mdi/decimal'
|
||
2 years ago
|
import SpecificDBTypeIcon from '~icons/mdi/database-settings'
|
||
3 years ago
|
|
||
2 years ago
|
const props = defineProps<{ columnMeta?: ColumnType }>()
|
||
2 years ago
|
|
||
2 years ago
|
const columnMeta = toRef(props, 'columnMeta')
|
||
2 years ago
|
const column = inject(ColumnInj, columnMeta)
|
||
3 years ago
|
|
||
2 years ago
|
const additionalColMeta = useColumn(column as Ref<ColumnType>)
|
||
3 years ago
|
|
||
|
const icon = computed(() => {
|
||
2 years ago
|
if (column?.value?.pk) {
|
||
3 years ago
|
return KeyIcon
|
||
2 years ago
|
} else if (additionalColMeta.isJSON.value) {
|
||
3 years ago
|
return JSONIcon
|
||
2 years ago
|
} else if (additionalColMeta.isDate.value) {
|
||
2 years ago
|
return CalendarIcon
|
||
2 years ago
|
} else if (additionalColMeta.isDateTime.value) {
|
||
3 years ago
|
return DatetimeIcon
|
||
2 years ago
|
} else if (additionalColMeta.isSet.value) {
|
||
3 years ago
|
return MultiSelectIcon
|
||
2 years ago
|
} else if (additionalColMeta.isSingleSelect.value) {
|
||
3 years ago
|
return SingleSelectIcon
|
||
2 years ago
|
} else if (additionalColMeta.isBoolean.value) {
|
||
3 years ago
|
return BooleanIcon
|
||
2 years ago
|
} else if (additionalColMeta.isTextArea.value) {
|
||
3 years ago
|
return TextAreaIcon
|
||
2 years ago
|
} else if (additionalColMeta.isEmail.value) {
|
||
2 years ago
|
return EmailIcon
|
||
2 years ago
|
} else if (additionalColMeta.isYear.value) {
|
||
2 years ago
|
return CalendarIcon
|
||
2 years ago
|
} else if (additionalColMeta.isTime.value) {
|
||
2 years ago
|
return ClockIcon
|
||
2 years ago
|
} else if (additionalColMeta.isRating.value) {
|
||
3 years ago
|
return RatingIcon
|
||
2 years ago
|
} else if (additionalColMeta.isAttachment.value) {
|
||
3 years ago
|
return AttachmentIcon
|
||
2 years ago
|
} else if (additionalColMeta.isDecimal.value) {
|
||
2 years ago
|
return DecimalIcon
|
||
2 years ago
|
} else if (additionalColMeta.isPhoneNumber.value) {
|
||
2 years ago
|
return FilePhoneIcon
|
||
3 years ago
|
}
|
||
|
// else if(additionalColMeta.isForeignKey) {
|
||
|
// return FKIcon
|
||
|
// }
|
||
2 years ago
|
else if (additionalColMeta.isURL.value) {
|
||
2 years ago
|
return WebIcon
|
||
2 years ago
|
} else if (additionalColMeta.isCurrency.value) {
|
||
2 years ago
|
return CurrencyIcon
|
||
2 years ago
|
} else if (additionalColMeta.isPercent.value) {
|
||
2 years ago
|
return PercentIcon
|
||
2 years ago
|
} else if (additionalColMeta.isInt.value || additionalColMeta.isFloat.value) {
|
||
2 years ago
|
return NumericIcon
|
||
2 years ago
|
} else if (additionalColMeta.isString.value) {
|
||
2 years ago
|
return StringIcon
|
||
2 years ago
|
} else if (additionalColMeta.isSpecificDBType.value) {
|
||
|
return SpecificDBTypeIcon
|
||
3 years ago
|
} else {
|
||
3 years ago
|
return GenericIcon
|
||
|
}
|
||
|
})
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
2 years ago
|
<component :is="icon" class="text-grey mx-1 !text-sm" />
|
||
3 years ago
|
</template>
|