import {InputElement} from "./InputElement"; import {UIEventSource} from "../../Logic/UIEventSource"; import BaseUIElement from "../BaseUIElement"; import {VariableUiElement} from "../Base/VariableUIElement"; export default class VariableInputElement extends InputElement { private readonly value: UIEventSource; private readonly element: BaseUIElement public readonly IsSelected: UIEventSource; private readonly upstream: UIEventSource>; constructor(upstream: UIEventSource>) { super() this.upstream = upstream; this.value = upstream.bind(v => v.GetValue()) this.element = new VariableUiElement(upstream) this.IsSelected = upstream.bind(v => v.IsSelected) } GetValue(): UIEventSource { return this.value; } protected InnerConstructElement(): HTMLElement { return this.element.ConstructElement(); } IsValid(t: T): boolean { return this.upstream.data.IsValid(t); } }