documents.js 1.60.3 → 1.62.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 +84 -44
- 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 +29 -27
- package/dist/convert/convert.d.cts +9 -3
- package/dist/convert/convert.d.ts +9 -3
- package/dist/convert/convert.js +29 -27
- 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/{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 +54 -3
- package/dist/index.d.cts +28 -20
- package/dist/index.d.ts +27 -19
- package/dist/index.js +13 -4
- 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 +43 -9
- package/dist/mathml/layout.d.cts +1 -1
- package/dist/mathml/layout.d.ts +1 -1
- package/dist/mathml/layout.js +43 -9
- package/dist/mathml/variant.cjs +48 -5
- package/dist/mathml/variant.js +48 -5
- 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/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/odg/vector.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_xml_fragment = require("../../xml/fragment.cjs");
|
|
3
3
|
const require_xml_edit = require("../../xml/edit.cjs");
|
|
4
|
+
const require_edit_geometry = require("../geometry.cjs");
|
|
4
5
|
const require_edit_odg_style = require("./style.cjs");
|
|
5
6
|
const require_edit_odg_svg_path = require("./svg-path.cjs");
|
|
6
7
|
let ooxml_js = require("ooxml.js");
|
|
@@ -49,14 +50,18 @@ var OdgBoxVector = class {
|
|
|
49
50
|
return (0, ooxml_js.attr)(this.live(), "draw:name");
|
|
50
51
|
}
|
|
51
52
|
get frame() {
|
|
52
|
-
return (0, odf_js.
|
|
53
|
+
return (0, odf_js.resolveOdfShapeGeometry)(this.live())?.frame;
|
|
53
54
|
}
|
|
54
55
|
set frame(value) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
require_edit_geometry.applyOdfGeometry(this.live(), value, this.rotationDeg);
|
|
57
|
+
}
|
|
58
|
+
get rotationDeg() {
|
|
59
|
+
return (0, odf_js.resolveOdfShapeGeometry)(this.live())?.rotationDeg;
|
|
60
|
+
}
|
|
61
|
+
set rotationDeg(value) {
|
|
62
|
+
const currentFrame = this.frame;
|
|
63
|
+
if (currentFrame === void 0) throw new Error("cannot set rotationDeg on a vector with no resolvable frame (missing svg:width/svg:height)");
|
|
64
|
+
require_edit_geometry.applyOdfGeometry(this.live(), currentFrame, value);
|
|
60
65
|
}
|
|
61
66
|
get fill() {
|
|
62
67
|
return require_edit_odg_style.readGraphicFill(this.pkg, this.live());
|
|
@@ -162,14 +167,18 @@ var OdgPathVector = class {
|
|
|
162
167
|
return (0, ooxml_js.attr)(this.live(), "draw:name");
|
|
163
168
|
}
|
|
164
169
|
get frame() {
|
|
165
|
-
return (0, odf_js.
|
|
170
|
+
return (0, odf_js.resolveOdfShapeGeometry)(this.live())?.frame;
|
|
166
171
|
}
|
|
167
172
|
set frame(value) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
+
require_edit_geometry.applyOdfGeometry(this.live(), value, this.rotationDeg);
|
|
174
|
+
}
|
|
175
|
+
get rotationDeg() {
|
|
176
|
+
return (0, odf_js.resolveOdfShapeGeometry)(this.live())?.rotationDeg;
|
|
177
|
+
}
|
|
178
|
+
set rotationDeg(value) {
|
|
179
|
+
const currentFrame = this.frame;
|
|
180
|
+
if (currentFrame === void 0) throw new Error("cannot set rotationDeg on a vector with no resolvable frame (missing svg:width/svg:height)");
|
|
181
|
+
require_edit_geometry.applyOdfGeometry(this.live(), currentFrame, value);
|
|
173
182
|
}
|
|
174
183
|
get fill() {
|
|
175
184
|
return require_edit_odg_style.readGraphicFill(this.pkg, this.live());
|
|
@@ -187,7 +196,7 @@ var OdgPathVector = class {
|
|
|
187
196
|
const node = this.live();
|
|
188
197
|
const viewBoxValue = (0, ooxml_js.attr)(node, "svg:viewBox");
|
|
189
198
|
const dValue = (0, ooxml_js.attr)(node, "svg:d");
|
|
190
|
-
const frame = (0, odf_js.
|
|
199
|
+
const frame = (0, odf_js.resolveOdfShapeGeometry)(node)?.frame;
|
|
191
200
|
if (viewBoxValue === void 0 || dValue === void 0 || frame === void 0) return [];
|
|
192
201
|
const viewBox = (0, odf_js.parseOdfViewBox)(viewBoxValue);
|
|
193
202
|
if (viewBox === void 0) return [];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as OdgLineVector, c as buildEllipseElement, d as buildRectElement, i as OdgBoxVectorKind, l as buildLineElement, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as PathVectorInit, t as BoxVectorInit, u as buildPathElement } from "../../vector-
|
|
1
|
+
import { a as OdgLineVector, c as buildEllipseElement, d as buildRectElement, i as OdgBoxVectorKind, l as buildLineElement, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as PathVectorInit, t as BoxVectorInit, u as buildPathElement } from "../../vector-Puuqu_IT.cjs";
|
|
2
2
|
export { BoxVectorInit, LineVectorInit, OdgBoxVector, OdgBoxVectorKind, OdgLineVector, OdgPathVector, PathVectorInit, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as OdgLineVector, c as buildEllipseElement, d as buildRectElement, i as OdgBoxVectorKind, l as buildLineElement, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as PathVectorInit, t as BoxVectorInit, u as buildPathElement } from "../../vector-
|
|
1
|
+
import { a as OdgLineVector, c as buildEllipseElement, d as buildRectElement, i as OdgBoxVectorKind, l as buildLineElement, n as LineVectorInit, o as OdgPathVector, r as OdgBoxVector, s as PathVectorInit, t as BoxVectorInit, u as buildPathElement } from "../../vector-Puuqu_IT.js";
|
|
2
2
|
export { BoxVectorInit, LineVectorInit, OdgBoxVector, OdgBoxVectorKind, OdgLineVector, OdgPathVector, PathVectorInit, buildEllipseElement, buildLineElement, buildPathElement, buildRectElement };
|
package/dist/edit/odg/vector.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { el } from "../../xml/fragment.js";
|
|
2
2
|
import { removeChild, setAttr } from "../../xml/edit.js";
|
|
3
|
+
import { applyOdfGeometry } from "../geometry.js";
|
|
3
4
|
import { buildGraphicStyle, readGraphicFill, readGraphicStroke, setGraphicFill, setGraphicStroke } from "./style.js";
|
|
4
5
|
import { buildSvgPathData, buildSvgViewBox } from "./svg-path.js";
|
|
5
6
|
import { attr } from "ooxml.js";
|
|
6
|
-
import { buildOdfSubpaths, formatOdfLength,
|
|
7
|
+
import { buildOdfSubpaths, formatOdfLength, parseLinePoints, parseOdfPathData, parseOdfViewBox, resolveOdfShapeGeometry } from "odf.js";
|
|
7
8
|
//#region src/edit/odg/vector.ts
|
|
8
9
|
function directTextP() {
|
|
9
10
|
return el("text:p");
|
|
@@ -48,14 +49,18 @@ var OdgBoxVector = class {
|
|
|
48
49
|
return attr(this.live(), "draw:name");
|
|
49
50
|
}
|
|
50
51
|
get frame() {
|
|
51
|
-
return
|
|
52
|
+
return resolveOdfShapeGeometry(this.live())?.frame;
|
|
52
53
|
}
|
|
53
54
|
set frame(value) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
applyOdfGeometry(this.live(), value, this.rotationDeg);
|
|
56
|
+
}
|
|
57
|
+
get rotationDeg() {
|
|
58
|
+
return resolveOdfShapeGeometry(this.live())?.rotationDeg;
|
|
59
|
+
}
|
|
60
|
+
set rotationDeg(value) {
|
|
61
|
+
const currentFrame = this.frame;
|
|
62
|
+
if (currentFrame === void 0) throw new Error("cannot set rotationDeg on a vector with no resolvable frame (missing svg:width/svg:height)");
|
|
63
|
+
applyOdfGeometry(this.live(), currentFrame, value);
|
|
59
64
|
}
|
|
60
65
|
get fill() {
|
|
61
66
|
return readGraphicFill(this.pkg, this.live());
|
|
@@ -161,14 +166,18 @@ var OdgPathVector = class {
|
|
|
161
166
|
return attr(this.live(), "draw:name");
|
|
162
167
|
}
|
|
163
168
|
get frame() {
|
|
164
|
-
return
|
|
169
|
+
return resolveOdfShapeGeometry(this.live())?.frame;
|
|
165
170
|
}
|
|
166
171
|
set frame(value) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
applyOdfGeometry(this.live(), value, this.rotationDeg);
|
|
173
|
+
}
|
|
174
|
+
get rotationDeg() {
|
|
175
|
+
return resolveOdfShapeGeometry(this.live())?.rotationDeg;
|
|
176
|
+
}
|
|
177
|
+
set rotationDeg(value) {
|
|
178
|
+
const currentFrame = this.frame;
|
|
179
|
+
if (currentFrame === void 0) throw new Error("cannot set rotationDeg on a vector with no resolvable frame (missing svg:width/svg:height)");
|
|
180
|
+
applyOdfGeometry(this.live(), currentFrame, value);
|
|
172
181
|
}
|
|
173
182
|
get fill() {
|
|
174
183
|
return readGraphicFill(this.pkg, this.live());
|
|
@@ -186,7 +195,7 @@ var OdgPathVector = class {
|
|
|
186
195
|
const node = this.live();
|
|
187
196
|
const viewBoxValue = attr(node, "svg:viewBox");
|
|
188
197
|
const dValue = attr(node, "svg:d");
|
|
189
|
-
const frame =
|
|
198
|
+
const frame = resolveOdfShapeGeometry(node)?.frame;
|
|
190
199
|
if (viewBoxValue === void 0 || dValue === void 0 || frame === void 0) return [];
|
|
191
200
|
const viewBox = parseOdfViewBox(viewBoxValue);
|
|
192
201
|
if (viewBox === void 0) return [];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_model_embedded_drawing = require("../../model/embedded-drawing.cjs");
|
|
2
3
|
const require_edit_odt_content = require("../odt/content.cjs");
|
|
3
4
|
const require_edit_odp_editor = require("./editor.cjs");
|
|
4
5
|
let odf_js = require("odf.js");
|
|
@@ -17,6 +18,7 @@ function buildOdpPackage(content) {
|
|
|
17
18
|
}
|
|
18
19
|
function appendShape(slide, shape) {
|
|
19
20
|
const [onlyBlock] = shape.blocks;
|
|
21
|
+
if (shape.blocks.length === 1 && onlyBlock?.kind === "embeddedObject" && require_model_embedded_drawing.drawingOfBlock(onlyBlock) !== void 0) return;
|
|
20
22
|
if (shape.blocks.length === 1 && onlyBlock?.kind === "image") {
|
|
21
23
|
const imageShape = slide.addImage({
|
|
22
24
|
frame: shape.frame,
|
|
@@ -27,6 +29,19 @@ function appendShape(slide, shape) {
|
|
|
27
29
|
if (shape.rotationDeg !== void 0) imageShape.rotationDeg = shape.rotationDeg;
|
|
28
30
|
return;
|
|
29
31
|
}
|
|
32
|
+
if (shape.blocks.length === 1 && onlyBlock?.kind === "table") {
|
|
33
|
+
const { shape: tableFrame, table } = slide.addTable({
|
|
34
|
+
frame: shape.frame,
|
|
35
|
+
table: {
|
|
36
|
+
rows: onlyBlock.rows.length,
|
|
37
|
+
columns: onlyBlock.columnWidthsPt.length,
|
|
38
|
+
columnWidthsPt: onlyBlock.columnWidthsPt
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
if (shape.rotationDeg !== void 0) tableFrame.rotationDeg = shape.rotationDeg;
|
|
42
|
+
require_edit_odt_content.populateOdtTable(table, onlyBlock);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
30
45
|
const textShape = slide.addTextBox({
|
|
31
46
|
frame: shape.frame,
|
|
32
47
|
text: ""
|
package/dist/edit/odp/content.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { drawingOfBlock } from "../../model/embedded-drawing.js";
|
|
2
|
+
import { populateOdtTable, populateParagraph } from "../odt/content.js";
|
|
2
3
|
import { createOdp } from "./editor.js";
|
|
3
4
|
import { base64ToBytes } from "odf.js";
|
|
4
5
|
//#region src/edit/odp/content.ts
|
|
@@ -16,6 +17,7 @@ function buildOdpPackage(content) {
|
|
|
16
17
|
}
|
|
17
18
|
function appendShape(slide, shape) {
|
|
18
19
|
const [onlyBlock] = shape.blocks;
|
|
20
|
+
if (shape.blocks.length === 1 && onlyBlock?.kind === "embeddedObject" && drawingOfBlock(onlyBlock) !== void 0) return;
|
|
19
21
|
if (shape.blocks.length === 1 && onlyBlock?.kind === "image") {
|
|
20
22
|
const imageShape = slide.addImage({
|
|
21
23
|
frame: shape.frame,
|
|
@@ -26,6 +28,19 @@ function appendShape(slide, shape) {
|
|
|
26
28
|
if (shape.rotationDeg !== void 0) imageShape.rotationDeg = shape.rotationDeg;
|
|
27
29
|
return;
|
|
28
30
|
}
|
|
31
|
+
if (shape.blocks.length === 1 && onlyBlock?.kind === "table") {
|
|
32
|
+
const { shape: tableFrame, table } = slide.addTable({
|
|
33
|
+
frame: shape.frame,
|
|
34
|
+
table: {
|
|
35
|
+
rows: onlyBlock.rows.length,
|
|
36
|
+
columns: onlyBlock.columnWidthsPt.length,
|
|
37
|
+
columnWidthsPt: onlyBlock.columnWidthsPt
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
if (shape.rotationDeg !== void 0) tableFrame.rotationDeg = shape.rotationDeg;
|
|
41
|
+
populateOdtTable(table, onlyBlock);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
29
44
|
const textShape = slide.addTextBox({
|
|
30
45
|
frame: shape.frame,
|
|
31
46
|
text: ""
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as MediaContext, r as insertImageFrameMedia, t as ImageInit } from "../../image-
|
|
1
|
+
import { n as MediaContext, r as insertImageFrameMedia, t as ImageInit } from "../../image-M5SezZVI.cjs";
|
|
2
2
|
export { ImageInit, MediaContext, insertImageFrameMedia };
|
package/dist/edit/odp/image.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as MediaContext, r as insertImageFrameMedia, t as ImageInit } from "../../image-
|
|
1
|
+
import { n as MediaContext, r as insertImageFrameMedia, t as ImageInit } from "../../image-DHcA9kaK.js";
|
|
2
2
|
export { ImageInit, MediaContext, insertImageFrameMedia };
|
package/dist/edit/odp/shape.cjs
CHANGED
|
@@ -3,30 +3,13 @@ const require_xml_fragment = require("../../xml/fragment.cjs");
|
|
|
3
3
|
const require_xml_edit = require("../../xml/edit.cjs");
|
|
4
4
|
const require_edit_odt_paragraph = require("../odt/paragraph.cjs");
|
|
5
5
|
const require_edit_odt_list = require("../odt/list.cjs");
|
|
6
|
+
const require_edit_geometry = require("../geometry.cjs");
|
|
6
7
|
let ooxml_js = require("ooxml.js");
|
|
7
8
|
let odf_js = require("odf.js");
|
|
8
9
|
//#region src/edit/odp/shape.ts
|
|
9
10
|
function directChild(parent, tag) {
|
|
10
11
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
11
12
|
}
|
|
12
|
-
function buildTransformAttr(frame, rotationDeg) {
|
|
13
|
-
const angleRad = -rotationDeg * Math.PI / 180;
|
|
14
|
-
const localCenter = {
|
|
15
|
-
xPt: frame.widthPt / 2,
|
|
16
|
-
yPt: frame.heightPt / 2
|
|
17
|
-
};
|
|
18
|
-
const rotatedCenter = (0, odf_js.applyOdfTransform)([{
|
|
19
|
-
kind: "rotate",
|
|
20
|
-
angleRad
|
|
21
|
-
}], localCenter);
|
|
22
|
-
const desiredCenter = {
|
|
23
|
-
xPt: frame.xPt + frame.widthPt / 2,
|
|
24
|
-
yPt: frame.yPt + frame.heightPt / 2
|
|
25
|
-
};
|
|
26
|
-
const txPt = desiredCenter.xPt - rotatedCenter.xPt;
|
|
27
|
-
const tyPt = desiredCenter.yPt - rotatedCenter.yPt;
|
|
28
|
-
return `rotate(${angleRad}) translate(${(0, odf_js.formatOdfLength)(txPt)} ${(0, odf_js.formatOdfLength)(tyPt)})`;
|
|
29
|
-
}
|
|
30
13
|
var OdpShape = class {
|
|
31
14
|
container;
|
|
32
15
|
node;
|
|
@@ -59,18 +42,7 @@ var OdpShape = class {
|
|
|
59
42
|
this.applyGeometry(currentFrame, value);
|
|
60
43
|
}
|
|
61
44
|
applyGeometry(frame, rotationDeg) {
|
|
62
|
-
|
|
63
|
-
require_xml_edit.setAttr(node, "svg:width", (0, odf_js.formatOdfLength)(frame.widthPt));
|
|
64
|
-
require_xml_edit.setAttr(node, "svg:height", (0, odf_js.formatOdfLength)(frame.heightPt));
|
|
65
|
-
if (rotationDeg === void 0 || rotationDeg === 0) {
|
|
66
|
-
require_xml_edit.removeAttr(node, "draw:transform");
|
|
67
|
-
require_xml_edit.setAttr(node, "svg:x", (0, odf_js.formatOdfLength)(frame.xPt));
|
|
68
|
-
require_xml_edit.setAttr(node, "svg:y", (0, odf_js.formatOdfLength)(frame.yPt));
|
|
69
|
-
} else {
|
|
70
|
-
require_xml_edit.removeAttr(node, "svg:x");
|
|
71
|
-
require_xml_edit.removeAttr(node, "svg:y");
|
|
72
|
-
require_xml_edit.setAttr(node, "draw:transform", buildTransformAttr(frame, rotationDeg));
|
|
73
|
-
}
|
|
45
|
+
require_edit_geometry.applyOdfGeometry(this.live(), frame, rotationDeg);
|
|
74
46
|
}
|
|
75
47
|
textBox(create) {
|
|
76
48
|
const node = this.live();
|
|
@@ -127,7 +99,16 @@ function buildImageFrame(partPath, frame) {
|
|
|
127
99
|
"svg:height": (0, odf_js.formatOdfLength)(frame.heightPt)
|
|
128
100
|
}, [require_xml_fragment.el("draw:image", { "xlink:href": partPath })]);
|
|
129
101
|
}
|
|
102
|
+
function buildTableFrame(frame, tableElement) {
|
|
103
|
+
return require_xml_fragment.el("draw:frame", {
|
|
104
|
+
"svg:x": (0, odf_js.formatOdfLength)(frame.xPt),
|
|
105
|
+
"svg:y": (0, odf_js.formatOdfLength)(frame.yPt),
|
|
106
|
+
"svg:width": (0, odf_js.formatOdfLength)(frame.widthPt),
|
|
107
|
+
"svg:height": (0, odf_js.formatOdfLength)(frame.heightPt)
|
|
108
|
+
}, [tableElement]);
|
|
109
|
+
}
|
|
130
110
|
//#endregion
|
|
131
111
|
exports.OdpShape = OdpShape;
|
|
132
112
|
exports.buildImageFrame = buildImageFrame;
|
|
113
|
+
exports.buildTableFrame = buildTableFrame;
|
|
133
114
|
exports.buildTextBoxFrame = buildTextBoxFrame;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as buildImageFrame, r as
|
|
2
|
-
export { OdpShape, buildImageFrame, buildTextBoxFrame };
|
|
1
|
+
import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-CXZ6fejV.cjs";
|
|
2
|
+
export { OdpShape, buildImageFrame, buildTableFrame, buildTextBoxFrame };
|
package/dist/edit/odp/shape.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as buildImageFrame, r as
|
|
2
|
-
export { OdpShape, buildImageFrame, buildTextBoxFrame };
|
|
1
|
+
import { i as buildTextBoxFrame, n as buildImageFrame, r as buildTableFrame, t as OdpShape } from "../../shape-CVXedeL7.js";
|
|
2
|
+
export { OdpShape, buildImageFrame, buildTableFrame, buildTextBoxFrame };
|
package/dist/edit/odp/shape.js
CHANGED
|
@@ -1,31 +1,14 @@
|
|
|
1
1
|
import { el } from "../../xml/fragment.js";
|
|
2
|
-
import {
|
|
2
|
+
import { removeChild } from "../../xml/edit.js";
|
|
3
3
|
import { OdtParagraph, buildParagraph } from "../odt/paragraph.js";
|
|
4
4
|
import { OdtList, buildList } from "../odt/list.js";
|
|
5
|
+
import { applyOdfGeometry } from "../geometry.js";
|
|
5
6
|
import { attr } from "ooxml.js";
|
|
6
|
-
import {
|
|
7
|
+
import { formatOdfLength, resolveOdfShapeGeometry } from "odf.js";
|
|
7
8
|
//#region src/edit/odp/shape.ts
|
|
8
9
|
function directChild(parent, tag) {
|
|
9
10
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
10
11
|
}
|
|
11
|
-
function buildTransformAttr(frame, rotationDeg) {
|
|
12
|
-
const angleRad = -rotationDeg * Math.PI / 180;
|
|
13
|
-
const localCenter = {
|
|
14
|
-
xPt: frame.widthPt / 2,
|
|
15
|
-
yPt: frame.heightPt / 2
|
|
16
|
-
};
|
|
17
|
-
const rotatedCenter = applyOdfTransform([{
|
|
18
|
-
kind: "rotate",
|
|
19
|
-
angleRad
|
|
20
|
-
}], localCenter);
|
|
21
|
-
const desiredCenter = {
|
|
22
|
-
xPt: frame.xPt + frame.widthPt / 2,
|
|
23
|
-
yPt: frame.yPt + frame.heightPt / 2
|
|
24
|
-
};
|
|
25
|
-
const txPt = desiredCenter.xPt - rotatedCenter.xPt;
|
|
26
|
-
const tyPt = desiredCenter.yPt - rotatedCenter.yPt;
|
|
27
|
-
return `rotate(${angleRad}) translate(${formatOdfLength(txPt)} ${formatOdfLength(tyPt)})`;
|
|
28
|
-
}
|
|
29
12
|
var OdpShape = class {
|
|
30
13
|
container;
|
|
31
14
|
node;
|
|
@@ -58,18 +41,7 @@ var OdpShape = class {
|
|
|
58
41
|
this.applyGeometry(currentFrame, value);
|
|
59
42
|
}
|
|
60
43
|
applyGeometry(frame, rotationDeg) {
|
|
61
|
-
|
|
62
|
-
setAttr(node, "svg:width", formatOdfLength(frame.widthPt));
|
|
63
|
-
setAttr(node, "svg:height", formatOdfLength(frame.heightPt));
|
|
64
|
-
if (rotationDeg === void 0 || rotationDeg === 0) {
|
|
65
|
-
removeAttr(node, "draw:transform");
|
|
66
|
-
setAttr(node, "svg:x", formatOdfLength(frame.xPt));
|
|
67
|
-
setAttr(node, "svg:y", formatOdfLength(frame.yPt));
|
|
68
|
-
} else {
|
|
69
|
-
removeAttr(node, "svg:x");
|
|
70
|
-
removeAttr(node, "svg:y");
|
|
71
|
-
setAttr(node, "draw:transform", buildTransformAttr(frame, rotationDeg));
|
|
72
|
-
}
|
|
44
|
+
applyOdfGeometry(this.live(), frame, rotationDeg);
|
|
73
45
|
}
|
|
74
46
|
textBox(create) {
|
|
75
47
|
const node = this.live();
|
|
@@ -126,5 +98,13 @@ function buildImageFrame(partPath, frame) {
|
|
|
126
98
|
"svg:height": formatOdfLength(frame.heightPt)
|
|
127
99
|
}, [el("draw:image", { "xlink:href": partPath })]);
|
|
128
100
|
}
|
|
101
|
+
function buildTableFrame(frame, tableElement) {
|
|
102
|
+
return el("draw:frame", {
|
|
103
|
+
"svg:x": formatOdfLength(frame.xPt),
|
|
104
|
+
"svg:y": formatOdfLength(frame.yPt),
|
|
105
|
+
"svg:width": formatOdfLength(frame.widthPt),
|
|
106
|
+
"svg:height": formatOdfLength(frame.heightPt)
|
|
107
|
+
}, [tableElement]);
|
|
108
|
+
}
|
|
129
109
|
//#endregion
|
|
130
|
-
export { OdpShape, buildImageFrame, buildTextBoxFrame };
|
|
110
|
+
export { OdpShape, buildImageFrame, buildTableFrame, buildTextBoxFrame };
|
package/dist/edit/odp/slide.cjs
CHANGED
|
@@ -3,6 +3,7 @@ const require_xml_fragment = require("../../xml/fragment.cjs");
|
|
|
3
3
|
const require_xml_edit = require("../../xml/edit.cjs");
|
|
4
4
|
const require_xml_odf_text = require("../../xml/odf-text.cjs");
|
|
5
5
|
const require_edit_odt_paragraph = require("../odt/paragraph.cjs");
|
|
6
|
+
const require_edit_odt_table = require("../odt/table.cjs");
|
|
6
7
|
const require_edit_odp_shape = require("./shape.cjs");
|
|
7
8
|
const require_edit_odp_image = require("./image.cjs");
|
|
8
9
|
let ooxml_js = require("ooxml.js");
|
|
@@ -59,6 +60,16 @@ var OdpSlide = class {
|
|
|
59
60
|
node.children.push(frameElement);
|
|
60
61
|
return new require_edit_odp_shape.OdpShape(node.children, frameElement, this.context.pkg);
|
|
61
62
|
}
|
|
63
|
+
addTable(init) {
|
|
64
|
+
const node = this.live();
|
|
65
|
+
const tableElement = require_edit_odt_table.buildTable(this.context.pkg, init.table);
|
|
66
|
+
const frameElement = require_edit_odp_shape.buildTableFrame(init.frame, tableElement);
|
|
67
|
+
node.children.push(frameElement);
|
|
68
|
+
return {
|
|
69
|
+
shape: new require_edit_odp_shape.OdpShape(node.children, frameElement, this.context.pkg),
|
|
70
|
+
table: new require_edit_odt_table.OdtTable(frameElement.children, tableElement, this.context.pkg)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
62
73
|
get notes() {
|
|
63
74
|
const notesElement = directChild(this.live(), "presentation:notes");
|
|
64
75
|
if (notesElement === void 0) return "";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { t as Box } from "../../geometry-
|
|
2
|
-
import { t as ImageInit } from "../../image-
|
|
3
|
-
import { t as OdpShape } from "../../shape-
|
|
1
|
+
import { t as Box } from "../../geometry-DaJr8yQW.cjs";
|
|
2
|
+
import { t as ImageInit } from "../../image-M5SezZVI.cjs";
|
|
3
|
+
import { t as OdpShape } from "../../shape-CXZ6fejV.cjs";
|
|
4
|
+
import { i as TableInit, t as OdtTable } from "../../table-DjYcNOFm.cjs";
|
|
4
5
|
import { Package, XmlElement, XmlNode } from "odf.js";
|
|
5
6
|
//#region src/edit/odp/slide.d.ts
|
|
6
7
|
interface TextBoxInit {
|
|
@@ -10,9 +11,17 @@ interface TextBoxInit {
|
|
|
10
11
|
interface SlideImageInit extends ImageInit {
|
|
11
12
|
readonly frame: Box;
|
|
12
13
|
}
|
|
14
|
+
interface SlideTableInit {
|
|
15
|
+
readonly frame: Box;
|
|
16
|
+
readonly table: TableInit;
|
|
17
|
+
}
|
|
13
18
|
interface SlideContext {
|
|
14
19
|
readonly pkg: Package;
|
|
15
20
|
}
|
|
21
|
+
interface OdpTableShape {
|
|
22
|
+
readonly shape: OdpShape;
|
|
23
|
+
readonly table: OdtTable;
|
|
24
|
+
}
|
|
16
25
|
declare class OdpSlide {
|
|
17
26
|
private readonly container;
|
|
18
27
|
private readonly node;
|
|
@@ -23,9 +32,10 @@ declare class OdpSlide {
|
|
|
23
32
|
shapes(): OdpShape[];
|
|
24
33
|
addTextBox(init: TextBoxInit): OdpShape;
|
|
25
34
|
addImage(init: SlideImageInit): OdpShape;
|
|
35
|
+
addTable(init: SlideTableInit): OdpTableShape;
|
|
26
36
|
get notes(): string;
|
|
27
37
|
set notes(value: string);
|
|
28
38
|
remove(): void;
|
|
29
39
|
}
|
|
30
40
|
//#endregion
|
|
31
|
-
export { OdpSlide, SlideContext, SlideImageInit, TextBoxInit };
|
|
41
|
+
export { OdpSlide, OdpTableShape, SlideContext, SlideImageInit, SlideTableInit, TextBoxInit };
|
package/dist/edit/odp/slide.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { t as Box } from "../../geometry-
|
|
2
|
-
import { t as ImageInit } from "../../image-
|
|
3
|
-
import { t as OdpShape } from "../../shape-
|
|
1
|
+
import { t as Box } from "../../geometry-DaJr8yQW.js";
|
|
2
|
+
import { t as ImageInit } from "../../image-DHcA9kaK.js";
|
|
3
|
+
import { t as OdpShape } from "../../shape-CVXedeL7.js";
|
|
4
|
+
import { i as TableInit, t as OdtTable } from "../../table-DqfqMkVq.js";
|
|
4
5
|
import { Package, XmlElement, XmlNode } from "odf.js";
|
|
5
6
|
//#region src/edit/odp/slide.d.ts
|
|
6
7
|
interface TextBoxInit {
|
|
@@ -10,9 +11,17 @@ interface TextBoxInit {
|
|
|
10
11
|
interface SlideImageInit extends ImageInit {
|
|
11
12
|
readonly frame: Box;
|
|
12
13
|
}
|
|
14
|
+
interface SlideTableInit {
|
|
15
|
+
readonly frame: Box;
|
|
16
|
+
readonly table: TableInit;
|
|
17
|
+
}
|
|
13
18
|
interface SlideContext {
|
|
14
19
|
readonly pkg: Package;
|
|
15
20
|
}
|
|
21
|
+
interface OdpTableShape {
|
|
22
|
+
readonly shape: OdpShape;
|
|
23
|
+
readonly table: OdtTable;
|
|
24
|
+
}
|
|
16
25
|
declare class OdpSlide {
|
|
17
26
|
private readonly container;
|
|
18
27
|
private readonly node;
|
|
@@ -23,9 +32,10 @@ declare class OdpSlide {
|
|
|
23
32
|
shapes(): OdpShape[];
|
|
24
33
|
addTextBox(init: TextBoxInit): OdpShape;
|
|
25
34
|
addImage(init: SlideImageInit): OdpShape;
|
|
35
|
+
addTable(init: SlideTableInit): OdpTableShape;
|
|
26
36
|
get notes(): string;
|
|
27
37
|
set notes(value: string);
|
|
28
38
|
remove(): void;
|
|
29
39
|
}
|
|
30
40
|
//#endregion
|
|
31
|
-
export { OdpSlide, SlideContext, SlideImageInit, TextBoxInit };
|
|
41
|
+
export { OdpSlide, OdpTableShape, SlideContext, SlideImageInit, SlideTableInit, TextBoxInit };
|
package/dist/edit/odp/slide.js
CHANGED
|
@@ -2,7 +2,8 @@ import { el } from "../../xml/fragment.js";
|
|
|
2
2
|
import { removeChild } from "../../xml/edit.js";
|
|
3
3
|
import { decodeOdfText as decodeOdfText$1 } from "../../xml/odf-text.js";
|
|
4
4
|
import { buildParagraph } from "../odt/paragraph.js";
|
|
5
|
-
import {
|
|
5
|
+
import { OdtTable, buildTable } from "../odt/table.js";
|
|
6
|
+
import { OdpShape, buildTableFrame, buildTextBoxFrame } from "./shape.js";
|
|
6
7
|
import { insertImageFrameMedia } from "./image.js";
|
|
7
8
|
import { elementsWithTag } from "ooxml.js";
|
|
8
9
|
import { formatOdfLength } from "odf.js";
|
|
@@ -58,6 +59,16 @@ var OdpSlide = class {
|
|
|
58
59
|
node.children.push(frameElement);
|
|
59
60
|
return new OdpShape(node.children, frameElement, this.context.pkg);
|
|
60
61
|
}
|
|
62
|
+
addTable(init) {
|
|
63
|
+
const node = this.live();
|
|
64
|
+
const tableElement = buildTable(this.context.pkg, init.table);
|
|
65
|
+
const frameElement = buildTableFrame(init.frame, tableElement);
|
|
66
|
+
node.children.push(frameElement);
|
|
67
|
+
return {
|
|
68
|
+
shape: new OdpShape(node.children, frameElement, this.context.pkg),
|
|
69
|
+
table: new OdtTable(frameElement.children, tableElement, this.context.pkg)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
61
72
|
get notes() {
|
|
62
73
|
const notesElement = directChild(this.live(), "presentation:notes");
|
|
63
74
|
if (notesElement === void 0) return "";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_model_formula = require("../../model/formula.cjs");
|
|
2
3
|
const require_edit_odt_editor = require("./editor.cjs");
|
|
3
4
|
//#region src/edit/odt/content.ts
|
|
4
5
|
function buildOdtPackage(content) {
|
|
@@ -75,27 +76,56 @@ function populateParagraph(paragraph, block) {
|
|
|
75
76
|
if (run.color !== void 0) odtRun.color = run.color;
|
|
76
77
|
}
|
|
77
78
|
}
|
|
79
|
+
function populateCellBlocks(cell, blocks) {
|
|
80
|
+
const [firstBlock, ...restBlocks] = blocks;
|
|
81
|
+
const firstParagraph = cell.paragraphs()[0];
|
|
82
|
+
if (firstBlock?.kind === "paragraph" && firstParagraph !== void 0) populateParagraph(firstParagraph, firstBlock);
|
|
83
|
+
else if (firstBlock !== void 0) appendCellBlock(cell, firstBlock);
|
|
84
|
+
for (const remaining of restBlocks) appendCellBlock(cell, remaining);
|
|
85
|
+
}
|
|
86
|
+
function populateOdtTable(table, block) {
|
|
87
|
+
const verticalMerges = /* @__PURE__ */ new Map();
|
|
88
|
+
block.rows.forEach((row) => {
|
|
89
|
+
const tableRow = table.appendEmptyRow();
|
|
90
|
+
let colIndex = 0;
|
|
91
|
+
let horizontalCoverRemaining = 0;
|
|
92
|
+
row.cells.forEach((cell) => {
|
|
93
|
+
if (horizontalCoverRemaining > 0) {
|
|
94
|
+
tableRow.appendCoveredCell();
|
|
95
|
+
horizontalCoverRemaining -= 1;
|
|
96
|
+
colIndex += 1;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const verticalRemaining = verticalMerges.get(colIndex);
|
|
100
|
+
if (verticalRemaining !== void 0 && verticalRemaining > 0) {
|
|
101
|
+
tableRow.appendCoveredCell();
|
|
102
|
+
verticalMerges.set(colIndex, verticalRemaining - 1);
|
|
103
|
+
colIndex += 1;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const tableCell = tableRow.appendCell();
|
|
107
|
+
const span = cell.colSpan ?? 1;
|
|
108
|
+
if (span > 1) {
|
|
109
|
+
tableCell.colSpan = span;
|
|
110
|
+
horizontalCoverRemaining = span - 1;
|
|
111
|
+
}
|
|
112
|
+
if (cell.rowSpan !== void 0 && cell.rowSpan > 1) {
|
|
113
|
+
tableCell.rowSpan = cell.rowSpan;
|
|
114
|
+
for (let c = 0; c < span; c++) verticalMerges.set(colIndex + c, cell.rowSpan - 1);
|
|
115
|
+
}
|
|
116
|
+
populateCellBlocks(tableCell, cell.blocks);
|
|
117
|
+
colIndex += 1;
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
78
121
|
function appendTable(body, block) {
|
|
79
122
|
const columns = block.columnWidthsPt.length;
|
|
80
123
|
if (block.rows.length === 0 || columns === 0) return;
|
|
81
|
-
|
|
82
|
-
rows:
|
|
124
|
+
populateOdtTable(body.appendTable({
|
|
125
|
+
rows: 0,
|
|
83
126
|
columns,
|
|
84
127
|
columnWidthsPt: block.columnWidthsPt
|
|
85
|
-
});
|
|
86
|
-
block.rows.forEach((row, rowIndex) => {
|
|
87
|
-
const tableRow = table.rows()[rowIndex];
|
|
88
|
-
if (tableRow === void 0) return;
|
|
89
|
-
row.cells.forEach((cell, cellIndex) => {
|
|
90
|
-
const tableCell = tableRow.cells()[cellIndex];
|
|
91
|
-
if (tableCell === void 0) return;
|
|
92
|
-
const [firstBlock, ...restBlocks] = cell.blocks;
|
|
93
|
-
const firstParagraph = tableCell.paragraphs()[0];
|
|
94
|
-
if (firstBlock?.kind === "paragraph" && firstParagraph !== void 0) populateParagraph(firstParagraph, firstBlock);
|
|
95
|
-
else if (firstBlock !== void 0) appendCellBlock(tableCell, firstBlock);
|
|
96
|
-
for (const remaining of restBlocks) appendCellBlock(tableCell, remaining);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
128
|
+
}), block);
|
|
99
129
|
}
|
|
100
130
|
function appendCellBlock(cell, block) {
|
|
101
131
|
if (block.kind === "paragraph") populateParagraph(cell.appendParagraph(), block);
|
|
@@ -104,7 +134,17 @@ function appendBlock(body, block) {
|
|
|
104
134
|
if (block.kind === "paragraph") populateParagraph(body.appendParagraph(), block);
|
|
105
135
|
else if (block.kind === "pageBreak") body.appendPageBreak();
|
|
106
136
|
else if (block.kind === "table") appendTable(body, block);
|
|
137
|
+
else if (block.kind === "embeddedObject") appendEmbeddedObject(body, block);
|
|
138
|
+
}
|
|
139
|
+
function appendEmbeddedObject(body, block) {
|
|
140
|
+
const formula = require_model_formula.formulaOfBlock(block);
|
|
141
|
+
if (formula === void 0) return;
|
|
142
|
+
populateParagraph(body.appendParagraph(), {
|
|
143
|
+
kind: "paragraph",
|
|
144
|
+
runs: [{ text: require_model_formula.formulaPlaceholderText(formula) }]
|
|
145
|
+
});
|
|
107
146
|
}
|
|
108
147
|
//#endregion
|
|
109
148
|
exports.buildOdtPackage = buildOdtPackage;
|
|
149
|
+
exports.populateOdtTable = populateOdtTable;
|
|
110
150
|
exports.populateParagraph = populateParagraph;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { t as OdtParagraph } from "../../paragraph-BXbXKPy3.cjs";
|
|
2
|
-
import {
|
|
2
|
+
import { t as OdtTable } from "../../table-DjYcNOFm.cjs";
|
|
3
|
+
import { ContentDocument, ContentParagraph, ContentTable } from "document-schema.js";
|
|
3
4
|
import { Package } from "odf.js";
|
|
4
5
|
//#region src/edit/odt/content.d.ts
|
|
5
6
|
declare function buildOdtPackage(content: ContentDocument): Package;
|
|
6
7
|
declare function populateParagraph(paragraph: OdtParagraph, block: ContentParagraph): void;
|
|
8
|
+
declare function populateOdtTable(table: OdtTable, block: ContentTable): void;
|
|
7
9
|
//#endregion
|
|
8
|
-
export { buildOdtPackage, populateParagraph };
|
|
10
|
+
export { buildOdtPackage, populateOdtTable, populateParagraph };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { t as OdtParagraph } from "../../paragraph-CoUi_88j.js";
|
|
2
|
-
import {
|
|
2
|
+
import { t as OdtTable } from "../../table-DqfqMkVq.js";
|
|
3
|
+
import { ContentDocument, ContentParagraph, ContentTable } from "document-schema.js";
|
|
3
4
|
import { Package } from "odf.js";
|
|
4
5
|
//#region src/edit/odt/content.d.ts
|
|
5
6
|
declare function buildOdtPackage(content: ContentDocument): Package;
|
|
6
7
|
declare function populateParagraph(paragraph: OdtParagraph, block: ContentParagraph): void;
|
|
8
|
+
declare function populateOdtTable(table: OdtTable, block: ContentTable): void;
|
|
7
9
|
//#endregion
|
|
8
|
-
export { buildOdtPackage, populateParagraph };
|
|
10
|
+
export { buildOdtPackage, populateOdtTable, populateParagraph };
|