From f7e28d954902bf9e7e8567ce06b6eb03b6cd92ef Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Sun, 2 Mar 2025 03:19:21 -0500 Subject: Slight refactors (with so much wasted time trying for larger ones) --- src/client/documents/Documents.ts | 1 + .../DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx | 32 ++++-- .../DocCreatorMenu/FieldTypes/DecorationField.tsx | 19 ++-- .../DocCreatorMenu/FieldTypes/DynamicField.tsx | 99 +++++++++++------- .../DataVizBox/DocCreatorMenu/FieldTypes/Field.tsx | 114 ++++++++------------- .../DocCreatorMenu/FieldTypes/FieldUtils.tsx | 53 +--------- .../FieldTypes/StaticContentField.tsx | 59 +++++------ .../nodes/DataVizBox/DocCreatorMenu/Template.tsx | 4 +- .../DataVizBox/DocCreatorMenu/TemplateBackend.tsx | 8 +- 9 files changed, 173 insertions(+), 216 deletions(-) (limited to 'src') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 0a7047128..b35845de9 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -285,6 +285,7 @@ export class DocumentOptions { _layout_showSidebar?: BOOLt = new BoolInfo('whether an annotationsidebar should be displayed for text docuemnts'); _layout_showCaption?: string; // which field to display in the caption area. leave empty to have no caption _layout_showTags?: BOOLt = new BoolInfo('whether to show the list of document tags at the bottom of a DocView'); + _layout_hideScroll?: BOOLt = new BoolInfo('whether to hide scroll bars on the document'); _chromeHidden?: BOOLt = new BoolInfo('whether the editing chrome for a document is hidden'); hideClickBehaviors?: BOOLt = new BoolInfo('whether to hide click behaviors in context menu'); diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx index faa6cffa8..cc161e688 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu/DocCreatorMenu.tsx @@ -47,6 +47,8 @@ export enum LayoutType { export class DocCreatorMenu extends ObservableReactComponent { static Instance: DocCreatorMenu; + private DEBUG_MODE: boolean = false; + private _disposers: { [name: string]: IDisposer } = {}; private _ref: HTMLDivElement | null = null; @@ -122,8 +124,11 @@ export class DocCreatorMenu extends ObservableReactComponent { }; @computed get docsToRender() { - return [1, 2, 3, 4]; - //this._selectedTemplate ? NumListCast(this._dataViz?.layoutDoc.dataViz_selectedRows) : []; !!! put this back for GPT rendering + if (this.DEBUG_MODE) { + return [1, 2, 3, 4]; + } else { + return this._selectedTemplate ? NumListCast(this._dataViz?.layoutDoc.dataViz_selectedRows) : []; + } } @computed get rowsCount() { @@ -607,20 +612,27 @@ export class DocCreatorMenu extends ObservableReactComponent { }; generatePresetTemplates = async () => { - this._dataViz?.updateColDefaults(); - const cols = this.fieldsInfos; - const templates = this.templateManager.getValidTemplates(cols); + const templates: Template[] = []; - console.log(templates) + if (this.DEBUG_MODE) { + templates.push(...this.templateManager.templates) + } else { + this._dataViz?.updateColDefaults(); - const assignments: [Template, { [field: number]: Col }][] = await this.assignColsToFields(templates, cols); + const cols = this.fieldsInfos; + templates.push(...this.templateManager.getValidTemplates(cols)); - const renderedTemplatePromises: Promise