From 03f2f80e7168d3b33d21600ec2c03efd5c127224 Mon Sep 17 00:00:00 2001 From: yaolongfei <2991205548@qq.com> Date: Mon, 2 Dec 2024 17:44:21 +0800 Subject: [PATCH] fix(form field): add field basic type https://github.com/ant-design/pro-components/issues/8845 --- packages/form/src/components/Field/index.tsx | 53 ++++++++++---------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/packages/form/src/components/Field/index.tsx b/packages/form/src/components/Field/index.tsx index 6946daecd674..f63a04f14c3c 100644 --- a/packages/form/src/components/Field/index.tsx +++ b/packages/form/src/components/Field/index.tsx @@ -1,4 +1,4 @@ -import ProField from '@ant-design/pro-field'; +import ProField, { ProFieldPropsType } from '@ant-design/pro-field'; import type { ProSchema } from '@ant-design/pro-utils'; import { isDeepEqualReact, @@ -10,29 +10,30 @@ import { EditOrReadOnlyContext } from '../../BaseForm/EditOrReadOnlyContext'; import { createField } from '../../BaseForm/createField'; import type { ProFormFieldItemProps } from '../../typing'; -export type ProFormFieldProps< - T = any, - FiledProps = Record, -> = ProSchema< - T, - ProFormFieldItemProps & { - mode?: 'edit' | 'read' | 'update'; - // 用来判断是不是被嵌套渲染的 dom - isDefaultDom?: boolean; - ref?: any; - plain?: boolean; - text?: any; - getFieldProps?: () => Record; - getFormItemProps?: () => Record; - /** - * dependencies value - */ - dependenciesValues?: Record; - originDependencies?: Record; - }, - any, - any ->; +export type ProFormFieldProps> = Omit< + ProSchema< + T, + ProFormFieldItemProps & { + mode?: 'edit' | 'read' | 'update'; + // 用来判断是不是被嵌套渲染的 dom + isDefaultDom?: boolean; + ref?: any; + plain?: boolean; + text?: any; + getFieldProps?: () => Record; + getFormItemProps?: () => Record; + /** + * dependencies value + */ + dependenciesValues?: Record; + originDependencies?: Record; + }, + any, + any + >, + keyof ProFieldPropsType +> & + ProFieldPropsType; const BaseProFormField: React.FC< ProFormFieldProps & { @@ -119,8 +120,8 @@ const BaseProFormField: React.FC< return (