MCPcopy Create free account
hub / github.com/Autodesk/react-base-table / constructor

Method constructor

src/BaseTable.js:58–146  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

56 */
57class BaseTable extends React.PureComponent {
58 constructor(props) {
59 super(props);
60
61 const { columns, children, defaultExpandedRowKeys } = props;
62 this.state = {
63 scrollbarSize: 0,
64 hoveredRowKey: null,
65 resizingKey: null,
66 resizingWidth: 0,
67 expandedRowKeys: cloneArray(defaultExpandedRowKeys),
68 };
69 this.columnManager = new ColumnManager(getColumns(columns, children), props.fixed);
70
71 this._setContainerRef = this._setContainerRef.bind(this);
72 this._setMainTableRef = this._setMainTableRef.bind(this);
73 this._setLeftTableRef = this._setLeftTableRef.bind(this);
74 this._setRightTableRef = this._setRightTableRef.bind(this);
75
76 this.renderExpandIcon = this.renderExpandIcon.bind(this);
77 this.renderRow = this.renderRow.bind(this);
78 this.renderRowCell = this.renderRowCell.bind(this);
79 this.renderHeader = this.renderHeader.bind(this);
80 this.renderHeaderCell = this.renderHeaderCell.bind(this);
81
82 this._handleScroll = this._handleScroll.bind(this);
83 this._handleVerticalScroll = this._handleVerticalScroll.bind(this);
84 this._handleRowsRendered = this._handleRowsRendered.bind(this);
85 this._handleRowHover = this._handleRowHover.bind(this);
86 this._handleRowExpand = this._handleRowExpand.bind(this);
87 this._handleColumnResize = throttle(this._handleColumnResize.bind(this), RESIZE_THROTTLE_WAIT);
88 this._handleColumnResizeStart = this._handleColumnResizeStart.bind(this);
89 this._handleColumnResizeStop = this._handleColumnResizeStop.bind(this);
90 this._handleColumnSort = this._handleColumnSort.bind(this);
91 this._handleFrozenRowHeightChange = this._handleFrozenRowHeightChange.bind(this);
92 this._handleRowHeightChange = this._handleRowHeightChange.bind(this);
93
94 this._getLeftTableContainerStyle = memoize(getContainerStyle);
95 this._getRightTableContainerStyle = memoize(getContainerStyle);
96 this._flattenOnKeys = memoize((tree, keys, dataKey) => {
97 this._depthMap = {};
98 return flattenOnKeys(tree, keys, this._depthMap, dataKey);
99 });
100 this._resetColumnManager = memoize(
101 (columns, fixed) => {
102 this.columnManager.reset(columns, fixed);
103
104 if (this.props.estimatedRowHeight && fixed) {
105 if (!this.columnManager.hasLeftFrozenColumns()) {
106 this._leftRowHeightMap = {};
107 }
108 if (!this.columnManager.hasRightFrozenColumns()) {
109 this._rightRowHeightMap = {};
110 }
111 }
112 },
113 (newArgs, lastArgs) => isObjectEqual(newArgs, lastArgs, this.props.ignoreFunctionInColumnCompare)
114 );
115

Callers

nothing calls this directly

Calls 10

resetAfterRowIndexMethod · 0.95
forceUpdateTableMethod · 0.95
cloneArrayFunction · 0.90
throttleFunction · 0.90
flattenOnKeysFunction · 0.90
isObjectEqualFunction · 0.90
debounceFunction · 0.90
resetMethod · 0.80
hasLeftFrozenColumnsMethod · 0.80
hasRightFrozenColumnsMethod · 0.80

Tested by

no test coverage detected