ant-design / ant-design/pro-components
🐛[BUG]自定义valuetype时候 request fieldProps 等关键词无法通过fieldProps传递到组件里面来
- 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
### 🐛 bug 描述
自定义valuetype时候 request fieldProps 等关键词无法通过fieldProps传递到组件里面来



### 📷 复现步骤
1. 将ProFromTreeSelect定义为自定义valuetype

2. 在column schema

3. 打印valuetype里面的props无法拿到request方法,换成其他名字比如api就能拿到

### 🏞 期望结果
### 💻 复现代码
```tsx
// 自定义valuetype代码
/**
* 自定义 valueMap
*/
export const valueTypeMap: Record = {
proTreeSelect: {
renderFormItem(text, props) {
console.log(text);
console.log(props);
// request fieldProps 等参数无法传过来
return (
);
},
},
};
```
```tsx
// column schema
{
title: '上级ID',
dataIndex: 'pid',
width: 300,
valueType: 'proTreeSelect',
fieldProps: () => {
return {
// hell: () => {},
request: (v: any) => {
return new Promise((resolve, reject) => {
all_permission(v)
.then((ret) => {
resolve(to_tree(ret.data, ''));
})
.catch((e) => reject(e));
});
},
tree: {
fieldNames: {
label: 'name',
value: 'id',
},
},
};
},
}
```
### © 版本信息
- ProComponents 版本: [e.g. 4.0.0]
- umi 版本
- 浏览器环境
- 开发环境 [e.g. mac OS]
### 🚑 其他信息
Contributor guide
Research direction
No repository file or test is named. Reproduce the issue from the custom valueType's renderFormItem and the ProFormTreeSelect column schema, then trace how fieldProps are passed into the component. Done means the request callback and nested tree fieldNames arrive through the documented fieldProps path, with a regression test covering the schema.
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