-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathTreeTableHeader.tsx
45 lines (35 loc) · 1.01 KB
/
TreeTableHeader.tsx
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
import React, { Component, CSSProperties } from 'react';
import HeaderCellWrapper from './HeaderCellWrapper';
import { ColumnProps } from './Column';
export type TreeTableHeaderProps<TData> = {
columns: Array<ColumnProps<TData>>;
height?: number;
}
export default class TreeTableHeader<TData> extends Component<TreeTableHeaderProps<TData>, {}> {
static defaultProps = {
height: 26,
};
render() {
const { columns, height } = this.props;
return (
<div className="cp_tree-table_header"
style={{ ...STYLE_ROW, height: `${height}px` }}>
{columns.map((column: ColumnProps<TData>, indexKey) => {
return (
<HeaderCellWrapper key={indexKey}
renderHeaderCell={column.renderHeaderCell}
grow={column.grow}
basis={column.basis}/>
);
})}
</div>
);
}
}
const STYLE_ROW: CSSProperties = {
display: 'flex',
boxSizing: 'border-box',
position: 'relative',
overflow: 'hidden',
width: '100%',
};