diff --git a/packages/nc-gui/components/nc/List/index.vue b/packages/nc-gui/components/nc/List/index.vue
index 311780889d..64f6cc6f0e 100644
--- a/packages/nc-gui/components/nc/List/index.vue
+++ b/packages/nc-gui/components/nc/List/index.vue
@@ -1,5 +1,6 @@
@@ -79,39 +89,23 @@ onMounted(() => {
-
-
-
@@ -120,7 +114,7 @@ onMounted(() => {
{
+ if (!column) return '';
+
+ switch (column.uidt) {
+ case UITypes.LongText: {
+ if (ncParseProp(column.meta)?.richMode) {
+ return UITypesName.RichText;
+ }
+
+ if (ncParseProp(column.meta)[LongTextAiMetaProp]) {
+ return UITypesName.AIPrompt;
+ }
+
+ return UITypesName[column.uidt];
+ }
+ case UITypes.Button: {
+ if (
+ column.uidt === UITypes.Button &&
+ (column?.colOptions as any)?.type === 'ai'
+ ) {
+ return UITypesName.AIButton;
+ }
+
+ return UITypesName[column.uidt];
+ }
+ default: {
+ return column.uidt ? UITypesName[column.uidt] : '';
+ }
+ }
+};
+
export const FieldNameFromUITypes: Record = {
[UITypes.ID]: 'ID',
[UITypes.LinkToAnotherRecord]: '{TableName}',
@@ -188,12 +219,11 @@ export function isVirtualCol(
].includes((typeof col === 'object' ? col?.uidt : col));
}
-export function isAIPromptCol(
- col:
- | ColumnReqType
- | ColumnType
-) {
- return col.uidt === UITypes.LongText && parseHelper((col as any)?.meta)?.[LongTextAiMetaProp];
+export function isAIPromptCol(col: ColumnReqType | ColumnType) {
+ return (
+ col.uidt === UITypes.LongText &&
+ parseHelper((col as any)?.meta)?.[LongTextAiMetaProp]
+ );
}
export function isCreatedOrLastModifiedTimeCol(
@@ -331,3 +361,39 @@ export const getUITypesForFormulaDataType = (
return [];
}
};
+
+export const isSupportedDisplayValueColumn = (column: Partial) => {
+ if (!column?.uidt) return false;
+
+ switch (column.uidt) {
+ case UITypes.SingleLineText:
+ case UITypes.Date:
+ case UITypes.DateTime:
+ case UITypes.Time:
+ case UITypes.Year:
+ case UITypes.PhoneNumber:
+ case UITypes.Email:
+ case UITypes.URL:
+ case UITypes.Number:
+ case UITypes.Currency:
+ case UITypes.Percent:
+ case UITypes.Duration:
+ case UITypes.Decimal:
+ case UITypes.Formula: {
+ return true;
+ }
+ case UITypes.LongText: {
+ if (
+ ncParseProp(column.meta)?.richMode ||
+ ncParseProp(column.meta)[LongTextAiMetaProp]
+ ) {
+ return false;
+ }
+ return true;
+ }
+
+ default: {
+ return false;
+ }
+ }
+};
diff --git a/packages/nocodb-sdk/src/lib/helperFunctions.ts b/packages/nocodb-sdk/src/lib/helperFunctions.ts
index cb70719c21..32567926ff 100644
--- a/packages/nocodb-sdk/src/lib/helperFunctions.ts
+++ b/packages/nocodb-sdk/src/lib/helperFunctions.ts
@@ -228,6 +228,24 @@ export const integrationCategoryNeedDefault = (category: IntegrationsType) => {
return [IntegrationsType.Ai].includes(category);
};
+export function ncParseProp(v: any): any {
+ if (!v) return {};
+ try {
+ return typeof v === 'string' ? JSON.parse(v) ?? {} : v;
+ } catch {
+ return {};
+ }
+}
+
+export function ncStringifyProp(v: any): string {
+ if (!v) return '{}';
+ try {
+ return typeof v === 'string' ? v : JSON.stringify(v) ?? '{}';
+ } catch {
+ return '{}';
+ }
+}
+
export function parseHelper(v: any): any {
try {
return typeof v === 'string' ? JSON.parse(v) : v;
@@ -238,7 +256,7 @@ export function parseHelper(v: any): any {
export function stringifyHelper(v: any): string {
try {
- return JSON.stringify(v);
+ return typeof v === 'string' ? v : JSON.stringify(v);
} catch {
return v;
}
diff --git a/packages/nocodb-sdk/src/lib/index.ts b/packages/nocodb-sdk/src/lib/index.ts
index 9f66861cd7..cc639aaf08 100644
--- a/packages/nocodb-sdk/src/lib/index.ts
+++ b/packages/nocodb-sdk/src/lib/index.ts
@@ -24,6 +24,8 @@ export {
getUITypesForFormulaDataType,
readonlyMetaAllowedTypes,
partialUpdateAllowedTypes,
+ isSupportedDisplayValueColumn,
+ columnTypeName,
} from '~/lib/UITypes';
export { default as CustomAPI, FileType } from '~/lib/CustomAPI';
export { default as TemplateGenerator } from '~/lib/TemplateGenerator';