UNPKG

react-flexigrid

Version:

A React table component designed to allow presenting millions of rows of data.

97 lines (84 loc) 3.27 kB
import _extends from 'babel-runtime/helpers/extends'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import React from 'react'; import PropTypes from 'prop-types'; import propTypes from './struct/propTypes'; import { shouldUpdateBody } from './FlexiGridUpdateHelper'; import FlexiGridBufferedRows from './FlexiGridBufferedRows'; var FlexiGridBody = function (_React$Component) { _inherits(FlexiGridBody, _React$Component); function FlexiGridBody() { _classCallCheck(this, FlexiGridBody); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } FlexiGridBody.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) { return shouldUpdateBody(this.props, nextProps); }; FlexiGridBody.prototype.renderRows = function renderRows() { return React.createElement(FlexiGridBufferedRows, _extends({}, this.props, { rowCount: this.props.data.length, defaultRowHeight: this.props.rowHeight })); }; FlexiGridBody.prototype.render = function render() { var _props = this.props, prefixCls = _props.prefixCls, width = _props.width, height = _props.height, data = _props.data; return React.createElement( 'div', { className: prefixCls + '-body', style: { width: width, height: height } }, data && data.length ? this.renderRows() : null ); }; return FlexiGridBody; }(React.Component); FlexiGridBody.PROPTYPES_DISABLED_FOR_PERFORMANCE = { prefixCls: PropTypes.string, rowHeight: PropTypes.number, bordered: PropTypes.bool, scrollX: PropTypes.number, showScrollbarX: PropTypes.bool, showScrollbarY: PropTypes.bool, isJustFullfill: PropTypes.bool, width: PropTypes.number, height: PropTypes.number, data: propTypes.data, rowKey: propTypes.columnKey, firstRowIndex: PropTypes.number, firstRowOffset: PropTypes.number, bufferRowCount: PropTypes.number, scrolling: PropTypes.bool, getRowPosition: PropTypes.func.isRequired, getRowClassName: PropTypes.func, getRowHeight: PropTypes.func, getSubRowHeight: PropTypes.func, leftFixedColumns: propTypes.columns, scrollableColumns: propTypes.columns, rightFixedColumns: propTypes.columns, leftFixedLeafColumns: propTypes.columns, scrollableLeafColumns: propTypes.columns, rightFixedLeafColumns: propTypes.columns, scrollableColumnsToRender: propTypes.columns, scrollableLeafColumnsToRender: propTypes.columns, leftFixedColumnsWidth: PropTypes.number, scrollableColumnsWidth: PropTypes.number, rightFixedColumnsWidth: PropTypes.number, leftFixedColumnsUpdated: PropTypes.bool, scrollableColumnsUpdated: PropTypes.bool, rightFixedColumnsUpdated: PropTypes.bool, scrollableColumnsToRenderUpdated: PropTypes.bool, onRowTouchStart: PropTypes.func, onRowTouchEnd: PropTypes.func, onRowTouchMove: PropTypes.func, onRowClick: PropTypes.func, onRowDoubleClick: PropTypes.func, onRowMouseDown: PropTypes.func, onRowMouseUp: PropTypes.func, onRowMouseEnter: PropTypes.func, onRowMouseLeave: PropTypes.func }; export default FlexiGridBody;