react-flexigrid
Version:
A React table component designed to allow presenting millions of rows of data.
83 lines (72 loc) • 2.95 kB
JavaScript
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 { shouldUpdateHeader } from './FlexiGridUpdateHelper';
import FlexiGridRow from './FlexiGridRow';
var FlexiGridHeader = function (_React$Component) {
_inherits(FlexiGridHeader, _React$Component);
function FlexiGridHeader() {
_classCallCheck(this, FlexiGridHeader);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
FlexiGridHeader.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
return shouldUpdateHeader(this.props, nextProps);
};
FlexiGridHeader.prototype.render = function render() {
var _props = this.props,
prefixCls = _props.prefixCls,
width = _props.width,
height = _props.height,
showScrollbarX = _props.showScrollbarX,
showScrollbarY = _props.showScrollbarY,
isJustFullfill = _props.isJustFullfill,
scrollbarSize = _props.scrollbarSize;
var rowProps = _extends({}, this.props, {
offsetTop: 0,
rowIndex: -1,
isHeader: true
});
return React.createElement(
'div',
{ className: prefixCls + '-header', style: { width: width, height: height } },
React.createElement(FlexiGridRow, _extends({ key: 'header-row' }, rowProps)),
(isJustFullfill || showScrollbarX) && showScrollbarY ? React.createElement('div', {
className: prefixCls + '-header-end-sapce',
style: { width: scrollbarSize, height: height }
}) : null
);
};
return FlexiGridHeader;
}(React.Component);
FlexiGridHeader.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,
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,
width: PropTypes.number,
height: PropTypes.number,
scrollbarSize: PropTypes.number
};
export default FlexiGridHeader;