From 46fa52fa85102d30a3e13a93fb191f12e3e28aa1 Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Fri, 19 Jun 2020 17:23:33 -0500 Subject: adding open button and slight change to preview in doc --- .../views/collections/CollectionSchemaCells.tsx | 79 ++++++++++++---------- .../CollectionSchemaMovableTableHOC.tsx | 2 + .../views/collections/CollectionSchemaView.tsx | 3 +- 3 files changed, 47 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx index cbee848e6..30278db32 100644 --- a/src/client/views/collections/CollectionSchemaCells.tsx +++ b/src/client/views/collections/CollectionSchemaCells.tsx @@ -3,7 +3,7 @@ import { action, observable, trace, computed } from "mobx"; import { observer } from "mobx-react"; import { CellInfo } from "react-table"; import "react-table/react-table.css"; -import { emptyFunction, returnFalse, returnZero, returnOne, returnEmptyFilter, Utils } from "../../../Utils"; +import { emptyFunction, returnFalse, returnZero, returnOne, returnEmptyFilter, Utils, emptyPath } from "../../../Utils"; import { Doc, DocListCast, Field, Opt } from "../../../fields/Doc"; import { Id } from "../../../fields/FieldSymbols"; import { KeyCodes } from "../../util/KeyCodes"; @@ -31,6 +31,7 @@ import { OverlayView } from "../OverlayView"; import { DocumentIconContainer } from "../nodes/DocumentIcon"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { ContentFittingDocumentView } from "../nodes/ContentFittingDocumentView"; +import ReactDOM from "react-dom"; const path = require('path'); library.add(faExpand); @@ -344,7 +345,7 @@ export class CollectionSchemaDocCell extends CollectionSchemaCell { addDocTab: this.props.addDocTab, pinToPres: this.props.pinToPres, ContentScaling: returnOne, - docFilters: [] + docFilters: returnEmptyFilter }; @observable private _field = this.prop.Document[this.prop.fieldKey]; @observable private _doc = FieldValue(Cast(this._field, Doc)); @@ -388,6 +389,7 @@ export class CollectionSchemaDocCell extends CollectionSchemaCell { @action onOpenClick = () => { + this._preview = false; if (this._doc) { this.prop.addDocTab(this._doc, "onRight"); return true; @@ -415,42 +417,45 @@ export class CollectionSchemaDocCell extends CollectionSchemaCell { return ( -
- {this._preview ? { return false; }} - PanelWidth={() => { return 200 }} - PanelHeight={() => { return 200 }} - ScreenToLocalTransform={this.getPreviewTransform} - docFilters={this.docFilters} - ContainingCollectionDoc={this.props.CollectionView?.props.Document} - ContainingCollectionView={this.props.CollectionView} - moveDocument={this.props.moveDocument} - //addDocument={this.props.addDocument} - //removeDocument={this.props.removeDocument} - parentActive={this.prop.active} - whenActiveChanged={this.prop.whenActiveChanged} - addDocTab={this.props.addDocTab} - pinToPres={this.props.pinToPres} - bringToFront={returnFalse} - ContentScaling={returnOne} +
{ this.showPreview(true); }} + onPointerLeave={() => { this.showPreview(false); }}> - > - : null} + {this._preview ?
false} + PanelWidth={() => 150} + PanelHeight={() => 150} + ScreenToLocalTransform={this.getPreviewTransform} + docFilters={returnEmptyFilter} + ContainingCollectionDoc={this.props.CollectionView?.props.Document} + ContainingCollectionView={this.props.CollectionView} + moveDocument={this.props.moveDocument} + parentActive={this.prop.active} + whenActiveChanged={this.prop.whenActiveChanged} + addDocTab={this.props.addDocTab} + pinToPres={this.props.pinToPres} + bringToFront={returnFalse} + ContentScaling={returnOne}> +
: null}
this._overlayDisposer?.()} ref={this.dropRef} - onClick={() => { this.showPreview(!this._preview) }}> + >
- +
+
); } else { @@ -522,7 +527,8 @@ export class CollectionSchemaImageCell extends CollectionSchemaCell { NativeWidth: returnZero, addDocTab: this.props.addDocTab, pinToPres: this.props.pinToPres, - ContentScaling: returnOne + ContentScaling: returnOne, + docFilters: returnEmptyFilter }; let image = true; @@ -600,7 +606,8 @@ export class CollectionSchemaListCell extends CollectionSchemaCell { NativeWidth: returnZero, addDocTab: this.props.addDocTab, pinToPres: this.props.pinToPres, - ContentScaling: returnOne + ContentScaling: returnOne, + docFilters: returnEmptyFilter }; @observable private _field = this.prop.Document[this.prop.fieldKey]; @observable private _optionsList = this._field as List; diff --git a/src/client/views/collections/CollectionSchemaMovableTableHOC.tsx b/src/client/views/collections/CollectionSchemaMovableTableHOC.tsx index b206765e8..b77173b25 100644 --- a/src/client/views/collections/CollectionSchemaMovableTableHOC.tsx +++ b/src/client/views/collections/CollectionSchemaMovableTableHOC.tsx @@ -137,6 +137,7 @@ export interface MovableRowProps { textWrapRow: (doc: Doc) => void; rowWrapped: boolean; dropAction: string; + addDocTab: any; } export class MovableRow extends React.Component { @@ -232,6 +233,7 @@ export class MovableRow extends React.Component {
this.props.removeDoc(this.props.rowInfo.original))}>
+
this.props.addDocTab(this.props.rowInfo.original, "onRight")}>
{children} diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx index 86034376d..81dfc9c62 100644 --- a/src/client/views/collections/CollectionSchemaView.tsx +++ b/src/client/views/collections/CollectionSchemaView.tsx @@ -407,7 +407,8 @@ export class SchemaTable extends React.Component { rowFocused: !this._headerIsEditing && rowInfo.index === this._focusedCell.row && this.props.isFocused(this.props.Document), textWrapRow: this.toggleTextWrapRow, rowWrapped: this.textWrappedRows.findIndex(id => rowInfo.original[Id] === id) > -1, - dropAction: StrCast(this.props.Document.childDropAction) + dropAction: StrCast(this.props.Document.childDropAction), + addDocTab: this.props.addDocTab }; } -- cgit v1.2.3-70-g09d2