From 9524cc6eb12c944f026cbd05f05ea7ac44df77aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Zi=C4=85bek?= Date: Thu, 6 Jan 2022 00:22:07 +0100 Subject: [PATCH] 2022.1.0-beta3 Renaming Box() to MinimalBox() --- QuestPDF.Examples/CanvasExamples.cs | 2 +- QuestPDF.Examples/ElementExamples.cs | 8 ++++---- QuestPDF.Examples/InlinedExamples.cs | 4 ++-- QuestPDF.Examples/RowExamples.cs | 2 +- QuestPDF.Examples/TableExamples.cs | 14 +++++++------- QuestPDF.Examples/TextExamples.cs | 14 +++++++------- .../Layouts/DifferentHeadersTemplate.cs | 4 ++-- QuestPDF.UnitTests/BoxTests.cs | 8 ++++---- QuestPDF/Elements/DebugArea.cs | 2 +- QuestPDF/Elements/{Box.cs => MinimalBox.cs} | 2 +- QuestPDF/Fluent/ElementExtensions.cs | 9 ++++++++- QuestPDF/Fluent/TextExtensions.cs | 2 +- QuestPDF/QuestPDF.csproj | 2 +- 13 files changed, 40 insertions(+), 33 deletions(-) rename QuestPDF/Elements/{Box.cs => MinimalBox.cs} (88%) diff --git a/QuestPDF.Examples/CanvasExamples.cs b/QuestPDF.Examples/CanvasExamples.cs index 0de9357..a37d41f 100644 --- a/QuestPDF.Examples/CanvasExamples.cs +++ b/QuestPDF.Examples/CanvasExamples.cs @@ -23,7 +23,7 @@ namespace QuestPDF.Examples container .Background(Colors.Grey.Lighten2) .Padding(25) - .Box() + .MinimalBox() .Layers(layers => { layers.Layer().Canvas((canvas, size) => diff --git a/QuestPDF.Examples/ElementExamples.cs b/QuestPDF.Examples/ElementExamples.cs index 993c6a2..e37423b 100644 --- a/QuestPDF.Examples/ElementExamples.cs +++ b/QuestPDF.Examples/ElementExamples.cs @@ -474,7 +474,7 @@ namespace QuestPDF.Examples .Padding(15) .Border(4) .BorderColor(Colors.Blue.Medium) - //.Box() + //.MinimalBox() .Background(Colors.Grey.Lighten2) .Padding(15) .Text("Test of the \n box element", TextStyle.Default.Size(20)); @@ -542,7 +542,7 @@ namespace QuestPDF.Examples { container .Background("#FFF") - .Box() + .MinimalBox() .Padding(25) @@ -588,7 +588,7 @@ namespace QuestPDF.Examples return element; }) - .Box() + .MinimalBox() .Background(Colors.White) .Padding(10) .Text($"Rotated {turns * 90}°", TextStyle.Default.Size(16)); @@ -686,7 +686,7 @@ namespace QuestPDF.Examples return element; }) - .Box() + .MinimalBox() .Background(Colors.White) .Padding(10) .Text($"Flipped {turns}", TextStyle.Default.Size(16)); diff --git a/QuestPDF.Examples/InlinedExamples.cs b/QuestPDF.Examples/InlinedExamples.cs index 95c21ef..72c7e1e 100644 --- a/QuestPDF.Examples/InlinedExamples.cs +++ b/QuestPDF.Examples/InlinedExamples.cs @@ -37,7 +37,7 @@ namespace QuestPDF.Examples decoration .Content() .PaddingTop(25) - //.Box() + //.MinimalBox() .Border(1) .Background(Colors.Grey.Lighten2) .Inlined(inlined => @@ -94,7 +94,7 @@ namespace QuestPDF.Examples { container .Padding(20) - .Box() + .MinimalBox() .Border(1) .Background(Colors.Grey.Lighten4) .Inlined(inlined => diff --git a/QuestPDF.Examples/RowExamples.cs b/QuestPDF.Examples/RowExamples.cs index 5792114..cd200b4 100644 --- a/QuestPDF.Examples/RowExamples.cs +++ b/QuestPDF.Examples/RowExamples.cs @@ -20,7 +20,7 @@ namespace QuestPDF.Examples { container .Padding(25) - .Box() + .MinimalBox() .Border(1) .Stack(stack => { diff --git a/QuestPDF.Examples/TableExamples.cs b/QuestPDF.Examples/TableExamples.cs index 5c4d45f..c9eeee1 100644 --- a/QuestPDF.Examples/TableExamples.cs +++ b/QuestPDF.Examples/TableExamples.cs @@ -28,7 +28,7 @@ namespace QuestPDF.Examples { container .Padding(10) - .Box() + .MinimalBox() .Border(1) .Table(table => { @@ -61,7 +61,7 @@ namespace QuestPDF.Examples { container .Padding(10) - .Box() + .MinimalBox() .Border(1) .DefaultTextStyle(TextStyle.Default.Size(16)) .Table(table => @@ -125,7 +125,7 @@ namespace QuestPDF.Examples { container .Padding(10) - .Box() + .MinimalBox() .Border(1) .Table(table => { @@ -158,7 +158,7 @@ namespace QuestPDF.Examples { container .Padding(10) - .Box() + .MinimalBox() .Border(1) .Table(table => { @@ -193,7 +193,7 @@ namespace QuestPDF.Examples { container .Padding(10) - .Box() + .MinimalBox() .Border(1) .Table(table => { @@ -307,7 +307,7 @@ namespace QuestPDF.Examples container .Padding(10) - .Box() + .MinimalBox() .Border(1) .Decoration(decoration => { @@ -400,7 +400,7 @@ namespace QuestPDF.Examples container .Padding(25) //.Background(Colors.Blue.Lighten2) - .Box() + .MinimalBox() .Border(1) //.Background(Colors.Red.Lighten2) .Table(table => diff --git a/QuestPDF.Examples/TextExamples.cs b/QuestPDF.Examples/TextExamples.cs index 9d1b82e..dfe8d35 100644 --- a/QuestPDF.Examples/TextExamples.cs +++ b/QuestPDF.Examples/TextExamples.cs @@ -24,7 +24,7 @@ namespace QuestPDF.Examples { container .Padding(5) - .Box() + .MinimalBox() .Border(1) .Padding(10) .Text(text => @@ -48,7 +48,7 @@ namespace QuestPDF.Examples { container .Padding(5) - .Box() + .MinimalBox() .Border(1) .Padding(10) .Text(text => @@ -76,7 +76,7 @@ namespace QuestPDF.Examples { container .Padding(5) - .Box() + .MinimalBox() .Border(1) .Padding(10) .Text(text => @@ -108,7 +108,7 @@ namespace QuestPDF.Examples container .Padding(20) .Padding(10) - .Box() + .MinimalBox() .Border(1) .Padding(5) .Padding(10) @@ -138,7 +138,7 @@ namespace QuestPDF.Examples container .Padding(20) .Padding(10) - .Box() + .MinimalBox() .Border(1) .Padding(5) .Padding(10) @@ -167,7 +167,7 @@ namespace QuestPDF.Examples container .Padding(20) .Padding(10) - .Box() + .MinimalBox() .Border(1) .Padding(5) .Padding(10) @@ -230,7 +230,7 @@ namespace QuestPDF.Examples container .Padding(20) .Padding(10) - .Box() + .MinimalBox() .Border(1) .Padding(5) .Padding(10) diff --git a/QuestPDF.ReportSample/Layouts/DifferentHeadersTemplate.cs b/QuestPDF.ReportSample/Layouts/DifferentHeadersTemplate.cs index 2b3898f..7f54bdb 100644 --- a/QuestPDF.ReportSample/Layouts/DifferentHeadersTemplate.cs +++ b/QuestPDF.ReportSample/Layouts/DifferentHeadersTemplate.cs @@ -31,12 +31,12 @@ namespace QuestPDF.ReportSample.Layouts stack.Item().ShowOnce().Padding(5).AlignMiddle().Row(row => { row.RelativeColumn(2).AlignMiddle().Text("PRIMARY HEADER", TextStyle.Default.Color(Colors.Grey.Darken3).Size(30).Bold()); - row.RelativeColumn(1).AlignRight().Box().AlignMiddle().Background(Colors.Blue.Darken2).Padding(30); + row.RelativeColumn(1).AlignRight().MinimalBox().AlignMiddle().Background(Colors.Blue.Darken2).Padding(30); }); stack.Item().SkipOnce().Padding(5).Row(row => { row.RelativeColumn(2).Text("SECONDARY HEADER", TextStyle.Default.Color(Colors.Grey.Darken3).Size(30).Bold()); - row.RelativeColumn(1).AlignRight().Box().Background(Colors.Blue.Lighten4).Padding(15); + row.RelativeColumn(1).AlignRight().MinimalBox().Background(Colors.Blue.Lighten4).Padding(15); }); }); } diff --git a/QuestPDF.UnitTests/BoxTests.cs b/QuestPDF.UnitTests/BoxTests.cs index bfdffd4..4a49dfc 100644 --- a/QuestPDF.UnitTests/BoxTests.cs +++ b/QuestPDF.UnitTests/BoxTests.cs @@ -10,13 +10,13 @@ namespace QuestPDF.UnitTests public class BoxTests { [Test] - public void Measure() => SimpleContainerTests.Measure(); + public void Measure() => SimpleContainerTests.Measure(); [Test] public void Draw_Wrap() { TestPlan - .For(x => new Box + .For(x => new MinimalBox { Child = x.CreateChild() }) @@ -29,7 +29,7 @@ namespace QuestPDF.UnitTests public void Measure_PartialRender() { TestPlan - .For(x => new Box + .For(x => new MinimalBox { Child = x.CreateChild() }) @@ -43,7 +43,7 @@ namespace QuestPDF.UnitTests public void Measure_FullRender() { TestPlan - .For(x => new Box + .For(x => new MinimalBox { Child = x.CreateChild() }) diff --git a/QuestPDF/Elements/DebugArea.cs b/QuestPDF/Elements/DebugArea.cs index e61bdc2..cd93da2 100644 --- a/QuestPDF/Elements/DebugArea.cs +++ b/QuestPDF/Elements/DebugArea.cs @@ -27,7 +27,7 @@ namespace QuestPDF.Elements .Layer() .ShowIf(!string.IsNullOrWhiteSpace(Text)) .AlignCenter() - .Box() + .MinimalBox() .Background(Colors.White) .Padding(2) .Text(Text, TextStyle.Default.Color(Color).FontType(Fonts.Consolas).Size(8)); diff --git a/QuestPDF/Elements/Box.cs b/QuestPDF/Elements/MinimalBox.cs similarity index 88% rename from QuestPDF/Elements/Box.cs rename to QuestPDF/Elements/MinimalBox.cs index edd581e..741b439 100644 --- a/QuestPDF/Elements/Box.cs +++ b/QuestPDF/Elements/MinimalBox.cs @@ -3,7 +3,7 @@ using QuestPDF.Infrastructure; namespace QuestPDF.Elements { - internal class Box : ContainerElement + internal class MinimalBox : ContainerElement { internal override void Draw(Size availableSpace) { diff --git a/QuestPDF/Fluent/ElementExtensions.cs b/QuestPDF/Fluent/ElementExtensions.cs index 884e115..856585d 100644 --- a/QuestPDF/Fluent/ElementExtensions.cs +++ b/QuestPDF/Fluent/ElementExtensions.cs @@ -136,9 +136,16 @@ namespace QuestPDF.Fluent }); } + // TODO: deprecated Box method in QuestPDF 2022.1 + [Obsolete("This element has been renamed. Please use the MinimalBox method.")] public static IContainer Box(this IContainer element) { - return element.Element(new Box()); + return element.Element(new MinimalBox()); + } + + public static IContainer MinimalBox(this IContainer element) + { + return element.Element(new MinimalBox()); } public static IContainer Unconstrained(this IContainer element) diff --git a/QuestPDF/Fluent/TextExtensions.cs b/QuestPDF/Fluent/TextExtensions.cs index 3fc96c2..c08cfd6 100644 --- a/QuestPDF/Fluent/TextExtensions.cs +++ b/QuestPDF/Fluent/TextExtensions.cs @@ -167,7 +167,7 @@ namespace QuestPDF.Fluent Element = container }); - return container.AlignBottom().Box(); + return container.AlignBottom().MinimalBox(); } internal void Compose(IContainer container) diff --git a/QuestPDF/QuestPDF.csproj b/QuestPDF/QuestPDF.csproj index 3f2176f..57cc018 100644 --- a/QuestPDF/QuestPDF.csproj +++ b/QuestPDF/QuestPDF.csproj @@ -4,7 +4,7 @@ MarcinZiabek CodeFlint QuestPDF - 2022.1.0-beta2 + 2022.1.0-beta3 QuestPDF is an open-source, modern and battle-tested library that can help you with generating PDF documents by offering friendly, discoverable and predictable C# fluent API. $([System.IO.File]::ReadAllText("$(MSBuildProjectDirectory)/Resources/ReleaseNotes.txt")) 9