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");
const require_index$1 = require("../surcharge/index.js");
const require_index$2 = require("../receipt/index.js");
const require_index$3 = require("../deviceList/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
//#region src/components/eftpos/form/index.tsx
const _excluded = ["__sourceName", "Component"], _excluded2 = ["input"], _excluded3 = ["input"];
const Mapping = {
	Input: antd.Input,
	InputNumber: antd.InputNumber,
	Checkbox: antd.Checkbox,
	"Checkbox.Group": require_index.CheckboxGroup,
	Radio: antd.Radio,
	"Radio.Group": require_index.RadioGroup,
	"Radio.Button": antd.Radio.Button,
	Cascader: antd.Cascader,
	DatePicker: antd.DatePicker,
	Select: antd.Select,
	Slider: antd.Slider,
	Switch: antd.Switch,
	TimePicker: antd.TimePicker,
	Transfer: antd.Transfer,
	TreeSelect: antd.TreeSelect,
	Upload: antd.Upload
};
const CustomMapping = {
	Surcharge: require_index$1.default,
	DeviceList: require_index$3.default,
	Receipt: require_index$2.default
};
/**
* @title: 递归循环表单数据
* @Author: hongbing.wang
* @Date: 2024-08-20 13:21
*/
const CustomFormItem = ({ formItemList, level = 0, onChange }) => {
	return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, formItemList.map((_ref, index) => {
		let { __sourceName, Component } = _ref, item = require_objectWithoutProperties._objectWithoutProperties(_ref, _excluded);
		if (Array.isArray(item.children)) return /* @__PURE__ */ react.default.createElement(CustomFormItem, {
			formItemList: item.children,
			onChange,
			key: item.name ? `${item.name}${level}` : `${Component}${index}${level}`,
			level: level + 1
		});
		if (typeof Component === "object") return /* @__PURE__ */ react.default.createElement(Component, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, item), {}, { key: `${item.name}${level}` }));
		if (Mapping[Component]) {
			const Comm = Mapping[Component];
			const { input } = item, formItemProps = require_objectWithoutProperties._objectWithoutProperties(item, _excluded2);
			return /* @__PURE__ */ react.default.createElement(antd.Form.Item, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, formItemProps), {}, { key: `${item.name}${level}` }), /* @__PURE__ */ react.default.createElement(Comm, input));
		}
		if (Mapping[Component]) {
			const Comm = Mapping[Component];
			const { input } = item, formItemProps = require_objectWithoutProperties._objectWithoutProperties(item, _excluded3);
			return /* @__PURE__ */ react.default.createElement(antd.Form.Item, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, formItemProps), {}, { key: `${item.name}${level}` }), /* @__PURE__ */ react.default.createElement(Comm, input));
		}
		if (CustomMapping[Component]) {
			const Comm = CustomMapping[Component];
			return /* @__PURE__ */ react.default.createElement(Comm, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, item), {}, { key: `${item.name}${level}` }));
		}
		throw TypeError(`pos物料库 输入组件类型 ${Component} 无法映射,请正确传入组件类型`);
	}));
};
const helpMapping = {
	Surcharge: {
		getCommName: require_index$1.getCommName,
		getCommDefaultVal: require_index$1.getCommDefaultVal
	},
	Receipt: {
		getCommName: require_index$2.getCommName,
		getCommDefaultVal: require_index$2.getCommDefaultVal
	}
};
//#endregion
exports.default = CustomFormItem;
exports.helpMapping = helpMapping;
