From 82761e28b7e0c89d010061a7453a40bfb744c78b Mon Sep 17 00:00:00 2001 From: Pawel Rog Date: Fri, 12 May 2017 14:47:27 +0200 Subject: [PATCH] Add table level props to component props. fixes #54 --- src/TableRow.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/TableRow.js b/src/TableRow.js index ab9caa9..37d1788 100644 --- a/src/TableRow.js +++ b/src/TableRow.js @@ -11,11 +11,11 @@ const propTypes = { CheckboxComponent: PropTypes.func, }; -const resolveProps = (row, componentProps) => { +const resolveProps = (row, componentProps, tableProps) => { if (!componentProps) { return {}; } else if (_.isFunction(componentProps)) { - return componentProps(row); + return componentProps(row, tableProps); } else if (_.isObject(componentProps)) { return componentProps; } @@ -31,6 +31,7 @@ class TableRow extends Component { headers, columns, CheckboxComponent, + ...otherProps, } = this.props; const select = headers.select; const visibleColumns = columns.filter((c) => !c.hidden); @@ -57,7 +58,7 @@ class TableRow extends Component { {_.get(row, col.key)} : _.get(row, col.key)