ant-design / ant-design/pro-components
👑 [需求] 自定义 ProForm valueType 取不到 fieldsProps 和 request 参数
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.4k
- Avg merge
- 10h 44m
- Merged PRs (30d)
- 3
Description
### 🔩 所属模块或组件
ProForm
### 🥰 需求描述
现在有一个自定义 FormItem组件
```ts
export const MyFormItem = memo<{
fieldProps: { /* ... */ },
request: () => Promise
}>(() => {
/* ... */
})
export function ProSchemaProvider({
children,
}: PropsWithChildren) {
const proProviderValue = useContext(ProProvider);
const value = useMemo(() => {
return {
...proProviderValue,
valueTypeMap: {
...proProviderValue.valueTypeMap,
my: {
renderFormItem(_, props) {
// props.fieldProps 里取不到 request和 fieldsProps字段
return ;
},
},
},
};
}, [proProviderValue]);
return {children};
}
```
自定义 valueType 时, MyFormItem 的 `request` 和 `fieldProps` 字段取不到
```ts
[], fieldProps: {a:true} } ]
}
/>
```
需要把`request`和`fieldProps`改成其他名字才能获取
### ⛰ 功能需求适用场景
### 🧐 解决方案
### 🚑 其他信息
Contributor guide
Research direction
Start by tracing ProForm columns into ProSchemaProvider and the custom valueTypeMap renderFormItem entry point. Verify how props.fieldProps is assembled for the custom MyFormItem example, including request and nested fieldProps. Done means the custom value type can receive both fields without requiring renamed properties.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100