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("../group/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
//#region src/components/eftpos/receipt/index.tsx
const _excluded = ["input"], _excluded2 = ["input"];
/**
* @title: 自定义组件设置
* @description: 自定义组件设置
* @param {any} commConfig 当前组件配置
* @param {string} name 上游name(用于嵌套 xxx:{yyy:''})
* @return {*}
* @Author: hongbing.wang
* @Date: 2024-08-20 11:10
*/
const getCommName = (commConfig, name) => {
	commConfig.receipts.__sourceName = commConfig.receipts.name;
	commConfig.receiptList.__sourceName = commConfig.receiptList.name;
	commConfig.receipts.name = name.length > 0 ? [...name, commConfig.receipts.name] : commConfig.receipts.name;
	commConfig.receiptList.name = name.length > 0 ? [...name, commConfig.receiptList.name] : commConfig.receiptList.name;
	return commConfig;
};
/**
* @title: 自定义组件结果设置
* @description: 自定义组件结果设置
* @param {any} commConfig 当前组件配置
* @return {*}
* @Author: hongbing.wang
* @Date: 2024-08-20 11:11
*/
const getCommDefaultVal = (commConfig) => {
	const receipts = commConfig.receipts.input.defaultValue;
	const receiptList = commConfig.receiptList.input.defaultValue;
	console.log("receipts = ", receipts);
	return {
		[commConfig.receipts.__sourceName]: typeof receipts === "undefined" ? true : receipts,
		[commConfig.receiptList.__sourceName]: typeof receiptList === "undefined" ? ["merchant", "customer"] : receiptList
	};
};
var receipt_default = (props) => {
	const { receipts, receiptList } = props;
	const [receiptsInput, receiptsOther] = (0, react.useMemo)(() => {
		const { input } = receipts;
		return [input, require_objectWithoutProperties._objectWithoutProperties(receipts, _excluded)];
	}, [receipts]);
	const [receiptListInput, receiptListOther] = (0, react.useMemo)(() => {
		const { input } = receiptList;
		return [input, require_objectWithoutProperties._objectWithoutProperties(receiptList, _excluded2)];
	}, [receipts]);
	const [type, setType] = (0, react.useState)(receiptsInput.defaultValue);
	return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement(antd.Form.Item, require_objectSpread2._objectSpread2({ style: { marginBottom: "12px" } }, receiptsOther), /* @__PURE__ */ react.default.createElement(require_index.RadioGroup, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, receiptsInput), {}, { onChange: (event) => {
		setType(event.target.value);
	} }))), /* @__PURE__ */ react.default.createElement(antd.Form.Item, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, receiptListOther), {}, { style: type ? {
		marginLeft: "24px",
		display: "none"
	} : { marginLeft: "24px" } }), /* @__PURE__ */ react.default.createElement(require_index.CheckboxGroup, receiptListInput)));
};
//#endregion
exports.default = receipt_default;
exports.getCommDefaultVal = getCommDefaultVal;
exports.getCommName = getCommName;
