const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_objectWithoutProperties = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
const require_index = require("../pisellViewGrid/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./index.less");
//#region src/components/pisellCustomCheckboxGroup/index.tsx
const _excluded = [
	"dataSource",
	"allowAdd",
	"onAdd",
	"onClick",
	"renderAddItem",
	"disabled",
	"isMultiple",
	"value",
	"onChange",
	"className"
];
const PisellCustomCheckboxGroup = (_ref) => {
	let { dataSource = [], allowAdd = false, onAdd, onClick, renderAddItem, disabled = false, isMultiple = false, value, onChange, className } = _ref, rest = require_objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
	/**
	* @title: 构建最终数据，如果允许添加，则增加一项
	* @description:
	* @param {*} useMemo
	* @return {*}
	* @Author: WangHan
	* @Date: 2025-01-08 18:21
	*/
	const finalDataSource = (0, react.useMemo)(() => {
		return allowAdd ? [{
			id: 0,
			text: "+",
			isAddCard: true
		}, ...dataSource] : dataSource;
	}, [allowAdd, dataSource]);
	/**
	* @title: 渲染卡片
	* @description:
	* @param {any} item
	* @param {number} index
	* @return {*}
	* @Author: WangHan
	* @Date: 2025-01-08 18:11
	*/
	const renderGridItem = (item, index) => {
		var _rest$renderItem;
		return /* @__PURE__ */ react.default.createElement("div", {
			onClick: () => onClick(item),
			style: { height: "100%" }
		}, (item === null || item === void 0 ? void 0 : item.isAddCard) && renderAddItem ? renderAddItem(item) : rest === null || rest === void 0 || (_rest$renderItem = rest.renderItem) === null || _rest$renderItem === void 0 ? void 0 : _rest$renderItem.call(rest, item, index));
	};
	return /* @__PURE__ */ react.default.createElement(require_index.default, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, rest), {}, {
		dataSource: finalDataSource,
		renderItem: (item, index) => {
			return renderGridItem(item, index);
		},
		className: (0, classnames.default)("pisell-custom-checkbox-group", className)
	}));
};
//#endregion
exports.default = PisellCustomCheckboxGroup;
