import Filter$1 from "./components/FilterButton/index.js";
import QuickFilter from "./components/QuickFilter/index.js";
import React, { useEffect, useMemo } from "react";
import { Form } from "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] = Form.useForm();
	const isShowQuickFilter = useMemo(() => {
		if (isMobileBool && show && sortButtonShow) return false;
		return true;
	}, [
		show,
		sortButtonShow,
		isMobileBool
	]);
	useEffect(() => {
		if (isRenderFormContent) form.setFieldsValue({ filter_setting: { notSortFilter: list } });
	}, [isRenderFormContent, list]);
	const content = /* @__PURE__ */ React.createElement(React.Fragment, null, isShowQuickFilter && /* @__PURE__ */ React.createElement(Form.Item, {
		name: "filter_setting",
		noStyle: true
	}, /* @__PURE__ */ React.createElement(QuickFilter, { formFiltersPrefix: isRenderFormContent ? "" : formFiltersPrefix })), show && sortButtonShow ? /* @__PURE__ */ React.createElement(Form.Item, {
		name: "filter_setting",
		noStyle: true
	}, /* @__PURE__ */ React.createElement(Filter$1, {
		formFiltersPrefix,
		quickFilterMaxLength
	})) : null);
	if (!show) return null;
	if (isRenderFormContent) return /* @__PURE__ */ React.createElement(Form, {
		onValuesChange,
		form,
		initialValues: { filter_setting: { notSortFilter: list } }
	}, content);
	return content;
};
//#endregion
export { Filter as default };
