aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-05-04 23:03:49 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-05-04 23:03:49 -0400
commitaf2e5dbf49e0e82d76f267c681761968d4bafc62 (patch)
tree154dcd6061c4956ae76a5f1406c69fa5e2b5fe69
parent070787b6be93dca4a43ec7e893ae4ac4b4d80e59 (diff)
fixed tree view. added non-data keys.
-rw-r--r--src/client/views/Main.scss1
-rw-r--r--src/client/views/collections/CollectionTreeView.scss17
-rw-r--r--src/client/views/collections/CollectionTreeView.tsx37
-rw-r--r--src/new_fields/Doc.ts2
4 files changed, 38 insertions, 19 deletions
diff --git a/src/client/views/Main.scss b/src/client/views/Main.scss
index cbf920793..5c5c252e9 100644
--- a/src/client/views/Main.scss
+++ b/src/client/views/Main.scss
@@ -182,6 +182,7 @@ button:hover {
top: 0;
left: 0;
overflow: scroll;
+ z-index: 1;
}
#mainContent-div {
width: 100%;
diff --git a/src/client/views/collections/CollectionTreeView.scss b/src/client/views/collections/CollectionTreeView.scss
index 19d4abc05..6ce13cf56 100644
--- a/src/client/views/collections/CollectionTreeView.scss
+++ b/src/client/views/collections/CollectionTreeView.scss
@@ -33,9 +33,10 @@
}
.bullet {
- position: absolute;
- width: 1.5em;
- display: inline-block;
+ float:left;
+ position: relative;
+ width: 15px;
+ display: block;
color: $intermediate-color;
margin-top: 3px;
transform: scale(1.3,1.3);
@@ -50,7 +51,7 @@
.docContainer {
margin-left: 10px;
display: block;
- width: max-content;
+ width:100%;//width: max-content;
}
.docContainer:hover {
@@ -59,6 +60,9 @@
// width: auto;
}
}
+ .editableView-container {
+ font-weight: bold;
+ }
.delete-button {
color: $intermediate-color;
@@ -67,4 +71,9 @@
// margin-top: 3px;
display: inline;
}
+
+ .collectionTreeView-keyHeader {
+ font-style: italic;
+ font-size: 8pt;
+ }
} \ No newline at end of file
diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx
index b67d6f965..17109508d 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -18,6 +18,8 @@ import { Main } from '../Main';
import { CurrentUserUtils } from '../../../server/authentication/models/current_user_utils';
import { CollectionDockingView } from './CollectionDockingView';
import { DocumentManager } from '../../util/DocumentManager';
+import { Utils } from '../../../Utils';
+import { List } from '../../../new_fields/List';
export interface TreeViewProps {
@@ -122,17 +124,25 @@ class TreeView extends React.Component<TreeViewProps> {
render() {
let bulletType = BulletType.List;
- let contentElement: JSX.Element | null = (null);
- var children = Cast(this.props.document.data, listSpec(Doc));
- if (children) { // add children for a collection
- if (!this._collapsed) {
- bulletType = BulletType.Collapsible;
- contentElement = <ul>
- {TreeView.GetChildElements(children, this.remove, this.move, this.props.dropAction)}
- </ul >;
- }
- else bulletType = BulletType.Collapsed;
+ let contentElement: (JSX.Element | null)[] = [];
+ let keys = Array.from(Object.keys(this.props.document));
+ if (this.props.document.proto instanceof Doc) {
+ keys.push(...Array.from(Object.keys(this.props.document.proto)));
}
+ keys.map(key => {
+ let docList = Cast(this.props.document[key], listSpec(Doc));
+ if (docList instanceof List && docList.length && docList[0] instanceof Doc) {
+ if (!this._collapsed) {
+ bulletType = BulletType.Collapsible;
+ contentElement.push(<ul key={key + "more"}>
+ {(key === "data") ? (null) :
+ <span className="collectionTreeView-keyHeader" key={key}>{key}</span>}
+ {TreeView.GetChildElements(docList, key !== "data", this.remove, this.move, this.props.dropAction)}
+ </ul >);
+ } else
+ bulletType = BulletType.Collapsed;
+ }
+ });
return <div className="treeViewItem-container"
style={{ background: BoolCast(this.props.document.libraryBrush, false) ? "#06121212" : "0" }}
onContextMenu={this.onWorkspaceContextMenu}
@@ -144,8 +154,8 @@ class TreeView extends React.Component<TreeViewProps> {
</li>
</div>;
}
- public static GetChildElements(docs: Doc[], remove: ((doc: Doc) => void), move: DragManager.MoveFunction, dropAction: dropActionType) {
- return docs.filter(child => !child.excludeFromLibrary).filter(doc => FieldValue(doc)).map(child =>
+ public static GetChildElements(docs: Doc[], allowMinimized: boolean, remove: ((doc: Doc) => void), move: DragManager.MoveFunction, dropAction: dropActionType) {
+ return docs.filter(child => !child.excludeFromLibrary && (allowMinimized || !child.isMinimized)).filter(doc => FieldValue(doc)).map(child =>
<TreeView document={child} key={child[Id]} deleteDoc={remove} moveDocument={move} dropAction={dropAction} />);
}
}
@@ -168,13 +178,12 @@ export class CollectionTreeView extends CollectionSubView(Document) {
}
}
render() {
- trace();
const children = this.children;
let dropAction = StrCast(this.props.Document.dropAction, "alias") as dropActionType;
if (!children) {
return (null);
}
- let childElements = TreeView.GetChildElements(children, this.remove, this.props.moveDocument, dropAction);
+ let childElements = TreeView.GetChildElements(children, false, this.remove, this.props.moveDocument, dropAction);
return (
<div id="body" className="collectionTreeView-dropTarget"
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts
index 3055af1bf..b2863c632 100644
--- a/src/new_fields/Doc.ts
+++ b/src/new_fields/Doc.ts
@@ -186,7 +186,7 @@ export namespace Doc {
UndoManager.RunInBatch(() => {
let linkDoc = Docs.TextDocument({ width: 100, height: 30, borderRounding: -1 });
//let linkDoc = new Doc;
- linkDoc.title = "-link name-";
+ linkDoc.proto!.title = "-link name-";
linkDoc.linkDescription = "";
linkDoc.linkTags = "Default";