aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/collections/CollectionSchemaView.scss9
-rw-r--r--src/client/views/collections/CollectionSchemaView.tsx40
-rw-r--r--src/new_fields/SchemaHeaderField.ts1
3 files changed, 34 insertions, 16 deletions
diff --git a/src/client/views/collections/CollectionSchemaView.scss b/src/client/views/collections/CollectionSchemaView.scss
index e0de76247..3c3708a30 100644
--- a/src/client/views/collections/CollectionSchemaView.scss
+++ b/src/client/views/collections/CollectionSchemaView.scss
@@ -8,7 +8,7 @@
box-sizing: border-box;
// position: absolute;
width: 100%;
- height: calc(100% - 50px);
+ height: calc(100% - 70px);
// overflow: hidden;
// overflow-x: scroll;
// border: none;
@@ -195,6 +195,11 @@
height: 100%;
}
}
+
+ .rt-resizer {
+ width: 20px;
+ right: -10px;
+ }
}
.documentView-node-topmost {
@@ -312,7 +317,7 @@ button.add-column {
height: 100%;
background-color: white;
- &.row-focused {
+ &.row-focused .rt-tr {
background-color: rgb(255, 246, 246);//$light-color-secondary;
}
diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx
index 8436b22a4..7bd0b5965 100644
--- a/src/client/views/collections/CollectionSchemaView.tsx
+++ b/src/client/views/collections/CollectionSchemaView.tsx
@@ -199,13 +199,13 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) {
get schemaTable() {
return (
<SchemaTable
- Document={this.props.Document} // child doc
+ Document={this.props.Document}
PanelHeight={this.props.PanelHeight}
PanelWidth={this.props.PanelWidth}
- childDocs={this.childDocs}
+ // childDocs={this.childDocs}
CollectionView={this.props.CollectionView}
ContainingCollectionView={this.props.ContainingCollectionView}
- fieldKey={this.props.fieldKey} // might just be this.
+ fieldKey={this.props.fieldKey}
renderDepth={this.props.renderDepth}
moveDocument={this.props.moveDocument}
ScreenToLocalTransform={this.props.ScreenToLocalTransform}
@@ -252,7 +252,7 @@ export interface SchemaTableProps {
dataDoc?: Doc;
PanelHeight: () => number;
PanelWidth: () => number;
- childDocs: Doc[];
+ // childDocs: Doc[];
CollectionView: CollectionView | CollectionPDFView | CollectionVideoView;
ContainingCollectionView: Opt<CollectionView | CollectionPDFView | CollectionVideoView>;
fieldKey: string;
@@ -287,9 +287,13 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
@computed get previewHeight() { return () => this.props.PanelHeight() - 2 * this.borderWidth; }
@computed get tableWidth() { return this.props.PanelWidth() - 2 * this.borderWidth - this.DIVIDER_WIDTH - this.previewWidth(); }
@computed get columns() {
+ console.log("columns");
return Cast(this.props.Document.schemaColumns, listSpec(SchemaHeaderField), []);
}
- @computed get childDocs() { return this.props.childDocs; }
+ @computed get childDocs() {
+ let doc = this.props.dataDoc ? this.props.dataDoc : this.props.Document;
+ return DocListCast(doc[this.props.fieldKey]);
+ }
set columns(columns: SchemaHeaderField[]) { this.props.Document.schemaColumns = new List<SchemaHeaderField>(columns); }
@computed get borderWidth() { return Number(COLLECTION_BORDER_WIDTH); }
@computed get tableColumns(): Column<Doc>[] {
@@ -406,7 +410,8 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
super(props);
// convert old schema columns (list of strings) into new schema columns (list of schema header fields)
let oldSchemaColumns = Cast(this.props.Document.schemaColumns, listSpec("string"), []);
- if (oldSchemaColumns && oldSchemaColumns.length) {
+ if (oldSchemaColumns && oldSchemaColumns.length && typeof oldSchemaColumns[0] !== "object") {
+ console.log("REMAKING COLUMNs");
let newSchemaColumns = oldSchemaColumns.map(i => typeof i === "string" ? new SchemaHeaderField(i) : i);
this.props.Document.schemaColumns = new List<SchemaHeaderField>(newSchemaColumns);
}
@@ -425,9 +430,9 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
}
tableRemoveDoc = (document: Doc): boolean => {
- let doc = this.props.dataDoc ? this.props.dataDoc : this.props.Document;
- let children = Cast(doc[this.props.fieldKey], listSpec(Doc), []);
- // let children = this.childDocs;
+ // let doc = this.props.dataDoc ? this.props.dataDoc : this.props.Document;
+ // let children = Cast(doc[this.props.fieldKey], listSpec(Doc), []);
+ let children = this.childDocs;
if (children.indexOf(document) !== -1) {
children.splice(children.indexOf(document), 1);
return true;
@@ -521,7 +526,7 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
let direction = e.key === "Tab" ? "tab" : e.which === 39 ? "right" : e.which === 37 ? "left" : e.which === 38 ? "up" : e.which === 40 ? "down" : "";
this.changeFocusedCellByDirection(direction);
- let doc = this.props.dataDoc ? this.props.dataDoc : this.props.Document;
+ // let doc = this.props.dataDoc ? this.props.dataDoc : this.props.Document;
// let children = Cast(doc[this.props.fieldKey], listSpec(Doc), []);
let children = this.childDocs;
const pdoc = FieldValue(children[this._focusedCell.row]);
@@ -531,7 +536,7 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
@action
changeFocusedCellByDirection = (direction: string): void => {
- let doc = this.props.dataDoc ? this.props.dataDoc : this.props.Document;
+ // let doc = this.props.dataDoc ? this.props.dataDoc : this.props.Document;
// let children = Cast(doc[this.props.fieldKey], listSpec(Doc), []);
let children = this.childDocs;
switch (direction) {
@@ -574,7 +579,7 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
}
createRow = () => {
- let doc = this.props.dataDoc ? this.props.dataDoc : this.props.Document;
+ // let doc = this.props.dataDoc ? this.props.dataDoc : this.props.Document;
// let children = Cast(doc[this.props.fieldKey], listSpec(Doc), []);
let children = this.childDocs;
@@ -589,6 +594,7 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
let index = 0;
let found = this.columns.findIndex(col => col.heading.toUpperCase() === "New field".toUpperCase()) > -1;
if (!found) {
+ console.log("create column found");
this.columns.push(new SchemaHeaderField("New field"));
return;
}
@@ -596,13 +602,16 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
index++;
found = this.columns.findIndex(col => col.heading.toUpperCase() === ("New field (" + index + ")").toUpperCase()) > -1;
}
+ console.log("create column new");
this.columns.push(new SchemaHeaderField("New field (" + index + ")"));
}
@action
deleteColumn = (key: string) => {
+ console.log("deleting columnnn");
let list = Cast(this.props.Document.schemaColumns, listSpec(SchemaHeaderField));
if (list === undefined) {
+ console.log("delete column");
this.props.Document.schemaColumns = list = new List<SchemaHeaderField>([]);
} else {
const index = list.map(c => c.heading).indexOf(key);
@@ -614,10 +623,13 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
@action
changeColumns = (oldKey: string, newKey: string, addNew: boolean) => {
+ console.log("changingin columnsdfhs");
let list = Cast(this.props.Document.schemaColumns, listSpec(SchemaHeaderField));
if (list === undefined) {
+ console.log("change columns new");
this.props.Document.schemaColumns = list = new List<SchemaHeaderField>([new SchemaHeaderField(newKey)]);
} else {
+ console.log("change column");
if (addNew) {
this.columns.push(new SchemaHeaderField(newKey));
} else {
@@ -717,7 +729,7 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
@computed
get reactTable() {
- let cdoc = this.props.dataDoc ? this.props.dataDoc : this.props.Document;
+ // let cdoc = this.props.dataDoc ? this.props.dataDoc : this.props.Document;
// let children = DocListCast(cdoc[this.props.fieldKey]);
let children = this.childDocs;
@@ -784,7 +796,7 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
getField = (row: number, col?: number) => {
// const docs = DocListCast(this.props.Document[this.props.fieldKey]);
- let cdoc = this.props.dataDoc ? this.props.dataDoc : this.props.Document;
+ // let cdoc = this.props.dataDoc ? this.props.dataDoc : this.props.Document;
// const docs = DocListCast(cdoc[this.props.fieldKey]);
let docs = this.childDocs;
diff --git a/src/new_fields/SchemaHeaderField.ts b/src/new_fields/SchemaHeaderField.ts
index a6df31e81..84d9ae20e 100644
--- a/src/new_fields/SchemaHeaderField.ts
+++ b/src/new_fields/SchemaHeaderField.ts
@@ -49,6 +49,7 @@ export class SchemaHeaderField extends ObjectField {
type: number;
constructor(heading: string = "", color: string = RandomPastel(), type?: ColumnType) {
+ console.log("CREATING SCHEMA HEADER FIELD");
super();
this.heading = heading;