Skip to content

Commit 3e3ed11

Browse files
authored
Merge pull request #11 from datafold/sergey-revert-bad-code
Revert "Virtualize columns"
2 parents e23f60c + b26b21b commit 3e3ed11

File tree

5 files changed

+8
-38
lines changed

5 files changed

+8
-38
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@datafoldcom/react-base-table",
3-
"version": "1.15.3",
3+
"version": "1.15.4",
44
"description": "a react table component to display large data set with high performance and flexibility, forked from https://github.com/Autodesk/react-base-table.git",
55
"main": "lib/index.js",
66
"module": "es/index.js",

src/BaseTable.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,6 @@ BaseTable.defaultProps = {
10881088
sortBy: {},
10891089
useIsScrolling: false,
10901090
overscanRowCount: 1,
1091-
overscanColumnCount: 1,
10921091
onEndReachedThreshold: 500,
10931092
getScrollbarSize: defaultGetScrollbarSize,
10941093
ignoreFunctionInColumnCompare: true,
@@ -1302,14 +1301,6 @@ BaseTable.propTypes = {
13021301
* Number of rows to render above/below the visible bounds of the list
13031302
*/
13041303
overscanRowCount: PropTypes.number,
1305-
/**
1306-
* Number of columns to render left/right the visible bounds of the list
1307-
*/
1308-
overscanColumnCount: PropTypes.number,
1309-
/**
1310-
* Array of column widths, when column virtualization is required
1311-
*/
1312-
columnWidths: PropTypes.arrayOf(PropTypes.number),
13131304
/**
13141305
* Custom scrollbar size measurement
13151306
*/

src/GridTable.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,6 @@ class GridTable extends React.PureComponent {
7474
return rowRenderer({ ...args, columns, rowData });
7575
}
7676

77-
getColumnWidthFunction(columnWidths) {
78-
return (index) => columnWidths[index];
79-
}
80-
81-
getColumnCount() {
82-
return this.props.columnWidths && Array.isArray(this.props.columnWidths) ? this.props.columnWidths.length : 1
83-
}
84-
8577
render() {
8678
const {
8779
containerStyle,
@@ -100,20 +92,17 @@ class GridTable extends React.PureComponent {
10092
onScroll,
10193
hoveredRowKey,
10294
overscanRowCount,
103-
overscanColumnCount,
10495
// omit from rest
10596
style,
10697
onScrollbarPresenceChange,
107-
columnWidths,
10898
...rest
10999
} = this.props;
110100
const headerHeight = this._getHeaderHeight();
111101
const frozenRowCount = frozenData.length;
112102
const frozenRowsHeight = rowHeight * frozenRowCount;
113103
const cls = cn(`${classPrefix}__table`, className);
114104
const containerProps = containerStyle ? { style: containerStyle } : null;
115-
const Grid = (estimatedRowHeight || columnWidths) ? VariableSizeGrid : FixedSizeGrid;
116-
const columnCount = this.getColumnCount();
105+
const Grid = estimatedRowHeight ? VariableSizeGrid : FixedSizeGrid;
117106

118107
this._resetColumnWidthCache(bodyWidth);
119108
return (
@@ -128,13 +117,13 @@ class GridTable extends React.PureComponent {
128117
frozenData={frozenData}
129118
width={width}
130119
height={Math.max(height - headerHeight - frozenRowsHeight, 0)}
131-
rowHeight={(estimatedRowHeight || columnWidths) ? (getRowHeight ? getRowHeight : () => rowHeight) : rowHeight}
120+
rowHeight={estimatedRowHeight ? getRowHeight : rowHeight}
132121
estimatedRowHeight={typeof estimatedRowHeight === 'function' ? undefined : estimatedRowHeight}
133122
rowCount={data.length}
134123
overscanRowCount={overscanRowCount}
135-
columnWidth={columnWidths ? this.getColumnWidthFunction(columnWidths) : estimatedRowHeight ? this._getBodyWidth : bodyWidth}
136-
columnCount={columnCount}
137-
overscanColumnCount={overscanColumnCount}
124+
columnWidth={estimatedRowHeight ? this._getBodyWidth : bodyWidth}
125+
columnCount={1}
126+
overscanColumnCount={0}
138127
useIsScrolling={useIsScrolling}
139128
hoveredRowKey={hoveredRowKey}
140129
onScroll={onScroll}
@@ -221,15 +210,13 @@ GridTable.propTypes = {
221210
rowKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
222211
useIsScrolling: PropTypes.bool,
223212
overscanRowCount: PropTypes.number,
224-
overscanColumnCount: PropTypes.number,
225213
hoveredRowKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
226214
style: PropTypes.object,
227215
onScrollbarPresenceChange: PropTypes.func,
228216
onScroll: PropTypes.func,
229217
onRowsRendered: PropTypes.func,
230218
headerRenderer: PropTypes.func.isRequired,
231219
rowRenderer: PropTypes.func.isRequired,
232-
columnWidths: PropTypes.arrayOf(PropTypes.number),
233220
};
234221

235222
export default GridTable;

types/index.d.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -426,14 +426,6 @@ declare module '@datafoldcom/react-base-table' {
426426
* Number of rows to render above/below the visible bounds of the list
427427
*/
428428
overscanRowCount?: number;
429-
/**
430-
* Number of columns to render left/right the visible bounds of the list
431-
*/
432-
overscanColumnCount?: number;
433-
/**
434-
* Array of column widths, when column virtualization is required
435-
*/
436-
columnWidths?: number[];
437429
/**
438430
* Custom scrollbar size measurement
439431
*/

0 commit comments

Comments
 (0)