UNPKG

@wulperstudio/cms

Version:
45 lines 1.51 kB
import React from 'react'; import { v4 } from 'uuid'; import { TableBody as MTableBody, Grid } from '@mui/material'; import { TableCell, TableRow } from '../styled'; import { jsx as _jsx } from "react/jsx-runtime"; // eslint-disable-next-line no-shadow var Position = /*#__PURE__*/function (Position) { Position["start"] = "flex-start"; Position["center"] = "center"; Position["end"] = "flex-end"; return Position; }(Position || {}); export var TableBody = function TableBody(_ref) { var rows = _ref.rows, getTableBodyProps = _ref.getTableBodyProps, prepareRow = _ref.prepareRow, onClickRow = _ref.onClickRow; var handleClick = function handleClick(item) { onClickRow(item); }; return /*#__PURE__*/_jsx(MTableBody, Object.assign({}, getTableBodyProps(), { children: rows.map(function (row) { prepareRow(row); return /*#__PURE__*/_jsx(TableRow, { selected: row.isSelected, onClick: function onClick() { handleClick(row); }, children: row.cells.map(function (cell) { var _ref2 = cell.column, position = _ref2.position; return /*#__PURE__*/_jsx(TableCell, { children: /*#__PURE__*/_jsx(Grid, { container: true, justifyContent: Position[position || 'center'], alignItems: "center", height: "100%", children: cell.render('Cell') }) }, v4()); }) }, v4()); }) })); };