fix(默认宽度支持百分比计算;固定列渲染expand):

This commit is contained in:
wanghaoo 2018-09-18 10:36:42 +08:00
parent 2777f07372
commit 3887fde0ed
4 changed files with 11 additions and 5 deletions

View File

@ -213,13 +213,17 @@ var ColumnManager = function () {
this._cached = {};
};
ColumnManager.prototype.getColumnWidth = function getColumnWidth() {
ColumnManager.prototype.getColumnWidth = function getColumnWidth(contentWidth) {
var columns = this.groupedColumns();
var res = { computeWidth: 0, lastShowIndex: 0 };
columns.forEach(function (col, index) {
//如果列显示
if (col.ifshow) {
res.computeWidth += parseInt(col.width);
var width = col.width;
if (typeof width == 'string' && width.includes('%')) {
width = contentWidth * parseInt(col.width) / 100;
}
res.computeWidth += parseInt(width);
if (!col.fixed) {
res.lastShowIndex = index;
}

View File

@ -268,6 +268,8 @@
background: #f7f7f7; }
.u-table tr.u-table-expanded-row:hover {
background: #f7f7f7; }
.u-table tr.u-table-expanded-row .u-table {
z-index: 1; }
.u-table-column-hidden {
display: none; }
.u-table-prev-columns-page, .u-table-next-columns-page {

View File

@ -270,7 +270,7 @@ var Table = function (_Component) {
this.contentWidth = this.contentWidth * parseInt(setWidthParam) / 100;
}
}
var computeObj = this.columnManager.getColumnWidth();
var computeObj = this.columnManager.getColumnWidth(this.contentWidth);
var lastShowIndex = computeObj.lastShowIndex;
this.computeWidth = computeObj.computeWidth;
if (this.computeWidth < this.contentWidth) {
@ -450,7 +450,7 @@ var Table = function (_Component) {
props: {
colSpan: colCount
},
children: fixed !== 'right' ? content : contentContainer()
children: !fixed ? content : contentContainer()
};
}
}];

View File

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