2018-10-16 16:32:22 +08:00
|
|
|
// 表格类
|
|
|
|
class Table {
|
|
|
|
rowLength: number;
|
|
|
|
columnLength: number;
|
|
|
|
selectedRow: string;
|
|
|
|
selectedCell: string;
|
|
|
|
instanceOfCells: any;
|
|
|
|
constructor(rowLength: number, columnLength: number, instanceOfCells: any) {
|
|
|
|
this.rowLength = rowLength;
|
|
|
|
this.columnLength = columnLength;
|
|
|
|
this.instanceOfCells = instanceOfCells;
|
|
|
|
this.selectedRow;
|
|
|
|
this.selectedCell;
|
|
|
|
}
|
|
|
|
render() {}
|
|
|
|
addRowElement() {}
|
|
|
|
}
|
|
|
|
// 行类
|
|
|
|
class Row {
|
|
|
|
createRowElement() {
|
|
|
|
const rowElement = document.createElement("tr");
|
|
|
|
return rowElement;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 单元类
|
|
|
|
class Cell {
|
|
|
|
cellId: string;
|
2018-10-17 15:20:24 +08:00
|
|
|
font: string;
|
2018-10-16 16:32:22 +08:00
|
|
|
fontSize: string;
|
2018-10-17 15:20:24 +08:00
|
|
|
fontColor: string;
|
|
|
|
fontWeight: string;
|
|
|
|
fontStyle: string;
|
|
|
|
textDecoration: string; // underline or line throught
|
|
|
|
border: string;
|
|
|
|
backgroundColor: string;
|
|
|
|
textAlign: string;
|
2018-10-16 16:32:22 +08:00
|
|
|
constructor(id) {
|
|
|
|
this.cellId = id;
|
2018-10-17 15:20:24 +08:00
|
|
|
this.font = "Serif";
|
2018-10-16 16:32:22 +08:00
|
|
|
this.fontSize = "12";
|
2018-10-17 15:20:24 +08:00
|
|
|
this.fontColor = "black";
|
|
|
|
this.fontWeight = "normal";
|
|
|
|
this.fontStyle = "normal";
|
|
|
|
this.textDecoration = "";
|
|
|
|
this.border = "";
|
|
|
|
this.backgroundColor = "";
|
|
|
|
this.textAlign = "left";
|
2018-10-16 16:32:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
CreateCellElement() {
|
|
|
|
let tdElement = document.createElement("td");
|
2018-10-17 15:20:24 +08:00
|
|
|
|
|
|
|
tdElement.style.fontFamily = this.font;
|
|
|
|
tdElement.style.backgroundColor = this.backgroundColor;
|
|
|
|
|
2018-10-16 16:32:22 +08:00
|
|
|
tdElement.style.border = this.border + "px solid";
|
|
|
|
tdElement.style.fontSize = this.fontSize + "px";
|
2018-10-17 15:20:24 +08:00
|
|
|
tdElement.style.color = this.fontColor;
|
|
|
|
tdElement.style.fontWeight = this.fontWeight;
|
|
|
|
tdElement.style.fontStyle = this.fontStyle;
|
|
|
|
tdElement.style.textDecoration = this.textDecoration;
|
|
|
|
tdElement.style.textAlign = this.textAlign;
|
|
|
|
tdElement.innerHTML = "cell";
|
2018-10-16 16:32:22 +08:00
|
|
|
|
|
|
|
return tdElement;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export { Table, Cell };
|