-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: support TextBox
and RenderableText
in @nested_panels
#241
Comments
My use case is to add footnotes to a table: julia> ASME_Materials.tableKM620_options()
╭──── Table KM-620 Material Categories ───────────────────────────────────╮
│ ╭────────────┬──────────────────────────────────────────────────────╮ │
│ │ Category │ Material │ │
│ ├────────────┼──────────────────────────────────────────────────────┤ │
│ │ 1 │ Ferritic steel │ │
│ ├────────────┼──────────────────────────────────────────────────────┤ │
│ │ 2 │ Austenitic stainless steel and nickel-based alloys │ │
│ ├────────────┼──────────────────────────────────────────────────────┤ │
│ │ 3 │ Duplex stainless steel │ │
│ ├────────────┼──────────────────────────────────────────────────────┤ │
│ │ 4 │ Precipitation hardening, nickel based │ │
│ ├────────────┼──────────────────────────────────────────────────────┤ │
│ │ 5 │ Aluminum │ │
│ ├────────────┼──────────────────────────────────────────────────────┤ │
│ │ 6 │ Copper │ │
│ ├────────────┼──────────────────────────────────────────────────────┤ │
│ │ 7 │ Titanium and zirconium │ │
│ ╰────────────┴──────────────────────────────────────────────────────╯ │
│ ╭──── Note: ────────────────────────────────────────────────────────╮ │
│ │ (1) Ferritic steel includes carbon, low alloy, and alloy │ │
│ │ steels, and ferritic, martensitic, and iron-based age-hardenin │ │
│ │ g stainless steels. │ │
│ ╰───────────────────────────────────────────────────────────────────╯ │
╰─────────────────────────────────────────────────────────────────────────╯ function tableKM620_options()
table = select(KM620.coefficients_table, "Material")
notes = join(values(metadata(KM620.coefficients_table)), "\n")
panel = @nested_panels Panel(
Term.Table(
hcat(1:nrow(table), table."Material"),
header = ["Category", "Material"],
header_style = "cyan",
columns_justify = [:center, :left],
columns_style = "default",
box = :ROUNDED,
style = "cyan",
),
Panel(
@style(notes, "cyan dim"),
style = "cyan dim",
title = "Note:",
title_style = "cyan dim",
),
title = "Table KM-620 Material Categories",
title_style = "cyan",
style = "cyan",
)
return panel
end I cannot get it to look nice without the julia> ASME_Materials.tableKM620_options2()
╭──── Table KM-620 Material Categories ───────────────────────────────────╮
│ ╭────────────┬────────────────────────────────────────────────────── │
│ ╮ │
│ │ Category │ Material │
│ │ │
│ ├────────────┼────────────────────────────────────────────────────── │
│ ┤ │
│ │ 1 │ Ferritic steel │
│ │ │
│ ├────────────┼────────────────────────────────────────────────────── │
│ ┤ │
│ │ 2 │ Austenitic stainless steel and nickel-based alloys │
│ │ │
│ ├────────────┼────────────────────────────────────────────────────── │
│ ┤ │
│ │ 3 │ Duplex stainless steel │
│ │ │
│ ├────────────┼────────────────────────────────────────────────────── │
│ ┤ │
│ │ 4 │ Precipitation hardening, nickel based │
│ │ │
│ ├────────────┼────────────────────────────────────────────────────── │
│ ┤ │
│ │ 5 │ Aluminum │
│ │ │
│ ├────────────┼────────────────────────────────────────────────────── │
│ ┤ │
│ │ 6 │ Copper │
│ │ │
│ ├────────────┼────────────────────────────────────────────────────── │
│ ┤ │
│ │ 7 │ Titanium and zirconium │
│ │ │
│ ╰────────────┴────────────────────────────────────────────────────── │
│ ╯ │
│ │
│ │
│ Notes: │
│ │
│ (1) Ferritic steel includes carbon, low alloy, and alloy steels, │
│ │
│ and ferritic, martensitic, and iron-based age-hardening stainless │
│ │
│ steels. │
│ │
│ │
│ │
╰─────────────────────────────────────────────────────────────────────────╯ function tableKM620_options2()
table = select(KM620.coefficients_table, "Material")
notes = "Notes:\n" * join(values(metadata(KM620.coefficients_table)), "\n")
panel = @nested_panels Panel(
Term.Table(
hcat(1:nrow(table), table."Material"),
header = ["Category", "Material"],
header_style = "cyan",
columns_justify = [:center, :left],
columns_style = "default",
box = :ROUNDED,
style = "cyan",
),
TextBox(
@style(notes, "cyan dim"),
),
title = "Table KM-620 Material Categories",
title_style = "cyan",
style = "cyan",
)
return panel
end (Also in the last example, the styling is only applied to the first line of the |
Hi,
Thanks for reaching out. Unfortunately at the moment I don’t have the bandwidth to keep development work for Term.jl though. I’d you’d like to send a PR though I can review and approve that. I hope this helps.
Sent from [Proton Mail](https://proton.me/mail/home) for iOS
…On Thu, Feb 15, 2024 at 15:39, Nathan Boyer ***@***.***(mailto:On Thu, Feb 15, 2024 at 15:39, Nathan Boyer <<a href=)> wrote:
My use case is to add footnotes to a table:
julia
>
ASME_Materials
.
tableKM620_options
()
╭──── Table KM
-
620
Material Categories ───────────────────────────────────╮
│ ╭────────────┬──────────────────────────────────────────────────────╮ │
│ │ Category │ Material │ │
│ ├────────────┼──────────────────────────────────────────────────────┤ │
│ │
1
│ Ferritic steel │ │
│ ├────────────┼──────────────────────────────────────────────────────┤ │
│ │
2
│ Austenitic stainless steel and nickel
-
based alloys │ │
│ ├────────────┼──────────────────────────────────────────────────────┤ │
│ │
3
│ Duplex stainless steel │ │
│ ├────────────┼──────────────────────────────────────────────────────┤ │
│ │
4
│ Precipitation hardening, nickel based │ │
│ ├────────────┼──────────────────────────────────────────────────────┤ │
│ │
5
│ Aluminum │ │
│ ├────────────┼──────────────────────────────────────────────────────┤ │
│ │
6
│ Copper │ │
│ ├────────────┼──────────────────────────────────────────────────────┤ │
│ │
7
│ Titanium and zirconium │ │
│ ╰────────────┴──────────────────────────────────────────────────────╯ │
│ ╭──── Note
:
────────────────────────────────────────────────────────╮ │
│ │ (
1
) Ferritic steel includes carbon, low alloy, and alloy │ │
│ │ steels, and ferritic, martensitic, and iron
-
based age
-
hardenin │ │
│ │ g stainless steels. │ │
│ ╰───────────────────────────────────────────────────────────────────╯ │
╰─────────────────────────────────────────────────────────────────────────╯
function
tableKM620_options
()
table
=
select
(KM620
.
coefficients_table,
"
Material
"
)
notes
=
join
(
values
(
metadata
(KM620
.
coefficients_table)),
"
\n
"
)
panel
=
@nested_panels
Panel
(
Term
.
Table
(
hcat
(
1
:
nrow
(table), table.
"
Material
"
),
header
=
[
"
Category
"
,
"
Material
"
],
header_style
=
"
cyan
"
,
columns_justify
=
[
:center
,
:left
],
columns_style
=
"
default
"
,
box
=
:ROUNDED
,
style
=
"
cyan
"
,
),
Panel
(
@Style
(notes,
"
cyan dim
"
),
style
=
"
cyan dim
"
,
title
=
"
Note:
"
,
title_style
=
"
cyan dim
"
,
),
title
=
"
Table KM-620 Material Categories
"
,
title_style
=
"
cyan
"
,
style
=
"
cyan
"
,
)
return
panel
end
I cannot get it to look nice without the Panel:
julia
>
ASME_Materials
.
tableKM620_options2
()
╭──── Table KM
-
620
Material Categories ───────────────────────────────────╮
│ ╭────────────┬────────────────────────────────────────────────────── │
│ ╮ │
│ │ Category │ Material │
│ │ │
│ ├────────────┼────────────────────────────────────────────────────── │
│ ┤ │
│ │
1
│ Ferritic steel │
│ │ │
│ ├────────────┼────────────────────────────────────────────────────── │
│ ┤ │
│ │
2
│ Austenitic stainless steel and nickel
-
based alloys │
│ │ │
│ ├────────────┼────────────────────────────────────────────────────── │
│ ┤ │
│ │
3
│ Duplex stainless steel │
│ │ │
│ ├────────────┼────────────────────────────────────────────────────── │
│ ┤ │
│ │
4
│ Precipitation hardening, nickel based │
│ │ │
│ ├────────────┼────────────────────────────────────────────────────── │
│ ┤ │
│ │
5
│ Aluminum │
│ │ │
│ ├────────────┼────────────────────────────────────────────────────── │
│ ┤ │
│ │
6
│ Copper │
│ │ │
│ ├────────────┼────────────────────────────────────────────────────── │
│ ┤ │
│ │
7
│ Titanium and zirconium │
│ │ │
│ ╰────────────┴────────────────────────────────────────────────────── │
│ ╯ │
│ │
│ │
│ Notes
:
│
│ │
│ (
1
) Ferritic steel includes carbon, low alloy, and alloy steels, │
│ │
│ and ferritic, martensitic, and iron
-
based age
-
hardening stainless │
│ │
│ steels. │
│ │
│ │
│ │
╰─────────────────────────────────────────────────────────────────────────╯
function
tableKM620_options2
()
table
=
select
(KM620
.
coefficients_table,
"
Material
"
)
notes
=
"
Notes:
\n
"
*
join
(
values
(
metadata
(KM620
.
coefficients_table)),
"
\n
"
)
panel
=
@nested_panels
Panel
(
Term
.
Table
(
hcat
(
1
:
nrow
(table), table.
"
Material
"
),
header
=
[
"
Category
"
,
"
Material
"
],
header_style
=
"
cyan
"
,
columns_justify
=
[
:center
,
:left
],
columns_style
=
"
default
"
,
box
=
:ROUNDED
,
style
=
"
cyan
"
,
),
TextBox
(
@Style
(notes,
"
cyan dim
"
),
),
title
=
"
Table KM-620 Material Categories
"
,
title_style
=
"
cyan
"
,
style
=
"
cyan
"
,
)
return
panel
end
(Also in the last example, the styling is only applied to the first line of the TextBox.)
—
Reply to this email directly, [view it on GitHub](#241 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AEFA5GKVSGJLZEUQV4SGLQDYTZXBVAVCNFSM6AAAAABDK466Q2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBXGMYDKNBXG4).
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@nested_panel
works well with panels:But it does not work well with other text renderables:
The text was updated successfully, but these errors were encountered: