import { getText } from "../../../../../locales/index.js";
import ButtonIcon from "../ButtonIcon/index.js";
import React, { useMemo } from "react";
import { Dropdown } from "antd";
import { BarChartOutlined } from "@ant-design/icons";
//#region src/components/table/Actions/component/ViewMode/index.tsx
const itemsMap = {
	grid: {
		key: "grid",
		label: getText("table-action-view-mode-grid")
	},
	gallery: {
		key: "gallery",
		label: getText("table-action-view-mode-gallery")
	},
	kanban: {
		key: "kanban",
		label: getText("table-action-view-mode-kanban")
	}
};
const defaultArr = [];
const ViewMode = (props) => {
	const { view, value, onChange } = props;
	const { defaultViewMode, modeList = defaultArr } = view;
	const items = useMemo(() => {
		return modeList.map((item) => itemsMap[item]);
	}, [modeList]);
	const handleClick = (e) => {
		onChange === null || onChange === void 0 || onChange(e.key);
	};
	return /* @__PURE__ */ React.createElement(Dropdown, {
		menu: {
			items,
			selectable: true,
			selectedKeys: value ? [value] : [defaultViewMode],
			onClick: handleClick
		},
		placement: "bottomRight"
	}, /* @__PURE__ */ React.createElement(ButtonIcon, { isActive: false }, /* @__PURE__ */ React.createElement(BarChartOutlined, { style: {
		cursor: "pointer",
		fontSize: 18
	} })));
};
//#endregion
export { ViewMode as default };
