fix(拖拽支持字符类型、滚动条错位问题):
This commit is contained in:
parent
ee05264459
commit
7263f78c13
|
@ -218,7 +218,7 @@
|
||||||
padding-right: 0px; }
|
padding-right: 0px; }
|
||||||
.u-table-fixed-header .u-table-body-inner {
|
.u-table-fixed-header .u-table-body-inner {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: auto; }
|
overflow: scroll; }
|
||||||
.u-table-fixed-header .u-table-scroll .u-table-header {
|
.u-table-fixed-header .u-table-scroll .u-table-header {
|
||||||
overflow-x: scroll;
|
overflow-x: scroll;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
|
@ -390,6 +390,9 @@
|
||||||
.u-table-thead-th .th-drag-gap-hover {
|
.u-table-thead-th .th-drag-gap-hover {
|
||||||
background: #ccc;
|
background: #ccc;
|
||||||
cursor: col-resize; }
|
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 {
|
.u-table-thead-th:last-child-drag-gap {
|
||||||
border: none; }
|
border: none; }
|
||||||
.u-table-filter-column-pop-cont {
|
.u-table-filter-column-pop-cont {
|
||||||
|
|
|
@ -110,7 +110,7 @@ var TableHeader = function (_Component) {
|
||||||
_this.drag.currIndex = _this.props.rows[0].findIndex(function (da) {
|
_this.drag.currIndex = _this.props.rows[0].findIndex(function (da) {
|
||||||
return da.key == data.key;
|
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 contentTableDom = document.getElementById("u-table-drag-thead-" + _this.theadKey).parentNode;
|
||||||
var styleWidth = contentTableDom.style.width;
|
var styleWidth = contentTableDom.style.width;
|
||||||
if (styleWidth && (typeof styleWidth == 'number' || styleWidth.includes('px'))) {
|
if (styleWidth && (typeof styleWidth == 'number' || styleWidth.includes('px'))) {
|
||||||
|
@ -118,6 +118,12 @@ var TableHeader = function (_Component) {
|
||||||
} else {
|
} else {
|
||||||
_this.contentTableWidth = parseInt(contentTableDom.scrollWidth);
|
_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) {
|
_this.onMouseUp = function (event, data) {
|
||||||
|
@ -365,11 +371,13 @@ var TableHeader = function (_Component) {
|
||||||
var thHover = da.drgHover ? ' ' + clsPrefix + '-thead th-drag-hover' : "";
|
var thHover = da.drgHover ? ' ' + clsPrefix + '-thead th-drag-hover' : "";
|
||||||
delete da.drgHover;
|
delete da.drgHover;
|
||||||
var fixedStyle = '';
|
var fixedStyle = '';
|
||||||
|
var canDotDrag = '';
|
||||||
if (!fixed && da.fixed) {
|
if (!fixed && da.fixed) {
|
||||||
fixedStyle = clsPrefix + '-row-fixed-columns-in-body';
|
fixedStyle = clsPrefix + '-row-fixed-columns-in-body';
|
||||||
}
|
}
|
||||||
if (lastShowIndex == i) {
|
if (lastShowIndex == i) {
|
||||||
da.width = parseInt(da.width) + contentWidthDiff;
|
da.width = parseInt(da.width) + contentWidthDiff;
|
||||||
|
canDotDrag = 'th-can-not-drag';
|
||||||
}
|
}
|
||||||
if (draggable) {
|
if (draggable) {
|
||||||
return _react2["default"].createElement('th', _extends({}, da, {
|
return _react2["default"].createElement('th', _extends({}, da, {
|
||||||
|
@ -400,7 +408,7 @@ var TableHeader = function (_Component) {
|
||||||
onMouseUp: function onMouseUp(event) {
|
onMouseUp: function onMouseUp(event) {
|
||||||
_this2.onThMouseUp(event, da);
|
_this2.onThMouseUp(event, da);
|
||||||
},
|
},
|
||||||
className: da.className + ' ' + clsPrefix + '-thead-th ' + fixedStyle,
|
className: da.className + ' ' + clsPrefix + '-thead-th ' + canDotDrag + ' ' + fixedStyle,
|
||||||
key: i },
|
key: i },
|
||||||
da.children,
|
da.children,
|
||||||
_react2["default"].createElement('div', { ref: function ref(el) {
|
_react2["default"].createElement('div', { ref: function ref(el) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "bee-table",
|
"name": "bee-table",
|
||||||
"version": "1.4.7",
|
"version": "1.4.8",
|
||||||
"description": "Table ui component for react",
|
"description": "Table ui component for react",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
|
|
Loading…
Reference in New Issue