π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix(nc-gui): use NcIconField everywhere
Ramesh Mane04044bc3737c
diff --git a/packages/nc-gui/components/ai/Erd/TableNode.vue b/packages/nc-gui/components/ai/Erd/TableNode.vueindex 32bfeffadf..37067efea0 100644--- a/packages/nc-gui/components/ai/Erd/TableNode.vue+++ b/packages/nc-gui/components/ai/Erd/TableNode.vue@@ -130,8 +130,8 @@ watch(class="nc-erd-table-node-column flex items-center gap-2":class="`nc-erd-table-node-${data.table}-column-${col.title}`">- <SmartsheetHeaderCellIcon- :column-meta="{+ <NcIconField+ :field="{uidt: col.type,}"/>diff --git a/packages/nc-gui/components/smartsheet/Form.vue b/packages/nc-gui/components/smartsheet/Form.vueindex 4935ee8559..3819037561 100644--- a/packages/nc-gui/components/smartsheet/Form.vue+++ b/packages/nc-gui/components/smartsheet/Form.vue@@ -1555,12 +1555,7 @@ const { message: templatedMessage } = useTemplatedMessage(<div class="px-1.75 text-gray-500 text-xl font-normal">/</div><div class="flex items-center pr-1 py-1.5 text-gray-800">- <SmartsheetHeaderVirtualCellIcon- v-if="isVirtualCol(activeField)"- :column-meta="activeField"- class="flex-none"- />- <SmartsheetHeaderCellIcon v-else :column-meta="activeField" class="flex-none" />+ <NcIconField :field="activeField" /><NcTooltip class="truncate max-w-[120px] text-sm font-semibold" show-on-truncate-only><template #title>@@ -1778,12 +1773,8 @@ const { message: templatedMessage } = useTemplatedMessage(class="flex-1 flex items-center cursor-pointer max-w-[calc(100%_-_40px)]"@click.prevent="onFormItemClick(field, true)">- <SmartsheetHeaderVirtualCellIcon- v-if="field && isVirtualCol(field)"- :column-meta="field"- color="text-nc-content-gray-subtle"- />- <SmartsheetHeaderCellIcon v-else :column-meta="field" color="text-nc-content-gray-subtle" />+ <NcIconField :field="field" color="text-nc-content-gray-subtle" />+<div class="flex-1 flex items-center justify-start max-w-[calc(100%_-_28px)]"><div class="w-full flex items-center"><div class="ml-1 inline-flex" :class="field.label?.trim() ? 'max-w-1/2' : 'max-w-[95%]'">diff --git a/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue b/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vueindex 1140c88acb..773524be06 100644--- a/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue+++ b/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue@@ -1077,7 +1077,8 @@ const expandRecord = (record: Row) => {"><div class="flex items-center gap-1">- <LazySmartsheetHeaderCellIcon :column-meta="range.fk_from_col" />+ <LazyNcIconField :field="range.fk_from_col" />+<span class="ml-1">{{ range.fk_from_col!.title! }}</span></div></NcMenuItem>diff --git a/packages/nc-gui/components/smartsheet/calendar/MonthView.vue b/packages/nc-gui/components/smartsheet/calendar/MonthView.vueindex 741b28b74d..c1874c236e 100644--- a/packages/nc-gui/components/smartsheet/calendar/MonthView.vue+++ b/packages/nc-gui/components/smartsheet/calendar/MonthView.vue@@ -841,7 +841,8 @@ const addRecord = (date: dayjs.Dayjs) => {"><div class="flex items-center gap-1">- <LazySmartsheetHeaderCellIcon :column-meta="range.fk_from_col" />+ <LazyNcIconField :field="range.fk_from_col" />+<span class="ml-1">{{ range.fk_from_col!.title }}</span></div></NcMenuItem>diff --git a/packages/nc-gui/components/smartsheet/column/AiButtonOptions.vue b/packages/nc-gui/components/smartsheet/column/AiButtonOptions.vueindex b3867e3b92..899bdb4a87 100644--- a/packages/nc-gui/components/smartsheet/column/AiButtonOptions.vue+++ b/packages/nc-gui/components/smartsheet/column/AiButtonOptions.vue@@ -171,11 +171,6 @@ const removeFromOutputFieldOptions = (id: string) => {outputColumnIds.value = outputColumnIds.value.filter((op) => op !== id)}-const cellIcon = (column: ColumnType) =>- h(isVirtualCol(column) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), {- columnMeta: column,- })-const generate = async () => {if (!selectedRecordPk.value || !outputColumnIds.value.length) return@@ -458,7 +453,8 @@ onBeforeUnmount(() => {<NcCheckbox :checked="isSelected" /><div class="inline-flex items-center gap-2 flex-1 truncate">- <component :is="cellIcon(option)" class="!mx-0" color="text-nc-content-gray-subtle2" />+ <NcIconField :field="option as ColumnType" class="!mx-0" color="text-nc-content-gray-subtle" />+<NcTooltip class="truncate flex-1" show-on-truncate-only><template #title>{{ option?.title }}@@ -481,7 +477,8 @@ onBeforeUnmount(() => {<template v-for="op in outputFieldOptions"><a-tag v-if="outputColumnIds.includes(op.id)" :key="op.id" class="nc-ai-button-output-field"><div class="flex flex-row items-center gap-1 py-[2px] text-sm">- <component :is="cellIcon(op)" class="!mx-0 !mr-1 opacity-80" />+ <NcIconField :field="op" class="!mx-0 !mr-1 opacity-80" />+<NcTooltip show-on-truncate-only class="truncate max-w-[150px]"><template #title>{{ op.title }}</template>{{ op.title }}@@ -652,7 +649,8 @@ onBeforeUnmount(() => {class="!my-0 nc-input-required-error"><div class="flex items-center gap-2 text-nc-content-gray-subtle2 mb-2">- <component :is="cellIcon(field)" class="!mx-0" />+ <NcIconField :field="field" class="!mx-0" />+<NcTooltip class="truncate flex-1" show-on-truncate-only><template #title>{{ field?.title }}@@ -822,7 +820,8 @@ onBeforeUnmount(() => {class="!my-0 nc-input-required-error"><div class="flex items-center gap-2 text-nc-content-gray-subtle2 mb-2">- <component :is="cellIcon(field)" class="!mx-0" />+ <NcIconField :field="field" class="!mx-0" />+<NcTooltip class="truncate flex-1" show-on-truncate-only><template #title>{{ field?.title }}diff --git a/packages/nc-gui/components/smartsheet/column/BarcodeOptions.vue b/packages/nc-gui/components/smartsheet/column/BarcodeOptions.vueindex 11b5a6824b..44a1b2990f 100644--- a/packages/nc-gui/components/smartsheet/column/BarcodeOptions.vue+++ b/packages/nc-gui/components/smartsheet/column/BarcodeOptions.vue@@ -1,6 +1,6 @@<script setup lang="ts">import { ColumnHelper, type ColumnType, UITypes } from 'nocodb-sdk'-import { AllowedColumnTypesForQrAndBarcodes, isVirtualCol } from 'nocodb-sdk'+import { AllowedColumnTypesForQrAndBarcodes } from 'nocodb-sdk'import { supportedBarcodeFormats } from '~/helpers/columnDefaultMeta'const props = defineProps<{@@ -59,11 +59,6 @@ setAvoidShowingToastMsgForValidations({})const showBarcodeValueColumnInfoIcon = computed(() => !columnsAllowedAsBarcodeValue.value?.length)--const cellIcon = (column: ColumnType) =>- h(isVirtualCol(column) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), {- columnMeta: column,- })</script><template>@@ -85,7 +80,8 @@ const cellIcon = (column: ColumnType) =><a-select-option v-for="(option, index) of columnsAllowedAsBarcodeValue" :key="index" :value="option.id"><div class="w-full flex gap-2 truncate items-center justify-between" :data-testid="`nc-barcode-${option.title}`"><div class="inline-flex items-center gap-2 flex-1 truncate">- <component :is="cellIcon(option)" :column-meta="option" class="!mx-0" color="text-nc-content-gray-subtle2" />+ <NcIconField :field="option" class="!mx-0" color="text-nc-content-gray-subtle2" />+<div class="truncate flex-1">{{ option.title }}</div></div>diff --git a/packages/nc-gui/components/smartsheet/column/FormulaInputHelper.vue b/packages/nc-gui/components/smartsheet/column/FormulaInputHelper.vueindex 7cc0486a6d..4fceded697 100644--- a/packages/nc-gui/components/smartsheet/column/FormulaInputHelper.vue+++ b/packages/nc-gui/components/smartsheet/column/FormulaInputHelper.vue@@ -1,5 +1,5 @@<script setup lang="ts">-import { UITypes, isHiddenCol, isVirtualCol, jsepCurlyHook, type ColumnType } from 'nocodb-sdk'+import { UITypes, isHiddenCol, jsepCurlyHook, type ColumnType } from 'nocodb-sdk'import type { Ref } from 'vue'import type { ListItem as AntListItem } from 'ant-design-vue/lib/list'import {@@ -89,8 +89,8 @@ const sortOrder: Record<string, number> = {}const getIcon = (c: ColumnType) =>- h(isVirtualCol(c) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), {- columnMeta: c,+ h(resolveComponent('NcIconField'), {+ field: c,})const suggestionsList = computed(() => {diff --git a/packages/nc-gui/components/smartsheet/column/FormulaOptions.vue b/packages/nc-gui/components/smartsheet/column/FormulaOptions.vueindex 3675c5d6ea..8110eeea8b 100644--- a/packages/nc-gui/components/smartsheet/column/FormulaOptions.vue+++ b/packages/nc-gui/components/smartsheet/column/FormulaOptions.vue@@ -6,7 +6,6 @@ import {UITypes,getUITypesForFormulaDataType,isHiddenCol,- isVirtualCol,substituteColumnIdWithAliasInFormula,validateFormulaAndExtractTreeWithType,} from 'nocodb-sdk'@@ -195,14 +194,11 @@ const supportedFormulaAlias = computed(() => {return {value: uidt,label: t(`datatype.${uidt}`),- icon: h(- isVirtualCol(uidt) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'),- {- columnMeta: {- uidt,- },+ icon: h(resolveComponent('NcIconField'), {+ field: {+ uidt,},- ),+ }),}})} catch (e) {diff --git a/packages/nc-gui/components/smartsheet/column/LookupOptions.vue b/packages/nc-gui/components/smartsheet/column/LookupOptions.vueindex 5ff2fbd76b..505338a42a 100644--- a/packages/nc-gui/components/smartsheet/column/LookupOptions.vue+++ b/packages/nc-gui/components/smartsheet/column/LookupOptions.vue@@ -1,7 +1,7 @@<script setup lang="ts">import { onMounted } from '@vue/runtime-core'import type { ColumnType, LinkToAnotherRecordType, LookupType, TableType } from 'nocodb-sdk'-import { PlanFeatureTypes, PlanTitles, RelationTypes, UITypes, isLinksOrLTAR, isVirtualCol } from 'nocodb-sdk'+import { PlanFeatureTypes, PlanTitles, RelationTypes, UITypes, isLinksOrLTAR } from 'nocodb-sdk'const props = defineProps<{value: any@@ -177,11 +177,6 @@ watchEffect(() => {}})-const cellIcon = (column: ColumnType) =>- h(isVirtualCol(column) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), {- columnMeta: column,- })-watch(() => vModel.value.fk_relation_column_id,(newValue) => {@@ -243,12 +238,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"- />+ <NcIconField :field="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>@@ -295,7 +285,8 @@ const handleScrollIntoView = () => {<a-select-option v-for="column of columns" :key="column.title" :value="column.id"><div class="w-full flex gap-2 truncate items-center justify-between"><div class="inline-flex items-center gap-2 flex-1 truncate">- <component :is="cellIcon(column)" :column-meta="column" class="!mx-0" />+ <NcIconField :field="column" class="!mx-0" />+<div class="truncate flex-1">{{ column.title }}</div></div>diff --git a/packages/nc-gui/components/smartsheet/column/QrCodeOptions.vue b/packages/nc-gui/components/smartsheet/column/QrCodeOptions.vueindex 36a5bab94a..abfd60151b 100644--- a/packages/nc-gui/components/smartsheet/column/QrCodeOptions.vue+++ b/packages/nc-gui/components/smartsheet/column/QrCodeOptions.vue@@ -1,6 +1,6 @@<script setup lang="ts">import type { ColumnType, UITypes } from 'nocodb-sdk'-import { AllowedColumnTypesForQrAndBarcodes, isVirtualCol } from 'nocodb-sdk'+import { AllowedColumnTypesForQrAndBarcodes } from 'nocodb-sdk'const props = defineProps<{modelValue: any@@ -44,11 +44,6 @@ setAdditionalValidations({setAvoidShowingToastMsgForValidations({fk_qr_value_column_id: true,})--const cellIcon = (column: ColumnType) =>- h(isVirtualCol(column) ? resolveComponent('SmartsheetHeaderVirtualCellIcon') : resolveComponent('SmartsheetHeaderCellIcon'), {- columnMeta: column,- })</script><template>@@ -70,12 +65,8 @@ const cellIcon = (column: ColumnType) =><a-select-option v-for="(option, index) of columnsAllowedAsQrValue" :key="index" :value="option.id"><div class="flex gap-2 w-full truncate items-center" :data-testid="`nc-qr-${option.title}`"><div class="inline-flex items-center gap-2 flex-1 truncate">- <component- :is="cellIcon(option)"- :column-meta="option"- class="!mx-0 flex-none w-4 h-4"- color="text-nc-content-gray-subtle2"- />+ <NcIconField :field="option" class="!mx-0 w-4 h-4" color="text-nc-content-gray-subtle2" />+<NcTooltip show-on-truncate-only class="flex-1 truncate"><template #title>{{ option.title }}</template>{{ option.title }}diff --git a/packages/nc-gui/components/smartsheet/header/CellIcon.ts b/packages/nc-gui/components/smartsheet/header/CellIcon.tsindex 7bf655d13b..a70d3a9dca 100644--- a/packages/nc-gui/components/smartsheet/header/CellIcon.ts+++ b/packages/nc-gui/components/smartsheet/header/CellIcon.ts@@ -97,7 +97,7 @@ export default defineComponent({if (!column.value && !columnMeta.value) return nullreturn h(renderIcon((columnMeta.value ?? column.value)!, abstractType.value), {- class: `${defaultColor.value || 'text-inherit'} mx-1 nc-cell-icon`,+ class: `${defaultColor.value || 'text-inherit'} mx-1 flex-none nc-cell-icon`,})}},diff --git a/packages/nc-gui/components/smartsheet/header/VirtualCellIcon.ts b/packages/nc-gui/components/smartsheet/header/VirtualCellIcon.tsindex beafdb2209..5aaa5f7f3b 100644--- a/packages/nc-gui/components/smartsheet/header/VirtualCellIcon.ts+++ b/packages/nc-gui/components/smartsheet/header/VirtualCellIcon.ts@@ -111,7 +111,7 @@ export default defineComponent({const { icon: Icon, color } = renderIcon(column.value, relationColumn)- return h(Icon, { class: `${color || defaultColor.value || 'text-inherit'} mx-1 nc-virtual-cell-icon` })+ return h(Icon, { class: `${color || defaultColor.value || 'text-inherit'} mx-1 flex-none nc-virtual-cell-icon` })}},})