diff --git a/src/app/components/generic-input/generic-input.component.ts b/src/app/components/generic-input/generic-input.component.ts index 5b31ee4e81da662abc5897837387b656547bdf10..3dc390d50f261a0dab352154f62a34000e46b885 100644 --- a/src/app/components/generic-input/generic-input.component.ts +++ b/src/app/components/generic-input/generic-input.component.ts @@ -263,12 +263,7 @@ export abstract class GenericInputComponentDirective implements OnChanges { if (valid && this._uiValue !== "") { val = +this._uiValue; // cast UI value to Number } - if (this.setAndValidateModel(this, val)) { - // set parameter "modified" flag - if (this._model instanceof NgParameter) { - this._model.isValueModified = true; - } - } + this.setAndValidateModel(this, val); } } diff --git a/src/app/formulaire/elements/ngparam.ts b/src/app/formulaire/elements/ngparam.ts index 59c4e188fe7c766365989ccf95bd175086ad6136..43d7cb29815ed0c8e42baa5fa9910fa2b0b810a5 100644 --- a/src/app/formulaire/elements/ngparam.ts +++ b/src/app/formulaire/elements/ngparam.ts @@ -38,9 +38,6 @@ export class NgParameter extends InputField implements Observer { public disabled: boolean; - /** true if value has been modified by user */ - private _isValueModified = false; - constructor(private _paramDef: ParamDefinition, parent: FormulaireNode) { super(parent); this.radioConfig = this.radioState; @@ -284,14 +281,6 @@ export class NgParameter extends InputField implements Observer { return this._paramDef.valuesIterator; } - public get isValueModified(): boolean { - return this._isValueModified; - } - - public set isValueModified(b: boolean) { - this._isValueModified = b; - } - /** * Reads radio config from parameter calculability */ @@ -404,18 +393,6 @@ export class NgParameter extends InputField implements Observer { ); } - /** - * fixe la valeur du paramètre en tant que valeur par défaut - */ - public resetValue(sender: any, val: number) { - const changed = (this._paramDef.getValue() !== val); - this._isValueModified = false; - if (changed) { - this._paramDef.setValue(val, sender); - this.notifyValueModified(sender); - } - } - /** * fixe la valeur du paramètre. * une notification préalable est envoyée pour laisser l'occasion aux objets liés de préciser le contexte @@ -433,7 +410,6 @@ export class NgParameter extends InputField implements Observer { public resetMinValue(sender: any, v: number) { const changed = (this._paramDef.min !== v); - this._isValueModified = false; if (changed) { this._paramDef.min = v; this.notifyMinValueModified(sender); @@ -444,14 +420,12 @@ export class NgParameter extends InputField implements Observer { const changed = (this._paramDef.min !== v); if (changed) { this._paramDef.min = v; - this._isValueModified = true; this.notifyMinValueModified(sender); } } public resetMaxValue(sender: any, v: number) { const changed = (this._paramDef.max !== v); - this._isValueModified = false; if (changed) { this._paramDef.max = v; this.notifyMaxValueModified(sender); @@ -462,14 +436,12 @@ export class NgParameter extends InputField implements Observer { const changed = (this._paramDef.max !== v); if (changed) { this._paramDef.max = v; - this._isValueModified = true; this.notifyMaxValueModified(sender); } } public resetStepValue(sender: any, v: number) { const changed = (this._paramDef.step !== v); - this._isValueModified = false; if (changed) { this._paramDef.step = v; this.notifyStepValueModified(sender); @@ -480,14 +452,12 @@ export class NgParameter extends InputField implements Observer { const changed = (this._paramDef.step !== v); if (changed) { this._paramDef.step = v; - this._isValueModified = true; this.notifyStepValueModified(sender); } } public resetValueList(sender: any, l: number[]) { const changed = (JSON.stringify(this._paramDef.valueList) !== JSON.stringify(l)); - this._isValueModified = false; if (changed) { this._paramDef.valueList = l; this.notifyListValueModified(sender); @@ -498,7 +468,6 @@ export class NgParameter extends InputField implements Observer { const changed = (JSON.stringify(this._paramDef.valueList) !== JSON.stringify(l)); if (changed) { this._paramDef.valueList = l; - this._isValueModified = true; this.notifyListValueModified(sender); } } @@ -520,7 +489,6 @@ export class NgParameter extends InputField implements Observer { allowEmpty: this._allowEmpty, unit: this.unit, radioConfig: this.radioConfig, - modified: this._isValueModified } } @@ -530,7 +498,6 @@ export class NgParameter extends InputField implements Observer { this._allowEmpty = rep.allowEmpty; this.unit = rep.unit; this.radioConfig = rep.radioConfig; - this._isValueModified = rep._isValueModified; } }