forked from MapComplete/MapComplete
		
	
		
			
				
	
	
		
			41 lines
		
	
	
		
			No EOL
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			No EOL
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import {UIEventSource} from "../../Logic/UIEventSource";
 | |
| import OpeningHoursPickerTable from "./OpeningHoursPickerTable";
 | |
| import {OH, OpeningHour} from "./OpeningHours";
 | |
| import {InputElement} from "../Input/InputElement";
 | |
| import BaseUIElement from "../BaseUIElement";
 | |
| 
 | |
| export default class OpeningHoursPicker extends InputElement<OpeningHour[]> {
 | |
|     public readonly IsSelected: UIEventSource<boolean> = new UIEventSource<boolean>(false);
 | |
|     private readonly _ohs: UIEventSource<OpeningHour[]>;
 | |
|     private readonly _backgroundTable: OpeningHoursPickerTable;
 | |
| 
 | |
| 
 | |
|     constructor(ohs: UIEventSource<OpeningHour[]> = new UIEventSource<OpeningHour[]>([])) {
 | |
|         super();
 | |
|         this._ohs = ohs;
 | |
| 
 | |
|         ohs.addCallback(oh => {
 | |
|             ohs.setData(OH.MergeTimes(oh));
 | |
|         })
 | |
| 
 | |
|         this._backgroundTable = new OpeningHoursPickerTable(this._ohs);
 | |
|         this._backgroundTable.ConstructElement()
 | |
|     }
 | |
| 
 | |
|     InnerRender(): BaseUIElement {
 | |
|         return this._backgroundTable;
 | |
|     }
 | |
| 
 | |
|     GetValue(): UIEventSource<OpeningHour[]> {
 | |
|         return this._ohs
 | |
|     }
 | |
| 
 | |
|     IsValid(t: OpeningHour[]): boolean {
 | |
|         return true;
 | |
|     }
 | |
| 
 | |
|     protected InnerConstructElement(): HTMLElement {
 | |
|         return this._backgroundTable.ConstructElement();
 | |
|     }
 | |
| 
 | |
| } |