diff --git a/src/app/calculators/prebarrage/config.json b/src/app/calculators/prebarrage/config.json index 754fbc81d7914f8c3412fe1fe85ad91b3fb58066..6c72eac2d6d75a1552d3e23af20253fbfc68937f 100644 --- a/src/app/calculators/prebarrage/config.json +++ b/src/app/calculators/prebarrage/config.json @@ -4,24 +4,127 @@ "type": "pb_schema" }, { - "id": "fs_params", - "type": "fieldset", - "fields": [ + "id": "subform_river", + "type": "subform", + "config": [ { - "id": "select_upstream", - "type": "select_reference", - "reference": "nub", - "source": "upstream_stuff" + "id": "fs_river_params", + "type": "fieldset", + "fields": [ + "Q", + "Z1", + "Z2" + ] }, { - "id": "select_downstream", - "type": "select_reference", - "reference": "nub", - "source": "downstream_stuff" + "type": "options", + "selectIds": [ ] + } + ] + }, + { + "id": "subform_basin", + "type": "subform", + "config": [ + { + "id": "fs_basin_params", + "type": "fieldset", + "fields": [ + { + "id": "select_upstream", + "type": "select_reference", + "reference": "nub", + "source": "upstream_stuff" + }, + { + "id": "select_downstream", + "type": "select_reference", + "reference": "nub", + "source": "downstream_stuff" + }, + "Q", + "Z1", + "Z2" + ] }, - "Q", - "Z1", - "Z2" + { + "type": "options", + "selectIds": [ ] + } + ] + }, + { + "id": "subform_wall", + "type": "subform", + "config": [ + { + "id": "fs_wall_device", + "type": "fieldset_template", + "calcType": "Structure", + "defaultStructType": "SeuilRectangulaire", + "defaultLoiDebit": "WeirSubmergedLarinier", + "fields": [ + { + "id": "select_structure", + "type": "select", + "property": "structureType", + "source": "device_structure_type" + }, + { + "id": "select_loidebit", + "type": "select", + "property": "loiDebit", + "source": "device_loi_debit", + "help": { + "Orifice_OrificeSubmerged": "structures/orifice_noye.html", + "SeuilRectangulaire_WeirVillemonte": "structures/kivi.html", + "SeuilRectangulaire_WeirSubmergedLarinier": "structures/fente_noyee.html", + "SeuilTriangulaire_TriangularWeirFree": "structures/dever_triang.html", + "SeuilTriangulaire_TriangularWeirBroad": "structures/dever_triang.html", + "SeuilTriangulaireTrunc_TriangularTruncWeirFree": "structures/dever_triang_tronque.html" + } + }, + "h1", + "L", + "CdWSL", + "CdWR", + "CdGR", + "CdT", + "S", + "alpha2", + "BT", + "ZT" + ] + }, + { + "id": "fs_wall_params", + "type": "fieldset", + "fields": [ + { + "id": "select_upstream", + "type": "select_reference", + "reference": "nub", + "source": "upstream_stuff" + }, + { + "id": "select_downstream", + "type": "select_reference", + "reference": "nub", + "source": "downstream_stuff" + }, + { + "id": "devices_container", + "type": "template_container", + "templates": [ + "fs_wall_device" + ] + } + ] + }, + { + "type": "options", + "selectIds": [ ] + } ] }, { diff --git a/src/app/components/generic-calculator/calculator.component.html b/src/app/components/generic-calculator/calculator.component.html index d9f3b2650147b8fb0487566d69928d95d0b5755d..9cb4f5d2f295798df4edf3dcf0a50156f35c56bb 100644 --- a/src/app/components/generic-calculator/calculator.component.html +++ b/src/app/components/generic-calculator/calculator.component.html @@ -99,7 +99,7 @@ [fxFlex.lt-sm]="isPB ? '1 0 300px' : '1 0 auto'"> <pb-schema *ngIf="isPbSchema(fe)" [pbSchema]=fe (radio)=onRadioClick($event) - (validChange)=onElementValid() (inputChange)=onInputChange($event)> + (validChange)=onElementValid() (nodeSelected)="onPBNodeSelected($event)"> </pb-schema> <div fxHide.sm fxFlex.gt-sm="0 0 16px"></div> diff --git a/src/app/components/generic-calculator/calculator.component.ts b/src/app/components/generic-calculator/calculator.component.ts index b32796c5c3e4206dd6c2e87ea2f1d35fe49b0d6c..f987427202e6ef7bdb0462a47fdd636304aac72e 100644 --- a/src/app/components/generic-calculator/calculator.component.ts +++ b/src/app/components/generic-calculator/calculator.component.ts @@ -567,6 +567,13 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe elt.select(); } + /** réception d'un événement de clic sur un nœud du schéma de PréBarrage */ + public onPBNodeSelected(event: any) { + console.log("node selected", event.node ? event.node.constructor.name : "zubi"); + this.showPBInputData = true; + // show proper form depending on what was clicked + } + public openHelp() { window.open("assets/docs/" + this.appSetupService.language + "/calculators/" + this._formulaire.helpLink, "_blank"); } @@ -822,14 +829,14 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe } const f: FormulaireDefinition = await this.formulaireService.createFormulaire(CalculatorType.SectionParametree, secParam); - const sp = (f.currentNub as SectionParametree); - sp.section.prms.Y.setValues(Ys); - sp.section.prms.If.setValues(Ifs); - // calculate - f.doCompute(); - // go to new SP + const sp = (f.currentNub as SectionParametree); + sp.section.prms.Y.setValues(Ys); + sp.section.prms.If.setValues(Ifs); + // calculate + f.doCompute(); + // go to new SP this.router.navigate(["/calculator", f.uid]); - } + } public get generateRuSpEnabled(): boolean { return this.hasResults && ! this._formulaire.currentNub.result.hasErrorMessages(); @@ -863,10 +870,10 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe Session.getInstance().registerNub(secParam); const f: FormulaireDefinition = await this.formulaireService.createFormulaire(CalculatorType.SectionParametree, secParam); - // calculate - f.doCompute(); - // go to new SP - } + // calculate + f.doCompute(); + // go to new SP + } public get generatePARSimulationEnabled(): boolean { const parCalage = (this._formulaire.currentNub as Par); @@ -978,9 +985,9 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe Session.getInstance().registerNub(parSimulation); const f: FormulaireDefinition = await this.formulaireService.createFormulaire(CalculatorType.ParSimulation, parSimulation); - // calculate - f.doCompute(); - // go to new ParSimulation + // calculate + f.doCompute(); + // go to new ParSimulation this.router.navigate(["/calculator", f.uid]); } @@ -1012,6 +1019,6 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, AfterViewChe const serialisedNub: string = this._formulaire.currentNub.serialise({ title: this._formulaire.calculatorName }); const nubPointer = Session.getInstance().unserialiseSingleNub(serialisedNub); const f = await this.formulaireService.createFormulaire(nubPointer.nub.calcType, nubPointer.nub, nubPointer.meta.title); - this.router.navigate(["/calculator", f.uid]); + this.router.navigate(["/calculator", f.uid]); } } diff --git a/src/app/components/pb-schema/pb-schema.component.html b/src/app/components/pb-schema/pb-schema.component.html index 1ac51ca737cb4602b3031dbf1aa57747febfbad2..f8bb9bbc0bc1c4e0f85a1edab06b49f528d99a84 100644 --- a/src/app/components/pb-schema/pb-schema.component.html +++ b/src/app/components/pb-schema/pb-schema.component.html @@ -39,6 +39,6 @@ <div id="schema" #schema></div> - <!-- <pre id="debug">{{ graphDef }} </pre> --> + <pre id="debug">{{ graphDef }} </pre> </mat-card-content> diff --git a/src/app/components/pb-schema/pb-schema.component.scss b/src/app/components/pb-schema/pb-schema.component.scss index a398740b8c1394eef1b61ff173dfa7af3eb18f2c..c0834e6b705c5bfbf69eef224c464be9f7ff0a32 100644 --- a/src/app/components/pb-schema/pb-schema.component.scss +++ b/src/app/components/pb-schema/pb-schema.component.scss @@ -57,3 +57,7 @@ mat-card-content { margin-bottom: .5em; text-align: center; } + +#debug { + display: none; +} diff --git a/src/app/components/pb-schema/pb-schema.component.ts b/src/app/components/pb-schema/pb-schema.component.ts index 4e2f6952f1563685114c52fbd0b8b98cb3ef60f1..6728c782946e3b2eb20e643e466e889213b7770c 100644 --- a/src/app/components/pb-schema/pb-schema.component.ts +++ b/src/app/components/pb-schema/pb-schema.component.ts @@ -46,9 +46,9 @@ export class PbSchemaComponent implements AfterViewInit, OnInit { @Output() private validChange = new EventEmitter(); - /** événément de changement de valeur d'un input */ + /** événément de sélection d'un nœud du graphique Mermaid */ @Output() - private inputChange = new EventEmitter(); + private nodeSelected = new EventEmitter(); /** underlying PB */ private model: PreBarrage; @@ -255,6 +255,10 @@ export class PbSchemaComponent implements AfterViewInit, OnInit { } } } + // show proper form, hide results + this.nodeSelected.emit({ + node: this._selectedItem + }); } // for debug only @@ -271,24 +275,11 @@ export class PbSchemaComponent implements AfterViewInit, OnInit { return this._isValid; } + /** used for a cosmetics CSS trick only (mat-card-header right margin) */ public get showInputData(): boolean { return this.calculatorComponent.showPBInputData; } - /** - * Checks that input value is a valid number, according to input[type="number"] algorithm, - * and stores it in cell.uiValidity, so that the <td> element can access it and get angry - * if input is invalid - */ - public inputValueChanged($event, cell) { - if ($event && $event.target && $event.target.validity) { - cell.uiValidity = $event.target.validity.valid; - } - this.updateValidity(); - // send input change event (used to reset form results) - this.inputChange.emit(); - } - public get prefixedItemDescription(): string { let desc = this.itemDesription(this._selectedItem); if (this._selectedItem instanceof PbCloison) { @@ -420,6 +411,7 @@ export class PbSchemaComponent implements AfterViewInit, OnInit { // check that at least 1 basin is present and a route from river // upstream to river downstream exists (2nd check includes 1st) this._isValid = this.model.hasUpDownConnection(); + console.log("schéma valide", this._isValid); this.validChange.emit(); } diff --git a/src/app/formulaire/definition/form-definition.ts b/src/app/formulaire/definition/form-definition.ts index 5f8a226d81741cbcaab4147ec48d91ebc2bf7d49..dd679776531c4cf0cd40287f96d078e460df5b95 100644 --- a/src/app/formulaire/definition/form-definition.ts +++ b/src/app/formulaire/definition/form-definition.ts @@ -24,7 +24,6 @@ import { TopFormulaireElementIterator } from "../form-iterator/top-element-itera import { CalculatorResults } from "../../results/calculator-results"; import { ServiceFactory } from "../../services/service-factory"; import { PabTable } from "../elements/pab-table"; -import { PbSchema } from '../elements/pb-schema'; /** * classe de base pour tous les formulaires @@ -47,7 +46,7 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs protected _resultsHelpLinks: { [key: string]: string }; /** fichier de configuration */ - private _jsonConfig: {}; + protected _jsonConfig: {}; /** clé-valeurs du fichier de localisation spécifique à ce module */ private _specificLocalisation: StringMap; @@ -204,31 +203,25 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs public removeFieldset(fs: FieldSet) { } - private parse_fieldset(json: {}, nub?: Nub) { + protected parse_fieldset(json: {}, nub?: Nub) { const fs = this.createFieldset(this, json, undefined, nub); fs.parseConfig(json); this.afterParseFieldset(fs); } - private parse_template_container(json: {}, templates: any[]) { + protected parse_template_container(json: {}, templates: any[]) { const fsc: FieldsetContainer = new FieldsetContainer(this); fsc.parseConfig(json, templates); this.kids.push(fsc); } + // @TODO move to FormulairePAB by overloading parseConfig() private parse_pab_table(json: {}) { const tab: PabTable = new PabTable(this); tab.parseConfig(json); this.kids.push(tab); } - private parse_pb_schema(json: {}) { - const sch: PbSchema = new PbSchema(this); - sch.parseConfig(json); - this.kids.push(sch); - } - - /** * 1ère passe d'analyse de la configuration */ @@ -286,10 +279,6 @@ export abstract class FormulaireDefinition extends FormulaireNode implements Obs this.parse_pab_table(conf); break; - case "pb_schema": // not generic at all - this.parse_pb_schema(conf); - break; - default: throw new Error(`type d'objet de module de calcul ${type} non pris en charge`); } diff --git a/src/app/formulaire/definition/form-prebarrage.ts b/src/app/formulaire/definition/form-prebarrage.ts new file mode 100644 index 0000000000000000000000000000000000000000..d15c13b37335d37330283557ccf08cffc95edff6 --- /dev/null +++ b/src/app/formulaire/definition/form-prebarrage.ts @@ -0,0 +1,116 @@ +import { CalculatorType } from "jalhyd"; + +import { FormulaireFixedVar } from "./form-fixedvar"; +import { FormulaireParallelStructure } from "./form-parallel-structures"; +import { PbSchema } from "../elements/pb-schema"; + +/** + * Formulaire pour les PréBarrage + */ +export class FormulairePrebarrage extends FormulaireFixedVar { + + /** child form for river upstream/downstream elevations and flow */ + private riverForm: FormulaireFixedVar; + + /** child form for basins dimensions */ + private basinForm: FormulaireFixedVar; + + /** child form for walls (repeatable devices) */ + private wallForm: FormulaireParallelStructure; + + public constructor() { + super(); + console.log("Construction du FormPreBarrage !!"); + this.riverForm = new FormulaireFixedVar(); + this.riverForm.defaultProperties["calcType"] = CalculatorType.PreBarrage; + this.basinForm = new FormulaireFixedVar(); + this.basinForm.defaultProperties["calcType"] = CalculatorType.PbBassin; + this.wallForm = new FormulaireParallelStructure(); + this.wallForm.defaultProperties["calcType"] = CalculatorType.PbCloison; + } + + protected parseOptions(json: {}) { + // super.parseOptions(json); + // @TODO parse children forms configs + } + + public parseConfig(json?: {}) { + console.log("> parse confaïgue"); + if (json !== undefined) { + this._jsonConfig = json; + } + for (const conf_index in this._jsonConfig) { + const conf = this._jsonConfig[conf_index]; + const type: string = conf["type"]; + + switch (type) { + // options globales + case "options": + break; + + case "subform": + this.parse_subform(conf); + break; + + case "pb_schema": + this.parse_pb_schema(conf); + break; + + default: + throw new Error(`type d'objet de module de calcul ${type} non pris en charge`); + } + } + this.completeParse(this._jsonConfig); + } + + private parse_subform(json: {}) { + console.log("parse sf", json); + switch (json["id"]) { + case "subform_river": + this.riverForm.currentNub = this.currentNub; + this.riverForm.parseConfig(json["config"]); + break; + case "subform_basin": + // this.basinForm.currentNub = this.currentNub; + this.basinForm.parseConfig(json["config"]); + break; + case "subform_wall": + // this.wallForm.currentNub = this.currentNub; + this.wallForm.parseConfig(json["config"]); + break; + } + // console.log(">> triggering parsing of new subform", subform.constructor.name, subform.uid); + // subform.parseConfig(json); + // this.kids.push(subform); + // f.defaultProperties["calcType"] = ct; + } + + private parse_pb_schema(json: {}) { + const sch: PbSchema = new PbSchema(this); + sch.parseConfig(json); + this.kids.push(sch); + } + + protected completeParse(json: {}, firstNotif: boolean = true) { + // super.completeParse(json); + // @TODO parse children forms configs + } + + // interface Observer + + /* public update(sender: IObservable, data: any) { + // copied from FormDefinition, to avoid calling super.update() + if (sender instanceof Nub) { + switch (data.action) { + case "resultUpdated": + // forward Nub results update notification to FormCompute objects + this.reaffectResultComponents(); + break; + } + } + // copied from FormFixedVar, to avoid calling super.update() + if (data.action === "propertyChange") { + this.reset(); + } + } */ +} diff --git a/src/app/services/formulaire.service.ts b/src/app/services/formulaire.service.ts index e4bb9b0b92539c3123c20bcb515cad9ee8c4fdb9..9e3879d8ada618982c1343abe86977b6d6e587ef 100644 --- a/src/app/services/formulaire.service.ts +++ b/src/app/services/formulaire.service.ts @@ -40,6 +40,7 @@ import { AppComponent } from "../app.component"; import { FormulaireSPP } from "../formulaire/definition/form-spp"; import { FormulaireFixedVar } from "../formulaire/definition/form-fixedvar"; import { FormulaireSection } from "../formulaire/definition/form-section"; +import { FormulairePrebarrage } from "../formulaire/definition/form-prebarrage"; @Injectable() export class FormulaireService extends Observable { @@ -96,7 +97,7 @@ export class FormulaireService extends Observable { console.error(`trying fallback language: ${fallbackLang}`); return this.loadLocalisationForLang(calc, fallbackLang); } - } + } } /** @@ -119,9 +120,9 @@ export class FormulaireService extends Observable { return localisation as StringMap; } catch(e) { throw new Error(`LOCALISATION_FILE_NOT_FOUND "${f}"`); + } } } - } /** * Loads localisation file corresponding to current language then updates all form strings, @@ -131,8 +132,8 @@ export class FormulaireService extends Observable { const requiredLang = this._intlService.currentLanguage; if (requiredLang !== f.currentLanguage) { const localisation = await this.loadLocalisation(f.calculatorType); - f.updateLocalisation(localisation, requiredLang); - return f; + f.updateLocalisation(localisation, requiredLang); + return f; } } @@ -308,6 +309,10 @@ export class FormulaireService extends Observable { f = new FormulaireSPP(); break; + case CalculatorType.PreBarrage: + f = new FormulairePrebarrage(); + break; + default: f = new FormulaireFixedVar(); } @@ -329,92 +334,92 @@ export class FormulaireService extends Observable { this._formulaires.push(f); // Charge la configuration dépendamment du type const s: any = await this.loadConfig(ct); - f.preparseConfig(s); + f.preparseConfig(s); - // Associe le Nub fourni (chargement de session / duplication de module), sinon en crée un nouveau - if (nub) { - f.currentNub = nub; - } else { - f.initNub(); - } + // Associe le Nub fourni (chargement de session / duplication de module), sinon en crée un nouveau + if (nub) { + f.currentNub = nub; + } else { + f.initNub(); + } - // Restaure le nom du module, sinon affecte le nom par défaut - let tempName: string; - if (calculatorName) { - tempName = calculatorName; - } else { - tempName = decode(this.getLocalisedShortTitleFromCalculatorType(ct)); - } - // Suffixe le nom du module si nécessaire - f.calculatorName = this.suffixNameIfNeeded(tempName); - - f.parseConfig(); - - // add fieldsets for existing Structures if needed - // (when loading session only) - if (f.currentNub instanceof ParallelStructure) { - for (const struct of f.currentNub.structures) { - for (const e of f.allFormElements) { - if (e instanceof FieldsetContainer) { // @TODO manage many containers one day ? - e.addFromTemplate(0, undefined, struct); - } + // Restaure le nom du module, sinon affecte le nom par défaut + let tempName: string; + if (calculatorName) { + tempName = calculatorName; + } else { + tempName = decode(this.getLocalisedShortTitleFromCalculatorType(ct)); + } + // Suffixe le nom du module si nécessaire + f.calculatorName = this.suffixNameIfNeeded(tempName); + + f.parseConfig(); + + // add fieldsets for existing Structures if needed + // (when loading session only) + if (f.currentNub instanceof ParallelStructure) { + for (const struct of f.currentNub.structures) { + for (const e of f.allFormElements) { + if (e instanceof FieldsetContainer) { // @TODO manage many containers one day ? + e.addFromTemplate(0, undefined, struct); } } } + } - // add fieldsets for existing YAXN if needed - // (when loading session only) - if (f.currentNub instanceof SPP) { - for (const c of f.currentNub.getChildren()) { - for (const e of f.allFormElements) { - if (e instanceof FieldsetContainer) { // @TODO manage many containers one day ? - e.addFromTemplate(0, undefined, c); - } + // add fieldsets for existing YAXN if needed + // (when loading session only) + if (f.currentNub instanceof SPP) { + for (const c of f.currentNub.getChildren()) { + for (const e of f.allFormElements) { + if (e instanceof FieldsetContainer) { // @TODO manage many containers one day ? + e.addFromTemplate(0, undefined, c); } } } + } - // when creating a new Pab, add one wall with one device, plus the downwall - // (when loading session, those items are already present) - if ( - f instanceof FormulairePab - && f.currentNub instanceof Pab - && f.currentNub.children.length === 0 - && f.currentNub.downWall === undefined - ) { - // 1. one wall - const newWall = Session.getInstance().createNub( - new Props({ - calcType: CalculatorType.Cloisons - }) - ) as Cloisons; - // add new default device for new wall - const newDevice = Session.getInstance().createNub( - new Props({ - calcType: CalculatorType.Structure, - loiDebit: newWall.getDefaultLoiDebit() - }) - ); - newWall.addChild(newDevice); - f.pabNub.addChild(newWall); - // 2. downwall - const newDownWall = Session.getInstance().createNub( - new Props({ - calcType: CalculatorType.CloisonAval - }) - ) as CloisonAval; - // add new default device for new downwall - const newDownwallDevice = Session.getInstance().createNub( - new Props({ - calcType: CalculatorType.Structure, - loiDebit: newDownWall.getDefaultLoiDebit() - }) - ); - newDownWall.addChild(newDownwallDevice); - f.pabNub.downWall = newDownWall; - } - this.notifyObservers({ - "action": "createForm", + // when creating a new Pab, add one wall with one device, plus the downwall + // (when loading session, those items are already present) + if ( + f instanceof FormulairePab + && f.currentNub instanceof Pab + && f.currentNub.children.length === 0 + && f.currentNub.downWall === undefined + ) { + // 1. one wall + const newWall = Session.getInstance().createNub( + new Props({ + calcType: CalculatorType.Cloisons + }) + ) as Cloisons; + // add new default device for new wall + const newDevice = Session.getInstance().createNub( + new Props({ + calcType: CalculatorType.Structure, + loiDebit: newWall.getDefaultLoiDebit() + }) + ); + newWall.addChild(newDevice); + f.pabNub.addChild(newWall); + // 2. downwall + const newDownWall = Session.getInstance().createNub( + new Props({ + calcType: CalculatorType.CloisonAval + }) + ) as CloisonAval; + // add new default device for new downwall + const newDownwallDevice = Session.getInstance().createNub( + new Props({ + calcType: CalculatorType.Structure, + loiDebit: newDownWall.getDefaultLoiDebit() + }) + ); + newDownWall.addChild(newDownwallDevice); + f.pabNub.downWall = newDownWall; + } + this.notifyObservers({ + "action": "createForm", "form": f }); return f; @@ -637,47 +642,47 @@ export class FormulaireService extends Observable { */ public async calculatorInfosFromSessionFile(f: File): Promise<{ nubs: any[], formatVersion: string }> { const s = await this.readSingleFile(f); - // return value + // return value const res: { nubs: any[]; formatVersion: string; } = { - nubs: [], - formatVersion: "" - }; - const data = JSON.parse(s); - // liste des noms de modules de calcul - if (data.session && Array.isArray(data.session)) { - data.session.forEach((e: any) => { - const nubInfo = { - uid: e.uid, - title: e.meta && e.meta.title ? e.meta.title : undefined, - requires: [], - children: [], - type: e.props.calcType - }; - // list linked params dependencies for each Nub - if (e.parameters) { - e.parameters.forEach((p) => { + nubs: [], + formatVersion: "" + }; + const data = JSON.parse(s); + // liste des noms de modules de calcul + if (data.session && Array.isArray(data.session)) { + data.session.forEach((e: any) => { + const nubInfo = { + uid: e.uid, + title: e.meta && e.meta.title ? e.meta.title : undefined, + requires: [], + children: [], + type: e.props.calcType + }; + // list linked params dependencies for each Nub + if (e.parameters) { + e.parameters.forEach((p) => { if (p.targetNub && !nubInfo.requires.includes(p.targetNub)) { - nubInfo.requires.push(p.targetNub); - } - }); - } - // list children nubs for each Nub - if (e.children) { - e.children.forEach((p) => { - nubInfo.children.push(p.uid); - }); - } - res.nubs.push(nubInfo); - }); - } - // version du format de fichier - if (data.header && data.header.format_version) { - res.formatVersion = data.header.format_version; - } - return res; + nubInfo.requires.push(p.targetNub); + } + }); + } + // list children nubs for each Nub + if (e.children) { + e.children.forEach((p) => { + nubInfo.children.push(p.uid); + }); + } + res.nubs.push(nubInfo); + }); + } + // version du format de fichier + if (data.header && data.header.format_version) { + res.formatVersion = data.header.format_version; + } + return res; } public saveForm(f: FormulaireDefinition) {