diff options
author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-12-03 19:44:25 -0500 |
---|---|---|
committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-12-03 19:44:25 -0500 |
commit | af94458be6620ae8a05730f17ee3fc4ec403cf09 (patch) | |
tree | 43ef3dabb13c4fe693a1e70799744f747c84eba3 /src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx | |
parent | d2eef0d1341c475a8cb753efeb31b270714e76ec (diff) |
bunch of changes related to rendering changes to template docs; trying to make it so docs don't need to rerender every time, and so that all attributes are accounted for.
Diffstat (limited to 'src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx')
-rw-r--r-- | src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx index 31402eeeb..4680b0316 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/Template.tsx @@ -1,4 +1,5 @@ +import { makeAutoObservable } from "mobx"; import { Doc, FieldType } from "../../../../../fields/Doc"; import { Docs } from "../../../../documents/Documents"; import { Col } from "./DocCreatorMenu"; @@ -6,22 +7,33 @@ import { DynamicField } from "./FieldTypes/DynamicField"; import { Field, FieldSettings, ViewType } from "./FieldTypes/Field"; import { } from "./FieldTypes/FieldUtils"; import { } from "./FieldTypes/StaticField"; +import { observer } from "mobx-react"; export class Template { mainField: DynamicField; settings: FieldSettings; + constructor(templateInfo: FieldSettings) { + makeAutoObservable(this); this.mainField = this.setupMainField(templateInfo); this.settings = templateInfo; + } + + get childFields(): Field[] { return this.mainField.getSubfields }; get allFields(): Field[] { return this.mainField.getAllSubfields }; get contentFields(): Field[] { return this.allFields.filter(field => field.getViewType === ViewType.STATIC) }; get doc(){ return this.mainField.renderedDoc(); }; + // addField = (type: FieldType, doc?: Doc): Field => { + + // this.mainField.addField(); + // } + cloneBase = () => { const clone: Template = new Template(this.settings); clone.allFields.forEach(field => { |