diff --git a/src/app/formulaire/definition/form-fixedvar.ts b/src/app/formulaire/definition/form-fixedvar.ts index 72928a7b9013fb984f089b62fe8102d06bd87f29..20314b5209a40fa200917e1cc31c43f3a94f5be8 100644 --- a/src/app/formulaire/definition/form-fixedvar.ts +++ b/src/app/formulaire/definition/form-fixedvar.ts @@ -89,8 +89,8 @@ export class FormulaireFixedVar extends FormulaireDefinition { protected compute() { this.runNubCalc(this.currentNub); + this.refreshFieldsets(); // important: before reaffectResultComponents() or it will break results components localization this.reaffectResultComponents(); - this.refreshFieldsets(); } protected reaffectResultComponents() { @@ -118,6 +118,9 @@ export class FormulaireFixedVar extends FormulaireDefinition { } } + /** + * Forces all fieldsets to update all their fields + */ protected refreshFieldsets() { for (const fs of this.allFieldsets) { fs.updateFields(); @@ -132,9 +135,7 @@ export class FormulaireFixedVar extends FormulaireDefinition { if (data.action === "propertyChange") { this.reset(); // reflect changes in GUI (who knows ?), for ex. show / hide dependent fields - for (const fs of this.allFieldsets) { - fs.updateFields(); - } + this.refreshFieldsets(); } } } diff --git a/src/app/formulaire/definition/form-macrorugo-compound.ts b/src/app/formulaire/definition/form-macrorugo-compound.ts index 663da1f960e32217289a9c5d73c44f7b8b81d534..c94dad30a3aafd7dfd1b3a27ce6d35f391b31f21 100644 --- a/src/app/formulaire/definition/form-macrorugo-compound.ts +++ b/src/app/formulaire/definition/form-macrorugo-compound.ts @@ -87,10 +87,8 @@ export class FormulaireMacrorugoCompound extends FormulaireRepeatableFieldset { * Reflect inclinedApron property state in GUI */ public updateApronState(inclined: MRCInclination) { - for (const fs of this.allFieldsets) { - // show / hide dependent fields (read from model) - fs.updateFields(); - } + // show / hide dependent fields (read from model) + this.refreshFieldsets(); // show / hide children list (GUI only) for (const elt of this.allFormElements) { if (elt instanceof FieldsetContainer) { diff --git a/src/app/formulaire/definition/form-section.ts b/src/app/formulaire/definition/form-section.ts index db63b5a1d681ce99de03d12fe0a2154630dd4c4d..77669213a882cff81572f0712589d834d11ca151 100644 --- a/src/app/formulaire/definition/form-section.ts +++ b/src/app/formulaire/definition/form-section.ts @@ -18,6 +18,8 @@ export class FormulaireSection extends FormulaireFixedVar { // show / hide dependent fields fs.updateFields(); } + // show / hide dependent fields + this.refreshFieldsets(); // empty fields ? only those belonging to the specific section type if (ServiceFactory.instance.applicationSetupService.enableEmptyFieldsOnFormInit) { // "LargeurBerge" is hackily used as LargeurFond in Rectangular and Trapez sections, omit it here