fix(合并列中计算lastShowIndex):
This commit is contained in:
parent
9b016901ae
commit
2aea757a7f
|
@ -214,7 +214,7 @@ var ColumnManager = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
ColumnManager.prototype.getColumnWidth = function getColumnWidth(contentWidth) {
|
ColumnManager.prototype.getColumnWidth = function getColumnWidth(contentWidth) {
|
||||||
var columns = this.groupedColumns();
|
var columns = this.leafColumns();
|
||||||
var res = { computeWidth: 0, lastShowIndex: 0 };
|
var res = { computeWidth: 0, lastShowIndex: 0 };
|
||||||
columns.forEach(function (col, index) {
|
columns.forEach(function (col, index) {
|
||||||
//如果列显示
|
//如果列显示
|
||||||
|
|
|
@ -617,6 +617,7 @@ var Table = function (_Component) {
|
||||||
|
|
||||||
Table.prototype.getColGroup = function getColGroup(columns, fixed) {
|
Table.prototype.getColGroup = function getColGroup(columns, fixed) {
|
||||||
var cols = [];
|
var cols = [];
|
||||||
|
var self = this;
|
||||||
var _state = this.state,
|
var _state = this.state,
|
||||||
_state$contentWidthDi = _state.contentWidthDiff,
|
_state$contentWidthDi = _state.contentWidthDiff,
|
||||||
contentWidthDiff = _state$contentWidthDi === undefined ? 0 : _state$contentWidthDi,
|
contentWidthDiff = _state$contentWidthDi === undefined ? 0 : _state$contentWidthDi,
|
||||||
|
@ -641,9 +642,15 @@ var Table = function (_Component) {
|
||||||
}
|
}
|
||||||
cols = cols.concat(leafColumns.map(function (c, i, arr) {
|
cols = cols.concat(leafColumns.map(function (c, i, arr) {
|
||||||
var width = c.width;
|
var width = c.width;
|
||||||
if (lastShowIndex == i) {
|
if (typeof width == 'string' && width.indexOf('%') > -1) {
|
||||||
width = parseInt(width) + contentWidthDiff;
|
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('col', { key: c.key, style: { width: width, minWidth: c.width } });
|
||||||
}));
|
}));
|
||||||
return _react2["default"].createElement(
|
return _react2["default"].createElement(
|
||||||
|
@ -725,6 +732,10 @@ var Table = function (_Component) {
|
||||||
tableStyle.width = _this3.contentWidth;
|
tableStyle.width = _this3.contentWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//自动出现滚动条
|
||||||
|
// if(this.contentDomWidth < this.contentWidth){
|
||||||
|
// tableStyle.width = this.contentWidth;
|
||||||
|
// }
|
||||||
var tableBody = hasBody ? getBodyWrapper(_react2["default"].createElement(
|
var tableBody = hasBody ? getBodyWrapper(_react2["default"].createElement(
|
||||||
'tbody',
|
'tbody',
|
||||||
{ className: clsPrefix + '-tbody' },
|
{ className: clsPrefix + '-tbody' },
|
||||||
|
|
|
@ -119,7 +119,7 @@ var TableHeader = function (_Component) {
|
||||||
_this.contentTableWidth = parseInt(contentTableDom.scrollWidth);
|
_this.contentTableWidth = parseInt(contentTableDom.scrollWidth);
|
||||||
}
|
}
|
||||||
var dragColWidth = _this.drag.data[_this.drag.currIndex].width;
|
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;
|
_this.drag.width = _this.contentTableWidth * parseInt(dragColWidth) / 100;
|
||||||
} else {
|
} else {
|
||||||
_this.drag.width = parseInt(_this.drag.data[_this.drag.currIndex].width);
|
_this.drag.width = parseInt(_this.drag.data[_this.drag.currIndex].width);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "bee-table",
|
"name": "bee-table",
|
||||||
"version": "1.4.9",
|
"version": "1.4.10",
|
||||||
"description": "Table ui component for react",
|
"description": "Table ui component for react",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
|
|
Loading…
Reference in New Issue