documents.js 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/pptx/slide.cjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
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_opc_paths = require("../../opc/paths.cjs");
|
|
5
6
|
const require_opc_rels = require("../../opc/rels.cjs");
|
|
6
7
|
const require_opc_content_types = require("../../opc/content-types.cjs");
|
|
7
|
-
const require_xml_entities = require("../../xml/entities.cjs");
|
|
8
8
|
const require_edit_pptx_scaffold = require("./scaffold.cjs");
|
|
9
9
|
const require_edit_pptx_shape = require("./shape.cjs");
|
|
10
10
|
const require_edit_pptx_image = require("./image.cjs");
|
|
11
|
+
const require_edit_pptx_table = require("./table.cjs");
|
|
11
12
|
let ooxml_js = require("ooxml.js");
|
|
12
13
|
//#region src/edit/pptx/slide.ts
|
|
13
14
|
function directChild(parent, tag) {
|
|
@@ -109,6 +110,14 @@ var PptxSlide = class {
|
|
|
109
110
|
spTree.children.push(shapeElement);
|
|
110
111
|
return new require_edit_pptx_shape.PptxShape(spTree.children, shapeElement);
|
|
111
112
|
}
|
|
113
|
+
addTable(init) {
|
|
114
|
+
const spTree = findSpTree(this.live());
|
|
115
|
+
const id = nextIdIn(spTree);
|
|
116
|
+
const tableElement = require_edit_pptx_table.buildDrawingTable(init.table);
|
|
117
|
+
const graphicFrame = require_edit_pptx_table.buildTableGraphicFrame(init.frame, tableElement, id, init.rotationDeg);
|
|
118
|
+
spTree.children.push(graphicFrame);
|
|
119
|
+
return new require_edit_pptx_table.PptxTable(tableElement);
|
|
120
|
+
}
|
|
112
121
|
get notes() {
|
|
113
122
|
const notesRel = [...(0, ooxml_js.resolveRelationships)(this.context.pkg, this.context.slidePartPath).values()].find((r) => r.type === NOTES_SLIDE_RELATIONSHIP_TYPE);
|
|
114
123
|
if (notesRel === void 0) return "";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { t as Box } from "../../geometry-
|
|
2
|
-
import { t as ImageInit } from "../../image-
|
|
3
|
-
import { r as PptxShape } from "../../shape-
|
|
1
|
+
import { t as Box } from "../../geometry-DaJr8yQW.cjs";
|
|
2
|
+
import { t as ImageInit } from "../../image-7snmKIxn.cjs";
|
|
3
|
+
import { r as PptxShape } from "../../shape-BhkP6HB8.cjs";
|
|
4
|
+
import { r as PptxTableInit, t as PptxTable } from "../../table-C3CPZ--2.cjs";
|
|
4
5
|
import { Package, XmlElement, XmlNode } from "ooxml.js";
|
|
5
6
|
//#region src/edit/pptx/slide.d.ts
|
|
6
7
|
interface TextBoxInit {
|
|
@@ -10,6 +11,11 @@ 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: PptxTableInit;
|
|
17
|
+
readonly rotationDeg?: number;
|
|
18
|
+
}
|
|
13
19
|
interface SlideContext {
|
|
14
20
|
readonly pkg: Package;
|
|
15
21
|
readonly slidePartPath: string;
|
|
@@ -25,9 +31,10 @@ declare class PptxSlide {
|
|
|
25
31
|
shapes(): PptxShape[];
|
|
26
32
|
addTextBox(init: TextBoxInit): PptxShape;
|
|
27
33
|
addImage(init: SlideImageInit): PptxShape;
|
|
34
|
+
addTable(init: SlideTableInit): PptxTable;
|
|
28
35
|
get notes(): string;
|
|
29
36
|
set notes(value: string);
|
|
30
37
|
remove(): void;
|
|
31
38
|
}
|
|
32
39
|
//#endregion
|
|
33
|
-
export { PptxSlide, SlideContext, SlideImageInit, TextBoxInit };
|
|
40
|
+
export { PptxSlide, SlideContext, SlideImageInit, SlideTableInit, TextBoxInit };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { t as Box } from "../../geometry-
|
|
2
|
-
import { t as ImageInit } from "../../image-
|
|
3
|
-
import { r as PptxShape } from "../../shape-
|
|
1
|
+
import { t as Box } from "../../geometry-DaJr8yQW.js";
|
|
2
|
+
import { t as ImageInit } from "../../image-Cs8xF753.js";
|
|
3
|
+
import { r as PptxShape } from "../../shape-BkVcwPcf.js";
|
|
4
|
+
import { r as PptxTableInit, t as PptxTable } from "../../table-DvS_7UQS.js";
|
|
4
5
|
import { Package, XmlElement, XmlNode } from "ooxml.js";
|
|
5
6
|
//#region src/edit/pptx/slide.d.ts
|
|
6
7
|
interface TextBoxInit {
|
|
@@ -10,6 +11,11 @@ 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: PptxTableInit;
|
|
17
|
+
readonly rotationDeg?: number;
|
|
18
|
+
}
|
|
13
19
|
interface SlideContext {
|
|
14
20
|
readonly pkg: Package;
|
|
15
21
|
readonly slidePartPath: string;
|
|
@@ -25,9 +31,10 @@ declare class PptxSlide {
|
|
|
25
31
|
shapes(): PptxShape[];
|
|
26
32
|
addTextBox(init: TextBoxInit): PptxShape;
|
|
27
33
|
addImage(init: SlideImageInit): PptxShape;
|
|
34
|
+
addTable(init: SlideTableInit): PptxTable;
|
|
28
35
|
get notes(): string;
|
|
29
36
|
set notes(value: string);
|
|
30
37
|
remove(): void;
|
|
31
38
|
}
|
|
32
39
|
//#endregion
|
|
33
|
-
export { PptxSlide, SlideContext, SlideImageInit, TextBoxInit };
|
|
40
|
+
export { PptxSlide, SlideContext, SlideImageInit, SlideTableInit, TextBoxInit };
|
package/dist/edit/pptx/slide.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { el, txt } from "../../xml/fragment.js";
|
|
2
|
+
import { encodeXmlText } from "../../xml/entities.js";
|
|
2
3
|
import { removeChild } from "../../xml/edit.js";
|
|
3
4
|
import { buildRelativeTarget } from "../../opc/paths.js";
|
|
4
5
|
import { addRelationship } from "../../opc/rels.js";
|
|
5
6
|
import { ensureContentTypeOverride } from "../../opc/content-types.js";
|
|
6
|
-
import { encodeXmlText } from "../../xml/entities.js";
|
|
7
7
|
import { DML_NS, NOTES_MASTER_REL_TYPE, PML_NS, buildEmptyGroupSpTree, ensureNotesMaster } from "./scaffold.js";
|
|
8
8
|
import { PptxShape, buildTextBoxShape } from "./shape.js";
|
|
9
9
|
import { insertPictureShapeMedia } from "./image.js";
|
|
10
|
+
import { PptxTable, buildDrawingTable, buildTableGraphicFrame } from "./table.js";
|
|
10
11
|
import { resolveRelationships, rootElement, textContent } from "ooxml.js";
|
|
11
12
|
//#region src/edit/pptx/slide.ts
|
|
12
13
|
function directChild(parent, tag) {
|
|
@@ -108,6 +109,14 @@ var PptxSlide = class {
|
|
|
108
109
|
spTree.children.push(shapeElement);
|
|
109
110
|
return new PptxShape(spTree.children, shapeElement);
|
|
110
111
|
}
|
|
112
|
+
addTable(init) {
|
|
113
|
+
const spTree = findSpTree(this.live());
|
|
114
|
+
const id = nextIdIn(spTree);
|
|
115
|
+
const tableElement = buildDrawingTable(init.table);
|
|
116
|
+
const graphicFrame = buildTableGraphicFrame(init.frame, tableElement, id, init.rotationDeg);
|
|
117
|
+
spTree.children.push(graphicFrame);
|
|
118
|
+
return new PptxTable(tableElement);
|
|
119
|
+
}
|
|
111
120
|
get notes() {
|
|
112
121
|
const notesRel = [...resolveRelationships(this.context.pkg, this.context.slidePartPath).values()].find((r) => r.type === NOTES_SLIDE_RELATIONSHIP_TYPE);
|
|
113
122
|
if (notesRel === void 0) return "";
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_xml_fragment = require("../../xml/fragment.cjs");
|
|
3
|
+
const require_xml_edit = require("../../xml/edit.cjs");
|
|
4
|
+
const require_model_units = require("../../model/units.cjs");
|
|
5
|
+
const require_edit_pptx_shape = require("./shape.cjs");
|
|
6
|
+
let ooxml_js = require("ooxml.js");
|
|
7
|
+
//#region src/edit/pptx/table.ts
|
|
8
|
+
const DEFAULT_TABLE_WIDTH_PT = 468;
|
|
9
|
+
const DEFAULT_ROW_HEIGHT_PT = 20;
|
|
10
|
+
const TABLE_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/table";
|
|
11
|
+
var PptxTableCell = class {
|
|
12
|
+
node;
|
|
13
|
+
constructor(node) {
|
|
14
|
+
this.node = node;
|
|
15
|
+
}
|
|
16
|
+
get colSpan() {
|
|
17
|
+
const value = (0, ooxml_js.attr)(this.node, "gridSpan");
|
|
18
|
+
return value === void 0 ? void 0 : Number(value);
|
|
19
|
+
}
|
|
20
|
+
set colSpan(value) {
|
|
21
|
+
if (value === void 0) {
|
|
22
|
+
require_xml_edit.removeAttr(this.node, "gridSpan");
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
require_xml_edit.setAttr(this.node, "gridSpan", String(value));
|
|
26
|
+
}
|
|
27
|
+
get rowSpan() {
|
|
28
|
+
const value = (0, ooxml_js.attr)(this.node, "rowSpan");
|
|
29
|
+
return value === void 0 ? void 0 : Number(value);
|
|
30
|
+
}
|
|
31
|
+
set rowSpan(value) {
|
|
32
|
+
if (value === void 0) {
|
|
33
|
+
require_xml_edit.removeAttr(this.node, "rowSpan");
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
require_xml_edit.setAttr(this.node, "rowSpan", String(value));
|
|
37
|
+
}
|
|
38
|
+
set horizontalMerge(value) {
|
|
39
|
+
if (value) require_xml_edit.setAttr(this.node, "hMerge", "1");
|
|
40
|
+
else require_xml_edit.removeAttr(this.node, "hMerge");
|
|
41
|
+
}
|
|
42
|
+
set verticalMerge(value) {
|
|
43
|
+
if (value) require_xml_edit.setAttr(this.node, "vMerge", "1");
|
|
44
|
+
else require_xml_edit.removeAttr(this.node, "vMerge");
|
|
45
|
+
}
|
|
46
|
+
setParagraphs(paragraphs) {
|
|
47
|
+
const txBody = require_xml_edit.directChildElement(this.node, "a:txBody");
|
|
48
|
+
if (txBody === void 0) return;
|
|
49
|
+
txBody.children = [...txBody.children.filter((c) => !(c.type === "element" && c.tag === "a:p")), ...paragraphs.map(require_edit_pptx_shape.buildDrawingParagraph)];
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var PptxTableRow = class {
|
|
53
|
+
node;
|
|
54
|
+
constructor(node) {
|
|
55
|
+
this.node = node;
|
|
56
|
+
}
|
|
57
|
+
cells() {
|
|
58
|
+
const out = [];
|
|
59
|
+
for (const child of this.node.children) if (child.type === "element" && child.tag === "a:tc") out.push(new PptxTableCell(child));
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var PptxTable = class {
|
|
64
|
+
node;
|
|
65
|
+
constructor(node) {
|
|
66
|
+
this.node = node;
|
|
67
|
+
}
|
|
68
|
+
rows() {
|
|
69
|
+
const out = [];
|
|
70
|
+
for (const child of this.node.children) if (child.type === "element" && child.tag === "a:tr") out.push(new PptxTableRow(child));
|
|
71
|
+
return out;
|
|
72
|
+
}
|
|
73
|
+
cell(rowIndex, columnIndex) {
|
|
74
|
+
const row = this.rows()[rowIndex];
|
|
75
|
+
if (row === void 0) throw new Error(`row ${rowIndex} does not exist in this table`);
|
|
76
|
+
const cell = row.cells()[columnIndex];
|
|
77
|
+
if (cell === void 0) throw new Error(`column ${columnIndex} does not exist in row ${rowIndex}`);
|
|
78
|
+
return cell;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
function buildTableCellElement() {
|
|
82
|
+
return require_xml_fragment.el("a:tc", {}, [require_xml_fragment.el("a:txBody", {}, [
|
|
83
|
+
require_xml_fragment.el("a:bodyPr"),
|
|
84
|
+
require_xml_fragment.el("a:lstStyle"),
|
|
85
|
+
require_xml_fragment.el("a:p", {}, [require_xml_fragment.el("a:endParaRPr")])
|
|
86
|
+
]), require_xml_fragment.el("a:tcPr")]);
|
|
87
|
+
}
|
|
88
|
+
function buildTblGrid(columns, columnWidthsPt) {
|
|
89
|
+
const defaultWidth = DEFAULT_TABLE_WIDTH_PT / columns;
|
|
90
|
+
const cols = [];
|
|
91
|
+
for (let i = 0; i < columns; i++) {
|
|
92
|
+
const widthPt = columnWidthsPt?.[i] ?? defaultWidth;
|
|
93
|
+
cols.push(require_xml_fragment.el("a:gridCol", { w: String(require_model_units.ptToEmu(widthPt)) }));
|
|
94
|
+
}
|
|
95
|
+
return require_xml_fragment.el("a:tblGrid", {}, cols);
|
|
96
|
+
}
|
|
97
|
+
function buildDrawingTable(init) {
|
|
98
|
+
const rows = [];
|
|
99
|
+
for (let r = 0; r < init.rows; r++) {
|
|
100
|
+
const cells = [];
|
|
101
|
+
for (let c = 0; c < init.columns; c++) cells.push(buildTableCellElement());
|
|
102
|
+
rows.push(require_xml_fragment.el("a:tr", { h: String(require_model_units.ptToEmu(DEFAULT_ROW_HEIGHT_PT)) }, cells));
|
|
103
|
+
}
|
|
104
|
+
return require_xml_fragment.el("a:tbl", {}, [
|
|
105
|
+
require_xml_fragment.el("a:tblPr"),
|
|
106
|
+
buildTblGrid(init.columns, init.columnWidthsPt),
|
|
107
|
+
...rows
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
110
|
+
function buildTableGraphicFrame(frame, tableElement, shapeId, rotationDeg) {
|
|
111
|
+
const xfrmAttrs = rotationDeg === void 0 || rotationDeg === 0 ? {} : { rot: String(Math.round(rotationDeg * require_edit_pptx_shape.ROTATION_UNITS_PER_DEGREE)) };
|
|
112
|
+
return require_xml_fragment.el("p:graphicFrame", {}, [
|
|
113
|
+
require_xml_fragment.el("p:nvGraphicFramePr", {}, [
|
|
114
|
+
require_xml_fragment.el("p:cNvPr", {
|
|
115
|
+
id: String(shapeId),
|
|
116
|
+
name: `Table ${shapeId}`
|
|
117
|
+
}),
|
|
118
|
+
require_xml_fragment.el("p:cNvGraphicFramePr"),
|
|
119
|
+
require_xml_fragment.el("p:nvPr")
|
|
120
|
+
]),
|
|
121
|
+
require_xml_fragment.el("p:xfrm", xfrmAttrs, [require_xml_fragment.el("a:off", {
|
|
122
|
+
x: String(require_model_units.ptToEmu(frame.xPt)),
|
|
123
|
+
y: String(require_model_units.ptToEmu(frame.yPt))
|
|
124
|
+
}), require_xml_fragment.el("a:ext", {
|
|
125
|
+
cx: String(require_model_units.ptToEmu(frame.widthPt)),
|
|
126
|
+
cy: String(require_model_units.ptToEmu(frame.heightPt))
|
|
127
|
+
})]),
|
|
128
|
+
require_xml_fragment.el("a:graphic", {}, [require_xml_fragment.el("a:graphicData", { uri: TABLE_GRAPHIC_URI }, [tableElement])])
|
|
129
|
+
]);
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
exports.PptxTable = PptxTable;
|
|
133
|
+
exports.PptxTableCell = PptxTableCell;
|
|
134
|
+
exports.PptxTableRow = PptxTableRow;
|
|
135
|
+
exports.buildDrawingTable = buildDrawingTable;
|
|
136
|
+
exports.buildTableGraphicFrame = buildTableGraphicFrame;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, t as PptxTable } from "../../table-C3CPZ--2.cjs";
|
|
2
|
+
export { PptxTable, PptxTableCell, PptxTableInit, PptxTableRow, buildDrawingTable, buildTableGraphicFrame };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as buildDrawingTable, i as PptxTableRow, n as PptxTableCell, o as buildTableGraphicFrame, r as PptxTableInit, t as PptxTable } from "../../table-DvS_7UQS.js";
|
|
2
|
+
export { PptxTable, PptxTableCell, PptxTableInit, PptxTableRow, buildDrawingTable, buildTableGraphicFrame };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { el } from "../../xml/fragment.js";
|
|
2
|
+
import { directChildElement, removeAttr, setAttr } from "../../xml/edit.js";
|
|
3
|
+
import { ptToEmu } from "../../model/units.js";
|
|
4
|
+
import { ROTATION_UNITS_PER_DEGREE, buildDrawingParagraph } from "./shape.js";
|
|
5
|
+
import { attr } from "ooxml.js";
|
|
6
|
+
//#region src/edit/pptx/table.ts
|
|
7
|
+
const DEFAULT_TABLE_WIDTH_PT = 468;
|
|
8
|
+
const DEFAULT_ROW_HEIGHT_PT = 20;
|
|
9
|
+
const TABLE_GRAPHIC_URI = "http://schemas.openxmlformats.org/drawingml/2006/table";
|
|
10
|
+
var PptxTableCell = class {
|
|
11
|
+
node;
|
|
12
|
+
constructor(node) {
|
|
13
|
+
this.node = node;
|
|
14
|
+
}
|
|
15
|
+
get colSpan() {
|
|
16
|
+
const value = attr(this.node, "gridSpan");
|
|
17
|
+
return value === void 0 ? void 0 : Number(value);
|
|
18
|
+
}
|
|
19
|
+
set colSpan(value) {
|
|
20
|
+
if (value === void 0) {
|
|
21
|
+
removeAttr(this.node, "gridSpan");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
setAttr(this.node, "gridSpan", String(value));
|
|
25
|
+
}
|
|
26
|
+
get rowSpan() {
|
|
27
|
+
const value = attr(this.node, "rowSpan");
|
|
28
|
+
return value === void 0 ? void 0 : Number(value);
|
|
29
|
+
}
|
|
30
|
+
set rowSpan(value) {
|
|
31
|
+
if (value === void 0) {
|
|
32
|
+
removeAttr(this.node, "rowSpan");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
setAttr(this.node, "rowSpan", String(value));
|
|
36
|
+
}
|
|
37
|
+
set horizontalMerge(value) {
|
|
38
|
+
if (value) setAttr(this.node, "hMerge", "1");
|
|
39
|
+
else removeAttr(this.node, "hMerge");
|
|
40
|
+
}
|
|
41
|
+
set verticalMerge(value) {
|
|
42
|
+
if (value) setAttr(this.node, "vMerge", "1");
|
|
43
|
+
else removeAttr(this.node, "vMerge");
|
|
44
|
+
}
|
|
45
|
+
setParagraphs(paragraphs) {
|
|
46
|
+
const txBody = directChildElement(this.node, "a:txBody");
|
|
47
|
+
if (txBody === void 0) return;
|
|
48
|
+
txBody.children = [...txBody.children.filter((c) => !(c.type === "element" && c.tag === "a:p")), ...paragraphs.map(buildDrawingParagraph)];
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var PptxTableRow = class {
|
|
52
|
+
node;
|
|
53
|
+
constructor(node) {
|
|
54
|
+
this.node = node;
|
|
55
|
+
}
|
|
56
|
+
cells() {
|
|
57
|
+
const out = [];
|
|
58
|
+
for (const child of this.node.children) if (child.type === "element" && child.tag === "a:tc") out.push(new PptxTableCell(child));
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var PptxTable = class {
|
|
63
|
+
node;
|
|
64
|
+
constructor(node) {
|
|
65
|
+
this.node = node;
|
|
66
|
+
}
|
|
67
|
+
rows() {
|
|
68
|
+
const out = [];
|
|
69
|
+
for (const child of this.node.children) if (child.type === "element" && child.tag === "a:tr") out.push(new PptxTableRow(child));
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
cell(rowIndex, columnIndex) {
|
|
73
|
+
const row = this.rows()[rowIndex];
|
|
74
|
+
if (row === void 0) throw new Error(`row ${rowIndex} does not exist in this table`);
|
|
75
|
+
const cell = row.cells()[columnIndex];
|
|
76
|
+
if (cell === void 0) throw new Error(`column ${columnIndex} does not exist in row ${rowIndex}`);
|
|
77
|
+
return cell;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
function buildTableCellElement() {
|
|
81
|
+
return el("a:tc", {}, [el("a:txBody", {}, [
|
|
82
|
+
el("a:bodyPr"),
|
|
83
|
+
el("a:lstStyle"),
|
|
84
|
+
el("a:p", {}, [el("a:endParaRPr")])
|
|
85
|
+
]), el("a:tcPr")]);
|
|
86
|
+
}
|
|
87
|
+
function buildTblGrid(columns, columnWidthsPt) {
|
|
88
|
+
const defaultWidth = DEFAULT_TABLE_WIDTH_PT / columns;
|
|
89
|
+
const cols = [];
|
|
90
|
+
for (let i = 0; i < columns; i++) {
|
|
91
|
+
const widthPt = columnWidthsPt?.[i] ?? defaultWidth;
|
|
92
|
+
cols.push(el("a:gridCol", { w: String(ptToEmu(widthPt)) }));
|
|
93
|
+
}
|
|
94
|
+
return el("a:tblGrid", {}, cols);
|
|
95
|
+
}
|
|
96
|
+
function buildDrawingTable(init) {
|
|
97
|
+
const rows = [];
|
|
98
|
+
for (let r = 0; r < init.rows; r++) {
|
|
99
|
+
const cells = [];
|
|
100
|
+
for (let c = 0; c < init.columns; c++) cells.push(buildTableCellElement());
|
|
101
|
+
rows.push(el("a:tr", { h: String(ptToEmu(DEFAULT_ROW_HEIGHT_PT)) }, cells));
|
|
102
|
+
}
|
|
103
|
+
return el("a:tbl", {}, [
|
|
104
|
+
el("a:tblPr"),
|
|
105
|
+
buildTblGrid(init.columns, init.columnWidthsPt),
|
|
106
|
+
...rows
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
function buildTableGraphicFrame(frame, tableElement, shapeId, rotationDeg) {
|
|
110
|
+
const xfrmAttrs = rotationDeg === void 0 || rotationDeg === 0 ? {} : { rot: String(Math.round(rotationDeg * ROTATION_UNITS_PER_DEGREE)) };
|
|
111
|
+
return el("p:graphicFrame", {}, [
|
|
112
|
+
el("p:nvGraphicFramePr", {}, [
|
|
113
|
+
el("p:cNvPr", {
|
|
114
|
+
id: String(shapeId),
|
|
115
|
+
name: `Table ${shapeId}`
|
|
116
|
+
}),
|
|
117
|
+
el("p:cNvGraphicFramePr"),
|
|
118
|
+
el("p:nvPr")
|
|
119
|
+
]),
|
|
120
|
+
el("p:xfrm", xfrmAttrs, [el("a:off", {
|
|
121
|
+
x: String(ptToEmu(frame.xPt)),
|
|
122
|
+
y: String(ptToEmu(frame.yPt))
|
|
123
|
+
}), el("a:ext", {
|
|
124
|
+
cx: String(ptToEmu(frame.widthPt)),
|
|
125
|
+
cy: String(ptToEmu(frame.heightPt))
|
|
126
|
+
})]),
|
|
127
|
+
el("a:graphic", {}, [el("a:graphicData", { uri: TABLE_GRAPHIC_URI }, [tableElement])])
|
|
128
|
+
]);
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
export { PptxTable, PptxTableCell, PptxTableRow, buildDrawingTable, buildTableGraphicFrame };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HsqldbTable } from "../hsqldb/script.cjs";
|
|
2
|
-
import { r as FirebirdSchemaParseError } from "../schema-
|
|
2
|
+
import { r as FirebirdSchemaParseError } from "../schema-BeR_KJ0X.cjs";
|
|
3
3
|
import { FirebirdCompositeRecordUnsupportedError } from "./data.cjs";
|
|
4
4
|
//#region src/firebird/backup.d.ts
|
|
5
5
|
declare class FirebirdBackupFormatError extends Error {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HsqldbTable } from "../hsqldb/script.js";
|
|
2
|
-
import { r as FirebirdSchemaParseError } from "../schema-
|
|
2
|
+
import { r as FirebirdSchemaParseError } from "../schema-CSKwSb_v.js";
|
|
3
3
|
import { FirebirdCompositeRecordUnsupportedError } from "./data.js";
|
|
4
4
|
//#region src/firebird/backup.d.ts
|
|
5
5
|
declare class FirebirdBackupFormatError extends Error {
|
|
@@ -65,7 +65,7 @@ function decodeBlrType(blrType) {
|
|
|
65
65
|
if (physical === void 0) throw new FirebirdUnsupportedFieldTypeError(blrType);
|
|
66
66
|
return physical;
|
|
67
67
|
}
|
|
68
|
-
function describeFieldType(physical, lengthBytes, scale, characterLength) {
|
|
68
|
+
function describeFieldType(physical, lengthBytes, scale, characterLength, subType) {
|
|
69
69
|
switch (physical) {
|
|
70
70
|
case "short": return scale === 0 ? "SMALLINT" : `NUMERIC(4,${-scale})`;
|
|
71
71
|
case "long": return scale === 0 ? "INTEGER" : `NUMERIC(9,${-scale})`;
|
|
@@ -79,7 +79,7 @@ function describeFieldType(physical, lengthBytes, scale, characterLength) {
|
|
|
79
79
|
case "varying": return `VARCHAR(${characterLength ?? lengthBytes})`;
|
|
80
80
|
case "cstring": return `CSTRING(${characterLength ?? lengthBytes})`;
|
|
81
81
|
case "boolean": return "BOOLEAN";
|
|
82
|
-
case "blob": return
|
|
82
|
+
case "blob": return `BLOB SUB_TYPE ${subType}`;
|
|
83
83
|
case "quad": return "ARRAY";
|
|
84
84
|
case "int128": return `NUMERIC(38,${-scale})`;
|
|
85
85
|
case "dec64": return "DECFLOAT(16)";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as BLR_TIMESTAMP_TZ, D as FirebirdUnsupportedFieldTypeError, E as FirebirdPhysicalType, O as decodeBlrType, S as BLR_TIMESTAMP, T as BLR_VARYING2, _ as BLR_SQL_DATE, a as BLR_DEC128, b as BLR_TEXT, c as BLR_D_FLOAT, d as BLR_FLOAT, f as BLR_INT128, g as BLR_SHORT, h as BLR_QUAD, i as BLR_CSTRING2, k as describeFieldType, l as BLR_EX_TIMESTAMP_TZ, m as BLR_LONG, n as BLR_BOOL, o as BLR_DEC64, p as BLR_INT64, r as BLR_CSTRING, s as BLR_DOUBLE, t as BLR_BLOB, u as BLR_EX_TIME_TZ, v as BLR_SQL_TIME, w as BLR_VARYING, x as BLR_TEXT2, y as BLR_SQL_TIME_TZ } from "../blr-types-
|
|
1
|
+
import { C as BLR_TIMESTAMP_TZ, D as FirebirdUnsupportedFieldTypeError, E as FirebirdPhysicalType, O as decodeBlrType, S as BLR_TIMESTAMP, T as BLR_VARYING2, _ as BLR_SQL_DATE, a as BLR_DEC128, b as BLR_TEXT, c as BLR_D_FLOAT, d as BLR_FLOAT, f as BLR_INT128, g as BLR_SHORT, h as BLR_QUAD, i as BLR_CSTRING2, k as describeFieldType, l as BLR_EX_TIMESTAMP_TZ, m as BLR_LONG, n as BLR_BOOL, o as BLR_DEC64, p as BLR_INT64, r as BLR_CSTRING, s as BLR_DOUBLE, t as BLR_BLOB, u as BLR_EX_TIME_TZ, v as BLR_SQL_TIME, w as BLR_VARYING, x as BLR_TEXT2, y as BLR_SQL_TIME_TZ } from "../blr-types-DVgO1DQ9.cjs";
|
|
2
2
|
export { BLR_BLOB, BLR_BOOL, BLR_CSTRING, BLR_CSTRING2, BLR_DEC128, BLR_DEC64, BLR_DOUBLE, BLR_D_FLOAT, BLR_EX_TIMESTAMP_TZ, BLR_EX_TIME_TZ, BLR_FLOAT, BLR_INT128, BLR_INT64, BLR_LONG, BLR_QUAD, BLR_SHORT, BLR_SQL_DATE, BLR_SQL_TIME, BLR_SQL_TIME_TZ, BLR_TEXT, BLR_TEXT2, BLR_TIMESTAMP, BLR_TIMESTAMP_TZ, BLR_VARYING, BLR_VARYING2, FirebirdPhysicalType, FirebirdUnsupportedFieldTypeError, decodeBlrType, describeFieldType };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as BLR_TIMESTAMP_TZ, D as FirebirdUnsupportedFieldTypeError, E as FirebirdPhysicalType, O as decodeBlrType, S as BLR_TIMESTAMP, T as BLR_VARYING2, _ as BLR_SQL_DATE, a as BLR_DEC128, b as BLR_TEXT, c as BLR_D_FLOAT, d as BLR_FLOAT, f as BLR_INT128, g as BLR_SHORT, h as BLR_QUAD, i as BLR_CSTRING2, k as describeFieldType, l as BLR_EX_TIMESTAMP_TZ, m as BLR_LONG, n as BLR_BOOL, o as BLR_DEC64, p as BLR_INT64, r as BLR_CSTRING, s as BLR_DOUBLE, t as BLR_BLOB, u as BLR_EX_TIME_TZ, v as BLR_SQL_TIME, w as BLR_VARYING, x as BLR_TEXT2, y as BLR_SQL_TIME_TZ } from "../blr-types-
|
|
1
|
+
import { C as BLR_TIMESTAMP_TZ, D as FirebirdUnsupportedFieldTypeError, E as FirebirdPhysicalType, O as decodeBlrType, S as BLR_TIMESTAMP, T as BLR_VARYING2, _ as BLR_SQL_DATE, a as BLR_DEC128, b as BLR_TEXT, c as BLR_D_FLOAT, d as BLR_FLOAT, f as BLR_INT128, g as BLR_SHORT, h as BLR_QUAD, i as BLR_CSTRING2, k as describeFieldType, l as BLR_EX_TIMESTAMP_TZ, m as BLR_LONG, n as BLR_BOOL, o as BLR_DEC64, p as BLR_INT64, r as BLR_CSTRING, s as BLR_DOUBLE, t as BLR_BLOB, u as BLR_EX_TIME_TZ, v as BLR_SQL_TIME, w as BLR_VARYING, x as BLR_TEXT2, y as BLR_SQL_TIME_TZ } from "../blr-types-DVgO1DQ9.js";
|
|
2
2
|
export { BLR_BLOB, BLR_BOOL, BLR_CSTRING, BLR_CSTRING2, BLR_DEC128, BLR_DEC64, BLR_DOUBLE, BLR_D_FLOAT, BLR_EX_TIMESTAMP_TZ, BLR_EX_TIME_TZ, BLR_FLOAT, BLR_INT128, BLR_INT64, BLR_LONG, BLR_QUAD, BLR_SHORT, BLR_SQL_DATE, BLR_SQL_TIME, BLR_SQL_TIME_TZ, BLR_TEXT, BLR_TEXT2, BLR_TIMESTAMP, BLR_TIMESTAMP_TZ, BLR_VARYING, BLR_VARYING2, FirebirdPhysicalType, FirebirdUnsupportedFieldTypeError, decodeBlrType, describeFieldType };
|
|
@@ -64,7 +64,7 @@ function decodeBlrType(blrType) {
|
|
|
64
64
|
if (physical === void 0) throw new FirebirdUnsupportedFieldTypeError(blrType);
|
|
65
65
|
return physical;
|
|
66
66
|
}
|
|
67
|
-
function describeFieldType(physical, lengthBytes, scale, characterLength) {
|
|
67
|
+
function describeFieldType(physical, lengthBytes, scale, characterLength, subType) {
|
|
68
68
|
switch (physical) {
|
|
69
69
|
case "short": return scale === 0 ? "SMALLINT" : `NUMERIC(4,${-scale})`;
|
|
70
70
|
case "long": return scale === 0 ? "INTEGER" : `NUMERIC(9,${-scale})`;
|
|
@@ -78,7 +78,7 @@ function describeFieldType(physical, lengthBytes, scale, characterLength) {
|
|
|
78
78
|
case "varying": return `VARCHAR(${characterLength ?? lengthBytes})`;
|
|
79
79
|
case "cstring": return `CSTRING(${characterLength ?? lengthBytes})`;
|
|
80
80
|
case "boolean": return "BOOLEAN";
|
|
81
|
-
case "blob": return
|
|
81
|
+
case "blob": return `BLOB SUB_TYPE ${subType}`;
|
|
82
82
|
case "quad": return "ARRAY";
|
|
83
83
|
case "int128": return `NUMERIC(38,${-scale})`;
|
|
84
84
|
case "dec64": return "DECFLOAT(16)";
|
package/dist/firebird/data.cjs
CHANGED
|
@@ -26,23 +26,71 @@ var FirebirdCompositeRecordUnsupportedError = class extends Error {
|
|
|
26
26
|
this.recordType = recordType;
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
function
|
|
30
|
-
|
|
29
|
+
function readBlobRecord(reader) {
|
|
30
|
+
const ATT_BLOB_FIELD_NUMBER = 3;
|
|
31
|
+
const ATT_BLOB_NUMBER_SEGMENTS = 5;
|
|
32
|
+
const ATT_BLOB_DATA = 7;
|
|
33
|
+
let fieldNumber;
|
|
34
|
+
let segmentCount = 0;
|
|
31
35
|
for (;;) {
|
|
32
36
|
const attribute = reader.readTag();
|
|
33
|
-
if (attribute ===
|
|
34
|
-
if (attribute ===
|
|
35
|
-
else if (attribute ===
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
if (attribute === ATT_BLOB_DATA) break;
|
|
38
|
+
if (attribute === ATT_BLOB_FIELD_NUMBER) fieldNumber = reader.readInt32Attribute();
|
|
39
|
+
else if (attribute === ATT_BLOB_NUMBER_SEGMENTS) segmentCount = reader.readInt32Attribute();
|
|
40
|
+
else reader.skipAttributeValue();
|
|
41
|
+
}
|
|
42
|
+
if (fieldNumber === void 0) throw new FirebirdDataParseError("a rec_blob record had no att_blob_field_number attribute, so its content cannot be attributed to a column");
|
|
43
|
+
const segments = [];
|
|
44
|
+
let total = 0;
|
|
45
|
+
for (let i = 0; i < segmentCount; i++) {
|
|
46
|
+
const length = reader.readBlobSegmentLength();
|
|
47
|
+
const segment = reader.readRawPayload(length);
|
|
48
|
+
segments.push(segment);
|
|
49
|
+
total += segment.length;
|
|
50
|
+
}
|
|
51
|
+
const bytes = new Uint8Array(total);
|
|
52
|
+
let offset = 0;
|
|
53
|
+
for (const segment of segments) {
|
|
54
|
+
bytes.set(segment, offset);
|
|
55
|
+
offset += segment.length;
|
|
42
56
|
}
|
|
57
|
+
return {
|
|
58
|
+
fieldNumber,
|
|
59
|
+
bytes
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const BINARY_BLOB_DATA_URI_PREFIX = "data:application/octet-stream;base64,";
|
|
63
|
+
const BLOB_SUB_TYPE_TEXT = 1;
|
|
64
|
+
const BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
65
|
+
function bytesToBase64(bytes) {
|
|
66
|
+
let result = "";
|
|
67
|
+
for (let i = 0; i < bytes.length; i += 3) {
|
|
68
|
+
const b0 = bytes[i] ?? 0;
|
|
69
|
+
const b1 = bytes[i + 1];
|
|
70
|
+
const b2 = bytes[i + 2];
|
|
71
|
+
const triple = b0 << 16 | (b1 ?? 0) << 8 | (b2 ?? 0);
|
|
72
|
+
result += BASE64_ALPHABET[triple >> 18 & 63] ?? "";
|
|
73
|
+
result += BASE64_ALPHABET[triple >> 12 & 63] ?? "";
|
|
74
|
+
result += b1 === void 0 ? "=" : BASE64_ALPHABET[triple >> 6 & 63] ?? "";
|
|
75
|
+
result += b2 === void 0 ? "=" : BASE64_ALPHABET[triple & 63] ?? "";
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
function blobCellValue(field, bytes) {
|
|
80
|
+
if (field.subType === BLOB_SUB_TYPE_TEXT) return {
|
|
81
|
+
kind: "string",
|
|
82
|
+
value: new TextDecoder("utf-8").decode(bytes)
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
kind: "string",
|
|
86
|
+
value: `${BINARY_BLOB_DATA_URI_PREFIX}${bytesToBase64(bytes)}`
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function storedFieldsOf(fields) {
|
|
90
|
+
return fields.filter((field) => !field.computed);
|
|
43
91
|
}
|
|
44
92
|
function decodeRowValues(fields, payload) {
|
|
45
|
-
const storedFields = fields
|
|
93
|
+
const storedFields = storedFieldsOf(fields);
|
|
46
94
|
const xdr = new require_firebird_reader.XdrReader(payload);
|
|
47
95
|
const rawValues = [];
|
|
48
96
|
for (const field of storedFields) switch (field.physicalType) {
|
|
@@ -171,10 +219,16 @@ function readRowGroup(reader, relation, compressed) {
|
|
|
171
219
|
if (dataTag !== ATT_DATA_DATA) throw new FirebirdDataParseError(`relation "${relation.name}": expected att_data_data (tag ${ATT_DATA_DATA}), found tag ${dataTag}`);
|
|
172
220
|
}
|
|
173
221
|
const payload = compressed ? reader.readCompressedPayload(xdrLength) : reader.readRawPayload(xdrLength);
|
|
174
|
-
|
|
222
|
+
const values = decodeRowValues(relation.fields, payload);
|
|
223
|
+
rows.push(values);
|
|
175
224
|
let next = reader.readTag();
|
|
176
225
|
while (next === REC_BLOB) {
|
|
177
|
-
|
|
226
|
+
const blob = readBlobRecord(reader);
|
|
227
|
+
const storedFields = storedFieldsOf(relation.fields);
|
|
228
|
+
const columnIndex = storedFields.findIndex((field) => field.fieldNumber === blob.fieldNumber);
|
|
229
|
+
const field = storedFields[columnIndex];
|
|
230
|
+
if (field === void 0) throw new FirebirdDataParseError(`relation "${relation.name}": a rec_blob record names att_blob_field_number ${blob.fieldNumber}, which matches no field's own att_field_number in this relation`);
|
|
231
|
+
values[columnIndex] = blobCellValue(field, blob.bytes);
|
|
178
232
|
next = reader.readTag();
|
|
179
233
|
}
|
|
180
234
|
if (next !== REC_DATA) {
|
package/dist/firebird/data.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as FirebirdBackupReader } from "../reader-DP0Mbaj4.cjs";
|
|
2
|
-
import { n as FirebirdRelation } from "../schema-
|
|
2
|
+
import { n as FirebirdRelation } from "../schema-BeR_KJ0X.cjs";
|
|
3
3
|
import { ContentCellValue } from "document-schema.js";
|
|
4
4
|
//#region src/firebird/data.d.ts
|
|
5
5
|
declare class FirebirdDataParseError extends Error {
|
package/dist/firebird/data.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as FirebirdBackupReader } from "../reader-DP0Mbaj4.js";
|
|
2
|
-
import { n as FirebirdRelation } from "../schema-
|
|
2
|
+
import { n as FirebirdRelation } from "../schema-CSKwSb_v.js";
|
|
3
3
|
import { ContentCellValue } from "document-schema.js";
|
|
4
4
|
//#region src/firebird/data.d.ts
|
|
5
5
|
declare class FirebirdDataParseError extends Error {
|