ant-design / ant-design/pro-components

🐛[BUG]BetaSchemaForm中columns为formList时,title无法拿到formlist的index

Open
#8,561 5 comments 1 reaction 0 assignees View on GitHub
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 描述
目前在title部分只暴露了props,type,dom 同时在formItemProps 也没有地方能拿到当前formlist的index
![image](https://github.com/user-attachments/assets/2cbf3ddc-b9ef-45b1-9747-e457dffa610f)

### 📷 复现步骤
用复现的代码可以查看

### 🏞 期望结果
目前的效果是
![image](https://github.com/user-attachments/assets/d8f718b1-4ae9-4ddf-83ee-678999c25435)

希望能在label前面加上index,能否有地方得到下面的效果
![image](https://github.com/user-attachments/assets/00f85fcc-30e9-43e5-b237-3408b899f405)

### 💻 复现代码

```
const columns = [
{
valueType: 'formList',
dataIndex: 'flowNodeApplyReqList',
fieldProps: {
alwaysShowItemLabel: true,
creatorButtonProps: {
creatorButtonText: '增加一行',
},
},
columns: [
{
title: '',
valueType: 'group',
rowProps: {
wrap: false,
justify: 'space-between',
},
columns: [
{
title: (props, type, dom) => {
console.log('props,type,dom', props, type, dom);
return

院区名称
;
},
dataIndex: 'displayName',
// formItemProps: (...rest) => {
// console.log('form', rest);
// return {
// label: 'test',
// };
// },
colProps: {
span: 12,
},
},
{
title: '院区名称',
dataIndex: 'applicationCode',
params: {},
colProps: {
span: 12,
},
},
],
},
],
},
]

```

### © 版本信息

- ProComponents 版本: [e.g. 4.0.0] 2.5.0
- umi 版本 4.0.68
- 浏览器环境 chrome
- 开发环境 [e.g. mac OS] mac

### 🚑 其他信息

Contributor guide

Open the contributing guide

Research direction

Start with the BetaSchemaForm entry point and the supplied columns reproduction, focusing on the formList, nested group, title callback, and formItemProps callback. Trace what arguments those callbacks receive; done means the current formList index is available where needed so the label can include it, with the reproduction showing the expected indexed label.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.