"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.mergeCellHover = mergeCellHover;
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
var _utils = require("../../utils");
function mergeCellHover() {
  return function (pipeline) {
    return pipeline.mapColumns((0, _utils.makeRecursiveMapper)(function (col) {
      if (!(0, _utils.isLeafNode)(col)) {
        return col;
      }
      var prevGetCellProps = col.getCellProps;
      return (0, _extends2.default)((0, _extends2.default)({}, col), {
        getCellProps: function getCellProps(value, record, rowIndex) {
          var prevCellProps = prevGetCellProps === null || prevGetCellProps === void 0 ? void 0 : prevGetCellProps(value, record, rowIndex);
          return (0, _utils.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');
              });
            }
          });
        }
      });
    }));
  };
}