v 1.6.0 交换列处理

This commit is contained in:
“jonyshi” 2018-12-03 11:17:39 +08:00
parent 3d8ef5860c
commit 8e379ae5e6
4 changed files with 13 additions and 4 deletions

View File

@ -75,7 +75,8 @@ var TableHeader = function (_Component) {
var currentCols = _this.table.cols[_this.drag.currIndex];
var diff = event.x - _this.drag.oldLeft;
var newWidth = _this.drag.oldWidth + diff;
if (newWidth > _this.drag.minWidth) {
// if(newWidth > this.drag.minWidth){
if (newWidth > _this.minWidth) {
currentCols.style.width = newWidth + 'px';
//hao 支持固定表头拖拽 修改表体的width
if (_this.fixedTable.cols) {
@ -174,6 +175,7 @@ var TableHeader = function (_Component) {
return;
}
var data = _this.getCurrentEventData(e);
if (!data) return;
if (!_this.currentObj || _this.currentObj.key == data.key) return;
if (!_this.props.onDrop) return;
_this.props.onDrop(event, { dragSource: _this.currentObj, dragTarg: data });
@ -308,6 +310,7 @@ var TableHeader = function (_Component) {
width: 0,
option: ''
};
_this.minWidth = 80; //确定最小宽度就是80
_this.table = null;
var _row = [];
_this.props.rows[0] && _this.props.rows[0].forEach(function (item) {

5
dist/demo.js vendored
View File

@ -12630,7 +12630,8 @@
var currentCols = _this.table.cols[_this.drag.currIndex];
var diff = event.x - _this.drag.oldLeft;
var newWidth = _this.drag.oldWidth + diff;
if (newWidth > _this.drag.minWidth) {
// if(newWidth > this.drag.minWidth){
if (newWidth > _this.minWidth) {
currentCols.style.width = newWidth + 'px';
//hao 支持固定表头拖拽 修改表体的width
if (_this.fixedTable.cols) {
@ -12729,6 +12730,7 @@
return;
}
var data = _this.getCurrentEventData(e);
if (!data) return;
if (!_this.currentObj || _this.currentObj.key == data.key) return;
if (!_this.props.onDrop) return;
_this.props.onDrop(event, { dragSource: _this.currentObj, dragTarg: data });
@ -12863,6 +12865,7 @@
width: 0,
option: ''
};
_this.minWidth = 80; //确定最小宽度就是80
_this.table = null;
var _row = [];
_this.props.rows[0] && _this.props.rows[0].forEach(function (item) {

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -29,6 +29,7 @@ class TableHeader extends Component {
width: 0,
option:''
};
this.minWidth = 80;//确定最小宽度就是80
this.table = null;
let _row = [];
this.props.rows[0] &&
@ -164,7 +165,8 @@ class TableHeader extends Component {
let currentCols = this.table.cols[this.drag.currIndex];
let diff = (event.x - this.drag.oldLeft);
let newWidth = this.drag.oldWidth + diff;
if(newWidth > this.drag.minWidth){
// if(newWidth > this.drag.minWidth){
if(newWidth > this.minWidth){
currentCols.style.width = newWidth +'px';
//hao 支持固定表头拖拽 修改表体的width
if(this.fixedTable.cols){
@ -309,6 +311,7 @@ class TableHeader extends Component {
if (!this.props.draggable) return;
if(this.drag.option === 'border'){return;}
let data = this.getCurrentEventData(e);
if(!data)return;
if (!this.currentObj || this.currentObj.key == data.key) return;
if(!this.props.onDrop)return;
this.props.onDrop(event,{dragSource:this.currentObj,dragTarg:data});