@evotecit/officeimo 0.1.2 → 0.1.4
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 +59 -51
- package/bundles/officeimo-canopyx.js +1553 -314
- package/bundles/officeimo-canopyx.mjs +1497 -269
- package/bundles/officeimo-csv.js +18 -15
- package/bundles/officeimo-csv.mjs +16 -13
- package/bundles/officeimo-datatables.js +463 -301
- package/bundles/officeimo-datatables.mjs +420 -259
- package/bundles/officeimo-pdf.js +148 -65
- package/bundles/officeimo-pdf.mjs +124 -41
- package/bundles/officeimo-xlsx.js +177 -101
- package/bundles/officeimo-xlsx.mjs +149 -74
- package/bundles/officeimo.js +461 -299
- package/bundles/officeimo.mjs +419 -258
- package/dist/csv/index.js +16 -13
- package/dist/integrations/canopyx/diagnostics.d.ts +3 -0
- package/dist/integrations/canopyx/diagnostics.js +17 -0
- package/dist/integrations/canopyx/grouping.d.ts +6 -0
- package/dist/integrations/canopyx/grouping.js +198 -0
- package/dist/integrations/canopyx/index.d.ts +2 -2
- package/dist/integrations/canopyx/index.js +89 -15
- package/dist/integrations/canopyx/metadata.d.ts +4 -0
- package/dist/integrations/canopyx/metadata.js +51 -0
- package/dist/integrations/canopyx/pdf-layout.d.ts +5 -0
- package/dist/integrations/canopyx/pdf-layout.js +97 -0
- package/dist/integrations/canopyx/pdf-number.d.ts +3 -0
- package/dist/integrations/canopyx/pdf-number.js +64 -0
- package/dist/integrations/canopyx/pivot.d.ts +15 -0
- package/dist/integrations/canopyx/pivot.js +67 -0
- package/dist/integrations/canopyx/presentation.d.ts +8 -0
- package/dist/integrations/canopyx/presentation.js +40 -0
- package/dist/integrations/canopyx/rule-predicates.d.ts +3 -0
- package/dist/integrations/canopyx/rule-predicates.js +110 -0
- package/dist/integrations/canopyx/rules.d.ts +6 -0
- package/dist/integrations/canopyx/rules.js +176 -0
- package/dist/integrations/canopyx/source.js +69 -31
- package/dist/integrations/canopyx/types.d.ts +134 -10
- package/dist/integrations/canopyx/workbook.d.ts +6 -0
- package/dist/integrations/canopyx/workbook.js +52 -0
- package/dist/opc/index.js +9 -0
- package/dist/pdf/font-resources.js +33 -14
- package/dist/pdf/pages.js +60 -14
- package/dist/pdf/table-band-flow.js +7 -2
- package/dist/pdf/table-band-plan.js +9 -1
- package/dist/pdf/table-layout.js +6 -2
- package/dist/pdf/table-structure.js +9 -8
- package/dist/xlsx/index.d.ts +1 -1
- package/dist/xlsx/options.js +1 -1
- package/dist/xlsx/outlines.d.ts +3 -0
- package/dist/xlsx/outlines.js +39 -0
- package/dist/xlsx/types.d.ts +9 -0
- package/dist/xlsx/values.js +11 -2
- package/dist/xlsx/workbook.js +2 -0
- package/dist/xlsx/worksheet.js +14 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
Install the
|
|
7
|
+
Install the package in your JavaScript application:
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
npm install /
|
|
10
|
+
npm install @evotecit/officeimo
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
For local source qualification, produce an archive from this package's source directory:
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
16
|
npm ci
|
|
@@ -18,6 +18,8 @@ npm run build
|
|
|
18
18
|
npm pack --pack-destination /path/to/local-packages
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
Install that archive in an isolated consumer with `npm install /path/to/local-packages/evotecit-officeimo-0.1.0.tgz`.
|
|
22
|
+
|
|
21
23
|
`tsc` produces ES modules and declarations in `dist/`. The archive contains those files, portable bundles, this README and the MIT license. TypeScript is a development dependency; installing the archive as an application dependency installs no compiler or runtime packages.
|
|
22
24
|
|
|
23
25
|
## Export a table
|
|
@@ -61,6 +63,8 @@ saveBlob(await writeCsv(rows, { columns }), "sales.csv");
|
|
|
61
63
|
|
|
62
64
|
The table writers accept synchronous iterables and async iterables. XLSX defaults to the sheet name `Data`, a bold header, filtering when a header is present, and width sampling of up to 100 rows clamped to 6–54 characters. `sheet` supplies the existing worksheet layout options. Workbook-local style indexes belong to the advanced `Workbook` API; portable `ExportCell` presentation and row/cell style patches work with the table helper.
|
|
63
65
|
|
|
66
|
+
CSV-only applications can import `writeCsv` or `writeCsvTo` from `@evotecit/officeimo/csv` to load the CSV module graph without the XLSX and PDF writers. The root entry remains useful when an application exports several formats.
|
|
67
|
+
|
|
64
68
|
An `ExportCell` can carry an external link alongside its typed value, display text and presentation:
|
|
65
69
|
|
|
66
70
|
```typescript
|
|
@@ -143,7 +147,7 @@ CSS classes and computed DOM styles are not copied automatically. CSV retains va
|
|
|
143
147
|
| Footers | Structured exports preserve up to 16 physical rows; XLSX native table/filter constraints and CSV flattening apply. `includeFooter: false` omits footers | Same |
|
|
144
148
|
| Server-side processing | Rejected unless `serverSide: "loaded"` acknowledges loaded rows only | Same |
|
|
145
149
|
|
|
146
|
-
Qualified pairs are DataTables 2.3.7/Buttons 3.2.6 and DataTables 3.1.3/Buttons 4.1.2, including Select and ColReorder. TypeScript
|
|
150
|
+
Qualified pairs are DataTables 2.3.7/Buttons 3.2.6 and DataTables 3.1.3/Buttons 4.1.2, including Select and ColReorder. TypeScript 7.0.2 consumer checks use bundler resolution. The newer pair has duplicate upstream declaration index signatures and requires `skipLibCheck`; OfficeIMO's declarations remain strictly checked. This declaration limit is separate from browser interoperability.
|
|
147
151
|
|
|
148
152
|
`createDataTablesExport(DataTable, table, options)` exposes readonly `columns`, heading rows, optional footer, `rowCount` and a single-use async `rows` source. `headings: "structured"` additionally exposes `headerStructure`/`footerStructure` for the writers' span matrices. Selection/headings are captured immediately; batched body values are read during iteration. Each batch replaces bounded cell indexes through public API result-set operations, without rescanning the table's rows. Batched exports require one table per API instance. Keep table data and column layout stable until export finishes. `batchRows` defaults to 4,096; `maxBatchCells` defaults to 65,536, can lower the effective row count per batch and must fit one row. Cancellation is checked between cells and yielding occurs during formatting and between batches. A synchronous DataTables renderer cannot be interrupted while it runs.
|
|
149
153
|
|
|
@@ -157,7 +161,7 @@ Direct sink output avoids retaining the finished file. Blob exports and register
|
|
|
157
161
|
|
|
158
162
|
DataTables and its DOM stay on the page. A host-owned worker can consume portable columns and bounded row batches from the source: request/acknowledge batches and output chunks rather than cloning the full matrix. Reconstruct `ExportCell` in the worker because structured cloning loses its brand. The [verification guide](../Build/BrowserExports/README.md#datatables-integration-and-comparisons) covers workers, cancellation, fallback and reproducible comparisons. Measurements describe the tested workload/browser, without a universal speed claim.
|
|
159
163
|
|
|
160
|
-
## CanopyX
|
|
164
|
+
## CanopyX exports
|
|
161
165
|
|
|
162
166
|
The optional `@evotecit/officeimo/integrations/canopyx` entry consumes CanopyX's immutable `prepareExport` capture. CanopyX owns the accepted query, column order, selection, source paging, revision checks and resolved presentation. OfficeIMO owns file generation. Neither package imports the other at runtime, and importing the main OfficeIMO package does not load the adapter.
|
|
163
167
|
|
|
@@ -165,67 +169,71 @@ The optional `@evotecit/officeimo/integrations/canopyx` entry consumes CanopyX's
|
|
|
165
169
|
import { exportCanopy } from "@evotecit/officeimo/integrations/canopyx";
|
|
166
170
|
|
|
167
171
|
const capture = grid.prepareExport({ scope: "filtered", values: "raw" });
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
amount: { format: "#,##0.00", width: 18 },
|
|
177
|
-
updated: { format: "yyyy-mm-dd hh:mm:ss.000", width: 42, wrapText: true }
|
|
172
|
+
const blob = await exportCanopy(capture, "xlsx", {
|
|
173
|
+
datetime: "preserve",
|
|
174
|
+
xlsx: { dateMode: "utc" },
|
|
175
|
+
about: true,
|
|
176
|
+
grouped: {
|
|
177
|
+
labelColumn: { header: "Region" },
|
|
178
|
+
subtotalLabel: group => `${group.label} total`,
|
|
179
|
+
grandTotalLabel: () => "Grand total"
|
|
178
180
|
},
|
|
179
|
-
|
|
181
|
+
columnOptions: { updated: { format: "yyyy-mm-dd hh:mm:ss.000" } },
|
|
180
182
|
limits: { maxRows: 250_000, maxCells: 5_000_000 }
|
|
181
|
-
};
|
|
182
|
-
const blob = await exportCanopy(capture, "xlsx", reportOptions);
|
|
183
|
+
});
|
|
183
184
|
// Deliver the Blob through the host's download or storage policy.
|
|
184
185
|
```
|
|
185
186
|
|
|
186
|
-
`exportCanopy(capture, format, options)` accepts `"xlsx"`, `"csv"` or `"pdf"`. `writeCanopyTo(capture, format, destination, options)` writes to a caller-owned sink or `WritableStream`; failed partial output remains caller-owned. Format options live in `xlsx`, `csv` and `pdf`, with common cancellation, limits and progress at the top level. Common limits override matching format limits.
|
|
187
|
-
|
|
188
|
-
`createCanopyExport` retains `type: "number"` for native numeric columns in a raw capture, so grouped metrics can use its columns directly. Display captures keep their rendered strings. Datetime metadata remains unforced because the preservation profile can intentionally produce exact ISO text rather than a `Date`.
|
|
189
|
-
|
|
190
|
-
`columnOptions` is keyed by captured column ID. Settings for unselected columns are ignored, so one host format map can serve different visible/selected captures. `PdfFont` is exported from this entry as well as the PDF layer for constructing caller-supplied fonts.
|
|
187
|
+
`exportCanopy(capture, format, options)` accepts `"xlsx"`, `"csv"` or `"pdf"`. `writeCanopyTo(capture, format, destination, options)` writes to a caller-owned sink or `WritableStream`; failed partial output remains caller-owned. Format options live in `xlsx`, `csv` and `pdf`, with common cancellation, limits and progress at the top level. Common limits override matching format limits.
|
|
191
188
|
|
|
192
189
|
| Captured contract | Output behavior |
|
|
193
190
|
| --- | --- |
|
|
194
|
-
| Column IDs, titles and order | Preserved without
|
|
195
|
-
|
|
|
196
|
-
|
|
|
197
|
-
|
|
|
198
|
-
|
|
|
199
|
-
|
|
|
200
|
-
|
|
|
201
|
-
|
|
|
202
|
-
|
|
|
191
|
+
| Column IDs, titles and order | Preserved without reading the viewport or evaluating queries |
|
|
192
|
+
| Raw values and resolved text | XLSX keeps typed numbers and dates; PDF keeps captured text; raw CSV retains original ISO dates |
|
|
193
|
+
| Display values | Literal exported strings; CSV formula protection still applies |
|
|
194
|
+
| Fitted CSS pixel widths | XLSX uses a Calibri 11 profile at 96 DPI, a seven-pixel maximum digit and five-pixel cell padding, quantized to 1/256 character; PDF converts pixels to points at 72/96 |
|
|
195
|
+
| Leading left pins | XLSX freezes the contiguous leading pinned columns and any included header; the grouped label column is included in the physical pane offset |
|
|
196
|
+
| Numeric format intent | Fraction digits from 0 through 10 and literal prefixes/suffixes become invariant Excel formats; text such as `Usage %` does not change a raw value of 17 into a percentage |
|
|
197
|
+
| Canonical neutral tone | No override unless explicitly mapped in `tones`; cell styles override overlapping row-style properties |
|
|
198
|
+
| Safe resolved links | Native XLSX relationships and PDF annotations; a hidden source URL column is not required |
|
|
199
|
+
| Relative navigation links | Text columns export the captured visible label, including null-valued links, without inventing an absolute URL; raw numeric and datetime columns retain their typed-value policy |
|
|
200
|
+
| History series | Raw captures export the captured latest scalar, or an empty value when none exists; display captures export the rendered cell text. No sparkline or historical-series reconstruction |
|
|
201
|
+
| Unmapped row and cell tones | Preserves status text and typed values without inventing a style; explicit `tones` mappings still apply |
|
|
202
|
+
| `recordCount` | Checked against enumeration and used for detail progress, independently of dataset `total` and live `matched` |
|
|
203
|
+
| Captured grouping | Validated contiguous half-open ranges, typed group identities and declared numeric aggregates feed the existing grouped XLSX/PDF writers |
|
|
204
|
+
| Explicit `request.pivot` | Preserves the frozen full-query projection, prefix summaries, descendants, Other and grand totals in captured order; never regroups or recomputes values |
|
|
205
|
+
| No grouping snapshot | Flat records, even if the accepted query contains `groupBy` |
|
|
206
|
+
| `about: true` | XLSX adds an `About` worksheet with captured revision, scope, UTC time, counts, selected IDs and the actual accepted export query |
|
|
203
207
|
|
|
204
|
-
|
|
208
|
+
The width profile provides reproducible conversion; it does not promise pixel-identical rendering in native Excel. `columnOptions[id].width` overrides the XLSX character width, and `pdf.columnWidths` overrides PDF point widths. Right and nonleading pins retain their column order and require an explicit text fallback diagnostic. `columnOptions` applies only to selected IDs; native `columnOptions[id].format` remains the explicit Excel-format override.
|
|
205
209
|
|
|
206
|
-
|
|
210
|
+
For a pivot table, pass the frozen `prepareExport({ pivot: true, scope: "filtered", values: "raw" })` capture through the same entry point. Numeric cells retain their already-computed `mode` and native `numberFormat`: a fractional share stays numeric and receives a percent format without multiplying or parsing its text. Empty intersections need neither field; an explicit empty column format selects `General`. Row and column identities are opaque. `recordCount` counts physical projected rows, including summaries; `matched` still describes the underlying accepted records.
|
|
207
211
|
|
|
208
|
-
|
|
212
|
+
XLSX places pivot summaries above their descendants and to their left, preserving captured outline levels, hidden descendants and collapsed summaries. It does not add `SUBTOTAL` formulas, a table or an autofilter over the pre-aggregated projection. Captured pivot outlines and totals reject conflicting worksheet overrides. Pivot exports also reject XLSX `cellValueWriters` and PDF `footer.totals`, preserving frozen values and aggregates. PDF and CSV include the complete projection, including initially hidden descendants; `PIVOT_OUTLINES_XLSX_ONLY` reports that the interactive outline controls belong to Excel. PDF retains resolved display text, headings and normal fit/band policies. A malformed explicit pivot rejects instead of silently becoming an ordinary flat export.
|
|
209
213
|
|
|
210
|
-
|
|
214
|
+
The worksheet engine also exposes `outlineSummaryBelow` and `outlineSummaryRight` (both default to `true`) and `columnOutlines: [{ firstColumn, columnCount, level?, hidden?, collapsed? }]`. Column ranges use zero-based positions, must be disjoint and remain within the declared columns; outline levels are zero through seven. These settings work through both `Workbook` and the portable XLSX writers. Row outlines continue to use the synchronous `rowOutline` callback with an explicit `maxOutlineLevel`.
|
|
211
215
|
|
|
212
|
-
|
|
213
|
-
import { writeCanopyTo } from "@evotecit/officeimo/integrations/canopyx";
|
|
214
|
-
import type { GridHostOptions } from "@evotecit/canopyx/reporting";
|
|
216
|
+
XLSX maps the declared rule subset to editable data bars, two/three-stop color scales and row/cell highlights. The first matching tone wins within each row or cell target, and a cell tone overrides a row tone. Native cell visuals take precedence over row tints; their own declaration order is retained. Predicates support `and`/`or`, numeric `eq`/`ne`/`gt`/`ge`/`lt`/`le`, and null tests, within four levels and 64 nodes. Numeric operands use numbers, booleans or plain invariant numeric strings. Each comparison excludes null cells. Equality and inequality with boolean or numeric operands on text columns retain the raw value's type; string comparisons on text columns and separator/culture profiles are unsupported.
|
|
215
217
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
218
|
+
Datetime rule filters require `datetime: "typed"` and the UTC XLSX clock. Operands use explicit-zone ISO timestamps at exact millisecond precision, or integer epoch milliseconds; the existing date writer converts them to native serials. Local, preserved-text and sub-millisecond predicate profiles report an unsupported diagnostic. Native numeric rules require numeric or null cells; datetime rules require ISO cells that the typed writer converts to native dates, or null. Numeric strings in numeric cells and numeric epoch values in datetime cells are unsupported native rule profiles and reject during enumeration, including text fallback. The flat source retains its raw values. Ordinary datetime output keeps its separate preservation policy below.
|
|
219
|
+
|
|
220
|
+
`stopIfTrue` masks later highlight predicates across the whole row in the original declaration order. A captured rule sequence combining this behavior with native bars or scales is unsupported. Cell-tone and data-bar rules targeting the same column are also unsupported because the cell tone's fill depends on whether the bar resolves. Explicit text fallback omits either unsupported captured sequence and reports the loss. Native rule ranges cover only details, including with omitted or multilevel headers and in grouped reports. CSS variables and resolved `cell.format` properties are not parsed. The portable default rule palette is info `4472C4`, success `70AD47`, warning `FFC000` and danger `C00000`, with matching pale fills; explicit tone mappings override it.
|
|
221
|
+
|
|
222
|
+
PDF defaults to landscape without shrinking the font. Flat and pivot captures measure the selected PDF font against a bounded lookahead of up to 128 rows or 262,144 displayed UTF-16 code units, then replay that single source. Column minimums protect the longest sampled header/content word; numeric and date columns reserve their natural value width. Remaining width first satisfies full header/content preferences, then goes to text columns. If the minimums exceed the printable width, horizontal bands retain readable widths. A word wider than a page can still break at scalar boundaries; later rows use the writer's ordinary lossless wrapping. Explicit `pdf.columnWidths`, horizontal-band settings and shaping providers retain their own layout policy.
|
|
223
|
+
|
|
224
|
+
Canopy PDF cells wrap independently of the grid's screen `wrap` setting. A seven-column grid with screen `wrap: false` still exports its full text, dates and numbers. An explicit `columnOptions[id].wrapText: false` retains strict nonwrapping behavior and rejects content that cannot fit; use suitable `pdf.columnWidths` or horizontal bands for that contract. Pivot summary and total rows are bold, and numeric columns default to right alignment. Raw numeric captures apply simple declared decimal/percentage/grouping formats to PDF text, retaining the sampled column's decimal separator and captured affixes. Complex native formats retain their resolved text. Missing values remain blank and computed zero values remain zero; neither is invented from the other. XLSX retains the captured screen wrapping unless overridden. Group headings, repeated column headings and continuation context use the existing grouped layout. Supply embedding-permitted TrueType fonts through `pdf.fonts` for Unicode, and a declared language through `pdf.tagged` for tagged reports. XLSX's native rule declarations do not render PDF bars or scales: PDF reports that loss and requires `unsupportedPresentation: "text"` to accept it. This option does not remove typed values, resolved text or valid links.
|
|
225
|
+
|
|
226
|
+
Ordinary text-only grid/tree captures are accepted as flat output. Tree indentation does not create analytical groups. Relative links, history-series presentation and unmapped row/cell tones use the scalar/text projections above and report their presentation loss through synchronous `onDiagnostic` when supplied. Genuine unsupported presentation diagnostics and unsupported declarations still reject by default in XLSX/PDF. Explicit `unsupportedPresentation: "text"` accepts their text fallback and reports each diagnostic through the same callback. CSV defaults to text. Unsafe hyperlinks remain rejected. No unbounded diagnostic list or whole-table body is retained.
|
|
227
|
+
|
|
228
|
+
Grouping requires a raw capture with an exact count and complete scope-specific ranges and aggregate values. Up to four levels and 1,000 groups are supported. One aggregate operation per numeric column maps `sum`, `count`, `average`, `minimum` and `maximum` to the canonical report owner; numeric `count` ignores nulls. Captured sums and averages are checked using Canopy's compensated accumulation and empty-input convention. Native formulas calculate their own caches, which can differ by floating-point rounding; an empty native sum is zero. Range and declared-total mismatches still reject the export. Grouped sheets own their summary rows and cannot also use a native table, arbitrary heading matrix or footer. Existing grouped label callbacks remain caller-owned; omitted labels use the English defaults `Group`, `<label> total` and `Grand total`. `xlsx.sheet.includeHeader: false` omits the data header and its default freeze; explicit settings remain subject to the worksheet contract.
|
|
229
|
+
|
|
230
|
+
Captured group identity is checked against the original raw scalar before relative-link detail labels are written. Distinct raw identities with the same visible label remain separate groups.
|
|
231
|
+
|
|
232
|
+
`about` metadata uses the technical capture field names with `Field` and `Value` headings. `About` is reserved when this worksheet is requested, and the data sheet must have another name. Metadata is limited to 65,536 UTF-16 units in total. Known cell text is validated before detail enumeration; `xlsx.oversizedText: "preserve"` retains the workbook's bounded overflow policy for longer values. Metadata and generated summary rows consume output resource limits, but progress and result `rows` count source details only. Selected/all query metadata describes the accepted export query; the adapter does not reconstruct the original live filter from `matched`.
|
|
233
|
+
|
|
234
|
+
`datetime: "typed"` requires exact millisecond precision; `"text"` retains the original ISO value. The default `"preserve"` keeps finer timestamps and dates outside Excel's 1900–9999 range as text rather than rounding or dropping them. Typed Excel dates require an explicit time zone and default to the capture's UTC/local clock; `xlsx.dateMode` overrides it.
|
|
227
235
|
|
|
228
|
-
|
|
236
|
+
`createCanopyExport(capture, format, options)` remains the flat source API: frozen columns, `rowCount` and fresh `rows()` enumerations. Full adapter writers add captured grouping, native rules and optional metadata. Each enumeration passes its cancellation signal into CanopyX's page requests. A live grid remains page-owned; worker hosts own and release their bounded capture/row bridge. CanopyX may retain identity/cursor bookkeeping, so streamed output does not imply constant memory for the source itself.
|
|
229
237
|
|
|
230
238
|
## PDF tables
|
|
231
239
|
|