Skip to content

Commit c12d3fa

Browse files
committed
fix #1006
1 parent 963b8d6 commit c12d3fa

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

packages/react-bootstrap-table2/src/bootstrap-table.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ BootstrapTable.propTypes = {
191191
Const.INDICATOR_POSITION_LEFT,
192192
Const.INDICATOR_POSITION_RIGHT
193193
]),
194+
className: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
194195
parentClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.func])
195196
}),
196197
rowStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),

packages/react-bootstrap-table2/src/row-expand/expand-row.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import cs from 'classnames';
12
import React from 'react';
23
import PropTypes from 'prop-types';
34
import { CSSTransition } from 'react-transition-group';
45

5-
const ExpandRow = ({ children, expanded, onClosed, ...rest }) => (
6+
const ExpandRow = ({ children, expanded, onClosed, className, ...rest }) => (
67
<tr>
7-
<td className="reset-expansion-style" { ...rest }>
8+
<td className={ cs('reset-expansion-style', className) } { ...rest }>
89
<CSSTransition
910
appear
1011
in={ expanded }
@@ -25,13 +26,15 @@ const ExpandRow = ({ children, expanded, onClosed, ...rest }) => (
2526
ExpandRow.propTypes = {
2627
children: PropTypes.node,
2728
expanded: PropTypes.bool,
28-
onClosed: PropTypes.func
29+
onClosed: PropTypes.func,
30+
className: PropTypes.string
2931
};
3032

3133
ExpandRow.defaultProps = {
3234
children: null,
3335
expanded: false,
34-
onClosed: null
36+
onClosed: null,
37+
className: ''
3538
};
3639

3740
export default ExpandRow;

packages/react-bootstrap-table2/src/row-expand/row-consumer.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import ExpansionContext from '../contexts/row-expand-context';
88
export default (Component) => {
99
const renderWithExpansion = (props, expandRow) => {
1010
let parentClassName = '';
11+
let className = '';
1112
const key = props.value;
1213

1314
const expanded = _.contains(expandRow.expanded, key);
@@ -17,6 +18,10 @@ export default (Component) => {
1718
parentClassName = _.isFunction(expandRow.parentClassName) ?
1819
expandRow.parentClassName(expanded, props.row, props.rowIndex) :
1920
(expandRow.parentClassName || '');
21+
22+
className = _.isFunction(expandRow.className) ?
23+
expandRow.className(expanded, props.row, props.rowIndex) :
24+
(expandRow.className || '');
2025
}
2126

2227
return [
@@ -33,6 +38,7 @@ export default (Component) => {
3338
colSpan={ props.visibleColumnSize }
3439
expanded={ expanded }
3540
onClosed={ () => expandRow.onClosed(key) }
41+
className={ className }
3642
>
3743
{ expandRow.renderer(props.row, props.rowIndex) }
3844
</ExpandRow> : null

0 commit comments

Comments
 (0)