Skip to content

Commit e864f33

Browse files
CopilotBSd3v
andauthored
refactor: centralize detail params normalization and add changelog
Agent-Logs-Url: https://github.com/plotly/dash-ag-grid/sessions/8ac40ce1-2f40-4da6-be94-8b7a9896c93f Co-authored-by: BSd3v <82055130+BSd3v@users.noreply.github.com>
1 parent a121b42 commit e864f33

2 files changed

Lines changed: 12 additions & 25 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Links "DE#nnn" prior to version 2.0 point to the Dash Enterprise closed-source D
77
## [unreleased]
88
### Added
99
- [#453](https://github.com/plotly/dash-ag-grid/pull/453) Test for changelog entry
10+
- [#455](https://github.com/plotly/dash-ag-grid/pull/455) Added support for dynamic `detailCellRendererParams` in Master/Detail, including dynamic detail-grid column definitions.
1011

1112
### Changed
1213
- [#452](https://github.com/plotly/dash-ag-grid/pull/452)

‎src/lib/fragments/AgGrid.react.js‎

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,13 @@ export function DashAgGrid(props) {
644644
}, value);
645645
}
646646
if (GRID_NESTED_FUNCTIONS[target]) {
647+
if (
648+
target === 'rowSelection' &&
649+
typeof value === 'string'
650+
) {
651+
// to still support rowSelection='single' | 'multiple' deprecated in v32.3.4
652+
return value;
653+
}
647654
if (target === 'detailCellRendererParams') {
648655
if (has('function', value)) {
649656
const dynamicDetailParams =
@@ -658,32 +665,11 @@ export function DashAgGrid(props) {
658665
dynamicDetailParams
659666
);
660667
}
661-
return normalizeDetailCellRendererParams(value);
662-
}
663-
664-
let adjustedVal = value;
665-
if (
666-
target === 'rowSelection' &&
667-
typeof value === 'string'
668-
) {
669-
// to still support rowSelection='single' | 'multiple' deprecated in v32.3.4
670-
return value;
671-
}
672-
if ('suppressCallback' in value) {
673-
adjustedVal = {
674-
...adjustedVal,
675-
getDetailRowData: value.suppressCallback
676-
? suppressGetDetail(value.detailColName)
677-
: callbackGetDetail,
678-
};
679-
}
680-
if ('detailGridOptions' in value) {
681-
adjustedVal = assocPath(
682-
['detailGridOptions', 'components'],
683-
components,
684-
adjustedVal
685-
);
686668
}
669+
const adjustedVal =
670+
target === 'detailCellRendererParams'
671+
? normalizeDetailCellRendererParams(value)
672+
: value;
687673
return convertAllPropsRef.current(adjustedVal);
688674
}
689675
if (GRID_DANGEROUS_FUNCTIONS[target]) {

0 commit comments

Comments
 (0)