Commit c9008f3b authored by Grand Francois's avatar Grand Francois
Browse files

fix: adapt to useDefaultParamValue flag removal in jalhyd

refs #516
Showing with 11 additions and 5 deletions
+11 -5
...@@ -21,6 +21,7 @@ import { AppComponent } from "../../app.component"; ...@@ -21,6 +21,7 @@ import { AppComponent } from "../../app.component";
import { fv } from "app/util"; import { fv } from "app/util";
import { FormulaireNode } from "app/formulaire/elements/formulaire-node"; import { FormulaireNode } from "app/formulaire/elements/formulaire-node";
import { ServiceFactory } from "app/services/service-factory";
/** /**
* The interactive schema for calculator type "PreBarrage" (component) * The interactive schema for calculator type "PreBarrage" (component)
...@@ -494,7 +495,7 @@ export class PbSchemaComponent implements AfterViewInit, AfterContentInit, OnIni ...@@ -494,7 +495,7 @@ export class PbSchemaComponent implements AfterViewInit, AfterContentInit, OnIni
/** Adds a new lone basin */ /** Adds a new lone basin */
public onAddBasinClick() { public onAddBasinClick() {
const newBasin = new PbBassin(new PbBassinParams(20, 99)); const newBasin = new PbBassin(new PbBassinParams(20, 99, ServiceFactory.applicationSetupService.enableEmptyFieldsOnFormInit));
this.model.addChild(newBasin); this.model.addChild(newBasin);
this.clearResults(); this.clearResults();
this.refreshWithSelection(newBasin.uid); this.refreshWithSelection(newBasin.uid);
......
...@@ -9,7 +9,8 @@ import { ...@@ -9,7 +9,8 @@ import {
acSection, acSection,
ParamDefinition, ParamDefinition,
Result, Result,
VariatedDetails VariatedDetails,
Prop_NullParameters
} from "jalhyd"; } from "jalhyd";
import { FormulaireElement } from "../elements/formulaire-element"; import { FormulaireElement } from "../elements/formulaire-element";
...@@ -110,6 +111,7 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs ...@@ -110,6 +111,7 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs
*/ */
public initNub(props?: Props) { public initNub(props?: Props) {
const p = props ? props : new Props(this.defaultProperties); const p = props ? props : new Props(this.defaultProperties);
p.setPropValue(Prop_NullParameters, ServiceFactory.applicationSetupService.enableEmptyFieldsOnFormInit); // transmit "empty fields" flag
this.currentNub = Session.getInstance().createSessionNub(p); this.currentNub = Session.getInstance().createSessionNub(p);
if (this.currentNub instanceof SectionNub) { if (this.currentNub instanceof SectionNub) {
......
import { Structure, Nub, ParallelStructure, StructureProperties, Props, Session, ParamDefinition } from "jalhyd"; import { Structure, Nub, ParallelStructure, StructureProperties, Props, Session, ParamDefinition, Prop_NullParameters } from "jalhyd";
import { FieldsetContainer } from "../elements/fieldset-container"; import { FieldsetContainer } from "../elements/fieldset-container";
import { FieldSet } from "../elements/fieldset"; import { FieldSet } from "../elements/fieldset";
...@@ -7,6 +7,7 @@ import { NgParameter } from "../elements/ngparam"; ...@@ -7,6 +7,7 @@ import { NgParameter } from "../elements/ngparam";
import { FieldsetTemplate } from "../elements/fieldset-template"; import { FieldsetTemplate } from "../elements/fieldset-template";
import { FormulaireNode } from "../elements/formulaire-node"; import { FormulaireNode } from "../elements/formulaire-node";
import { FormulaireRepeatableFieldset } from "./form-repeatable-fieldset"; import { FormulaireRepeatableFieldset } from "./form-repeatable-fieldset";
import { ServiceFactory } from "app/services/service-factory";
export class FormulaireParallelStructure extends FormulaireRepeatableFieldset { export class FormulaireParallelStructure extends FormulaireRepeatableFieldset {
...@@ -66,6 +67,7 @@ export class FormulaireParallelStructure extends FormulaireRepeatableFieldset { ...@@ -66,6 +67,7 @@ export class FormulaireParallelStructure extends FormulaireRepeatableFieldset {
params["nodeType"] = templ.defaultNodeTypeFromConfig; params["nodeType"] = templ.defaultNodeTypeFromConfig;
params["structureType"] = templ.defaultStructTypeFromConfig; params["structureType"] = templ.defaultStructTypeFromConfig;
params["loiDebit"] = templ.defaultLoiDebitFromConfig; params["loiDebit"] = templ.defaultLoiDebitFromConfig;
params[Prop_NullParameters] = ServiceFactory.applicationSetupService.enableEmptyFieldsOnFormInit;
return this.createStructure(new Props(params)); return this.createStructure(new Props(params));
} }
......
...@@ -24,6 +24,7 @@ export class ApplicationSetupService extends Observable { ...@@ -24,6 +24,7 @@ export class ApplicationSetupService extends Observable {
private _maxIterations = 100; // tied to model private _maxIterations = 100; // tied to model
public enableNotifications = true; public enableNotifications = true;
public enableHotkeys = false; public enableHotkeys = false;
private _enableEmptyFieldsOnFormInit = true;
public set computePrecision(p: number) { public set computePrecision(p: number) {
this._computePrecision = p; this._computePrecision = p;
...@@ -46,11 +47,11 @@ export class ApplicationSetupService extends Observable { ...@@ -46,11 +47,11 @@ export class ApplicationSetupService extends Observable {
} }
public get enableEmptyFieldsOnFormInit() { public get enableEmptyFieldsOnFormInit() {
return !SessionSettings.useDefaultParamValue; return this._enableEmptyFieldsOnFormInit;
} }
public set enableEmptyFieldsOnFormInit(b: boolean) { public set enableEmptyFieldsOnFormInit(b: boolean) {
SessionSettings.useDefaultParamValue = !b; this._enableEmptyFieldsOnFormInit = b;
} }
/** /**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment