ant-design / ant-design/pro-components

🐛[BUG] ProTable 连续 pin 前两列的时候 left 计算错误

Open
#8,294 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

### 🐛 bug 描述

代码如下:

```ts
column = [
{
title: '第一列',
fixed: 'left',
},
{
title: '二列',
fixed: 'left',
},
// ...其他
]
```

这时第一列可以正常固定,但是第二列固定在 left: 0 的地方,和第一列重叠了。

原版的 antd table 没有这个问题:

### 📷 复现步骤

代码见下面的code sandbox里,左右滚动时录屏如下:

https://github.com/ant-design/pro-components/assets/16148054/ba248857-ba6b-4737-bf13-22847f758d0c

### 🏞 期望结果

实现 antd table 这样的连续 pin 两列的效果:
https://ant.design/~demos/components-table-demo-fixed-columns

### 💻 复现代码

[code sandbox](https://codesandbox.io/p/sandbox/cha-xun-biao-ge-forked-dhfl58)

### © 版本信息

- ProComponents 版本: 2.6.50
- umi 版本 文档上的 code sandbox 示例改的,没有用 umi
- 浏览器环境 Edge
- 开发环境 [e.g. mac OS] mac OS

### 🚑 其他信息

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the overlapping second fixed column in the linked CodeSandbox, then trace ProTable's fixed-column handling and its left-offset calculation. Done means two consecutive left-pinned columns remain side by side while horizontally scrolling, matching the linked Ant Design Table behavior.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.