mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 18:40:50 +08:00 
			
		
		
		
	Add support for aligning tables
This commit is contained in:
		
				
					committed by
					
						
						Patrik Svensson
					
				
			
			
				
	
			
			
			
						parent
						
							b52056ee49
						
					
				
				
					commit
					9afc1ea721
				
			@@ -27,7 +27,7 @@ namespace Spectre.Console
 | 
			
		||||
                throw new ArgumentNullException(nameof(text));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return SetHeader(panel, new Title(text, style, alignment));
 | 
			
		||||
            return SetHeader(panel, new PanelHeader(text, style, alignment));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
@@ -36,7 +36,7 @@ namespace Spectre.Console
 | 
			
		||||
        /// <param name="panel">The panel.</param>
 | 
			
		||||
        /// <param name="header">The header to use.</param>
 | 
			
		||||
        /// <returns>The same instance so that multiple calls can be chained.</returns>
 | 
			
		||||
        public static Panel SetHeader(this Panel panel, Title header)
 | 
			
		||||
        public static Panel SetHeader(this Panel panel, PanelHeader header)
 | 
			
		||||
        {
 | 
			
		||||
            if (panel is null)
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
@@ -183,9 +183,8 @@ namespace Spectre.Console
 | 
			
		||||
        /// <param name="table">The table.</param>
 | 
			
		||||
        /// <param name="text">The heading.</param>
 | 
			
		||||
        /// <param name="style">The style.</param>
 | 
			
		||||
        /// <param name="alignment">The alignment.</param>
 | 
			
		||||
        /// <returns>The same instance so that multiple calls can be chained.</returns>
 | 
			
		||||
        public static Table SetHeading(this Table table, string text, Style? style = null, Justify? alignment = null)
 | 
			
		||||
        public static Table SetHeading(this Table table, string text, Style? style = null)
 | 
			
		||||
        {
 | 
			
		||||
            if (table is null)
 | 
			
		||||
            {
 | 
			
		||||
@@ -197,7 +196,7 @@ namespace Spectre.Console
 | 
			
		||||
                throw new ArgumentNullException(nameof(text));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return SetHeading(table, new Title(text, style, alignment));
 | 
			
		||||
            return SetHeading(table, new TableTitle(text, style));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
@@ -206,7 +205,7 @@ namespace Spectre.Console
 | 
			
		||||
        /// <param name="table">The table.</param>
 | 
			
		||||
        /// <param name="heading">The heading.</param>
 | 
			
		||||
        /// <returns>The same instance so that multiple calls can be chained.</returns>
 | 
			
		||||
        public static Table SetHeading(this Table table, Title heading)
 | 
			
		||||
        public static Table SetHeading(this Table table, TableTitle heading)
 | 
			
		||||
        {
 | 
			
		||||
            if (table is null)
 | 
			
		||||
            {
 | 
			
		||||
@@ -223,9 +222,8 @@ namespace Spectre.Console
 | 
			
		||||
        /// <param name="table">The table.</param>
 | 
			
		||||
        /// <param name="text">The footnote.</param>
 | 
			
		||||
        /// <param name="style">The style.</param>
 | 
			
		||||
        /// <param name="alignment">The alignment.</param>
 | 
			
		||||
        /// <returns>The same instance so that multiple calls can be chained.</returns>
 | 
			
		||||
        public static Table SetFootnote(this Table table, string text, Style? style = null, Justify? alignment = null)
 | 
			
		||||
        public static Table SetFootnote(this Table table, string text, Style? style = null)
 | 
			
		||||
        {
 | 
			
		||||
            if (table is null)
 | 
			
		||||
            {
 | 
			
		||||
@@ -237,7 +235,7 @@ namespace Spectre.Console
 | 
			
		||||
                throw new ArgumentNullException(nameof(text));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return SetFootnote(table, new Title(text, style, alignment));
 | 
			
		||||
            return SetFootnote(table, new TableTitle(text, style));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
@@ -246,7 +244,7 @@ namespace Spectre.Console
 | 
			
		||||
        /// <param name="table">The table.</param>
 | 
			
		||||
        /// <param name="footnote">The footnote.</param>
 | 
			
		||||
        /// <returns>The same instance so that multiple calls can be chained.</returns>
 | 
			
		||||
        public static Table SetFootnote(this Table table, Title footnote)
 | 
			
		||||
        public static Table SetFootnote(this Table table, TableTitle footnote)
 | 
			
		||||
        {
 | 
			
		||||
            if (table is null)
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user