From 6768ef5fff0cd88e1568f0d5c1922ae1c0514115 Mon Sep 17 00:00:00 2001 From: Mark Gregory Date: Tue, 20 Oct 2026 09:14:25 +0100 Subject: [PATCH] row editing --- DBSyn.xcodeproj/project.pbxproj | 8 ++-- DBSyn/MainView.swift | 76 ++++++++++++++++++++------------- 2 files changed, 51 insertions(+), 33 deletions(-) diff --git a/DBSyn.xcodeproj/project.pbxproj b/DBSyn.xcodeproj/project.pbxproj index f1b432e..ef7e3db 100644 --- a/DBSyn.xcodeproj/project.pbxproj +++ b/DBSyn.xcodeproj/project.pbxproj @@ -221,8 +221,8 @@ ENABLE_APP_SANDBOX = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_CFBundleDisplayName = "DBSyn"; - MARKETING_VERSION = 1.0.0; - CURRENT_PROJECT_VERSION = 73; + MARKETING_VERSION = 1.0.3; + CURRENT_PROJECT_VERSION = 76; ENABLE_TESTABILITY = YES; ONLY_ACTIVE_ARCH = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2026 ABSDEV. All rights reserved."; @@ -244,8 +244,8 @@ ENABLE_APP_SANDBOX = NO; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_CFBundleDisplayName = "DBSyn"; - MARKETING_VERSION = 1.0.0; - CURRENT_PROJECT_VERSION = 73; + MARKETING_VERSION = 1.0.3; + CURRENT_PROJECT_VERSION = 76; ENABLE_TESTABILITY = YES; ONLY_ACTIVE_ARCH = YES; INFOPLIST_KEY_NSHumanReadableCopyright = "Copyright © 2026 ABSDEV. All rights reserved."; diff --git a/DBSyn/MainView.swift b/DBSyn/MainView.swift index 77bac4f..d02dc50 100644 --- a/DBSyn/MainView.swift +++ b/DBSyn/MainView.swift @@ -1119,13 +1119,13 @@ struct MainView: View { Spacer() Button { - editResultRow = selectedResultRow + if let row = selectedResultRow { openResultRowEditor(row) } } label: { Label("Edit Row…", systemImage: "pencil") } - .disabled(selectedResultRow == nil || editableResultTarget == nil) - .help(editableResultTarget == nil - ? "Editing requires a SELECT * from a single base table with a primary key and loaded introspection metadata." + .disabled(selectedResultRow == nil || parsedResultTarget == nil) + .help(parsedResultTarget == nil + ? "Editing requires a single-table SELECT containing its primary key." : selectedResultRow == nil ? "Select a result row first." : "Edit selected row and preview SQL") if !model.result.columns.isEmpty { @@ -1197,9 +1197,9 @@ struct MainView: View { } .sheet(isPresented: Binding( get: { editResultRow != nil }, - set: { if !$0 { editResultRow = nil } } + set: { if !$0 { editResultRow = nil; editingResultTarget = nil } } )) { - if let row = editResultRow, let target = editableResultTarget { + if let row = editResultRow, let target = editingResultTarget { DBSynInlineRowEditor(model: model, database: target.database, table: target.table, columns: model.result.columns, original: row) } @@ -1220,39 +1220,57 @@ struct MainView: View { let end = min(start + resultPageSize, rows.count) return NativeResultGrid(columns: model.result.columns, rows: Array(rows[start..