-
-
Notifications
You must be signed in to change notification settings - Fork 296
fix(datagrid): edit JSON cells inline and open blob hex editor on double-click #1588
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,9 +11,6 @@ internal struct CellContext: Equatable { | |
| let isTableEditable: Bool | ||
| let isRowDeleted: Bool | ||
| let isImmutableColumn: Bool | ||
| let columnName: String? | ||
| let connectionId: UUID? | ||
| let tableName: String? | ||
| let displayFormatOverride: ValueDisplayFormat? | ||
|
|
||
| init( | ||
|
|
@@ -22,19 +19,13 @@ internal struct CellContext: Equatable { | |
| isTableEditable: Bool, | ||
| isRowDeleted: Bool, | ||
| isImmutableColumn: Bool, | ||
| columnName: String? = nil, | ||
| connectionId: UUID? = nil, | ||
| tableName: String? = nil, | ||
| displayFormatOverride: ValueDisplayFormat? = nil | ||
| ) { | ||
| self.columnType = columnType | ||
| self.value = value | ||
| self.isTableEditable = isTableEditable | ||
| self.isRowDeleted = isRowDeleted | ||
| self.isImmutableColumn = isImmutableColumn | ||
| self.columnName = columnName | ||
| self.connectionId = connectionId | ||
| self.tableName = tableName | ||
| self.displayFormatOverride = displayFormatOverride | ||
| } | ||
| } | ||
|
|
@@ -59,31 +50,16 @@ internal struct CellInteractionResolver { | |
|
|
||
| let isReadOnly = !context.isTableEditable || context.isImmutableColumn | ||
|
|
||
| if let override = context.displayFormatOverride { | ||
| switch override { | ||
| case .raw: | ||
| return plainText(for: context, isReadOnly: isReadOnly) | ||
| case .json: | ||
| return isReadOnly ? .viewJson : .editJson | ||
| case .phpSerialized: | ||
| return .viewPhpSerialized | ||
| case .uuid, .unixTimestamp, .unixTimestampMillis: | ||
| break | ||
| } | ||
| if context.columnType?.isBlobType == true { | ||
| return isReadOnly ? .viewBlob : .editBlob | ||
| } | ||
|
|
||
| if let columnType = context.columnType { | ||
| if columnType.isBlobType { return isReadOnly ? .viewBlob : .editBlob } | ||
| if columnType.isJsonType { return isReadOnly ? .viewJson : .editJson } | ||
| } | ||
|
|
||
| let value = context.value ?? "" | ||
| switch CellValueContentDetector.detect(value) { | ||
| switch context.displayFormatOverride { | ||
| case .json: | ||
| return isReadOnly ? .viewJson : .editJson | ||
| case .phpSerialized: | ||
| return .viewPhpSerialized | ||
| case .plain: | ||
| case .raw, .uuid, .unixTimestamp, .unixTimestampMillis, .none: | ||
| return plainText(for: context, isReadOnly: isReadOnly) | ||
|
Comment on lines
+62
to
63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When no display-format override is saved, Useful? React with 👍 / 👎. |
||
| } | ||
| } | ||
|
|
||
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.
In read-only result grids (
isTableEditable == false), native JSON columns now hit the.raw/.nonebranch and returnviewInline, becauseeffectiveFormatdefaults to.rawand the resolver no longer checkscolumnType.isJsonType. The documented fallback chevron is not available in that context (DataGridCellViewonly draws chevrons when the cell is editable), so users double-clicking or pressing Enter on JSON columns from read-only queries lose the structured JSON viewer entirely.Useful? React with 👍 / 👎.