fix(拖拽支持字符类型、滚动条错位问题):

This commit is contained in:
wanghaoo 2018-09-30 11:08:05 +08:00
parent ee05264459
commit 7263f78c13
3 changed files with 15 additions and 4 deletions

View File

@ -218,7 +218,7 @@
padding-right: 0px; }
.u-table-fixed-header .u-table-body-inner {
height: 100%;
overflow: auto; }
overflow: scroll; }
.u-table-fixed-header .u-table-scroll .u-table-header {
overflow-x: scroll;
padding-bottom: 20px;
@ -390,6 +390,9 @@
.u-table-thead-th .th-drag-gap-hover {
background: #ccc;
cursor: col-resize; }
.u-table-thead-th.th-can-not-drag .th-drag-gap-hover {
cursor: none;
width: 0px; }
.u-table-thead-th:last-child-drag-gap {
border: none; }
.u-table-filter-column-pop-cont {

View File

@ -110,7 +110,7 @@ var TableHeader = function (_Component) {
_this.drag.currIndex = _this.props.rows[0].findIndex(function (da) {
return da.key == data.key;
});
_this.drag.width = _this.drag.data[_this.drag.currIndex].width;
var contentTableDom = document.getElementById("u-table-drag-thead-" + _this.theadKey).parentNode;
var styleWidth = contentTableDom.style.width;
if (styleWidth && (typeof styleWidth == 'number' || styleWidth.includes('px'))) {
@ -118,6 +118,12 @@ var TableHeader = function (_Component) {
} else {
_this.contentTableWidth = parseInt(contentTableDom.scrollWidth);
}
var dragColWidth = _this.drag.data[_this.drag.currIndex].width;
if (typeof dragColWidth == 'string' && dragColWidth.indexOf('%')) {
_this.drag.width = _this.contentTableWidth * parseInt(dragColWidth) / 100;
} else {
_this.drag.width = parseInt(_this.drag.data[_this.drag.currIndex].width);
}
};
_this.onMouseUp = function (event, data) {
@ -365,11 +371,13 @@ var TableHeader = function (_Component) {
var thHover = da.drgHover ? ' ' + clsPrefix + '-thead th-drag-hover' : "";
delete da.drgHover;
var fixedStyle = '';
var canDotDrag = '';
if (!fixed && da.fixed) {
fixedStyle = clsPrefix + '-row-fixed-columns-in-body';
}
if (lastShowIndex == i) {
da.width = parseInt(da.width) + contentWidthDiff;
canDotDrag = 'th-can-not-drag';
}
if (draggable) {
return _react2["default"].createElement('th', _extends({}, da, {
@ -400,7 +408,7 @@ var TableHeader = function (_Component) {
onMouseUp: function onMouseUp(event) {
_this2.onThMouseUp(event, da);
},
className: da.className + ' ' + clsPrefix + '-thead-th ' + fixedStyle,
className: da.className + ' ' + clsPrefix + '-thead-th ' + canDotDrag + ' ' + fixedStyle,
key: i },
da.children,
_react2["default"].createElement('div', { ref: function ref(el) {

View File

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