@adaptabletools/adaptable
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
13 lines (12 loc) • 695 B
JavaScript
import * as React from 'react';
import isPlainObject from 'lodash/isPlainObject';
export default ({ domProps, item, onItemClick, index, columns, className, idProperty, style, }) => {
const key = item[idProperty] || index;
if (!isPlainObject(item)) {
return (React.createElement("tr", { onClick: onItemClick, key: key, className: className, ...domProps },
React.createElement("td", { colSpan: columns.length, style: style }, item)));
}
return (React.createElement("tr", { onClick: onItemClick, key: key, className: className, ...domProps }, columns.map((col) => {
return (React.createElement("td", { key: col, style: style }, item[col]));
})));
};