import Search from "../../components/Search/index.js";
import ScheduleList from "../../components/ScheduleList/index.js";
import React, { useMemo, useState } from "react";
import { Button } from "antd";
import { locales } from "@pisell/utils";
import "./index.less";
//#region src/components/schedules/schedules/AllSchedules/index.tsx
/**
* 所有schedules列表
* @param props
* @constructor
*/
const AllSchedules = (props) => {
	const { onOpenDetail, dataSource, loading } = props;
	const [search, setSearch] = useState("");
	const showDataSource = useMemo(() => {
		return dataSource.filter((item) => item.name.toLowerCase().includes(search.toLowerCase()));
	}, [dataSource, search]);
	return /* @__PURE__ */ React.createElement("div", { className: "pisell-lowcode__schedules-module-content-wrap" }, /* @__PURE__ */ React.createElement("div", { className: "pisell-lowcode__schedules-module-header" }, /* @__PURE__ */ React.createElement(Search, {
		value: search,
		onChange: setSearch
	})), /* @__PURE__ */ React.createElement("div", { className: "pisell-lowcode__schedules-module-content" }, /* @__PURE__ */ React.createElement(ScheduleList, {
		loading,
		dataSource: showDataSource,
		onItemClick: (item) => onOpenDetail === null || onOpenDetail === void 0 ? void 0 : onOpenDetail(item.id),
		showTabs: true
	})), /* @__PURE__ */ React.createElement("div", { className: "pisell-lowcode__schedules-module-add-button-wrap" }, /* @__PURE__ */ React.createElement(Button, {
		className: "pisell-lowcode__schedules-module-add-button",
		onClick: () => onOpenDetail === null || onOpenDetail === void 0 ? void 0 : onOpenDetail(),
		size: "large",
		type: "primary",
		ghost: true
	}, locales.getText("pisell2.text.schedules.add"))));
};
//#endregion
export { AllSchedules as default };
