Skip to content

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

Merged
debba merged 3 commits into
TabularisDB:mainfrom
zzx04-cool:feat/1032-clipboard-filter
Nov 9, 2026
Merged

debba merged 3 commits into
TabularisDB:mainfrom
zzx04-cool:feat/1032-clipboard-filter

Conversation

@zzx04-cool

@zzx04-cool zzx04-cool commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Add "= clipboard" and "IN (clipboard)" entries to the cell context menu (dashboard)

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, non-numeric line dropping for numeric columns
  • add "= clipboard" and "IN (clipboard)" cell context menu entries, hidden for insertion rows, BLOB and JSON cells
  • clipboard is read through the platform adapter (platform.readClipboard), so the feature also works in the tabularis web browser build; a denied clipboard permission surfaces as the existing "Could not read the clipboard" toast
  • plugin drivers get the feature through activeCapabilities: the clause builder and identifier quoting accept a DriverCapabilities object, covered by a dedicated test
  • add i18n keys in all locales and unit tests for clause building (including buildCellValueFilterClause with IN)

@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

Re-reviewed at HEAD f1bb7a3. The PR's own diff is 16 files: the 14 files from the previous review (unchanged) plus a new commit, fix(sidebar): defer keyboard activation setup until the key event.

Checked against current code:

  • The new commit changes onKeyDown={onActivationKey(handleToggle)} to onKeyDown={(event) => onActivationKey(handleToggle)(event)} in SidebarNestedDatabaseItem.tsx and SidebarSchemaItem.tsx. onActivationKey returns a handler that checks target === currentTarget and the Enter/Space keys, then calls preventDefault() and activate(event). The wrapper behaves the same as before. Its only effect is that the handler is built when the key event fires rather than on each render. handleToggle takes no arguments, so the call type-checks.
  • The clipboard filter feature (= clipboard and IN clipboard) is unchanged since the last review. IN is added to CellValueFilterOperator and to both Record<CellValueFilterOperator, string> maps in DataGrid.tsx, IN literals go through formatSqlValueForColumnComparison, and numeric columns drop non-numeric clipboard lines with a warning toast. All 11 locales have the new keys.
  • Both earlier inline comments are outdated (line: null) and their findings are resolved.

Not run: tests, lint and typecheck (read-only review).

Files Reviewed (16 files)
  • packages/web-ui/src/components/ui/DataGrid.tsx
  • packages/web-ui/src/components/layout/sidebar/SidebarNestedDatabaseItem.tsx
  • packages/web-ui/src/components/layout/sidebar/SidebarSchemaItem.tsx
  • packages/web-ui/src/utils/cellValueFilter.ts
  • packages/web-ui/tests/utils/cellValueFilter.test.ts
  • packages/web-ui/src/i18n/locales/de.json
  • packages/web-ui/src/i18n/locales/en.json
  • packages/web-ui/src/i18n/locales/es.json
  • packages/web-ui/src/i18n/locales/fr.json
  • packages/web-ui/src/i18n/locales/it.json
  • packages/web-ui/src/i18n/locales/ja.json
  • packages/web-ui/src/i18n/locales/ko.json
  • packages/web-ui/src/i18n/locales/pt-BR.json
  • packages/web-ui/src/i18n/locales/ru.json
  • packages/web-ui/src/i18n/locales/tl.json
  • packages/web-ui/src/i18n/locales/zh.json
Previous Review Summaries (8 snapshots, latest commit da7e115)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit da7e115)

Status: No Issues Found | Recommendation: Merge

Re-reviewed at HEAD da7e115. The PR was rebased onto the new packages/web-ui layout (base dc919d0). Its own diff is 14 files, additive in code, with no stale-base reverts. The two earlier inline comments are outdated and both findings are resolved.

