class Playbook::PbAdvancedTable::TableHeader
def process_columns(columns, rows, current_depth, max_depth)
def process_columns(columns, rows, current_depth, max_depth) total_columns = columns.size columns.each_with_index do |col, index| is_last = index == total_columns - 1 if col[:columns] colspan = compute_leaf_columns(col[:columns]) rows[current_depth] << { label: col[:label], colspan: colspan, is_last_in_group: is_last && current_depth.positive?, } process_columns(col[:columns], rows, current_depth + 1, max_depth) else raw_styling = col[:column_styling] || {} header_alignment = raw_styling[:header_alignment] colspan = 1 rows[current_depth] << { label: col[:label], colspan: colspan, accessor: col[:accessor], sort_menu: col[:sort_menu], is_last_in_group: is_last && current_depth.positive?, header_alignment: header_alignment, } end end end