import _extends from "@babel/runtime-corejs3/helpers/extends";
import { isLeafNode, makeRecursiveMapper, mergeCellProps } from '../../utils';
export function mergeCellHover() {
  return function (pipeline) {
    return pipeline.mapColumns(makeRecursiveMapper(function (col) {
      if (!isLeafNode(col)) {
        return col;
      }
      var prevGetCellProps = col.getCellProps;
      return _extends(_extends({}, col), {
        getCellProps: function getCellProps(value, record, rowIndex) {
          var prevCellProps = prevGetCellProps === null || prevGetCellProps === void 0 ? void 0 : prevGetCellProps(value, record, rowIndex);
          return mergeCellProps(prevCellProps, {
            onMouseEnter: function onMouseEnter(e) {
              var InRangeRow = pipeline.ref.current.domHelper.getInRangeRowByCellEvent(e);
              InRangeRow.forEach(function (row) {
                row.classList.add('row-hover');
              });
            },
            onMouseLeave: function onMouseLeave(e) {
              var InRangeRow = pipeline.ref.current.domHelper.getInRangeRowByCellEvent(e);
              InRangeRow.forEach(function (row) {
                row.classList.remove('row-hover');
              });
            }
          });
        }
      });
    }));
  };
}