ant-design / ant-design/pro-components
ProForm的transform不支持自动处理多层嵌套的数据👑 [需求]
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.4k
- Avg merge
- 10h 44m
- Merged PRs (30d)
- 3
Description
提问前先看看:
https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md
### 🔩 所属模块或组件
ProForm
### 🥰 需求描述
如果想调用transform处理数据,但是是在比较深的层级,比如{ a: { b: { c: 'xxxx' } } },想处理c的值,在transform中需要return { a: { b: { c: 'yyyy' } } }。希望能有一个默认的逻辑,让数据维持在其原本所属的层级上
### ⛰ 功能需求适用场景
有时候自己封装一个公用组件,提前写好transform,但是它在form中的位置不固定,目前就无法写这个transform
### 🧐 解决方案
可能的解决方案:第二个参数namePath,可以是一个层级的key的数组,比如:['a', 'b', 'c'],或者新加一个参数来表示,这样就可以处理了
Contributor guide
Research direction
Start by locating the ProForm implementation and the code that applies transform callbacks. Reproduce the nested { a: { b: { c: 'xxxx' } } } case, then review how a namePath such as ['a', 'b', 'c'] could preserve the value's original nesting. Done means a transform can update the nested value without rebuilding the full object.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100