ant-design / ant-design/pro-components

👑 [需求]EditableProTable需求Column.onCell新增isEditable参数

Open
#9,043 1 comment 0 reactions 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

### 🔩 所属模块或组件

EditableProTable

### 🥰 需求描述

当我们使用Table编辑时,数量大时希望在展示阶段合并单元格,但是在当前组件暴露的api下编辑状态无法有效处理每一行。

**非编辑状态下:**

![Image](https://github.com/user-attachments/assets/e6a3ab82-249f-447e-8264-dd2c8dc4bdca)

**编辑状态:**

合并后的列只受第一行编辑,其他行无法修改合并的列

![Image](https://github.com/user-attachments/assets/263b66b1-1d4d-4b74-99b7-da811e860d1d)

**期望的编辑效果:**

![Image](https://github.com/user-attachments/assets/dcc92e99-441b-42ac-966b-a1511254241b)

### ⛰ 功能需求适用场景

需要合并单元和单行编辑共存的场景

### 🧐 解决方案

Column 暴露一个新的onCell方法。在原有onCell参数上额外暴露一个 isEditable参数,告诉调用者在编辑状态下是否要修改传入的rowSpan值
例如:
```js

onCell(record, isEditable) {
return {
rowSpan: isEditable ? 1 : record.rowSpan
}
}

```

### 🚑 其他信息

Contributor guide

Open the contributing guide

Research direction

Start at the EditableProTable implementation and its Column onCell handling, then inspect how editing state currently interacts with rowSpan. Add the isEditable argument described in the issue and verify that merged columns can be edited per row while non-editing behavior remains unchanged; the payload names no specific test file.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.