// Export the standalone DatePicker component (with form logic built-in) import React from 'react'; import Picker from '../../Picker'; import withFormItem from '../withFormItem'; import { useFormFieldContext } from '../hooks/FormFieldContext'; import { PickerInputProps } from '../../Picker/PickerInput'; import { FieldValues } from 'react-hook-form'; import { FormItemProps } from '../Item'; const PickerInputBase = ({ onConfirm, ...props }: PickerInputProps) => { const { field, hasError } = useFormFieldContext(); return ( { field.onChange(value); field.onBlur(); onConfirm?.(value, columns); }} /> ); }; // 使用withFormItem包装,自动处理表单项能力 const FormPicker = withFormItem(PickerInputBase, 'FormPicker'); // 导出支持泛型的类型定义 export type FormPickerProps = Omit, 'children'> & PickerInputProps; export default FormPicker;