Repository navigation
fix(datagrid): edit date cells inline and add date presets to Set Value - #1233
Merged
Merged
Conversation
datlechin
force-pushed
the
fix/datagrid-date-cell-edit
branch
6 times, most recently
from
May 12, 2026 10:08
4a31c15 to
26b2f7a
Compare
datlechin
force-pushed
the
fix/datagrid-date-cell-edit
branch
from
May 12, 2026 10:14
26b2f7a to
4c1539f
Compare
…tions, follow FK preview on row changes
…er by focused row
5 of 6 tasks
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NSDatePickerpopover for date / datetime / timestamp cells. Those cells now use the same inline text overlay editor as every other column: double-click, type, Return.CURRENT_DATECURRENT_TIMENOW(),CURRENT_TIMESTAMPSQLStatementGeneratoralready routes them throughSQLEscaping.isTemporalFunctionso they emit unquoted (no parameter binding)..datecase fromDataGridCellKindand the chevron accessory from date cells.DatePickerCellEditor.swiftdeleted entirely (-233 LOC).Other fixes folded in
CellOverlayEditornow tracks the initial value and skipsonCommitwhen the value is unchanged.MainActor.assumeIsolatedinstead of deferring throughTask { @MainActor … }.00:00:00time suffix;DateFormattingServicenow picks the right formatter bucket (date-only, time-only, datetime) per column type, and the format cache is keyed by bucket.OverlayTextViewgets its own privateUndoManagerso typing-undo no longer pollutes the window's undo stack; dismissing the editor used to leave dangling text-view targets that crashedobjc_msgSendon the next Cmd+Z.applyDeltafor.rowsInserted,.rowsRemoved,.columnsReplaced, and.fullReplacenow dismisses the active overlay editor. This means any row insertion or removal (Add Row, paste rows, undo, full reload, schema change) closes the editor — not just Add Row + Cmd+Z. The editor's row anchor would be stale otherwise.KeyHandlingTableView.didAddSubviewre-raises the editor's container whenever NSTableView adds a sibling subview (the animation-deferred row view used to render on top of the auto-opened editor).undo:/redo:viaNSApp.sendAction(_:to:nil)before falling back to the window's undo manager. Cmd+Z while editing now undoes typing in the overlay editor instead of jumping straight to data-grid changes.FK preview popover follows the selection
@Observable FKPreviewModel(cellValue + fkInfo) drivesForeignKeyPreviewView; the view re-runs its fetch via.task(id:)when either changes.tableViewSelectionDidChangecallsrefreshFKPreviewForRowChange(), which updatesmodel.cellValue,model.fkInfo, andpopover.positioningRectin place — no close-and-reopen.KeyHandlingTableViewarrow-left / arrow-right callcoordinator?.dismissFKPreviewOnColumnChange()since FK metadata is column-scoped.keyTableView.focusedRowfirst, thenselectedRowIndexes.max(), so the popover follows even during Shift+arrow extend-selection.Why
The original popover was only reachable via the chevron on date cells; double-click and the inline edit path were both explicitly blocked. The popover was effectively dead code. Folding date cells into the standard overlay editor removes a special-case path and ~233 LOC, and the Set Value submenu gives one-click access to the standard SQL function presets users already expect.
DATE presets are restricted to
CURRENT_DATErather than includingNOW()/CURRENT_TIMESTAMPso the feature works on Postgres without explicit casts. Same reasoning for TIME →CURRENT_TIME.Test plan
DATEcell → inline text editor opens with the current value. Type a new date, Return commits.TIMESTAMP/DATETIMEcell → same inline editor.CURRENT_DATE; choose it and Save → SQL preview emitsCURRENT_DATEunquoted.NOW()andCURRENT_TIMESTAMP.CURRENT_TIME.