js.documents 1.61.0 → 1.63.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 +120 -47
- package/dist/{blr-types-CYYC3yYU.d.cts → blr-types-DVgO1DQ9.d.cts} +1 -1
- package/dist/{blr-types-CYYC3yYU.d.ts → blr-types-DVgO1DQ9.d.ts} +1 -1
- package/dist/convert/capability.cjs +1 -0
- package/dist/convert/capability.d.cts +1 -1
- package/dist/convert/capability.d.ts +1 -1
- package/dist/convert/capability.js +1 -0
- package/dist/convert/convert.cjs +92 -38
- package/dist/convert/convert.d.cts +11 -4
- package/dist/convert/convert.d.ts +11 -4
- package/dist/convert/convert.js +93 -39
- package/dist/convert/local.cjs +15 -2
- package/dist/convert/local.js +15 -2
- package/dist/convert/port.d.cts +8 -4
- package/dist/convert/port.d.ts +8 -4
- package/dist/edit/docx/content.cjs +75 -13
- package/dist/edit/docx/content.d.cts +8 -2
- package/dist/edit/docx/content.d.ts +8 -2
- package/dist/edit/docx/content.js +75 -13
- package/dist/edit/docx/paragraph.cjs +14 -0
- package/dist/edit/docx/paragraph.d.cts +5 -0
- package/dist/edit/docx/paragraph.d.ts +5 -0
- package/dist/edit/docx/paragraph.js +14 -0
- package/dist/edit/docx/run.cjs +1 -1
- package/dist/edit/docx/run.js +1 -1
- package/dist/edit/docx/table.cjs +41 -0
- package/dist/edit/docx/table.d.cts +7 -1
- package/dist/edit/docx/table.d.ts +7 -1
- package/dist/edit/docx/table.js +42 -1
- package/dist/edit/geometry.cjs +38 -0
- package/dist/edit/geometry.d.cts +7 -0
- package/dist/edit/geometry.d.ts +7 -0
- package/dist/edit/geometry.js +36 -0
- package/dist/edit/odg/content.cjs +15 -12
- package/dist/edit/odg/content.js +15 -12
- package/dist/edit/odg/editor.d.cts +1 -1
- package/dist/edit/odg/editor.d.ts +1 -1
- package/dist/edit/odg/page.d.cts +3 -3
- package/dist/edit/odg/page.d.ts +3 -3
- package/dist/edit/odg/vector.cjs +22 -13
- package/dist/edit/odg/vector.d.cts +1 -1
- package/dist/edit/odg/vector.d.ts +1 -1
- package/dist/edit/odg/vector.js +23 -14
- package/dist/edit/odp/content.cjs +15 -0
- package/dist/edit/odp/content.js +16 -1
- package/dist/edit/odp/editor.d.cts +1 -1
- package/dist/edit/odp/editor.d.ts +1 -1
- package/dist/edit/odp/image.d.cts +1 -1
- package/dist/edit/odp/image.d.ts +1 -1
- package/dist/edit/odp/shape.cjs +11 -30
- package/dist/edit/odp/shape.d.cts +2 -2
- package/dist/edit/odp/shape.d.ts +2 -2
- package/dist/edit/odp/shape.js +13 -33
- package/dist/edit/odp/slide.cjs +11 -0
- package/dist/edit/odp/slide.d.cts +14 -4
- package/dist/edit/odp/slide.d.ts +14 -4
- package/dist/edit/odp/slide.js +12 -1
- package/dist/edit/odt/content.cjs +56 -16
- package/dist/edit/odt/content.d.cts +4 -2
- package/dist/edit/odt/content.d.ts +4 -2
- package/dist/edit/odt/content.js +56 -17
- package/dist/edit/odt/editor.d.cts +1 -1
- package/dist/edit/odt/editor.d.ts +1 -1
- package/dist/edit/odt/table.cjs +36 -0
- package/dist/edit/odt/table.d.cts +1 -36
- package/dist/edit/odt/table.d.ts +1 -36
- package/dist/edit/odt/table.js +37 -1
- package/dist/edit/pptx/content.cjs +71 -3
- package/dist/edit/pptx/content.js +71 -3
- package/dist/edit/pptx/editor.d.cts +1 -1
- package/dist/edit/pptx/editor.d.ts +1 -1
- package/dist/edit/pptx/image.d.cts +1 -1
- package/dist/edit/pptx/image.d.ts +1 -1
- package/dist/edit/pptx/shape.cjs +23 -1
- package/dist/edit/pptx/shape.d.cts +2 -2
- package/dist/edit/pptx/shape.d.ts +2 -2
- package/dist/edit/pptx/shape.js +23 -3
- package/dist/edit/pptx/slide.cjs +10 -1
- package/dist/edit/pptx/slide.d.cts +11 -4
- package/dist/edit/pptx/slide.d.ts +11 -4
- package/dist/edit/pptx/slide.js +10 -1
- package/dist/edit/pptx/table.cjs +136 -0
- package/dist/edit/pptx/table.d.cts +2 -0
- package/dist/edit/pptx/table.d.ts +2 -0
- package/dist/edit/pptx/table.js +131 -0
- package/dist/firebird/backup.d.cts +1 -1
- package/dist/firebird/backup.d.ts +1 -1
- package/dist/firebird/blr-types.cjs +2 -2
- package/dist/firebird/blr-types.d.cts +1 -1
- package/dist/firebird/blr-types.d.ts +1 -1
- package/dist/firebird/blr-types.js +2 -2
- package/dist/firebird/data.cjs +68 -14
- package/dist/firebird/data.d.cts +1 -1
- package/dist/firebird/data.d.ts +1 -1
- package/dist/firebird/data.js +68 -14
- package/dist/firebird/schema.cjs +13 -1
- package/dist/firebird/schema.d.cts +1 -1
- package/dist/firebird/schema.d.ts +1 -1
- package/dist/firebird/schema.js +13 -1
- package/dist/fonts/obfuscation.cjs +50 -0
- package/dist/fonts/obfuscation.d.cts +9 -0
- package/dist/fonts/obfuscation.d.ts +9 -0
- package/dist/fonts/obfuscation.js +46 -0
- package/dist/fonts/odf.cjs +86 -0
- package/dist/fonts/odf.d.cts +9 -0
- package/dist/fonts/odf.d.ts +9 -0
- package/dist/fonts/odf.js +84 -0
- package/dist/fonts/ooxml.cjs +129 -0
- package/dist/fonts/ooxml.d.cts +9 -0
- package/dist/fonts/ooxml.d.ts +9 -0
- package/dist/fonts/ooxml.js +127 -0
- package/dist/fonts/registry.cjs +18 -0
- package/dist/fonts/registry.d.cts +2 -0
- package/dist/fonts/registry.d.ts +2 -0
- package/dist/fonts/registry.js +16 -0
- package/dist/{geometry-DvwdrIij.d.cts → geometry-DaJr8yQW.d.cts} +2 -2
- package/dist/{geometry-DvwdrIij.d.ts → geometry-DaJr8yQW.d.ts} +2 -2
- package/dist/hsqldb/binary-script.cjs +154 -0
- package/dist/hsqldb/binary-script.d.cts +15 -0
- package/dist/hsqldb/binary-script.d.ts +15 -0
- package/dist/hsqldb/binary-script.js +151 -0
- package/dist/hsqldb/cache.cjs +18 -11
- package/dist/hsqldb/cache.d.cts +9 -4
- package/dist/hsqldb/cache.d.ts +9 -4
- package/dist/hsqldb/cache.js +18 -11
- package/dist/hsqldb/rowformat.cjs +60 -16
- package/dist/hsqldb/rowformat.d.cts +2 -21
- package/dist/hsqldb/rowformat.d.ts +2 -21
- package/dist/hsqldb/rowformat.js +60 -17
- package/dist/{image-BZDy72Jb.d.cts → image-7snmKIxn.d.cts} +1 -1
- package/dist/{image-B-xQWYYS.d.ts → image-Cs8xF753.d.ts} +1 -1
- package/dist/{image-CeqwL-Qs.d.ts → image-DHcA9kaK.d.ts} +1 -1
- package/dist/{image-DWX6cNOD.d.cts → image-M5SezZVI.d.cts} +1 -1
- package/dist/index.cjs +86 -3
- package/dist/index.d.cts +33 -21
- package/dist/index.d.ts +33 -21
- package/dist/index.js +18 -5
- package/dist/layout/cell-typing.cjs +209 -0
- package/dist/layout/cell-typing.d.cts +22 -0
- package/dist/layout/cell-typing.d.ts +22 -0
- package/dist/layout/cell-typing.js +208 -0
- package/dist/layout/drawing.cjs +193 -17
- package/dist/layout/drawing.js +193 -17
- package/dist/layout/engine.cjs +46 -29
- package/dist/layout/engine.d.cts +0 -2
- package/dist/layout/engine.d.ts +0 -2
- package/dist/layout/engine.js +47 -30
- package/dist/layout/lattice.cjs +139 -0
- package/dist/layout/lattice.d.cts +20 -0
- package/dist/layout/lattice.d.ts +20 -0
- package/dist/layout/lattice.js +135 -0
- package/dist/layout/reconstruct.cjs +176 -113
- package/dist/layout/reconstruct.d.cts +2 -0
- package/dist/layout/reconstruct.d.ts +2 -0
- package/dist/layout/reconstruct.js +173 -110
- package/dist/layout/shared.cjs +52 -0
- package/dist/layout/shared.d.cts +4 -2
- package/dist/layout/shared.d.ts +4 -2
- package/dist/layout/shared.js +51 -1
- package/dist/layout/sheets.cjs +45 -11
- package/dist/layout/sheets.js +46 -12
- package/dist/layout/slides.cjs +7 -7
- package/dist/layout/slides.d.cts +0 -3
- package/dist/layout/slides.d.ts +0 -3
- package/dist/layout/slides.js +7 -7
- package/dist/markdown/write.cjs +19 -6
- package/dist/markdown/write.js +19 -6
- package/dist/mathml/layout.cjs +2 -2
- package/dist/mathml/layout.d.cts +1 -1
- package/dist/mathml/layout.d.ts +1 -1
- package/dist/mathml/layout.js +2 -2
- package/dist/model/embedded-drawing.cjs +32 -0
- package/dist/model/embedded-drawing.d.cts +8 -0
- package/dist/model/embedded-drawing.d.ts +8 -0
- package/dist/model/embedded-drawing.js +30 -0
- package/dist/model/formula.cjs +31 -0
- package/dist/model/formula.d.cts +6 -6
- package/dist/model/formula.d.ts +6 -6
- package/dist/model/formula.js +27 -0
- package/dist/model/geometry.d.cts +1 -1
- package/dist/model/geometry.d.ts +1 -1
- package/dist/model/paint-order.cjs +15 -0
- package/dist/model/paint-order.d.cts +14 -0
- package/dist/model/paint-order.d.ts +14 -0
- package/dist/model/paint-order.js +14 -0
- package/dist/odb/components.cjs +12 -0
- package/dist/odb/components.d.cts +6 -0
- package/dist/odb/components.d.ts +6 -0
- package/dist/odb/components.js +10 -0
- package/dist/odb/read.cjs +11 -7
- package/dist/odb/read.d.cts +3 -2
- package/dist/odb/read.d.ts +3 -2
- package/dist/odb/read.js +11 -7
- package/dist/odf/formula/detect.cjs +86 -18
- package/dist/odf/formula/detect.d.cts +10 -6
- package/dist/odf/formula/detect.d.ts +10 -6
- package/dist/odf/formula/detect.js +86 -19
- package/dist/odf/formula/read.cjs +4 -16
- package/dist/odf/formula/read.d.cts +4 -8
- package/dist/odf/formula/read.d.ts +4 -8
- package/dist/odf/formula/read.js +5 -17
- package/dist/odf/odp/read.cjs +9 -19
- package/dist/odf/odp/read.d.cts +2 -7
- package/dist/odf/odp/read.d.ts +2 -7
- package/dist/odf/odp/read.js +10 -20
- package/dist/odf/odt/read.cjs +63 -23
- package/dist/odf/odt/read.d.cts +2 -7
- package/dist/odf/odt/read.d.ts +2 -7
- package/dist/odf/odt/read.js +64 -24
- package/dist/omml/write.cjs +258 -0
- package/dist/omml/write.d.cts +2 -0
- package/dist/omml/write.d.ts +2 -0
- package/dist/omml/write.js +256 -0
- package/dist/registry-CrSqLIcn.d.ts +19 -0
- package/dist/registry-CtPhMD0f.d.cts +19 -0
- package/dist/rowformat-Cl2exlEh.d.cts +25 -0
- package/dist/rowformat-Cl2exlEh.d.ts +25 -0
- package/dist/{schema-Acco3Ezi.d.cts → schema-BeR_KJ0X.d.cts} +3 -1
- package/dist/{schema-VkAA6pF5.d.ts → schema-CSKwSb_v.d.ts} +3 -1
- package/dist/{shape-BUfjw5eZ.d.cts → shape-BhkP6HB8.d.cts} +6 -2
- package/dist/{shape-CTkl6kt8.d.ts → shape-BkVcwPcf.d.ts} +6 -2
- package/dist/{shape-BfN3m52m.d.ts → shape-CVXedeL7.d.ts} +3 -2
- package/dist/{shape-CN2ycxOo.d.cts → shape-CXZ6fejV.d.cts} +3 -2
- package/dist/table-C3CPZ--2.d.cts +35 -0
- package/dist/table-DjYcNOFm.d.cts +44 -0
- package/dist/table-DqfqMkVq.d.ts +44 -0
- package/dist/table-DvS_7UQS.d.ts +35 -0
- package/dist/{vector-ClohqsOe.d.cts → vector-Puuqu_IT.d.cts} +4 -0
- package/dist/{vector-ClohqsOe.d.ts → vector-Puuqu_IT.d.ts} +4 -0
- package/dist/write-DuyfnbL_.d.cts +16 -0
- package/dist/write-Zqwx6pka.d.ts +16 -0
- package/package.json +4 -4
- package/dist/odf/formula/placeholder.cjs +0 -36
- package/dist/odf/formula/placeholder.d.cts +0 -14
- package/dist/odf/formula/placeholder.d.ts +0 -14
- package/dist/odf/formula/placeholder.js +0 -36
package/dist/edit/odt/content.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formulaOfBlock, formulaPlaceholderText } from "../../model/formula.js";
|
|
1
2
|
import { createOdt } from "./editor.js";
|
|
2
3
|
//#region src/edit/odt/content.ts
|
|
3
4
|
function buildOdtPackage(content) {
|
|
@@ -74,27 +75,56 @@ function populateParagraph(paragraph, block) {
|
|
|
74
75
|
if (run.color !== void 0) odtRun.color = run.color;
|
|
75
76
|
}
|
|
76
77
|
}
|
|
78
|
+
function populateCellBlocks(cell, blocks) {
|
|
79
|
+
const [firstBlock, ...restBlocks] = blocks;
|
|
80
|
+
const firstParagraph = cell.paragraphs()[0];
|
|
81
|
+
if (firstBlock?.kind === "paragraph" && firstParagraph !== void 0) populateParagraph(firstParagraph, firstBlock);
|
|
82
|
+
else if (firstBlock !== void 0) appendCellBlock(cell, firstBlock);
|
|
83
|
+
for (const remaining of restBlocks) appendCellBlock(cell, remaining);
|
|
84
|
+
}
|
|
85
|
+
function populateOdtTable(table, block) {
|
|
86
|
+
const verticalMerges = /* @__PURE__ */ new Map();
|
|
87
|
+
block.rows.forEach((row) => {
|
|
88
|
+
const tableRow = table.appendEmptyRow();
|
|
89
|
+
let colIndex = 0;
|
|
90
|
+
let horizontalCoverRemaining = 0;
|
|
91
|
+
row.cells.forEach((cell) => {
|
|
92
|
+
if (horizontalCoverRemaining > 0) {
|
|
93
|
+
tableRow.appendCoveredCell();
|
|
94
|
+
horizontalCoverRemaining -= 1;
|
|
95
|
+
colIndex += 1;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const verticalRemaining = verticalMerges.get(colIndex);
|
|
99
|
+
if (verticalRemaining !== void 0 && verticalRemaining > 0) {
|
|
100
|
+
tableRow.appendCoveredCell();
|
|
101
|
+
verticalMerges.set(colIndex, verticalRemaining - 1);
|
|
102
|
+
colIndex += 1;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const tableCell = tableRow.appendCell();
|
|
106
|
+
const span = cell.colSpan ?? 1;
|
|
107
|
+
if (span > 1) {
|
|
108
|
+
tableCell.colSpan = span;
|
|
109
|
+
horizontalCoverRemaining = span - 1;
|
|
110
|
+
}
|
|
111
|
+
if (cell.rowSpan !== void 0 && cell.rowSpan > 1) {
|
|
112
|
+
tableCell.rowSpan = cell.rowSpan;
|
|
113
|
+
for (let c = 0; c < span; c++) verticalMerges.set(colIndex + c, cell.rowSpan - 1);
|
|
114
|
+
}
|
|
115
|
+
populateCellBlocks(tableCell, cell.blocks);
|
|
116
|
+
colIndex += 1;
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
77
120
|
function appendTable(body, block) {
|
|
78
121
|
const columns = block.columnWidthsPt.length;
|
|
79
122
|
if (block.rows.length === 0 || columns === 0) return;
|
|
80
|
-
|
|
81
|
-
rows:
|
|
123
|
+
populateOdtTable(body.appendTable({
|
|
124
|
+
rows: 0,
|
|
82
125
|
columns,
|
|
83
126
|
columnWidthsPt: block.columnWidthsPt
|
|
84
|
-
});
|
|
85
|
-
block.rows.forEach((row, rowIndex) => {
|
|
86
|
-
const tableRow = table.rows()[rowIndex];
|
|
87
|
-
if (tableRow === void 0) return;
|
|
88
|
-
row.cells.forEach((cell, cellIndex) => {
|
|
89
|
-
const tableCell = tableRow.cells()[cellIndex];
|
|
90
|
-
if (tableCell === void 0) return;
|
|
91
|
-
const [firstBlock, ...restBlocks] = cell.blocks;
|
|
92
|
-
const firstParagraph = tableCell.paragraphs()[0];
|
|
93
|
-
if (firstBlock?.kind === "paragraph" && firstParagraph !== void 0) populateParagraph(firstParagraph, firstBlock);
|
|
94
|
-
else if (firstBlock !== void 0) appendCellBlock(tableCell, firstBlock);
|
|
95
|
-
for (const remaining of restBlocks) appendCellBlock(tableCell, remaining);
|
|
96
|
-
});
|
|
97
|
-
});
|
|
127
|
+
}), block);
|
|
98
128
|
}
|
|
99
129
|
function appendCellBlock(cell, block) {
|
|
100
130
|
if (block.kind === "paragraph") populateParagraph(cell.appendParagraph(), block);
|
|
@@ -103,6 +133,15 @@ function appendBlock(body, block) {
|
|
|
103
133
|
if (block.kind === "paragraph") populateParagraph(body.appendParagraph(), block);
|
|
104
134
|
else if (block.kind === "pageBreak") body.appendPageBreak();
|
|
105
135
|
else if (block.kind === "table") appendTable(body, block);
|
|
136
|
+
else if (block.kind === "embeddedObject") appendEmbeddedObject(body, block);
|
|
137
|
+
}
|
|
138
|
+
function appendEmbeddedObject(body, block) {
|
|
139
|
+
const formula = formulaOfBlock(block);
|
|
140
|
+
if (formula === void 0) return;
|
|
141
|
+
populateParagraph(body.appendParagraph(), {
|
|
142
|
+
kind: "paragraph",
|
|
143
|
+
runs: [{ text: formulaPlaceholderText(formula) }]
|
|
144
|
+
});
|
|
106
145
|
}
|
|
107
146
|
//#endregion
|
|
108
|
-
export { buildOdtPackage, populateParagraph };
|
|
147
|
+
export { buildOdtPackage, populateOdtTable, populateParagraph };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-BXbXKPy3.cjs";
|
|
2
2
|
import { t as OdtList } from "../../list-BuBM9rwQ.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { i as TableInit, t as OdtTable } from "../../table-DjYcNOFm.cjs";
|
|
4
4
|
import { Package } from "odf.js";
|
|
5
5
|
//#region src/edit/odt/editor.d.ts
|
|
6
6
|
interface OdtBody {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-CoUi_88j.js";
|
|
2
2
|
import { t as OdtList } from "../../list-CvKxhy3y.js";
|
|
3
|
-
import {
|
|
3
|
+
import { i as TableInit, t as OdtTable } from "../../table-DqfqMkVq.js";
|
|
4
4
|
import { Package } from "odf.js";
|
|
5
5
|
//#region src/edit/odt/editor.d.ts
|
|
6
6
|
interface OdtBody {
|
package/dist/edit/odt/table.cjs
CHANGED
|
@@ -46,6 +46,28 @@ var OdtTableCell = class {
|
|
|
46
46
|
get text() {
|
|
47
47
|
return this.paragraphs().map((p) => p.text).join("\n");
|
|
48
48
|
}
|
|
49
|
+
get colSpan() {
|
|
50
|
+
const raw = (0, ooxml_js.attr)(this.node, "table:number-columns-spanned");
|
|
51
|
+
return raw === void 0 ? void 0 : Number(raw);
|
|
52
|
+
}
|
|
53
|
+
set colSpan(value) {
|
|
54
|
+
if (value === void 0) {
|
|
55
|
+
require_xml_edit.removeAttr(this.node, "table:number-columns-spanned");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
require_xml_edit.setAttr(this.node, "table:number-columns-spanned", String(value));
|
|
59
|
+
}
|
|
60
|
+
get rowSpan() {
|
|
61
|
+
const raw = (0, ooxml_js.attr)(this.node, "table:number-rows-spanned");
|
|
62
|
+
return raw === void 0 ? void 0 : Number(raw);
|
|
63
|
+
}
|
|
64
|
+
set rowSpan(value) {
|
|
65
|
+
if (value === void 0) {
|
|
66
|
+
require_xml_edit.removeAttr(this.node, "table:number-rows-spanned");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
require_xml_edit.setAttr(this.node, "table:number-rows-spanned", String(value));
|
|
70
|
+
}
|
|
49
71
|
};
|
|
50
72
|
var OdtTableRow = class {
|
|
51
73
|
node;
|
|
@@ -59,6 +81,14 @@ var OdtTableRow = class {
|
|
|
59
81
|
for (const child of this.node.children) if (child.type === "element" && child.tag === "table:table-cell") out.push(new OdtTableCell(child, this.pkg));
|
|
60
82
|
return out;
|
|
61
83
|
}
|
|
84
|
+
appendCell() {
|
|
85
|
+
const cellElement = buildCell(this.pkg);
|
|
86
|
+
this.node.children.push(cellElement);
|
|
87
|
+
return new OdtTableCell(cellElement, this.pkg);
|
|
88
|
+
}
|
|
89
|
+
appendCoveredCell() {
|
|
90
|
+
this.node.children.push(require_xml_fragment.el("table:covered-table-cell"));
|
|
91
|
+
}
|
|
62
92
|
};
|
|
63
93
|
function buildCell(pkg) {
|
|
64
94
|
return require_xml_fragment.el("table:table-cell", {}, [require_edit_odt_paragraph.buildParagraph(pkg)]);
|
|
@@ -100,6 +130,12 @@ var OdtTable = class {
|
|
|
100
130
|
node.children.push(row);
|
|
101
131
|
return new OdtTableRow(row, this.pkg);
|
|
102
132
|
}
|
|
133
|
+
appendEmptyRow() {
|
|
134
|
+
const node = this.live();
|
|
135
|
+
const row = require_xml_fragment.el("table:table-row");
|
|
136
|
+
node.children.push(row);
|
|
137
|
+
return new OdtTableRow(row, this.pkg);
|
|
138
|
+
}
|
|
103
139
|
remove() {
|
|
104
140
|
require_xml_edit.removeChild(this.container, this.live());
|
|
105
141
|
this.removed = true;
|
|
@@ -1,37 +1,2 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { Package, XmlElement, XmlNode } from "odf.js";
|
|
3
|
-
//#region src/edit/odt/table.d.ts
|
|
4
|
-
interface TableInit {
|
|
5
|
-
readonly rows: number;
|
|
6
|
-
readonly columns: number;
|
|
7
|
-
readonly columnWidthsPt?: readonly number[];
|
|
8
|
-
}
|
|
9
|
-
declare class OdtTableCell {
|
|
10
|
-
private readonly node;
|
|
11
|
-
private readonly pkg;
|
|
12
|
-
constructor(node: XmlElement, pkg: Package);
|
|
13
|
-
paragraphs(): OdtParagraph[];
|
|
14
|
-
appendParagraph(init?: ParagraphInit): OdtParagraph;
|
|
15
|
-
get text(): string;
|
|
16
|
-
}
|
|
17
|
-
declare class OdtTableRow {
|
|
18
|
-
private readonly node;
|
|
19
|
-
private readonly pkg;
|
|
20
|
-
constructor(node: XmlElement, pkg: Package);
|
|
21
|
-
cells(): OdtTableCell[];
|
|
22
|
-
}
|
|
23
|
-
declare class OdtTable {
|
|
24
|
-
private readonly container;
|
|
25
|
-
private readonly node;
|
|
26
|
-
private readonly pkg;
|
|
27
|
-
private removed;
|
|
28
|
-
constructor(container: XmlNode[], node: XmlElement, pkg: Package);
|
|
29
|
-
private live;
|
|
30
|
-
rows(): OdtTableRow[];
|
|
31
|
-
cell(rowIndex: number, columnIndex: number): OdtTableCell;
|
|
32
|
-
appendRow(columnCount: number): OdtTableRow;
|
|
33
|
-
remove(): void;
|
|
34
|
-
}
|
|
35
|
-
declare function buildTable(pkg: Package, init: TableInit): XmlElement;
|
|
36
|
-
//#endregion
|
|
1
|
+
import { a as buildTable, i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "../../table-DjYcNOFm.cjs";
|
|
37
2
|
export { OdtTable, OdtTableCell, OdtTableRow, TableInit, buildTable };
|
package/dist/edit/odt/table.d.ts
CHANGED
|
@@ -1,37 +1,2 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { Package, XmlElement, XmlNode } from "odf.js";
|
|
3
|
-
//#region src/edit/odt/table.d.ts
|
|
4
|
-
interface TableInit {
|
|
5
|
-
readonly rows: number;
|
|
6
|
-
readonly columns: number;
|
|
7
|
-
readonly columnWidthsPt?: readonly number[];
|
|
8
|
-
}
|
|
9
|
-
declare class OdtTableCell {
|
|
10
|
-
private readonly node;
|
|
11
|
-
private readonly pkg;
|
|
12
|
-
constructor(node: XmlElement, pkg: Package);
|
|
13
|
-
paragraphs(): OdtParagraph[];
|
|
14
|
-
appendParagraph(init?: ParagraphInit): OdtParagraph;
|
|
15
|
-
get text(): string;
|
|
16
|
-
}
|
|
17
|
-
declare class OdtTableRow {
|
|
18
|
-
private readonly node;
|
|
19
|
-
private readonly pkg;
|
|
20
|
-
constructor(node: XmlElement, pkg: Package);
|
|
21
|
-
cells(): OdtTableCell[];
|
|
22
|
-
}
|
|
23
|
-
declare class OdtTable {
|
|
24
|
-
private readonly container;
|
|
25
|
-
private readonly node;
|
|
26
|
-
private readonly pkg;
|
|
27
|
-
private removed;
|
|
28
|
-
constructor(container: XmlNode[], node: XmlElement, pkg: Package);
|
|
29
|
-
private live;
|
|
30
|
-
rows(): OdtTableRow[];
|
|
31
|
-
cell(rowIndex: number, columnIndex: number): OdtTableCell;
|
|
32
|
-
appendRow(columnCount: number): OdtTableRow;
|
|
33
|
-
remove(): void;
|
|
34
|
-
}
|
|
35
|
-
declare function buildTable(pkg: Package, init: TableInit): XmlElement;
|
|
36
|
-
//#endregion
|
|
1
|
+
import { a as buildTable, i as TableInit, n as OdtTableCell, r as OdtTableRow, t as OdtTable } from "../../table-DqfqMkVq.js";
|
|
37
2
|
export { OdtTable, OdtTableCell, OdtTableRow, TableInit, buildTable };
|
package/dist/edit/odt/table.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { el } from "../../xml/fragment.js";
|
|
2
|
-
import { removeChild } from "../../xml/edit.js";
|
|
2
|
+
import { removeAttr, removeChild, setAttr } from "../../xml/edit.js";
|
|
3
3
|
import { ensureAutomaticStyles, nextStyleName } from "./automatic-styles.js";
|
|
4
4
|
import { OdtParagraph, buildParagraph } from "./paragraph.js";
|
|
5
5
|
import { attr } from "ooxml.js";
|
|
@@ -45,6 +45,28 @@ var OdtTableCell = class {
|
|
|
45
45
|
get text() {
|
|
46
46
|
return this.paragraphs().map((p) => p.text).join("\n");
|
|
47
47
|
}
|
|
48
|
+
get colSpan() {
|
|
49
|
+
const raw = attr(this.node, "table:number-columns-spanned");
|
|
50
|
+
return raw === void 0 ? void 0 : Number(raw);
|
|
51
|
+
}
|
|
52
|
+
set colSpan(value) {
|
|
53
|
+
if (value === void 0) {
|
|
54
|
+
removeAttr(this.node, "table:number-columns-spanned");
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
setAttr(this.node, "table:number-columns-spanned", String(value));
|
|
58
|
+
}
|
|
59
|
+
get rowSpan() {
|
|
60
|
+
const raw = attr(this.node, "table:number-rows-spanned");
|
|
61
|
+
return raw === void 0 ? void 0 : Number(raw);
|
|
62
|
+
}
|
|
63
|
+
set rowSpan(value) {
|
|
64
|
+
if (value === void 0) {
|
|
65
|
+
removeAttr(this.node, "table:number-rows-spanned");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
setAttr(this.node, "table:number-rows-spanned", String(value));
|
|
69
|
+
}
|
|
48
70
|
};
|
|
49
71
|
var OdtTableRow = class {
|
|
50
72
|
node;
|
|
@@ -58,6 +80,14 @@ var OdtTableRow = class {
|
|
|
58
80
|
for (const child of this.node.children) if (child.type === "element" && child.tag === "table:table-cell") out.push(new OdtTableCell(child, this.pkg));
|
|
59
81
|
return out;
|
|
60
82
|
}
|
|
83
|
+
appendCell() {
|
|
84
|
+
const cellElement = buildCell(this.pkg);
|
|
85
|
+
this.node.children.push(cellElement);
|
|
86
|
+
return new OdtTableCell(cellElement, this.pkg);
|
|
87
|
+
}
|
|
88
|
+
appendCoveredCell() {
|
|
89
|
+
this.node.children.push(el("table:covered-table-cell"));
|
|
90
|
+
}
|
|
61
91
|
};
|
|
62
92
|
function buildCell(pkg) {
|
|
63
93
|
return el("table:table-cell", {}, [buildParagraph(pkg)]);
|
|
@@ -99,6 +129,12 @@ var OdtTable = class {
|
|
|
99
129
|
node.children.push(row);
|
|
100
130
|
return new OdtTableRow(row, this.pkg);
|
|
101
131
|
}
|
|
132
|
+
appendEmptyRow() {
|
|
133
|
+
const node = this.live();
|
|
134
|
+
const row = el("table:table-row");
|
|
135
|
+
node.children.push(row);
|
|
136
|
+
return new OdtTableRow(row, this.pkg);
|
|
137
|
+
}
|
|
102
138
|
remove() {
|
|
103
139
|
removeChild(this.container, this.live());
|
|
104
140
|
this.removed = true;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_edit_pptx_editor = require("./editor.cjs");
|
|
3
|
+
const require_model_embedded_drawing = require("../../model/embedded-drawing.cjs");
|
|
3
4
|
let ooxml_js = require("ooxml.js");
|
|
4
5
|
//#region src/edit/pptx/content.ts
|
|
5
6
|
function buildPptxPackage(content) {
|
|
@@ -16,13 +17,27 @@ function buildPptxPackage(content) {
|
|
|
16
17
|
}
|
|
17
18
|
function appendShape(slide, shape) {
|
|
18
19
|
const [onlyBlock] = shape.blocks;
|
|
20
|
+
if (shape.blocks.length === 1 && onlyBlock?.kind === "embeddedObject" && require_model_embedded_drawing.drawingOfBlock(onlyBlock) !== void 0) return;
|
|
19
21
|
if (shape.blocks.length === 1 && onlyBlock?.kind === "image") {
|
|
20
|
-
slide.addImage({
|
|
22
|
+
const imageShape = slide.addImage({
|
|
21
23
|
frame: shape.frame,
|
|
22
24
|
format: onlyBlock.format,
|
|
23
25
|
bytes: (0, ooxml_js.base64ToBytes)(onlyBlock.base64),
|
|
24
26
|
altText: onlyBlock.altText
|
|
25
27
|
});
|
|
28
|
+
if (shape.rotationDeg !== void 0) imageShape.rotationDeg = shape.rotationDeg;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (shape.blocks.length === 1 && onlyBlock?.kind === "table") {
|
|
32
|
+
populatePptxTable(slide.addTable({
|
|
33
|
+
frame: shape.frame,
|
|
34
|
+
rotationDeg: shape.rotationDeg,
|
|
35
|
+
table: {
|
|
36
|
+
rows: onlyBlock.rows.length,
|
|
37
|
+
columns: onlyBlock.columnWidthsPt.length,
|
|
38
|
+
columnWidthsPt: onlyBlock.columnWidthsPt
|
|
39
|
+
}
|
|
40
|
+
}), onlyBlock);
|
|
26
41
|
return;
|
|
27
42
|
}
|
|
28
43
|
const paragraphs = [];
|
|
@@ -40,10 +55,63 @@ function appendShape(slide, shape) {
|
|
|
40
55
|
}))
|
|
41
56
|
});
|
|
42
57
|
}
|
|
43
|
-
slide.addTextBox({
|
|
58
|
+
const textBox = slide.addTextBox({
|
|
44
59
|
frame: shape.frame,
|
|
45
60
|
text: ""
|
|
46
|
-
})
|
|
61
|
+
});
|
|
62
|
+
if (shape.rotationDeg !== void 0) textBox.rotationDeg = shape.rotationDeg;
|
|
63
|
+
textBox.setParagraphs(paragraphs);
|
|
64
|
+
}
|
|
65
|
+
function populateCellParagraphs(cell, blocks) {
|
|
66
|
+
const paragraphs = [];
|
|
67
|
+
for (const block of blocks) {
|
|
68
|
+
if (block.kind !== "paragraph") continue;
|
|
69
|
+
paragraphs.push({
|
|
70
|
+
alignment: block.alignment,
|
|
71
|
+
runs: block.runs.map((run) => ({
|
|
72
|
+
text: run.text,
|
|
73
|
+
bold: run.bold,
|
|
74
|
+
italic: run.italic,
|
|
75
|
+
fontFamily: run.fontFamily,
|
|
76
|
+
sizePt: run.sizePt,
|
|
77
|
+
color: run.color
|
|
78
|
+
}))
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
cell.setParagraphs(paragraphs);
|
|
82
|
+
}
|
|
83
|
+
function populatePptxTable(table, block) {
|
|
84
|
+
const verticalMerges = /* @__PURE__ */ new Map();
|
|
85
|
+
block.rows.forEach((row, rowIndex) => {
|
|
86
|
+
let horizontalCoverRemaining = 0;
|
|
87
|
+
row.cells.forEach((cell, colIndex) => {
|
|
88
|
+
const tableCell = table.cell(rowIndex, colIndex);
|
|
89
|
+
const verticalRemaining = verticalMerges.get(colIndex);
|
|
90
|
+
const isVerticallyCovered = verticalRemaining !== void 0 && verticalRemaining > 0;
|
|
91
|
+
const isHorizontallyCovered = horizontalCoverRemaining > 0;
|
|
92
|
+
if (isVerticallyCovered || isHorizontallyCovered) {
|
|
93
|
+
if (isHorizontallyCovered) {
|
|
94
|
+
tableCell.horizontalMerge = true;
|
|
95
|
+
horizontalCoverRemaining -= 1;
|
|
96
|
+
}
|
|
97
|
+
if (isVerticallyCovered && verticalRemaining !== void 0) {
|
|
98
|
+
tableCell.verticalMerge = true;
|
|
99
|
+
verticalMerges.set(colIndex, verticalRemaining - 1);
|
|
100
|
+
}
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const span = cell.colSpan ?? 1;
|
|
104
|
+
if (span > 1) {
|
|
105
|
+
tableCell.colSpan = span;
|
|
106
|
+
horizontalCoverRemaining = span - 1;
|
|
107
|
+
}
|
|
108
|
+
if (cell.rowSpan !== void 0 && cell.rowSpan > 1) {
|
|
109
|
+
tableCell.rowSpan = cell.rowSpan;
|
|
110
|
+
for (let c = 0; c < span; c++) verticalMerges.set(colIndex + c, cell.rowSpan - 1);
|
|
111
|
+
}
|
|
112
|
+
populateCellParagraphs(tableCell, cell.blocks);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
47
115
|
}
|
|
48
116
|
//#endregion
|
|
49
117
|
exports.buildPptxPackage = buildPptxPackage;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createPptx } from "./editor.js";
|
|
2
|
+
import { drawingOfBlock } from "../../model/embedded-drawing.js";
|
|
2
3
|
import { base64ToBytes } from "ooxml.js";
|
|
3
4
|
//#region src/edit/pptx/content.ts
|
|
4
5
|
function buildPptxPackage(content) {
|
|
@@ -15,13 +16,27 @@ function buildPptxPackage(content) {
|
|
|
15
16
|
}
|
|
16
17
|
function appendShape(slide, shape) {
|
|
17
18
|
const [onlyBlock] = shape.blocks;
|
|
19
|
+
if (shape.blocks.length === 1 && onlyBlock?.kind === "embeddedObject" && drawingOfBlock(onlyBlock) !== void 0) return;
|
|
18
20
|
if (shape.blocks.length === 1 && onlyBlock?.kind === "image") {
|
|
19
|
-
slide.addImage({
|
|
21
|
+
const imageShape = slide.addImage({
|
|
20
22
|
frame: shape.frame,
|
|
21
23
|
format: onlyBlock.format,
|
|
22
24
|
bytes: base64ToBytes(onlyBlock.base64),
|
|
23
25
|
altText: onlyBlock.altText
|
|
24
26
|
});
|
|
27
|
+
if (shape.rotationDeg !== void 0) imageShape.rotationDeg = shape.rotationDeg;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (shape.blocks.length === 1 && onlyBlock?.kind === "table") {
|
|
31
|
+
populatePptxTable(slide.addTable({
|
|
32
|
+
frame: shape.frame,
|
|
33
|
+
rotationDeg: shape.rotationDeg,
|
|
34
|
+
table: {
|
|
35
|
+
rows: onlyBlock.rows.length,
|
|
36
|
+
columns: onlyBlock.columnWidthsPt.length,
|
|
37
|
+
columnWidthsPt: onlyBlock.columnWidthsPt
|
|
38
|
+
}
|
|
39
|
+
}), onlyBlock);
|
|
25
40
|
return;
|
|
26
41
|
}
|
|
27
42
|
const paragraphs = [];
|
|
@@ -39,10 +54,63 @@ function appendShape(slide, shape) {
|
|
|
39
54
|
}))
|
|
40
55
|
});
|
|
41
56
|
}
|
|
42
|
-
slide.addTextBox({
|
|
57
|
+
const textBox = slide.addTextBox({
|
|
43
58
|
frame: shape.frame,
|
|
44
59
|
text: ""
|
|
45
|
-
})
|
|
60
|
+
});
|
|
61
|
+
if (shape.rotationDeg !== void 0) textBox.rotationDeg = shape.rotationDeg;
|
|
62
|
+
textBox.setParagraphs(paragraphs);
|
|
63
|
+
}
|
|
64
|
+
function populateCellParagraphs(cell, blocks) {
|
|
65
|
+
const paragraphs = [];
|
|
66
|
+
for (const block of blocks) {
|
|
67
|
+
if (block.kind !== "paragraph") continue;
|
|
68
|
+
paragraphs.push({
|
|
69
|
+
alignment: block.alignment,
|
|
70
|
+
runs: block.runs.map((run) => ({
|
|
71
|
+
text: run.text,
|
|
72
|
+
bold: run.bold,
|
|
73
|
+
italic: run.italic,
|
|
74
|
+
fontFamily: run.fontFamily,
|
|
75
|
+
sizePt: run.sizePt,
|
|
76
|
+
color: run.color
|
|
77
|
+
}))
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
cell.setParagraphs(paragraphs);
|
|
81
|
+
}
|
|
82
|
+
function populatePptxTable(table, block) {
|
|
83
|
+
const verticalMerges = /* @__PURE__ */ new Map();
|
|
84
|
+
block.rows.forEach((row, rowIndex) => {
|
|
85
|
+
let horizontalCoverRemaining = 0;
|
|
86
|
+
row.cells.forEach((cell, colIndex) => {
|
|
87
|
+
const tableCell = table.cell(rowIndex, colIndex);
|
|
88
|
+
const verticalRemaining = verticalMerges.get(colIndex);
|
|
89
|
+
const isVerticallyCovered = verticalRemaining !== void 0 && verticalRemaining > 0;
|
|
90
|
+
const isHorizontallyCovered = horizontalCoverRemaining > 0;
|
|
91
|
+
if (isVerticallyCovered || isHorizontallyCovered) {
|
|
92
|
+
if (isHorizontallyCovered) {
|
|
93
|
+
tableCell.horizontalMerge = true;
|
|
94
|
+
horizontalCoverRemaining -= 1;
|
|
95
|
+
}
|
|
96
|
+
if (isVerticallyCovered && verticalRemaining !== void 0) {
|
|
97
|
+
tableCell.verticalMerge = true;
|
|
98
|
+
verticalMerges.set(colIndex, verticalRemaining - 1);
|
|
99
|
+
}
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const span = cell.colSpan ?? 1;
|
|
103
|
+
if (span > 1) {
|
|
104
|
+
tableCell.colSpan = span;
|
|
105
|
+
horizontalCoverRemaining = span - 1;
|
|
106
|
+
}
|
|
107
|
+
if (cell.rowSpan !== void 0 && cell.rowSpan > 1) {
|
|
108
|
+
tableCell.rowSpan = cell.rowSpan;
|
|
109
|
+
for (let c = 0; c < span; c++) verticalMerges.set(colIndex + c, cell.rowSpan - 1);
|
|
110
|
+
}
|
|
111
|
+
populateCellParagraphs(tableCell, cell.blocks);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
46
114
|
}
|
|
47
115
|
//#endregion
|
|
48
116
|
export { buildPptxPackage };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as MediaContext, r as insertPictureShapeMedia, t as ImageInit } from "../../image-
|
|
1
|
+
import { n as MediaContext, r as insertPictureShapeMedia, t as ImageInit } from "../../image-7snmKIxn.cjs";
|
|
2
2
|
export { ImageInit, MediaContext, insertPictureShapeMedia };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as MediaContext, r as insertPictureShapeMedia, t as ImageInit } from "../../image-
|
|
1
|
+
import { n as MediaContext, r as insertPictureShapeMedia, t as ImageInit } from "../../image-Cs8xF753.js";
|
|
2
2
|
export { ImageInit, MediaContext, insertPictureShapeMedia };
|
package/dist/edit/pptx/shape.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_xml_fragment = require("../../xml/fragment.cjs");
|
|
3
|
+
const require_xml_entities = require("../../xml/entities.cjs");
|
|
3
4
|
const require_xml_edit = require("../../xml/edit.cjs");
|
|
4
5
|
const require_model_units = require("../../model/units.cjs");
|
|
5
|
-
const require_xml_entities = require("../../xml/entities.cjs");
|
|
6
6
|
let ooxml_js = require("ooxml.js");
|
|
7
7
|
//#region src/edit/pptx/shape.ts
|
|
8
8
|
function directChild(parent, tag) {
|
|
@@ -12,6 +12,7 @@ function parseEmuAttr(element, name) {
|
|
|
12
12
|
const value = (0, ooxml_js.attr)(element, name);
|
|
13
13
|
return value === void 0 ? void 0 : Number.parseInt(value, 10);
|
|
14
14
|
}
|
|
15
|
+
const ROTATION_UNITS_PER_DEGREE = 6e4;
|
|
15
16
|
var PptxShape = class {
|
|
16
17
|
container;
|
|
17
18
|
node;
|
|
@@ -66,6 +67,25 @@ var PptxShape = class {
|
|
|
66
67
|
cy: String(require_model_units.ptToEmu(value.heightPt))
|
|
67
68
|
})];
|
|
68
69
|
}
|
|
70
|
+
get rotationDeg() {
|
|
71
|
+
const spPr = this.spPrElement(false);
|
|
72
|
+
const xfrm = spPr === void 0 ? void 0 : directChild(spPr, "a:xfrm");
|
|
73
|
+
const rot = xfrm === void 0 ? void 0 : (0, ooxml_js.attr)(xfrm, "rot");
|
|
74
|
+
return rot === void 0 ? void 0 : Number(rot) / ROTATION_UNITS_PER_DEGREE;
|
|
75
|
+
}
|
|
76
|
+
set rotationDeg(value) {
|
|
77
|
+
const spPr = this.spPrElement(true);
|
|
78
|
+
let xfrm = directChild(spPr, "a:xfrm");
|
|
79
|
+
if (xfrm === void 0) {
|
|
80
|
+
xfrm = require_xml_fragment.el("a:xfrm");
|
|
81
|
+
spPr.children.unshift(xfrm);
|
|
82
|
+
}
|
|
83
|
+
if (value === void 0 || value === 0) {
|
|
84
|
+
require_xml_edit.removeAttr(xfrm, "rot");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
require_xml_edit.setAttr(xfrm, "rot", String(Math.round(value * ROTATION_UNITS_PER_DEGREE)));
|
|
88
|
+
}
|
|
69
89
|
get text() {
|
|
70
90
|
const txBody = directChild(this.live(), "p:txBody");
|
|
71
91
|
return txBody === void 0 ? "" : (0, ooxml_js.textContent)(txBody);
|
|
@@ -178,5 +198,7 @@ function buildPictureShape(frame, relationshipId, shapeId) {
|
|
|
178
198
|
}
|
|
179
199
|
//#endregion
|
|
180
200
|
exports.PptxShape = PptxShape;
|
|
201
|
+
exports.ROTATION_UNITS_PER_DEGREE = ROTATION_UNITS_PER_DEGREE;
|
|
202
|
+
exports.buildDrawingParagraph = buildDrawingParagraph;
|
|
181
203
|
exports.buildPictureShape = buildPictureShape;
|
|
182
204
|
exports.buildTextBoxShape = buildTextBoxShape;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { DrawingParagraphInit, DrawingRunInit, PptxShape, buildPictureShape, buildTextBoxShape };
|
|
1
|
+
import { a as buildDrawingParagraph, i as ROTATION_UNITS_PER_DEGREE, n as DrawingRunInit, o as buildPictureShape, r as PptxShape, s as buildTextBoxShape, t as DrawingParagraphInit } from "../../shape-BhkP6HB8.cjs";
|
|
2
|
+
export { DrawingParagraphInit, DrawingRunInit, PptxShape, ROTATION_UNITS_PER_DEGREE, buildDrawingParagraph, buildPictureShape, buildTextBoxShape };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { DrawingParagraphInit, DrawingRunInit, PptxShape, buildPictureShape, buildTextBoxShape };
|
|
1
|
+
import { a as buildDrawingParagraph, i as ROTATION_UNITS_PER_DEGREE, n as DrawingRunInit, o as buildPictureShape, r as PptxShape, s as buildTextBoxShape, t as DrawingParagraphInit } from "../../shape-BkVcwPcf.js";
|
|
2
|
+
export { DrawingParagraphInit, DrawingRunInit, PptxShape, ROTATION_UNITS_PER_DEGREE, buildDrawingParagraph, buildPictureShape, buildTextBoxShape };
|
package/dist/edit/pptx/shape.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { el, txt } from "../../xml/fragment.js";
|
|
2
|
-
import { removeChild } from "../../xml/edit.js";
|
|
3
|
-
import { emuToPt, ptToEmu } from "../../model/units.js";
|
|
4
2
|
import { encodeXmlText, needsSpacePreserve } from "../../xml/entities.js";
|
|
3
|
+
import { removeAttr, removeChild, setAttr } from "../../xml/edit.js";
|
|
4
|
+
import { emuToPt, ptToEmu } from "../../model/units.js";
|
|
5
5
|
import { attr, textContent } from "ooxml.js";
|
|
6
6
|
//#region src/edit/pptx/shape.ts
|
|
7
7
|
function directChild(parent, tag) {
|
|
@@ -11,6 +11,7 @@ function parseEmuAttr(element, name) {
|
|
|
11
11
|
const value = attr(element, name);
|
|
12
12
|
return value === void 0 ? void 0 : Number.parseInt(value, 10);
|
|
13
13
|
}
|
|
14
|
+
const ROTATION_UNITS_PER_DEGREE = 6e4;
|
|
14
15
|
var PptxShape = class {
|
|
15
16
|
container;
|
|
16
17
|
node;
|
|
@@ -65,6 +66,25 @@ var PptxShape = class {
|
|
|
65
66
|
cy: String(ptToEmu(value.heightPt))
|
|
66
67
|
})];
|
|
67
68
|
}
|
|
69
|
+
get rotationDeg() {
|
|
70
|
+
const spPr = this.spPrElement(false);
|
|
71
|
+
const xfrm = spPr === void 0 ? void 0 : directChild(spPr, "a:xfrm");
|
|
72
|
+
const rot = xfrm === void 0 ? void 0 : attr(xfrm, "rot");
|
|
73
|
+
return rot === void 0 ? void 0 : Number(rot) / ROTATION_UNITS_PER_DEGREE;
|
|
74
|
+
}
|
|
75
|
+
set rotationDeg(value) {
|
|
76
|
+
const spPr = this.spPrElement(true);
|
|
77
|
+
let xfrm = directChild(spPr, "a:xfrm");
|
|
78
|
+
if (xfrm === void 0) {
|
|
79
|
+
xfrm = el("a:xfrm");
|
|
80
|
+
spPr.children.unshift(xfrm);
|
|
81
|
+
}
|
|
82
|
+
if (value === void 0 || value === 0) {
|
|
83
|
+
removeAttr(xfrm, "rot");
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
setAttr(xfrm, "rot", String(Math.round(value * ROTATION_UNITS_PER_DEGREE)));
|
|
87
|
+
}
|
|
68
88
|
get text() {
|
|
69
89
|
const txBody = directChild(this.live(), "p:txBody");
|
|
70
90
|
return txBody === void 0 ? "" : textContent(txBody);
|
|
@@ -176,4 +196,4 @@ function buildPictureShape(frame, relationshipId, shapeId) {
|
|
|
176
196
|
]);
|
|
177
197
|
}
|
|
178
198
|
//#endregion
|
|
179
|
-
export { PptxShape, buildPictureShape, buildTextBoxShape };
|
|
199
|
+
export { PptxShape, ROTATION_UNITS_PER_DEGREE, buildDrawingParagraph, buildPictureShape, buildTextBoxShape };
|