Enhance ObjectProperty component with readOnly handling and reference case support

- Added functionality to process readOnly as a function for dynamic object data handling.
- Updated rendering logic to include a new 'reference' case, allowing for the display of ID references with appropriate components.
- Improved ObjectDisplay rendering by passing showHyperlink prop for enhanced interactivity.
This commit is contained in:
Tom Butcher 2025-12-07 02:42:02 +00:00
parent b955f42b88
commit c10daf008e

View File

@ -131,6 +131,10 @@ const ObjectProperty = ({
options = options(objectData)
}
if (readOnly && typeof readOnly == 'function' && objectData) {
readOnly = readOnly(objectData)
}
if (!value) {
value = getPropertyValue(objectData, name)
}
@ -364,7 +368,13 @@ const ObjectProperty = ({
}
case 'object': {
if (value && value._id) {
return <ObjectDisplay object={value} objectType={objectType} />
return (
<ObjectDisplay
object={value}
objectType={objectType}
showHyperlink={showHyperlink}
/>
)
} else {
return (
<Text type='secondary' {...textParams}>
@ -439,6 +449,24 @@ const ObjectProperty = ({
)
}
}
case 'reference': {
if (value) {
return (
<IdDisplay
id={value}
reference={value}
type={objectType}
{...rest}
/>
)
} else {
return (
<Text type='secondary' {...textParams}>
n/a
</Text>
)
}
}
case 'miscId': {
return <MiscId value={value} {...rest} />
}