Skip to content

Commit e190a7a

Browse files
committed
refactor(datagrid): replace RowBuffer with TableRows; delete legacy row stack
1 parent 2d941b4 commit e190a7a

48 files changed

Lines changed: 333 additions & 2674 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222

2323
### Changed
2424

25-
- Introduced TableRows, Row, and Delta value types in TablePro/Models/Query/ as the foundation for the data grid row model rewrite. NSTableView delegate reads cell values and row count from TableRows; sidebar, JSON view, and exports now read from TableRows. Cell edits route through TableRows.edit and apply NSTableView updates via the Delta-driven TableRowsController. Row operations (add, duplicate, delete, paste, undo) mutate TableRows and apply the returned Delta through TableViewCoordinator.applyDelta. Sort state moved from InMemoryRowProvider's positional sortIndices to a TableViewCoordinator.sortedIDs permutation keyed by Row.id, so cell edits under sort hit the correct storage row and inserted rows survive at the end of the sorted view without re-sorting. RowBuffer still backs the display cache pending later phases (Phase C.2 of the DataGrid refactor).
25+
- Replaced RowBuffer / InMemoryRowProvider / RowDataStore with TableRows / TableRowsStore / TableRowsController. Mutations emit Delta events; the controller drives NSTableView via insertRows / removeRows / reloadData(forRowIndexes:). Sort and the display cache moved off the row provider into the data grid coordinator, keyed by Row.id.
2626
- DataChangeManager extracted a PendingChanges value type that owns cross-collection invariants for cell edits, row insertions, and deletions. DataChangeManager kept undo/redo registration, plugin SQL generation, and the `@Observable` boundary, dropping from ~960 to ~190 lines. The serialization DTO `TabPendingChanges` is renamed to `TabChangeSnapshot` to distinguish it from the live tracker.
2727
- AnyChangeManager uses ChangeManaging protocol instead of closure-based type erasure, removing all runtime `[Any]` downcasts
2828
- Row selection state moved from MainContentView @State to GridSelectionState @Observable class, preventing full view tree invalidation on every row click

TablePro/Core/Plugins/StreamingQueryExportDataSource.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//
55
// Streaming export data source for query results.
66
// Re-executes the query and streams rows directly from the database to the export plugin,
7-
// bypassing RowBuffer. Allows exporting large result sets without loading all rows into memory.
7+
// bypassing in-memory storage. Allows exporting large result sets without loading all rows into memory.
88
//
99

1010
import Foundation

TablePro/Core/Services/Formatting/CellDisplayFormatter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// TablePro
44
//
55
// Pure formatter that transforms raw cell values into display-ready strings.
6-
// Used by InMemoryRowProvider's display cache to compute values once per cell.
6+
// Used by the data grid coordinator's display cache to compute values once per cell.
77
//
88

99
import Foundation

TablePro/Core/Services/Query/RowDataStore.swift

Lines changed: 0 additions & 44 deletions
This file was deleted.

TablePro/Models/Query/ResultSet.swift

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import os
1414
final class ResultSet: Identifiable {
1515
let id: UUID
1616
var label: String
17-
var rowBuffer: RowBuffer
17+
var tableRows: TableRows
1818
var executionTime: TimeInterval?
1919
var rowsAffected: Int = 0
2020
var errorMessage: String?
@@ -27,37 +27,11 @@ final class ResultSet: Identifiable {
2727
var pagination = PaginationState()
2828
var columnLayout = ColumnLayoutState()
2929

30-
var columnTypes: [ColumnType] {
31-
get { rowBuffer.columnTypes }
32-
set { rowBuffer.columnTypes = newValue }
33-
}
34-
35-
var columnDefaults: [String: String?] {
36-
get { rowBuffer.columnDefaults }
37-
set { rowBuffer.columnDefaults = newValue }
38-
}
39-
40-
var columnForeignKeys: [String: ForeignKeyInfo] {
41-
get { rowBuffer.columnForeignKeys }
42-
set { rowBuffer.columnForeignKeys = newValue }
43-
}
44-
45-
var columnEnumValues: [String: [String]] {
46-
get { rowBuffer.columnEnumValues }
47-
set { rowBuffer.columnEnumValues = newValue }
48-
}
49-
50-
var columnNullable: [String: Bool] {
51-
get { rowBuffer.columnNullable }
52-
set { rowBuffer.columnNullable = newValue }
53-
}
54-
55-
var resultColumns: [String] { rowBuffer.columns }
56-
var resultRows: [[String?]] { rowBuffer.rows }
30+
var resultColumns: [String] { tableRows.columns }
5731

58-
init(id: UUID = UUID(), label: String, rowBuffer: RowBuffer = RowBuffer()) {
32+
init(id: UUID = UUID(), label: String, tableRows: TableRows = TableRows()) {
5933
self.id = id
6034
self.label = label
61-
self.rowBuffer = rowBuffer
35+
self.tableRows = tableRows
6236
}
6337
}

TablePro/Models/Query/RowBuffer.swift

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)