From 2020cfecd19bfe2bb76001068742b9416b1ed166 Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Wed, 26 Aug 2020 14:35:49 +0200 Subject: [PATCH 01/13] Work on #431 - make QA variable in PAB --- jalhyd_branch | 2 +- .../pab-table/pab-table.component.html | 9 +++ .../pab-table/pab-table.component.scss | 10 +++ .../pab-table/pab-table.component.ts | 66 +++++++++++++------ .../param-field-line.component.ts | 12 +++- src/styles.scss | 49 ++++++++++++++ 6 files changed, 124 insertions(+), 24 deletions(-) diff --git a/jalhyd_branch b/jalhyd_branch index de50629b8..47cea4573 100644 --- a/jalhyd_branch +++ b/jalhyd_branch @@ -1 +1 @@ -278-prebarrage-calculable-avec-champs-vides-cassiopee-nghyd-470 +261-pab-pouvoir-lier-et-varier-le-debit-d-attrait diff --git a/src/app/components/pab-table/pab-table.component.html b/src/app/components/pab-table/pab-table.component.html index 96efe09a1..777573a7f 100644 --- a/src/app/components/pab-table/pab-table.component.html +++ b/src/app/components/pab-table/pab-table.component.html @@ -96,6 +96,15 @@ </mat-option> </mat-select> + <div *ngIf="isQA(cell)" class="qaFieldLineContainer"> + <div class="qaLabel"> + {{ cell.title }} + </div> + <param-field-line class="qaFieldLine" [param]="cell.model" (radio)="inputValueChanged($event, cell)" + (input)="inputValueChanged($event, cell)"> + </param-field-line> + </div> + <span *ngIf="! hasModel(cell)">{{ cellValue(cell) }}</span> </td> </tr> diff --git a/src/app/components/pab-table/pab-table.component.scss b/src/app/components/pab-table/pab-table.component.scss index abd5be33c..5b64df679 100644 --- a/src/app/components/pab-table/pab-table.component.scss +++ b/src/app/components/pab-table/pab-table.component.scss @@ -47,3 +47,13 @@ mat-card-content { } } } + +.qaFieldLineContainer { + padding: 0 10px; +} + +.qaLabel { + margin-top: 13px; + margin-right: 10px; + font-weight: bold; +} diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts index b3c8934ec..bacee1c96 100644 --- a/src/app/components/pab-table/pab-table.component.ts +++ b/src/app/components/pab-table/pab-table.component.ts @@ -1,6 +1,6 @@ import { Component, Input, Output, EventEmitter, OnInit, AfterViewInit } from "@angular/core"; -import { LoiDebit } from "jalhyd"; +import { LoiDebit, ParamCalculability } from "jalhyd"; import { MatDialog } from "@angular/material/dialog"; @@ -27,6 +27,7 @@ import { NotificationsService } from "../../services/notifications.service"; import { PabTable } from "../../formulaire/elements/pab-table"; import { DialogEditPabComponent } from "../dialog-edit-pab/dialog-edit-pab.component"; import { AppComponent } from "../../app.component"; +import { NgParameter, ParamRadioConfig } from "../../formulaire/elements/ngparam"; /** * The big editable data grid for calculator type "Pab" (component) @@ -101,7 +102,7 @@ export class PabTableComponent implements AfterViewInit, OnInit { /** returns true if the cell is an editable number */ public isNumberInput(cell: any): boolean { - return this.hasModel(cell) && ! this.isSelect(cell); + return this.hasModel(cell) && ! this.isSelect(cell) && ! this.isQA(cell); } /** returns true if the cell is a select box */ @@ -109,6 +110,11 @@ export class PabTableComponent implements AfterViewInit, OnInit { return this.hasModel(cell) && (cell.options !== undefined); } + /** returns true if the cell is a QA (Attraction flow) editor */ + public isQA(cell: any): boolean { + return this.hasModel(cell) && cell.qa; + } + /** value to display in a cell, if it is not editable */ public cellValue(cell: any) { if (cell === undefined) { @@ -166,8 +172,12 @@ export class PabTableComponent implements AfterViewInit, OnInit { */ public isInvalid(cell: any): boolean { let valid = true; - if (this.hasModel(cell) && cell.model instanceof ParamDefinition) { - valid = valid && cell.model.isValid; + if (this.hasModel(cell)) { + if (cell.model instanceof ParamDefinition) { + valid = valid && cell.model.isValid; + } else if (cell.model instanceof NgParameter) { // for QA (currently has domain ANY but that might change) + valid = valid && cell.model.paramDefinition.isValid; + } } if (cell.uiValidity !== undefined) { valid = valid && cell.uiValidity; @@ -443,7 +453,7 @@ export class PabTableComponent implements AfterViewInit, OnInit { const nDigits = this.appSetupService.displayPrecision; for (const c of this.model.children) { for (const p of c.parameterIterator) { - if (p.visible) { + if (p.visible && p.symbol !== "QA") { // QA might vary ! p.singleValue = round(p.singleValue, nDigits); } } @@ -461,7 +471,7 @@ export class PabTableComponent implements AfterViewInit, OnInit { bs = bs.concat(this.model.downWall); this.headers.push({ title: this.i18nService.localizeText("INFO_PAB_BASSIN"), - colspan: 6, + colspan: 5, selectable: bs }); // 1 header for each device of the wall having the most devices (including downwall) @@ -476,7 +486,7 @@ export class PabTableComponent implements AfterViewInit, OnInit { // A. build columns set this.cols = []; - // 6 cols for basin + // 5 cols for basin this.cols.push({ title: this.i18nService.localizeText("INFO_PAB_NUM_BASSIN"), selectable: bs @@ -489,10 +499,10 @@ export class PabTableComponent implements AfterViewInit, OnInit { title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "BB"), selectable: bs }); - this.cols.push({ + /* this.cols.push({ title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "QA"), selectable: bs - }); + }); */ this.cols.push({ title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "ZRMB"), selectable: bs @@ -543,14 +553,14 @@ export class PabTableComponent implements AfterViewInit, OnInit { // basin number deviceParamRow.cells.push({ value: childIndex + 1, - rowspan: maxNbParams + 1, + rowspan: maxNbParams + 2, class: "basin_number", selectable: cloison }); - // 4 empty cells + // 3 empty cells deviceParamRow.cells.push({ - colspan: 4, - rowspan: maxNbParams , + colspan: 3, + rowspan: maxNbParams, selectable: cloison }); // ZRAM @@ -562,7 +572,7 @@ export class PabTableComponent implements AfterViewInit, OnInit { // 1 empty cell if (i === 1) { deviceParamRow.cells.push({ - rowspan: maxNbParams, + rowspan: maxNbParams + 1, selectable: cloison }); } @@ -639,10 +649,6 @@ export class PabTableComponent implements AfterViewInit, OnInit { model: cloison.prms.BB, title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "BB") }, - { - model: cloison.prms.QA, - title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "QA") - }, { model: cloison.prms.ZRMB, title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "ZRMB") @@ -652,11 +658,29 @@ export class PabTableComponent implements AfterViewInit, OnInit { // fill horizontal space for (let i = 0; i < maxNbDevices; i++) { basinRow.cells.push({ - colspan: 3 + colspan: 3, + rowspan: 2 }); } // done ! this.rows.push(basinRow); + // 1 row for QA editor + const qaParam = new NgParameter(cloison.prms.QA, this.pabTable.form); + qaParam.radioConfig = ParamRadioConfig.VAR; + const qaRow: { selectable: any, cells: any[] } = { + selectable: undefined, + cells: [ + { + model: qaParam, + colspan: 3, + qa: true, + title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "QA") + } + ] + }; + this.rows.push(qaRow); + // done ! + childIndex ++; } @@ -681,9 +705,9 @@ export class PabTableComponent implements AfterViewInit, OnInit { class: "basin_number", selectable: this.model.downWall }); - // 4 empty cells + // 3 empty cells deviceParamRowDW.cells.push({ - colspan: 4, + colspan: 3, rowspan: maxNbParamsDW , selectable: this.model.downWall }); 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 22b7a92ad..614521e14 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 @@ -4,7 +4,7 @@ import { I18nService } from "../../services/internationalisation.service"; import { NgParameter, ParamRadioConfig } from "../../formulaire/elements/ngparam"; import { NgParamInputComponent } from "../ngparam-input/ngparam-input.component"; import { ServiceFactory } from "../../services/service-factory"; -import { ParamValueMode, ParallelStructure, ParamCalculability } from "jalhyd"; +import { ParamValueMode, ParallelStructure, ParamCalculability, Pab } from "jalhyd"; import { FormulaireService } from "../../services/formulaire.service"; import { ParamLinkComponent } from "../param-link/param-link.component"; import { ParamValuesComponent } from "../param-values/param-values.component"; @@ -173,7 +173,7 @@ export class ParamFieldLineComponent implements OnChanges { return this._formService.getLinkableValues(this.param).length > 0; } - // ou un seul module de calcul "ouvrages parallèles" + // ou un seul module de calcul "ouvrages parallèles" avec au moins 2 ouvrages if (this._formService.formulaires[0].currentNub instanceof ParallelStructure) { const ps: ParallelStructure = this._formService.formulaires[0].currentNub; if (ps.structures.length > 1) { @@ -181,6 +181,14 @@ export class ParamFieldLineComponent implements OnChanges { } } + // ou un seul module de calcul "PAB" avec au mois 2 ouvrages + if (this._formService.formulaires[0].currentNub instanceof Pab) { + const pab: Pab = this._formService.formulaires[0].currentNub; + if (pab.children.length > 1) { + return this._formService.getLinkableValues(this.param).length > 0; + } + } + } return false; } diff --git a/src/styles.scss b/src/styles.scss index 4f086079e..727ac59f1 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -136,6 +136,55 @@ field-set { } } +.qaFieldLineContainer { + + .qaFieldLine { + .mat-button-toggle-label-content { + line-height: 24px !important; + } + } + + ngparam-input { + height: 38px; + margin-top: 0; + } + + param-values { + margin-top: 0; + } + + param-link { + margin-top: 0; + + .status-icons-container { + display: none; + } + } + + mat-form-field { + + .mat-form-field-wrapper { + padding-bottom: 5px; + } + + input.form-control.mat-input-element { + width: 100%; + } + + button.param-values-more { + display: none; + } + + .mat-form-field-underline { + display: none; + } + + mat-error.mat-error { + display: none; + } + } +} + .pab-data-table { .editable-cell-bg { -- GitLab From c5d0eecb96c67ea1a73595819016c9ccb8688458 Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Thu, 27 Aug 2020 10:52:40 +0200 Subject: [PATCH 02/13] Work on #431 - update label in Pab QA links --- src/app/components/param-link/param-link.component.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/components/param-link/param-link.component.ts b/src/app/components/param-link/param-link.component.ts index 058ed5a28..89255ef13 100644 --- a/src/app/components/param-link/param-link.component.ts +++ b/src/app/components/param-link/param-link.component.ts @@ -1,7 +1,7 @@ import { Component, Input, Output, EventEmitter, OnChanges, OnDestroy } from "@angular/core"; import { NgParameter } from "../../formulaire/elements/ngparam"; -import { LinkedValue, ParamValueMode, Observer, Structure, acSection, ParamDefinition, ChildNub } from "jalhyd"; +import { LinkedValue, ParamValueMode, Observer, acSection, ParamDefinition, ChildNub, Cloisons, Pab } from "jalhyd"; import { FormulaireService } from "../../services/formulaire.service"; import { I18nService } from "../../services/internationalisation.service"; import { FormulaireDefinition } from "../../formulaire/definition/form-definition"; @@ -169,7 +169,14 @@ export class ParamLinkComponent implements OnChanges, Observer, OnDestroy { } // 1. Paramètre / résultat d'un Nub enfant au sein d'un Nub parent - if (i.nub instanceof ChildNub) { + if ( + (i.nub instanceof ChildNub) + || ( + (i.nub instanceof Cloisons) + && i.nub.parent !== undefined + && (i.nub.parent instanceof Pab) + ) + ) { let pos: number; pos = i.nub.findPositionInParent(); return `${preview} - ` + sprintf( -- GitLab From de4c556edf0a43284624d11ba4ee4ffcfeb8a9f8 Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Thu, 27 Aug 2020 12:03:56 +0200 Subject: [PATCH 03/13] Work on #431 - do not capture Tab events --- .../ngparam-input/ngparam-input.component.ts | 21 +++++++++++++++++-- .../pab-table/pab-table.component.html | 2 +- .../pab-table/pab-table.component.ts | 2 +- .../param-field-line.component.html | 2 +- .../param-field-line.component.ts | 4 ++++ 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/app/components/ngparam-input/ngparam-input.component.ts b/src/app/components/ngparam-input/ngparam-input.component.ts index 81db20827..cbaf4e2fd 100644 --- a/src/app/components/ngparam-input/ngparam-input.component.ts +++ b/src/app/components/ngparam-input/ngparam-input.component.ts @@ -1,6 +1,6 @@ // cf. https://blog.thoughtram.io/angular/2016/07/27/custom-form-controls-in-angular-2.html -import { Component, ChangeDetectorRef, OnDestroy } from "@angular/core"; +import { Component, ChangeDetectorRef, OnDestroy, Input, ElementRef } from "@angular/core"; import { Message, Observer } from "jalhyd"; @@ -17,6 +17,10 @@ import { ApplicationSetupService } from "../../services/app-setup.service"; ] }) export class NgParamInputComponent extends GenericInputComponentDirective implements Observer, OnDestroy { + + @Input() + public captureTabEvents: boolean; + /** * paramètre géré */ @@ -33,9 +37,11 @@ export class NgParamInputComponent extends GenericInputComponentDirective implem constructor( intlService: I18nService, appSetupService: ApplicationSetupService, - cdRef: ChangeDetectorRef + cdRef: ChangeDetectorRef, + private element: ElementRef ) { super(cdRef, intlService, appSetupService); + this.captureTabEvents = true; } /** @@ -114,6 +120,17 @@ export class NgParamInputComponent extends GenericInputComponentDirective implem } } + /** + * Renvoie l'événement au composant du dessus + */ + public onTabPressed(event, shift: boolean) { + this.tabPressed.emit({ originalEvent: event, shift: shift }); + // stop event propagation ? + if (this.captureTabEvents) { + return false; + } // else let it bubble ! + } + public ngOnDestroy() { this._paramDef.removeObserver(this); } diff --git a/src/app/components/pab-table/pab-table.component.html b/src/app/components/pab-table/pab-table.component.html index 777573a7f..488fe6565 100644 --- a/src/app/components/pab-table/pab-table.component.html +++ b/src/app/components/pab-table/pab-table.component.html @@ -101,7 +101,7 @@ {{ cell.title }} </div> <param-field-line class="qaFieldLine" [param]="cell.model" (radio)="inputValueChanged($event, cell)" - (input)="inputValueChanged($event, cell)"> + (input)="inputValueChanged($event, cell)" [captureTabEvents]="false"> </param-field-line> </div> diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts index bacee1c96..5f8455f9a 100644 --- a/src/app/components/pab-table/pab-table.component.ts +++ b/src/app/components/pab-table/pab-table.component.ts @@ -1,6 +1,6 @@ import { Component, Input, Output, EventEmitter, OnInit, AfterViewInit } from "@angular/core"; -import { LoiDebit, ParamCalculability } from "jalhyd"; +import { LoiDebit } from "jalhyd"; import { MatDialog } from "@angular/material/dialog"; 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 1143ac972..e1faeebf2 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 @@ -4,7 +4,7 @@ <div fxFlex="1 0 120px"> <!-- composant pour gérer le cas général (valeur numérique à saisir) --> <ngparam-input [title]="param.title" [hidden]="! isRadioFixChecked" (change)="onInputChange($event)" - (tabPressed)="onTabPressed($event)"> + (tabPressed)="onTabPressed($event)" [captureTabEvents]="captureTabEvents"> </ngparam-input> <!-- composant pour gérer le cas "paramètre calculé" --> 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 614521e14..f76d819c2 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 @@ -26,6 +26,7 @@ export class ParamFieldLineComponent implements OnChanges { this._formService = ServiceFactory.formulaireService; this.valid = new EventEmitter(); this.inputChange = new EventEmitter(); + this.captureTabEvents = true; } public get uitextParamFixe() { @@ -86,6 +87,9 @@ export class ParamFieldLineComponent implements OnChanges { @Input() public param: NgParameter; + @Input() + public captureTabEvents: boolean; + @ViewChild(NgParamInputComponent, { static: true }) private _ngParamInputComponent: NgParamInputComponent; -- GitLab From 7b8271250a863d4bdb233317d727144574e6e791 Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Thu, 27 Aug 2020 15:17:04 +0200 Subject: [PATCH 04/13] Work on #431 - proper display of variating QA in boundaries selector and chart --- .../pab-profile-chart.component.ts | 8 ++- .../pab-table/pab-table.component.ts | 22 ++++++- .../variable-results-selector.component.ts | 43 +------------- src/app/formulaire/definition/form-pab.ts | 17 +++++- src/app/results/calculator-results.ts | 59 ++++++++++++++++++- src/locale/messages.en.json | 1 + src/locale/messages.fr.json | 1 + 7 files changed, 102 insertions(+), 49 deletions(-) diff --git a/src/app/components/pab-profile-chart/pab-profile-chart.component.ts b/src/app/components/pab-profile-chart/pab-profile-chart.component.ts index 5d9220b27..449c050ff 100644 --- a/src/app/components/pab-profile-chart/pab-profile-chart.component.ts +++ b/src/app/components/pab-profile-chart/pab-profile-chart.component.ts @@ -12,6 +12,7 @@ import { AppComponent } from "../../app.component"; import { CloisonAval, Cloisons, LoiDebit } from "jalhyd"; import { sprintf } from "sprintf-js"; +import { CalculatorResults } from 'app/results/calculator-results'; @Component({ selector: "pab-profile-chart", @@ -453,13 +454,14 @@ export class PabProfileChartComponent extends ResultsComponentDirective implemen * @param n index of the variating parameter(s) iteration */ private getLegendForSeries(n: number): string { - let i = 0; + /* let i = 0; return this.varValues.map((vv) => { const vp = this._results.variatedParameters[i]; i++; let value = "0"; value = vv[n]; - return `${vp.param.symbol} = ${value}`; - }).join(", "); + return `${vp.symbol} = ${value}`; + }).join(", "); */ + return CalculatorResults.variatingModalityLabel(this.varValues, this._results, n); } } diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts index 5f8455f9a..225d7da87 100644 --- a/src/app/components/pab-table/pab-table.component.ts +++ b/src/app/components/pab-table/pab-table.component.ts @@ -1,6 +1,6 @@ import { Component, Input, Output, EventEmitter, OnInit, AfterViewInit } from "@angular/core"; -import { LoiDebit } from "jalhyd"; +import { LoiDebit, ParamValueMode } from "jalhyd"; import { MatDialog } from "@angular/material/dialog"; @@ -1057,7 +1057,10 @@ export class PabTableComponent implements AfterViewInit, OnInit { ); // copy parameter values for (const p of si.prms) { - newChild.getParameter(p.symbol).singleValue = p.singleValue; + // @TODO QA may vary + if (p.visible && p.symbol !== "QA") { // QA might vary ! + newChild.getParameter(p.symbol).singleValue = p.singleValue; + } } // copy children if (si instanceof ParallelStructure) { @@ -1242,7 +1245,8 @@ export class PabTableComponent implements AfterViewInit, OnInit { for (const av of availableVariables) { for (const c of this.selectedItems) { for (const p of c.parameterIterator) { - if (p.visible && p.symbol === av.value) { + // @TODO what todo when p varies (QA only) ? + if (p.visible && p.symbol === av.value && ! p.hasMultipleValues) { av.occurrences ++; if (av.first === undefined) { av.first = p.singleValue; @@ -1319,6 +1323,10 @@ export class PabTableComponent implements AfterViewInit, OnInit { case "set-value": for (const s of this.selectedItems) { for (const p of s.parameterIterator) { // deep + // force single mode (QA only) + if (p.hasMultipleValues) { + p.valueMode = ParamValueMode.SINGLE; + } if (p.symbol === result.variable) { p.singleValue = result.value; } @@ -1329,6 +1337,10 @@ export class PabTableComponent implements AfterViewInit, OnInit { case "delta": for (const s of this.selectedItems) { for (const p of s.parameterIterator) { // deep + // force single mode (QA only) + if (p.hasMultipleValues) { + p.valueMode = ParamValueMode.SINGLE; + } if (p.symbol === result.variable) { p.singleValue += result.delta; } @@ -1405,6 +1417,10 @@ export class PabTableComponent implements AfterViewInit, OnInit { // for ZRMB, interpolatedValues length is shorter by 1 element if (interpolatedValues[idx] !== undefined) { for (const p of s.parameterIterator) { // deep + // force single mode (QA only) + if (p.hasMultipleValues) { + p.valueMode = ParamValueMode.SINGLE; + } if (p.symbol === result.variable) { p.singleValue = interpolatedValues[idx]; idx ++; diff --git a/src/app/components/variable-results-selector/variable-results-selector.component.ts b/src/app/components/variable-results-selector/variable-results-selector.component.ts index 9f91c26b0..663f1f0e5 100644 --- a/src/app/components/variable-results-selector/variable-results-selector.component.ts +++ b/src/app/components/variable-results-selector/variable-results-selector.component.ts @@ -4,8 +4,8 @@ import { I18nService } from "../../services/internationalisation.service"; import { fv, longestVarParam } from "../../util"; import { MultiDimensionResults } from "../../results/multidimension-results"; import { PrebarrageResults } from "../../results/prebarrage-results"; - import { CalculatorType, PbBassin, PbCloison, Structure, VariatedDetails } from "jalhyd"; +import { CalculatorResults } from "../../results/calculator-results"; @Component({ selector: "variable-results-selector", @@ -81,46 +81,7 @@ export class VariableResultsSelectorComponent implements OnChanges { } protected entryLabel(index: number): string { - const kv = []; - for (let i = 0; i < this.varValues.length; i++) { - const vv = this.varValues[i]; - const vp = this.results.variatedParameters[i]; - let symbol = vp.param.symbol; - // is vp a parameter of a child Nub ? - if ( - vp.param.parentNub - && vp.param.parentNub !== vp.param.originNub - ) { - let childPrefix: string; - // prefix the label depending on (grand)children type - switch (vp.param.originNub.calcType) { - case CalculatorType.PreBarrage: - const pbRes = this.results as PrebarrageResults; - if (vp.param.parentNub instanceof Structure) { - const struct = vp.param.parentNub as Structure; - const wall = struct.parent as PbCloison; - const posS = struct.findPositionInParent() + 1; - childPrefix = this.intlService.localizeMessage(wall.description); - // there might be multiple walls between the same pair of basins - if (wall.uid in pbRes.wallsSuffixes) { - childPrefix += " (" + pbRes.wallsSuffixes[wall.uid] + ")"; - } - childPrefix += "_" + this.intlService.localizeText("INFO_LIB_STRUCTURE_N_COURT") + posS; - } else if (vp.param.parentNub instanceof PbBassin) { - const bassin = vp.param.parentNub as PbBassin; - childPrefix = this.intlService.localizeMessage(bassin.description); - } - break; - case CalculatorType.MacroRugoCompound: - const posMR = vp.param.parentNub.findPositionInParent() + 1; - childPrefix = this.intlService.localizeText("INFO_LIB_RADIER_N_COURT") + posMR; - break; - } - symbol = childPrefix + "_" + symbol; - } - kv.push(`${symbol} = ${vv[index]}`); - } - return kv.join(", "); + return CalculatorResults.variatingModalityLabel(this.varValues, this.results, index); } public get selectedValue(): number { diff --git a/src/app/formulaire/definition/form-pab.ts b/src/app/formulaire/definition/form-pab.ts index d88ae7826..0bafb5760 100644 --- a/src/app/formulaire/definition/form-pab.ts +++ b/src/app/formulaire/definition/form-pab.ts @@ -2,7 +2,7 @@ import { Pab, Result, VariatedDetails } from "jalhyd"; import { FormulaireDefinition } from "./form-definition"; import { PabResults } from "../../results/pab-results"; -import { NgParameter } from "../elements/ngparam"; +import { NgParameter, ParamRadioConfig } from "../elements/ngparam"; import { longestVarParam } from "../../util"; import { CalculatorResults } from "../../results/calculator-results"; @@ -78,6 +78,21 @@ export class FormulairePab extends FormulaireDefinition { } } + public getVariatedParameters(): NgParameter[] { + const res: NgParameter[] = super.getVariatedParameters(); + // add artificial NgParameters for any variated QA @WARNING clodo trick + if (this.pabNub) { + for (const c of this.pabNub.children) { + if (c.prms.QA.hasMultipleValues) { + const qaParam = new NgParameter(c.prms.QA, this); + qaParam.radioConfig = ParamRadioConfig.VAR; + res.push(qaParam); + } + } + } + return res; + } + public get pabResults() { return this._pabResults; } diff --git a/src/app/results/calculator-results.ts b/src/app/results/calculator-results.ts index f573b6c99..95954608a 100644 --- a/src/app/results/calculator-results.ts +++ b/src/app/results/calculator-results.ts @@ -1,9 +1,11 @@ -import { Nub, capitalize } from "jalhyd"; +import { CalculatorType, Nub, capitalize, MacrorugoCompound, Pab, Structure, PbCloison, PbBassin } from "jalhyd"; import { NgParameter } from "../formulaire/elements/ngparam"; import { ServiceFactory } from "../services/service-factory"; import { sprintf } from "sprintf-js"; +import { MultiDimensionResults } from "./multidimension-results"; +import { PrebarrageResults } from "./prebarrage-results"; export abstract class CalculatorResults { @@ -45,6 +47,61 @@ export abstract class CalculatorResults { return res; } + /** + * Returns a label showing the boundary conditions values of all variating parameters, + * for the given iteration + * @param varvalues array of values: one element per variating parameter, itself an array of + * values, one per iteration + * @param variatedParameters array of variating parameters, in the same order as varvalues + * @param n index of the variating parameter(s) iteration + */ + public static variatingModalityLabel(varValues: any[], results: MultiDimensionResults, index: number): string { + const kv = []; + for (let i = 0; i < varValues.length; i++) { + const vv = varValues[i]; + const vp = results.variatedParameters[i]; + let symbol = vp.param.symbol; + // is vp a parameter of a child Nub ? + if ( + vp.param.parentNub + && vp.param.parentNub !== vp.param.originNub + ) { + let childPrefix: string; + // prefix the label depending on (grand)children type + switch (vp.param.originNub.calcType) { + case CalculatorType.PreBarrage: + const pbRes = results as PrebarrageResults; + if (vp.param.parentNub instanceof Structure) { + const struct = vp.param.parentNub as Structure; + const wall = struct.parent as PbCloison; + const posS = struct.findPositionInParent() + 1; + childPrefix = ServiceFactory.i18nService.localizeMessage(wall.description); + // there might be multiple walls between the same pair of basins + if (wall.uid in pbRes.wallsSuffixes) { + childPrefix += " (" + pbRes.wallsSuffixes[wall.uid] + ")"; + } + childPrefix += "_" + ServiceFactory.i18nService.localizeText("INFO_LIB_STRUCTURE_N_COURT") + posS; + } else if (vp.param.parentNub instanceof PbBassin) { + const bassin = vp.param.parentNub as PbBassin; + childPrefix = ServiceFactory.i18nService.localizeMessage(bassin.description); + } + break; + case CalculatorType.MacroRugoCompound: + const posMR = vp.param.parentNub.findPositionInParent() + 1; + childPrefix = ServiceFactory.i18nService.localizeText("INFO_LIB_RADIER_N_COURT") + posMR; + break; + case CalculatorType.PAB: + const posPAB = vp.param.parentNub.findPositionInParent() + 1; + childPrefix = ServiceFactory.i18nService.localizeText("INFO_LIB_CLOISON_N_COURT") + posPAB; + break; + } + symbol = childPrefix + "_" + symbol; + } + kv.push(`${symbol} = ${vv[index]}`); + } + return kv.join(", "); + } + /** * remet tous les résultats à zero */ diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json index d8e491c12..009ebec32 100755 --- a/src/locale/messages.en.json +++ b/src/locale/messages.en.json @@ -285,6 +285,7 @@ "INFO_LIB_CDT": "Discharge coefficient triangular weir", "INFO_LIB_CDO": "Discharge coefficient orifice", "INFO_LIB_CLOISON": "Cross wall #", + "INFO_LIB_CLOISON_N_COURT": "W", "INFO_LIB_COTE": "Elevation (m)", "INFO_LIB_COTE_VANNE_LEVANTE": "Lift gate elevation", "INFO_LIB_CV": "Cv: Velocity coefficient", diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index ca8fc400d..b018c642d 100755 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -286,6 +286,7 @@ "INFO_LIB_CDT": "Coefficient de débit seuil triangulaire", "INFO_LIB_CDO": "Coefficient de débit orifice", "INFO_LIB_CLOISON": "Cloison n°", + "INFO_LIB_CLOISON_N_COURT": "C", "INFO_LIB_COTE": "Cote (m)", "INFO_LIB_COTE_VANNE_LEVANTE": "Cote vanne levante", "INFO_LIB_CV": "Cv : Coefficient de vitesse d'approche", -- GitLab From 7cbea8820e41d89688ab0262925a70e5e342d648 Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Thu, 3 Sep 2020 10:13:49 +0200 Subject: [PATCH 05/13] Work on #431 - compact rows and add missing cells --- .../pab-table/pab-table.component.ts | 78 ++++++++----------- 1 file changed, 33 insertions(+), 45 deletions(-) diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts index 225d7da87..0095fb838 100644 --- a/src/app/components/pab-table/pab-table.component.ts +++ b/src/app/components/pab-table/pab-table.component.ts @@ -499,10 +499,6 @@ export class PabTableComponent implements AfterViewInit, OnInit { title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "BB"), selectable: bs }); - /* this.cols.push({ - title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "QA"), - selectable: bs - }); */ this.cols.push({ title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "ZRMB"), selectable: bs @@ -533,16 +529,16 @@ export class PabTableComponent implements AfterViewInit, OnInit { // B. Build rows set this.rows = []; + // admissible LoiDebit (same for all cloisons) + const loisCloisons = this.model.children[0].getLoisAdmissiblesArray().map(l => { + return { + label: this.localizeLoiDebit(l), + value: l + }; + }); // B.1 many rows for each wall let childIndex = 0; for (const cloison of this.model.children) { - // admissible LoiDebit - const loisCloisons = cloison.getLoisAdmissiblesArray().map(l => { // @TODO move up ? (same for all cloisons) - return { - label: this.localizeLoiDebit(l), - value: l - }; - }); // as much rows as the greatest number of parameters among its devices const maxNbParams = this.findMaxNumberOfDeviceParameters(cloison); for (let i = 0; i < maxNbParams; i++) { @@ -553,14 +549,14 @@ export class PabTableComponent implements AfterViewInit, OnInit { // basin number deviceParamRow.cells.push({ value: childIndex + 1, - rowspan: maxNbParams + 2, + rowspan: maxNbParams + 1, class: "basin_number", selectable: cloison }); // 3 empty cells deviceParamRow.cells.push({ colspan: 3, - rowspan: maxNbParams, + rowspan: maxNbParams - 1, selectable: cloison }); // ZRAM @@ -569,10 +565,25 @@ export class PabTableComponent implements AfterViewInit, OnInit { title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "ZRAM") }); } - // 1 empty cell + // basin cells on the last but 1 row + if (i === maxNbParams - 1) { + deviceParamRow.cells.push({ + model: cloison.prms.LB, + title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "LB") + }); + deviceParamRow.cells.push({ + model: cloison.prms.BB, + title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "BB") + }); + deviceParamRow.cells.push({ + model: cloison.prms.ZRMB, + title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "ZRMB") + }); + } + // 1 empty cell below ZRAM if (i === 1) { deviceParamRow.cells.push({ - rowspan: maxNbParams + 1, + rowspan: maxNbParams, selectable: cloison }); } @@ -589,7 +600,7 @@ export class PabTableComponent implements AfterViewInit, OnInit { selectable: ouvrage }); } - // fill space + // fill space below device type selector if (i === 1) { deviceParamRow.cells.push({ rowspan: (maxNbParams - 1), @@ -636,34 +647,6 @@ export class PabTableComponent implements AfterViewInit, OnInit { // done ! this.rows.push(deviceParamRow); } - // 1 row for the basin after the wall - const basinRow: { selectable: any, cells: any[] } = { - selectable: cloison, - cells: [ - // no cell for basin number (defined by rowspan-n cell above) - { - model: cloison.prms.LB, - title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "LB") - }, - { - model: cloison.prms.BB, - title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "BB") - }, - { - model: cloison.prms.ZRMB, - title: this.formService.expandVariableNameAndUnit(CalculatorType.Pab, "ZRMB") - } - ] - }; - // fill horizontal space - for (let i = 0; i < maxNbDevices; i++) { - basinRow.cells.push({ - colspan: 3, - rowspan: 2 - }); - } - // done ! - this.rows.push(basinRow); // 1 row for QA editor const qaParam = new NgParameter(cloison.prms.QA, this.pabTable.form); qaParam.radioConfig = ParamRadioConfig.VAR; @@ -678,8 +661,13 @@ export class PabTableComponent implements AfterViewInit, OnInit { } ] }; - this.rows.push(qaRow); + // as many pairs of columns as the maximum number of devices + qaRow.cells.push({ + colspan: maxNbDevices * 3, + // selectable: cloison @TODO oui ou non ? + }); // done ! + this.rows.push(qaRow); childIndex ++; } -- GitLab From 165576c9cf32486d1369c00750532d269c8ea66a Mon Sep 17 00:00:00 2001 From: David Dorchies <david.dorchies@irstea.fr> Date: Tue, 29 Sep 2020 14:57:08 +0200 Subject: [PATCH 06/13] fix: rebase compilation issue Refs #431 --- src/app/formulaire/definition/form-pab.ts | 15 --------------- src/app/results/calculator-results.ts | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/app/formulaire/definition/form-pab.ts b/src/app/formulaire/definition/form-pab.ts index 0bafb5760..af9b7f56d 100644 --- a/src/app/formulaire/definition/form-pab.ts +++ b/src/app/formulaire/definition/form-pab.ts @@ -78,21 +78,6 @@ export class FormulairePab extends FormulaireDefinition { } } - public getVariatedParameters(): NgParameter[] { - const res: NgParameter[] = super.getVariatedParameters(); - // add artificial NgParameters for any variated QA @WARNING clodo trick - if (this.pabNub) { - for (const c of this.pabNub.children) { - if (c.prms.QA.hasMultipleValues) { - const qaParam = new NgParameter(c.prms.QA, this); - qaParam.radioConfig = ParamRadioConfig.VAR; - res.push(qaParam); - } - } - } - return res; - } - public get pabResults() { return this._pabResults; } diff --git a/src/app/results/calculator-results.ts b/src/app/results/calculator-results.ts index 95954608a..a205ceddd 100644 --- a/src/app/results/calculator-results.ts +++ b/src/app/results/calculator-results.ts @@ -90,7 +90,7 @@ export abstract class CalculatorResults { const posMR = vp.param.parentNub.findPositionInParent() + 1; childPrefix = ServiceFactory.i18nService.localizeText("INFO_LIB_RADIER_N_COURT") + posMR; break; - case CalculatorType.PAB: + case CalculatorType.Pab: const posPAB = vp.param.parentNub.findPositionInParent() + 1; childPrefix = ServiceFactory.i18nService.localizeText("INFO_LIB_CLOISON_N_COURT") + posPAB; break; -- GitLab From 7cc67ab8cfb6d466ad673f1f99ffd7e0b8e0c191 Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Tue, 23 Nov 2021 11:46:09 +0100 Subject: [PATCH 07/13] fix(pab): update vary value from pab fish ladder and unable compute Button ref #431 --- src/app/components/pab-table/pab-table.component.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts index 0095fb838..5f6042646 100644 --- a/src/app/components/pab-table/pab-table.component.ts +++ b/src/app/components/pab-table/pab-table.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, Output, EventEmitter, OnInit, AfterViewInit } from "@angular/core"; +import { Component, Input, Output, EventEmitter, OnInit, AfterViewInit, AfterViewChecked } from "@angular/core"; import { LoiDebit, ParamValueMode } from "jalhyd"; @@ -39,7 +39,7 @@ import { NgParameter, ParamRadioConfig } from "../../formulaire/elements/ngparam "./pab-table.component.scss" ] }) -export class PabTableComponent implements AfterViewInit, OnInit { +export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnInit { @Input() private pabTable: PabTable; @@ -86,6 +86,12 @@ export class PabTableComponent implements AfterViewInit, OnInit { this.selectedItems = []; } + /** update vary value from pab fish ladder and unable compute Button */ + ngAfterViewChecked(): void { + this.updateValidity(); + } + + public get title(): string { return this.i18nService.localizeText("INFO_PAB_TABLE"); } -- GitLab From a2bba80e3e20dea71bd171a54b8c51182b9aff29 Mon Sep 17 00:00:00 2001 From: manmohan <man-mohan.gargani@inrae.fr> Date: Thu, 25 Nov 2021 10:22:26 +0100 Subject: [PATCH 08/13] fix #431 display QA-label on the line as control --- .../components/pab-table/pab-table.component.html | 2 +- .../components/pab-table/pab-table.component.scss | 5 +++-- .../param-field-line/param-field-line.component.html | 2 +- .../param-field-line/param-field-line.component.scss | 3 ++- src/styles.scss | 12 ++++++------ 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/app/components/pab-table/pab-table.component.html b/src/app/components/pab-table/pab-table.component.html index 488fe6565..293bd1b07 100644 --- a/src/app/components/pab-table/pab-table.component.html +++ b/src/app/components/pab-table/pab-table.component.html @@ -111,4 +111,4 @@ </ng-template> </p-table> -</mat-card-content> \ No newline at end of file +</mat-card-content> diff --git a/src/app/components/pab-table/pab-table.component.scss b/src/app/components/pab-table/pab-table.component.scss index 5b64df679..9f6b1055a 100644 --- a/src/app/components/pab-table/pab-table.component.scss +++ b/src/app/components/pab-table/pab-table.component.scss @@ -50,10 +50,11 @@ mat-card-content { .qaFieldLineContainer { padding: 0 10px; + display: flex; } .qaLabel { - margin-top: 13px; - margin-right: 10px; + margin-top: 2px; + margin-right: 20px; font-weight: bold; } 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 e1faeebf2..daad0ba4b 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 @@ -52,4 +52,4 @@ </mat-button-toggle-group> </div> -</div> \ No newline at end of file +</div> diff --git a/src/app/components/param-field-line/param-field-line.component.scss b/src/app/components/param-field-line/param-field-line.component.scss index 16c2b9153..d05bd95c8 100644 --- a/src/app/components/param-field-line/param-field-line.component.scss +++ b/src/app/components/param-field-line/param-field-line.component.scss @@ -1,8 +1,9 @@ .toggle-group-container { text-align: right; + margin-bottom: 10px; } mat-button-toggle-group { - margin-top: 4px; + margin-top: 8px; box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12); } diff --git a/src/styles.scss b/src/styles.scss index 727ac59f1..87774a115 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -129,7 +129,7 @@ field-set { .mat-select-value, .mat-select-arrow { color: #fff; } - + .mat-form-field-infix { border-bottom: 2px solid #fff; } @@ -186,7 +186,7 @@ field-set { } .pab-data-table { - + .editable-cell-bg { @extend .bg-accent-extralight; } @@ -271,7 +271,7 @@ field-set { > input[type="number"] { -moz-appearance: textfield; } - input[type=number]::-webkit-outer-spin-button, + input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; @@ -297,7 +297,7 @@ mat-checkbox.wrapped-checkbox { param-computed, param-values { mat-form-field { - + input.mat-input-element { width: calc(100% - 40px); text-overflow: ellipsis; @@ -353,7 +353,7 @@ mat-list { > .mat-list-item { height: auto; margin-bottom: .5em; - + > .mat-list-item-content { align-items: start; @@ -366,7 +366,7 @@ mat-list { } table.mat-table { - + .material-icons { font-size: 1.4em; vertical-align: bottom; -- GitLab From 187dab72e638d4530c5508f1ed2ec3d83271913a Mon Sep 17 00:00:00 2001 From: manmohan <man-mohan.gargani@inrae.fr> Date: Thu, 25 Nov 2021 17:34:34 +0100 Subject: [PATCH 09/13] fix(pab): #431 Modification of dispaly QA-label on the same line --- src/app/components/pab-table/pab-table.component.scss | 9 +++++++-- .../param-field-line/param-field-line.component.scss | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app/components/pab-table/pab-table.component.scss b/src/app/components/pab-table/pab-table.component.scss index 9f6b1055a..775e64397 100644 --- a/src/app/components/pab-table/pab-table.component.scss +++ b/src/app/components/pab-table/pab-table.component.scss @@ -36,10 +36,12 @@ mat-card-content { } .hyd-window-btns { text-align: right; + align-items: flex-end; #add-many-children { width: 3em; vertical-align: middle; + align-items: flex-start; } button.mat-icon-button { @@ -51,10 +53,13 @@ mat-card-content { .qaFieldLineContainer { padding: 0 10px; display: flex; + flex-wrap: wrap; + flex-direction: row; + justify-content:space-between; } .qaLabel { - margin-top: 2px; - margin-right: 20px; + margin-top: 13px; font-weight: bold; } + diff --git a/src/app/components/param-field-line/param-field-line.component.scss b/src/app/components/param-field-line/param-field-line.component.scss index d05bd95c8..4723ca170 100644 --- a/src/app/components/param-field-line/param-field-line.component.scss +++ b/src/app/components/param-field-line/param-field-line.component.scss @@ -1,9 +1,9 @@ .toggle-group-container { text-align: right; - margin-bottom: 10px; } mat-button-toggle-group { - margin-top: 8px; + margin-top: 4px; box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12); } + -- GitLab From 1b25d95112e95f450de23ad346a9dc38ed789c94 Mon Sep 17 00:00:00 2001 From: manmohan <man-mohan.gargani@inrae.fr> Date: Wed, 1 Dec 2021 15:47:52 +0100 Subject: [PATCH 10/13] Bug-fix #431 clone of QA and VARIE parameters --- src/app/components/pab-table/pab-table.component.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts index 5f6042646..9b9c48095 100644 --- a/src/app/components/pab-table/pab-table.component.ts +++ b/src/app/components/pab-table/pab-table.component.ts @@ -1052,10 +1052,12 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni // copy parameter values for (const p of si.prms) { // @TODO QA may vary - if (p.visible && p.symbol !== "QA") { // QA might vary ! - newChild.getParameter(p.symbol).singleValue = p.singleValue; - } + if (p.visible) { // QA might vary ! + newChild.getParameter(p.symbol).loadObjectRepresentation(p.objectRepresentation()); + console.log(newChild.getParameter(p.symbol).loadObjectRepresentation(p.objectRepresentation())); + } + } // copy children if (si instanceof ParallelStructure) { for (const c of si.getChildren()) { -- GitLab From a3f0cda9e5daac12e4fd431cd0e72506bab39705 Mon Sep 17 00:00:00 2001 From: manmohan gargani <man-mohan-gargani@inrae.fr> Date: Thu, 2 Dec 2021 13:24:03 +0100 Subject: [PATCH 11/13] fix(pab): #431 -copying QA value by cloning loadObjectRepresentation(p.objectRepresentation --- src/app/components/pab-table/pab-table.component.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts index 9b9c48095..0c7d9c089 100644 --- a/src/app/components/pab-table/pab-table.component.ts +++ b/src/app/components/pab-table/pab-table.component.ts @@ -1051,11 +1051,8 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni ); // copy parameter values for (const p of si.prms) { - // @TODO QA may vary - if (p.visible) { // QA might vary ! + if (p.visible) { newChild.getParameter(p.symbol).loadObjectRepresentation(p.objectRepresentation()); - console.log(newChild.getParameter(p.symbol).loadObjectRepresentation(p.objectRepresentation())); - } } // copy children -- GitLab From dd9b2fd5c5801e821dcde052f5791c20362e235f Mon Sep 17 00:00:00 2001 From: David Dorchies <david.dorchies@irstea.fr> Date: Wed, 8 Dec 2021 12:01:45 +0100 Subject: [PATCH 12/13] fix(Pab): display varied and linked values for Excel export of the Pab table Refs #431 --- src/app/components/pab-table/pab-table.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts index 0c7d9c089..6c6088f8a 100644 --- a/src/app/components/pab-table/pab-table.component.ts +++ b/src/app/components/pab-table/pab-table.component.ts @@ -1466,7 +1466,11 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni const inputs = td.getElementsByTagName("input"); if (inputs.length > 0) { const input = inputs[0]; - td.innerHTML = input.value; + if (input.id.split("_")[1] == "QA") { + td.innerHTML = NgParameter.preview(this.model.children[input.id.split("_")[0]].prms.QA) + } else { + td.innerHTML = input.value; + } } } } -- GitLab From 31193c8ddaa633a2c86dc6ae746514b726598d8e Mon Sep 17 00:00:00 2001 From: manmohan <man-mohan.gargani@inrae.fr> Date: Wed, 8 Dec 2021 12:21:59 +0100 Subject: [PATCH 13/13] lint(pab): #431 --- src/app/components/pab-table/pab-table.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/components/pab-table/pab-table.component.ts b/src/app/components/pab-table/pab-table.component.ts index 6c6088f8a..486789521 100644 --- a/src/app/components/pab-table/pab-table.component.ts +++ b/src/app/components/pab-table/pab-table.component.ts @@ -1466,8 +1466,8 @@ export class PabTableComponent implements AfterViewInit, AfterViewChecked, OnIni const inputs = td.getElementsByTagName("input"); if (inputs.length > 0) { const input = inputs[0]; - if (input.id.split("_")[1] == "QA") { - td.innerHTML = NgParameter.preview(this.model.children[input.id.split("_")[0]].prms.QA) + if (input.id.split("_")[1] === "QA") { + td.innerHTML = NgParameter.preview(this.model.children[input.id.split("_")[0]].prms.QA); } else { td.innerHTML = input.value; } -- GitLab