mapcomplete/UI/Base/Combine.ts

31 lines
841 B
TypeScript
Raw Normal View History

2020-07-21 01:37:48 +02:00
import {UIElement} from "../UIElement";
import Translations from "../i18n/Translations";
export default class Combine extends UIElement {
private uiElements: (string | UIElement)[];
2020-07-21 01:37:48 +02:00
constructor(uiElements: (string | UIElement)[]) {
super(undefined);
this.uiElements = uiElements;
2020-07-21 01:37:48 +02:00
}
InnerRender(): string {
let elements = "";
for (const element of this.uiElements) {
if (element instanceof UIElement) {
elements += element.Render();
} else {
elements += element;
}
2020-07-21 01:37:48 +02:00
}
return elements;
}
protected InnerUpdate(htmlElement: HTMLElement) {
for (const element of this.uiElements) {
if (element instanceof UIElement) {
element.Update();
}
}
}
2020-07-21 01:37:48 +02:00
}