diff --git a/src/app/formulaire/definition/form-definition.ts b/src/app/formulaire/definition/form-definition.ts index 23f9d2d9842af25f6fc5c132f443bd628b40c044..d5ebca4f24c09a43c3ff9432865feb7136c3806c 100644 --- a/src/app/formulaire/definition/form-definition.ts +++ b/src/app/formulaire/definition/form-definition.ts @@ -478,16 +478,19 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs // interface Observer public update(sender: any, data: any) { + console.log("test") if (sender instanceof Nub) { switch (data.action) { case "resultUpdated": + console.log("test 1"); // forward Nub results update notification to FormCompute objects this.reaffectResultComponents(); break; } } else if (sender instanceof SessionSettings) { - // reset results if a session setting (max iterations, compute precision) has been modified + console.log("test 2"); + // reset results if a session setting (max iterations, compute precision) has bsseen modified this.reset(); } } diff --git a/src/app/formulaire/definition/form-macrorugo-remous.ts b/src/app/formulaire/definition/form-macrorugo-remous.ts index 28c2308ea379ee205ce59907d6942d96f11819e0..6eb5a1c4310f931d5a2a1066c89347d69ccf8b7d 100644 --- a/src/app/formulaire/definition/form-macrorugo-remous.ts +++ b/src/app/formulaire/definition/form-macrorugo-remous.ts @@ -1,7 +1,8 @@ import { RemousResults } from "app/results/remous-results"; import { acSection, CourbeRemous, CourbeRemousParams, MacroRugo, MacrorugoRemous, Props, Result, Session } from "jalhyd"; -import { MacrorugoRemousParams} from "jalhyd/build/internal_modules"; +import { IObservable, MacrorugoRemousParams, Nub, Verificateur} from "jalhyd/build/internal_modules"; import { FormulaireFixedVar } from "./form-fixedvar"; +import { SelectField } from "../elements/select/select-field"; export class FormulaireMacrorugoRemous extends FormulaireFixedVar { public initNub(props?: Props) { @@ -14,8 +15,7 @@ export class FormulaireMacrorugoRemous extends FormulaireFixedVar { } } if (pam !== undefined) { - // props.setPropValue(MacrorugoRemous.nubMacroRugo, pam.uid); - props.setPropValue("Q", pam.prms.Q.V); + props.setPropValue("nubMacroRugo", pam.uid); } return super.initNub(props); } @@ -79,6 +79,33 @@ export class FormulaireMacrorugoRemous extends FormulaireFixedVar { } } + // interface Observer + + // public update(sender: IObservable, data: any) { + // // copied from FormDefinition, to avoid calling super.update() that would trigger an unwanted this.refreshFieldsets(); + // if (sender instanceof Nub) { + // switch (data.action) { + // case "resultUpdated": + // // forward Nub results update notification to FormCompute objects + // this.reaffectResultComponents(); + // break; + // } + // } + // // copied from FormFixedVar, to avoid calling super.update() + // if (data.action === "propertyChange") { + // this.reset(); + // } + + // if (sender instanceof SelectField) { + // this.reset(); // reset results + // console.log("update", data.action) + // if (sender.id === "select_target_pam" && data.action === "select") { + // // update Verificateur property: Pass to check + // this._currentNub.setPropValue("nubToVerify", data.value ? data.value.value : undefined); + // } + // } + // } + public resetFormResults() { this._remousResults.reset(); this.updateCalcResults();