mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
fix #1006
This commit is contained in:
parent
963b8d669b
commit
c12d3faba3
@ -191,6 +191,7 @@ BootstrapTable.propTypes = {
|
||||
Const.INDICATOR_POSITION_LEFT,
|
||||
Const.INDICATOR_POSITION_RIGHT
|
||||
]),
|
||||
className: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
||||
parentClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.func])
|
||||
}),
|
||||
rowStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
import cs from 'classnames';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { CSSTransition } from 'react-transition-group';
|
||||
|
||||
const ExpandRow = ({ children, expanded, onClosed, ...rest }) => (
|
||||
const ExpandRow = ({ children, expanded, onClosed, className, ...rest }) => (
|
||||
<tr>
|
||||
<td className="reset-expansion-style" { ...rest }>
|
||||
<td className={ cs('reset-expansion-style', className) } { ...rest }>
|
||||
<CSSTransition
|
||||
appear
|
||||
in={ expanded }
|
||||
@ -25,13 +26,15 @@ const ExpandRow = ({ children, expanded, onClosed, ...rest }) => (
|
||||
ExpandRow.propTypes = {
|
||||
children: PropTypes.node,
|
||||
expanded: PropTypes.bool,
|
||||
onClosed: PropTypes.func
|
||||
onClosed: PropTypes.func,
|
||||
className: PropTypes.string
|
||||
};
|
||||
|
||||
ExpandRow.defaultProps = {
|
||||
children: null,
|
||||
expanded: false,
|
||||
onClosed: null
|
||||
onClosed: null,
|
||||
className: ''
|
||||
};
|
||||
|
||||
export default ExpandRow;
|
||||
|
||||
@ -8,6 +8,7 @@ import ExpansionContext from '../contexts/row-expand-context';
|
||||
export default (Component) => {
|
||||
const renderWithExpansion = (props, expandRow) => {
|
||||
let parentClassName = '';
|
||||
let className = '';
|
||||
const key = props.value;
|
||||
|
||||
const expanded = _.contains(expandRow.expanded, key);
|
||||
@ -17,6 +18,10 @@ export default (Component) => {
|
||||
parentClassName = _.isFunction(expandRow.parentClassName) ?
|
||||
expandRow.parentClassName(expanded, props.row, props.rowIndex) :
|
||||
(expandRow.parentClassName || '');
|
||||
|
||||
className = _.isFunction(expandRow.className) ?
|
||||
expandRow.className(expanded, props.row, props.rowIndex) :
|
||||
(expandRow.className || '');
|
||||
}
|
||||
|
||||
return [
|
||||
@ -33,6 +38,7 @@ export default (Component) => {
|
||||
colSpan={ props.visibleColumnSize }
|
||||
expanded={ expanded }
|
||||
onClosed={ () => expandRow.onClosed(key) }
|
||||
className={ className }
|
||||
>
|
||||
{ expandRow.renderer(props.row, props.rowIndex) }
|
||||
</ExpandRow> : null
|
||||
|
||||
Loading…
Reference in New Issue
Block a user