Add table column and vertical merging

This commit is contained in:
Dolan
2019-03-04 22:50:04 +00:00
parent 4fd2b6f1d3
commit efd89f24e6
6 changed files with 59 additions and 6 deletions

View File

@ -0,0 +1,22 @@
import { TableCell, VMergeType } from "./table-cell";
export class TableColumn {
constructor(private readonly cells: TableCell[]) {}
public getCell(index: number): TableCell {
const cell = this.cells[index];
if (!cell) {
throw Error("Index out of bounds when trying to get cell on column");
}
return cell;
}
public mergeCells(startIndex: number, endIndex: number): TableCell {
this.cells[startIndex].addVerticalMerge(VMergeType.RESTART);
this.cells[endIndex].addVerticalMerge(VMergeType.CONTINUE);
return this.cells[startIndex];
}
}