From 943d5d8e0006ef70d455f37e671a3871d6715390 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Fri, 8 Jun 2018 11:03:03 +0200
Subject: [PATCH 01/41] =?UTF-8?q?=20#48=20d=C3=A9sactivation=20en=20mode?=
 =?UTF-8?q?=20d=C3=A9veloppement=20de=20la=20confirmation=20de=20rechargem?=
 =?UTF-8?q?ent=20de=20la=20page/fermeture=20de=20l'onglet=20de=20l'appli?=
 =?UTF-8?q?=20(uniquement=20mode=20prod)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/app/app.component.ts | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index f71d031e1..8f495b5da 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -368,7 +368,9 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
    */
   @HostListener('window:beforeunload', ['$event'])
   confirmExit($event) {
-    // affecter une valeur différente de null provoque l'affichage d'un dialogue de confirmation, mais le texte n'est pas affiché
-    $event.returnValue = 'Your data will be lost !';
+    if (environment.production) {
+      // affecter une valeur différente de null provoque l'affichage d'un dialogue de confirmation, mais le texte n'est pas affiché
+      $event.returnValue = 'Your data will be lost !';
+    }
   }
 }
-- 
GitLab


From 5f1900fc0746d74b0df7db8be64c506245835f4c Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Fri, 8 Jun 2018 15:52:45 +0200
Subject: [PATCH 02/41] =?UTF-8?q?=20#48=20composant=20ParamFieldLineCompon?=
 =?UTF-8?q?ent=20:=20ajout=20du=20bouton=20"li=C3=A9"=20(pour=20importer?=
 =?UTF-8?q?=20la=20valeur=20d'un=20autre=20param=C3=A8tre)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../param-field-line.component.html           |  6 +++
 .../param-field-line.component.ts             | 37 +++++++++++++++++++
 src/app/formulaire/ngparam.ts                 | 10 ++++-
 src/locale/error_messages.en.json             |  1 +
 src/locale/error_messages.fr.json             |  1 +
 5 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/src/app/components/param-field-line/param-field-line.component.html b/src/app/components/param-field-line/param-field-line.component.html
index b50485252..67f7218c1 100644
--- a/src/app/components/param-field-line/param-field-line.component.html
+++ b/src/app/components/param-field-line/param-field-line.component.html
@@ -27,6 +27,12 @@
             value="cal" (click)="onRadioClick('cal')" [checked]=radioCalCheck [disabled]=isDisabled id="radio_cal">
             {{uitextParamCalculer}}
         </label>
+
+        <!-- radio "lié" -->
+        <label *ngIf="hasRadioLink()" class="{{radioLinkClass}} h-75 px-3 py-3" [(ngModel)]="radioModel" mdbRadio="Right" name="radio_param_{{symbol}}"
+            value="link" (click)="onRadioClick('link')" [checked]=radioLinkCheck [disabled]=isDisabled id="radio_link">
+            {{uitextParamLie}}
+        </label>
     </div>
 </div>
 
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 d43df61f3..68df687f3 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
@@ -5,6 +5,7 @@ import { NgParameter, ParamRadioConfig } from "../../formulaire/ngparam";
 import { NgParamInputComponent } from "../ngparam-input/ngparam-input.component";
 import { ServiceFactory } from "../../services/service-factory";
 import { ParamValueMode } from "jalhyd";
+import { FormulaireService } from "../../services/formulaire/formulaire.service";
 
 @Component({
     selector: "param-field-line",
@@ -51,8 +52,11 @@ export class ParamFieldLineComponent implements OnChanges {
 
     private intlService: InternationalisationService;
 
+    private _formService: FormulaireService;
+
     constructor() {
         this.intlService = ServiceFactory.instance.internationalisationService;
+        this._formService = ServiceFactory.instance.formulaireService;
         this.onValid = new EventEmitter();
         this.inputChange = new EventEmitter();
     }
@@ -78,6 +82,10 @@ export class ParamFieldLineComponent implements OnChanges {
         return this.intlService.localizeText("INFO_PARAMFIELD_PARAMCALCULER");
     }
 
+    private get uitextParamLie() {
+        return this.intlService.localizeText("INFO_PARAMFIELD_PARAMLIE");
+    }
+
     /**
      * Parameter symbol (Q, Ks, B, ...) input attribute
      */
@@ -125,6 +133,13 @@ export class ParamFieldLineComponent implements OnChanges {
         }
     }
 
+    /**
+    * calcule la présence du radio "paramètre lié" (importé d'une autre calculette)
+    */
+    private hasRadioLink(): boolean {
+        return this._formService.formulaires.length > 1;
+    }
+
     /**
     * calcule l'état du radio "paramètre fixé"
     */
@@ -148,6 +163,15 @@ export class ParamFieldLineComponent implements OnChanges {
         return undefined;
     }
 
+    /**
+    * calcule l'état du radio "paramètre lié"
+    */
+    private get radioLinkCheck(): string {
+        if (this._param.radioState == ParamRadioConfig.LINK)
+            return "checked";
+        return undefined;
+    }
+
     /**
      * retourne l'état du radio "paramètre fixé" sous forme booléenne
      */
@@ -185,6 +209,10 @@ export class ParamFieldLineComponent implements OnChanges {
             case "cal":
                 this._param.valueMode = ParamValueMode.CALCUL;
                 break;
+
+            case "link":
+                this._param.valueMode = ParamValueMode.LINK;
+                break;
         }
 
         this.onRadio.emit({
@@ -240,6 +268,15 @@ export class ParamFieldLineComponent implements OnChanges {
         return "";
     }
 
+    /**
+     * classe du radio "lié"
+     */
+    private get radioLinkClass(): string {
+        if (this.on)
+            return this.radioLinkCheck == undefined ? this.offClass : this.onClass;
+        return "";
+    }
+
     /**
      * validité des saisies du composant
      */
diff --git a/src/app/formulaire/ngparam.ts b/src/app/formulaire/ngparam.ts
index 552594bc4..aabda4d65 100644
--- a/src/app/formulaire/ngparam.ts
+++ b/src/app/formulaire/ngparam.ts
@@ -24,7 +24,12 @@ export enum ParamRadioConfig {
     /**
      * boutons radio "paramètre fixé", "paramètre à varier" et "paramètre à calculer"
      */
-    CAL
+    CAL,
+
+    /**
+     * boutons radio "paramètre fixé", "paramètre à varier" et "paramètre à calculer", "paramètre lié"
+     */
+    LINK
 };
 
 /**
@@ -80,6 +85,9 @@ export class NgParameter extends InputField {
 
             case ParamValueMode.CALCUL:
                 return ParamRadioConfig.CAL;
+
+            case ParamValueMode.LINK:
+                return ParamRadioConfig.LINK;
         }
     }
 
diff --git a/src/locale/error_messages.en.json b/src/locale/error_messages.en.json
index f010427d9..985191346 100644
--- a/src/locale/error_messages.en.json
+++ b/src/locale/error_messages.en.json
@@ -33,6 +33,7 @@
     "INFO_PARAMFIELD_PARAMFIXE": "Fixed",
     "INFO_PARAMFIELD_PARAMVARIER": "Vary",
     "INFO_PARAMFIELD_PARAMCALCULER": "Calculate",
+    "INFO_PARAMFIELD_PARAMLIE": "Link",
     "INFO_PARAMFIELD_VALEURMINI": "From minimum value",
     "INFO_PARAMFIELD_VALEURMAXI": "to maximum value",
     "INFO_PARAMFIELD_PASVARIATION": "with a variation step of:",
diff --git a/src/locale/error_messages.fr.json b/src/locale/error_messages.fr.json
index 69c3b8f87..4f7493d23 100644
--- a/src/locale/error_messages.fr.json
+++ b/src/locale/error_messages.fr.json
@@ -39,6 +39,7 @@
     "INFO_PARAMFIELD_PARAMFIXE": "fixé",
     "INFO_PARAMFIELD_PARAMVARIER": "varier",
     "INFO_PARAMFIELD_PARAMCALCULER": "calculer",
+    "INFO_PARAMFIELD_PARAMLIE": "lié",
     "INFO_PARAMFIELD_VALEURMINI": "De la valeur minimum",
     "INFO_PARAMFIELD_VALEURMAXI": "à la valeur maximum",
     "INFO_PARAMFIELD_PASVARIATION": "avec un pas de&nbsp;:",
-- 
GitLab


From 0a030c6b2bf71356bd717c33af78446379a9065a Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Wed, 13 Jun 2018 16:31:59 +0200
Subject: [PATCH 03/41] =?UTF-8?q?=20#48=20NgParameter=20:=20d=C3=A9placeme?=
 =?UTF-8?q?nt=20vers=20jalHyd=20(dans=20BaseParam)=20des=20m=C3=A9thodes?=
 =?UTF-8?q?=20de=20validation=20des=20valeurs?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/app/formulaire/ngparam.ts | 84 +++--------------------------------
 1 file changed, 7 insertions(+), 77 deletions(-)

diff --git a/src/app/formulaire/ngparam.ts b/src/app/formulaire/ngparam.ts
index aabda4d65..859900023 100644
--- a/src/app/formulaire/ngparam.ts
+++ b/src/app/formulaire/ngparam.ts
@@ -140,38 +140,16 @@ export class NgParameter extends InputField {
             this._paramValues.valueMode = m;
     }
 
-    /**
-     * vérifie si un min/max est valide par rapport au domaine de définition
-     */
-    private isMinMaxDomainValid(v: number): boolean {
-        if (v == undefined)
-            return false;
-
-        if (this._paramValues.valueMode == ParamValueMode.MINMAX)
-            try {
-                this.checkValue(v);
-            }
-            catch (e) {
-                return false;
-            }
-
-        return true;
-    }
-
-    private checkMinMax(min: number, max: number): boolean {
-        return this.isMinMaxDomainValid(min) && this.isMinMaxDomainValid(max) && (min < max);
-    }
-
     public checkMin(min: number): boolean {
-        return this.isMinMaxDomainValid(min) && (min < this._paramValues.max);
+        return this._paramDef.checkMin(min);
     }
 
     public checkMax(max: number): boolean {
-        return this.isMinMaxDomainValid(max) && (this._paramValues.min < max);
+        return this._paramDef.checkMax(max);
     }
 
     public get isMinMaxValid(): boolean {
-        return this.checkMinMax(this._paramValues.min, this._paramValues.max);
+        return this._paramDef.isMinMaxValid;
     }
 
     public get minValue() {
@@ -191,7 +169,7 @@ export class NgParameter extends InputField {
     }
 
     public checkStep(step: number): boolean {
-        return this.isMinMaxValid && this._paramValues.stepRefValue.intervalHasValue(step);
+        return this._paramDef.checkStep(step);
     }
 
     public get stepRefValue(): Pair {
@@ -214,59 +192,11 @@ export class NgParameter extends InputField {
         this._paramValues.valueList = l;
     }
 
-    private get isListValid(): boolean {
-        if (this._paramValues.valueList == undefined)
-            return false;
-
-        for (let v of this._paramValues.valueList)
-            try {
-                this.checkValue(v);
-            }
-            catch (e) {
-                return false;
-            }
-        return true;
-    }
-
-    private get isRangeValid(): boolean {
-        switch (this._paramValues.valueMode) {
-            case ParamValueMode.LISTE:
-                return this.isListValid;
-
-            case ParamValueMode.MINMAX:
-                return this.checkStep(this._paramValues.step);
-        }
-
-        throw new Error(`"NgParameter.isRangeValid() : valeur ${ParamValueMode[this._paramValues.valueMode]} de ParamValueMode non prise en compte`);
-    }
-
-    private get isValueValid(): boolean {
-        try {
-            const v = this._paramDef.getValue();
-            this._paramDef.checkValue(v);
-            return true;
-        }
-        catch (e) {
-            return false;
-        }
-    }
-
     public get isValid() {
-        switch (this.radioState) {
-            case ParamRadioConfig.FIX:
-                return this.isValueValid;
-
-            case ParamRadioConfig.VAR:
-                return this.isRangeValid;
-
-            case ParamRadioConfig.CAL:
-                return true;
-
-            case undefined:
-                return false;
-        }
+        if (this.radioState === undefined)
+            return false;
 
-        throw new Error(`"NgParameter.isValid() : valeur de ParamRadioConfig '${this.radioState}' (radioState) non prise en compte`);
+        return this._paramDef.isValid;
     }
 
     private static getRadioConfig(s: string) {
-- 
GitLab


From 88425cc376a6dd48945b68f6eb60b0bddc3467b5 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Wed, 13 Jun 2018 17:02:35 +0200
Subject: [PATCH 04/41] =?UTF-8?q?=20#48=20ajout=20du=20squelette=20du=20co?=
 =?UTF-8?q?mposant=20ParamLinkComponent=20pour=20g=C3=A9rer=20la=20liaison?=
 =?UTF-8?q?=20(import)=20d'un=20param=C3=A8tre=20=C3=A0=20un=20autre?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/app/app.module.ts                         |  4 +-
 .../param-field-line.component.html           |  6 ++-
 .../param-field-line.component.ts             | 10 ++++
 .../param-link/param-link.component.html      | 10 ++++
 .../param-link/param-link.component.ts        | 47 +++++++++++++++++++
 .../param-values/param-values.component.html  |  6 +--
 .../param-values/param-values.component.ts    |  7 +++
 .../definition/form-def-fixedvar.ts           | 11 ++++-
 8 files changed, 95 insertions(+), 6 deletions(-)
 create mode 100644 src/app/components/param-link/param-link.component.html
 create mode 100644 src/app/components/param-link/param-link.component.ts

diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index e084fe592..d5fb12041 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -53,6 +53,7 @@ import { LoadCalculatorComponent } from './components/load-calculator/load-calcu
 import { LoadCalcDialogAnchorDirective } from './components/load-calculator/load-calculator-anchor.directive';
 import { SaveCalculatorComponent } from './components/save-calculator/save-calculator.component';
 import { SaveCalcDialogAnchorDirective } from './components/save-calculator/save-calculator-anchor.directive';
+import { ParamLinkComponent } from './components/param-link/param-link.component';
 
 const appRoutes: Routes = [
   { path: 'list', component: CalculatorListComponent },
@@ -100,7 +101,8 @@ const appRoutes: Routes = [
     FixedResultsComponent, VarResultsComponent,
     HelpComponent,
     LoadCalculatorComponent, LoadCalcDialogAnchorDirective,
-    SaveCalculatorComponent, SaveCalcDialogAnchorDirective
+    SaveCalculatorComponent, SaveCalcDialogAnchorDirective,
+    ParamLinkComponent
   ],
   // entryComponents: [AlertDialog],
   entryComponents: [LoadCalculatorComponent, SaveCalculatorComponent],
diff --git a/src/app/components/param-field-line/param-field-line.component.html b/src/app/components/param-field-line/param-field-line.component.html
index 67f7218c1..d3ae40fd9 100644
--- a/src/app/components/param-field-line/param-field-line.component.html
+++ b/src/app/components/param-field-line/param-field-line.component.html
@@ -36,4 +36,8 @@
     </div>
 </div>
 
-<param-values *ngIf="isRadioVarChecked" [param]="_param" (onValid)=onParamValuesValid($event)></param-values>
\ No newline at end of file
+<!-- composant pour gérer le cas "paramètre à varier" (min-max/liste de valeurs) -->
+<param-values *ngIf="isRadioVarChecked" [param]="_param" (onValid)=onParamValuesValid($event)></param-values>
+
+<!-- composant pour gérer le cas "paramètre lié" -->
+<param-link *ngIf="isRadioLinkChecked" [param]="_param" (onValid)=onParamValuesValid($event)></param-link>
\ No newline at end of file
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 68df687f3..f1f752819 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
@@ -186,6 +186,13 @@ export class ParamFieldLineComponent implements OnChanges {
         return this._param.radioState == ParamRadioConfig.VAR;
     }
 
+    /**
+     * retourne l'état du radio "paramètre lié" sous forme booléenne
+     */
+    private get isRadioLinkChecked(): boolean {
+        return this._param.radioState == ParamRadioConfig.LINK;
+    }
+
     /*
      * gestion des événements clic sur les radios :
      * envoi d'un message au composant parent
@@ -197,6 +204,8 @@ export class ParamFieldLineComponent implements OnChanges {
 
     private onRadioClick(option: string) {
         const oldValue = this._param.valueMode;
+
+        //console.log(`param ${this._param.valueMode} mode ${ParamValueMode[this._param.valueMode]}`);
         switch (option) {
             case "fix":
                 this._param.valueMode = ParamValueMode.SINGLE;
@@ -214,6 +223,7 @@ export class ParamFieldLineComponent implements OnChanges {
                 this._param.valueMode = ParamValueMode.LINK;
                 break;
         }
+        //console.log(`param ${this._param.valueMode} mode ${ParamValueMode[this._param.valueMode]}`);
 
         this.onRadio.emit({
             "param": this._param,
diff --git a/src/app/components/param-link/param-link.component.html b/src/app/components/param-link/param-link.component.html
new file mode 100644
index 000000000..994ddba8b
--- /dev/null
+++ b/src/app/components/param-link/param-link.component.html
@@ -0,0 +1,10 @@
+<div class="row">
+    <div class="btn-group col-12 col-sm-3" dropdown (click)="onSelectLinkableParam($event)">
+        <button dropdownToggle class="btn btn-primary dropdown-toggle waves-light my-1" type="button" mdbRippleRadius>
+            {{currentLinkedParamLabel}}
+        </button>
+        <div class="dropdown-menu">
+            <a class="dropdown-item" *ngFor="let e of _linkableParams" [value]=e.value>{{e.label}}</a>
+        </div>
+    </div>
+</div>
\ No newline at end of file
diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts
new file mode 100644
index 000000000..92e1aa333
--- /dev/null
+++ b/src/app/components/param-link/param-link.component.ts
@@ -0,0 +1,47 @@
+import { Component, Input, Output, EventEmitter } from "@angular/core";
+
+import { NgParameter } from "../../formulaire/ngparam";
+
+@Component({
+    selector: "param-link",
+    templateUrl: "./param-link.component.html"
+})
+export class ParamLinkComponent {
+    @Input("param")
+    private _param: NgParameter;
+
+    @Output()
+    private onValid: EventEmitter<boolean>;
+
+    /**
+     * liste des paramètres liables
+     */
+    private _linkableParams: any[] = [{ value: "aaa", label: "Aaa aa" }, { value: "bbb", label: "Bbbb bb" }];
+    constructor() {
+        this.onValid = new EventEmitter();
+    }
+
+    /**
+     * envoi d'un événement de validité
+     */
+    private emitValidity() {
+        // this.onValid.emit(this._validList);
+    }
+
+    /**
+     * réception d'un événement du menu des paramètres liables
+     */
+    private onSelectLinkableParam(event: any) {
+        const next = event.target.value;
+
+        switch (next) {
+        }
+    }
+
+    /**
+     * valeur courante affichée dans le select des paramètres liables
+     */
+    private get currentLinkedParamLabel(): string {
+        return "azeaz";
+    }
+}
diff --git a/src/app/components/param-values/param-values.component.html b/src/app/components/param-values/param-values.component.html
index d231d6036..0335d8bdd 100644
--- a/src/app/components/param-values/param-values.component.html
+++ b/src/app/components/param-values/param-values.component.html
@@ -8,13 +8,13 @@
         </div>
     </div>
 
-    <div *ngIf="!isList" class="col-12 col-sm-3">
+    <div *ngIf="isMinMax" class="col-12 col-sm-3">
         <ngparam-min [title]="uitextValeurMini" (onChange)="onMinChanged($event)"></ngparam-min>
     </div>
-    <div *ngIf="!isList" class="col-12 col-sm-3">
+    <div *ngIf="isMinMax" class="col-12 col-sm-3">
         <ngparam-max [title]="uitextValeurMaxi" (onChange)="onMaxChanged($event)"></ngparam-max>
     </div>
-    <div *ngIf="!isList" class="col-12 col-sm-3">
+    <div *ngIf="isMinMax" class="col-12 col-sm-3">
         <ngparam-step [title]="uitextPasVariation" [param]=_param (onChange)="onStepChanged($event)"></ngparam-step>
     </div>
 
diff --git a/src/app/components/param-values/param-values.component.ts b/src/app/components/param-values/param-values.component.ts
index 91200b464..36761b432 100644
--- a/src/app/components/param-values/param-values.component.ts
+++ b/src/app/components/param-values/param-values.component.ts
@@ -281,6 +281,13 @@ export class ParamValuesComponent extends BaseComponent implements AfterViewChec
         return this._param.valueMode == ParamValueMode.LISTE;
     }
 
+    /**
+     * true si mode "lié"
+     */
+    private get isLink(): boolean {
+        return this._param.valueMode == ParamValueMode.LINK;
+    }
+
     /**
      * true si mode "min/max/pas"
      */
diff --git a/src/app/formulaire/definition/form-def-fixedvar.ts b/src/app/formulaire/definition/form-def-fixedvar.ts
index 3c00d5657..69afb546c 100644
--- a/src/app/formulaire/definition/form-def-fixedvar.ts
+++ b/src/app/formulaire/definition/form-def-fixedvar.ts
@@ -22,7 +22,7 @@ export class FormDefFixedVar {
     protected resetOtherRadio(me: NgParameter, except: ParamRadioConfig) {
         for (const p of this._formBase.allFormElements) {
             if (p instanceof NgParameter)
-                if (p != me && p.radioState != except && p.radioConfig != ParamRadioConfig.FIX)
+                if (p != me && p.radioState != except && p.radioState != ParamRadioConfig.LINK && p.radioConfig != ParamRadioConfig.FIX)
                     p.valueMode = ParamValueMode.SINGLE;
         }
     }
@@ -81,6 +81,13 @@ export class FormDefFixedVar {
         }
     }
 
+    private logParams() {
+        console.log("----");
+        for (const fe of this._formBase.allFormElements)
+            if (fe instanceof NgParameter)
+                console.log(`${fe.paramDefinition.symbol} : ${ParamValueMode[fe.paramDefinition.valueMode]}`);
+    }
+
     /**
      * gestion des événements clic sur les radios
      */
@@ -88,6 +95,8 @@ export class FormDefFixedVar {
         const param: NgParameter = info.param; // paramètre source de l'événement radio
         const old: ParamValueMode = info.oldValueMode; // ancien état (radio)
 
+        //this.logParams();
         this.resetRadiosAndResults(param, old);
+        //this.logParams();
     }
 }
-- 
GitLab


From ae9ef6a0f60b74c82ed00cb18fcd29f1a3f7af40 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Thu, 14 Jun 2018 16:37:41 +0200
Subject: [PATCH 05/41] =?UTF-8?q?=20#48=20ParamLinkComponent=20:=20remplis?=
 =?UTF-8?q?sage=20de=20la=20liste=20des=20param=C3=A8tres=20liables=20en?=
 =?UTF-8?q?=20fonction=20des=20calculettes=20ouvertes?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../param-link/param-link.component.html      |  7 +-
 .../param-link/param-link.component.ts        | 73 +++++++++++++++++--
 src/app/formulaire/ngparam.ts                 | 14 +++-
 .../services/formulaire/formulaire.service.ts | 22 ++++++
 4 files changed, 104 insertions(+), 12 deletions(-)

diff --git a/src/app/components/param-link/param-link.component.html b/src/app/components/param-link/param-link.component.html
index 994ddba8b..1fc116676 100644
--- a/src/app/components/param-link/param-link.component.html
+++ b/src/app/components/param-link/param-link.component.html
@@ -1,10 +1,13 @@
 <div class="row">
-    <div class="btn-group col-12 col-sm-3" dropdown (click)="onSelectLinkableParam($event)">
+    <div class="btn-group col-6 col-sm-3" dropdown (click)="onSelectLinkableParam($event)">
         <button dropdownToggle class="btn btn-primary dropdown-toggle waves-light my-1" type="button" mdbRippleRadius>
             {{currentLinkedParamLabel}}
         </button>
         <div class="dropdown-menu">
-            <a class="dropdown-item" *ngFor="let e of _linkableParams" [value]=e.value>{{e.label}}</a>
+            <a class="dropdown-item" *ngFor="let e of _linkableParams" [value]=e>{{selectItemLabel(e)}}</a>
         </div>
     </div>
+    <div class="col-6 text-danger">
+        {{_message}}
+    </div>
 </div>
\ No newline at end of file
diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts
index 92e1aa333..4ccaf65e1 100644
--- a/src/app/components/param-link/param-link.component.ts
+++ b/src/app/components/param-link/param-link.component.ts
@@ -1,12 +1,14 @@
-import { Component, Input, Output, EventEmitter } from "@angular/core";
+import { Component, Input, Output, EventEmitter, OnChanges } from "@angular/core";
 
 import { NgParameter } from "../../formulaire/ngparam";
+import { ServiceFactory } from "../../services/service-factory";
+import { ParamValueMode } from "jalhyd";
 
 @Component({
     selector: "param-link",
     templateUrl: "./param-link.component.html"
 })
-export class ParamLinkComponent {
+export class ParamLinkComponent implements OnChanges {
     @Input("param")
     private _param: NgParameter;
 
@@ -14,9 +16,21 @@ export class ParamLinkComponent {
     private onValid: EventEmitter<boolean>;
 
     /**
-     * liste des paramètres liables
+     * indice actuel du paramètre sélectionné dans la lsite
      */
-    private _linkableParams: any[] = [{ value: "aaa", label: "Aaa aa" }, { value: "bbb", label: "Bbbb bb" }];
+    private _currentIndex = -1;
+
+    /**
+     * message affiché à côté du select des paramètres
+     */
+    private _message: string;
+
+    /**
+     * liste des paramètres liables sous la forme
+     * {"param":<paramètre liable>, "nub":<Nub d'origine du paramètre>, "formTitle":<nom de la calculette liée au nub>}
+     */
+    private _linkableParams: any[];
+
     constructor() {
         this.onValid = new EventEmitter();
     }
@@ -34,14 +48,59 @@ export class ParamLinkComponent {
     private onSelectLinkableParam(event: any) {
         const next = event.target.value;
 
-        switch (next) {
-        }
+        let i = 0;
+        for (const e of this._linkableParams)
+            if (this._linkableParams[i].param.uid == next.param.uid) {
+                this.linkTo(i);
+                break;
+            }
+            else
+                i++;
     }
 
     /**
      * valeur courante affichée dans le select des paramètres liables
      */
     private get currentLinkedParamLabel(): string {
-        return "azeaz";
+        if (this._linkableParams !== undefined) {
+            if (this._currentIndex === -1 || this._currentIndex >= this._linkableParams.length)
+                return undefined;
+
+            return this.selectItemLabel(this._linkableParams[this._currentIndex]);
+        }
+
+        return undefined;
+    }
+
+    /**
+     * attribut "label" d'une entrée du select des paramètres
+     */
+    private selectItemLabel(i: any) {
+        const s = i.param.symbol;
+        const c = i.formTitle;
+        return `${s} (${c})`;
+    }
+
+    /**
+     * lie le paramètre géré à un des paramètres liables de la liste
+     * @param index indice dans la liste
+     */
+    private linkTo(index: number) {
+        if (this._currentIndex !== index) {
+            this._currentIndex = index;
+            const lp = this._linkableParams[index];
+
+            this._param.linkToParameter(lp.nub, lp.param);
+        }
+    }
+
+    public ngOnChanges() {
+        this._linkableParams = ServiceFactory.instance.formulaireService.getLinkableParameters(this._param);
+        if (this._linkableParams.length > 0) {
+            this.linkTo(0);
+            this._message = undefined;
+        }
+        else
+            this._message = "Aucun paramètre compatible trouvé";
     }
 }
diff --git a/src/app/formulaire/ngparam.ts b/src/app/formulaire/ngparam.ts
index 859900023..b48b72503 100644
--- a/src/app/formulaire/ngparam.ts
+++ b/src/app/formulaire/ngparam.ts
@@ -1,4 +1,4 @@
-import { ParamDefinition, Pair, ParamDomain, ParamValues, ParamValueMode, ParamValueIterator } from "jalhyd";
+import { ParamDefinition, Pair, ParamDomain, ParamValues, ParamValueMode, ParamValueIterator, Nub } from "jalhyd";
 
 import { InputField } from "./input-field";
 import { Dependency } from "./dependency/dependency";
@@ -75,7 +75,7 @@ export class NgParameter extends InputField {
     }
 
     public get radioState() {
-        switch (this._paramDef.paramValues.valueMode) {
+        switch (this._paramDef.valueMode) {
             case ParamValueMode.SINGLE:
                 return ParamRadioConfig.FIX;
 
@@ -116,6 +116,14 @@ export class NgParameter extends InputField {
         this.notifyValueModified(sender);
     }
 
+    /**
+     * crée le lien avec un paramètre
+     */
+    public linkToParameter(n: Nub, p: ParamDefinition) {
+        this.valueMode = ParamValueMode.LINK;
+        this.paramDefinition.defineReference(n, p.symbol);
+    }
+
     get isDefined(): boolean {
         return this._paramDef.isDefined;
     }
@@ -137,7 +145,7 @@ export class NgParameter extends InputField {
         // undefined si on clique en dehors du select après l'avoir ouvert (cad sans avoir fait de sélection)
         // et au même niveau, cad à côté du bouton et non à côté du menu déroulant
         if (m != undefined)
-            this._paramValues.valueMode = m;
+            this._paramDef.valueMode = m;
     }
 
     public checkMin(min: number): boolean {
diff --git a/src/app/services/formulaire/formulaire.service.ts b/src/app/services/formulaire/formulaire.service.ts
index 5984c3f9d..29a370edc 100644
--- a/src/app/services/formulaire/formulaire.service.ts
+++ b/src/app/services/formulaire/formulaire.service.ts
@@ -24,6 +24,7 @@ import { FormulaireRegimeUniforme } from "../../formulaire/definition/concrete/f
 import { FormulairePasseBassinDimensions } from "../../formulaire/definition/concrete/form-passe-bassin-dim";
 import { FormulairePasseBassinPuissance } from "../../formulaire/definition/concrete/form-passe-bassin-puissance";
 import { FormulaireParallelStructure } from "../../formulaire/definition/concrete/form-parallel-structures";
+import { NgParameter } from "../../formulaire/ngparam";
 
 @Injectable()
 export class FormulaireService extends Observable {
@@ -468,4 +469,25 @@ export class FormulaireService extends Observable {
                     throw new Error(`session file : invalid key '${ks}' in session object`);
             }
     }
+
+    /**
+     * @returns liste des paramètres liables à un paramètre sous la forme d'un tableau d'objets
+     * {"param":<paramètre lié>, "nub":<Nub d'origine du paramètre lié>, "formTitle":<nom de la calculette liée au nub>}
+     * @param symbol symbole (Q, J, ...) du paramètre qui sert de clé de recherche des paramètres liables
+     */
+    public getLinkableParameters(p: NgParameter): any[] {
+        let res: any[] = [];
+
+        if (p !== undefined)
+            for (const f of this._formulaires) {
+                const sn = f.currentSessionNub;
+                const ps = sn.getLinkableParameters(p.paramDefinition);
+                for (const np of ps) {
+                    np["formTitle"] = f.calculatorName;
+                    res.push(np);
+                }
+            }
+
+        return res;
+    }
 }
-- 
GitLab


From 7c34821b42cd7088f10b4475a504d8705df9e612 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Thu, 14 Jun 2018 16:48:58 +0200
Subject: [PATCH 06/41]  #45 MAJ jalhyd_branch

---
 jalhyd_branch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jalhyd_branch b/jalhyd_branch
index 1f7391f92..d918178ee 100644
--- a/jalhyd_branch
+++ b/jalhyd_branch
@@ -1 +1 @@
-master
+45-importation-d-un-parametre-resultat-ou-resultat-complementaire-d-une-autre-calculette
-- 
GitLab


From fadb25dbb0a6fb08a249093f071bc524df9d63a4 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Fri, 15 Jun 2018 11:07:14 +0200
Subject: [PATCH 07/41] =?UTF-8?q?=20#48=20ParamLinkComponent=20:=20MAJ=20d?=
 =?UTF-8?q?e=20la=20liste=20des=20param=C3=A8tres=20liables=20apr=C3=A8s?=
 =?UTF-8?q?=20cr=C3=A9ation=20d'une=20calculette?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../param-link/param-link.component.ts        | 39 ++++++++++++++++---
 1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts
index 4ccaf65e1..0ce835b5d 100644
--- a/src/app/components/param-link/param-link.component.ts
+++ b/src/app/components/param-link/param-link.component.ts
@@ -2,13 +2,14 @@ import { Component, Input, Output, EventEmitter, OnChanges } from "@angular/core
 
 import { NgParameter } from "../../formulaire/ngparam";
 import { ServiceFactory } from "../../services/service-factory";
-import { ParamValueMode } from "jalhyd";
+import { ParamValueMode, Observer } from "jalhyd";
+import { FormulaireService } from "../../services/formulaire/formulaire.service";
 
 @Component({
     selector: "param-link",
     templateUrl: "./param-link.component.html"
 })
-export class ParamLinkComponent implements OnChanges {
+export class ParamLinkComponent implements OnChanges, Observer {
     @Input("param")
     private _param: NgParameter;
 
@@ -31,8 +32,12 @@ export class ParamLinkComponent implements OnChanges {
      */
     private _linkableParams: any[];
 
+    private _formService: FormulaireService;
+
     constructor() {
         this.onValid = new EventEmitter();
+        this._formService = ServiceFactory.instance.formulaireService;
+        this._formService.addObserver(this);
     }
 
     /**
@@ -94,13 +99,35 @@ export class ParamLinkComponent implements OnChanges {
         }
     }
 
-    public ngOnChanges() {
-        this._linkableParams = ServiceFactory.instance.formulaireService.getLinkableParameters(this._param);
+    private updateParamList() {
+        // liste des paramètres liables
+        this._linkableParams = this._formService.getLinkableParameters(this._param);
+
+        // initialisation de l'indice courant
         if (this._linkableParams.length > 0) {
-            this.linkTo(0);
+            if (this._currentIndex === -1)
+                this.linkTo(0);
             this._message = undefined;
         }
-        else
+        else {
+            this._currentIndex = -1;
             this._message = "Aucun paramètre compatible trouvé";
+        }
+    }
+
+    public ngOnChanges() {
+        this.updateParamList();
+    }
+
+    // interface Observer 
+
+    public update(sender: any, data: any) {
+        if (sender instanceof FormulaireService) {
+            switch (data["action"]) {
+                case "createForm":
+                    this.updateParamList();
+                    break;
+            }
+        }
     }
 }
-- 
GitLab


From df4b073915fe015bd5c22e67926b101ad2e336da Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Fri, 15 Jun 2018 14:56:36 +0200
Subject: [PATCH 08/41] =?UTF-8?q?=20#48=20MAJ=20de=20la=20valeur=20dans=20?=
 =?UTF-8?q?le=20champ=20de=20saisie=20d'un=20param=C3=A8tre=20quand=20on?=
 =?UTF-8?q?=20change=20la=20valeur=20point=C3=A9e=20dans=20le=20select?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../ngparam-input/ngparam-input.component.ts   | 12 ++++++++++++
 .../param-link/param-link.component.ts         | 13 +++++++++++--
 src/app/formulaire/ngparam.ts                  | 18 +++++++++++++++---
 3 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/src/app/components/ngparam-input/ngparam-input.component.ts b/src/app/components/ngparam-input/ngparam-input.component.ts
index abce24cdf..3db763c94 100644
--- a/src/app/components/ngparam-input/ngparam-input.component.ts
+++ b/src/app/components/ngparam-input/ngparam-input.component.ts
@@ -115,6 +115,18 @@ export class NgParamInputComponent extends GenericInputComponent implements Obse
                     this._tmp = data["value"];
                     this.updateAndValidateUI();
                 }
+                break;
+
+            // changement de valueMode du paramètre ou de valeur à laquelle il est lié
+            case "valueModeChange":
+            case "valueLinkChange":
+                this._tmp = data["value"];
+                this.updateAndValidateUI();
+                break;
         }
     }
+
+    public ngOnDestroy() {
+        this._paramDef.removeObserver(this);
+    }
 }
diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts
index 0ce835b5d..4ea99b759 100644
--- a/src/app/components/param-link/param-link.component.ts
+++ b/src/app/components/param-link/param-link.component.ts
@@ -1,4 +1,4 @@
-import { Component, Input, Output, EventEmitter, OnChanges } from "@angular/core";
+import { Component, Input, Output, EventEmitter, OnChanges, OnDestroy } from "@angular/core";
 
 import { NgParameter } from "../../formulaire/ngparam";
 import { ServiceFactory } from "../../services/service-factory";
@@ -9,7 +9,8 @@ import { FormulaireService } from "../../services/formulaire/formulaire.service"
     selector: "param-link",
     templateUrl: "./param-link.component.html"
 })
-export class ParamLinkComponent implements OnChanges, Observer {
+export class ParamLinkComponent implements OnChanges, Observer, OnDestroy {
+    // paramètre géré (qui sera lié à une valeur, cad qui importe cette valeur)
     @Input("param")
     private _param: NgParameter;
 
@@ -116,9 +117,17 @@ export class ParamLinkComponent implements OnChanges, Observer {
     }
 
     public ngOnChanges() {
+        if (this._param !== undefined)
+            this._param.removeObserver(this);
+        this._param.addObserver(this);
+
         this.updateParamList();
     }
 
+    public ngOnDestroy() {
+        this._param.removeObserver(this);
+    }
+
     // interface Observer 
 
     public update(sender: any, data: any) {
diff --git a/src/app/formulaire/ngparam.ts b/src/app/formulaire/ngparam.ts
index b48b72503..fee5e2f71 100644
--- a/src/app/formulaire/ngparam.ts
+++ b/src/app/formulaire/ngparam.ts
@@ -120,8 +120,15 @@ export class NgParameter extends InputField {
      * crée le lien avec un paramètre
      */
     public linkToParameter(n: Nub, p: ParamDefinition) {
-        this.valueMode = ParamValueMode.LINK;
-        this.paramDefinition.defineReference(n, p.symbol);
+        const changed: boolean = this.paramDefinition.referencedObject !== n || this.paramDefinition.referenceDesc !== p.symbol;
+        if (changed) {
+            this.valueMode = ParamValueMode.LINK;
+            this._paramDef.defineReference(n, p.symbol);
+            this.notifyObservers({
+                "action": "valueLinkChange",
+                "value": this._paramDef.getValue()
+            });
+        }
     }
 
     get isDefined(): boolean {
@@ -144,8 +151,13 @@ export class NgParameter extends InputField {
     public set valueMode(m: ParamValueMode) {
         // undefined si on clique en dehors du select après l'avoir ouvert (cad sans avoir fait de sélection)
         // et au même niveau, cad à côté du bouton et non à côté du menu déroulant
-        if (m != undefined)
+        if (m !== undefined && this._paramDef.valueMode !== m) {
             this._paramDef.valueMode = m;
+            this.notifyObservers({
+                "action": "valueModeChange",
+                "value": this._paramDef.getValue()
+            });
+        }
     }
 
     public checkMin(min: number): boolean {
-- 
GitLab


From bdb072ec064e7387ca3127cb673b827550ec907c Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Tue, 19 Jun 2018 11:52:38 +0200
Subject: [PATCH 09/41] =?UTF-8?q?=20#48=20mode=20de=20valeur=20des=20param?=
 =?UTF-8?q?=C3=A8tres=20:=20modif=20pour=20afficher=20l'option=20"li=C3=A9?=
 =?UTF-8?q?"=20quand=20une=20seule=20calculette=20est=20ouverte=20dans=20l?=
 =?UTF-8?q?e=20cas=20o=C3=B9=20c'est=20une=20calculette=20"ouvrages=20para?=
 =?UTF-8?q?ll=C3=A8les"=20(pour=20pouvoir=20lier=20des=20ouvrages=20entre?=
 =?UTF-8?q?=20eux)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../param-field-line/param-field-line.component.ts          | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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 f1f752819..0caedab2e 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
@@ -4,7 +4,7 @@ import { InternationalisationService } from "../../services/internationalisation
 import { NgParameter, ParamRadioConfig } from "../../formulaire/ngparam";
 import { NgParamInputComponent } from "../ngparam-input/ngparam-input.component";
 import { ServiceFactory } from "../../services/service-factory";
-import { ParamValueMode } from "jalhyd";
+import { ParamValueMode, CalculatorType } from "jalhyd";
 import { FormulaireService } from "../../services/formulaire/formulaire.service";
 
 @Component({
@@ -137,7 +137,9 @@ export class ParamFieldLineComponent implements OnChanges {
     * calcule la présence du radio "paramètre lié" (importé d'une autre calculette)
     */
     private hasRadioLink(): boolean {
-        return this._formService.formulaires.length > 1;
+        if (this._formService.formulaires.length > 0)
+            return this._formService.formulaires.length > 1 || this._formService.formulaires[0].calculatorType == CalculatorType.ParallelStructure;
+        return false;
     }
 
     /**
-- 
GitLab


From f591bb50e28203c19241fb2804f3ef0091bdbbaa Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Tue, 19 Jun 2018 11:54:54 +0200
Subject: [PATCH 10/41]  #48 modifs suite au renommage dans jalHyd de
 getLinkableParameters en getLinkableValues

---
 .../param-link/param-link.component.ts        | 23 +++++++++++++++----
 src/app/formulaire/ngparam.ts                 |  2 +-
 .../services/formulaire/formulaire.service.ts | 19 +++++++++++++--
 3 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts
index 4ea99b759..e3efcd9ac 100644
--- a/src/app/components/param-link/param-link.component.ts
+++ b/src/app/components/param-link/param-link.component.ts
@@ -29,7 +29,7 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy {
 
     /**
      * liste des paramètres liables sous la forme
-     * {"param":<paramètre liable>, "nub":<Nub d'origine du paramètre>, "formTitle":<nom de la calculette liée au nub>}
+     * {"value":<valeur liable>, "nub":<Nub d'origine du paramètre>, "formTitle":<nom de la calculette liée au nub>}
      */
     private _linkableParams: any[];
 
@@ -56,7 +56,7 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy {
 
         let i = 0;
         for (const e of this._linkableParams)
-            if (this._linkableParams[i].param.uid == next.param.uid) {
+            if (this._linkableParams[i].value.uid == next.value.uid) {
                 this.linkTo(i);
                 break;
             }
@@ -78,11 +78,23 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy {
         return undefined;
     }
 
+    //     // le paramètre est il déjà lié à une valeur ? si oui laquelle ?
+    //     if(this._currentIndex === -1 && this._param.valueMode == ParamValueMode.LINK && this._linkableParams !== undefined) {
+    //     let i = 0;
+    //     for (const e of this._linkableParams)
+    //         if (e.param.uid === this._param.paramDefinition.re) {
+    //             this._currentIndex = i;
+    //             break;
+    //         }
+    //         else
+    //             i++;
+    // }
+
     /**
      * attribut "label" d'une entrée du select des paramètres
      */
     private selectItemLabel(i: any) {
-        const s = i.param.symbol;
+        const s = i.value.name;
         const c = i.formTitle;
         return `${s} (${c})`;
     }
@@ -96,13 +108,14 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy {
             this._currentIndex = index;
             const lp = this._linkableParams[index];
 
-            this._param.linkToParameter(lp.nub, lp.param);
+            this._param.linkToParameter(lp.nub, lp.value);
         }
     }
 
     private updateParamList() {
         // liste des paramètres liables
-        this._linkableParams = this._formService.getLinkableParameters(this._param);
+        // this._linkableParams = this._formService.getLinkableParameters(this._param);
+        this._linkableParams = this._formService.getLinkableValues(this._param);
 
         // initialisation de l'indice courant
         if (this._linkableParams.length > 0) {
diff --git a/src/app/formulaire/ngparam.ts b/src/app/formulaire/ngparam.ts
index fee5e2f71..6972f2b26 100644
--- a/src/app/formulaire/ngparam.ts
+++ b/src/app/formulaire/ngparam.ts
@@ -120,7 +120,7 @@ export class NgParameter extends InputField {
      * crée le lien avec un paramètre
      */
     public linkToParameter(n: Nub, p: ParamDefinition) {
-        const changed: boolean = this.paramDefinition.referencedObject !== n || this.paramDefinition.referenceDesc !== p.symbol;
+        const changed: boolean = this.paramDefinition.referencedNub !== n || this.paramDefinition.referenceDefinition !== p.symbol;
         if (changed) {
             this.valueMode = ParamValueMode.LINK;
             this._paramDef.defineReference(n, p.symbol);
diff --git a/src/app/services/formulaire/formulaire.service.ts b/src/app/services/formulaire/formulaire.service.ts
index 29a370edc..07a2cee36 100644
--- a/src/app/services/formulaire/formulaire.service.ts
+++ b/src/app/services/formulaire/formulaire.service.ts
@@ -475,13 +475,28 @@ export class FormulaireService extends Observable {
      * {"param":<paramètre lié>, "nub":<Nub d'origine du paramètre lié>, "formTitle":<nom de la calculette liée au nub>}
      * @param symbol symbole (Q, J, ...) du paramètre qui sert de clé de recherche des paramètres liables
      */
-    public getLinkableParameters(p: NgParameter): any[] {
+    // public getLinkableParameters(p: NgParameter): any[] {
+    //     let res: any[] = [];
+
+    //     if (p !== undefined)
+    //         for (const f of this._formulaires) {
+    //             const sn = f.currentSessionNub;
+    //             const ps = sn.getLinkableParameters(p.paramDefinition);
+    //             for (const np of ps) {
+    //                 np["formTitle"] = f.calculatorName;
+    //                 res.push(np);
+    //             }
+    //         }
+
+    //     return res;
+    // }
+    public getLinkableValues(p: NgParameter): any[] {
         let res: any[] = [];
 
         if (p !== undefined)
             for (const f of this._formulaires) {
                 const sn = f.currentSessionNub;
-                const ps = sn.getLinkableParameters(p.paramDefinition);
+                const ps = sn.getLinkableValues(p.paramDefinition);
                 for (const np of ps) {
                     np["formTitle"] = f.calculatorName;
                     res.push(np);
-- 
GitLab


From 2eabb5204b120d5eba3dd42e66b22efd9db4f7be Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Tue, 19 Jun 2018 14:34:44 +0200
Subject: [PATCH 11/41] =?UTF-8?q?=20#48=20ParamFieldLineComponent=20:=20af?=
 =?UTF-8?q?fichage=20de=20l'option=20"li=C3=A9"=20pour=20les=20param=C3=A8?=
 =?UTF-8?q?tres=20dans=20le=20cas=20des=20ouvrages=20parall=C3=A8les=20uni?=
 =?UTF-8?q?quement=20si=20au=20moins=202=20ouvrages=20sont=20pr=C3=A9sents?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../param-field-line.component.ts                 | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

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 0caedab2e..6b1883394 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
@@ -4,7 +4,7 @@ import { InternationalisationService } from "../../services/internationalisation
 import { NgParameter, ParamRadioConfig } from "../../formulaire/ngparam";
 import { NgParamInputComponent } from "../ngparam-input/ngparam-input.component";
 import { ServiceFactory } from "../../services/service-factory";
-import { ParamValueMode, CalculatorType } from "jalhyd";
+import { ParamValueMode, CalculatorType, ParallelStructure } from "jalhyd";
 import { FormulaireService } from "../../services/formulaire/formulaire.service";
 
 @Component({
@@ -137,8 +137,17 @@ export class ParamFieldLineComponent implements OnChanges {
     * calcule la présence du radio "paramètre lié" (importé d'une autre calculette)
     */
     private hasRadioLink(): boolean {
-        if (this._formService.formulaires.length > 0)
-            return this._formService.formulaires.length > 1 || this._formService.formulaires[0].calculatorType == CalculatorType.ParallelStructure;
+        if (this._formService.formulaires.length > 0) {
+            if (this._formService.formulaires.length > 1)
+                return true;
+
+            if (this._formService.formulaires[0].calculatorType == CalculatorType.ParallelStructure) {
+                const ps: ParallelStructure = this._formService.formulaires[0].currentSessionNub.nub as ParallelStructure;
+                if (ps.structures.length > 1)
+                    return true;
+            }
+
+        }
         return false;
     }
 
-- 
GitLab


From ff94605ba688f052c9d91fbc238baf732dc8d5ea Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Thu, 21 Jun 2018 10:23:11 +0200
Subject: [PATCH 12/41] =?UTF-8?q?=20#48=20NgParamInputComponent=20:=20limi?=
 =?UTF-8?q?tation=20des=20MAJ=20de=20l'affichage=20dans=20le=20cas=20d'?=
 =?UTF-8?q?=C3=A9v=C3=A9nements=20valueModeChange/valueLinkChange?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/app/components/ngparam-input/ngparam-input.component.ts | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/app/components/ngparam-input/ngparam-input.component.ts b/src/app/components/ngparam-input/ngparam-input.component.ts
index 3db763c94..bba17a97f 100644
--- a/src/app/components/ngparam-input/ngparam-input.component.ts
+++ b/src/app/components/ngparam-input/ngparam-input.component.ts
@@ -120,8 +120,10 @@ export class NgParamInputComponent extends GenericInputComponent implements Obse
             // changement de valueMode du paramètre ou de valeur à laquelle il est lié
             case "valueModeChange":
             case "valueLinkChange":
-                this._tmp = data["value"];
-                this.updateAndValidateUI();
+                if (this._tmp !== data["value"]) {
+                    this._tmp = data["value"];
+                    this.updateAndValidateUI();
+                }
                 break;
         }
     }
-- 
GitLab


From 7374318842be02775d2a1f99f48125f0c99db499 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Thu, 21 Jun 2018 10:24:51 +0200
Subject: [PATCH 13/41] =?UTF-8?q?=20#48=20ParamLinkComponent=20:=20raffine?=
 =?UTF-8?q?ment=20des=20=C3=A9tiquettes=20dans=20le=20s=C3=A9lecteur=20de?=
 =?UTF-8?q?=20param=C3=A8tres=20liables?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../param-link/param-link.component.ts        | 41 +++++++++++++++++--
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts
index e3efcd9ac..ab78d4d85 100644
--- a/src/app/components/param-link/param-link.component.ts
+++ b/src/app/components/param-link/param-link.component.ts
@@ -29,7 +29,17 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy {
 
     /**
      * liste des paramètres liables sous la forme
-     * {"value":<valeur liable>, "nub":<Nub d'origine du paramètre>, "formTitle":<nom de la calculette liée au nub>}
+     * {"name":<étiquette>, "value":<valeur liable>, "nub":<Nub d'origine du paramètre>, "formTitle":<nom de la calculette liée au nub>}
+     * 
+     * l'étiquette "name" est de la forme <n|N1>[.[N2]]
+     * n : indice de de l'ouvrage dans le cas des ouvrages parallèles
+     * N1 : un nom de paramètre/résultat (dans le cas d'un résultat, il est suivi d'un point)
+     * N2 : nom de résultat complémentaire (optionnel)
+     * ex : 
+     *   Q, Z1 (paramètres)
+     *   J. (résultat)
+     *   .Yf (résultat complémentaire du résultat courant)
+     *   Q.Yf (résultat complémentaire du résultat nommé "Q")
      */
     private _linkableParams: any[];
 
@@ -94,9 +104,32 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy {
      * attribut "label" d'une entrée du select des paramètres
      */
     private selectItemLabel(i: any) {
-        const s = i.value.name;
-        const c = i.formTitle;
-        return `${s} (${c})`;
+        const s = i.name; // nom associé au paramètre/à la valeur
+        const c = i.formTitle; // nom de la calculette
+
+        const re1 = /([^\.]+)\.$/;  // forme xxx. (résultat)
+        const match1 = re1.exec(s);
+        if (match1 !== null)
+            return `${match1[1]} (résultat de ${c})`;
+
+        const re4 = /(\d+)\.(.+)/;  // forme <nombre>.xxx (ouvrage)
+        const match4 = re4.exec(s);
+        if (match4 !== null) {
+            const n = +match4[1] + 1
+            return `${match4[2]} (${c}, ouvrage n°${n})`;
+        }
+
+        const re2 = /([^\.]+)\.(.+)/;  // forme xxx.yyy (résultat complémentaire)
+        const match2 = re2.exec(s);
+        if (match2 !== null)
+            return `${match2[2]} (${c}, résultat complémentaire de ${match2[1]})`;
+
+        const re3 = /^\.(.+)/;  // forme .xxx (résultat complémentaire)
+        const match3 = re3.exec(s);
+        if (match3 !== null)
+            return `${match3[1]} (${c}, résultat complémentaire)`;
+
+        return `${s} (${c})`; // forme simple (paramètre)
     }
 
     /**
-- 
GitLab


From 006c61231ea3400fab22eb372fbd333315d2b703 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Thu, 21 Jun 2018 10:43:50 +0200
Subject: [PATCH 14/41] =?UTF-8?q?=20#48=20MAJ=20de=20tous=20les=20composan?=
 =?UTF-8?q?ts=20ParamLinkComponent=20d'un=20formulaire=20quand=20un=20de?=
 =?UTF-8?q?=20ces=20composants=20est=20modifi=C3=A9=20(liste=20des=20param?=
 =?UTF-8?q?=C3=A8tres=20liables)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/app/components/field-set/field-set.component.ts  |  7 +++++++
 .../fieldset-container.component.ts                  |  7 +++++++
 .../generic-calculator/calculator.component.ts       |  9 +++++++++
 .../param-field-line/param-field-line.component.ts   | 12 ++++++++++++
 .../components/param-link/param-link.component.ts    |  2 +-
 5 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/src/app/components/field-set/field-set.component.ts b/src/app/components/field-set/field-set.component.ts
index 1c14aafc4..cbf78ed49 100644
--- a/src/app/components/field-set/field-set.component.ts
+++ b/src/app/components/field-set/field-set.component.ts
@@ -261,6 +261,13 @@ export class FieldSetComponent implements DoCheck {
         this._paramComponents.forEach(fsc => fsc.updateParameterFromUI());
     }
 
+    /**
+     * met à jour les paramètres liés
+     */
+    public updateLinkedParameters() {
+        this._paramComponents.forEach(fsc => fsc.updateLinkedParameter());
+    }
+
     /**
      * clic sur le bouton ajouter
      */
diff --git a/src/app/components/fieldset-container/fieldset-container.component.ts b/src/app/components/fieldset-container/fieldset-container.component.ts
index 240f408b9..947302dee 100644
--- a/src/app/components/fieldset-container/fieldset-container.component.ts
+++ b/src/app/components/fieldset-container/fieldset-container.component.ts
@@ -161,6 +161,13 @@ export class FieldsetContainerComponent implements DoCheck, AfterViewInit {
         this._fieldsetComponents.forEach(fsc => fsc.updateParametersFromUI());
     }
 
+    /**
+     * met à jour les paramètres liés
+     */
+    public updateLinkedParameters() {
+        this._fieldsetComponents.forEach(fsc => fsc.updateLinkedParameters());
+    }
+
     /**
     * réception d'un événement de demande d'ajout d'un FieldSet
     */
diff --git a/src/app/components/generic-calculator/calculator.component.ts b/src/app/components/generic-calculator/calculator.component.ts
index b7b8a07fc..6a293b7bf 100644
--- a/src/app/components/generic-calculator/calculator.component.ts
+++ b/src/app/components/generic-calculator/calculator.component.ts
@@ -194,6 +194,7 @@ export class GenericCalculatorComponent extends BaseComponent implements OnInit,
      */
     private onRadioClick(info: any) {
         this._formulaire.onRadioClick(info);
+        this.updateLinkedParameters();
     }
 
     private onCloseForm() {
@@ -219,6 +220,14 @@ export class GenericCalculatorComponent extends BaseComponent implements OnInit,
         this._fieldsetContainerComponents.forEach(fscc => fscc.updateParametersFromUI());
     }
 
+    /**
+     * met à jour les paramètres liés
+     */
+    private updateLinkedParameters() {
+        this._fieldsetComponents.forEach(fsc => fsc.updateLinkedParameters());
+        this._fieldsetContainerComponents.forEach(fscc => fscc.updateLinkedParameters());
+    }
+
     private doCompute() {
         this.updateParametersFromUI();
         this._formulaire.doCompute();
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 6b1883394..a741c7cb2 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
@@ -6,6 +6,7 @@ import { NgParamInputComponent } from "../ngparam-input/ngparam-input.component"
 import { ServiceFactory } from "../../services/service-factory";
 import { ParamValueMode, CalculatorType, ParallelStructure } from "jalhyd";
 import { FormulaireService } from "../../services/formulaire/formulaire.service";
+import { ParamLinkComponent } from "../param-link/param-link.component";
 
 @Component({
     selector: "param-field-line",
@@ -34,6 +35,9 @@ export class ParamFieldLineComponent implements OnChanges {
     @ViewChild(NgParamInputComponent)
     private _ngParamInputComponent: NgParamInputComponent;
 
+    @ViewChild(ParamLinkComponent)
+    private _paramLinkComponent: ParamLinkComponent;
+
     @Output()
     private onValid: EventEmitter<void>;
 
@@ -360,4 +364,12 @@ export class ParamFieldLineComponent implements OnChanges {
     public updateParameterFromUI() {
         this._ngParamInputComponent.updateModelFromUI();
     }
+
+    /**
+     * met à jour les paramètres liés
+     */
+    public updateLinkedParameter() {
+        if (this._paramLinkComponent !== undefined)
+            this._paramLinkComponent.updateParamList();
+    }
 }
diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts
index ab78d4d85..8ad07ff0c 100644
--- a/src/app/components/param-link/param-link.component.ts
+++ b/src/app/components/param-link/param-link.component.ts
@@ -145,7 +145,7 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy {
         }
     }
 
-    private updateParamList() {
+    public updateParamList() {
         // liste des paramètres liables
         // this._linkableParams = this._formService.getLinkableParameters(this._param);
         this._linkableParams = this._formService.getLinkableValues(this._param);
-- 
GitLab


From 70e78605d95efb82a4d66e89fa775ac267b520e9 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Thu, 21 Jun 2018 16:12:12 +0200
Subject: [PATCH 15/41] =?UTF-8?q?=20#48=20NgParameter=20:=20modifs=20pour?=
 =?UTF-8?q?=20que=20les=20changements=20de=20valeur=20saisis=20par=20l'uti?=
 =?UTF-8?q?lisateur=20sur=20un=20param=C3=A8tre=20li=C3=A9=20soient=20affi?=
 =?UTF-8?q?ch=C3=A9s=20dans=20le=20param=C3=A8tre=20liant?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/app/formulaire/ngparam.ts | 41 ++++++++++++++++++++++++++++++-----
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/src/app/formulaire/ngparam.ts b/src/app/formulaire/ngparam.ts
index 6972f2b26..bc6effb9a 100644
--- a/src/app/formulaire/ngparam.ts
+++ b/src/app/formulaire/ngparam.ts
@@ -1,10 +1,9 @@
-import { ParamDefinition, Pair, ParamDomain, ParamValues, ParamValueMode, ParamValueIterator, Nub } from "jalhyd";
+import { ParamDefinition, Pair, ParamDomain, ParamValueMode, ParamValueIterator, Nub, Observer, asObservable } from "jalhyd";
 
 import { InputField } from "./input-field";
 import { Dependency } from "./dependency/dependency";
 import { DependencyConditionType } from "./dependency/dependency-condition";
 import { ValueDependencyCondition } from "./dependency/value-dependency-condition";
-import { FormulaireDefinition } from "./definition/form-definition";
 import { ServiceFactory } from "../services/service-factory";
 import { ApplicationSetupService } from "../services/app-setup/app-setup.service";
 import { StringMap } from "../stringmap";
@@ -35,7 +34,7 @@ export enum ParamRadioConfig {
 /**
  * classe englobante de ParamDefinition (champs supplémentaires pour l'affichage, radio boutons, ...)
  */
-export class NgParameter extends InputField {
+export class NgParameter extends InputField implements Observer {
     public unit: string;
     public radioConfig: ParamRadioConfig;
 
@@ -112,18 +111,39 @@ export class NgParameter extends InputField {
      * @param val 
      */
     public setValue(sender: any, val: number) {
-        this._paramDef.v = val;
+        this._paramDef.setValue(val, sender);
         this.notifyValueModified(sender);
     }
 
+    /**
+     * supprime un lien avec un paramètre
+     */
+    private unlinkParameter() {
+        let o = asObservable(this._paramDef.referencedObject);
+        if (this.valueMode === ParamValueMode.LINK) {
+            this._paramDef.undefineReference();
+            if (o !== undefined)
+                o.removeObserver(this);
+        }
+    }
+
     /**
      * crée le lien avec un paramètre
      */
     public linkToParameter(n: Nub, p: ParamDefinition) {
-        const changed: boolean = this.paramDefinition.referencedNub !== n || this.paramDefinition.referenceDefinition !== p.symbol;
+        const changed: boolean = this._paramDef.valueMode !== ParamValueMode.LINK || this._paramDef.referencedNub !== n || this._paramDef.referenceDefinition !== p.symbol;
         if (changed) {
+            let o = asObservable(this._paramDef.referencedObject);
+            if (o !== undefined)
+                o.removeObserver(this);
+
             this.valueMode = ParamValueMode.LINK;
             this._paramDef.defineReference(n, p.symbol);
+
+            o = asObservable(this._paramDef.referencedObject);
+            if (o !== undefined)
+                o.addObserver(this); // pour être prévenu des changements de valeur de l'object référencé
+
             this.notifyObservers({
                 "action": "valueLinkChange",
                 "value": this._paramDef.getValue()
@@ -152,6 +172,7 @@ export class NgParameter extends InputField {
         // undefined si on clique en dehors du select après l'avoir ouvert (cad sans avoir fait de sélection)
         // et au même niveau, cad à côté du bouton et non à côté du menu déroulant
         if (m !== undefined && this._paramDef.valueMode !== m) {
+            this.unlinkParameter();
             this._paramDef.valueMode = m;
             this.notifyObservers({
                 "action": "valueModeChange",
@@ -352,4 +373,14 @@ export class NgParameter extends InputField {
             }
         }
     }
+
+    // interface Observer
+
+    public update(sender: any, data: any) {
+        switch (data["action"]) {
+            case "baseparamAfterValue": // changement de valeur envoyé par l'objet référencé
+                this.notifyValueModified(sender);
+                break;
+        }
+    }
 }
-- 
GitLab


From 5576240a40a18bb436957b355cf85cb770802bb9 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Thu, 21 Jun 2018 17:02:35 +0200
Subject: [PATCH 16/41] =?UTF-8?q?=20#48=20FormResultFixedVar.addFixedParam?=
 =?UTF-8?q?eters()=20:=20modif=20pour=20tenir=20compte=20des=20param=C3=A8?=
 =?UTF-8?q?tres=20li=C3=A9s=20dont=20le=20mode=20est=20SINGLE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/app/formulaire/definition/form-result-fixedvar.ts | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/app/formulaire/definition/form-result-fixedvar.ts b/src/app/formulaire/definition/form-result-fixedvar.ts
index 0dacc750a..27e04a353 100644
--- a/src/app/formulaire/definition/form-result-fixedvar.ts
+++ b/src/app/formulaire/definition/form-result-fixedvar.ts
@@ -1,4 +1,4 @@
-import { ResultElement, cLog } from "jalhyd";
+import { ResultElement, cLog, ParamValueMode } from "jalhyd";
 
 import { FixedResults } from "../../results/fixed-results";
 import { GraphType, VarResults } from "../../results/var-results";
@@ -40,6 +40,10 @@ export class FormResultFixedVar extends FormResult {
         for (const p of this._formBase.getDisplayedParamListFromState(ParamRadioConfig.FIX))
             if (p.symbol !== "Pr")
                 this._fixedResults.addFixedParameter(p);
+
+        for (const p of this._formBase.getDisplayedParamListFromState(ParamRadioConfig.LINK))
+            if (p.paramDefinition.referencedParamValues.valueMode == ParamValueMode.SINGLE)
+                this._fixedResults.addFixedParameter(p);
     }
 
     public set graphType(t: GraphType) {
-- 
GitLab


From bd6738b156f12f753a5de8bdca8cebe6b9da326d Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Tue, 26 Jun 2018 10:03:54 +0200
Subject: [PATCH 17/41] =?UTF-8?q?=20#48=20FormComputeFixedVar=20:=20modif?=
 =?UTF-8?q?=20de=20getVariatedParameter()=20pour=20tenir=20compte=20des=20?=
 =?UTF-8?q?param=C3=A8tres=20li=C3=A9s=20=C3=A0=20un=20param=C3=A8tre=20va?=
 =?UTF-8?q?riable?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../definition/form-compute-fixedvar.ts           | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/app/formulaire/definition/form-compute-fixedvar.ts b/src/app/formulaire/definition/form-compute-fixedvar.ts
index 1955e9350..110235960 100644
--- a/src/app/formulaire/definition/form-compute-fixedvar.ts
+++ b/src/app/formulaire/definition/form-compute-fixedvar.ts
@@ -15,7 +15,20 @@ export class FormComputeFixedVar extends FormCompute {
     }
 
     private getVariatedParameter(): NgParameter {
-        return this._formBase.getDisplayedParamFromState(ParamRadioConfig.VAR);
+        let res = this._formBase.getDisplayedParamFromState(ParamRadioConfig.VAR);
+        if (res !== undefined)
+            return res;
+
+        const pms = this._formBase.getDisplayedParamListFromState(ParamRadioConfig.LINK);
+        for (const p of pms)
+            if (p.valueMode === ParamValueMode.LINK)
+                switch (p.paramDefinition.referencedParamValues.valueMode) {
+                    case ParamValueMode.LISTE:
+                    case ParamValueMode.MINMAX:
+                        return p;
+                }
+
+        return undefined;
     }
 
     private getComputedParameter(): NgParameter {
-- 
GitLab


From 57f770b29a6853f6b3ec8df151d99ee5ed0081af Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Tue, 26 Jun 2018 15:28:51 +0200
Subject: [PATCH 18/41] =?UTF-8?q?=20#48=20modif=20pour=20g=C3=A9rer=20les?=
 =?UTF-8?q?=20contraintes=20de=20mode=20de=20valeurs=20des=20param=C3=A8tr?=
 =?UTF-8?q?es=20quand=20on=20modifie=20le=20mode=20d'un=20param=C3=A8tre?=
 =?UTF-8?q?=20(un=20seul=20param=C3=A8tre=20=C3=A0=20CAL,=20un=20seul=20?=
 =?UTF-8?q?=C3=A0=20VAR,=20gestion=20du=20mode=20des=20param=C3=A8tres=20l?=
 =?UTF-8?q?i=C3=A9s)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../concrete/form-regime-uniforme.ts          |  1 -
 .../definition/form-def-fixedvar.ts           | 94 +++++++++++++++++--
 .../definition/form-def-paramcalc.ts          | 41 ++++++--
 3 files changed, 117 insertions(+), 19 deletions(-)

diff --git a/src/app/formulaire/definition/concrete/form-regime-uniforme.ts b/src/app/formulaire/definition/concrete/form-regime-uniforme.ts
index 50e7aeff7..0a920398a 100644
--- a/src/app/formulaire/definition/concrete/form-regime-uniforme.ts
+++ b/src/app/formulaire/definition/concrete/form-regime-uniforme.ts
@@ -75,7 +75,6 @@ export class FormulaireRegimeUniforme extends FormulaireDefinition implements Ob
 
     public reset() {
         super.reset();
-        this._formParamCalc.parseOptions(this.jsonConfig);
     }
 
     // interface Observer
diff --git a/src/app/formulaire/definition/form-def-fixedvar.ts b/src/app/formulaire/definition/form-def-fixedvar.ts
index 69afb546c..440272eff 100644
--- a/src/app/formulaire/definition/form-def-fixedvar.ts
+++ b/src/app/formulaire/definition/form-def-fixedvar.ts
@@ -19,7 +19,7 @@ export class FormDefFixedVar {
     /**
      * remet les radios de tous les paramètres à FIX sauf "me" et ceux (celui) à l'état "except"
      */
-    protected resetOtherRadio(me: NgParameter, except: ParamRadioConfig) {
+    protected resetOtherRadio(me: NgParameter, except: ParamRadioConfig = undefined) {
         for (const p of this._formBase.allFormElements) {
             if (p instanceof NgParameter)
                 if (p != me && p.radioState != except && p.radioState != ParamRadioConfig.LINK && p.radioConfig != ParamRadioConfig.FIX)
@@ -27,25 +27,103 @@ export class FormDefFixedVar {
         }
     }
 
+    /**
+     * gère un changement de mode pour un paramètre
+     * règles :
+     *   - 1 seul paramètre CAL à la fois
+     *   - 1 seul paramètre multivalué (VAR) à la fois (directement ou par liaison)
+     *   - plusieurs paramètres FIX à la fois possible
+     *   - plusieurs paramètres LINK à la fois possible si les 2 1ères règles sont respectées
+     * 
+     * analyse :
+     * ancien état    nouvel état    action(s)
+     * FIX            VAR            action1
+     * FIX            CAL            action2
+     * FIX            LINK           si paramètre lié FIX : aucune
+     *                               si paramètre lié VAR : action1
+     *                               si paramètre lié CAL : si valeur unique : aucune
+     *                                                      si valeur multiple : action1
+     *                               si paramètre lié LINK : recommencer ce cas avec le paramètre lié
+     * 
+     * VAR            FIX            aucune
+     * VAR            CAL            action2
+     * VAR            LINK           si paramètre lié FIX : aucune
+     *                               si paramètre lié VAR : aucune
+     *                               si paramètre lié CAL : si valeur unique : aucune
+     *                                                      si valeur multiple : aucune
+     *                               si paramètre lié LINK : recommencer ce cas avec le paramètre lié
+     * 
+     * CAL            FIX            action5
+     * CAL            VAR            action3 + action5
+     * CAL            LINK           si paramètre lié FIX : aucune
+     *                               si paramètre lié VAR : action3 + action4|action5
+     *                               si paramètre lié CAL : action3 + action4|action5
+     *                               si paramètre lié LINK : recommencer ce cas avec le paramètre lié
+     *
+     * action1 : reset (à FIX) de tous les autres paramètres que celui modifié sauf celui à CAL
+     * action2 : reset (à FIX) de tous les autres paramètres que celui modifié sauf celui/ceux à VAR
+     * action3 : reset (à FIX) de tous les autres paramètres que celui modifié
+     * action4 : mettre le paramètre désigné par la conf comme "par défault" à CAL
+     * action5 : mettre le 1er paramètre de la calculette à CAL
+     */
     protected processRadioStateChange(sourceParam: NgParameter, oldState: ParamValueMode) {
         switch (oldState) {
-            case ParamValueMode.SINGLE:
-                switch (sourceParam.valueMode) { // nouvel état
-                    case ParamValueMode.MINMAX:
+            case ParamValueMode.SINGLE:  // ancien état
+                switch (sourceParam.valueMode) {
+                    case ParamValueMode.MINMAX:  // nouvel état
                     case ParamValueMode.LISTE:
                         this.resetOtherRadio(sourceParam, ParamRadioConfig.CAL);
                         break;
 
-                    case ParamValueMode.CALCUL:
+                    case ParamValueMode.CALCUL:  // nouvel état
                         this.resetOtherRadio(sourceParam, ParamRadioConfig.VAR);
                         break;
+
+                    case ParamValueMode.LINK:  // nouvel état
+                        // mode du paramètre référencé
+                        const refParamValues = sourceParam.paramDefinition.referencedParamValues;
+                        switch (refParamValues.valueMode) {
+                            case ParamValueMode.MINMAX:
+                            case ParamValueMode.LISTE:
+                                this.resetOtherRadio(sourceParam, ParamRadioConfig.CAL);
+                                break;
+
+                            case ParamValueMode.CALCUL:
+                                if (refParamValues.hasMultipleValues)
+                                    this.resetOtherRadio(sourceParam, ParamRadioConfig.CAL);
+                                break;
+
+                            case ParamValueMode.LINK:
+                                throw new Error(`références de paramètre en chaîne non pris en charge`); // cas à traiter
+                        }
+                        break;
                 }
                 break;
 
-            case ParamValueMode.LISTE:
+            case ParamValueMode.LISTE:  // ancien état
             case ParamValueMode.MINMAX:
-                switch (sourceParam.valueMode) { // nouvel état
-                    case ParamValueMode.CALCUL:
+                switch (sourceParam.valueMode) {
+                    case ParamValueMode.CALCUL:  // nouvel état
+                        this.resetOtherRadio(sourceParam, ParamRadioConfig.VAR);
+                        break;
+
+                    case ParamValueMode.LINK:  // nouvel état
+                        // mode du paramètre référencé
+                        const refParamValues = sourceParam.paramDefinition.referencedParamValues;
+                        if (refParamValues.valueMode === ParamValueMode.LINK)
+                            throw new Error(`références de paramètre en chaîne non pris en charge`)
+                        break;
+                }
+                break;
+
+            case ParamValueMode.LINK:  // ancien état
+                switch (sourceParam.valueMode) {
+                    case ParamValueMode.MINMAX:  // nouvel état
+                    case ParamValueMode.LISTE:
+                        this.resetOtherRadio(sourceParam, ParamRadioConfig.CAL);
+                        break;
+
+                    case ParamValueMode.CALCUL:  // nouvel état
                         this.resetOtherRadio(sourceParam, ParamRadioConfig.VAR);
                         break;
                 }
diff --git a/src/app/formulaire/definition/form-def-paramcalc.ts b/src/app/formulaire/definition/form-def-paramcalc.ts
index 67bcd3939..4852c9449 100644
--- a/src/app/formulaire/definition/form-def-paramcalc.ts
+++ b/src/app/formulaire/definition/form-def-paramcalc.ts
@@ -38,28 +38,49 @@ export class FormDefParamToCalculate extends FormDefFixedVar {
     }
 
     /**
-     * met le paramètre par défaut à CAL
+     * met le paramètre par défaut à CAL sauf si c'est "except"
+     * @param except paramètre à ne pas remettre à CAL
      */
-    private setDefault(): NgParameter {
+    private setDefault(except: NgParameter = undefined): NgParameter {
         const defaultParamCal: NgParameter = this._formBase.getParamFromSymbol(this._defaultCalculatedParam);
-        defaultParamCal.valueMode = ParamValueMode.CALCUL;
+        if (except === undefined || defaultParamCal.uid !== except.uid)
+            defaultParamCal.valueMode = ParamValueMode.CALCUL;
         return defaultParamCal;
     }
 
+    /**
+     * @see FormDefFixedVar.processRadioStateChange pour l'analyse
+     */
     protected processRadioStateChange(sourceParam: NgParameter, oldState: ParamValueMode) {
         super.processRadioStateChange(sourceParam, oldState);
 
         switch (oldState) {
-            case ParamValueMode.CALCUL:
-                switch (sourceParam.valueMode) {  // nouvel état
-                    case ParamValueMode.SINGLE:
-                        this.setDefault();
+            case ParamValueMode.CALCUL:  // ancien état
+                switch (sourceParam.valueMode) {
+                    case ParamValueMode.SINGLE:  // nouvel état
+                        this.setDefault(sourceParam);
                         break;
 
-                    case ParamValueMode.MINMAX:
+                    case ParamValueMode.MINMAX:  // nouvel état
                     case ParamValueMode.LISTE:
-                        super.resetOtherRadio(sourceParam, ParamRadioConfig.CAL);
-                        this.setDefault();
+                        super.resetOtherRadio(sourceParam);
+                        this.setDefault(sourceParam);
+                        break;
+
+                    case ParamValueMode.LINK:  // nouvel état
+                        // mode du paramètre référencé
+                        const refParamValues = sourceParam.paramDefinition.referencedParamValues;
+                        switch (refParamValues.valueMode) {
+                            case ParamValueMode.MINMAX:
+                            case ParamValueMode.LISTE:
+                            case ParamValueMode.CALCUL:
+                                super.resetOtherRadio(sourceParam);
+                                this.setDefault();
+                                break;
+
+                            case ParamValueMode.LINK:
+                                throw new Error(`références de paramètre en chaîne non pris en charge`); // cas à traiter
+                        }
                         break;
                 }
         }
-- 
GitLab


From 615497d5ae5f0baf520dfd8854a05ce57de21178 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Wed, 27 Jun 2018 16:33:05 +0200
Subject: [PATCH 19/41] =?UTF-8?q?=20#48=20GenericCalculatorComponent.onRad?=
 =?UTF-8?q?ioClick()=20:=20modifs=20pour=20pouvoir=20appeler=20updateLinke?=
 =?UTF-8?q?dParameters()=20en=201er=20(pour=20MAJ=20les=20objets=20r=C3=A9?=
 =?UTF-8?q?f=C3=A9renc=C3=A9s=20quand=20on=20passe=20un=20param=C3=A8tre?=
 =?UTF-8?q?=20en=20mode=20LINK)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../calculator.component.ts                   | 23 ++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/app/components/generic-calculator/calculator.component.ts b/src/app/components/generic-calculator/calculator.component.ts
index 6a293b7bf..244026f1f 100644
--- a/src/app/components/generic-calculator/calculator.component.ts
+++ b/src/app/components/generic-calculator/calculator.component.ts
@@ -1,4 +1,4 @@
-import { Component, OnInit, DoCheck, OnDestroy, ViewChild, ViewChildren, QueryList } from "@angular/core";
+import { Component, OnInit, DoCheck, OnDestroy, ViewChild, ViewChildren, QueryList, AfterViewChecked } from "@angular/core";
 import { ActivatedRoute } from '@angular/router';
 
 import { Observer } from "jalhyd";
@@ -39,7 +39,7 @@ import { ServiceFactory } from "../../services/service-factory";
     `
     ]
 })
-export class GenericCalculatorComponent extends BaseComponent implements OnInit, DoCheck, OnDestroy, Observer {
+export class GenericCalculatorComponent extends BaseComponent implements OnInit, DoCheck, AfterViewChecked, OnDestroy, Observer {
     /**
      * liste des FieldSetComponent
      */
@@ -89,6 +89,14 @@ export class GenericCalculatorComponent extends BaseComponent implements OnInit,
      */
     private isCalculateDisabled: boolean = true;
 
+    /**
+     * flag (+info) indiquant un événement onRadio à traiter
+     * nécessaire avec l'introduction du mode de valeur LINK des paramètres car quand on modifie le mode à LINK, les possibles
+     * paramètres liables ne sont pas encore connus
+     */
+    private _pendingRadioClick: boolean = false;
+    private _pendingRadioClickInfo: any;
+
     // services
 
     private intlService: InternationalisationService;
@@ -193,8 +201,17 @@ export class GenericCalculatorComponent extends BaseComponent implements OnInit,
      * gestion des événements clic sur les radios
      */
     private onRadioClick(info: any) {
-        this._formulaire.onRadioClick(info);
         this.updateLinkedParameters();
+        this._pendingRadioClick = true;
+        this._pendingRadioClickInfo = info;
+    }
+
+    public ngAfterViewChecked() {
+        if (this._pendingRadioClick) {
+            this._pendingRadioClick = false;
+            this._formulaire.onRadioClick(this._pendingRadioClickInfo);
+            this._pendingRadioClickInfo = undefined;
+        }
     }
 
     private onCloseForm() {
-- 
GitLab


From 8a2ec5515639d85175e0121da6927f2b6b81b623 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Wed, 27 Jun 2018 16:38:18 +0200
Subject: [PATCH 20/41] =?UTF-8?q?=20#48=20modifs=20suite=20=C3=A0=20l'ajou?=
 =?UTF-8?q?t=20de=20NumberIterator=20dans=20jalHyd?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../components/remous-results/remous-results.component.ts   | 5 ++---
 src/app/formulaire/ngparam.ts                               | 6 +++---
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/app/components/remous-results/remous-results.component.ts b/src/app/components/remous-results/remous-results.component.ts
index 07bbca115..ee772b261 100644
--- a/src/app/components/remous-results/remous-results.component.ts
+++ b/src/app/components/remous-results/remous-results.component.ts
@@ -1,12 +1,11 @@
 import { Component, ViewChild } from "@angular/core";
 
-import { ArrayReverseIterator, ResultElement, ParamValueIterator } from "jalhyd";
+import { ArrayReverseIterator, ResultElement, NumberIterator } from "jalhyd";
 
 import { InternationalisationService } from "../../services/internationalisation/internationalisation.service";
 import { LogComponent } from "../../components/log/log.component";
 import { RemousResults } from "../../results/remous-results";
 import { CalculatorResults } from "../../results/calculator-results";
-import { VarResults } from "../../results/var-results";
 import { VarResultsComponent } from "../fixedvar-results/var-results.component";
 
 @Component({
@@ -159,7 +158,7 @@ export class RemousResultsComponent {
         return false;
     }
 
-    private get abscisseIterator(): ParamValueIterator {
+    private get abscisseIterator(): NumberIterator {
         return this._remousResults.varResults.variatedParameter.paramDefinition.paramValues.getValuesIterator();
     }
 
diff --git a/src/app/formulaire/ngparam.ts b/src/app/formulaire/ngparam.ts
index bc6effb9a..c075d73ea 100644
--- a/src/app/formulaire/ngparam.ts
+++ b/src/app/formulaire/ngparam.ts
@@ -1,4 +1,4 @@
-import { ParamDefinition, Pair, ParamDomain, ParamValueMode, ParamValueIterator, Nub, Observer, asObservable } from "jalhyd";
+import { ParamDefinition, Pair, ParamDomain, ParamValueMode, NumberIterator, Nub, Observer, asObservable } from "jalhyd";
 
 import { InputField } from "./input-field";
 import { Dependency } from "./dependency/dependency";
@@ -288,8 +288,8 @@ export class NgParameter extends InputField implements Observer {
         }
     }
 
-    public get valuesIterator(): ParamValueIterator {
-        return this._paramValues.getValuesIterator();
+    public get valuesIterator(): NumberIterator {
+        return this._paramDef.valuesIterator;
     }
 
     public updateLocalisation(loc: StringMap) {
-- 
GitLab


From bb103d98662048bc253ccfee4325f74838b9bed2 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Wed, 27 Jun 2018 16:41:32 +0200
Subject: [PATCH 21/41] =?UTF-8?q?=20#48=20modifs=20suite=20=C3=A0=20l'ajou?=
 =?UTF-8?q?t=20de=20hasMultipleValues=20dans=20IterableValues=20(jalHyd)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../definition/form-compute-fixedvar.ts       |  8 ++-----
 .../definition/form-def-fixedvar.ts           | 22 ++++++-------------
 .../definition/form-result-fixedvar.ts        |  2 +-
 3 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/src/app/formulaire/definition/form-compute-fixedvar.ts b/src/app/formulaire/definition/form-compute-fixedvar.ts
index 110235960..9285a6704 100644
--- a/src/app/formulaire/definition/form-compute-fixedvar.ts
+++ b/src/app/formulaire/definition/form-compute-fixedvar.ts
@@ -21,12 +21,8 @@ export class FormComputeFixedVar extends FormCompute {
 
         const pms = this._formBase.getDisplayedParamListFromState(ParamRadioConfig.LINK);
         for (const p of pms)
-            if (p.valueMode === ParamValueMode.LINK)
-                switch (p.paramDefinition.referencedParamValues.valueMode) {
-                    case ParamValueMode.LISTE:
-                    case ParamValueMode.MINMAX:
-                        return p;
-                }
+            if (p.paramDefinition.hasMultipleValues)
+                return p;
 
         return undefined;
     }
diff --git a/src/app/formulaire/definition/form-def-fixedvar.ts b/src/app/formulaire/definition/form-def-fixedvar.ts
index 440272eff..9016a8a30 100644
--- a/src/app/formulaire/definition/form-def-fixedvar.ts
+++ b/src/app/formulaire/definition/form-def-fixedvar.ts
@@ -80,21 +80,13 @@ export class FormDefFixedVar {
                         break;
 
                     case ParamValueMode.LINK:  // nouvel état
-                        // mode du paramètre référencé
-                        const refParamValues = sourceParam.paramDefinition.referencedParamValues;
-                        switch (refParamValues.valueMode) {
-                            case ParamValueMode.MINMAX:
-                            case ParamValueMode.LISTE:
-                                this.resetOtherRadio(sourceParam, ParamRadioConfig.CAL);
-                                break;
-
-                            case ParamValueMode.CALCUL:
-                                if (refParamValues.hasMultipleValues)
-                                    this.resetOtherRadio(sourceParam, ParamRadioConfig.CAL);
-                                break;
-
-                            case ParamValueMode.LINK:
-                                throw new Error(`références de paramètre en chaîne non pris en charge`); // cas à traiter
+                        if (sourceParam.paramDefinition.hasMultipleValues)
+                            this.resetOtherRadio(sourceParam, ParamRadioConfig.CAL);
+                        else {
+                            const refParamValues = sourceParam.paramDefinition.referencedParamValues;
+                            if (refParamValues !== undefined) // cad si on référence un paramètre et non un Result par ex
+                                if (refParamValues.valueMode == ParamValueMode.LINK)
+                                    throw new Error(`références de paramètre en chaîne non pris en charge`); // cas à traiter
                         }
                         break;
                 }
diff --git a/src/app/formulaire/definition/form-result-fixedvar.ts b/src/app/formulaire/definition/form-result-fixedvar.ts
index 27e04a353..695bc2059 100644
--- a/src/app/formulaire/definition/form-result-fixedvar.ts
+++ b/src/app/formulaire/definition/form-result-fixedvar.ts
@@ -42,7 +42,7 @@ export class FormResultFixedVar extends FormResult {
                 this._fixedResults.addFixedParameter(p);
 
         for (const p of this._formBase.getDisplayedParamListFromState(ParamRadioConfig.LINK))
-            if (p.paramDefinition.referencedParamValues.valueMode == ParamValueMode.SINGLE)
+            if (!p.paramDefinition.hasMultipleValues)
                 this._fixedResults.addFixedParameter(p);
     }
 
-- 
GitLab


From b5c1a82ecd889d77010a3f6f236a4354f14169cf Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Wed, 27 Jun 2018 16:42:55 +0200
Subject: [PATCH 22/41] =?UTF-8?q?=20#48=20NgParameter.linkToParameter()=20?=
 =?UTF-8?q?:=20modif=20pour=20g=C3=A9n=C3=A9raliser=20aux=20Result=20et=20?=
 =?UTF-8?q?r=C3=A9sultats=20compl=C3=A9mentaires?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/app/components/param-link/param-link.component.ts | 2 +-
 src/app/formulaire/ngparam.ts                         | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts
index 8ad07ff0c..a3428b963 100644
--- a/src/app/components/param-link/param-link.component.ts
+++ b/src/app/components/param-link/param-link.component.ts
@@ -141,7 +141,7 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy {
             this._currentIndex = index;
             const lp = this._linkableParams[index];
 
-            this._param.linkToParameter(lp.nub, lp.value);
+            this._param.linkToParameter(lp.nub, lp.name);
         }
     }
 
diff --git a/src/app/formulaire/ngparam.ts b/src/app/formulaire/ngparam.ts
index c075d73ea..2b31478c3 100644
--- a/src/app/formulaire/ngparam.ts
+++ b/src/app/formulaire/ngparam.ts
@@ -130,15 +130,15 @@ export class NgParameter extends InputField implements Observer {
     /**
      * crée le lien avec un paramètre
      */
-    public linkToParameter(n: Nub, p: ParamDefinition) {
-        const changed: boolean = this._paramDef.valueMode !== ParamValueMode.LINK || this._paramDef.referencedNub !== n || this._paramDef.referenceDefinition !== p.symbol;
+    public linkToParameter(n: Nub, ref: string) {
+        const changed: boolean = this._paramDef.valueMode !== ParamValueMode.LINK || this._paramDef.referencedNub !== n || this._paramDef.referenceDefinition !== ref;
         if (changed) {
             let o = asObservable(this._paramDef.referencedObject);
             if (o !== undefined)
                 o.removeObserver(this);
 
             this.valueMode = ParamValueMode.LINK;
-            this._paramDef.defineReference(n, p.symbol);
+            this._paramDef.defineReference(n, ref);
 
             o = asObservable(this._paramDef.referencedObject);
             if (o !== undefined)
@@ -146,7 +146,7 @@ export class NgParameter extends InputField implements Observer {
 
             this.notifyObservers({
                 "action": "valueLinkChange",
-                "value": this._paramDef.getValue()
+                "value": this.getValue()
             });
         }
     }
-- 
GitLab


From fcbdea6d7838b3a70eb3be97a9e5d196dee8aee7 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Wed, 27 Jun 2018 17:14:11 +0200
Subject: [PATCH 23/41]  #48 ParamService.createParameter() : correction du
 message d'erreur

---
 src/app/services/param/param.service.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/app/services/param/param.service.ts b/src/app/services/param/param.service.ts
index 0b5dea306..bdf292efe 100644
--- a/src/app/services/param/param.service.ts
+++ b/src/app/services/param/param.service.ts
@@ -84,7 +84,7 @@ export class ParamService {
                     break;
 
                 default:
-                    throw new Error(`ComputeNodeParameters.getParameter() : symbole ${symbol} non pris en charge`);
+                    throw new Error(`ParamService.createParameter() : symbole ${symbol} non pris en charge`);
             }
         }
 
-- 
GitLab


From 826e4324e109e98192cfac5179714e25cc086daa Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Wed, 27 Jun 2018 17:14:46 +0200
Subject: [PATCH 24/41] =?UTF-8?q?=20#48=20MAJ=20de=20la=20proc=C3=A9dure?=
 =?UTF-8?q?=20d'ajout=20de=20calculette?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 README.md | 30 ++++++------------------------
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/README.md b/README.md
index 529b343e4..154df00fd 100644
--- a/README.md
+++ b/README.md
@@ -129,51 +129,33 @@ and then :
 * Créer les tests unitaires correspondants
 
 
-* Ajouter une valeur à l'enum _ComputeNodeType_ pour identifier le type de noeud de calcul (par ex _MaCalculette_).
+* Ajouter une valeur à l'enum _CalculatorType_ pour identifier le type de calculette (par ex _MaCalculette_).
 
 
-* Compléter la méthode _ComputeNodeParameters.getComputeNodeParameters()_.
-
-	Si plusieurs valeurs de _ComputeNodeType_ font référence à la même calculette, n'ajouter les _case_ que pour les valeurs "concrètes". Par exemple, pour les sections paramétrées, il n'y a pas de _case_ pour la valeur _SectionParametree_ qui est générique.
+* Compléter la méthode _NubFactory.createNub()_.
 
 
 ## ngHyd
 
-* Créer les fichier de configuration de la calculette
+* Créer les fichiers de configuration de la calculette
 	- dans _src/app/calculators_ : créer un répertoire (par ex _ma-calculette_)
 
 	- dans _src/app/calculators/ma-calculette_ :
 	
 		Créer _ma-calculette.config.json_ sur le modèle des autres.
-		Les ids utilisés doivent correspondre au symbole fourni à classe _ParamDefinition_ (2ème paramètre du constructeur)
+		Les ids utilisés doivent correspondre au symbole fourni à classe _BaseParam_ (1er paramètre du constructeur)
 
 		Ne pas oublier de spécifier :
-			- le type de noeud de la calculette (dans l'objet comportant _"id":"options"_) avec le champ _"nodeType": "MaCalculette"_
-			- éventuellement le type de noeud de fieldset particuliers (objets comportant _"id":"fs_XXX"_) avec le champ _"nodeType": "MaCalculetteBleue"_
+			- éventuellement le type de noeud de paramètres particuliers (objets comportant _"type":"input"_) avec le champ _"nodeType": "MaCalculetteBleue"_
 
 	- dans _src/app/calculators/ma-calculette_ :
 	
 		Créer les fichiers d'internationalisation (_ma-calculette.&lt;langue&gt;.json_). Il doivent reprendre tous les ids utilisés dans le fichier de configuration et fournir leur traduction.
 
-* Dans le fichier *src/app/formulaire/formulaire-definition.ts* ajouter une valeur à l'enum _CalculatorType_ pour identifier la calculette.
-
-	On ne reprend pas directement l'enum _ComputeNodeType_ car celui ci sert à distinguer les variantes au sein d'une même calculette (par exemple les différentes sections paramétrées).
-
-* Composant CalculatorListComponent : ajouter une ligne à la methode _updateLocale()_ pour créer une nouvelle entrée dans la liste des calculettes disponibles.
-
 * _src/locale/error_messages.&lt;langue&gt;.json_ :
 	Ajouter un champ pour le titre de la calculette. Par exemple :
 		 _"INFO_MACALC_TITRE": "Ma calculette"_
 
-* Compléter la méthode _GenericCalculatorComponent.uitextTitre()_ avec cette valeur et la valeur de l'enum _CalculatorType_ correspondante.
+* Compléter la méthode _FormulaireService.getLocalisedTitleFromCalculatorType()_ avec cette valeur et la valeur de l'enum _CalculatorType_ correspondante.
 
 * Dans la méthode _FormulaireService.getConfigPathPrefix()_, compléter le _switch_ pour fournir le préfixe des fichiers de configuration/internationalisation.
-
-* Classe _ParamService_ : compléter le constructeur.
-
-* S'il existe plusieurs valeurs de _ComputeNodeType_ pour la même calculette, compléter les méthodes
-	- _FormulaireDefinition.getComputeNodeTypeFromSection()_.
-	- _ParamService.hasParameter()_
-
-* Compléter la méthode _FormulaireDefinition.doCompute()_.
-	En particulier, adapter les méthodes _getNubAndParameters()_ ou _getSectionNubAndParameters()_ (récupération des valeurs saisies dans l'interface).
-- 
GitLab


From 334137a3ed0c457bbbb338e377a90630dd62fae7 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Thu, 28 Jun 2018 10:02:08 +0200
Subject: [PATCH 25/41] =?UTF-8?q?=20#48=20FormDefParamToCalculate.processR?=
 =?UTF-8?q?adioStateChange()=20:=20correction=20d'un=20crash=20quand=20on?=
 =?UTF-8?q?=20passe=20en=20mode=20li=C3=A9=20et=20que=20la=20valeur=20cibl?=
 =?UTF-8?q?e=20n'est=20pas=20un=20param=C3=A8tre?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../definition/form-def-paramcalc.ts          | 29 ++++++++++++-------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/app/formulaire/definition/form-def-paramcalc.ts b/src/app/formulaire/definition/form-def-paramcalc.ts
index 4852c9449..de7d95b77 100644
--- a/src/app/formulaire/definition/form-def-paramcalc.ts
+++ b/src/app/formulaire/definition/form-def-paramcalc.ts
@@ -68,18 +68,25 @@ export class FormDefParamToCalculate extends FormDefFixedVar {
                         break;
 
                     case ParamValueMode.LINK:  // nouvel état
-                        // mode du paramètre référencé
-                        const refParamValues = sourceParam.paramDefinition.referencedParamValues;
-                        switch (refParamValues.valueMode) {
-                            case ParamValueMode.MINMAX:
-                            case ParamValueMode.LISTE:
-                            case ParamValueMode.CALCUL:
-                                super.resetOtherRadio(sourceParam);
-                                this.setDefault();
-                                break;
+                        if (sourceParam.paramDefinition.hasMultipleValues) {
+                            super.resetOtherRadio(sourceParam);
+                            this.setDefault();
+                        }
+                        else {
+                            // mode du paramètre référencé
+                            const refParamValues = sourceParam.paramDefinition.referencedParamValues;
+                            if (refParamValues !== undefined)
+                                switch (refParamValues.valueMode) {
+                                    case ParamValueMode.MINMAX:
+                                    case ParamValueMode.LISTE:
+                                    case ParamValueMode.CALCUL:
+                                        super.resetOtherRadio(sourceParam);
+                                        this.setDefault();
+                                        break;
 
-                            case ParamValueMode.LINK:
-                                throw new Error(`références de paramètre en chaîne non pris en charge`); // cas à traiter
+                                    case ParamValueMode.LINK:
+                                        throw new Error(`références de paramètre en chaîne non pris en charge`); // cas à traiter
+                                }
                         }
                         break;
                 }
-- 
GitLab


From 9af02e01c3d1cb2246be87d1dfc2de07c77b7bc3 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Thu, 28 Jun 2018 10:03:24 +0200
Subject: [PATCH 26/41] =?UTF-8?q?=20#48=20correction=20d'un=20bug=20:=20ou?=
 =?UTF-8?q?vrir=20une=20conduite=20distributrice,=20calculer=20Q,=20en=20o?=
 =?UTF-8?q?uvrir=20une=202=C3=A8me,=20lier=20Q=20=C3=A0=20celui=20de=20la?=
 =?UTF-8?q?=201=C3=A8re=20calculette=20(la=20valeur=20calcul=C3=A9e=20dans?=
 =?UTF-8?q?=20l'autre=20conduite=20est=20affich=C3=A9e),=20calculer,=20rep?=
 =?UTF-8?q?asser=20Q=20en=20mode=20fix=C3=A9=20:=20on=20ne=20retrouve=20pa?=
 =?UTF-8?q?s=20la=20valeur=20d'origine?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../components/param-field-line/param-field-line.component.ts  | 3 +++
 1 file changed, 3 insertions(+)

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 a741c7cb2..b07127bc2 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
@@ -223,7 +223,10 @@ export class ParamFieldLineComponent implements OnChanges {
         //console.log(`param ${this._param.valueMode} mode ${ParamValueMode[this._param.valueMode]}`);
         switch (option) {
             case "fix":
+                const oldValueMode = this._param.valueMode;
                 this._param.valueMode = ParamValueMode.SINGLE;
+                if (oldValueMode === ParamValueMode.LINK)
+                    this._param.setValue(this, this._param.paramDefinition.paramValues.singleValue);
                 break;
 
             case "var":
-- 
GitLab


From 7b58a038a77169f5d704c66a9a324423cc6feca7 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Thu, 28 Jun 2018 15:28:48 +0200
Subject: [PATCH 27/41] =?UTF-8?q?=20#48=20ParamLinkComponent.selectItemLab?=
 =?UTF-8?q?el()=20:=20ajout=20du=20cas=20des=20r=C3=A9sultats=20d'ouvrage?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/app/components/param-link/param-link.component.ts | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts
index a3428b963..ce5e4ff5b 100644
--- a/src/app/components/param-link/param-link.component.ts
+++ b/src/app/components/param-link/param-link.component.ts
@@ -107,6 +107,13 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy {
         const s = i.name; // nom associé au paramètre/à la valeur
         const c = i.formTitle; // nom de la calculette
 
+        const re5 = /(\d+)\.(.+)\.$/;  // forme <nombre>.xxx. (résultat d'ouvrage)
+        const match5 = re5.exec(s);
+        if (match5 !== null) {
+            const n = +match5[1] + 1
+            return `${match5[2]} (résultat de ${c}, ouvrage n°${n})`;
+        }
+
         const re1 = /([^\.]+)\.$/;  // forme xxx. (résultat)
         const match1 = re1.exec(s);
         if (match1 !== null)
-- 
GitLab


From f1ca551cb0acda3c1a83b253a2ec8b18e8f6d9ba Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Fri, 29 Jun 2018 10:29:18 +0200
Subject: [PATCH 28/41] =?UTF-8?q?=20#48=20ParamFieldLineComponent=20:=20mo?=
 =?UTF-8?q?dif=20pour=20les=20param=C3=A8tres=20dont=20la=20config=20est?=
 =?UTF-8?q?=20FIX=20(non=20variable,=20non=20calculable),=20par=20ex=20dan?=
 =?UTF-8?q?s=20les=20courbes=20de=20remous=20:=20quand=20on=20affiche=20le?=
 =?UTF-8?q?=20radio=20"li=C3=A9",=20on=20affiche=20aussi=20le=20radio=20"f?=
 =?UTF-8?q?ix=C3=A9"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../components/param-field-line/param-field-line.component.ts   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 b07127bc2..aa2969a55 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
@@ -103,7 +103,7 @@ export class ParamFieldLineComponent implements OnChanges {
     private hasRadioFix(): boolean {
         switch (this._param.radioConfig) {
             case ParamRadioConfig.FIX:
-                return false;
+                return this.hasRadioLink();
 
             default:
                 return true;
-- 
GitLab


From 233e10406ae099b01358c312607e11a4803ca273 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Fri, 29 Jun 2018 10:59:41 +0200
Subject: [PATCH 29/41] =?UTF-8?q?=20#48=20ParamFieldLineComponent=20:=20mo?=
 =?UTF-8?q?dif=20pour=20retrouver=20la=20valeur=20'single'=20du=20param?=
 =?UTF-8?q?=C3=A8tre=20quand=20on=20repasse=20en=20mode=20fix=C3=A9=20(g?=
 =?UTF-8?q?=C3=A9n=C3=A9ralisation=20du=20commit=209af02e0)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../param-field-line/param-field-line.component.ts           | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

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 aa2969a55..a0000052e 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
@@ -220,13 +220,11 @@ export class ParamFieldLineComponent implements OnChanges {
     private onRadioClick(option: string) {
         const oldValue = this._param.valueMode;
 
-        //console.log(`param ${this._param.valueMode} mode ${ParamValueMode[this._param.valueMode]}`);
         switch (option) {
             case "fix":
                 const oldValueMode = this._param.valueMode;
                 this._param.valueMode = ParamValueMode.SINGLE;
-                if (oldValueMode === ParamValueMode.LINK)
-                    this._param.setValue(this, this._param.paramDefinition.paramValues.singleValue);
+                this._param.setValue(this, this._param.paramDefinition.paramValues.singleValue);
                 break;
 
             case "var":
@@ -241,7 +239,6 @@ export class ParamFieldLineComponent implements OnChanges {
                 this._param.valueMode = ParamValueMode.LINK;
                 break;
         }
-        //console.log(`param ${this._param.valueMode} mode ${ParamValueMode[this._param.valueMode]}`);
 
         this.onRadio.emit({
             "param": this._param,
-- 
GitLab


From 91ab84d416a0624c336a73ef97a7c01ba2ccec04 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Fri, 29 Jun 2018 11:29:15 +0200
Subject: [PATCH 30/41] =?UTF-8?q?=20#48=20FormulaireService.getLinkableVal?=
 =?UTF-8?q?ues()=20:=20modif=20pour=20exclure=20des=20valeurs=20retourn?=
 =?UTF-8?q?=C3=A9es=20le=20r=C3=A9sultat=20du=20m=C3=AAme=20nom=20que=20le?=
 =?UTF-8?q?=20param=C3=A8tre=20donn=C3=A9=20quand=20ce=20param=C3=A8tre=20?=
 =?UTF-8?q?appartient=20au=20Nub=20courant=20de=20la=20boucle=20(ex=20:=20?=
 =?UTF-8?q?cr=C3=A9er=20une=20conduite=20distributrice,=20calculer=20Q,=20?=
 =?UTF-8?q?ouvrir=20une=202=C3=A8me=20conduite,=20revenir=20=C3=A0=20la=20?=
 =?UTF-8?q?1=C3=A8re,=20passer=20en=20Q=20en=20mode=20li=C3=A9=20:=20le=20?=
 =?UTF-8?q?r=C3=A9sultat=20calcul=C3=A9=20pr=C3=A9c=C3=A9demment=20apparai?=
 =?UTF-8?q?t=20dans=20la=20liste=20des=20valeurs=20liables=20(ne=20devrait?=
 =?UTF-8?q?=20pas))?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../services/formulaire/formulaire.service.ts | 27 +++++++------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/src/app/services/formulaire/formulaire.service.ts b/src/app/services/formulaire/formulaire.service.ts
index 07a2cee36..6e5409a62 100644
--- a/src/app/services/formulaire/formulaire.service.ts
+++ b/src/app/services/formulaire/formulaire.service.ts
@@ -471,32 +471,23 @@ export class FormulaireService extends Observable {
     }
 
     /**
-     * @returns liste des paramètres liables à un paramètre sous la forme d'un tableau d'objets
+     * @returns liste des valeurs liables à un paramètre sous la forme d'un tableau d'objets
      * {"param":<paramètre lié>, "nub":<Nub d'origine du paramètre lié>, "formTitle":<nom de la calculette liée au nub>}
-     * @param symbol symbole (Q, J, ...) du paramètre qui sert de clé de recherche des paramètres liables
+     * @param p paramètre qui sert de clé de recherche des paramètres liables
      */
-    // public getLinkableParameters(p: NgParameter): any[] {
-    //     let res: any[] = [];
-
-    //     if (p !== undefined)
-    //         for (const f of this._formulaires) {
-    //             const sn = f.currentSessionNub;
-    //             const ps = sn.getLinkableParameters(p.paramDefinition);
-    //             for (const np of ps) {
-    //                 np["formTitle"] = f.calculatorName;
-    //                 res.push(np);
-    //             }
-    //         }
-
-    //     return res;
-    // }
     public getLinkableValues(p: NgParameter): any[] {
         let res: any[] = [];
 
         if (p !== undefined)
             for (const f of this._formulaires) {
+                // nub associé au formulaire
                 const sn = f.currentSessionNub;
-                const ps = sn.getLinkableValues(p.paramDefinition);
+
+                // on vérifie que le paramètre en entrée appartient au nub
+                const np = sn.nub.getParameter(p.symbol);
+
+                // si oui, on demande à exclure des valeurs retournées le résultat du même nom que le paramètre
+                const ps = sn.getLinkableValues(p.paramDefinition, p.paramDefinition.uid === np.uid);
                 for (const np of ps) {
                     np["formTitle"] = f.calculatorName;
                     res.push(np);
-- 
GitLab


From 2f1c278393cff16cc4296b742cc65cb58ace81c7 Mon Sep 17 00:00:00 2001
From: David Dorchies <david.dorchies@irstea.fr>
Date: Wed, 4 Jul 2018 14:09:28 +0200
Subject: [PATCH 31/41] =?UTF-8?q?Correction=20bug=20affichage=20libell?=
 =?UTF-8?q?=C3=A9=20Sections=20param=C3=A9tr=C3=A9es=20suite=20=C3=A0=2035?=
 =?UTF-8?q?56b203?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../section-results.component.ts              | 11 +++---
 src/locale/error_messages.fr.json             | 38 +++++++++----------
 2 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/src/app/components/section-results/section-results.component.ts b/src/app/components/section-results/section-results.component.ts
index 0656b917a..f296b115b 100644
--- a/src/app/components/section-results/section-results.component.ts
+++ b/src/app/components/section-results/section-results.component.ts
@@ -16,12 +16,12 @@ import { InternationalisationService } from '../../services/internationalisation
         text-align: right;
         padding-top:10px;
         padding-bottom:10px;
-        padding-right:10px;   
+        padding-right:10px;
     }
     .result_value {
         text-align: center;
-        padding-left:30px;   
-        padding-right:30px;   
+        padding-left:30px;
+        padding-right:30px;
     }
     .result_id_0 {
         background-color: #f0f0f0;
@@ -82,7 +82,7 @@ export class SectionResultsComponent implements DoCheck {
             this._doUpdate = this._results.hasResults;
     }
 
-    /** 
+    /**
      * appelé pour gérer les changements non détectés par Angular
      */
     public ngDoCheck() {
@@ -105,8 +105,7 @@ export class SectionResultsComponent implements DoCheck {
 
             // traduction des symboles des variables calculées
             for (const k in this._results.result.extraResults) {
-                const k2 = "INFO_GRANDEUR_" + k.toUpperCase();
-                const lbl = this.intlService.localizeText(k2);
+                const lbl = k.toUpperCase();
                 const er = this._results.result.getExtraResult(k);
                 this._resultElement.addExtraResult(lbl, er);
 
diff --git a/src/locale/error_messages.fr.json b/src/locale/error_messages.fr.json
index 34ea96170..e1dfb10f2 100644
--- a/src/locale/error_messages.fr.json
+++ b/src/locale/error_messages.fr.json
@@ -50,24 +50,7 @@
     "INFO_LECHAPTCALMON_TITRE": "Lechapt-Calmon",
     "INFO_REGIMEUNIFORME_TITRE": "Régime uniforme",
     "INFO_SECTIONPARAMETREE_TITRE": "Section paramétrée",
-    "INFO_GRANDEUR_Q": "Débit (m³/s)",
-    "INFO_GRANDEUR_HS": "La charge spécifique (m)",
-    "INFO_GRANDEUR_HSC": "La charge critique (m)",
-    "INFO_GRANDEUR_B": "La largeur au miroir (m)",
-    "INFO_GRANDEUR_P": "Le périmètre mouillé (m)",
-    "INFO_GRANDEUR_S": "La surface mouillée  (m²)",
-    "INFO_GRANDEUR_R": "Le rayon hydraulique  (m)",
-    "INFO_GRANDEUR_V": "La vitesse moyenne  (m/s)",
-    "INFO_GRANDEUR_FR": "Le Froude",
-    "INFO_GRANDEUR_YC": "Le tirant d'eau critique (m)",
-    "INFO_GRANDEUR_YN": "Le tirant d'eau normal (m)",
-    "INFO_GRANDEUR_YF": "Le tirant d'eau fluvial (m)",
-    "INFO_GRANDEUR_YT": "Le tirant d'eau torrentiel (m)",
-    "INFO_GRANDEUR_YCO": "Le tirant d'eau conjugué (m)",
-    "INFO_GRANDEUR_J": "La perte de charge (m)",
-    "INFO_GRANDEUR_I-J": "Variation linéaire de l'énergie spécifique (m/m)",
-    "INFO_GRANDEUR_IMP": "Impulsion (N)",
-    "INFO_GRANDEUR_TAU0": "La force tractrice (Pa)",
+
     "INFO_COURBEREMOUS_TITRE": "Courbes de remous",
     "INFO_REMOUSRESULTS_TITREJOURNAL": "Journal de calcul",
     "INFO_REMOUSRESULTS_ABSCISSE": "Abscisse (m)",
@@ -96,10 +79,27 @@
     "INFO_EXTRARES_LIB_OUVRAGE_Q": "Débit (m³/s)",
     "INFO_EXTRARES_LIB_OUVRAGE_Q_MODE": "Type d'écoulement",
     "INFO_EXTRARES_LIB_OUVRAGE_Q_REGIME": "Régime",
-    "INFO_EXTRARES_LIB_V": "V: Vitesse (m/s)",
     "INFO_EXTRARES_LIB_EC": "EC: Énergie cinétique (m)",
     "INFO_EXTRARES_LIB_CV": "Cv: Coefficient de vitesse d'approche",
     "INFO_EXTRARES_LIB_CVQT": "CV.QT: Débit corrigé (m³/s)",
+    "INFO_EXTRARES_LIB_Q": "Débit (m³/s)",
+    "INFO_EXTRARES_LIB_HS": "Charge spécifique (m)",
+    "INFO_EXTRARES_LIB_HSC": "Charge critique (m)",
+    "INFO_EXTRARES_LIB_B": "Largeur au miroir (m)",
+    "INFO_EXTRARES_LIB_P": "Périmètre mouillé (m)",
+    "INFO_EXTRARES_LIB_S": "Surface mouillée  (m²)",
+    "INFO_EXTRARES_LIB_R": "Rayon hydraulique  (m)",
+    "INFO_EXTRARES_LIB_V": "Vitesse moyenne  (m/s)",
+    "INFO_EXTRARES_LIB_FR": "Froude",
+    "INFO_EXTRARES_LIB_YC": "Tirant d'eau critique (m)",
+    "INFO_EXTRARES_LIB_YN": "Tirant d'eau normal (m)",
+    "INFO_EXTRARES_LIB_YF": "Tirant d'eau fluvial (m)",
+    "INFO_EXTRARES_LIB_YT": "Tirant d'eau torrentiel (m)",
+    "INFO_EXTRARES_LIB_YCO": "Tirant d'eau conjugué (m)",
+    "INFO_EXTRARES_LIB_J": "Perte de charge (m)",
+    "INFO_EXTRARES_LIB_I-J": "Variation linéaire de l'énergie spécifique (m/m)",
+    "INFO_EXTRARES_LIB_IMP": "Impulsion (N)",
+    "INFO_EXTRARES_LIB_TAU0": "Force tractrice (Pa)",
 
     "INFO_EXTRARES_ENUM_OUVRAGE_Q_MODE_0": "Surface libre",
     "INFO_EXTRARES_ENUM_OUVRAGE_Q_MODE_1": "En charge",
-- 
GitLab


From 1714a2abe2f76602f5d278c85de4ea86fe1f9975 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Wed, 4 Jul 2018 16:35:48 +0200
Subject: [PATCH 32/41] =?UTF-8?q?=20#48=20d=C3=A9placement=20de=20parentFo?=
 =?UTF-8?q?rm()=20de=20FieldSet=20vers=20FormulaireElement?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/app/formulaire/fieldset.ts           | 10 ----------
 src/app/formulaire/formulaire-element.ts | 10 ++++++++++
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/app/formulaire/fieldset.ts b/src/app/formulaire/fieldset.ts
index af553da83..03b705446 100644
--- a/src/app/formulaire/fieldset.ts
+++ b/src/app/formulaire/fieldset.ts
@@ -40,16 +40,6 @@ export class FieldSet extends FormulaireElement implements Observer {
         this._props = new Props();
     }
 
-    /**
-     * formulaire parent
-     */
-    private get parentForm(): FormulaireDefinition {
-        let res = this.parent;
-        while (!(res instanceof FormulaireDefinition))
-            res = res.parent;
-        return res as FormulaireDefinition;
-
-    }
     public get sessionNub(): SessionNub {
         return this._sessionNub;
     }
diff --git a/src/app/formulaire/formulaire-element.ts b/src/app/formulaire/formulaire-element.ts
index 943115839..27b7c0bbb 100644
--- a/src/app/formulaire/formulaire-element.ts
+++ b/src/app/formulaire/formulaire-element.ts
@@ -59,6 +59,16 @@ export abstract class FormulaireElement extends FormulaireNode {
         return super.kids as FormulaireElement[];
     }
 
+    /**
+     * formulaire parent
+     */
+    public get parentForm(): FormulaireDefinition {
+        let res = this.parent;
+        while (!(res instanceof FormulaireDefinition))
+            res = res.parent;
+        return res as FormulaireDefinition;
+    }
+
     /**
      * analyse les dépendances d'existence
      * @param json configuration de la dépendance
-- 
GitLab


From 0a83ab8226327fdfa76d16175cedb5d74923f0e3 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Wed, 4 Jul 2018 16:47:35 +0200
Subject: [PATCH 33/41] =?UTF-8?q?=20#48=20modifs=20pour=20casser=20une=20d?=
 =?UTF-8?q?=C3=A9pendance=20circulaire=20des=20imports=20-=20suppression?=
 =?UTF-8?q?=20des=20imports=20inutiles=20-=20r=C3=A9impl=C3=A9mentation=20?=
 =?UTF-8?q?de=20FormulaireElement.parentForm()=20-=20suppression=20du=20pa?=
 =?UTF-8?q?ram=C3=A8tre=20inutile=20de=20ForumlaireElement.applyDependenci?=
 =?UTF-8?q?es()?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../generic-calculator/calculator.component.ts      |  2 +-
 src/app/formulaire/check-field.ts                   |  3 ---
 src/app/formulaire/definition/form-definition.ts    |  9 ++-------
 src/app/formulaire/fieldset-container.ts            |  4 ----
 src/app/formulaire/fieldset.ts                      | 10 ++++------
 src/app/formulaire/formulaire-element.ts            | 13 ++++++-------
 src/app/formulaire/input-field.ts                   |  2 --
 7 files changed, 13 insertions(+), 30 deletions(-)

diff --git a/src/app/components/generic-calculator/calculator.component.ts b/src/app/components/generic-calculator/calculator.component.ts
index 244026f1f..2b0a443f9 100644
--- a/src/app/components/generic-calculator/calculator.component.ts
+++ b/src/app/components/generic-calculator/calculator.component.ts
@@ -113,7 +113,7 @@ export class GenericCalculatorComponent extends BaseComponent implements OnInit,
     private get formElements(): FormulaireElement[] {
         if (this._formulaire == undefined)
             return [];
-        return this._formulaire.formElements;
+        return this._formulaire.kids as FormulaireElement[];
     }
 
     /**
diff --git a/src/app/formulaire/check-field.ts b/src/app/formulaire/check-field.ts
index 95f1afcdb..f508e699a 100644
--- a/src/app/formulaire/check-field.ts
+++ b/src/app/formulaire/check-field.ts
@@ -1,7 +1,4 @@
 import { Field } from "./field";
-import { Dependency } from "./dependency/dependency";
-import { DependencyConditionType } from "./dependency/dependency-condition";
-import { FormulaireDefinition } from "./definition/form-definition";
 import { FormulaireNode } from "./formulaire-node";
 
 export class CheckField extends Field {
diff --git a/src/app/formulaire/definition/form-definition.ts b/src/app/formulaire/definition/form-definition.ts
index c9d050696..85656392c 100644
--- a/src/app/formulaire/definition/form-definition.ts
+++ b/src/app/formulaire/definition/form-definition.ts
@@ -14,7 +14,6 @@ import { DeepFieldsetIterator } from "../form-iterator/deep-fieldset-iterator";
 import { DeepFormulaireElementIterator } from "../form-iterator/deep-element-iterator";
 import { TopFormulaireElementIterator } from "../form-iterator/top-element-iterator";
 import { CalculatorResults } from "../../results/calculator-results";
-import { FieldsetTemplate } from "../fieldset-template";
 
 /**
  * classe de base pour tous les formulaires
@@ -183,7 +182,7 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs
     private parse_template_container(json: {}, templates: any[]) {
         const fsc: FieldsetContainer = new FieldsetContainer(this);
         fsc.parseConfig(json, templates);
-        this.formElements.push(fsc);
+        this.kids.push(fsc);
     }
 
     public parseDependencies(json: {}) {
@@ -383,13 +382,9 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs
         return select.getValue().label;
     }
 
-    public get formElements(): FormulaireElement[] {
-        return this.kids as FormulaireElement[];
-    }
-
     public applyDependencies() {
         for (const fe of this.topFormElements)
-            fe.applyDependencies(this);
+            fe.applyDependencies();
     }
 
     public abstract resetResults();
diff --git a/src/app/formulaire/fieldset-container.ts b/src/app/formulaire/fieldset-container.ts
index 1f384a140..6d8c093b0 100644
--- a/src/app/formulaire/fieldset-container.ts
+++ b/src/app/formulaire/fieldset-container.ts
@@ -1,12 +1,8 @@
-import { Structure } from "jalhyd";
-
 import { FormulaireElement } from "./formulaire-element";
 import { FieldSet } from "./fieldset";
 import { FieldsetTemplate } from "./fieldset-template";
-import { Dependency } from "./dependency/dependency";
 import { StringMap } from "../stringmap";
 import { FormulaireNode } from "./formulaire-node";
-import { FormulaireParallelStructure } from "./definition/concrete/form-parallel-structures";
 
 export class FieldsetContainer extends FormulaireElement {
     private _templates: FieldsetTemplate[];
diff --git a/src/app/formulaire/fieldset.ts b/src/app/formulaire/fieldset.ts
index 03b705446..9cff04ec9 100644
--- a/src/app/formulaire/fieldset.ts
+++ b/src/app/formulaire/fieldset.ts
@@ -1,8 +1,6 @@
 import { CalculatorType, ComputeNodeType, ParamDefinition, LoiDebit, StructureType, Props, SessionNub, Observer } from "jalhyd";
 
 import { FormulaireElement } from "./formulaire-element";
-import { Dependency } from "./dependency/dependency";
-import { DependencyConditionType } from "./dependency/dependency-condition";
 import { Field } from "./field";
 import { CheckField } from "./check-field";
 import { SelectField } from "./select-field";
@@ -11,7 +9,6 @@ import { ServiceFactory } from "../services/service-factory";
 import { ParamService } from "../services/param/param.service";
 import { FormulaireDefinition } from "./definition/form-definition";
 import { StringMap } from "../stringmap";
-import { FieldsetContainer } from "./fieldset-container";
 import { FormulaireNode } from "./formulaire-node";
 
 export class FieldSet extends FormulaireElement implements Observer {
@@ -232,7 +229,7 @@ export class FieldSet extends FormulaireElement implements Observer {
 
         // fin MAJ selects
 
-        this.applyDependencies(this.parentForm);
+        this.applyDependencies();
     }
 
     public parseConfig(json: {}, data?: {}) {
@@ -240,12 +237,13 @@ export class FieldSet extends FormulaireElement implements Observer {
 
         this._confId = json["id"];
 
+        const parentForm = this.parentForm as FormulaireDefinition;
         const ct: string = json["calcType"];
-        const calc_type: CalculatorType = ct == undefined ? this.parentForm.calculatorType : CalculatorType[ct];
+        const calc_type: CalculatorType = ct == undefined ? parentForm.calculatorType : CalculatorType[ct];
         this.setPropValue("calcType", calc_type);
 
         const dnt: string = json["defaultNodeType"];
-        const node_type: ComputeNodeType = dnt == undefined ? this.parentForm.nodeType : ComputeNodeType[dnt];
+        const node_type: ComputeNodeType = dnt == undefined ? parentForm.nodeType : ComputeNodeType[dnt];
         this.setPropValue("nodeType", node_type);
 
         const st: string = json["defaultStructType"];
diff --git a/src/app/formulaire/formulaire-element.ts b/src/app/formulaire/formulaire-element.ts
index 27b7c0bbb..5fe3851bd 100644
--- a/src/app/formulaire/formulaire-element.ts
+++ b/src/app/formulaire/formulaire-element.ts
@@ -2,10 +2,8 @@ import { FormulaireNode } from "./formulaire-node"
 import { StringMap } from "../stringmap";
 import { Dependency } from "./dependency/dependency";
 import { DependencyCondition, DependencyConditionType } from "./dependency/dependency-condition";
-import { ValueDependency } from "./dependency/value-dependency";
 import { ValueDependencyCondition } from "./dependency/value-dependency-condition";
 import { ExistenceDependency } from "./dependency/existence-dependency";
-import { FormulaireDefinition } from "./definition/form-definition";
 import { DeepFormulaireElementIterator } from "./form-iterator/deep-element-iterator";
 
 /** 
@@ -62,11 +60,12 @@ export abstract class FormulaireElement extends FormulaireNode {
     /**
      * formulaire parent
      */
-    public get parentForm(): FormulaireDefinition {
+    public get parentForm(): FormulaireNode {
         let res = this.parent;
-        while (!(res instanceof FormulaireDefinition))
+        //while (!(res instanceof FormulaireDefinition))
+        while (!("calculatorName" in res)) // pour éviter de faire référence au type FormulaireDefinition, supprimer l'import correspondant et casser les dépendances circulaires d'import
             res = res.parent;
-        return res as FormulaireDefinition;
+        return res;
     }
 
     /**
@@ -137,7 +136,7 @@ export abstract class FormulaireElement extends FormulaireNode {
             }
     }
 
-    public applyDependencies(parentForm: FormulaireDefinition) {
+    public applyDependencies() {
         this.prepareExistenceDependencies();
 
         for (let d of this._dependencies) {
@@ -145,7 +144,7 @@ export abstract class FormulaireElement extends FormulaireNode {
         }
 
         for (const k of this.getKids())
-            k.applyDependencies(parentForm);
+            k.applyDependencies();
     }
 
     public printDependencies() {
diff --git a/src/app/formulaire/input-field.ts b/src/app/formulaire/input-field.ts
index 3aa574a33..933e2c626 100644
--- a/src/app/formulaire/input-field.ts
+++ b/src/app/formulaire/input-field.ts
@@ -1,6 +1,4 @@
 import { Field } from "./field"
-import { FormulaireDefinition } from "./definition/form-definition";
-
 
 export abstract class InputField extends Field {
     private _value: any;
-- 
GitLab


From 89ed537f4b1c3a3b4910eb057306add28540c4b5 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Wed, 4 Jul 2018 17:23:25 +0200
Subject: [PATCH 34/41]  #48 correction d'un crash dans
 FormulaireService.getLinkableValues()

---
 src/app/services/formulaire/formulaire.service.ts | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/app/services/formulaire/formulaire.service.ts b/src/app/services/formulaire/formulaire.service.ts
index 62304f2e8..4c16d9a1f 100644
--- a/src/app/services/formulaire/formulaire.service.ts
+++ b/src/app/services/formulaire/formulaire.service.ts
@@ -470,11 +470,13 @@ export class FormulaireService extends Observable {
                 // on vérifie que le paramètre en entrée appartient au nub
                 const np = sn.nub.getParameter(p.symbol);
 
-                // si oui, on demande à exclure des valeurs retournées le résultat du même nom que le paramètre
-                const ps = sn.getLinkableValues(p.paramDefinition, p.paramDefinition.uid === np.uid);
-                for (const np of ps) {
-                    np["formTitle"] = f.calculatorName;
-                    res.push(np);
+                if (np !== undefined) {
+                    // si oui, on demande à exclure des valeurs retournées le résultat du même nom que le paramètre
+                    const ps = sn.getLinkableValues(p.paramDefinition, p.paramDefinition.uid === np.uid);
+                    for (const np of ps) {
+                        np["formTitle"] = f.calculatorName;
+                        res.push(np);
+                    }
                 }
             }
 
-- 
GitLab


From 24e3b8ffbb64edbf5762883c4d8b80b2009f9afd Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Wed, 4 Jul 2018 17:37:59 +0200
Subject: [PATCH 35/41] =?UTF-8?q?=20#48=20ParamLinkComponent.updateParamLi?=
 =?UTF-8?q?st()=20:=20filtrage=20des=20param=C3=A8tres=20liables=20retourn?=
 =?UTF-8?q?=C3=A9s=20par=20jalHyd=20en=20supprimant=20ceux=20non=20affich?=
 =?UTF-8?q?=C3=A9s=20dans=20leur=20parent=20respectif=20(cas=20de=20Q/Z1/Z?=
 =?UTF-8?q?2...=20dans=20les=20ouvrages=20enfants=20des=20ouvrages=20paral?=
 =?UTF-8?q?l=C3=A8les)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../param-link/param-link.component.ts        | 32 +++++++++++++++++--
 .../services/formulaire/formulaire.service.ts | 11 ++++++-
 2 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts
index ce5e4ff5b..0c368e15f 100644
--- a/src/app/components/param-link/param-link.component.ts
+++ b/src/app/components/param-link/param-link.component.ts
@@ -2,8 +2,9 @@ import { Component, Input, Output, EventEmitter, OnChanges, OnDestroy } from "@a
 
 import { NgParameter } from "../../formulaire/ngparam";
 import { ServiceFactory } from "../../services/service-factory";
-import { ParamValueMode, Observer } from "jalhyd";
+import { ParamValueMode, Observer, ParamDefinition } from "jalhyd";
 import { FormulaireService } from "../../services/formulaire/formulaire.service";
+import { FormulaireDefinition } from "../../formulaire/definition/form-definition";
 
 @Component({
     selector: "param-link",
@@ -154,8 +155,33 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy {
 
     public updateParamList() {
         // liste des paramètres liables
-        // this._linkableParams = this._formService.getLinkableParameters(this._param);
-        this._linkableParams = this._formService.getLinkableValues(this._param);
+        if (this._param.valueMode == ParamValueMode.LINK)
+            this._linkableParams = this._formService.getLinkableValues(this._param);
+        else
+            this._linkableParams = [];
+
+        // suppression des paramètres non affichés
+
+        for (let i = this._linkableParams.length - 1; i >= 0; i--) {
+            // pour chaque paramètre...
+            const prm: ParamDefinition = this._linkableParams[i].value;
+
+            const parentForm: FormulaireDefinition = ServiceFactory.instance.formulaireService.getParamdefParentForm(prm);
+
+            // ... on cherche s'il est affiché dans son parent
+            // (ce n'est pas le cas par ex pour Q, Z1, Z2 dans les ouvrages enfants des ouvrages //)
+            let found: boolean = false;
+            if (parentForm !== undefined)
+                for (const fe of parentForm.allFormElements)
+                    if (fe instanceof NgParameter)
+                        if (fe.paramDefinition.uid === prm.uid) {
+                            found = true;
+                            break;
+                        }
+
+            if (!found)
+                this._linkableParams.splice(i, 1);
+        }
 
         // initialisation de l'indice courant
         if (this._linkableParams.length > 0) {
diff --git a/src/app/services/formulaire/formulaire.service.ts b/src/app/services/formulaire/formulaire.service.ts
index 4c16d9a1f..d6feac924 100644
--- a/src/app/services/formulaire/formulaire.service.ts
+++ b/src/app/services/formulaire/formulaire.service.ts
@@ -5,7 +5,7 @@ import "rxjs/add/operator/toPromise";
 import { decode } from "he";
 import { saveAs } from "file-saver";
 
-import { CalculatorType, EnumEx, Observable } from "jalhyd";
+import { CalculatorType, EnumEx, Observable, ParamDefinition } from "jalhyd";
 
 import { ServiceFactory } from "../service-factory";
 import { HttpService } from "../../services/http/http.service";
@@ -249,6 +249,15 @@ export class FormulaireService extends Observable {
         return undefined;
     }
 
+    public getParamdefParentForm(prm: ParamDefinition): FormulaireDefinition {
+        for (const f of this._formulaires)
+            for (const p of f.allFormElements)
+                if (p instanceof NgParameter)
+                    if (p.paramDefinition.uid === prm.uid)
+                        return f;
+        return undefined;
+    }
+
     public getConfigPathPrefix(ct: CalculatorType): string {
         if (ct == undefined)
             throw "FormulaireService.getConfigPathPrefix() : invalid undefined CalculatorType"
-- 
GitLab


From 81964ae0a321a71061917a5a2496b0463582b1bd Mon Sep 17 00:00:00 2001
From: David Dorchies <david.dorchies@irstea.fr>
Date: Wed, 4 Jul 2018 23:00:58 +0200
Subject: [PATCH 36/41] =?UTF-8?q?Ajout=20de=20la=20configuration=20pour=20?=
 =?UTF-8?q?le=20d=C3=A9bogage?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .vscode/launch.json | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 .vscode/launch.json

diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 000000000..560298a30
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,24 @@
+{
+    // Use IntelliSense to learn about possible attributes.
+    // Hover to view descriptions of existing attributes.
+    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+    "version": "0.2.0",
+    "configurations": [
+        {
+            "type": "chrome",
+            "request": "launch",
+            "name": "Launch Chrome (local webserver)",
+            "url": "http://localhost:4200",
+            "webRoot": "${workspaceFolder}",
+            "runtimeExecutable": "/usr/bin/chromium-browser"
+        },
+        {
+            "name": "Launch Firefox (local webserver)",
+            "type": "firefox",
+            "request": "launch",
+            "reAttach": true,
+            "url": "http://localhost:4200",
+            "webRoot": "${workspaceFolder}"
+        }
+    ]
+}
\ No newline at end of file
-- 
GitLab


From b2b64ff29f02557b6ab85ce58988d568c6e4e536 Mon Sep 17 00:00:00 2001
From: David Dorchies <david.dorchies@irstea.fr>
Date: Wed, 4 Jul 2018 23:10:12 +0200
Subject: [PATCH 37/41] =?UTF-8?q?Correction=20de=20la=20gestion=20des=20li?=
 =?UTF-8?q?bell=C3=A9s=20pour=20courbe=20de=20remous=20et=20sections=20par?=
 =?UTF-8?q?am=C3=A9tr=C3=A9es=20suite=20=C3=A0=203556b20361?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../remous-results.component.ts               | 201 ++++++++++--------
 .../vertical-result-element.component.ts      |   2 +-
 .../definition/concrete/form-courbe-remous.ts |   1 -
 .../definition/form-compute-courbe-remous.ts  |  17 +-
 src/app/formulaire/ngparam.ts                 |  12 +-
 src/app/results/remous-results.ts             |  16 +-
 src/app/results/var-results.ts                |   2 +-
 .../internationalisation.service.ts           |   6 +-
 src/locale/error_messages.fr.json             |   6 +-
 9 files changed, 145 insertions(+), 118 deletions(-)

diff --git a/src/app/components/remous-results/remous-results.component.ts b/src/app/components/remous-results/remous-results.component.ts
index ee772b261..a986c11d1 100644
--- a/src/app/components/remous-results/remous-results.component.ts
+++ b/src/app/components/remous-results/remous-results.component.ts
@@ -16,12 +16,12 @@ import { VarResultsComponent } from "../fixedvar-results/var-results.component";
         text-align: right;
         padding-top:10px;
         padding-bottom:10px;
-        padding-right:10px;   
+        padding-right:10px;
     }
     .result_value {
         text-align: center;
-        padding-left:30px;   
-        padding-right:30px;   
+        padding-left:30px;
+        padding-right:30px;
     }
     .result_id_0 {
         background-color: #f0f0f0;
@@ -57,7 +57,7 @@ export class RemousResultsComponent {
     /**
      * true si les résultats doivent être mis à jour
      */
-    private _doUpdate: boolean = false;
+    private _doUpdate = false;
 
     /**
      * composant des résultats variables
@@ -75,54 +75,56 @@ export class RemousResultsComponent {
     }
 
     private get uitextLigneFluviale() {
-        return this.intlService.localizeText("INFO_REMOUSRESULTS_LIGNEFLUVIALE")
+        return this.intlService.getExtraResLabel("FLU");
     }
 
     private get uitextLigneTorrentielle() {
-        return this.intlService.localizeText("INFO_REMOUSRESULTS_LIGNETORRENTIELLE")
+        return this.intlService.getExtraResLabel("TOR");
     }
 
     private get uitextAbscisse() {
-        return this.intlService.localizeText("INFO_REMOUSRESULTS_ABSCISSE")
+        return this.intlService.localizeText("INFO_REMOUSRESULTS_ABSCISSE");
     }
 
     private get uitextTirant() {
-        return this.intlService.localizeText("INFO_REMOUSRESULTS_TIRANT")
+        return this.intlService.localizeText("INFO_REMOUSRESULTS_TIRANT");
     }
 
     private get uitextFond() {
-        return this.intlService.localizeText("INFO_REMOUSRESULTS_FOND")
+        return this.intlService.localizeText("INFO_REMOUSRESULTS_FOND");
     }
 
     private get uitextBerge() {
-        return this.intlService.localizeText("INFO_REMOUSRESULTS_BERGE")
+        return this.intlService.localizeText("INFO_REMOUSRESULTS_BERGE");
     }
 
     private get uitextTirantNormal() {
-        return this.intlService.localizeText("INFO_REMOUSRESULTS_TIRANTNORMAL")
+        return this.intlService.localizeText("INFO_REMOUSRESULTS_TIRANTNORMAL");
     }
 
     private get uitextTirantCritique() {
-        return this.intlService.localizeText("INFO_REMOUSRESULTS_TIRANTCRITIQUE")
+        return this.intlService.localizeText("INFO_REMOUSRESULTS_TIRANTCRITIQUE");
     }
 
     private get extraGraph(): boolean {
-        return this._remousResults == undefined ? false : this._remousResults.extraGraph;
+        return this._remousResults === undefined ? false : this._remousResults.extraGraph;
     }
 
     private get extraParamLabel(): string {
-        return this._remousResults == undefined ? undefined : this._remousResults.extraParamLabel;
+        return this._remousResults === undefined ? undefined :
+            this.intlService.getExtraResLabel(this._remousResults.extraParamSymbol);
     }
 
     public set results(rs: CalculatorResults[]) {
         this._remousResults = undefined;
-        if (rs != undefined)
+        if (rs !== undefined) {
             for (const r of rs) {
                 if (r instanceof RemousResults) {
                     this._remousResults = r;
                     break;
                 }
             }
+        }
         this.updateView();
     }
 
@@ -131,26 +133,30 @@ export class RemousResultsComponent {
         this.graph1_options = {};
         this.graph2_data = {};
         this.graph2_options = {};
-        if (this.varResultsComponent != undefined)
+        if (this.varResultsComponent !== undefined) {
             this.varResultsComponent.results = undefined;
-        if (this.logComponent != undefined)
+        }
+        if (this.logComponent !== undefined) {
             this.logComponent.log = undefined;
+        }
         this._tableHeaders = [];
 
-        if (this._remousResults != undefined)
+        if (this._remousResults !== undefined) {
             this._doUpdate = this._remousResults.hasResults;
+        }
     }
 
-    /** 
+    /**
      * appelé pour gérer les changements non détectés par Angular
      */
     public ngDoCheck() {
-        if (this._doUpdate)
+        if (this._doUpdate) {
             this._doUpdate = !this.updateResults();
+        }
     }
 
     private updateResults() {
-        if (this.logComponent != undefined && this._remousResults != undefined) {
+        if (this.logComponent !== undefined && this._remousResults !== undefined) {
             this.logComponent.log = this._remousResults.log;
             this.generateGraph();
             return true;
@@ -163,57 +169,61 @@ export class RemousResultsComponent {
     }
 
     private connectRessaut(lineFlu: LineData, lineTor: LineData) {
-        if (lineFlu != undefined && lineTor != undefined) {
-            let tX = lineFlu.tx.slice(0); // copie
+        if (lineFlu !== undefined && lineTor !== undefined) {
+            const tX = lineFlu.tx.slice(0); // copie
 
             tX.sort((a, b) => {
-                if (a > b)
+                if (a > b) {
                     return 1;
-                if (a < b)
+                }
+                if (a < b) {
                     return -1;
+                }
                 return 0;
             });
 
             let minXflu; // abscisse de début de la courbe fluviale
             let itX = this.abscisseIterator;
-            for (let re of this._remousResults.result.resultElements) {
-                if (!itX.hasNext)
-                    throw new Error("RemousResultsComponent.connectRessaut() : erreur interne (itérateur sur x)")
+            for (const re of this._remousResults.result.resultElements) {
+                if (!itX.hasNext) {
+                    throw new Error("RemousResultsComponent.connectRessaut() : erreur interne (itérateur sur x)");
+                }
                 const x = itX.next().value;
-                if (re.getExtraResult("flu") != undefined) {
+                if (re.getExtraResult("flu") !== undefined) {
                     minXflu = x;
                     break;
                 }
             }
 
-            if (minXflu != undefined && minXflu != tX[0]) {
+            if (minXflu !== undefined && minXflu !== tX[0]) {
                 // la courbe fluviale ne démarre pas au début, on ajoute un point de raccord avec la ligne torrentielle
 
-                let i = tX.indexOf(minXflu);
-                let xflu = tX[i - 1];
-                let yflu = lineTor.getYat(xflu);
+                const i = tX.indexOf(minXflu);
+                const xflu = tX[i - 1];
+                const yflu = lineTor.getYat(xflu);
                 lineFlu.setPoint(xflu, yflu);
             }
 
             let maxXtor; // abscisse de fin de la courbe torrentielle
             const itRE = new ArrayReverseIterator<ResultElement>(this._remousResults.result.resultElements);
             itX = this.abscisseIterator;
-            for (let r of itRE) {
-                if (!itX.hasNext)
-                    throw new Error("RemousResultsComponent.connectRessaut() : erreur interne (itérateur sur x)")
+            for (const r of itRE) {
+                if (!itX.hasNext) {
+                    throw new Error("RemousResultsComponent.connectRessaut() : erreur interne (itérateur sur x)");
+                }
                 const x = itX.next();
-                if (r.getExtraResult("tor") != undefined) {
+                if (r.getExtraResult("tor") !== undefined) {
                     maxXtor = x;
                     break;
                 }
             }
 
-            if (maxXtor != undefined && maxXtor != tX[tX.length - 1]) {
+            if (maxXtor !== undefined && maxXtor !== tX[tX.length - 1]) {
                 // la courbe torrentielle ne finit pas à la fin des abscisses, on ajoute un point de raccord avec la ligne fluviale
 
-                let i = tX.indexOf(maxXtor);
-                let xflu = tX[i + 1];
-                let yflu = lineFlu.getYat(xflu);
+                const i = tX.indexOf(maxXtor);
+                const xflu = tX[i + 1];
+                const yflu = lineFlu.getYat(xflu);
                 lineTor.setPoint(xflu, yflu);
             }
         }
@@ -224,86 +234,109 @@ export class RemousResultsComponent {
         // le dernier dataset de la liste datasets est dessiné en 1er
 
         this._remousResults.update();
-        if (this.varResultsComponent)
+        if (this.varResultsComponent) {
             this.varResultsComponent.results = this._remousResults.varResults;
+        }
 
         const penteFond: number = this._remousResults.penteFond;
 
         // abscisses
 
         let labs: number[] = [];
+        let xmax: number;
         if (this._remousResults.result.ok) {
-            var xmax = -1e8;
-            const itX = this.abscisseIterator;
-            while (itX.hasNext) {
-                const x = itX.next().value;
+            xmax = -1e8;
+            const itX2 = this.abscisseIterator;
+            while (itX2.hasNext) {
+                const x = itX2.next().value;
                 labs.push(x);
                 xmax = Math.max(x, xmax);
             }
-        }
-        else {
+        } else {
             labs = [0, 1];
             xmax = 1;
         }
 
         // init graphiques
 
-        let gr1 = new GraphData(labs, penteFond, xmax);
-        if (this._remousResults.extraGraph)
-            var gr2 = new GraphData(labs, 0, xmax);
+        const gr1 = new GraphData(labs, penteFond, xmax);
+        let gr2: GraphData;
+        if (this._remousResults.extraGraph) {
+            gr2 = new GraphData(labs, 0, xmax);
+        }
 
         // ligne de fond
         gr1.drawLine(0, 0, 3, "#753F00", this.uitextFond, "#753F00");
 
         // ligne de berge
-        if (this._remousResults.hautBerge)
+        if (this._remousResults.hautBerge) {
             gr1.drawLine(this._remousResults.hautBerge, this._remousResults.hautBerge, 4, "#C58F50", this.uitextBerge);
+        }
 
         // hauteur normale
-        if (this._remousResults.hautNormale != undefined && this._remousResults.hautNormale.ok)
-            gr1.drawLine(this._remousResults.hautNormale.vCalc, this._remousResults.hautNormale.vCalc, 5, "#A4C537", this.uitextTirantNormal);
+        if (this._remousResults.hautNormale !== undefined && this._remousResults.hautNormale.ok) {
+            gr1.drawLine(this._remousResults.hautNormale.vCalc, this._remousResults.hautNormale.vCalc,
+                5, "#A4C537", this.uitextTirantNormal
+            );
+        }
 
         // hauteur critique
-        if (this._remousResults.hautCritique != undefined && this._remousResults.hautCritique.ok)
-            gr1.drawLine(this._remousResults.hautCritique.vCalc, this._remousResults.hautCritique.vCalc, 6, "#FF0000", this.uitextTirantCritique);
+        if (this._remousResults.hautCritique !== undefined && this._remousResults.hautCritique.ok) {
+            gr1.drawLine(this._remousResults.hautCritique.vCalc, this._remousResults.hautCritique.vCalc,
+                6, "#FF0000", this.uitextTirantCritique
+            );
+        }
 
         // lignes d'eau torrentielle et fluviale
 
-        if (this._remousResults.hasFluData)
-            var lineFlu = gr1.newLine(0);
-        if (this._remousResults.hasTorData)
-            var lineTor = gr1.newLine(1);
+        let lineFlu: LineData;
+        if (this._remousResults.hasFluData) {
+            lineFlu = gr1.newLine(0);
+        }
+        let lineTor: LineData;
+        if (this._remousResults.hasTorData) {
+            lineTor = gr1.newLine(1);
+        }
+        let lineExtra: LineData;
         if (this._remousResults.hasExtra) {
-            if (this._remousResults.extraGraph)
-                var lineExtra = gr2.newLine(2);
-            else
+            if (this._remousResults.extraGraph) {
+                lineExtra = gr2.newLine(2);
+            } else {
                 lineExtra = gr1.newLine(2);
+            }
         }
 
         const itX = this.abscisseIterator;
-        for (let re of this._remousResults.result.resultElements) {
+        for (const re of this._remousResults.result.resultElements) {
             if (!itX.hasNext)
-                throw new Error("RemousResultsComponent.generateGraph() : erreur interne (itérateur sur x)")
+                throw new Error("RemousResultsComponent.generateGraph() : erreur interne (itérateur sur x)");
 
             const x = itX.next().value;
-            const yExtra = re.getExtraResult("tRes");
-            if (yExtra != undefined)
+            const yExtra = re.getExtraResult(this._remousResults.extraParamSymbol);
+            if (yExtra !== undefined)
                 lineExtra.mapPoint(x, yExtra);
 
             const yFlu = re.getExtraResult("flu");
-            if (yFlu != undefined)
+            if (yFlu !== undefined)
                 lineFlu.mapPoint(x, yFlu);
 
             const yTor = re.getExtraResult("tor");
-            if (yTor != undefined)
+            if (yTor !== undefined)
                 lineTor.mapPoint(x, yTor);
         }
 
         if (this._remousResults.hasExtra) {
-            if (this._remousResults.extraGraph)
-                lineExtra.data = { label: this._remousResults.extraParamLabel, tension: 0, spanGaps: true, borderColor: "#0093BD", pointRadius: 4 };
-            else
-                lineExtra.data = { label: this._remousResults.extraParamLabel, tension: 0, fill: false, spanGaps: true, borderColor: "#C17AF0", pointRadius: 4 };
+            if (this._remousResults.extraGraph) {
+                lineExtra.data = {
+                    label: this.extraParamLabel,
+                    tension: 0, spanGaps: true, borderColor: "#0093BD", pointRadius: 4
+                };
+            } else {
+                lineExtra.data = {
+                    label: this.extraParamLabel,
+                    tension: 0, fill: false, spanGaps: true, borderColor: "#C17AF0", pointRadius: 4
+                };
+            }
         }
 
         // raccordement ligne fluviale -> torrentielle pour dessiner le ressaut
@@ -312,9 +345,9 @@ export class RemousResultsComponent {
 
         // ajout des données au graphique
 
-        if (lineTor != undefined)
+        if (lineTor !== undefined)
             lineTor.data = { label: this.uitextLigneTorrentielle, tension: 0, borderColor: "#77A3CD", pointBackgroundColor: "#77A3CD", pointRadius: 4, backgroundColor: "#D1D0D4" };
-        if (lineFlu != undefined)
+        if (lineFlu !== undefined)
             lineFlu.data = { label: this.uitextLigneFluviale, tension: 0, borderColor: "#0093BD", pointBackgroundColor: "#0093BD", pointRadius: 4, backgroundColor: "#D1D0D4" };
 
         this.graph1_data = gr1.data;
@@ -367,7 +400,7 @@ export class RemousResultsComponent {
     }
 
     private get hasResults(): boolean {
-        return this._remousResults != undefined && this._remousResults.hasResults;
+        return this._remousResults !== undefined && this._remousResults.hasResults;
     }
 
     private get hasData(): boolean {
@@ -413,12 +446,12 @@ class LineData {
     }
 
     public getYat(x: number) {
-        let i = this._tx.indexOf(x);
+        const i = this._tx.indexOf(x);
         return this._ty[i];
     }
 
     public setPoint(x: number, y: number) {
-        let i = this._tx.indexOf(x);
+        const i = this._tx.indexOf(x);
         this._ty[i] = y;
     }
 
@@ -435,7 +468,7 @@ class LineData {
     }
 
     public hasYs(): boolean {
-        for (let y of this._ty)
+        for (const y of this._ty)
             if (y != null)
                 return true;
         return false;
@@ -480,7 +513,7 @@ class GraphData {
      * @param z profondeur de la lign
      */
     public newLine(z: number): LineData {
-        let res = new LineData(this);
+        const res = new LineData(this);
         res.z = z;
         this._lines.push(res);
         return res;
@@ -514,19 +547,19 @@ class GraphData {
      * @param fillColor couleur de remplissage sous la ligne
      */
     public drawLine(y0: number, ymax: number, prof: number, color: string, lbl: string, fillColor: string = undefined) {
-        let l = this.newLine(prof);
+        const l = this.newLine(prof);
         l.mapPoint(0, y0);
         l.mapPoint(this._longBief, ymax);
 
         // l.data = { label: lbl, data: l, fill: fillColor != undefined, tension: 0, borderColor: color, backgroundColor: fillColor, pointRadius: 0 };
         l.data = {
-            label: lbl, fill: fillColor != undefined, tension: 0, spanGaps: true,
+            label: lbl, fill: fillColor !== undefined, tension: 0, spanGaps: true,
             borderColor: color, backgroundColor: fillColor, pointRadius: 0
         };
     }
 
     public get data() {
-        let ds = [];
+        const ds = [];
         this._lines.sort((a, b) => {
             if (a.z > b.z)
                 return -1;
@@ -535,7 +568,7 @@ class GraphData {
             return 0;
         });
 
-        for (let l of this._lines)
+        for (const l of this._lines)
             ds.push(l.data);
 
         return {
diff --git a/src/app/components/result-element/vertical-result-element.component.ts b/src/app/components/result-element/vertical-result-element.component.ts
index 53fff9965..ae8f7c09c 100644
--- a/src/app/components/result-element/vertical-result-element.component.ts
+++ b/src/app/components/result-element/vertical-result-element.component.ts
@@ -54,7 +54,7 @@ export class VerticalResultElementComponent extends ResultElementBaseComponent {
                 const lblClass = (i % 2) == 0 ? "label1" : "label2";
                 const valueClass = (i % 2) == 0 ? "value1" : "value2";
                 this.vcRef.createEmbeddedView(this.trTemplate, {
-                    extraRes: { "label": this.intlService.translateLabel(k), "value": this.intlService.formatResult(k, er) },
+                    extraRes: { "label": this.intlService.getExtraResLabel(k), "value": this.intlService.formatResult(k, er) },
                     classes: { "label_class": lblClass, "value_class": valueClass }
                 });
                 i++;
diff --git a/src/app/formulaire/definition/concrete/form-courbe-remous.ts b/src/app/formulaire/definition/concrete/form-courbe-remous.ts
index c4653bbac..f67df0d0b 100644
--- a/src/app/formulaire/definition/concrete/form-courbe-remous.ts
+++ b/src/app/formulaire/definition/concrete/form-courbe-remous.ts
@@ -6,7 +6,6 @@ import { FormComputeCourbeRemous } from "../form-compute-courbe-remous";
 import { FormulaireDefinition } from "../form-definition";
 import { CalculatorResults } from "../../../results/calculator-results";
 import { FieldSet } from "../../fieldset";
-import { SelectField } from "../../select-field";
 
 export class FormulaireCourbeRemous extends FormulaireDefinition {
     private _formSection: FormDefSection;
diff --git a/src/app/formulaire/definition/form-compute-courbe-remous.ts b/src/app/formulaire/definition/form-compute-courbe-remous.ts
index 664a17cf4..69f3a832a 100644
--- a/src/app/formulaire/definition/form-compute-courbe-remous.ts
+++ b/src/app/formulaire/definition/form-compute-courbe-remous.ts
@@ -22,31 +22,30 @@ export class FormComputeCourbeRemous extends FormCompute {
         const prmCR: CourbeRemousParams = cr.parameters as CourbeRemousParams;
         const sect: acSection = prmCR.Sn;
 
-        let Yn: Result = sect.Calc("Yn"); // hauteur normale
-        let Yc: Result = sect.Calc("Yc"); // hauteur critique
+        const Yn: Result = sect.Calc("Yn"); // hauteur normale
+        const Yc: Result = sect.Calc("Yc"); // hauteur critique
 
         this.remousResults.parameters = prmCR;
 
         // méthode de résolution
 
-        let msf: SelectField = <SelectField>this._formBase.getFormulaireNodeById("select_resolution");
-        let methRes: MethodeResolution = msf.getValue().value;
+        const msf: SelectField = <SelectField>this._formBase.getFormulaireNodeById("select_resolution");
+        const methRes: MethodeResolution = msf.getValue().value;
 
         // variable supplémentaire à calculer
 
-        const extraSymbol: string = this._formBase.getSelectedValue("select_target");
+        this.remousResults.extraParamSymbol = this._formBase.getSelectedValue("select_target");
 
         // calcul
 
-        this.remousResults.result = cr.calculRemous(extraSymbol);
+        this.remousResults.result = cr.calculRemous(this.remousResults.extraParamSymbol);
 
         // données du graphe
 
         this.remousResults.hauteurNormale = Yn.resultElement;
         this.remousResults.hauteurCritique = Yc.resultElement;
-        if (extraSymbol) {
-            this.remousResults.extraParamLabel = this._formBase.getSelectedLabel("select_target");
-            this.remousResults.extraGraph = ["Hs", "Hsc", "Yf", "Yt", "Yco"].indexOf(extraSymbol) == -1;
+        if (this.remousResults.extraParamSymbol) {
+            this.remousResults.extraGraph = ["Hs", "Hsc", "Yf", "Yt", "Yco"].indexOf(this.remousResults.extraParamSymbol) === -1;
         }
         else
             this.remousResults.extraGraph = false;
diff --git a/src/app/formulaire/ngparam.ts b/src/app/formulaire/ngparam.ts
index 2b31478c3..71b4e6b68 100644
--- a/src/app/formulaire/ngparam.ts
+++ b/src/app/formulaire/ngparam.ts
@@ -107,8 +107,8 @@ export class NgParameter extends InputField implements Observer {
      * fixe la valeur du paramètre.
      * une notification préalable est envoyée pour laisser l'occasion aux objets liés de préciser le contexte
      * dans lequel cette valeur existe
-     * @param sender 
-     * @param val 
+     * @param sender
+     * @param val
      */
     public setValue(sender: any, val: number) {
         this._paramDef.setValue(val, sender);
@@ -292,14 +292,6 @@ export class NgParameter extends InputField implements Observer {
         return this._paramDef.valuesIterator;
     }
 
-    public updateLocalisation(loc: StringMap) {
-        super.updateLocalisation(loc);
-        if (this.label == undefined) {
-            const key: string = `INFO_GRANDEUR_${this.symbol.toUpperCase()}`;
-            super.updateLocalisation(loc, key);
-        }
-    }
-
     private paramValuesJSON(): any {
         let res = {};
         res["mode"] = ParamValueMode[this._paramValues.valueMode];
diff --git a/src/app/results/remous-results.ts b/src/app/results/remous-results.ts
index 99cbddeb6..ec7d5ef9c 100644
--- a/src/app/results/remous-results.ts
+++ b/src/app/results/remous-results.ts
@@ -57,7 +57,7 @@ export class RemousResults extends CalculatorResults {
     /**
      * titre de la colonne du paramètre supplémentaire
      */
-    private _extraParamLabel: string;
+    private _extraParamSymbol: string;
 
     /**
      * journal de calcul
@@ -76,7 +76,7 @@ export class RemousResults extends CalculatorResults {
         this._penteFond = undefined;
         this._hautNormale = undefined;
         this._hautCritique = undefined;
-        this._extraParamLabel = undefined;
+        this._extraParamSymbol = undefined;
         this._hasFlu = false;
         this._hasTor = false;
         this._hasExtra = false;
@@ -127,7 +127,7 @@ export class RemousResults extends CalculatorResults {
                 this._hasFlu = true;
             if (!this._hasTor && re.getExtraResult("tor"))
                 this._hasTor = true;
-            if (!this._hasExtra && re.getExtraResult("tRes"))
+            if (!this._hasExtra && re.getExtraResult(this.extraParamSymbol))
                 this._hasExtra = true;
         }
 
@@ -143,13 +143,17 @@ export class RemousResults extends CalculatorResults {
         if (this._hasTor)
             keys.push("tor");
         if (this._hasExtra)
-            keys.push("tRes");
+            keys.push(this.extraParamSymbol);
         this._varResults.extraResultKeys = keys;
         this._varResults.update(true);
     }
 
-    public set extraParamLabel(l: string) {
-        this._extraParamLabel = l;
+    public get extraParamSymbol(): string {
+        return this._extraParamSymbol;
+    }
+
+    public set extraParamSymbol(l: string) {
+        this._extraParamSymbol = l;
     }
 
     public get hautBerge() {
diff --git a/src/app/results/var-results.ts b/src/app/results/var-results.ts
index 72cec0561..4a39c1c9a 100644
--- a/src/app/results/var-results.ts
+++ b/src/app/results/var-results.ts
@@ -136,6 +136,6 @@ export class VarResults extends CalculatedParamResults {
 
         const intlService = ServiceFactory.instance.internationalisationService;
         for (const k of this._extraResultKeys)
-            this._extraResultHeaders.push(intlService.translateLabel(k));
+            this._extraResultHeaders.push(intlService.getExtraResLabel(k));
     }
 }
diff --git a/src/app/services/internationalisation/internationalisation.service.ts b/src/app/services/internationalisation/internationalisation.service.ts
index 00397c931..95b6dcbad 100644
--- a/src/app/services/internationalisation/internationalisation.service.ts
+++ b/src/app/services/internationalisation/internationalisation.service.ts
@@ -163,10 +163,10 @@ export class InternationalisationService extends Observable {
      */
     public localizeText(code: string) {
         if (this._Messages === undefined) {
-            return "<messages not loaded>";
+            return "*** messages not loaded: ${code} ***";
         }
         if (this._Messages[code] === undefined) {
-            return `<message not exists: ${code}>`;
+            return `*** message not exists: ${code} ***`;
         }
         return this._Messages[code];
     }
@@ -182,7 +182,7 @@ export class InternationalisationService extends Observable {
     /**
      * Traduit un libellé qui peut être un code
      */
-    public translateLabel(s: string) {
+    public getExtraResLabel(s: string) {
         const key = "INFO_EXTRARES_LIB_";
         const match = this.parseLabel(s);
         if (match) {
diff --git a/src/locale/error_messages.fr.json b/src/locale/error_messages.fr.json
index e1dfb10f2..e0e56d74c 100644
--- a/src/locale/error_messages.fr.json
+++ b/src/locale/error_messages.fr.json
@@ -87,9 +87,9 @@
     "INFO_EXTRARES_LIB_HSC": "Charge critique (m)",
     "INFO_EXTRARES_LIB_B": "Largeur au miroir (m)",
     "INFO_EXTRARES_LIB_P": "Périmètre mouillé (m)",
-    "INFO_EXTRARES_LIB_S": "Surface mouillée  (m²)",
-    "INFO_EXTRARES_LIB_R": "Rayon hydraulique  (m)",
-    "INFO_EXTRARES_LIB_V": "Vitesse moyenne  (m/s)",
+    "INFO_EXTRARES_LIB_S": "Surface mouillée (m²)",
+    "INFO_EXTRARES_LIB_R": "Rayon hydraulique (m)",
+    "INFO_EXTRARES_LIB_V": "Vitesse moyenne (m/s)",
     "INFO_EXTRARES_LIB_FR": "Froude",
     "INFO_EXTRARES_LIB_YC": "Tirant d'eau critique (m)",
     "INFO_EXTRARES_LIB_YN": "Tirant d'eau normal (m)",
-- 
GitLab


From 80f0f05987d889105d261a51b4d14cad150c6887 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Thu, 5 Jul 2018 09:47:13 +0200
Subject: [PATCH 38/41] =?UTF-8?q?=20#48=20ParamLinkComponent.updateParamLi?=
 =?UTF-8?q?st()=20:=20correction=20d'une=20r=C3=A9gression=20n'affichant?=
 =?UTF-8?q?=20plus=20les=20r=C3=A9sultats=20d'une=20autre=20calculette?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../param-link/param-link.component.ts        | 39 ++++++++++---------
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts
index 0c368e15f..fc7d64bc9 100644
--- a/src/app/components/param-link/param-link.component.ts
+++ b/src/app/components/param-link/param-link.component.ts
@@ -163,24 +163,27 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy {
         // suppression des paramètres non affichés
 
         for (let i = this._linkableParams.length - 1; i >= 0; i--) {
-            // pour chaque paramètre...
-            const prm: ParamDefinition = this._linkableParams[i].value;
-
-            const parentForm: FormulaireDefinition = ServiceFactory.instance.formulaireService.getParamdefParentForm(prm);
-
-            // ... on cherche s'il est affiché dans son parent
-            // (ce n'est pas le cas par ex pour Q, Z1, Z2 dans les ouvrages enfants des ouvrages //)
-            let found: boolean = false;
-            if (parentForm !== undefined)
-                for (const fe of parentForm.allFormElements)
-                    if (fe instanceof NgParameter)
-                        if (fe.paramDefinition.uid === prm.uid) {
-                            found = true;
-                            break;
-                        }
-
-            if (!found)
-                this._linkableParams.splice(i, 1);
+            const v = this._linkableParams[i].value;
+            if (v instanceof ParamDefinition) {
+                // pour chaque paramètre...
+                const prm: ParamDefinition = v;
+
+                const parentForm: FormulaireDefinition = ServiceFactory.instance.formulaireService.getParamdefParentForm(prm);
+
+                // ... on cherche s'il est affiché dans son parent
+                // (ce n'est pas le cas par ex pour Q, Z1, Z2 dans les ouvrages enfants des ouvrages //)
+                let found: boolean = false;
+                if (parentForm !== undefined)
+                    for (const fe of parentForm.allFormElements)
+                        if (fe instanceof NgParameter)
+                            if (fe.paramDefinition.uid === prm.uid) {
+                                found = true;
+                                break;
+                            }
+
+                if (!found)
+                    this._linkableParams.splice(i, 1);
+            }
         }
 
         // initialisation de l'indice courant
-- 
GitLab


From 1b4b4c6ad281fc99ed9dfe0eaae1af1468574542 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Thu, 5 Jul 2018 10:44:44 +0200
Subject: [PATCH 39/41] =?UTF-8?q?=20#48=20FormulaireService.getLinkableVal?=
 =?UTF-8?q?ues()=20:=20correction=20de=20crash=20(exception)=20si=20le=20p?=
 =?UTF-8?q?aram=C3=A8tre=20pass=C3=A9=20n'existe=20pas=20dans=20un=20nub?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/app/services/formulaire/formulaire.service.ts | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/app/services/formulaire/formulaire.service.ts b/src/app/services/formulaire/formulaire.service.ts
index d6feac924..418ac6e1f 100644
--- a/src/app/services/formulaire/formulaire.service.ts
+++ b/src/app/services/formulaire/formulaire.service.ts
@@ -476,10 +476,10 @@ export class FormulaireService extends Observable {
                 // nub associé au formulaire
                 const sn = f.currentSessionNub;
 
-                // on vérifie que le paramètre en entrée appartient au nub
-                const np = sn.nub.getParameter(p.symbol);
+                try {
+                    // on vérifie que le paramètre en entrée appartient au nub
+                    const np = sn.nub.getParameter(p.symbol);
 
-                if (np !== undefined) {
                     // si oui, on demande à exclure des valeurs retournées le résultat du même nom que le paramètre
                     const ps = sn.getLinkableValues(p.paramDefinition, p.paramDefinition.uid === np.uid);
                     for (const np of ps) {
@@ -487,6 +487,9 @@ export class FormulaireService extends Observable {
                         res.push(np);
                     }
                 }
+                catch (e) {
+                    //  p.symbol n'existe pas dans le nub testé
+                }
             }
 
         return res;
-- 
GitLab


From dff6bfc713602f13f7a27f4d716d0d74978a7de9 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Thu, 5 Jul 2018 10:54:40 +0200
Subject: [PATCH 40/41] =?UTF-8?q?=20#48=20ParamLinkComponent.updateParamLi?=
 =?UTF-8?q?st()=20:=20d=C3=A9placement=20du=20code=20de=20filtrage=20des?=
 =?UTF-8?q?=20param=C3=A8tres=20renvoy=C3=A9s=20par=20FormulaireService.ge?=
 =?UTF-8?q?tLinkableValues()=20dans=20la=20m=C3=A9thode=20FormulaireServic?=
 =?UTF-8?q?e.filterLinkableValues()?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../param-link/param-link.component.ts        | 32 +++--------------
 .../services/formulaire/formulaire.service.ts | 36 ++++++++++++++++++-
 2 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts
index fc7d64bc9..d7b5bc013 100644
--- a/src/app/components/param-link/param-link.component.ts
+++ b/src/app/components/param-link/param-link.component.ts
@@ -155,38 +155,14 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy {
 
     public updateParamList() {
         // liste des paramètres liables
-        if (this._param.valueMode == ParamValueMode.LINK)
-            this._linkableParams = this._formService.getLinkableValues(this._param);
+
+        if (this._param.valueMode === ParamValueMode.LINK)
+            this._linkableParams = this._formService.filterLinkableValues(this._formService.getLinkableValues(this._param));
         else
             this._linkableParams = [];
 
-        // suppression des paramètres non affichés
-
-        for (let i = this._linkableParams.length - 1; i >= 0; i--) {
-            const v = this._linkableParams[i].value;
-            if (v instanceof ParamDefinition) {
-                // pour chaque paramètre...
-                const prm: ParamDefinition = v;
-
-                const parentForm: FormulaireDefinition = ServiceFactory.instance.formulaireService.getParamdefParentForm(prm);
-
-                // ... on cherche s'il est affiché dans son parent
-                // (ce n'est pas le cas par ex pour Q, Z1, Z2 dans les ouvrages enfants des ouvrages //)
-                let found: boolean = false;
-                if (parentForm !== undefined)
-                    for (const fe of parentForm.allFormElements)
-                        if (fe instanceof NgParameter)
-                            if (fe.paramDefinition.uid === prm.uid) {
-                                found = true;
-                                break;
-                            }
-
-                if (!found)
-                    this._linkableParams.splice(i, 1);
-            }
-        }
-
         // initialisation de l'indice courant
+
         if (this._linkableParams.length > 0) {
             if (this._currentIndex === -1)
                 this.linkTo(0);
diff --git a/src/app/services/formulaire/formulaire.service.ts b/src/app/services/formulaire/formulaire.service.ts
index 418ac6e1f..c8bb1e5d2 100644
--- a/src/app/services/formulaire/formulaire.service.ts
+++ b/src/app/services/formulaire/formulaire.service.ts
@@ -5,7 +5,7 @@ import "rxjs/add/operator/toPromise";
 import { decode } from "he";
 import { saveAs } from "file-saver";
 
-import { CalculatorType, EnumEx, Observable, ParamDefinition } from "jalhyd";
+import { CalculatorType, EnumEx, Observable, ParamDefinition, ParamValueMode } from "jalhyd";
 
 import { ServiceFactory } from "../service-factory";
 import { HttpService } from "../../services/http/http.service";
@@ -494,4 +494,38 @@ export class FormulaireService extends Observable {
 
         return res;
     }
+
+    /**
+     * filtre les valeurs liables à un paramètre :
+     * - supprime les valeurs non affichées dans leur parent (ce n'est pas le cas par ex pour Q, Z1, Z2 dans les ouvrages enfants des ouvrages //)
+     * @param values valeurs liables (modifié par la méthode)
+     */
+    public filterLinkableValues(values: any[]): any[] {
+        // suppression des paramètres non affichés
+
+        for (let i = values.length - 1; i >= 0; i--) {
+            const v = values[i].value;
+            if (v instanceof ParamDefinition) {
+                // pour chaque paramètre...
+                const prm: ParamDefinition = v;
+
+                const parentForm: FormulaireDefinition = this.getParamdefParentForm(prm);
+
+                // ... on cherche s'il est affiché dans son parent
+                let found: boolean = false;
+                if (parentForm !== undefined)
+                    for (const fe of parentForm.allFormElements)
+                        if (fe instanceof NgParameter)
+                            if (fe.paramDefinition.uid === prm.uid) {
+                                found = true;
+                                break;
+                            }
+
+                if (!found)
+                    values.splice(i, 1);
+            }
+        }
+
+        return values;
+    }
 }
-- 
GitLab


From 1eb55db7c47c97b472f5c3df66464217c49b61e7 Mon Sep 17 00:00:00 2001
From: "francois.grand" <francois.grand@irstea.fr>
Date: Thu, 5 Jul 2018 10:56:48 +0200
Subject: [PATCH 41/41] =?UTF-8?q?=20#48=20ParamFieldLineComponent.hasRadio?=
 =?UTF-8?q?Link()=20:=20on=20autorise=20l'affichage=20du=20radio=20"li?=
 =?UTF-8?q?=C3=A9"=20que=20s'il=20y=20a=20effectivement=20des=20valeurs=20?=
 =?UTF-8?q?liables?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../param-field-line/param-field-line.component.ts          | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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 a0000052e..c957e6b1a 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
@@ -142,13 +142,15 @@ export class ParamFieldLineComponent implements OnChanges {
     */
     private hasRadioLink(): boolean {
         if (this._formService.formulaires.length > 0) {
+            // au moins 2 calculettes ouvertes
             if (this._formService.formulaires.length > 1)
-                return true;
+                return this._formService.filterLinkableValues(this._formService.getLinkableValues(this._param)).length > 0;
 
+            // ou une seule calculette "ouvrages parallèles"
             if (this._formService.formulaires[0].calculatorType == CalculatorType.ParallelStructure) {
                 const ps: ParallelStructure = this._formService.formulaires[0].currentSessionNub.nub as ParallelStructure;
                 if (ps.structures.length > 1)
-                    return true;
+                    return this._formService.filterLinkableValues(this._formService.getLinkableValues(this._param)).length > 0;
             }
 
         }
-- 
GitLab