-
-
Notifications
You must be signed in to change notification settings - Fork 143
refactor(datagrid): name-based identifiers + native sort indicators #942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
8c272c6
refactor(datagrid): native sort indicators, FK button reuse fix, drop…
datlechin 3922ad5
refactor(datagrid): name-based column identifiers, protocol-based lay…
datlechin e7daf8d
refactor(datagrid): address review — split persister protocol, drop r…
datlechin f8438f0
fix(datagrid): compare column sets not arrays so user reorder does no…
datlechin 0f97a36
diag(datagrid): trace sort dispatch + SF Symbol fallback for sort ind…
datlechin e266472
fix(datagrid): read live shift modifier from NSEvent for multi-sort d…
datlechin f573150
diag(datagrid): expand sort logging — modifier flags raw, indicator p…
datlechin c693a79
fix(datagrid): intercept shift+click in custom NSTableHeaderView for …
datlechin 4c25c34
fix(datagrid): set all sort descriptors so multi-sort indicators rend…
datlechin ecf0017
fix(datagrid): custom NSTableHeaderCell renders indicators on every m…
datlechin 99308fc
fix(datagrid): use native NSAscendingSortIndicator at natural size, d…
datlechin d91541a
fix(datagrid): clear AppKit's auto sort indicator so custom cell does…
datlechin 90a1722
fix(datagrid): override drawSortIndicator to no-op so AppKit stops dr…
datlechin a955be9
fix(datagrid): tint native sort indicator template image with seconda…
datlechin b295cfe
fix(datagrid): tint sort indicator template image in offscreen contex…
datlechin 02f81f5
fix(datagrid): tint sort indicator with tertiaryLabelColor for native…
datlechin bab57ac
fix(datagrid): use SF Symbol chevron with light weight for sort indic…
datlechin 6223708
fix(datagrid): tweak sort indicator alpha to 0.4 between secondary an…
datlechin c265258
refactor(datagrid): use AppKit's native NSTableHeaderCell.drawSortInd…
datlechin c202227
fix(datagrid): SF Symbol chevron with paletteColors config for native…
datlechin 9c57e2b
fix(datagrid): reduce sort indicator pointSize to 9 for smaller chevron
datlechin f4d9c9e
feat(datagrid): 3-state sort cycle + 'Don't Sort' context menu — nati…
datlechin fd88b23
refactor(datagrid): split sort handling — AppKit drives single-click …
datlechin 09f5222
i18n: add 'Don't Sort' string to Localizable catalog
datlechin cce7b95
fix(datagrid): override init(coder:) + copy(with:) on MultiSortHeader…
datlechin dabb7cc
fix(datagrid): drop SF Symbol paletteColors config, tint at draw-time…
datlechin cbc5611
fix(datagrid): rip out MultiSortHeaderCell, use pure native NSTableVi…
datlechin b20e8a8
refactor(datagrid): NSImageView overlays on header for multi-sort ind…
datlechin 6964084
fix(datagrid): clear highlightedTableColumn so AppKit does not auto-d…
datlechin e0918b3
fix(datagrid): explicit setIndicatorImage nil to clear AppKit auto-in…
datlechin cd222f2
fix(datagrid): stateless NSTableHeaderCell subclass overrides drawSor…
datlechin 5c01de2
Merge branch 'main' into refactor/datagrid-column-architecture
datlechin ffe9fe5
refactor(datagrid): inject ColumnLayoutPersisting per view, drop shar…
datlechin 7ea29f5
fix(datagrid): preserve native sort cycle on column header clicks
datlechin a337b90
fix(a11y): announce sort direction on data grid column headers
datlechin a67bcd4
refactor(datagrid): drop redundant doc comment on visibility helper
datlechin ace2733
test(datagrid): cover sort transitions, persister corruption, and lit…
datlechin 6acf667
docs: correct sort indicator implementation note in CHANGELOG
datlechin d6b212a
fix(datagrid): restore three-state sort cycle (asc, desc, none)
datlechin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // | ||
| // ColumnLayoutPersisting.swift | ||
| // TablePro | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| @MainActor | ||
| protocol ColumnLayoutPersisting: AnyObject { | ||
| func load(for tableName: String, connectionId: UUID) -> ColumnLayoutState? | ||
| func save(_ layout: ColumnLayoutState, for tableName: String, connectionId: UUID) | ||
| func clear(for tableName: String, connectionId: UUID) | ||
| } |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // | ||
| // ColumnIdentitySchema.swift | ||
| // TablePro | ||
| // | ||
|
|
||
| import AppKit | ||
|
|
||
| struct ColumnIdentitySchema: Equatable { | ||
| static let rowNumberIdentifier = NSUserInterfaceItemIdentifier("__rowNumber__") | ||
|
|
||
| let identifiers: [NSUserInterfaceItemIdentifier] | ||
| let isNameBased: Bool | ||
| private let indexByRawIdentifier: [String: Int] | ||
|
|
||
| init(columns: [String]) { | ||
| let canUseNames = Set(columns).count == columns.count | ||
| && !columns.contains(Self.rowNumberIdentifier.rawValue) | ||
|
|
||
| if canUseNames { | ||
| self.identifiers = columns.map { NSUserInterfaceItemIdentifier($0) } | ||
| self.isNameBased = true | ||
| } else { | ||
| self.identifiers = columns.indices.map { | ||
| NSUserInterfaceItemIdentifier("col_\($0)") | ||
| } | ||
| self.isNameBased = false | ||
| } | ||
|
|
||
| var map: [String: Int] = [:] | ||
| map.reserveCapacity(self.identifiers.count) | ||
| for (index, identifier) in self.identifiers.enumerated() { | ||
| map[identifier.rawValue] = index | ||
| } | ||
| self.indexByRawIdentifier = map | ||
| } | ||
|
|
||
| static let empty = ColumnIdentitySchema(columns: []) | ||
|
|
||
| func identifier(for dataIndex: Int) -> NSUserInterfaceItemIdentifier? { | ||
| guard dataIndex >= 0, dataIndex < identifiers.count else { return nil } | ||
| return identifiers[dataIndex] | ||
| } | ||
|
|
||
| func dataIndex(from identifier: NSUserInterfaceItemIdentifier) -> Int? { | ||
| indexByRawIdentifier[identifier.rawValue] | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14085,6 +14085,9 @@ | |
| } | ||
| } | ||
| } | ||
| }, | ||
| "Don't Sort" : { | ||
|
|
||
| }, | ||
| "Done" : { | ||
|
|
||
|
|
||
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
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
27 changes: 0 additions & 27 deletions
27
TablePro/Views/Main/Extensions/MainContentCoordinator+ColumnLayout.swift
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching tabs no longer calls
saveColumnLayoutForTable(), so layout writes now depend only on the debouncedscheduleLayoutPersist()path in the grid coordinator. If the user resizes/reorders a column and switches tabs within the 500ms debounce window, the coordinator is rebound to the new tab before the task fires, so the outgoing tab’s latest layout can be lost (and the delayed write can target the wrong table context). This is a user-visible data-loss regression for column widths/order on quick tab switches.Useful? React with 👍 / 👎.