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:
parent
b955f42b88
commit
c10daf008e
@ -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} />
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user