2020-07-21 01:37:48 +02:00
|
|
|
import {UIElement} from "../UIElement";
|
|
|
|
import Translations from "../i18n/Translations";
|
|
|
|
|
|
|
|
export default class Combine extends UIElement {
|
2020-09-02 11:37:34 +02:00
|
|
|
private readonly uiElements: (string | UIElement)[];
|
|
|
|
private readonly className: string = undefined;
|
2020-07-21 01:37:48 +02:00
|
|
|
|
2020-07-31 04:58:58 +02:00
|
|
|
constructor(uiElements: (string | UIElement)[], className: string = undefined) {
|
2020-07-21 01:37:48 +02:00
|
|
|
super(undefined);
|
2020-09-02 11:37:34 +02:00
|
|
|
this.dumbMode = false;
|
2020-07-31 04:58:58 +02:00
|
|
|
this.className = className;
|
2020-07-21 02:55:28 +02:00
|
|
|
this.uiElements = uiElements;
|
2020-09-02 11:37:34 +02:00
|
|
|
if (className) {
|
|
|
|
console.error("Deprecated used of className")
|
|
|
|
}
|
2020-07-21 01:37:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
InnerRender(): string {
|
|
|
|
let elements = "";
|
|
|
|
for (const element of this.uiElements) {
|
2020-09-05 15:27:35 +02:00
|
|
|
if(element === undefined){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-07-21 02:55:28 +02:00
|
|
|
if (element instanceof UIElement) {
|
|
|
|
elements += element.Render();
|
|
|
|
} else {
|
|
|
|
elements += element;
|
|
|
|
}
|
2020-07-21 01:37:48 +02:00
|
|
|
}
|
2020-07-31 04:58:58 +02:00
|
|
|
if(this.className !== undefined){
|
|
|
|
elements = `<span class='${this.className}'>${elements}</span>`;
|
|
|
|
}
|
|
|
|
|
2020-07-21 01:37:48 +02:00
|
|
|
return elements;
|
|
|
|
}
|
2020-07-21 02:55:28 +02:00
|
|
|
|
2020-07-22 15:56:43 +02:00
|
|
|
InnerUpdate(htmlElement: HTMLElement) {
|
2020-07-21 02:55:28 +02:00
|
|
|
for (const element of this.uiElements) {
|
|
|
|
if (element instanceof UIElement) {
|
|
|
|
element.Update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-07-21 01:37:48 +02:00
|
|
|
}
|