diff --git a/build/Table.css b/build/Table.css index 41cf509..f6b4f0c 100644 --- a/build/Table.css +++ b/build/Table.css @@ -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 { diff --git a/build/TableHeader.js b/build/TableHeader.js index 17edef2..ceee73b 100644 --- a/build/TableHeader.js +++ b/build/TableHeader.js @@ -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) { diff --git a/package.json b/package.json index 1670ab9..099756d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bee-table", - "version": "1.4.7", + "version": "1.4.8", "description": "Table ui component for react", "keywords": [ "react",