forked from MapComplete/MapComplete
		
	Intermediary refactoring
This commit is contained in:
		
							parent
							
								
									dcf5d24002
								
							
						
					
					
						commit
						93db813cfc
					
				
					 15 changed files with 280 additions and 178 deletions
				
			
		
							
								
								
									
										29
									
								
								UI/Input/FixedInputElement.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								UI/Input/FixedInputElement.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | |||
| import {InputElement} from "./InputElement"; | ||||
| import {UIEventSource} from "../UIEventSource"; | ||||
| import {UIElement} from "../UIElement"; | ||||
| import {FixedUiElement} from "../Base/FixedUiElement"; | ||||
| 
 | ||||
| 
 | ||||
| export class FixedInputElement<T> extends InputElement<T> { | ||||
|     private rendering: UIElement; | ||||
|     private value: UIEventSource<T>; | ||||
| 
 | ||||
|     constructor(rendering: UIElement | string, value: T) { | ||||
|         super(undefined); | ||||
|         this.value = new UIEventSource<T>(value); | ||||
|         this.rendering = typeof (rendering) === 'string' ? new FixedUiElement(rendering) : rendering; | ||||
|     } | ||||
| 
 | ||||
|     GetValue(): UIEventSource<T> { | ||||
|         return this.value; | ||||
|     } | ||||
| 
 | ||||
|     protected InnerRender(): string { | ||||
|         return this.rendering.Render(); | ||||
|     } | ||||
| 
 | ||||
|     IsValid(t: T): boolean { | ||||
|         return t === this.value.data; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue