Skip to content

feat(grid): filter a column by clipboard value (= clipboard, IN clipb… - #1112

Open
zzx04-cool wants to merge 1 commit into
TabularisDB:mainfrom
zzx04-cool:feat/1032-clipboard-filter
Open

zzx04-cool wants to merge 1 commit into
TabularisDB:mainfrom
zzx04-cool:feat/1032-clipboard-filter

Conversation

@zzx04-cool

Copy link
Copy Markdown

…oard)

Closes #1032

  • add IN operator to buildCellValueFilterClause, formatting each value with formatSqlValueForColumnComparison
  • add parseClipboardInList: line split, blank-line/duplicate removal, 1000-value cap with truncation flag
  • add "= clipboard" and "IN (clipboard)" cell context menu entries, hidden for insertion rows, BLOB and JSON cells
  • add i18n keys in all locales and unit tests for clause building

…oard)

Closes TabularisDB#1032

- add IN operator to buildCellValueFilterClause, formatting each value
  with formatSqlValueForColumnComparison
- add parseClipboardInList: line split, blank-line/duplicate removal,
  1000-value cap with truncation flag
- add "= clipboard" and "IN (clipboard)" cell context menu entries,
  hidden for insertion rows, BLOB and JSON cells
- add i18n keys in all locales and unit tests for clause building
@zzx04-cool
zzx04-cool force-pushed the feat/1032-clipboard-filter branch from ab7b599 to 1f4bf48 Compare October 15, 2026 06:15
@kilo-code-bot

kilo-code-bot Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (15 files)
  • src/components/ui/DataGrid.tsx
  • src/i18n/locales/de.json
  • src/i18n/locales/en.json
  • src/i18n/locales/es.json
  • src/i18n/locales/fr.json
  • src/i18n/locales/it.json
  • src/i18n/locales/ja.json
  • src/i18n/locales/ko.json
  • src/i18n/locales/pt-BR.json
  • src/i18n/locales/ru.json
  • src/i18n/locales/tl.json
  • src/i18n/locales/zh.json
  • src/pages/Editor.tsx
  • src/utils/cellValueFilter.ts
  • tests/utils/cellValueFilter.test.ts

Reviewed by free · Input: 50.2K · Output: 2K · Cached: 170K

@zzx04-cool

Copy link
Copy Markdown
Author

Reproducible test report

Environment

  • Runtime: Node v22.23.2, pnpm 10.30.3
  • OS: Windows NT 10.0 (Win11)
  • Arch: AMD64

Test Commands & Results

  1. pnpm exec vitest run tests/utils/cellValueFilter.test.ts
    → 29 pass, 0 fail, 0 skip (21 baseline + 8 new)
  2. pnpm exec vitest run (full suite)
    → 6033 pass, 1 fail, 0 skip (371 test files)
  3. pnpm typecheck
    → passed (tsc --noEmit, no errors)
  4. pnpm exec eslint src/utils/cellValueFilter.ts src/components/ui/DataGrid.tsx src/pages/Editor.tsx tests/utils/cellValueFilter.test.ts
    → passed (no errors)

Pre-existing Failures

  • tests/themes/compatibilityBaseline.test.ts > preserves all checked-in named editor assets, including the unused legacy asset — also fails on an unmodified checkout (verified with git stash + the same command). It is a Windows CRLF checkout artifact: the test hashes the checked-in editor assets and gets different digests than the golden values. No files in this PR touch themes or that test.

Notes for Reviewer

  • Each IN value is formatted with the existing formatSqlValueForColumnComparison, so numeric columns (e.g. integer) emit unquoted numbers while varchar values stay quoted.
  • The = clipboard item trims the whole clipboard text (per the acceptance criteria) but does not otherwise alter it, so values with internal spaces survive.
  • The cap toast is a warning toast and the first 1,000 values are still applied.

@debba debba left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for building this, filtering by a list pasted from somewhere else is a really practical addition. I like that the clipboard is read when the item is clicked rather than when the menu opens, that blank lines and duplicates are dropped, and that the 1000-value cap comes with a toast instead of silently cutting the list. Reusing formatSqlValueForColumnComparison for each IN item also keeps quoting and the PostgreSQL real cast consistent with the existing = filter. The tests and typecheck pass on the branch (cellValueFilter, DataGrid, i18n: 247 tests).

There's one problem I'd like fixed before merging, because it gives wrong results without any warning.

Non-numeric clipboard lines on a numeric column. A very common way to fill the clipboard is copying a column from a spreadsheet, header included. With the clipboard set to:

user_id
1
2

IN (clipboard) on an int column builds `user_id` IN ('user_id', 1, 2) (I checked it through parseClipboardInList + buildCellValueFilterClause with the mysql driver). Then:

  • MySQL casts 'user_id' to 0, so the filter also returns every row where user_id = 0, with only a 1292 Truncated incorrect DOUBLE value warning that the user never sees.
  • PostgreSQL rejects the whole query: ERROR: invalid input syntax for type integer: "id" (same clause shape run against a local PG table).

The same applies to = clipboard when the clipboard holds non-numeric text.

A fix that keeps the feature friendly: when the column is numeric (isNumericColumnType), drop the lines that aren't numbers and show a short toast with how many were skipped, and if nothing numeric is left, show the existing "no filter applied" message. A test with a header line in the clipboard would lock it in.

One coordination note, not something you need to change now: #1081 (still open, waiting for a rebase) moves the "Filter by this value" entries into a submenu and extends CellValueFilterOperator and CELL_VALUE_FILTER_LABEL_KEYS, so the two PRs conflict. Whichever lands second will need to rebase, and ideally these two clipboard entries would live in that submenu too.

Since this is your first PR here: if you feel like it, come say hi on our Discord, we'd be happy to have you around: https://discord.com/invite/K2hmhfHRSt

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat]: Data grid: filter a column by the clipboard value (= clipboard, IN clipboard)

2 participants