diff options
author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-07-31 12:46:55 -0400 |
---|---|---|
committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-07-31 12:46:55 -0400 |
commit | 99b879956b67dc246f1ba48759a5550a94a5813d (patch) | |
tree | ecbb3f28c0da20f2a36eebeaad7bf6fcbb52d2e4 /src | |
parent | 951d6a8681e9be9068c8a0f8fce659938ab9ed80 (diff) |
with old code for basic templates
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/DataVizBox/DataVizBox.tsx | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.tsx b/src/client/views/nodes/DataVizBox/DataVizBox.tsx index f25602fd5..43cfe5bba 100644 --- a/src/client/views/nodes/DataVizBox/DataVizBox.tsx +++ b/src/client/views/nodes/DataVizBox/DataVizBox.tsx @@ -12,7 +12,7 @@ import { InkTool } from '../../../../fields/InkField'; import { List } from '../../../../fields/List'; import { Cast, CsvCast, DocCast, NumCast, StrCast } from '../../../../fields/Types'; import { CsvField } from '../../../../fields/URLField'; -import { GetEffectiveAcl, TraceMobx } from '../../../../fields/util'; +import { GetEffectiveAcl, TraceMobx, inheritParentAcls } from '../../../../fields/util'; import { DocUtils } from '../../../documents/DocUtils'; import { DocumentType } from '../../../documents/DocumentTypes'; import { Docs } from '../../../documents/Documents'; @@ -569,32 +569,30 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { createBasicTemplates = (colsToLayout: {width: number, height: number, x: number, y: number, title: string}[]) => { const mainCollection = this.DocumentView?.().containerViewPath?.().lastElement()?.ComponentView as CollectionFreeFormView; - const docTools: Doc[] = DocListCast(DocListCast(Doc.MyTools?.data)[0]?.data); - console.log(docTools.map(doc => doc.title)) - const index = docTools.map(doc => doc.title).indexOf('Col'); - const template: Doc | undefined = DocUtils.copyDragFactory(Cast(docTools[index]?.dragFactory, Doc, null)); - if (!template) return; + // const docTools: Doc[] = DocListCast(DocListCast(Doc.MyTools?.data)[0]?.data); + // const index = docTools.map(doc => doc.title).indexOf('Col'); + // const template: Doc | undefined = DocUtils.copyDragFactory(Cast(docTools[index]?.dragFactory, Doc, null)); + //if (!template) return; //const template = new CollectionFreeFormView({}); const fields: Doc[] = colsToLayout.map(layout => { - const field = new Doc(); - field.x = layout.x; - field.y = layout.y; - field._width = layout.width; - field._height = layout.height; - field.title = layout.title; - template.data = 'hey'//DocListCast(template.data).map(doc => `idToDoc("${doc[Id]}")`).push(`idToDoc("${field[Id]}")`); + const field = Docs.Create.TextDocument('', { _height: layout.height, _width: layout.width, title: layout.title, x: layout.x, y: layout.y }); + // Doc.SetContainer(field, template); + // inheritParentAcls(template, field, true); + //template.data = 'hey'//DocListCast(template.data).map(doc => `idToDoc("${doc[Id]}")`).push(`idToDoc("${field[Id]}")`); return field; }); + const template = Docs.Create.FreeformDocument(fields, { _height: 500, _width: 500, title: 'template', x: 400, y: 400 }) + const fieldLiterals: string[] = fields.map(field => `idToDoc("${field[Id]}")`); - template.data = fieldLiterals[0]; + //template.data = fieldLiterals[0]; - template.x = 400; - template.y = 400; - template._width = 500; - template._height = 500; + // template.x = 400; + // template.y = 400; + // template._width = 500; + // template._height = 500; mainCollection.addDocument(template); } |