require("../../../../../_virtual/_rolldown/runtime.js");
let react = require("react");
//#region src/components/table/Gallery/components/VirtualGrid/useGenGridProps.ts
const useGenGridProps = (params) => {
	const { itemMaxWidth, itemMinWidth, width, dataSource, horizontal, vertical } = params;
	const columnCount = (0, react.useMemo)(() => {
		const minCount = Math.floor(width / itemMinWidth);
		const maxCount = Math.floor(width / itemMaxWidth);
		return Math.max(Math.floor((minCount + maxCount) / 2), 1);
	}, [
		width,
		itemMinWidth,
		itemMaxWidth
	]);
	return {
		columnCount,
		columnWidth: (0, react.useMemo)(() => {
			return (width - horizontal * (columnCount - 1) - 17) / columnCount;
		}, [
			width,
			horizontal,
			columnCount
		]),
		rowCount: (0, react.useMemo)(() => {
			return Math.ceil(dataSource.length / columnCount);
		}, [dataSource.length, columnCount])
	};
};
//#endregion
exports.default = useGenGridProps;
