Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): use SmartsheetHeaderIcon

Ramesh Mane01b9ca8885fd
diff --git a/packages/nc-gui/components/dlg/View/Create.vue b/packages/nc-gui/components/dlg/View/Create.vue
index 64b0540fb3..f86e677414 100644
--- a/packages/nc-gui/components/dlg/View/Create.vue
+++ b/packages/nc-gui/components/dlg/View/Create.vue
@@ -343,6 +343,8 @@ onMounted(async () => {
return {
value: field.id,
label: field.title,
+ uidt: field.uidt,
+ col: field,
}
})
@@ -369,6 +371,7 @@ onMounted(async () => {
value: field.id,
label: field.title,
uidt: field.uidt,
+ col: field,
}
}),
]
@@ -408,6 +411,7 @@ onMounted(async () => {
value: c.id,
label: c.title,
uidt: c.uidt,
+ col: c,
}
})
@@ -431,6 +435,7 @@ onMounted(async () => {
value: field.id,
label: field.title,
uidt: field.uidt,
+ col: field,
}
})
@@ -466,6 +471,7 @@ onMounted(async () => {
value: field.id,
label: field.title,
uidt: field.uidt,
+ col: field,
}
})
.sort((a, b) => {
@@ -882,7 +888,7 @@ watch(activeBaseId, () => {
<a-select-option v-for="option of viewSelectFieldOptions" :key="option.value" :value="option.value">
<div class="w-full flex gap-2 items-center justify-between" :title="option.label">
<div class="flex-1 flex items-center gap-1 max-w-[calc(100%_-_24px)]">
- <SmartsheetHeaderIcon v-if="option.value" :column="option" class="!ml-0" />
+ <SmartsheetHeaderIcon v-if="option.col" :column="option.col" class="!ml-0" />
<NcTooltip class="flex-1 max-w-[calc(100%_-_20px)] truncate" show-on-truncate-only>
<template #title>
@@ -920,7 +926,7 @@ watch(activeBaseId, () => {
<a-select-option v-for="option of viewSelectFieldOptions" :key="option.value" :value="option.value">
<div class="w-full flex gap-2 items-center justify-between" :title="option.label">
<div class="flex-1 flex items-center gap-1 max-w-[calc(100%_-_24px)]">
- <SmartsheetHeaderIcon :column="option" class="!ml-0" />
+ <SmartsheetHeaderIcon v-if="option.col" :column="option.col" class="!ml-0" />
<NcTooltip class="flex-1 max-w-[calc(100%_-_20px)] truncate" show-on-truncate-only>
<template #title>
@@ -993,7 +999,7 @@ watch(activeBaseId, () => {
>
<div class="w-full flex gap-2 items-center justify-between" :title="option.label">
<div class="flex items-center gap-1 max-w-[calc(100%_-_20px)]">
- <SmartsheetHeaderIcon :column="option" />
+ <SmartsheetHeaderIcon v-if="option.col" :column="option.col" />
<NcTooltip class="flex-1 max-w-[calc(100%_-_20px)] truncate" show-on-truncate-only>
<template #title>
@@ -1091,7 +1097,7 @@ watch(activeBaseId, () => {
>
<div class="w-full flex gap-2 items-center justify-between" :title="option.label">
<div class="flex items-center gap-1 max-w-[calc(100%_-_20px)]">
- <SmartsheetHeaderIcon :column="option" />
+ <SmartsheetHeaderIcon v-if="option.col" :column="option.col" />
<NcTooltip class="flex-1 max-w-[calc(100%_-_20px)] truncate" show-on-truncate-only>
<template #title>
diff --git a/packages/nc-gui/components/smartsheet/column/RollupOptions.vue b/packages/nc-gui/components/smartsheet/column/RollupOptions.vue
index 75b1340a39..9360765f77 100644
--- a/packages/nc-gui/components/smartsheet/column/RollupOptions.vue
+++ b/packages/nc-gui/components/smartsheet/column/RollupOptions.vue
@@ -145,11 +145,6 @@ const onRelationColChange = async () => {
onDataTypeChange()
}
-const cellIcon = (column: ColumnType) =>
- h(isVirtualCol(column) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), {
- columnMeta: column,
- })
-
const aggFunctionsList: Ref<Record<string, string>[]> = ref([])
const availableRollupPerColumn = computed(() => {
@@ -298,12 +293,7 @@ const handleScrollIntoView = () => {
<a-select-option v-for="(table, i) of refTables" :key="i" :value="table.col.fk_column_id">
<div class="flex gap-2 w-full justify-between truncate items-center">
<div class="min-w-1/2 flex items-center gap-2">
- <component
- :is="cellIcon(table.column)"
- :column-meta="table.column"
- class="!mx-0"
- color="text-nc-content-gray-subtle2"
- />
+ <SmartsheetHeaderIcon :column="table.column" class="!mx-0" color="text-nc-content-gray-subtle2" />
<NcTooltip class="truncate min-w-[calc(100%_-_24px)]" show-on-truncate-only>
<template #title>{{ table.column.title }}</template>
@@ -351,7 +341,8 @@ const handleScrollIntoView = () => {
<a-select-option v-for="column of filteredColumns" :key="column.title" :value="column.id">
<div class="w-full flex gap-2 truncate items-center justify-between">
<div class="flex items-center gap-2 flex-1 truncate">
- <component :is="cellIcon(column)" :column-meta="column" class="!mx-0" />
+ <SmartsheetHeaderIcon :column="column" class="!mx-0" color="text-nc-content-gray-subtle2" />
+
<div class="truncate flex-1">{{ column.title }}</div>
</div>
<component
diff --git a/packages/nc-gui/components/smartsheet/details/Fields.vue b/packages/nc-gui/components/smartsheet/details/Fields.vue
index 16c4abfff5..7c6afa0147 100644
--- a/packages/nc-gui/components/smartsheet/details/Fields.vue
+++ b/packages/nc-gui/components/smartsheet/details/Fields.vue
@@ -1860,16 +1860,12 @@ onBeforeRouteUpdate((_to, from, next) => {
"
/>
<NcCheckbox v-else :disabled="true" class="opacity-0" :checked="true" />
- <SmartsheetHeaderVirtualCellIcon
- v-if="field && isVirtualCol(fieldState(field) || field)"
- :column-meta="fieldState(field) || field"
- :color="compareCols(field, activeField) ? 'text-brand-500' : 'text-nc-content-gray-subtle2'"
- />
- <SmartsheetHeaderCellIcon
- v-else
- :column-meta="fieldState(field) || field"
+
+ <SmartsheetHeaderIcon
+ :column="fieldState(field) || field"
:color="compareCols(field, activeField) ? 'text-brand-500' : 'text-nc-content-gray-subtle2'"
/>
+
<NcTooltip
:class="{
'text-brand-500': compareCols(field, activeField),
@@ -2066,16 +2062,11 @@ onBeforeRouteUpdate((_to, from, next) => {
/>
<NcCheckbox :disabled="true" :checked="true" data-testid="nc-field-visibility-checkbox" />
- <SmartsheetHeaderVirtualCellIcon
- v-if="displayColumn && isVirtualCol(fieldState(displayColumn) || displayColumn)"
- :column-meta="fieldState(displayColumn) || displayColumn"
- :color="compareCols(displayColumn, activeField) ? 'text-brand-500' : 'text-nc-content-gray-subtle2'"
- />
- <SmartsheetHeaderCellIcon
- v-else-if="displayColumn"
- :column-meta="fieldState(displayColumn) || displayColumn"
+ <SmartsheetHeaderIcon
+ :column="fieldState(displayColumn) || displayColumn"
:color="compareCols(displayColumn, activeField) ? 'text-brand-500' : 'text-nc-content-gray-subtle2'"
/>
+
<NcTooltip
class="truncate flex-1"
:class="{
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/AuditMiniItem.vue b/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/AuditMiniItem.vue
index fbd8132144..a7a476488b 100644
--- a/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/AuditMiniItem.vue
+++ b/packages/nc-gui/components/smartsheet/expanded-form/Sidebar/AuditMiniItem.vue
@@ -149,13 +149,13 @@ const isAiGeneratedText = (key: string) => {
<template>
<div v-for="columnKey of columnKeys" :key="columnKey" class="py-2 px-3">
<div class="w-full flex items-center gap-1 !text-nc-content-gray-subtle2 text-xs font-weight-500 nc-audit-mini-item-header">
- <SmartsheetHeaderCellIcon
- :column-meta="{
+ <SmartsheetHeaderIcon
+ :column="{
uidt: meta[columnKey]?.type,
dt: meta[columnKey]?.type === 'Number' ? 'bigint' : undefined,
meta: normalizeMeta(columnKey),
}"
- class="!m-0"
+ class="!w-4 !h-4 !mx-0"
/>
<NcTooltip
class="truncate"
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/presentors/Discussion/AuditInfoExpressive.vue b/packages/nc-gui/components/smartsheet/expanded-form/presentors/Discussion/AuditInfoExpressive.vue
index 8c39121a8e..6e24911b95 100644
--- a/packages/nc-gui/components/smartsheet/expanded-form/presentors/Discussion/AuditInfoExpressive.vue
+++ b/packages/nc-gui/components/smartsheet/expanded-form/presentors/Discussion/AuditInfoExpressive.vue
@@ -145,13 +145,14 @@ const isAiGeneratedText = (key: string) => {
<span
class="rounded-md px-1 !h-[20px] inline-flex items-center gap-1 text-nc-content-gray-emphasis border-1 border-nc-border-gray-medium max-w-full"
>
- <SmartsheetHeaderCellIcon
- :column-meta="{
+ <SmartsheetHeaderIcon
+ :column="{
uidt: meta[columnKey]?.type,
dt: meta[columnKey]?.type === 'Number' ? 'bigint' : undefined,
meta: normalizeMeta(columnKey),
}"
- class="!w-[16px] !h-[16px] !m-0 !text-nc-content-gray-emphasis"
+ class="!w-4 !h-4 !mx-0"
+ color="text-nc-content-gray-emphasis"
/>
<NcTooltip class="truncate" show-on-truncate-only>
diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/components/ExpandedText.vue b/packages/nc-gui/components/smartsheet/grid/canvas/components/ExpandedText.vue
index 88f2ef8f21..464766ed59 100644
--- a/packages/nc-gui/components/smartsheet/grid/canvas/components/ExpandedText.vue
+++ b/packages/nc-gui/components/smartsheet/grid/canvas/components/ExpandedText.vue
@@ -210,7 +210,8 @@ const urls = replaceUrlsWithLink(result)
class="flex flex-row gap-x-1 items-center font-medium pl-3 pb-2.5 pt-3 border-b-1 border-gray-100 overflow-hidden cursor-move select-none"
@mousedown="dragStart"
>
- <SmartsheetHeaderCellIcon :column-meta="column" class="flex" />
+ <SmartsheetHeaderIcon :column="column" class="flex" />
+
<div class="flex max-w-38">
<span class="truncate">
{{ column.title }}
diff --git a/packages/nc-gui/components/smartsheet/header/AddLookupsOrRollups.vue b/packages/nc-gui/components/smartsheet/header/AddLookupsOrRollups.vue
index 84659e06c9..3032b1f141 100644
--- a/packages/nc-gui/components/smartsheet/header/AddLookupsOrRollups.vue
+++ b/packages/nc-gui/components/smartsheet/header/AddLookupsOrRollups.vue
@@ -4,7 +4,6 @@ import {
type TableType,
UITypes,
getAvailableRollupForColumn,
- isVirtualCol,
rollupAllFunctions,
} from 'nocodb-sdk'
import Draggable from 'vuedraggable'
@@ -51,11 +50,6 @@ const filteredColumns = ref<
const selectedFields = ref<Record<string, boolean>>({})
-const getIcon = (c: ColumnType) =>
- h(isVirtualCol(c) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), {
- columnMeta: c,
- })
-
const isLoadingModel = ref(false)
const fkRelatedModelId = computed(() => (column.value.colOptions as any)?.fk_related_model_id)
@@ -265,7 +259,7 @@ onMounted(async () => {
>
<component :is="iconMap.drag" class="cursor-move !h-3.75 text-gray-600 mr-1" />
<div class="flex flex-row items-center w-full cursor-pointer truncate ml-1 py-[5px] pr-2">
- <component :is="getIcon(field)" class="!w-3.5 !h-3.5" color="text-nc-content-gray-muted" />
+ <SmartsheetHeaderIcon :column="field" class="!w-3.5 !h-3.5" color="text-nc-content-gray-muted" />
<NcTooltip class="flex-1 pl-1 pr-2 truncate" show-on-truncate-only>
<template #title>
{{ field.title }}
diff --git a/packages/nc-gui/components/smartsheet/header/DeleteColumnModal.vue b/packages/nc-gui/components/smartsheet/header/DeleteColumnModal.vue
index 3f4180395d..31794a9de0 100644
--- a/packages/nc-gui/components/smartsheet/header/DeleteColumnModal.vue
+++ b/packages/nc-gui/components/smartsheet/header/DeleteColumnModal.vue
@@ -1,6 +1,6 @@
<script lang="ts" setup>
import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
-import { RelationTypes, isLinksOrLTAR, isVirtualCol } from 'nocodb-sdk'
+import { RelationTypes, isLinksOrLTAR } from 'nocodb-sdk'
const props = defineProps<{
visible: boolean
@@ -104,8 +104,8 @@ const onDelete = async () => {
<GeneralDeleteModal v-model:visible="visible" :entity-name="$t('objects.column')" :on-delete="onDelete">
<template #entity-preview>
<div v-if="column" class="flex flex-row items-center py-2 px-3 bg-gray-50 rounded-lg text-gray-700 mb-4">
- <SmartsheetHeaderVirtualCellIcon v-if="isVirtualCol(column)" class="nc-view-icon"></SmartsheetHeaderVirtualCellIcon>
- <SmartsheetHeaderCellIcon v-else class="nc-view-icon"></SmartsheetHeaderCellIcon>
+ <SmartsheetHeaderIcon :column="column" class="nc-view-icon" />
+
<div
class="capitalize text-ellipsis overflow-hidden select-none w-full pl-1.5"
:style="{ wordBreak: 'keep-all', whiteSpace: 'nowrap', display: 'inline' }"
diff --git a/packages/nc-gui/components/smartsheet/header/Icon.vue b/packages/nc-gui/components/smartsheet/header/Icon.vue
index 159ef471b0..a1b7d385b6 100644
--- a/packages/nc-gui/components/smartsheet/header/Icon.vue
+++ b/packages/nc-gui/components/smartsheet/header/Icon.vue
@@ -1,11 +1,25 @@
<script lang="ts" setup>
-import type { ColumnType } from 'nocodb-sdk'
+import type { ColumnType, UITypes } from 'nocodb-sdk'
import { isVirtualCol } from 'nocodb-sdk'
-const { column } = defineProps<{ column: ColumnType }>()
+const props = defineProps<{
+ column?: ColumnType
+ /**
+ * Windicss color class
+ */
+ color?: string
+ defaultUidt?: UITypes
+}>()
+
+const { column } = toRefs(props)
+
+const injectedColumn = inject(ColumnInj, column)
+
+const columnMeta = computed(() => column.value ?? injectedColumn.value)
</script>
<template>
- <SmartsheetHeaderVirtualCellIcon v-if="isVirtualCol(column)" :column-meta="column" />
- <SmartsheetHeaderCellIcon v-else :column-meta="column" />
+ <SmartsheetHeaderVirtualCellIcon v-if="columnMeta && isVirtualCol(columnMeta)" :column-meta="columnMeta" :color="color" />
+ <SmartsheetHeaderCellIcon v-else-if="columnMeta" :column-meta="columnMeta" :color="color" />
+ <component v-else-if="defaultUidt" :is="getUIDTIcon(defaultUidt)" class="flex-none h-4 w-4" :class="color" />
</template>
diff --git a/packages/nc-gui/components/smartsheet/header/UpdateDisplayValue.vue b/packages/nc-gui/components/smartsheet/header/UpdateDisplayValue.vue
index 78a09d8a53..fb9dda8ef2 100644
--- a/packages/nc-gui/components/smartsheet/header/UpdateDisplayValue.vue
+++ b/packages/nc-gui/components/smartsheet/header/UpdateDisplayValue.vue
@@ -90,11 +90,6 @@ const changeDisplayField = async () => {
}
}
-const cellIcon = (c: ColumnType) =>
- h(isVirtualCol(c) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), {
- columnMeta: c,
- })
-
onMounted(() => {
selectedFieldId.value = useMetaFields.value
? meta.value?.columns?.find((c) => c.id === column.value.id)?.id
@@ -130,7 +125,7 @@ onMounted(() => {
container-class-name="!max-h-[200px]"
>
<template #listItemExtraLeft="{ option }">
- <component :is="cellIcon(option.column)" class="!mx-0 opacity-70" />
+ <SmartsheetHeaderIcon :column="option.column" class="!mx-0 opacity-70" />
</template>
</NcList>
</div>
diff --git a/packages/nc-gui/components/smartsheet/toolbar/AddLookupsDropdown.vue b/packages/nc-gui/components/smartsheet/toolbar/AddLookupsDropdown.vue
index 1e5035c71f..7da3dea956 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/AddLookupsDropdown.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/AddLookupsDropdown.vue
@@ -1,5 +1,5 @@
<script setup lang="ts">
-import { type ColumnType, type TableType, UITypes, isVirtualCol } from 'nocodb-sdk'
+import { type ColumnType, type TableType, UITypes } from 'nocodb-sdk'
import { generateUniqueColumnName } from '~/helpers/parsers/parserHelpers'
interface Props {
@@ -42,11 +42,6 @@ const filteredColumns = ref<
const selectedFields = ref<Record<string, boolean>>({})
-const getIcon = (c: ColumnType) =>
- h(isVirtualCol(c) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), {
- columnMeta: c,
- })
-
const fkRelatedModelId = computed(() => (column.value.colOptions as any)?.fk_related_model_id)
const relatedModel = ref<TableType | null>()
@@ -216,7 +211,7 @@ watch(isOpened, async (val) => {
@click.stop="selectedFields[field.id] = !selectedFields[field.id]"
>
<div class="flex flex-row items-center w-full cursor-pointer truncate ml-1 py-[2px] pr-2">
- <component :is="getIcon(field)" class="!w-3.5 !h-3.5" color="text-nc-content-gray-muted" />
+ <SmartsheetHeaderIcon :column="field" class="!w-3.5 !h-3.5" color="text-nc-content-gray-muted" />
<NcTooltip class="flex-1 pl-1 pr-2 truncate" show-on-truncate-only>
<template #title>
{{ field.title }}
diff --git a/packages/nc-gui/components/smartsheet/toolbar/Calendar/Range.vue b/packages/nc-gui/components/smartsheet/toolbar/Calendar/Range.vue
index 325ea63510..7e80830a33 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/Calendar/Range.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/Calendar/Range.vue
@@ -51,6 +51,7 @@ const dateFieldOptions = computed<SelectProps['options']>(() => {
label: c.title,
value: c.id,
uidt: c.uidt,
+ col: c,
})) ?? []
).sort((a, b) => {
const priority = {
@@ -246,7 +247,7 @@ const onValueChange = async () => {
>
<div class="w-full flex gap-2 items-center justify-between" :title="option.label">
<div class="flex items-center gap-1 max-w-[calc(100%_-_20px)]">
- <SmartsheetHeaderIcon :column="option" />
+ <SmartsheetHeaderIcon :column="option.col" />
<NcTooltip class="flex-1 max-w-[calc(100%_-_20px)] truncate" show-on-truncate-only>
<template #title>
@@ -329,7 +330,7 @@ const onValueChange = async () => {
>
<div class="w-full flex gap-2 items-center justify-between" :title="option.label">
<div class="flex items-center gap-1 max-w-[calc(100%_-_20px)]">
- <SmartsheetHeaderIcon :column="option" />
+ <SmartsheetHeaderIcon :column="option.col" />
<NcTooltip class="flex-1 max-w-[calc(100%_-_20px)] truncate" show-on-truncate-only>
<template #title>
diff --git a/packages/nc-gui/components/smartsheet/toolbar/FieldListAutoCompleteDropdown.vue b/packages/nc-gui/components/smartsheet/toolbar/FieldListAutoCompleteDropdown.vue
index 85c691c453..f271b8b273 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/FieldListAutoCompleteDropdown.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/FieldListAutoCompleteDropdown.vue
@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { SelectProps } from 'ant-design-vue'
import type { ColumnType, LinkToAnotherRecordType, TableType } from 'nocodb-sdk'
-import { RelationTypes, UITypes, isHiddenCol, isLinksOrLTAR, isSystemColumn, isVirtualCol } from 'nocodb-sdk'
+import { RelationTypes, UITypes, isHiddenCol, isLinksOrLTAR, isSystemColumn } from 'nocodb-sdk'
const { modelValue, isSort, allowEmpty, disableSmartsheet, ...restProps } = defineProps<{
modelValue?: string
@@ -119,12 +119,9 @@ const options = computed<SelectProps['options']>(() =>
?.map((c: ColumnType) => ({
value: c.id,
label: fieldNameAlias.value[c.id!] || c.title,
- icon: h(
- isVirtualCol(c) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'),
- {
- columnMeta: c,
- },
- ),
+ icon: h(resolveComponent('SmartsheetHeaderIcon'), {
+ column: c,
+ }),
ncItemDisabled: c.ncItemDisabled,
ncItemTooltip: c.ncItemTooltip,
c,
diff --git a/packages/nc-gui/components/smartsheet/toolbar/FieldListWithSearch.vue b/packages/nc-gui/components/smartsheet/toolbar/FieldListWithSearch.vue
index e25955a7dc..48535a9f7e 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/FieldListWithSearch.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/FieldListWithSearch.vue
@@ -140,7 +140,7 @@ const fieldSearchBasisOptions = computed<NcListSearchBasisOptionType[]>(() => [
@change="handleSelect"
>
<template #listItemExtraLeft="{ option }">
- <SmartsheetHeaderIcon :column="option" class="!w-3.5 !h-3.5 !text-gray-500" />
+ <SmartsheetHeaderIcon :column="option" class="!w-3.5 !h-3.5" color="text-nc-content-gray-muted" />
</template>
</NcList>
</template>
diff --git a/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue b/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue
index 13800b40c3..61300f031d 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue
@@ -1,15 +1,6 @@
<script lang="ts" setup>
-import {
- type ColumnType,
- type GalleryType,
- type KanbanType,
- type LookupType,
- UITypes,
- ViewTypes,
- isLinksOrLTAR,
- isSystemColumn,
- isVirtualCol,
-} from 'nocodb-sdk'
+import type { ColumnType, GalleryType, KanbanType, LookupType } from 'nocodb-sdk'
+import { UITypes, ViewTypes, isLinksOrLTAR, isSystemColumn } from 'nocodb-sdk'
import Draggable from 'vuedraggable'
import type { SelectProps } from 'ant-design-vue'
@@ -365,11 +356,6 @@ const showAllColumns = computed({
},
})
-const getIcon = (c: ColumnType) =>
- h(isVirtualCol(c) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), {
- columnMeta: c,
- })
-
const open = ref(false)
const showSystemField = computed({
@@ -614,9 +600,9 @@ const onAddColumnDropdownVisibilityChange = () => {
'max-w-full': coverImageColumnId !== option.value,
}"
>
- <component
- :is="getIcon(metaColumnById[option.value])"
- v-if="option.value"
+ <SmartsheetHeaderIcon
+ v-if="option.value && metaColumnById[option.value]"
+ :column="metaColumnById[option.value]"
class="!w-3.5 !h-3.5 !ml-0"
color="text-nc-content-gray-subtle"
/>
@@ -770,8 +756,9 @@ const onAddColumnDropdownVisibilityChange = () => {
}"
@click="conditionalToggleFieldVisibility(field)"
>
- <component
- :is="getIcon(metaColumnById[field.fk_column_id])"
+ <SmartsheetHeaderIcon
+ v-if="field.fk_column_id && metaColumnById[field.fk_column_id]"
+ :column="metaColumnById[field.fk_column_id]"
class="!w-3.5 !h-3.5"
color="text-nc-content-gray-subtle2"
@click.stop
diff --git a/packages/nc-gui/components/smartsheet/toolbar/StackedBy.vue b/packages/nc-gui/components/smartsheet/toolbar/StackedBy.vue
index 2532beb76e..35f0256d7c 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/StackedBy.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/StackedBy.vue
@@ -1,6 +1,6 @@
<script setup lang="ts">
-import type { ColumnType, KanbanType } from 'nocodb-sdk'
-import { UITypes, isVirtualCol } from 'nocodb-sdk'
+import type { KanbanType } from 'nocodb-sdk'
+import { UITypes } from 'nocodb-sdk'
import type { SelectProps } from 'ant-design-vue'
provide(IsKanbanInj, ref(true))
@@ -117,11 +117,6 @@ const singleSelectFieldOptions = computed<SelectProps['options']>(() => {
const handleChange = () => {
open.value = false
}
-
-const getIcon = (c: ColumnType) =>
- h(isVirtualCol(c) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), {
- columnMeta: c,
- })
</script>
<template>
@@ -184,9 +179,9 @@ const getIcon = (c: ColumnType) =>
<a-select-option v-for="option of singleSelectFieldOptions" :key="option.value" :value="option.value">
<div class="w-full flex gap-2 items-center justify-between" :title="option.label">
<div class="flex items-center gap-1 max-w-[calc(100%_-_20px)]">
- <component
- :is="getIcon(metaColumnById[option.value])"
- v-if="option.value"
+ <SmartsheetHeaderIcon
+ v-if="option.value && metaColumnById[option.value]"
+ :column="metaColumnById[option.value]"
class="!w-3.5 !h-3.5 opacity-80 !ml-0"
color="text-current"
/>
diff --git a/packages/nc-gui/components/virtual-cell/QrCode.vue b/packages/nc-gui/components/virtual-cell/QrCode.vue
index 9b3e430846..7307248e4b 100644
--- a/packages/nc-gui/components/virtual-cell/QrCode.vue
+++ b/packages/nc-gui/components/virtual-cell/QrCode.vue
@@ -1,7 +1,6 @@
<script setup lang="ts">
import { useQRCode } from '@vueuse/integrations/useQRCode'
import type QRCode from 'qrcode'
-import { type ColumnType, isVirtualCol } from 'nocodb-sdk'
import { IsCanvasInjectionInj } from '../../context'
import { base64ToBlob, copyPNGToClipboard } from '~/utils/svgToPng'
@@ -72,10 +71,6 @@ const meta = inject(MetaInj)
const valueFieldId = computed(() => column?.value.colOptions?.fk_qr_value_column_id)
const { showClearNonEditableFieldWarning } = useShowNotEditableWarning({ onEnter: showQrModal })
-const cellIcon = (column: ColumnType) =>
- h(isVirtualCol(column) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), {
- columnMeta: column,
- })
const { isCopied, performCopy } = useIsCopied()
@@ -121,7 +116,12 @@ onMounted(() => {
<div class="flex gap-2 items-center w-full">
<h1 class="font-weight-700 m-0">{{ column?.title }}</h1>
<div class="h-5 px-1 bg-nc-bg-gray-medium text-nc-content-gray-subtle2 rounded-md justify-center items-center flex">
- <component :is="cellIcon(meta?.columnsById?.[valueFieldId])" class="h-4" />
+ <SmartsheetHeaderIcon
+ v-if="meta?.columnsById?.[valueFieldId]"
+ :column="meta?.columnsById?.[valueFieldId]"
+ class="h-4"
+ />
+
<div class="text-sm font-medium">{{ meta?.columnsById?.[valueFieldId]?.title }}</div>
</div>
<div class="flex-1"></div>
diff --git a/packages/nc-gui/components/virtual-cell/barcode/Barcode.vue b/packages/nc-gui/components/virtual-cell/barcode/Barcode.vue
index 7fad0509aa..24e28433ac 100644
--- a/packages/nc-gui/components/virtual-cell/barcode/Barcode.vue
+++ b/packages/nc-gui/components/virtual-cell/barcode/Barcode.vue
@@ -1,6 +1,5 @@
<script setup lang="ts">
import type { ComputedRef } from 'vue'
-import { type ColumnType, isVirtualCol } from 'nocodb-sdk'
import { IsCanvasInjectionInj } from '../../../context'
import JsBarcodeWrapper from './JsBarcodeWrapper.vue'
@@ -66,11 +65,6 @@ const height = computed(() => {
return `${rowHeight.value === 1 ? rowHeightInPx['1']! - 4 : rowHeightInPx[`${rowHeight.value}`]! - 20}px`
})
-const cellIcon = (column: ColumnType) =>
- h(isVirtualCol(column) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), {
- columnMeta: column,
- })
-
onMounted(() => {
if (isCanvasInjected && !isUnderLookup.value && !isExpandedFormOpen.value && !isLinkRecordDropdown.value) {
modalVisible.value = true
@@ -93,7 +87,12 @@ onMounted(() => {
<div class="flex gap-2 items-center w-full">
<h1 class="font-weight-700 m-0">{{ column?.title }}</h1>
<div class="h-5 px-1 bg-nc-bg-gray-medium text-nc-content-gray-subtle2 rounded-md justify-center items-center flex">
- <component :is="cellIcon(meta?.columnsById?.[valueFieldId])" class="h-4" />
+ <SmartsheetHeaderIcon
+ v-if="meta?.columnsById?.[valueFieldId]"
+ :column="meta?.columnsById?.[valueFieldId]"
+ class="h-4"
+ />
+
<div class="text-sm font-medium">{{ meta?.columnsById?.[valueFieldId]?.title }}</div>
</div>
<div class="flex-1"></div>
diff --git a/packages/nc-gui/components/webhook/TriggerByField.vue b/packages/nc-gui/components/webhook/TriggerByField.vue
index cd41cc4392..1c3ca7cd83 100644
--- a/packages/nc-gui/components/webhook/TriggerByField.vue
+++ b/packages/nc-gui/components/webhook/TriggerByField.vue
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { ColumnType } from 'nocodb-sdk'
-import { isVirtualCol } from 'nocodb-sdk'
+
interface Props {
columns: ColumnType[]
triggerField?: boolean
@@ -67,8 +67,7 @@ const removeColumnId = (colId: string) => {
<template #listItem="{ option }">
<div class="flex items-center w-full truncate gap-3 text-nc-content-gray-subtle hover:text-black transition-colors">
- <SmartsheetHeaderVirtualCellIcon v-if="isVirtualCol(option)" :column-meta="option" />
- <SmartsheetHeaderCellIcon v-else :column-meta="option" />
+ <SmartsheetHeaderIcon :column="option" />
<NcTooltip class="flex-1 truncate" show-on-truncate-only>
<template #title>
@@ -93,8 +92,8 @@ const removeColumnId = (colId: string) => {
:key="col.id"
class="bg-nc-bg-gray-medium text-nc-content-gray-subtle2 px-1 py-0.5 rounded-md flex gap-1 items-center"
>
- <SmartsheetHeaderVirtualCellIcon v-if="isVirtualCol(col)" :column-meta="col" />
- <SmartsheetHeaderCellIcon v-else :column-meta="col" />
+ <SmartsheetHeaderIcon :column="col" />
+
<div class="text-[13px] font-default leading-4.5">
{{ col.title }}
</div>