feat: templates

This commit is contained in:
2026-04-01 07:50:43 +02:00
parent b40c6436cd
commit df11705875
10 changed files with 589 additions and 19 deletions

View File

@@ -5,7 +5,7 @@ from __future__ import annotations
from uframe.ir import (
IRNode, Page, Box, Row, Col, Spacer, Pad,
Heading, Text, Label, Divider, Link, ListNode, ListItem,
Gauge, Sparkline, Status,
Gauge, Sparkline, Status, Table,
)
@@ -194,6 +194,14 @@ def measure(node: IRNode, available_width: int) -> None:
node.pref_height = 1
node.min_height = 1
elif isinstance(node, Table):
# Height = header border + header row + separator + data rows + bottom border
num_rows = len(node.rows)
node.pref_width = available_width
node.min_width = len(node.columns) * 3 + 1 # minimum 3 chars per col + borders
node.pref_height = num_rows + 4 # top border + header + separator + rows + bottom border
node.min_height = 4
else:
# Generic: just measure children
total_h = 0