aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/CollectionSchemaView.tsx4
-rw-r--r--src/client/views/collections/SchemaTable.tsx12
2 files changed, 9 insertions, 7 deletions
diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx
index 7e8455149..dc4e75443 100644
--- a/src/client/views/collections/CollectionSchemaView.tsx
+++ b/src/client/views/collections/CollectionSchemaView.tsx
@@ -78,10 +78,10 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) {
}
@computed get columns() {
- return Cast(this.props.Document.schemaColumns, listSpec(SchemaHeaderField), []);
+ return Cast(this.props.Document._schemaHeaders, listSpec(SchemaHeaderField), []);
}
set columns(columns: SchemaHeaderField[]) {
- this.props.Document.schemaColumns = new List<SchemaHeaderField>(columns);
+ this.props.Document._schemaHeaders = new List<SchemaHeaderField>(columns);
}
get documentKeys() {
diff --git a/src/client/views/collections/SchemaTable.tsx b/src/client/views/collections/SchemaTable.tsx
index eb0d234c0..5152b16b0 100644
--- a/src/client/views/collections/SchemaTable.tsx
+++ b/src/client/views/collections/SchemaTable.tsx
@@ -294,10 +294,12 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
constructor(props: SchemaTableProps) {
super(props);
// convert old schema columns (list of strings) into new schema columns (list of schema header fields)
- const oldSchemaColumns = Cast(this.props.Document.schemaColumns, listSpec("string"), []);
- if (oldSchemaColumns && oldSchemaColumns.length && typeof oldSchemaColumns[0] !== "object") {
- const newSchemaColumns = oldSchemaColumns.map(i => typeof i === "string" ? new SchemaHeaderField(i, "#f1efeb") : i);
- this.props.Document.schemaColumns = new List<SchemaHeaderField>(newSchemaColumns);
+ const oldSchemaHeaders = Cast(this.props.Document._schemaHeaders, listSpec("string"), []);
+ if (oldSchemaHeaders?.length && typeof oldSchemaHeaders[0] !== "object") {
+ const newSchemaHeaders = oldSchemaHeaders.map(i => typeof i === "string" ? new SchemaHeaderField(i, "#f1efeb") : i);
+ this.props.Document._schemaHeaders = new List<SchemaHeaderField>(newSchemaHeaders);
+ } else if (this.props.Document._schemaHeaders === undefined) {
+ this.props.Document._schemaHeaders = new List<SchemaHeaderField>([new SchemaHeaderField("title", "#f1efeb")]);
}
}
@@ -539,7 +541,7 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
if(col === undefined) {
return (doc as any)[key][row + ${row}];
}
- return (doc as any)[key][row + ${row}][(doc as any).schemaColumns[col + ${col}].heading];
+ return (doc as any)[key][row + ${row}][(doc as any)._schemaHeaders[col + ${col}].heading];
}
return ${script}`;
const compiled = CompileScript(script, { params: { this: Doc.name }, capturedVariables: { doc: this.props.Document, key: this.props.fieldKey }, typecheck: false, transformer: this.createTransformer(row, col) });