This commit is contained in:
wanghaoo 2019-02-18 14:56:02 +08:00
parent d767e1af81
commit 06c4556145
2 changed files with 11 additions and 9 deletions

View File

@ -99,7 +99,8 @@ var propTypes = {
onFilterChange: _propTypes2["default"].func, onFilterChange: _propTypes2["default"].func,
onFilterClear: _propTypes2["default"].func, onFilterClear: _propTypes2["default"].func,
syncHover: _propTypes2["default"].bool, syncHover: _propTypes2["default"].bool,
tabIndex: _propTypes2["default"].string tabIndex: _propTypes2["default"].string,
hoverContent: _propTypes2["default"].func
}; };
var defaultProps = { var defaultProps = {
@ -760,8 +761,7 @@ var Table = function (_Component) {
setRowParentIndex: props.setRowParentIndex, setRowParentIndex: props.setRowParentIndex,
treeType: childrenColumn || this.treeType ? true : false, treeType: childrenColumn || this.treeType ? true : false,
fixedIndex: fixedIndex + lazyCurrentIndex, fixedIndex: fixedIndex + lazyCurrentIndex,
rootIndex: rootIndex, rootIndex: rootIndex
hoverContent: props.hoverContent
}))); })));
this.treeRowIndex++; this.treeRowIndex++;
var subVisible = visible && isRowExpanded; var subVisible = visible && isRowExpanded;
@ -1221,9 +1221,11 @@ var Table = function (_Component) {
//增加新的API设置是否同步Hover状态提高性能避免无关的渲染 //增加新的API设置是否同步Hover状态提高性能避免无关的渲染
var _props9 = this.props, var _props9 = this.props,
syncHover = _props9.syncHover, syncHover = _props9.syncHover,
onRowHover = _props9.onRowHover; onRowHover = _props9.onRowHover,
// 固定列、或者含有hoverdom时情况下同步hover状态 data = _props9.data;
var record = data[currentIndex];
// 固定列、或者含有hoverdom时情况下同步hover状态
if (this.columnManager.isAnyColumnsFixed() && syncHover) { if (this.columnManager.isAnyColumnsFixed() && syncHover) {
this.hoverKey = key; this.hoverKey = key;
this.store.setState({ this.store.setState({
@ -1240,7 +1242,8 @@ var Table = function (_Component) {
this.hoverDom.style.display = 'block'; this.hoverDom.style.display = 'block';
} }
} }
onRowHover && onRowHover(currentIndex);
onRowHover && onRowHover(currentIndex, record);
}; };
Table.prototype.render = function render() { Table.prototype.render = function render() {
@ -1309,7 +1312,7 @@ var Table = function (_Component) {
onMouseEnter: this.onRowHoverMouseEnter, onMouseLeave: this.onRowHoverMouseLeave, ref: function ref(el) { onMouseEnter: this.onRowHoverMouseEnter, onMouseLeave: this.onRowHoverMouseLeave, ref: function ref(el) {
return _this6.hoverDom = el; return _this6.hoverDom = el;
} }, } },
props.hoverContent props.hoverContent()
) )
); );
}; };

View File

@ -300,8 +300,7 @@ var TableRow = function (_Component) {
// key={hoverKey} // key={hoverKey}
, ref: this.bindElement , ref: this.bindElement
}, },
cells.length > 0 ? cells : _react2["default"].createElement('td', null), cells.length > 0 ? cells : _react2["default"].createElement('td', null)
_react2["default"].createElement('div', { className: 'u-row-hover2' })
); );
}; };