import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
import { memo, isValidElement, cloneElement, Fragment as Fragment$1 } from 'react';
import SortableRow from './SortableRow.js';

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$1, { 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 { VirtualizedRows as default };
//# sourceMappingURL=VirtualizedRows.js.map
