merge
This commit is contained in:
commit
0cddb2738f
24
CHANGELOG.md
24
CHANGELOG.md
|
@ -1,3 +1,13 @@
|
|||
<a name="2.1.3"></a>
|
||||
## [2.1.3](https://github.com/tinper-bee/bee-table/compare/v2.1.2...v2.1.3) (2019-06-12)
|
||||
|
||||
|
||||
|
||||
<a name="2.1.2"></a>
|
||||
## [2.1.2](https://github.com/tinper-bee/bee-table/compare/v2.1.1...v2.1.2) (2019-06-06)
|
||||
|
||||
|
||||
|
||||
<a name="2.1.1"></a>
|
||||
## [2.1.1](https://github.com/tinper-bee/bee-table/compare/v2.1.0...v2.1.1) (2019-06-05)
|
||||
|
||||
|
@ -9,7 +19,7 @@
|
|||
|
||||
|
||||
<a name="2.1.0"></a>
|
||||
# [2.1.0](https://github.com/tinper-bee/bee-table/compare/v2.0.24...v2.1.0) (2019-06-01)
|
||||
# [2.1.0](https://github.com/tinper-bee/bee-table/compare/v2.0.25...v2.1.0) (2019-06-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
@ -18,13 +28,13 @@
|
|||
|
||||
|
||||
|
||||
<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.23...v2.0.24) (2019-05-22)
|
||||
|
||||
|
||||
|
||||
<a name="2.0.23"></a>
|
||||
## [2.0.23](https://github.com/tinper-bee/bee-table/compare/v2.0.22...v2.0.23) (2019-05-22)
|
||||
## [2.0.24](https://github.com/tinper-bee/bee-table/compare/v2.0.22...v2.0.24) (2019-05-22)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -153,6 +153,13 @@
|
|||
.u-loading.u-loading-line.u-loading-line-warning > div {
|
||||
background-color: #ff9800; }
|
||||
|
||||
.u-loading.u-loading-custom > div {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
-webkit-transform: translate(-50%, -50%);
|
||||
transform: translate(-50%, -50%); }
|
||||
|
||||
@keyframes line-scale {
|
||||
0% {
|
||||
-webkit-transform: scaley(1);
|
||||
|
|
|
@ -96,11 +96,13 @@ var TableHeader = function (_Component) {
|
|||
_this.drag.minWidth = currentObj.style.minWidth != "" ? parseInt(currentObj.style.minWidth) : defaultWidth;
|
||||
_this.drag.tableWidth = parseInt(_this.table.table.style.width ? _this.table.table.style.width : _this.table.table.scrollWidth);
|
||||
} else if (type != 'online' && _this.props.draggable) {
|
||||
if (!_this.props.draggable || targetEvent.nodeName.toUpperCase() != "TH") return;
|
||||
targetEvent.setAttribute('draggable', true); //添加交换列效果
|
||||
// if (!this.props.draggable || targetEvent.nodeName.toUpperCase() != "TH") return;
|
||||
if (!_this.props.draggable) return;
|
||||
var th = _this.getTargetToTh(targetEvent);
|
||||
th.setAttribute('draggable', true); //添加交换列效果
|
||||
_this.drag.option = 'dragAble';
|
||||
_this.currentDome = event.target;
|
||||
var _currentIndex = parseInt(currentElement.getAttribute("data-line-index"));
|
||||
_this.currentDome = th;
|
||||
var _currentIndex = parseInt(th.getAttribute("data-line-index"));
|
||||
_this.drag.currIndex = _currentIndex;
|
||||
} else {
|
||||
// console.log("onTrMouseDown dragborder or draggable is all false !");
|
||||
|
@ -108,6 +110,15 @@ var TableHeader = function (_Component) {
|
|||
}
|
||||
};
|
||||
|
||||
_this.getTargetToTh = function (targetEvent) {
|
||||
var th = targetEvent;
|
||||
if (targetEvent.nodeName.toUpperCase() != "TH") {
|
||||
th = _this.getThDome(targetEvent);
|
||||
}
|
||||
console.log(" getTargetToTh: ", th);
|
||||
return th;
|
||||
};
|
||||
|
||||
_this.onTrMouseMove = function (e) {
|
||||
if (!_this.props.dragborder && !_this.props.draggable) return;
|
||||
var _this$props2 = _this.props,
|
||||
|
@ -221,8 +232,9 @@ var TableHeader = function (_Component) {
|
|||
return;
|
||||
}
|
||||
var event = _utils.Event.getEvent(e),
|
||||
target = _utils.Event.getTarget(event);
|
||||
|
||||
// target = Event.getTarget(event);
|
||||
target = _this.getTargetToTh(_utils.Event.getTarget(event));
|
||||
var currentIndex = parseInt(target.getAttribute("data-line-index"));
|
||||
var currentKey = target.getAttribute('data-line-key');
|
||||
|
||||
|
@ -571,6 +583,11 @@ var TableHeader = function (_Component) {
|
|||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 判断当前的target 是否是 th,如果不是,直接递归查找。
|
||||
* @memberof TableHeader
|
||||
*/
|
||||
|
||||
/**
|
||||
* 调整列宽的move事件
|
||||
* @memberof TableHeader
|
||||
|
@ -667,6 +684,26 @@ var TableHeader = function (_Component) {
|
|||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据当前鼠标点击的节点,进行递归遍历,最终找到th
|
||||
* @param {*} element
|
||||
* @returns <th />对象
|
||||
* @memberof TableHeader
|
||||
*/
|
||||
|
||||
|
||||
TableHeader.prototype.getThDome = function getThDome(element) {
|
||||
var _tagName = element.tagName.toLowerCase();
|
||||
if (element.getAttribute('data-filter-type') === 'filterContext') return null;
|
||||
if (_tagName === 'i') return null;
|
||||
if (_tagName != 'th') {
|
||||
return this.getThDome(element.parentElement);
|
||||
} else {
|
||||
return element;
|
||||
}
|
||||
};
|
||||
|
||||
//---拖拽列交换----end-----
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,8 +42,15 @@ function singleSelect(Table, Radio) {
|
|||
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
||||
|
||||
_this.onRadioChange = function (value, record, index) {
|
||||
var selectedRowIndex = _this.state.selectedRowIndex;
|
||||
|
||||
if (selectedRowIndex === index) {
|
||||
_this.setState({ selectedRowIndex: '' });
|
||||
_this.props.getSelectedDataFunc();
|
||||
} else {
|
||||
_this.setState({ selectedRowIndex: index });
|
||||
_this.props.getSelectedDataFunc(record, index);
|
||||
}
|
||||
};
|
||||
|
||||
_this.getDefaultColumns = function (columns) {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bee-table",
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.3",
|
||||
"description": "Table ui component for react",
|
||||
"keywords": [
|
||||
"react",
|
||||
|
@ -56,7 +56,7 @@
|
|||
"bee-loading": "1.1.2",
|
||||
"bee-locale": "0.0.14",
|
||||
"bee-menus": "^2.0.6",
|
||||
"bee-radio": "2.0.10",
|
||||
"bee-radio": "^2.0.11",
|
||||
"bee-select": "^2.0.11",
|
||||
"classnames": "^2.2.5",
|
||||
"component-classes": "^1.2.6",
|
||||
|
|
|
@ -203,11 +203,13 @@ class TableHeader extends Component {
|
|||
this.drag.minWidth = currentObj.style.minWidth != ""?parseInt(currentObj.style.minWidth):defaultWidth;
|
||||
this.drag.tableWidth = parseInt(this.table.table.style.width ?this.table.table.style.width:this.table.table.scrollWidth);
|
||||
}else if(type != 'online' && this.props.draggable){
|
||||
if (!this.props.draggable || targetEvent.nodeName.toUpperCase() != "TH") return;
|
||||
targetEvent.setAttribute('draggable',true);//添加交换列效果
|
||||
// if (!this.props.draggable || targetEvent.nodeName.toUpperCase() != "TH") return;
|
||||
if (!this.props.draggable) return;
|
||||
let th = this.getTargetToTh(targetEvent);
|
||||
th.setAttribute('draggable',true);//添加交换列效果
|
||||
this.drag.option = 'dragAble';
|
||||
this.currentDome = event.target;
|
||||
let currentIndex = parseInt(currentElement.getAttribute("data-line-index"));
|
||||
this.currentDome = th;
|
||||
let currentIndex = parseInt(th.getAttribute("data-line-index"));
|
||||
this.drag.currIndex = currentIndex;
|
||||
}else{
|
||||
// console.log("onTrMouseDown dragborder or draggable is all false !");
|
||||
|
@ -215,6 +217,18 @@ class TableHeader extends Component {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 判断当前的target 是否是 th,如果不是,直接递归查找。
|
||||
* @memberof TableHeader
|
||||
*/
|
||||
getTargetToTh = (targetEvent) => {
|
||||
let th = targetEvent;
|
||||
if(targetEvent.nodeName.toUpperCase() != "TH"){
|
||||
th = this.getThDome(targetEvent);
|
||||
}
|
||||
console.log(" getTargetToTh: ", th);
|
||||
return th;
|
||||
}
|
||||
/**
|
||||
* 调整列宽的move事件
|
||||
* @memberof TableHeader
|
||||
|
@ -385,8 +399,8 @@ class TableHeader extends Component {
|
|||
if (!this.props.draggable) return;
|
||||
if(this.drag && this.drag.option != 'dragAble'){return;}
|
||||
let event = Event.getEvent(e) ,
|
||||
target = Event.getTarget(event);
|
||||
|
||||
// target = Event.getTarget(event);
|
||||
target = this.getTargetToTh(Event.getTarget(event));
|
||||
let currentIndex = parseInt(target.getAttribute("data-line-index"));
|
||||
let currentKey = target.getAttribute('data-line-key');
|
||||
|
||||
|
@ -485,6 +499,25 @@ class TableHeader extends Component {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前鼠标点击的节点,进行递归遍历,最终找到th
|
||||
* @param {*} element
|
||||
* @returns <th />对象
|
||||
* @memberof TableHeader
|
||||
*/
|
||||
getThDome(element){
|
||||
let _tagName = element.tagName.toLowerCase();
|
||||
if(element.getAttribute('data-filter-type') === 'filterContext')return null;
|
||||
if(_tagName === 'i')return null;
|
||||
if(_tagName != 'th'){
|
||||
return this.getThDome(element.parentElement);
|
||||
}else{
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//---拖拽列交换----end-----
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,9 +45,15 @@ export default function singleSelect(Table, Radio) {
|
|||
}
|
||||
|
||||
onRadioChange = (value, record, index) => {
|
||||
let { selectedRowIndex } = this.state;
|
||||
if(selectedRowIndex === index){
|
||||
this.setState({selectedRowIndex: ''});
|
||||
this.props.getSelectedDataFunc();
|
||||
}else{
|
||||
this.setState({selectedRowIndex: index});
|
||||
this.props.getSelectedDataFunc(record,index);
|
||||
}
|
||||
}
|
||||
|
||||
getDefaultColumns=(columns)=>{
|
||||
let {selectedRowIndex} = this.state;
|
||||
|
|
Loading…
Reference in New Issue