From f19ee5abb19ece29a0ea7a857078125307f15908 Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Tue, 28 Jul 2020 16:36:15 -0500 Subject: collapsing sections --- src/client/views/DocumentDecorations.tsx | 2 +- .../collectionFreeForm/PropertiesView.scss | 45 +++++++++++++ .../collectionFreeForm/PropertiesView.tsx | 73 ++++++++++++++++++---- 3 files changed, 107 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index c889557ba..0a0136d87 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -577,7 +577,7 @@ export class DocumentDecorations extends React.Component<{}, { value: string }> : <> {minimal ? (null) :
Show context menu
} placement="top">
- +
}
{`${this.selectionTitle}`} diff --git a/src/client/views/collections/collectionFreeForm/PropertiesView.scss b/src/client/views/collections/collectionFreeForm/PropertiesView.scss index 856f8e7f2..1fda8e5a2 100644 --- a/src/client/views/collections/collectionFreeForm/PropertiesView.scss +++ b/src/client/views/collections/collectionFreeForm/PropertiesView.scss @@ -40,6 +40,10 @@ border-bottom: 1px solid black; padding: 8.5px; font-size: 12.5px; + + &:hover { + cursor: pointer; + } } .propertiesView-settings { @@ -52,6 +56,17 @@ font-weight: bold; font-size: 12.5px; padding-bottom: 7px; + display: flex; + width: 200px; + + .propertiesView-settings-title-icon { + margin-left: 2px; + margin-right: 7px; + + &:hover { + cursor: pointer; + } + } } .propertiesView-settings-content { @@ -69,6 +84,16 @@ font-size: 12.5px; font-weight: bold; padding-bottom: 7px; + display: flex; + + .propertiesView-sharing-title-icon { + margin-left: 2px; + margin-right: 7px; + + &:hover { + cursor: pointer; + } + } } .propertiesView-sharing-content { @@ -172,6 +197,16 @@ font-weight: bold; white-space: nowrap; width: 35px; + display: flex; + } + + .propertiesView-fields-title-icon { + margin-left: 2px; + margin-right: 7px; + + &:hover { + cursor: pointer; + } } .propertiesView-fields-title-checkbox { @@ -225,6 +260,16 @@ font-weight: bold; font-size: 12.5px; padding-bottom: 7px; + display: flex; + + .propertiesView-layout-title-icon { + margin-left: 2px; + margin-right: 7px; + + &:hover { + cursor: pointer; + } + } } .propertiesView-layout-content { diff --git a/src/client/views/collections/collectionFreeForm/PropertiesView.tsx b/src/client/views/collections/collectionFreeForm/PropertiesView.tsx index be024b772..91d407eea 100644 --- a/src/client/views/collections/collectionFreeForm/PropertiesView.tsx +++ b/src/client/views/collections/collectionFreeForm/PropertiesView.tsx @@ -1,7 +1,7 @@ import React = require("react"); import { observer } from "mobx-react"; import "./PropertiesView.scss"; -import { observable, action, computed } from "mobx"; +import { observable, action, computed, runInAction } from "mobx"; import { Doc, Field, DocListCast, WidthSym, HeightSym } from "../../../../fields/Doc"; import { DocumentView } from "../../nodes/DocumentView"; import { ComputedField } from "../../../../fields/ScriptField"; @@ -43,6 +43,11 @@ export class PropertiesView extends React.Component { @observable layoutFields: boolean = false; + @observable openActions: boolean = true; + @observable openSharing: boolean = true; + @observable openFields: boolean = true; + @observable openLayout: boolean = true; + @action rtfWidth = () => { if (this.selectedDoc) { @@ -314,6 +319,25 @@ export class PropertiesView extends React.Component { this.layoutFields = !this.layoutFields; } + @computed get editableTitle() { + return StrCast(this.selectedDoc?.title)} + SetValue={this.setTitle} />; + } + + setTitle = (value: string) => { + if (this.dataDoc) { + this.selectedDoc && (this.selectedDoc.title = value); + KeyValueBox.SetField(this.dataDoc, "title", value, true); + return true; + } + return false; + } + render() { if (!this.selectedDoc) { @@ -333,35 +357,60 @@ export class PropertiesView extends React.Component {
- {this.selectedDoc.title} + {this.editableTitle}
-
Document Actions
-
- +
+
runInAction(() => { this.openActions = !this.openActions; })}> + +
+ Document Actions
+ {this.openActions ?
+ +
: null}
-
Sharing {"&"} Permissions
-
- {this.sharingTable} +
+
runInAction(() => { this.openSharing = !this.openSharing; })}> + +
+ Sharing {"&"} Permissions
+ {this.openSharing ?
+ {this.sharingTable} +
: null}
+
runInAction(() => { this.openFields = !this.openFields; })}> + +
Fields {"&"} Tags
- {!novice ?
+ {!novice && this.openFields ?
{this.fieldsCheckbox}
Layout
: null}
-
{novice ? this.noviceFields : this.expandedField}
+ {this.openFields ? +
+ {novice ? this.noviceFields : this.expandedField} +
: null}
-
Layout
-
{this.layoutPreview}
+
+
runInAction(() => { this.openLayout = !this.openLayout; })}> + +
+ Layout +
+ {this.openLayout ?
{this.layoutPreview}
: null}
; } -- cgit v1.2.3-70-g09d2