Better borders on tableView

This commit is contained in:
Dustin Swan 2026-04-10 15:42:04 -06:00
parent cd7565261a
commit 32815301fa
No known key found for this signature in database
GPG key ID: 30D46587E2100467

View file

@ -22,12 +22,8 @@ layoutDir : Direction \ { w : Int, h : Int } \ List LayoutChild \ { ui : UI, w :
childH = dir childH = dir
| Col \ allocated.s | Col \ allocated.s
| Row \ crossSize; | Row \ crossSize;
posX = dir posX = dir | Col \ 0 | Row \ acc.pos;
| Col \ 0 posY = dir | Col \ acc.pos | Row \ 0;
| Row \ acc.pos;
posY = dir
| Col \ acc.pos
| Row \ 0;
rendered = ui.positioned { x = posX, y = posY, child = allocated.view { w = childW, h = childH } }; rendered = ui.positioned { x = posX, y = posY, child = allocated.view { w = childW, h = childH } };
acc.{ pos = acc.pos + allocated.s, children = [...acc.children, rendered] }) { pos = 0, children = [] } children; acc.{ pos = acc.pos + allocated.s, children = [...acc.children, rendered] }) { pos = 0, children = [] } children;
{ {
@ -55,21 +51,40 @@ align = hAlign vAlign w h child \
h = h h = h
}; };
tableCell = isHeader idx ctx content \ tableCell = isHeader colIdx ctx content \
padding = 2; padding = 2;
innerW = ctx.w - 2 * padding; innerW = ctx.w - 2 * padding;
innerH = ctx.h - 2 * padding; innerH = ctx.h - 2 * padding;
hAlign = isHeader | True \ Center | False \ Start; hAlign = isHeader | True \ Center | False \ Start;
alignedContent = align hAlign Center innerW innerH (sizedText content); alignedContent = align hAlign Center innerW innerH (sizedText content);
leftBorder = colIdx == 0 | True \ Empty | _ \ ui.positioned {
x = 0,
y = 0,
child = ui.rect {
w = 1,
h = ctx.h,
color = "rgba(255,255,255,0.2)",
# strokeColor = "rgba(255,255,255,0.3)",
strokeWidth = 1
}
};
ui.stack { ui.stack {
children = [ children = [
ui.rect { leftBorder,
w = ctx.w, # bottom border
h = ctx.h, ui.positioned {
color = isHeader | True \ "rgba(255,255,255,0.2)" | False \ "transparent", x = 0,
strokeColor = "rgba(255,255,255,0.3)", y = ctx.h,
strokeWidth = isHeader | True \ 0 | False \ 1 child = ui.rect {
w = ctx.w,
h = 1,
color = "rgba(255,255,255,0.2)",
# strokeColor = "rgba(255,255,255,0.3)",
strokeWidth = 1
}
}, },
# content
ui.positioned { ui.positioned {
x = padding, x = padding,
y = padding, y = padding,