@evotecit/officeimo 0.1.2 → 0.1.3
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 +43 -49
- package/bundles/officeimo-canopyx.js +966 -122
- package/bundles/officeimo-canopyx.mjs +929 -92
- package/bundles/officeimo-csv.js +18 -15
- package/bundles/officeimo-csv.mjs +16 -13
- package/bundles/officeimo-datatables.js +168 -82
- package/bundles/officeimo-datatables.mjs +140 -54
- package/bundles/officeimo-pdf.js +148 -65
- package/bundles/officeimo-pdf.mjs +124 -41
- package/bundles/officeimo.js +168 -82
- package/bundles/officeimo.mjs +140 -54
- 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 +188 -0
- package/dist/integrations/canopyx/index.d.ts +2 -2
- package/dist/integrations/canopyx/index.js +72 -15
- package/dist/integrations/canopyx/metadata.d.ts +4 -0
- package/dist/integrations/canopyx/metadata.js +51 -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 +24 -22
- package/dist/integrations/canopyx/types.d.ts +89 -8
- package/dist/integrations/canopyx/workbook.d.ts +6 -0
- package/dist/integrations/canopyx/workbook.js +52 -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/package.json +1 -1
|
@@ -1110,7 +1110,7 @@ _modules.set("f0627ba89e5c8fcb376ebe3ce72dcc8d68c34952981f8703e36b8bb1a9894208",
|
|
|
1110
1110
|
return _exports;
|
|
1111
1111
|
})();
|
|
1112
1112
|
|
|
1113
|
-
const _m15 = _modules.get("
|
|
1113
|
+
const _m15 = _modules.get("b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4") ?? (() => {
|
|
1114
1114
|
const { beginTask, checkAbort, consumeRows, taskYieldDue, withAbort } = _m4;
|
|
1115
1115
|
|
|
1116
1116
|
const { BlobByteSink, ChunkedTextSink, withDestination } = _m3;
|
|
@@ -1135,29 +1135,32 @@ const { captureCsvOptions } = _m19;
|
|
|
1135
1135
|
|
|
1136
1136
|
|
|
1137
1137
|
|
|
1138
|
-
function csvField(value, delimiter, protect, quote, booleanText
|
|
1139
|
-
|
|
1140
|
-
value = nullValue;
|
|
1138
|
+
function csvField(value, delimiter, protect, quote, booleanText) {
|
|
1139
|
+
const kind = typeof value;
|
|
1141
1140
|
let text;
|
|
1142
1141
|
if (value == null)
|
|
1143
1142
|
text = "";
|
|
1143
|
+
else if (kind === "string")
|
|
1144
|
+
text = value;
|
|
1145
|
+
else if (kind === "number") {
|
|
1146
|
+
text = Number.isFinite(value) ? String(value) : "";
|
|
1147
|
+
// Numeric text has no CSV delimiter, quote or line break to escape.
|
|
1148
|
+
return quote === "all" ? '"' + text + '"' : text;
|
|
1149
|
+
}
|
|
1150
|
+
else if (kind === "boolean")
|
|
1151
|
+
text = booleanText[value ? "true" : "false"];
|
|
1144
1152
|
else if (isDate(value))
|
|
1145
1153
|
text = Number.isFinite(value.getTime()) ? value.toISOString() : "";
|
|
1146
|
-
else if (typeof value === "boolean")
|
|
1147
|
-
text = booleanText[value ? "true" : "false"];
|
|
1148
|
-
else if (typeof value === "number")
|
|
1149
|
-
text = Number.isFinite(value) ? String(value) : "";
|
|
1150
|
-
else if (typeof value === "string")
|
|
1151
|
-
text = value;
|
|
1152
1154
|
else {
|
|
1153
1155
|
if (typeof value.then === "function")
|
|
1154
1156
|
void Promise.resolve(value).catch(() => { });
|
|
1155
1157
|
throw new TypeError("CSV cells and formatter results must be synchronous strings, numbers, booleans, Dates or null.");
|
|
1156
1158
|
}
|
|
1157
|
-
|
|
1159
|
+
// Only ASCII spaces, controls and markers through @ can begin the protected prefix.
|
|
1160
|
+
if (protect && (kind === "string" || kind === "boolean") && text.charCodeAt(0) <= 64 && /^ *[=+\-@\t\r\n]/.test(text))
|
|
1158
1161
|
text = "'" + text;
|
|
1159
|
-
return quote === "all" || (quote === "strings" &&
|
|
1160
|
-
? '"' + text.replace(/"/g, '""') + '"' : text;
|
|
1162
|
+
return quote === "all" || (quote === "strings" && kind === "string") || text.includes(delimiter) || /["\r\n]/.test(text)
|
|
1163
|
+
? '"' + (text.includes('"') ? text.replace(/"/g, '""') : text) + '"' : text;
|
|
1161
1164
|
}
|
|
1162
1165
|
async function writeCsvTo(rows, destination, configuration) {
|
|
1163
1166
|
const options = captureCsvOptions(configuration);
|
|
@@ -1209,7 +1212,7 @@ async function write(rows, sink, options) {
|
|
|
1209
1212
|
value = options.nullValue;
|
|
1210
1213
|
budget.cell(typeof value === "boolean" ? booleanText[value ? "true" : "false"] : value);
|
|
1211
1214
|
checkAbort(signal);
|
|
1212
|
-
text += (i ? delimiter : "") + csvField(value, delimiter, protect, quote, booleanText
|
|
1215
|
+
text += (i ? delimiter : "") + csvField(value, delimiter, protect, quote, booleanText);
|
|
1213
1216
|
if (text.length >= buffer.chunkSize || (i & 127) === 127 && taskYieldDue()) {
|
|
1214
1217
|
if (buffer.append(text))
|
|
1215
1218
|
return buffer.flush().then(() => record(values, header, i + 1, snapshot));
|
|
@@ -1257,7 +1260,7 @@ async function writeCsv(rows, configuration) {
|
|
|
1257
1260
|
}
|
|
1258
1261
|
}
|
|
1259
1262
|
const _exports = Object.freeze({ saveBlob: _m1.saveBlob, ExportCell: _m5.ExportCell, writeCsvTo: writeCsvTo, writeCsv: writeCsv });
|
|
1260
|
-
_modules.set("
|
|
1263
|
+
_modules.set("b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4", _exports);
|
|
1261
1264
|
return _exports;
|
|
1262
1265
|
})();
|
|
1263
1266
|
|
|
@@ -7199,7 +7202,7 @@ _modules.set("59911f0fe023545e9e97521b268551078bdc4c5f303e446a13b7d52f905e8070",
|
|
|
7199
7202
|
return _exports;
|
|
7200
7203
|
})();
|
|
7201
7204
|
|
|
7202
|
-
const _m61 = _modules.get("
|
|
7205
|
+
const _m61 = _modules.get("4d4736e6b8e2aaecc6f6c1b124b7e6bc0a5e141dcc725edf0ad4847d87fca1b3") ?? (() => {
|
|
7203
7206
|
const { NotSupportedError, OfficeIMOError } = _m2;
|
|
7204
7207
|
|
|
7205
7208
|
const { fontProgram } = _m62;
|
|
@@ -7210,7 +7213,8 @@ const { pdfNumber, unicodeHex } = _m59;
|
|
|
7210
7213
|
|
|
7211
7214
|
const { checkAbort, pause, taskYieldDue } = _m4;
|
|
7212
7215
|
|
|
7213
|
-
const
|
|
7216
|
+
const hexBytes = Object.freeze(Array.from({ length: 256 }, (_, byte) => byte.toString(16).padStart(2, "0")));
|
|
7217
|
+
function cidHex(cid) { return hexBytes[cid >>> 8] + hexBytes[cid & 255]; }
|
|
7214
7218
|
class PdfFontResource {
|
|
7215
7219
|
index;
|
|
7216
7220
|
bold;
|
|
@@ -7241,12 +7245,16 @@ class PdfFontResource {
|
|
|
7241
7245
|
width(scalar) {
|
|
7242
7246
|
if (this.shared)
|
|
7243
7247
|
return this.shared.width(scalar);
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7248
|
+
if (this.program) {
|
|
7249
|
+
const existing = this.mappings.get(scalar);
|
|
7250
|
+
if (existing)
|
|
7251
|
+
return existing.width;
|
|
7252
|
+
}
|
|
7253
|
+
else {
|
|
7254
|
+
const standard = this.standardWidths.get(scalar);
|
|
7255
|
+
if (standard !== undefined)
|
|
7256
|
+
return standard;
|
|
7257
|
+
}
|
|
7250
7258
|
const resolved = resolveScalar(scalar, this.program, this.bold);
|
|
7251
7259
|
if (!resolved.supported) {
|
|
7252
7260
|
if (resolved.code === "unpaired-surrogate")
|
|
@@ -7259,7 +7267,8 @@ class PdfFontResource {
|
|
|
7259
7267
|
}
|
|
7260
7268
|
if (this.mappings.size >= 65535)
|
|
7261
7269
|
throw new OfficeIMOError("RESOURCE_LIMIT", "A PDF font supports at most 65,535 distinct Unicode scalars.");
|
|
7262
|
-
const
|
|
7270
|
+
const cid = this.mappings.size + 1;
|
|
7271
|
+
const mapping = { cid, hex: cidHex(cid), glyph: resolved.glyph, width: resolved.width, text: String.fromCodePoint(scalar) };
|
|
7263
7272
|
this.mappings.set(scalar, mapping);
|
|
7264
7273
|
return mapping.width;
|
|
7265
7274
|
}
|
|
@@ -7272,8 +7281,20 @@ class PdfFontResource {
|
|
|
7272
7281
|
let hex = "";
|
|
7273
7282
|
for (const char of text) {
|
|
7274
7283
|
const cp = char.codePointAt(0);
|
|
7275
|
-
this.
|
|
7276
|
-
|
|
7284
|
+
if (this.program) {
|
|
7285
|
+
let mapping = this.mappings.get(cp);
|
|
7286
|
+
// Layout normally registered the scalar already; validate only a newly painted scalar.
|
|
7287
|
+
if (!mapping) {
|
|
7288
|
+
this.width(cp);
|
|
7289
|
+
mapping = this.mappings.get(cp);
|
|
7290
|
+
}
|
|
7291
|
+
hex += mapping.hex;
|
|
7292
|
+
}
|
|
7293
|
+
else {
|
|
7294
|
+
if (!this.standardWidths.has(cp))
|
|
7295
|
+
this.width(cp);
|
|
7296
|
+
hex += hexBytes[standardCode(cp)];
|
|
7297
|
+
}
|
|
7277
7298
|
}
|
|
7278
7299
|
return "<" + hex + ">";
|
|
7279
7300
|
}
|
|
@@ -7288,10 +7309,11 @@ class PdfFontResource {
|
|
|
7288
7309
|
if (!mapping) {
|
|
7289
7310
|
if (this.mappings.size >= 65535)
|
|
7290
7311
|
throw new OfficeIMOError("RESOURCE_LIMIT", "A PDF font supports at most 65,535 distinct CID mappings.");
|
|
7291
|
-
|
|
7312
|
+
const cid = this.mappings.size + 1;
|
|
7313
|
+
mapping = { cid, hex: cidHex(cid), glyph, width: this.program.widths[glyph], text };
|
|
7292
7314
|
this.mappings.set(key, mapping);
|
|
7293
7315
|
}
|
|
7294
|
-
return "<" + mapping.
|
|
7316
|
+
return "<" + mapping.hex + ">";
|
|
7295
7317
|
}
|
|
7296
7318
|
async write(objects, compression) {
|
|
7297
7319
|
checkAbort(this.signal);
|
|
@@ -7340,7 +7362,7 @@ class PdfFontResource {
|
|
|
7340
7362
|
const batch = mapped.slice(i, i + 100);
|
|
7341
7363
|
cmap += batch.length + " beginbfchar\n";
|
|
7342
7364
|
for (const [, m] of batch)
|
|
7343
|
-
cmap += "<" + m.
|
|
7365
|
+
cmap += "<" + m.hex + "> <" + unicodeHex(m.text) + ">\n";
|
|
7344
7366
|
cmap += "endbfchar\n";
|
|
7345
7367
|
if (taskYieldDue())
|
|
7346
7368
|
await pause();
|
|
@@ -7391,7 +7413,7 @@ class PdfFontResources {
|
|
|
7391
7413
|
if (!found)
|
|
7392
7414
|
this.explicitSelections.set(explicit, selections);
|
|
7393
7415
|
}
|
|
7394
|
-
const key =
|
|
7416
|
+
const key = (bold ? 2 : 0) | (italic ? 1 : 0), existing = selections.get(key);
|
|
7395
7417
|
if (existing)
|
|
7396
7418
|
return existing;
|
|
7397
7419
|
const { font, syntheticBold, syntheticItalic } = explicit ? { font: explicit, syntheticBold: bold, syntheticItalic: italic } : selectFont(this.fonts, bold, italic);
|
|
@@ -7408,7 +7430,7 @@ class PdfFontResources {
|
|
|
7408
7430
|
dictionary() { return "<< " + this.resources.map(f => "/" + f.name + " " + f.object + " 0 R").join(" ") + " >>"; }
|
|
7409
7431
|
}
|
|
7410
7432
|
const _exports = Object.freeze({ PdfFontResource: PdfFontResource, PdfFontResources: PdfFontResources });
|
|
7411
|
-
_modules.set("
|
|
7433
|
+
_modules.set("4d4736e6b8e2aaecc6f6c1b124b7e6bc0a5e141dcc725edf0ad4847d87fca1b3", _exports);
|
|
7412
7434
|
return _exports;
|
|
7413
7435
|
})();
|
|
7414
7436
|
|
|
@@ -7933,7 +7955,7 @@ _modules.set("0a1c79b51ac9a164b86197239117df6497f45ca2892b423b1ec77a663ccc1c47",
|
|
|
7933
7955
|
return _exports;
|
|
7934
7956
|
})();
|
|
7935
7957
|
|
|
7936
|
-
const _m72 = _modules.get("
|
|
7958
|
+
const _m72 = _modules.get("2f40af05ba09102fe440c1d46385b64cecdd233371771796c9ae4e8d523f2cea") ?? (() => {
|
|
7937
7959
|
const { OfficeIMOError } = _m2;
|
|
7938
7960
|
|
|
7939
7961
|
const { wrapPdfText } = _m70;
|
|
@@ -7981,6 +8003,14 @@ async function projectBandRows(rows, band, widths, settings, fonts) {
|
|
|
7981
8003
|
for (const row of rows) {
|
|
7982
8004
|
const cells = [];
|
|
7983
8005
|
for (const cell of row.cells) {
|
|
8006
|
+
// Ordinary data and leaf headings keep their captured width and lines in every band.
|
|
8007
|
+
// Look up their physical position without allocating another per-row column index.
|
|
8008
|
+
if (cell.span === 1) {
|
|
8009
|
+
const first = band.columns.indexOf(cell.first);
|
|
8010
|
+
if (first >= 0)
|
|
8011
|
+
cells.push({ ...cell, source: cell.source ?? cell, first });
|
|
8012
|
+
continue;
|
|
8013
|
+
}
|
|
7984
8014
|
for (let first = 0; first < band.columns.length;) {
|
|
7985
8015
|
const source = band.columns[first];
|
|
7986
8016
|
if (source < cell.first || source >= cell.first + cell.span) {
|
|
@@ -7991,7 +8021,7 @@ async function projectBandRows(rows, band, widths, settings, fonts) {
|
|
|
7991
8021
|
while (end < band.columns.length && band.columns[end] === band.columns[end - 1] + 1 && band.columns[end] < cell.first + cell.span)
|
|
7992
8022
|
end++;
|
|
7993
8023
|
const width = band.columns.slice(first, end).reduce((sum, index) => sum + widths[index], 0);
|
|
7994
|
-
const lines =
|
|
8024
|
+
const lines = await wrapPdfText(cell.captured, fonts, settings.fontSize, width - settings.padding * 2, settings, cell.style.wrapText !== false);
|
|
7995
8025
|
cells.push({ ...cell, source: cell.source ?? cell, first, span: end - first, width, lines,
|
|
7996
8026
|
lineHeight: lines.reduce((height, line) => Math.max(height, line.lineHeight), cell.font.lineHeight(settings.fontSize)) });
|
|
7997
8027
|
first = end;
|
|
@@ -8020,11 +8050,11 @@ function alignBandBlocks(bands, settings) {
|
|
|
8020
8050
|
cells: row.cells.map(cell => ({ ...cell, height: heights.slice(index, index + (cell.rowSpan ?? 1)).reduce((sum, value) => sum + value, 0) })) })));
|
|
8021
8051
|
}
|
|
8022
8052
|
const _exports = Object.freeze({ planTableBands: planTableBands, projectBandRows: projectBandRows, alignBandBlocks: alignBandBlocks });
|
|
8023
|
-
_modules.set("
|
|
8053
|
+
_modules.set("2f40af05ba09102fe440c1d46385b64cecdd233371771796c9ae4e8d523f2cea", _exports);
|
|
8024
8054
|
return _exports;
|
|
8025
8055
|
})();
|
|
8026
8056
|
|
|
8027
|
-
const _m68 = _modules.get("
|
|
8057
|
+
const _m68 = _modules.get("ad81357e627d3100e1068a8ce521aa1c1cd65de5c6c6ab36f807a3e5da50d874") ?? (() => {
|
|
8028
8058
|
const { ExportCell } = _m5;
|
|
8029
8059
|
|
|
8030
8060
|
const { copyExportLink } = _m7;
|
|
@@ -8144,8 +8174,12 @@ class PdfTableLayout {
|
|
|
8144
8174
|
lines };
|
|
8145
8175
|
}
|
|
8146
8176
|
row(cells) {
|
|
8147
|
-
|
|
8148
|
-
|
|
8177
|
+
let lines = 1, lineHeight = this.lineHeight;
|
|
8178
|
+
for (let index = 0; index < cells.length; index++) {
|
|
8179
|
+
const cell = cells[index];
|
|
8180
|
+
lines = Math.max(lines, cell.lines.length);
|
|
8181
|
+
lineHeight = Math.max(lineHeight, cell.lineHeight);
|
|
8182
|
+
}
|
|
8149
8183
|
return { cells, lines, lineHeight, height: lines * lineHeight + this.settings.padding * 2 };
|
|
8150
8184
|
}
|
|
8151
8185
|
async headers() {
|
|
@@ -8251,11 +8285,11 @@ class PdfTableLayout {
|
|
|
8251
8285
|
}
|
|
8252
8286
|
}
|
|
8253
8287
|
const _exports = Object.freeze({ PdfTableLayout: PdfTableLayout });
|
|
8254
|
-
_modules.set("
|
|
8288
|
+
_modules.set("ad81357e627d3100e1068a8ce521aa1c1cd65de5c6c6ab36f807a3e5da50d874", _exports);
|
|
8255
8289
|
return _exports;
|
|
8256
8290
|
})();
|
|
8257
8291
|
|
|
8258
|
-
const _m74 = _modules.get("
|
|
8292
|
+
const _m74 = _modules.get("9ea74d93c18250e809a7be745444b886bcd5ec924a78e6ab004d649789db1f72") ?? (() => {
|
|
8259
8293
|
const { OfficeIMOError } = _m2;
|
|
8260
8294
|
|
|
8261
8295
|
const { checkAbort } = _m4;
|
|
@@ -8299,7 +8333,7 @@ class PdfTableBandFlow {
|
|
|
8299
8333
|
await this.flush();
|
|
8300
8334
|
}
|
|
8301
8335
|
async row(row, allowFirstFragment = false) {
|
|
8302
|
-
const { padding, fontSize, options } = this.layout.settings, minimumLines = this.layout.minimumRowLines(row), minimumHeight =
|
|
8336
|
+
const { padding, fontSize, options } = this.layout.settings, minimumLines = this.layout.minimumRowLines(row), minimumHeight = minimumLines * row.lineHeight + padding * 2;
|
|
8303
8337
|
if (minimumHeight > this.painter.firstFullCapacity + .001 || minimumHeight > this.painter.continuationCapacity + .001)
|
|
8304
8338
|
throw new RangeError("Repeated PDF identifiers must fit intact below the first and continued band headings/context.");
|
|
8305
8339
|
// Keep ordinary rows intact when they fit fresh. A kept heading/caption can deliberately
|
|
@@ -8333,9 +8367,14 @@ class PdfTableBandFlow {
|
|
|
8333
8367
|
let remaining = false;
|
|
8334
8368
|
const cells = rows[0].cells.map(cell => {
|
|
8335
8369
|
const source = this.layout.bands[index].columns[cell.first];
|
|
8336
|
-
const repeated = this.layout.repeatedColumn(source),
|
|
8370
|
+
const repeated = this.layout.repeatedColumn(source), reusable = cell.span === 1 && (cell.source?.span ?? 1) === 1 && (cell.rowSpan ?? 1) === 1 &&
|
|
8371
|
+
cell.height === undefined && first === 0 && (repeated || lines >= cell.lines.length);
|
|
8372
|
+
const visible = repeated || reusable ? cell.lines : cell.lines.slice(first, first + lines);
|
|
8337
8373
|
if (!repeated && (visible.length > 0 || cell.link !== undefined))
|
|
8338
8374
|
remaining = true;
|
|
8375
|
+
// A complete first fragment already owns these lines and their maximum font metrics.
|
|
8376
|
+
if (reusable)
|
|
8377
|
+
return cell;
|
|
8339
8378
|
const { height: _height, ...plain } = cell;
|
|
8340
8379
|
return { ...plain, lines: visible,
|
|
8341
8380
|
lineHeight: visible.reduce((value, line) => Math.max(value, line.lineHeight), cell.font.lineHeight(fontSize)),
|
|
@@ -8388,11 +8427,11 @@ class PdfTableBandFlow {
|
|
|
8388
8427
|
}
|
|
8389
8428
|
}
|
|
8390
8429
|
const _exports = Object.freeze({ PdfTableBandFlow: PdfTableBandFlow });
|
|
8391
|
-
_modules.set("
|
|
8430
|
+
_modules.set("9ea74d93c18250e809a7be745444b886bcd5ec924a78e6ab004d649789db1f72", _exports);
|
|
8392
8431
|
return _exports;
|
|
8393
8432
|
})();
|
|
8394
8433
|
|
|
8395
|
-
const _m75 = _modules.get("
|
|
8434
|
+
const _m75 = _modules.get("9deed79565a5da5009f7a01579df8d6a3f019b78eb7b17d831c7964840e9a6bf") ?? (() => {
|
|
8396
8435
|
/** @internal Source-cell identities survive page fragments and horizontal band projections.
|
|
8397
8436
|
* Only column headers and still-owned row objects remain reachable from this table owner. */
|
|
8398
8437
|
class PdfTableStructure {
|
|
@@ -8444,30 +8483,31 @@ class PdfTableStructure {
|
|
|
8444
8483
|
return row.cells.map(cell => this.cells.get(cell));
|
|
8445
8484
|
const rowId = this.structure.element("TR", parent);
|
|
8446
8485
|
this.rows.set(row, rowId);
|
|
8447
|
-
const headers = row.cells.map((cell, index) => rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex);
|
|
8448
8486
|
// Allocate in source order, then resolve every row header before associating even earlier data cells.
|
|
8449
8487
|
// Generated summary labels override detail roles so numeric subtotal cells never become row headers.
|
|
8450
8488
|
const ids = row.cells.map((cell, index) => {
|
|
8451
|
-
const
|
|
8489
|
+
const header = rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex;
|
|
8490
|
+
const id = this.structure.element(header ? "TH" : "TD", rowId);
|
|
8452
8491
|
this.cells.set(cell, id);
|
|
8453
8492
|
return id;
|
|
8454
8493
|
});
|
|
8455
|
-
|
|
8494
|
+
let rowHeaders;
|
|
8456
8495
|
for (let index = 0; index < ids.length; index++)
|
|
8457
|
-
if (
|
|
8458
|
-
rowHeaders.push(await this.structure.identifier(ids[index]));
|
|
8496
|
+
if (rowHeaderIndex === undefined ? row.cells[index].rowHeader === true : index === rowHeaderIndex)
|
|
8497
|
+
(rowHeaders ??= []).push(await this.structure.identifier(ids[index]));
|
|
8459
8498
|
for (let index = 0; index < row.cells.length; index++) {
|
|
8460
8499
|
const cell = row.cells[index];
|
|
8461
|
-
if (!rowHeaders
|
|
8500
|
+
if (!rowHeaders && cell.span === 1 && (cell.rowSpan ?? 1) === 1) {
|
|
8462
8501
|
const attributes = this.ordinaryAttributes[cell.first] ??=
|
|
8463
8502
|
await this.structure.attributeReference(this.attributeDictionary(cell, this.associations(cell)));
|
|
8464
8503
|
this.structure.setAttributes(ids[index], attributes);
|
|
8465
8504
|
continue;
|
|
8466
8505
|
}
|
|
8467
8506
|
const associations = this.associations(cell);
|
|
8468
|
-
|
|
8507
|
+
const header = rowHeaderIndex === undefined ? cell.rowHeader === true : index === rowHeaderIndex;
|
|
8508
|
+
if (!header && rowHeaders)
|
|
8469
8509
|
associations.push(...rowHeaders);
|
|
8470
|
-
this.structure.setAttributes(ids[index], this.attributes(cell, associations,
|
|
8510
|
+
this.structure.setAttributes(ids[index], this.attributes(cell, associations, header ? "Row" : undefined));
|
|
8471
8511
|
}
|
|
8472
8512
|
return ids;
|
|
8473
8513
|
}
|
|
@@ -8502,7 +8542,7 @@ class PdfTableStructure {
|
|
|
8502
8542
|
}
|
|
8503
8543
|
}
|
|
8504
8544
|
const _exports = Object.freeze({ PdfTableStructure: PdfTableStructure });
|
|
8505
|
-
_modules.set("
|
|
8545
|
+
_modules.set("9deed79565a5da5009f7a01579df8d6a3f019b78eb7b17d831c7964840e9a6bf", _exports);
|
|
8506
8546
|
return _exports;
|
|
8507
8547
|
})();
|
|
8508
8548
|
|
|
@@ -8620,7 +8660,7 @@ _modules.set("a66257a32f03d958aa57be4de9da7f80b708cebca26b5cc6404de0ee11bfe052",
|
|
|
8620
8660
|
return _exports;
|
|
8621
8661
|
})();
|
|
8622
8662
|
|
|
8623
|
-
const _m73 = _modules.get("
|
|
8663
|
+
const _m73 = _modules.get("3ed7114181be5a3066742336da574fef7f2fc04ee6dfc5e64211f3bedad4cab9") ?? (() => {
|
|
8624
8664
|
const { OfficeIMOError } = _m2;
|
|
8625
8665
|
|
|
8626
8666
|
const { checkAbort } = _m4;
|
|
@@ -8655,7 +8695,8 @@ class PdfPages {
|
|
|
8655
8695
|
outlines;
|
|
8656
8696
|
references = [];
|
|
8657
8697
|
current = 0;
|
|
8658
|
-
commands =
|
|
8698
|
+
commands = "";
|
|
8699
|
+
commandParts = [];
|
|
8659
8700
|
commandBytes = 0;
|
|
8660
8701
|
annotations = [];
|
|
8661
8702
|
hyperlinks = 0;
|
|
@@ -8673,6 +8714,12 @@ class PdfPages {
|
|
|
8673
8714
|
pendingBookmarks = [];
|
|
8674
8715
|
pageNumberWidth = 0;
|
|
8675
8716
|
colors = new Map();
|
|
8717
|
+
textFont;
|
|
8718
|
+
textSize = 0;
|
|
8719
|
+
textColor = "";
|
|
8720
|
+
textPrefix = "";
|
|
8721
|
+
rectangleLefts;
|
|
8722
|
+
rectangleColumns = [];
|
|
8676
8723
|
externalObjects = new Map();
|
|
8677
8724
|
bandFlow;
|
|
8678
8725
|
bandCellBudget = false;
|
|
@@ -8739,7 +8786,7 @@ class PdfPages {
|
|
|
8739
8786
|
}
|
|
8740
8787
|
add(command) {
|
|
8741
8788
|
this.retainPageBytes(command.length);
|
|
8742
|
-
this.commands
|
|
8789
|
+
this.commands += command;
|
|
8743
8790
|
}
|
|
8744
8791
|
retainPageBytes(length) {
|
|
8745
8792
|
this.commandBytes += length;
|
|
@@ -8759,9 +8806,17 @@ class PdfPages {
|
|
|
8759
8806
|
return this.structure ? "/Artifact << /Type /" + type + " >> BDC\n" + command + "EMC\n" : command;
|
|
8760
8807
|
}
|
|
8761
8808
|
text(text, font, size, x, baseline, foreground = "111827", element) {
|
|
8762
|
-
const n = pdfNumber
|
|
8763
|
-
|
|
8764
|
-
|
|
8809
|
+
const n = pdfNumber;
|
|
8810
|
+
if (font !== this.textFont || size !== this.textSize || foreground !== this.textColor) {
|
|
8811
|
+
const shear = font.syntheticItalic ? .213 : 0, rgb = this.rgb(foreground);
|
|
8812
|
+
// Keep one prefix, independent of report size. Resource identity includes synthetic styling.
|
|
8813
|
+
this.textPrefix = "q " + rgb + " rg " + rgb + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
|
|
8814
|
+
(font.syntheticBold ? n(size * .025) + " w 2 Tr " : "0 Tr ") + "1 0 " + n(shear) + " 1 ";
|
|
8815
|
+
this.textFont = font;
|
|
8816
|
+
this.textSize = size;
|
|
8817
|
+
this.textColor = foreground;
|
|
8818
|
+
}
|
|
8819
|
+
const command = this.textPrefix + n(x) + " " + n(baseline) + " Tm " + font.encode(text) + " Tj ET Q\n";
|
|
8765
8820
|
this.add(this.structure && element !== undefined ? this.structure.mark(element) + command + "EMC\n" : this.artifact(command, "Pagination"));
|
|
8766
8821
|
}
|
|
8767
8822
|
link(link, x, bottom, width, height, element) {
|
|
@@ -8791,8 +8846,8 @@ class PdfPages {
|
|
|
8791
8846
|
for (const segment of line.segments) {
|
|
8792
8847
|
const registered = marks?.get(segment), owner = registered?.owner ?? (segment.link && this.structure && element !== undefined ? this.structure.link(element, segment.link) : element);
|
|
8793
8848
|
if (segment.glyphs) {
|
|
8794
|
-
const font = segment.font, n = pdfNumber, shear = font.syntheticItalic ? .213 : 0;
|
|
8795
|
-
let cursor = x, command = "q " +
|
|
8849
|
+
const font = segment.font, n = pdfNumber, shear = font.syntheticItalic ? .213 : 0, rgb = this.rgb(segment.color ?? "111827");
|
|
8850
|
+
let cursor = x, command = "q " + rgb + " rg " + rgb + " RG\nBT /" + font.name + " " + n(size) + " Tf " +
|
|
8796
8851
|
(font.syntheticBold ? n(size * .025) + " w 2 Tr " : "0 Tr ");
|
|
8797
8852
|
for (const glyph of segment.glyphs) {
|
|
8798
8853
|
command += "1 0 " + n(shear) + " 1 " + n(cursor + (glyph.xOffset + shear * glyph.yOffset) * size / 1000) + " " + n(baseline + glyph.yOffset * size / 1000) + " Tm " + font.encodeGlyph(glyph.id, glyph.logicalText) + " Tj\n";
|
|
@@ -8840,7 +8895,8 @@ class PdfPages {
|
|
|
8840
8895
|
this.current = this.objects.reserve();
|
|
8841
8896
|
this.references.push(this.current);
|
|
8842
8897
|
}
|
|
8843
|
-
this.commands =
|
|
8898
|
+
this.commands = "";
|
|
8899
|
+
this.commandParts = [];
|
|
8844
8900
|
this.annotations = [];
|
|
8845
8901
|
this.commandBytes = 0;
|
|
8846
8902
|
this.bodyAdded = false;
|
|
@@ -8923,15 +8979,32 @@ class PdfPages {
|
|
|
8923
8979
|
if (!this.layout)
|
|
8924
8980
|
throw new Error("A table layout is required before drawing rows.");
|
|
8925
8981
|
this.bodyAdded = true;
|
|
8926
|
-
const { padding, fontSize } = this.settings, n = pdfNumber, height = lineCount * row.lineHeight + padding * 2;
|
|
8982
|
+
const { padding, fontSize } = this.settings, n = pdfNumber, height = lineCount * row.lineHeight + padding * 2, lefts = this.layout.lefts;
|
|
8983
|
+
// One geometry token per active physical column; table/band changes release the old tokens.
|
|
8984
|
+
if (this.rectangleLefts !== lefts) {
|
|
8985
|
+
this.rectangleLefts = lefts;
|
|
8986
|
+
this.rectangleColumns = [];
|
|
8987
|
+
}
|
|
8988
|
+
let rectangleHeight, rectangleBottom = "", rectangleHeightText = "";
|
|
8927
8989
|
for (const [index, cell] of row.cells.entries()) {
|
|
8928
8990
|
if (this.bandCellBudget)
|
|
8929
8991
|
this.settings.budget.cell(this.settings.budget.limits.maxTextCharacters === undefined ? "" :
|
|
8930
8992
|
(cell.height === undefined ? cell.lines.slice(firstLine, firstLine + lineCount) : cell.lines).map(line => line.text).join(""));
|
|
8931
|
-
const x =
|
|
8993
|
+
const x = lefts[cell.first], cellHeight = cell.height ?? height;
|
|
8994
|
+
if (cellHeight !== rectangleHeight) {
|
|
8995
|
+
rectangleBottom = n(this.y - cellHeight);
|
|
8996
|
+
rectangleHeightText = n(cellHeight);
|
|
8997
|
+
rectangleHeight = cellHeight;
|
|
8998
|
+
}
|
|
8999
|
+
let horizontal = this.rectangleColumns[cell.first];
|
|
9000
|
+
if (!horizontal || horizontal.x !== x || horizontal.width !== cell.width) {
|
|
9001
|
+
horizontal = { x, width: cell.width, left: n(x), widthText: n(cell.width) };
|
|
9002
|
+
this.rectangleColumns[cell.first] = horizontal;
|
|
9003
|
+
}
|
|
9004
|
+
const rectangle = horizontal.left + " " + rectangleBottom + " " + horizontal.widthText + " " + rectangleHeightText;
|
|
8932
9005
|
if (cell.style.background)
|
|
8933
|
-
this.add(this.artifact("q " + this.rgb(cell.style.background) + " rg " +
|
|
8934
|
-
this.add(this.artifact("q 0.82 0.85 0.89 RG 0.4 w " +
|
|
9006
|
+
this.add(this.artifact("q " + this.rgb(cell.style.background) + " rg " + rectangle + " re f Q\n"));
|
|
9007
|
+
this.add(this.artifact("q 0.82 0.85 0.89 RG 0.4 w " + rectangle + " re S Q\n"));
|
|
8935
9008
|
const element = elements?.[index], artifact = cell.semanticArtifact || repeated[index], owner = cell.link && this.structure && element !== undefined ? this.structure.link(element, cell.link) : element;
|
|
8936
9009
|
for (let line = firstLine; line < Math.min(cell.lines.length, cell.height ? cell.lines.length : firstLine + lineCount); line++) {
|
|
8937
9010
|
const text = cell.lines[line], left = cell.style.alignment === "right" ? cell.width - padding - text.width : cell.style.alignment === "center" ? (cell.width - text.width) / 2 : padding;
|
|
@@ -8941,6 +9014,7 @@ class PdfPages {
|
|
|
8941
9014
|
this.link(cell.link, x, this.y - cellHeight, cell.width, cellHeight, owner);
|
|
8942
9015
|
}
|
|
8943
9016
|
this.y -= row.structured ? row.height : height;
|
|
9017
|
+
this.sealCommands();
|
|
8944
9018
|
}
|
|
8945
9019
|
async block(rows) {
|
|
8946
9020
|
if (this.bandFlow)
|
|
@@ -9266,9 +9340,22 @@ class PdfPages {
|
|
|
9266
9340
|
marker: { line: item.marker, gap: item.markerGap, ...(label === undefined ? {} : { owner: label }) } });
|
|
9267
9341
|
await this.structure?.complete(li);
|
|
9268
9342
|
}
|
|
9343
|
+
sealCommands() {
|
|
9344
|
+
if (this.commands) {
|
|
9345
|
+
this.commandParts.push(this.commands);
|
|
9346
|
+
this.commands = "";
|
|
9347
|
+
}
|
|
9348
|
+
}
|
|
9349
|
+
takeCommands() {
|
|
9350
|
+
this.sealCommands();
|
|
9351
|
+
const content = this.commandParts.join("");
|
|
9352
|
+
// Encoding and awaited delivery own the page value; the next page starts independently.
|
|
9353
|
+
this.commandParts = [];
|
|
9354
|
+
return content;
|
|
9355
|
+
}
|
|
9269
9356
|
async finishPage() {
|
|
9270
9357
|
const contents = this.objects.reserve(), { page, options } = this.settings;
|
|
9271
|
-
await this.objects.stream(contents, this.
|
|
9358
|
+
await this.objects.stream(contents, this.takeCommands(), "", options.compression !== false);
|
|
9272
9359
|
const annotations = [];
|
|
9273
9360
|
for (const annotation of this.annotations) {
|
|
9274
9361
|
annotations.push(annotation.id);
|
|
@@ -9280,7 +9367,6 @@ class PdfPages {
|
|
|
9280
9367
|
(annotations.length ? " /Annots [" + annotations.map(id => id + " 0 R").join(" ") + "]" : "") + " >>");
|
|
9281
9368
|
if (this.structure)
|
|
9282
9369
|
await this.structure.finishPage();
|
|
9283
|
-
this.commands = [];
|
|
9284
9370
|
this.annotations = [];
|
|
9285
9371
|
this.commandBytes = 0;
|
|
9286
9372
|
this.current = 0;
|
|
@@ -9312,7 +9398,7 @@ class PdfPages {
|
|
|
9312
9398
|
}
|
|
9313
9399
|
}
|
|
9314
9400
|
const _exports = Object.freeze({ PdfPages: PdfPages });
|
|
9315
|
-
_modules.set("
|
|
9401
|
+
_modules.set("3ed7114181be5a3066742336da574fef7f2fc04ee6dfc5e64211f3bedad4cab9", _exports);
|
|
9316
9402
|
return _exports;
|
|
9317
9403
|
})();
|
|
9318
9404
|
|
|
@@ -9755,7 +9841,7 @@ _modules.set("52c78ca6833cee7e5a96b657e2c00172d550176daf2c95e742692f8416977bea",
|
|
|
9755
9841
|
return _exports;
|
|
9756
9842
|
})();
|
|
9757
9843
|
|
|
9758
|
-
const _m58 = _modules.get("
|
|
9844
|
+
const _m58 = _modules.get("afdad27eb363e8de0c3bd69ebf358860eb76f5c6fb29f43a87635807cb7fc273") ?? (() => {
|
|
9759
9845
|
const { PdfObjects, unicodeHex } = _m59;
|
|
9760
9846
|
|
|
9761
9847
|
const { PdfFontResources } = _m61;
|
|
@@ -9818,11 +9904,11 @@ class PdfWriteSession {
|
|
|
9818
9904
|
}
|
|
9819
9905
|
}
|
|
9820
9906
|
const _exports = Object.freeze({ PdfWriteSession: PdfWriteSession });
|
|
9821
|
-
_modules.set("
|
|
9907
|
+
_modules.set("afdad27eb363e8de0c3bd69ebf358860eb76f5c6fb29f43a87635807cb7fc273", _exports);
|
|
9822
9908
|
return _exports;
|
|
9823
9909
|
})();
|
|
9824
9910
|
|
|
9825
|
-
const _m54 = _modules.get("
|
|
9911
|
+
const _m54 = _modules.get("45cf9fd6b6293c1a83bc8554e1bcb5cf119f44701fbad7849f39a712cab5074b") ?? (() => {
|
|
9826
9912
|
const { BlobByteSink, withDestination } = _m3;
|
|
9827
9913
|
|
|
9828
9914
|
const { beginTask, checkAbort, consumeRows, pause, taskYieldDue } = _m4;
|
|
@@ -9887,7 +9973,7 @@ async function writePdfTo(rows, destination, configuration) {
|
|
|
9887
9973
|
});
|
|
9888
9974
|
}
|
|
9889
9975
|
const _exports = Object.freeze({ writePdf: writePdf, writePdfTo: writePdfTo });
|
|
9890
|
-
_modules.set("
|
|
9976
|
+
_modules.set("45cf9fd6b6293c1a83bc8554e1bcb5cf119f44701fbad7849f39a712cab5074b", _exports);
|
|
9891
9977
|
return _exports;
|
|
9892
9978
|
})();
|
|
9893
9979
|
|
|
@@ -10819,7 +10905,7 @@ _modules.set("d04686d2c067355dfd215333b83eb5f79f96e9e4be49f942e050f21ac0795343",
|
|
|
10819
10905
|
return _exports;
|
|
10820
10906
|
})();
|
|
10821
10907
|
|
|
10822
|
-
const _m90 = _modules.get("
|
|
10908
|
+
const _m90 = _modules.get("289fa3a052c7fbab2a3ca0fb91fb9974db709d24b7d850f1175810258f0409a0") ?? (() => {
|
|
10823
10909
|
const { assertGroupedReportSource, groupedReportOperation } = _m8;
|
|
10824
10910
|
|
|
10825
10911
|
const { consumeRows } = _m4;
|
|
@@ -11073,11 +11159,11 @@ async function renderGroupedPdfTable(block, context) {
|
|
|
11073
11159
|
}
|
|
11074
11160
|
}
|
|
11075
11161
|
const _exports = Object.freeze({ renderGroupedPdfTable: renderGroupedPdfTable });
|
|
11076
|
-
_modules.set("
|
|
11162
|
+
_modules.set("289fa3a052c7fbab2a3ca0fb91fb9974db709d24b7d850f1175810258f0409a0", _exports);
|
|
11077
11163
|
return _exports;
|
|
11078
11164
|
})();
|
|
11079
11165
|
|
|
11080
|
-
const _m83 = _modules.get("
|
|
11166
|
+
const _m83 = _modules.get("9051bf9fc3168e24b53b16c123a42816198456846003fb49191c03a18cdab904") ?? (() => {
|
|
11081
11167
|
const { BlobByteSink, withDestination } = _m3;
|
|
11082
11168
|
|
|
11083
11169
|
const { OfficeIMOError } = _m2;
|
|
@@ -11367,11 +11453,11 @@ function captureTableOptions(options) {
|
|
|
11367
11453
|
return { ...captured, ...(captured.wideTable === undefined ? {} : { wideTable: captureWideTable(captured.wideTable) }) };
|
|
11368
11454
|
}
|
|
11369
11455
|
const _exports = Object.freeze({ pdfTable: pdfTable, writePdfDocument: writePdfDocument, writePdfDocumentTo: writePdfDocumentTo });
|
|
11370
|
-
_modules.set("
|
|
11456
|
+
_modules.set("9051bf9fc3168e24b53b16c123a42816198456846003fb49191c03a18cdab904", _exports);
|
|
11371
11457
|
return _exports;
|
|
11372
11458
|
})();
|
|
11373
11459
|
|
|
11374
|
-
const _m82 = _modules.get("
|
|
11460
|
+
const _m82 = _modules.get("abe76e52ffeed11ab42477c83ddde1d1d7de28b803096436b5b23cb153af58ba") ?? (() => {
|
|
11375
11461
|
const { assertGroupedReportSource } = _m8;
|
|
11376
11462
|
|
|
11377
11463
|
const { BlobByteSink } = _m3;
|
|
@@ -11417,7 +11503,7 @@ async function writeGroupedPdfTo(report, destination, configuration) {
|
|
|
11417
11503
|
return writePdfDocumentTo([pdfGroupedTable(report, tableOptions)], destination, documentOptions);
|
|
11418
11504
|
}
|
|
11419
11505
|
const _exports = Object.freeze({ pdfGroupedTable: _m91.pdfGroupedTable, writeGroupedPdf: writeGroupedPdf, writeGroupedPdfTo: writeGroupedPdfTo });
|
|
11420
|
-
_modules.set("
|
|
11506
|
+
_modules.set("abe76e52ffeed11ab42477c83ddde1d1d7de28b803096436b5b23cb153af58ba", _exports);
|
|
11421
11507
|
return _exports;
|
|
11422
11508
|
})();
|
|
11423
11509
|
|
|
@@ -11461,10 +11547,10 @@ _modules.set("3d777096288d1be55a05a80bc015d4674212e587703f25a7e7cf99a8065feb86",
|
|
|
11461
11547
|
return _exports;
|
|
11462
11548
|
})();
|
|
11463
11549
|
|
|
11464
|
-
const _m53 = _modules.get("
|
|
11550
|
+
const _m53 = _modules.get("027aafa08408056b10d7d717d63d1f7c0ee20ecfc68213aa66feacc75ec525fe") ?? (() => {
|
|
11465
11551
|
|
|
11466
11552
|
const _exports = Object.freeze({ writePdf: _m54.writePdf, writePdfTo: _m54.writePdfTo, writeGroupedPdf: _m82.writeGroupedPdf, writeGroupedPdfTo: _m82.writeGroupedPdfTo, pdfGroupedTable: _m82.pdfGroupedTable, createGroupedReport: _m8.createGroupedReport, writePdfDocument: _m83.writePdfDocument, writePdfDocumentTo: _m83.writePdfDocumentTo, pdfTable: _m83.pdfTable, PdfFont: _m62.PdfFont, preflightPdfText: _m92.preflightPdfText, ExportCell: _m5.ExportCell, saveBlob: _m1.saveBlob });
|
|
11467
|
-
_modules.set("
|
|
11553
|
+
_modules.set("027aafa08408056b10d7d717d63d1f7c0ee20ecfc68213aa66feacc75ec525fe", _exports);
|
|
11468
11554
|
return _exports;
|
|
11469
11555
|
})();
|
|
11470
11556
|
|
|
@@ -11838,7 +11924,7 @@ _modules.set("58066519dce31ad3bb7f5f5c377585d3374a84578358ad519e2c021efa1a26f8",
|
|
|
11838
11924
|
return _exports;
|
|
11839
11925
|
})();
|
|
11840
11926
|
|
|
11841
|
-
const _m0 = _modules.get("
|
|
11927
|
+
const _m0 = _modules.get("febf70a0ae4804a10a5333e9d7f0cdd19a5362f9d4bdb21fc5ce101b0a3334d8") ?? (() => {
|
|
11842
11928
|
const { BlobByteSink, checkAbort, saveBlob } = _m1;
|
|
11843
11929
|
|
|
11844
11930
|
const { notifyProgress } = _m14;
|
|
@@ -12021,7 +12107,7 @@ function registerDataTablesButtons(host, options = {}) {
|
|
|
12021
12107
|
}
|
|
12022
12108
|
}
|
|
12023
12109
|
const _exports = Object.freeze({ createDataTablesExport: _m95.createDataTablesExport, ExportCell: _m5.ExportCell, PdfFont: _m62.PdfFont, writeDataTableTo: writeDataTableTo, exportDataTable: exportDataTable, registerDataTablesButtons: registerDataTablesButtons });
|
|
12024
|
-
_modules.set("
|
|
12110
|
+
_modules.set("febf70a0ae4804a10a5333e9d7f0cdd19a5362f9d4bdb21fc5ce101b0a3334d8", _exports);
|
|
12025
12111
|
return _exports;
|
|
12026
12112
|
})();
|
|
12027
12113
|
Object.assign(officeimo, _m0);
|