master
Vitaliy Filippov 2019-03-13 19:20:23 +03:00
parent c1ec2a1fdb
commit eefbd6b9e3
1 changed files with 6 additions and 3 deletions

View File

@ -6,7 +6,7 @@
*
* Author: Vitaliy Filippov <vitalif@yourcmc.ru>, 2019
* License: dual-license MPL 2.0 or GPL 3.0+
* Version: 2019-02-11
* Version: 2019-03-13
*/
import React from 'react';
@ -374,19 +374,20 @@ export class FixedHeaderGridTable extends React.PureComponent
let i = 0;
for (let row of rows)
{
let st = i == 0 ? 'first' : (i == rows.length-1 ? 'last' : '');
if (React.isValidElement(row))
{
// Allow element rows
// In fact, this should be the default use-case
cells.push(React.cloneElement(row, {
decorateCells: this.bind('decorateCells', i == 0 ? 'first' : (i == rows.length-1 ? 'last' : '')),
decorateCells: this.bind('decorateCells', st),
}));
}
else
{
// In other case just process cells in-place
// BUT this is slow, because such cells are reconciled on each render
cells.push.apply(cells, this.decorateCells(i, row));
cells.push.apply(cells, this.decorateCells(st, row, { key: i }));
}
i++;
}
@ -417,6 +418,8 @@ export class FixedHeaderGridTable extends React.PureComponent
onDoubleClick={this.props.isResizable === undefined || this.props.isResizable ? this.onResizeDblClick : null}
onMouseMove={this.onMouseMove}
onMouseLeave={this.onMouseLeave}
onMouseOver={this.props.onMouseOver}
onMouseOut={this.props.onMouseOut}
style={{position: 'relative', gridTemplateColumns: this.columnWidths.join(' ')}}>
{cells}
{this.props.isResizable === undefined || this.props.isResizable