js.documents 12.1.0 → 14.0.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/README.md +1 -1
- package/dist/codecs/read.cjs +1 -1
- package/dist/codecs/read.js +1 -1
- package/dist/codecs/registry.cjs +1 -1
- package/dist/codecs/registry.js +1 -1
- package/dist/convert/composition.cjs +1 -1
- package/dist/convert/composition.js +1 -1
- package/dist/edit/docx/content.cjs +1 -0
- package/dist/edit/docx/content.js +1 -0
- package/dist/edit/docx/table.cjs +14 -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 +14 -0
- package/dist/edit/odf-repeated-runs.cjs +99 -0
- package/dist/edit/odf-repeated-runs.d.cts +22 -0
- package/dist/edit/odf-repeated-runs.d.ts +22 -0
- package/dist/edit/odf-repeated-runs.js +87 -0
- package/dist/edit/odp/slide.d.cts +1 -1
- package/dist/edit/odp/slide.d.ts +1 -1
- package/dist/edit/ods/address.cjs +9 -101
- package/dist/edit/ods/address.d.cts +2 -18
- package/dist/edit/ods/address.d.ts +2 -18
- package/dist/edit/ods/address.js +4 -86
- package/dist/edit/ods/column-row.cjs +7 -6
- package/dist/edit/ods/column-row.js +2 -1
- package/dist/edit/ods/floating.cjs +5 -4
- package/dist/edit/ods/floating.js +2 -1
- package/dist/edit/ods/print-settings.cjs +8 -7
- package/dist/edit/ods/print-settings.js +2 -1
- package/dist/edit/ods/sheet.cjs +2 -1
- package/dist/edit/ods/sheet.js +2 -1
- package/dist/edit/odt/content.cjs +2 -0
- package/dist/edit/odt/content.d.cts +1 -1
- package/dist/edit/odt/content.d.ts +1 -1
- package/dist/edit/odt/content.js +2 -0
- package/dist/edit/odt/editor.d.cts +1 -1
- package/dist/edit/odt/editor.d.ts +1 -1
- package/dist/edit/odt/table.cjs +114 -22
- package/dist/edit/odt/table.d.cts +1 -1
- package/dist/edit/odt/table.d.ts +1 -1
- package/dist/edit/odt/table.js +114 -22
- package/dist/index.cjs +3 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/model/bytes.cjs +5 -8
- package/dist/model/bytes.js +5 -8
- package/dist/svg/text.cjs +41 -8
- package/dist/svg/text.d.cts +25 -3
- package/dist/svg/text.d.ts +25 -3
- package/dist/svg/text.js +40 -8
- package/dist/svg/xml-encoding.cjs +91 -0
- package/dist/svg/xml-encoding.d.cts +32 -0
- package/dist/svg/xml-encoding.d.ts +32 -0
- package/dist/svg/xml-encoding.js +88 -0
- package/dist/{table-BT3wN3Hd.d.cts → table-Bt9ahRyh.d.cts} +2 -0
- package/dist/{table-DhTy5Re7.d.ts → table-Cou5rKOo.d.ts} +2 -0
- package/package.json +14 -14
package/dist/edit/ods/address.js
CHANGED
|
@@ -1,92 +1,9 @@
|
|
|
1
1
|
import { el } from "../../xml/fragment.js";
|
|
2
|
+
import { CELL_TAG, COLUMN_REPEAT_ATTR, ROW_REPEAT_ATTR, ROW_TAG, collectRunMembers, isCellOrCoveredCell, isElementWithTag, readRunRepeatCount, replaceRun, validateIndex, withRepeatCount } from "../odf-repeated-runs.js";
|
|
2
3
|
//#region src/edit/ods/address.ts
|
|
3
|
-
const ROW_TAG = "table:table-row";
|
|
4
4
|
const COLUMN_TAG = "table:table-column";
|
|
5
|
-
const CELL_TAG = "table:table-cell";
|
|
6
|
-
const COVERED_CELL_TAG = "table:covered-table-cell";
|
|
7
|
-
const ROW_REPEAT_ATTR = "table:number-rows-repeated";
|
|
8
|
-
const COLUMN_REPEAT_ATTR = "table:number-columns-repeated";
|
|
9
5
|
const HEADER_ROWS_TAG = "table:table-header-rows";
|
|
10
6
|
const HEADER_COLUMNS_TAG = "table:table-header-columns";
|
|
11
|
-
function isElementWithTag(tag) {
|
|
12
|
-
return (node) => node.type === "element" && node.tag === tag;
|
|
13
|
-
}
|
|
14
|
-
function isCellOrCoveredCell(node) {
|
|
15
|
-
return node.type === "element" && (node.tag === "table:table-cell" || node.tag === "table:covered-table-cell");
|
|
16
|
-
}
|
|
17
|
-
function validateIndex(value, label) {
|
|
18
|
-
if (!Number.isInteger(value) || value < 0) throw new Error(`${label} must be a non-negative integer, got ${value}`);
|
|
19
|
-
}
|
|
20
|
-
function readRunRepeatCount(node, attrName) {
|
|
21
|
-
const raw = node.attributes.find((attribute) => attribute.name === attrName)?.value;
|
|
22
|
-
if (raw === void 0) return 1;
|
|
23
|
-
const parsed = Number.parseInt(raw, 10);
|
|
24
|
-
return Number.isInteger(parsed) && parsed > 0 ? parsed : 1;
|
|
25
|
-
}
|
|
26
|
-
function collectRunMembers(children, isMember, headerWrapperTag) {
|
|
27
|
-
const members = [];
|
|
28
|
-
children.forEach((node, outerPosition) => {
|
|
29
|
-
if (node.type !== "element") return;
|
|
30
|
-
if (headerWrapperTag !== void 0 && node.tag === headerWrapperTag) {
|
|
31
|
-
node.children.forEach((inner, innerPosition) => {
|
|
32
|
-
if (isMember(inner)) members.push({
|
|
33
|
-
node: inner,
|
|
34
|
-
container: node.children,
|
|
35
|
-
containerPosition: innerPosition,
|
|
36
|
-
outerPosition
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (isMember(node)) members.push({
|
|
42
|
-
node,
|
|
43
|
-
container: children,
|
|
44
|
-
containerPosition: outerPosition,
|
|
45
|
-
outerPosition
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
return members;
|
|
49
|
-
}
|
|
50
|
-
function withRepeatCount(node, attrName, count) {
|
|
51
|
-
const clone = structuredClone(node);
|
|
52
|
-
clone.attributes = clone.attributes.filter((attribute) => attribute.name !== attrName);
|
|
53
|
-
if (count > 1) clone.attributes.push({
|
|
54
|
-
name: attrName,
|
|
55
|
-
value: String(count)
|
|
56
|
-
});
|
|
57
|
-
return clone;
|
|
58
|
-
}
|
|
59
|
-
function replaceRun(children, isMember, targetIndex, repeatAttr, buildEmpty, headerWrapperTag) {
|
|
60
|
-
validateIndex(targetIndex, "targetIndex");
|
|
61
|
-
const members = collectRunMembers(children, isMember, headerWrapperTag);
|
|
62
|
-
let cursor = 0;
|
|
63
|
-
for (const member of members) {
|
|
64
|
-
const count = readRunRepeatCount(member.node, repeatAttr);
|
|
65
|
-
if (targetIndex < cursor + count) {
|
|
66
|
-
const offset = targetIndex - cursor;
|
|
67
|
-
if (count === 1) return member.node;
|
|
68
|
-
const before = offset > 0 ? withRepeatCount(member.node, repeatAttr, offset) : void 0;
|
|
69
|
-
const target = withRepeatCount(member.node, repeatAttr, 1);
|
|
70
|
-
const replacement = [
|
|
71
|
-
before,
|
|
72
|
-
target,
|
|
73
|
-
count - offset - 1 > 0 ? withRepeatCount(member.node, repeatAttr, count - offset - 1) : void 0
|
|
74
|
-
].filter((candidate) => candidate !== void 0);
|
|
75
|
-
member.container.splice(member.containerPosition, 1, ...replacement);
|
|
76
|
-
return target;
|
|
77
|
-
}
|
|
78
|
-
cursor += count;
|
|
79
|
-
}
|
|
80
|
-
const gap = targetIndex - cursor;
|
|
81
|
-
const lastMember = members[members.length - 1];
|
|
82
|
-
const insertAt = lastMember === void 0 ? children.length : lastMember.outerPosition + 1;
|
|
83
|
-
const toInsert = [];
|
|
84
|
-
if (gap > 0) toInsert.push(withRepeatCount(buildEmpty(), repeatAttr, gap));
|
|
85
|
-
const target = buildEmpty();
|
|
86
|
-
toInsert.push(target);
|
|
87
|
-
children.splice(insertAt, 0, ...toInsert);
|
|
88
|
-
return target;
|
|
89
|
-
}
|
|
90
7
|
function ensureColumnCoverage(tableElement, minCount) {
|
|
91
8
|
if (minCount <= 0) return;
|
|
92
9
|
const columnMembers = collectRunMembers(tableElement.children, isElementWithTag(COLUMN_TAG), HEADER_COLUMNS_TAG);
|
|
@@ -105,7 +22,8 @@ function resolveCellNode(tableElement, row, column) {
|
|
|
105
22
|
validateIndex(row, "row");
|
|
106
23
|
validateIndex(column, "column");
|
|
107
24
|
ensureColumnCoverage(tableElement, column + 1);
|
|
108
|
-
|
|
25
|
+
const rowElement = replaceRun(tableElement.children, isElementWithTag(ROW_TAG), row, ROW_REPEAT_ATTR, () => el(ROW_TAG), HEADER_ROWS_TAG);
|
|
26
|
+
return replaceRun(rowElement.children, isCellOrCoveredCell, column, COLUMN_REPEAT_ATTR, () => el(CELL_TAG));
|
|
109
27
|
}
|
|
110
28
|
//#endregion
|
|
111
|
-
export {
|
|
29
|
+
export { COLUMN_TAG, HEADER_COLUMNS_TAG, HEADER_ROWS_TAG, ensureColumnCoverage, resolveCellNode };
|
|
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_xml_fragment = require("../../xml/fragment.cjs");
|
|
3
3
|
const require_xml_edit = require("../../xml/edit.cjs");
|
|
4
4
|
const require_edit_odt_automatic_styles = require("../odt/automatic-styles.cjs");
|
|
5
|
+
const require_edit_odf_repeated_runs = require("../odf-repeated-runs.cjs");
|
|
5
6
|
const require_edit_ods_address = require("./address.cjs");
|
|
6
7
|
let ooxml_js = require("ooxml.js");
|
|
7
8
|
let odf_js = require("odf.js");
|
|
@@ -32,7 +33,7 @@ function currentRowStyleProperties(pkg, rowElement) {
|
|
|
32
33
|
}
|
|
33
34
|
function applyColumnStyleProperties(pkg, tableElement, index, changes) {
|
|
34
35
|
require_edit_ods_address.ensureColumnCoverage(tableElement, index + 1);
|
|
35
|
-
const columnElement =
|
|
36
|
+
const columnElement = require_edit_odf_repeated_runs.replaceRun(tableElement.children, require_edit_odf_repeated_runs.isElementWithTag(require_edit_ods_address.COLUMN_TAG), index, require_edit_odf_repeated_runs.COLUMN_REPEAT_ATTR, () => require_xml_fragment.el(require_edit_ods_address.COLUMN_TAG), require_edit_ods_address.HEADER_COLUMNS_TAG);
|
|
36
37
|
const current = currentColumnStyleProperties(pkg, columnElement);
|
|
37
38
|
const widthPt = changes.widthPt ?? current.widthPt;
|
|
38
39
|
const manualBreak = changes.manualBreak ?? current.manualBreak;
|
|
@@ -48,7 +49,7 @@ function applyColumnStyleProperties(pkg, tableElement, index, changes) {
|
|
|
48
49
|
require_xml_edit.setAttr(columnElement, "table:style-name", styleName);
|
|
49
50
|
}
|
|
50
51
|
function applyRowStyleProperties(pkg, tableElement, index, changes) {
|
|
51
|
-
const rowElement =
|
|
52
|
+
const rowElement = require_edit_odf_repeated_runs.replaceRun(tableElement.children, require_edit_odf_repeated_runs.isElementWithTag(require_edit_odf_repeated_runs.ROW_TAG), index, require_edit_odf_repeated_runs.ROW_REPEAT_ATTR, () => require_xml_fragment.el(require_edit_odf_repeated_runs.ROW_TAG), require_edit_ods_address.HEADER_ROWS_TAG);
|
|
52
53
|
const current = currentRowStyleProperties(pkg, rowElement);
|
|
53
54
|
const heightPt = changes.heightPt ?? current.heightPt;
|
|
54
55
|
const manualBreak = changes.manualBreak ?? current.manualBreak;
|
|
@@ -71,10 +72,10 @@ function writeRowHeight(pkg, tableElement, index, heightPt) {
|
|
|
71
72
|
}
|
|
72
73
|
function ensureColumnDefaultWidth(pkg, tableElement, index) {
|
|
73
74
|
require_edit_ods_address.ensureColumnCoverage(tableElement, index + 1);
|
|
74
|
-
if (currentColumnStyleProperties(pkg,
|
|
75
|
+
if (currentColumnStyleProperties(pkg, require_edit_odf_repeated_runs.replaceRun(tableElement.children, require_edit_odf_repeated_runs.isElementWithTag("table:table-column"), index, "table:number-columns-repeated", () => require_xml_fragment.el("table:table-column"), "table:table-header-columns")).widthPt === void 0) writeColumnWidth(pkg, tableElement, index, DEFAULT_COLUMN_WIDTH_PT);
|
|
75
76
|
}
|
|
76
77
|
function ensureRowDefaultHeight(pkg, tableElement, index) {
|
|
77
|
-
if (currentRowStyleProperties(pkg,
|
|
78
|
+
if (currentRowStyleProperties(pkg, require_edit_odf_repeated_runs.replaceRun(tableElement.children, require_edit_odf_repeated_runs.isElementWithTag("table:table-row"), index, "table:number-rows-repeated", () => require_xml_fragment.el("table:table-row"), "table:table-header-rows")).heightPt === void 0) writeRowHeight(pkg, tableElement, index, DEFAULT_ROW_HEIGHT_PT);
|
|
78
79
|
}
|
|
79
80
|
function ensureColumnElementDefaultWidth(pkg, columnElement) {
|
|
80
81
|
if (currentColumnStyleProperties(pkg, columnElement).widthPt !== void 0) return;
|
|
@@ -104,13 +105,13 @@ function writeRowManualBreak(pkg, tableElement, index) {
|
|
|
104
105
|
}
|
|
105
106
|
function writeColumnHidden(pkg, tableElement, index, hidden) {
|
|
106
107
|
ensureColumnDefaultWidth(pkg, tableElement, index);
|
|
107
|
-
const columnElement =
|
|
108
|
+
const columnElement = require_edit_odf_repeated_runs.replaceRun(tableElement.children, require_edit_odf_repeated_runs.isElementWithTag(require_edit_ods_address.COLUMN_TAG), index, require_edit_odf_repeated_runs.COLUMN_REPEAT_ATTR, () => require_xml_fragment.el(require_edit_ods_address.COLUMN_TAG), require_edit_ods_address.HEADER_COLUMNS_TAG);
|
|
108
109
|
if (hidden) require_xml_edit.setAttr(columnElement, VISIBILITY_ATTR, VISIBILITY_COLLAPSE);
|
|
109
110
|
else require_xml_edit.removeAttr(columnElement, VISIBILITY_ATTR);
|
|
110
111
|
}
|
|
111
112
|
function writeRowHidden(pkg, tableElement, index, hidden) {
|
|
112
113
|
ensureRowDefaultHeight(pkg, tableElement, index);
|
|
113
|
-
const rowElement =
|
|
114
|
+
const rowElement = require_edit_odf_repeated_runs.replaceRun(tableElement.children, require_edit_odf_repeated_runs.isElementWithTag(require_edit_odf_repeated_runs.ROW_TAG), index, require_edit_odf_repeated_runs.ROW_REPEAT_ATTR, () => require_xml_fragment.el(require_edit_odf_repeated_runs.ROW_TAG), require_edit_ods_address.HEADER_ROWS_TAG);
|
|
114
115
|
if (hidden) require_xml_edit.setAttr(rowElement, VISIBILITY_ATTR, VISIBILITY_COLLAPSE);
|
|
115
116
|
else require_xml_edit.removeAttr(rowElement, VISIBILITY_ATTR);
|
|
116
117
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { el } from "../../xml/fragment.js";
|
|
2
2
|
import { directChildElement, removeAttr, setAttr } from "../../xml/edit.js";
|
|
3
3
|
import { ensureAutomaticStyles, nextStyleName } from "../odt/automatic-styles.js";
|
|
4
|
-
import { COLUMN_REPEAT_ATTR,
|
|
4
|
+
import { COLUMN_REPEAT_ATTR, ROW_REPEAT_ATTR, ROW_TAG, isElementWithTag, replaceRun } from "../odf-repeated-runs.js";
|
|
5
|
+
import { COLUMN_TAG, HEADER_COLUMNS_TAG, HEADER_ROWS_TAG, ensureColumnCoverage } from "./address.js";
|
|
5
6
|
import { attr } from "ooxml.js";
|
|
6
7
|
import { findStyleElement, formatOdfLength, parseOdfLength } from "odf.js";
|
|
7
8
|
//#region src/edit/ods/column-row.ts
|
|
@@ -3,6 +3,7 @@ const require_xml_fragment = require("../../xml/fragment.cjs");
|
|
|
3
3
|
const require_xml_edit = require("../../xml/edit.cjs");
|
|
4
4
|
const require_odf_package_formula = require("../../odf-package/formula.cjs");
|
|
5
5
|
const require_odf_package_media = require("../../odf-package/media.cjs");
|
|
6
|
+
const require_edit_odf_repeated_runs = require("../odf-repeated-runs.cjs");
|
|
6
7
|
const require_edit_ods_address = require("./address.cjs");
|
|
7
8
|
let ooxml_js = require("ooxml.js");
|
|
8
9
|
let odf_js = require("odf.js");
|
|
@@ -39,9 +40,9 @@ function resolvedRowHeightPt(pkg, rowElement) {
|
|
|
39
40
|
function cumulativeColumnOffsetPt(pkg, tableElement, anchorColumn) {
|
|
40
41
|
let cursor = 0;
|
|
41
42
|
let offsetPt = 0;
|
|
42
|
-
for (const member of
|
|
43
|
+
for (const member of require_edit_odf_repeated_runs.collectRunMembers(tableElement.children, require_edit_odf_repeated_runs.isElementWithTag(require_edit_ods_address.COLUMN_TAG), require_edit_ods_address.HEADER_COLUMNS_TAG)) {
|
|
43
44
|
if (cursor >= anchorColumn) break;
|
|
44
|
-
const count =
|
|
45
|
+
const count = require_edit_odf_repeated_runs.readRunRepeatCount(member.node, require_edit_odf_repeated_runs.COLUMN_REPEAT_ATTR);
|
|
45
46
|
const overlap = Math.min(count, anchorColumn - cursor);
|
|
46
47
|
offsetPt += overlap * resolvedColumnWidthPt(pkg, member.node);
|
|
47
48
|
cursor += count;
|
|
@@ -52,9 +53,9 @@ function cumulativeColumnOffsetPt(pkg, tableElement, anchorColumn) {
|
|
|
52
53
|
function cumulativeRowOffsetPt(pkg, tableElement, anchorRow) {
|
|
53
54
|
let cursor = 0;
|
|
54
55
|
let offsetPt = 0;
|
|
55
|
-
for (const member of
|
|
56
|
+
for (const member of require_edit_odf_repeated_runs.collectRunMembers(tableElement.children, require_edit_odf_repeated_runs.isElementWithTag(require_edit_odf_repeated_runs.ROW_TAG), require_edit_ods_address.HEADER_ROWS_TAG)) {
|
|
56
57
|
if (cursor >= anchorRow) break;
|
|
57
|
-
const count =
|
|
58
|
+
const count = require_edit_odf_repeated_runs.readRunRepeatCount(member.node, require_edit_odf_repeated_runs.ROW_REPEAT_ATTR);
|
|
58
59
|
const overlap = Math.min(count, anchorRow - cursor);
|
|
59
60
|
offsetPt += overlap * resolvedRowHeightPt(pkg, member.node);
|
|
60
61
|
cursor += count;
|
|
@@ -2,7 +2,8 @@ import { el } from "../../xml/fragment.js";
|
|
|
2
2
|
import { directChildElement } from "../../xml/edit.js";
|
|
3
3
|
import { addFormulaObject } from "../../odf-package/formula.js";
|
|
4
4
|
import { addImageMedia } from "../../odf-package/media.js";
|
|
5
|
-
import { COLUMN_REPEAT_ATTR,
|
|
5
|
+
import { COLUMN_REPEAT_ATTR, ROW_REPEAT_ATTR, ROW_TAG, collectRunMembers, isElementWithTag, readRunRepeatCount } from "../odf-repeated-runs.js";
|
|
6
|
+
import { COLUMN_TAG, HEADER_COLUMNS_TAG, HEADER_ROWS_TAG } from "./address.js";
|
|
6
7
|
import { attr } from "ooxml.js";
|
|
7
8
|
import { base64ToBytes as base64ToBytes$1, findStyleElement, formatOdfLength, parseOdfLength, writeEmbeddedObject } from "odf.js";
|
|
8
9
|
//#region src/edit/ods/floating.ts
|
|
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_xml_fragment = require("../../xml/fragment.cjs");
|
|
3
3
|
const require_xml_edit = require("../../xml/edit.cjs");
|
|
4
4
|
const require_edit_odt_automatic_styles = require("../odt/automatic-styles.cjs");
|
|
5
|
+
const require_edit_odf_repeated_runs = require("../odf-repeated-runs.cjs");
|
|
5
6
|
const require_edit_ods_address = require("./address.cjs");
|
|
6
7
|
const require_edit_ods_column_row = require("./column-row.cjs");
|
|
7
8
|
let ooxml_js = require("ooxml.js");
|
|
@@ -56,12 +57,12 @@ function scanTableStructure(pkg, tableElement) {
|
|
|
56
57
|
const manualBreakRows = [];
|
|
57
58
|
function processColumn(columnElement) {
|
|
58
59
|
if (hasManualBreak(pkg, columnElement, "table-column", "style:table-column-properties")) manualBreakColumns.push(columnCursor);
|
|
59
|
-
columnCursor +=
|
|
60
|
+
columnCursor += require_edit_odf_repeated_runs.readRunRepeatCount(columnElement, require_edit_odf_repeated_runs.COLUMN_REPEAT_ATTR);
|
|
60
61
|
}
|
|
61
62
|
function processRow(rowElement) {
|
|
62
63
|
const startIndex = rowCursor;
|
|
63
64
|
if (hasManualBreak(pkg, rowElement, "table-row", "style:table-row-properties")) manualBreakRows.push(startIndex);
|
|
64
|
-
rowCursor +=
|
|
65
|
+
rowCursor += require_edit_odf_repeated_runs.readRunRepeatCount(rowElement, require_edit_odf_repeated_runs.ROW_REPEAT_ATTR);
|
|
65
66
|
}
|
|
66
67
|
for (const child of tableElement.children) {
|
|
67
68
|
if (child.type !== "element") continue;
|
|
@@ -174,7 +175,7 @@ function collectRangeElements(children, tag, repeatAttr, start, end) {
|
|
|
174
175
|
const found = [];
|
|
175
176
|
children.forEach((node, position) => {
|
|
176
177
|
if (node.type !== "element" || node.tag !== tag) return;
|
|
177
|
-
const count =
|
|
178
|
+
const count = require_edit_odf_repeated_runs.readRunRepeatCount(node, repeatAttr);
|
|
178
179
|
if (cursor >= start && cursor + count - 1 <= end) found.push({
|
|
179
180
|
position,
|
|
180
181
|
element: node
|
|
@@ -184,8 +185,8 @@ function collectRangeElements(children, tag, repeatAttr, start, end) {
|
|
|
184
185
|
return found;
|
|
185
186
|
}
|
|
186
187
|
function wrapRepeatRange(tableElement, memberTag, repeatAttr, wrapperTag, range, buildEmpty, pkg) {
|
|
187
|
-
|
|
188
|
-
|
|
188
|
+
require_edit_odf_repeated_runs.replaceRun(tableElement.children, require_edit_odf_repeated_runs.isElementWithTag(memberTag), range.start, repeatAttr, buildEmpty);
|
|
189
|
+
require_edit_odf_repeated_runs.replaceRun(tableElement.children, require_edit_odf_repeated_runs.isElementWithTag(memberTag), range.end, repeatAttr, buildEmpty);
|
|
189
190
|
for (const entry of collectRangeElements(tableElement.children, memberTag, repeatAttr, 0, range.end)) if (memberTag === "table:table-column") require_edit_ods_column_row.ensureColumnElementDefaultWidth(pkg, entry.element);
|
|
190
191
|
else require_edit_ods_column_row.ensureRowElementDefaultHeight(pkg, entry.element);
|
|
191
192
|
const found = collectRangeElements(tableElement.children, memberTag, repeatAttr, range.start, range.end);
|
|
@@ -235,9 +236,9 @@ function writeSheetPrintSettings(pkg, tableElement, settings) {
|
|
|
235
236
|
require_xml_edit.setAttr(tableElement, "table:print-ranges", formatPrintRange(sheetName, settings.printRange));
|
|
236
237
|
}
|
|
237
238
|
unwrapHeaderGroup(tableElement, require_edit_ods_address.HEADER_COLUMNS_TAG);
|
|
238
|
-
if (settings.repeatColumns !== void 0) wrapRepeatRange(tableElement, require_edit_ods_address.COLUMN_TAG,
|
|
239
|
+
if (settings.repeatColumns !== void 0) wrapRepeatRange(tableElement, require_edit_ods_address.COLUMN_TAG, require_edit_odf_repeated_runs.COLUMN_REPEAT_ATTR, require_edit_ods_address.HEADER_COLUMNS_TAG, settings.repeatColumns, () => require_xml_fragment.el(require_edit_ods_address.COLUMN_TAG), pkg);
|
|
239
240
|
unwrapHeaderGroup(tableElement, require_edit_ods_address.HEADER_ROWS_TAG);
|
|
240
|
-
if (settings.repeatRows !== void 0) wrapRepeatRange(tableElement,
|
|
241
|
+
if (settings.repeatRows !== void 0) wrapRepeatRange(tableElement, require_edit_odf_repeated_runs.ROW_TAG, require_edit_odf_repeated_runs.ROW_REPEAT_ATTR, require_edit_ods_address.HEADER_ROWS_TAG, settings.repeatRows, () => require_xml_fragment.el(require_edit_odf_repeated_runs.ROW_TAG), pkg);
|
|
241
242
|
if (settings.manualBreaks !== void 0) {
|
|
242
243
|
for (const columnIndex of settings.manualBreaks.columns) require_edit_ods_column_row.writeColumnManualBreak(pkg, tableElement, columnIndex);
|
|
243
244
|
for (const rowIndex of settings.manualBreaks.rows) require_edit_ods_column_row.writeRowManualBreak(pkg, tableElement, rowIndex);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { el } from "../../xml/fragment.js";
|
|
2
2
|
import { setAttr } from "../../xml/edit.js";
|
|
3
3
|
import { nextStyleName } from "../odt/automatic-styles.js";
|
|
4
|
-
import { COLUMN_REPEAT_ATTR,
|
|
4
|
+
import { COLUMN_REPEAT_ATTR, ROW_REPEAT_ATTR, ROW_TAG, isElementWithTag, readRunRepeatCount, replaceRun } from "../odf-repeated-runs.js";
|
|
5
|
+
import { COLUMN_TAG, HEADER_COLUMNS_TAG, HEADER_ROWS_TAG } from "./address.js";
|
|
5
6
|
import { ensureColumnElementDefaultWidth, ensureRowElementDefaultHeight, writeColumnManualBreak, writeRowManualBreak } from "./column-row.js";
|
|
6
7
|
import { attr } from "ooxml.js";
|
|
7
8
|
import { PAGE_SIZE_A4, cellReference, parseCellReference } from "document-schema.js";
|
package/dist/edit/ods/sheet.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_xml_edit = require("../../xml/edit.cjs");
|
|
3
|
+
const require_edit_odf_repeated_runs = require("../odf-repeated-runs.cjs");
|
|
3
4
|
const require_edit_ods_address = require("./address.cjs");
|
|
4
5
|
const require_edit_ods_cell = require("./cell.cjs");
|
|
5
6
|
const require_edit_ods_column_row = require("./column-row.cjs");
|
|
@@ -86,7 +87,7 @@ var OdsSheet = class {
|
|
|
86
87
|
for (let rowOffset = 0; rowOffset < rowSpan; rowOffset++) for (let columnOffset = 0; columnOffset < colSpan; columnOffset++) {
|
|
87
88
|
if (rowOffset === 0 && columnOffset === 0) continue;
|
|
88
89
|
const coveredNode = require_edit_ods_address.resolveCellNode(tableElement, startRow + rowOffset, startColumn + columnOffset);
|
|
89
|
-
coveredNode.tag =
|
|
90
|
+
coveredNode.tag = require_edit_odf_repeated_runs.COVERED_CELL_TAG;
|
|
90
91
|
coveredNode.attributes = [];
|
|
91
92
|
coveredNode.children = [];
|
|
92
93
|
}
|
package/dist/edit/ods/sheet.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { removeChild, setAttr } from "../../xml/edit.js";
|
|
2
|
-
import { COVERED_CELL_TAG
|
|
2
|
+
import { COVERED_CELL_TAG } from "../odf-repeated-runs.js";
|
|
3
|
+
import { resolveCellNode } from "./address.js";
|
|
3
4
|
import { OdsCell } from "./cell.js";
|
|
4
5
|
import { ensureColumnDefaultWidth, ensureRowDefaultHeight, writeColumnHidden, writeColumnWidth, writeRowHeight, writeRowHidden } from "./column-row.js";
|
|
5
6
|
import { insertSheetEmbeddedObject, insertSheetImage } from "./floating.js";
|
|
@@ -135,6 +135,7 @@ function populateCellBlocks(cell, blocks) {
|
|
|
135
135
|
function populateOdtTable(table, block) {
|
|
136
136
|
require_edit_table_grid.assertTableObeysGridRule(block, "populateOdtTable");
|
|
137
137
|
const gridPositions = (0, document_schema_js.walkTableGrid)(block);
|
|
138
|
+
const headerFlags = block.rows.map((row) => row.isHeader === true);
|
|
138
139
|
block.rows.forEach((row, rowIndex) => {
|
|
139
140
|
const tableRow = table.appendEmptyRow();
|
|
140
141
|
tableRow.heightPt = row.heightPt;
|
|
@@ -153,6 +154,7 @@ function populateOdtTable(table, block) {
|
|
|
153
154
|
populateCellBlocks(tableCell, cell.blocks);
|
|
154
155
|
});
|
|
155
156
|
});
|
|
157
|
+
table.setHeaderRows(headerFlags);
|
|
156
158
|
}
|
|
157
159
|
function applyCellDecoration(target, cell) {
|
|
158
160
|
if (cell.background !== void 0) target.background = (0, document_schema_js.resolveCellFillColor)(cell.background);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as ClockPort } from "../../clock-C7SUuYN0.cjs";
|
|
2
2
|
import { t as OdtParagraph } from "../../paragraph-CRaLSzWz.cjs";
|
|
3
|
-
import { o as TableInit, r as OdtTable } from "../../table-
|
|
3
|
+
import { o as TableInit, r as OdtTable } from "../../table-Bt9ahRyh.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 { t as ClockPort } from "../../clock-C7SUuYN0.js";
|
|
2
2
|
import { t as OdtParagraph } from "../../paragraph-D4f705GG.js";
|
|
3
|
-
import { o as TableInit, r as OdtTable } from "../../table-
|
|
3
|
+
import { o as TableInit, r as OdtTable } from "../../table-Cou5rKOo.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
|
package/dist/edit/odt/content.js
CHANGED
|
@@ -134,6 +134,7 @@ function populateCellBlocks(cell, blocks) {
|
|
|
134
134
|
function populateOdtTable(table, block) {
|
|
135
135
|
assertTableObeysGridRule(block, "populateOdtTable");
|
|
136
136
|
const gridPositions = walkTableGrid(block);
|
|
137
|
+
const headerFlags = block.rows.map((row) => row.isHeader === true);
|
|
137
138
|
block.rows.forEach((row, rowIndex) => {
|
|
138
139
|
const tableRow = table.appendEmptyRow();
|
|
139
140
|
tableRow.heightPt = row.heightPt;
|
|
@@ -152,6 +153,7 @@ function populateOdtTable(table, block) {
|
|
|
152
153
|
populateCellBlocks(tableCell, cell.blocks);
|
|
153
154
|
});
|
|
154
155
|
});
|
|
156
|
+
table.setHeaderRows(headerFlags);
|
|
155
157
|
}
|
|
156
158
|
function applyCellDecoration(target, cell) {
|
|
157
159
|
if (cell.background !== void 0) target.background = resolveCellFillColor(cell.background);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as ClockPort } from "../../clock-C7SUuYN0.cjs";
|
|
2
2
|
import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-CRaLSzWz.cjs";
|
|
3
3
|
import { t as OdtList } from "../../list-C_UPIZWM.cjs";
|
|
4
|
-
import { o as TableInit, r as OdtTable } from "../../table-
|
|
4
|
+
import { o as TableInit, r as OdtTable } from "../../table-Bt9ahRyh.cjs";
|
|
5
5
|
import { Box, ContentControlDescriptor, ContentFormula, ContentVector, DivisionDescriptor, LayoutMetadata } from "document-schema.js";
|
|
6
6
|
import { Package } from "odf.js";
|
|
7
7
|
//#region src/edit/odt/editor.d.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as ClockPort } from "../../clock-C7SUuYN0.js";
|
|
2
2
|
import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-D4f705GG.js";
|
|
3
3
|
import { t as OdtList } from "../../list-C2GWIe6E.js";
|
|
4
|
-
import { o as TableInit, r as OdtTable } from "../../table-
|
|
4
|
+
import { o as TableInit, r as OdtTable } from "../../table-Cou5rKOo.js";
|
|
5
5
|
import { Box, ContentControlDescriptor, ContentFormula, ContentVector, DivisionDescriptor, LayoutMetadata } from "document-schema.js";
|
|
6
6
|
import { Package } from "odf.js";
|
|
7
7
|
//#region src/edit/odt/editor.d.ts
|
package/dist/edit/odt/table.cjs
CHANGED
|
@@ -4,6 +4,7 @@ const require_xml_edit = require("../../xml/edit.cjs");
|
|
|
4
4
|
const require_edit_table_grid = require("../table-grid.cjs");
|
|
5
5
|
const require_edit_odt_automatic_styles = require("./automatic-styles.cjs");
|
|
6
6
|
const require_edit_odt_paragraph = require("./paragraph.cjs");
|
|
7
|
+
const require_edit_odf_repeated_runs = require("../odf-repeated-runs.cjs");
|
|
7
8
|
let ooxml_js = require("ooxml.js");
|
|
8
9
|
let document_schema_js = require("document-schema.js");
|
|
9
10
|
let odf_js = require("odf.js");
|
|
@@ -250,16 +251,41 @@ function retagAsCovered(element) {
|
|
|
250
251
|
element.attributes = element.attributes.filter((attribute) => attribute.name === COVERED_CELL_KEPT_ATTRIBUTE);
|
|
251
252
|
element.children = [];
|
|
252
253
|
}
|
|
253
|
-
function
|
|
254
|
+
function gridColumnElements(row) {
|
|
254
255
|
const out = [];
|
|
255
|
-
|
|
256
|
+
let columnIndex = 0;
|
|
257
|
+
for (const member of require_edit_odf_repeated_runs.collectRunMembers(row.children, require_edit_odf_repeated_runs.isCellOrCoveredCell, void 0)) {
|
|
258
|
+
const repeat = require_edit_odf_repeated_runs.readRunRepeatCount(member.node, require_edit_odf_repeated_runs.COLUMN_REPEAT_ATTR);
|
|
259
|
+
for (let offset = 0; offset < repeat; offset++) out.push({
|
|
260
|
+
columnIndex: columnIndex + offset,
|
|
261
|
+
element: member.node
|
|
262
|
+
});
|
|
263
|
+
columnIndex += repeat;
|
|
264
|
+
}
|
|
256
265
|
return out;
|
|
257
266
|
}
|
|
267
|
+
function rowGridColumnCount(row) {
|
|
268
|
+
return require_edit_odf_repeated_runs.collectRunMembers(row.children, require_edit_odf_repeated_runs.isCellOrCoveredCell, void 0).reduce((sum, member) => sum + require_edit_odf_repeated_runs.readRunRepeatCount(member.node, require_edit_odf_repeated_runs.COLUMN_REPEAT_ATTR), 0);
|
|
269
|
+
}
|
|
270
|
+
function locateGridColumnElement(row, columnIndex) {
|
|
271
|
+
if (columnIndex < 0) return;
|
|
272
|
+
let cursor = 0;
|
|
273
|
+
for (const member of require_edit_odf_repeated_runs.collectRunMembers(row.children, require_edit_odf_repeated_runs.isCellOrCoveredCell, void 0)) {
|
|
274
|
+
const count = require_edit_odf_repeated_runs.readRunRepeatCount(member.node, require_edit_odf_repeated_runs.COLUMN_REPEAT_ATTR);
|
|
275
|
+
if (columnIndex < cursor + count) return member.node;
|
|
276
|
+
cursor += count;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
function individuateGridColumn(row, columnIndex) {
|
|
280
|
+
return require_edit_odf_repeated_runs.replaceRun(row.children, require_edit_odf_repeated_runs.isCellOrCoveredCell, columnIndex, require_edit_odf_repeated_runs.COLUMN_REPEAT_ATTR, () => {
|
|
281
|
+
throw new Error(`individuateGridColumn: column ${columnIndex} has no existing element to individuate in this row — callers must bounds-check against rowGridColumnCount first`);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
258
284
|
function tableRowElements(table) {
|
|
259
|
-
return table.
|
|
285
|
+
return tableRowEntries(table).map((entry) => entry.element);
|
|
260
286
|
}
|
|
261
287
|
function placedCells(row, pkg) {
|
|
262
|
-
return
|
|
288
|
+
return gridColumnElements(row).flatMap(({ columnIndex, element }) => {
|
|
263
289
|
if (element.tag !== "table:table-cell") return [];
|
|
264
290
|
const cell = new OdtTableCell(element, pkg);
|
|
265
291
|
return [{
|
|
@@ -275,9 +301,9 @@ function resolveOdtGrid(table, pkg) {
|
|
|
275
301
|
let declaredColumns = 0;
|
|
276
302
|
for (const child of table.children) {
|
|
277
303
|
if (child.type !== "element") continue;
|
|
278
|
-
if (child.tag === "table:table-column") declaredColumns
|
|
279
|
-
else if (child.tag === "table:table-row") placedRows.push(placedCells(child, pkg));
|
|
304
|
+
if (child.tag === "table:table-column") declaredColumns += require_edit_odf_repeated_runs.readRunRepeatCount(child, require_edit_odf_repeated_runs.COLUMN_REPEAT_ATTR);
|
|
280
305
|
}
|
|
306
|
+
for (const row of tableRowElements(table)) placedRows.push(placedCells(row, pkg));
|
|
281
307
|
return require_edit_table_grid.resolveLiveTableGrid(placedRows, declaredColumns);
|
|
282
308
|
}
|
|
283
309
|
function regionCovers(region, rowIndex, columnIndex) {
|
|
@@ -319,14 +345,15 @@ function refuseMerge(rowIndex, reason) {
|
|
|
319
345
|
}
|
|
320
346
|
function planMerge(table, pkg, target, rows) {
|
|
321
347
|
const [anchorRow, ...coveredRows] = rows;
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
const anchor = anchorCells[target.column];
|
|
325
|
-
if (anchor === void 0) return refuseMerge(target.row, `column ${target.column} does not exist in this row`);
|
|
348
|
+
const anchorElement = locateGridColumnElement(anchorRow, target.column);
|
|
349
|
+
if (anchorElement === void 0) return refuseMerge(target.row, `column ${target.column} does not exist in this row`);
|
|
326
350
|
const endColumn = target.column + target.columnSpan;
|
|
327
|
-
for (const [offset,
|
|
351
|
+
for (const [offset, row] of rows.entries()) {
|
|
352
|
+
const totalColumns = rowGridColumnCount(row);
|
|
353
|
+
if (endColumn > totalColumns) return refuseMerge(target.row + offset, `colSpan ${target.columnSpan} starting at column ${target.column} exceeds this row's own ${totalColumns} grid columns`);
|
|
354
|
+
}
|
|
328
355
|
const regions = anchorRegions(resolveOdtGrid(table, pkg));
|
|
329
|
-
if (
|
|
356
|
+
if (anchorElement.tag === "table:covered-table-cell") {
|
|
330
357
|
const covering = regions.find((region) => regionCovers(region, target.row, target.column));
|
|
331
358
|
return refuseMerge(target.row, covering === void 0 ? `column ${target.column} is a covered position that no merge anchors` : `column ${target.column} is covered by ${describeRegionAnchor(covering)}`);
|
|
332
359
|
}
|
|
@@ -335,18 +362,47 @@ function planMerge(table, pkg, target, rows) {
|
|
|
335
362
|
const column = Math.max(cutting.column, target.column);
|
|
336
363
|
return refuseMerge(Math.max(cutting.row, target.row), `column ${column} belongs to ${describeRegionAnchor(cutting)}, which reaches outside the region being merged and cannot be merged over`);
|
|
337
364
|
}
|
|
365
|
+
const consumed = [];
|
|
366
|
+
for (let column = target.column + 1; column < endColumn; column++) consumed.push({
|
|
367
|
+
row: anchorRow,
|
|
368
|
+
column
|
|
369
|
+
});
|
|
370
|
+
for (const row of coveredRows) for (let column = target.column; column < endColumn; column++) consumed.push({
|
|
371
|
+
row,
|
|
372
|
+
column
|
|
373
|
+
});
|
|
338
374
|
return {
|
|
339
|
-
anchor
|
|
340
|
-
|
|
375
|
+
anchor: {
|
|
376
|
+
row: anchorRow,
|
|
377
|
+
column: target.column
|
|
378
|
+
},
|
|
379
|
+
consumed
|
|
341
380
|
};
|
|
342
381
|
}
|
|
343
382
|
function applyMerge(plan, target, pkg) {
|
|
344
|
-
for (const
|
|
345
|
-
const anchor = new OdtTableCell(plan.anchor, pkg);
|
|
383
|
+
for (const position of plan.consumed) retagAsCovered(individuateGridColumn(position.row, position.column));
|
|
384
|
+
const anchor = new OdtTableCell(individuateGridColumn(plan.anchor.row, plan.anchor.column), pkg);
|
|
346
385
|
anchor.colSpan = target.columnSpan;
|
|
347
386
|
if (target.rowSpan > 1) anchor.rowSpan = target.rowSpan;
|
|
348
387
|
return anchor;
|
|
349
388
|
}
|
|
389
|
+
const ROW_WRAPPER_TAGS = /* @__PURE__ */ new Set([
|
|
390
|
+
"table:table-rows",
|
|
391
|
+
"table:table-header-rows",
|
|
392
|
+
"table:table-row-group"
|
|
393
|
+
]);
|
|
394
|
+
function tableRowEntries(parent, insideHeader = false) {
|
|
395
|
+
const entries = [];
|
|
396
|
+
for (const child of parent.children) {
|
|
397
|
+
if (child.type !== "element") continue;
|
|
398
|
+
if (child.tag === "table:table-row") entries.push({
|
|
399
|
+
element: child,
|
|
400
|
+
insideHeader
|
|
401
|
+
});
|
|
402
|
+
else if (ROW_WRAPPER_TAGS.has(child.tag)) entries.push(...tableRowEntries(child, insideHeader || child.tag === "table:table-header-rows"));
|
|
403
|
+
}
|
|
404
|
+
return entries;
|
|
405
|
+
}
|
|
350
406
|
var OdtTableRow = class {
|
|
351
407
|
node;
|
|
352
408
|
pkg;
|
|
@@ -402,12 +458,12 @@ var OdtTableRow = class {
|
|
|
402
458
|
return applyMerge(plan, target, this.pkg);
|
|
403
459
|
}
|
|
404
460
|
markCellCovered(columnIndex) {
|
|
405
|
-
const
|
|
406
|
-
if (
|
|
461
|
+
const totalColumns = rowGridColumnCount(this.node);
|
|
462
|
+
if (columnIndex < 0 || columnIndex >= totalColumns) throw new Error(`markCellCovered: column ${columnIndex} does not exist in this row`);
|
|
407
463
|
const rowIndex = tableRowElements(this.table).indexOf(this.node);
|
|
408
464
|
const anchored = anchorRegions(resolveOdtGrid(this.table, this.pkg)).find((region) => region.row === rowIndex && region.column === columnIndex && (region.rowSpan > 1 || region.columnSpan > 1));
|
|
409
465
|
if (anchored !== void 0) throw new Error(`markCellCovered: column ${columnIndex} anchors a merge with rowSpan ${anchored.rowSpan} and colSpan ${anchored.columnSpan}, so covering it would leave the rest of that merge without an anchor`);
|
|
410
|
-
retagAsCovered(
|
|
466
|
+
retagAsCovered(individuateGridColumn(this.node, columnIndex));
|
|
411
467
|
}
|
|
412
468
|
};
|
|
413
469
|
function buildCell(pkg) {
|
|
@@ -433,9 +489,45 @@ var OdtTable = class {
|
|
|
433
489
|
return this.node;
|
|
434
490
|
}
|
|
435
491
|
rows() {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
492
|
+
return tableRowElements(this.live()).map((row) => new OdtTableRow(row, this.pkg, this.node));
|
|
493
|
+
}
|
|
494
|
+
headerRows() {
|
|
495
|
+
return tableRowEntries(this.live()).map((entry) => entry.insideHeader);
|
|
496
|
+
}
|
|
497
|
+
setHeaderRows(flags) {
|
|
498
|
+
const table = this.live();
|
|
499
|
+
const rows = tableRowElements(table);
|
|
500
|
+
const regrouped = [];
|
|
501
|
+
let run = [];
|
|
502
|
+
const closeRun = () => {
|
|
503
|
+
if (run.length > 0) {
|
|
504
|
+
regrouped.push(require_xml_fragment.el("table:table-header-rows", {}, run));
|
|
505
|
+
run = [];
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
rows.forEach((row, index) => {
|
|
509
|
+
if (flags[index] === true) {
|
|
510
|
+
run.push(row);
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
closeRun();
|
|
514
|
+
regrouped.push(row);
|
|
515
|
+
});
|
|
516
|
+
closeRun();
|
|
517
|
+
const rest = [];
|
|
518
|
+
let placed = false;
|
|
519
|
+
for (const child of table.children) {
|
|
520
|
+
if (!(child.type === "element" && (child.tag === "table:table-row" || ROW_WRAPPER_TAGS.has(child.tag)))) {
|
|
521
|
+
rest.push(child);
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
if (!placed) {
|
|
525
|
+
rest.push(...regrouped);
|
|
526
|
+
placed = true;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
if (!placed) rest.push(...regrouped);
|
|
530
|
+
table.children = rest;
|
|
439
531
|
}
|
|
440
532
|
gridRows() {
|
|
441
533
|
return this.grid().rows;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as OdtTableRow, c as buildTable, i as OdtTableCell, l as readCellDecoration, n as OdtCoveredTableCell, o as TableInit, r as OdtTable, s as buildCellStyle, t as CellDecoration } from "../../table-
|
|
1
|
+
import { a as OdtTableRow, c as buildTable, i as OdtTableCell, l as readCellDecoration, n as OdtCoveredTableCell, o as TableInit, r as OdtTable, s as buildCellStyle, t as CellDecoration } from "../../table-Bt9ahRyh.cjs";
|
|
2
2
|
export { CellDecoration, OdtCoveredTableCell, OdtTable, OdtTableCell, OdtTableRow, TableInit, buildCellStyle, buildTable, readCellDecoration };
|
package/dist/edit/odt/table.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as OdtTableRow, c as buildTable, i as OdtTableCell, l as readCellDecoration, n as OdtCoveredTableCell, o as TableInit, r as OdtTable, s as buildCellStyle, t as CellDecoration } from "../../table-
|
|
1
|
+
import { a as OdtTableRow, c as buildTable, i as OdtTableCell, l as readCellDecoration, n as OdtCoveredTableCell, o as TableInit, r as OdtTable, s as buildCellStyle, t as CellDecoration } from "../../table-Cou5rKOo.js";
|
|
2
2
|
export { CellDecoration, OdtCoveredTableCell, OdtTable, OdtTableCell, OdtTableRow, TableInit, buildCellStyle, buildTable, readCellDecoration };
|