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.
89 lines
3.2 KiB
89 lines
3.2 KiB
2 years ago
|
<script setup lang="ts">
|
||
|
import type { ColumnType } from 'nocodb-sdk'
|
||
2 years ago
|
import type { Ref } from 'vue'
|
||
2 years ago
|
import { ColumnInj, toRef, useColumn } from '#imports'
|
||
2 years ago
|
import FilePhoneIcon from '~icons/mdi/file-phone'
|
||
2 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'
|
||
2 years ago
|
import WebIcon from '~icons/mdi/web'
|
||
2 years ago
|
import TextAreaIcon from '~icons/mdi/card-text-outline'
|
||
2 years ago
|
import StringIcon from '~icons/mdi/alpha-a-box-outline'
|
||
2 years ago
|
import BooleanIcon from '~icons/mdi/check-box-outline'
|
||
2 years ago
|
import CalendarIcon from '~icons/mdi/calendar'
|
||
2 years ago
|
import SingleSelectIcon from '~icons/mdi/arrow-down-drop-circle'
|
||
|
import MultiSelectIcon from '~icons/mdi/format-list-bulleted-square'
|
||
2 years ago
|
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'
|
||
2 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'
|
||
2 years ago
|
import DurationIcon from '~icons/mdi/timer-outline'
|
||
2 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)
|
||
2 years ago
|
|
||
2 years ago
|
const additionalColMeta = useColumn(column as Ref<ColumnType>)
|
||
2 years ago
|
|
||
|
const icon = computed(() => {
|
||
2 years ago
|
if (column?.value?.pk) {
|
||
2 years ago
|
return KeyIcon
|
||
2 years ago
|
} else if (additionalColMeta.isJSON.value) {
|
||
2 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) {
|
||
2 years ago
|
return DatetimeIcon
|
||
2 years ago
|
} else if (additionalColMeta.isSet.value) {
|
||
2 years ago
|
return MultiSelectIcon
|
||
2 years ago
|
} else if (additionalColMeta.isSingleSelect.value) {
|
||
2 years ago
|
return SingleSelectIcon
|
||
2 years ago
|
} else if (additionalColMeta.isBoolean.value) {
|
||
2 years ago
|
return BooleanIcon
|
||
2 years ago
|
} else if (additionalColMeta.isTextArea.value) {
|
||
2 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) {
|
||
2 years ago
|
return RatingIcon
|
||
2 years ago
|
} else if (additionalColMeta.isAttachment.value) {
|
||
2 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
|
||
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.isDuration.value) {
|
||
|
return DurationIcon
|
||
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
|
||
2 years ago
|
} else {
|
||
2 years ago
|
return GenericIcon
|
||
|
}
|
||
|
})
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
2 years ago
|
<component :is="icon" class="text-grey mx-1 !text-sm" />
|
||
2 years ago
|
</template>
|