aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/DocComponent.tsx61
1 files changed, 50 insertions, 11 deletions
diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx
index a25a8f77a..18e7ab12a 100644
--- a/src/client/views/DocComponent.tsx
+++ b/src/client/views/DocComponent.tsx
@@ -75,15 +75,25 @@ export function DocComponent<P extends DocComponentProps>() {
makeObservable(this);
}
- //TODO This might be pretty inefficient if doc isn't observed, because computed doesn't cache then
+ /**
+ * This is the document being rendered. In the case of a compound template, it
+ * may not be the actual document rendered and it also may not be the 'real' root document.
+ * Rather, it specifies the shared properties of all layouts of the document (eg, x,y,)
+ */
get Document() {
return this._props.Document;
}
- // This is the rendering data of a document -- it may be "The Document", or it may be some template document that holds the rendering info
+
+ /**
+ * This is the document being rendered. It may be a template so it may or may no inherit from the data doc.
+ */
@computed get layoutDoc() {
return this._props.LayoutTemplateString ? this.Document : Doc.Layout(this.Document, this._props.LayoutTemplate?.());
}
- // This is the data part of a document -- ie, the data that is constant across all views of the document
+
+ /**
+ * This is the unique data repository for a dcoument that stores the intrinsic document data
+ */
@computed get dataDoc() {
return this.Document[DocData];
}
@@ -109,19 +119,32 @@ export function ViewBoxBaseComponent<P extends FieldViewProps>() {
get DocumentView() {
return this._props.DocumentView;
}
- //TODO This might be pretty inefficient if doc isn't observed, because computed doesn't cache then
+
+ /**
+ * This is the document being rendered. In the case of a compound template, it
+ * may not be the actual document rendered and it also may not be the 'real' root document.
+ * Rather, it specifies the shared properties of all layouts of the document (eg, x,y,)
+ */
get Document() {
return this._props.Document;
}
- // This is the rendering data of a document -- it may be "The Document", or it may be some template document that holds the rendering info
+ /**
+ * This is the document being rendered. It may be a template so it may or may no inherit from the data doc.
+ */
@computed get layoutDoc() {
return Doc.Layout(this.Document);
}
- // This is the data part of a document -- ie, the data that is constant across all views of the document
+
+ /**
+ * This is the unique data repository for a dcoument that stores the intrinsic document data
+ */
@computed get dataDoc() {
return this.Document.isTemplateForField || this.Document.isTemplateDoc ? this._props.TemplateDataDocument ?? this.Document[DocData] : this.Document[DocData];
}
- // key where data is stored
+
+ /**
+ * this is the field key where the primary rendering data is stored for the layout doc (e.g., it's often the 'data' field for a collection, or the 'text' field for rich text)
+ */
get fieldKey() {
return this._props.fieldKey;
}
@@ -154,23 +177,39 @@ export function ViewBoxAnnotatableComponent<P extends FieldViewProps>() {
get DocumentView() {
return this._props.DocumentView;
}
- //TODO This might be pretty inefficient if doc isn't observed, because computed doesn't cache then
+
+ /**
+ * This is the document being rendered. In the case of a compound template, it
+ * may not be the actual document rendered and it also may not be the 'real' root document.
+ * Rather, it specifies the shared properties of all layouts of the document (eg, x,y,)
+ */
@computed get Document() {
return this._props.Document;
}
- // This is the rendering data of a document -- it may be "The Document", or it may be some template document that holds the rendering info
+ /**
+ * This is the document being rendered. It may be a template so it may or may no inherit from the data doc.
+ */
@computed get layoutDoc() {
return Doc.Layout(this.Document);
}
- // This is the data part of a document -- ie, the data that is constant across all views of the document
+
+ /**
+ * This is the unique data repository for a dcoument that stores the intrinsic document data
+ */
@computed get dataDoc() {
return this.Document.isTemplateForField || this.Document.isTemplateDoc ? this._props.TemplateDataDocument ?? this.Document[DocData] : this.Document[DocData];
}
- // key where data is stored
+ /**
+ * this is the field key where the primary rendering data is stored for the layout doc (e.g., it's often the 'data' field for a collection, or the 'text' field for rich text)
+ */
@computed get fieldKey() {
return this._props.fieldKey;
}
+
+ /**
+ * this is field key where the list of annotations is stored
+ */
@computed public get annotationKey() {
return this.fieldKey + (this._annotationKeySuffix() ? '_' + this._annotationKeySuffix() : '');
}