import { useMemo } from "react";
var useGenGridProps = function useGenGridProps(params) {
  var itemMaxWidth = params.itemMaxWidth,
    itemMinWidth = params.itemMinWidth,
    width = params.width,
    dataSource = params.dataSource,
    horizontal = params.horizontal,
    vertical = params.vertical;
  var columnCount = useMemo(function () {
    var minCount = Math.floor(width / itemMinWidth);
    var maxCount = Math.floor(width / itemMaxWidth);
    return Math.max(Math.floor((minCount + maxCount) / 2), 1);
  }, [width, itemMinWidth, itemMaxWidth]);
  var columnWidth = useMemo(function () {
    return (width - horizontal * (columnCount - 1) - 17) / columnCount;
  }, [width, horizontal, columnCount]);
  var rowCount = useMemo(function () {
    return Math.ceil(dataSource.length / columnCount);
  }, [dataSource.length, columnCount]);
  return {
    columnCount: columnCount,
    columnWidth: columnWidth,
    rowCount: rowCount
  };
};
export default useGenGridProps;