Skip to content
Snippets Groups Projects
Commit 1617b30d authored by François Grand's avatar François Grand
Browse files

refactor: move list of parameters not to be emptied by "create new calculators...

refactor: move list of parameters not to be emptied by "create new calculators with empty fields" to constant in FormulaireNode

refs #480
parent ce23cd73
No related branches found
No related tags found
2 merge requests!133Release version 4.15.0,!119Resolve "Mode "champs vides par défaut" : changer le type d'un ouvrage (ex: dans Cloisons) remplit les champs"
......@@ -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;
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment