diff --git a/src/Table.js b/src/Table.js index c464abe..b5f6865 100644 --- a/src/Table.js +++ b/src/Table.js @@ -802,7 +802,7 @@ class Table extends Component { indent={indent} indentSize={props.indentSize} needIndentSpaced={needIndentSpaced} - className={`${className} ${props.rowDraggAble && !props.useDragHandle?'row-dragg-able ':''}`} + className={`${className}`} record={record} expandIconAsCell={expandIconAsCell} onDestroy={this.onRowDestroy} diff --git a/src/TableCell.js b/src/TableCell.js index c2b7bcc..9a4f6d1 100644 --- a/src/TableCell.js +++ b/src/TableCell.js @@ -184,6 +184,11 @@ class TableCell extends Component{ onPaste(e,position) } + onCellMouseOver = (e)=> { + const {column} = this.props + this.props.stopRowDrag(column.notRowDrag) + } + render() { const { record, indentSize, clsPrefix, indent, index, expandIcon, column ,fixed,showSum, bodyDisplayInRow,lazyStartIndex,lazyEndIndex} = this.props; @@ -301,6 +306,7 @@ class TableCell extends Component{ onClick={this.handleClick} title={title} onPaste={this.onPaste} + onMouseOver={this.onCellMouseOver} style={{maxWidth:column.width, color:fontColor, backgroundColor:bgColor, ...column.style}}> {indentText} {expandIcon} diff --git a/src/TableRow.js b/src/TableRow.js index ffb3ec1..4b2cad4 100644 --- a/src/TableRow.js +++ b/src/TableRow.js @@ -140,7 +140,7 @@ class TableRow extends Component{ */ onDragStart = (e) => { let {onDragRowStart} = this.props; - if (!this.props.rowDraggAble) return; + if (!this.props.rowDraggAble || this.notRowDrag) return; let event = Event.getEvent(e) , target = Event.getTarget(event); if (target.tagName === 'TD') { @@ -430,6 +430,16 @@ class TableRow extends Component{ onHover(false, hoverKey,e,fixedIndex,record); } + stopRowDrag = (isStop) => { + const {rowDraggAble} = this.props; + const {notRowDrag} = this.state; + if(rowDraggAble && isStop!== notRowDrag) { + this.setState({ + notRowDrag: isStop + }) + } + } + set =(fn)=> { this.clear(); this._timeout = window.setTimeout(fn, 300); @@ -452,6 +462,7 @@ class TableRow extends Component{ expandable, onExpand, needIndentSpaced, indent, indentSize,isHiddenExpandIcon,fixed,bodyDisplayInRow ,expandedIcon,collapsedIcon, hoverKey,lazyStartIndex,lazyEndIndex, expandIconCellWidth } = this.props; + const {notRowDrag} = this.state; let showSum = false; let { className } = this.props; if (this.state.hovered) { @@ -515,6 +526,7 @@ class TableRow extends Component{ lazyStartIndex={lazyStartIndex} lazyEndIndex={lazyEndIndex} onPaste={onPaste} + stopRowDrag={this.stopRowDrag} col={i} /> ); @@ -526,9 +538,14 @@ class TableRow extends Component{ if(record && record._checked){ className += ' selected'; } + + if(rowDraggAble && !useDragHandle && !notRowDrag) { + className += ' row-dragg-able' + } + return (