| 
									
										
										
										
											2020-07-21 01:37:48 +02:00
										 |  |  | import {UIElement} from "../UIElement"; | 
					
						
							| 
									
										
										
										
											2020-09-12 23:15:17 +02:00
										 |  |  | import {FixedUiElement} from "./FixedUiElement"; | 
					
						
							|  |  |  | import {Utils} from "../../Utils"; | 
					
						
							| 
									
										
										
										
											2020-07-21 01:37:48 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export default class Combine extends UIElement { | 
					
						
							| 
									
										
										
										
											2020-09-12 23:15:17 +02:00
										 |  |  |     private readonly uiElements: UIElement[]; | 
					
						
							| 
									
										
										
										
											2020-07-21 01:37:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-12 23:15:17 +02:00
										 |  |  |     constructor(uiElements: (string | UIElement)[]) { | 
					
						
							|  |  |  |         super(); | 
					
						
							|  |  |  |         this.uiElements = Utils.NoNull(uiElements) | 
					
						
							|  |  |  |             .map(el => { | 
					
						
							|  |  |  |                 if (typeof el === "string") { | 
					
						
							|  |  |  |                     return new FixedUiElement(el); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 return el; | 
					
						
							|  |  |  |             }); | 
					
						
							| 
									
										
										
										
											2020-07-21 01:37:48 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     InnerRender(): string { | 
					
						
							| 
									
										
										
										
											2020-09-27 20:51:37 +02:00
										 |  |  |         return this.uiElements.map(ui => { | 
					
						
							|  |  |  |             if(ui === undefined || ui === null){ | 
					
						
							|  |  |  |                 return ""; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             if(ui.Render === undefined){ | 
					
						
							|  |  |  |                 console.error("Not a UI-element", ui); | 
					
						
							|  |  |  |                 return ""; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2021-02-20 02:25:29 +01:00
										 |  |  |             return ui.Render(); | 
					
						
							| 
									
										
										
										
											2020-09-27 20:51:37 +02:00
										 |  |  |         }).join(""); | 
					
						
							| 
									
										
										
										
											2020-07-21 01:37:48 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-07-21 02:55:28 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-21 01:37:48 +02:00
										 |  |  | } |