import {InputElement} from "./InputElement"; import {UIEventSource} from "../../Logic/UIEventSource"; import Combine from "../Base/Combine"; import BaseUIElement from "../BaseUIElement"; export default class CombinedInputElement extends InputElement { protected InnerConstructElement(): HTMLElement { return this._combined.ConstructElement(); } private readonly _a: InputElement; private readonly _b: BaseUIElement; private readonly _combined: BaseUIElement; 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(); } IsValid(t: T): boolean { return this._a.IsValid(t); } }