js.documents 1.72.0 → 1.73.0
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.
- package/dist/edit/docx/table.cjs +32 -0
- package/dist/edit/docx/table.d.cts +2 -0
- package/dist/edit/docx/table.d.ts +2 -0
- package/dist/edit/docx/table.js +32 -0
- package/dist/edit/odp/slide.d.cts +1 -1
- package/dist/edit/odp/slide.d.ts +1 -1
- package/dist/edit/odt/content.d.cts +1 -1
- package/dist/edit/odt/content.d.ts +1 -1
- package/dist/edit/odt/editor.d.cts +1 -1
- package/dist/edit/odt/editor.d.ts +1 -1
- package/dist/edit/odt/table.cjs +47 -0
- package/dist/edit/odt/table.d.cts +1 -1
- package/dist/edit/odt/table.d.ts +1 -1
- package/dist/edit/odt/table.js +47 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{table-kvclAXS5.d.ts → table-AT4t4VUy.d.ts} +4 -0
- package/dist/{table-sEo1Jf8c.d.cts → table-DSFcqJ7C.d.cts} +4 -0
- package/package.json +1 -1
package/dist/edit/docx/table.cjs
CHANGED
|
@@ -74,6 +74,21 @@ var DocxTableRow = class {
|
|
|
74
74
|
for (const child of this.node.children) if (child.type === "element" && child.tag === "w:tc") out.push(new DocxTableCell(child));
|
|
75
75
|
return out;
|
|
76
76
|
}
|
|
77
|
+
mergeCellsHorizontally(startColumnIndex, colSpan) {
|
|
78
|
+
if (!Number.isInteger(colSpan) || colSpan < 1) throw new Error(`mergeCellsHorizontally: colSpan must be a positive integer, got ${colSpan}`);
|
|
79
|
+
const cellElements = [];
|
|
80
|
+
for (const child of this.node.children) if (child.type === "element" && child.tag === "w:tc") cellElements.push(child);
|
|
81
|
+
const anchorElement = cellElements[startColumnIndex];
|
|
82
|
+
if (anchorElement === void 0) throw new Error(`mergeCellsHorizontally: column ${startColumnIndex} does not exist in this row`);
|
|
83
|
+
if (startColumnIndex + colSpan > cellElements.length) throw new Error(`mergeCellsHorizontally: colSpan ${colSpan} starting at column ${startColumnIndex} exceeds this row's own ${cellElements.length} columns`);
|
|
84
|
+
for (let i = 1; i < colSpan; i++) {
|
|
85
|
+
const consumedElement = cellElements[startColumnIndex + i];
|
|
86
|
+
if (consumedElement !== void 0) require_xml_edit.removeChild(this.node.children, consumedElement);
|
|
87
|
+
}
|
|
88
|
+
const anchor = new DocxTableCell(anchorElement);
|
|
89
|
+
anchor.colSpan = colSpan;
|
|
90
|
+
return anchor;
|
|
91
|
+
}
|
|
77
92
|
};
|
|
78
93
|
function buildCell() {
|
|
79
94
|
return require_xml_fragment.el("w:tc", {}, [require_edit_docx_paragraph.buildParagraph()]);
|
|
@@ -110,6 +125,23 @@ var DocxTable = class {
|
|
|
110
125
|
node.children.push(row);
|
|
111
126
|
return new DocxTableRow(row);
|
|
112
127
|
}
|
|
128
|
+
mergeCells(startRow, startColumn, rowSpan, colSpan) {
|
|
129
|
+
if (!Number.isInteger(rowSpan) || rowSpan < 1 || !Number.isInteger(colSpan) || colSpan < 1) throw new Error(`mergeCells: rowSpan and colSpan must be positive integers, got rowSpan=${rowSpan}, colSpan=${colSpan}`);
|
|
130
|
+
const rows = this.rows();
|
|
131
|
+
const anchorRow = rows[startRow];
|
|
132
|
+
if (anchorRow === void 0) throw new Error(`mergeCells: row ${startRow} does not exist in this table`);
|
|
133
|
+
const anchor = anchorRow.mergeCellsHorizontally(startColumn, colSpan);
|
|
134
|
+
if (rowSpan > 1) {
|
|
135
|
+
anchor.verticalMerge = "restart";
|
|
136
|
+
for (let r = 1; r < rowSpan; r++) {
|
|
137
|
+
const coveredRow = rows[startRow + r];
|
|
138
|
+
if (coveredRow === void 0) throw new Error(`mergeCells: rowSpan ${rowSpan} starting at row ${startRow} exceeds this table's own ${rows.length} rows`);
|
|
139
|
+
const coveredAnchor = coveredRow.mergeCellsHorizontally(startColumn, colSpan);
|
|
140
|
+
coveredAnchor.verticalMerge = "continue";
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return anchor;
|
|
144
|
+
}
|
|
113
145
|
remove() {
|
|
114
146
|
require_xml_edit.removeChild(this.container, this.live());
|
|
115
147
|
this.removed = true;
|
|
@@ -23,6 +23,7 @@ declare class DocxTableRow {
|
|
|
23
23
|
private readonly node;
|
|
24
24
|
constructor(node: XmlElement);
|
|
25
25
|
cells(): DocxTableCell[];
|
|
26
|
+
mergeCellsHorizontally(startColumnIndex: number, colSpan: number): DocxTableCell;
|
|
26
27
|
}
|
|
27
28
|
declare class DocxTable {
|
|
28
29
|
private readonly container;
|
|
@@ -33,6 +34,7 @@ declare class DocxTable {
|
|
|
33
34
|
rows(): DocxTableRow[];
|
|
34
35
|
cell(rowIndex: number, columnIndex: number): DocxTableCell;
|
|
35
36
|
appendRow(columnCount: number): DocxTableRow;
|
|
37
|
+
mergeCells(startRow: number, startColumn: number, rowSpan: number, colSpan: number): DocxTableCell;
|
|
36
38
|
remove(): void;
|
|
37
39
|
}
|
|
38
40
|
declare function buildTable(init: TableInit): XmlElement;
|
|
@@ -23,6 +23,7 @@ declare class DocxTableRow {
|
|
|
23
23
|
private readonly node;
|
|
24
24
|
constructor(node: XmlElement);
|
|
25
25
|
cells(): DocxTableCell[];
|
|
26
|
+
mergeCellsHorizontally(startColumnIndex: number, colSpan: number): DocxTableCell;
|
|
26
27
|
}
|
|
27
28
|
declare class DocxTable {
|
|
28
29
|
private readonly container;
|
|
@@ -33,6 +34,7 @@ declare class DocxTable {
|
|
|
33
34
|
rows(): DocxTableRow[];
|
|
34
35
|
cell(rowIndex: number, columnIndex: number): DocxTableCell;
|
|
35
36
|
appendRow(columnCount: number): DocxTableRow;
|
|
37
|
+
mergeCells(startRow: number, startColumn: number, rowSpan: number, colSpan: number): DocxTableCell;
|
|
36
38
|
remove(): void;
|
|
37
39
|
}
|
|
38
40
|
declare function buildTable(init: TableInit): XmlElement;
|
package/dist/edit/docx/table.js
CHANGED
|
@@ -73,6 +73,21 @@ var DocxTableRow = class {
|
|
|
73
73
|
for (const child of this.node.children) if (child.type === "element" && child.tag === "w:tc") out.push(new DocxTableCell(child));
|
|
74
74
|
return out;
|
|
75
75
|
}
|
|
76
|
+
mergeCellsHorizontally(startColumnIndex, colSpan) {
|
|
77
|
+
if (!Number.isInteger(colSpan) || colSpan < 1) throw new Error(`mergeCellsHorizontally: colSpan must be a positive integer, got ${colSpan}`);
|
|
78
|
+
const cellElements = [];
|
|
79
|
+
for (const child of this.node.children) if (child.type === "element" && child.tag === "w:tc") cellElements.push(child);
|
|
80
|
+
const anchorElement = cellElements[startColumnIndex];
|
|
81
|
+
if (anchorElement === void 0) throw new Error(`mergeCellsHorizontally: column ${startColumnIndex} does not exist in this row`);
|
|
82
|
+
if (startColumnIndex + colSpan > cellElements.length) throw new Error(`mergeCellsHorizontally: colSpan ${colSpan} starting at column ${startColumnIndex} exceeds this row's own ${cellElements.length} columns`);
|
|
83
|
+
for (let i = 1; i < colSpan; i++) {
|
|
84
|
+
const consumedElement = cellElements[startColumnIndex + i];
|
|
85
|
+
if (consumedElement !== void 0) removeChild(this.node.children, consumedElement);
|
|
86
|
+
}
|
|
87
|
+
const anchor = new DocxTableCell(anchorElement);
|
|
88
|
+
anchor.colSpan = colSpan;
|
|
89
|
+
return anchor;
|
|
90
|
+
}
|
|
76
91
|
};
|
|
77
92
|
function buildCell() {
|
|
78
93
|
return el("w:tc", {}, [buildParagraph()]);
|
|
@@ -109,6 +124,23 @@ var DocxTable = class {
|
|
|
109
124
|
node.children.push(row);
|
|
110
125
|
return new DocxTableRow(row);
|
|
111
126
|
}
|
|
127
|
+
mergeCells(startRow, startColumn, rowSpan, colSpan) {
|
|
128
|
+
if (!Number.isInteger(rowSpan) || rowSpan < 1 || !Number.isInteger(colSpan) || colSpan < 1) throw new Error(`mergeCells: rowSpan and colSpan must be positive integers, got rowSpan=${rowSpan}, colSpan=${colSpan}`);
|
|
129
|
+
const rows = this.rows();
|
|
130
|
+
const anchorRow = rows[startRow];
|
|
131
|
+
if (anchorRow === void 0) throw new Error(`mergeCells: row ${startRow} does not exist in this table`);
|
|
132
|
+
const anchor = anchorRow.mergeCellsHorizontally(startColumn, colSpan);
|
|
133
|
+
if (rowSpan > 1) {
|
|
134
|
+
anchor.verticalMerge = "restart";
|
|
135
|
+
for (let r = 1; r < rowSpan; r++) {
|
|
136
|
+
const coveredRow = rows[startRow + r];
|
|
137
|
+
if (coveredRow === void 0) throw new Error(`mergeCells: rowSpan ${rowSpan} starting at row ${startRow} exceeds this table's own ${rows.length} rows`);
|
|
138
|
+
const coveredAnchor = coveredRow.mergeCellsHorizontally(startColumn, colSpan);
|
|
139
|
+
coveredAnchor.verticalMerge = "continue";
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return anchor;
|
|
143
|
+
}
|
|
112
144
|
remove() {
|
|
113
145
|
removeChild(this.container, this.live());
|
|
114
146
|
this.removed = true;
|
|
@@ -2,7 +2,7 @@ import { t as Box$1 } from "../../geometry-DaJr8yQW.cjs";
|
|
|
2
2
|
import { t as ImageInit } from "../../image-M5SezZVI.cjs";
|
|
3
3
|
import { t as OdpShape } from "../../shape-BR8GL8XC.cjs";
|
|
4
4
|
import { s as OdgVector } from "../../vector-D03KX8Ux.cjs";
|
|
5
|
-
import { i as TableInit, t as OdtTable } from "../../table-
|
|
5
|
+
import { i as TableInit, t as OdtTable } from "../../table-DSFcqJ7C.cjs";
|
|
6
6
|
import { ContentVector } from "document-schema.js";
|
|
7
7
|
import { Package, XmlElement, XmlNode } from "odf.js";
|
|
8
8
|
//#region src/edit/odp/slide.d.ts
|
package/dist/edit/odp/slide.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { t as Box$1 } from "../../geometry-DaJr8yQW.js";
|
|
|
2
2
|
import { t as ImageInit } from "../../image-DHcA9kaK.js";
|
|
3
3
|
import { t as OdpShape } from "../../shape-DeP-P4Nh.js";
|
|
4
4
|
import { s as OdgVector } from "../../vector-D03KX8Ux.js";
|
|
5
|
-
import { i as TableInit, t as OdtTable } from "../../table-
|
|
5
|
+
import { i as TableInit, t as OdtTable } from "../../table-AT4t4VUy.js";
|
|
6
6
|
import { ContentVector } from "document-schema.js";
|
|
7
7
|
import { Package, XmlElement, XmlNode } from "odf.js";
|
|
8
8
|
//#region src/edit/odp/slide.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClockPort } from "../../ports/clock.cjs";
|
|
2
2
|
import { t as OdtParagraph } from "../../paragraph-Dlly6_E9.cjs";
|
|
3
|
-
import { t as OdtTable } from "../../table-
|
|
3
|
+
import { t as OdtTable } from "../../table-DSFcqJ7C.cjs";
|
|
4
4
|
import { ContentDocument, ContentParagraph, ContentTable } from "document-schema.js";
|
|
5
5
|
import { Package } from "odf.js";
|
|
6
6
|
//#region src/edit/odt/content.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClockPort } from "../../ports/clock.js";
|
|
2
2
|
import { t as OdtParagraph } from "../../paragraph-kMJVZhAi.js";
|
|
3
|
-
import { t as OdtTable } from "../../table-
|
|
3
|
+
import { t as OdtTable } from "../../table-AT4t4VUy.js";
|
|
4
4
|
import { ContentDocument, ContentParagraph, ContentTable } from "document-schema.js";
|
|
5
5
|
import { Package } from "odf.js";
|
|
6
6
|
//#region src/edit/odt/content.d.ts
|
|
@@ -2,7 +2,7 @@ import { ClockPort } from "../../ports/clock.cjs";
|
|
|
2
2
|
import { t as Box$1 } from "../../geometry-DaJr8yQW.cjs";
|
|
3
3
|
import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-Dlly6_E9.cjs";
|
|
4
4
|
import { t as OdtList } from "../../list-DXRaCcT1.cjs";
|
|
5
|
-
import { i as TableInit, t as OdtTable } from "../../table-
|
|
5
|
+
import { i as TableInit, t as OdtTable } from "../../table-DSFcqJ7C.cjs";
|
|
6
6
|
import { ContentFormula, ContentVector } from "document-schema.js";
|
|
7
7
|
import { Package } from "odf.js";
|
|
8
8
|
//#region src/edit/odt/editor.d.ts
|
|
@@ -2,7 +2,7 @@ import { ClockPort } from "../../ports/clock.js";
|
|
|
2
2
|
import { t as Box$1 } from "../../geometry-DaJr8yQW.js";
|
|
3
3
|
import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-kMJVZhAi.js";
|
|
4
4
|
import { t as OdtList } from "../../list-7hZydHAV.js";
|
|
5
|
-
import { i as TableInit, t as OdtTable } from "../../table-
|
|
5
|
+
import { i as TableInit, t as OdtTable } from "../../table-AT4t4VUy.js";
|
|
6
6
|
import { ContentFormula, ContentVector } from "document-schema.js";
|
|
7
7
|
import { Package } from "odf.js";
|
|
8
8
|
//#region src/edit/odt/editor.d.ts
|
package/dist/edit/odt/table.cjs
CHANGED
|
@@ -89,6 +89,37 @@ var OdtTableRow = class {
|
|
|
89
89
|
appendCoveredCell() {
|
|
90
90
|
this.node.children.push(require_xml_fragment.el("table:covered-table-cell"));
|
|
91
91
|
}
|
|
92
|
+
gridCells() {
|
|
93
|
+
const out = [];
|
|
94
|
+
for (const child of this.node.children) if (child.type === "element" && (child.tag === "table:table-cell" || child.tag === "table:covered-table-cell")) out.push(child);
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
mergeCellsHorizontally(startColumnIndex, colSpan) {
|
|
98
|
+
if (!Number.isInteger(colSpan) || colSpan < 1) throw new Error(`mergeCellsHorizontally: colSpan must be a positive integer, got ${colSpan}`);
|
|
99
|
+
const gridCells = this.gridCells();
|
|
100
|
+
const anchorElement = gridCells[startColumnIndex];
|
|
101
|
+
if (anchorElement === void 0) throw new Error(`mergeCellsHorizontally: column ${startColumnIndex} does not exist in this row`);
|
|
102
|
+
if (anchorElement.tag === "table:covered-table-cell") throw new Error(`mergeCellsHorizontally: column ${startColumnIndex} is already covered by another merge -- address that merge's own anchor cell instead`);
|
|
103
|
+
if (startColumnIndex + colSpan > gridCells.length) throw new Error(`mergeCellsHorizontally: colSpan ${colSpan} starting at column ${startColumnIndex} exceeds this row's own ${gridCells.length} grid columns`);
|
|
104
|
+
for (let i = 1; i < colSpan; i++) {
|
|
105
|
+
const consumedElement = gridCells[startColumnIndex + i];
|
|
106
|
+
if (consumedElement !== void 0) {
|
|
107
|
+
consumedElement.tag = "table:covered-table-cell";
|
|
108
|
+
consumedElement.attributes = [];
|
|
109
|
+
consumedElement.children = [];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const anchor = new OdtTableCell(anchorElement, this.pkg);
|
|
113
|
+
anchor.colSpan = colSpan;
|
|
114
|
+
return anchor;
|
|
115
|
+
}
|
|
116
|
+
markCellCovered(columnIndex) {
|
|
117
|
+
const element = this.gridCells()[columnIndex];
|
|
118
|
+
if (element === void 0) throw new Error(`markCellCovered: column ${columnIndex} does not exist in this row`);
|
|
119
|
+
element.tag = "table:covered-table-cell";
|
|
120
|
+
element.attributes = [];
|
|
121
|
+
element.children = [];
|
|
122
|
+
}
|
|
92
123
|
};
|
|
93
124
|
function buildCell(pkg) {
|
|
94
125
|
return require_xml_fragment.el("table:table-cell", {}, [require_edit_odt_paragraph.buildParagraph(pkg)]);
|
|
@@ -136,6 +167,22 @@ var OdtTable = class {
|
|
|
136
167
|
node.children.push(row);
|
|
137
168
|
return new OdtTableRow(row, this.pkg);
|
|
138
169
|
}
|
|
170
|
+
mergeCells(startRow, startColumn, rowSpan, colSpan) {
|
|
171
|
+
if (!Number.isInteger(rowSpan) || rowSpan < 1 || !Number.isInteger(colSpan) || colSpan < 1) throw new Error(`mergeCells: rowSpan and colSpan must be positive integers, got rowSpan=${rowSpan}, colSpan=${colSpan}`);
|
|
172
|
+
const rows = this.rows();
|
|
173
|
+
const anchorRow = rows[startRow];
|
|
174
|
+
if (anchorRow === void 0) throw new Error(`mergeCells: row ${startRow} does not exist in this table`);
|
|
175
|
+
const anchor = anchorRow.mergeCellsHorizontally(startColumn, colSpan);
|
|
176
|
+
if (rowSpan > 1) {
|
|
177
|
+
anchor.rowSpan = rowSpan;
|
|
178
|
+
for (let r = 1; r < rowSpan; r++) {
|
|
179
|
+
const coveredRow = rows[startRow + r];
|
|
180
|
+
if (coveredRow === void 0) throw new Error(`mergeCells: rowSpan ${rowSpan} starting at row ${startRow} exceeds this table's own ${rows.length} rows`);
|
|
181
|
+
for (let c = 0; c < colSpan; c++) coveredRow.markCellCovered(startColumn + c);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return anchor;
|
|
185
|
+
}
|
|
139
186
|
remove() {
|
|
140
187
|
require_xml_edit.removeChild(this.container, this.live());
|
|
141
188
|
this.removed = true;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as buildTable, i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "../../table-
|
|
1
|
+
import { a as buildTable, i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "../../table-DSFcqJ7C.cjs";
|
|
2
2
|
export { OdtTable, OdtTableCell, OdtTableRow, TableInit, buildTable };
|
package/dist/edit/odt/table.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as buildTable, i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "../../table-
|
|
1
|
+
import { a as buildTable, i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "../../table-AT4t4VUy.js";
|
|
2
2
|
export { OdtTable, OdtTableCell, OdtTableRow, TableInit, buildTable };
|
package/dist/edit/odt/table.js
CHANGED
|
@@ -88,6 +88,37 @@ var OdtTableRow = class {
|
|
|
88
88
|
appendCoveredCell() {
|
|
89
89
|
this.node.children.push(el("table:covered-table-cell"));
|
|
90
90
|
}
|
|
91
|
+
gridCells() {
|
|
92
|
+
const out = [];
|
|
93
|
+
for (const child of this.node.children) if (child.type === "element" && (child.tag === "table:table-cell" || child.tag === "table:covered-table-cell")) out.push(child);
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
mergeCellsHorizontally(startColumnIndex, colSpan) {
|
|
97
|
+
if (!Number.isInteger(colSpan) || colSpan < 1) throw new Error(`mergeCellsHorizontally: colSpan must be a positive integer, got ${colSpan}`);
|
|
98
|
+
const gridCells = this.gridCells();
|
|
99
|
+
const anchorElement = gridCells[startColumnIndex];
|
|
100
|
+
if (anchorElement === void 0) throw new Error(`mergeCellsHorizontally: column ${startColumnIndex} does not exist in this row`);
|
|
101
|
+
if (anchorElement.tag === "table:covered-table-cell") throw new Error(`mergeCellsHorizontally: column ${startColumnIndex} is already covered by another merge -- address that merge's own anchor cell instead`);
|
|
102
|
+
if (startColumnIndex + colSpan > gridCells.length) throw new Error(`mergeCellsHorizontally: colSpan ${colSpan} starting at column ${startColumnIndex} exceeds this row's own ${gridCells.length} grid columns`);
|
|
103
|
+
for (let i = 1; i < colSpan; i++) {
|
|
104
|
+
const consumedElement = gridCells[startColumnIndex + i];
|
|
105
|
+
if (consumedElement !== void 0) {
|
|
106
|
+
consumedElement.tag = "table:covered-table-cell";
|
|
107
|
+
consumedElement.attributes = [];
|
|
108
|
+
consumedElement.children = [];
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const anchor = new OdtTableCell(anchorElement, this.pkg);
|
|
112
|
+
anchor.colSpan = colSpan;
|
|
113
|
+
return anchor;
|
|
114
|
+
}
|
|
115
|
+
markCellCovered(columnIndex) {
|
|
116
|
+
const element = this.gridCells()[columnIndex];
|
|
117
|
+
if (element === void 0) throw new Error(`markCellCovered: column ${columnIndex} does not exist in this row`);
|
|
118
|
+
element.tag = "table:covered-table-cell";
|
|
119
|
+
element.attributes = [];
|
|
120
|
+
element.children = [];
|
|
121
|
+
}
|
|
91
122
|
};
|
|
92
123
|
function buildCell(pkg) {
|
|
93
124
|
return el("table:table-cell", {}, [buildParagraph(pkg)]);
|
|
@@ -135,6 +166,22 @@ var OdtTable = class {
|
|
|
135
166
|
node.children.push(row);
|
|
136
167
|
return new OdtTableRow(row, this.pkg);
|
|
137
168
|
}
|
|
169
|
+
mergeCells(startRow, startColumn, rowSpan, colSpan) {
|
|
170
|
+
if (!Number.isInteger(rowSpan) || rowSpan < 1 || !Number.isInteger(colSpan) || colSpan < 1) throw new Error(`mergeCells: rowSpan and colSpan must be positive integers, got rowSpan=${rowSpan}, colSpan=${colSpan}`);
|
|
171
|
+
const rows = this.rows();
|
|
172
|
+
const anchorRow = rows[startRow];
|
|
173
|
+
if (anchorRow === void 0) throw new Error(`mergeCells: row ${startRow} does not exist in this table`);
|
|
174
|
+
const anchor = anchorRow.mergeCellsHorizontally(startColumn, colSpan);
|
|
175
|
+
if (rowSpan > 1) {
|
|
176
|
+
anchor.rowSpan = rowSpan;
|
|
177
|
+
for (let r = 1; r < rowSpan; r++) {
|
|
178
|
+
const coveredRow = rows[startRow + r];
|
|
179
|
+
if (coveredRow === void 0) throw new Error(`mergeCells: rowSpan ${rowSpan} starting at row ${startRow} exceeds this table's own ${rows.length} rows`);
|
|
180
|
+
for (let c = 0; c < colSpan; c++) coveredRow.markCellCovered(startColumn + c);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return anchor;
|
|
184
|
+
}
|
|
138
185
|
remove() {
|
|
139
186
|
removeChild(this.container, this.live());
|
|
140
187
|
this.removed = true;
|
package/dist/index.d.cts
CHANGED
|
@@ -28,7 +28,7 @@ import { OdgPage, PageImageInit, TextBoxInit } from "./edit/odg/page.cjs";
|
|
|
28
28
|
import { CreateOdgOptions, OdgEditor, createOdg, openOdg } from "./edit/odg/editor.cjs";
|
|
29
29
|
import { CreateEmptyOdgPackageOptions } from "./edit/odg/scaffold.cjs";
|
|
30
30
|
import { BuildOdpPackageOptions, buildOdpPackage } from "./edit/odp/content.cjs";
|
|
31
|
-
import { i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "./table-
|
|
31
|
+
import { i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "./table-DSFcqJ7C.cjs";
|
|
32
32
|
import { OdpSlide, SlideImageInit, SlideTableInit, TextBoxInit as TextBoxInit$1 } from "./edit/odp/slide.cjs";
|
|
33
33
|
import { CreateOdpOptions, OdpEditor, createOdp, openOdp } from "./edit/odp/editor.cjs";
|
|
34
34
|
import { CreateEmptyOdpPackageOptions } from "./edit/odp/scaffold.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ import { OdgPage, PageImageInit, TextBoxInit } from "./edit/odg/page.js";
|
|
|
28
28
|
import { CreateOdgOptions, OdgEditor, createOdg, openOdg } from "./edit/odg/editor.js";
|
|
29
29
|
import { CreateEmptyOdgPackageOptions } from "./edit/odg/scaffold.js";
|
|
30
30
|
import { BuildOdpPackageOptions, buildOdpPackage } from "./edit/odp/content.js";
|
|
31
|
-
import { i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "./table-
|
|
31
|
+
import { i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "./table-AT4t4VUy.js";
|
|
32
32
|
import { OdpSlide, SlideImageInit, SlideTableInit, TextBoxInit as TextBoxInit$1 } from "./edit/odp/slide.js";
|
|
33
33
|
import { CreateOdpOptions, OdpEditor, createOdp, openOdp } from "./edit/odp/editor.js";
|
|
34
34
|
import { CreateEmptyOdpPackageOptions } from "./edit/odp/scaffold.js";
|
|
@@ -25,6 +25,9 @@ declare class OdtTableRow {
|
|
|
25
25
|
cells(): OdtTableCell[];
|
|
26
26
|
appendCell(): OdtTableCell;
|
|
27
27
|
appendCoveredCell(): void;
|
|
28
|
+
private gridCells;
|
|
29
|
+
mergeCellsHorizontally(startColumnIndex: number, colSpan: number): OdtTableCell;
|
|
30
|
+
markCellCovered(columnIndex: number): void;
|
|
28
31
|
}
|
|
29
32
|
declare class OdtTable {
|
|
30
33
|
private readonly container;
|
|
@@ -37,6 +40,7 @@ declare class OdtTable {
|
|
|
37
40
|
cell(rowIndex: number, columnIndex: number): OdtTableCell;
|
|
38
41
|
appendRow(columnCount: number): OdtTableRow;
|
|
39
42
|
appendEmptyRow(): OdtTableRow;
|
|
43
|
+
mergeCells(startRow: number, startColumn: number, rowSpan: number, colSpan: number): OdtTableCell;
|
|
40
44
|
remove(): void;
|
|
41
45
|
}
|
|
42
46
|
declare function buildTable(pkg: Package, init: TableInit): XmlElement;
|
|
@@ -25,6 +25,9 @@ declare class OdtTableRow {
|
|
|
25
25
|
cells(): OdtTableCell[];
|
|
26
26
|
appendCell(): OdtTableCell;
|
|
27
27
|
appendCoveredCell(): void;
|
|
28
|
+
private gridCells;
|
|
29
|
+
mergeCellsHorizontally(startColumnIndex: number, colSpan: number): OdtTableCell;
|
|
30
|
+
markCellCovered(columnIndex: number): void;
|
|
28
31
|
}
|
|
29
32
|
declare class OdtTable {
|
|
30
33
|
private readonly container;
|
|
@@ -37,6 +40,7 @@ declare class OdtTable {
|
|
|
37
40
|
cell(rowIndex: number, columnIndex: number): OdtTableCell;
|
|
38
41
|
appendRow(columnCount: number): OdtTableRow;
|
|
39
42
|
appendEmptyRow(): OdtTableRow;
|
|
43
|
+
mergeCells(startRow: number, startColumn: number, rowSpan: number, colSpan: number): OdtTableCell;
|
|
40
44
|
remove(): void;
|
|
41
45
|
}
|
|
42
46
|
declare function buildTable(pkg: Package, init: TableInit): XmlElement;
|
package/package.json
CHANGED