ant-design / ant-design/pro-components
🐛[BUG] ProFormDigit 非必填时,没有填值时提交的数据缺少该字段
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.4k
- Avg merge
- 10h 44m
- Merged PRs (30d)
- 3
Description
### 🐛 bug 描述
ProFormDigit 非必填时,validateFields,onValuesChange,onFinish中返回的值缺少该字段
### 📷 复现步骤
1. 清空输入框值,点击提交按钮,查看输出

2. 填写1,再点击提交按钮,查看输出

### 🏞 期望结果
1. 清空输入框值,点击提交按钮,输出结果应该是
`{ price:null }`
与ant form.item InputNumber 对齐
https://stackblitz.com/edit/react-s4h9ap?file=demo.tsx
### 💻 复现代码
https://stackblitz.com/edit/react-abklup?file=App.tsx
### © 版本信息
- ProComponents 版本: latest
- umi 版本
- 浏览器环境 chrome 120.0.6099.131
- 开发环境 [e.g. mac OS] windows
### 🚑 其他信息
Contributor guide
Research direction
Start with the App.tsx reproduction linked in the issue and compare ProFormDigit with Ant Design Form.Item using InputNumber. Trace the values returned by validateFields, onValuesChange, and onFinish when the field is cleared. Done means an optional empty ProFormDigit consistently returns { price: null } like InputNumber.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100