import * as React from 'react'; import cx from 'classnames'; export class GridHeaderCell extends React.Component { constructor( props: iAXDataGridHeaderCellProps ) { super( props ); this.state = {}; } public render() { const { bodyRow, optionsHeader, focusedCol, selectionCols, sortInfo, ri, col, onClickHeader } = this.props; let lineHeight = (optionsHeader.columnHeight - optionsHeader.columnPadding * 2 - optionsHeader.columnBorderWidth); let colAlign = optionsHeader.align || col.align; let label, sorter, filter; if ( col.key === '__checkbox_header__' ) { if ( optionsHeader.selector ) { label =
; } } else { label = col.label; } if ( col.key && col.colIndex !== null && typeof col.colIndex !== 'undefined' && sortInfo[ col.key ] ) { sorter = ; } let cellHeight = optionsHeader.columnHeight * col.rowspan - optionsHeader.columnBorderWidth; let tdClassNames = { ['axd-header-column']: true, ['axd-header-corner']: (col.columnAttr === 'lineNumber'), ['focused']: (focusedCol > -1 && col.colIndex === focusedCol && bodyRow.rows.length - 1 === ri + col.rowspan - 1), ['selected']: (selectionCols[ col.colIndex ] && bodyRow.rows.length - 1 === ri + col.rowspan - 1) }; return ( onClickHeader( e, col.colIndex, col.columnAttr )} style={{ height: cellHeight, minHeight: '1px' }}> {sorter} {label || ' '} {(optionsHeader.enableFilter && col.key && col.colIndex > -1) ? : null} ); } }