import { Checkbox, Col, Divider, Input, Row } from 'antd';
import { memo, useEffect, useState } from 'react';
import type { CheckboxValueType } from 'antd/es/checkbox/Group';
import { useIntl } from 'umi';
import { useSelections } from 'ahooks';
type CustomCheckGroupProps = {
value: CheckboxValueType[];
onChange: (value: CheckboxValueType[]) => void;
options: { label: string; value: string }[];
};
const CustomCheckGroup = ({ value, onChange, options }: CustomCheckGroupProps) => {
const { formatMessage } = useIntl();
const [filterValue, setFilterValue] = useState(options);
const { selected, allSelected, isSelected, toggle, toggleAll, partiallySelected } = useSelections(
filterValue.map((item) => item.value),
value,
);
useEffect(() => {
onChange?.(selected);
}, [selected, onChange]);
return (
<>
setFilterValue(
options.filter((item) =>
item.label.toLocaleLowerCase().includes(event.target.value.toLocaleLowerCase()),
),
)
}
style={{ margin: '10px 0' }}
/>