tooltip
This commit is contained in:
@@ -245,10 +245,22 @@ function FieldRenderer({ params, field, fieldKey, config, onNavigate, navigate,
|
||||
}
|
||||
|
||||
if (field.type === 'array' && Array.isArray(value)) {
|
||||
if (field.displayField) {
|
||||
return value.map((item) => (typeof item === 'object' ? item[field.displayField!] : item)).filter(Boolean).join(', ');
|
||||
}
|
||||
return `${value.length} items`;
|
||||
const displayList = field.displayField ?
|
||||
value.map((item) => (typeof item === 'object' ? item[field.displayField!] : item)).filter(Boolean).join(', ') :
|
||||
`${value.length} items`;
|
||||
|
||||
const tooltipTitle = value.map((item) => {
|
||||
if (typeof item !== 'object') return String(item);
|
||||
return item.name || item.title || item.label || item[field.displayField!] || JSON.stringify(item);
|
||||
}).join(', ');
|
||||
|
||||
return (
|
||||
<Tooltip title={tooltipTitle} arrow placement="top">
|
||||
<Box component="span" sx={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', display: 'block' }}>
|
||||
{displayList}
|
||||
</Box>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
if (field.type === 'object' && value) {
|
||||
|
||||
Reference in New Issue
Block a user