const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../../../../locales/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let _pisell_icon_es_HelpCircle = require("@pisell/icon/es/HelpCircle");
_pisell_icon_es_HelpCircle = require_runtime.__toESM(_pisell_icon_es_HelpCircle);
require("./PopoverContent.less");
//#region src/components/table/Actions/component/Group/PopoverContent.tsx
const prefix = "pisell-lowcode-";
const PopoverContent = (props) => {
	const { columns, value = [], onChange } = props;
	const firstValue = (value === null || value === void 0 ? void 0 : value[0]) || {};
	const handleFieldChange = (value) => {
		if (!value) {
			onChange === null || onChange === void 0 || onChange([]);
			return;
		}
		onChange === null || onChange === void 0 || onChange([{ field: value }]);
	};
	const options = (0, react.useMemo)(() => {
		return (columns || []).filter((item) => !(item === null || item === void 0 ? void 0 : item.isHidden)).map((item) => ({
			label: item.label,
			value: `${item.name}`
		}));
	}, [columns]);
	return /* @__PURE__ */ react.default.createElement("div", { className: `${prefix}table-action-group-popover-content-wrap` }, /* @__PURE__ */ react.default.createElement("div", { className: `${prefix}table-action-group-header` }, /* @__PURE__ */ react.default.createElement("span", { className: `${prefix}table-action-group-header-title` }, require_index.getText("table-action-group-by-title")), /* @__PURE__ */ react.default.createElement(antd.Tooltip, { title: require_index.getText("table-action-group-by-title-tip") }, /* @__PURE__ */ react.default.createElement(_pisell_icon_es_HelpCircle.default, null))), /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement(antd.Select, {
		options,
		value: firstValue.field,
		onChange: handleFieldChange,
		style: { width: 200 },
		allowClear: true
	}))));
};
//#endregion
exports.default = PopoverContent;
