Skip to content

feat: 给表格增加一个配置项 - #5335

Open
rubbishmaker wants to merge 4 commits into
VisActor:developfrom
rubbishmaker:feat/add-drop-cloumn-config@20260930
Open

rubbishmaker wants to merge 4 commits into
VisActor:developfrom
rubbishmaker:feat/add-drop-cloumn-config@20260930

Conversation

@rubbishmaker

Copy link
Copy Markdown

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Refactoring
  • Update dependency
  • Code style optimization
  • Test Case
  • Branch merge
  • Site / documentation update
  • Demo update
  • Workflow
  • Chore
  • Release
  • Other (about what?)

🔗 Related issue link

#4809

💡 Background and solution

📝 Changelog

增加一个配置项realtime,用于控制表格的resize行为。默认为true,与当前行为保持一致,为false时不会实时渲染,拖拽中 :只累积偏移量pendingDelta + 移动指示线,不重排列宽/行高,松开时 :一次性把累计偏移应用到真实列宽/行高
| ---------- | --------- |
| 🇺🇸 English | |
| 🇨🇳 Chinese | |

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

copilot:summary

🔍 Walkthrough

copilot:walkthrough

@fangsmile

fangsmile commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

有两处阻塞性问题需要修正后再合并:

  1. 非实时模式会把整段 pendingDeltaX 一次传入 min/max 约束,当前按“当前宽度离哪个边界更近”选择边界,可能产生反向 resize。例如宽度 180、minWidth=100、maxWidth=200,向左累计拖动 100px 后目标为 80,但代码会取 maxWidth - widthCache = 20,最终反而扩到 200。应按目标值的越界方向 clamp,并补跨越 min/max 的非实时回归用例。

  2. adaptive 模式重复扣减累计位移。rightColWidth 已是 rightColWidthCache - detaX,随后又用 rightColWidth - detaX 判断 limitMinWidth。相邻列宽 150、最小宽 10、累计右拖 80px 时,右列应为 70,但当前会把位移错误截成 60px,导致最终尺寸与指示线终点、实时模式不一致。行高路径存在相同问题,需要同步修正并补测试。

rubbishmaker and others added 2 commits October 10, 2026 15:28
- Clamp column width by the target value's out-of-bounds direction so
  non-realtime mode no longer reverse-resizes to the far min/max boundary
  when the whole pending delta is applied at once.
- Stop double-subtracting the accumulated delta on the adaptive neighbor
  column/row, keeping the final size consistent with the indicator line
  and realtime mode.
- Add deterministic regression cases for non-realtime min clamp and
  adaptive neighbor column/row resize.
- Mount the resize-realtime example toggle inside the table root element
  so it no longer leaks onto other demos.

@visactor-review-bot visactor-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现 1 个需要修复的问题,见行内评论。

state.columnResize.pendingDeltaX
);
state.table.scenegraph.updateNextFrame();
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] 非实时拖拽提交后应通知依赖 resize_column 的布局同步

当甘特图通过公开的 taskListTable: { tableWidth: 'auto', resize: { realtime: false } } 配置启用非实时列拖拽时,此处只累计位移便返回,因此 container-dom.ts 在每次鼠标移动后发出的 resize_column 携带的 colWidth 始终是旧值;松开时 endResizeCol() 虽提交新宽度并发出 resize_column_end,却不再发出 resize_column。packages/vtable-gantt/src/state/gantt-table-sync.ts 的 syncTableWidthFromTable() 只监听 resize_column 来调用 _syncTableSize(),导致任务列表变宽后甘特图起点、分隔线与画布宽度仍停留在旧位置(缩窄时也会留空)。行高的 resize_row 同样会在新模式下仅报告旧值。建议提交后通知依赖过程事件的调用方(或使相关调用方改为监听结束事件),并补跨包回归验证。此问题不同于现有讨论的 min/max 反向调整和 adaptive 重复扣减,影响的是最终尺寸正确时仍未同步的跨包布局。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants