Enhance ObjectProperty and ObjectChildTable components by introducing parentData prop for improved data handling in nested structures. Update related functions to utilize parentData for better context in calculations and rendering.

This commit is contained in:
Tom Butcher 2026-07-04 20:20:17 +01:00
parent bdb2327aac
commit 092b9ff4e4
2 changed files with 15 additions and 12 deletions

View File

@ -186,6 +186,7 @@ const ObjectChildTable = ({
{...property}
longId={false}
objectData={record}
parentData={objectData}
isEditing={isEditing}
useFormItem={false}
name={undefined}

View File

@ -74,6 +74,7 @@ const ObjectProperty = ({
masterFilter = {},
language = '',
objectData = null,
parentData = null,
objectType = 'unknown',
readOnly = false,
disabled = false,
@ -100,50 +101,51 @@ const ObjectProperty = ({
...rest
}) => {
if (value && typeof value == 'function' && objectData) {
value = value(objectData)
value = value(objectData, parentData)
}
if (max && typeof max == 'function' && objectData) {
max = max(objectData)
max = max(objectData, parentData)
}
if (min && typeof min == 'function' && objectData) {
min = min(objectData)
min = min(objectData, parentData)
}
if (objectType && typeof objectType == 'function' && objectData) {
objectType = objectType(objectData)
objectType = objectType(objectData, parentData)
}
if (disabled && typeof disabled == 'function' && objectData) {
disabled = disabled(objectData)
disabled = disabled(objectData, parentData)
}
if (empty && typeof empty == 'function' && objectData) {
empty = empty(objectData)
empty = empty(objectData, parentData)
}
if (difference && typeof difference == 'function' && objectData) {
difference = difference(objectData)
difference = difference(objectData, parentData)
}
if (prefix && typeof prefix == 'function' && objectData) {
prefix = prefix(objectData)
prefix = prefix(objectData, parentData)
}
if (suffix && typeof suffix == 'function' && objectData) {
suffix = suffix(objectData)
suffix = suffix(objectData, parentData)
}
if (masterFilter && typeof masterFilter == 'function' && objectData) {
masterFilter = masterFilter(objectData)
masterFilter = masterFilter(objectData, parentData)
}
if (options && typeof options == 'function' && objectData) {
options = options(objectData)
options = options(objectData, parentData)
}
if (readOnly && typeof readOnly == 'function' && objectData) {
readOnly = readOnly(objectData)
readOnly = readOnly(objectData, parentData)
}
if (!value) {