aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionSchemaView.tsx
diff options
context:
space:
mode:
authorSam Wilkins <abdullah_ahmed@brown.edu>2019-07-23 19:11:17 -0400
committerSam Wilkins <abdullah_ahmed@brown.edu>2019-07-23 19:11:17 -0400
commit7d9958f23b2b69f59bb108b33ec014b52ad41c99 (patch)
tree92219e63c1071bac0b1dec9f07ff5a886db9a9d6 /src/client/views/collections/CollectionSchemaView.tsx
parente62b7a0c5c5eec2ef1431b2e2a876e2f3753ebc0 (diff)
merge
Diffstat (limited to 'src/client/views/collections/CollectionSchemaView.tsx')
-rw-r--r--src/client/views/collections/CollectionSchemaView.tsx21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx
index 5546feb95..6d71823c2 100644
--- a/src/client/views/collections/CollectionSchemaView.tsx
+++ b/src/client/views/collections/CollectionSchemaView.tsx
@@ -95,6 +95,10 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) {
this._focusedTable = doc;
}
+ @action
+ setPreviewDoc = (doc: Doc): void => {
+ this.previewDoc = doc;
+ }
//toggles preview side-panel of schema
@action
@@ -384,6 +388,16 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
document.removeEventListener("keydown", this.onKeyDown);
}
+ tableAddDoc = (doc: Doc, relativeTo?: Doc, before?: boolean) => {
+ console.log("table add doc");
+ return Doc.AddDocToList(this.props.Document, this.props.fieldKey, doc, relativeTo, before);
+ }
+
+ tableMoveDoc = (d: Doc, target: Doc, addDoc: (doc: Doc) => boolean) => {
+ console.log("SCHEMA MOVE");
+ this.props.moveDocument(d, target, addDoc);
+ }
+
private getTrProps: ComponentPropsGetterR = (state, rowInfo) => {
const that = this;
if (!rowInfo) {
@@ -391,8 +405,8 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
}
return {
ScreenToLocalTransform: this.props.ScreenToLocalTransform,
- addDoc: (doc: Doc, relativeTo?: Doc, before?: boolean) => Doc.AddDocToList(this.props.Document, this.props.fieldKey, doc, relativeTo, before),
- moveDoc: (d: Doc, target: Doc, addDoc: (doc: Doc) => boolean) => this.props.moveDocument(d, target, addDoc),
+ addDoc: this.tableAddDoc,
+ moveDoc: this.tableMoveDoc,
rowInfo,
rowFocused: !this._headerIsEditing && rowInfo.index === this._focusedCell.row && this.props.isFocused(this.props.Document)
};
@@ -654,7 +668,6 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
}
render() {
- if (this.props.isFocused(this.props.Document)) console.log(StrCast(this.props.Document.title), "IS FOCUSED");
// if (SelectionManager.SelectedDocuments().length > 0) console.log(StrCast(SelectionManager.SelectedDocuments()[0].Document.title));
// if (DocumentManager.Instance.getDocumentView(this.props.Document)) console.log(StrCast(this.props.Document.title), SelectionManager.IsSelected(DocumentManager.Instance.getDocumentView(this.props.Document)!))
return (
@@ -669,7 +682,7 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
interface CollectionSchemaPreviewProps {
Document?: Doc;
- DataDocument?: Doc;
+ DataDocument?: Doc;
childDocs?: Doc[];
renderDepth: number;
fitToBox?: boolean;