@evotecit/officeimo 0.1.1 → 0.1.2
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/bundles/officeimo-canopyx.js +95 -85
- package/bundles/officeimo-canopyx.mjs +29 -19
- package/bundles/officeimo-datatables.js +95 -85
- package/bundles/officeimo-datatables.mjs +29 -19
- package/bundles/officeimo-pdf.js +15 -14
- package/bundles/officeimo-pdf.mjs +3 -2
- package/bundles/officeimo-xlsx.js +78 -69
- package/bundles/officeimo-xlsx.mjs +26 -17
- package/bundles/officeimo.js +95 -85
- package/bundles/officeimo.mjs +29 -19
- package/dist/opc/index.js +14 -9
- package/dist/pdf/pages.js +3 -2
- package/dist/xlsx/workbook.js +7 -4
- package/dist/xlsx/worksheet.js +2 -1
- package/dist/xml/index.js +3 -3
- package/package.json +1 -1
|
@@ -1289,6 +1289,8 @@ const { OfficeIMOError } = _m2;
|
|
|
1289
1289
|
const { ChunkedTextSink } = _m3;
|
|
1290
1290
|
|
|
1291
1291
|
const xmlDeclaration = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
|
1292
|
+
const xmlEscapes = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'",
|
|
1293
|
+
"\r": " ", "\n": " ", "\t": "	" };
|
|
1292
1294
|
/** XML 1.0 characters; Unicode mode retains valid surrogate pairs. */
|
|
1293
1295
|
function cleanXml(value, policy = "strip") {
|
|
1294
1296
|
if (policy !== "strip" && policy !== "reject")
|
|
@@ -1300,9 +1302,7 @@ function cleanXml(value, policy = "strip") {
|
|
|
1300
1302
|
}
|
|
1301
1303
|
/** Escape data, including whitespace that XML parsers otherwise normalize. */
|
|
1302
1304
|
function escapeXml(value, policy = "strip") {
|
|
1303
|
-
|
|
1304
|
-
"\r": " ", "\n": " ", "\t": "	" };
|
|
1305
|
-
return cleanXml(value, policy).replace(/[&<>"'\r\n\t]/g, c => escapes[c]);
|
|
1305
|
+
return cleanXml(value, policy).replace(/[&<>"'\r\n\t]/g, c => xmlEscapes[c]);
|
|
1306
1306
|
}
|
|
1307
1307
|
/** Encode an OOXML ST_Xstring attribute without interpreting literal escape tokens as characters. */
|
|
1308
1308
|
function escapeOoxmlAttribute(value, policy = "strip") {
|
|
@@ -1900,8 +1900,11 @@ class OpcPackage {
|
|
|
1900
1900
|
return uri;
|
|
1901
1901
|
}
|
|
1902
1902
|
addPart(part) {
|
|
1903
|
-
const uri
|
|
1904
|
-
|
|
1903
|
+
const { uri: requestedUri, contentType, data } = part;
|
|
1904
|
+
// Structural accessors and byte ownership are captured before reserving metadata.
|
|
1905
|
+
const capturedData = data instanceof Uint8Array ? new Uint8Array(data) : data;
|
|
1906
|
+
const uri = this.reserve(requestedUri, contentType);
|
|
1907
|
+
this.parts.set(uri.toLowerCase(), { uri, contentType, data: capturedData });
|
|
1905
1908
|
}
|
|
1906
1909
|
/** @internal */
|
|
1907
1910
|
addPrepared(uri, type, prepared) {
|
|
@@ -1926,17 +1929,19 @@ class OpcPackage {
|
|
|
1926
1929
|
checkAbort(this.options.signal);
|
|
1927
1930
|
this.open();
|
|
1928
1931
|
source = source === "/" ? source : partUri(source);
|
|
1929
|
-
|
|
1932
|
+
const { id, type, target: requestedTarget, external } = relationship;
|
|
1933
|
+
this.open();
|
|
1934
|
+
if (!/^[A-Za-z_][A-Za-z0-9_.-]*$/.test(id))
|
|
1930
1935
|
throw new TypeError("Relationship id must be an XML ID.");
|
|
1931
|
-
if (!/^[A-Za-z][A-Za-z0-9+.-]*:[^\s<>"']+$/.test(
|
|
1936
|
+
if (!/^[A-Za-z][A-Za-z0-9+.-]*:[^\s<>"']+$/.test(type))
|
|
1932
1937
|
throw new TypeError("Relationship type must be an absolute URI.");
|
|
1933
|
-
const target =
|
|
1934
|
-
if (
|
|
1938
|
+
const target = external ? requestedTarget : partUri(requestedTarget);
|
|
1939
|
+
if (external && (!target || /[\u0000-\u0020]/.test(target)))
|
|
1935
1940
|
throw new TypeError("Invalid external relationship target.");
|
|
1936
1941
|
const key = source.toLowerCase(), list = this.relationships.get(key) ?? new Map();
|
|
1937
|
-
if (list.has(
|
|
1938
|
-
throw new TypeError("Duplicate relationship id: " +
|
|
1939
|
-
list.set(
|
|
1942
|
+
if (list.has(id))
|
|
1943
|
+
throw new TypeError("Duplicate relationship id: " + id);
|
|
1944
|
+
list.set(id, { id, type, target, ...(external === undefined ? {} : { external }) });
|
|
1940
1945
|
this.relationships.set(key, list);
|
|
1941
1946
|
}
|
|
1942
1947
|
setProperties(core = {}, app = {}) {
|
|
@@ -3747,7 +3752,8 @@ class Worksheet {
|
|
|
3747
3752
|
});
|
|
3748
3753
|
const originalCharacters = typeof value === "string" ? value.length : 0;
|
|
3749
3754
|
let reservedCharacters = this.preserved || header || footer ? originalCharacters : undefined;
|
|
3750
|
-
|
|
3755
|
+
// Cleaning removes characters; ordinary strings cannot cross Excel's limit.
|
|
3756
|
+
if (type === "string" && originalCharacters > 32767 && cleanXml(value, this.book.settings.invalidCharacterPolicy).length > 32767) {
|
|
3751
3757
|
const cell = col.letter + row;
|
|
3752
3758
|
if (link || this.linkedCells.has(cell))
|
|
3753
3759
|
throw new TypeError("A text-preservation cell cannot also have an external hyperlink.");
|
|
@@ -4967,12 +4973,15 @@ class Workbook {
|
|
|
4967
4973
|
});
|
|
4968
4974
|
}
|
|
4969
4975
|
addPart(part) {
|
|
4976
|
+
this.assertOpen();
|
|
4977
|
+
const { uri, contentType, data, relationship } = part;
|
|
4978
|
+
const capturedRelationship = relationship && { id: relationship.id, type: relationship.type, source: relationship.source };
|
|
4970
4979
|
this.assertOpen();
|
|
4971
4980
|
// Reserve now so collisions and invalid names fail at the call site.
|
|
4972
|
-
this.package.addPart(
|
|
4973
|
-
if (
|
|
4974
|
-
const { source,
|
|
4975
|
-
this.package.addRelationship(source ?? "/xl/workbook.xml", {
|
|
4981
|
+
this.package.addPart({ uri, contentType, data });
|
|
4982
|
+
if (capturedRelationship) {
|
|
4983
|
+
const { source, id, type } = capturedRelationship;
|
|
4984
|
+
this.package.addRelationship(source ?? "/xl/workbook.xml", { id, type, target: uri });
|
|
4976
4985
|
}
|
|
4977
4986
|
}
|
|
4978
4987
|
/** Complete the archive and return counts. Does not close or dispose a caller-owned sink. */
|
|
@@ -8816,7 +8825,7 @@ class PdfPages {
|
|
|
8816
8825
|
// Charge physical repeats without recapturing callbacks or making them semantic duplicates.
|
|
8817
8826
|
for (const cell of header.cells)
|
|
8818
8827
|
if (!this.bandCellBudget && this.paintedHeaderBudgetCells.has(cell.source ?? cell))
|
|
8819
|
-
this.settings.budget.cell(cell.lines.map(line => line.text).join(""));
|
|
8828
|
+
this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" : cell.lines.map(line => line.text).join(""));
|
|
8820
8829
|
const elements = this.tableStructure ? header.cells.map(cell => this.tableStructure.owner(cell.source ?? cell)) : undefined;
|
|
8821
8830
|
const repeated = header.cells.map(cell => this.paintedHeaderCells.has(cell.source ?? cell));
|
|
8822
8831
|
this.draw(header, 0, header.lines, elements, repeated);
|
|
@@ -8837,7 +8846,8 @@ class PdfPages {
|
|
|
8837
8846
|
const { padding, fontSize } = this.settings, n = pdfNumber, height = lineCount * row.lineHeight + padding * 2;
|
|
8838
8847
|
for (const [index, cell] of row.cells.entries()) {
|
|
8839
8848
|
if (this.bandCellBudget)
|
|
8840
|
-
this.settings.budget.cell(
|
|
8849
|
+
this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" :
|
|
8850
|
+
(cell.height === undefined ? cell.lines.slice(firstLine, firstLine + lineCount) : cell.lines).map(line => line.text).join(""));
|
|
8841
8851
|
const x = this.layout.lefts[cell.first], cellHeight = cell.height ?? height;
|
|
8842
8852
|
if (cell.style.background)
|
|
8843
8853
|
this.add(this.artifact("q " + this.rgb(cell.style.background) + " rg " + n(x) + " " + n(this.y - cellHeight) + " " + n(cell.width) + " " + n(cellHeight) + " re f Q\n"));
|
package/bundles/officeimo-pdf.js
CHANGED
|
@@ -3821,7 +3821,7 @@ _modules.set("a66257a32f03d958aa57be4de9da7f80b708cebca26b5cc6404de0ee11bfe052",
|
|
|
3821
3821
|
return _exports;
|
|
3822
3822
|
})();
|
|
3823
3823
|
|
|
3824
|
-
const _m34 = _modules.get("
|
|
3824
|
+
const _m34 = _modules.get("a7fca40cb8c75af206111c90db36839b4648982beeb4179efda0ddd1ee366210") ?? (() => {
|
|
3825
3825
|
const { OfficeIMOError } = _m4;
|
|
3826
3826
|
|
|
3827
3827
|
const { checkAbort } = _m3;
|
|
@@ -4106,7 +4106,7 @@ class PdfPages {
|
|
|
4106
4106
|
// Charge physical repeats without recapturing callbacks or making them semantic duplicates.
|
|
4107
4107
|
for (const cell of header.cells)
|
|
4108
4108
|
if (!this.bandCellBudget && this.paintedHeaderBudgetCells.has(cell.source ?? cell))
|
|
4109
|
-
this.settings.budget.cell(cell.lines.map(line => line.text).join(""));
|
|
4109
|
+
this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" : cell.lines.map(line => line.text).join(""));
|
|
4110
4110
|
const elements = this.tableStructure ? header.cells.map(cell => this.tableStructure.owner(cell.source ?? cell)) : undefined;
|
|
4111
4111
|
const repeated = header.cells.map(cell => this.paintedHeaderCells.has(cell.source ?? cell));
|
|
4112
4112
|
this.draw(header, 0, header.lines, elements, repeated);
|
|
@@ -4127,7 +4127,8 @@ class PdfPages {
|
|
|
4127
4127
|
const { padding, fontSize } = this.settings, n = pdfNumber, height = lineCount * row.lineHeight + padding * 2;
|
|
4128
4128
|
for (const [index, cell] of row.cells.entries()) {
|
|
4129
4129
|
if (this.bandCellBudget)
|
|
4130
|
-
this.settings.budget.cell(
|
|
4130
|
+
this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" :
|
|
4131
|
+
(cell.height === undefined ? cell.lines.slice(firstLine, firstLine + lineCount) : cell.lines).map(line => line.text).join(""));
|
|
4131
4132
|
const x = this.layout.lefts[cell.first], cellHeight = cell.height ?? height;
|
|
4132
4133
|
if (cell.style.background)
|
|
4133
4134
|
this.add(this.artifact("q " + this.rgb(cell.style.background) + " rg " + n(x) + " " + n(this.y - cellHeight) + " " + n(cell.width) + " " + n(cellHeight) + " re f Q\n"));
|
|
@@ -4512,7 +4513,7 @@ class PdfPages {
|
|
|
4512
4513
|
}
|
|
4513
4514
|
}
|
|
4514
4515
|
const _exports = Object.freeze({ PdfPages: PdfPages });
|
|
4515
|
-
_modules.set("
|
|
4516
|
+
_modules.set("a7fca40cb8c75af206111c90db36839b4648982beeb4179efda0ddd1ee366210", _exports);
|
|
4516
4517
|
return _exports;
|
|
4517
4518
|
})();
|
|
4518
4519
|
|
|
@@ -4955,7 +4956,7 @@ _modules.set("52c78ca6833cee7e5a96b657e2c00172d550176daf2c95e742692f8416977bea",
|
|
|
4955
4956
|
return _exports;
|
|
4956
4957
|
})();
|
|
4957
4958
|
|
|
4958
|
-
const _m18 = _modules.get("
|
|
4959
|
+
const _m18 = _modules.get("eb2c981b4568b33deca2137956ace31ea621b6a6287755ec234336d0a7c23cfc") ?? (() => {
|
|
4959
4960
|
const { PdfObjects, unicodeHex } = _m19;
|
|
4960
4961
|
|
|
4961
4962
|
const { PdfFontResources } = _m21;
|
|
@@ -5018,11 +5019,11 @@ class PdfWriteSession {
|
|
|
5018
5019
|
}
|
|
5019
5020
|
}
|
|
5020
5021
|
const _exports = Object.freeze({ PdfWriteSession: PdfWriteSession });
|
|
5021
|
-
_modules.set("
|
|
5022
|
+
_modules.set("eb2c981b4568b33deca2137956ace31ea621b6a6287755ec234336d0a7c23cfc", _exports);
|
|
5022
5023
|
return _exports;
|
|
5023
5024
|
})();
|
|
5024
5025
|
|
|
5025
|
-
const _m1 = _modules.get("
|
|
5026
|
+
const _m1 = _modules.get("98eb735e985f873ed0ffc628449a20d1f3bb729a87b6d6b3099b6f308438fcb5") ?? (() => {
|
|
5026
5027
|
const { BlobByteSink, withDestination } = _m2;
|
|
5027
5028
|
|
|
5028
5029
|
const { beginTask, checkAbort, consumeRows, pause, taskYieldDue } = _m3;
|
|
@@ -5087,7 +5088,7 @@ async function writePdfTo(rows, destination, configuration) {
|
|
|
5087
5088
|
});
|
|
5088
5089
|
}
|
|
5089
5090
|
const _exports = Object.freeze({ writePdf: writePdf, writePdfTo: writePdfTo });
|
|
5090
|
-
_modules.set("
|
|
5091
|
+
_modules.set("98eb735e985f873ed0ffc628449a20d1f3bb729a87b6d6b3099b6f308438fcb5", _exports);
|
|
5091
5092
|
return _exports;
|
|
5092
5093
|
})();
|
|
5093
5094
|
|
|
@@ -6566,7 +6567,7 @@ _modules.set("d43e573fd5bad18a7ec2d71752168c422c4f8fabbc51f1cef8e3ba389f298715",
|
|
|
6566
6567
|
return _exports;
|
|
6567
6568
|
})();
|
|
6568
6569
|
|
|
6569
|
-
const _m45 = _modules.get("
|
|
6570
|
+
const _m45 = _modules.get("f6c70e9a0bed09b5a1c61a662ad7d3faf731c911f574e2df285f669bd643b947") ?? (() => {
|
|
6570
6571
|
const { BlobByteSink, withDestination } = _m2;
|
|
6571
6572
|
|
|
6572
6573
|
const { OfficeIMOError } = _m4;
|
|
@@ -6856,11 +6857,11 @@ function captureTableOptions(options) {
|
|
|
6856
6857
|
return { ...captured, ...(captured.wideTable === undefined ? {} : { wideTable: captureWideTable(captured.wideTable) }) };
|
|
6857
6858
|
}
|
|
6858
6859
|
const _exports = Object.freeze({ pdfTable: pdfTable, writePdfDocument: writePdfDocument, writePdfDocumentTo: writePdfDocumentTo });
|
|
6859
|
-
_modules.set("
|
|
6860
|
+
_modules.set("f6c70e9a0bed09b5a1c61a662ad7d3faf731c911f574e2df285f669bd643b947", _exports);
|
|
6860
6861
|
return _exports;
|
|
6861
6862
|
})();
|
|
6862
6863
|
|
|
6863
|
-
const _m43 = _modules.get("
|
|
6864
|
+
const _m43 = _modules.get("879a0adeb3c62918085a071cbc37f221eb89a0fd73d56ebb5e9cfe0d49db8ee9") ?? (() => {
|
|
6864
6865
|
const { assertGroupedReportSource } = _m44;
|
|
6865
6866
|
|
|
6866
6867
|
const { BlobByteSink } = _m2;
|
|
@@ -6906,7 +6907,7 @@ async function writeGroupedPdfTo(report, destination, configuration) {
|
|
|
6906
6907
|
return writePdfDocumentTo([pdfGroupedTable(report, tableOptions)], destination, documentOptions);
|
|
6907
6908
|
}
|
|
6908
6909
|
const _exports = Object.freeze({ pdfGroupedTable: _m54.pdfGroupedTable, writeGroupedPdf: writeGroupedPdf, writeGroupedPdfTo: writeGroupedPdfTo });
|
|
6909
|
-
_modules.set("
|
|
6910
|
+
_modules.set("879a0adeb3c62918085a071cbc37f221eb89a0fd73d56ebb5e9cfe0d49db8ee9", _exports);
|
|
6910
6911
|
return _exports;
|
|
6911
6912
|
})();
|
|
6912
6913
|
|
|
@@ -6999,10 +7000,10 @@ _modules.set("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00",
|
|
|
6999
7000
|
return _exports;
|
|
7000
7001
|
})();
|
|
7001
7002
|
|
|
7002
|
-
const _m0 = _modules.get("
|
|
7003
|
+
const _m0 = _modules.get("2deab7b4ccb08bed297341ddb563d8fcf74277aff38c1dfc3d9edd61c0d98481") ?? (() => {
|
|
7003
7004
|
|
|
7004
7005
|
const _exports = Object.freeze({ writePdf: _m1.writePdf, writePdfTo: _m1.writePdfTo, writeGroupedPdf: _m43.writeGroupedPdf, writeGroupedPdfTo: _m43.writeGroupedPdfTo, pdfGroupedTable: _m43.pdfGroupedTable, createGroupedReport: _m44.createGroupedReport, writePdfDocument: _m45.writePdfDocument, writePdfDocumentTo: _m45.writePdfDocumentTo, pdfTable: _m45.pdfTable, PdfFont: _m22.PdfFont, preflightPdfText: _m55.preflightPdfText, ExportCell: _m7.ExportCell, saveBlob: _m56.saveBlob });
|
|
7005
|
-
_modules.set("
|
|
7006
|
+
_modules.set("2deab7b4ccb08bed297341ddb563d8fcf74277aff38c1dfc3d9edd61c0d98481", _exports);
|
|
7006
7007
|
return _exports;
|
|
7007
7008
|
})();
|
|
7008
7009
|
Object.assign(officeimo, _m0, { core: _m56, pdf: _m0 });
|
|
@@ -4064,7 +4064,7 @@ class PdfPages {
|
|
|
4064
4064
|
// Charge physical repeats without recapturing callbacks or making them semantic duplicates.
|
|
4065
4065
|
for (const cell of header.cells)
|
|
4066
4066
|
if (!this.bandCellBudget && this.paintedHeaderBudgetCells.has(cell.source ?? cell))
|
|
4067
|
-
this.settings.budget.cell(cell.lines.map(line => line.text).join(""));
|
|
4067
|
+
this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" : cell.lines.map(line => line.text).join(""));
|
|
4068
4068
|
const elements = this.tableStructure ? header.cells.map(cell => this.tableStructure.owner(cell.source ?? cell)) : undefined;
|
|
4069
4069
|
const repeated = header.cells.map(cell => this.paintedHeaderCells.has(cell.source ?? cell));
|
|
4070
4070
|
this.draw(header, 0, header.lines, elements, repeated);
|
|
@@ -4085,7 +4085,8 @@ class PdfPages {
|
|
|
4085
4085
|
const { padding, fontSize } = this.settings, n = pdfNumber, height = lineCount * row.lineHeight + padding * 2;
|
|
4086
4086
|
for (const [index, cell] of row.cells.entries()) {
|
|
4087
4087
|
if (this.bandCellBudget)
|
|
4088
|
-
this.settings.budget.cell(
|
|
4088
|
+
this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" :
|
|
4089
|
+
(cell.height === undefined ? cell.lines.slice(firstLine, firstLine + lineCount) : cell.lines).map(line => line.text).join(""));
|
|
4089
4090
|
const x = this.layout.lefts[cell.first], cellHeight = cell.height ?? height;
|
|
4090
4091
|
if (cell.style.background)
|
|
4091
4092
|
this.add(this.artifact("q " + this.rgb(cell.style.background) + " rg " + n(x) + " " + n(this.y - cellHeight) + " " + n(cell.width) + " " + n(cellHeight) + " re f Q\n"));
|