UNPKG

@stakefish/ui

Version:

<div align="center"> <a href="https://www.npmjs.com/package/@stakefish/ui"><img src="https://gateway.pinata.cloud/ipfs/QmbZL1ceA8Yiz2pKALTg919jYx141DPUGegC9L4XpyayW5" width="300" /></a> </div>

31 lines (28 loc) 1.71 kB
import { _ as __assign } from '../tslib.es6-35932c2c.js'; import { jsx, jsxs } from 'react/jsx-runtime'; import MuiTable from '@mui/material/Table'; import MuiTableRow from '@mui/material/TableRow'; import MuiTableBody from '@mui/material/TableBody'; import MuiTableHead from '@mui/material/TableHead'; import MuiTableContainer from '@mui/material/TableContainer'; import MuiTableCell from '@mui/material/TableCell'; /** * Utilities */ function createCellData(dataSets, cellDataKeys) { var cellData = {}; cellDataKeys.forEach(function (key, index) { return (cellData[key] = dataSets[index]); }); return cellData; } function formatCellDataRowsIntoArray(data) { var array = []; for (var property in data) { array.push(data[property]); } return array; } var TableContainer = function (_a) { var headCells = _a.headCells, bodyCellsRows = _a.bodyCellsRows; return (jsx(MuiTableContainer, { children: jsxs(MuiTable, __assign({ "aria-labelledby": "tableTitle", "aria-label": "enhanced table" }, { children: [jsx(MuiTableHead, { children: jsx(MuiTableRow, { children: headCells.map(function (cell, cellIndex) { return (jsx(MuiTableCell, __assign({}, cell.props, { children: cell.label }), cellIndex)); }) }, void 0) }, void 0), jsx(MuiTableBody, { children: bodyCellsRows.map(function (rowCells, index) { return (jsx(MuiTableRow, { children: formatCellDataRowsIntoArray(rowCells).map(function (cell, cellIndex) { return (jsx(MuiTableCell, __assign({}, cell.props, { children: cell.content }), cellIndex)); }) }, index)); }) }, void 0)] }), void 0) }, void 0)); }; export { createCellData, TableContainer as default, formatCellDataRowsIntoArray };