el-header-and-footer 0.0.52 → 0.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -658,30 +658,79 @@ class ElHeaderAndFooterComponent {
|
|
658
658
|
// }
|
659
659
|
// }
|
660
660
|
// }
|
661
|
+
// addColumn() {
|
662
|
+
// if (this.selectedTable) {
|
663
|
+
// const columnCount = this.selectedTable.rows[0].cells.length + 1; // New column count
|
664
|
+
// const tableWidth = this.selectedTable.offsetWidth;
|
665
|
+
// const minWidth = tableWidth / columnCount;
|
666
|
+
// for (let i = 0; i < this.selectedTable.rows.length; i++) {
|
667
|
+
// let cell = this.selectedTable.rows[i].insertCell(-1);
|
668
|
+
// cell.innerHTML = ' ';
|
669
|
+
// cell.style.border = this.themeModeClrVerticalLineForTable();
|
670
|
+
// cell.style.minWidth = `${minWidth}px`;
|
671
|
+
// cell.style.wordWrap = 'break-word';
|
672
|
+
// cell.style.wordBreak = 'break-all';
|
673
|
+
// cell.style.whiteSpace = 'normal';
|
674
|
+
// }
|
675
|
+
// // Update existing cells' minWidth
|
676
|
+
// for (let i = 0; i < this.selectedTable.rows.length; i++) {
|
677
|
+
// for (let j = 0; j < this.selectedTable.rows[i].cells.length; j++) {
|
678
|
+
// this.selectedTable.rows[i].cells[j].style.minWidth = `${minWidth}px`;
|
679
|
+
// }
|
680
|
+
// }
|
681
|
+
// }
|
682
|
+
// }
|
683
|
+
// deleteColumn() {
|
684
|
+
// if (this.selectedTable) {
|
685
|
+
// if (window.getSelection) {
|
686
|
+
// let selection = window.getSelection();
|
687
|
+
// if (selection) {
|
688
|
+
// let cell = selection.anchorNode?.parentElement?.closest('td, th') as HTMLTableCellElement;
|
689
|
+
// if (cell) {
|
690
|
+
// let cellIndex = cell.cellIndex;
|
691
|
+
// for (let i = 0; i < this.selectedTable.rows.length; i++) {
|
692
|
+
// this.selectedTable.rows[i].deleteCell(cellIndex);
|
693
|
+
// }
|
694
|
+
// }
|
695
|
+
// }
|
696
|
+
// }
|
697
|
+
// }
|
698
|
+
// }
|
661
699
|
addColumn() {
|
662
700
|
if (this.selectedTable) {
|
663
|
-
const columnCount = this.selectedTable.rows[0].cells.length
|
701
|
+
const columnCount = this.selectedTable.rows[0].cells.length; // Get current column count
|
702
|
+
if (columnCount >= 3) {
|
703
|
+
console.warn("Maximum column limit (3) reached!");
|
704
|
+
return; // Stop adding columns if the limit is reached
|
705
|
+
}
|
706
|
+
const newColumnCount = columnCount + 1; // New column count after adding
|
664
707
|
const tableWidth = this.selectedTable.offsetWidth;
|
665
|
-
const minWidth = tableWidth /
|
708
|
+
const minWidth = tableWidth / newColumnCount;
|
666
709
|
for (let i = 0; i < this.selectedTable.rows.length; i++) {
|
667
710
|
let cell = this.selectedTable.rows[i].insertCell(-1);
|
668
711
|
cell.innerHTML = ' ';
|
669
|
-
cell.style.border =
|
712
|
+
cell.style.border = `1px solid #000`; // Set border color (Black)
|
670
713
|
cell.style.minWidth = `${minWidth}px`;
|
671
714
|
cell.style.wordWrap = 'break-word';
|
672
715
|
cell.style.wordBreak = 'break-all';
|
673
716
|
cell.style.whiteSpace = 'normal';
|
674
717
|
}
|
675
|
-
// Update existing cells' minWidth
|
718
|
+
// Update existing cells' minWidth and border color
|
676
719
|
for (let i = 0; i < this.selectedTable.rows.length; i++) {
|
677
720
|
for (let j = 0; j < this.selectedTable.rows[i].cells.length; j++) {
|
678
721
|
this.selectedTable.rows[i].cells[j].style.minWidth = `${minWidth}px`;
|
722
|
+
this.selectedTable.rows[i].cells[j].style.border = `1px solid${this.themeModeClrBorderForTable()}`; // Apply border color
|
679
723
|
}
|
680
724
|
}
|
681
725
|
}
|
682
726
|
}
|
683
727
|
deleteColumn() {
|
684
728
|
if (this.selectedTable) {
|
729
|
+
const columnCount = this.selectedTable.rows[0].cells.length; // Get current column count
|
730
|
+
if (columnCount <= 1) {
|
731
|
+
console.warn("Cannot delete the last column!");
|
732
|
+
return; // Stop deleting if only one column is left
|
733
|
+
}
|
685
734
|
if (window.getSelection) {
|
686
735
|
let selection = window.getSelection();
|
687
736
|
if (selection) {
|