Skip to content
Snippets Groups Projects

Resolve "Ajout du module de calcul d'une passe à bassins"

Merged David Dorchies requested to merge 93-ajout-du-module-de-calcul-d-une-passe-a-bassins into master
2 files
+ 37
2
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -8,6 +8,7 @@ import { InputField } from "../../formulaire/input-field";
import { SelectField } from "../../formulaire/select-field";
import { SelectFieldModel } from "../../formulaire/select-field-model";
import { FormulairePab } from "../../formulaire/definition/concrete/form-pab";
import { SelectModelFieldLineComponent } from "../select-model-field-line/select-model-field-line.component";
@Component({
selector: "field-set",
@@ -51,6 +52,9 @@ export class FieldSetComponent implements DoCheck {
@ViewChildren(ParamFieldLineComponent)
private _paramComponents: QueryList<ParamFieldLineComponent>;
@ViewChildren(SelectModelFieldLineComponent)
private _selectModelComponents: QueryList<SelectModelFieldLineComponent>;
/**
* événement de changement de validité
*/
@@ -205,13 +209,17 @@ export class FieldSetComponent implements DoCheck {
}
/**
* calcul de la validité de tous les ParamFieldLineComponent de la vue
* calcul de la validité de tous les ParamFieldLineComponent et tous les
* SelectModelFieldLineComponent de la vue
*/
private updateValidity() {
this._isValid = false;
let paramsAreValid = true;
let selectAreValid = true;
if (this._paramComponents) {
this._isValid = this._paramComponents.reduce(
paramsAreValid = false;
paramsAreValid = this._paramComponents.reduce(
// callback
(
// accumulator (valeur précédente du résultat)
@@ -229,6 +237,29 @@ export class FieldSetComponent implements DoCheck {
, true);
}
if (this._selectModelComponents) {
selectAreValid = false;
selectAreValid = this._selectModelComponents.reduce(
// callback
(
// accumulator (valeur précédente du résultat)
acc,
// currentValue (élément courant dans le tableau)
select,
// currentIndex (indice courant dans le tableau)
currIndex,
// array (tableau parcouru)
array
) => {
return acc && select.isValid;
}
// valeur initiale
, true);
}
// global validity
this._isValid = (paramsAreValid && selectAreValid);
this.validChange.emit();
}
Loading