const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../../tabProduct/index.js");
const require_utils = require("../../schedules/utils.js");
const require_index$1 = require("./RenderScheduleItem/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let _pisell_utils = require("@pisell/utils");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./index.less");
//#region src/components/schedules/components/ScheduleList/index.tsx
/**
* 日程列表 展示日程简略信息
* @param props
* @constructor
*/
const ScheduleList = (props) => {
	const { dataSource, onItemClick, showDeleteIcon, onDelete, loading, className, addButtonProps, showTabs } = props;
	const renderList = (0, react.useMemo)(() => {
		return require_utils.formatScheduleListByTabs(dataSource);
	}, [dataSource]);
	const content = (0, react.useMemo)(() => {
		if (dataSource.length === 0) return /* @__PURE__ */ react.default.createElement(antd.Empty, {
			image: antd.Empty.PRESENTED_IMAGE_SIMPLE,
			description: _pisell_utils.locales.getText("pisell2.text.schedules.no-schedules")
		});
		if (showTabs) return /* @__PURE__ */ react.default.createElement(require_index.default, {
			scrollDom: ".pisell-lowcode__schedules-module-content-wrap",
			list: renderList,
			name: "schedule",
			renderItem: (item) => {
				return /* @__PURE__ */ react.default.createElement(require_index$1.default, {
					item,
					key: item.id,
					showDeleteIcon,
					onItemClick: () => onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item),
					onDelete: () => onDelete === null || onDelete === void 0 ? void 0 : onDelete(item)
				});
			}
		});
		else return dataSource.map((item) => {
			return /* @__PURE__ */ react.default.createElement(require_index$1.default, {
				item,
				showDeleteIcon,
				onItemClick: () => onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item),
				onDelete: () => onDelete === null || onDelete === void 0 ? void 0 : onDelete(item)
			});
		});
	}, [
		dataSource,
		showDeleteIcon,
		showTabs
	]);
	return /* @__PURE__ */ react.default.createElement("div", { className: (0, classnames.default)("pisell-lowcode__schedule-list", className) }, /* @__PURE__ */ react.default.createElement(antd.Skeleton, {
		active: true,
		round: true,
		loading
	}, content, addButtonProps ? /* @__PURE__ */ react.default.createElement(antd.Button, addButtonProps) : null));
};
//#endregion
exports.default = ScheduleList;
