diff --git a/src/app/components/generic-calculator/calculator.component.ts b/src/app/components/generic-calculator/calculator.component.ts index 623091c900c92c77900ceadcde9aadbdb4d2f51f..be369c0b5b79ff4c3fb073a897d78c98fb08ae56 100644 --- a/src/app/components/generic-calculator/calculator.component.ts +++ b/src/app/components/generic-calculator/calculator.component.ts @@ -406,8 +406,8 @@ export class GenericCalculatorComponent extends BaseComponent implements OnInit, /** * réception d'un événement de changement de valeur d'un input */ - public onInputChange() { - this._formulaire.resetResults([]); + public onInputChange(event: any) { + this._formulaire.resetResults([], event.symbol); } /** diff --git a/src/app/components/generic-input/generic-input.component.ts b/src/app/components/generic-input/generic-input.component.ts index 3ed95a301ac7b3a2b62e37fd302df7e3be38ca99..42481be86e78793187601478e59824f327dc6b77 100644 --- a/src/app/components/generic-input/generic-input.component.ts +++ b/src/app/components/generic-input/generic-input.component.ts @@ -197,7 +197,11 @@ export abstract class GenericInputComponent extends BaseComponent implements OnC * événement de changement de la valeur du modèle */ private emitModelChanged() { - this.change.emit({ "action": "model", "value": this.getModelValue() }); + this.change.emit({ + action: "model", + value: this.getModelValue(), + symbol: (this._model instanceof NgParameter ? this._model.symbol : undefined) + }); } protected setAndValidateModel(sender: any, v: any) { diff --git a/src/app/components/param-field-line/param-field-line.component.ts b/src/app/components/param-field-line/param-field-line.component.ts index ecbbbeb482b79f63f2190f185adf95fc4d78f19c..0e3c35446e6fe7695982f31b457e116a7e077aa5 100644 --- a/src/app/components/param-field-line/param-field-line.component.ts +++ b/src/app/components/param-field-line/param-field-line.component.ts @@ -260,7 +260,7 @@ export class ParamFieldLineComponent implements OnChanges { break; case "model": - this.inputChange.emit(); + this.inputChange.emit(event); break; } } diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts index fd3a6b4cd42f38bbff29779b046dfdd1df8db19e..ed0cad6f325a9b3836e315a8e83bca3c7fa6a970 100644 --- a/src/app/components/param-link/param-link.component.ts +++ b/src/app/components/param-link/param-link.component.ts @@ -257,8 +257,9 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy { // console.log("undefined target value (pending calculation)"); } this.change.emit({ - "action": "model", - "value": value + action: "model", + value: value, + symbol: this.param.symbol }); } diff --git a/src/app/components/param-values/param-values.component.ts b/src/app/components/param-values/param-values.component.ts index ca4bc9c1cf74c16abaeb21765f5152c45c65ce34..65277721e5976c57d5ff6565f9d9ab8667c28c41 100644 --- a/src/app/components/param-values/param-values.component.ts +++ b/src/app/components/param-values/param-values.component.ts @@ -86,7 +86,11 @@ export class ParamValuesComponent implements AfterViewInit, Observer { * événement de changement de la valeur du modèle */ private emitModelChanged() { - this.change.emit({ "action": "model", "value": this.param.getValue() }); + this.change.emit({ + action: "model", + value: this.param.getValue(), + symbol: this.param.symbol + }); } public update(sender: any, data: any): void { diff --git a/src/app/formulaire/definition/concrete/form-base.ts b/src/app/formulaire/definition/concrete/form-base.ts index e54548b98fb970165a16b9bfdfc3a83a9c09fbb2..976cf3368d999b51ddee651a5d752852e4e1e1c0 100644 --- a/src/app/formulaire/definition/concrete/form-base.ts +++ b/src/app/formulaire/definition/concrete/form-base.ts @@ -21,15 +21,18 @@ export class FormulaireBase extends FormulaireDefinition { /** * Resets the form results, the results panel on screen, the model * results, and does the same for all depending modules + * @param symbol symbol of the parameter whose value change triggered this method + * @param forceResetAllDependencies if true, even non-calculated non-modified parameters + * links will be considered as dependencies @see jalhyd#98 */ - public resetResults(visited: string[] = []) { + public resetResults(visited: string[] = [], symbol?: string, forceResetAllDependencies: boolean = false) { visited.push(this.currentNub.uid); // reset GUI results this._formResult.resetResults(); // reset model results this.currentNub.resetResult(); // reset the result panels of all forms depending on this one - ServiceFactory.instance.formulaireService.resetAllDependingFormsResults(this, visited); + ServiceFactory.instance.formulaireService.resetAllDependingFormsResults(this, visited, symbol, forceResetAllDependencies); } public doCompute() { diff --git a/src/app/formulaire/definition/form-definition.ts b/src/app/formulaire/definition/form-definition.ts index 1e90fa201405ecd14ff0f2dbf4449e7c6788ee6e..f10ec866230967f6ff0de706f26f982265ec6356 100644 --- a/src/app/formulaire/definition/form-definition.ts +++ b/src/app/formulaire/definition/form-definition.ts @@ -380,7 +380,7 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs * effacement des résultats, application des dépendances, ... */ public reset() { - this.resetResults([]); + this.resetResults([], undefined, true); this.applyDependencies(); // prévenir les composants qu'il faut détecter les changements @@ -413,7 +413,7 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs } } - public abstract resetResults(visited: string[]); + public abstract resetResults(visited: string[], symbol?: string, forceResetAllDependencies?: boolean); public abstract doCompute(); public abstract get hasResults(): boolean; public abstract get results(): CalculatorResults[]; diff --git a/src/app/services/formulaire/formulaire.service.ts b/src/app/services/formulaire/formulaire.service.ts index b834703aba97da775b10bd808d0e0c91f40b94a8..0b499b5d895036c7bcc44e8e9f6525f8afa95862 100644 --- a/src/app/services/formulaire/formulaire.service.ts +++ b/src/app/services/formulaire/formulaire.service.ts @@ -497,7 +497,7 @@ export class FormulaireService extends Observable { // reset the result panels of all forms depending on this one // @TODO UI should detect model change instead of doing this manually - this.resetAllDependingFormsResults(form, [], false); + this.resetAllDependingFormsResults(form, [], undefined, true, false); } if (nub) { // reset model results (important, also resets dependent Nubs results in chain) @@ -721,9 +721,18 @@ export class FormulaireService extends Observable { /** * Resets the results of all forms depending on the given form "f" * @param f + * @param symbol symbol of the parameter whose value change triggered this method + * @param forceResetAllDependencies if true, even non-calculated non-modified parameters + * links will be considered as dependencies @see jalhyd#98 */ - public resetAllDependingFormsResults(f: FormulaireDefinition, visited: string[] = [], notify: boolean = true) { - const dependingNubs = Session.getInstance().getDependingNubs(f.currentNub.uid); + public resetAllDependingFormsResults( + f: FormulaireDefinition, + visited: string[] = [], + symbol?: string, + forceResetAllDependencies: boolean = false, + notify: boolean = true + ) { + const dependingNubs = Session.getInstance().getDependingNubs(f.currentNub.uid, symbol, forceResetAllDependencies); for (const dn of dependingNubs) { if (! visited.includes(dn.uid)) { const form = this.getFormulaireFromNubId(dn.uid);