From a82ae1499878aeae9291c2c3a7c7bf23f5803600 Mon Sep 17 00:00:00 2001 From: Mike Ammerlaan Date: Wed, 4 Dec 2024 06:03:39 -0800 Subject: [PATCH] fix(val): Validation and client entity editor fixes - Allow features in add-on validation - More interlinking work - Parse IDs of types and recipes in add-ons - Render Controller and Client Entity Editor work - Update to 1.21.50 files --- .../render_controller_set_geometry.form.json | 1 + .../render_controller_set_materials.form.json | 1 + .../render_controller_set_textures.form.json | 1 + app/reslist/packs-preview.resources.json | 2 +- app/reslist/packs.resources.json | 2 +- app/src/UX/EntityTypeResourceEditor.tsx | 54 +- app/src/UX/RenderControllerSetEditor.tsx | 43 +- app/src/app/Carto.ts | 8 +- app/src/app/IProjectItemData.ts | 4 +- app/src/app/Project.ts | 12 +- app/src/app/ProjectItem.ts | 4 +- app/src/app/ProjectItemRelations.ts | 27 +- app/src/app/ProjectItemUtilities.ts | 26 +- app/src/app/ProjectUtilities.ts | 13 +- app/src/cli/ClUtils.ts | 7 +- app/src/core/ContentIndex.ts | 14 +- app/src/dataform/DataForm.tsx | 240 +- app/src/dataform/StringArray.tsx | 12 +- .../info/AddOnItemRequirementsGenerator.ts | 47 +- app/src/info/AddOnRequirementsGenerator.ts | 30 +- app/src/info/ItemCountsInfoGenerator.ts | 2 +- app/src/info/JsonFileTagsInfoGenerator.ts | 228 +- app/src/info/ProjectInfoSet.ts | 2 +- app/src/info/StrictPlatformInfoGenerator.ts | 2 +- app/src/info/TextureInfoGenerator.ts | 6 +- app/src/local/LocalUtilities.ts | 14 + .../manager/BehaviorPackItemTypeManager.ts | 2 +- app/src/manager/FormatVersionManager.ts | 4 +- .../minecraft/AnimationBehaviorDefinition.ts | 3 +- .../AnimationControllerBehaviorDefinition.ts | 3 +- .../AnimationControllerResourceDefinition.ts | 3 +- .../minecraft/AnimationResourceDefinition.ts | 3 +- .../minecraft/AttachableResourceDefinition.ts | 2 +- .../minecraft/BehaviorManifestDefinition.ts | 15 +- .../minecraft/BlockTypeBehaviorDefinition.ts | 3 +- app/src/minecraft/Database.ts | 29 +- app/src/minecraft/EntityTypeDefinition.ts | 3 +- .../minecraft/EntityTypeResourceDefinition.ts | 2 +- .../FlipbookTextureCatalogDefinition.ts | 143 +- app/src/minecraft/IDefinition.ts | 3 + app/src/minecraft/IParticleEffect.ts | 6 +- app/src/minecraft/IRecipeBehavior.ts | 41 + app/src/minecraft/IRenderControllerSet.ts | 6 +- .../minecraft/ItemTypeBehaviorDefinition.ts | 3 +- app/src/minecraft/MinecraftDefinitions.ts | 7 +- .../MusicDefinitionCatalogDefinition.ts | 5 +- .../ParticleEffectResourceDefinition.ts | 151 +- app/src/minecraft/RecipeBehaviorDefinition.ts | 46 +- .../RenderControllerSetDefinition.ts | 19 +- .../minecraft/ResourceManifestDefinition.ts | 12 +- app/src/minecraft/SoundCatalogDefinition.ts | 5 +- .../SoundDefinitionCatalogDefinition.ts | 4 +- .../TerrainTextureCatalogDefinition.ts | 5 +- .../behavior_packs/cn_test/manifest.json | 12 +- .../resource_packs/cn_test/manifest.json | 8 +- .../serveCommandValidate/report.json | 5815 ++++++++--------- app/test/scenarios/simple/report.json | 20 +- .../content3.csv | 4 - .../content3.mcr.json | 39 +- .../content3.report.html | 2 +- .../content3.csv | 6 +- .../content3.mcr.json | 6 +- .../content3.report.html | 2 +- .../validateLinkErrors/content_linkerrors.csv | 15 +- .../content_linkerrors.mcr.json | 73 +- .../content_linkerrors.report.html | 2 +- 66 files changed, 3861 insertions(+), 3473 deletions(-) create mode 100644 app/src/minecraft/IDefinition.ts diff --git a/app/public/data/forms/render_controller_set_geometry.form.json b/app/public/data/forms/render_controller_set_geometry.form.json index c2a88839..677aa678 100644 --- a/app/public/data/forms/render_controller_set_geometry.form.json +++ b/app/public/data/forms/render_controller_set_geometry.form.json @@ -23,6 +23,7 @@ { "id": "geometries", "title": "Geometries", + "undefinedIfEmpty": true, "description": "Lists of geometries that can be used in selection calculations", "dataType": 28 } diff --git a/app/public/data/forms/render_controller_set_materials.form.json b/app/public/data/forms/render_controller_set_materials.form.json index 1657cbf2..0a0d28da 100644 --- a/app/public/data/forms/render_controller_set_materials.form.json +++ b/app/public/data/forms/render_controller_set_materials.form.json @@ -23,6 +23,7 @@ { "id": "materials", "title": "Materials", + "undefinedIfEmpty": true, "description": "Lists of materials that can be used in selection calculations", "dataType": 28 } diff --git a/app/public/data/forms/render_controller_set_textures.form.json b/app/public/data/forms/render_controller_set_textures.form.json index 5f8dac44..cc977666 100644 --- a/app/public/data/forms/render_controller_set_textures.form.json +++ b/app/public/data/forms/render_controller_set_textures.form.json @@ -24,6 +24,7 @@ { "id": "textures", "title": "Textures", + "undefinedIfEmpty": true, "description": "Lists of textures that can be used in selection calculations", "dataType": 28 } diff --git a/app/reslist/packs-preview.resources.json b/app/reslist/packs-preview.resources.json index eb15a124..48fde650 100644 --- a/app/reslist/packs-preview.resources.json +++ b/app/reslist/packs-preview.resources.json @@ -1,5 +1,5 @@ { - "url": "https://github.com/Mojang/bedrock-samples/archive/acc158ace8d048413c6be79c26584914643c9a12.zip", + "url": "https://github.com/Mojang/bedrock-samples/archive/706bce4c7df169f79f36e0302e1fe9f930e4af3e.zip", "ignoreFirstFolder": true, "exclude": [ "documentation/", diff --git a/app/reslist/packs.resources.json b/app/reslist/packs.resources.json index 9ea30f26..9e9caa5b 100644 --- a/app/reslist/packs.resources.json +++ b/app/reslist/packs.resources.json @@ -1,5 +1,5 @@ { - "url": "https://github.com/Mojang/bedrock-samples/archive/6e0daa70a8c94130fd04f65295e672f99d7adc6d.zip", + "url": "https://github.com/Mojang/bedrock-samples/archive/5ce65764d3426f2a1f600f4156412f829c178b55.zip", "ignoreFirstFolder": true, "exclude": [ "documentation/", diff --git a/app/src/UX/EntityTypeResourceEditor.tsx b/app/src/UX/EntityTypeResourceEditor.tsx index 984f474d..669362ce 100644 --- a/app/src/UX/EntityTypeResourceEditor.tsx +++ b/app/src/UX/EntityTypeResourceEditor.tsx @@ -81,8 +81,6 @@ export default class EntityTypeResourceEditor extends Component< }; this._childPersistables = []; - - this._updateManager(true); } static getDerivedStateFromProps(props: IEntityTypeResourceEditorProps, state: IEntityTypeResourceEditorState) { @@ -110,10 +108,11 @@ export default class EntityTypeResourceEditor extends Component< componentDidMount(): void { this._childPersistables = []; - this._updateManager(true); + + this._updateManager(); } - async _updateManager(setState: boolean) { + async _updateManager() { if (this.state !== undefined && this.state.fileToEdit !== undefined) { if (this.state.fileToEdit !== this._lastFileEdited) { this._lastFileEdited = this.state.fileToEdit; @@ -133,15 +132,15 @@ export default class EntityTypeResourceEditor extends Component< (this.state.fileToEdit.manager as EntityTypeResourceDefinition).isLoaded && !this.state.isLoaded ) { - this._doUpdate(setState); + this._doUpdate(); } } _definitionLoaded(defA: EntityTypeResourceDefinition, defB: EntityTypeResourceDefinition) { - this._doUpdate(true); + this._doUpdate(); } - async _doUpdate(setState: boolean) { + async _doUpdate() { let selItem = this.state.entityTypeResource; if (selItem === undefined && this.state && this.state.fileToEdit && this.state.fileToEdit.manager) { @@ -182,25 +181,14 @@ export default class EntityTypeResourceEditor extends Component< } } - if (setState) { - this.setState({ - fileToEdit: this.state.fileToEdit, - isLoaded: true, - mode: this.state.mode, - sound: soundEvent, - entityTypeResource: etrd, - renderControllerSets: renderControllerSets, - }); - } else { - this.state = { - fileToEdit: this.props.file, - isLoaded: true, - mode: this.state.mode, - sound: soundEvent, - entityTypeResource: etrd, - renderControllerSets: renderControllerSets, - }; - } + this.setState({ + fileToEdit: this.state.fileToEdit, + isLoaded: true, + mode: this.state.mode, + sound: soundEvent, + entityTypeResource: etrd, + renderControllerSets: renderControllerSets, + }); } async persist() { @@ -275,12 +263,6 @@ export default class EntityTypeResourceEditor extends Component< this.state.fileToEdit.manager === undefined || Database.uxCatalog === null ) { - if (this.state.fileToEdit !== null) { - if (this.state.fileToEdit.manager === undefined) { - this._updateManager(true); - } - } - return
Loading...
; } @@ -395,6 +377,7 @@ export default class EntityTypeResourceEditor extends Component< header = (
+
{rcTitle}
{rcDescrip}
); + let i = 0; for (const renderControllerSet of this.state.renderControllerSets) { renderControllerEditors.push( ); + i++; } } @@ -464,6 +450,7 @@ export default class EntityTypeResourceEditor extends Component< ", - "Latest Minecraft release", - "Latest Minecraft preview", - "Latest Education Edition", - "Latest Education Edition preview", + "Latest Minecraft Bedrock", + "Latest Minecraft Bedrock preview", + "Latest Minecraft Education", + "Latest Minecraft Education preview", ]; export const AUTOGENERATED_CONTENT_TOKEN = "==== AUTOGENERATED"; @@ -2312,7 +2312,7 @@ export default class Project { } else if (folderContext === FolderContext.behaviorPack && folderPathLower.indexOf("/dialogue/") >= 0) { newJsonType = ProjectItemType.dialogueBehaviorJson; } else if (folderContext === FolderContext.behaviorPack && folderPathLower.indexOf("/recipes/") >= 0) { - newJsonType = ProjectItemType.recipeBehaviorJson; + newJsonType = ProjectItemType.recipeBehavior; } else if ( folderContext === FolderContext.behaviorPack && folderPathLower.indexOf("/spawn_rules/") >= 0 @@ -2481,7 +2481,7 @@ export default class Project { ) { newJsonType = ProjectItemType.entityTypeBehavior; } else if (folderContext === FolderContext.behaviorPack && folderPathLower.indexOf("/items/") >= 0) { - newJsonType = ProjectItemType.itemTypeBehaviorJson; + newJsonType = ProjectItemType.itemTypeBehavior; } else if (folderContext === FolderContext.behaviorPack && folderPathLower.indexOf("/blocks/") >= 0) { newJsonType = ProjectItemType.blockTypeBehavior; } else if (folderContext === FolderContext.docs && baseName === "info") { diff --git a/app/src/app/ProjectItem.ts b/app/src/app/ProjectItem.ts index 2c51e961..0600ee6b 100644 --- a/app/src/app/ProjectItem.ts +++ b/app/src/app/ProjectItem.ts @@ -338,7 +338,7 @@ export default class ProjectItem { return "behavior/animations/animations.json"; case ProjectItemType.blockTypeBehavior: return "behavior/blocks/blocks.json"; - case ProjectItemType.itemTypeBehaviorJson: + case ProjectItemType.itemTypeBehavior: return "behavior/items/items.json"; case ProjectItemType.lootTableBehavior: return "behavior/loot_tables/loot_tables.json"; @@ -378,7 +378,7 @@ export default class ProjectItem { return "behavior/feature_rules/feature_rules.json"; case ProjectItemType.functionEventJson: return "behavior/functions/tick.json"; - case ProjectItemType.recipeBehaviorJson: + case ProjectItemType.recipeBehavior: return "behavior/recipes/recipes.json"; case ProjectItemType.spawnRuleBehavior: return "behavior/spawn_rules/spawn_rules.json"; diff --git a/app/src/app/ProjectItemRelations.ts b/app/src/app/ProjectItemRelations.ts index 02e25232..aba71bf1 100644 --- a/app/src/app/ProjectItemRelations.ts +++ b/app/src/app/ProjectItemRelations.ts @@ -3,6 +3,7 @@ import EntityTypeDefinition from "../minecraft/EntityTypeDefinition"; import EntityTypeResourceDefinition from "../minecraft/EntityTypeResourceDefinition"; import ItemTextureCatalogDefinition from "../minecraft/ItemTextureCatalogDefinition"; import MusicDefinitionCatalogDefinition from "../minecraft/MusicDefinitionCatalogDefinition"; +import ParticleEffectResourceDefinition from "../minecraft/ParticleEffectResourceDefinition"; import SoundCatalogDefinition from "../minecraft/SoundCatalogDefinition"; import SoundDefinitionCatalogDefinition from "../minecraft/SoundDefinitionCatalogDefinition"; import TerrainTextureCatalogDefinition from "../minecraft/TerrainTextureCatalogDefinition"; @@ -41,6 +42,16 @@ export default class ProjectItemRelations { await entityTypeResource.addChildItems(project, item); } } + } else if (item.itemType === ProjectItemType.particleJson) { + await item.ensureStorage(); + + if (item.file) { + const particleResource = await ParticleEffectResourceDefinition.ensureOnFile(item.file); + + if (particleResource) { + await particleResource.addChildItems(project, item); + } + } } else if (item.itemType === ProjectItemType.attachableResourceJson) { await item.ensureStorage(); @@ -119,7 +130,17 @@ export default class ProjectItemRelations { const entityTypeResource = await EntityTypeResourceDefinition.ensureOnFile(rel.parentItem.file); if (entityTypeResource) { - await entityTypeResource.deleteLink(rel); + await entityTypeResource.deleteLinkToChild(rel); + } + } + } else if (rel.parentItem.itemType === ProjectItemType.particleJson) { + await item.ensureStorage(); + + if (rel.parentItem.file) { + const particleResource = await ParticleEffectResourceDefinition.ensureOnFile(rel.parentItem.file); + + if (particleResource) { + await particleResource.deleteLinkToChild(rel); } } } else if (rel.parentItem.itemType === ProjectItemType.attachableResourceJson) { @@ -129,7 +150,7 @@ export default class ProjectItemRelations { const attachableResource = await AttachableResourceDefinition.ensureOnFile(rel.parentItem.file); if (attachableResource) { - await attachableResource.deleteLink(rel); + await attachableResource.deleteLinkToChild(rel); } } } else if (rel.parentItem.itemType === ProjectItemType.soundCatalog) { @@ -139,7 +160,7 @@ export default class ProjectItemRelations { const soundCat = await SoundDefinitionCatalogDefinition.ensureOnFile(rel.parentItem.file); if (soundCat) { - await soundCat.deleteLink(rel.childItem); + await soundCat.deleteLinkToChild(rel.childItem); } } } diff --git a/app/src/app/ProjectItemUtilities.ts b/app/src/app/ProjectItemUtilities.ts index 5e5a1238..2c4d7c59 100644 --- a/app/src/app/ProjectItemUtilities.ts +++ b/app/src/app/ProjectItemUtilities.ts @@ -52,13 +52,13 @@ export default class ProjectItemUtilities { firstHundred.indexOf('"minecraft:recipe_shaped"') >= 0 || firstHundred.indexOf('"minecraft:recipe_shapeless"') >= 0 ) { - return { itemType: ProjectItemType.recipeBehaviorJson }; + return { itemType: ProjectItemType.recipeBehavior }; } else if (firstHundred.indexOf('"minecraft:entity"') >= 0) { return { itemType: ProjectItemType.entityTypeBehavior }; } else if (firstHundred.indexOf('"minecraft:item"') >= 0) { - return { itemType: ProjectItemType.itemTypeBehaviorJson }; + return { itemType: ProjectItemType.itemTypeBehavior }; } else if (firstHundred.indexOf('"pools"') >= 0) { - return { itemType: ProjectItemType.itemTypeBehaviorJson }; + return { itemType: ProjectItemType.itemTypeBehavior }; } else if (firstHundred.indexOf('"minecraft:spawn_rules"') >= 0) { return { itemType: ProjectItemType.spawnRuleBehavior }; } else if (firstHundred.indexOf('"tiers"') >= 0) { @@ -118,9 +118,9 @@ export default class ProjectItemUtilities { case ProjectItemType.blockTypeBehavior: return 1852; - case ProjectItemType.itemTypeBehaviorJson: + case ProjectItemType.itemTypeBehavior: return 1853; - case ProjectItemType.recipeBehaviorJson: + case ProjectItemType.recipeBehavior: return 1860; case ProjectItemType.particleJson: return 1870; @@ -200,12 +200,12 @@ export default class ProjectItemUtilities { case ProjectItemType.blockTypeBehavior: case ProjectItemType.blocksCatalogResourceJson: case ProjectItemType.blockTypeResourceJson: - case ProjectItemType.itemTypeBehaviorJson: + case ProjectItemType.itemTypeBehavior: case ProjectItemType.fogResourceJson: case ProjectItemType.tradingBehaviorJson: case ProjectItemType.particleJson: case ProjectItemType.structure: - case ProjectItemType.recipeBehaviorJson: + case ProjectItemType.recipeBehavior: case ProjectItemType.biomeBehaviorJson: case ProjectItemType.biomeResourceJson: case ProjectItemType.lootTableBehavior: @@ -324,7 +324,7 @@ export default class ProjectItemUtilities { case ProjectItemType.animationControllerBehaviorJson: case ProjectItemType.blockTypeBehavior: case ProjectItemType.blockMaterialsBehaviorJson: - case ProjectItemType.itemTypeBehaviorJson: + case ProjectItemType.itemTypeBehavior: case ProjectItemType.lootTableBehavior: case ProjectItemType.biomeResourceJson: case ProjectItemType.fileListArrayJson: @@ -345,7 +345,7 @@ export default class ProjectItemUtilities { case ProjectItemType.featureRuleBehaviorJson: case ProjectItemType.featureBehavior: case ProjectItemType.functionEventJson: - case ProjectItemType.recipeBehaviorJson: + case ProjectItemType.recipeBehavior: case ProjectItemType.spawnRuleBehavior: case ProjectItemType.tradingBehaviorJson: case ProjectItemType.volumeBehaviorJson: @@ -502,7 +502,7 @@ export default class ProjectItemUtilities { return "Block type"; case ProjectItemType.blockMaterialsBehaviorJson: return "Block type materials"; - case ProjectItemType.itemTypeBehaviorJson: + case ProjectItemType.itemTypeBehavior: return "Item type"; case ProjectItemType.lootTableBehavior: return "Loot table"; @@ -542,7 +542,7 @@ export default class ProjectItemUtilities { return "Feature"; case ProjectItemType.functionEventJson: return "Function event"; - case ProjectItemType.recipeBehaviorJson: + case ProjectItemType.recipeBehavior: return "Recipe"; case ProjectItemType.spawnRuleBehavior: return "Spawn rule"; @@ -832,7 +832,7 @@ export default class ProjectItemUtilities { return ["attachables"]; case ProjectItemType.entityTypeBehavior: return ["entities"]; - case ProjectItemType.itemTypeBehaviorJson: + case ProjectItemType.itemTypeBehavior: case ProjectItemType.itemTypeResourceJson: return ["items"]; case ProjectItemType.blockTypeBehavior: @@ -843,7 +843,7 @@ export default class ProjectItemUtilities { return ["command_modules"]; case ProjectItemType.lootTableBehavior: return ["loot_tables"]; - case ProjectItemType.recipeBehaviorJson: + case ProjectItemType.recipeBehavior: return ["recipes"]; case ProjectItemType.spawnRuleBehavior: return ["spawn_rules"]; diff --git a/app/src/app/ProjectUtilities.ts b/app/src/app/ProjectUtilities.ts index 18224fb1..e5fc7edb 100644 --- a/app/src/app/ProjectUtilities.ts +++ b/app/src/app/ProjectUtilities.ts @@ -667,8 +667,8 @@ export default class ProjectUtilities { ); if ( - bpManifestJson.uuid !== oldUids["defaultBehaviorPack"] && - bpManifestJson.uuid !== project.defaultBehaviorPackUniqueId + bpManifestJson.id !== oldUids["defaultBehaviorPack"] && + bpManifestJson.id !== project.defaultBehaviorPackUniqueId ) { await bpManifestJson.setUuid(Utilities.createUuid(), project); } @@ -680,8 +680,8 @@ export default class ProjectUtilities { rpManifestJson.randomizeModuleUuids(project.defaultDataUniqueId, oldUids["defaultDataModulePack"]); if ( - rpManifestJson.uuid !== oldUids["defaultResourcePack"] && - rpManifestJson.uuid !== project.defaultResourcePackUniqueId + rpManifestJson.id !== oldUids["defaultResourcePack"] && + rpManifestJson.id !== project.defaultResourcePackUniqueId ) { await rpManifestJson.setUuid(Utilities.createUuid(), project); } @@ -925,7 +925,10 @@ export default class ProjectUtilities { } static replaceNamesInPath(path: string, project: Project, entityTypeProject: IGalleryItem, newName: string) { - path = Utilities.replaceAll(path, entityTypeProject.id, newName); + path = Utilities.replaceAll(path, "/" + entityTypeProject.id + ".", "/" + newName + "."); + path = Utilities.replaceAll(path, "\\" + entityTypeProject.id + ".", "\\" + newName + "."); + path = Utilities.replaceAll(path, "/" + entityTypeProject.id + "/", "/" + newName + "/"); + path = Utilities.replaceAll(path, "\\" + entityTypeProject.id + "\\", "\\" + newName + "\\"); return path; } diff --git a/app/src/cli/ClUtils.ts b/app/src/cli/ClUtils.ts index 88b3274b..2bfca905 100644 --- a/app/src/cli/ClUtils.ts +++ b/app/src/cli/ClUtils.ts @@ -4,6 +4,7 @@ import Project, { ProjectAutoDeploymentMode } from "../app/Project"; import IStatus, { StatusType } from "../app/Status"; import Log from "../core/Log"; import LocalEnvironment, { OperationColors, consoleText_reset } from "../local/LocalEnvironment"; +import LocalUtilities from "../local/LocalUtilities"; import NodeStorage from "../local/NodeStorage"; import Database from "../minecraft/Database"; import IFolder from "../storage/IFolder"; @@ -143,7 +144,7 @@ export default class ClUtils { return workFolder; } - static getCarto(localEnv: LocalEnvironment) { + static getCarto(localEnv: LocalEnvironment, basePath?: string) { CartoApp.localFolderExists = ClUtils.localFolderExists; CartoApp.localFileExists = ClUtils.localFileExists; CartoApp.ensureLocalFolder = ClUtils.ensureLocalFolder; @@ -173,6 +174,10 @@ export default class ClUtils { "" ); + if (localEnv.utilities && basePath) { + (localEnv.utilities as LocalUtilities).basePathAdjust = basePath; + } + const coreStorage = new NodeStorage(__dirname + "/../data/content/", ""); Database.contentFolder = coreStorage.rootFolder; diff --git a/app/src/core/ContentIndex.ts b/app/src/core/ContentIndex.ts index 7ba235c4..13d51a20 100644 --- a/app/src/core/ContentIndex.ts +++ b/app/src/core/ContentIndex.ts @@ -12,7 +12,6 @@ export enum AnnotationCategories { entityComponentDependent = "c", blockComponentDependent = "d", entityTypeDependent = "e", - experiment = "E", itemTypeDependent = "i", itemComponentDependent = "j", entityComponentDependentInGroup = "g", @@ -21,8 +20,17 @@ export enum AnnotationCategories { entityTypeSource = "E", blockTypeSource = "B", itemTypeSource = "I", + itemTextureSource = "J", + blockSounds = "L", + musicDefinitionSource = "M", + entitySounds = "N", + interactiveSounds = "R", jsSource = "S", + terrainTextureSource = "T", + soundDefinitionSource = "U", + individualEventSoundsSource = "V", worldProperty = "W", + experiment = "X", } const AvoidTermList = ["__proto__", "prototype", "[[Prototype]]"]; @@ -334,7 +342,7 @@ export default class ContentIndex implements IContentIndex { for (const item in curNode) { // we've found part of our string in this node - if (item.startsWith(nextStart) && curNode[item] !== undefined) { + if (item.startsWith(nextStart) && curNode[item] !== undefined && !hasAdvanced) { let itemIndex = 0; hasAdvanced = true; curNode = curNode[item]; @@ -396,7 +404,7 @@ export default class ContentIndex implements IContentIndex { } insert(key: string, item: string, annotationChar?: string) { - if (Utilities.isNumericIsh(key) || key.length > 40) { + if (Utilities.isNumericIsh(key) || key.length > 70) { return; } diff --git a/app/src/dataform/DataForm.tsx b/app/src/dataform/DataForm.tsx index 929dc029..f1b5e963 100644 --- a/app/src/dataform/DataForm.tsx +++ b/app/src/dataform/DataForm.tsx @@ -137,7 +137,7 @@ export default class DataForm extends Component const fieldId = this._getProperty("id", undefined); - if (!fieldId) { + if (fieldId) { return fieldId; } @@ -975,8 +975,6 @@ export default class DataForm extends Component this.checkboxItems = []; this.checkboxNames = []; - const seedId = this._getObjectId(); - if (this.props.definition !== undefined) { for (const propIndex in this.props.definition.fields) { const field = this.props.definition.fields[propIndex]; @@ -985,17 +983,19 @@ export default class DataForm extends Component const curVal = FieldUtilities.getFieldValue(field, this.props); const defaultVal = curVal ? curVal : field.defaultValue; + let baseKey = this._getObjectId() + "." + field.id; + let isValid = true; if (field.validity) { isValid = FieldUtilities.evaluate(this.props.definition, field.validity, this.props, field); } - let descriptionElement = <>; + let descriptionElement = ; if (field.description) { descriptionElement = ( -
+
{field.description}
); @@ -1006,7 +1006,7 @@ export default class DataForm extends Component if (this.props.readOnly || field.readOnly) { if (field.defaultValue === undefined || field.defaultValue !== curVal) { formInterior.push( -
+
{title}
{curVal}
@@ -1054,7 +1054,7 @@ export default class DataForm extends Component label={title} id={propIndex} items={items} - key={"frs" + seedId + title + propIndex} + key={"frs" + baseKey + title + propIndex} fluid={true} onChange={this._handleDropdownChange} value={[dropdownValue]} @@ -1064,7 +1064,7 @@ export default class DataForm extends Component this.dropdownNames.push(field.id); this.dropdownItems.push(items); formInterior.push( -
+
{dropdown} {descriptionElement}
@@ -1072,6 +1072,7 @@ export default class DataForm extends Component } else if (field.dataType === FieldDataType.point3) { const val = this._getProperty(field.id, [0, 0, 0]); let objKey = field.id; + if (this.props.objectKey) { objKey += this.props.objectKey; } @@ -1080,7 +1081,7 @@ export default class DataForm extends Component this.formComponentNames.push(field.id); this.formComponents.push(point3); formInterior.push( -
+
{point3} {descriptionElement}
@@ -1108,7 +1109,7 @@ export default class DataForm extends Component this.formComponents.push(version); formInterior.push( -
+
{version} {descriptionElement}
@@ -1139,7 +1140,7 @@ export default class DataForm extends Component this.formComponents.push(sarrt); formInterior.push( -
+
{title}
{descriptionElement} {sarrt} @@ -1172,7 +1173,7 @@ export default class DataForm extends Component this.formComponents.push(range); formInterior.push( -
+
{range} {descriptionElement}
@@ -1202,7 +1203,7 @@ export default class DataForm extends Component this.formComponents.push(sarr); formInterior.push( -
+
{descriptionElement} {sarr}
@@ -1238,7 +1239,7 @@ export default class DataForm extends Component const fieldInput = (