Skip to content

Commit

Permalink
fix: regression of optional detail panel function
Browse files Browse the repository at this point in the history
  • Loading branch information
Domino987 committed Sep 21, 2021
1 parent 479798c commit 6d55e36
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/components/m-table-detailpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,20 @@ function MTableDetailPanel(props) {
if (!props.detailPanel) {
return <React.Fragment />;
} else {
console.log(typeof props.detailPanel, props.detailPanel);
if (typeof props.detailPanel === 'function') {
renderFunction = props.detailPanel;
} else {
renderFunction = props.detailPanel
? props.detailPanel.find(
(panel) =>
panel.render.toString() ===
(props.data.tableData.showDetailPanel || '').toString()
)
? props.detailPanel
.map((panel) =>
typeof panel === 'function' ? panel(props.data) : panel
)
.find(
(panel) =>
panel.render.toString() ===
(props.data.tableData.showDetailPanel || '').toString()
)
: undefined;
renderFunction = renderFunction ? renderFunction.render : null;
}
Expand Down

0 comments on commit 6d55e36

Please sign in to comment.