fix(默认宽度支持百分比计算;固定列渲染expand):
This commit is contained in:
parent
2777f07372
commit
3887fde0ed
|
@ -213,13 +213,17 @@ var ColumnManager = function () {
|
||||||
this._cached = {};
|
this._cached = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
ColumnManager.prototype.getColumnWidth = function getColumnWidth() {
|
ColumnManager.prototype.getColumnWidth = function getColumnWidth(contentWidth) {
|
||||||
var columns = this.groupedColumns();
|
var columns = this.groupedColumns();
|
||||||
var res = { computeWidth: 0, lastShowIndex: 0 };
|
var res = { computeWidth: 0, lastShowIndex: 0 };
|
||||||
columns.forEach(function (col, index) {
|
columns.forEach(function (col, index) {
|
||||||
//如果列显示
|
//如果列显示
|
||||||
if (col.ifshow) {
|
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) {
|
if (!col.fixed) {
|
||||||
res.lastShowIndex = index;
|
res.lastShowIndex = index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,6 +268,8 @@
|
||||||
background: #f7f7f7; }
|
background: #f7f7f7; }
|
||||||
.u-table tr.u-table-expanded-row:hover {
|
.u-table tr.u-table-expanded-row:hover {
|
||||||
background: #f7f7f7; }
|
background: #f7f7f7; }
|
||||||
|
.u-table tr.u-table-expanded-row .u-table {
|
||||||
|
z-index: 1; }
|
||||||
.u-table-column-hidden {
|
.u-table-column-hidden {
|
||||||
display: none; }
|
display: none; }
|
||||||
.u-table-prev-columns-page, .u-table-next-columns-page {
|
.u-table-prev-columns-page, .u-table-next-columns-page {
|
||||||
|
|
|
@ -270,7 +270,7 @@ var Table = function (_Component) {
|
||||||
this.contentWidth = this.contentWidth * parseInt(setWidthParam) / 100;
|
this.contentWidth = this.contentWidth * parseInt(setWidthParam) / 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var computeObj = this.columnManager.getColumnWidth();
|
var computeObj = this.columnManager.getColumnWidth(this.contentWidth);
|
||||||
var lastShowIndex = computeObj.lastShowIndex;
|
var lastShowIndex = computeObj.lastShowIndex;
|
||||||
this.computeWidth = computeObj.computeWidth;
|
this.computeWidth = computeObj.computeWidth;
|
||||||
if (this.computeWidth < this.contentWidth) {
|
if (this.computeWidth < this.contentWidth) {
|
||||||
|
@ -450,7 +450,7 @@ var Table = function (_Component) {
|
||||||
props: {
|
props: {
|
||||||
colSpan: colCount
|
colSpan: colCount
|
||||||
},
|
},
|
||||||
children: fixed !== 'right' ? content : contentContainer()
|
children: !fixed ? content : contentContainer()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "bee-table",
|
"name": "bee-table",
|
||||||
"version": "1.4.2",
|
"version": "1.4.3",
|
||||||
"description": "Table ui component for react",
|
"description": "Table ui component for react",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
|
|
Loading…
Reference in New Issue