From 092b9ff4e43918a1efa3a76ad419eb94824bc69a Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Sat, 4 Jul 2026 20:20:17 +0100 Subject: [PATCH] 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. --- .../Dashboard/common/ObjectChildTable.jsx | 1 + .../Dashboard/common/ObjectProperty.jsx | 26 ++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/components/Dashboard/common/ObjectChildTable.jsx b/src/components/Dashboard/common/ObjectChildTable.jsx index 7ac9263..9aa43c4 100644 --- a/src/components/Dashboard/common/ObjectChildTable.jsx +++ b/src/components/Dashboard/common/ObjectChildTable.jsx @@ -186,6 +186,7 @@ const ObjectChildTable = ({ {...property} longId={false} objectData={record} + parentData={objectData} isEditing={isEditing} useFormItem={false} name={undefined} diff --git a/src/components/Dashboard/common/ObjectProperty.jsx b/src/components/Dashboard/common/ObjectProperty.jsx index 4eac600..d531581 100644 --- a/src/components/Dashboard/common/ObjectProperty.jsx +++ b/src/components/Dashboard/common/ObjectProperty.jsx @@ -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) {