import { memo } from 'react'; import { css } from 'ecij'; import { classnames } from './utils'; import type { RenderRowProps } from './types'; import { bottomSummaryRowClassname, rowClassname, rowActiveClassname, topSummaryRowClassname } from './style/row'; import SummaryCell from './SummaryCell'; type SharedRenderRowProps = Pick< RenderRowProps, | 'mapViewportColumns' | 'rowIdx' | 'gridRowStart' | 'setActivePosition' | 'activeCellIdx' | 'isTreeGrid' >; interface SummaryRowProps extends SharedRenderRowProps { 'aria-rowindex': number; row: SR; top: number | undefined; bottom: number | undefined; isTop: boolean; } const summaryRow = css` @layer rdg.SummaryRow { position: sticky; z-index: 2; } `; const summaryRowClassname = `rdg-summary-row ${summaryRow}`; function SummaryRow({ rowIdx, gridRowStart, row, mapViewportColumns, activeCellIdx, setActivePosition, top, bottom, isTop, isTreeGrid, 'aria-rowindex': ariaRowIndex }: SummaryRowProps) { const isPositionOnRow = activeCellIdx === -1; const cells = mapViewportColumns( activeCellIdx, { type: 'SUMMARY', row }, (column, isCellActive, colSpan) => ( key={column.key} column={column} colSpan={colSpan} row={row} rowIdx={rowIdx} isCellActive={isCellActive} setActivePosition={setActivePosition} /> ) ); return (
{cells}
); } export default memo(SummaryRow) as (props: SummaryRowProps) => React.JSX.Element;