import {InputElement} from "./InputElement"; import {UIEventSource} from "../UIEventSource"; import {UIElement} from "../UIElement"; import {FixedUiElement} from "../Base/FixedUiElement"; export class FixedInputElement extends InputElement { private rendering: UIElement; private value: UIEventSource; constructor(rendering: UIElement | string, value: T) { super(undefined); this.value = new UIEventSource(value); this.rendering = typeof (rendering) === 'string' ? new FixedUiElement(rendering) : rendering; } GetValue(): UIEventSource { return this.value; } protected InnerRender(): string { return this.rendering.Render(); } IsValid(t: T): boolean { return t === this.value.data; } }