diff --git a/src/app/calculators/bief/config.json b/src/app/calculators/bief/config.json index 7434f2abcf9bed90ed8d8f0779ee1f9f50c8b09f..584efa8287ba4454e34565cb342d846c6b52bb63 100644 --- a/src/app/calculators/bief/config.json +++ b/src/app/calculators/bief/config.json @@ -69,7 +69,6 @@ { "type": "options", "defaultNodeType": "SectionRectangle", - "selectIds": [ "select_section", "select_regime" ], "help": "hsl/cote_amont_aval.html" } ] diff --git a/src/app/calculators/cloisons/config.json b/src/app/calculators/cloisons/config.json index 2423ef4bc3b405f01736a6b9f1fe2892cd599d03..e3b2a662dfc9774e9a22e7087c619c972487ba97 100644 --- a/src/app/calculators/cloisons/config.json +++ b/src/app/calculators/cloisons/config.json @@ -61,7 +61,6 @@ }, { "type": "options", - "selectIds": [ "select_structure", "select_loidebit" ], "help": "pab/cloisons.html" } ] diff --git a/src/app/calculators/courberemous/config.json b/src/app/calculators/courberemous/config.json index b66d709bb5e4717bb1f6b868cca3f7274cb7e64e..30bab2879ef281a3795b06c1511a872d0b32fa28 100644 --- a/src/app/calculators/courberemous/config.json +++ b/src/app/calculators/courberemous/config.json @@ -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", diff --git a/src/app/calculators/dever/config.json b/src/app/calculators/dever/config.json index 6b502f27a57751d79ec687c5b18bb6f92382a2b7..69188b972bb098fe57b95911835e9b17780776af 100644 --- a/src/app/calculators/dever/config.json +++ b/src/app/calculators/dever/config.json @@ -51,7 +51,6 @@ }, { "type": "options", - "selectIds": [ "select_structure", "select_loidebit" ], "help": "structures/dever.html" } ] \ No newline at end of file diff --git a/src/app/calculators/espece/config.json b/src/app/calculators/espece/config.json index 1b6185a5ee7ec30cf63aaf17086edea49597d95b..71a6f42f759511cb75de75d05737b58b83804e5f 100644 --- a/src/app/calculators/espece/config.json +++ b/src/app/calculators/espece/config.json @@ -94,7 +94,6 @@ { "type": "options", "help": "verif/especes_predefinies.html", - "selectIds": [ "select_divingjetsupported" ], "calculateDisabled": true } ] diff --git a/src/app/calculators/grille/config.json b/src/app/calculators/grille/config.json index e964fa9e33b84dc02f1ebe2c33df2761a59a0ce8..b01502d19326776b5a52bdbdba2cb33e10494330 100644 --- a/src/app/calculators/grille/config.json +++ b/src/app/calculators/grille/config.json @@ -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", diff --git a/src/app/calculators/lechaptcalmon/config.json b/src/app/calculators/lechaptcalmon/config.json index 431552de8fe835cc1124910f5ac257babf02690b..d655d5ca3d6d36f24c32fd327cda6ba596bc1297 100644 --- a/src/app/calculators/lechaptcalmon/config.json +++ b/src/app/calculators/lechaptcalmon/config.json @@ -28,7 +28,6 @@ }, { "type": "options", - "selectIds": [ "select_material" ], "help": "hyd_en_charge/lechapt-calmon.html" } ] \ No newline at end of file diff --git a/src/app/calculators/macrorugocompound/config.json b/src/app/calculators/macrorugocompound/config.json index 8df7adca30b829076b1b3929bd2548686112fde9..79290dc661b94b9a3a9ed20ba698c467b6f8b728 100644 --- a/src/app/calculators/macrorugocompound/config.json +++ b/src/app/calculators/macrorugocompound/config.json @@ -78,7 +78,6 @@ }, { "type": "options", - "selectIds": [ "select_passtype" ], "help": "pam/macrorugo_complexe.html" } ] diff --git a/src/app/calculators/par/config.json b/src/app/calculators/par/config.json index dc6fcb41e4cf7a6f959f33bd0146576f55373154..c7ba05c46cae67a319ff58a2672c70935268aa85 100644 --- a/src/app/calculators/par/config.json +++ b/src/app/calculators/par/config.json @@ -38,7 +38,6 @@ }, { "type": "options", - "selectIds": [ "select_partype" ], "help": "par/calage.html" } ] diff --git a/src/app/calculators/parallelstructure/config.json b/src/app/calculators/parallelstructure/config.json index d265d9a66e0b0cf6edd589a02f055f11580ba82d..87ef999087fe575c8d1c8476065c81df3f9f3bdc 100644 --- a/src/app/calculators/parallelstructure/config.json +++ b/src/app/calculators/parallelstructure/config.json @@ -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" diff --git a/src/app/calculators/parsimulation/config.json b/src/app/calculators/parsimulation/config.json index a5cb2c9de1bd6c7dd5dacad8e69e20e2cd52fc8e..810625bf606e5297964528a3893abf79a9e30b38 100644 --- a/src/app/calculators/parsimulation/config.json +++ b/src/app/calculators/parsimulation/config.json @@ -54,7 +54,6 @@ }, { "type": "options", - "selectIds": [ "select_partype" ], "help": "par/simulation.html" } ] diff --git a/src/app/calculators/prebarrage/config.json b/src/app/calculators/prebarrage/config.json index 1b0431549caae933ad6a26ae1a20c38c76194994..406711a5e1834aca77920148c5997c77403070ca 100644 --- a/src/app/calculators/prebarrage/config.json +++ b/src/app/calculators/prebarrage/config.json @@ -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" diff --git a/src/app/calculators/regimeuniforme/config.json b/src/app/calculators/regimeuniforme/config.json index 14a3239ef635d21c5ff75538d8db46dd630da574..171dc01398c9bdd68ec292b06ad018d5faebd89d 100644 --- a/src/app/calculators/regimeuniforme/config.json +++ b/src/app/calculators/regimeuniforme/config.json @@ -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" diff --git a/src/app/calculators/sectionparametree/config.json b/src/app/calculators/sectionparametree/config.json index f24b88ca8954faf65b6764ecdf60dc8231995ead..4e4ce5e2879f38e60baa7dfc6d9bdfb45371ad9e 100644 --- a/src/app/calculators/sectionparametree/config.json +++ b/src/app/calculators/sectionparametree/config.json @@ -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", diff --git a/src/app/calculators/solveur/config.json b/src/app/calculators/solveur/config.json index 99d21526468c8ba6dc2e4df8990a5307585a14c1..9c0fd2b31099d71d7f5124b763a22133d47461c8 100644 --- a/src/app/calculators/solveur/config.json +++ b/src/app/calculators/solveur/config.json @@ -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" } diff --git a/src/app/calculators/spp/config.json b/src/app/calculators/spp/config.json index 8506d7c73f7385b057410a5ee0a4b0b68abef2a8..e28d38ff84648d3b79245e7586d07111c4d1e291 100644 --- a/src/app/calculators/spp/config.json +++ b/src/app/calculators/spp/config.json @@ -31,7 +31,6 @@ }, { "type": "options", - "selectIds": [ "select_sppoperation" ], "help": "maths/operators.html#somme-et-produit-de-puissances" } ] \ No newline at end of file diff --git a/src/app/calculators/trigo/config.json b/src/app/calculators/trigo/config.json index 3b9f5d97a4b7eb5c65974554a57534edbe4f685d..264fe9299e91dbad8321ad2f62a27e36eeba1b05 100644 --- a/src/app/calculators/trigo/config.json +++ b/src/app/calculators/trigo/config.json @@ -24,7 +24,6 @@ }, { "type": "options", - "selectIds": [ "select_operation", "select_unit" ], "help": "maths/operators.html#fonction-trigonometrique" } ] \ No newline at end of file diff --git a/src/app/calculators/verificateur/config.json b/src/app/calculators/verificateur/config.json index 07f6f672c080191ef17b12f6dcbe253dc78694a8..7faef08de4d662fa42139f9e3603727a17e676a5 100644 --- a/src/app/calculators/verificateur/config.json +++ b/src/app/calculators/verificateur/config.json @@ -21,8 +21,6 @@ }, { "type": "options", - "selectIds": [ "select_pab_jet_type" ], - "customSelectIds": [ "select_target_pass", "select_species_list" ], "help": "verif/principe.html" } ] diff --git a/src/app/formulaire/definition/form-definition.ts b/src/app/formulaire/definition/form-definition.ts index cc5837883349385c3a97201ddfa4cad979dad1b1..bcf6eef68a5b176178cbe4d6fb47ee762414fd37 100644 --- a/src/app/formulaire/definition/form-definition.ts +++ b/src/app/formulaire/definition/form-definition.ts @@ -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) { diff --git a/src/app/formulaire/definition/form-fixedvar.ts b/src/app/formulaire/definition/form-fixedvar.ts index 9289094a7d9e0b701ee8f73b092b0da3c73bebbb..0a329f489308d59093da98d30da932a160e249fa 100644 --- a/src/app/formulaire/definition/form-fixedvar.ts +++ b/src/app/formulaire/definition/form-fixedvar.ts @@ -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 diff --git a/src/app/formulaire/elements/fieldset.ts b/src/app/formulaire/elements/fieldset.ts index 89a696bf0045946a6c899be01719cc46c5cd15e1..e5fbca7d736e5747da1ebc31eebfcb0b63bc156b 100644 --- a/src/app/formulaire/elements/fieldset.ts +++ b/src/app/formulaire/elements/fieldset.ts @@ -15,8 +15,6 @@ import { FieldsetContainer } from "./fieldset-container"; import { SelectFieldFactory } from "./select/select-field-factory"; import { FormulaireFixedVar } from "../definition/form-fixedvar"; import { SelectEntry } from "./select/select-entry"; -import { FormulaireNode } from "./formulaire-node"; -import { ServiceFactory } from "app/services/service-factory"; export class FieldSet extends FormulaireElement implements Observer { @@ -237,9 +235,10 @@ export class FieldSet extends FormulaireElement implements Observer { // for all select fields known by the form, set selected value // from associated property if (this.parentForm instanceof FormulaireFixedVar) { - const selectIds = this.parentForm.selectids; - for (const sId of selectIds) { - this.setSelectValueFromProperty(sId, (this._confId === "fs_section")); + for (const sel of this.parentForm.allSelectFields) { + if (sel.hasAssociatedNubProperty) { // ie. if select is a standard select + this.setSelectValueFromProperty(sel.id, (this._confId === "fs_section")); + } } } } @@ -289,13 +288,10 @@ export class FieldSet extends FormulaireElement implements Observer { // for all select fields known by the form, apply default value // to associated property, usually from associated enum if (this.parentForm instanceof FormulaireFixedVar) { - const selectIds = this.parentForm.selectids; - for (const sId of selectIds) { - // find select element in parent form - const fe = this.getFormulaireNodeById(sId); - if (fe) { - const prop = (fe as SelectField).associatedProperty; - const defaultValue = (fe as SelectField).configDefaultValue; + for (const sel of this.parentForm.allSelectFields) { + if (sel.hasAssociatedNubProperty) { // ie. if select is a standard select + const prop = sel.associatedProperty; + const defaultValue = sel.configDefaultValue; // Sets Nub default property, unless this property is already set const currentValue = this.properties.getPropValue(prop); if (defaultValue !== undefined && currentValue === undefined) { @@ -379,28 +375,27 @@ export class FieldSet extends FormulaireElement implements Observer { }); } } else { - if (this.parentForm instanceof FormulaireFixedVar) { - // for all select fields known by the form, apply received value - // to associated property - const selectIds = this.parentForm.selectids; - for (const sId of selectIds) { - if (senderId === sId) { - // find select element in parent form - const fe = this.parentForm.getFieldById(sId); - if (fe && data.value !== undefined) { - const prop = (fe as SelectField).associatedProperty; - // for multiple select - if (Array.isArray(data.value)) { - this.setNubPropValue(prop, data.value.map((v: any) => v.value)); - } else { - this.setNubPropValue(prop, data.value.value); + if (data.value !== undefined) { + if (this.parentForm instanceof FormulaireFixedVar) { + // for all select fields known by the form, apply received value + // to associated property + for (const sel of this.parentForm.allSelectFields) { + if (senderId === sel.id) { + // find select element in parent form + if (sel.hasAssociatedNubProperty) { // if select is a standard select + const prop = sel.associatedProperty; + // for multiple select + if (Array.isArray(data.value)) { + this.setNubPropValue(prop, data.value.map((v: any) => v.value)); + } else { + this.setNubPropValue(prop, data.value.value); + } } } } } } } - break; // switch (data.action) } } diff --git a/src/app/formulaire/elements/select/select-field-device-loi-debit.ts b/src/app/formulaire/elements/select/select-field-device-loi-debit.ts index 15194174f06e90276c5f50937ec06e04c7d1c70e..6a9c86e7cb1a678f4bd9e6288e9a1905dec93a81 100644 --- a/src/app/formulaire/elements/select/select-field-device-loi-debit.ts +++ b/src/app/formulaire/elements/select/select-field-device-loi-debit.ts @@ -1,6 +1,7 @@ import { LoiDebit, ParallelStructure, StructureProperties, StructureType } from "jalhyd"; import { SelectField } from "./select-field"; import { SelectEntry } from "./select-entry"; +import { FormulaireNode } from "../formulaire-node"; /* "id": "select_loidebit", @@ -11,6 +12,11 @@ import { SelectEntry } from "./select-entry"; */ export class SelectFieldDeviceLoiDebit extends SelectField { + constructor(parent: FormulaireNode) { + super(parent); + this._associatedProperty = "loiDebit"; + } + protected populate() { // possible values depend on CalcType @@ -31,12 +37,4 @@ export class SelectFieldDeviceLoiDebit extends SelectField { protected initSelectedValue() { this.findAndSetDefaultValue(); } - - public get associatedProperty(): string { - return "loiDebit"; - } - - public get configDefaultValue(): string { - return undefined; - } -} \ No newline at end of file +} diff --git a/src/app/formulaire/elements/select/select-field-device-structure-type.ts b/src/app/formulaire/elements/select/select-field-device-structure-type.ts index b818eedf5f26096a46a26a966c62884aa7cbd099..0210eb1b709bf19cc29e887e090410c37b198b50 100644 --- a/src/app/formulaire/elements/select/select-field-device-structure-type.ts +++ b/src/app/formulaire/elements/select/select-field-device-structure-type.ts @@ -1,6 +1,7 @@ import { ParallelStructure, StructureType } from "jalhyd"; import { SelectField } from "./select-field"; import { SelectEntry } from "./select-entry"; +import { FormulaireNode } from "../formulaire-node"; /* "id": "select_structure", @@ -10,6 +11,11 @@ import { SelectEntry } from "./select-entry"; */ export class SelectFieldDeviceStructureType extends SelectField { + constructor(parent: FormulaireNode) { + super(parent); + this._associatedProperty = "structureType"; + } + protected populate() { // possible values depend on CalcType for (const st in (this.nub as ParallelStructure).getLoisAdmissibles()) { @@ -21,12 +27,4 @@ export class SelectFieldDeviceStructureType extends SelectField { protected initSelectedValue() { this.findAndSetDefaultValue(); } - - public get associatedProperty(): string { - return "structureType"; - } - - public get configDefaultValue(): string { - return undefined; - } -} \ No newline at end of file +} diff --git a/src/app/formulaire/elements/select/select-field-downstream-basin.ts b/src/app/formulaire/elements/select/select-field-downstream-basin.ts index 77fcab4bd494f04fe63923c1351db73f93935185..05675917d12907d7dbd408e7a72dcd3062b5e1d5 100644 --- a/src/app/formulaire/elements/select/select-field-downstream-basin.ts +++ b/src/app/formulaire/elements/select/select-field-downstream-basin.ts @@ -42,12 +42,4 @@ export class SelectFieldDownstreamBasin extends SelectField { const db = (this.nub as PbCloison).bassinAval; this.setValueFromId(this._entriesBaseId + (db ? db.uid : "none")); } - - public get associatedProperty(): string { - return undefined; - } - - public get configDefaultValue(): string { - return undefined; - } } diff --git a/src/app/formulaire/elements/select/select-field-remous-target.ts b/src/app/formulaire/elements/select/select-field-remous-target.ts index 6d0f2c506da155a025ae889fc2e3ff2b8edcc445..20b40cc473bbe7395462953dd359638a1f9e217a 100644 --- a/src/app/formulaire/elements/select/select-field-remous-target.ts +++ b/src/app/formulaire/elements/select/select-field-remous-target.ts @@ -1,6 +1,7 @@ import { CourbeRemous } from "jalhyd"; import { SelectField } from "./select-field"; import { SelectEntry } from "./select-entry"; +import { FormulaireNode } from "../formulaire-node"; /* "id": "select_target", @@ -11,6 +12,11 @@ import { SelectEntry } from "./select-entry"; */ export class SelectFieldRemousTarget extends SelectField { + constructor(parent: FormulaireNode) { + super(parent); + this._associatedProperty = "varCalc"; + } + protected populate() { // driven by string[], not enum (easier for variable names) this.addEntry(new SelectEntry(this._entriesBaseId + "none", "")); @@ -23,12 +29,4 @@ export class SelectFieldRemousTarget extends SelectField { protected initSelectedValue() { this.findAndSetDefaultValue(); } - - public get associatedProperty(): string { - return "varCalc"; - } - - public get configDefaultValue(): string { - return undefined; - } -} \ No newline at end of file +} diff --git a/src/app/formulaire/elements/select/select-field-searched-param.ts b/src/app/formulaire/elements/select/select-field-searched-param.ts index 5380e12381c10bee69f4fd003597ef914fd12d9d..1342fb643e31b378ea799dc166f3277714d9b123 100644 --- a/src/app/formulaire/elements/select/select-field-searched-param.ts +++ b/src/app/formulaire/elements/select/select-field-searched-param.ts @@ -48,14 +48,6 @@ export class SelectFieldSearchedParam extends SelectField { } } - public get associatedProperty(): string { - return undefined; - } - - public get configDefaultValue(): string { - return undefined; - } - public updateLocalisation() { // do not override localisation done in populate() // ie. avoid what is done by SelectField.updateLocalisation() diff --git a/src/app/formulaire/elements/select/select-field-solver-targeted-result.ts b/src/app/formulaire/elements/select/select-field-solver-targeted-result.ts index 2b10da8276479761487795781c4aecc734980237..a547bde3c6e1036f697281d8449d6b0df74b2fcf 100644 --- a/src/app/formulaire/elements/select/select-field-solver-targeted-result.ts +++ b/src/app/formulaire/elements/select/select-field-solver-targeted-result.ts @@ -4,6 +4,7 @@ import { Nub, Solveur } from "jalhyd"; import { FormulaireElement } from "../formulaire-element"; import { SelectField } from "./select-field"; import { SelectEntry } from "./select-entry"; +import { FormulaireNode } from "../formulaire-node"; /* "id": "select_target_result", @@ -13,6 +14,10 @@ import { SelectEntry } from "./select-entry"; "default": "" */ export class SelectFieldSolverTargetedResult extends SelectField { + constructor(parent: FormulaireNode) { + super(parent); + this._associatedProperty = "targettedResult"; + } protected populate() { // @WARNING for localisation, @see hack in this.updateLocalisation() @@ -34,14 +39,6 @@ export class SelectFieldSolverTargetedResult extends SelectField { this.findAndSetDefaultValue(); } - public get configDefaultValue(): string { - return ""; - } - - public get associatedProperty(): string { - return "targettedResult"; - } - public updateLocalisation() { FormulaireElement.prototype.updateLocalisation.call(this); for (const e of this._entries) { @@ -61,4 +58,4 @@ export class SelectFieldSolverTargetedResult extends SelectField { } } } -} \ No newline at end of file +} diff --git a/src/app/formulaire/elements/select/select-field-solveur-target.ts b/src/app/formulaire/elements/select/select-field-solveur-target.ts index 64d37dc33d11647c5e44321f602e02396ff2ebb2..aecd238b8d87d8836879bedf48ea707e21894e40 100644 --- a/src/app/formulaire/elements/select/select-field-solveur-target.ts +++ b/src/app/formulaire/elements/select/select-field-solveur-target.ts @@ -47,16 +47,8 @@ export class SelectFieldSolverTarget extends SelectField { } } - public get associatedProperty(): string { - return undefined; - } - - public get configDefaultValue(): string { - return undefined; - } - public updateLocalisation() { // do not override localisation done in populate() // ie. avoid what is done by SelectField.updateLocalisation() } -} \ No newline at end of file +} diff --git a/src/app/formulaire/elements/select/select-field-species-list.ts b/src/app/formulaire/elements/select/select-field-species-list.ts index bcdbbee79f373489d0900edc519eb78cec080c6a..602a5685493dbfd44762bfa4660e81d92e65ec9f 100644 --- a/src/app/formulaire/elements/select/select-field-species-list.ts +++ b/src/app/formulaire/elements/select/select-field-species-list.ts @@ -58,16 +58,8 @@ export class SelectFieldSpeciesList extends SelectField { } } - public get associatedProperty(): string { - return undefined; - } - - public get configDefaultValue(): string { - return undefined; - } - public updateLocalisation() { // do not override localisation done in populate() // ie. avoid what is done by SelectField.updateLocalisation() } -} \ No newline at end of file +} diff --git a/src/app/formulaire/elements/select/select-field-target-pass.ts b/src/app/formulaire/elements/select/select-field-target-pass.ts index 36430d2179ee8d9b72741555f73003a123ce05f0..10cd639a1b125fec2a7af633bfeb4cbde056f07d 100644 --- a/src/app/formulaire/elements/select/select-field-target-pass.ts +++ b/src/app/formulaire/elements/select/select-field-target-pass.ts @@ -47,16 +47,8 @@ export class SelectFieldTargetPass extends SelectField { } } - public get associatedProperty(): string { - return undefined; - } - - public get configDefaultValue(): string { - return undefined; - } - public updateLocalisation() { // do not override localisation done in populate() // ie. avoid what is done by SelectField.updateLocalisation() } -} \ No newline at end of file +} diff --git a/src/app/formulaire/elements/select/select-field-upstream-basin.ts b/src/app/formulaire/elements/select/select-field-upstream-basin.ts index 06e335f5c6d0fdec4d6d03e70245ac1365995f58..0eeb6b605b2e3565baf8bcb20bacead7bc7825d8 100644 --- a/src/app/formulaire/elements/select/select-field-upstream-basin.ts +++ b/src/app/formulaire/elements/select/select-field-upstream-basin.ts @@ -42,12 +42,4 @@ export class SelectFieldUpstreamBasin extends SelectField { const ub = (this.nub as PbCloison).bassinAmont; this.setValueFromId(this._entriesBaseId + (ub ? ub.uid : "none")); } - - public get associatedProperty(): string { - return undefined; - } - - public get configDefaultValue(): string { - return undefined; - } -} \ No newline at end of file +} diff --git a/src/app/formulaire/elements/select/select-field.ts b/src/app/formulaire/elements/select/select-field.ts index 435d042f39ef777de393a1e0ec0024a3f7f4a18c..f67c07404d8395e16baa6219619b75898d3d23c4 100644 --- a/src/app/formulaire/elements/select/select-field.ts +++ b/src/app/formulaire/elements/select/select-field.ts @@ -173,6 +173,13 @@ export abstract class SelectField extends Field { return this._associatedProperty; } + /** + * @returns true if select field is associated to a nub property + */ + public get hasAssociatedNubProperty(): boolean { + return this._associatedProperty !== undefined; + } + /** * default value from configuration */ diff --git a/src/app/formulaire/form-iterator/deep-selectfield-iterator.ts b/src/app/formulaire/form-iterator/deep-selectfield-iterator.ts new file mode 100644 index 0000000000000000000000000000000000000000..6c854754391759334a0e90dbdf8343aca72b197f --- /dev/null +++ b/src/app/formulaire/form-iterator/deep-selectfield-iterator.ts @@ -0,0 +1,19 @@ +import { AbstractFormulaireNodeIterator } from "./abstract-node-iterator"; +import { FormulaireNode } from "../elements/formulaire-node"; +import { SelectField } from "../elements/select/select-field"; + +/** + * itérateur qui extrait récursivement les SelectField dans un tableau de FormulaireElement + * (qui peut contenir des FieldsetContainer) + */ +export class DeepSelectFieldIterator extends AbstractFormulaireNodeIterator<SelectField> implements IterableIterator<SelectField> { + protected isIterable(fe: FormulaireNode) { + return fe instanceof SelectField; + } + + // interface IterableIterator + + [Symbol.iterator](): IterableIterator<SelectField> { + return this; + } +}