import {InputElement} from "./InputElement"; import {UIEventSource} from "../../Logic/UIEventSource"; import Combine from "../Base/Combine"; import {UIElement} from "../UIElement"; export default class CombinedInputElement extends InputElement { private readonly _a: InputElement; private readonly _b: UIElement; private readonly _combined: UIElement; public readonly IsSelected: UIEventSource; constructor(a: InputElement, b: InputElement) { super(); this._a = a; this._b = b; this.IsSelected = this._a.IsSelected.map((isSelected) => { return isSelected || b.IsSelected.data }, [b.IsSelected]) this._combined = new Combine([this._a, this._b]); } GetValue(): UIEventSource { return this._a.GetValue(); } InnerRender(): string { return this._combined.Render(); } IsValid(t: T): boolean { return this._a.IsValid(t); } }