diff --git a/src/components/Dashboard/common/ObjectInfo.jsx b/src/components/Dashboard/common/ObjectInfo.jsx index 4ec1d97..2699bb8 100644 --- a/src/components/Dashboard/common/ObjectInfo.jsx +++ b/src/components/Dashboard/common/ObjectInfo.jsx @@ -13,7 +13,10 @@ const ObjectInfo = ({ showHyperlink, showLabels = true, objectData = null, + parentData = null, properties = [], + propertyDefinitions = null, + onPropertyChange = null, required = undefined, visibleProperties = {}, objectPropertyProps = {}, @@ -39,7 +42,9 @@ const ObjectInfo = ({ // If properties array is empty, show all properties // Otherwise, filter and order by the properties array let items - if (properties.length === 0) { + if (Array.isArray(propertyDefinitions) && propertyDefinitions.length > 0) { + items = propertyDefinitions + } else if (properties.length === 0) { items = allItems } else { items = properties @@ -80,6 +85,8 @@ const ObjectInfo = ({ } }) + const isControlled = typeof onPropertyChange === 'function' + // Map items to Descriptions 'items' prop format const descriptionItems = items.map((item, idx) => { const key = item.name || item.label || idx @@ -98,7 +105,17 @@ const ObjectInfo = ({ {...objectPropertyProps} isEditing={isEditing} objectData={combinedObjectData} + parentData={parentData} showSince={true} + useFormItem={isControlled ? false : objectPropertyProps.useFormItem} + value={ + isControlled ? combinedObjectData?.[item.name] : undefined + } + onChange={ + isControlled + ? (newVal) => onPropertyChange(item.name, newVal) + : objectPropertyProps.onChange + } /> ), @@ -130,8 +147,11 @@ ObjectInfo.propTypes = { bordered: PropTypes.bool, items: PropTypes.arrayOf(PropTypes.object), isEditing: PropTypes.bool, - type: PropTypes.string.isRequired, + type: PropTypes.string, objectData: PropTypes.object, + parentData: PropTypes.object, + propertyDefinitions: PropTypes.array, + onPropertyChange: PropTypes.func, required: PropTypes.bool, visibleProperties: PropTypes.object, objectPropertyProps: PropTypes.object,