diff --git a/src/app/app.component.html b/src/app/app.component.html index 469793d4b198e5f6aff7d0fb80b891abbece2799..fe5b970bfa3db9d521f40cc739d65371eb9c1cd5 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -40,7 +40,7 @@ </div> <!-- règle gradée des colonnes Bootstrap --> - <div *ngIf="ruler" class="container"> + <div *ngIf="ruler" class="container-fluid"> <div class="row"> <div class="col 1 red">1</div> <div class="col 1 green">2</div> @@ -57,9 +57,9 @@ </div> </div> - <div class="container"> + <div class="container-fluid"> <div class="row"> - <div class="col 12"> + <div class="col-12"> <router-outlet></router-outlet> </div> </div> @@ -72,4 +72,4 @@ <br> <a href="http://www.irstea.fr/">Institut national de recherche en sciences et technologies pour l'environnement et l'agriculture</a> </div> --> -</footer> \ No newline at end of file +</footer> diff --git a/src/app/components/calculator-results/calculator-results.component.html b/src/app/components/calculator-results/calculator-results.component.html index 10445cc1a6bff4ddd433b48c76455389353d00c6..b9150353414ca58ca645d6a2c2b7402996559063 100644 --- a/src/app/components/calculator-results/calculator-results.component.html +++ b/src/app/components/calculator-results/calculator-results.component.html @@ -1,7 +1,5 @@ -<div class="row"> - <div class="col-12 mx-auto"> - <fixedvar-results [style.display]="getFixedVarResultsStyleDisplay()"> </fixedvar-results> - <section-results [style.display]="getSectionResultsStyleDisplay()"></section-results> - <remous-results [style.display]="getRemousResultsStyleDisplay()"></remous-results> - </div> +<div class="container-fluid"> + <fixedvar-results [style.display]="getFixedVarResultsStyleDisplay()"> </fixedvar-results> + <section-results [style.display]="getSectionResultsStyleDisplay()"></section-results> + <remous-results [style.display]="getRemousResultsStyleDisplay()"></remous-results> </div> diff --git a/src/app/components/fixedvar-results/fixedvar-results.component.html b/src/app/components/fixedvar-results/fixedvar-results.component.html index f17d9e8ebf7dd2f990a393f91923269bb9c98f99..f3ddd2076cd24f2b97897e85f6a1cc896de15b42 100644 --- a/src/app/components/fixedvar-results/fixedvar-results.component.html +++ b/src/app/components/fixedvar-results/fixedvar-results.component.html @@ -1,8 +1,5 @@ -<div class="row"> - <div class="col-12 mx-auto"> - <log></log> - </div> -</div> +<!-- journal --> +<log></log> <results-graph *ngIf="showVarResults"></results-graph> @@ -13,34 +10,30 @@ <div class="row"> <!-- table des résultats fixés --> - <div [ngClass]="(showVarResults) ? 'col-xs-12 col-sm-10 col-lg-8 col-xl-6 mx-auto':'col-xs-10 col-md-8 col-lg-6 col-xl-5 mx-auto'"> - <div class="row"> - <div [ngClass]="(showVarResults) ? 'col-12 col-sm-6':'col-12'" *ngIf="showFixedResults"> - <table class="table" style="border: 1px solid rgb(230,230,230);"> - <tr> - <th class="result_center">{{uitextParamFixes}}</th> - <th class="result_center">{{uitextValeurs}}</th> - </tr> - <tr *ngFor="let r of _fixedResults; let i=index"> - <td class="result_right {{getFixedResultClass(i)}}">{{r.label}}</td> - <td class="result_center {{getFixedResultClass(i)}}">{{r.value}}</td> - </tr> - </table> - </div> + <div class="col mx-auto" *ngIf="showFixedResults"> + <table class="table" style="border: 1px solid rgb(230,230,230);"> + <tr> + <th class="result_center">{{uitextParamFixes}}</th> + <th class="result_center">{{uitextValeurs}}</th> + </tr> + <tr *ngFor="let r of _fixedResults; let i=index"> + <td class="result_right {{getFixedResultClass(i)}}">{{r.label}}</td> + <td class="result_center {{getFixedResultClass(i)}}">{{r.value}}</td> + </tr> + </table> + </div> - <!-- table des résultats variés --> - <div class="col-12 col-sm-6" *ngIf="showVarResults"> - <table class="table table-striped" style="border: 1px solid rgb(230,230,230);"> - <tr> - <th class="result_center">{{_results.variableParamHeader}}</th> - <th class="result_center">{{_results.variableResultHeader}}</th> - </tr> - <tr *ngFor="let r of _varResults; let i=index"> - <td class="result_center">{{r.param}}</td> - <td class="result_center">{{r.result}}</td> - </tr> - </table> - </div> - </div> + <!-- table des résultats variés --> + <div class="col" *ngIf="showVarResults"> + <table class="table table-striped" style="border: 1px solid rgb(230,230,230);"> + <tr> + <th class="result_center">{{_results.variableParamHeader}}</th> + <th class="result_center">{{_results.variableResultHeader}}</th> + </tr> + <tr *ngFor="let r of _varResults; let i=index"> + <td class="result_center">{{r.param}}</td> + <td class="result_center">{{r.result}}</td> + </tr> + </table> </div> </div> \ No newline at end of file diff --git a/src/app/components/generic-calculator/calculator.component.html b/src/app/components/generic-calculator/calculator.component.html index f8955dc20cb608ff59222625cb25686f710de66a..a1f621c7e5dee4beb1df02333a85d30cb696fdf2 100644 --- a/src/app/components/generic-calculator/calculator.component.html +++ b/src/app/components/generic-calculator/calculator.component.html @@ -1,34 +1,42 @@ -<div *ngIf="hasData()" class="row"> +<div class="row"> + <!-- titre --> <div class="col-10"> <!-- on utilise [innerHTML] pour que les codes HTML comme soient interprétés correctement --> <h1 [innerHTML]="uitextTitre"></h1> </div> + + <!-- bouton de fermeture --> <div class="col-2 pr-0"> <button type="button" id="close-button" class="btn btn-primary float-right black" (click)="confirmModal.show()">×</button> </div> </div> -<field-set *ngFor="let fs of fieldSets" [style.display]="getFieldsetStyleDisplay(fs.id)" [fieldSet]=fs (onRadio)=onRadioClick($event) - (onSelectChange)=onSelectChanged($event)></field-set> -<div *ngIf="hasData()" class="row"> - <div class="col text-center"> - <p></p> - </div> -</div> +<div class="row"> + <div [ngClass]="(hasResults) ? 'col-12 col-lg-6' : 'col-12'"> + <div class="container-fluid"> + <!-- chapitres --> + <field-set *ngFor="let fs of fieldSets" [style.display]="getFieldsetStyleDisplay(fs.id)" [fieldSet]=fs (onRadio)=onRadioClick($event) + (onSelectChange)=onSelectChanged($event)></field-set> + </div> + + <!-- bouton calculer --> + <div class="row"> + <div class="col-12 text-center"> + <button type="button" class="button_compute" name="Calculer" (click)="doCompute()">{{uitextCalculer}}</button> + <p></p> + <p></p> + </div> + </div> -<div *ngIf="hasData()" class="row"> - <div class="col text-center"> - <button type="button" class="button_compute" name="Calculer" (click)="doCompute()">{{uitextCalculer}}</button> </div> -</div> -<div *ngIf="hasData()" class="row"> - <div class="col text-center"> - <p></p> + <!-- résultats --> + <div [ngClass]="(hasResults) ? 'col-12 col-lg-6' : 'col-12'"> + <calc-results id="resultsComp" (contentCompleted)="onResultsCompleted()"></calc-results> </div> </div> -<calc-results id="resultsComp" (contentCompleted)="onResultsCompleted()"></calc-results> +<!-- dialogue de confirmation de fermeture --> <div mdbModal #confirmModal="mdb-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" [config]="{backdrop: false, ignoreBackdropClick: true}"> <div class="modal-dialog" role="document"> <div class="modal-content"> @@ -39,7 +47,6 @@ <h4 class="modal-title w-100" id="myModalLabel">{{uitextCloseDialogTitle}}</h4> </div> <div class="modal-body"> - <!-- <h4> {{uitextCloseDialogText}} </h4> --> <h4 [innerHTML]="uitextCloseDialogText"></h4> </div> <div class="modal-footer"> diff --git a/src/app/components/generic-calculator/calculator.component.ts b/src/app/components/generic-calculator/calculator.component.ts index 37a28b7e2308cd05d8ab3fbbcc474cf6689f000e..ef8d98b0506d959e27f1334b58a86a834120c7ec 100644 --- a/src/app/components/generic-calculator/calculator.component.ts +++ b/src/app/components/generic-calculator/calculator.component.ts @@ -56,36 +56,45 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, OnDestroy, O return this._formulaire.getFieldSets(); } - private hasData() { + private get hasForm() { return this._formulaire != undefined; } + private get hasResults() { + if (this.hasForm) + return this._formulaire.hasResults; + return false; + } + private get uitextTitre() { - switch (this._formulaire.calculatorType) { - case CalculatorType.ConduiteDistributrice: - return this.intlService.localizeText("INFO_CONDDISTRI_TITRE"); + if (this.hasForm) + switch (this._formulaire.calculatorType) { + case CalculatorType.ConduiteDistributrice: + return this.intlService.localizeText("INFO_CONDDISTRI_TITRE"); - case CalculatorType.LechaptCalmon: - return this.intlService.localizeText("INFO_LECHAPT_TITRE"); + case CalculatorType.LechaptCalmon: + return this.intlService.localizeText("INFO_LECHAPT_TITRE"); - case CalculatorType.RegimeUniforme: - return this.intlService.localizeText("INFO_REGUNI_TITRE"); + case CalculatorType.RegimeUniforme: + return this.intlService.localizeText("INFO_REGUNI_TITRE"); - case CalculatorType.SectionParametree: - return this.intlService.localizeText("INFO_SECTPARAM_TITRE"); + case CalculatorType.SectionParametree: + return this.intlService.localizeText("INFO_SECTPARAM_TITRE"); - case CalculatorType.CourbeRemous: - return this.intlService.localizeText("INFO_REMOUS_TITRE") + case CalculatorType.CourbeRemous: + return this.intlService.localizeText("INFO_REMOUS_TITRE") - case CalculatorType.PabDimensions: - return this.intlService.localizeText("INFO_PABDIM_TITRE") + case CalculatorType.PabDimensions: + return this.intlService.localizeText("INFO_PABDIM_TITRE") - case CalculatorType.PabPuissance: - return this.intlService.localizeText("INFO_PABPUISS_TITRE") + case CalculatorType.PabPuissance: + return this.intlService.localizeText("INFO_PABPUISS_TITRE") - default: - return "Invalid calculator type " + this._formulaire.calculatorType; - } + default: + return "Invalid calculator type " + this._formulaire.calculatorType; + } + + return undefined; } private get uitextCalculer() { diff --git a/src/app/components/log/log.component.html b/src/app/components/log/log.component.html index 86b0f12b4d66b67f6649eefe2d2fff102c02353c..90fd45727409a32db29d8773e1cdb925cc3a8f8f 100644 --- a/src/app/components/log/log.component.html +++ b/src/app/components/log/log.component.html @@ -1,5 +1,5 @@ <div class="row" *ngIf="hasEntries"> - <div class="col-xs-12 col-lg-8 mx-auto"> + <div class="col-12"> <div class="hyd_log"> <div class="titre">{{uitextTitreJournal}}</div> <ul *ngFor="let r of _logEntries"> 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 753b689b36d223503031142880f1d39790d623a1..e99500c62ff0d4c964e41384055462f4d9a8d098 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 @@ -1,15 +1,16 @@ <div class="row"> <!-- input de saisie de la valeur --> - <div class="col-12 col-sm-6 pt-3"> + <div class="col-12 col-sm-9 pt-3"> <ngparam-input [inputDisabled]="isInputDisabled" [param]="_param" [title]="title"></ngparam-input> </div> - <div class="btn-group" role="group"> - <!-- radio "fixé" --> + <div class="btn-group col" role="group"> <!-- px-3 : padding left/right 3 --> <!-- py-3 : padding top/bottom 3 --> <!-- h-50 : hauteur relative de l'élément par rapport au parent à 50%--> <!-- cf. https://getbootstrap.com/docs/4.0/utilities/spacing --> + + <!-- radio "fixé" --> <label *ngIf="hasRadioFix()" class="{{radioFixClass}} h-75 px-3 py-3" [(ngModel)]="radioModel" mdbRadio="Left" name="radio_param_{{symbol}}" value="fix" (click)="onRadioClick(symbol, 'fix')" [checked]=radioFixCheck [disabled]=isDisabled id="radio_fix"> {{uitextParamFixe}} diff --git a/src/app/components/remous-results/remous-results.component.html b/src/app/components/remous-results/remous-results.component.html index 4c1e9250999f3e13aa6661a6b006a5690093712d..ebf23827774e927b403c6d911e00b3aaf1501549 100644 --- a/src/app/components/remous-results/remous-results.component.html +++ b/src/app/components/remous-results/remous-results.component.html @@ -1,48 +1,42 @@ <div class="row"> - <div class="col-10 mx-auto"> + <div class="col"> <chart [type]="graph1_type" [data]="graph1_data" [options]="graph1_options"></chart> </div> </div> <div class="row"> - <div class="col-10 mx-auto"> + <div class="col"> <chart *ngIf="extraGraph" [type]="graph2_type" [data]="graph2_data" [options]="graph2_options"></chart> </div> </div> <!-- journal --> -<div class="row"> - <div class="col-12 mx-auto"> - <log></log> - </div> -</div> +<log></log> <div class="row"> - <div class="col-xs-12 col-lg-6 mx-auto"> - <!-- résultats numériques --> - <table class="table"> - <thead> - <tr> - <th></th> - <th>{{uitextLigneFluviale}}</th> - <th></th> - <th>{{uitextLigneTorrentielle}}</th> - <th></th> - </tr> - <tr> - <th>{{uitextAbscisse}}</th> - <th>{{uitextTirant}}</th> - <th>{{extraParamLabel}}</th> - <th>{{uitextTirant}}</th> - <th>{{extraParamLabel}}</th> - </tr> - </thead> - <tr *ngFor="let r of series; let i=index" [class]="getResultClass(i)"> - <td>{{r.abs}}</td> - <td>{{r.flu}}</td> - <td>{{r.extraFlu}}</td> - <td>{{r.tor}}</td> - <td>{{r.extraTor}}</td> + <!-- résultats numériques --> + <table class="table"> + <thead> + <tr> + <th></th> + <th>{{uitextLigneFluviale}}</th> + <th></th> + <th>{{uitextLigneTorrentielle}}</th> + <th></th> </tr> - </table> - </div> + <tr> + <th>{{uitextAbscisse}}</th> + <th>{{uitextTirant}}</th> + <th>{{extraParamLabel}}</th> + <th>{{uitextTirant}}</th> + <th>{{extraParamLabel}}</th> + </tr> + </thead> + <tr *ngFor="let r of series; let i=index" [class]="getResultClass(i)"> + <td>{{r.abs}}</td> + <td>{{r.flu}}</td> + <td>{{r.extraFlu}}</td> + <td>{{r.tor}}</td> + <td>{{r.extraTor}}</td> + </tr> + </table> </div> \ No newline at end of file diff --git a/src/app/components/section-results/section-results.component.html b/src/app/components/section-results/section-results.component.html index e21f3bd982943cca5766a6dc95dd770405f0a1d7..674f8026d070535ca080f6a2768a39ed5e033077 100644 --- a/src/app/components/section-results/section-results.component.html +++ b/src/app/components/section-results/section-results.component.html @@ -1,12 +1,14 @@ +<!-- graphique --> <div class="row"> - <div class="col-xs-2 col-md-6"> - <!-- graphique --> - <section-canvas class="float-xs-none float-md-right" #sectionCanvas></section-canvas> + <div class="col" style="text-align: center"> + <section-canvas></section-canvas> </div> +</div> - <div class="col-xs-2 col-md-6"> - <!-- tableau de valeurs --> - <table> +<!-- tableau de valeurs --> +<div class="row"> + <div class="col mx-auto"> + <table style="width: 100%"> <tr *ngFor="let r of _results; let i=index" [class]="getResultClass(i)"> <td class="result_label">{{r.label}}</td> <td class="result_value">{{r.value}}</td> diff --git a/src/app/components/section-results/section-results.component.ts b/src/app/components/section-results/section-results.component.ts index 0ec90da170de6d1e383bb075cfbe9a0caed3e23d..61e28aa7e801f4f4d83fea95d43ae2bc68e89794 100644 --- a/src/app/components/section-results/section-results.component.ts +++ b/src/app/components/section-results/section-results.component.ts @@ -53,7 +53,7 @@ export class SectionResultsComponent { "Yco": { r: 255, g: 0, b: 255 }, }; - @ViewChild("sectionCanvas") + @ViewChild(SectionCanvasComponent) private _sectionCanvas: SectionCanvasComponent; public set results(r: SectionResults) { @@ -89,4 +89,4 @@ export class SectionResultsComponent { private getResultClass(i: number) { return "result_id_" + String(i & 1); } -} \ No newline at end of file +} diff --git a/src/app/formulaire/formulaire-definition.ts b/src/app/formulaire/formulaire-definition.ts index 8bd2ed0b6907924085ddd46535bc27d665a83def..23615dcf41abd49f57a27b7121f7e6d3fd01d10a 100644 --- a/src/app/formulaire/formulaire-definition.ts +++ b/src/app/formulaire/formulaire-definition.ts @@ -344,7 +344,8 @@ export class FormulaireDefinition extends Observable { break; } - newCal.radioState = ParamRadioConfig.CAL; + if (newCal != undefined) + newCal.radioState = ParamRadioConfig.CAL; } this.resetResults(); @@ -1203,7 +1204,7 @@ export class FormulaireDefinition extends Observable { return this._remousResults.hasResults(); } - private hasResults(): boolean { + public get hasResults(): boolean { return this.hasFixVarResults() || this.hasSectionResults() || this.hasRemousResults(); } @@ -1219,7 +1220,7 @@ export class FormulaireDefinition extends Observable { } } - if (this.hasResults()) + if (this.hasResults) this.doCompute(); // pour mettre à jour la langue } }