Skip to content

feat(grid): support highlighting duplicate and null values in column context menu - #11153

Merged
t8y2 merged 2 commits into
t8y2:mainfrom
lxk955:feat/8794-highlight-duplicates-nulls
Oct 7, 2026
Merged

t8y2 merged 2 commits into
t8y2:mainfrom
lxk955:feat/8794-highlight-duplicates-nulls

Conversation

@lxk955

@lxk955 lxk955 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #8794

Summary

  • Adds column context menu actions under "Highlight" ("高亮") submenu to highlight duplicate values ("高亮重复值") and NULL values ("高亮空值"), with a "Clear Highlights" action and checkmark toggling.
  • Supports both canvas grid and DOM/transpose views with distinctive colors:
    • Duplicates: amber background
    • NULLs: sky blue background
  • Displays a highlighter icon indicator in the column header when highlighting is active on that column.
  • Shows toast feedback with match counts when toggled on.
  • Cleans up column highlight state automatically when new query results load.
  • Added comprehensive unit tests for highlight computation, context menu integration, and header indicator rendering.
  • Included multi-language translations across all 12 supported locales.

@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 7, 2026
@lxk955
lxk955 force-pushed the feat/8794-highlight-duplicates-nulls branch from ed987c0 to cdd2015 Compare October 7, 2026 03:50
@lxk955
lxk955 force-pushed the feat/8794-highlight-duplicates-nulls branch from cdd2015 to e3c1057 Compare October 7, 2026 03:52

@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.

Maintainer patch in 82c275c (on top of e3c1057) — the feature structure is solid (pure lib extraction, canvas/DOM/transpose parity, 12-locale i18n); this closes the two blocking review notes:

  1. Perf: columnHighlightMatches now short-circuits to empty key sets when no highlight rules are active, before touching displayItems. Previously the computed eagerly materialized every RowItem (displayRowRefs.map(...)) on each edit/filter/load-more invalidation even with the feature unused — the canvas draw reads the key sets every frame. This follows the useDataGridSearch empty-query early-return precedent (#8524). The isNullValue wiring is factored into a shared columnHighlightMatchesFor helper.
  2. Toast accuracy: the duplicate/NULL toast counts are now computed from the toggled columns' rules only. Previously the count spanned every active highlight column, so enabling duplicates on an all-unique column could toast another column's match count.

Deferred as a follow-up (wording choice, not patched): detection covers loaded rows only, so "No duplicate values found" can be premature on streamed results — consider "in loaded rows" phrasing later.

Checks run locally: vitest run dataGridColumnHighlight.spec.ts dataGridContextMenu.spec.ts — 21/21 passed; git diff --check clean.

@t8y2
t8y2 merged commit 79dca4b 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 79dca4b, 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