Skip to content
Snippets Groups Projects
Commit 1930e4d6 authored by François Grand's avatar François Grand
Browse files

refactor: calculator JSON configuration: remove selectIds, customSelectIds

refs #483
parent f5eba4f5
No related branches found
No related tags found
2 merge requests!225Release v4.17.0,!176Resolve "Fusionner les "select" avec "source" et les "select_custom""
Showing
with 11 additions and 64 deletions
......@@ -69,7 +69,6 @@
{
"type": "options",
"defaultNodeType": "SectionRectangle",
"selectIds": [ "select_section", "select_regime" ],
"help": "hsl/cote_amont_aval.html"
}
]
......@@ -61,7 +61,6 @@
},
{
"type": "options",
"selectIds": [ "select_structure", "select_loidebit" ],
"help": "pab/cloisons.html"
}
]
......@@ -96,7 +96,6 @@
{
"type": "options",
"defaultNodeType": "SectionRectangle",
"selectIds": [ "select_resolution", "select_section", "select_target" ],
"help": "hsl/courbe_remous.html",
"resultsHelp": {
"B": "hsl/section_parametree.html#largeur-au-miroir-surface-et-perimetre-mouille",
......
......@@ -51,7 +51,6 @@
},
{
"type": "options",
"selectIds": [ "select_structure", "select_loidebit" ],
"help": "structures/dever.html"
}
]
\ No newline at end of file
......@@ -94,7 +94,6 @@
{
"type": "options",
"help": "verif/especes_predefinies.html",
"selectIds": [ "select_divingjetsupported" ],
"calculateDisabled": true
}
]
......@@ -96,7 +96,6 @@
},
{
"type": "options",
"selectIds": [ "select_gridtype", "select_gridprofile" ],
"help": "devalaison/grille.html",
"resultsHelp": {
"VAPDG": "devalaison/grille.html#vitesse-dapproche-moyenne-pour-le-debit-maximum-turbine-en-soustrayant-la-partie-superieure-eventuellement-obturee",
......
......@@ -28,7 +28,6 @@
},
{
"type": "options",
"selectIds": [ "select_material" ],
"help": "hyd_en_charge/lechapt-calmon.html"
}
]
\ No newline at end of file
......@@ -78,7 +78,6 @@
},
{
"type": "options",
"selectIds": [ "select_passtype" ],
"help": "pam/macrorugo_complexe.html"
}
]
......@@ -38,7 +38,6 @@
},
{
"type": "options",
"selectIds": [ "select_partype" ],
"help": "par/calage.html"
}
]
......@@ -74,7 +74,6 @@
},
{
"type": "options",
"selectIds": [ "select_structure", "select_loidebit" ],
"help": "structures/lois_ouvrages.html",
"resultsHelp": {
"ENUM_StructureJetType": "structures/lois_ouvrages.html#type-de-jet"
......
......@@ -54,7 +54,6 @@
},
{
"type": "options",
"selectIds": [ "select_partype" ],
"help": "par/simulation.html"
}
]
......@@ -15,10 +15,6 @@
"Z1",
"Z2"
]
},
{
"type": "options",
"selectIds": [ ]
}
]
},
......@@ -41,10 +37,6 @@
"templates": [
"fs_basin"
]
},
{
"type": "options",
"selectIds": [ ]
}
]
},
......@@ -181,17 +173,11 @@
"templates": [
"fs_ouvrage"
]
},
{
"type": "options",
"selectIds": [ "select_structure", "select_loidebit" ],
"customSelectIds": [ "select_upstream_basin", "select_downstream_basin" ]
}
]
},
{
"type": "options",
"selectIds": [ ],
"upstreamSelectId": "select_upstream",
"downstreamSelectId": "select_downstream",
"help": "pab/prebarrage.html"
......
......@@ -50,7 +50,6 @@
{
"type": "options",
"defaultNodeType": "SectionRectangle",
"selectIds": [ "select_section" ],
"help": "hsl/regime_uniforme.html",
"resultsHelp": {
"V": "hsl/section_parametree.html#la-vitesse-moyenne-ms"
......
......@@ -50,7 +50,6 @@
{
"type": "options",
"defaultNodeType": "SectionRectangle",
"selectIds": [ "select_section" ],
"help": "hsl/section_parametree.html",
"resultsHelp": {
"B": "hsl/section_parametree.html#largeur-au-miroir-surface-et-perimetre-mouille",
......
......@@ -27,8 +27,6 @@
},
{
"type": "options",
"selectIds": [ "select_target_result" ],
"customSelectIds": [ "select_target_nub", "select_searched_param" ],
"targettedResultSelectId": "select_target_result",
"help": "maths/solver.html"
}
......
......@@ -31,7 +31,6 @@
},
{
"type": "options",
"selectIds": [ "select_sppoperation" ],
"help": "maths/operators.html#somme-et-produit-de-puissances"
}
]
\ No newline at end of file
......@@ -24,7 +24,6 @@
},
{
"type": "options",
"selectIds": [ "select_operation", "select_unit" ],
"help": "maths/operators.html#fonction-trigonometrique"
}
]
\ No newline at end of file
......@@ -21,8 +21,6 @@
},
{
"type": "options",
"selectIds": [ "select_pab_jet_type" ],
"customSelectIds": [ "select_target_pass", "select_species_list" ],
"help": "verif/principe.html"
}
]
......@@ -26,6 +26,7 @@ import { ServiceFactory } from "../../services/service-factory";
import { PabTable } from "../elements/pab-table";
import { SelectEntry } from "../elements/select/select-entry";
import { SelectField } from "../elements/select/select-field";
import { DeepSelectFieldIterator } from "../form-iterator/deep-selectfield-iterator";
/**
* classe de base pour tous les formulaires
......@@ -410,6 +411,13 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs
return new TopFormulaireElementIterator(this);
}
/**
* itère sur tous les SelectField
*/
public get allSelectFields(): IterableIterator<SelectField> {
return new DeepSelectFieldIterator(this);
}
// interface Observer
public update(sender: any, data: any) {
......
......@@ -14,12 +14,6 @@ export class FormulaireFixedVar extends FormulaireDefinition {
protected _fixedResults: FixedResults;
protected _varResults: VarResults;
/** ids of select fields */
private _selectIds: string[] = [];
/** ids of "custom" select fields */
private _customSelectIds: string[] = [];
constructor(parent?: FormulaireNode) {
super(parent);
this._fixedResults = new FixedResults();
......@@ -31,10 +25,6 @@ export class FormulaireFixedVar extends FormulaireDefinition {
return this._fixedResults;
}
public get selectids(): string[] {
return this._selectIds;
}
public resetFormResults() {
this._fixedResults.reset();
this._varResults.reset();
......@@ -73,24 +63,14 @@ export class FormulaireFixedVar extends FormulaireDefinition {
public afterParseFieldset(fs: FieldSet) {
// observe all Select fields @see this.update()
if (this._selectIds.length > 0) {
for (const sId of this._selectIds) {
const sel = fs.getFormulaireNodeById(sId);
if (sel) {
// Formulaire is listening to FieldSet properties (@TODO why not directly Select ?)
fs.properties.addObserver(this);
}
}
}
fs.properties.addObserver(this);
}
protected completeParse(firstNotif: boolean = true) {
super.completeParse(firstNotif);
// observe all CustomSelect fields @TODO move to afterParseFieldset ?
if (this._customSelectIds.length > 0) {
for (const csId of this._customSelectIds) {
const sel = this.getFormulaireNodeById(csId);
// Formulaire is listening to Select value
for (const sel of this.allSelectFields) { // Formulaire is listening to Select value
if (!sel.hasAssociatedNubProperty) { // only to "custom" selects
sel.addObserver(this);
if (firstNotif) {
// force 1st observation
......@@ -100,14 +80,6 @@ export class FormulaireFixedVar extends FormulaireDefinition {
}
}
protected parseOptions(json: {}) {
super.parseOptions(json);
// get ids of all select fields
this._selectIds = this.getOption(json, "selectIds") || [];
// get ids of all "custom" select fields
this._customSelectIds = this.getOption(json, "customSelectIds") || [];
}
protected compute() {
this.runNubCalc(this.currentNub);
this.refreshFieldsets(); // important: before reaffectResultComponents() or it will break results components localization
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment