import * as React from 'react'; import classNames from 'classnames' import { GridBodyPanel } from './GridBodyPanel'; export class GridBody extends React.Component { constructor( props: iAXDataGridBodyProps ) { super( props ); } public render() { const { mounted, styles, options, frozenColumnIndex, colGroup, asideColGroup, leftHeaderColGroup, headerColGroup, bodyTable, asideBodyRowData, asideBodyGroupingData, leftBodyRowData, leftBodyGroupingData, bodyRowData, bodyGroupingData, scrollLeft, scrollTop, CTInnerWidth, CTInnerHeight, list, onMouseDownBody } = this.props; if ( !mounted ) return null; const { bodyHeight, bodyTrHeight, asidePanelWidth, frozenPanelWidth, frozenPanelHeight, rightPanelWidth, footSumHeight } = styles; const { frozenRowIndex } = options; const sRowIndex = Math.floor( -scrollTop / bodyTrHeight ) + frozenRowIndex; let scrollPaddingLeft = (headerColGroup[ 0 ]) ? headerColGroup[ 0 ]._sx - styles.frozenPanelWidth : 0; let topBodyScrollConfig: iAXDataGridBodyPanelScrollConfig = { frozenRowIndex: 0, sRowIndex: 0, eRowIndex: frozenRowIndex }; let bodyScrollConfig: iAXDataGridBodyPanelScrollConfig = { frozenRowIndex: frozenRowIndex, sRowIndex: sRowIndex, eRowIndex: sRowIndex + Math.ceil( bodyHeight / bodyTrHeight ) + 1 }; let topAsideBodyPanelStyle: iAXDataGridBodyPanelStyle = { left: 0, width: asidePanelWidth, top: 0, height: frozenPanelHeight }; let topLeftBodyPanelStyle: iAXDataGridBodyPanelStyle = { left: asidePanelWidth, width: frozenPanelWidth, top: 0, height: frozenPanelHeight }; let topBodyPanelStyle: iAXDataGridBodyPanelStyle = { left: frozenPanelWidth + asidePanelWidth, width: CTInnerWidth - asidePanelWidth - frozenPanelWidth - rightPanelWidth, top: 0, height: frozenPanelHeight }; let asideBodyPanelStyle: iAXDataGridBodyPanelStyle = { left: 0, width: asidePanelWidth, top: frozenPanelHeight, height: bodyHeight - frozenPanelHeight - footSumHeight }; let leftBodyPanelStyle: iAXDataGridBodyPanelStyle = { left: asidePanelWidth, width: frozenPanelWidth, top: frozenPanelHeight, height: bodyHeight - frozenPanelHeight - footSumHeight }; let bodyPanelStyle: iAXDataGridBodyPanelStyle = { left: frozenPanelWidth + asidePanelWidth, width: CTInnerWidth - asidePanelWidth - frozenPanelWidth - rightPanelWidth, top: frozenPanelHeight, height: bodyHeight - frozenPanelHeight - footSumHeight }; return (
onMouseDownBody( e )}> {(styles.asidePanelWidth > 0 && styles.frozenPanelHeight > 0) ? (
) : null} {(styles.frozenPanelWidth > 0 && styles.frozenPanelHeight > 0) ? (
) : null} {(styles.frozenPanelHeight > 0) ? (
) : null} {(styles.asidePanelWidth > 0) ? (
) : null} {(styles.frozenPanelWidth > 0) ? (
) : null}
); } } // todo : 틀고정시 마우스 선택 포지션 다시 계산.