@trudb/tru-common-lib 0.2.545 → 0.2.546

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8084,6 +8084,21 @@ class TruDataGridUtil {
8084
8084
  return true;
8085
8085
  return TruDataGridUtil.resolvePropertyPath(entity, propertyPath) !== null;
8086
8086
  };
8087
+ static getCellEditorConfigField = (rowData, columnDef) => {
8088
+ const fieldName = columnDef.field;
8089
+ if (!fieldName)
8090
+ return undefined;
8091
+ const propertyPath = rowData?.[fieldName]?.propertyPath;
8092
+ if (TruDataGridUtil.isPropertyPathAvailable(rowData?.$entity, propertyPath))
8093
+ return fieldName;
8094
+ const relationshipConfigField = columnDef.relationshipConfigField;
8095
+ if (!relationshipConfigField)
8096
+ return fieldName;
8097
+ const relationshipPropertyPath = rowData?.[relationshipConfigField]?.propertyPath;
8098
+ if (!TruDataGridUtil.isPropertyPathAvailable(rowData?.$entity, relationshipPropertyPath))
8099
+ return fieldName;
8100
+ return relationshipConfigField;
8101
+ };
8087
8102
  static validatePropertyPath = (entity, propertyPath) => {
8088
8103
  const resolvedProperty = TruDataGridUtil.resolvePropertyPath(entity, propertyPath);
8089
8104
  if (!resolvedProperty)
@@ -9186,9 +9201,9 @@ class TruDataGrid {
9186
9201
  : configuredEditable;
9187
9202
  if (!canEdit)
9188
9203
  return false;
9189
- const fieldName = columnDef.field;
9190
- const propertyPath = fieldName
9191
- ? params.data?.[fieldName]?.propertyPath
9204
+ const configFieldName = TruDataGridUtil.getCellEditorConfigField(params.data, columnDef);
9205
+ const propertyPath = configFieldName
9206
+ ? params.data?.[configFieldName]?.propertyPath
9192
9207
  : undefined;
9193
9208
  return TruDataGridUtil.isPropertyPathAvailable(params.data?.$entity, propertyPath);
9194
9209
  },