| 
									
										
										
										
											2020-07-25 18:00:08 +02:00
										 |  |  | import Translations from "../i18n/Translations"; | 
					
						
							| 
									
										
										
										
											2021-06-12 02:58:32 +02:00
										 |  |  | import BaseUIElement from "../BaseUIElement"; | 
					
						
							| 
									
										
										
										
											2020-06-29 03:12:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-15 00:55:12 +02:00
										 |  |  | export class Button extends BaseUIElement { | 
					
						
							| 
									
										
										
										
											2021-06-12 02:58:32 +02:00
										 |  |  |     private _text: BaseUIElement; | 
					
						
							| 
									
										
										
										
											2020-06-29 03:12:44 +02:00
										 |  |  |     private _onclick: () => void; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-28 00:45:49 +02:00
										 |  |  |     constructor(text: string | BaseUIElement, onclick: (() => void)) { | 
					
						
							| 
									
										
										
										
											2021-06-15 00:55:12 +02:00
										 |  |  |         super(); | 
					
						
							| 
									
										
										
										
											2020-07-25 18:00:08 +02:00
										 |  |  |         this._text = Translations.W(text); | 
					
						
							| 
									
										
										
										
											2020-06-29 03:12:44 +02:00
										 |  |  |         this._onclick = onclick; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-15 00:55:12 +02:00
										 |  |  |     protected InnerConstructElement(): HTMLElement { | 
					
						
							|  |  |  |         const el = this._text.ConstructElement(); | 
					
						
							| 
									
										
										
										
											2021-09-09 00:05:51 +02:00
										 |  |  |         if (el === undefined) { | 
					
						
							| 
									
										
										
										
											2021-06-15 00:55:12 +02:00
										 |  |  |             return undefined; | 
					
						
							| 
									
										
										
										
											2020-06-29 03:12:44 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-06-15 00:55:12 +02:00
										 |  |  |         const form = document.createElement("form") | 
					
						
							|  |  |  |         const button = document.createElement("button") | 
					
						
							|  |  |  |         button.type = "button" | 
					
						
							|  |  |  |         button.appendChild(el) | 
					
						
							|  |  |  |         button.onclick = this._onclick | 
					
						
							|  |  |  |         form.appendChild(button) | 
					
						
							|  |  |  |         return form; | 
					
						
							| 
									
										
										
										
											2020-06-29 03:12:44 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |