-
Notifications
You must be signed in to change notification settings - Fork 375
/
table-layout.types.ts
75 lines (69 loc) · 2.26 KB
/
table-layout.types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import {
TableRow, TableColumn, ColumnAnimationStyleMap, GetCellColSpanFn, TableProps,
LEFT_POSITION, RIGHT_POSITION,
} from '../index';
type tableLayoutComponents = 'containerComponent' | 'tableComponent'
| 'headComponent' | 'bodyComponent' | 'footerComponent';
type placeholderComponents = 'rowComponent'
| 'cellComponent';
type Partialize<T> = {
[K in keyof T]: T[K] extends React.ComponentType<infer U> ? React.ComponentType<Partial<U>> : T[K]
};
/** @internal */
export type TableLayoutProps =
Pick<TableProps, tableLayoutComponents> & Partialize<Pick<TableProps, placeholderComponents>> & {
headerRows: TableRow[],
bodyRows: TableRow[],
footerRows: TableRow[],
columns: TableColumn[],
minWidth?: string,
minColumnWidth?: number,
isFixed?: boolean,
getCellColSpan?: GetCellColSpanFn,
tableRef?: React.RefObject<HTMLTableElement>,
forwardedRef?: React.MutableRefObject<any> | React.RefCallback<any> | null,
};
/** @internal */
export type TableLayoutCoreProps = TableLayoutProps & {
layoutComponent: React.ComponentType<TableLayoutProps>,
minColumnWidth: number,
columns: TableColumn[],
};
/** @internal */
export type TableLayoutCoreState = {
animationState: ColumnAnimationStyleMap,
};
/** @internal */
export interface VirtualTableLayoutProps extends TableLayoutProps {
height: number | 'auto';
estimatedRowHeight: number;
footerTableComponent: React.ComponentType<object>;
totalRowCount: number;
loadedRowsStart: number;
isDataRemote: boolean;
setViewport: any;
viewport: any;
scrollTop?: number;
nextColumnId?: typeof LEFT_POSITION | typeof RIGHT_POSITION | undefined;
}
/** @internal */
export type VirtualTableLayoutState = {
rowHeights: Map<any, number>,
viewportTop: number,
skipItems: [number, number],
containerHeight: number,
containerWidth: number,
viewportLeft: number,
};
type virtualBlockProps = placeholderComponents | 'tableRef' | 'minWidth' | 'bodyComponent';
/** @internal */
export type VirtualTableLayoutBlockProps = Pick<VirtualTableLayoutProps, virtualBlockProps> & {
name: string,
isFixed?: boolean,
collapsedGrid: {
columns: any,
rows: any,
},
rowRefsHandler: (row: any, ref?: React.ReactInstance | null) => void,
tableRef?: React.RefObject<HTMLTableElement>,
};