ant-design / ant-design/pro-components
🐛[BUG]当使用formRef.current.validateFieldsReturnFormatValue 时,transform回调函数失效,未起到转化效果
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.4k
- Avg merge
- 10h 44m
- Merged PRs (30d)
- 3
Description
### 🐛 bug 描述
`ProForm.Item`的`transform`方法无效,`formRef.current.validateFieldsReturnFormatValue`虽然触发了`transform`回调方法的执行,但是最终获取到的值依然没有被转化。
### 📷 复现步骤
```
const [form] = Form.useForm<{ name: string; company: string }>();
const formRef = useRef(form);
async function onSave() {
const values = await formRef.current?.validateFieldsReturnFormatValue?.();
// values的实际结果: {name: {x: 'ffffffff'}},期望结果:{name: 'ffffffff'}
console.log(values);
}
value.x}>
保存
function MyCom({onChange}) {
return (
{
onChange({x: e.target.value})
}} />
);
}
```
### 🏞 期望结果
期望`formRef.current.validateFieldsReturnFormatValue`拿到的是转化后的值。
### 💻 复现代码
### © 版本信息
- ProComponents 版本: 2.8.4
- umi 版本
- 浏览器环境
- 开发环境 [e.g. mac OS]
### 🚑 其他信息
Contributor guide
Research direction
Start by locating the implementation of validateFieldsReturnFormatValue and the ProForm.Item transform handling. Reproduce the example with a custom component that emits {x: value}, then verify that the returned name is the transformed string rather than the object. Done means the method returns the transformed field value while preserving existing behavior.
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
- 45/100