diff --git a/src/app/components/dialog-load-session/dialog-load-session.component.html b/src/app/components/dialog-load-session/dialog-load-session.component.html index 75e1430613a0f3b9b16b9252fdf8fef0d1b4e9f3..b9f411fb767fdff20042560145f24d00edfef737 100644 --- a/src/app/components/dialog-load-session/dialog-load-session.component.html +++ b/src/app/components/dialog-load-session/dialog-load-session.component.html @@ -2,10 +2,6 @@ <form [formGroup]="loadSessionForm"> - <!-- <input type="file" required [(ngModel)]="file" - name="fileSelection" #fileSelection="ngModel"> --> - - <div mat-dialog-content> <mat-form-field> diff --git a/src/app/components/fixedvar-results/fixed-results.component.html b/src/app/components/fixedvar-results/fixed-results.component.html index 5e779313aa458ff7af63ebcbe7ec80a036043d64..b35f932d4c58789bd991bd20f33c13d0dd2ad727 100644 --- a/src/app/components/fixedvar-results/fixed-results.component.html +++ b/src/app/components/fixedvar-results/fixed-results.component.html @@ -1,5 +1,4 @@ <div class="fixed-results-container" *ngIf="hasFixedParameters"> - <!-- table des résultats fixés --> <table mat-table [dataSource]="dataSet"> @@ -14,7 +13,5 @@ <tr mat-header-row *matHeaderRowDef="tableColumns"></tr> <tr mat-row *matRowDef="let row; columns: tableColumns;"></tr> - - <!-- <tr *ngIf="hasParameterResult" vertical-result-element [result-element]=resultElement [_label]=resultLabel> --> </table> </div> diff --git a/src/app/components/generic-calculator/calculator.component.scss b/src/app/components/generic-calculator/calculator.component.scss index 0226d4398d872466abcaeecc83a62f029a43cabc..b9275137bf8288272c846be0520777d73c5e211f 100644 --- a/src/app/components/generic-calculator/calculator.component.scss +++ b/src/app/components/generic-calculator/calculator.component.scss @@ -44,6 +44,10 @@ mat-card { &#calc-card-results { margin-left: 1em; margin-right: 1em; + + mat-card-header { + margin-bottom: 1em; + } } // @WARNING ::ng-deep est déprécié, mais y a rien d'autre pour diff --git a/src/app/components/generic-input/generic-input.component.html b/src/app/components/generic-input/generic-input.component.html index 28d062b05ba539d9f0419b166ddae09068d9aaa3..af97d05051c9d46778bb2c8a75116c26436bda3e 100644 --- a/src/app/components/generic-input/generic-input.component.html +++ b/src/app/components/generic-input/generic-input.component.html @@ -1,7 +1,7 @@ <mat-form-field> - <input matInput class="form-control" type="text" inputmode="numeric" - [id]="inputId" [disabled]="isDisabled" [(ngModel)]="uiValue" [placeholder]="title" - required> + <input matInput #inputControl="ngModel" class="form-control" type="text" inputmode="numeric" + [id]="inputId" [name]="inputId" [disabled]="isDisabled" [(ngModel)]="uiValue" [placeholder]="title" + pattern="-?([0-9]+\.)?[0-9]+" required> <mat-error>{{ errorMessage }}</mat-error> </mat-form-field> diff --git a/src/app/components/generic-input/generic-input.component.ts b/src/app/components/generic-input/generic-input.component.ts index 15c56f546c23552b27be30af22e17ab9211b5d8b..a7cd9064ce906ff59382e4dc0382751f45fd1073 100644 --- a/src/app/components/generic-input/generic-input.component.ts +++ b/src/app/components/generic-input/generic-input.component.ts @@ -1,5 +1,5 @@ -import { Input, Output, EventEmitter, ChangeDetectorRef, OnChanges } from "@angular/core"; - +import { Input, Output, EventEmitter, ChangeDetectorRef, OnChanges, ViewChild } from "@angular/core"; +import { NgModel } from "@angular/forms"; import { BaseComponent } from "../base/base.component"; import { isNumeric } from "jalhyd"; @@ -75,6 +75,8 @@ export abstract class GenericInputComponent extends BaseComponent implements OnC */ private _errorMessageModel: string; + @ViewChild("inputControl") inputField: NgModel; + constructor(private cdRef: ChangeDetectorRef) { super(); // generate "unique" input id @@ -132,6 +134,12 @@ export abstract class GenericInputComponent extends BaseComponent implements OnC if (this.isValid !== old) { this.emitValidChanged(); } + // répercussion des erreurs sur le Form angular, pour faire apparaître/disparaître les mat-error + if (b) { + this.inputField.control.setErrors(null); + } else { + this.inputField.control.setErrors({ "incorrect": true }); + } } private validateModel() { diff --git a/src/app/components/ngparam-input/ngparam-input.component.ts b/src/app/components/ngparam-input/ngparam-input.component.ts index 69be65ac350b3d7b23272a41d9d07653c06a1fd0..7e1af55cead345ce13871671d3174e359cfbc07f 100644 --- a/src/app/components/ngparam-input/ngparam-input.component.ts +++ b/src/app/components/ngparam-input/ngparam-input.component.ts @@ -2,7 +2,7 @@ import { Component, ChangeDetectorRef, OnDestroy } from "@angular/core"; -import { isNumeric, Message, Observer } from "jalhyd"; +import { Message, Observer } from "jalhyd"; import { I18nService } from "../../services/internationalisation/internationalisation.service"; import { NgParameter } from "../../formulaire/ngparam"; diff --git a/src/app/components/remous-results/remous-results.component.ts b/src/app/components/remous-results/remous-results.component.ts index 21d0cab670f57bb15bf1d1463af733c2f0237f3e..a6ff0306bc8d9a38c3033a6867a7f595b320085c 100644 --- a/src/app/components/remous-results/remous-results.component.ts +++ b/src/app/components/remous-results/remous-results.component.ts @@ -7,6 +7,8 @@ import { LogComponent } from "../../components/log/log.component"; import { RemousResults } from "../../results/remous-results"; import { CalculatorResults } from "../../results/calculator-results"; import { VarResultsComponent } from "../fixedvar-results/var-results.component"; +import { ApplicationSetupService } from "../../services/app-setup/app-setup.service"; +import { ServiceFactory } from "../../services/service-factory"; /** * données pour une ligne dans le graphe @@ -32,6 +34,8 @@ class LineData { */ private _data = {}; + private appSetup: ApplicationSetupService; + /** * profondeur à laquelle est dessinée la ligne * les profondeurs les plus petites sont dessinées derrière les profondeurs les plus grandes @@ -44,6 +48,7 @@ class LineData { for (let i = this._tx.length - 1; i >= 0; i--) { this._ty.push(null); } + this.appSetup = ServiceFactory.instance.applicationSetupService; } public getYat(x: number) {