Skip to content

feat(datagrid): native dropdown picker for ENUM and SET cells (#1283)#1297

Merged
datlechin merged 2 commits into
mainfrom
feat/enum-set-cell-picker
May 16, 2026
Merged

feat(datagrid): native dropdown picker for ENUM and SET cells (#1283)#1297
datlechin merged 2 commits into
mainfrom
feat/enum-set-cell-picker

Conversation

@datlechin
Copy link
Copy Markdown
Member

Summary

  • Native NSMenu dropdown picker for ENUM and SET columns, triggered by the cell chevron. Closes Enum type dropdown select #1283.
  • Drivers (MySQL, MariaDB, PostgreSQL, ClickHouse, DuckDB, MongoDB JSON-schema) populate allowed values directly in PluginColumnInfo.allowedValues instead of being parsed downstream from the type string.
  • Filter rows show an enum picker for = and != operators on enum columns.

Behavior

Trigger Action
Click chevron Opens native NSMenu picker (single-select for ENUM, multi-select with Cmd+click for SET)
Double-click cell body Opens text overlay editor (typing a freeform value is still possible; server rejects if invalid)
Return on focused cell Text overlay (existing behavior)

Matches Apple HIG: chevron = explicit "pick from list", cell body = "type/correct" affordance, both available for different intents.

Edge cases handled

  • Nullable column → italic NULL sentinel at top, separated.
  • Drift value (current cell value not in declared enum) → appended after a separator with exclamationmark.triangle.fill and localized tooltip.
  • Default value pre-highlighted on empty/new-row cells.
  • Very narrow column → text truncates with ellipsis, chevron hides if it can't fit at all; no text/chevron overlap.

Driver scope

Engine Discovery source
MySQL / MariaDB COLUMN_TYPE ENUM(...) / SET(...) parsed in driver
PostgreSQL pg_type + pg_enum joined in fetchColumns
ClickHouse system.columns.type Enum8('v'=1, ...) parsed in driver (handles Nullable(...) / LowCardinality(...))
DuckDB duckdb_types() WHERE type_category = 'ENUM'
MongoDB options.validator.$jsonSchema.properties.<col>.enum
SQLite Existing CHECK (col IN (...)) DDL parser retained as fallback

PostgreSQL was the most visible gap before — pg_enum data existed but never reached the picker. SQLite/MSSQL/Oracle CHECK-constraint expansion is intentionally out of scope.

Architecture changes

  • PluginColumnInfo grows optional allowedValues: [String]? (Codable shape change, no PluginKit ABI bump — JSON encoded, missing key decodes to nil).
  • MainContentCoordinator.fetchEnumValues shrinks from per-engine orchestration to col.allowedValues lookup + SQLite CHECK fallback.
  • ColumnType.parseEnumValues / parseClickHouseEnumValues deleted; moved to EnumValueParser in TableProPluginKit so drivers parse at fetch time.
  • FieldEditorResolver moved from Views/RightSidebar/FieldEditors/ to Views/Shared/FieldEditors/.
  • DataGridCoordinator.rebuildKindSets now trusts columnEnumValues instead of ct.isEnumType (the classifier only sees the raw type name and can't recognize PG UDTs).
  • EnumPopoverContentView (SwiftUI) deleted, replaced by EnumMenuPicker (AppKit NSMenu).
  • Cell drawing now clips to bounds and handles the "too narrow for ellipsis" case cleanly.

Plugin re-release

No PluginKit ABI bump needed. DuckDB and MongoDB plugins should get patch tags (plugin-duckdb-v1.0.10, plugin-mongodb-v1.0.10) after merge to main, since their code (not just data shape) changed.

Test plan

  • MySQL: ENUM and SET column cells show chevron, picker opens on click, multi-select works for SET
  • PostgreSQL: CREATE TYPE foo AS ENUM(...) column shows picker (was broken before this PR)
  • ClickHouse: Enum8('a'=1, 'b'=2) and Nullable(Enum8(...)) both work
  • DuckDB: CREATE TYPE foo AS ENUM(...) column shows picker
  • MongoDB: collection with $jsonSchema.properties.col.enum shows picker
  • SQLite: CHECK (col IN ('a','b')) regression check — still works via fallback
  • Nullable column shows NULL sentinel at top of menu
  • Filter panel: = and != on enum column shows picker instead of text input
  • Right sidebar field editor for enum still works (existing behavior)
  • Narrow column: text truncates cleanly with ellipsis, no overflow into next column
  • Very narrow column: chevron hides, no chevron/text overlap
  • Double-click cell body opens text overlay (not picker)
  • swiftlint lint --strict passes
  • xcodebuild test passes

@datlechin datlechin merged commit 70527db into main May 16, 2026
2 checks passed
@datlechin datlechin deleted the feat/enum-set-cell-picker branch May 16, 2026 18:43
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.

Enum type dropdown select

1 participant