aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-03-27 12:12:20 -0400
committerbobzel <zzzman@gmail.com>2025-03-27 12:12:20 -0400
commitb1f85154edc250a18d0bc033df91ee1249975946 (patch)
tree1a96d9d48ef82e39acedbb92c0b68cf2c418f12a /src/client/views/collections
parent64f65dd17f9dea4e0cee17600d2b0daa847bab73 (diff)
fix so that schemacellfield doesn't trigger a finalizeEdit when it's not editing. added 'red' color for template fields to schematablecell. fixed set field to allow setting data fields when field is an '_' and no template. fixed setting '=' when getting a keyValueString for empty fields with an '_' key.
Diffstat (limited to 'src/client/views/collections')
-rw-r--r--src/client/views/collections/TreeView.tsx2
-rw-r--r--src/client/views/collections/collectionSchema/SchemaCellField.tsx2
-rw-r--r--src/client/views/collections/collectionSchema/SchemaTableCell.tsx7
3 files changed, 6 insertions, 5 deletions
diff --git a/src/client/views/collections/TreeView.tsx b/src/client/views/collections/TreeView.tsx
index cb7da8c84..9889766d5 100644
--- a/src/client/views/collections/TreeView.tsx
+++ b/src/client/views/collections/TreeView.tsx
@@ -594,7 +594,7 @@ export class TreeView extends ObservableReactComponent<TreeViewProps> {
const key = match[1];
const assign = match[2];
const val = match[3];
- Doc.SetField(doc, key, assign + val, false);
+ Doc.SetField(doc, key, assign + val);
return true;
}
return false;
diff --git a/src/client/views/collections/collectionSchema/SchemaCellField.tsx b/src/client/views/collections/collectionSchema/SchemaCellField.tsx
index 7e4518dbb..9ad94cb31 100644
--- a/src/client/views/collections/collectionSchema/SchemaCellField.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaCellField.tsx
@@ -100,7 +100,7 @@ export class SchemaCellField extends ObservableReactComponent<SchemaCellFieldPro
() => this._props.GetValue(),
fieldVal => {
this._unrenderedContent = fieldVal ?? '';
- this.finalizeEdit(false, false, false);
+ this._editing && this.finalizeEdit(false, false, false);
}
);
}
diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
index dc5dca3c3..72838074e 100644
--- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
@@ -104,13 +104,14 @@ export class SchemaTableCell extends ObservableReactComponent<SchemaTableCellPro
public static renderProps(props: SchemaTableCellProps) {
const { Doc: Document, fieldKey, /* getFinfo,*/ columnWidth, isRowActive } = props;
let protoCount = 0;
- let doc: Doc | undefined = Document;
+ const layoutDoc = fieldKey.startsWith('_') ? Doc.Layout(Document) : Document;
+ let doc = Document;
while (doc) {
if (Object.keys(doc).includes(fieldKey.replace(/^_/, ''))) break;
protoCount++;
doc = DocCast(doc.proto);
}
- const color = protoCount === 0 || (fieldKey.startsWith('_') && Document[fieldKey] === undefined) ? 'black' : 'blue'; // color of text in cells
+ const color = layoutDoc !== Document ? 'red' : protoCount === 0 || (fieldKey.startsWith('_') && Document[fieldKey] === undefined) ? 'black' : 'blue'; // color of text in cells
const textDecoration = '';
const fieldProps: FieldViewProps = {
childFilters: returnEmptyFilter,
@@ -130,7 +131,7 @@ export class SchemaTableCell extends ObservableReactComponent<SchemaTableCellPro
focus: emptyFunction,
addDocTab: SchemaTableCell.addFieldDoc,
pinToPres: returnZero,
- Document: DocCast(Document.rootDocument, Document),
+ Document: Document,
fieldKey: fieldKey,
PanelWidth: columnWidth,
PanelHeight: props.rowHeight,