bordered大数据下样式有问题

This commit is contained in:
wanghaoo 2018-12-24 17:13:56 +08:00
parent b9c66aed7f
commit 0f884679a5
8 changed files with 32 additions and 13 deletions

View File

@ -235,11 +235,17 @@ var ColumnManager = function () {
ColumnManager.prototype.getLeftColumnsWidth = function getLeftColumnsWidth() {
var _this13 = this;
var contentWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
return this._cache('leftColumnsWidth', function () {
var leftColumnsWidth = 0;
_this13.groupedColumns().forEach(function (column) {
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;
@ -249,11 +255,17 @@ var ColumnManager = function () {
ColumnManager.prototype.getRightColumnsWidth = function getRightColumnsWidth() {
var _this14 = this;
var contentWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
return this._cache('rightColumnsWidth', function () {
var rightColumnsWidth = 0;
_this14.groupedColumns().forEach(function (column) {
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;

View File

@ -864,12 +864,12 @@ var Table = function (_Component) {
if (scroll.x === true) {
tableStyle.tableLayout = 'fixed';
} 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) {
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(
'tbody',
@ -945,8 +945,8 @@ var Table = function (_Component) {
)
);
}
var leftFixedWidth = this.columnManager.getLeftColumnsWidth();
var rightFixedWidth = this.columnManager.getRightColumnsWidth();
var leftFixedWidth = this.columnManager.getLeftColumnsWidth(this.contentWidth);
var rightFixedWidth = this.columnManager.getRightColumnsWidth(this.contentWidth);
var parStyle = {};
if (!fixed) {
parStyle = { 'marginLeft': leftFixedWidth, 'marginRight': rightFixedWidth };

View File

@ -62,7 +62,9 @@ var defaultProps = {
expandIconColumnIndex: 0,
expandRowByClick: false,
onHover: function onHover() {}
onHover: function onHover() {},
className: ''
};
var TableRow = function (_Component) {

View File

@ -99,6 +99,7 @@ class Demo32 extends Component {
parentNodeId='parent'
scroll={{y:300}}
height={40}
bordered
onRowClick={(record, index, indent) => {
this.setState({
selectedRowIndex: index

File diff suppressed because one or more lines are too long

9
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -38,6 +38,7 @@ const defaultProps = {
expandIconColumnIndex: 0,
expandRowByClick: false,
onHover() {},
className:''
};
class TableRow extends Component{
@ -212,7 +213,7 @@ class TableRow extends Component{
style={style}
ref={this.bindElement}
>
{cells}
{cells.length>0?cells:<td></td>}
</tr>
);
}