()
| 357 | } |
| 358 | |
| 359 | render() { |
| 360 | const { |
| 361 | children, |
| 362 | className, |
| 363 | disableHeader, |
| 364 | gridClassName, |
| 365 | gridStyle, |
| 366 | headerHeight, |
| 367 | headerRowRenderer, |
| 368 | height, |
| 369 | id, |
| 370 | noRowsRenderer, |
| 371 | rowClassName, |
| 372 | rowStyle, |
| 373 | scrollToIndex, |
| 374 | style, |
| 375 | width, |
| 376 | } = this.props; |
| 377 | const {scrollbarWidth} = this.state; |
| 378 | |
| 379 | const availableRowsHeight = disableHeader ? height : height - headerHeight; |
| 380 | |
| 381 | const rowClass = |
| 382 | typeof rowClassName === 'function' |
| 383 | ? rowClassName({index: -1}) |
| 384 | : rowClassName; |
| 385 | const rowStyleObject = |
| 386 | typeof rowStyle === 'function' ? rowStyle({index: -1}) : rowStyle; |
| 387 | |
| 388 | // Precompute and cache column styles before rendering rows and columns to speed things up |
| 389 | this._cachedColumnStyles = []; |
| 390 | React.Children.toArray(children).forEach((column, index) => { |
| 391 | const flexStyles = this._getFlexStyleForColumn( |
| 392 | column, |
| 393 | column.props.style || Column.defaultProps.style, |
| 394 | ); |
| 395 | |
| 396 | this._cachedColumnStyles[index] = { |
| 397 | overflow: 'hidden', |
| 398 | ...flexStyles, |
| 399 | }; |
| 400 | }); |
| 401 | |
| 402 | // Note that we specify :rowCount, :scrollbarWidth, :sortBy, and :sortDirection as properties on Grid even though these have nothing to do with Grid. |
| 403 | // This is done because Grid is a pure component and won't update unless its properties or state has changed. |
| 404 | // Any property that should trigger a re-render of Grid then is specified here to avoid a stale display. |
| 405 | return ( |
| 406 | <div |
| 407 | aria-label={this.props['aria-label']} |
| 408 | aria-labelledby={this.props['aria-labelledby']} |
| 409 | aria-colcount={React.Children.toArray(children).length} |
| 410 | aria-rowcount={this.props.rowCount} |
| 411 | className={clsx('ReactVirtualized__Table', className)} |
| 412 | id={id} |
| 413 | role="grid" |
| 414 | style={style}> |
| 415 | {!disableHeader && |
| 416 | headerRowRenderer({ |
nothing calls this directly
no test coverage detected