| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  | import {UIElement} from "../UIElement"; | 
					
						
							|  |  |  | import {ImageSearcher} from "../../Logic/ImageSearcher"; | 
					
						
							| 
									
										
										
										
											2020-10-14 12:15:09 +02:00
										 |  |  | import {SlideShow} from "./SlideShow"; | 
					
						
							| 
									
										
										
										
											2020-08-17 17:23:15 +02:00
										 |  |  | import {UIEventSource} from "../../Logic/UIEventSource"; | 
					
						
							| 
									
										
										
										
											2020-09-13 03:29:44 +02:00
										 |  |  | import Combine from "../Base/Combine"; | 
					
						
							|  |  |  | import DeleteImage from "./DeleteImage"; | 
					
						
							| 
									
										
										
										
											2020-07-14 20:18:44 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-27 01:01:34 +01:00
										 |  |  | export class ImageCarousel extends UIElement{ | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-02 18:59:21 +01:00
										 |  |  |     public readonly slideshow: UIElement; | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-17 02:37:53 +02:00
										 |  |  |     constructor(tags: UIEventSource<any>, imagePrefix: string = "image", loadSpecial: boolean =true) { | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  |         super(tags); | 
					
						
							| 
									
										
										
										
											2020-10-17 02:37:53 +02:00
										 |  |  |         const searcher : UIEventSource<{url:string}[]> = new ImageSearcher(tags, imagePrefix, loadSpecial); | 
					
						
							| 
									
										
										
										
											2020-09-13 03:29:44 +02:00
										 |  |  |         const uiElements = searcher.map((imageURLS: {key: string, url:string}[]) => { | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  |             const uiElements: UIElement[] = []; | 
					
						
							|  |  |  |             for (const url of imageURLS) { | 
					
						
							| 
									
										
										
										
											2020-09-13 03:29:44 +02:00
										 |  |  |                 let image = ImageSearcher.CreateImageElement(url.url); | 
					
						
							|  |  |  |                 if(url.key !== undefined){ | 
					
						
							|  |  |  |                     image = new Combine([ | 
					
						
							|  |  |  |                         image, | 
					
						
							|  |  |  |                         new DeleteImage(url.key, tags) | 
					
						
							|  |  |  |                     ]); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2020-07-07 15:08:52 +02:00
										 |  |  |                 uiElements.push(image); | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  |             } | 
					
						
							|  |  |  |             return uiElements; | 
					
						
							|  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2020-07-07 15:08:52 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-13 00:53:24 +02:00
										 |  |  |         this.slideshow = new SlideShow(uiElements).HideOnEmpty(true); | 
					
						
							| 
									
										
										
										
											2020-11-02 18:59:21 +01:00
										 |  |  |          | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-11-02 12:38:04 +01:00
										 |  |  |      | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  |     InnerRender(): string { | 
					
						
							| 
									
										
										
										
											2020-09-13 00:53:24 +02:00
										 |  |  |         return this.slideshow.Render(); | 
					
						
							| 
									
										
										
										
											2020-07-07 15:08:52 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-06-24 00:35:19 +02:00
										 |  |  | } |