From a227c14e0a4391e71ef9014134145474e61637cd Mon Sep 17 00:00:00 2001 From: Vishesh 'ironeagle' Bangotra Date: Mon, 8 Jun 2026 01:03:00 +0530 Subject: [PATCH] removed displayField --- react-openapi/components/EnhancedTable.tsx | 21 ++++++--------------- react-openapi/utils/options.ts | 2 +- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/react-openapi/components/EnhancedTable.tsx b/react-openapi/components/EnhancedTable.tsx index 9999b45..3550257 100644 --- a/react-openapi/components/EnhancedTable.tsx +++ b/react-openapi/components/EnhancedTable.tsx @@ -278,19 +278,10 @@ function MobileCardRow({ row, config, onDelete, onNavigate, navigate, components ); } -function getFormattedDisplayValue(item: any, displayFormat?: string | string[], enumValue?: string) { +function getFormattedDisplayValue(item: any, displayFormat: string) { if (!item) return ""; - if (enumValue) return resolveTemplate(enumValue, item); - if (!displayFormat) return item.name || item.title || item.label || item.id || JSON.stringify(item); - if (Array.isArray(displayFormat)) { -return displayFormat - .map(key => item[key]) - .filter(val => val !== undefined && val !== null) - .join(' '); - } - - return item[displayFormat] || item.id || JSON.stringify(item); + return resolveTemplate(displayFormat, item); } function FieldRenderer({ params, field, fieldKey, config, onNavigate, navigate, isMobile, components }: any) { @@ -307,7 +298,7 @@ function FieldRenderer({ params, field, fieldKey, config, onNavigate, navigate, // 1. Single Relation if (field.relation && value && !Array.isArray(value)) { const relationId = typeof value === 'object' ? (value.id || value._id || value.pk) : value; - const displayValue = getFormattedDisplayValue(value, field.displayFormat, field.enumOption?.value); + const displayValue = getFormattedDisplayValue(value, field.displayFormat); return ( getFormattedDisplayValue(item, field.displayFormat, enumValue)).join(', '); + const tooltipTitle = value.map((item) => getFormattedDisplayValue(item, field.displayFormat)).join(', '); return ( @@ -335,7 +326,7 @@ function FieldRenderer({ params, field, fieldKey, config, onNavigate, navigate, {value.map((item, idx) => ( ({ - key: String(item[enumOption.key] ?? ''), + key: String(item[enumOption.key]), value: resolveTemplate(enumOption.value, item), })); }