| 
									
										
										
										
											2021-01-02 16:04:16 +01:00
										 |  |  | import {UIEventSource} from "../../Logic/UIEventSource"; | 
					
						
							|  |  |  | import OpeningHoursPickerTable from "./OpeningHoursPickerTable"; | 
					
						
							|  |  |  | import {OH, OpeningHour} from "./OpeningHours"; | 
					
						
							|  |  |  | import {InputElement} from "../Input/InputElement"; | 
					
						
							| 
									
										
										
										
											2021-06-10 01:36:20 +02:00
										 |  |  | import BaseUIElement from "../BaseUIElement"; | 
					
						
							| 
									
										
										
										
											2020-10-02 19:00:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-04 01:04:46 +02:00
										 |  |  | export default class OpeningHoursPicker extends InputElement<OpeningHour[]> { | 
					
						
							|  |  |  |     public readonly IsSelected: UIEventSource<boolean> = new UIEventSource<boolean>(false); | 
					
						
							| 
									
										
										
										
											2021-06-16 14:23:53 +02:00
										 |  |  |     private readonly _ohs: UIEventSource<OpeningHour[]>; | 
					
						
							| 
									
										
										
										
											2020-10-04 01:04:46 +02:00
										 |  |  |     private readonly _backgroundTable: OpeningHoursPickerTable; | 
					
						
							| 
									
										
										
										
											2020-09-30 22:22:58 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-04 12:55:44 +02:00
										 |  |  |     constructor(ohs: UIEventSource<OpeningHour[]> = new UIEventSource<OpeningHour[]>([])) { | 
					
						
							| 
									
										
										
										
											2020-09-30 22:22:58 +02:00
										 |  |  |         super(); | 
					
						
							| 
									
										
										
										
											2020-10-04 01:04:46 +02:00
										 |  |  |         this._ohs = ohs; | 
					
						
							| 
									
										
										
										
											2020-09-30 22:22:58 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-16 14:23:53 +02:00
										 |  |  |         ohs.addCallback(oh => { | 
					
						
							|  |  |  |             ohs.setData(OH.MergeTimes(oh)); | 
					
						
							|  |  |  |         }) | 
					
						
							| 
									
										
										
										
											2020-09-30 22:22:58 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-16 14:23:53 +02:00
										 |  |  |         this._backgroundTable = new OpeningHoursPickerTable(this._ohs); | 
					
						
							|  |  |  |         this._backgroundTable.ConstructElement() | 
					
						
							| 
									
										
										
										
											2020-09-30 22:22:58 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-10 01:36:20 +02:00
										 |  |  |     InnerRender(): BaseUIElement { | 
					
						
							|  |  |  |         return this._backgroundTable; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-04 01:04:46 +02:00
										 |  |  |     GetValue(): UIEventSource<OpeningHour[]> { | 
					
						
							|  |  |  |         return this._ohs | 
					
						
							| 
									
										
										
										
											2020-09-30 22:22:58 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-04 01:04:46 +02:00
										 |  |  |     IsValid(t: OpeningHour[]): boolean { | 
					
						
							|  |  |  |         return true; | 
					
						
							| 
									
										
										
										
											2020-09-30 22:22:58 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-06-16 14:23:53 +02:00
										 |  |  |     protected InnerConstructElement(): HTMLElement { | 
					
						
							|  |  |  |         return this._backgroundTable.ConstructElement(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-30 22:22:58 +02:00
										 |  |  | } |