aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/documents/Documents.ts2
-rw-r--r--src/client/views/PreviewCursor.tsx5
-rw-r--r--src/client/views/collections/CollectionCarousel3DView.tsx4
-rw-r--r--src/client/views/collections/CollectionCarouselView.tsx4
-rw-r--r--src/client/views/collections/CollectionMasonryViewFieldRow.tsx2
-rw-r--r--src/client/views/collections/CollectionPileView.tsx6
-rw-r--r--src/client/views/collections/CollectionSchemaCells.tsx2
-rw-r--r--src/client/views/collections/CollectionSchemaHeaders.tsx3
-rw-r--r--src/client/views/collections/CollectionSchemaView.tsx2
-rw-r--r--src/client/views/collections/CollectionStackingView.tsx12
-rw-r--r--src/client/views/collections/CollectionStackingViewFieldColumn.tsx14
-rw-r--r--src/client/views/collections/CollectionSubView.tsx42
-rw-r--r--src/client/views/collections/CollectionTimeView.tsx2
-rw-r--r--src/client/views/collections/CollectionTreeView.tsx20
-rw-r--r--src/client/views/collections/CollectionView.tsx75
-rw-r--r--src/client/views/collections/SchemaTable.tsx8
-rw-r--r--src/client/views/collections/TabDocView.tsx2
-rw-r--r--src/client/views/collections/TreeView.scss4
-rw-r--r--src/client/views/collections/TreeView.tsx24
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormRemoteCursors.tsx8
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx24
-rw-r--r--src/client/views/collections/collectionFreeForm/MarqueeView.tsx28
-rw-r--r--src/client/views/collections/collectionMulticolumn/CollectionMulticolumnView.tsx6
-rw-r--r--src/client/views/collections/collectionMulticolumn/CollectionMultirowView.tsx6
-rw-r--r--src/client/views/nodes/DocumentView.tsx71
-rw-r--r--src/client/views/nodes/FieldView.tsx61
-rw-r--r--src/client/views/nodes/FilterBox.tsx8
-rw-r--r--src/client/views/nodes/LinkBox.tsx4
-rw-r--r--src/client/views/nodes/PresBox.tsx4
-rw-r--r--src/client/views/nodes/VideoBox.tsx1
30 files changed, 189 insertions, 265 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index ae0cd8b92..8a5f0fb5e 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -1136,7 +1136,7 @@ export namespace DocUtils {
newDoc.x = x;
newDoc.y = y;
if (newDoc.type === DocumentType.RTF) FormattedTextBox.SelectOnLoad = newDoc[Id];
- docAdder(newDoc);
+ docAdder?.(newDoc);
}
}),
icon: "eye"
diff --git a/src/client/views/PreviewCursor.tsx b/src/client/views/PreviewCursor.tsx
index d756227f6..ac61dd1d8 100644
--- a/src/client/views/PreviewCursor.tsx
+++ b/src/client/views/PreviewCursor.tsx
@@ -11,6 +11,7 @@ import { Transform } from "../util/Transform";
import { undoBatch, UndoManager } from '../util/UndoManager';
import { FormattedTextBox } from './nodes/formattedText/FormattedTextBox';
import "./PreviewCursor.scss";
+import { returnFalse } from '../../Utils';
@observer
export class PreviewCursor extends React.Component<{}> {
@@ -145,13 +146,13 @@ export class PreviewCursor extends React.Component<{}> {
onKeyPress: (e: KeyboardEvent) => void,
addLiveText: (doc: Doc) => void,
getTransform: () => Transform,
- addDocument: (doc: Doc | Doc[]) => boolean,
+ addDocument: undefined | ((doc: Doc | Doc[]) => boolean),
nudge: undefined | ((nudgeX: number, nudgeY: number) => boolean)) {
this._clickPoint = [x, y];
this._onKeyPress = onKeyPress;
this._addLiveTextDoc = addLiveText;
this._getTransform = getTransform;
- this._addDocument = addDocument;
+ this._addDocument = addDocument || returnFalse;
this._nudge = nudge;
this.Visible = true;
}
diff --git a/src/client/views/collections/CollectionCarousel3DView.tsx b/src/client/views/collections/CollectionCarousel3DView.tsx
index 4e30709a6..67f73d44a 100644
--- a/src/client/views/collections/CollectionCarousel3DView.tsx
+++ b/src/client/views/collections/CollectionCarousel3DView.tsx
@@ -46,8 +46,8 @@ export class CollectionCarousel3DView extends CollectionSubView(Carousel3DDocume
onDoubleClick={this.onChildDoubleClick}
onClick={onChildClick}
renderDepth={this.props.renderDepth + 1}
- LayoutTemplate={this.props.ChildLayoutTemplate}
- LayoutTemplateString={this.props.ChildLayoutString}
+ LayoutTemplate={this.props.childLayoutTemplate}
+ LayoutTemplateString={this.props.childLayoutString}
Document={childPair.layout}
DataDoc={childPair.data}
PanelWidth={this.panelWidth}
diff --git a/src/client/views/collections/CollectionCarouselView.tsx b/src/client/views/collections/CollectionCarouselView.tsx
index 16ccdc6f4..8b7a46e2f 100644
--- a/src/client/views/collections/CollectionCarouselView.tsx
+++ b/src/client/views/collections/CollectionCarouselView.tsx
@@ -53,8 +53,8 @@ export class CollectionCarouselView extends CollectionSubView(CarouselDocument)
onDoubleClick={this.onContentDoubleClick}
onClick={this.onContentClick}
renderDepth={this.props.renderDepth + 1}
- LayoutTemplate={this.props.ChildLayoutTemplate}
- LayoutTemplateString={this.props.ChildLayoutString}
+ LayoutTemplate={this.props.childLayoutTemplate}
+ LayoutTemplateString={this.props.childLayoutString}
Document={curDoc.layout}
DataDoc={curDoc.data}
PanelHeight={this.panelHeight}
diff --git a/src/client/views/collections/CollectionMasonryViewFieldRow.tsx b/src/client/views/collections/CollectionMasonryViewFieldRow.tsx
index b35644c6b..ff69c7d05 100644
--- a/src/client/views/collections/CollectionMasonryViewFieldRow.tsx
+++ b/src/client/views/collections/CollectionMasonryViewFieldRow.tsx
@@ -146,7 +146,7 @@ export class CollectionMasonryViewFieldRow extends React.Component<CMVFieldRowPr
const onLayoutDoc = this.onLayoutDoc(key);
(onLayoutDoc ? newDoc : newDoc[DataSym])[key] = this.getValue(this.props.heading);
const docs = this.props.parent.childDocList;
- return docs ? (docs.splice(0, 0, newDoc) ? true : false) : this.props.parent.props.addDocument(newDoc);
+ return docs ? (docs.splice(0, 0, newDoc) ? true : false) : this.props.parent.props.addDocument?.(newDoc) || false;
}
deleteRow = undoBatch(action(() => {
diff --git a/src/client/views/collections/CollectionPileView.tsx b/src/client/views/collections/CollectionPileView.tsx
index 2636b98e5..f054e7b7f 100644
--- a/src/client/views/collections/CollectionPileView.tsx
+++ b/src/client/views/collections/CollectionPileView.tsx
@@ -36,11 +36,11 @@ export class CollectionPileView extends CollectionSubView(doc => doc) {
<CollectionFreeFormView {...this.props} layoutEngine={this.layoutEngine}
addDocument={undoBatch((doc: Doc | Doc[]) => {
(doc instanceof Doc ? [doc] : doc).map((d) => DocUtils.iconify(d));
- return this.props.addDocument(doc);
+ return this.props.addDocument?.(doc) || false;
})}
moveDocument={undoBatch((doc: Doc | Doc[], targetCollection: Doc | undefined, addDoc: (doc: Doc | Doc[]) => boolean) => {
(doc instanceof Doc ? [doc] : doc).map(undoBatch((d) => Doc.deiconifyView(d)));
- return this.props.moveDocument(doc, targetCollection, addDoc);
+ return this.props.moveDocument?.(doc, targetCollection, addDoc) || false;
})} />
</div>;
}
@@ -91,7 +91,7 @@ export class CollectionPileView extends CollectionSubView(doc => doc) {
const doc = this.childDocs[0];
doc.x = e.clientX;
doc.y = e.clientY;
- this.props.addDocTab(doc, "inParent") && this.props.removeDocument(doc);
+ this.props.addDocTab(doc, "inParent") && (this.props.removeDocument?.(doc) || false);
dist = 0;
}
}
diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx
index 0b3dfe1e4..904b4c761 100644
--- a/src/client/views/collections/CollectionSchemaCells.tsx
+++ b/src/client/views/collections/CollectionSchemaCells.tsx
@@ -44,7 +44,7 @@ export interface CellProps {
renderDepth: number;
addDocTab: (document: Doc, where: string) => boolean;
pinToPres: (document: Doc) => void;
- moveDocument: (document: Doc | Doc[], targetCollection: Doc | undefined,
+ moveDocument?: (document: Doc | Doc[], targetCollection: Doc | undefined,
addDocument: (document: Doc | Doc[]) => boolean) => boolean;
isFocused: boolean;
changeFocusedCellByIndex: (row: number, col: number) => void;
diff --git a/src/client/views/collections/CollectionSchemaHeaders.tsx b/src/client/views/collections/CollectionSchemaHeaders.tsx
index b408fd680..f50da0134 100644
--- a/src/client/views/collections/CollectionSchemaHeaders.tsx
+++ b/src/client/views/collections/CollectionSchemaHeaders.tsx
@@ -461,9 +461,6 @@ export class KeysDropdown extends React.Component<KeysDropdownProps> {
}
}
-
- get ignoreFields() { return ["_docFilters", "_docRangeFilters"]; }
-
@computed get scriptField() {
const scriptText = "setDocFilter(containingTreeView, heading, this.title, checked)";
const script = ScriptField.MakeScript(scriptText, { this: Doc.name, heading: "string", checked: "string", containingTreeView: Doc.name });
diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx
index 8ae70ce20..e22b8effe 100644
--- a/src/client/views/collections/CollectionSchemaView.tsx
+++ b/src/client/views/collections/CollectionSchemaView.tsx
@@ -484,7 +484,7 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) {
const cm = ContextMenu.Instance;
const options = cm.findByDescription("Options...");
const optionItems: ContextMenuProps[] = options && "subitems" in options ? options.subitems : [];
- optionItems.push({ description: "remove", event: () => this._previewDoc && this.props.removeDocument(this._previewDoc), icon: "trash" });
+ optionItems.push({ description: "remove", event: () => this._previewDoc && this.props.removeDocument?.(this._previewDoc), icon: "trash" });
!options && cm.addItem({ description: "Options...", subitems: optionItems, icon: "compass" });
cm.displayMenu(e.clientX, e.clientY);
(e.nativeEvent as any).SchemaHandled = true; // not sure why this is needed, but if you right-click quickly on a cell, the Document/Collection contextMenu handlers still fire without this.
diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx
index 0e4029764..83ac138f5 100644
--- a/src/client/views/collections/CollectionStackingView.tsx
+++ b/src/client/views/collections/CollectionStackingView.tsx
@@ -152,7 +152,7 @@ export class CollectionStackingView extends CollectionSubView<StackingDocument,
@action
moveDocument = (doc: Doc, targetCollection: Doc | undefined, addDocument: (document: Doc) => boolean): boolean => {
- return this.props.removeDocument(doc) && addDocument(doc);
+ return this.props.removeDocument?.(doc) && addDocument?.(doc) ? true : false;
}
createRef = (ele: HTMLDivElement | null) => {
this._masonryGridRef = ele;
@@ -193,9 +193,9 @@ export class CollectionStackingView extends CollectionSubView<StackingDocument,
Document={doc}
DataDoc={dataDoc || (!Doc.AreProtosEqual(doc[DataSym], doc) && doc[DataSym])}
styleProvider={this.props.styleProvider}
- LayoutTemplate={this.props.ChildLayoutTemplate}
- LayoutTemplateString={this.props.ChildLayoutString}
- FreezeDimensions={this.props.freezeChildDimensions}
+ LayoutTemplate={this.props.childLayoutTemplate}
+ LayoutTemplateString={this.props.childLayoutString}
+ FreezeDimensions={this.props.childFreezeDimensions}
renderDepth={this.props.renderDepth + 1}
PanelWidth={width}
PanelHeight={height}
@@ -232,14 +232,14 @@ export class CollectionStackingView extends CollectionSubView<StackingDocument,
getDocWidth(d?: Doc) {
if (!d) return 0;
- const layoutDoc = Doc.Layout(d, this.props.ChildLayoutTemplate?.());
+ const layoutDoc = Doc.Layout(d, this.props.childLayoutTemplate?.());
const nw = Doc.NativeWidth(layoutDoc);
return Math.min(nw && !this.layoutDoc._columnsFill ? d[WidthSym]() : Number.MAX_VALUE, this.columnWidth / this.numGroupColumns);
}
getDocHeight(d?: Doc) {
if (!d) return 0;
const childDataDoc = (!d.isTemplateDoc && !d.isTemplateForField && !d.PARAMS) ? undefined : this.props.DataDoc;
- const childLayoutDoc = Doc.Layout(d, this.props.ChildLayoutTemplate?.());
+ const childLayoutDoc = Doc.Layout(d, this.props.childLayoutTemplate?.());
const nw = Doc.NativeWidth(childLayoutDoc, childDataDoc);
const nh = Doc.NativeHeight(childLayoutDoc, childDataDoc);
let wid = this.columnWidth / (this.isStackingView ? this.numGroupColumns : 1);
diff --git a/src/client/views/collections/CollectionStackingViewFieldColumn.tsx b/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
index b7562c45e..ec6458d00 100644
--- a/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
+++ b/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
@@ -10,7 +10,7 @@ import { ScriptField } from "../../../fields/ScriptField";
import { Cast, NumCast, StrCast } from "../../../fields/Types";
import { ImageField } from "../../../fields/URLField";
import { TraceMobx } from "../../../fields/util";
-import { emptyFunction, setupMoveUpEvents } from "../../../Utils";
+import { emptyFunction, setupMoveUpEvents, returnFalse } from "../../../Utils";
import { Docs, DocUtils } from "../../documents/Documents";
import { DocumentType } from "../../documents/DocumentTypes";
import { DragManager } from "../../util/DragManager";
@@ -146,7 +146,7 @@ export class CollectionStackingViewFieldColumn extends React.Component<CSVFieldC
newDoc.heading = heading;
FormattedTextBox.SelectOnLoad = newDoc[Id];
FormattedTextBox.SelectOnLoadChar = forceEmptyNote ? "" : " ";
- return this.props.parent.props.addDocument(newDoc);
+ return this.props.parent.props.addDocument?.(newDoc) || false;
}
@action
@@ -238,8 +238,8 @@ export class CollectionStackingViewFieldColumn extends React.Component<CSVFieldC
DocUtils.addDocumentCreatorMenuItems((doc) => {
FormattedTextBox.SelectOnLoad = doc[Id];
- return this.props.parent.props.addDocument(doc);
- }, this.props.parent.props.addDocument, x, y, true);
+ return this.props.parent.props.addDocument?.(doc) || false;
+ }, this.props.parent.props.addDocument || returnFalse, x, y, true);
Array.from(Object.keys(Doc.GetProto(dataDoc))).filter(fieldKey => dataDoc[fieldKey] instanceof RichTextField || dataDoc[fieldKey] instanceof ImageField || typeof (dataDoc[fieldKey]) === "string").map(fieldKey =>
docItems.push({
@@ -249,7 +249,7 @@ export class CollectionStackingViewFieldColumn extends React.Component<CSVFieldC
if (this.props.parent.Document.isTemplateDoc) {
Doc.MakeMetadataFieldTemplate(created, this.props.parent.props.Document);
}
- return this.props.parent.props.addDocument(created);
+ return this.props.parent.props.addDocument?.(created) || false;
}
}, icon: "compress-arrows-alt"
}));
@@ -263,7 +263,7 @@ export class CollectionStackingViewFieldColumn extends React.Component<CSVFieldC
Doc.MakeMetadataFieldTemplate(created, container);
return Doc.AddDocToList(container, Doc.LayoutFieldKey(container), created);
}
- return this.props.parent.props.addDocument(created);
+ return this.props.parent.props.addDocument?.(created) || false;
}
}, icon: "compress-arrows-alt"
}));
@@ -276,7 +276,7 @@ export class CollectionStackingViewFieldColumn extends React.Component<CSVFieldC
if (this.props.parent.Document.isTemplateDoc) {
Doc.MakeMetadataFieldTemplate(created, this.props.parent.props.Document);
}
- this.props.parent.props.addDocument(created);
+ this.props.parent.props.addDocument?.(created);
}
});
const pt = this.props.screenToLocalTransform().inverse().transformPoint(x, y);
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index 10459a497..592d6ab87 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -8,48 +8,20 @@ import { ScriptField } from "../../../fields/ScriptField";
import { WebField } from "../../../fields/URLField";
import { Cast, ScriptCast, NumCast, StrCast } from "../../../fields/Types";
import { GestureUtils } from "../../../pen-gestures/GestureUtils";
-import { Utils, returnFalse, returnEmptyFilter } from "../../../Utils";
+import { Utils, returnFalse } from "../../../Utils";
import { DocServer } from "../../DocServer";
import { Networking } from "../../Network";
import { ImageUtils } from "../../util/Import & Export/ImageUtils";
import { InteractionUtils } from "../../util/InteractionUtils";
import { undoBatch, UndoManager } from "../../util/UndoManager";
import { DocComponent } from "../DocComponent";
-import { FieldViewProps } from "../nodes/FieldView";
import React = require("react");
import * as rp from 'request-promise';
import ReactLoading from 'react-loading';
-export interface CollectionViewProps extends FieldViewProps {
- addDocument: (document: Doc | Doc[]) => boolean;
- removeDocument: (document: Doc | Doc[]) => boolean;
- moveDocument: (document: Doc | Doc[], targetCollection: Doc | undefined, addDocument: (document: Doc | Doc[]) => boolean) => boolean;
- PanelWidth: () => number;
- PanelHeight: () => number;
- VisibleHeight?: () => number;
- setPreviewCursor?: (func: (x: number, y: number, drag: boolean) => void) => void;
- rootSelected: (outsideReaction?: boolean) => boolean;
- fieldKey: string;
- NativeWidth?: () => number;
- NativeHeight?: () => number;
-}
export interface SubCollectionViewProps extends CollectionViewProps {
CollectionView: Opt<CollectionView>;
- children?: never | (() => JSX.Element[]) | React.ReactNode;
- ChildLayoutTemplate?: () => Doc;
- childOpacity?: () => number;
- childIgnoreNativeSize?: boolean;
- ChildLayoutString?: string;
- childClickScript?: ScriptField;
- childDoubleClickScript?: ScriptField;
- freezeChildDimensions?: boolean; // used by TimeView to coerce documents to treat their width height as their native width/height
- overrideDocuments?: Doc[]; // used to override the documents shown by the sub collection to an explicit list (see LinkBox)
- ignoreFields?: string[]; // used in TreeView to ignore specified fields (see LinkBox)
- parentActive: (outsideReaction: boolean) => boolean;
- isAnnotationOverlay?: boolean;
- annotationsKey: string;
- layoutEngine?: () => string;
}
export function CollectionSubView<T, X>(schemaCtor: (doc: Doc) => T, moreProps?: X) {
@@ -112,11 +84,11 @@ export function CollectionSubView<T, X>(schemaCtor: (doc: Doc) => T, moreProps?:
return Cast(this.dataField, listSpec(Doc));
}
docFilters = () => {
- return this.props.ignoreFields?.includes("_docFilters") ? [] :
+ return this.props.ignoreFilters ? [] :
[...this.props.docFilters(), ...Cast(this.props.Document._docFilters, listSpec("string"), [])];
}
docRangeFilters = () => {
- return this.props.ignoreFields?.includes("_docRangeFilters") ? [] :
+ return this.props.ignoreFilters ? [] :
[...this.props.docRangeFilters(), ...Cast(this.props.Document._docRangeFilters, listSpec("string"), [])];
}
searchFilterDocs = () => {
@@ -220,7 +192,7 @@ export function CollectionSubView<T, X>(schemaCtor: (doc: Doc) => T, moreProps?:
}
}
- addDocument = (doc: Doc | Doc[]) => this.props.addDocument(doc);
+ addDocument = (doc: Doc | Doc[]) => this.props.addDocument?.(doc) || false;
@action
protected onInternalDrop(e: Event, de: DragManager.DropEvent): boolean {
@@ -329,7 +301,7 @@ export function CollectionSubView<T, X>(schemaCtor: (doc: Doc) => T, moreProps?:
DocServer.GetRefField(docid).then(f => {
if (f instanceof Doc) {
if (options.x || options.y) { f.x = options.x; f.y = options.y; } // should be in CollectionFreeFormView
- (f instanceof Doc) && this.props.addDocument(f);
+ (f instanceof Doc) && this.addDocument(f);
}
});
} else {
@@ -343,7 +315,7 @@ export function CollectionSubView<T, X>(schemaCtor: (doc: Doc) => T, moreProps?:
const modHtml = srcUrl ? html.replace(reg, srcUrl) : html;
const htmlDoc = Docs.Create.HtmlDocument(modHtml, { ...options, title: "-web page-", _width: 300, _height: 300 });
Doc.GetProto(htmlDoc)["data-text"] = Doc.GetProto(htmlDoc).text = text;
- this.props.addDocument(htmlDoc);
+ this.addDocument(htmlDoc);
if (srcWeb) {
const iframe = SelectionManager.SelectedDocuments()[0].ContentDiv?.getElementsByTagName("iframe")?.[0];
const focusNode = (iframe?.contentDocument?.getSelection()?.focusNode as any);
@@ -503,7 +475,7 @@ import { Docs, DocumentOptions, DocUtils } from "../../documents/Documents";
import { CurrentUserUtils } from "../../util/CurrentUserUtils";
import { DocumentType } from "../../documents/DocumentTypes";
import { FormattedTextBox, GoogleRef } from "../nodes/formattedText/FormattedTextBox";
-import { CollectionView, CollectionViewType } from "./CollectionView";
+import { CollectionView, CollectionViewType, CollectionViewProps } from "./CollectionView";
import { SelectionManager } from "../../util/SelectionManager";
import { OverlayView } from "../OverlayView";
import { setTimeout } from "timers";
diff --git a/src/client/views/collections/CollectionTimeView.tsx b/src/client/views/collections/CollectionTimeView.tsx
index c2d682361..e4a3c384c 100644
--- a/src/client/views/collections/CollectionTimeView.tsx
+++ b/src/client/views/collections/CollectionTimeView.tsx
@@ -85,7 +85,7 @@ export class CollectionTimeView extends CollectionSubView(doc => doc) {
@computed get contents() {
return <div className="collectionTimeView-innards" key="timeline" style={{ width: "100%", pointerEvents: this.props.active() ? undefined : "none" }} onPointerDown={this.contentsDown}>
- <CollectionFreeFormView {...this.props} childClickScript={this._childClickedScript} viewDefDivClick={this._viewDefDivClick} fitToBox={true} freezeChildDimensions={true} layoutEngine={this.layoutEngine} />
+ <CollectionFreeFormView {...this.props} childClickScript={this._childClickedScript} viewDefDivClick={this._viewDefDivClick} fitToBox={true} childFreezeDimensions={true} layoutEngine={this.layoutEngine} />
</div>;
}
diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx
index 681584cc5..265f5a323 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -6,10 +6,11 @@ import { Id } from '../../../fields/FieldSymbols';
import { List } from '../../../fields/List';
import { Document } from '../../../fields/Schema';
import { ScriptField } from '../../../fields/ScriptField';
-import { BoolCast, NumCast, ScriptCast, StrCast, Cast } from '../../../fields/Types';
+import { BoolCast, Cast, NumCast, ScriptCast, StrCast } from '../../../fields/Types';
import { TraceMobx } from '../../../fields/util';
-import { emptyPath, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnOne, returnTrue, Utils } from '../../../Utils';
+import { returnEmptyDoclist, returnEmptyFilter, returnFalse, returnOne, returnTrue, Utils } from '../../../Utils';
import { DocUtils } from '../../documents/Documents';
+import { DocumentManager } from '../../util/DocumentManager';
import { DragManager, dropActionType } from "../../util/DragManager";
import { SelectionManager } from '../../util/SelectionManager';
import { SnappingManager } from '../../util/SnappingManager';
@@ -17,20 +18,17 @@ import { undoBatch, UndoManager } from '../../util/UndoManager';
import { ContextMenu } from '../ContextMenu';
import { ContextMenuProps } from '../ContextMenuItem';
import { EditableView } from "../EditableView";
-import { ContentFittingDocumentView } from '../nodes/ContentFittingDocumentView';
+import { DocumentView } from '../nodes/DocumentView';
import { FormattedTextBox } from '../nodes/formattedText/FormattedTextBox';
-import { RichTextMenu } from '../nodes/formattedText/RichTextMenu';
import { CollectionSubView } from "./CollectionSubView";
import "./CollectionTreeView.scss";
import { TreeView } from "./TreeView";
import React = require("react");
-import { DocumentManager } from '../../util/DocumentManager';
-import { FormattedTextBoxComment } from '../nodes/formattedText/FormattedTextBoxComment';
-import { DocumentView } from '../nodes/DocumentView';
export type collectionTreeViewProps = {
treeViewHideTitle?: boolean;
treeViewHideHeaderFields?: boolean;
+ treeViewSkipFields?: string[]; // prevents specific fields from being displayed (see LinkBox)
onCheckedClick?: () => ScriptField;
onChildClick?: () => ScriptField;
};
@@ -92,7 +90,7 @@ export class CollectionTreeView extends CollectionSubView<Document, Partial<coll
if (this.doc.resolvedDataDoc instanceof Promise) {
this.doc.resolvedDataDoc.then((resolved: any) => doAddDoc(doc));
} else if (relativeTo === undefined) {
- this.props.addDocument(doc);
+ this.props.addDocument?.(doc);
} else {
doAddDoc(doc);
(doc instanceof Doc ? [doc] : doc).forEach(d => d.context = this.props.Document);
@@ -195,18 +193,18 @@ export class CollectionTreeView extends CollectionSubView<Document, Partial<coll
active = (outsideReaction: boolean | undefined) => this.props.active(outsideReaction) || this._isChildActive;
@computed get treeChildren() {
TraceMobx();
- return this.props.overrideDocuments ? this.props.overrideDocuments : this.childDocs;
+ return this.props.childDocuments || this.childDocs;
}
@computed get treeViewElements() {
TraceMobx();
const dropAction = StrCast(this.doc.childDropAction) as dropActionType;
const addDoc = (doc: Doc | Doc[], relativeTo?: Doc, before?: boolean) => this.addDoc(doc, relativeTo, before);
- const moveDoc = (d: Doc | Doc[], target: Doc | undefined, addDoc: (doc: Doc | Doc[]) => boolean) => this.props.moveDocument(d, target, addDoc);
+ const moveDoc = (d: Doc | Doc[], target: Doc | undefined, addDoc: (doc: Doc | Doc[]) => boolean) => this.props.moveDocument?.(d, target, addDoc) || false;
return TreeView.GetChildElements(this.treeChildren, this, this.doc, this.props.DataDoc, this.props.fieldKey, this.props.ContainingCollectionDoc, undefined, addDoc, this.remove,
moveDoc, dropAction, this.props.addDocTab, this.props.pinToPres, this.props.styleProvider, this.props.ScreenToLocalTransform,
this.outerXf, this.active, this.props.PanelWidth, this.props.ChromeHeight, this.props.renderDepth, () => this.props.treeViewHideHeaderFields || BoolCast(this.doc.treeViewHideHeaderFields),
BoolCast(this.doc.treeViewPreventOpen), [], this.props.onCheckedClick,
- this.onChildClick, this.props.ignoreFields, true, this.whenActiveChanged, this.props.dontRegisterView || Cast(this.props.Document.dontRegisterChildViews, "boolean", null));
+ this.onChildClick, this.props.treeViewSkipFields, true, this.whenActiveChanged, this.props.dontRegisterView || Cast(this.props.Document.dontRegisterChildViews, "boolean", null));
}
@computed get titleBar() {
const hideTitle = this.props.treeViewHideTitle || this.doc.treeViewHideTitle;
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 8f402c427..af03e4ceb 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -10,7 +10,7 @@ import { List } from '../../../fields/List';
import { ObjectField } from '../../../fields/ObjectField';
import { BoolCast, Cast, ScriptCast, StrCast } from '../../../fields/Types';
import { ImageField } from '../../../fields/URLField';
-import { distributeAcls, GetEffectiveAcl, SharingPermissions, TraceMobx, normalizeEmail, denormalizeEmail } from '../../../fields/util';
+import { denormalizeEmail, distributeAcls, GetEffectiveAcl, SharingPermissions, TraceMobx } from '../../../fields/util';
import { returnFalse, Utils } from '../../../Utils';
import { Docs, DocUtils } from '../../documents/Documents';
import { DocumentType } from '../../documents/DocumentTypes';
@@ -38,10 +38,7 @@ import { SubCollectionViewProps } from './CollectionSubView';
import { CollectionTimeView } from './CollectionTimeView';
import { CollectionTreeView } from "./CollectionTreeView";
import './CollectionView.scss';
-import { listSpec } from '../../../fields/Schema';
-const higflyout = require("@hig/flyout");
-export const { anchorPoints } = higflyout;
-export const Flyout = higflyout.default;
+import { ScriptField } from '../../../fields/ScriptField';
export const COLLECTION_BORDER_WIDTH = 2;
const path = require('path');
@@ -64,28 +61,29 @@ export enum CollectionViewType {
Grid = "grid",
Pile = "pileup"
}
-export interface CollectionViewCustomProps {
+export interface CollectionViewProps extends FieldViewProps {
+ isAnnotationOverlay?: boolean; // is the collection an annotation overlay (eg an overlay on an image/video/etc)
+ annotationsKey: string; // which data field on the collection stores the collection of annotation documents
+ ignoreFilters?: boolean;
+ layoutEngine?: () => string;
+ parentActive: (outsideReaction: boolean) => boolean;
filterAddDocument?: (doc: Doc | Doc[]) => boolean; // allows a document that renders a Collection view to filter or modify any documents added to the collection (see PresBox for an example)
+ VisibleHeight?: () => number;
+ setPreviewCursor?: (func: (x: number, y: number, drag: boolean) => void) => void;
+
+ // property overrides for child documents
+ childDocuments?: Doc[]; // used to override the documents shown by the sub collection to an explicit list (see LinkBox)
childOpacity?: () => number;
- hideFilter?: true;
+ childLayoutTemplate?: () => (Doc | undefined);// specify a layout Doc template to use for children of the collection
+ childLayoutString?: string;
+ children?: never | (() => JSX.Element[]) | React.ReactNode;
+ childFreezeDimensions?: boolean; // used by TimeView to coerce documents to treat their width height as their native width/height
childIgnoreNativeSize?: boolean;
+ childClickScript?: ScriptField;
+ childDoubleClickScript?: ScriptField;
}
-
-export interface CollectionRenderProps {
- addDocument: (document: Doc | Doc[]) => boolean;
- removeDocument: (document: Doc | Doc[]) => boolean;
- moveDocument: (document: Doc | Doc[], targetCollection: Doc | undefined, addDocument: (document: Doc | Doc[]) => boolean) => boolean;
- active: () => boolean;
- parentActive: (outsideReaction: boolean) => boolean;
- whenActiveChanged: (isActive: boolean) => void;
- PanelWidth: () => number;
- PanelHeight: () => number;
- ChildLayoutTemplate?: () => Doc;// specify a layout Doc template to use for children of the collection
- ChildLayoutString?: string;// specify a layout string to use for children of the collection
-}
-
@observer
-export class CollectionView extends Touchable<FieldViewProps & CollectionViewCustomProps> {
+export class CollectionView extends Touchable<CollectionViewProps> {
public static LayoutString(fieldStr: string) { return FieldView.LayoutString(CollectionView, fieldStr); }
_isChildActive = false; //TODO should this be observable?
@@ -97,22 +95,13 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus
protected _multiTouchDisposer?: InteractionUtils.MultiTouchEventDisposer;
- private AclMap = new Map<symbol, string>([
- [AclPrivate, SharingPermissions.None],
- [AclReadonly, SharingPermissions.View],
- [AclAddonly, SharingPermissions.Add],
- [AclEdit, SharingPermissions.Edit],
- [AclAdmin, SharingPermissions.Admin]
- ]);
-
get collectionViewType(): CollectionViewType | undefined {
const viewField = StrCast(this.props.Document._viewType);
if (CollectionView._safeMode) {
- if (viewField === CollectionViewType.Freeform || viewField === CollectionViewType.Schema) {
- return CollectionViewType.Tree;
- }
- if (viewField === CollectionViewType.Invalid) {
- return CollectionViewType.Freeform;
+ switch (viewField) {
+ case CollectionViewType.Freeform:
+ case CollectionViewType.Schema: return CollectionViewType.Tree;
+ case CollectionViewType.Invalid: return CollectionViewType.Freeform;
}
}
return viewField as any as CollectionViewType;
@@ -136,7 +125,6 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus
const docs = doc instanceof Doc ? [doc] : doc;
-
if (docs.find(doc => Doc.AreProtosEqual(doc, this.props.Document))) return false;
const targetDataDoc = this.props.Document[DataSym];
const docList = DocListCast(targetDataDoc[this.props.fieldKey]);
@@ -253,9 +241,8 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus
}
screenToLocalTransform = () => this.props.renderDepth ? this.props.ScreenToLocalTransform() : this.props.ScreenToLocalTransform().scale(this.props.PanelWidth() / this.bodyPanelWidth());
- private SubView = (type: CollectionViewType, renderProps: CollectionRenderProps) => {
+ private SubView = (type: CollectionViewType, props: SubCollectionViewProps) => {
TraceMobx();
- const props: SubCollectionViewProps = { ...this.props, ...renderProps, ScreenToLocalTransform: this.screenToLocalTransform, CollectionView: this, annotationsKey: "" };
switch (type) {
case CollectionViewType.Schema: return (<CollectionSchemaView key="collview" {...props} />);
case CollectionViewType.Docking: return (<CollectionDockingView key="collview" {...props} />);
@@ -273,7 +260,7 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus
case CollectionViewType.Map: return (<CollectionMapView key="collview" {...props} />);
case CollectionViewType.Grid: return (<CollectionGridView key="gridview" {...props} />);
case CollectionViewType.Freeform:
- default: { this.props.Document._freeformLayoutEngine = undefined; return (<CollectionFreeFormView key="collview" {...props} ChildLayoutString={props.ChildLayoutString} />); }
+ default: { this.props.Document._freeformLayoutEngine = undefined; return (<CollectionFreeFormView key="collview" {...props} />); }
}
}
@@ -386,7 +373,8 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus
render() {
TraceMobx();
- const props: CollectionRenderProps = {
+ const props: SubCollectionViewProps = {
+ ...this.props,
addDocument: this.addDocument,
removeDocument: this.removeDocument,
moveDocument: this.moveDocument,
@@ -395,8 +383,11 @@ export class CollectionView extends Touchable<FieldViewProps & CollectionViewCus
parentActive: this.props.parentActive,
PanelWidth: this.bodyPanelWidth,
PanelHeight: this.props.PanelHeight,
- ChildLayoutTemplate: this.childLayoutTemplate,
- ChildLayoutString: this.childLayoutString,
+ childLayoutTemplate: this.childLayoutTemplate,
+ childLayoutString: this.childLayoutString,
+ ScreenToLocalTransform: this.screenToLocalTransform,
+ CollectionView: this,
+ annotationsKey: ""
};
const boxShadow = Doc.UserDoc().renderStyle === "comic" || this.props.Document.treeViewOutlineMode || this.collectionViewType === CollectionViewType.Linear ? undefined :
this.props.styleProvider?.(this.props.Document, this.props, "boxShadow");
diff --git a/src/client/views/collections/SchemaTable.tsx b/src/client/views/collections/SchemaTable.tsx
index 664b6115a..b532d3302 100644
--- a/src/client/views/collections/SchemaTable.tsx
+++ b/src/client/views/collections/SchemaTable.tsx
@@ -62,9 +62,9 @@ export interface SchemaTableProps {
ContainingCollectionDoc: Opt<Doc>;
fieldKey: string;
renderDepth: number;
- deleteDocument: (document: Doc | Doc[]) => boolean;
- addDocument: (document: Doc | Doc[]) => boolean;
- moveDocument: (document: Doc | Doc[], targetCollection: Doc | undefined, addDocument: (document: Doc | Doc[]) => boolean) => boolean;
+ deleteDocument?: (document: Doc | Doc[]) => boolean;
+ addDocument?: (document: Doc | Doc[]) => boolean;
+ moveDocument?: (document: Doc | Doc[], targetCollection: Doc | undefined, addDocument: (document: Doc | Doc[]) => boolean) => boolean;
ScreenToLocalTransform: () => Transform;
active: (outsideReaction: boolean | undefined) => boolean;
onDrop: (e: React.DragEvent<Element>, options: DocumentOptions, completed?: (() => void) | undefined) => void;
@@ -376,7 +376,7 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
@undoBatch
createRow = action(() => {
- this.props.addDocument(Docs.Create.TextDocument("", { title: "", _width: 100, _height: 30 }));
+ this.props.addDocument?.(Docs.Create.TextDocument("", { title: "", _width: 100, _height: 30 }));
this._focusedCell = { row: this.childDocs.length, col: this._focusedCell.col };
});
diff --git a/src/client/views/collections/TabDocView.tsx b/src/client/views/collections/TabDocView.tsx
index e1fd47592..3c1aaae47 100644
--- a/src/client/views/collections/TabDocView.tsx
+++ b/src/client/views/collections/TabDocView.tsx
@@ -339,7 +339,7 @@ export class TabDocView extends React.Component<TabDocViewProps> {
ContainingCollectionView={undefined}
ContainingCollectionDoc={undefined}
parentActive={returnFalse}
- ChildLayoutTemplate={this.childLayoutTemplate} // bcz: Ugh .. should probably be rendering a CollectionView or the minimap should be part of the collectionFreeFormView to avoid having to set stuff like this.
+ childLayoutTemplate={this.childLayoutTemplate} // bcz: Ugh .. should probably be rendering a CollectionView or the minimap should be part of the collectionFreeFormView to avoid having to set stuff like this.
noOverlay={true} // don't render overlay Docs since they won't scale
active={returnTrue}
select={emptyFunction}
diff --git a/src/client/views/collections/TreeView.scss b/src/client/views/collections/TreeView.scss
index 84b5af7be..0a97166f0 100644
--- a/src/client/views/collections/TreeView.scss
+++ b/src/client/views/collections/TreeView.scss
@@ -17,6 +17,10 @@
left: -10px;
position: absolute;
}
+ .treeView-checkIcon {
+ left: -10px;
+ position: absolute;
+ }
&:hover {
.treeView-expandIcon {
display: unset;
diff --git a/src/client/views/collections/TreeView.tsx b/src/client/views/collections/TreeView.tsx
index 675ba60c0..be8a27ab0 100644
--- a/src/client/views/collections/TreeView.tsx
+++ b/src/client/views/collections/TreeView.tsx
@@ -49,7 +49,7 @@ export interface TreeViewProps {
outdentDocument?: () => void;
ScreenToLocalTransform: () => Transform;
dontRegisterView?: boolean;
- backgroundColor?: (doc: Opt<Doc>, props: Opt<DocumentViewProps>, property: string, layerProvider?: (doc: Doc, assign?: boolean) => boolean) => string | undefined;
+ backgroundColor?: (doc: Opt<Doc>, props: DocumentViewProps, property: string) => string | undefined;
outerXf: () => { translateX: number, translateY: number };
treeView: CollectionTreeView;
parentKey: string;
@@ -59,7 +59,7 @@ export interface TreeViewProps {
renderedIds: string[]; // list of document ids rendered used to avoid unending expansion of items in a cycle
onCheckedClick?: () => ScriptField;
onChildClick?: () => ScriptField;
- ignoreFields?: string[];
+ skipFields?: string[];
firstLevel: boolean;
whenActiveChanged: (isActive: boolean) => void;
}
@@ -311,7 +311,7 @@ export class TreeView extends React.Component<TreeViewProps> {
doc && Object.keys(doc).forEach(key => !(key in ids) && doc[key] !== ComputedField.undefined && (ids[key] = key));
for (const key of Object.keys(ids).slice().sort()) {
- if (this.props.ignoreFields?.includes(key) || key === "title" || key === "treeViewOpen") continue;
+ if (this.props.skipFields?.includes(key) || key === "title" || key === "treeViewOpen") continue;
const contents = doc[key];
let contentElement: (JSX.Element | null)[] | JSX.Element = [];
@@ -327,7 +327,7 @@ export class TreeView extends React.Component<TreeViewProps> {
this.props.treeView, doc, undefined, key, this.props.containingCollection, this.props.prevSibling, addDoc, remDoc, this.move,
this.props.dropAction, this.props.addDocTab, this.props.pinToPres, this.props.backgroundColor, this.props.ScreenToLocalTransform, this.props.outerXf, this.props.active,
this.props.panelWidth, this.props.ChromeHeight, this.props.renderDepth, this.props.treeViewHideHeaderFields, this.props.treeViewPreventOpen,
- [...this.props.renderedIds, doc[Id]], this.props.onCheckedClick, this.props.onChildClick, this.props.ignoreFields, false, this.props.whenActiveChanged, this.props.dontRegisterView);
+ [...this.props.renderedIds, doc[Id]], this.props.onCheckedClick, this.props.onChildClick, this.props.skipFields, false, this.props.whenActiveChanged, this.props.dontRegisterView);
} else {
contentElement = <EditableView key="editableView"
contents={contents !== undefined ? Field.toString(contents as Field) : "null"}
@@ -406,7 +406,7 @@ export class TreeView extends React.Component<TreeViewProps> {
this.dataDoc, expandKey, this.props.containingCollection, this.props.prevSibling, addDoc, remDoc, this.move,
StrCast(this.doc.childDropAction, this.props.dropAction) as dropActionType, this.props.addDocTab, this.props.pinToPres, this.props.backgroundColor, this.props.ScreenToLocalTransform,
this.props.outerXf, this.props.active, this.props.panelWidth, this.props.ChromeHeight, this.props.renderDepth, this.props.treeViewHideHeaderFields, this.props.treeViewPreventOpen,
- [...this.props.renderedIds, this.doc[Id]], this.props.onCheckedClick, this.props.onChildClick, this.props.ignoreFields, false, this.props.whenActiveChanged, this.props.dontRegisterView)}
+ [...this.props.renderedIds, this.doc[Id]], this.props.onCheckedClick, this.props.onChildClick, this.props.skipFields, false, this.props.whenActiveChanged, this.props.dontRegisterView)}
</ul >;
} else if (this.treeViewExpandedView === "fields") {
return <ul key={this.doc[Id] + this.doc.title}><div style={{ display: "inline-block" }} >
@@ -449,14 +449,14 @@ export class TreeView extends React.Component<TreeViewProps> {
!(this.doc.text as RichTextField)?.Text ? (null) :
<FontAwesomeIcon size="sm" icon={[this.childDocs?.length && !this.treeViewOpen ? "fas" : "far", "circle"]} /> :
<div className="treeView-bulletIcons" >
- <div className="treeView-expandIcon">
- <FontAwesomeIcon size="sm" icon={this.outlineMode ? [this.childDocs?.length && !this.treeViewOpen ? "fas" : "far", "circle"] :
+ <div className={`treeView-${this.onCheckedClick ? "checkIcon" : "expandIcon"}`}>
+ <FontAwesomeIcon size="sm" icon={
checked === "check" ? "check" :
(checked === "x" ? "times" : checked === "unchecked" ? "square" :
!this.treeViewOpen ? "caret-right" :
"caret-down")} />
</div>
- <FontAwesomeIcon icon={iconType} />
+ {this.onCheckedClick ? (null) : <FontAwesomeIcon icon={iconType} />}
</div>
}
</div>;
@@ -710,7 +710,7 @@ export class TreeView extends React.Component<TreeViewProps> {
dropAction: dropActionType,
addDocTab: (doc: Doc, where: string) => boolean,
pinToPres: (document: Doc) => void,
- backgroundColor: undefined | ((document: Opt<Doc>, props: Opt<DocumentViewProps>, property: string, layerProvider?: (doc: Doc, assign?: boolean) => boolean) => string | undefined),
+ styleProvider: undefined | ((document: Opt<Doc>, props: DocumentViewProps, property: string) => string | undefined),
screenToLocalXf: () => Transform,
outerXf: () => { translateX: number, translateY: number },
active: (outsideReaction?: boolean) => boolean,
@@ -722,7 +722,7 @@ export class TreeView extends React.Component<TreeViewProps> {
renderedIds: string[],
onCheckedClick: undefined | (() => ScriptField),
onChildClick: undefined | (() => ScriptField),
- ignoreFields: string[] | undefined,
+ skipFields: string[] | undefined,
firstLevel: boolean,
whenActiveChanged: (isActive: boolean) => void,
dontRegisterView: boolean | undefined) {
@@ -783,7 +783,7 @@ export class TreeView extends React.Component<TreeViewProps> {
renderDepth={renderDepth}
removeDoc={StrCast(containingCollection.freezeChildren).includes("remove") ? undefined : remove}
addDocument={addDocument}
- backgroundColor={backgroundColor}
+ backgroundColor={styleProvider}
panelWidth={rowWidth}
panelHeight={rowHeight}
ChromeHeight={ChromeHeight}
@@ -799,7 +799,7 @@ export class TreeView extends React.Component<TreeViewProps> {
treeViewHideHeaderFields={treeViewHideHeaderFields}
treeViewPreventOpen={treeViewPreventOpen}
renderedIds={renderedIds}
- ignoreFields={ignoreFields}
+ skipFields={skipFields}
firstLevel={firstLevel}
whenActiveChanged={whenActiveChanged} />;
});
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormRemoteCursors.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormRemoteCursors.tsx
index 548ad78a5..9f6938e67 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormRemoteCursors.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormRemoteCursors.tsx
@@ -1,16 +1,16 @@
+import { computed } from "mobx";
import { observer } from "mobx-react";
import * as mobxUtils from 'mobx-utils';
import CursorField from "../../../../fields/CursorField";
+import { FieldResult } from "../../../../fields/Doc";
+import { List } from "../../../../fields/List";
import { listSpec } from "../../../../fields/Schema";
import { Cast } from "../../../../fields/Types";
import { CurrentUserUtils } from "../../../util/CurrentUserUtils";
-import { CollectionViewProps } from "../CollectionSubView";
+import { CollectionViewProps } from "../CollectionView";
import "./CollectionFreeFormView.scss";
import React = require("react");
import v5 = require("uuid/v5");
-import { computed } from "mobx";
-import { FieldResult } from "../../../../fields/Doc";
-import { List } from "../../../../fields/List";
@observer
export class CollectionFreeFormRemoteCursors extends React.Component<CollectionViewProps> {
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 136600164..0f466fc16 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -158,11 +158,11 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P
addDocument = action((newBox: Doc | Doc[]) => {
let retVal = false;
if (newBox instanceof Doc) {
- retVal = this.props.addDocument(newBox);
+ retVal = this.props.addDocument?.(newBox) || false;
retVal && this.bringToFront(newBox);
retVal && this.updateCluster(newBox);
} else {
- retVal = this.props.addDocument(newBox);
+ retVal = this.props.addDocument?.(newBox) || false;
// bcz: deal with clusters
}
if (retVal) {
@@ -270,7 +270,7 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P
return false;
} else {
const source = Docs.Create.TextDocument("", { _width: 200, _height: 75, x: xp, y: yp, title: "dropped annotation" });
- this.props.addDocument(source);
+ this.props.addDocument?.(source);
linkDragData.linkDocument = DocUtils.MakeLink({ doc: source }, { doc: linkDragData.linkSourceDocument }, "doc annotation", ""); // TODODO this is where in text links get passed
e.stopPropagation();
return true;
@@ -396,7 +396,7 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P
}
}
- getClusterColor = (doc: Opt<Doc>, props: Opt<DocumentViewProps>, property: string) => {
+ getClusterColor = (doc: Opt<Doc>, props: DocumentViewProps, property: string) => {
let clusterColor = this.props.styleProvider?.(doc, props, property); // bcz: check 'props' used to be renderDepth + 1
if (property !== "backgroundColor") return clusterColor;
const cluster = NumCast(doc?.cluster);
@@ -510,7 +510,7 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P
return pass;
});
this.addDocument(Docs.Create.FreeformDocument(sel, { title: "nested collection", x: bounds.x, y: bounds.y, _width: bWidth, _height: bHeight, _panX: 0, _panY: 0 }));
- sel.forEach(d => this.props.removeDocument(d));
+ sel.forEach(d => this.props.removeDocument?.(d));
e.stopPropagation();
break;
case GestureUtils.Gestures.StartBracket:
@@ -999,9 +999,9 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P
fitToBox: false,
DataDoc: childData,
Document: childLayout,
- LayoutTemplate: childLayout.z ? undefined : this.props.ChildLayoutTemplate,
- LayoutTemplateString: childLayout.z ? undefined : this.props.ChildLayoutString,
- FreezeDimensions: this.props.freezeChildDimensions,
+ LayoutTemplate: childLayout.z ? undefined : this.props.childLayoutTemplate,
+ LayoutTemplateString: childLayout.z ? undefined : this.props.childLayoutString,
+ FreezeDimensions: this.props.childFreezeDimensions,
setupDragLines: this.setupDragLines,
dontRegisterView: this.props.dontRegisterView,
rootSelected: childData ? this.rootSelected : returnFalse,
@@ -1032,14 +1032,14 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P
const pt = this.getTransform().transformPoint(NumCast(doc.x), NumCast(doc.y));
doc.x = pt[0];
doc.y = pt[1];
- return this.props.addDocument(doc);
+ return this.props.addDocument?.(doc) || false;
} else {
(doc as any as Doc[]).forEach(doc => {
const pt = this.getTransform().transformPoint(NumCast(doc.x), NumCast(doc.y));
doc.x = pt[0];
doc.y = pt[1];
});
- return this.props.addDocument(doc);
+ return this.props.addDocument?.(doc) || false;
}
}
if (where === "inPlace" && this.layoutDoc.isInPlaceContainer) {
@@ -1172,8 +1172,8 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P
(this.props.viewDefDivClick || (engine === "pass" && !this.props.isSelected(true))) ? "none" : undefined}
jitterRotation={NumCast(this.props.Document._jitterRotation) || ((Doc.UserDoc().renderStyle === "comic" ? 10 : 0))}
//fitToBox={this.props.fitToBox || BoolCast(this.props.freezeChildDimensions)} // bcz: check this
- fitToBox={BoolCast(this.props.freezeChildDimensions)} // bcz: check this
- FreezeDimensions={BoolCast(this.props.freezeChildDimensions)}
+ fitToBox={BoolCast(this.props.childFreezeDimensions)} // bcz: check this
+ FreezeDimensions={BoolCast(this.props.childFreezeDimensions)}
/>,
bounds: this.childDataProvider(entry[1].pair.layout, entry[1].replica)
}));
diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
index a963b9158..39df606f7 100644
--- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
+++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx
@@ -8,7 +8,7 @@ import { RichTextField } from "../../../../fields/RichTextField";
import { SchemaHeaderField } from "../../../../fields/SchemaHeaderField";
import { Cast, FieldValue, NumCast, StrCast } from "../../../../fields/Types";
import { GetEffectiveAcl } from "../../../../fields/util";
-import { Utils, intersectRect } from "../../../../Utils";
+import { Utils, intersectRect, returnFalse } from "../../../../Utils";
import { CognitiveServices } from "../../../cognitive_services/CognitiveServices";
import { Docs, DocumentOptions, DocUtils } from "../../../documents/Documents";
import { DocumentType } from "../../../documents/DocumentTypes";
@@ -93,7 +93,7 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
e.stopPropagation();
} else
if (e.key === ":") {
- DocUtils.addDocumentCreatorMenuItems(this.props.addLiveTextDocument, this.props.addDocument, x, y);
+ DocUtils.addDocumentCreatorMenuItems(this.props.addLiveTextDocument, this.props.addDocument || returnFalse, x, y);
cm.displayMenu(this._downX, this._downY);
e.stopPropagation();
@@ -121,7 +121,7 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
ns.map(line => {
const indent = line.search(/\S|$/);
const newBox = Docs.Create.TextDocument(line, { _width: 200, _height: 35, x: x + indent / 3 * 10, y: ypos, title: line });
- this.props.addDocument(newBox);
+ this.props.addDocument?.(newBox);
ypos += 40 * this.Transform.Scale;
});
})();
@@ -143,11 +143,11 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
slide.x = x;
slide.y = y;
FormattedTextBox.SelectOnLoad = slide[Id];
- this.props.addDocument(slide);
+ this.props.addDocument?.(slide);
//setTimeout(() => SelectionManager.SelectDoc(DocumentManager.Instance.getDocumentView(slide)!, false));
e.stopPropagation();
} else if (!e.ctrlKey && !e.metaKey && SelectionManager.SelectedDocuments().length < 2) {
- FormattedTextBox.SelectOnLoadChar = FormattedTextBox.DefaultLayout && !this.props.ChildLayoutString ? e.key : "";
+ FormattedTextBox.SelectOnLoadChar = FormattedTextBox.DefaultLayout && !this.props.childLayoutString ? e.key : "";
FormattedTextBox.LiveTextUndo = UndoManager.StartBatch("live text batch");
this.props.addLiveTextDocument(CurrentUserUtils.GetNewTextDoc("-typed text-", x, y, 200, 100, this.props.xMargin === 0));
e.stopPropagation();
@@ -191,7 +191,7 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
}
const newCol = Docs.Create.SchemaDocument([...(groupAttr ? [new SchemaHeaderField("_group", "#f1efeb")] : []), ...columns.filter(c => c).map(c => new SchemaHeaderField(c, "#f1efeb"))], docList, { x: x, y: y, title: "droppedTable", _width: 300, _height: 100 });
- this.props.addDocument(newCol);
+ this.props.addDocument?.(newCol);
}
}
@@ -333,7 +333,7 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
delete = () => {
const selected = this.marqueeSelect(false);
SelectionManager.DeselectAll();
- selected.forEach(doc => this.props.removeDocument(doc));
+ selected.forEach(doc => this.props.removeDocument?.(doc));
this.cleanupInteractions(false);
MarqueeOptionsMenu.Instance.fadeOut(true);
@@ -363,9 +363,9 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
pileup = (e: KeyboardEvent | React.PointerEvent | undefined) => {
const selected = this.marqueeSelect(false);
SelectionManager.DeselectAll();
- selected.forEach(d => this.props.removeDocument(d));
+ selected.forEach(d => this.props.removeDocument?.(d));
const newCollection = DocUtils.pileup(selected, this.Bounds.left + this.Bounds.width / 2, this.Bounds.top + this.Bounds.height / 2);
- this.props.addDocument(newCollection!);
+ this.props.addDocument?.(newCollection!);
this.props.selectDocuments([newCollection!]);
MarqueeOptionsMenu.Instance.fadeOut(true);
this.hideMarquee();
@@ -424,10 +424,10 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
d.y = dy - this.Bounds.top - this.Bounds.height / 2;
return d;
}));
- this.props.removeDocument(selected);
+ this.props.removeDocument?.(selected);
}
const newCollection = this.getCollection(selected, (e as KeyboardEvent)?.key === "t" ? Docs.Create.StackingDocument : undefined, []);
- this.props.addDocument(newCollection);
+ this.props.addDocument?.(newCollection);
this.props.selectDocuments([newCollection]);
MarqueeOptionsMenu.Instance.fadeOut(true);
this.hideMarquee();
@@ -494,7 +494,7 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
// }
const lines = results.filter((r: any) => r.category === "line");
const text = lines.map((l: any) => l.recognizedText).join("\r\n");
- this.props.addDocument(Docs.Create.TextDocument(text, { _width: this.Bounds.width, _height: this.Bounds.height, x: this.Bounds.left + this.Bounds.width, y: this.Bounds.top, title: text }));
+ this.props.addDocument?.(Docs.Create.TextDocument(text, { _width: this.Bounds.width, _height: this.Bounds.height, x: this.Bounds.left + this.Bounds.width, y: this.Bounds.top, title: text }));
});
}
}
@@ -503,7 +503,7 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
@action
summary = (e: KeyboardEvent | React.PointerEvent | undefined) => {
const selected = this.marqueeSelect(false).map(d => {
- this.props.removeDocument(d);
+ this.props.removeDocument?.(d);
d.x = NumCast(d.x) - this.Bounds.left;
d.y = NumCast(d.y) - this.Bounds.top;
return d;
@@ -524,7 +524,7 @@ export class MarqueeView extends React.Component<SubCollectionViewProps & Marque
@action
background = (e: KeyboardEvent | React.PointerEvent | undefined) => {
const newCollection = this.getCollection([], undefined, ["background"]);
- this.props.addDocument(newCollection);
+ this.props.addDocument?.(newCollection);
MarqueeOptionsMenu.Instance.fadeOut(true);
this.hideMarquee();
setTimeout(() => this.props.selectDocuments([newCollection]));
diff --git a/src/client/views/collections/collectionMulticolumn/CollectionMulticolumnView.tsx b/src/client/views/collections/collectionMulticolumn/CollectionMulticolumnView.tsx
index 7ce269c92..586c5d1df 100644
--- a/src/client/views/collections/collectionMulticolumn/CollectionMulticolumnView.tsx
+++ b/src/client/views/collections/collectionMulticolumn/CollectionMulticolumnView.tsx
@@ -217,9 +217,9 @@ export class CollectionMulticolumnView extends CollectionSubView(MulticolumnDocu
Document={layout}
DataDoc={layout.resolvedDataDoc as Doc}
styleProvider={this.props.styleProvider}
- LayoutTemplate={this.props.ChildLayoutTemplate}
- LayoutTemplateString={this.props.ChildLayoutString}
- FreezeDimensions={this.props.freezeChildDimensions}
+ LayoutTemplate={this.props.childLayoutTemplate}
+ LayoutTemplateString={this.props.childLayoutString}
+ FreezeDimensions={this.props.childFreezeDimensions}
renderDepth={this.props.renderDepth + 1}
PanelWidth={width}
PanelHeight={height}
diff --git a/src/client/views/collections/collectionMulticolumn/CollectionMultirowView.tsx b/src/client/views/collections/collectionMulticolumn/CollectionMultirowView.tsx
index 7700ea128..87c56de6f 100644
--- a/src/client/views/collections/collectionMulticolumn/CollectionMultirowView.tsx
+++ b/src/client/views/collections/collectionMulticolumn/CollectionMultirowView.tsx
@@ -217,9 +217,9 @@ export class CollectionMultirowView extends CollectionSubView(MultirowDocument)
Document={layout}
DataDoc={layout.resolvedDataDoc as Doc}
styleProvider={this.props.styleProvider}
- LayoutTemplate={this.props.ChildLayoutTemplate}
- LayoutTemplateString={this.props.ChildLayoutString}
- FreezeDimensions={this.props.freezeChildDimensions}
+ LayoutTemplate={this.props.childLayoutTemplate}
+ LayoutTemplateString={this.props.childLayoutString}
+ FreezeDimensions={this.props.childFreezeDimensions}
renderDepth={this.props.renderDepth + 1}
PanelWidth={width}
PanelHeight={height}
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 5ed49185b..dc048843f 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -45,57 +45,60 @@ import React = require("react");
export type DocAfterFocusFunc = (notFocused: boolean) => boolean;
export type DocFocusFunc = (doc: Doc, willZoom?: boolean, scale?: number, afterFocus?: DocAfterFocusFunc, dontCenter?: boolean, focused?: boolean) => void;
-export interface DocumentViewProps {
+export interface DocumentViewSharedProps {
ContainingCollectionView: Opt<CollectionView>;
ContainingCollectionDoc: Opt<Doc>;
- docFilters: () => string[];
+ Document: Doc;
+ DataDoc?: Doc;
contentsActive?: (setActive: () => boolean) => void;
+ onClick?: () => ScriptField;
+ dropAction?: dropActionType;
+ backgroundHalo?: (doc: Doc) => boolean;
+ docFilters: () => string[];
docRangeFilters: () => string[];
searchFilterDocs: () => Doc[];
- FreezeDimensions?: boolean;
+ rootSelected: (outsideReaction?: boolean) => boolean; // whether the root of a template has been selected
+ renderDepth: number;
+ addDocTab: (doc: Doc, where: string) => boolean;
+ addDocument?: (doc: Doc | Doc[]) => boolean;
+ removeDocument?: (doc: Doc | Doc[]) => boolean;
+ moveDocument?: (doc: Doc | Doc[], targetCollection: Doc | undefined, addDocument: (document: Doc | Doc[]) => boolean) => boolean;
+ pinToPres: (document: Doc) => void;
+ layerProvider?: (doc: Doc, assign?: boolean) => boolean;
+ styleProvider?: (doc: Opt<Doc>, props: DocumentViewProps, property: string) => any;
+ ScreenToLocalTransform: () => Transform;
+ bringToFront: (doc: Doc, sendToBack?: boolean) => void;
+ parentActive: (outsideReaction: boolean) => boolean;
+ whenActiveChanged: (isActive: boolean) => void;
+ LayoutTemplateString?: string;
+ dontRegisterView?: boolean;
+ focus: DocFocusFunc;
+ ignoreAutoHeight?: boolean;
+ PanelWidth: () => number;
+ PanelHeight: () => number;
NativeWidth?: () => number;
NativeHeight?: () => number;
- Document: Doc;
- DataDoc?: Doc;
- layerProvider?: (doc: Doc, assign?: boolean) => boolean;
+ ContentScaling: () => number;
+ ChromeHeight?: () => number;
+ pointerEvents?: string;
+}
+export interface DocumentViewProps extends DocumentViewSharedProps {
+ // properties specific to DocumentViews but not to FieldView
+ FreezeDimensions?: boolean;
+ fitToBox?: boolean;
+ treeViewDoc?: Doc;
+ dragDivName?: string;
+ contentsPointerEvents?: string;
getView?: (view: DocumentView) => any;
- LayoutTemplateString?: string;
LayoutTemplate?: () => Opt<Doc>;
- fitToBox?: boolean;
- ignoreAutoHeight?: boolean;
contextMenuItems?: () => { script: ScriptField, label: string }[];
- rootSelected: (outsideReaction?: boolean) => boolean; // whether the root of a template has been selected
- onClick?: () => ScriptField;
onDoubleClick?: () => ScriptField;
onPointerDown?: () => ScriptField;
onPointerUp?: () => ScriptField;
- treeViewDoc?: Doc;
- dropAction?: dropActionType;
- dragDivName?: string;
nudge?: (x: number, y: number) => void;
- addDocument?: (doc: Doc | Doc[]) => boolean;
- removeDocument?: (doc: Doc | Doc[]) => boolean;
- moveDocument?: (doc: Doc | Doc[], targetCollection: Doc | undefined, addDocument: (document: Doc | Doc[]) => boolean) => boolean;
- ScreenToLocalTransform: () => Transform;
setupDragLines?: (snapToDraggedDoc: boolean) => void;
- renderDepth: number;
- ContentScaling: () => number;
- PanelWidth: () => number;
- PanelHeight: () => number;
- pointerEvents?: string;
- contentsPointerEvents?: string;
- focus: DocFocusFunc;
- parentActive: (outsideReaction: boolean) => boolean;
- whenActiveChanged: (isActive: boolean) => void;
- bringToFront: (doc: Doc, sendToBack?: boolean) => void;
- addDocTab: (doc: Doc, where: string) => boolean;
- pinToPres: (document: Doc) => void;
- backgroundHalo?: (doc: Doc) => boolean;
- styleProvider?: (doc: Opt<Doc>, props: DocumentViewProps, property: string) => any;
forceHideLinkButton?: () => boolean;
opacity?: () => number | undefined;
- ChromeHeight?: () => number;
- dontRegisterView?: boolean;
layoutKey?: string;
radialMenu?: String[];
display?: string;
diff --git a/src/client/views/nodes/FieldView.tsx b/src/client/views/nodes/FieldView.tsx
index 5cd752fdb..1d58893ae 100644
--- a/src/client/views/nodes/FieldView.tsx
+++ b/src/client/views/nodes/FieldView.tsx
@@ -2,70 +2,29 @@ import React = require("react");
import { computed } from "mobx";
import { observer } from "mobx-react";
import { DateField } from "../../../fields/DateField";
-import { Doc, FieldResult, Opt, Field } from "../../../fields/Doc";
+import { Doc, Field, FieldResult, Opt } from "../../../fields/Doc";
import { List } from "../../../fields/List";
-import { ScriptField } from "../../../fields/ScriptField";
-import { AudioField, VideoField, WebField } from "../../../fields/URLField";
-import { Transform } from "../../util/Transform";
-import { CollectionView } from "../collections/CollectionView";
-import { AudioBox } from "./AudioBox";
+import { VideoField, WebField } from "../../../fields/URLField";
+import { DocumentViewSharedProps } from "./DocumentView";
import { VideoBox } from "./VideoBox";
-import { dropActionType } from "../../util/DragManager";
-import { DocAfterFocusFunc, DocFocusFunc, DocumentViewProps } from "./DocumentView";
//
// these properties get assigned through the render() method of the DocumentView when it creates this node.
// However, that only happens because the properties are "defined" in the markup for the field view.
// See the LayoutString method on each field view : ImageBox, FormattedTextBox, etc.
//
-export interface FieldViewProps {
+export interface FieldViewProps extends DocumentViewSharedProps {
+ // FieldView specific props that are not part of DocumentView props
fieldKey: string;
fitToBox?: boolean;
- ContainingCollectionView: Opt<CollectionView>;
- ContainingCollectionDoc: Opt<Doc>;
- Document: Doc;
- DataDoc?: Doc;
- layerProvider?: (doc: Doc, assign?: boolean) => boolean;
- contentsActive?: (setActive: () => boolean) => void;
- onClick?: () => ScriptField;
- dropAction: dropActionType;
- backgroundHalo?: () => boolean;
- docFilters: () => string[];
- docRangeFilters: () => string[];
- searchFilterDocs: () => Doc[];
- isSelected: (outsideReaction?: boolean) => boolean;
- select: (isCtrlPressed: boolean) => void;
- rootSelected: (outsideReaction?: boolean) => boolean;
- renderDepth: number;
- addDocument?: (document: Doc | Doc[]) => boolean;
- addDocTab: (document: Doc, where: string) => boolean;
- pinToPres: (document: Doc) => void;
- removeDocument?: (document: Doc | Doc[]) => boolean;
- moveDocument?: (document: Doc | Doc[], targetCollection: Doc | undefined, addDocument: (document: Doc | Doc[]) => boolean) => boolean;
- styleProvider?: (document: Opt<Doc>, props: Opt<DocumentViewProps>, property: string) => any;
- ScreenToLocalTransform: () => Transform;
- bringToFront: (doc: Doc, sendToBack?: boolean) => void;
- parentActive: (outsideReaction: boolean) => boolean;
+ overflow?: boolean; // bcz: would like to think this can be avoided -- need to look at further
active: (outsideReaction?: boolean) => boolean;
- whenActiveChanged: (isActive: boolean) => void;
- LayoutTemplateString?: string;
- dontRegisterView?: boolean;
- focus: DocFocusFunc;
- presMultiSelect?: (doc: Doc) => void; //added for selecting multiple documents in a presentation
- ignoreAutoHeight?: boolean;
- PanelWidth: () => number;
- PanelHeight: () => number;
- PanelPosition?: string;
- overflow?: boolean;
- NativeHeight?: () => number;
- NativeWidth?: () => number;
- setVideoBox?: (player: VideoBox) => void;
- ContentScaling: () => number;
- ChromeHeight?: () => number;
- childLayoutTemplate?: () => Opt<Doc>;
+ select: (isCtrlPressed: boolean) => void;
+ isSelected: (outsideReaction?: boolean) => boolean;
+
// properties intended to be used from within layout strings (otherwise use the function equivalents that work more efficiently with React)
- fontSize?: number;
pointerEvents?: string;
+ fontSize?: number;
height?: number;
width?: number;
background?: string;
diff --git a/src/client/views/nodes/FilterBox.tsx b/src/client/views/nodes/FilterBox.tsx
index 0161f51fd..b90bf9eb1 100644
--- a/src/client/views/nodes/FilterBox.tsx
+++ b/src/client/views/nodes/FilterBox.tsx
@@ -9,7 +9,7 @@ import { RichTextField } from "../../../fields/RichTextField";
import { listSpec, makeInterface } from "../../../fields/Schema";
import { ComputedField, ScriptField } from "../../../fields/ScriptField";
import { Cast } from "../../../fields/Types";
-import { emptyFunction, emptyPath, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnOne, returnZero } from "../../../Utils";
+import { emptyFunction, emptyPath, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnOne, returnZero, returnTrue } from "../../../Utils";
import { Docs } from "../../documents/Documents";
import { DocumentType } from "../../documents/DocumentTypes";
import { CollectionDockingView } from "../collections/CollectionDockingView";
@@ -153,7 +153,6 @@ export class FilterBox extends ViewBoxBaseComponent<FieldViewProps, FilterBoxDoc
}
}
filterBackground = () => "rgba(105, 105, 105, 0.432)";
- get ignoreFields() { return ["_docFilters", "_docRangeFilters"]; } // this makes the tree view collection ignore these filters (otherwise, the filters would filter themselves)
@computed get scriptField() {
const scriptText = "setDocFilter(this?.target, heading, this.title, checked)";
const script = ScriptField.MakeScript(scriptText, { this: Doc.name, heading: "string", checked: "string", containingTreeView: Doc.name });
@@ -181,7 +180,6 @@ export class FilterBox extends ViewBoxBaseComponent<FieldViewProps, FilterBoxDoc
</div>
<div className="filterBox-tree" key="tree">
<CollectionTreeView
- PanelPosition={""}
Document={facetCollection}
DataDoc={Doc.GetProto(facetCollection)}
fieldKey={`${this.props.fieldKey}`}
@@ -202,7 +200,7 @@ export class FilterBox extends ViewBoxBaseComponent<FieldViewProps, FilterBoxDoc
isSelected={returnFalse}
select={returnFalse}
bringToFront={emptyFunction}
- active={this.props.active}
+ active={returnTrue}
parentActive={returnFalse}
whenActiveChanged={returnFalse}
treeViewHideTitle={true}
@@ -210,7 +208,7 @@ export class FilterBox extends ViewBoxBaseComponent<FieldViewProps, FilterBoxDoc
focus={returnFalse}
treeViewHideHeaderFields={true}
onCheckedClick={this.scriptField}
- ignoreFields={this.ignoreFields}
+ ignoreFilters={true} // otherwise, the filters would filter themselves out of the tree view
annotationsKey={""}
dontRegisterView={true}
styleProvider={this.filterBackground}
diff --git a/src/client/views/nodes/LinkBox.tsx b/src/client/views/nodes/LinkBox.tsx
index bf19457da..50ad884ca 100644
--- a/src/client/views/nodes/LinkBox.tsx
+++ b/src/client/views/nodes/LinkBox.tsx
@@ -21,8 +21,8 @@ export class LinkBox extends ViewBoxBaseComponent<FieldViewProps, LinkDocument>(
<CollectionTreeView {...this.props}
ChromeHeight={returnZero}
- overrideDocuments={[this.dataDoc]}
- ignoreFields={Cast(this.props.Document.linkBoxExcludedKeys, listSpec("string"), null)}
+ childDocuments={[this.dataDoc]}
+ treeViewSkipFields={Cast(this.props.Document.linkBoxExcludedKeys, listSpec("string"), null)}
annotationsKey={""}
dontRegisterView={true}
renderDepth={this.props.renderDepth + 1}
diff --git a/src/client/views/nodes/PresBox.tsx b/src/client/views/nodes/PresBox.tsx
index 5985225e3..c2385cab8 100644
--- a/src/client/views/nodes/PresBox.tsx
+++ b/src/client/views/nodes/PresBox.tsx
@@ -2412,6 +2412,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
<div className="presBox-listCont">
{mode !== CollectionViewType.Invalid ?
<CollectionView {...this.props}
+ annotationsKey={""}
ContainingCollectionDoc={this.props.Document}
PanelWidth={this.props.PanelWidth}
PanelHeight={this.panelHeight}
@@ -2423,7 +2424,8 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps, PresBoxSchema>
removeDocument={returnFalse}
dontRegisterView={true}
focus={this.selectElement}
- ScreenToLocalTransform={this.getTransform} />
+ ScreenToLocalTransform={this.getTransform}
+ />
: (null)
}
</div>
diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx
index 998ca839d..f64d80731 100644
--- a/src/client/views/nodes/VideoBox.tsx
+++ b/src/client/views/nodes/VideoBox.tsx
@@ -183,7 +183,6 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps, VideoD
}
componentDidMount() {
- if (this.props.setVideoBox) this.props.setVideoBox(this);
this._disposers.videoStart = reaction(
() => this.Document._videoStart,
(videoStart) => {