// components/Table.js import { h, each } from "sigpro"; export const Table = (props, children) => { children === undefined && (children = props, props = {}); return h("table", { ...props, class: `table ${props.class ?? ''}` }, children); }; export const TableItems = (props) => { const itemArray = typeof props.items === "function" ? props.items() : (props.items || []); const thead = props.header !== false && props.columns?.some(col => col.label) ? h("thead", {}, h("tr", {}, props.columns.map(col => h("th", { class: col.class }, col.label)) ) ) : null; const tbody = h("tbody", {}, [ each(itemArray, (item, idx) => h("tr", {}, props.columns.map(col => { const content = col.render ? col.render(item, idx) : item[col.key]; return h("td", { class: col.class }, content); }) ) , props.keyFn || ((item, idx) => item.id ?? idx)) ]); return [thead, tbody]; };