From 1353c41b9e7c2e2bca2aea7fe9f2450a4b017ebf Mon Sep 17 00:00:00 2001 From: Fawn Date: Sat, 27 Jul 2019 22:53:19 -0400 Subject: can drag doc field out of schema --- .../views/collections/CollectionSchemaCells.tsx | 29 +++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx index e00142c91..d9291826c 100644 --- a/src/client/views/collections/CollectionSchemaCells.tsx +++ b/src/client/views/collections/CollectionSchemaCells.tsx @@ -84,6 +84,11 @@ export class CollectionSchemaCell extends React.Component { @action onPointerDown = (e: React.PointerEvent): void => { this.props.changeFocusedCellByIndex(this.props.row, this.props.col); + this.props.setPreviewDoc(this.props.rowProps.original); + + let field = this.props.rowProps.original[this.props.rowProps.column.id!]; + let doc = FieldValue(Cast(field, Doc)); + if (typeof field === "object" && doc) this.props.setPreviewDoc(doc); } applyToDoc = (doc: Doc, row: number, col: number, run: (args?: { [name: string]: any }) => any) => { @@ -150,10 +155,10 @@ export class CollectionSchemaCell extends React.Component { addDocTab: this.props.addDocTab, }; - // let onItemDown = (e: React.PointerEvent) => { - // SetupDrag(this._focusRef, () => this._document[props.fieldKey] instanceof Doc ? this._document[props.fieldKey] : this._document, - // this._document[props.fieldKey] instanceof Doc ? (doc: Doc, target: Doc, addDoc: (newDoc: Doc) => any) => addDoc(doc) : this.props.moveDocument, this._document[props.fieldKey] instanceof Doc ? "alias" : this.props.Document.schemaDoc ? "copy" : undefined)(e); - // }; + let onItemDown = (e: React.PointerEvent) => { + SetupDrag(this._focusRef, () => this._document[props.fieldKey] instanceof Doc ? this._document[props.fieldKey] : this._document, + this._document[props.fieldKey] instanceof Doc ? (doc: Doc, target: Doc, addDoc: (newDoc: Doc) => any) => addDoc(doc) : this.props.moveDocument, this._document[props.fieldKey] instanceof Doc ? "alias" : this.props.Document.schemaDoc ? "copy" : undefined)(e); + }; let onPointerEnter = (e: React.PointerEvent): void => { if (e.buttons === 1 && SelectionManager.GetIsDragging() && (type === "document" || type === undefined)) { dragRef!.current!.className = "collectionSchemaView-cellContainer doc-drag-over"; @@ -181,16 +186,16 @@ export class CollectionSchemaCell extends React.Component { let doc = FieldValue(Cast(field, Doc)); let fieldIsDoc = (type === "document" && typeof field === "object") || (typeof field === "object" && doc); - let docExpander = ( -
- -
- ); + // let docExpander = ( + //
+ // + //
+ // ); return ( -
+
-
+
{ }} />
- {fieldIsDoc ? docExpander : null} + {/* {fieldIsDoc ? docExpander : null} */}
); -- cgit v1.2.3-70-g09d2