merge
This commit is contained in:
commit
07009bae46
|
@ -1,3 +1,8 @@
|
|||
<a name="2.0.25"></a>
|
||||
## [2.0.25](https://github.com/tinper-bee/bee-table/compare/v2.0.24...v2.0.25) (2019-05-24)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.24"></a>
|
||||
## [2.0.24](https://github.com/tinper-bee/bee-table/compare/v2.0.22...v2.0.24) (2019-05-22)
|
||||
|
||||
|
|
|
@ -205,17 +205,18 @@ var Table = function (_Component) {
|
|||
targetIndex = i;
|
||||
}
|
||||
});
|
||||
if (currentIndex < targetIndex) {
|
||||
data.splice(targetIndex, 0, data.splice(currentIndex, 1).shift());
|
||||
} else {
|
||||
data.splice(targetIndex + 1, 0, data.splice(currentIndex, 1).shift());
|
||||
}
|
||||
data = _this.swapArray(data, currentIndex, targetIndex);
|
||||
_this.props.onDropRow && _this.props.onDropRow(data, record);
|
||||
_this.setState({
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
_this.swapArray = function (arr, index1, index2) {
|
||||
arr[index1] = arr.splice(index2, 1, arr[index1])[0];
|
||||
return arr;
|
||||
};
|
||||
|
||||
_this.renderDragHideTable = function () {
|
||||
var _this$props = _this.props,
|
||||
columns = _this$props.columns,
|
||||
|
@ -396,7 +397,7 @@ var Table = function (_Component) {
|
|||
}
|
||||
|
||||
// 是否传入 scroll中的y属性,如果传入判断是否是整数,如果是则进行比较 。bodyTable 的clientHeight进行判断
|
||||
// this.isShowScrollY();
|
||||
this.isShowScrollY();
|
||||
};
|
||||
|
||||
Table.prototype.componentWillUnmount = function componentWillUnmount() {
|
||||
|
@ -454,7 +455,7 @@ var Table = function (_Component) {
|
|||
var bodyH = this.bodyTable.clientHeight;
|
||||
var bodyContentH = this.bodyTable.querySelector('table').clientHeight;
|
||||
var rightBodyTable = this.refs.fixedColumnsBodyRight;
|
||||
var leftBodyTable = this.refs.fixedColumnsBodyLeft;
|
||||
// const leftBodyTable = this.refs.fixedColumnsBodyLeft;
|
||||
var overflowy = bodyContentH <= bodyH ? 'auto' : 'scroll';
|
||||
this.bodyTable.style.overflowY = overflowy;
|
||||
|
||||
|
@ -737,6 +738,13 @@ var Table = function (_Component) {
|
|||
* @param targetKey 拖拽结束时,目标位置的key
|
||||
*/
|
||||
|
||||
/**
|
||||
* 数组元素交换位置
|
||||
* @param {array} arr 数组
|
||||
* @param {number} index1 添加项目的位置
|
||||
* @param {number} index2 删除项目的位置
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -16626,17 +16626,18 @@
|
|||
targetIndex = i;
|
||||
}
|
||||
});
|
||||
if (currentIndex < targetIndex) {
|
||||
data.splice(targetIndex, 0, data.splice(currentIndex, 1).shift());
|
||||
} else {
|
||||
data.splice(targetIndex + 1, 0, data.splice(currentIndex, 1).shift());
|
||||
}
|
||||
data = _this.swapArray(data, currentIndex, targetIndex);
|
||||
_this.props.onDropRow && _this.props.onDropRow(data, record);
|
||||
_this.setState({
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
_this.swapArray = function (arr, index1, index2) {
|
||||
arr[index1] = arr.splice(index2, 1, arr[index1])[0];
|
||||
return arr;
|
||||
};
|
||||
|
||||
_this.renderDragHideTable = function () {
|
||||
var _this$props = _this.props,
|
||||
columns = _this$props.columns,
|
||||
|
@ -17158,6 +17159,13 @@
|
|||
* @param targetKey 拖拽结束时,目标位置的key
|
||||
*/
|
||||
|
||||
/**
|
||||
* 数组元素交换位置
|
||||
* @param {array} arr 数组
|
||||
* @param {number} index1 添加项目的位置
|
||||
* @param {number} index2 删除项目的位置
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bee-table",
|
||||
"version": "2.0.25-beta.0",
|
||||
"version": "2.0.26-beta.0",
|
||||
"description": "Table ui component for react",
|
||||
"keywords": [
|
||||
"react",
|
||||
|
|
16
src/Table.js
16
src/Table.js
|
@ -581,16 +581,22 @@ class Table extends Component {
|
|||
targetIndex = i;
|
||||
}
|
||||
});
|
||||
if(currentIndex < targetIndex){
|
||||
data.splice(targetIndex, 0, data.splice(currentIndex, 1).shift());
|
||||
}else{
|
||||
data.splice((targetIndex+1), 0, data.splice(currentIndex, 1).shift());
|
||||
}
|
||||
data = this.swapArray(data,currentIndex,targetIndex);
|
||||
this.props.onDropRow && this.props.onDropRow(data,record);
|
||||
this.setState({
|
||||
data,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 数组元素交换位置
|
||||
* @param {array} arr 数组
|
||||
* @param {number} index1 添加项目的位置
|
||||
* @param {number} index2 删除项目的位置
|
||||
*/
|
||||
swapArray = (arr, index1, index2) => {
|
||||
arr[index1] = arr.splice(index2, 1, arr[index1])[0];
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue