@1771technologies/lytenyte-pro
Version:
Blazingly fast headless React data grid with 100s of features.
33 lines (32 loc) • 1.36 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { Row } from "../../grid/row.js";
import { Cell } from "../../grid/cell.js";
import { RowFullWidth } from "../../grid/row-full-width.js";
export const RowHandler = (props) => {
return props.rows.map((row) => {
if (row.kind === "full-width")
return _jsx(RowFullWidth, { row: row }, row.id);
return _jsx(Memo, { row: row, withStyles: props.withStyles, pinned: props.pinned }, row.id);
});
};
function RowFor({ row, withStyles, pinned, }) {
const styles = withStyles
? {
background: pinned
? "light-dark(rgb(200,200,200), rgb(0,0,60))"
: row.rowIndex % 2 === 0
? "light-dark(white, rgb(0,0,0))"
: "light-dark(rgb(252, 243, 243), rgb(30,30,30))",
color: "light-dark(black, white)",
display: "flex",
alignItems: "center",
borderTop: row.rowIndex !== 0 ? "1px solid light-dark(gray, #444242)" : undefined,
borderRight: "1px solid light-dark(gray, #444242)",
paddingInline: "16px",
}
: undefined;
return (_jsx(Row, { row: row, accepted: ["row"], children: row.cells.map((cell) => {
return _jsx(Cell, { cell: cell, style: styles }, cell.id);
}) }));
}
const Memo = RowFor;