diff --git a/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.html b/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.html index 8fbe604a524054fb39e7dc0727076d78e1e348b9..43f8a3a0f3565893efd03a7ae3ba2616cbc4ff10 100644 --- a/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.html +++ b/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.html @@ -105,6 +105,15 @@ </form> </div> + <mat-form-field> + <mat-select [placeholder]="uitextExtensionStrategy" [(value)]="selectedExtensionStrategy" + data-testid="variable-extension-strategy-select"> + <mat-option *ngFor="let e of extensionStrategies" [value]="e.value"> + {{ e.label }} + </mat-option> + </mat-select> + </mat-form-field> + </div> <div mat-dialog-content *ngIf="viewChart"> diff --git a/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts b/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts index 5bc041da529c3ca22fe8c3133acc3227137c6174..803de5b0be298d58fe5de40432f1fa401afa4a6d 100644 --- a/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts +++ b/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts @@ -3,7 +3,7 @@ import { Inject, Component, OnInit } from "@angular/core"; import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { I18nService } from "../../services/internationalisation/internationalisation.service"; import { NgParameter } from "../../formulaire/ngparam"; -import { ParamValueMode } from "jalhyd"; +import { ParamValueMode, ExtensionStrategy } from "jalhyd"; import { sprintf } from "sprintf-js"; import { ApplicationSetupService } from "../../services/app-setup/app-setup.service"; @@ -23,6 +23,9 @@ export class DialogEditParamValuesComponent implements OnInit { /** available decimal separators */ public decimalSeparators: { label: string; value: string; }[]; + /** available extension strategies */ + public extensionStrategies: { value: ExtensionStrategy; label: string; }[]; + /** current decimal separator */ public decimalSeparator: string; @@ -76,6 +79,16 @@ export class DialogEditParamValuesComponent implements OnInit { } ]; this.decimalSeparator = this.decimalSeparators[0].value; + this.extensionStrategies = [ + { + value: ExtensionStrategy.REPEAT_LAST, + label: this.intlService.localizeText("INFO_PARAMFIELD_PARAMVARIER_EXT_STRATEGY_REPEAT_LAST") + }, + { + value: ExtensionStrategy.RECYCLE, + label: this.intlService.localizeText("INFO_PARAMFIELD_PARAMVARIER_EXT_STRATEGY_RECYCLE") + } + ]; // chart configuration const nDigits = this.appSetupService.displayDigits; @@ -171,6 +184,14 @@ export class DialogEditParamValuesComponent implements OnInit { this.param.valueMode = v; } + public get selectedExtensionStrategy() { + return this.param.paramDefinition.extensionStrategy; + } + + public set selectedExtensionStrategy(es) { + this.param.paramDefinition.extensionStrategy = es; + } + public get isMinMax() { return this.param.valueMode === ParamValueMode.MINMAX; } @@ -412,6 +433,10 @@ export class DialogEditParamValuesComponent implements OnInit { return this.intlService.localizeText("INFO_PARAMFIELD_PARAMVARIER_IMPORT_FICHIER"); } + public get uitextExtensionStrategy() { + return this.intlService.localizeText("INFO_PARAMFIELD_PARAMVARIER_EXT_STRATEGY"); + } + public ngOnInit() { this.initVariableValues(); } 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 df956b33acfe059a408a8e6e82390cdb246adfa1..5b105c01f1cb6385820c999c2741629b22654c0d 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 @@ -197,7 +197,7 @@ export class ParamFieldLineComponent implements OnChanges { let ret = true; if (this.param.paramDefinition.isCalculated) { const nub = this.param.paramDefinition.parentNub; - const p = nub.findFirstSingleParameter(this.param.paramDefinition); + const p = nub.findFirstCalculableParameter(this.param.paramDefinition); ret = (p !== undefined); } return ret; diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json index b521d5451ff8f2ac832d7be94c448749a3e894ec..32364c09832fef08f3c9054093616ecdb6886227 100644 --- a/src/locale/messages.en.json +++ b/src/locale/messages.en.json @@ -212,6 +212,9 @@ "INFO_PARAMFIELD_PARAMFIXE": "Fixed", "INFO_PARAMFIELD_PARAMLIE_LABEL": "Linked parameter", "INFO_PARAMFIELD_PARAMLIE": "Link", + "INFO_PARAMFIELD_PARAMVARIER_EXT_STRATEGY": "Values list extension strategy", + "INFO_PARAMFIELD_PARAMVARIER_EXT_STRATEGY_REPEAT_LAST": "Repeat last value", + "INFO_PARAMFIELD_PARAMVARIER_EXT_STRATEGY_RECYCLE": "Recycle values", "INFO_PARAMFIELD_PARAMVARIER_IMPORT_FICHIER": "Import file", "INFO_PARAMFIELD_PARAMVARIER_MINMAXSTEP": "min: %s, max: %s, step: %s", "INFO_PARAMFIELD_PARAMVARIER_MODE": "Mode", diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index efa2d9ba84232826e707875717056569989a9283..7228186b3420c17e0e4e7633247c1623fca744fb 100644 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -212,6 +212,9 @@ "INFO_PARAMFIELD_PARAMFIXE": "fixé", "INFO_PARAMFIELD_PARAMLIE_LABEL": "Paramètre lié", "INFO_PARAMFIELD_PARAMLIE": "lié", + "INFO_PARAMFIELD_PARAMVARIER_EXT_STRATEGY": "Stratégie d'extension de la liste de valeurs", + "INFO_PARAMFIELD_PARAMVARIER_EXT_STRATEGY_REPEAT_LAST": "Répéter la dernière valeur", + "INFO_PARAMFIELD_PARAMVARIER_EXT_STRATEGY_RECYCLE": "Réutiliser les valeurs", "INFO_PARAMFIELD_PARAMVARIER_IMPORT_FICHIER": "Importer un fichier", "INFO_PARAMFIELD_PARAMVARIER_MINMAXSTEP": "min : %s, max : %s, pas : %s", "INFO_PARAMFIELD_PARAMVARIER_MODE": "Mode",