diff --git a/src/app/formulaire/definition/form-prebarrage.ts b/src/app/formulaire/definition/form-prebarrage.ts index 143a6991de916dacb0dad8b7fb48b2772e4c36a2..ebe3ea8ffdda5ae94f096a9dd6c0a3ceefa1089f 100644 --- a/src/app/formulaire/definition/form-prebarrage.ts +++ b/src/app/formulaire/definition/form-prebarrage.ts @@ -10,6 +10,7 @@ import { CalculatorResults } from "../../results/calculator-results"; import { PrebarrageResults } from "../../results/prebarrage-results"; import { NgParameter } from "../elements/ngparam"; import { longestVarParam } from "../../util"; +import { FormulaireNode } from "../elements/formulaire-node"; /** * Formulaire pour les PréBarrage @@ -324,7 +325,7 @@ export class FormulairePrebarrage extends FormulaireFixedVar { /** * Set value of all single parameters to undefined, except for the given parameter ids */ - public emptyFields(except: string[] = [ "Cd0", "CdWS", "CdGR", "CdGRS", "CdCunge", "CdWR", "CdO", "CdT", "CdWSL" ]) { + public emptyFields(except: string[] = FormulaireNode.NeverEmptyFields) { // save current calculated param, as setting value on a CALC param will // change its mode and choose another calculated param by default const paramCalculated = this.currentNub.calculatedParam; diff --git a/src/app/formulaire/elements/formulaire-node.ts b/src/app/formulaire/elements/formulaire-node.ts index 7731dfd43029def02f02d3299a9508ad350c653e..dca5bbe5d21d768c66b9692b81b385801b1bad14 100644 --- a/src/app/formulaire/elements/formulaire-node.ts +++ b/src/app/formulaire/elements/formulaire-node.ts @@ -9,6 +9,11 @@ import { NgParameter } from "./ngparam"; */ export abstract class FormulaireNode implements IObservable { + /** + * fields in fieldset that must not be empty due to enableEmptyFieldsOnFormInit option + */ + protected static NeverEmptyFields = ["Cd0", "CdWS", "CdGR", "CdGRS", "CdCunge", "CdWR", "CdO", "CdT", "CdWSL"]; + /** aide en ligne */ protected _helpLink: string; @@ -143,7 +148,7 @@ export abstract class FormulaireNode implements IObservable { /** * Set value of all single parameters to undefined, except for the given parameter ids */ - public emptyFields(except: string[] = [ "Cd0", "CdWS", "CdGR", "CdGRS", "CdCunge", "CdWR", "CdO", "CdT", "CdWSL" ]) { + public emptyFields(except: string[] = FormulaireNode.NeverEmptyFields) { // save current calculated param, as setting value on a CALC param will // change its mode and choose another calculated param by default let calcP: NgParameter;