feat(datagrid): add Add button to status bar to insert a new row#1705
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Thank you for your contribution! Before we can merge this PR, you need to sign our Contributor License Agreement. To sign, please comment below with:
I have read the CLA Document and I hereby sign the CLA. xuhengyu seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
|
I have read the CLA Document and I hereby sign the CLA. |
Summary
Adds an Add button to the table status bar, to the left of the Columns button. Clicking it appends a new empty row at the end of the grid and starts inline editing the first cell. Matches the Navicat-style insert-in-place interaction.
Why
Today you can only add a row via the Edit menu (Cmd+Shift+N), double-clicking the grid's empty area, or the empty-space right-click menu. None of those are discoverable from the status bar, which is where users look for grid actions. A dedicated button makes the most common data-entry action obvious.
What changed
MainStatusBarView: aplus+ "Add" button, shown only in Data view mode when the current table is editable (not a view, not read-only, not write-blocked by safe mode, has a table name). Hover showsAdd Row (Cmd+Shift+N).MainEditorContentView: wires the button to the existingonAddRowclosure viacurrentTabAllowsAddRow.CHANGELOG.md: one line under[Unreleased]>Added.How it works
The button calls
coordinator.addNewRow(), which is the same path as the menu item and the existing shortcuts. No new core logic:RowOperationsManager.addNewRowbuilds the row (DEFAULT sentinel for columns with defaults, NULL otherwise), appends it, and records the change.beginEditing(displayRow:column:0)moves focus into the first cell.The change is purely SwiftUI wiring. The underlying add-row logic is unchanged and already covered by
RowOperationsManagerTestsand the change-tracking tests.Verification
xcodebuild ... build -skipPackagePluginValidationwithCODE_SIGNING_ALLOWED=NOpasses (** BUILD SUCCEEDED **).