2020-09-12 23:15:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  { FixedUiElement }  from  "./FixedUiElement" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  { Utils }  from  "../../Utils" ;  
						 
					
						
							
								
									
										
										
										
											2021-06-10 01:36:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  BaseUIElement  from  "../BaseUIElement" ;  
						 
					
						
							
								
									
										
										
										
											2020-07-21 01:37:48 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-10 01:36:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								export  default  class  Combine  extends  BaseUIElement  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    private  readonly  uiElements : BaseUIElement [ ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-21 01:37:48 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-10 01:36:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    constructor ( uiElements :  ( string  |  BaseUIElement ) [ ] )  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-12 23:15:17 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        super ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . uiElements  =  Utils . NoNull ( uiElements ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            . map ( el  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if  ( typeof  el  ===  "string" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    return  new  FixedUiElement ( el ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                return  el ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-21 01:37:48 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-09 00:05:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    AsMarkdown ( ) :  string  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-14 19:34:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        let  sep  =  " " ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-18 18:52:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( this . HasClass ( "flex-col" ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-14 19:34:00 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            sep  =  "\n\n" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  this . uiElements . map ( el  = >  el . AsMarkdown ( ) ) . join ( sep ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-09 00:05:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-06 18:51:52 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    Destroy() { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        super . Destroy ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        for  ( const  uiElement  of  this . uiElements )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            uiElement . Destroy ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-26 21:40:38 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    public  getElements ( ) :  BaseUIElement [ ]  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  this . uiElements 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-10 01:36:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    protected  InnerConstructElement ( ) :  HTMLElement  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  el  =  document . createElement ( "span" ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-09 00:05:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        try  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 12:04:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if ( this . uiElements  ===  undefined ) { 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-30 20:25:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                console . error ( "PANIC: this.uiElements is undefined. (This might indicate a constructor which did not call 'super'. The constructor name is" ,  this . constructor /*Disable code quality: used for debugging*/ . name + ")" )    
							 
						 
					
						
							
								
									
										
										
										
											2022-07-20 12:04:14 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-09 00:05:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            for  ( const  subEl  of  this . uiElements )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if  ( subEl  ===  undefined  ||  subEl  ===  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-07 16:34:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                try  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    const  subHtml  =  subEl . ConstructElement ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    if  ( subHtml  !==  undefined )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        el . appendChild ( subHtml ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                }  catch  ( e )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-08 04:33:39 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    console . error ( "Could not generate subelement in combine due to " ,  e ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-27 20:51:37 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-09 00:05:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        }  catch  ( e )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-16 14:23:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            const  domExc  =  e  as  DOMException 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            console . error ( "DOMException: " ,  domExc . name ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            el . appendChild ( new  FixedUiElement ( "Could not generate this combine!" ) . SetClass ( "alert" ) . ConstructElement ( ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-09 00:05:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-10 01:36:20 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  el ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-07-21 01:37:48 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-18 18:52:42 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-06-15 00:28:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-21 01:37:48 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}