Repository navigation
Conversation
Allow flow tables to set header typography, separate axis padding, and per-cell border colors without changing the existing defaults or native multipage row handling. Co-authored-by: Mase Graye <[email protected]>
|
Thanks for the contribution @masegraye! The table styling options are useful, and I tested I found one issue to address before merging: with Here is a regression test that currently fails: test "header line height defaults to the header font size" do
page =
PaperForge.Page.new(origin: :top_left)
|> PaperForge.Page.table(
[["First\nSecond"], ["Body"]],
x: 20,
y: 20,
width: 180,
row_height: 90,
header: true,
size: 10,
header_size: 30
)
assert {:text_box, "First\nSecond", options} =
Enum.find(page.operations, &match?({:text_box, "First\nSecond", _}, &1))
assert options[:size] == 30
assert options[:line_height] == 39.0
endThe expected value follows the existing default of Could you also add support for the new options in This test reproduces the declarative issue: test "declarative tables accept independent header and padding options" do
template = %{
"version" => "1",
"blocks" => [
%{
"type" => "table",
"columns" => ["Header"],
"rows" => [["Body"]],
"options" => %{
"header_font" => "helvetica_bold",
"header_size" => 18,
"header_line_height" => 23.4,
"padding_x" => 12,
"padding_y" => 8
}
}
]
}
assert {:ok, _compiled} = PaperForge.Declarative.compile(template)
endA rendering test with an embedded header font would also help verify that the Thanks again for the contribution! |
|
Hi @masegraye ! I prepared the requested fixes and tests in this commit: Could you cherry-pick it onto your PR branch? It adjusts the default header Thank you! |
Problem
Flow tables share typography and padding settings between headers and body cells, limiting control over table presentation.
Solution
Add optional header font, size, and line height; separate horizontal and vertical padding; and per-cell border colors. Existing defaults and native pagination are preserved.
Tests
Four new tests cover backward-compatible output, styling options, multipage tables with repeated headers, and ensuring header styling doesn't affect body rows when headers aren't repeated. On Elixir 1.20.2 / OTP 28.3,
mix testpassed 446 tests with 2 excluded; formatting and compilation with warnings as errors also passed.This change was AI-authored and is in actual use.