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

fix: ParamValuesComponent notified of changes on parameter fixed value

refs #480
parent 1b3ba3ab
No related branches found
No related tags found
2 merge requests!133Release version 4.15.0,!119Resolve "Mode "champs vides par défaut" : changer le type d'un ouvrage (ex: dans Cloisons) remplit les champs"
......@@ -102,7 +102,10 @@ export class ParamValuesComponent implements AfterViewInit, Observer {
public update(sender: any, data: any): void {
if (sender instanceof DialogEditParamValuesComponent) {
switch (data.action) {
case "ngparamAfterValue":
case "ngparamAfterMinValue":
case "ngparamAfterMaxValue":
case "ngparamAfterStepValue":
case "ngparamAfterListValue":
// tell the form to clear the results
this.emitModelChanged();
break;
......
......@@ -341,6 +341,46 @@ export class NgParameter extends InputField implements Observer {
);
}
private notifyMinValueModified(sender: any) {
this.notifyObservers(
{
"action": "ngparamAfterMinValue",
"param": this,
"value": this._paramDef.min
}, sender
);
}
private notifyMaxValueModified(sender: any) {
this.notifyObservers(
{
"action": "ngparamAfterMaxValue",
"param": this,
"value": this._paramDef.max
}, sender
);
}
private notifyStepValueModified(sender: any) {
this.notifyObservers(
{
"action": "ngparamAfterStepValue",
"param": this,
"value": this._paramDef.step
}, sender
);
}
private notifyListValueModified(sender: any) {
this.notifyObservers(
{
"action": "ngparamAfterStepValue",
"param": this,
"value": this._paramDef.valueList
}, 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
......@@ -355,33 +395,33 @@ export class NgParameter extends InputField implements Observer {
public setMinValue(sender: any, v: number) {
const changed = (this._paramDef.min !== v);
this._paramDef.min = v;
if (changed) {
this.notifyValueModified(sender);
this._paramDef.min = v;
this.notifyMinValueModified(sender);
}
}
public setMaxValue(sender: any, v: number) {
const changed = (this._paramDef.max !== v);
this._paramDef.max = v;
if (changed) {
this.notifyValueModified(sender);
this._paramDef.max = v;
this.notifyMaxValueModified(sender);
}
}
public setStepValue(sender: any, v: number) {
const changed = (this._paramDef.step !== v);
this._paramDef.step = v;
if (changed) {
this.notifyValueModified(sender);
this._paramDef.step = v;
this.notifyStepValueModified(sender);
}
}
public setValueList(sender: any, l: number[]) {
const changed = (JSON.stringify(this._paramDef.valueList) !== JSON.stringify(l));
this._paramDef.valueList = l;
if (changed) {
this.notifyValueModified(sender);
this._paramDef.valueList = l;
this.notifyListValueModified(sender);
}
}
......
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