fix:配置的行高,优先级大于height

This commit is contained in:
yangchch6 2019-11-12 14:56:22 +08:00
parent c805b95e7e
commit 04fd93bc4b
7 changed files with 17 additions and 13 deletions

View File

@ -599,7 +599,7 @@ var Table = function (_Component) {
// const trStyle = headerHeight&&!fixed ? { height: headerHeight } : (fixed ? this.getHeaderRowStyle(columns, rows) : null);
var trStyle = fixed ? this.getHeaderRowStyle(columns, rows) : headerHeight ? { height: headerHeight } : null;
if (!fixed && tableSizeConf && tableSizeConf.headerHeight) {
if (tableSizeConf && tableSizeConf.headerHeight) {
trStyle = {
height: tableSizeConf.headerHeight,
fontSize: tableSizeConf.fontSize
@ -849,7 +849,7 @@ var Table = function (_Component) {
height = fixedColumnsBodyRowsHeight[fixedIndex];
}
// 如果切换了配置,以自定义配置的高度为准
if (!fixed && !props.heightConsistent && tableSizeConf && tableSizeConf.headerHeight) {
if (tableSizeConf && tableSizeConf.headerHeight) {
height = tableSizeConf.height;
}

View File

@ -8,7 +8,7 @@ import React, { Component } from "react";
import Table from "../../src";
const columns = [
{ title: "订单编号", dataIndex: "orderNum", key: "orderNum", width: 100 },
{ title: "订单编号", dataIndex: "orderNum", key: "orderNum", fixed: 'left',width: 100 },
{ title: "采购组织", dataIndex: "org", key: "org", width: 200 },
{ title: "供应商", dataIndex: "supplier", key: "supplier", width: 100 },
{ title: "订单日期", dataIndex: "orderDate", key: "orderDate", width: 150 },
@ -16,7 +16,7 @@ const columns = [
{ title: "单据状态", dataIndex: "status", key: "status", width: 100 },
{ title: "提交人", dataIndex: "submitter", key: "submitter", width: 100 },
{ title: "单位", dataIndex: "unit", key: "unit", width: 100 },
{ title: "总税价合计", dataIndex: "sum", key: "sum", width: 100 },
{ title: "总税价合计", dataIndex: "sum", key: "sum", fixed: 'right', width: 100 },
];
const data = [
@ -79,6 +79,8 @@ class Demo0 extends Component {
<Table
canConfigureTableSize={true}
getToolbarContainer={this.getToolbarContainer}
height={30}
headerHeight={35}
columns={columns}
data={data}
onRowClick={(record, index, indent) => {

File diff suppressed because one or more lines are too long

10
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

@ -1,6 +1,6 @@
{
"name": "bee-table",
"version": "2.0.8-nc.10",
"version": "2.0.8-nc.11",
"description": "Table ui component for react",
"keywords": [
"react",

View File

@ -378,7 +378,7 @@ class Table extends Component {
// const trStyle = headerHeight&&!fixed ? { height: headerHeight } : (fixed ? this.getHeaderRowStyle(columns, rows) : null);
let trStyle = fixed ? this.getHeaderRowStyle(columns, rows) : ( headerHeight ? { height: headerHeight } : null );
if( !fixed && tableSizeConf && tableSizeConf.headerHeight ){
if( tableSizeConf && tableSizeConf.headerHeight ){
trStyle = {
height : tableSizeConf.headerHeight,
fontSize : tableSizeConf.fontSize
@ -614,7 +614,7 @@ class Table extends Component {
height = fixedColumnsBodyRowsHeight[fixedIndex];
}
// 如果切换了配置,以自定义配置的高度为准
if( !fixed && !props.heightConsistent && tableSizeConf && tableSizeConf.headerHeight ){
if( tableSizeConf && tableSizeConf.headerHeight ){
height = tableSizeConf.height;
}