aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/Doc.ts
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-06-28 03:00:30 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-06-28 03:00:30 -0400
commitdc4b658639beb21e73fc2411abd147ff6716ba3d (patch)
tree90cb2951006a3a4ceb613dcaa4ec3c8851d4869a /src/new_fields/Doc.ts
parent2ca24a234817495c3330b93b504b13c0c6db91f3 (diff)
added expansion of templates on demand
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r--src/new_fields/Doc.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts
index b0184dd4e..d552ddd2d 100644
--- a/src/new_fields/Doc.ts
+++ b/src/new_fields/Doc.ts
@@ -280,6 +280,19 @@ export namespace Doc {
return new Doc;
}
+ export function expandTemplateLayout(templateLayoutDoc: Doc, dataDoc: Doc) {
+ let expandedTemplateLayout = templateLayoutDoc["_expanded_" + dataDoc[Id]];
+ if (expandedTemplateLayout instanceof Doc) {
+ return expandedTemplateLayout;
+ }
+ if (expandedTemplateLayout === undefined)
+ setTimeout(() => {
+ templateLayoutDoc["_expanded_" + dataDoc[Id]] = Doc.MakeDelegate(templateLayoutDoc);
+ (templateLayoutDoc["_expanded_" + dataDoc[Id]] as Doc).title = templateLayoutDoc.title + " applied to " + dataDoc.title;
+ }, 0);
+ return templateLayoutDoc;
+ }
+
export function MakeCopy(doc: Doc, copyProto: boolean = false): Doc {
const copy = new Doc;
Object.keys(doc).forEach(key => {