feat:增加 Hover状态是否同步到左侧Checkbox属性syncHover

This commit is contained in:
kvkens 2018-12-14 13:30:24 +08:00
parent e7d4988925
commit f30218c4dd
6 changed files with 56 additions and 16 deletions

View File

@ -106,6 +106,7 @@ class Demo extends Component {
| onFilterChange | 触发过滤输入操作以及下拉条件的回调 | function | (field,value,condition) => ()
| onFilterClear | 清除过滤条件的回调函数,回调参数为清空的字段 | function | (field) => ()
| headerScroll | 表头下是否显示滚动条 | bool| false
| syncHover | 是否同步Hover状态到左侧Checkbox关闭此功能有助于提升性能 | bool| true
*注意: data参数中的key值必需否则会导致部分功能出现问题建议使用唯一的值如id*

View File

@ -92,7 +92,13 @@ var propTypes = {
getBodyWrapper: _propTypes2["default"].func,
children: _propTypes2["default"].node,
draggable: _propTypes2["default"].bool,
minColumnWidth: _propTypes2["default"].number
minColumnWidth: _propTypes2["default"].number,
filterable: _propTypes2["default"].bool,
filterDelay: _propTypes2["default"].number,
onFilterChange: _propTypes2["default"].func,
onFilterClear: _propTypes2["default"].func,
syncHover: _propTypes2["default"].bool
};
var defaultProps = {
@ -132,7 +138,8 @@ var defaultProps = {
},
columns: [],
minColumnWidth: 80,
locale: {}
locale: {},
syncHover: true
};
var Table = function (_Component) {
@ -1088,9 +1095,14 @@ var Table = function (_Component) {
};
Table.prototype.handleRowHover = function handleRowHover(isHover, key) {
//增加新的API设置是否同步Hover状态提高性能避免无关的渲染
var syncHover = this.props.syncHover;
if (syncHover) {
this.store.setState({
currentHoverKey: isHover ? key : null
});
}
};
Table.prototype.render = function render() {

16
dist/demo.js vendored
View File

@ -10727,7 +10727,13 @@
getBodyWrapper: _propTypes2['default'].func,
children: _propTypes2['default'].node,
draggable: _propTypes2['default'].bool,
minColumnWidth: _propTypes2['default'].number
minColumnWidth: _propTypes2['default'].number,
filterable: _propTypes2['default'].bool,
filterDelay: _propTypes2['default'].number,
onFilterChange: _propTypes2['default'].func,
onFilterClear: _propTypes2['default'].func,
syncHover: _propTypes2['default'].bool
};
var defaultProps = {
@ -10767,7 +10773,8 @@
},
columns: [],
minColumnWidth: 80,
locale: {}
locale: {},
syncHover: true
};
var Table = function (_Component) {
@ -11723,9 +11730,14 @@
};
Table.prototype.handleRowHover = function handleRowHover(isHover, key) {
//增加新的API设置是否同步Hover状态提高性能避免无关的渲染
var syncHover = this.props.syncHover;
if (syncHover) {
this.store.setState({
currentHoverKey: isHover ? key : null
});
}
};
Table.prototype.render = function render() {

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -54,6 +54,9 @@ import 'bee-table/build/Table.css';
| onFilterClear | 清除过滤条件的回调函数,回调参数为清空的字段 | function | (field) => ()
| headerScroll | 表头下是否显示滚动条 | bool| false
| sort | 排序的属性 | object| { mode:'single'//单列排序, backSource:false //默认是前端排序值为true为后端排序 } mode:multiple-多列排序
| syncHover | 是否同步Hover状态到左侧Checkbox关闭此功能有助于提升性能 | bool| true
*注意: data参数中的key值必需否则会导致部分功能出现问题建议使用唯一的值如id*

View File

@ -42,7 +42,13 @@ const propTypes = {
getBodyWrapper: PropTypes.func,
children: PropTypes.node,
draggable: PropTypes.bool,
minColumnWidth: PropTypes.number
minColumnWidth: PropTypes.number,
filterable: PropTypes.bool,
filterDelay: PropTypes.number,
onFilterChange: PropTypes.func,
onFilterClear: PropTypes.func,
syncHover: PropTypes.bool,
};
const defaultProps = {
@ -71,7 +77,8 @@ const defaultProps = {
emptyText: () => 'No Data',
columns:[],
minColumnWidth: 80,
locale:{}
locale:{},
syncHover: true
};
class Table extends Component {
@ -958,11 +965,16 @@ class Table extends Component {
}
handleRowHover(isHover, key) {
//增加新的API设置是否同步Hover状态提高性能避免无关的渲染
let { syncHover } = this.props;
if(syncHover){
this.store.setState({
currentHoverKey: isHover ? key : null,
});
}
}
render() {
const props = this.props;
const clsPrefix = props.clsPrefix;