publish 2.1.2

This commit is contained in:
jonyshi 2019-06-06 16:15:47 +08:00
parent cab1f66b56
commit 8dd48af754
8 changed files with 95193 additions and 31096 deletions

View File

@ -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);

View File

@ -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-----
/**

File diff suppressed because one or more lines are too long

6
dist/demo.css vendored
View File

@ -142,6 +142,12 @@
.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%;
transform: translate(-50%, -50%); }
@keyframes line-scale {
0% {
transform: scaley(1); }

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

126221
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

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