import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { cloneElement, Fragment, isValidElement, memo, } from 'react';
import SortableRow from './SortableRow';
const VirtualizedRows = memo(({ paddingTop, paddingBottom, columnsLength, visibleRows, startIndex, columns, freezeColumns, frozenWidth, handleOnclick, isRowCheckBoxDisable, isRowDisabled, onSelectClick, tableBodyRowClass, tableDataTextColor, updateRowHeight, withCheckbox, draggable, editMode, editComponent, accordionContent, getAccordionStatus = () => { }, selectedNode, uniqueRowIdForAccordion, }) => {
    return (_jsxs(_Fragment, { children: [paddingTop > 0 && (_jsx("tr", { children: _jsx("td", { style: { height: paddingTop, padding: 0 }, colSpan: columnsLength }) })), visibleRows.map((row, i) => {
                const absoluteIndex = startIndex + i;
                const rowId = row._id ?? row.id;
                if (editMode === rowId) {
                    return (_jsx("tr", { className: "edit-row", children: _jsx("td", { colSpan: columns.length, style: { padding: '0px' }, children: isValidElement(editComponent) &&
                                cloneElement(editComponent, {
                                    rowData: row,
                                    rowIndex: absoluteIndex + 1,
                                }) }) }, `edit-${rowId}`));
                }
                const isOpen = getAccordionStatus(row?.id ||
                    row?._id ||
                    (uniqueRowIdForAccordion
                        ? row?.[uniqueRowIdForAccordion]
                        : undefined));
                return (_jsx(Fragment, { children: _jsx(SortableRow, { row: row, index: absoluteIndex, serialNumber: absoluteIndex + 1, columns: columns, tableBodyRowClass: tableBodyRowClass, handleOnclick: handleOnclick, tableDataTextColor: tableDataTextColor, withCheckbox: withCheckbox, onSelectClick: onSelectClick, isRowCheckBoxDisable: isRowCheckBoxDisable, isRowDisabled: isRowDisabled, freezeColumns: freezeColumns, frozenWidth: frozenWidth, updateRowHeight: updateRowHeight, draggable: draggable, editMode: editMode, isAccordionOpen: isOpen, accordionContent: accordionContent, selectedNode: selectedNode }, rowId) }, row._id || absoluteIndex));
            }), paddingBottom > 0 && (_jsx("tr", { children: _jsx("td", { style: { height: paddingBottom, padding: 0 }, colSpan: columnsLength }) }))] }));
});
export default VirtualizedRows;
//# sourceMappingURL=VirtualizedRows.js.map