fix:行destory时,hoverDom

This commit is contained in:
wanghaoo 2019-03-08 10:10:47 +08:00
parent 37b9806507
commit c0d9531a0a
4 changed files with 43 additions and 31 deletions

39
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "bee-table",
"version": "2.0.3-beta.0",
"version": "2.0.4",
"description": "Table ui component for react",
"keywords": [
"react",

View File

@ -320,6 +320,10 @@ class Table extends Component {
if (index !== -1) {
expandedRows.splice(index, 1);
}
//
if(this.currentHoverKey == rowKey && this.hoverDom){
this.hoverDom.style.display = 'none';
}
this.onExpandedRowsChange(expandedRows);
}
@ -1114,20 +1118,23 @@ class Table extends Component {
currentHoverKey: isHover ? key : null,
});
}
if(this.hoverDom && isHover){
this.currentHoverKey = key;
const td = closest(event.target,'td');
if(td){
const scrollTop = this.lastScrollTop ?this.lastScrollTop:0
let top = td.offsetTop - scrollTop;
if(this.refs.headTable){
top = top + this.refs.headTable.clientHeight;
if(this.hoverDom){
if(isHover){
this.currentHoverKey = key;
const td = closest(event.target,'td');
if(td){
const scrollTop = this.lastScrollTop ?this.lastScrollTop:0
let top = td.offsetTop - scrollTop;
if(this.refs.headTable){
top = top + this.refs.headTable.clientHeight;
}
this.hoverDom.style.top = top + 'px';
this.hoverDom.style.height = td.offsetHeight + 'px';
this.hoverDom.style.lineHeight = td.offsetHeight + 'px';
this.hoverDom.style.display = 'block';
}
this.hoverDom.style.top = top + 'px';
this.hoverDom.style.height = td.offsetHeight + 'px';
this.hoverDom.style.lineHeight = td.offsetHeight + 'px';
this.hoverDom.style.display = 'block';
}
}
onRowHover && onRowHover(currentIndex,record);