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.type === 'array' && Array.isArray(value)) {
|
||||||
if (field.displayField) {
|
const displayList = field.displayField ?
|
||||||
return value.map((item) => (typeof item === 'object' ? item[field.displayField!] : item)).filter(Boolean).join(', ');
|
value.map((item) => (typeof item === 'object' ? item[field.displayField!] : item)).filter(Boolean).join(', ') :
|
||||||
}
|
`${value.length} items`;
|
||||||
return `${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) {
|
if (field.type === 'object' && value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user