UNPKG

react-virtualized

Version:

React components for efficiently rendering large, scrollable lists and tabular data

59 lines (53 loc) 1.44 kB
import _extends from 'babel-runtime/helpers/extends'; import React from 'react'; /** * Default row renderer for Table. */ export default function defaultRowRenderer(_ref) { var className = _ref.className; var columns = _ref.columns; var index = _ref.index; var isScrolling = _ref.isScrolling; var key = _ref.key; var onRowClick = _ref.onRowClick; var onRowDoubleClick = _ref.onRowDoubleClick; var onRowMouseOver = _ref.onRowMouseOver; var onRowMouseOut = _ref.onRowMouseOut; var rowData = _ref.rowData; var style = _ref.style; var a11yProps = {}; if (onRowClick || onRowDoubleClick || onRowMouseOver || onRowMouseOut) { a11yProps['aria-label'] = 'row'; a11yProps.role = 'row'; a11yProps.tabIndex = 0; if (onRowClick) { a11yProps.onClick = function () { return onRowClick({ index: index }); }; } if (onRowDoubleClick) { a11yProps.onDoubleClick = function () { return onRowDoubleClick({ index: index }); }; } if (onRowMouseOut) { a11yProps.onMouseOut = function () { return onRowMouseOut({ index: index }); }; } if (onRowMouseOver) { a11yProps.onMouseOver = function () { return onRowMouseOver({ index: index }); }; } } return React.createElement( 'div', _extends({}, a11yProps, { className: className, key: key, style: style }), columns ); }