@evotecit/officeimo 0.1.19 → 0.1.21
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 +6 -3
- package/bundles/officeimo-canopyx-adapter.js +121 -59
- package/bundles/officeimo-canopyx-adapter.min.js +1 -1
- package/bundles/officeimo-canopyx-adapter.min.mjs +1 -1
- package/bundles/officeimo-canopyx-adapter.mjs +108 -47
- package/bundles/officeimo-canopyx.js +177 -100
- package/bundles/officeimo-canopyx.min.js +1 -1
- package/bundles/officeimo-canopyx.min.mjs +1 -1
- package/bundles/officeimo-canopyx.mjs +144 -68
- package/bundles/officeimo-datatables-adapter.js +7 -7
- package/bundles/officeimo-datatables-adapter.min.js +1 -1
- package/bundles/officeimo-datatables-adapter.min.mjs +1 -1
- package/bundles/officeimo-datatables-adapter.mjs +3 -3
- package/bundles/officeimo-datatables.js +63 -48
- package/bundles/officeimo-datatables.min.js +1 -1
- package/bundles/officeimo-datatables.min.mjs +1 -1
- package/bundles/officeimo-datatables.mjs +39 -24
- package/bundles/officeimo-xlsx.js +59 -44
- package/bundles/officeimo-xlsx.min.js +1 -1
- package/bundles/officeimo-xlsx.min.mjs +1 -1
- package/bundles/officeimo-xlsx.mjs +39 -24
- package/bundles/officeimo.js +61 -46
- package/bundles/officeimo.min.js +1 -1
- package/bundles/officeimo.min.mjs +1 -1
- package/bundles/officeimo.mjs +40 -25
- package/dist/integrations/canopyx/index.js +4 -2
- package/dist/integrations/canopyx/pdf-number.js +9 -6
- package/dist/integrations/canopyx/rule-predicates.d.ts +1 -1
- package/dist/integrations/canopyx/rule-predicates.js +2 -1
- package/dist/integrations/canopyx/rules.d.ts +1 -1
- package/dist/integrations/canopyx/rules.js +11 -13
- package/dist/integrations/canopyx/source.js +44 -7
- package/dist/integrations/canopyx/tones.d.ts +10 -0
- package/dist/integrations/canopyx/tones.js +12 -0
- package/dist/integrations/canopyx/types.d.ts +8 -1
- package/dist/xlsx/options.js +1 -1
- package/dist/xlsx/portable.js +1 -1
- package/dist/xlsx/styles.js +28 -18
- package/dist/xlsx/types.d.ts +5 -1
- package/dist/xlsx/workbook.js +3 -1
- package/dist/xlsx/worksheet.js +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -194,11 +194,14 @@ const blob = await exportCanopy(capture, "xlsx", {
|
|
|
194
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
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
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
|
+
| Standard row and cell tones | `info`, `success`, `warning` and `danger` get a pale fill with a dark font (`DDEBF7`/`1F4E78`, `E2F0D9`/`375623`, `FFF2CC`/`7F5000`, `FFC7CE`/`9C0006`, each at least 4.5:1 contrast); `muted` gets a grey `595959` font. Applies to XLSX cells and PDF cells; an entry in `tones` replaces that tone's default |
|
|
197
198
|
| Canonical neutral tone | No override unless explicitly mapped in `tones`; cell styles override overlapping row-style properties |
|
|
199
|
+
| Badges, custom classes and host renderers | Exported as the captured value or text. Badge labels in `cell.badges` are appended to the cell's display text, for example `Alice · Disabled · Stale`, and a badged text cell exports that label. Typed number and date columns, and text columns read by an emitted native rule, keep their raw value and show badges in the text only (PDF). Each reports a `badges`, `custom-class` or `custom-renderer` diagnostic without failing the export |
|
|
200
|
+
| XLSX header row | Bold, wrapped, filled `E7EDF5` with a thin bottom rule, matching the PDF heading; `xlsx.sheet.headerFill`, `headerBorder` and `headerWrap` override it |
|
|
198
201
|
| Safe resolved links | Native XLSX relationships and PDF annotations; a hidden source URL column is not required |
|
|
199
202
|
| 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
203
|
| 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
|
-
|
|
|
204
|
+
| Unknown row and cell tones | Preserves status text and typed values without inventing a style and reports `UNMAPPED_TONE`; explicit `tones` mappings still apply |
|
|
202
205
|
| `recordCount` | Checked against enumeration and used for detail progress, independently of dataset `total` and live `matched` |
|
|
203
206
|
| Captured grouping | Validated contiguous half-open ranges, typed group identities and declared numeric aggregates feed the existing grouped XLSX/PDF writers |
|
|
204
207
|
| Explicit `request.pivot` | Preserves the frozen full-query projection, prefix summaries, descendants, Other and grand totals in captured order; never regroups or recomputes values |
|
|
@@ -217,7 +220,7 @@ XLSX maps the declared rule subset to editable data bars, two/three-stop color s
|
|
|
217
220
|
|
|
218
221
|
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
222
|
|
|
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
|
|
223
|
+
`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` for bars and scales, and the standard tone fills above for highlights; explicit tone mappings override it.
|
|
221
224
|
|
|
222
225
|
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
226
|
|
|
@@ -225,7 +228,7 @@ The same flat/pivot PDF lookahead chooses one numeric convention for the entire
|
|
|
225
228
|
|
|
226
229
|
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.
|
|
227
230
|
|
|
228
|
-
Ordinary text-only grid/tree captures are accepted as flat output. Tree indentation does not create analytical groups. Relative links, history-series presentation and
|
|
231
|
+
Ordinary text-only grid/tree captures are accepted as flat output. Tree indentation does not create analytical groups. Relative links, history-series presentation, badges, custom classes, host renderers and unknown 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.
|
|
229
232
|
|
|
230
233
|
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.
|
|
231
234
|
|
|
@@ -11,8 +11,8 @@ const _c2 = _core("50b3c10b690ceff693c8c5f809195ba6845b20e60f408e791a750d2ecbd5c
|
|
|
11
11
|
const _c3 = _core("42faf379960e5674a6fdfa8c8fca0bb68bbd74587231248d2524d7004def3671");
|
|
12
12
|
const _c4 = _core("f0627ba89e5c8fcb376ebe3ce72dcc8d68c34952981f8703e36b8bb1a9894208");
|
|
13
13
|
const _c5 = _core("4a089607f7cbe50e13d4382d1cc4e5f6ce32c5773bbec2df84178710f54d9a38");
|
|
14
|
-
const _c6 = _core("
|
|
15
|
-
const _c7 = _core("
|
|
14
|
+
const _c6 = _core("8f13b484030aa6b921e616d803614fd061f718241692003633375fab4c36045e");
|
|
15
|
+
const _c7 = _core("e5310c591178a3de9292f150e2e6f1477b94b895ef0c90840c72adef00f75974");
|
|
16
16
|
const _c8 = _core("b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4");
|
|
17
17
|
const _c9 = _core("027aafa08408056b10d7d717d63d1f7c0ee20ecfc68213aa66feacc75ec525fe");
|
|
18
18
|
const _c10 = _core("0391fe35ea7d02b25804ab4d0e7543136d6bb615f368f268c74aa135f23aa6bc");
|
|
@@ -22,11 +22,11 @@ const _c13 = _core("046b305cdccf817d847addb75a778131622de23f2840830bbe1c0c26053a
|
|
|
22
22
|
const _c14 = _core("87c24efeaa0f1579c19afeeb4918caeb4f8f65a88d24a246e2cfd712b37dbac3");
|
|
23
23
|
const _c15 = _core("c9fde2c438e186da56f740105fcd41c265fdfdd855a4f1b811d556a02387479b");
|
|
24
24
|
const _c16 = _core("227236fd7adc9472e188831b8f16fdc69338c4d779f2b69a8abbd8dbfa95b585");
|
|
25
|
-
const _c17 = _core("
|
|
25
|
+
const _c17 = _core("62ff1bcbf8ca07e8ab92cd1f6afbd54049346193e18160ab0afec48e03950bba");
|
|
26
26
|
const _c18 = _core("5337d1e3bd5ae0c1d10a476fcd31540d20337ccf7aa93c7e9e26c2b1a7dab92b");
|
|
27
27
|
const _c19 = _core("d9c1509dff0538488752433e47cd0927ece5f93c559ad0e32dc56602dfd44596");
|
|
28
28
|
const _c20 = _core("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070");
|
|
29
|
-
const _m4 = _modules.get("
|
|
29
|
+
const _m4 = _modules.get("bbf637a660bc4dc3fa6fc932009b7b8fb557ad6403af8b5479a1cc857cc020a4") ?? (() => {
|
|
30
30
|
const { captureFields } = _c2;
|
|
31
31
|
|
|
32
32
|
const { ExportBudget } = _c3;
|
|
@@ -67,7 +67,7 @@ function capturePdfOptions(input = {}) {
|
|
|
67
67
|
return { ...options, ...(options.limits === undefined ? {} : { limits: capturePdfLimits(options.limits) }) };
|
|
68
68
|
}
|
|
69
69
|
const _exports = Object.freeze({ captureCommonLimits: captureCommonLimits, mergeAdapterLimits: mergeAdapterLimits, captureXlsxOptions: captureXlsxOptions, captureCsvOptions: captureCsvOptions, capturePdfOptions: capturePdfOptions });
|
|
70
|
-
_modules.set("
|
|
70
|
+
_modules.set("bbf637a660bc4dc3fa6fc932009b7b8fb557ad6403af8b5479a1cc857cc020a4", _exports);
|
|
71
71
|
return _exports;
|
|
72
72
|
})();
|
|
73
73
|
|
|
@@ -257,7 +257,25 @@ _modules.set("040752afe195985e6f2e91f8c62fc13464c455fc44034b8cef4828851e05b83d",
|
|
|
257
257
|
return _exports;
|
|
258
258
|
})();
|
|
259
259
|
|
|
260
|
-
const
|
|
260
|
+
const _m19 = _modules.get("09d56e54463cbff00a2b225e10a62b06c881933290525c614bb5e276167e9eac") ?? (() => {
|
|
261
|
+
/** Stable document palette for CanopyX's standard tones. Browser CSS variables and resolved cell.format are never interpreted.
|
|
262
|
+
* Each foreground keeps at least a 4.5:1 contrast ratio on its background. */
|
|
263
|
+
const canopyTonePalette = Object.freeze({
|
|
264
|
+
info: Object.freeze({ color: "4472C4", background: "DDEBF7", foreground: "1F4E78" }),
|
|
265
|
+
success: Object.freeze({ color: "70AD47", background: "E2F0D9", foreground: "375623" }),
|
|
266
|
+
warning: Object.freeze({ color: "FFC000", background: "FFF2CC", foreground: "7F5000" }),
|
|
267
|
+
danger: Object.freeze({ color: "C00000", background: "FFC7CE", foreground: "9C0006" }),
|
|
268
|
+
// Muted tones dim the text rather than painting the cell.
|
|
269
|
+
muted: Object.freeze({ color: "A6A6A6", foreground: "595959" })
|
|
270
|
+
});
|
|
271
|
+
/** Default cell presentation for a standard tone; `neutral` and unknown tones have none. */
|
|
272
|
+
const canopyDefaultTones = new Map(Object.entries(canopyTonePalette).map(([name, tone]) => [name, Object.freeze({ ...(tone.background === undefined ? {} : { background: tone.background }), color: tone.foreground })]));
|
|
273
|
+
const _exports = Object.freeze({ canopyTonePalette: canopyTonePalette, canopyDefaultTones: canopyDefaultTones });
|
|
274
|
+
_modules.set("09d56e54463cbff00a2b225e10a62b06c881933290525c614bb5e276167e9eac", _exports);
|
|
275
|
+
return _exports;
|
|
276
|
+
})();
|
|
277
|
+
|
|
278
|
+
const _m13 = _modules.get("1c14f8a6ef9eb43a6a59948c7ec08999e0d5d7759b2dcc6468e6e425680d0d50") ?? (() => {
|
|
261
279
|
const { ExportCell, checkAbort, inputRows } = _c0;
|
|
262
280
|
|
|
263
281
|
const { canopyPivot, pivotNumberFormat } = _m14;
|
|
@@ -274,8 +292,21 @@ const { canopyDiagnostics } = _m12;
|
|
|
274
292
|
|
|
275
293
|
const { canopyNumberFormat, canopyXlsxWidth } = _m18;
|
|
276
294
|
|
|
295
|
+
const { canopyDefaultTones } = _m19;
|
|
296
|
+
|
|
277
297
|
const columnFields = ["width", "format", "wrapText", "alignment", "rowHeader", "groups"];
|
|
298
|
+
// Captured presentations whose cell text already carries the readable content (badge labels are appended below).
|
|
299
|
+
// Their visual loss is reported, never treated as an unsupported export.
|
|
300
|
+
const textFallbacks = new Set(["relative-link", "history-series", "badges", "custom-class", "custom-renderer"]);
|
|
301
|
+
const badgeSeparator = " \u00b7 ";
|
|
278
302
|
const rawIdentities = new WeakMap();
|
|
303
|
+
// Appended badge labels, kept apart so later passes that re-render a cell's text (PDF numbers) can carry them over.
|
|
304
|
+
const badgeSuffixes = new WeakMap();
|
|
305
|
+
/** @internal The text a later pass may re-render, and the badge suffix it must append back unchanged. */
|
|
306
|
+
function canopyBadgeSplit(cell) {
|
|
307
|
+
const suffix = badgeSuffixes.get(cell), text = cell.text ?? "";
|
|
308
|
+
return suffix !== undefined && text.endsWith(suffix) ? { text: text.slice(0, text.length - suffix.length), suffix } : { text, suffix: "" };
|
|
309
|
+
}
|
|
279
310
|
/** @internal Grouping uses captured identity even when a detail cell displays a relative-link label. */
|
|
280
311
|
function canopyIdentityValue(value) {
|
|
281
312
|
if (!(value instanceof ExportCell))
|
|
@@ -283,6 +314,20 @@ function canopyIdentityValue(value) {
|
|
|
283
314
|
const original = rawIdentities.get(value);
|
|
284
315
|
return original === undefined ? value.value : original;
|
|
285
316
|
}
|
|
317
|
+
function badgeText(input) {
|
|
318
|
+
if (!Array.isArray(input) || input.length > 64)
|
|
319
|
+
throw new TypeError("Canopy cell badges must be a bounded array of { text, tone?, title? }.");
|
|
320
|
+
const labels = [];
|
|
321
|
+
for (const badge of input) {
|
|
322
|
+
const text = typeof badge === "string" ? badge : badge && typeof badge === "object" ? badge.text : undefined;
|
|
323
|
+
if (typeof text !== "string")
|
|
324
|
+
throw new TypeError("Canopy cell badges must be a bounded array of { text, tone?, title? }.");
|
|
325
|
+
const label = text.trim();
|
|
326
|
+
if (label)
|
|
327
|
+
labels.push(label);
|
|
328
|
+
}
|
|
329
|
+
return labels.length ? labels.join(badgeSeparator) : undefined;
|
|
330
|
+
}
|
|
286
331
|
/** Map an immutable CanopyX record capture to a writer without querying the grid or retaining its body. */
|
|
287
332
|
function createCanopyExport(capture, format, options = {}) {
|
|
288
333
|
return prepareCanopyExport(capture, format, options).source;
|
|
@@ -316,7 +361,7 @@ function prepareCanopyExport(capture, format, options = {}) {
|
|
|
316
361
|
throw new TypeError("Canopy presentation diagnostics must be strings.");
|
|
317
362
|
for (const code of items) {
|
|
318
363
|
const diagnostic = { code, ...(rowId === undefined ? {} : { rowId }), ...(columnId === undefined ? {} : { columnId }) };
|
|
319
|
-
(code
|
|
364
|
+
(textFallbacks.has(code) ? fallback : report)(diagnostic);
|
|
320
365
|
}
|
|
321
366
|
};
|
|
322
367
|
if (request.presentation !== "text" && request.presentation !== "semantic")
|
|
@@ -331,11 +376,13 @@ function prepareCanopyExport(capture, format, options = {}) {
|
|
|
331
376
|
return undefined;
|
|
332
377
|
if (typeof name !== "string")
|
|
333
378
|
throw new TypeError("Canopy tones must be strings.");
|
|
334
|
-
const style = tones.get(name);
|
|
379
|
+
const style = tones.get(name) ?? canopyDefaultTones.get(name);
|
|
335
380
|
if (!style && name !== "neutral")
|
|
336
381
|
fallback({ code: "UNMAPPED_TONE:" + name, rowId, ...(columnId === undefined ? {} : { columnId }) });
|
|
337
382
|
return style;
|
|
338
383
|
};
|
|
384
|
+
// The full writer fills this with columns read by the native rules it emits, before any row is enumerated.
|
|
385
|
+
const ruleOperands = new Set();
|
|
339
386
|
const ids = new Set();
|
|
340
387
|
const specs = (pivot?.columns ?? request.columns).map(input => {
|
|
341
388
|
const fields = captureFields(input, ["id", "title", "kind", "width", "pinned", "format", "wrap", "alignment", "diagnostics"]);
|
|
@@ -394,8 +441,14 @@ function prepareCanopyExport(capture, format, options = {}) {
|
|
|
394
441
|
diagnostics(cell.diagnostics, row.id, spec.id);
|
|
395
442
|
// A relative destination is navigation metadata, not the visible label.
|
|
396
443
|
// History captures already carry their frozen latest scalar (or null).
|
|
397
|
-
|
|
398
|
-
|
|
444
|
+
// Columns read by an emitted native rule keep the raw scalar the rule compares, so the label goes to the text only.
|
|
445
|
+
const relativeLabel = spec.kind === "text" && cell.diagnostics?.includes("relative-link") && !ruleOperands.has(spec.id);
|
|
446
|
+
const badges = cell.badges === undefined ? undefined : badgeText(cell.badges);
|
|
447
|
+
const text = badges ? cell.text ? cell.text + badgeSeparator + badges : badges : cell.text;
|
|
448
|
+
// Badges belong to the visible label, so a badged text cell exports that composed label rather than a raw/label hybrid.
|
|
449
|
+
// Typed columns keep their scalar, and native rule operands keep the raw value the rule compares; both carry badges in the text only.
|
|
450
|
+
const badgedValue = !!badges && values === "raw" && !relativeLabel && spec.kind === "text" && !ruleOperands.has(spec.id);
|
|
451
|
+
let value = values === "display" || relativeLabel || badgedValue ? text : cell.value;
|
|
399
452
|
if (format === "xlsx" && values === "raw" && spec.kind === "datetime" && typeof value === "string")
|
|
400
453
|
value = datetime(value, dateMode, clock);
|
|
401
454
|
const capturedFormat = pivot && spec.kind === "number" && cell.value !== null ? pivotNumberFormat(cell) : undefined;
|
|
@@ -410,9 +463,12 @@ function prepareCanopyExport(capture, format, options = {}) {
|
|
|
410
463
|
if (format === "csv")
|
|
411
464
|
result.push(value);
|
|
412
465
|
else {
|
|
413
|
-
const exported = new ExportCell(value, { text
|
|
414
|
-
if (relativeLabel)
|
|
466
|
+
const exported = new ExportCell(value, { text, ...(presentation ? { presentation } : {}), ...(cell.link === undefined ? {} : { link: cell.link }) });
|
|
467
|
+
if (relativeLabel || badgedValue)
|
|
415
468
|
rawIdentities.set(exported, cell.value);
|
|
469
|
+
// A badge-only label is all suffix: later passes then see the captured label as empty.
|
|
470
|
+
if (badges)
|
|
471
|
+
badgeSuffixes.set(exported, cell.text ? badgeSeparator + badges : badges);
|
|
416
472
|
result.push(exported);
|
|
417
473
|
}
|
|
418
474
|
}
|
|
@@ -424,14 +480,14 @@ function prepareCanopyExport(capture, format, options = {}) {
|
|
|
424
480
|
if (rowCount !== null && count !== rowCount)
|
|
425
481
|
throw new TypeError("Canopy capture did not produce its declared recordCount.");
|
|
426
482
|
} });
|
|
427
|
-
return Object.freeze({ source, request: Object.freeze({ ...request, columns: Object.freeze(specs.map(spec => spec.input)) }), report, tones, pivot });
|
|
483
|
+
return Object.freeze({ source, request: Object.freeze({ ...request, columns: Object.freeze(specs.map(spec => spec.input)) }), report, tones, pivot, ruleOperands });
|
|
428
484
|
}
|
|
429
|
-
const _exports = Object.freeze({ canopyIdentityValue: canopyIdentityValue, createCanopyExport: createCanopyExport, prepareCanopyExport: prepareCanopyExport });
|
|
430
|
-
_modules.set("
|
|
485
|
+
const _exports = Object.freeze({ canopyBadgeSplit: canopyBadgeSplit, canopyIdentityValue: canopyIdentityValue, createCanopyExport: createCanopyExport, prepareCanopyExport: prepareCanopyExport });
|
|
486
|
+
_modules.set("1c14f8a6ef9eb43a6a59948c7ec08999e0d5d7759b2dcc6468e6e425680d0d50", _exports);
|
|
431
487
|
return _exports;
|
|
432
488
|
})();
|
|
433
489
|
|
|
434
|
-
const
|
|
490
|
+
const _m21 = _modules.get("5a74a3a4b49b99e91046bdd0ddc125e822d9021341a42f26750395f3d729c95c") ?? (() => {
|
|
435
491
|
const { columnName, excelDate } = _c12;
|
|
436
492
|
|
|
437
493
|
const { captureFields } = _c2;
|
|
@@ -439,7 +495,7 @@ const { captureFields } = _c2;
|
|
|
439
495
|
const { datetime } = _m15;
|
|
440
496
|
|
|
441
497
|
/** Compile only comparisons whose raw types and native encodings have a faithful bounded mapping. */
|
|
442
|
-
function canopyPredicate(request, grouped, options, root, unsupported, cellTypes) {
|
|
498
|
+
function canopyPredicate(request, grouped, options, root, unsupported, cellTypes, operands) {
|
|
443
499
|
let nodes = 0;
|
|
444
500
|
const operations = { eq: "=", ne: "<>", gt: ">", ge: ">=", lt: "<", le: "<=" };
|
|
445
501
|
const numeric = (value) => {
|
|
@@ -486,6 +542,7 @@ function canopyPredicate(request, grouped, options, root, unsupported, cellTypes
|
|
|
486
542
|
const index = request.columns.findIndex(column => column.id === filter.column);
|
|
487
543
|
if (index < 0)
|
|
488
544
|
return unsupported("RULE_COLUMN_NOT_EXPORTED:" + filter.column);
|
|
545
|
+
operands?.add(filter.column);
|
|
489
546
|
const column = request.columns[index], letter = columnName(index + 1 + (grouped ? 1 : 0));
|
|
490
547
|
const reference = "INDEX($" + letter + ":$" + letter + ",ROW())", present = "NOT(ISBLANK(" + reference + "))";
|
|
491
548
|
if (column.kind === "number")
|
|
@@ -546,28 +603,23 @@ function canopyPredicate(request, grouped, options, root, unsupported, cellTypes
|
|
|
546
603
|
return formula;
|
|
547
604
|
}
|
|
548
605
|
const _exports = Object.freeze({ canopyPredicate: canopyPredicate });
|
|
549
|
-
_modules.set("
|
|
606
|
+
_modules.set("5a74a3a4b49b99e91046bdd0ddc125e822d9021341a42f26750395f3d729c95c", _exports);
|
|
550
607
|
return _exports;
|
|
551
608
|
})();
|
|
552
609
|
|
|
553
|
-
const
|
|
610
|
+
const _m20 = _modules.get("9e37b2d273c800b7b2952c298b4c50a1368f06b9192f89d6bc3097e4ccb3bcf8") ?? (() => {
|
|
554
611
|
const { captureFields } = _c2;
|
|
555
612
|
|
|
556
|
-
const { canopyPredicate } =
|
|
613
|
+
const { canopyPredicate } = _m21;
|
|
614
|
+
|
|
615
|
+
const { canopyDefaultTones, canopyTonePalette: palette } = _m19;
|
|
557
616
|
|
|
558
|
-
// Stable document palette. Browser CSS variables and resolved cell.format are never interpreted.
|
|
559
|
-
const palette = {
|
|
560
|
-
info: { color: "4472C4", background: "DDEBF7", foreground: "1F4E78" },
|
|
561
|
-
success: { color: "70AD47", background: "E2F0D9", foreground: "375623" },
|
|
562
|
-
warning: { color: "FFC000", background: "FFF2CC", foreground: "9C6500" },
|
|
563
|
-
danger: { color: "C00000", background: "FFC7CE", foreground: "9C0006" }
|
|
564
|
-
};
|
|
565
617
|
class UnsupportedRule extends Error {
|
|
566
618
|
}
|
|
567
619
|
const unsupported = (message) => { throw new UnsupportedRule(message); };
|
|
568
620
|
/** Compile declarations in source order, then emit native target/aspect priorities.
|
|
569
621
|
* Data-column selectors let grouped writers exclude generated headings, subtotals and grand totals. */
|
|
570
|
-
function canopyRules(request, format, grouped, tones, report, options = {}, cellTypes) {
|
|
622
|
+
function canopyRules(request, format, grouped, tones, report, options = {}, cellTypes, operands) {
|
|
571
623
|
if (request.formatRules === undefined || format === "csv")
|
|
572
624
|
return [];
|
|
573
625
|
if (!Array.isArray(request.formatRules) || request.formatRules.length > 1000)
|
|
@@ -606,7 +658,7 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
|
|
|
606
658
|
}
|
|
607
659
|
const priorStops = [];
|
|
608
660
|
const priorRows = [], priorCells = new Map();
|
|
609
|
-
const requiredCells = new Map();
|
|
661
|
+
const requiredCells = new Map(), emittedOperands = new Set();
|
|
610
662
|
const column = (id) => {
|
|
611
663
|
const index = columns.findIndex(column => column.id === id);
|
|
612
664
|
if (index < 0)
|
|
@@ -624,8 +676,7 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
|
|
|
624
676
|
return value;
|
|
625
677
|
};
|
|
626
678
|
const style = (name) => {
|
|
627
|
-
const
|
|
628
|
-
const mapping = tones.get(name) ?? (defaults ? { background: defaults.background, color: defaults.foreground } : undefined);
|
|
679
|
+
const mapping = tones.get(name) ?? canopyDefaultTones.get(name);
|
|
629
680
|
if (!mapping)
|
|
630
681
|
return unsupported("UNMAPPED_RULE_TONE:" + name);
|
|
631
682
|
if ("alignment" in mapping || "wrapText" in mapping)
|
|
@@ -698,8 +749,8 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
|
|
|
698
749
|
const range = rule.target === "row" ? { column: columns[0].id, through: columns.at(-1).id } : { column: rule.column };
|
|
699
750
|
if (rule.column !== undefined)
|
|
700
751
|
column(rule.column);
|
|
701
|
-
const ruleCells = new Map();
|
|
702
|
-
const ownPredicate = canopyPredicate(request, grouped, options, rule.when, unsupported, ruleCells);
|
|
752
|
+
const ruleCells = new Map(), ruleOperands = new Set();
|
|
753
|
+
const ownPredicate = canopyPredicate(request, grouped, options, rule.when, unsupported, ruleCells, ruleOperands);
|
|
703
754
|
const reachable = priorStops.length ? "AND(" + ownPredicate + ",NOT(OR(" + priorStops.join(",") + ")))" : ownPredicate;
|
|
704
755
|
const previous = rule.target === "row" ? priorRows : priorCells.get(rule.column) ?? [];
|
|
705
756
|
const formula = previous.length ? "AND(" + reachable + ",NOT(OR(" + previous.join(",") + ")))" : reachable;
|
|
@@ -711,6 +762,8 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
|
|
|
711
762
|
priorCells.set(rule.column, previous);
|
|
712
763
|
for (const [column, type] of ruleCells)
|
|
713
764
|
requiredCells.set(column, type);
|
|
765
|
+
for (const id of ruleOperands)
|
|
766
|
+
emittedOperands.add(id);
|
|
714
767
|
// A matched declaration still stops the row when an earlier tone on that target already won.
|
|
715
768
|
if (rule.stopIfTrue)
|
|
716
769
|
priorStops.push(ownPredicate);
|
|
@@ -726,15 +779,18 @@ function canopyRules(request, format, grouped, tones, report, options = {}, cell
|
|
|
726
779
|
}
|
|
727
780
|
for (const [column, type] of requiredCells)
|
|
728
781
|
cellTypes?.set(column, type);
|
|
782
|
+
// Only emitted rules read raw cells; a rejected comparison leaves its column free to carry badge labels.
|
|
783
|
+
for (const id of emittedOperands)
|
|
784
|
+
operands?.add(id);
|
|
729
785
|
// Canopy paints cell visuals/tones over the row tint. Build masks before changing native priority order.
|
|
730
786
|
return Object.freeze([...visuals, ...cells, ...rows]);
|
|
731
787
|
}
|
|
732
788
|
const _exports = Object.freeze({ canopyRules: canopyRules });
|
|
733
|
-
_modules.set("
|
|
789
|
+
_modules.set("9e37b2d273c800b7b2952c298b4c50a1368f06b9192f89d6bc3097e4ccb3bcf8", _exports);
|
|
734
790
|
return _exports;
|
|
735
791
|
})();
|
|
736
792
|
|
|
737
|
-
const
|
|
793
|
+
const _m23 = _modules.get("74324ccf7f5e453329bc1a37bb4bf20600f9c12e02c0386f09e94c935126c014") ?? (() => {
|
|
738
794
|
const { createGroupedReport } = _c13;
|
|
739
795
|
|
|
740
796
|
const { checkAbort } = _c14;
|
|
@@ -940,11 +996,11 @@ function canopyGrouped(source, request, options, limits, report, format) {
|
|
|
940
996
|
...(options.signal === undefined ? {} : { signal: options.signal }), ...(sourceLimits === undefined ? {} : { limits: sourceLimits }) });
|
|
941
997
|
}
|
|
942
998
|
const _exports = Object.freeze({ canopyGrouped: canopyGrouped });
|
|
943
|
-
_modules.set("
|
|
999
|
+
_modules.set("74324ccf7f5e453329bc1a37bb4bf20600f9c12e02c0386f09e94c935126c014", _exports);
|
|
944
1000
|
return _exports;
|
|
945
1001
|
})();
|
|
946
1002
|
|
|
947
|
-
const
|
|
1003
|
+
const _m27 = _modules.get("99b23f94e240ecbeee81dbc96909e40786623c7df225f74ae7bd4d719b15d1e8") ?? (() => {
|
|
948
1004
|
const { cellText } = _c12;
|
|
949
1005
|
|
|
950
1006
|
const { cleanXml } = _c16;
|
|
@@ -1003,7 +1059,7 @@ _modules.set("99b23f94e240ecbeee81dbc96909e40786623c7df225f74ae7bd4d719b15d1e8",
|
|
|
1003
1059
|
return _exports;
|
|
1004
1060
|
})();
|
|
1005
1061
|
|
|
1006
|
-
const
|
|
1062
|
+
const _m29 = _modules.get("ff9ebe6611a20221f004b38be28c8bad2eb2498628f9c024ff76c73699b0eaca") ?? (() => {
|
|
1007
1063
|
const { Workbook, addGroupedXlsx } = _c7;
|
|
1008
1064
|
|
|
1009
1065
|
const { portableWorkbook } = _c17;
|
|
@@ -1060,13 +1116,15 @@ async function writeCanopyWorkbook(source, grouped, destination, options, labels
|
|
|
1060
1116
|
});
|
|
1061
1117
|
}
|
|
1062
1118
|
const _exports = Object.freeze({ writeCanopyWorkbook: writeCanopyWorkbook });
|
|
1063
|
-
_modules.set("
|
|
1119
|
+
_modules.set("ff9ebe6611a20221f004b38be28c8bad2eb2498628f9c024ff76c73699b0eaca", _exports);
|
|
1064
1120
|
return _exports;
|
|
1065
1121
|
})();
|
|
1066
1122
|
|
|
1067
|
-
const
|
|
1123
|
+
const _m35 = _modules.get("42874f77dd285c63f48c430331320f2732b3df1245c086552923233647a9149d") ?? (() => {
|
|
1068
1124
|
const { ExportCell } = _c0;
|
|
1069
1125
|
|
|
1126
|
+
const { canopyBadgeSplit } = _m13;
|
|
1127
|
+
|
|
1070
1128
|
/** Fixed numeric formats affect PDF text, not the frozen numeric value used by other writers. */
|
|
1071
1129
|
function numericProfile(format) {
|
|
1072
1130
|
// No declared precision: whole values (including counts) stay whole.
|
|
@@ -1114,11 +1172,11 @@ function documentDecimal(sample, columns) {
|
|
|
1114
1172
|
const profile = numericProfile(cell.presentation?.numberFormat ?? column.format);
|
|
1115
1173
|
if (!profile)
|
|
1116
1174
|
continue;
|
|
1117
|
-
const
|
|
1175
|
+
const label = canopyBadgeSplit(cell).text, captured = capturedNumber(label, profile);
|
|
1118
1176
|
if (!captured)
|
|
1119
1177
|
continue;
|
|
1120
1178
|
// A literal percent label is a culture signal without requesting numeric scaling.
|
|
1121
|
-
const percentageSignal = profile.percent || profile.prefix.includes("%") || profile.suffix.includes("%") ||
|
|
1179
|
+
const percentageSignal = profile.percent || profile.prefix.includes("%") || profile.suffix.includes("%") || label.includes("%");
|
|
1122
1180
|
if (percentageSignal !== percent)
|
|
1123
1181
|
continue;
|
|
1124
1182
|
const match = /([.,])(\d+)$/.exec(captured.number.trimEnd());
|
|
@@ -1145,10 +1203,12 @@ function canopyPdfNumbers(sample, columns) {
|
|
|
1145
1203
|
return value;
|
|
1146
1204
|
const format = value.presentation?.numberFormat ?? columns[index].format;
|
|
1147
1205
|
let profile = numericProfile(format);
|
|
1148
|
-
|
|
1206
|
+
// Badge labels are not part of the number: format the captured label alone, then append them unchanged.
|
|
1207
|
+
const { text: label, suffix: badges } = canopyBadgeSplit(value);
|
|
1208
|
+
if (!profile || label === "")
|
|
1149
1209
|
return value;
|
|
1150
|
-
const captured = capturedNumber(
|
|
1151
|
-
if (
|
|
1210
|
+
const captured = capturedNumber(label, profile);
|
|
1211
|
+
if (label && !captured)
|
|
1152
1212
|
return value;
|
|
1153
1213
|
// Undeclared formats normalize only plain numeric labels; a decoration
|
|
1154
1214
|
// alone does not declare how the raw value was transformed for display.
|
|
@@ -1180,16 +1240,16 @@ function canopyPdfNumbers(sample, columns) {
|
|
|
1180
1240
|
let suffix = captured?.suffix || profile.suffix;
|
|
1181
1241
|
if (profile.percent && !profile.suffix)
|
|
1182
1242
|
suffix = suffix.replace(/%/g, "");
|
|
1183
|
-
return new ExportCell(value.value, { text: leadingSign + prefix + formatted + (profile.percent ? "%" : "") + suffix,
|
|
1243
|
+
return new ExportCell(value.value, { text: leadingSign + prefix + formatted + (profile.percent ? "%" : "") + suffix + badges,
|
|
1184
1244
|
...(value.presentation ? { presentation: value.presentation } : {}), ...(value.link ? { link: value.link } : {}) });
|
|
1185
1245
|
});
|
|
1186
1246
|
}
|
|
1187
1247
|
const _exports = Object.freeze({ canopyPdfNumbers: canopyPdfNumbers });
|
|
1188
|
-
_modules.set("
|
|
1248
|
+
_modules.set("42874f77dd285c63f48c430331320f2732b3df1245c086552923233647a9149d", _exports);
|
|
1189
1249
|
return _exports;
|
|
1190
1250
|
})();
|
|
1191
1251
|
|
|
1192
|
-
const
|
|
1252
|
+
const _m32 = _modules.get("1e292c5b5b97e0a02496b29c710025ff18638d06c66533d294ba6dfea9f86f30") ?? (() => {
|
|
1193
1253
|
const { ExportCell, NotSupportedError, OfficeIMOError } = _c0;
|
|
1194
1254
|
|
|
1195
1255
|
const { inputRows, checkAbort, pause, taskYieldDue } = _c14;
|
|
@@ -1200,7 +1260,7 @@ const { resolveScalar, selectFont, validateFonts } = _c20;
|
|
|
1200
1260
|
|
|
1201
1261
|
const { settings } = _c5;
|
|
1202
1262
|
|
|
1203
|
-
const { canopyPdfNumbers } =
|
|
1263
|
+
const { canopyPdfNumbers } = _m35;
|
|
1204
1264
|
|
|
1205
1265
|
/** A bounded lookahead is replayed once; no second capture, full-dataset copy or smaller font is needed. */
|
|
1206
1266
|
async function withCanopyPdfLayout(source, captured, options, write) {
|
|
@@ -1294,11 +1354,11 @@ async function withCanopyPdfLayout(source, captured, options, write) {
|
|
|
1294
1354
|
}
|
|
1295
1355
|
}
|
|
1296
1356
|
const _exports = Object.freeze({ withCanopyPdfLayout: withCanopyPdfLayout });
|
|
1297
|
-
_modules.set("
|
|
1357
|
+
_modules.set("1e292c5b5b97e0a02496b29c710025ff18638d06c66533d294ba6dfea9f86f30", _exports);
|
|
1298
1358
|
return _exports;
|
|
1299
1359
|
})();
|
|
1300
1360
|
|
|
1301
|
-
const _m0 = _modules.get("
|
|
1361
|
+
const _m0 = _modules.get("5ec26f81c5d8452a1fc7f672295741a5e07f235fc91ce8d73a7263a181c91027") ?? (() => {
|
|
1302
1362
|
const { BlobByteSink, ExportCell } = _c0;
|
|
1303
1363
|
|
|
1304
1364
|
const { notifyProgress } = _c1;
|
|
@@ -1319,15 +1379,15 @@ const { prepareCanopyExport } = _m13;
|
|
|
1319
1379
|
|
|
1320
1380
|
const { canopyPins } = _m18;
|
|
1321
1381
|
|
|
1322
|
-
const { canopyRules } =
|
|
1382
|
+
const { canopyRules } = _m20;
|
|
1323
1383
|
|
|
1324
|
-
const { canopyGrouped } =
|
|
1384
|
+
const { canopyGrouped } = _m23;
|
|
1325
1385
|
|
|
1326
|
-
const { canopyAbout } =
|
|
1386
|
+
const { canopyAbout } = _m27;
|
|
1327
1387
|
|
|
1328
|
-
const { writeCanopyWorkbook } =
|
|
1388
|
+
const { writeCanopyWorkbook } = _m29;
|
|
1329
1389
|
|
|
1330
|
-
const { withCanopyPdfLayout } =
|
|
1390
|
+
const { withCanopyPdfLayout } = _m32;
|
|
1331
1391
|
|
|
1332
1392
|
|
|
1333
1393
|
|
|
@@ -1335,6 +1395,7 @@ const { withCanopyPdfLayout } = _m31;
|
|
|
1335
1395
|
|
|
1336
1396
|
|
|
1337
1397
|
|
|
1398
|
+
const canopyHeaderFill = "E7EDF5", canopyHeaderBorder = Object.freeze({ bottom: Object.freeze({ style: "thin", color: "A6B4C8" }) });
|
|
1338
1399
|
/** Write a captured CanopyX grid to a caller-owned destination; partial bytes remain caller-owned on failure. */
|
|
1339
1400
|
async function writeCanopyTo(capture, format, destination, options = {}) {
|
|
1340
1401
|
const selected = captureFields(options, ["tones", "columnOptions", "unsupportedPresentation", "datetime", "xlsx", "csv", "pdf", "signal", "onDiagnostic", "limits", "onProgress", "grouped", "about"]);
|
|
@@ -1374,13 +1435,14 @@ async function writeCanopyTo(capture, format, destination, options = {}) {
|
|
|
1374
1435
|
const stream = { ...(signal ? { signal } : {}), ...progress };
|
|
1375
1436
|
if (format === "xlsx") {
|
|
1376
1437
|
const formatLimits = mergeAdapterLimits(xlsx.limits, limits), grouped = pivot ? undefined : canopyGrouped(source, request, { ...selected, xlsx }, formatLimits, report, format);
|
|
1377
|
-
const pinned = canopyPins(request.columns, report), rules = canopyRules(request, format, grouped !== undefined, tones, report, { ...selected, xlsx }, ruleCellTypes);
|
|
1438
|
+
const pinned = canopyPins(request.columns, report), rules = canopyRules(request, format, grouped !== undefined, tones, report, { ...selected, xlsx }, ruleCellTypes, prepared.ruleOperands);
|
|
1378
1439
|
if (pivot && (xlsx.sheet?.rowOutline !== undefined || xlsx.sheet?.columnOutlines !== undefined || xlsx.sheet?.maxOutlineLevel !== undefined ||
|
|
1379
1440
|
xlsx.sheet?.outlineSummaryBelow !== undefined || xlsx.sheet?.outlineSummaryRight !== undefined || xlsx.sheet?.table !== undefined || xlsx.sheet?.footer !== undefined))
|
|
1380
1441
|
throw new TypeError("Captured pivot metadata owns outlines and totals; worksheet overrides cannot regroup or recalculate it.");
|
|
1381
1442
|
if (pivot && xlsx.cellValueWriters !== undefined)
|
|
1382
1443
|
throw new TypeError("Captured pivot exports use frozen values rather than custom cellValueWriters.");
|
|
1383
|
-
|
|
1444
|
+
// The header matches the PDF table heading: shaded, bold, wrapped and ruled off from the data.
|
|
1445
|
+
const sheet = { headerFill: canopyHeaderFill, headerBorder: canopyHeaderBorder, headerWrap: true, ...xlsx.sheet, ...(pivot?.sheet ?? {}), ...(pivot ? { autoFilter: false } : {}),
|
|
1384
1446
|
freezeHeader: xlsx.sheet?.freezeHeader ?? (xlsx.sheet?.includeHeader !== false),
|
|
1385
1447
|
freezeColumns: xlsx.sheet?.freezeColumns ?? (pinned ? pinned + (grouped ? 1 : 0) : 0),
|
|
1386
1448
|
conditionalFormats: [...rules, ...(xlsx.sheet?.conditionalFormats ?? [])] };
|
|
@@ -1437,7 +1499,7 @@ async function exportCanopy(capture, format, options = {}) {
|
|
|
1437
1499
|
}
|
|
1438
1500
|
}
|
|
1439
1501
|
const _exports = Object.freeze({ createCanopyExport: _m13.createCanopyExport, ExportCell: _c11.ExportCell, PdfFont: _c19.PdfFont, writeCanopyTo: writeCanopyTo, exportCanopy: exportCanopy });
|
|
1440
|
-
_modules.set("
|
|
1502
|
+
_modules.set("5ec26f81c5d8452a1fc7f672295741a5e07f235fc91ce8d73a7263a181c91027", _exports);
|
|
1441
1503
|
return _exports;
|
|
1442
1504
|
})();
|
|
1443
1505
|
Object.assign(officeimo, _m0);
|