@evotecit/officeimo 0.1.0 → 0.1.1
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 +13 -10
- package/bundles/officeimo-canopyx.js +813 -358
- package/bundles/officeimo-canopyx.mjs +700 -246
- package/bundles/officeimo-csv.js +29 -19
- package/bundles/officeimo-csv.mjs +17 -7
- package/bundles/officeimo-datatables.js +806 -360
- package/bundles/officeimo-datatables.mjs +694 -249
- package/bundles/officeimo-execution.js +35 -25
- package/bundles/officeimo-execution.mjs +17 -7
- package/bundles/officeimo-pdf.js +734 -289
- package/bundles/officeimo-pdf.mjs +685 -241
- package/bundles/officeimo-xlsx.js +88 -77
- package/bundles/officeimo-xlsx.mjs +22 -11
- package/bundles/officeimo.js +790 -344
- package/bundles/officeimo.mjs +680 -235
- package/dist/core/index.d.ts +2 -0
- package/dist/core/iteration.js +2 -2
- package/dist/core/sinks.js +2 -1
- package/dist/integrations/canopyx/source.js +13 -7
- package/dist/integrations/datatables/snapshot.js +3 -3
- package/dist/internal/rows.js +13 -4
- package/dist/pdf/document-grouped.js +72 -22
- package/dist/pdf/font-resources.js +2 -1
- package/dist/pdf/inline-text.js +50 -9
- package/dist/pdf/objects.js +188 -11
- package/dist/pdf/pages.js +25 -26
- package/dist/pdf/paragraph-layout.d.ts +2 -0
- package/dist/pdf/paragraph-layout.js +9 -4
- package/dist/pdf/session.js +1 -1
- package/dist/pdf/settings.d.ts +2 -0
- package/dist/pdf/settings.js +27 -2
- package/dist/pdf/structure.js +80 -28
- package/dist/pdf/table-band-flow.js +26 -11
- package/dist/pdf/table-band-plan.js +1 -3
- package/dist/pdf/table-layout.d.ts +4 -0
- package/dist/pdf/table-layout.js +22 -10
- package/dist/pdf/table-structure.js +28 -12
- package/dist/pdf/text.js +5 -0
- package/dist/pdf/types.d.ts +4 -2
- package/dist/pdf/xref.d.ts +1 -0
- package/dist/pdf/xref.js +30 -0
- package/dist/xlsx/values.js +3 -2
- package/dist/zip/entry.js +1 -1
- package/dist/zip/index.js +1 -1
- package/package.json +1 -1
package/bundles/officeimo-csv.js
CHANGED
|
@@ -5,10 +5,10 @@ const officeimo = root.OfficeIMO || (root.OfficeIMO = {});
|
|
|
5
5
|
const cacheKey = Symbol.for("@evotecit/officeimo/modules");
|
|
6
6
|
const _modules = officeimo[cacheKey] || new Map();
|
|
7
7
|
if (!officeimo[cacheKey]) Object.defineProperty(officeimo, cacheKey, { value: _modules });
|
|
8
|
-
const _m1 = _modules.get("
|
|
8
|
+
const _m1 = _modules.get("87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3") ?? (() => {
|
|
9
9
|
function checkAbort(signal) {
|
|
10
10
|
if (signal?.aborted)
|
|
11
|
-
throw signal.reason
|
|
11
|
+
throw signal.reason;
|
|
12
12
|
}
|
|
13
13
|
/** Race a pending producer or sink operation without leaving abort listeners behind. */
|
|
14
14
|
function withAbort(promise, signal) {
|
|
@@ -16,7 +16,7 @@ function withAbort(promise, signal) {
|
|
|
16
16
|
return Promise.resolve(promise);
|
|
17
17
|
return new Promise((resolve, reject) => {
|
|
18
18
|
const cleanup = () => signal.removeEventListener("abort", abort);
|
|
19
|
-
const abort = () => { cleanup(); reject(signal.reason
|
|
19
|
+
const abort = () => { cleanup(); reject(signal.reason); };
|
|
20
20
|
signal.addEventListener("abort", abort, { once: true });
|
|
21
21
|
Promise.resolve(promise).then(value => { cleanup(); resolve(value); }, error => { cleanup(); reject(error); });
|
|
22
22
|
if (signal.aborted)
|
|
@@ -156,7 +156,7 @@ function pause() {
|
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
const _exports = Object.freeze({ checkAbort: checkAbort, withAbort: withAbort, inputRows: inputRows, rowsFromBatches: rowsFromBatches, concatRows: concatRows, consumeRows: consumeRows, beginTask: beginTask, taskYieldDue: taskYieldDue, pause: pause });
|
|
159
|
-
_modules.set("
|
|
159
|
+
_modules.set("87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3", _exports);
|
|
160
160
|
return _exports;
|
|
161
161
|
})();
|
|
162
162
|
|
|
@@ -197,7 +197,7 @@ _modules.set("d5c945064d81fdd257960f48c421125e106e5f270427d170bb05587dd96a44ea",
|
|
|
197
197
|
return _exports;
|
|
198
198
|
})();
|
|
199
199
|
|
|
200
|
-
const _m2 = _modules.get("
|
|
200
|
+
const _m2 = _modules.get("5337d1e3bd5ae0c1d10a476fcd31540d20337ccf7aa93c7e9e26c2b1a7dab92b") ?? (() => {
|
|
201
201
|
const { checkAbort, consumeRows, withAbort, pause, taskYieldDue } = _m1;
|
|
202
202
|
|
|
203
203
|
const { OfficeIMOError } = _m3;
|
|
@@ -207,8 +207,9 @@ async function withDestination(destination, operation) {
|
|
|
207
207
|
// Native streams can belong to another browser realm; constructor identity is not portable.
|
|
208
208
|
if (destination && typeof destination.getWriter === "function") {
|
|
209
209
|
const writer = destination.getWriter();
|
|
210
|
+
// Native streams may retain accepted chunks after write resolves.
|
|
210
211
|
try {
|
|
211
|
-
return await operation({ write: bytes => writer.write(bytes) });
|
|
212
|
+
return await operation({ write: bytes => writer.write(new Uint8Array(bytes)) });
|
|
212
213
|
}
|
|
213
214
|
finally {
|
|
214
215
|
writer.releaseLock();
|
|
@@ -302,7 +303,7 @@ async function writeBytes(source, sink, signal) {
|
|
|
302
303
|
});
|
|
303
304
|
}
|
|
304
305
|
const _exports = Object.freeze({ withDestination: withDestination, BlobByteSink: BlobByteSink, ChunkedTextSink: ChunkedTextSink, writeBytes: writeBytes });
|
|
305
|
-
_modules.set("
|
|
306
|
+
_modules.set("5337d1e3bd5ae0c1d10a476fcd31540d20337ccf7aa93c7e9e26c2b1a7dab92b", _exports);
|
|
306
307
|
return _exports;
|
|
307
308
|
})();
|
|
308
309
|
|
|
@@ -515,7 +516,7 @@ _modules.set("6cfd3e806439f6301003a2d1699a74fdfa574d935550ab62b97b528728eaee1f",
|
|
|
515
516
|
return _exports;
|
|
516
517
|
})();
|
|
517
518
|
|
|
518
|
-
const _m10 = _modules.get("
|
|
519
|
+
const _m10 = _modules.get("0391fe35ea7d02b25804ab4d0e7543136d6bb615f368f268c74aa135f23aa6bc") ?? (() => {
|
|
519
520
|
const { assertExportValue } = _m6;
|
|
520
521
|
|
|
521
522
|
const { checkAbort } = _m1;
|
|
@@ -528,11 +529,18 @@ function createRowProjector(columns, worksheet, signal, validate = assertExportV
|
|
|
528
529
|
const getters = columns.some(column => column.value);
|
|
529
530
|
return (row, rowIndex = 0) => {
|
|
530
531
|
if (Array.isArray(row) && !getters) {
|
|
531
|
-
|
|
532
|
+
const length = row.length;
|
|
533
|
+
if (length > columns.length)
|
|
532
534
|
throw new RangeError("Row has more values than declared columns.");
|
|
533
|
-
|
|
535
|
+
// Resolve each positional value once, just like key/value projections. Returning the
|
|
536
|
+
// source array would let an accessor change a value after the portable-value check.
|
|
537
|
+
const values = new Array(length);
|
|
538
|
+
for (let index = 0; index < length; index++) {
|
|
539
|
+
const value = row[index];
|
|
534
540
|
validate(value);
|
|
535
|
-
|
|
541
|
+
values[index] = value;
|
|
542
|
+
}
|
|
543
|
+
return values;
|
|
536
544
|
}
|
|
537
545
|
if (!row || typeof row !== "object" || isDate(row))
|
|
538
546
|
throw new TypeError("A row must be an array or object.");
|
|
@@ -561,7 +569,7 @@ function createRowProjector(columns, worksheet, signal, validate = assertExportV
|
|
|
561
569
|
};
|
|
562
570
|
}
|
|
563
571
|
/** @internal Shared metadata fields for full columns and adapter-owned partial overrides. */
|
|
564
|
-
const columnOptionFields = ["header", "key", "value", "width", "type", "format", "wrapText", "alignment", "groups", "style", "valueFormatter"];
|
|
572
|
+
const columnOptionFields = ["header", "key", "value", "width", "type", "format", "wrapText", "alignment", "rowHeader", "groups", "style", "valueFormatter"];
|
|
565
573
|
function copyColumns(columns, workbookStyles = false) {
|
|
566
574
|
if (!Array.isArray(columns))
|
|
567
575
|
throw new TypeError("Declare the columns in export order.");
|
|
@@ -577,6 +585,8 @@ function copyColumns(columns, workbookStyles = false) {
|
|
|
577
585
|
throw new TypeError("Each column needs a string header and an optional string key.");
|
|
578
586
|
if (captured.value !== undefined && typeof captured.value !== "function")
|
|
579
587
|
throw new TypeError("Column value getters must be functions.");
|
|
588
|
+
if (captured.rowHeader !== undefined && typeof captured.rowHeader !== "boolean")
|
|
589
|
+
throw new TypeError("Column rowHeader must be boolean.");
|
|
580
590
|
if (captured.groups !== undefined) {
|
|
581
591
|
if (!Array.isArray(captured.groups))
|
|
582
592
|
throw new TypeError("Column groups must be an array of strings.");
|
|
@@ -589,7 +599,7 @@ function copyColumns(columns, workbookStyles = false) {
|
|
|
589
599
|
});
|
|
590
600
|
}
|
|
591
601
|
const _exports = Object.freeze({ createRowProjector: createRowProjector, columnOptionFields: columnOptionFields, copyColumns: copyColumns });
|
|
592
|
-
_modules.set("
|
|
602
|
+
_modules.set("0391fe35ea7d02b25804ab4d0e7543136d6bb615f368f268c74aa135f23aa6bc", _exports);
|
|
593
603
|
return _exports;
|
|
594
604
|
})();
|
|
595
605
|
|
|
@@ -785,7 +795,7 @@ _modules.set("c9fde2c438e186da56f740105fcd41c265fdfdd855a4f1b811d556a02387479b",
|
|
|
785
795
|
return _exports;
|
|
786
796
|
})();
|
|
787
797
|
|
|
788
|
-
const _m17 = _modules.get("
|
|
798
|
+
const _m17 = _modules.get("046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a68c0") ?? (() => {
|
|
789
799
|
const { ExportCell, assertScalar } = _m6;
|
|
790
800
|
|
|
791
801
|
const { isDate } = _m7;
|
|
@@ -1047,11 +1057,11 @@ function createGroupedReport(rows, options) {
|
|
|
1047
1057
|
return source;
|
|
1048
1058
|
}
|
|
1049
1059
|
const _exports = Object.freeze({ assertGroupedReportSource: assertGroupedReportSource, groupedReportEvents: groupedReportEvents, groupedReportOperation: groupedReportOperation, createGroupedReport: createGroupedReport });
|
|
1050
|
-
_modules.set("
|
|
1060
|
+
_modules.set("046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a68c0", _exports);
|
|
1051
1061
|
return _exports;
|
|
1052
1062
|
})();
|
|
1053
1063
|
|
|
1054
|
-
const _m16 = _modules.get("
|
|
1064
|
+
const _m16 = _modules.get("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00") ?? (() => {
|
|
1055
1065
|
|
|
1056
1066
|
|
|
1057
1067
|
|
|
@@ -1096,11 +1106,11 @@ function saveBlob(blob, fileName) {
|
|
|
1096
1106
|
}
|
|
1097
1107
|
}
|
|
1098
1108
|
const _exports = Object.freeze({ OfficeIMOError: _m3.OfficeIMOError, NotSupportedError: _m3.NotSupportedError, BlobByteSink: _m2.BlobByteSink, ChunkedTextSink: _m2.ChunkedTextSink, writeBytes: _m2.writeBytes, ExportCell: _m6.ExportCell, createGroupedReport: _m17.createGroupedReport, checkAbort: _m1.checkAbort, withAbort: _m1.withAbort, inputRows: _m1.inputRows, pause: _m1.pause, detectFeatures: detectFeatures, saveBlob: saveBlob });
|
|
1099
|
-
_modules.set("
|
|
1109
|
+
_modules.set("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00", _exports);
|
|
1100
1110
|
return _exports;
|
|
1101
1111
|
})();
|
|
1102
1112
|
|
|
1103
|
-
const _m0 = _modules.get("
|
|
1113
|
+
const _m0 = _modules.get("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1") ?? (() => {
|
|
1104
1114
|
const { beginTask, checkAbort, consumeRows, taskYieldDue, withAbort } = _m1;
|
|
1105
1115
|
|
|
1106
1116
|
const { BlobByteSink, ChunkedTextSink, withDestination } = _m2;
|
|
@@ -1247,7 +1257,7 @@ async function writeCsv(rows, configuration) {
|
|
|
1247
1257
|
}
|
|
1248
1258
|
}
|
|
1249
1259
|
const _exports = Object.freeze({ saveBlob: _m16.saveBlob, ExportCell: _m6.ExportCell, writeCsvTo: writeCsvTo, writeCsv: writeCsv });
|
|
1250
|
-
_modules.set("
|
|
1260
|
+
_modules.set("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1", _exports);
|
|
1251
1261
|
return _exports;
|
|
1252
1262
|
})();
|
|
1253
1263
|
Object.assign(officeimo, _m0, { core: _m16, csv: _m0 });
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const _m1 = (() => {
|
|
3
3
|
function checkAbort(signal) {
|
|
4
4
|
if (signal?.aborted)
|
|
5
|
-
throw signal.reason
|
|
5
|
+
throw signal.reason;
|
|
6
6
|
}
|
|
7
7
|
/** Race a pending producer or sink operation without leaving abort listeners behind. */
|
|
8
8
|
function withAbort(promise, signal) {
|
|
@@ -10,7 +10,7 @@ function withAbort(promise, signal) {
|
|
|
10
10
|
return Promise.resolve(promise);
|
|
11
11
|
return new Promise((resolve, reject) => {
|
|
12
12
|
const cleanup = () => signal.removeEventListener("abort", abort);
|
|
13
|
-
const abort = () => { cleanup(); reject(signal.reason
|
|
13
|
+
const abort = () => { cleanup(); reject(signal.reason); };
|
|
14
14
|
signal.addEventListener("abort", abort, { once: true });
|
|
15
15
|
Promise.resolve(promise).then(value => { cleanup(); resolve(value); }, error => { cleanup(); reject(error); });
|
|
16
16
|
if (signal.aborted)
|
|
@@ -199,8 +199,9 @@ async function withDestination(destination, operation) {
|
|
|
199
199
|
// Native streams can belong to another browser realm; constructor identity is not portable.
|
|
200
200
|
if (destination && typeof destination.getWriter === "function") {
|
|
201
201
|
const writer = destination.getWriter();
|
|
202
|
+
// Native streams may retain accepted chunks after write resolves.
|
|
202
203
|
try {
|
|
203
|
-
return await operation({ write: bytes => writer.write(bytes) });
|
|
204
|
+
return await operation({ write: bytes => writer.write(new Uint8Array(bytes)) });
|
|
204
205
|
}
|
|
205
206
|
finally {
|
|
206
207
|
writer.releaseLock();
|
|
@@ -513,11 +514,18 @@ function createRowProjector(columns, worksheet, signal, validate = assertExportV
|
|
|
513
514
|
const getters = columns.some(column => column.value);
|
|
514
515
|
return (row, rowIndex = 0) => {
|
|
515
516
|
if (Array.isArray(row) && !getters) {
|
|
516
|
-
|
|
517
|
+
const length = row.length;
|
|
518
|
+
if (length > columns.length)
|
|
517
519
|
throw new RangeError("Row has more values than declared columns.");
|
|
518
|
-
|
|
520
|
+
// Resolve each positional value once, just like key/value projections. Returning the
|
|
521
|
+
// source array would let an accessor change a value after the portable-value check.
|
|
522
|
+
const values = new Array(length);
|
|
523
|
+
for (let index = 0; index < length; index++) {
|
|
524
|
+
const value = row[index];
|
|
519
525
|
validate(value);
|
|
520
|
-
|
|
526
|
+
values[index] = value;
|
|
527
|
+
}
|
|
528
|
+
return values;
|
|
521
529
|
}
|
|
522
530
|
if (!row || typeof row !== "object" || isDate(row))
|
|
523
531
|
throw new TypeError("A row must be an array or object.");
|
|
@@ -546,7 +554,7 @@ function createRowProjector(columns, worksheet, signal, validate = assertExportV
|
|
|
546
554
|
};
|
|
547
555
|
}
|
|
548
556
|
/** @internal Shared metadata fields for full columns and adapter-owned partial overrides. */
|
|
549
|
-
const columnOptionFields = ["header", "key", "value", "width", "type", "format", "wrapText", "alignment", "groups", "style", "valueFormatter"];
|
|
557
|
+
const columnOptionFields = ["header", "key", "value", "width", "type", "format", "wrapText", "alignment", "rowHeader", "groups", "style", "valueFormatter"];
|
|
550
558
|
function copyColumns(columns, workbookStyles = false) {
|
|
551
559
|
if (!Array.isArray(columns))
|
|
552
560
|
throw new TypeError("Declare the columns in export order.");
|
|
@@ -562,6 +570,8 @@ function copyColumns(columns, workbookStyles = false) {
|
|
|
562
570
|
throw new TypeError("Each column needs a string header and an optional string key.");
|
|
563
571
|
if (captured.value !== undefined && typeof captured.value !== "function")
|
|
564
572
|
throw new TypeError("Column value getters must be functions.");
|
|
573
|
+
if (captured.rowHeader !== undefined && typeof captured.rowHeader !== "boolean")
|
|
574
|
+
throw new TypeError("Column rowHeader must be boolean.");
|
|
565
575
|
if (captured.groups !== undefined) {
|
|
566
576
|
if (!Array.isArray(captured.groups))
|
|
567
577
|
throw new TypeError("Column groups must be an array of strings.");
|