Form.d.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import * as React from 'react';
  2. import { List, useWatch } from 'rc-field-form';
  3. import type { FormProps as RcFormProps } from 'rc-field-form/lib/Form';
  4. import type { FormRef } from 'rc-field-form/lib/interface';
  5. import type { Variant } from '../config-provider';
  6. import type { SizeType } from '../config-provider/SizeContext';
  7. import type { ColProps } from '../grid/col';
  8. import type { FeedbackIcons } from './FormItem';
  9. import useForm from './hooks/useForm';
  10. import type { FormInstance } from './hooks/useForm';
  11. import type { FormLabelAlign, ScrollFocusOptions } from './interface';
  12. export type RequiredMark = boolean | 'optional' | ((labelNode: React.ReactNode, info: {
  13. required: boolean;
  14. }) => React.ReactNode);
  15. export type FormLayout = 'horizontal' | 'inline' | 'vertical';
  16. export type FormItemLayout = 'horizontal' | 'vertical';
  17. export type { ScrollFocusOptions };
  18. export interface FormProps<Values = any> extends Omit<RcFormProps<Values>, 'form'> {
  19. prefixCls?: string;
  20. colon?: boolean;
  21. name?: string;
  22. layout?: FormLayout;
  23. labelAlign?: FormLabelAlign;
  24. labelWrap?: boolean;
  25. labelCol?: ColProps;
  26. wrapperCol?: ColProps;
  27. form?: FormInstance<Values>;
  28. feedbackIcons?: FeedbackIcons;
  29. size?: SizeType;
  30. disabled?: boolean;
  31. scrollToFirstError?: ScrollFocusOptions | boolean;
  32. requiredMark?: RequiredMark;
  33. /** @deprecated Will warning in future branch. Pls use `requiredMark` instead. */
  34. hideRequiredMark?: boolean;
  35. rootClassName?: string;
  36. variant?: Variant;
  37. }
  38. declare const Form: (<Values = any>(props: React.PropsWithChildren<FormProps<Values>> & React.RefAttributes<FormRef<Values>>) => React.ReactElement) & Pick<React.FC, "displayName">;
  39. export { List, useForm, useWatch, type FormInstance };
  40. export default Form;