import React from "react"; import { Box, Typography, Chip, Avatar } from "@mui/material"; import type { FieldConfig } from "../../types"; import { applyDisplayFormat } from "./utils"; import { InlineRefField } from "./renderers/InlineRefField"; interface ListCellProps { field: FieldConfig; value: any; displayFormat?: string; } export function ListCellRenderer({ field, value, displayFormat }: ListCellProps) { if (value === null || value === undefined) { return ; } if (field.refSchema && !field.fk && !field.isArray && typeof value === "object") { return ; } if (field.isArray && Array.isArray(value) && field.refSchema && !field.fk) { if (value.length === 0) { return ; } return ( {value.map((item: any, i: number) => { const label = typeof item === "object" ? applyDisplayFormat(item, displayFormat ?? "") : String(item); return ; })} ); } if (field.fk && typeof value === "object" && !field.isArray) { return {applyDisplayFormat(value, displayFormat ?? "")}; } if (field.isArray && Array.isArray(value) && field.fk) { return ( {value.map((item: any, i: number) => { const label = typeof item === "object" ? applyDisplayFormat(item, displayFormat ?? "") : String(item); return ; })} ); } if (field.enumValues) { return ; } if (field.uiType === "image" && value) { return ; } if (field.type === "boolean") { return ; } return {String(value)}; }