ooxml-core 1.10.0 → 1.11.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/PptxHandler-DNZHAHUY.cjs +12 -0
- package/dist/PptxHandler-E44KDHMQ.mjs +3 -0
- package/dist/{PptxHandler-ADEFY476.mjs → PptxHandler-NROFYT2N.mjs} +2 -2
- package/dist/automation/index.cjs +3293 -2867
- package/dist/automation/index.mjs +3293 -2867
- package/dist/{chunk-3N6XMMTT.cjs → chunk-2UVH6RHI.cjs} +1138 -996
- package/dist/{chunk-ZOUGMAZG.mjs → chunk-7DSZI7S6.mjs} +1 -1
- package/dist/{chunk-S6DOCMQC.cjs → chunk-7QZGRB3T.cjs} +0 -10
- package/dist/chunk-ANZ4Q6I3.cjs +21 -0
- package/dist/{chunk-5NVJN4E6.mjs → chunk-EC2W2MDY.mjs} +1 -1
- package/dist/chunk-EGTRL3QJ.mjs +19 -0
- package/dist/chunk-GXHKNSZX.mjs +9 -0
- package/dist/{chunk-CCHYFCPD.mjs → chunk-HCXUI5UC.mjs} +296 -103
- package/dist/chunk-HDQXPSHY.cjs +17 -0
- package/dist/chunk-KTYBFGEY.mjs +14 -0
- package/dist/chunk-QOO36KG4.cjs +42 -0
- package/dist/chunk-R2KZXD6U.mjs +39 -0
- package/dist/{chunk-A6P7G3UK.mjs → chunk-U2DF3EGK.mjs} +1 -1
- package/dist/{chunk-R6KSBNKX.mjs → chunk-UAY26XOI.mjs} +1 -9
- package/dist/{chunk-WUE5ZHU3.mjs → chunk-W5ARCUJB.mjs} +3 -3
- package/dist/chunk-XZPZHXV4.cjs +12 -0
- package/dist/{chunk-ZE53K7DH.mjs → chunk-YB5SRNFS.mjs} +244 -102
- package/dist/docx/layout/flow-table.d.ts.map +1 -1
- package/dist/docx/layout/index.cjs +125 -56
- package/dist/docx/layout/index.mjs +125 -56
- package/dist/docx/layout/nested-fragment-edges.d.ts +9 -0
- package/dist/docx/layout/nested-fragment-edges.d.ts.map +1 -0
- package/dist/docx/layout/result.d.ts +7 -0
- package/dist/docx/layout/result.d.ts.map +1 -1
- package/dist/docx/layout/table-border-layout.d.ts +1 -1
- package/dist/docx/layout/table-border-layout.d.ts.map +1 -1
- package/dist/docx/layout/table-cell-layout.d.ts +1 -1
- package/dist/docx/layout/table-cell-layout.d.ts.map +1 -1
- package/dist/docx/layout/table-frames.d.ts.map +1 -1
- package/dist/docx/layout/table-layout.d.ts +1 -1
- package/dist/docx/layout/table-layout.d.ts.map +1 -1
- package/dist/pptx/automation/index.cjs +266 -114
- package/dist/pptx/automation/index.d.ts +5 -4
- package/dist/pptx/automation/index.d.ts.map +1 -1
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{text-operations-BqHmLaLA.d.ts → elements-DD3UGOMd.d.ts} +17 -3262
- package/dist/pptx/chunks/elements-DD3UGOMd.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-DUCGeZh7.d.ts → index-BZrFyNtU.d.ts} +53 -5
- package/dist/pptx/chunks/index-BZrFyNtU.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-Cuxtr76Y.d.ts → index-DdX02BSm.d.ts} +5 -3
- package/dist/pptx/chunks/index-DdX02BSm.d.ts.map +1 -0
- package/dist/pptx/chunks/smart-art-ENMMEbmW.d.ts +1512 -0
- package/dist/pptx/chunks/smart-art-ENMMEbmW.d.ts.map +1 -0
- package/dist/pptx/chunks/text-D49FKllA.d.ts +1473 -0
- package/dist/pptx/chunks/text-D49FKllA.d.ts.map +1 -0
- package/dist/pptx/chunks/text-operations-CyMTMfID.d.ts +3261 -0
- package/dist/pptx/chunks/text-operations-CyMTMfID.d.ts.map +1 -0
- package/dist/pptx/cli/index.cjs +266 -114
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.cjs +17 -16
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/find-replace.mjs +2 -1
- package/dist/pptx/editor/render/font-family-update.cjs +14 -0
- package/dist/pptx/editor/render/font-family-update.d.ts +17 -0
- package/dist/pptx/editor/render/font-family-update.d.ts.map +1 -0
- package/dist/pptx/editor/render/font-family-update.mjs +1 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.cjs +14 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts +17 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.d.ts.map +1 -0
- package/dist/pptx/editor/render/paragraph-geometry-overrides.mjs +12 -0
- package/dist/pptx/editor/render/slide-operations.cjs +9 -8
- package/dist/pptx/editor/render/slide-operations.mjs +3 -2
- package/dist/pptx/editor/render/table-data-grid-ops.cjs +1 -1
- package/dist/pptx/editor/render/table-data-grid-ops.mjs +1 -1
- package/dist/pptx/editor/render/text-content-style.cjs +18 -0
- package/dist/pptx/editor/render/text-content-style.d.ts +9 -0
- package/dist/pptx/editor/render/text-content-style.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-content-style.mjs +5 -0
- package/dist/pptx/editor/render/text-runs-style-patch.cjs +17 -0
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +7 -0
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-runs-style-patch.mjs +15 -0
- package/dist/pptx/editor/render/text-style-scope.cjs +173 -0
- package/dist/pptx/editor/render/text-style-scope.d.ts +76 -0
- package/dist/pptx/editor/render/text-style-scope.d.ts.map +1 -0
- package/dist/pptx/editor/render/text-style-scope.mjs +164 -0
- package/dist/pptx/editor/render/theme-editor-model.cjs +1 -1
- package/dist/pptx/editor/render/theme-editor-model.mjs +1 -1
- package/dist/pptx/editor/render/update-text-segment-style.cjs +11 -0
- package/dist/pptx/editor/render/update-text-segment-style.d.ts +14 -0
- package/dist/pptx/editor/render/update-text-segment-style.d.ts.map +1 -0
- package/dist/pptx/editor/render/update-text-segment-style.mjs +2 -0
- package/dist/pptx/index.cjs +329 -114
- package/dist/pptx/index.d.ts +7 -5
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/smartart-layouts/index.d.ts +1 -1
- package/dist/teams/index.cjs +112 -16
- package/dist/teams/index.mjs +112 -16
- package/dist/visio/edit-commands.d.ts +3 -3
- package/dist/visio/edit-commands.d.ts.map +1 -1
- package/dist/visio/edit-formatting-scope.d.ts.map +1 -1
- package/dist/visio/edit-recalculate-index.d.ts.map +1 -1
- package/dist/visio/edit-text-field-commands.d.ts +15 -0
- package/dist/visio/edit-text-field-commands.d.ts.map +1 -1
- package/dist/visio/edit-text-field.d.ts +2 -2
- package/dist/visio/edit-text-field.d.ts.map +1 -1
- package/dist/visio/edit.d.ts +1 -1
- package/dist/visio/edit.d.ts.map +1 -1
- package/dist/visio/index.cjs +382 -210
- package/dist/visio/index.d.ts +1 -1
- package/dist/visio/index.d.ts.map +1 -1
- package/dist/visio/index.mjs +382 -210
- package/dist/visio/model.d.ts +6 -0
- package/dist/visio/model.d.ts.map +1 -1
- package/dist/visio/shapes.d.ts.map +1 -1
- package/dist/visio/style.d.ts +1 -1
- package/dist/visio/style.d.ts.map +1 -1
- package/dist/visio/text-field-display.d.ts +3 -0
- package/dist/visio/text-field-display.d.ts.map +1 -1
- package/dist/visio/text-field-editability.d.ts +6 -0
- package/dist/visio/text-field-editability.d.ts.map +1 -0
- package/dist/visio/text-field-independent.d.ts +4 -0
- package/dist/visio/text-field-independent.d.ts.map +1 -0
- package/dist/visio/text-field-source.d.ts +6 -0
- package/dist/visio/text-field-source.d.ts.map +1 -0
- package/dist/visio/ui/edit-commands.d.ts.map +1 -1
- package/dist/visio/ui/index.cjs +394 -211
- package/dist/visio/ui/index.mjs +394 -211
- package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
- package/dist/xlsx/edit/pivots.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +773 -514
- package/dist/xlsx/index.mjs +772 -515
- package/dist/xlsx/load/index.cjs +541 -292
- package/dist/xlsx/load/index.mjs +541 -292
- package/dist/xlsx/model-pivots.d.ts +8 -0
- package/dist/xlsx/model-pivots.d.ts.map +1 -1
- package/dist/xlsx/pivot/admission.d.ts.map +1 -1
- package/dist/xlsx/pivot/aggregate.d.ts.map +1 -1
- package/dist/xlsx/pivot/data.d.ts +2 -2
- package/dist/xlsx/pivot/data.d.ts.map +1 -1
- package/dist/xlsx/pivot/index.d.ts +2 -0
- package/dist/xlsx/pivot/index.d.ts.map +1 -1
- package/dist/xlsx/pivot/measures.d.ts +1 -1
- package/dist/xlsx/pivot/measures.d.ts.map +1 -1
- package/dist/xlsx/pivot/page-filter-admission.d.ts +5 -0
- package/dist/xlsx/pivot/page-filter-admission.d.ts.map +1 -0
- package/dist/xlsx/pivot/page-filter.d.ts +11 -0
- package/dist/xlsx/pivot/page-filter.d.ts.map +1 -0
- package/dist/xlsx/pivot/read.d.ts.map +1 -1
- package/dist/xlsx/pivot/table-xml.d.ts.map +1 -1
- package/dist/xlsx/pivot/values-axis.d.ts +4 -1
- package/dist/xlsx/pivot/values-axis.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/navigation.d.ts.map +1 -1
- package/dist/xlsx/ui/commands/i18n/pivots.d.ts.map +1 -1
- package/dist/xlsx/ui/index.cjs +95 -12
- package/dist/xlsx/ui/index.mjs +95 -12
- package/package.json +2 -2
- package/dist/PptxHandler-5UURGJEV.mjs +0 -2
- package/dist/PptxHandler-U5XB2HUE.cjs +0 -11
- package/dist/pptx/chunks/index-Cuxtr76Y.d.ts.map +0 -1
- package/dist/pptx/chunks/index-DUCGeZh7.d.ts.map +0 -1
- package/dist/pptx/chunks/smart-art-D-sXa_Nb.d.ts +0 -2980
- package/dist/pptx/chunks/smart-art-D-sXa_Nb.d.ts.map +0 -1
- package/dist/pptx/chunks/text-operations-BqHmLaLA.d.ts.map +0 -1
|
@@ -4897,6 +4897,74 @@ function widowControlEnabled(value) {
|
|
|
4897
4897
|
return value !== false;
|
|
4898
4898
|
}
|
|
4899
4899
|
|
|
4900
|
+
// docx/layout/nested-frame-profile.ts
|
|
4901
|
+
var equal = (a, b) => a !== void 0 && b !== void 0 && a.style === b.style && a.color === b.color && Math.abs(a.widthPx - b.widthPx) < 1e-6;
|
|
4902
|
+
function nestedFrameProfile(table, tableWidthPx = table.widthPx) {
|
|
4903
|
+
const sides = table.rows.flatMap(
|
|
4904
|
+
(row) => row.cells.flatMap(
|
|
4905
|
+
(cell) => ["top", "right", "bottom", "left"].map((side) => cell.borders?.[side])
|
|
4906
|
+
)
|
|
4907
|
+
);
|
|
4908
|
+
if (sides.every((side) => !side)) return { leftPx: 0, rightPx: 0, bottomPx: 0 };
|
|
4909
|
+
if (!sides.every((side) => side?.style === "solid" && side.widthPx > 0)) return void 0;
|
|
4910
|
+
const first3 = table.rows[0], left = first3.cells[0].borders.left, right = first3.cells.at(-1).borders.right;
|
|
4911
|
+
for (const [index, row] of table.rows.entries()) {
|
|
4912
|
+
if (row.cells.length !== first3.cells.length || !equal(row.cells[0]?.borders?.left, left) || !equal(row.cells.at(-1)?.borders?.right, right))
|
|
4913
|
+
return void 0;
|
|
4914
|
+
for (const [column, cell] of row.cells.entries()) {
|
|
4915
|
+
const sourceWidth = cell.widthPx ?? (tableWidthPx === void 0 ? void 0 : tableWidthPx / row.cells.length);
|
|
4916
|
+
const paintWidth = sourceWidth === void 0 ? void 0 : sourceWidth + (cell.borders.left.widthPx - cell.borders.right.widthPx) / 2 + (column === row.cells.length - 1 ? cell.borders.right.widthPx : 0);
|
|
4917
|
+
if (paintWidth !== void 0 && paintWidth <= 0) return void 0;
|
|
4918
|
+
if (!equal(cell.borders?.top, row.cells[0]?.borders?.top) || !equal(cell.borders?.bottom, row.cells[0]?.borders?.bottom))
|
|
4919
|
+
return void 0;
|
|
4920
|
+
if (column && !equal(row.cells[column - 1]?.borders?.right, cell.borders?.left))
|
|
4921
|
+
return void 0;
|
|
4922
|
+
if (index) {
|
|
4923
|
+
const previous = table.rows[index - 1].cells[column];
|
|
4924
|
+
if (previous.xPx !== cell.xPx || previous.widthPx !== cell.widthPx || !equal(previous.borders?.bottom, cell.borders?.top))
|
|
4925
|
+
return void 0;
|
|
4926
|
+
}
|
|
4927
|
+
}
|
|
4928
|
+
}
|
|
4929
|
+
return {
|
|
4930
|
+
leftPx: left.widthPx,
|
|
4931
|
+
rightPx: right.widthPx,
|
|
4932
|
+
bottomPx: table.rows.at(-1).cells[0].borders.bottom.widthPx
|
|
4933
|
+
};
|
|
4934
|
+
}
|
|
4935
|
+
|
|
4936
|
+
// docx/layout/nested-fragment-edges.ts
|
|
4937
|
+
var plain = (paragraph) => !paragraph.keepLines && !paragraph.keepNext && !paragraph.pageBreakBefore && !paragraph.footnotes?.length && !paragraph.runs.some((run) => run.footnoteReferenceId !== void 0 || run.breakAfter);
|
|
4938
|
+
function nestedFragmentEdges(table) {
|
|
4939
|
+
if (table.widthPx === void 0 || !Number.isFinite(table.widthPx) || table.widthPx <= 0 || table.rows.length < 2 || !nestedFrameProfile(table, table.widthPx) || table.rows.some(
|
|
4940
|
+
(row) => row.heightPx !== void 0 || row.cantSplit || row.isHeader || row.cells.length !== 2 || row.cells.some(
|
|
4941
|
+
(cell) => cell.verticalAlign && cell.verticalAlign !== "top" || cell.blocks?.some((block) => block.kind !== "paragraph") || !(cell.blocks ?? cell.paragraphs).every(
|
|
4942
|
+
(block) => block.kind === "paragraph" && plain(block)
|
|
4943
|
+
)
|
|
4944
|
+
)
|
|
4945
|
+
))
|
|
4946
|
+
return void 0;
|
|
4947
|
+
const top = table.rows[0].cells.map((cell) => cell.borders?.top);
|
|
4948
|
+
const bottom = table.rows.at(-1).cells.map((cell) => cell.borders?.bottom);
|
|
4949
|
+
return top.every(Boolean) && bottom.every(Boolean) ? { top, bottom } : void 0;
|
|
4950
|
+
}
|
|
4951
|
+
function reflowNestedFragments(row) {
|
|
4952
|
+
if (row.heightPx !== void 0 || row.cantSplit || row.isHeader || row.cells.length !== 2)
|
|
4953
|
+
return false;
|
|
4954
|
+
let tables = 0;
|
|
4955
|
+
for (const cell of row.cells) {
|
|
4956
|
+
if (cell.verticalAlign && cell.verticalAlign !== "top") return false;
|
|
4957
|
+
for (const [index, block] of (cell.blocks ?? cell.paragraphs).entries()) {
|
|
4958
|
+
if (block.kind === "paragraph") {
|
|
4959
|
+
if (!plain(block)) return false;
|
|
4960
|
+
} else {
|
|
4961
|
+
if (index !== 0 || !nestedFragmentEdges(block) || ++tables > 1) return false;
|
|
4962
|
+
}
|
|
4963
|
+
}
|
|
4964
|
+
}
|
|
4965
|
+
return tables === 1;
|
|
4966
|
+
}
|
|
4967
|
+
|
|
4900
4968
|
// docx/layout/table-content.ts
|
|
4901
4969
|
function cellContentBottom(boxes, paddingBottom = 0) {
|
|
4902
4970
|
return Math.max(
|
|
@@ -4930,44 +4998,21 @@ function clipTableFrames(tables, start, end, inset = 0) {
|
|
|
4930
4998
|
}
|
|
4931
4999
|
];
|
|
4932
5000
|
});
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
);
|
|
4945
|
-
if (sides.every((side) => !side)) return { leftPx: 0, rightPx: 0, bottomPx: 0 };
|
|
4946
|
-
if (!sides.every((side) => side?.style === "solid" && side.widthPx > 0)) return void 0;
|
|
4947
|
-
const first3 = table.rows[0], left = first3.cells[0].borders.left, right = first3.cells.at(-1).borders.right;
|
|
4948
|
-
for (const [index, row] of table.rows.entries()) {
|
|
4949
|
-
if (row.cells.length !== first3.cells.length || !equal(row.cells[0]?.borders?.left, left) || !equal(row.cells.at(-1)?.borders?.right, right))
|
|
4950
|
-
return void 0;
|
|
4951
|
-
for (const [column, cell] of row.cells.entries()) {
|
|
4952
|
-
const sourceWidth = cell.widthPx ?? (tableWidthPx === void 0 ? void 0 : tableWidthPx / row.cells.length);
|
|
4953
|
-
const paintWidth = sourceWidth === void 0 ? void 0 : sourceWidth + (cell.borders.left.widthPx - cell.borders.right.widthPx) / 2 + (column === row.cells.length - 1 ? cell.borders.right.widthPx : 0);
|
|
4954
|
-
if (paintWidth !== void 0 && paintWidth <= 0) return void 0;
|
|
4955
|
-
if (!equal(cell.borders?.top, row.cells[0]?.borders?.top) || !equal(cell.borders?.bottom, row.cells[0]?.borders?.bottom))
|
|
4956
|
-
return void 0;
|
|
4957
|
-
if (column && !equal(row.cells[column - 1]?.borders?.right, cell.borders?.left))
|
|
4958
|
-
return void 0;
|
|
4959
|
-
if (index) {
|
|
4960
|
-
const previous = table.rows[index - 1].cells[column];
|
|
4961
|
-
if (previous.xPx !== cell.xPx || previous.widthPx !== cell.widthPx || !equal(previous.borders?.bottom, cell.borders?.top))
|
|
4962
|
-
return void 0;
|
|
5001
|
+
if (table.fragmentEdges && rows.length) {
|
|
5002
|
+
const edges = table.fragmentEdges;
|
|
5003
|
+
for (const [row, side] of [
|
|
5004
|
+
[rows[0], "top"],
|
|
5005
|
+
[rows.at(-1), "bottom"]
|
|
5006
|
+
]) {
|
|
5007
|
+
if (row.geometry)
|
|
5008
|
+
row.geometry = row.geometry.map((cell, index) => ({
|
|
5009
|
+
...cell,
|
|
5010
|
+
borders: { ...cell.borders, [side]: edges[side][index] }
|
|
5011
|
+
}));
|
|
4963
5012
|
}
|
|
4964
5013
|
}
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
leftPx: left.widthPx,
|
|
4968
|
-
rightPx: right.widthPx,
|
|
4969
|
-
bottomPx: table.rows.at(-1).cells[0].borders.bottom.widthPx
|
|
4970
|
-
};
|
|
5014
|
+
return [{ ...table, yPx: top - start + inset, heightPx: bottom - top, rows }];
|
|
5015
|
+
});
|
|
4971
5016
|
}
|
|
4972
5017
|
|
|
4973
5018
|
// docx/layout/table-cell-layout.ts
|
|
@@ -4977,7 +5022,7 @@ function cellParagraphs(cell) {
|
|
|
4977
5022
|
);
|
|
4978
5023
|
return cell.blocks ? walk(cell.blocks) : cell.paragraphs;
|
|
4979
5024
|
}
|
|
4980
|
-
function stackCellBlocks(cell, width, measurer, note, top, starts) {
|
|
5025
|
+
function stackCellBlocks(cell, width, measurer, note, top, starts, physicalFragments = false) {
|
|
4981
5026
|
if (!cell.blocks)
|
|
4982
5027
|
return stackParagraphs(
|
|
4983
5028
|
starts ? cell.paragraphs.filter((p) => starts.has(p.id)) : cell.paragraphs,
|
|
@@ -4998,6 +5043,7 @@ function stackCellBlocks(cell, width, measurer, note, top, starts) {
|
|
|
4998
5043
|
y = result.heightPx;
|
|
4999
5044
|
continue;
|
|
5000
5045
|
}
|
|
5046
|
+
const edges = physicalFragments ? nestedFragmentEdges(block) : void 0;
|
|
5001
5047
|
const tableWidth = block.widthPx ?? width;
|
|
5002
5048
|
const profile = nestedFrameProfile(block, tableWidth);
|
|
5003
5049
|
const reserveBorders = profile !== void 0;
|
|
@@ -5015,13 +5061,21 @@ function stackCellBlocks(cell, width, measurer, note, top, starts) {
|
|
|
5015
5061
|
widthPx: paintedWidth,
|
|
5016
5062
|
yPx: y,
|
|
5017
5063
|
heightPx: 0,
|
|
5018
|
-
rows: []
|
|
5064
|
+
rows: [],
|
|
5065
|
+
...edges ? { fragmentEdges: edges } : {}
|
|
5019
5066
|
};
|
|
5020
5067
|
for (const row of block.rows) {
|
|
5021
5068
|
if (starts && !row.cells.some((nested) => cellParagraphs(nested).some((p) => starts.has(p.id))))
|
|
5022
5069
|
continue;
|
|
5070
|
+
const visibleRow = edges && starts && !frame.rows.length ? {
|
|
5071
|
+
...row,
|
|
5072
|
+
cells: row.cells.map((cell2, index) => ({
|
|
5073
|
+
...cell2,
|
|
5074
|
+
borders: { ...cell2.borders, top: edges.top[index] }
|
|
5075
|
+
}))
|
|
5076
|
+
} : row;
|
|
5023
5077
|
const layout = layoutRow(
|
|
5024
|
-
|
|
5078
|
+
visibleRow,
|
|
5025
5079
|
tableWidth,
|
|
5026
5080
|
measurer,
|
|
5027
5081
|
note,
|
|
@@ -5047,6 +5101,7 @@ function stackCellBlocks(cell, width, measurer, note, top, starts) {
|
|
|
5047
5101
|
xPx: x + geometry.xPx + geometry.paddingLeftPx + (paragraph.xPx ?? 0),
|
|
5048
5102
|
widthPx: paragraph.widthPx ?? Math.max(1, geometry.widthPx - geometry.paddingLeftPx - geometry.paddingRightPx),
|
|
5049
5103
|
readOnly: true,
|
|
5104
|
+
...edges ? { tableFragmentBottomPx: edges.bottom[index].widthPx } : {},
|
|
5050
5105
|
tableFrameInsets: {
|
|
5051
5106
|
top: (paragraph.tableFrameInsets?.top ?? 0) + (reserveBorders ? geometry.borders?.top?.widthPx ?? 0 : 0),
|
|
5052
5107
|
bottom: (paragraph.tableFrameInsets?.bottom ?? 0) + (reserveBorders ? geometry.borders?.bottom?.widthPx ?? 0 : 0)
|
|
@@ -5095,7 +5150,7 @@ function stackParagraphs(paragraphs, widthPx, measurer, note, topPx = 0, startTo
|
|
|
5095
5150
|
}
|
|
5096
5151
|
return { heightPx: y, boxes };
|
|
5097
5152
|
}
|
|
5098
|
-
function layoutRow(row, tableWidthPx, measurer, note, remaining, startTokens, frameBorders = false, frameLeftBorderPx) {
|
|
5153
|
+
function layoutRow(row, tableWidthPx, measurer, note, remaining, startTokens, frameBorders = false, frameLeftBorderPx, physicalFragments = reflowNestedFragments(row)) {
|
|
5099
5154
|
const count = row.cells.length || 1;
|
|
5100
5155
|
let x = 0;
|
|
5101
5156
|
const geometry = [];
|
|
@@ -5121,7 +5176,8 @@ function layoutRow(row, tableWidthPx, measurer, note, remaining, startTokens, fr
|
|
|
5121
5176
|
measurer,
|
|
5122
5177
|
note,
|
|
5123
5178
|
padding.top,
|
|
5124
|
-
starts
|
|
5179
|
+
starts,
|
|
5180
|
+
physicalFragments
|
|
5125
5181
|
);
|
|
5126
5182
|
const heightPx2 = content2.heightPx + padding.bottom;
|
|
5127
5183
|
geometry.push({
|
|
@@ -5158,16 +5214,16 @@ function splitCellAtHeight(boxes, cutHeightPx, paragraphCuts) {
|
|
|
5158
5214
|
let beforeHeightPx = 0;
|
|
5159
5215
|
for (const box of boxes) {
|
|
5160
5216
|
const cut = paragraphCuts?.get(box.blockId) ?? cutHeightPx;
|
|
5161
|
-
if (box.yPx + box.heightPx + (box.tableFrameInsets?.bottom ?? 0) <= cut) {
|
|
5217
|
+
if (box.yPx + box.heightPx + (box.tableFragmentBottomPx ?? box.tableFrameInsets?.bottom ?? 0) <= cut) {
|
|
5162
5218
|
before.push(box);
|
|
5163
5219
|
beforeHeightPx = Math.max(
|
|
5164
5220
|
beforeHeightPx,
|
|
5165
|
-
box.yPx + box.heightPx + (box.tableFrameInsets?.bottom ?? 0)
|
|
5221
|
+
box.yPx + box.heightPx + (box.tableFragmentBottomPx ?? box.tableFrameInsets?.bottom ?? 0)
|
|
5166
5222
|
);
|
|
5167
5223
|
continue;
|
|
5168
5224
|
}
|
|
5169
5225
|
const beforeLines = box.lines.filter(
|
|
5170
|
-
(line2) => box.yPx + line2.yPx + line2.heightPx + (box.tableFrameInsets?.bottom ?? 0) <= cut
|
|
5226
|
+
(line2) => box.yPx + line2.yPx + line2.heightPx + (box.tableFragmentBottomPx ?? box.tableFrameInsets?.bottom ?? 0) <= cut
|
|
5171
5227
|
);
|
|
5172
5228
|
const afterLines = box.lines.slice(beforeLines.length);
|
|
5173
5229
|
if (beforeLines.length) {
|
|
@@ -5175,7 +5231,7 @@ function splitCellAtHeight(boxes, cutHeightPx, paragraphCuts) {
|
|
|
5175
5231
|
before.push({ ...box, heightPx: bottom, lines: beforeLines });
|
|
5176
5232
|
beforeHeightPx = Math.max(
|
|
5177
5233
|
beforeHeightPx,
|
|
5178
|
-
box.yPx + bottom + (box.tableFrameInsets?.bottom ?? 0)
|
|
5234
|
+
box.yPx + bottom + (box.tableFragmentBottomPx ?? box.tableFrameInsets?.bottom ?? 0)
|
|
5179
5235
|
);
|
|
5180
5236
|
}
|
|
5181
5237
|
if (afterLines.length) {
|
|
@@ -6022,7 +6078,7 @@ function measuredNoteReferences(paragraphs) {
|
|
|
6022
6078
|
}
|
|
6023
6079
|
|
|
6024
6080
|
// docx/layout/table-border-layout.ts
|
|
6025
|
-
function layoutBorderedRow(row, width, measurer, note, profile, remaining) {
|
|
6081
|
+
function layoutBorderedRow(row, width, measurer, note, profile, remaining, physicalFragments) {
|
|
6026
6082
|
const reserved = profile !== void 0 && (profile.leftPx > 0 || profile.rightPx > 0 || profile.bottomPx > 0);
|
|
6027
6083
|
const layout = layoutRow(
|
|
6028
6084
|
row,
|
|
@@ -6032,7 +6088,8 @@ function layoutBorderedRow(row, width, measurer, note, profile, remaining) {
|
|
|
6032
6088
|
remaining,
|
|
6033
6089
|
void 0,
|
|
6034
6090
|
reserved,
|
|
6035
|
-
profile?.leftPx
|
|
6091
|
+
profile?.leftPx,
|
|
6092
|
+
physicalFragments
|
|
6036
6093
|
);
|
|
6037
6094
|
if (!reserved) return layout;
|
|
6038
6095
|
const bottom = Math.max(0, ...layout.geometry.map((cell) => cell.borders?.bottom?.widthPx ?? 0));
|
|
@@ -6332,6 +6389,7 @@ var TableFootnotes = class {
|
|
|
6332
6389
|
function placeTable(cursor, table, measurer, note, resolveFootnotes) {
|
|
6333
6390
|
const firstBodyRow = table.rows.findIndex((row) => !row.isHeader);
|
|
6334
6391
|
const headerRows = table.rows.slice(0, firstBodyRow < 0 ? table.rows.length : firstBodyRow);
|
|
6392
|
+
const nativeFragments = new Map(table.rows.map((row) => [row, reflowNestedFragments(row)]));
|
|
6335
6393
|
const xPosition = () => {
|
|
6336
6394
|
const width = (table.widthPx ?? cursor.columnWidthPx) + (activeBorders ? (profile.leftPx + profile.rightPx) / 2 : 0);
|
|
6337
6395
|
return table.alignment === "center" ? Math.max(0, (cursor.columnWidthPx - width) / 2) : table.alignment === "right" ? Math.max(0, cursor.columnWidthPx - width) : table.indentPx ?? 0;
|
|
@@ -6342,13 +6400,14 @@ function placeTable(cursor, table, measurer, note, resolveFootnotes) {
|
|
|
6342
6400
|
note(
|
|
6343
6401
|
"Ordinary table border occupancy remains approximate for missing edges, non-solid or conflicting shared borders and changing row grids."
|
|
6344
6402
|
);
|
|
6345
|
-
const layoutRow2 = (row, width, m, n2, remaining) => layoutBorderedRow(
|
|
6403
|
+
const layoutRow2 = (row, width, m, n2, remaining, sourceRow = row) => layoutBorderedRow(
|
|
6346
6404
|
row,
|
|
6347
6405
|
activeBorders ? table.widthPx ?? width : width,
|
|
6348
6406
|
m,
|
|
6349
6407
|
n2,
|
|
6350
6408
|
profile,
|
|
6351
|
-
remaining
|
|
6409
|
+
remaining,
|
|
6410
|
+
nativeFragments.get(sourceRow) ?? false
|
|
6352
6411
|
);
|
|
6353
6412
|
const fragmentBorders = new TableFragmentBorders();
|
|
6354
6413
|
let fragmentRows = [];
|
|
@@ -6421,7 +6480,8 @@ function placeTable(cursor, table, measurer, note, resolveFootnotes) {
|
|
|
6421
6480
|
cursor.columnWidthPx,
|
|
6422
6481
|
measurer,
|
|
6423
6482
|
note,
|
|
6424
|
-
remainingRow.cells
|
|
6483
|
+
remainingRow.cells,
|
|
6484
|
+
row
|
|
6425
6485
|
);
|
|
6426
6486
|
if (fragmentRows.length) {
|
|
6427
6487
|
fragmentRows = [];
|
|
@@ -6453,7 +6513,8 @@ function placeTable(cursor, table, measurer, note, resolveFootnotes) {
|
|
|
6453
6513
|
cursor.columnWidthPx,
|
|
6454
6514
|
measurer,
|
|
6455
6515
|
note,
|
|
6456
|
-
after2.cells
|
|
6516
|
+
after2.cells,
|
|
6517
|
+
row
|
|
6457
6518
|
) : after2;
|
|
6458
6519
|
continue;
|
|
6459
6520
|
}
|
|
@@ -6466,7 +6527,8 @@ function placeTable(cursor, table, measurer, note, resolveFootnotes) {
|
|
|
6466
6527
|
cursor.columnWidthPx,
|
|
6467
6528
|
measurer,
|
|
6468
6529
|
note,
|
|
6469
|
-
remainingRow === initial ? void 0 : remainingRow.cells
|
|
6530
|
+
remainingRow === initial ? void 0 : remainingRow.cells,
|
|
6531
|
+
row
|
|
6470
6532
|
);
|
|
6471
6533
|
continue;
|
|
6472
6534
|
}
|
|
@@ -6513,17 +6575,24 @@ function placeTable(cursor, table, measurer, note, resolveFootnotes) {
|
|
|
6513
6575
|
const previousWidth = cursor.columnWidthPx;
|
|
6514
6576
|
if (before.cells.some((cell) => cell.length)) fragmentRows.push(toRowBox(before, false));
|
|
6515
6577
|
startNewFragment();
|
|
6516
|
-
remainingRow = after && previousWidth !== cursor.columnWidthPx ? layoutRow2(
|
|
6578
|
+
remainingRow = after && (previousWidth !== cursor.columnWidthPx || nativeFragments.get(row)) ? layoutRow2(
|
|
6517
6579
|
{ ...row, heightPx: 0, heightRule: "atLeast" },
|
|
6518
6580
|
cursor.columnWidthPx,
|
|
6519
6581
|
measurer,
|
|
6520
6582
|
note,
|
|
6521
|
-
after.cells
|
|
6583
|
+
after.cells,
|
|
6584
|
+
row
|
|
6522
6585
|
) : after;
|
|
6523
6586
|
}
|
|
6524
6587
|
}
|
|
6525
6588
|
for (const row of table.rows) {
|
|
6526
6589
|
const layout = layoutRow2(row, cursor.columnWidthPx, measurer, note);
|
|
6590
|
+
if (layout.heightPx > cursor.remainingHeightPx() && !nativeFragments.get(row) && row.cells.some(
|
|
6591
|
+
(cell) => cell.blocks?.some((block) => block.kind === "table" && block.rows.length > 1)
|
|
6592
|
+
))
|
|
6593
|
+
note(
|
|
6594
|
+
"Nested physical border edges at page cuts remain approximate outside automatic, top-aligned tables with two or more two-cell, note-free rows, direct paragraphs and complete shared borders."
|
|
6595
|
+
);
|
|
6527
6596
|
if (activeBorders && layout.heightPx > cursor.remainingHeightPx() && row.cells.some(
|
|
6528
6597
|
(cell) => (!measuredNoteReferences(row.cells.flatMap(cellParagraphs)) || !independentNoteStories(cell)) && cell.blocks?.some((block) => block.kind === "table") && cellParagraphs(cell).some((p) => p.footnotes?.length)
|
|
6529
6598
|
))
|
|
@@ -6787,9 +6856,9 @@ var SectionFlow = class {
|
|
|
6787
6856
|
const page = this.cursor.page;
|
|
6788
6857
|
const exclusions = this.exclusions?.get(page.index);
|
|
6789
6858
|
if (!exclusions) return void 0;
|
|
6790
|
-
const
|
|
6859
|
+
const plain2 = this.paragraphLayout(index);
|
|
6791
6860
|
const topPx = page.marginTopPx + this.cursor.y + spacingBeforePx;
|
|
6792
|
-
const bottomPx = topPx +
|
|
6861
|
+
const bottomPx = topPx + plain2.contentHeightPx;
|
|
6793
6862
|
if (!exclusions.some((item) => item.yPx < bottomPx && item.yPx + item.heightPx > topPx))
|
|
6794
6863
|
return void 0;
|
|
6795
6864
|
return layoutParagraph(
|