aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocComponent.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/DocComponent.tsx')
-rw-r--r--src/client/views/DocComponent.tsx44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx
index 3a868d1f9..e3d47317c 100644
--- a/src/client/views/DocComponent.tsx
+++ b/src/client/views/DocComponent.tsx
@@ -36,7 +36,7 @@ export function DocComponent<P extends DocComponentProps>() {
* NOTE: it is very unlikely that you really want to use this method. Instead
* consider: Document, layoutDoc, dataDoc
*/
- get _renderDoc() {
+ get Document() {
return this._props.Document;
}
@@ -46,8 +46,8 @@ export function DocComponent<P extends DocComponentProps>() {
* necessarily the Doc being rendered in the current React component.
* This Doc inherits from the dataDoc, and may or may not inherit (or be) the layoutDoc.
*/
- get Document() {
- return DocCast(this._renderDoc.rootDocument, this._renderDoc);
+ get rootDoc() {
+ return DocCast(this.Document.rootDocument, this.Document);
}
/**
* This is the document being rendered by the React component. In the
@@ -56,14 +56,14 @@ export function DocComponent<P extends DocComponentProps>() {
* This may or may not inherit from the data doc.
*/
@computed get layoutDoc() {
- return this._props.LayoutTemplateString ? this._renderDoc : Doc.Layout(this._renderDoc, this._props.LayoutTemplate?.());
+ return this._props.LayoutTemplateString ? this.Document : Doc.Layout(this.Document, this._props.LayoutTemplate?.());
}
/**
* This is the unique data repository for a document that stores the intrinsic document data.
*/
@computed get dataDoc() {
- return this._renderDoc[DocData];
+ return this.Document[DocData];
}
}
return Component;
@@ -92,10 +92,8 @@ export function ViewBoxBaseComponent<P extends FieldViewProps>() {
* This is the doc that is being rendered. It will be either:
* 1) the same as Document if the root of a regular or compound Doc is rendered
* 2) the same as the layoutDoc if a component of a compound Doc is rendered.
- * NOTE: it is very unlikely that you really want to use this method. Instead
- * consider: Document, layoutDoc, dataDoc
*/
- get _renderDoc() {
+ get Document() {
return this._props.Document;
}
@@ -104,9 +102,12 @@ export function ViewBoxBaseComponent<P extends FieldViewProps>() {
* this is the outermost Doc that represents the entire compound Doc. It is not
* necessarily the Doc being rendered in the current React component.
* This Doc inherits from the dataDoc, and may or may not inherit (or be) the layoutDoc.
+ *
+ * NOTE: it is very unlikely that you really want to use this method. Instead
+ * consider: Document, layoutDoc, dataDoc
*/
- get Document() {
- return DocCast(this._renderDoc.rootDocument, this._renderDoc);
+ get rootDoc() {
+ return DocCast(this.Document.rootDocument, this.Document);
}
/**
* This is the document being rendered by the React component. In the
@@ -115,14 +116,14 @@ export function ViewBoxBaseComponent<P extends FieldViewProps>() {
* This may or may not inherit from the data doc.
*/
@computed get layoutDoc() {
- return Doc.Layout(this._renderDoc);
+ return Doc.Layout(this.Document);
}
/**
* This is the unique data repository for a dcoument that stores the intrinsic document data
*/
@computed get dataDoc() {
- return this._renderDoc.isTemplateForField || this._renderDoc.isTemplateDoc ? (this._props.TemplateDataDocument ?? this._renderDoc[DocData]) : this._renderDoc[DocData];
+ return this.Document.isTemplateForField || this.Document.isTemplateDoc ? (this._props.TemplateDataDocument ?? this.Document[DocData]) : this.Document[DocData];
}
/**
@@ -165,10 +166,8 @@ export function ViewBoxAnnotatableComponent<P extends FieldViewProps>() {
* This is the doc that is being rendered. It will be either:
* 1) the same as Document if the root of a regular or compound Doc is rendered
* 2) the same as the layoutDoc if a component of a compound Doc is rendered.
- * NOTE: it would unlikely that you really want to use this instead of the
- * other Doc options (Document, layoutDoc, dataDoc)
*/
- get _renderDoc() {
+ get Document() {
return this._props.Document;
}
@@ -177,24 +176,27 @@ export function ViewBoxAnnotatableComponent<P extends FieldViewProps>() {
* this is the outermost Doc that represents the entire compound Doc. It is not
* necessarily the Doc being rendered in the current React component.
* This Doc inherits from the dataDoc, and may or may not inherit (or be) the layoutDoc.
+ *
+ * NOTE: it would unlikely that you really want to use this instead of the
+ * other Doc options (Document, layoutDoc, dataDoc)
*/
- @computed get Document() {
- return DocCast(this._renderDoc.rootDocument, this._renderDoc);
+ @computed get rootDoc() {
+ return DocCast(this.Document.rootDocument, this.Document);
}
/**
* 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._renderDoc);
+ return Doc.Layout(this.Document);
}
/**
* This is the unique data repository for a dcoument that stores the intrinsic document data
*/
@computed get dataDoc() {
- return this._renderDoc.isTemplateForField || this._renderDoc.isTemplateDoc ?
- (this._props.TemplateDataDocument ?? this._renderDoc[DocData]) :
- this._props.Document[DocData]; // prettier-ignore
+ return this.Document.isTemplateForField || this.Document.isTemplateDoc ?
+ (this._props.TemplateDataDocument ?? this.Document[DocData]) :
+ this.Document[DocData]; // prettier-ignore
}
/**