Commit 5f1900fc authored by Grand Francois's avatar Grand Francois
Browse files

#48 composant ParamFieldLineComponent : ajout du bouton "lié" (pour importer...

 #48 composant ParamFieldLineComponent : ajout du bouton "lié" (pour importer la valeur d'un autre paramètre)
Showing with 54 additions and 1 deletion
+54 -1
...@@ -27,6 +27,12 @@ ...@@ -27,6 +27,12 @@
value="cal" (click)="onRadioClick('cal')" [checked]=radioCalCheck [disabled]=isDisabled id="radio_cal"> value="cal" (click)="onRadioClick('cal')" [checked]=radioCalCheck [disabled]=isDisabled id="radio_cal">
{{uitextParamCalculer}} {{uitextParamCalculer}}
</label> </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>
</div> </div>
......
...@@ -5,6 +5,7 @@ import { NgParameter, ParamRadioConfig } from "../../formulaire/ngparam"; ...@@ -5,6 +5,7 @@ import { NgParameter, ParamRadioConfig } from "../../formulaire/ngparam";
import { NgParamInputComponent } from "../ngparam-input/ngparam-input.component"; import { NgParamInputComponent } from "../ngparam-input/ngparam-input.component";
import { ServiceFactory } from "../../services/service-factory"; import { ServiceFactory } from "../../services/service-factory";
import { ParamValueMode } from "jalhyd"; import { ParamValueMode } from "jalhyd";
import { FormulaireService } from "../../services/formulaire/formulaire.service";
@Component({ @Component({
selector: "param-field-line", selector: "param-field-line",
...@@ -51,8 +52,11 @@ export class ParamFieldLineComponent implements OnChanges { ...@@ -51,8 +52,11 @@ export class ParamFieldLineComponent implements OnChanges {
private intlService: InternationalisationService; private intlService: InternationalisationService;
private _formService: FormulaireService;
constructor() { constructor() {
this.intlService = ServiceFactory.instance.internationalisationService; this.intlService = ServiceFactory.instance.internationalisationService;
this._formService = ServiceFactory.instance.formulaireService;
this.onValid = new EventEmitter(); this.onValid = new EventEmitter();
this.inputChange = new EventEmitter(); this.inputChange = new EventEmitter();
} }
...@@ -78,6 +82,10 @@ export class ParamFieldLineComponent implements OnChanges { ...@@ -78,6 +82,10 @@ export class ParamFieldLineComponent implements OnChanges {
return this.intlService.localizeText("INFO_PARAMFIELD_PARAMCALCULER"); return this.intlService.localizeText("INFO_PARAMFIELD_PARAMCALCULER");
} }
private get uitextParamLie() {
return this.intlService.localizeText("INFO_PARAMFIELD_PARAMLIE");
}
/** /**
* Parameter symbol (Q, Ks, B, ...) input attribute * Parameter symbol (Q, Ks, B, ...) input attribute
*/ */
...@@ -125,6 +133,13 @@ export class ParamFieldLineComponent implements OnChanges { ...@@ -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é" * calcule l'état du radio "paramètre fixé"
*/ */
...@@ -148,6 +163,15 @@ export class ParamFieldLineComponent implements OnChanges { ...@@ -148,6 +163,15 @@ export class ParamFieldLineComponent implements OnChanges {
return undefined; 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 * retourne l'état du radio "paramètre fixé" sous forme booléenne
*/ */
...@@ -185,6 +209,10 @@ export class ParamFieldLineComponent implements OnChanges { ...@@ -185,6 +209,10 @@ export class ParamFieldLineComponent implements OnChanges {
case "cal": case "cal":
this._param.valueMode = ParamValueMode.CALCUL; this._param.valueMode = ParamValueMode.CALCUL;
break; break;
case "link":
this._param.valueMode = ParamValueMode.LINK;
break;
} }
this.onRadio.emit({ this.onRadio.emit({
...@@ -240,6 +268,15 @@ export class ParamFieldLineComponent implements OnChanges { ...@@ -240,6 +268,15 @@ export class ParamFieldLineComponent implements OnChanges {
return ""; 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 * validité des saisies du composant
*/ */
......
...@@ -24,7 +24,12 @@ export enum ParamRadioConfig { ...@@ -24,7 +24,12 @@ export enum ParamRadioConfig {
/** /**
* boutons radio "paramètre fixé", "paramètre à varier" et "paramètre à calculer" * 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 { ...@@ -80,6 +85,9 @@ export class NgParameter extends InputField {
case ParamValueMode.CALCUL: case ParamValueMode.CALCUL:
return ParamRadioConfig.CAL; return ParamRadioConfig.CAL;
case ParamValueMode.LINK:
return ParamRadioConfig.LINK;
} }
} }
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
"INFO_PARAMFIELD_PARAMFIXE": "Fixed", "INFO_PARAMFIELD_PARAMFIXE": "Fixed",
"INFO_PARAMFIELD_PARAMVARIER": "Vary", "INFO_PARAMFIELD_PARAMVARIER": "Vary",
"INFO_PARAMFIELD_PARAMCALCULER": "Calculate", "INFO_PARAMFIELD_PARAMCALCULER": "Calculate",
"INFO_PARAMFIELD_PARAMLIE": "Link",
"INFO_PARAMFIELD_VALEURMINI": "From minimum value", "INFO_PARAMFIELD_VALEURMINI": "From minimum value",
"INFO_PARAMFIELD_VALEURMAXI": "to maximum value", "INFO_PARAMFIELD_VALEURMAXI": "to maximum value",
"INFO_PARAMFIELD_PASVARIATION": "with a variation step of:", "INFO_PARAMFIELD_PASVARIATION": "with a variation step of:",
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
"INFO_PARAMFIELD_PARAMFIXE": "fixé", "INFO_PARAMFIELD_PARAMFIXE": "fixé",
"INFO_PARAMFIELD_PARAMVARIER": "varier", "INFO_PARAMFIELD_PARAMVARIER": "varier",
"INFO_PARAMFIELD_PARAMCALCULER": "calculer", "INFO_PARAMFIELD_PARAMCALCULER": "calculer",
"INFO_PARAMFIELD_PARAMLIE": "lié",
"INFO_PARAMFIELD_VALEURMINI": "De la valeur minimum", "INFO_PARAMFIELD_VALEURMINI": "De la valeur minimum",
"INFO_PARAMFIELD_VALEURMAXI": "à la valeur maximum", "INFO_PARAMFIELD_VALEURMAXI": "à la valeur maximum",
"INFO_PARAMFIELD_PASVARIATION": "avec un pas de&nbsp;:", "INFO_PARAMFIELD_PASVARIATION": "avec un pas de&nbsp;:",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment