Skip to content

feat(grid): support hiding identical value columns (#10820) - #11146

Merged
t8y2 merged 2 commits into
t8y2:mainfrom
lxk955:feat/10820-hide-identical-value-columns
Oct 7, 2026
Merged

t8y2 merged 2 commits into
t8y2:mainfrom
lxk955:feat/10820-hide-identical-value-columns

Conversation

@lxk955

@lxk955 lxk955 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves #10820

Adds the ability to hide columns with identical values from the data grid context menu, allowing users to quickly hide uniform columns and inspect differing columns when comparing data across multiple rows.

Changes

  • Added identicalValueColumnIndexes and areCellValuesEqual utilities in dataGridColumnVisibility.ts to identify columns that have identical values across comparison rows.
  • If multiple rows are explicitly selected, comparisons run across the selected rows; otherwise, comparisons run across all visible rows in the current view.
  • Added hideIdenticalColumns action and label support to createDataGridColumnContextMenuItems in dataGridContextMenu.ts.
  • Integrated hideIdenticalColumns into DataGrid.vue context menu, displaying the count of columns to be hidden when applicable and disabling the option when no identical columns exist.
  • Added localization strings across all 12 supported locales.
  • Added unit tests in dataGridColumnVisibility.test.ts and dataGridContextMenu.spec.ts.

@github-actions github-actions Bot added area/desktop Desktop application or Tauri shell enhancement New feature or request ui-change Changes user-visible interface, text, or visual assets labels Oct 6, 2026

@t8y2 t8y2 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

维护者补丁(79092d0e,基于 6bed236),修掉审阅中发现的正确性问题:

  1. 索引空间错位(阻断项):getComparisonRows() 原先从 visibleDisplayItems 取行,其 data 已被 visibleRowData() 按可见位置重排,而 identicalValueColumnIndexes 的候选索引是原始列索引。只要有列被隐藏/重排,比较就会读错单元格(超出可见数量的原始索引每行都读到 undefined,被误判为相同列而隐藏)。现改为从 displayItems.value 取全宽 item.data,与回退分支的 props.result.rows 语义一致,并加注释说明该约束。
  2. pt-BR 拼写:idénticos → idênticos(两处;西语尖音符改为葡语扬抑符,与文件内既有 idênticos 用法一致)。
  3. 回归锁:新增两个测试——纯函数层用例锁「候选为原始索引时行须全宽」契约(dataGridColumnVisibility.test.ts);源码断言锁 getComparisonRows 必须用 displayItems 且不得再引用 visibleDisplayItems(dataGridContextMenu.test.ts,沿用该文件既有源码断言风格)。

核验:dataGridColumnVisibility.test.ts、dataGridContextMenu.test.ts、dataGridContextMenu.spec.ts 共 46 用例全部通过;DataGrid.vue 与 pt-BR.ts 通过 oxfmt 检查(app-tests 文件不在格式门禁内,保持与 PR 原有风格一致)。CI 跑完后即可合并。

@t8y2
t8y2 merged commit 09c47b1 into t8y2:main Oct 7, 2026
27 checks passed
@t8y2

t8y2 commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Thanks for the contribution! Merged in 09c47b1, will be released in the next version.

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

Labels

area/desktop Desktop application or Tauri shell enhancement New feature or request ui-change Changes user-visible interface, text, or visual assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 数据网格右键菜单增加隐藏相同数值列功能

2 participants