forked from MapComplete/MapComplete
Link value of OHInput, make combinedInputElement more resilient; formatting
This commit is contained in:
parent
6efc928bb5
commit
570cbc67ce
2 changed files with 8 additions and 7 deletions
|
@ -24,13 +24,13 @@ export default class CombinedInputElement<T, J, X> extends InputElement<X> {
|
||||||
}, [b.IsSelected])
|
}, [b.IsSelected])
|
||||||
this._combined = new Combine([this._a, this._b]);
|
this._combined = new Combine([this._a, this._b]);
|
||||||
this._value = this._a.GetValue().map(
|
this._value = this._a.GetValue().map(
|
||||||
t => combine(t, this._b.GetValue().data),
|
t => combine(t, this._b?.GetValue()?.data),
|
||||||
[this._b.GetValue()],
|
[this._b.GetValue()],
|
||||||
)
|
)
|
||||||
.addCallback(x => {
|
.addCallback(x => {
|
||||||
const [t, j] = split(x)
|
const [t, j] = split(x)
|
||||||
this._a.GetValue().setData(t)
|
this._a.GetValue()?.setData(t)
|
||||||
this._b.GetValue().setData(j)
|
this._b.GetValue()?.setData(j)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -264,11 +264,12 @@ export default class ValidatedTextField {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tp.inputHelper) {
|
if (tp.inputHelper) {
|
||||||
input = new CombinedInputElement(input, tp.inputHelper(input.GetValue(), {
|
const helper = tp.inputHelper(input.GetValue(), {
|
||||||
location: options.location,
|
location: options.location,
|
||||||
mapBackgroundLayer: options.mapBackgroundLayer
|
mapBackgroundLayer: options.mapBackgroundLayer
|
||||||
|
|
||||||
}),
|
})
|
||||||
|
input = new CombinedInputElement(input, helper,
|
||||||
(a, _) => a, // We can ignore b, as they are linked earlier
|
(a, _) => a, // We can ignore b, as they are linked earlier
|
||||||
a => [a, a]
|
a => [a, a]
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue