const require_runtime = require("../../../../../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../../../../Table/fields/utils/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let antd = require("antd");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./index.less");
//#region src/components/table/Gallery/components/GalleryItem/components/RenderFields/index.tsx
const prefix = "pisell-lowcode-";
const RenderFields = (props) => {
	const { fields, columnsMap, showMode, record, isShowLabel } = props;
	const fieldContent = (0, react.useMemo)(() => {
		return fields.filter((item) => columnsMap.has(item)).map((field) => {
			const column = columnsMap.get(field);
			const title = column.title;
			const value = (0, _pisell_utils.isFunction)(column.render) ? column.render(require_index.getValueByKeys(record, column.dataIndex), record) : require_index.getValueByKeys(record, column.dataIndex);
			const valueSpan = /* @__PURE__ */ react.default.createElement("span", { className: `${prefix}gallery-render-fields-item-value` }, value);
			const valueDom = isShowLabel ? valueSpan : /* @__PURE__ */ react.default.createElement(antd.Tooltip, {
				title,
				destroyTooltipOnHide: true
			}, valueSpan);
			return /* @__PURE__ */ react.default.createElement("div", {
				key: field,
				className: `${prefix}gallery-render-fields-item-wrap`
			}, isShowLabel && /* @__PURE__ */ react.default.createElement("span", { className: `${prefix}gallery-render-fields-item-label` }, title), valueDom);
		});
	}, [
		fields,
		columnsMap,
		record,
		isShowLabel
	]);
	return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)(`${prefix}gallery-render-fields-wrap`, {
		[`${prefix}gallery-render-fields-wrap-inline`]: showMode === "inline",
		[`${prefix}gallery-render-fields-wrap-block`]: showMode === "block"
	}) }, fieldContent);
};
//#endregion
exports.default = RenderFields;
