From cec8cc0d8444b0321ec95a49d91a77a926462900 Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Mon, 22 Jun 2020 14:22:23 -0500 Subject: more with previews --- .../views/collections/CollectionSchemaCells.tsx | 35 +++++++++++++++++++--- .../views/collections/CollectionSchemaView.scss | 4 +++ .../views/collections/CollectionSchemaView.tsx | 11 ++++--- 3 files changed, 42 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx index 4231a3941..b9be3b64f 100644 --- a/src/client/views/collections/CollectionSchemaCells.tsx +++ b/src/client/views/collections/CollectionSchemaCells.tsx @@ -404,13 +404,37 @@ export class CollectionSchemaDocCell extends CollectionSchemaCell { this._preview = false; } else { if (bool) { - this.props.showDoc(this._doc, this.prop.DataDoc, e.screenX, e.screenY); + console.log("show doc"); + this.props.showDoc(this._doc, this.prop.DataDoc, e.screenX - 230, e.screenY - 570); } else { + console.log("no doc"); this.props.showDoc(undefined); } } } + onDown = (e: any) => { + this.props.changeFocusedCellByIndex(this.props.row, this.props.col); + this.props.setPreviewDoc(this.props.rowProps.original); + + let url: string; + if (url = StrCast(this.props.rowProps.row.href)) { + try { + new URL(url); + const temp = window.open(url)!; + temp.blur(); + window.focus(); + } catch { } + } + + const field = this.props.rowProps.original[this.props.rowProps.column.id!]; + const doc = FieldValue(Cast(field, Doc)); + if (typeof field === "object" && doc) this.props.setPreviewDoc(doc); + + this.showPreview(true, e); + + } + render() { const dragRef: React.RefObject = React.createRef(); @@ -420,9 +444,12 @@ export class CollectionSchemaDocCell extends CollectionSchemaCell { return ( -
{ this.showPreview(true, e); }} - onPointerLeave={(e) => { this.showPreview(false, e); }} +
{ this.onDown(e); }} + // onFocus={(e) => this.showPreview(true, e)} + onMouseEnter={(e) => { this.showPreview(true, e); }} + // onBlur={(e) => { console.log("Blur"); this.showPreview(false, e) }} + onMouseLeave={(e) => { this.showPreview(false, e); }} >
{ render() { const preview = ""; return
this.props.active(true) && e.stopPropagation()} onDrop={e => this.props.onDrop(e, {})} onContextMenu={this.onContextMenu} > + {this.reactTable} +
this.createRow()}>+ new
{!this._showDoc ? (null) : -
{ this.onOpenClick(); }} - style={{ position: "absolute", width: 400, height: 300, transform: `translate(${this._showDocPos[0]}px, ${this._showDocPos[1]}px)` }} +
{ this.onOpenClick(); }} + style={{ + position: "absolute", width: 400, height: 300, + transform: `translate(${this._showDocPos[0]}px, ${this._showDocPos[1]}px)` + }} ref="overlay"> { ContentScaling={returnOne}>
} - {this.reactTable} -
this.createRow()}>+ new
; } } \ No newline at end of file -- cgit v1.2.3-70-g09d2