diff --git a/src/app/components/fieldset-container/fieldset-container.component.ts b/src/app/components/fieldset-container/fieldset-container.component.ts index aa9c6639ddf3c27535e57db4832d5a894f6531d7..f612f362aa0ac7e2475b785e0e2bbf76bbded771 100644 --- a/src/app/components/fieldset-container/fieldset-container.component.ts +++ b/src/app/components/fieldset-container/fieldset-container.component.ts @@ -89,8 +89,8 @@ export class FieldsetContainerComponent implements DoCheck, AfterViewInit { const prms = after.backupParameters(); // replace in-place to change properties (overkill) // @WTF why only those two ? - newFs.setPropValue("structureType", after.properties.getPropValue("structureType")); - newFs.setPropValue("loiDebit", after.properties.getPropValue("loiDebit")); + newFs.setNubPropValue("structureType", after.properties.getPropValue("structureType")); + newFs.setNubPropValue("loiDebit", after.properties.getPropValue("loiDebit")); // au cas où un des paramètres du fieldset source est en mode calcul, // on met le paramètre copié en mode fixé (nghyd#567) diff --git a/src/app/formulaire/elements/fieldset.ts b/src/app/formulaire/elements/fieldset.ts index b73ff379a513b8a1c8b1f0ae0055ff97ffbb5d51..3b10ef25e87c79242acca583de74ffcebba28442 100644 --- a/src/app/formulaire/elements/fieldset.ts +++ b/src/app/formulaire/elements/fieldset.ts @@ -140,9 +140,11 @@ export class FieldSet extends FormulaireElement implements Observer { } /** + * get associated nub property value + * @param key property name * @param inSection if true, will look for the required property in the Nub's section (children[0]) */ - private getPropValue(key: string, inSection: boolean = false): any { + private getNubPropValue(key: string, inSection: boolean = false): any { if (inSection) { return this.sectionProperties.getPropValue(key); } else { @@ -150,7 +152,13 @@ export class FieldSet extends FormulaireElement implements Observer { } } - public setPropValue(key: string, val: any): boolean { + /** + * assign associated nub property + * @param key nub property name + * @param val value to assign with + * @returns true if property value has changed + */ + public setNubPropValue(key: string, val: any): boolean { return this.properties.setPropValue(key, val, this); } @@ -259,7 +267,7 @@ export class FieldSet extends FormulaireElement implements Observer { private setSelectValueFromProperty(selectId: string, inSection: boolean = false) { const selectField: SelectField = this.getFormulaireNodeById(selectId) as SelectField; if (selectField) { - let propVal: any = this.getPropValue(selectField.associatedProperty, inSection); + let propVal: any = this.getNubPropValue(selectField.associatedProperty, inSection); if (propVal === undefined) { propVal = ""; // clodo bullet-proof loading } @@ -288,7 +296,7 @@ export class FieldSet extends FormulaireElement implements Observer { const ct: string = json["calcType"]; const currentCt = this.properties.getPropValue("calcType"); const calc_type: CalculatorType = currentCt ? currentCt : (ct ? CalculatorType[ct] : this.parentForm.calculatorType); - this.setPropValue("calcType", calc_type); + this.setNubPropValue("calcType", calc_type); // parse fields once, so that SelectField elements are present // when setting default properties below @@ -313,7 +321,7 @@ export class FieldSet extends FormulaireElement implements Observer { if (enumClass) { formalValue = enumClass[defaultValue]; } - this.setPropValue(prop, formalValue); + this.setNubPropValue(prop, formalValue); } } } @@ -401,9 +409,9 @@ export class FieldSet extends FormulaireElement implements Observer { const prop = (fe as SelectField).associatedProperty; // for multiple select if (Array.isArray(data.value)) { - this.setPropValue(prop, data.value.map((v: any) => v.value)); + this.setNubPropValue(prop, data.value.map((v: any) => v.value)); } else { - this.setPropValue(prop, data.value.value); + this.setNubPropValue(prop, data.value.value); } } }