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

refactor: remove unused NgParam "modified" flag

refs #516
parent 4e39f694
No related branches found
No related tags found
2 merge requests!133Release version 4.15.0,!126Resolve "Cloisons > Générer une PAB: vider les champs"
......@@ -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);
}
}
......
......@@ -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;
}
}
......
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