import { getRowsFromItems } from "./getRowsFromItems"; import type { IBlockTableItem } from "../config/types"; /** * Возвращает лейбл для ячейки таблицы * @returns */ export const getCellLabel = (index: number = 0, items: IBlockTableItem[] = []): string => { const theadRows = getRowsFromItems("thead", items); if (theadRows.length) { const cols = theadRows[0]?.cols ?? []; if (cols.length) { return cols.find((item, i) => i === index)?.html ?? ""; } else { return ""; } } else { return ""; } };