bordered大数据下样式有问题
This commit is contained in:
parent
b9c66aed7f
commit
0f884679a5
|
@ -235,11 +235,17 @@ var ColumnManager = function () {
|
||||||
ColumnManager.prototype.getLeftColumnsWidth = function getLeftColumnsWidth() {
|
ColumnManager.prototype.getLeftColumnsWidth = function getLeftColumnsWidth() {
|
||||||
var _this13 = this;
|
var _this13 = this;
|
||||||
|
|
||||||
|
var contentWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
||||||
|
|
||||||
return this._cache('leftColumnsWidth', function () {
|
return this._cache('leftColumnsWidth', function () {
|
||||||
var leftColumnsWidth = 0;
|
var leftColumnsWidth = 0;
|
||||||
_this13.groupedColumns().forEach(function (column) {
|
_this13.groupedColumns().forEach(function (column) {
|
||||||
if (column.fixed === 'left' || column.fixed === true) {
|
if (column.fixed === 'left' || column.fixed === true) {
|
||||||
leftColumnsWidth += column.width;
|
var width = column.width;
|
||||||
|
if (typeof width == 'string' && width.includes('%')) {
|
||||||
|
width = contentWidth * parseInt(col.width) / 100;
|
||||||
|
}
|
||||||
|
leftColumnsWidth += parseInt(width);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return leftColumnsWidth;
|
return leftColumnsWidth;
|
||||||
|
@ -249,11 +255,17 @@ var ColumnManager = function () {
|
||||||
ColumnManager.prototype.getRightColumnsWidth = function getRightColumnsWidth() {
|
ColumnManager.prototype.getRightColumnsWidth = function getRightColumnsWidth() {
|
||||||
var _this14 = this;
|
var _this14 = this;
|
||||||
|
|
||||||
|
var contentWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
||||||
|
|
||||||
return this._cache('rightColumnsWidth', function () {
|
return this._cache('rightColumnsWidth', function () {
|
||||||
var rightColumnsWidth = 0;
|
var rightColumnsWidth = 0;
|
||||||
_this14.groupedColumns().forEach(function (column) {
|
_this14.groupedColumns().forEach(function (column) {
|
||||||
if (column.fixed === 'right') {
|
if (column.fixed === 'right') {
|
||||||
rightColumnsWidth += column.width;
|
var width = column.width;
|
||||||
|
if (typeof width == 'string' && width.includes('%')) {
|
||||||
|
width = contentWidth * parseInt(col.width) / 100;
|
||||||
|
}
|
||||||
|
rightColumnsWidth += parseInt(width);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return rightColumnsWidth;
|
return rightColumnsWidth;
|
||||||
|
|
|
@ -864,12 +864,12 @@ var Table = function (_Component) {
|
||||||
if (scroll.x === true) {
|
if (scroll.x === true) {
|
||||||
tableStyle.tableLayout = 'fixed';
|
tableStyle.tableLayout = 'fixed';
|
||||||
} else {
|
} else {
|
||||||
tableStyle.width = _this4.contentWidth - _this4.columnManager.getLeftColumnsWidth() - _this4.columnManager.getRightColumnsWidth();
|
tableStyle.width = _this4.contentWidth - _this4.columnManager.getLeftColumnsWidth(_this4.contentWidth) - _this4.columnManager.getRightColumnsWidth(_this4.contentWidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 自动出现滚动条
|
// 自动出现滚动条
|
||||||
if (!fixed && _this4.contentDomWidth < _this4.contentWidth) {
|
if (!fixed && _this4.contentDomWidth < _this4.contentWidth) {
|
||||||
tableStyle.width = _this4.contentWidth - _this4.columnManager.getLeftColumnsWidth() - _this4.columnManager.getRightColumnsWidth();
|
tableStyle.width = _this4.contentWidth - _this4.columnManager.getLeftColumnsWidth(_this4.contentWidth) - _this4.columnManager.getRightColumnsWidth(_this4.contentWidth);
|
||||||
}
|
}
|
||||||
var tableBody = hasBody ? getBodyWrapper(_react2["default"].createElement(
|
var tableBody = hasBody ? getBodyWrapper(_react2["default"].createElement(
|
||||||
'tbody',
|
'tbody',
|
||||||
|
@ -945,8 +945,8 @@ var Table = function (_Component) {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
var leftFixedWidth = this.columnManager.getLeftColumnsWidth();
|
var leftFixedWidth = this.columnManager.getLeftColumnsWidth(this.contentWidth);
|
||||||
var rightFixedWidth = this.columnManager.getRightColumnsWidth();
|
var rightFixedWidth = this.columnManager.getRightColumnsWidth(this.contentWidth);
|
||||||
var parStyle = {};
|
var parStyle = {};
|
||||||
if (!fixed) {
|
if (!fixed) {
|
||||||
parStyle = { 'marginLeft': leftFixedWidth, 'marginRight': rightFixedWidth };
|
parStyle = { 'marginLeft': leftFixedWidth, 'marginRight': rightFixedWidth };
|
||||||
|
|
|
@ -62,7 +62,9 @@ var defaultProps = {
|
||||||
|
|
||||||
expandIconColumnIndex: 0,
|
expandIconColumnIndex: 0,
|
||||||
expandRowByClick: false,
|
expandRowByClick: false,
|
||||||
onHover: function onHover() {}
|
onHover: function onHover() {},
|
||||||
|
|
||||||
|
className: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
var TableRow = function (_Component) {
|
var TableRow = function (_Component) {
|
||||||
|
|
|
@ -99,6 +99,7 @@ class Demo32 extends Component {
|
||||||
parentNodeId='parent'
|
parentNodeId='parent'
|
||||||
scroll={{y:300}}
|
scroll={{y:300}}
|
||||||
height={40}
|
height={40}
|
||||||
|
bordered
|
||||||
onRowClick={(record, index, indent) => {
|
onRowClick={(record, index, indent) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
selectedRowIndex: index
|
selectedRowIndex: index
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -38,6 +38,7 @@ const defaultProps = {
|
||||||
expandIconColumnIndex: 0,
|
expandIconColumnIndex: 0,
|
||||||
expandRowByClick: false,
|
expandRowByClick: false,
|
||||||
onHover() {},
|
onHover() {},
|
||||||
|
className:''
|
||||||
};
|
};
|
||||||
|
|
||||||
class TableRow extends Component{
|
class TableRow extends Component{
|
||||||
|
@ -212,7 +213,7 @@ class TableRow extends Component{
|
||||||
style={style}
|
style={style}
|
||||||
ref={this.bindElement}
|
ref={this.bindElement}
|
||||||
>
|
>
|
||||||
{cells}
|
{cells.length>0?cells:<td></td>}
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue