Skip to content

Commit

Permalink
fix: revert #831 (#1244)
Browse files Browse the repository at this point in the history
  • Loading branch information
amje authored Jan 15, 2024
1 parent 9693147 commit 79f7e07
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,29 +336,6 @@ export class Table<I extends TableDataItem = Record<string, string>> extends Rea
);
}

private renderColgroup() {
const {columns} = this.props;
const {columnsStyles} = this.state;

if (!columnsStyles.length) {
return null;
}

return (
<colgroup>
{columnsStyles.flatMap(({width}, index) => {
const key = columns[index]?.id;

if (!key) {
return [];
}

return <col style={{width}} key={key} />;
})}
</colgroup>
);
}

private renderHead() {
const {columns, edgePadding, wordWrap} = this.props;
const {columnsStyles} = this.state;
Expand All @@ -374,7 +351,7 @@ export class Table<I extends TableDataItem = Record<string, string>> extends Rea
<th
key={id}
ref={this.state.columnHeaderRefs[index]}
style={this.getCellStyles(columnsStyles[index])}
style={columnsStyles[index]}
className={b(
'cell',
{
Expand Down Expand Up @@ -409,7 +386,6 @@ export class Table<I extends TableDataItem = Record<string, string>> extends Rea
private renderTable() {
return (
<table ref={this.tableRef} className={b('table')}>
{this.renderColgroup()}
{this.renderHead()}
{this.renderBody()}
</table>
Expand Down Expand Up @@ -469,7 +445,7 @@ export class Table<I extends TableDataItem = Record<string, string>> extends Rea
return (
<td
key={id}
style={this.getCellStyles(columnsStyles[colIndex])}
style={columnsStyles[colIndex]}
className={b(
'cell',
{
Expand Down Expand Up @@ -559,14 +535,6 @@ export class Table<I extends TableDataItem = Record<string, string>> extends Rea
return style;
}

private getCellStyles(
columnStyles: React.CSSProperties | undefined,
): React.CSSProperties | undefined {
const {width: _width, ...styles} = columnStyles || {};

return Object.keys(styles).length ? styles : undefined;
}

private handleScrollContainerMouseenter = () => {
this.setState({activeScrollElement: 'scrollContainer'});
};
Expand Down

0 comments on commit 79f7e07

Please sign in to comment.