const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_index = require("./components/FilterButton/index.js");
const require_index$1 = require("./components/QuickFilter/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
//#region src/components/filter/index.tsx
const formFiltersPrefix = "filters";
const Filter = (props) => {
	const { filter, isRenderFormContent = true, onValuesChange, isMobile: isMobileBool } = props;
	const { show, quickFilterMaxLength, sortButtonShow, list } = filter || {};
	const [form] = antd.Form.useForm();
	const isShowQuickFilter = (0, react.useMemo)(() => {
		if (isMobileBool && show && sortButtonShow) return false;
		return true;
	}, [
		show,
		sortButtonShow,
		isMobileBool
	]);
	(0, react.useEffect)(() => {
		if (isRenderFormContent) form.setFieldsValue({ filter_setting: { notSortFilter: list } });
	}, [isRenderFormContent, list]);
	const content = /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, isShowQuickFilter && /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		name: "filter_setting",
		noStyle: true
	}, /* @__PURE__ */ react.default.createElement(require_index$1.default, { formFiltersPrefix: isRenderFormContent ? "" : formFiltersPrefix })), show && sortButtonShow ? /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		name: "filter_setting",
		noStyle: true
	}, /* @__PURE__ */ react.default.createElement(require_index.default, {
		formFiltersPrefix,
		quickFilterMaxLength
	})) : null);
	if (!show) return null;
	if (isRenderFormContent) return /* @__PURE__ */ react.default.createElement(antd.Form, {
		onValuesChange,
		form,
		initialValues: { filter_setting: { notSortFilter: list } }
	}, content);
	return content;
};
//#endregion
exports.default = Filter;
