mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2025-10-16 11:55:39 +00:00
Update bootstrap-table and row-consumer
Add new props to the bootstrap-table, nonSelectableStyle and nonSelectableClasses Update row-consume in order to support custom styles and classes for non selectable rows
This commit is contained in:
parent
18caf0ac8d
commit
defcd04b52
@ -166,6 +166,8 @@ BootstrapTable.propTypes = {
|
||||
style: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
|
||||
classes: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
||||
nonSelectable: PropTypes.array,
|
||||
nonSelectableStyle: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
||||
nonSelectableClasses: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
||||
bgColor: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
|
||||
hideSelectColumn: PropTypes.bool,
|
||||
selectionRenderer: PropTypes.func,
|
||||
|
||||
@ -9,6 +9,7 @@ export default (Component) => {
|
||||
const key = props.value;
|
||||
const selected = _.contains(selectRow.selected, key);
|
||||
const selectable = !selectRow.nonSelectable || !_.contains(selectRow.nonSelectable, key);
|
||||
const notSelectable = _.contains(selectRow.nonSelectable, key);
|
||||
|
||||
let {
|
||||
style,
|
||||
@ -38,6 +39,22 @@ export default (Component) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (notSelectable) {
|
||||
const notSelectableStyle = _.isFunction(selectRow.nonSelectableStyle)
|
||||
? selectRow.nonSelectableStyle(props.row, props.rowIndex)
|
||||
: selectRow.nonSelectableStyle;
|
||||
|
||||
const notSelectableClasses = _.isFunction(selectRow.nonSelectableClasses)
|
||||
? selectRow.nonSelectableClasses(props.row, props.rowIndex)
|
||||
: selectRow.nonSelectableClasses;
|
||||
|
||||
style = {
|
||||
...style,
|
||||
...notSelectableStyle
|
||||
};
|
||||
className = cs(className, notSelectableClasses) || undefined;
|
||||
}
|
||||
|
||||
return (
|
||||
<Component
|
||||
{ ...props }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user