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 c7b8d3803df4042c8549953787439651ba70b098..dae20c9701c99d18bd825730508dc4395caf3a2f 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 @@ -23,7 +23,7 @@ <input matInput class="form-control" type="number" inputmode="numeric" name="min-value" step="0.01" [placeholder]="uitextValeurMini" [(ngModel)]="minValue" #min="ngModel" name="min" (input)="minMaxForm.controls.max.updateValueAndValidity()" [appJalhydModelValidationMin]="param" - required pattern="^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$"> + required pattern="^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$" (keyup.enter)="onValidate()" (keyup.escape)="onCancel()"> <mat-error *ngIf="min.errors"> <div *ngIf="min.errors.required || min.errors.pattern"> @@ -39,7 +39,7 @@ <input matInput class="form-control" type="number" inputmode="numeric" name="max-value" step="0.01" [placeholder]="uitextValeurMaxi" [(ngModel)]="maxValue" #max="ngModel" name="max" (input)="minMaxForm.controls.min.updateValueAndValidity()" [appJalhydModelValidationMax]="param" - required pattern="^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$"> + required pattern="^-?([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$" (keyup.enter)="onValidate()" (keyup.escape)="onCancel()"> <mat-error *ngIf="max.errors"> <div *ngIf="max.errors.required || max.errors.pattern"> @@ -54,7 +54,8 @@ <mat-form-field> <input matInput class="form-control" type="number" inputmode="numeric" name="step-value" step="0.01" [placeholder]="uitextPasVariation" [(ngModel)]="stepValue" #step="ngModel" name="step" - [appJalhydModelValidationStep]="param" required pattern="^([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$"> + [appJalhydModelValidationStep]="param" required pattern="^([0-9]*\.)?([0-9]+[Ee]-?)?[0-9]+$" + (keyup.enter)="onValidate()" (keyup.escape)="onCancel()"> <mat-error *ngIf="step.errors"> {{ uitextMustBePositive }} @@ -128,4 +129,4 @@ {{ uitextValidate }} </button> </div> -</div> \ No newline at end of file +</div> 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 f5200cfd0e09da4212e8b4e9dd1893184cc66c60..7f28b26ddab5397d2453fb115a0c019d286b4ba5 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 @@ -290,20 +290,22 @@ export class DialogEditParamValuesComponent implements OnInit { } public onValidate() { - switch (this.param.valueMode) { - case ParamValueMode.LISTE: - this.data.param.setValueList(this, this.param.valueList); - break; - - case ParamValueMode.MINMAX: - this.data.param.setMinValue(this, this.param.minValue); - this.data.param.setMaxValue(this, this.param.maxValue); - this.data.param.setStepValue(this, this.param.stepValue); - break; + if (this.isFormValid) { + switch (this.param.valueMode) { + case ParamValueMode.LISTE: + this.data.param.setValueList(this, this.param.valueList); + break; + + case ParamValueMode.MINMAX: + this.data.param.setMinValue(this, this.param.minValue); + this.data.param.setMaxValue(this, this.param.maxValue); + this.data.param.setStepValue(this, this.param.stepValue); + break; + } + this.dialogRef.close({ + cancelled: false + }); } - this.dialogRef.close({ - cancelled: false - }); } /**