1 | import * as React from 'react';
|
2 | import type { FieldProps } from 'rc-field-form/lib/Field';
|
3 | import type { FormInstance, FormItemLayout } from '../Form';
|
4 | import type { FormItemInputProps } from '../FormItemInput';
|
5 | import type { FormItemLabelProps, LabelTooltipType } from '../FormItemLabel';
|
6 | import useFormItemStatus from '../hooks/useFormItemStatus';
|
7 | declare const ValidateStatuses: readonly ["success", "warning", "error", "validating", ""];
|
8 | export type ValidateStatus = (typeof ValidateStatuses)[number];
|
9 | type RenderChildren<Values = any> = (form: FormInstance<Values>) => React.ReactNode;
|
10 | type RcFieldProps<Values = any> = Omit<FieldProps<Values>, 'children'>;
|
11 | type ChildrenType<Values = any> = RenderChildren<Values> | React.ReactNode;
|
12 | export type FeedbackIcons = (itemStatus: {
|
13 | status: ValidateStatus;
|
14 | errors?: React.ReactNode[];
|
15 | warnings?: React.ReactNode[];
|
16 | }) => {
|
17 | [key in ValidateStatus]?: React.ReactNode;
|
18 | };
|
19 | export interface FormItemProps<Values = any> extends Omit<FormItemLabelProps, 'requiredMark'>, FormItemInputProps, RcFieldProps<Values> {
|
20 | prefixCls?: string;
|
21 | noStyle?: boolean;
|
22 | style?: React.CSSProperties;
|
23 | className?: string;
|
24 | rootClassName?: string;
|
25 | children?: ChildrenType<Values>;
|
26 | id?: string;
|
27 | hasFeedback?: boolean | {
|
28 | icons: FeedbackIcons;
|
29 | };
|
30 | validateStatus?: ValidateStatus;
|
31 | required?: boolean;
|
32 | hidden?: boolean;
|
33 | initialValue?: any;
|
34 | messageVariables?: Record<string, string>;
|
35 | tooltip?: LabelTooltipType;
|
36 |
|
37 | fieldKey?: React.Key | React.Key[];
|
38 | layout?: FormItemLayout;
|
39 | }
|
40 | declare function InternalFormItem<Values = any>(props: FormItemProps<Values>): React.ReactElement;
|
41 | type InternalFormItemType = typeof InternalFormItem;
|
42 | type CompoundedComponent = InternalFormItemType & {
|
43 | useStatus: typeof useFormItemStatus;
|
44 | };
|
45 | declare const FormItem: CompoundedComponent;
|
46 | export default FormItem;
|