diff --git a/src/app/calculators/parallel-structures/parallel-structures.config.json b/src/app/calculators/parallel-structures/parallel-structures.config.json index 928b882362a74e1121eb7718cffbfd620523196f..46de0359d1e8c02524f7f6144116d83bdbd1c0dc 100644 --- a/src/app/calculators/parallel-structures/parallel-structures.config.json +++ b/src/app/calculators/parallel-structures/parallel-structures.config.json @@ -28,6 +28,8 @@ { "id": "fs_struct_cem88d", "type": "fieldset_template", + "calcType": "Structure", + "nodeType": "StructureRectangle", "structType": "Cem88d", "option": "cal", "fields": [ @@ -53,6 +55,8 @@ { "id": "fs_struct_cem88v", "type": "fieldset_template", + "calcType": "Structure", + "nodeType": "StructureRectangle", "structType": "Cem88v", "option": "cal", "fields": [ diff --git a/src/app/formulaire/formulaire-definition.ts b/src/app/formulaire/formulaire-definition.ts index b7292ecf2c23ab2428bbe9b01d185a3eb338a855..1b37b5c43d8434490d785294446b20503a2ee3de 100644 --- a/src/app/formulaire/formulaire-definition.ts +++ b/src/app/formulaire/formulaire-definition.ts @@ -490,9 +490,9 @@ export class FormulaireDefinition extends Observable implements Observer { return res; } - private parse_input(node_type: ComputeNodeType, fieldset: {}, field: {}): NgParameter { + private parse_input(calc_type: CalculatorType, node_type: ComputeNodeType, fieldset: {}, field: {}): NgParameter { let input_id: string = field["id"]; - let res: NgParameter = this.paramService.createParameter(this._calcType, node_type, input_id, this._uid); + let res: NgParameter = this.paramService.createParameter(calc_type, node_type, input_id, this._uid); if (res == undefined) throw new Error(`pas de paramètre '${input_id}' trouvé dans le noeud ${ComputeNodeType[node_type]} (${node_type}) ou ComputeNodeType.None`); @@ -514,6 +514,10 @@ export class FormulaireDefinition extends Observable implements Observer { private parse_fieldset(json: {}) { const fs_id: string = json["id"]; + + const ct: string = json["calcType"]; + let calc_type: CalculatorType = ct == undefined ? this._calcType : CalculatorType[ct]; + const nt: string = json["nodeType"]; let node_type: ComputeNodeType = nt == undefined ? ComputeNodeType.None : ComputeNodeType[nt]; @@ -523,8 +527,9 @@ export class FormulaireDefinition extends Observable implements Observer { const fields = json["fields"]; for (const field_index in fields) { const field = fields[field_index]; + if (field["type"] === "input") { - const param = this.parse_input(node_type, json, field); + const param = this.parse_input(calc_type, node_type, json, field); res.addField(param); } else if (field["type"] === "select") { const param = this.parse_select(node_type, field);