js.documents 14.1.1 → 14.3.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/convert/variant-bridges.cjs +2 -2
- package/dist/convert/variant-bridges.js +2 -2
- package/dist/diagnostics-C2-C2uUI.d.cts +17 -0
- package/dist/diagnostics-C2-C2uUI.d.ts +17 -0
- package/dist/{diagnostics-9twvwLNY.d.cts → diagnostics-CGWySzd-.d.cts} +1 -0
- package/dist/{diagnostics-9twvwLNY.d.ts → diagnostics-CGWySzd-.d.ts} +1 -0
- package/dist/edit/doc/table.cjs +3 -3
- package/dist/edit/doc/table.js +3 -3
- package/dist/edit/docx/content.cjs +14 -3
- package/dist/edit/docx/content.d.cts +2 -0
- package/dist/edit/docx/content.d.ts +2 -0
- package/dist/edit/docx/content.js +14 -3
- package/dist/edit/docx/diagnostics.cjs +7 -0
- package/dist/edit/docx/diagnostics.d.cts +2 -0
- package/dist/edit/docx/diagnostics.d.ts +2 -0
- package/dist/edit/docx/diagnostics.js +5 -0
- package/dist/edit/markdown/table.cjs +3 -3
- package/dist/edit/markdown/table.js +3 -3
- package/dist/edit/odp/slide.d.cts +1 -1
- package/dist/edit/odp/slide.d.ts +1 -1
- package/dist/edit/odt/content.cjs +4 -2
- package/dist/edit/odt/content.d.cts +2 -2
- package/dist/edit/odt/content.d.ts +2 -2
- package/dist/edit/odt/content.js +4 -2
- package/dist/edit/odt/editor.d.cts +1 -1
- package/dist/edit/odt/editor.d.ts +1 -1
- package/dist/edit/odt/table.cjs +59 -4
- package/dist/edit/odt/table.d.cts +1 -1
- package/dist/edit/odt/table.d.ts +1 -1
- package/dist/edit/odt/table.js +59 -4
- package/dist/edit/pptx/content.cjs +12 -1
- package/dist/edit/pptx/content.d.cts +1 -1
- package/dist/edit/pptx/content.d.ts +1 -1
- package/dist/edit/pptx/content.js +12 -1
- package/dist/edit/pptx/diagnostics.cjs +4 -1
- package/dist/edit/pptx/diagnostics.d.cts +1 -1
- package/dist/edit/pptx/diagnostics.d.ts +1 -1
- package/dist/edit/pptx/diagnostics.js +4 -1
- package/dist/edit/pptx/slide.d.cts +1 -1
- package/dist/edit/pptx/slide.d.ts +1 -1
- package/dist/edit/pptx/table.cjs +29 -3
- package/dist/edit/pptx/table.d.cts +1 -1
- package/dist/edit/pptx/table.d.ts +1 -1
- package/dist/edit/pptx/table.js +29 -3
- package/dist/edit/table-grid.cjs +2 -2
- package/dist/edit/table-grid.js +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/layout/engine.cjs +1 -1
- package/dist/layout/engine.js +1 -1
- package/dist/layout/reconstruct.cjs +6 -6
- package/dist/layout/reconstruct.js +6 -6
- package/dist/layout/shared.cjs +3 -2
- package/dist/layout/shared.js +3 -2
- package/dist/layout/slides.cjs +1 -1
- package/dist/layout/slides.js +1 -1
- package/dist/markdown/render.cjs +3 -3
- package/dist/markdown/render.js +3 -3
- package/dist/odb/report/render.cjs +1 -1
- package/dist/odb/report/render.js +1 -1
- package/dist/{table-BuNLtwgL.d.ts → table-B1uKqI0r.d.ts} +2 -0
- package/dist/{table-Cou5rKOo.d.ts → table-B5htMG3g.d.ts} +2 -0
- package/dist/{table-ukpjK2hS.d.cts → table-CxLN4l90.d.cts} +2 -0
- package/dist/{table-Bt9ahRyh.d.cts → table-DrE6jEWv.d.cts} +2 -0
- package/package.json +13 -13
package/dist/edit/odt/table.js
CHANGED
|
@@ -298,10 +298,7 @@ function placedCells(row, pkg) {
|
|
|
298
298
|
function resolveOdtGrid(table, pkg) {
|
|
299
299
|
const placedRows = [];
|
|
300
300
|
let declaredColumns = 0;
|
|
301
|
-
for (const
|
|
302
|
-
if (child.type !== "element") continue;
|
|
303
|
-
if (child.tag === "table:table-column") declaredColumns += readRunRepeatCount(child, COLUMN_REPEAT_ATTR);
|
|
304
|
-
}
|
|
301
|
+
for (const column of tableColumnElements(table)) declaredColumns += readRunRepeatCount(column, COLUMN_REPEAT_ATTR);
|
|
305
302
|
for (const row of tableRowElements(table)) placedRows.push(placedCells(row, pkg));
|
|
306
303
|
return resolveLiveTableGrid(placedRows, declaredColumns);
|
|
307
304
|
}
|
|
@@ -402,6 +399,26 @@ function tableRowEntries(parent, insideHeader = false) {
|
|
|
402
399
|
}
|
|
403
400
|
return entries;
|
|
404
401
|
}
|
|
402
|
+
const COLUMN_WRAPPER_TAGS = /* @__PURE__ */ new Set([
|
|
403
|
+
"table:table-columns",
|
|
404
|
+
"table:table-header-columns",
|
|
405
|
+
"table:table-column-group"
|
|
406
|
+
]);
|
|
407
|
+
function tableColumnEntries(parent, insideHeader = false) {
|
|
408
|
+
const entries = [];
|
|
409
|
+
for (const child of parent.children) {
|
|
410
|
+
if (child.type !== "element") continue;
|
|
411
|
+
if (child.tag === "table:table-column") entries.push({
|
|
412
|
+
element: child,
|
|
413
|
+
insideHeader
|
|
414
|
+
});
|
|
415
|
+
else if (COLUMN_WRAPPER_TAGS.has(child.tag)) entries.push(...tableColumnEntries(child, insideHeader || child.tag === "table:table-header-columns"));
|
|
416
|
+
}
|
|
417
|
+
return entries;
|
|
418
|
+
}
|
|
419
|
+
function tableColumnElements(table) {
|
|
420
|
+
return tableColumnEntries(table).map((entry) => entry.element);
|
|
421
|
+
}
|
|
405
422
|
var OdtTableRow = class {
|
|
406
423
|
node;
|
|
407
424
|
pkg;
|
|
@@ -528,6 +545,44 @@ var OdtTable = class {
|
|
|
528
545
|
if (!placed) rest.push(...regrouped);
|
|
529
546
|
table.children = rest;
|
|
530
547
|
}
|
|
548
|
+
headerColumns() {
|
|
549
|
+
return tableColumnEntries(this.live()).map((entry) => entry.insideHeader);
|
|
550
|
+
}
|
|
551
|
+
setHeaderColumns(flags) {
|
|
552
|
+
const table = this.live();
|
|
553
|
+
const columns = tableColumnElements(table);
|
|
554
|
+
const regrouped = [];
|
|
555
|
+
let run = [];
|
|
556
|
+
const closeRun = () => {
|
|
557
|
+
if (run.length > 0) {
|
|
558
|
+
regrouped.push(el("table:table-header-columns", {}, run));
|
|
559
|
+
run = [];
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
columns.forEach((column, index) => {
|
|
563
|
+
if (flags[index] === true) {
|
|
564
|
+
run.push(column);
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
closeRun();
|
|
568
|
+
regrouped.push(column);
|
|
569
|
+
});
|
|
570
|
+
closeRun();
|
|
571
|
+
const rest = [];
|
|
572
|
+
let placed = false;
|
|
573
|
+
for (const child of table.children) {
|
|
574
|
+
if (!(child.type === "element" && (child.tag === "table:table-column" || COLUMN_WRAPPER_TAGS.has(child.tag)))) {
|
|
575
|
+
rest.push(child);
|
|
576
|
+
continue;
|
|
577
|
+
}
|
|
578
|
+
if (!placed) {
|
|
579
|
+
rest.push(...regrouped);
|
|
580
|
+
placed = true;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
if (!placed) rest.push(...regrouped);
|
|
584
|
+
table.children = rest;
|
|
585
|
+
}
|
|
531
586
|
gridRows() {
|
|
532
587
|
return this.grid().rows;
|
|
533
588
|
}
|
|
@@ -64,7 +64,8 @@ function appendShape(slide, shape, options) {
|
|
|
64
64
|
table: {
|
|
65
65
|
rows: onlyBlock.rows.length,
|
|
66
66
|
columns: (0, document_schema_js.tableGridColumnCount)(onlyBlock),
|
|
67
|
-
columnWidthsPt: onlyBlock.
|
|
67
|
+
columnWidthsPt: onlyBlock.columns.map((c) => c.widthPt),
|
|
68
|
+
rowHeightsPt: onlyBlock.rows.map((r) => r.heightPt)
|
|
68
69
|
}
|
|
69
70
|
}), onlyBlock, options?.onDiagnostic ?? require_edit_pptx_diagnostics.NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, (url) => slide.registerHyperlink(url));
|
|
70
71
|
return;
|
|
@@ -115,8 +116,18 @@ function populateCellParagraphs(cell, blocks, resolveHyperlinkRId) {
|
|
|
115
116
|
}
|
|
116
117
|
cell.setParagraphs(paragraphs);
|
|
117
118
|
}
|
|
119
|
+
function reportDroppedHeaderColumns(block, onDiagnostic) {
|
|
120
|
+
block.columns.forEach((column, columnIndex) => {
|
|
121
|
+
if (column.isHeader === true) onDiagnostic({
|
|
122
|
+
code: require_edit_pptx_diagnostics.PptxWriteDiagnosticCodes.TABLE_HEADER_COLUMN_DROPPED,
|
|
123
|
+
severity: "warning",
|
|
124
|
+
message: `buildPptxPackage: table column ${String(columnIndex)} is a header column, and that is dropped; DrawingML has no header-column marker, so the column is written exactly as any other`
|
|
125
|
+
}, { sourcePath: block.sourcePath });
|
|
126
|
+
});
|
|
127
|
+
}
|
|
118
128
|
function populatePptxTable(table, block, onDiagnostic, resolveHyperlinkRId) {
|
|
119
129
|
require_edit_table_grid.assertTableObeysGridRule(block, "buildPptxPackage");
|
|
130
|
+
reportDroppedHeaderColumns(block, onDiagnostic);
|
|
120
131
|
(0, document_schema_js.walkTableGrid)(block).forEach((positions, rowIndex) => {
|
|
121
132
|
if (block.rows[rowIndex]?.isHeader === true) onDiagnostic({
|
|
122
133
|
code: require_edit_pptx_diagnostics.PptxWriteDiagnosticCodes.TABLE_HEADER_ROW_DROPPED,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as ClockPort } from "../../clock-C7SUuYN0.cjs";
|
|
2
2
|
import { t as OmmlDiagnosticSink } from "../../formula-BH1FBblm.cjs";
|
|
3
|
-
import { o as PptxWriteDiagnosticSink } from "../../diagnostics-
|
|
3
|
+
import { o as PptxWriteDiagnosticSink } from "../../diagnostics-CGWySzd-.cjs";
|
|
4
4
|
import { ContentDocument } from "document-schema.js";
|
|
5
5
|
import { EmbeddedPresentationSerialiser, Package } from "ooxml.js";
|
|
6
6
|
//#region src/edit/pptx/content.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as ClockPort } from "../../clock-C7SUuYN0.js";
|
|
2
2
|
import { t as OmmlDiagnosticSink } from "../../formula-DF4R1QEJ.js";
|
|
3
|
-
import { o as PptxWriteDiagnosticSink } from "../../diagnostics-
|
|
3
|
+
import { o as PptxWriteDiagnosticSink } from "../../diagnostics-CGWySzd-.js";
|
|
4
4
|
import { EmbeddedPresentationSerialiser, Package } from "ooxml.js";
|
|
5
5
|
import { ContentDocument } from "document-schema.js";
|
|
6
6
|
//#region src/edit/pptx/content.d.ts
|
|
@@ -63,7 +63,8 @@ function appendShape(slide, shape, options) {
|
|
|
63
63
|
table: {
|
|
64
64
|
rows: onlyBlock.rows.length,
|
|
65
65
|
columns: tableGridColumnCount(onlyBlock),
|
|
66
|
-
columnWidthsPt: onlyBlock.
|
|
66
|
+
columnWidthsPt: onlyBlock.columns.map((c) => c.widthPt),
|
|
67
|
+
rowHeightsPt: onlyBlock.rows.map((r) => r.heightPt)
|
|
67
68
|
}
|
|
68
69
|
}), onlyBlock, options?.onDiagnostic ?? NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, (url) => slide.registerHyperlink(url));
|
|
69
70
|
return;
|
|
@@ -114,8 +115,18 @@ function populateCellParagraphs(cell, blocks, resolveHyperlinkRId) {
|
|
|
114
115
|
}
|
|
115
116
|
cell.setParagraphs(paragraphs);
|
|
116
117
|
}
|
|
118
|
+
function reportDroppedHeaderColumns(block, onDiagnostic) {
|
|
119
|
+
block.columns.forEach((column, columnIndex) => {
|
|
120
|
+
if (column.isHeader === true) onDiagnostic({
|
|
121
|
+
code: PptxWriteDiagnosticCodes.TABLE_HEADER_COLUMN_DROPPED,
|
|
122
|
+
severity: "warning",
|
|
123
|
+
message: `buildPptxPackage: table column ${String(columnIndex)} is a header column, and that is dropped; DrawingML has no header-column marker, so the column is written exactly as any other`
|
|
124
|
+
}, { sourcePath: block.sourcePath });
|
|
125
|
+
});
|
|
126
|
+
}
|
|
117
127
|
function populatePptxTable(table, block, onDiagnostic, resolveHyperlinkRId) {
|
|
118
128
|
assertTableObeysGridRule(block, "buildPptxPackage");
|
|
129
|
+
reportDroppedHeaderColumns(block, onDiagnostic);
|
|
119
130
|
walkTableGrid(block).forEach((positions, rowIndex) => {
|
|
120
131
|
if (block.rows[rowIndex]?.isHeader === true) onDiagnostic({
|
|
121
132
|
code: PptxWriteDiagnosticCodes.TABLE_HEADER_ROW_DROPPED,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/edit/pptx/diagnostics.ts
|
|
3
|
-
const PptxWriteDiagnosticCodes = {
|
|
3
|
+
const PptxWriteDiagnosticCodes = {
|
|
4
|
+
TABLE_HEADER_ROW_DROPPED: "pptx-write/table-header-row-dropped",
|
|
5
|
+
TABLE_HEADER_COLUMN_DROPPED: "pptx-write/table-header-column-dropped"
|
|
6
|
+
};
|
|
4
7
|
const NOOP_PPTX_WRITE_DIAGNOSTIC_SINK = () => {};
|
|
5
8
|
//#endregion
|
|
6
9
|
exports.NOOP_PPTX_WRITE_DIAGNOSTIC_SINK = NOOP_PPTX_WRITE_DIAGNOSTIC_SINK;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as PptxWriteDiagnosticSeverity, i as PptxWriteDiagnosticCodes, n as PptxWriteDiagnostic, o as PptxWriteDiagnosticSink, r as PptxWriteDiagnosticCode, t as NOOP_PPTX_WRITE_DIAGNOSTIC_SINK } from "../../diagnostics-
|
|
1
|
+
import { a as PptxWriteDiagnosticSeverity, i as PptxWriteDiagnosticCodes, n as PptxWriteDiagnostic, o as PptxWriteDiagnosticSink, r as PptxWriteDiagnosticCode, t as NOOP_PPTX_WRITE_DIAGNOSTIC_SINK } from "../../diagnostics-CGWySzd-.cjs";
|
|
2
2
|
export { NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, PptxWriteDiagnostic, PptxWriteDiagnosticCode, PptxWriteDiagnosticCodes, PptxWriteDiagnosticSeverity, PptxWriteDiagnosticSink };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as PptxWriteDiagnosticSeverity, i as PptxWriteDiagnosticCodes, n as PptxWriteDiagnostic, o as PptxWriteDiagnosticSink, r as PptxWriteDiagnosticCode, t as NOOP_PPTX_WRITE_DIAGNOSTIC_SINK } from "../../diagnostics-
|
|
1
|
+
import { a as PptxWriteDiagnosticSeverity, i as PptxWriteDiagnosticCodes, n as PptxWriteDiagnostic, o as PptxWriteDiagnosticSink, r as PptxWriteDiagnosticCode, t as NOOP_PPTX_WRITE_DIAGNOSTIC_SINK } from "../../diagnostics-CGWySzd-.js";
|
|
2
2
|
export { NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, PptxWriteDiagnostic, PptxWriteDiagnosticCode, PptxWriteDiagnosticCodes, PptxWriteDiagnosticSeverity, PptxWriteDiagnosticSink };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
//#region src/edit/pptx/diagnostics.ts
|
|
2
|
-
const PptxWriteDiagnosticCodes = {
|
|
2
|
+
const PptxWriteDiagnosticCodes = {
|
|
3
|
+
TABLE_HEADER_ROW_DROPPED: "pptx-write/table-header-row-dropped",
|
|
4
|
+
TABLE_HEADER_COLUMN_DROPPED: "pptx-write/table-header-column-dropped"
|
|
5
|
+
};
|
|
3
6
|
const NOOP_PPTX_WRITE_DIAGNOSTIC_SINK = () => {};
|
|
4
7
|
//#endregion
|
|
5
8
|
export { NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, PptxWriteDiagnosticCodes };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as ImageInit } from "../../image-C3L2cCLQ.cjs";
|
|
2
2
|
import { r as PptxShape } from "../../shape-C2ef6uwC.cjs";
|
|
3
|
-
import { r as PptxTableInit, t as PptxTable } from "../../table-
|
|
3
|
+
import { r as PptxTableInit, t as PptxTable } from "../../table-CxLN4l90.cjs";
|
|
4
4
|
import { Box, ContentVector } from "document-schema.js";
|
|
5
5
|
import { Package, XmlElement, XmlNode } from "ooxml.js";
|
|
6
6
|
//#region src/edit/pptx/slide.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as ImageInit } from "../../image-CAeD6ZbR.js";
|
|
2
2
|
import { r as PptxShape } from "../../shape-DwZouh8R.js";
|
|
3
|
-
import { r as PptxTableInit, t as PptxTable } from "../../table-
|
|
3
|
+
import { r as PptxTableInit, t as PptxTable } from "../../table-B1uKqI0r.js";
|
|
4
4
|
import { Package, XmlElement, XmlNode } from "ooxml.js";
|
|
5
5
|
import { Box, ContentVector } from "document-schema.js";
|
|
6
6
|
//#region src/edit/pptx/slide.d.ts
|
package/dist/edit/pptx/table.cjs
CHANGED
|
@@ -15,6 +15,17 @@ const PPTX_TABLE_CELL_VERTICAL_ALIGN_ANCHOR = {
|
|
|
15
15
|
center: "ctr",
|
|
16
16
|
bottom: "b"
|
|
17
17
|
};
|
|
18
|
+
const PPTX_BORDER_STYLE_TO_DASH_VAL = {
|
|
19
|
+
solid: "solid",
|
|
20
|
+
dashed: "dash",
|
|
21
|
+
dotted: "sysDot"
|
|
22
|
+
};
|
|
23
|
+
const DASH_VAL_TO_PPTX_BORDER_STYLE = /* @__PURE__ */ new Map([
|
|
24
|
+
["solid", "solid"],
|
|
25
|
+
["dash", "dashed"],
|
|
26
|
+
["sysDot", "dotted"]
|
|
27
|
+
]);
|
|
28
|
+
const PPTX_BORDER_CMPD_DOUBLE = "dbl";
|
|
18
29
|
const ANCHOR_TABLE_CELL_VERTICAL_ALIGN = /* @__PURE__ */ new Map([
|
|
19
30
|
["t", "top"],
|
|
20
31
|
["ctr", "center"],
|
|
@@ -115,7 +126,12 @@ var PptxTableCell = class {
|
|
|
115
126
|
]) {
|
|
116
127
|
const border = value[key];
|
|
117
128
|
if (border === void 0) continue;
|
|
118
|
-
|
|
129
|
+
const lineChildren = [require_xml_fragment.el("a:solidFill", {}, [require_xml_fragment.el("a:srgbClr", { val: require_edit_drawingml_vector.drawingMlColorHex(border.color) })])];
|
|
130
|
+
const dashVal = border.style === void 0 ? void 0 : PPTX_BORDER_STYLE_TO_DASH_VAL[border.style];
|
|
131
|
+
if (dashVal !== void 0) lineChildren.push(require_xml_fragment.el("a:prstDash", { val: dashVal }));
|
|
132
|
+
const lineAttrs = { w: String(require_model_units.ptToEmu(border.widthPt)) };
|
|
133
|
+
if (border.style === "double") lineAttrs.cmpd = PPTX_BORDER_CMPD_DOUBLE;
|
|
134
|
+
tcPr.children.push(require_xml_fragment.el(tag, lineAttrs, lineChildren));
|
|
119
135
|
}
|
|
120
136
|
}
|
|
121
137
|
get verticalAlign() {
|
|
@@ -143,11 +159,20 @@ var PptxTableCell = class {
|
|
|
143
159
|
const srgbClr = solidFill === void 0 ? void 0 : require_xml_edit.directChildElement(solidFill, "a:srgbClr");
|
|
144
160
|
const hex = srgbClr === void 0 ? void 0 : (0, ooxml_js.attr)(srgbClr, "val");
|
|
145
161
|
if (hex === void 0) return;
|
|
162
|
+
const style = this.readBorderStyle(lnElement);
|
|
146
163
|
return {
|
|
147
164
|
color: (0, document_schema_js.rgbHexToColor)(hex),
|
|
148
|
-
widthPt
|
|
165
|
+
widthPt,
|
|
166
|
+
...style === void 0 ? {} : { style }
|
|
149
167
|
};
|
|
150
168
|
}
|
|
169
|
+
readBorderStyle(lnElement) {
|
|
170
|
+
if ((0, ooxml_js.attr)(lnElement, "cmpd") === PPTX_BORDER_CMPD_DOUBLE) return "double";
|
|
171
|
+
const prstDash = require_xml_edit.directChildElement(lnElement, "a:prstDash");
|
|
172
|
+
const dashVal = prstDash === void 0 ? void 0 : (0, ooxml_js.attr)(prstDash, "val");
|
|
173
|
+
if (dashVal === void 0) return;
|
|
174
|
+
return DASH_VAL_TO_PPTX_BORDER_STYLE.get(dashVal) ?? "solid";
|
|
175
|
+
}
|
|
151
176
|
setParagraphs(paragraphs) {
|
|
152
177
|
const txBody = require_xml_edit.directChildElement(this.node, "a:txBody");
|
|
153
178
|
if (txBody === void 0) return;
|
|
@@ -204,7 +229,8 @@ function buildDrawingTable(init) {
|
|
|
204
229
|
for (let r = 0; r < init.rows; r++) {
|
|
205
230
|
const cells = [];
|
|
206
231
|
for (let c = 0; c < init.columns; c++) cells.push(buildTableCellElement());
|
|
207
|
-
|
|
232
|
+
const heightPt = init.rowHeightsPt?.[r] ?? DEFAULT_ROW_HEIGHT_PT;
|
|
233
|
+
rows.push(require_xml_fragment.el("a:tr", { h: String(require_model_units.ptToEmu(heightPt)) }, cells));
|
|
208
234
|
}
|
|
209
235
|
return require_xml_fragment.el("a:tbl", {}, [
|
|
210
236
|
require_xml_fragment.el("a:tblPr"),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, s as findGraphicFrameTable, t as PptxTable } from "../../table-
|
|
1
|
+
import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, s as findGraphicFrameTable, t as PptxTable } from "../../table-CxLN4l90.cjs";
|
|
2
2
|
export { PptxTable, PptxTableCell, PptxTableInit, PptxTableRow, buildDrawingTable, buildTableGraphicFrame, findGraphicFrameTable };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, s as findGraphicFrameTable, t as PptxTable } from "../../table-
|
|
1
|
+
import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, s as findGraphicFrameTable, t as PptxTable } from "../../table-B1uKqI0r.js";
|
|
2
2
|
export { PptxTable, PptxTableCell, PptxTableInit, PptxTableRow, buildDrawingTable, buildTableGraphicFrame, findGraphicFrameTable };
|
package/dist/edit/pptx/table.js
CHANGED
|
@@ -14,6 +14,17 @@ const PPTX_TABLE_CELL_VERTICAL_ALIGN_ANCHOR = {
|
|
|
14
14
|
center: "ctr",
|
|
15
15
|
bottom: "b"
|
|
16
16
|
};
|
|
17
|
+
const PPTX_BORDER_STYLE_TO_DASH_VAL = {
|
|
18
|
+
solid: "solid",
|
|
19
|
+
dashed: "dash",
|
|
20
|
+
dotted: "sysDot"
|
|
21
|
+
};
|
|
22
|
+
const DASH_VAL_TO_PPTX_BORDER_STYLE = /* @__PURE__ */ new Map([
|
|
23
|
+
["solid", "solid"],
|
|
24
|
+
["dash", "dashed"],
|
|
25
|
+
["sysDot", "dotted"]
|
|
26
|
+
]);
|
|
27
|
+
const PPTX_BORDER_CMPD_DOUBLE = "dbl";
|
|
17
28
|
const ANCHOR_TABLE_CELL_VERTICAL_ALIGN = /* @__PURE__ */ new Map([
|
|
18
29
|
["t", "top"],
|
|
19
30
|
["ctr", "center"],
|
|
@@ -114,7 +125,12 @@ var PptxTableCell = class {
|
|
|
114
125
|
]) {
|
|
115
126
|
const border = value[key];
|
|
116
127
|
if (border === void 0) continue;
|
|
117
|
-
|
|
128
|
+
const lineChildren = [el("a:solidFill", {}, [el("a:srgbClr", { val: drawingMlColorHex(border.color) })])];
|
|
129
|
+
const dashVal = border.style === void 0 ? void 0 : PPTX_BORDER_STYLE_TO_DASH_VAL[border.style];
|
|
130
|
+
if (dashVal !== void 0) lineChildren.push(el("a:prstDash", { val: dashVal }));
|
|
131
|
+
const lineAttrs = { w: String(ptToEmu(border.widthPt)) };
|
|
132
|
+
if (border.style === "double") lineAttrs.cmpd = PPTX_BORDER_CMPD_DOUBLE;
|
|
133
|
+
tcPr.children.push(el(tag, lineAttrs, lineChildren));
|
|
118
134
|
}
|
|
119
135
|
}
|
|
120
136
|
get verticalAlign() {
|
|
@@ -142,11 +158,20 @@ var PptxTableCell = class {
|
|
|
142
158
|
const srgbClr = solidFill === void 0 ? void 0 : directChildElement(solidFill, "a:srgbClr");
|
|
143
159
|
const hex = srgbClr === void 0 ? void 0 : attr(srgbClr, "val");
|
|
144
160
|
if (hex === void 0) return;
|
|
161
|
+
const style = this.readBorderStyle(lnElement);
|
|
145
162
|
return {
|
|
146
163
|
color: rgbHexToColor(hex),
|
|
147
|
-
widthPt
|
|
164
|
+
widthPt,
|
|
165
|
+
...style === void 0 ? {} : { style }
|
|
148
166
|
};
|
|
149
167
|
}
|
|
168
|
+
readBorderStyle(lnElement) {
|
|
169
|
+
if (attr(lnElement, "cmpd") === PPTX_BORDER_CMPD_DOUBLE) return "double";
|
|
170
|
+
const prstDash = directChildElement(lnElement, "a:prstDash");
|
|
171
|
+
const dashVal = prstDash === void 0 ? void 0 : attr(prstDash, "val");
|
|
172
|
+
if (dashVal === void 0) return;
|
|
173
|
+
return DASH_VAL_TO_PPTX_BORDER_STYLE.get(dashVal) ?? "solid";
|
|
174
|
+
}
|
|
150
175
|
setParagraphs(paragraphs) {
|
|
151
176
|
const txBody = directChildElement(this.node, "a:txBody");
|
|
152
177
|
if (txBody === void 0) return;
|
|
@@ -203,7 +228,8 @@ function buildDrawingTable(init) {
|
|
|
203
228
|
for (let r = 0; r < init.rows; r++) {
|
|
204
229
|
const cells = [];
|
|
205
230
|
for (let c = 0; c < init.columns; c++) cells.push(buildTableCellElement());
|
|
206
|
-
|
|
231
|
+
const heightPt = init.rowHeightsPt?.[r] ?? DEFAULT_ROW_HEIGHT_PT;
|
|
232
|
+
rows.push(el("a:tr", { h: String(ptToEmu(heightPt)) }, cells));
|
|
207
233
|
}
|
|
208
234
|
return el("a:tbl", {}, [
|
|
209
235
|
el("a:tblPr"),
|
package/dist/edit/table-grid.cjs
CHANGED
|
@@ -22,7 +22,7 @@ function resolveLiveTableGrid(rows, declaredColumnCount) {
|
|
|
22
22
|
})) }));
|
|
23
23
|
const skeleton = {
|
|
24
24
|
kind: "table",
|
|
25
|
-
|
|
25
|
+
columns: [],
|
|
26
26
|
rows: (0, document_schema_js.denseTableRows)(positioned, declaredColumnCount)
|
|
27
27
|
};
|
|
28
28
|
const liveCells = /* @__PURE__ */ new Map();
|
|
@@ -51,7 +51,7 @@ function resolvePivotTableGrid(table, wrap) {
|
|
|
51
51
|
cell: wrap(cell),
|
|
52
52
|
colSpan: cell.colSpan,
|
|
53
53
|
rowSpan: cell.rowSpan
|
|
54
|
-
}))), table.
|
|
54
|
+
}))), table.columns.length);
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* Throws when `table` breaks the grid rule (ContentTableCell in document-schema.js), naming `entryPoint` and the fault. The edit layer's builders write a covered position as a marker with no content of its own (a docx vertical-merge continuation, an ODF `table:covered-table-cell`, a pptx `hMerge`/`vMerge` cell), so a table whose covered positions carry blocks or spans, whose rows disagree about the grid, or whose regions run past the grid or into each other has no faithful spelling: the builder would drop what a covered position held, or guess which of two regions a position belongs to.
|
package/dist/edit/table-grid.js
CHANGED
|
@@ -21,7 +21,7 @@ function resolveLiveTableGrid(rows, declaredColumnCount) {
|
|
|
21
21
|
})) }));
|
|
22
22
|
const skeleton = {
|
|
23
23
|
kind: "table",
|
|
24
|
-
|
|
24
|
+
columns: [],
|
|
25
25
|
rows: denseTableRows(positioned, declaredColumnCount)
|
|
26
26
|
};
|
|
27
27
|
const liveCells = /* @__PURE__ */ new Map();
|
|
@@ -50,7 +50,7 @@ function resolvePivotTableGrid(table, wrap) {
|
|
|
50
50
|
cell: wrap(cell),
|
|
51
51
|
colSpan: cell.colSpan,
|
|
52
52
|
rowSpan: cell.rowSpan
|
|
53
|
-
}))), table.
|
|
53
|
+
}))), table.columns.length);
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* Throws when `table` breaks the grid rule (ContentTableCell in document-schema.js), naming `entryPoint` and the fault. The edit layer's builders write a covered position as a marker with no content of its own (a docx vertical-merge continuation, an ODF `table:covered-table-cell`, a pptx `hMerge`/`vMerge` cell), so a table whose covered positions carry blocks or spans, whose rows disagree about the grid, or whose regions run past the grid or into each other has no faithful spelling: the builder would drop what a covered position held, or guess which of two regions a position belongs to.
|
package/dist/index.d.cts
CHANGED
|
@@ -47,7 +47,7 @@ import { OdgPage, PageImageInit, TextBoxInit } from "./edit/odg/page.cjs";
|
|
|
47
47
|
import { CreateOdgOptions, OdgEditor, createOdg, openOdg } from "./edit/odg/editor.cjs";
|
|
48
48
|
import { CreateEmptyOdgPackageOptions } from "./edit/odg/scaffold.cjs";
|
|
49
49
|
import { BuildOdpPackageOptions, buildOdpPackage } from "./edit/odp/content.cjs";
|
|
50
|
-
import { a as OdtTableRow, i as OdtTableCell, n as OdtCoveredTableCell, o as TableInit$2, r as OdtTable } from "./table-
|
|
50
|
+
import { a as OdtTableRow, i as OdtTableCell, n as OdtCoveredTableCell, o as TableInit$2, r as OdtTable } from "./table-DrE6jEWv.cjs";
|
|
51
51
|
import { OdpSlide, SlideImageInit, SlideTableInit, TextBoxInit as TextBoxInit$1 } from "./edit/odp/slide.cjs";
|
|
52
52
|
import { CreateOdpOptions, OdpEditor, createOdp, openOdp } from "./edit/odp/editor.cjs";
|
|
53
53
|
import { CreateEmptyOdpPackageOptions } from "./edit/odp/scaffold.cjs";
|
|
@@ -66,7 +66,7 @@ import { PptShape, PptSlide } from "./edit/ppt/slide.cjs";
|
|
|
66
66
|
import { CreatePptOptions, PptEditor, createPpt, openPpt } from "./edit/ppt/editor.cjs";
|
|
67
67
|
import { BuildPptxPackageOptions, buildPptxPackage, embeddedPresentationSerialiser } from "./edit/pptx/content.cjs";
|
|
68
68
|
import { n as DrawingRunInit, r as PptxShape, t as DrawingParagraphInit } from "./shape-C2ef6uwC.cjs";
|
|
69
|
-
import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-
|
|
69
|
+
import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-CxLN4l90.cjs";
|
|
70
70
|
import { PptxSlide, SlideImageInit as SlideImageInit$1, SlideTableInit as SlideTableInit$1, TextBoxInit as TextBoxInit$2 } from "./edit/pptx/slide.cjs";
|
|
71
71
|
import { CreatePptxOptions, PptxEditor, createPptx, openPptx } from "./edit/pptx/editor.cjs";
|
|
72
72
|
import { CreateEmptyPptxPackageOptions } from "./edit/pptx/scaffold.cjs";
|
package/dist/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ import { OdgPage, PageImageInit, TextBoxInit } from "./edit/odg/page.js";
|
|
|
47
47
|
import { CreateOdgOptions, OdgEditor, createOdg, openOdg } from "./edit/odg/editor.js";
|
|
48
48
|
import { CreateEmptyOdgPackageOptions } from "./edit/odg/scaffold.js";
|
|
49
49
|
import { BuildOdpPackageOptions, buildOdpPackage } from "./edit/odp/content.js";
|
|
50
|
-
import { a as OdtTableRow, i as OdtTableCell, n as OdtCoveredTableCell, o as TableInit$2, r as OdtTable } from "./table-
|
|
50
|
+
import { a as OdtTableRow, i as OdtTableCell, n as OdtCoveredTableCell, o as TableInit$2, r as OdtTable } from "./table-B5htMG3g.js";
|
|
51
51
|
import { OdpSlide, SlideImageInit, SlideTableInit, TextBoxInit as TextBoxInit$1 } from "./edit/odp/slide.js";
|
|
52
52
|
import { CreateOdpOptions, OdpEditor, createOdp, openOdp } from "./edit/odp/editor.js";
|
|
53
53
|
import { CreateEmptyOdpPackageOptions } from "./edit/odp/scaffold.js";
|
|
@@ -66,7 +66,7 @@ import { PptShape, PptSlide } from "./edit/ppt/slide.js";
|
|
|
66
66
|
import { CreatePptOptions, PptEditor, createPpt, openPpt } from "./edit/ppt/editor.js";
|
|
67
67
|
import { BuildPptxPackageOptions, buildPptxPackage, embeddedPresentationSerialiser } from "./edit/pptx/content.js";
|
|
68
68
|
import { n as DrawingRunInit, r as PptxShape, t as DrawingParagraphInit } from "./shape-DwZouh8R.js";
|
|
69
|
-
import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-
|
|
69
|
+
import { i as PptxTableRow, n as PptxTableCell, r as PptxTableInit, t as PptxTable } from "./table-B1uKqI0r.js";
|
|
70
70
|
import { PptxSlide, SlideImageInit as SlideImageInit$1, SlideTableInit as SlideTableInit$1, TextBoxInit as TextBoxInit$2 } from "./edit/pptx/slide.js";
|
|
71
71
|
import { CreatePptxOptions, PptxEditor, createPptx, openPptx } from "./edit/pptx/editor.js";
|
|
72
72
|
import { CreateEmptyPptxPackageOptions } from "./edit/pptx/scaffold.js";
|
package/dist/layout/engine.cjs
CHANGED
|
@@ -157,7 +157,7 @@ function layoutParagraphInCell(paragraph, cellLeftXDown, cellWidthPt, startYDown
|
|
|
157
157
|
return cursorYDown + (paragraph.spacingAfterPt ?? 0);
|
|
158
158
|
}
|
|
159
159
|
function layoutTableFlow(table, section, pages, state, contentLeftXDown, contentWidthPt, contentBottomYDown, measurer, listCounters) {
|
|
160
|
-
const gridWidthPt = table.
|
|
160
|
+
const gridWidthPt = table.columns.reduce((sum, c) => sum + c.widthPt, 0);
|
|
161
161
|
const scale = gridWidthPt > 0 ? contentWidthPt / gridWidthPt : 1;
|
|
162
162
|
for (const { row, anchors } of require_layout_shared.tableAnchorBoxes(table, scale)) {
|
|
163
163
|
const rowHeightPt = row.heightPt ?? require_layout_shared.estimateRowHeightPt(anchors, measurer);
|
package/dist/layout/engine.js
CHANGED
|
@@ -156,7 +156,7 @@ function layoutParagraphInCell(paragraph, cellLeftXDown, cellWidthPt, startYDown
|
|
|
156
156
|
return cursorYDown + (paragraph.spacingAfterPt ?? 0);
|
|
157
157
|
}
|
|
158
158
|
function layoutTableFlow(table, section, pages, state, contentLeftXDown, contentWidthPt, contentBottomYDown, measurer, listCounters) {
|
|
159
|
-
const gridWidthPt = table.
|
|
159
|
+
const gridWidthPt = table.columns.reduce((sum, c) => sum + c.widthPt, 0);
|
|
160
160
|
const scale = gridWidthPt > 0 ? contentWidthPt / gridWidthPt : 1;
|
|
161
161
|
for (const { row, anchors } of tableAnchorBoxes(table, scale)) {
|
|
162
162
|
const rowHeightPt = row.heightPt ?? estimateRowHeightPt(anchors, measurer);
|
|
@@ -1187,7 +1187,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
|
|
|
1187
1187
|
const rows = [...rowsById.values()].sort((a, b) => a.row.order - b.row.order);
|
|
1188
1188
|
for (const row of rows) row.cells.sort((a, b) => a.cell.order - b.cell.order);
|
|
1189
1189
|
const columnCount = Math.max(...rows.map((row) => row.cells.length));
|
|
1190
|
-
const
|
|
1190
|
+
const columns = [];
|
|
1191
1191
|
for (let j = 0; j < columnCount; j++) {
|
|
1192
1192
|
let minX = Number.POSITIVE_INFINITY;
|
|
1193
1193
|
let maxX = Number.NEGATIVE_INFINITY;
|
|
@@ -1200,7 +1200,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
|
|
|
1200
1200
|
}
|
|
1201
1201
|
}
|
|
1202
1202
|
const width = maxX - minX;
|
|
1203
|
-
|
|
1203
|
+
columns.push({ widthPt: width > 0 ? width : DEFAULT_COLUMN_WIDTH_FALLBACK_PT });
|
|
1204
1204
|
}
|
|
1205
1205
|
const allItems = cells.flatMap((cellEntry) => cellEntry.items);
|
|
1206
1206
|
const contentRows = rows.map((row) => {
|
|
@@ -1217,7 +1217,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
|
|
|
1217
1217
|
const table = {
|
|
1218
1218
|
kind: "table",
|
|
1219
1219
|
rows: contentRows,
|
|
1220
|
-
|
|
1220
|
+
columns
|
|
1221
1221
|
};
|
|
1222
1222
|
require_layout_shared.stampFrame(table, pageIndex, box);
|
|
1223
1223
|
recovered.push({
|
|
@@ -1277,8 +1277,8 @@ function recoverTable(page, pageIndex) {
|
|
|
1277
1277
|
consumedText.add(item);
|
|
1278
1278
|
}
|
|
1279
1279
|
if (consumedText.size === 0) return;
|
|
1280
|
-
const
|
|
1281
|
-
for (let j = 0; j < columnCount; j++)
|
|
1280
|
+
const columns = [];
|
|
1281
|
+
for (let j = 0; j < columnCount; j++) columns.push({ widthPt: lattice.columnBoundariesAscPt[j + 1] - lattice.columnBoundariesAscPt[j] });
|
|
1282
1282
|
const positionedRows = [];
|
|
1283
1283
|
for (let i = 0; i < rowCount; i++) {
|
|
1284
1284
|
const positioned = [];
|
|
@@ -1327,7 +1327,7 @@ function recoverTable(page, pageIndex) {
|
|
|
1327
1327
|
const table = {
|
|
1328
1328
|
kind: "table",
|
|
1329
1329
|
rows,
|
|
1330
|
-
|
|
1330
|
+
columns
|
|
1331
1331
|
};
|
|
1332
1332
|
require_layout_shared.stampFrame(table, pageIndex, pdfBox);
|
|
1333
1333
|
return {
|
|
@@ -1186,7 +1186,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
|
|
|
1186
1186
|
const rows = [...rowsById.values()].sort((a, b) => a.row.order - b.row.order);
|
|
1187
1187
|
for (const row of rows) row.cells.sort((a, b) => a.cell.order - b.cell.order);
|
|
1188
1188
|
const columnCount = Math.max(...rows.map((row) => row.cells.length));
|
|
1189
|
-
const
|
|
1189
|
+
const columns = [];
|
|
1190
1190
|
for (let j = 0; j < columnCount; j++) {
|
|
1191
1191
|
let minX = Number.POSITIVE_INFINITY;
|
|
1192
1192
|
let maxX = Number.NEGATIVE_INFINITY;
|
|
@@ -1199,7 +1199,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
|
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
1201
1201
|
const width = maxX - minX;
|
|
1202
|
-
|
|
1202
|
+
columns.push({ widthPt: width > 0 ? width : DEFAULT_COLUMN_WIDTH_FALLBACK_PT });
|
|
1203
1203
|
}
|
|
1204
1204
|
const allItems = cells.flatMap((cellEntry) => cellEntry.items);
|
|
1205
1205
|
const contentRows = rows.map((row) => {
|
|
@@ -1216,7 +1216,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
|
|
|
1216
1216
|
const table = {
|
|
1217
1217
|
kind: "table",
|
|
1218
1218
|
rows: contentRows,
|
|
1219
|
-
|
|
1219
|
+
columns
|
|
1220
1220
|
};
|
|
1221
1221
|
stampFrame(table, pageIndex, box);
|
|
1222
1222
|
recovered.push({
|
|
@@ -1276,8 +1276,8 @@ function recoverTable(page, pageIndex) {
|
|
|
1276
1276
|
consumedText.add(item);
|
|
1277
1277
|
}
|
|
1278
1278
|
if (consumedText.size === 0) return;
|
|
1279
|
-
const
|
|
1280
|
-
for (let j = 0; j < columnCount; j++)
|
|
1279
|
+
const columns = [];
|
|
1280
|
+
for (let j = 0; j < columnCount; j++) columns.push({ widthPt: lattice.columnBoundariesAscPt[j + 1] - lattice.columnBoundariesAscPt[j] });
|
|
1281
1281
|
const positionedRows = [];
|
|
1282
1282
|
for (let i = 0; i < rowCount; i++) {
|
|
1283
1283
|
const positioned = [];
|
|
@@ -1326,7 +1326,7 @@ function recoverTable(page, pageIndex) {
|
|
|
1326
1326
|
const table = {
|
|
1327
1327
|
kind: "table",
|
|
1328
1328
|
rows,
|
|
1329
|
-
|
|
1329
|
+
columns
|
|
1330
1330
|
};
|
|
1331
1331
|
stampFrame(table, pageIndex, pdfBox);
|
|
1332
1332
|
return {
|
package/dist/layout/shared.cjs
CHANGED
|
@@ -221,12 +221,13 @@ function sumColumnWidthsPt(columnWidthsPt, startIndex, span) {
|
|
|
221
221
|
*/
|
|
222
222
|
function tableAnchorBoxes(table, scale) {
|
|
223
223
|
const positionsByRow = (0, document_schema_js.walkTableGrid)(table);
|
|
224
|
+
const columnWidthsPt = table.columns.map((column) => column.widthPt);
|
|
224
225
|
return table.rows.map((row, rowIndex) => ({
|
|
225
226
|
row,
|
|
226
227
|
anchors: positionsByRow[rowIndex].flatMap((position) => position.anchorRowIndex === void 0 ? [{
|
|
227
228
|
cell: position.cell,
|
|
228
|
-
xOffsetPt: sumColumnWidthsPt(
|
|
229
|
-
widthPt: sumColumnWidthsPt(
|
|
229
|
+
xOffsetPt: sumColumnWidthsPt(columnWidthsPt, 0, position.columnIndex) * scale,
|
|
230
|
+
widthPt: sumColumnWidthsPt(columnWidthsPt, position.columnIndex, (0, document_schema_js.tableCellColumnSpan)(position.cell)) * scale
|
|
230
231
|
}] : [])
|
|
231
232
|
}));
|
|
232
233
|
}
|
package/dist/layout/shared.js
CHANGED
|
@@ -220,12 +220,13 @@ function sumColumnWidthsPt(columnWidthsPt, startIndex, span) {
|
|
|
220
220
|
*/
|
|
221
221
|
function tableAnchorBoxes(table, scale) {
|
|
222
222
|
const positionsByRow = walkTableGrid(table);
|
|
223
|
+
const columnWidthsPt = table.columns.map((column) => column.widthPt);
|
|
223
224
|
return table.rows.map((row, rowIndex) => ({
|
|
224
225
|
row,
|
|
225
226
|
anchors: positionsByRow[rowIndex].flatMap((position) => position.anchorRowIndex === void 0 ? [{
|
|
226
227
|
cell: position.cell,
|
|
227
|
-
xOffsetPt: sumColumnWidthsPt(
|
|
228
|
-
widthPt: sumColumnWidthsPt(
|
|
228
|
+
xOffsetPt: sumColumnWidthsPt(columnWidthsPt, 0, position.columnIndex) * scale,
|
|
229
|
+
widthPt: sumColumnWidthsPt(columnWidthsPt, position.columnIndex, tableCellColumnSpan(position.cell)) * scale
|
|
229
230
|
}] : [])
|
|
230
231
|
}));
|
|
231
232
|
}
|
package/dist/layout/slides.cjs
CHANGED
|
@@ -79,7 +79,7 @@ function layoutParagraph(paragraph, contentLeftXDown, contentWidthPt, startYDown
|
|
|
79
79
|
}
|
|
80
80
|
function layoutTable(table, contentLeftXDown, contentWidthPt, startYDown, slideHeightPt, pageIndex, placement, measurer, out) {
|
|
81
81
|
let cursorYDown = startYDown;
|
|
82
|
-
const gridWidthPt = table.
|
|
82
|
+
const gridWidthPt = table.columns.reduce((sum, c) => sum + c.widthPt, 0);
|
|
83
83
|
const scale = gridWidthPt > 0 ? contentWidthPt / gridWidthPt : 1;
|
|
84
84
|
for (const { row, anchors } of require_layout_shared.tableAnchorBoxes(table, scale)) {
|
|
85
85
|
const rowHeightPt = row.heightPt ?? require_layout_shared.estimateRowHeightPt(anchors, measurer);
|
package/dist/layout/slides.js
CHANGED
|
@@ -78,7 +78,7 @@ function layoutParagraph(paragraph, contentLeftXDown, contentWidthPt, startYDown
|
|
|
78
78
|
}
|
|
79
79
|
function layoutTable(table, contentLeftXDown, contentWidthPt, startYDown, slideHeightPt, pageIndex, placement, measurer, out) {
|
|
80
80
|
let cursorYDown = startYDown;
|
|
81
|
-
const gridWidthPt = table.
|
|
81
|
+
const gridWidthPt = table.columns.reduce((sum, c) => sum + c.widthPt, 0);
|
|
82
82
|
const scale = gridWidthPt > 0 ? contentWidthPt / gridWidthPt : 1;
|
|
83
83
|
for (const { row, anchors } of tableAnchorBoxes(table, scale)) {
|
|
84
84
|
const rowHeightPt = row.heightPt ?? estimateRowHeightPt(anchors, measurer);
|
package/dist/markdown/render.cjs
CHANGED
|
@@ -115,17 +115,17 @@ function sheetToTable(sheet, sink) {
|
|
|
115
115
|
const visibleColumns = [];
|
|
116
116
|
for (let column = 0; column <= maxColumn; column += 1) if (!hiddenColumns.has(column)) visibleColumns.push(column);
|
|
117
117
|
const columnWidthByIndex = new Map(sheet.columns.map((column) => [column.index, column.widthPt]));
|
|
118
|
-
const
|
|
118
|
+
const columns = visibleColumns.map((column) => ({ widthPt: columnWidthByIndex.get(column) ?? DEFAULT_COLUMN_WIDTH_PT }));
|
|
119
119
|
const rows = visibleRows.map((row) => ({ cells: visibleColumns.map((column) => spreadsheetCellToTableCell(cellByPosition.get(`${String(row)}:${String(column)}`))) }));
|
|
120
120
|
sink({
|
|
121
121
|
severity: "info",
|
|
122
122
|
code: MarkdownRenderDiagnosticCodes.SPREADSHEET_SHEET_AS_TABLE,
|
|
123
|
-
message: `sheet "${sheet.name}" flattened to a ${String(rows.length)}x${String(
|
|
123
|
+
message: `sheet "${sheet.name}" flattened to a ${String(rows.length)}x${String(columns.length)} GFM table; its first row is rendered as the table header (a GFM table always has one, and a spreadsheet has no header/body distinction of its own)`
|
|
124
124
|
});
|
|
125
125
|
return {
|
|
126
126
|
kind: "table",
|
|
127
127
|
rows,
|
|
128
|
-
|
|
128
|
+
columns
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
function spreadsheetBlocks(document, sink) {
|