update to react-virtualized 9.5 (#15613)

This commit is contained in:
Kalle Ott 2017-04-17 18:10:46 +02:00 committed by Andy
parent 940b36aea4
commit 7aa9acc6b9
5 changed files with 21 additions and 10 deletions

View File

@ -126,16 +126,13 @@ export type GridCellRangeProps = {
scrollTop: number
}
export type GridCellRangeRenderer = (params: GridCellRangeProps) => React.ReactNode[];
// TODO add proper typing
export type GridProps = {
export type GridCoreProps = {
'aria-label'?: string;
autoContainerWidth?: boolean;
autoHeight?: boolean;
cellRenderer: GridCellRenderer;
cellRangeRenderer?: GridCellRangeRenderer;
className?: string;
columnCount: number;
columnWidth: number | ((params: Index) => number);
containerStyle?: React.CSSProperties;
deferredMeasurementCache?: CellMeasurerCache;
estimatedColumnSize?: number;
@ -143,6 +140,7 @@ export type GridProps = {
getScrollbarSize?: () => number;
height: number;
id?: string;
isScrolling?: boolean,
noContentRenderer?: () => React.ReactNode;
onScroll?: (params: ScrollParams) => any;
onSectionRendered?: (params: SectionRenderedParams) => any;
@ -160,6 +158,12 @@ export type GridProps = {
style?: React.CSSProperties;
tabIndex?: number;
width: number;
}
export type GridProps = GridCoreProps & {
cellRenderer: GridCellRenderer;
columnCount: number;
columnWidth: number | ((params: Index) => number);
};
export type ScrollDirection = 'horizontal' | 'vertical';
@ -274,6 +278,12 @@ export class Grid extends PureComponent<GridProps, GridState> {
*/
id: Requireable<string>,
/**
* Override internal is-scrolling state tracking.
* This property is primarily intended for use with the WindowScroller component.
*/
isScrolling: Requireable<boolean>,
/**
* Optional renderer to be used in place of rows when either :rowCount or :columnCount is 0.
*/

View File

@ -1,12 +1,12 @@
import { PureComponent, Validator, Requireable } from 'react'
import { Grid, GridCellProps } from './Grid'
import { Grid, GridCoreProps, GridCellProps } from './Grid'
import { Index, IndexRange, Alignment } from '../../index'
import { CellMeasurerCache } from './CellMeasurer'
export type ListRowProps = GridCellProps & { index: number, style: React.CSSProperties };
export type ListRowRenderer = (props: ListRowProps) => React.ReactNode;
export type ListProps = {
export type ListProps = GridCoreProps & {
deferredMeasurementCache?: CellMeasurerCache;
className?: string;
autoHeight?: boolean;

View File

@ -1,7 +1,7 @@
import { Validator, Requireable, PureComponent, Component } from 'react';
import { CellMeasurerCache } from './CellMeasurer';
import { Index, Alignment, ScrollEventData, IndexRange, OverscanIndexRange } from '../../index';
import { Grid } from './Grid';
import { Grid, GridCoreProps } from './Grid';
export type TableCellDataGetterParams = {
columnData?: any,
@ -155,7 +155,7 @@ export type HeaderMouseEventHandlerParams = {
}
// ref: https://github.com/bvaughn/react-virtualized/blob/master/docs/Table.md
export type TableProps = {
export type TableProps = GridCoreProps & {
deferredMeasurementCache?: CellMeasurerCache;
autoHeight?: boolean;
children?: React.ReactChildren;

View File

@ -1,4 +1,4 @@
// Type definitions for react-virtualized 9.4
// Type definitions for react-virtualized 9.5
// Project: https://github.com/bvaughn/react-virtualized
// Definitions by: Kalle Ott <https://github.com/kaoDev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

View File

@ -1700,6 +1700,7 @@ export class WindowScrollerExample extends PureComponent<any, any> {
autoHeight
className={'styles.List'}
height={height}
isScrolling={isScrolling}
overscanRowCount={2}
rowCount={list.size}
rowHeight={30}