{label}
@@ -331,14 +395,30 @@ export default class FilterableTable extends PureComponent {
);
}
- renderGridCell({ columnIndex, key, rowIndex, style }) {
+ renderGridCell({
+ columnIndex,
+ key,
+ rowIndex,
+ style,
+ }: {
+ columnIndex: number;
+ key: string;
+ rowIndex: number;
+ style: React.CSSProperties;
+ }) {
const columnKey = this.props.orderedColumnKeys[columnIndex];
const cellData = this.list.get(rowIndex)[columnKey];
const content = this.getCellContent({ cellData, columnKey });
const cellNode = (
{content}
@@ -362,14 +442,17 @@ export default class FilterableTable extends PureComponent {
let { height } = this.props;
let totalTableHeight = height;
- if (this.container && this.totalTableWidth > this.container.clientWidth) {
+ if (
+ this.container.current &&
+ this.totalTableWidth > this.container.current.clientWidth
+ ) {
// exclude the height of the horizontal scroll bar from the height of the table
// and the height of the table container if the content overflows
height -= SCROLL_BAR_HEIGHT;
totalTableHeight -= SCROLL_BAR_HEIGHT;
}
- const getColumnWidth = ({ index }) =>
+ const getColumnWidth = ({ index }: { index: number }) =>
this.widthsForColumnsByKey[orderedColumnKeys[index]];
// fix height of filterable table
@@ -413,7 +496,13 @@ export default class FilterableTable extends PureComponent {
);
}
- renderTableCell({ cellData, columnKey }) {
+ renderTableCell({
+ cellData,
+ columnKey,
+ }: {
+ cellData: CellDataType;
+ columnKey: string;
+ }) {
const cellNode = this.getCellContent({ cellData, columnKey });
const jsonObject = safeJsonObjectParse(cellData);
if (jsonObject) {
@@ -432,30 +521,33 @@ export default class FilterableTable extends PureComponent {
rowHeight,
} = this.props;
- let sortedAndFilteredList = this.list;
+ let sortedAndFilteredList: List
= this.list;
// filter list
if (filterText) {
- sortedAndFilteredList = this.list.filter(row =>
+ sortedAndFilteredList = this.list.filter((row: Datum) =>
this.hasMatch(filterText, row),
- );
+ ) as List;
}
// sort list
if (sortBy) {
sortedAndFilteredList = sortedAndFilteredList.sort(
this.sortResults(sortBy, sortDirection === SortDirection.DESC),
- );
+ ) as List;
}
let { height } = this.props;
let totalTableHeight = height;
- if (this.container && this.totalTableWidth > this.container.clientWidth) {
+ if (
+ this.container.current &&
+ this.totalTableWidth > this.container.current.clientWidth
+ ) {
// exclude the height of the horizontal scroll bar from the height of the table
// and the height of the table container if the content overflows
height -= SCROLL_BAR_HEIGHT;
totalTableHeight -= SCROLL_BAR_HEIGHT;
}
- const rowGetter = ({ index }) =>
+ const rowGetter = ({ index }: { index: number }) =>
this.getDatum(sortedAndFilteredList, index);
return (