2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  {  InputElement  }  from  "./InputElement"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  UIEventSource  }  from  "../../Logic/UIEventSource"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  BaseUIElement  from  "../BaseUIElement"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  Translation  }  from  "../i18n/Translation"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  {  SubstitutedTranslation  }  from  "../SubstitutedTranslation"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  FeaturePipelineState  from  "../../Logic/State/FeaturePipelineState"  
						 
					
						
							
								
									
										
										
										
											2021-07-11 15:44:17 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								export  default  class  InputElementWrapper < T >  extends  InputElement < T >  {  
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    private  readonly  _inputElement : InputElement < T > 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-11 15:44:17 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    private  readonly  _renderElement : BaseUIElement 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    constructor ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        inputElement : InputElement < T > , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        translation : Translation , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        key : string , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        tags : UIEventSource < any > , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        state : FeaturePipelineState 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-11 15:44:17 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        super ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . _inputElement  =  inputElement 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-11 15:44:17 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								        const  mapping  =  new  Map < string ,  BaseUIElement > ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        mapping . set ( key ,  inputElement ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // Bit of a hack: the SubstitutedTranslation expects a special rendering, but those are formatted '{key()}' instead of '{key}', so we substitute it first
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        translation  =  translation . OnEveryLanguage ( ( txt )  = > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            txt . replace ( "{"  +  key  +  "}" ,  "{"  +  key  +  "()}" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-04-04 02:18:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . _renderElement  =  new  SubstitutedTranslation ( translation ,  tags ,  state ,  mapping ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-11 15:44:17 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    GetValue ( ) :  UIEventSource < T >  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  this . _inputElement . GetValue ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-11 15:44:17 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    IsValid ( t : T ) :  boolean  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  this . _inputElement . IsValid ( t ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-11 15:44:17 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    protected  InnerConstructElement ( ) :  HTMLElement  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  this . _renderElement . ConstructElement ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-11 15:44:17 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-08 21:40:48 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}