Adding first pass at tableView to layout

This commit is contained in:
Dustin Swan 2026-04-08 18:48:15 -06:00
parent 1a26ec4d24
commit 82193a41ca
No known key found for this signature in database
GPG key ID: 30D46587E2100467

View file

@ -55,4 +55,34 @@ align = hAlign vAlign w h child \
h = h h = h
}; };
tableView = list \ w h \
firstRow = unwrapOr "{}" (nth 0 list);
columnNames = keys firstRow;
colW = w / (len columnNames);
rowH = 24;
rowFromRecord = r \
(row { w = w, h = rowH }
(map (cn \
cellValue = display (unwrapOr "" (getField cn r));
Fixed 100 (cw ch \ (sizedText cellValue).ui)
) columnNames)
).ui;
headerRow = (row { w = w, h = rowH }
(map (cn \
Fixed colW (cw ch \ (sizedText cn).ui)
) columnNames)
).ui;
bodyRows = map (r \ Fixed rowH (cw cch \ rowFromRecord r)) list;
(col { w = 500, h = 500 } [
Fixed rowH (cw ch \ headerRow),
...bodyRows
]).ui;
@ @