From d888a56abfee2934e0426258c7b24cfff3ad1a77 Mon Sep 17 00:00:00 2001 From: bob Date: Wed, 20 Mar 2019 18:29:32 -0400 Subject: switched to a tree view for performance and added dragging tree view items. --- src/client/views/collections/CollectionTreeView.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/client/views/collections') diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx index f9da759fd..d6998cd48 100644 --- a/src/client/views/collections/CollectionTreeView.tsx +++ b/src/client/views/collections/CollectionTreeView.tsx @@ -10,11 +10,12 @@ import "./CollectionTreeView.scss"; import { EditableView } from "../EditableView"; import { setupDrag } from "../../util/DragManager"; import { FieldWaiting } from "../../../fields/Field"; -import { COLLECTION_BORDER_WIDTH } from "./CollectionView"; +import { COLLECTION_BORDER_WIDTH, CollectionView } from "./CollectionView"; import { library } from '@fortawesome/fontawesome-svg-core'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faTrashAlt, faCaretRight, faCaretDown } from '@fortawesome/free-solid-svg-icons'; +import { CollectionDockingView } from "./CollectionDockingView"; export interface TreeViewProps { document: Document; @@ -41,7 +42,8 @@ class TreeView extends React.Component { collapsed: boolean = false; delete = () => { - this.props.deleteDoc(this.props.document); + CollectionDockingView.Instance.AddRightSplit(this.props.document) + //this.props.deleteDoc(this.props.document); } @@ -55,10 +57,11 @@ class TreeView extends React.Component { renderBullet(type: BulletType) { let onClicked = action(() => this.collapsed = !this.collapsed); + let onDoubleClick = action(() => CollectionDockingView.Instance.AddRightSplit(this.props.document)); switch (type) { case BulletType.Collapsed: - return
+ return
case BulletType.Collapsible: return
case BulletType.List: @@ -70,6 +73,8 @@ class TreeView extends React.Component { * Renders the EditableView title element for placement into the tree. */ renderTitle() { + let reference = React.createRef(); + let onItemDown = setupDrag(reference, () => this.props.document, (containingCollection: CollectionView) => this.props.deleteDoc(this.props.document)); let title = this.props.document.GetT(KeyStore.Title, TextField); // if the title hasn't loaded, immediately return the div @@ -77,7 +82,7 @@ class TreeView extends React.Component { return
; } - return
{ -- cgit v1.2.3-70-g09d2