drop 增加参数node.props.cloum

This commit is contained in:
jonyshi 2019-08-30 11:39:59 +08:00
parent 8991080cde
commit d7638273ca
3 changed files with 17 additions and 13 deletions

View File

@ -309,6 +309,8 @@ var TableHeader = function (_Component) {
_this.onDrop = function (e) { _this.onDrop = function (e) {
if (!_this.props.draggable) return; if (!_this.props.draggable) return;
var colum = _this.getCurrentEventData(_this._dragCurrent);
e.node = { props: { colum: colum } };
if (_this.drag && _this.drag.option != 'dragAble') { if (_this.drag && _this.drag.option != 'dragAble') {
_this.props.onDrop(e); _this.props.onDrop(e);
return; return;
@ -316,14 +318,14 @@ var TableHeader = function (_Component) {
var event = _utils.Event.getEvent(e), var event = _utils.Event.getEvent(e),
target = _utils.Event.getTarget(event); target = _utils.Event.getTarget(event);
_this.currentDome.setAttribute('draggable', false); //添加交换列效果 _this.currentDome.setAttribute('draggable', false); //添加交换列效果
var data = _this.getCurrentEventData(_this._dragCurrent); // let data = this.getCurrentEventData(this._dragCurrent);
if (!data) { // if(!data){
_this.props.onDrop(e); // this.props.onDrop(e);
return; // return;
} // }
if (!_this.props.onDrop) return; if (!_this.props.onDrop) return;
// this.props.onDrop(event,target); // this.props.onDrop(event,target);
_this.props.onDrop(event, { dragSource: _this.currentObj, dragTarg: data }); _this.props.onDrop(event, { dragSource: _this.currentObj, dragTarg: colum });
}; };
_this.onDragEnter = function (e) { _this.onDragEnter = function (e) {

View File

@ -1,6 +1,6 @@
{ {
"name": "bee-table", "name": "bee-table",
"version": "2.2.4", "version": "2.2.5",
"description": "Table ui component for react", "description": "Table ui component for react",
"keywords": [ "keywords": [
"react", "react",

View File

@ -488,6 +488,8 @@ class TableHeader extends Component {
*/ */
onDrop = (e) => { onDrop = (e) => {
if (!this.props.draggable) return; if (!this.props.draggable) return;
let colum = this.getCurrentEventData(this._dragCurrent)
e.node = {props:{colum}};
if(this.drag && this.drag.option != 'dragAble'){ if(this.drag && this.drag.option != 'dragAble'){
this.props.onDrop(e); this.props.onDrop(e);
return; return;
@ -495,14 +497,14 @@ class TableHeader extends Component {
let event = Event.getEvent(e) , let event = Event.getEvent(e) ,
target = Event.getTarget(event); target = Event.getTarget(event);
this.currentDome.setAttribute('draggable',false);//添加交换列效果 this.currentDome.setAttribute('draggable',false);//添加交换列效果
let data = this.getCurrentEventData(this._dragCurrent); // let data = this.getCurrentEventData(this._dragCurrent);
if(!data){ // if(!data){
this.props.onDrop(e); // this.props.onDrop(e);
return; // return;
} // }
if(!this.props.onDrop)return; if(!this.props.onDrop)return;
// this.props.onDrop(event,target); // this.props.onDrop(event,target);
this.props.onDrop(event,{dragSource:this.currentObj,dragTarg:data}); this.props.onDrop(event,{dragSource:this.currentObj,dragTarg:colum});
}; };