const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
let react = require("react");
react = require_runtime.__toESM(react);
//#region src/components/dataSourceComponents/fields/RecordListWrapper/ReadPretty.tsx
/**
* @title: RecordListWrapper 只读态
* @description: 低代码详情模式下展示每个 option 对应的 record 数据。
*   值结构: { optionValue: { field1: v1, field2: v2 } }
*/
const RecordListWrapperReadPretty = (props) => {
	const { value, options = [] } = props;
	const entries = Object.entries(value && typeof value === "object" && !Array.isArray(value) ? value : {});
	if (!entries.length) return /* @__PURE__ */ react.default.createElement("span", null, "-");
	return /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("div", { style: { marginBottom: 8 } }, "Records: ", entries.length), entries.map(([key, record]) => {
		const option = options.find((o) => String(o.value) === key);
		const label = (option === null || option === void 0 ? void 0 : option.label) || key;
		const displayLabel = typeof label === "object" ? JSON.stringify(label) : label;
		return /* @__PURE__ */ react.default.createElement("div", {
			key,
			style: { marginBottom: 8 }
		}, /* @__PURE__ */ react.default.createElement("div", { style: {
			fontWeight: 500,
			marginBottom: 4
		} }, displayLabel), /* @__PURE__ */ react.default.createElement("pre", { style: {
			margin: 0,
			padding: 8,
			background: "#f7f8fa",
			borderRadius: 4,
			fontSize: 12,
			maxHeight: 200,
			overflow: "auto"
		} }, JSON.stringify(record, null, 2)));
	}));
};
//#endregion
exports.default = RecordListWrapperReadPretty;
