import React from 'react'; import Checkbox from '../../Checkbox'; import withFormItem, { FormComponentProps } from '../withFormItem'; import { FieldValues } from 'react-hook-form'; import { CheckboxGroupProps, CheckboxProps, } from 'src/components/Checkbox/interface'; const FormCheckbox = withFormItem( Checkbox, 'FormCheckbox', {}, { triggerValidationOnChange: true, } ) as ( props: FormComponentProps> & { checkboxLabel?: React.ReactNode; } ) => React.ReactElement; const FormCheckboxGroup = withFormItem( Checkbox.Group, 'FormCheckboxGroup', {}, { triggerValidationOnChange: true, fallbackValue: null, } ) as ( props: FormComponentProps> ) => React.ReactElement; // 导出支持泛型的类型定义 export type FormCheckboxProps< TFieldValues extends FieldValues = FieldValues, ActiveValueT = boolean, InactiveValueT = boolean > = FormComponentProps< TFieldValues, CheckboxProps >; export type FormCheckboxGroupProps< TFieldValues extends FieldValues = FieldValues, T = unknown > = FormComponentProps>; export { FormCheckbox, FormCheckboxGroup };