import { useMemo } from "react";
var useGenScroll = function useGenScroll(params) {
  var wrapHeight = params.wrapHeight,
    propsScroll = params.scroll,
    columns = params.columns,
    isShowPagination = params.isShowPagination;
  var scroll = useMemo(function () {
    if (propsScroll !== null && propsScroll !== void 0 && propsScroll.autoCalc) {
      return {
        x: (propsScroll === null || propsScroll === void 0 ? void 0 : propsScroll.x) || columns.reduce(function (p, c) {
          return p + (c.width || 250);
        }, 0) || 2000,
        y: (propsScroll === null || propsScroll === void 0 ? void 0 : propsScroll.y) || Math.max(wrapHeight - 48 - (isShowPagination ? 50 + 24 : 24), 100),
        scrollToFirstRowOnChange: propsScroll === null || propsScroll === void 0 ? void 0 : propsScroll.scrollToFirstRowOnChange
      };
    }
    return propsScroll;
  }, [propsScroll, wrapHeight, columns, isShowPagination]);
  return scroll;
};
export default useGenScroll;