import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import PisellLoading from "../pisellLoading/index.js";
import React from "react";
import classNames from "classnames";
import "./index.less";
//#region src/components/pisellViewGrid/index.tsx
const PisellViewGrid = ({ columns = 3, horizontalGap = 10, verticalGap = 10, singleRow = false, dataSource = [], renderItem, loading = false, children, className, style }) => {
	const classes = classNames("pisell-view-grid", { "pisell-view-grid-single-row": singleRow }, className);
	return /* @__PURE__ */ React.createElement(PisellLoading, {
		loading,
		fullscreen: false,
		style: { width: "100%" }
	}, /* @__PURE__ */ React.createElement("div", {
		className: classes,
		style: _objectSpread2(_objectSpread2({}, style), {}, {
			width: "100%",
			overflow: "hidden"
		})
	}, /* @__PURE__ */ React.createElement("div", {
		className: "pisell-view-grid-content",
		style: !singleRow ? {
			gap: `${verticalGap}px ${horizontalGap}px`,
			gridTemplateColumns: `repeat(${columns}, 1fr)`,
			width: "100%"
		} : {
			display: "flex",
			flexWrap: "nowrap",
			overflowX: "auto",
			width: "100%"
		}
	}, dataSource.map((item, index) => /* @__PURE__ */ React.createElement("div", {
		key: index,
		className: "pisell-view-grid-item",
		style: {
			minWidth: 0,
			flex: `0 0 calc(100% / ${columns})`
		}
	}, renderItem === null || renderItem === void 0 ? void 0 : renderItem(item, index))))));
};
//#endregion
export { PisellViewGrid as default };
