fix(合并列中计算lastShowIndex):

This commit is contained in:
wanghaoo 2018-10-08 15:41:14 +08:00
parent 9b016901ae
commit 2aea757a7f
4 changed files with 16 additions and 5 deletions

View File

@ -214,7 +214,7 @@ var ColumnManager = function () {
};
ColumnManager.prototype.getColumnWidth = function getColumnWidth(contentWidth) {
var columns = this.groupedColumns();
var columns = this.leafColumns();
var res = { computeWidth: 0, lastShowIndex: 0 };
columns.forEach(function (col, index) {
//如果列显示

View File

@ -617,6 +617,7 @@ var Table = function (_Component) {
Table.prototype.getColGroup = function getColGroup(columns, fixed) {
var cols = [];
var self = this;
var _state = this.state,
_state$contentWidthDi = _state.contentWidthDiff,
contentWidthDiff = _state$contentWidthDi === undefined ? 0 : _state$contentWidthDi,
@ -641,9 +642,15 @@ var Table = function (_Component) {
}
cols = cols.concat(leafColumns.map(function (c, i, arr) {
var width = c.width;
if (lastShowIndex == i) {
width = parseInt(width) + contentWidthDiff;
if (typeof width == 'string' && width.indexOf('%') > -1) {
width = parseInt(self.contentWidth * parseInt(width) / 100);
} else {
width = parseInt(width);
}
if (lastShowIndex == i) {
width = width + contentWidthDiff;
}
return _react2["default"].createElement('col', { key: c.key, style: { width: width, minWidth: c.width } });
}));
return _react2["default"].createElement(
@ -725,6 +732,10 @@ var Table = function (_Component) {
tableStyle.width = _this3.contentWidth;
}
}
//自动出现滚动条
// if(this.contentDomWidth < this.contentWidth){
// tableStyle.width = this.contentWidth;
// }
var tableBody = hasBody ? getBodyWrapper(_react2["default"].createElement(
'tbody',
{ className: clsPrefix + '-tbody' },

View File

@ -119,7 +119,7 @@ var TableHeader = function (_Component) {
_this.contentTableWidth = parseInt(contentTableDom.scrollWidth);
}
var dragColWidth = _this.drag.data[_this.drag.currIndex].width;
if (typeof dragColWidth == 'string' && dragColWidth.indexOf('%')) {
if (typeof dragColWidth == 'string' && dragColWidth.indexOf('%') > -1) {
_this.drag.width = _this.contentTableWidth * parseInt(dragColWidth) / 100;
} else {
_this.drag.width = parseInt(_this.drag.data[_this.drag.currIndex].width);

View File

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