Checked against current code:

  • IN is added to CellValueFilterOperator and both Record<CellValueFilterOperator, string> maps in DataGrid.tsx.
  • buildCellValueFilterClause quotes each IN item through formatSqlValueForColumnComparison, the same path as =. A scalar value falls back to a single-item list.
  • isNumericColumnType is imported from @/utils/foreignKeys. platform (from usePlatformCapabilities), showToast and readClipboard are in scope in DataGrid.tsx.
  • onFilterByValue takes value: unknown, so passing an array for IN type-checks.
  • = clipboard and IN clipboard both show filterClipboardNoNumeric when nothing numeric remains. Partial-drop and truncation get separate warning toasts. Clipboard read errors are caught and toasted.
  • All 11 locales have the new keys (ru also has _few/_many).
  • The new tests cover dedupe, the cap, header dropping on numeric columns, IN clause building and isNumericClipboardValue.

Not run: tests, lint and typecheck (read-only review).

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

Previous review (commit 0f1d16c)

Status: No Issues Found | Recommendation: Merge

Re-reviewed at HEAD 0f1d16c. The PR diff against main is still additive in the code files (DataGrid.tsx, cellValueFilter.ts, tests), with no stale-base reverts. The locale JSON files also contain whitespace-only reformatting of existing blocks alongside the new keys. The two earlier inline comments (stale base, misleading non-numeric toast) are outdated and both findings are resolved.

Checked against current code:

  • IN is added to CellValueFilterOperator and both Record<CellValueFilterOperator, string> maps.
  • buildCellValueFilterClause quotes each IN item through formatSqlValueForColumnComparison, the same path as =.
  • isNumericColumnType is imported from @/utils/foreignKeys.
  • = clipboard and IN clipboard both show filterClipboardNoNumeric when nothing numeric remains. Partial-drop and truncation get separate warning toasts.
  • Clipboard read errors are caught and toasted, and readText and showToast are in scope in DataGrid.tsx.
  • All 11 locales have the new keys (ru also has _few/_many).
  • The new tests cover dedupe, the cap, header dropping on numeric columns, and isNumericClipboardValue.

Not run: tests, lint and typecheck (read-only review).

Files Reviewed (14 files)
  • src/components/ui/DataGrid.tsx
  • src/utils/cellValueFilter.ts
  • tests/utils/cellValueFilter.test.ts
  • 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

Previous review (commit b462bb0)

Status: No Issues Found | Recommendation: Merge

The PR is now a single commit rebased onto the repo-wide Prettier reformat (44270cab). The diff against main still contains only the clipboard-filter changes (14 files, +403/-4), with no stale-base reverts. The earlier CRITICAL (stale base) and WARNING (misleading non-numeric toast) findings were already fixed and their inline comments are outdated.

Checked against current code:

  • IN is added to CellValueFilterOperator, and both Record<CellValueFilterOperator, string> maps (CELL_VALUE_FILTER_BADGES, CELL_VALUE_FILTER_LABEL_KEYS) are updated.
  • onFilterByValue takes value: unknown, so passing a string[] for IN type-checks. buildCellValueFilterClause quotes each item through formatSqlValueForColumnComparison, the same path as =.
  • isNumericColumnType is exported from @/utils/foreignKeys and imported correctly in both DataGrid.tsx and cellValueFilter.ts.
  • The = clipboard and IN clipboard paths both use dataGrid.filterClipboardNoNumeric when nothing numeric remains. The partial-drop and truncation cases get their own warning toasts.
  • Clipboard read errors are caught and toasted. The async menu action is compatible with action?: () => void.
  • Every new i18n key is present in all 11 locales, including pluralisation (_one/_other, and _few/_many for ru).
  • The new tests cover dedupe, the cap, header dropping on numeric columns, and isNumericClipboardValue.
Files Reviewed (14 files)
  • src/components/ui/DataGrid.tsx
  • src/utils/cellValueFilter.ts
  • tests/utils/cellValueFilter.test.ts
  • 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

Previous review (commit 5bd7652)

