forked from MapComplete/MapComplete
Lot's of small improvements
This commit is contained in:
parent
9bd37d9cde
commit
8bca006787
29 changed files with 375 additions and 173 deletions
40
UI/Base/VerticalCombine.ts
Normal file
40
UI/Base/VerticalCombine.ts
Normal file
|
@ -0,0 +1,40 @@
|
|||
import {UIElement} from "../UIElement";
|
||||
|
||||
export class VerticalCombine extends UIElement {
|
||||
private _elements: UIElement[];
|
||||
private _className: string;
|
||||
|
||||
constructor(elements: UIElement[], className: string = undefined) {
|
||||
super(undefined);
|
||||
this._elements = elements;
|
||||
this._className = className;
|
||||
}
|
||||
|
||||
protected InnerRender(): string {
|
||||
let html = "";
|
||||
for (const element of this._elements) {
|
||||
if (!element.IsEmpty()) {
|
||||
html += "<div>" + element.Render() + "</div>";
|
||||
}
|
||||
}
|
||||
if(html === ""){
|
||||
return "";
|
||||
}
|
||||
if (this._className === undefined) {
|
||||
return html;
|
||||
}
|
||||
return "<div class='"+this._className+"'>" + html + "</div>";
|
||||
}
|
||||
InnerUpdate(htmlElement: HTMLElement) {
|
||||
for (const element of this._elements){
|
||||
element.Update();
|
||||
}
|
||||
}
|
||||
|
||||
Activate() {
|
||||
for (const element of this._elements){
|
||||
element.Activate();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue