mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 09:47:10 +00:00
fix: association field should support json field as title field (#3129)
This commit is contained in:
parent
c1c91095b8
commit
bdf49cd38a
@ -24,6 +24,9 @@ const toValue = (value, placeholder) => {
|
||||
}
|
||||
return value;
|
||||
};
|
||||
function isObject(value) {
|
||||
return typeof value === 'object' && value !== null;
|
||||
}
|
||||
export const ReadPrettyInternalViewer: React.FC = observer(
|
||||
(props: any) => {
|
||||
const fieldSchema = useFieldSchema();
|
||||
@ -45,11 +48,14 @@ export const ReadPrettyInternalViewer: React.FC = observer(
|
||||
const ellipsisWithTooltipRef = useRef<IEllipsisWithTooltipRef>();
|
||||
const renderRecords = () =>
|
||||
toArr(props.value).map((record, index, arr) => {
|
||||
const value = record?.[fieldNames?.label || 'label'];
|
||||
const label = isTreeCollection
|
||||
? transformNestedData(record)
|
||||
.map((o) => o?.[fieldNames?.label || 'label'])
|
||||
.join(' / ')
|
||||
: record?.[fieldNames?.label || 'label'];
|
||||
: isObject(value)
|
||||
? JSON.stringify(value)
|
||||
: value;
|
||||
const val = toValue(compile(label), 'N/A');
|
||||
const labelUiSchema = useLabelUiSchema(
|
||||
record?.__collection || collectionField?.target,
|
||||
|
Loading…
Reference in New Issue
Block a user