Status: No Issues Found | Recommendation: Merge

The previous CRITICAL finding (stale base reverting undo/redo and "copy column names as SQL list") is resolved: the PR is now a single commit rebased directly onto current main (cf518285), and the diff contains only the clipboard-filter changes. The earlier non-numeric-clipboard toast warning also stays fixed: both the = clipboard and IN clipboard paths use dataGrid.filterClipboardNoNumeric, and every new key is present in all 11 locales.

Checked against current code:

  • IN is added to CellValueFilterOperator, and the Record<CellValueFilterOperator, string> maps (CELL_VALUE_FILTER_BADGES, CELL_VALUE_FILTER_LABEL_KEYS) are updated, so there is no exhaustiveness gap.
  • buildCellValueFilterClause handles IN through the same formatSqlValueForColumnComparison path as =, so quoting and dialect handling stay consistent.
  • isNumericClipboardValue uses the same regex as formatSqlValueForFilter, so numeric columns never emit quoted non-numeric text.
  • The async menu action is compatible with action?: () => void, and clipboard read errors are caught and toasted.
  • The new tests cover dedupe, the cap, the numeric-column drop, and header handling.
Files Reviewed (14 files)
  • src/components/ui/DataGrid.tsx
  • src/utils/cellValueFilter.ts
  • tests/utils/cellValueFilter.test.ts
  • 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

Previous review (commit 1661976)

Status: 1 Issue Found | Recommendation: Address before merge

The earlier warning (misleading "Clipboard is empty" toast for non-numeric clipboard content) is resolved: both the = clipboard and IN clipboard paths now show dataGrid.filterClipboardNoNumeric, and the key exists in all 11 locales.

