Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render() {
if (this.props.width !== null) {
return this.renderTable(this.props.width);
}
return (
{({ width }) => this.renderTable(width)}
);
}
}
BpkDataTable.propTypes = {
..._omit(Table.propTypes, omittedTableProps),
rows: PropTypes.arrayOf(Object).isRequired,
children: hasChildrenOfType(BpkDataTableColumn),
width: PropTypes.number,
headerHeight: PropTypes.number,
className: PropTypes.string,
defaultColumnSortIndex: PropTypes.number,
};
BpkDataTable.defaultProps = {
...Table.defaultProps,
width: null,
headerHeight: 60,
rowHeight: 60,
gridStyle: { direction: undefined }, // This is required for rows to automatically respect rtl
defaultColumnSortIndex: 0,
};
// @flow
import * as React from 'react';
import styled from 'styled-components';
import {
type TableProps,
Table as BaseTable,
} from 'react-virtualized';
import '../style.css';
import defaultRowRenderer from './defaultRowRenderer';
import defaultHeaderRowRenderer from './defaultHeaderRowRenderer';
/* eslint-disable react/forbid-foreign-prop-types */
BaseTable.propTypes.children = () => {};
/* eslint-enable */
const StyledTable: React.ComponentType = styled(
BaseTable,
)``;
type Props = TableProps & {
hasHorizontalBorder?: boolean,
striped?: boolean,
};
class SimpleTable extends React.Component {
static defaultProps = {
...BaseTable.defaultProps,
rowRenderer: defaultRowRenderer,
headerRowRenderer: defaultHeaderRowRenderer,