mapcomplete/UI/Base/Combine.ts
2020-09-12 23:15:17 +02:00

23 lines
No EOL
633 B
TypeScript

import {UIElement} from "../UIElement";
import {FixedUiElement} from "./FixedUiElement";
import {Utils} from "../../Utils";
export default class Combine extends UIElement {
private readonly uiElements: UIElement[];
constructor(uiElements: (string | UIElement)[]) {
super();
this.uiElements = Utils.NoNull(uiElements)
.map(el => {
if (typeof el === "string") {
return new FixedUiElement(el);
}
return el;
});
}
InnerRender(): string {
return this.uiElements.map(ui => ui.Render()).join("");
}
}