import { map } from "@thi.ng/transducers/map" ; import { mapcat } from "@thi.ng/transducers/mapcat" ; import type { AppContext } from "../api" ; const thead = ( ctx , head ) => [ "thead" , [ row , ctx . ui . table . head . row , map ( ( x ) => [ "th" , ctx . ui . table . head . cell , x ] , head ) , ] , ] ; const row = ( ctx , attribs , body ) => [ "tr" , { ... ctx . ui . table . row , ... attribs } , ... body , ] ; param ctx param layout param head param body export const table = ( ctx , layout , head , body ) => [ "table" , ctx . ui . table . root , map ( ( x ) => [ "col" , { style : { width : x } } ] , layout || [ ] ) , [ thead , head ] , mapcat ( ( [ hd , rows ] ) => [ hd ? [ thead , hd ] : null , [ "tbody" , map ( ( cols ) => [ row , null , map ( ( x ) => [ "td" , ctx . ui . table . cell , x ] , cols ) , ] , rows ) , ] , ] , body ) , ] ;