aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-01-29 19:13:46 -0500
committerBob Zeleznik <zzzman@gmail.com>2020-01-29 19:13:46 -0500
commitc7fd1191af56e4a94e7c813e8b621c1386f90eeb (patch)
tree4051fd915c77d9af6e6bf0b74304cbc47b532cdd /src
parentc6dfa681ab54fff5abbbe1f317bda85638f496e7 (diff)
started to clean up chromeviews
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/CollectionSchemaView.tsx18
-rw-r--r--src/client/views/collections/CollectionViewChromes.scss3
-rw-r--r--src/client/views/collections/CollectionViewChromes.tsx11
-rw-r--r--src/client/views/nodes/DocumentView.tsx5
4 files changed, 22 insertions, 15 deletions
diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx
index a35c945b9..fa8be5177 100644
--- a/src/client/views/collections/CollectionSchemaView.tsx
+++ b/src/client/views/collections/CollectionSchemaView.tsx
@@ -624,6 +624,19 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
return Array.from(Object.keys(keys));
}
+ @undoBatch
+ @action
+ toggleTextwrap = async () => {
+ const textwrappedRows = Cast(this.props.Document.textwrappedSchemaRows, listSpec("string"), []);
+ if (textwrappedRows.length) {
+ this.props.Document.textwrappedSchemaRows = new List<string>([]);
+ } else {
+ const docs = DocListCast(this.props.Document[this.props.fieldKey]);
+ const allRows = docs instanceof Doc ? [docs[Id]] : docs.map(doc => doc[Id]);
+ this.props.Document.textwrappedSchemaRows = new List<string>(allRows);
+ }
+ }
+
@action
toggleTextWrapRow = (doc: Doc): void => {
const textWrapped = this.textWrappedRows;
@@ -642,7 +655,7 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
const expanded = {};
//@ts-ignore
expandedRowsList.forEach(row => expanded[row] = true);
- console.log("text wrapped rows", ...[...this.textWrappedRows]); // TODO: get component to rerender on text wrap change without needign to console.log :((((
+ const rerender = [...this.textWrappedRows]; // TODO: get component to rerender on text wrap change without needign to console.log :((((
return <ReactTable
style={{ position: "relative" }}
@@ -678,7 +691,8 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
onContextMenu = (e: React.MouseEvent): void => {
if (!e.isPropagationStopped() && this.props.Document[Id] !== "mainDoc") { // need to test this because GoldenLayout causes a parallel hierarchy in the React DOM for its children and the main document view7
- ContextMenu.Instance.addItem({ description: "Make DB", event: this.makeDB, icon: "table" });
+ // ContextMenu.Instance.addItem({ description: "Make DB", event: this.makeDB, icon: "table" });
+ ContextMenu.Instance.addItem({ description: "Toggle text wrapping", event: this.toggleTextwrap, icon: "table" })
}
}
diff --git a/src/client/views/collections/CollectionViewChromes.scss b/src/client/views/collections/CollectionViewChromes.scss
index efe185922..517f467b7 100644
--- a/src/client/views/collections/CollectionViewChromes.scss
+++ b/src/client/views/collections/CollectionViewChromes.scss
@@ -9,8 +9,7 @@
background: lightgrey;
.collectionViewChrome {
- display: grid;
- grid-template-columns: 1fr auto;
+ display: flex;
padding-bottom: 10px;
border-bottom: .5px solid rgb(180, 180, 180);
overflow: hidden;
diff --git a/src/client/views/collections/CollectionViewChromes.tsx b/src/client/views/collections/CollectionViewChromes.tsx
index d1919d588..073a30330 100644
--- a/src/client/views/collections/CollectionViewChromes.tsx
+++ b/src/client/views/collections/CollectionViewChromes.tsx
@@ -61,10 +61,12 @@ export class CollectionViewBaseChrome extends React.Component<CollectionViewChro
_freeform_commands = [this._contentCommand, this._templateCommand, this._narrativeCommand, this._viewCommand];
_stacking_commands = [this._contentCommand, this._templateCommand];
_masonry_commands = [this._contentCommand, this._templateCommand];
+ _schema_commands = [this._templateCommand, this._narrativeCommand];
_tree_commands = [];
private get _buttonizableCommands() {
switch (this.props.type) {
case CollectionViewType.Tree: return this._tree_commands;
+ case CollectionViewType.Schema: return this._schema_commands;
case CollectionViewType.Stacking: return this._stacking_commands;
case CollectionViewType.Masonry: return this._stacking_commands;
case CollectionViewType.Freeform: return this._freeform_commands;
@@ -617,15 +619,6 @@ export class CollectionSchemaViewChrome extends React.Component<CollectionViewCh
return (
<div className="collectionSchemaViewChrome-cont">
<div className="collectionSchemaViewChrome-toggle">
- <div className="collectionSchemaViewChrome-label">Wrap Text: </div>
- <div className="collectionSchemaViewChrome-toggler" onClick={this.toggleTextwrap}>
- <div className={"collectionSchemaViewChrome-togglerButton" + (textWrapped ? " on" : " off")}>
- {textWrapped ? "on" : "off"}
- </div>
- </div>
- </div>
-
- <div className="collectionSchemaViewChrome-toggle">
<div className="collectionSchemaViewChrome-label">Show Preview: </div>
<div className="collectionSchemaViewChrome-toggler" onClick={this.togglePreview}>
<div className={"collectionSchemaViewChrome-togglerButton" + (previewWidth !== 0 ? " on" : " off")}>
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 095b60a76..264311a7a 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -656,11 +656,12 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
let foundLayout: Opt<Doc> = undefined;
DocListCast(Cast(CurrentUserUtils.UserDocument.expandingButtons, Doc, null)?.data)?.map(btnDoc => {
- if (StrCast(Cast(btnDoc?.dragFactory, Doc, null)?.title)) {
+ if (StrCast(Cast(btnDoc?.dragFactory, Doc, null)?.title) === layout) {
foundLayout = btnDoc.dragFactory as Doc;
}
})
- DocumentView.makeCustomViewClicked(this.props.Document, this.props.DataDoc, Docs.Create.StackingDocument, layout, foundLayout);
+ DocumentView.
+ makeCustomViewClicked(this.props.Document, this.props.DataDoc, Docs.Create.StackingDocument, layout, foundLayout);
} else {
DocumentView.makeNativeViewClicked(this.props.Document, StrCast(this.props.Document.layoutKey).split("_")[1]);
}