From ef356b701f01be15840415f46ed3515ffb625e91 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 24 Dec 2020 15:58:49 +0100 Subject: [PATCH] matrix --- .../Schemas/Docs-Concepts/vaina.json | 4 +- .../UI/Spaces/Docs-Space/DocsSpace.js | 38 +++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/Projects/Superalgos/Schemas/Docs-Concepts/vaina.json b/Projects/Superalgos/Schemas/Docs-Concepts/vaina.json index ab1bbf182..3702dd057 100644 --- a/Projects/Superalgos/Schemas/Docs-Concepts/vaina.json +++ b/Projects/Superalgos/Schemas/Docs-Concepts/vaina.json @@ -11,8 +11,8 @@ "text": "Block #1" }, { - "style": "Text", - "text": "Vaina Paragraph 1" + "style": "Hierarchy", + "text": "Superalgos->Task->5" }, { "style": "Note", diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js index 8c5eca9a2..86f541e56 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/DocsSpace.js @@ -2960,6 +2960,44 @@ function newSuperalgosDocSpace() { appSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.appSchema.get(type) if (appSchemaDocument === undefined) { return } + if (isNaN(levels) === true) { return } + + const MAX_COLUMNS = 10 + const MAX_ROWS = 100 + + let contentMatrix = [] + + for (let i = 0; i < MAX_ROWS; i++) { + contentMatrix.push(['', '', '', '', '', '', '', '', '', '']) + } + + let currentColumn = 0 + let currentRow = -1 + + scanHierarchy(appSchemaDocument, project, currentColumn) + + function scanHierarchy(schemaDocument, project, currentColumn) { + + if (schemaDocument === undefined) { return } + if (schemaDocument.childrenNodesProperties === undefined) { return } + + currentRow++ + let matrixValue = schemaDocument.type + let matrixRow = contentMatrix[currentRow] + matrixRow[currentColumn] = matrixValue + + for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) { + let property = schemaDocument.childrenNodesProperties[i] + let childProject = project + if (property.project !== undefined) { + childProject = property.project + } + let childType = property.childType + let childSchemaDocument = SCHEMAS_BY_PROJECT.get(project).map.appSchema.get(childType) + scanHierarchy(childSchemaDocument, childProject, currentColumn + 1) + } + } + let HTML = ''