However, the latest commit (1661976c) is based on a stale tree. Its diff removes code that exists on current main and is unrelated to this feature, so merging as-is would revert two merged features.

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
src/components/ui/DataGrid.tsx 374 Reverts undo/redo of pending grid edits (#1206: onUndo/onRedo/canUndo/canRedo/onBeginBatchEdit/onEndBatchEdit, Ctrl/Cmd+Z/Y handler, batching, undo/redo i18n keys) and "copy column names as SQL list" (#1185: action, menu item, copyColumnNamesSqlList key). Also drops per-connection dialect resolution (getConnectionData) for copied SQL. Editor.tsx still passes onUndo/onBeginBatchEdit, so these features would silently stop working. Rebase onto current main so the diff only contains the clipboard-filter changes.
Files Reviewed (14 files)
  • src/components/ui/DataGrid.tsx - 1 issue
  • src/utils/cellValueFilter.ts
  • tests/utils/cellValueFilter.test.ts
  • 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

Fix these issues in Kilo Cloud

Previous review (commit 32f33dd)

Status: No Issues Found | Recommendation: Merge

The previous warning (misleading "Clipboard is empty" toast for non-numeric clipboard content) is resolved: both the "= clipboard" and "IN clipboard" paths now show the new dataGrid.filterClipboardNoNumeric message, and the key is present in all 11 locale files.

Files Reviewed (12 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

Previous review (commit ef113db)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src/components/ui/DataGrid.tsx 3150 The "= clipboard" path shows "Clipboard is empty" when the clipboard holds a non-numeric value for a numeric column. The "IN clipboard" path does the same at line 3187 when every line is dropped as non-numeric. The message should name the real cause.
Files Reviewed (14 files)
  • src/components/ui/DataGrid.tsx - 1 issue
  • src/utils/cellValueFilter.ts
  • tests/utils/cellValueFilter.test.ts
  • 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

Fix these issues in Kilo Cloud

Previous review (commit 1f4bf48)

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 claude-sonnet-5.5 · Input: 258 · Output: 2.9K · Cached: 355.2K

Review guidance: REVIEW.md from base branch main

@zzx04-cool

Copy link
Copy Markdown
Contributor 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

Comment thread src/components/ui/DataGrid.tsx Outdated
isNumericColumnType(colDataType) &&
!isNumericClipboardValue(clipboardText)
) {
showToast(t("dataGrid.filterClipboardEmpty"), {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WARNING: Misleading toast when the clipboard value is non-numeric

This branch runs when the clipboard is not empty but its value isn't numeric for a numeric column (e.g. a copied spreadsheet header). It reuses dataGrid.filterClipboardEmpty ("Clipboard is empty — no filter applied"), so the user is told the clipboard is empty when it actually contains text. The same happens on the IN path (line 3187) when every line is dropped as non-numeric: nonNumericDropped > 0 but values.length === 0 shows "Clipboard is empty" and returns before the filterClipboardNonNumericDropped toast. Use a dedicated message (e.g. reuse/adapt filterClipboardNonNumericDropped, or add a new key) for the non-numeric case so the feedback matches the cause.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@zzx04-cool

Copy link
Copy Markdown
Contributor Author

@debba Thanks for the review! I've pushed the requested changes:

  • Numeric columns drop non-numeric clipboard lines. parseClipboardInList now takes the column type and discards lines that aren't numeric literals (e.g. a copied spreadsheet header), so a numeric column no longer produces IN ('user_id', 1, 2) — MySQL would silently cast 'user_id' to 0 and PostgreSQL would reject the query. The same guard applies to = clipboard, which bails out instead of filtering on a non-numeric value.
  • Skipped lines are reported. A warning toast (filterClipboardNonNumericDropped) says how many non-numeric lines were dropped; if no numeric values remain at all, an error toast shows a "no filter applied" message rather than running an empty filter.
  • Added header-row tests in tests/utils/cellValueFilter.test.ts: a header copied with the column, a fully non-numeric clipboard, a duplicate header, and the isNumericClipboardValue predicate.

I also addressed the Kilo review note: when the clipboard held text but none of it was numeric, the code reused the "clipboard is empty" message, which was misleading. It now uses a dedicated filterClipboardNoNumeric message ("Clipboard contains no numeric values — no filter applied"), with translations in all 11 locales. All three feedback paths are covered: truly empty clipboard, no numeric values, and partially dropped lines.

Local checks: vitest (37 tests), tsc --noEmit, and eslint all pass.

Happy to rebase once #1081 lands to avoid the conflict noted in the other comment.

@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 the quick turnaround, and for going one step further than I asked. Dropping the header line in parseClipboardInList and reporting how many lines were skipped is exactly what I had in mind. Splitting "clipboard is empty" from "clipboard has no numeric values" makes the feedback much clearer, and the header and duplicate-header tests lock the behaviour in nicely. I checked the branch locally: 255 tests pass across cellValueFilter, DataGrid and i18n, tsc -b is clean, eslint is clean, and the new keys are in all 11 locales.

The fix itself is good. The only thing stopping the merge is that #1081 landed on main on the 15th, so the branch now conflicts in DataGrid.tsx, cellValueFilter.ts and every locale file. Could you rebase onto main? Since you'll be in there anyway:

  • CellValueFilterOperator now also has >, >=, <, <= and contains, so IN needs to be added next to them, and also to CELL_VALUE_FILTER_LABEL_KEYS.
  • The "Filter by this value" entries now live in a submenu. I'd like the two clipboard entries to go in there too, so the context menu stays short.

Two small things you can pick up during the rebase if you like, they're not blocking:

  • filterClipboardNonNumericDropped uses "value(s)". We already use i18next _one / _other plurals elsewhere (databaseCount_one for example), so it would read better that way.
  • isNumericColumnType is a substring match on keywords like int, so a PostgreSQL interval column counts as numeric. With this change, IN (clipboard) on that column drops every line and says there are no numeric values. It's an old helper and a rare case, so a follow-up is fine.

Once it's rebased I'll take another look and try it in the app before merging.

@zzx04-cool
zzx04-cool force-pushed the feat/1032-clipboard-filter branch from 32f33dd to 1661976 Compare October 19, 2026 13:16
Comment thread src/components/ui/DataGrid.tsx Outdated
activeCapabilities ??
activeDriver;
// Dialect the copied SQL literals follow (copy as INSERT / IN list).
const copyDriver = activeCapabilities ?? activeDriver;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CRITICAL: PR reverts two already-merged features (stale base)

The single commit in this PR is based on an older tree and, in DataGrid.tsx and all 11 locale files, deletes code that exists on current main (0524ac9a) and is unrelated to clipboard filtering:

  • Undo/redo of pending grid edits (feat(editor): undo and redo pending grid edits (#1167) #1206): the onUndo/onRedo/canUndo/canRedo/onBeginBatchEdit/onEndBatchEdit props, the Ctrl/Cmd+Z / Ctrl+Y handler, the batching in deleteRowsByIndices and stageCellWrites, and the undo/redo/undoGridEdit/redoGridEdit i18n keys.
  • Copy column names as SQL list (feat(grid): copy column names as quoted SQL list (#1153) #1185): the copyColumnNamesAsSqlList action, its menu item, the formatColumnNamesAsSqlList import and the copyColumnNamesSqlList i18n key.
  • This line also drops the per-connection getConnectionData(connectionId) dialect resolution, so copied SQL literals / IN lists fall back to the globally active connection's dialect instead of the grid's own connection.

src/pages/Editor.tsx still passes onUndo={handleUndoGrid} and onBeginBatchEdit={handleBeginBatchEdit} (and objectNameCopy.ts still exports the formatter), so merging would silently disable these features with no test coverage noticing. Please rebase onto current main and resolve conflicts so the diff contains only the clipboard-filter changes.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@zzx04-cool
zzx04-cool force-pushed the feat/1032-clipboard-filter branch from 1661976 to 5bd7652 Compare October 19, 2026 13:38
@zzx04-cool

Copy link
Copy Markdown
Contributor Author

Hi @debba, thanks for the thorough review! Rebased onto the latest main and addressed all blocking points:

  • Both clipboard items now live in the "Filter by this value" submenu.
  • IN coexists with the new >/>=/</<=/contains operators from feat(datagrid): comparison and contains operators in "Filter by this value" #1081 and is registered in CELL_VALUE_FILTER_LABEL_KEYS.
  • filterClipboardNonNumericDropped now uses i18next _one/_other pluralization across all 11 locales.
  • The interval false-positive in isNumericColumnType is left as a follow-up as you suggested.

Verified locally: typecheck, eslint and the full suite (6752 tests) pass.

debba
debba previously approved these changes Oct 21, 2026

@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 sticking with this one. Putting both clipboard entries in the "Filter by this value" submenu keeps the context menu nice and short, and adding IN to CELL_VALUE_FILTER_BADGES and CELL_VALUE_FILTER_LABEL_KEYS keeps the operator maps exhaustive with the new >/</contains operators from #1081. I checked the branch locally: 323 tests pass across cellValueFilter, DataGrid and the i18n suite, and tsc -b and eslint on the changed files are clean.

I'm approving this. Before it can go in I need one more rebase, and I'm sorry about that: #1247 reformatted the whole codebase with Prettier right after your rebase, so DataGrid.tsx, cellValueFilter.ts and the test file conflict again. The conflicts are formatting only (4-space indent, single quotes, the @/types/plugins import). After resolving them please run pnpm format, because pnpm lint now also runs prettier --check.

While you're in there, one small i18n fix: the Russian filterClipboardNonNumericDropped only has _one and _other, but Russian needs _one, _few, _many and _other (see connectionCount_few in ru.json). As it is, 2 to 20 skipped values fall back to the English text, and 21 shows "Пропущено 1 ..." because _one hardcodes the 1 instead of using {{count}}.

A couple of things that are fine as follow-ups, nothing to do in this PR:

  • Like interval, geometry types (POINT, LINESTRING) contain "int", so isNumericColumnType treats them as numeric and both clipboard entries would say there are no numeric values. isComparableColumnType already guards against this with isGeometricType, so the clipboard path could reuse the same check.
  • On a MySQL FLOAT column the clipboard values arrive as strings, so they skip the Math.fround widening that formatSqlValueForColumnComparison applies to numbers, and IN (clipboard) with something like 1.1 probably won't match the stored value.

Once it's rebased I'll try it in the app on MySQL and PostgreSQL before merging.

@zzx04-cool

Copy link
Copy Markdown
Contributor Author

Thanks @debba, both done and force-pushed.

Rebased onto the latest main (after #1247's Prettier reformat). The conflicts in DataGrid.tsx, cellValueFilter.ts and cellValueFilter.test.ts were formatting only — 4-space indent, single quotes, and the @/ import aliases — so I resolved them by re-applying the feature on top of the formatted tree and ran pnpm format. The branch is now a single commit, 1 ahead of main with no conflicts, and the diff is still just the 14 clipboard-filter files.

Russian pluralization fixed. filterClipboardNonNumericDropped now has all four Russian forms, modeled on connectionCount:

  • _one — Пропущено {{count}} нечисловое значение … (uses {{count}} instead of the hardcoded 1)
  • _few — Пропущено {{count}} нечисловых значения …
  • _many / _other — Пропущено {{count}} нечисловых значений …

Verified locally (Node v22.23.2, pnpm 10.30.3):

  • pnpm format then pnpm lint — clean (eslint + prettier --check + theme tokens)
  • pnpm typecheck (tsc -b) — clean
  • vitest — cellValueFilter 49, DataGrid 182, and the i18n suite (388 tests across those scopes) all pass; the full suite is green (6830 tests / 399 files)

I've left the two follow-ups for separate PRs as you suggested, not in this one: geometry types (POINT/LINESTRING) matching isNumericColumnType via the "int" substring, and MySQL FLOAT clipboard values arriving as strings and bypassing Math.fround.

Ready for another look.

@zzx04-cool
zzx04-cool force-pushed the feat/1032-clipboard-filter branch 3 times, most recently from b462bb0 to 0f1d16c Compare October 21, 2026 15:42

@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 the quick turnaround on the last round. The Russian plurals now have all four forms with {{count}} in _one, which is exactly what I was after, and the rebase on top of the Prettier reformat was clean. I checked the branch again: 334 tests pass across cellValueFilter, DataGrid and the i18n suite, and pnpm build and eslint are clean.

I can't merge it yet though, and I'm sorry, because this time it's main that moved under you. The whole frontend now lives in packages/web-ui/ (src, tests and locales), so the same React app can run both in the desktop app and in the new tabularis web server. GitHub reports the branch as conflicting because of the move. Git's rename detection carries most of your changes across, but there's one real overlap: on main, DataGrid.tsx no longer imports readText from @tauri-apps/plugin-clipboard-manager. Clipboard access goes through the platform adapter now, and eslint.config.js blocks direct @tauri-apps/** imports in the web UI. I tried a throwaway merge and pnpm build fails with Cannot find name 'readText' on both clipboard entries (DataGrid.tsx:3392 and :3446 on your branch).

So when you rebase, please:

  • move your changes to packages/web-ui/src/... and packages/web-ui/tests/utils/cellValueFilter.test.ts
  • replace readText() in the two clipboard actions with platform.readClipboard(). platform from usePlatformCapabilities() is already in DataGrid, and pasteFromClipboard does the same thing. As a bonus the feature then works in the browser version too: if the user denies clipboard permission it throws, and your existing "Could not read the clipboard" toast handles it.
  • keep only the new keys in the locale files. The last push also reformatted unrelated blocks in all 11 of them (environment.short, the whole themePackages section, "triggers":{), about 100 lines each. Locales are in .prettierignore, so I think an editor JSON formatter did it. Leaving those blocks alone keeps the diff readable and avoids conflicts with other PRs that touch them.

One small thing while you're in there: there's no test yet for buildCellValueFilterClause with IN. A few cases would be nice, for example a numeric column, a string with a quote like O'Brien, and one that passes a capabilities object instead of a driver id (.rules/plugins.md asks for that last one). It would also help to add a line to the PR description saying plugin drivers get the feature through activeCapabilities.

Something I found while testing, not for this PR: formatSqlValueForFilter only doubles single quotes, so on MySQL a clipboard line ending with a backslash, like C:\temp\, ends up as 'C:\temp\' and breaks the query. That helper is older than your change, so it's not on you, but clipboard text makes it easier to hit and I wanted you to know. The geometry and FLOAT follow-ups from last time are still fine to leave for later.

Once it's rebased I'll try it in the app on MySQL and PostgreSQL before merging.

@zzx04-cool
zzx04-cool force-pushed the feat/1032-clipboard-filter branch from 0f1d16c to da7e115 Compare November 5, 2026 15:46
@zzx04-cool

Copy link
Copy Markdown
Contributor Author

Rebased onto main with the packages/web-ui/ layout. Everything from your last review is in:

  • changes moved to packages/web-ui/src/... and packages/web-ui/tests/utils/cellValueFilter.test.ts
  • both clipboard actions now use platform.readClipboard() instead of readText() — the feature works in the browser build too, and a denied permission lands on the existing "Could not read the clipboard" toast
  • locale files now contain only the new keys (9 lines each, 11 for the Russian plurals); the unrelated reformatting is gone
  • added buildCellValueFilterClause IN tests: numeric column, O''Brien quoting, scalar-as-single-item, and a capabilities-object case per .rules/plugins.md
  • PR description updated with the plugin-driver note

Verified on the rebased branch: cellValueFilter 56/56, DataGrid + i18n suites 369/369, tsc -b clean, eslint clean on the changed files.

Noted on the MySQL trailing-backslash escaping in formatSqlValueForFilter — agreed it is out of scope here; happy to file a separate issue for it.

debba
debba previously approved these changes Nov 9, 2026

@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 handling the frontend move and the clipboard adapter change. Both actions now call platform.readClipboard(), and the added IN cases cover quoted text and a capabilities object. I reran the filter, DataGrid and i18n suites on this head: 425 tests pass.

I haven't found a blocking issue. One nit for a follow-up: Prettier still reports DataGrid.tsx and cellValueFilter.test.ts. Please format those two files without reformatting the locale files.

Approved. I'm leaving this unmerged until my manual clipboard checks on MySQL and PostgreSQL, including denied browser permission and the transposed layout.

I have now done the manual Web app checks with the integrated frontend, the Tabularis 0.31.0 server container, PostgreSQL 16 and MySQL 8.4. Through the real context menu, clipboard id\n1\n2\n2 produced IN (1, 2) and returned rows 1 and 2 on both databases. Filtering a name with O'Brien generated O''Brien and returned the matching row. In the transposed layout, a clipboard list of 1 and 3 returned those two records. The shared browser denied clipboard access; that path displayed Could not read the clipboard and kept all three rows and the empty filter. For the successful cases I used local Chromium with clipboard permissions granted, without replacing the platform adapter or database client.

The formatting nit is fixed. I merged main, reran 429 filter/grid/i18n tests, and corrected the two inherited sidebar keyboard handlers flagged by the React linter; the 119 sidebar tests and source ESLint pass. The integrated production build passes. I have finished the manual checks and will merge once the refreshed CI passes. Desktop was not exercised here.

@debba
debba merged commit f48de56 into TabularisDB:main Nov 9, 2026
11 checks passed
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