import { useActionCellColumnBase } from '../ActionCell';
import React, { useMemo } from 'react';
import { NestedTableActionCell } from './NestedTableActionCell';
export function useNestedTableActionCell(params) {
    const { state, actionCellProps, actionCellWidth } = params;
    const baseColumn = useActionCellColumnBase({
        actionCellProps,
        actionCellWidth,
    });
    return useMemo(() => {
        const isActionsColumnRequired = state.levels.some((level) => level.actionCell);
        if (!isActionsColumnRequired) {
            return null;
        }
        return {
            ...baseColumn,
            render: (keyedItem, rowNum) => {
                if (keyedItem.item.originalKeyedItem) {
                    return (React.createElement(NestedTableActionCell, { state: keyedItem.item.state, item: keyedItem.item.originalKeyedItem, rowNum: rowNum }));
                }
                return null;
            },
        };
    }, [baseColumn, state]);
}
//# sourceMappingURL=useNestedTableActionCell.js.map