, refSchema, displayField) ||
+ String((item as any).id || (item as any)._id || '[Object]'),
+ muted: false,
+ };
+ }
+ const r = resolveLabel(item);
+ return { label: r.text, muted: r.muted };
+ };
+
+ // Cap the chips the same way UserCellRenderer caps its avatars: a
+ // multi-value lookup can reference dozens of records (a 60-reference cell
+ // has been seen in the wild), and one chip per reference lets a single
+ // cell stretch its row to several screens. The hidden names stay
+ // reachable — the overflow chip's `title` lists them, and the record
+ // itself shows the full set.
+ const visible = value.slice(0, MAX_LOOKUP_CELL_CHIPS);
+ const overflow = value.slice(MAX_LOOKUP_CELL_CHIPS);
return (
- {value.map((item, idx) => {
- let label: string;
- let muted = false;
- if (item != null && typeof item === 'object') {
- label = resolveLookupRecordName(item as Record, refSchema, displayField) || String((item as any).id || (item as any)._id || '[Object]');
- } else {
- const r = resolveLabel(item);
- label = r.text;
- muted = r.muted;
- }
+ {visible.map((item, idx) => {
+ const { label, muted } = itemDisplay(item);
// Each chip is one referenced record, so each links on its own —
// there is no single destination a multi-value cell could point at.
return (
@@ -2067,6 +2089,14 @@ export function LookupCellRenderer({ value, field }: CellRendererProps): React.R
);
})}
+ {overflow.length > 0 && (
+ itemDisplay(item).label).join(', ')}
+ >
+ +{overflow.length}
+
+ )}
);
}