| 
									
										
										
										
											2020-07-20 15:54:50 +02:00
										 |  |  | import {InputElement} from "./InputElement"; | 
					
						
							|  |  |  | import {UIElement} from "../UIElement"; | 
					
						
							|  |  |  | import {FixedUiElement} from "../Base/FixedUiElement"; | 
					
						
							| 
									
										
										
										
											2020-07-29 13:16:21 +02:00
										 |  |  | import Translations from "../i18n/Translations"; | 
					
						
							| 
									
										
										
										
											2020-08-17 17:23:15 +02:00
										 |  |  | import {UIEventSource} from "../../Logic/UIEventSource"; | 
					
						
							| 
									
										
										
										
											2020-07-20 15:54:50 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export class InputElementWrapper<T> extends InputElement<T>{ | 
					
						
							|  |  |  |     private pre: UIElement ; | 
					
						
							|  |  |  |     private input: InputElement<T>; | 
					
						
							|  |  |  |     private post: UIElement ; | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     constructor( | 
					
						
							|  |  |  |         pre: UIElement | string, | 
					
						
							|  |  |  |         input: InputElement<T>, | 
					
						
							|  |  |  |         post: UIElement | string | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |     ) { | 
					
						
							|  |  |  |         super(undefined); | 
					
						
							| 
									
										
										
										
											2020-07-29 13:16:21 +02:00
										 |  |  |         // this.pre = typeof(pre) === 'string' ?  new FixedUiElement(pre) : pre
 | 
					
						
							|  |  |  |         this.pre = Translations.W(pre) | 
					
						
							| 
									
										
										
										
											2020-07-20 15:54:50 +02:00
										 |  |  |         this.input = input; | 
					
						
							| 
									
										
										
										
											2020-07-29 13:16:21 +02:00
										 |  |  |         // this.post =typeof(post) === 'string' ?  new FixedUiElement(post) : post
 | 
					
						
							|  |  |  |         this.post = Translations.W(post) | 
					
						
							| 
									
										
										
										
											2020-07-20 15:54:50 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     GetValue(): UIEventSource<T> { | 
					
						
							|  |  |  |         return this.input.GetValue(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-07-20 21:03:55 +02:00
										 |  |  |      | 
					
						
							| 
									
										
										
										
											2020-07-20 18:24:00 +02:00
										 |  |  |     InnerRender(): string { | 
					
						
							| 
									
										
										
										
											2020-07-20 15:54:50 +02:00
										 |  |  |         return this.pre.Render() + this.input.Render() + this.post.Render(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     IsValid(t: T): boolean { | 
					
						
							|  |  |  |         return this.input.IsValid(t); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  | } |