2020-04-27 04:41:23 +03:00
|
|
|
import { BorderPosition, TableCellBorder } from "./table-cell-border";
|
|
|
|
|
2020-04-30 07:39:56 +03:00
|
|
|
export type PositionKeys =
|
|
|
|
| "top"
|
|
|
|
| "left"
|
|
|
|
| "bottom"
|
|
|
|
| "right"
|
|
|
|
| "insideH"
|
|
|
|
| "insideV";
|
|
|
|
|
2020-04-27 04:41:23 +03:00
|
|
|
export class TableCellBorders {
|
2020-04-30 08:38:56 +03:00
|
|
|
top: TableCellBorder | null = new TableCellBorder("top");
|
|
|
|
left: TableCellBorder | null = new TableCellBorder("left");
|
|
|
|
bottom: TableCellBorder | null = new TableCellBorder("bottom");
|
|
|
|
right: TableCellBorder | null = new TableCellBorder("right");
|
|
|
|
insideH: TableCellBorder | null = new TableCellBorder("insideH");
|
|
|
|
insideV: TableCellBorder | null = new TableCellBorder("insideV");
|
2020-04-27 04:41:23 +03:00
|
|
|
|
|
|
|
set(border: TableCellBorder) {
|
|
|
|
switch (border.position) {
|
2020-04-30 08:38:56 +03:00
|
|
|
case "top":
|
2020-04-27 04:41:23 +03:00
|
|
|
this.top = border;
|
2020-04-30 08:38:56 +03:00
|
|
|
case "left":
|
2020-04-27 04:41:23 +03:00
|
|
|
this.left = border;
|
2020-04-30 08:38:56 +03:00
|
|
|
case "bottom":
|
2020-04-27 04:41:23 +03:00
|
|
|
this.bottom = border;
|
2020-04-30 08:38:56 +03:00
|
|
|
case "right":
|
2020-04-27 04:41:23 +03:00
|
|
|
this.right = border;
|
2020-04-30 08:38:56 +03:00
|
|
|
case "insideH":
|
2020-04-27 04:41:23 +03:00
|
|
|
this.insideH = border;
|
2020-04-30 08:38:56 +03:00
|
|
|
case "insideV":
|
2020-04-27 04:41:23 +03:00
|
|
|
this.insideV = border;
|
|
|
|
}
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
clear(position: BorderPosition) {
|
|
|
|
let nil = new TableCellBorder(position).border_type("Nil");
|
|
|
|
switch (position) {
|
2020-04-30 08:38:56 +03:00
|
|
|
case "top":
|
2020-04-27 04:41:23 +03:00
|
|
|
this.top = nil;
|
2020-04-30 08:38:56 +03:00
|
|
|
case "left":
|
2020-04-27 04:41:23 +03:00
|
|
|
this.left = nil;
|
2020-04-30 08:38:56 +03:00
|
|
|
case "bottom":
|
2020-04-27 04:41:23 +03:00
|
|
|
this.bottom = nil;
|
2020-04-30 08:38:56 +03:00
|
|
|
case "right":
|
2020-04-27 04:41:23 +03:00
|
|
|
this.right = nil;
|
2020-04-30 08:38:56 +03:00
|
|
|
case "insideH":
|
2020-04-27 04:41:23 +03:00
|
|
|
this.insideH = nil;
|
2020-04-30 08:38:56 +03:00
|
|
|
case "insideV":
|
2020-04-27 04:41:23 +03:00
|
|
|
this.insideV = nil;
|
|
|
|
}
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
clearAll() {
|
2020-04-30 08:38:56 +03:00
|
|
|
this.top = new TableCellBorder("top").border_type("Nil");
|
|
|
|
this.left = new TableCellBorder("left").border_type("Nil");
|
|
|
|
this.bottom = new TableCellBorder("bottom").border_type("Nil");
|
|
|
|
this.right = new TableCellBorder("right").border_type("Nil");
|
|
|
|
this.insideH = new TableCellBorder("insideH").border_type("Nil");
|
|
|
|
this.insideV = new TableCellBorder("insideV").border_type("Nil");
|
2020-04-27 04:41:23 +03:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|