Allow changes to trigger event in ValueWidget after construction (messy still, but possible)
This commit is contained in:
parent
9d8e7f5ccd
commit
c1cdf3660f
|
@ -196,20 +196,21 @@ export class ValueWidget extends Widget {
|
||||||
this._valueAsNumber = valueAsNumber;
|
this._valueAsNumber = valueAsNumber;
|
||||||
|
|
||||||
if ('value' in this.node) {
|
if ('value' in this.node) {
|
||||||
const readValues = (n: any) => {
|
this.on(triggerEvent, () => this.readValues());
|
||||||
this.suppressCycleWarning();
|
this.readValues();
|
||||||
this._value.value = n?.value ?? '';
|
|
||||||
this._valueAsNumber.value = n?.valueAsNumber ?? NaN;
|
|
||||||
};
|
|
||||||
|
|
||||||
this.on(triggerEvent, e => readValues(e.target));
|
|
||||||
readValues(this.node);
|
|
||||||
|
|
||||||
dataflow { this.valueAsNumber = this._valueAsNumber.value; }
|
dataflow { this.valueAsNumber = this._valueAsNumber.value; }
|
||||||
dataflow { this.value = this._value.value; }
|
dataflow { this.value = this._value.value; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readValues() {
|
||||||
|
const n = this.node as any;
|
||||||
|
this.suppressCycleWarning();
|
||||||
|
this._value.value = n.value ?? '';
|
||||||
|
this._valueAsNumber.value = n.valueAsNumber ?? NaN;
|
||||||
|
}
|
||||||
|
|
||||||
get value(): string {
|
get value(): string {
|
||||||
return this._value.value;
|
return this._value.value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue