@agile-team/mach-report 2.15.0 → 2.16.0

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.
Files changed (155) hide show
  1. package/README.md +14 -9
  2. package/dist/{ExcelBindingWizard-Bs43BGNp.cjs → ExcelBindingWizard-CP6h2x1f.cjs} +1 -1
  3. package/dist/{ExcelBindingWizard-BKH1nGNS.js → ExcelBindingWizard-HhB3hAJE.js} +3 -3
  4. package/dist/{ParamEditor-Da4akw6V.cjs → ParamEditor-CUQLgoxa.cjs} +1 -1
  5. package/dist/{ParamEditor-DoAhzJsm.js → ParamEditor-OKesP_nO.js} +1 -1
  6. package/dist/{ReportBatchPanel-wP9m9Pj1.cjs → ReportBatchPanel-cZCAMAwH.cjs} +1 -1
  7. package/dist/{ReportBatchPanel-BMf6boMA.js → ReportBatchPanel-ruxcbfY6.js} +3 -3
  8. package/dist/ReportPreview-BcDKCLiK.js +4834 -0
  9. package/dist/ReportPreview-Bk9nLfO9.cjs +6 -0
  10. package/dist/{ReportTemplateLibrary-Sxr3eD0J.cjs → ReportTemplateLibrary-BDlNT8JN.cjs} +1 -1
  11. package/dist/{ReportTemplateLibrary-C9wutIiT.js → ReportTemplateLibrary-DcwrH-63.js} +1 -1
  12. package/dist/{RuleEditor-XhGHK8DE.cjs → RuleEditor-BX5S8RSF.cjs} +1 -1
  13. package/dist/{RuleEditor-C_Clasvd.js → RuleEditor-CGl9XY2s.js} +2 -2
  14. package/dist/{TemplateOutlinePanel-JTSR53vJ.cjs → TemplateOutlinePanel-CGrT5DFN.cjs} +1 -1
  15. package/dist/{TemplateOutlinePanel-D6Bkny59.js → TemplateOutlinePanel-SXCjaPKR.js} +1 -1
  16. package/dist/{TemplateReusePanel-Kx35S0Ql.cjs → TemplateReusePanel-6Z3wRFz8.cjs} +1 -1
  17. package/dist/{TemplateReusePanel-rVuK1kTz.js → TemplateReusePanel-lHLOS9Wn.js} +2 -2
  18. package/dist/{TemplateReviewPanel-B0ar9_zf.js → TemplateReviewPanel-CJ9PLc48.js} +1 -1
  19. package/dist/{TemplateReviewPanel-Dn6X9UmY.cjs → TemplateReviewPanel-Dpk7sLcF.cjs} +1 -1
  20. package/dist/analytics.d.cts +2 -0
  21. package/dist/analytics.d.ts +2 -0
  22. package/dist/artifact-integrity.json +99 -91
  23. package/dist/{assets-DEaz4qsp.js → assets-CqIbfbTr.js} +24 -22
  24. package/dist/assets-e4YSke8n.cjs +1 -0
  25. package/dist/auto-YR7a4BtF.js +240 -0
  26. package/dist/auto-uVBjX1j5.cjs +1 -0
  27. package/dist/{batch-BfZHN1do.js → batch-WzDIXJAt.js} +1 -1
  28. package/dist/{batch-CLpELXBl.cjs → batch-z6Aw5GEY.cjs} +1 -1
  29. package/dist/capabilities-DDwXr_cA.js +103 -0
  30. package/dist/capabilities-DNLyZdNw.cjs +1 -0
  31. package/dist/codes.d.cts +2 -0
  32. package/dist/codes.d.ts +2 -0
  33. package/dist/component-tree-Ca6YYfHq.js +61 -0
  34. package/dist/component-tree-DkGLEfZC.cjs +1 -0
  35. package/dist/config-Dg_o8e7m.cjs +1 -0
  36. package/dist/{config-BVsJXSqS.js → config-XQ4qrQ7Q.js} +66 -64
  37. package/dist/designer-BfQSahxq.js +5163 -0
  38. package/dist/designer-CPPdeM5_.cjs +2 -0
  39. package/dist/designer.cjs +1 -1
  40. package/dist/designer.d.cts +53 -0
  41. package/dist/designer.d.ts +53 -0
  42. package/dist/designer.js +1 -1
  43. package/dist/diagnostic-notification-B9K9We3h.cjs +1 -0
  44. package/dist/diagnostic-notification-qGAYZdkB.js +7 -0
  45. package/dist/drill-CsdjgkRM.cjs +1 -0
  46. package/dist/{drill-ByJviLXS.js → drill-DIGsZfyB.js} +11 -11
  47. package/dist/encoding-BOGq4qYL.js +21 -0
  48. package/dist/encoding-BYF9ZTl9.cjs +1 -0
  49. package/dist/{font-loader-Q3bQjmrI.js → font-loader-CzI1GuBc.js} +1 -1
  50. package/dist/{font-loader-B_UkxpzC.cjs → font-loader-EKLzOJxf.cjs} +1 -1
  51. package/dist/index.cjs +7 -8
  52. package/dist/index.d.cts +2 -0
  53. package/dist/index.d.ts +2 -0
  54. package/dist/index.js +865 -834
  55. package/dist/json-snapshot-D6ioHth9.js +1702 -0
  56. package/dist/json-snapshot-DknkjvxP.cjs +2 -0
  57. package/dist/{pdf-CvvrjPQg.cjs → pdf-ByVCb1i6.cjs} +48 -50
  58. package/dist/{pdf-BwNyeGpt.js → pdf-DJ5S6ukC.js} +2737 -2749
  59. package/dist/pdf.cjs +1 -1
  60. package/dist/pdf.d.cts +2 -0
  61. package/dist/pdf.d.ts +2 -0
  62. package/dist/pdf.js +2 -2
  63. package/dist/{plugin-Ca_XZG3l.js → plugin-C2j5_mhx.js} +1 -1
  64. package/dist/{plugin-DHO7X8z2.cjs → plugin-Dr39GBRG.cjs} +1 -1
  65. package/dist/prepared-DdrjLC7L.cjs +1 -0
  66. package/dist/prepared-DqtpvRTn.js +87 -0
  67. package/dist/progress-BXzlVbIp.js +29 -0
  68. package/dist/progress-DJBd9Rb9.cjs +1 -0
  69. package/dist/{progress-D-OTpEav.js → progress-Hc2vxoCs.js} +2 -2
  70. package/dist/protocol-BzwMP4Vw.cjs +1 -0
  71. package/dist/protocol-kt4Iy6-3.js +90 -0
  72. package/dist/{record-bindings-Do_b3h4V.js → record-bindings-CZWBJ1fU.js} +9 -10
  73. package/dist/record-bindings-DUX1VMlR.cjs +1 -0
  74. package/dist/{region-binding-workflow-BMhK_TjP.js → region-binding-workflow-CWNvIjkV.js} +1 -1
  75. package/dist/{region-binding-workflow-DIYJdCUr.cjs → region-binding-workflow-CqSMxQ4p.cjs} +1 -1
  76. package/dist/report-encoding-worker.cjs +1 -0
  77. package/dist/report-encoding-worker.d.ts +1 -0
  78. package/dist/report-encoding-worker.js +2 -0
  79. package/dist/rich-text-layout-ALlMoYOG.cjs +3 -0
  80. package/dist/rich-text-layout-Ct5WrY1g.js +102 -0
  81. package/dist/runtime-BjKBI530.js +168 -0
  82. package/dist/runtime-CBFEPKEs.cjs +1 -0
  83. package/dist/sbom.cdx.json +2 -2
  84. package/dist/server/node.d.cts +86 -1
  85. package/dist/server/node.d.ts +86 -1
  86. package/dist/server-node.cjs +5 -1
  87. package/dist/server-node.js +4558 -473
  88. package/dist/server.cjs +1 -1
  89. package/dist/server.d.cts +8 -1
  90. package/dist/server.d.ts +8 -1
  91. package/dist/server.js +634 -792
  92. package/dist/sha256-BshdOkCC.cjs +1 -0
  93. package/dist/sha256-DTG-Gq8i.js +157 -0
  94. package/dist/style-67OqfNed.js +73 -0
  95. package/dist/style-C22Pbv3T.cjs +1 -0
  96. package/dist/style.css +1 -1
  97. package/dist/{template-catalog-j2B1MJlL.js → template-catalog-BtR2JmCL.js} +9 -9
  98. package/dist/{template-catalog-FJE_c9Qe.cjs → template-catalog-C2NLdrwB.cjs} +1 -1
  99. package/dist/{template-fragments-DcKeiylI.cjs → template-fragments-BVsbxs4a.cjs} +1 -1
  100. package/dist/{template-fragments-BGbQLGlV.js → template-fragments-By0aZC1D.js} +2 -2
  101. package/dist/template-registry-C62vpv4a.cjs +1 -0
  102. package/dist/{template-registry-BtaKPELV.js → template-registry-Cw3vRTX2.js} +389 -321
  103. package/dist/{textwrap-DE1kgcJB.js → textwrap-BEIg2w8y.js} +1 -1
  104. package/dist/textwrap-BI-yJ6Wt.cjs +4 -0
  105. package/dist/vue/async.d.cts +66 -0
  106. package/dist/vue/async.d.ts +66 -0
  107. package/dist/vue/index.d.cts +89 -1
  108. package/dist/vue/index.d.ts +89 -1
  109. package/dist/vue-async.cjs +1 -1
  110. package/dist/vue-async.js +3 -3
  111. package/dist/vue.cjs +1 -1
  112. package/dist/vue.js +7 -7
  113. package/dist/{workbook-session-BvToI-Fd.js → workbook-session-BeSO8PFB.js} +153 -140
  114. package/dist/{workbook-session-Bjv1YCRK.cjs → workbook-session-Cbts-22R.cjs} +12 -12
  115. package/dist/worker.cjs +1 -1
  116. package/dist/worker.d.cts +84 -1
  117. package/dist/worker.d.ts +84 -1
  118. package/dist/worker.js +12 -157
  119. package/dist/xlsx-node.cjs +33 -33
  120. package/dist/xlsx-node.js +1282 -1289
  121. package/dist/xlsx.cjs +4 -3
  122. package/dist/xlsx.d.cts +2 -0
  123. package/dist/xlsx.d.ts +2 -0
  124. package/dist/xlsx.js +297 -279
  125. package/package.json +6 -3
  126. package/dist/ReportPreview-ChV19HBp.js +0 -4619
  127. package/dist/ReportPreview-DbLvvOUT.cjs +0 -6
  128. package/dist/assets-B9ImAi6_.cjs +0 -1
  129. package/dist/batch-BaP6pWDE.cjs +0 -1
  130. package/dist/batch-CGyt-b2W.js +0 -273
  131. package/dist/capabilities-CAh2Nrue.cjs +0 -1
  132. package/dist/capabilities-DskCHs3V.js +0 -69
  133. package/dist/config-D10us76d.cjs +0 -1
  134. package/dist/data-explanation-B8MZRYVS.js +0 -16
  135. package/dist/data-explanation-DE55G30w.cjs +0 -1
  136. package/dist/defaults-DXhiM1ZD.js +0 -10
  137. package/dist/defaults-xhmcLLrf.cjs +0 -1
  138. package/dist/designer-2bDlcNXQ.js +0 -5136
  139. package/dist/designer-BT7XCdbW.cjs +0 -2
  140. package/dist/drill-DYTxuL3A.cjs +0 -1
  141. package/dist/grid-strokes-Cr7DwUux.cjs +0 -1
  142. package/dist/grid-strokes-DyyG1q_o.js +0 -53
  143. package/dist/json-snapshot-DFb2eWkf.js +0 -1416
  144. package/dist/json-snapshot-WWSGlaHG.cjs +0 -2
  145. package/dist/prepared-CFy9B75C.cjs +0 -1
  146. package/dist/prepared-ajM-H-9B.js +0 -69
  147. package/dist/record-bindings-By_UKZ2g.cjs +0 -1
  148. package/dist/render-plan-7xpGrCEl.cjs +0 -1
  149. package/dist/render-plan-Ck6koX9L.js +0 -13
  150. package/dist/sha256-ArEYjaTI.cjs +0 -1
  151. package/dist/sha256-DPEuJ3nh.js +0 -155
  152. package/dist/style-CQ1PK8ZB.js +0 -67
  153. package/dist/style-UgIJSA1F.cjs +0 -1
  154. package/dist/template-registry-Co1zPq5e.cjs +0 -1
  155. package/dist/textwrap-CWHyzkBH.cjs +0 -4
@@ -0,0 +1,102 @@
1
+ import { e as z, d as P, f as w, r as B, b as C } from "./style-67OqfNed.js";
2
+ const R = ["borderTop", "borderRight", "borderBottom", "borderLeft", "borderColor", "lineColor", "lineWidthPt"];
3
+ function $(n, t) {
4
+ const e = z(t.style), s = e.inner ? [...n.edges] : [];
5
+ e.top && s.push({ kind: "h", pos: 0, from: 0, to: t.widthMm }), e.bottom && s.push({ kind: "h", pos: t.heightMm, from: 0, to: t.widthMm }), e.left && s.push({ kind: "v", pos: 0, from: 0, to: t.heightMm }), e.right && s.push({ kind: "v", pos: t.widthMm, from: 0, to: t.heightMm });
6
+ const o = P(t.style);
7
+ return s.map((i) => ({ ...i, ...o }));
8
+ }
9
+ function H(n, t, e) {
10
+ const s = n.get(t);
11
+ (!s || e.widthPt > s.widthPt) && n.set(t, e);
12
+ }
13
+ function S(n, t, e, s, o, i) {
14
+ const c = e < t.rows.length ? t.rows[e].pos : t.rows[t.rows.length - 1].pos + t.rows[t.rows.length - 1].size;
15
+ for (let r = s; r < o; r++) {
16
+ const h = t.columns[r];
17
+ H(n, `h:${e}:${r}`, { kind: "h", pos: c, from: h.pos, to: h.pos + h.size, ...i });
18
+ }
19
+ }
20
+ function k(n, t, e, s, o, i) {
21
+ const c = e < t.columns.length ? t.columns[e].pos : t.columns[t.columns.length - 1].pos + t.columns[t.columns.length - 1].size;
22
+ for (let r = s; r < o; r++) {
23
+ const h = t.rows[r];
24
+ H(n, `v:${e}:${r}`, { kind: "v", pos: c, from: h.pos, to: h.pos + h.size, ...i });
25
+ }
26
+ }
27
+ function v(n, t, e, s) {
28
+ const o = Math.min(t.columns.length, e.ci + (e.cell.colSpan ?? 1)), i = Math.min(t.rows.length, e.ri + (e.cell.rowSpan ?? 1)), c = w(s, e.cell.style), r = z(c), h = P(c);
29
+ r.top && S(n, t, e.ri, e.ci, o, h), r.bottom && S(n, t, i, e.ci, o, h), r.left && k(n, t, e.ci, e.ri, i, h), r.right && k(n, t, o, e.ri, i, h);
30
+ }
31
+ function A(n) {
32
+ const t = [...n.values()].sort((s, o) => s.kind.localeCompare(o.kind) || s.pos - o.pos || s.from - o.from), e = [];
33
+ for (const s of t) {
34
+ const o = e[e.length - 1];
35
+ o && o.kind === s.kind && o.pos === s.pos && Math.abs(o.to - s.from) < 1e-6 && o.color === s.color && o.widthPt === s.widthPt ? o.to = s.to : e.push({ ...s });
36
+ }
37
+ return e;
38
+ }
39
+ function W(n, t) {
40
+ if (!n.cells.some(({ cell: i }) => R.some((c) => i.style?.[c] !== void 0))) return $(n, t);
41
+ const e = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), o = n.columns.length;
42
+ for (const i of n.cells) {
43
+ v(e, n, i, t.style);
44
+ const c = Math.min(n.rows.length, i.ri + (i.cell.rowSpan ?? 1)), r = Math.min(o, i.ci + (i.cell.colSpan ?? 1));
45
+ for (let h = i.ri; h < c; h++) for (let l = i.ci; l < r; l++) s.add(h * o + l);
46
+ }
47
+ for (let i = 0; i < n.rows.length; i++) for (let c = 0; c < o; c++)
48
+ s.has(i * o + c) || v(e, n, { ri: i, ci: c, cell: {} }, t.style);
49
+ return A(e);
50
+ }
51
+ function a(n) {
52
+ const t = B(n).fontSizePt;
53
+ return { runs: [], width: 0, height: t * C(n), fontSize: t };
54
+ }
55
+ function T(n, t, e, s) {
56
+ const o = n.runs[n.runs.length - 1];
57
+ o?.style === e ? (o.text += t, o.width += s) : n.runs.push({ text: t, style: e, width: s });
58
+ const i = B(e).fontSizePt;
59
+ n.width += s, n.fontSize = Math.max(n.fontSize, i), n.height = Math.max(n.height, i * C(e));
60
+ }
61
+ function E(n, t, e, s, o) {
62
+ const i = n.richParagraphs[t], c = w(n.style, { ...i.lineHeight === void 0 ? {} : { lineHeight: i.lineHeight } }), r = [a(c)];
63
+ for (const h of i.segments) {
64
+ const l = w(c, h.style), m = h.kind === "field" ? h.field ?? "" : h.text ?? "";
65
+ for (const d of m.replace(/\r\n|\r/g, `
66
+ `)) {
67
+ let f = r[r.length - 1];
68
+ if (d === `
69
+ `) {
70
+ r.push(a(l));
71
+ continue;
72
+ }
73
+ const g = o.measure(d, l);
74
+ f.runs.length && f.width + g > e - (r.length === 1 ? s : 0) && (f = a(l), r.push(f)), T(f, d, l, g);
75
+ }
76
+ }
77
+ return r;
78
+ }
79
+ function D(n, t, e) {
80
+ const s = n.richParagraphs.map((r, h) => {
81
+ const l = (r.indentMm ?? 0) * 72 / 25.4, m = E(n, h, t.width, l, e), d = m.reduce((f, g) => f + g.height, 0) + ((r.spaceBeforeMm ?? 0) + (r.spaceAfterMm ?? 0)) * 72 / 25.4;
82
+ return { paragraph: r, indent: l, lines: m, height: d };
83
+ }), o = s.reduce((r, h) => r + h.height, 0), i = n.style?.verticalAlign;
84
+ let c = t.yTop - (i === "middle" ? (t.height - o) / 2 : i === "bottom" ? t.height - o : 0);
85
+ for (const { paragraph: r, indent: h, lines: l } of s) {
86
+ c -= (r.spaceBeforeMm ?? 0) * 72 / 25.4;
87
+ const m = Math.max(0, t.width - h);
88
+ for (const [d, f] of l.entries()) {
89
+ const g = r.align ?? n.style?.align, L = d === 0 ? h : 0, u = d === 0 ? m : t.width;
90
+ let M = t.x + L + (g === "center" ? (u - f.width) / 2 : g === "right" ? u - f.width : 0);
91
+ for (const p of f.runs)
92
+ e.draw(p.text, { ...p.style, align: "left" }, M, c - f.fontSize, p.width), M += p.width;
93
+ c -= f.height;
94
+ }
95
+ c -= (r.spaceAfterMm ?? 0) * 72 / 25.4;
96
+ }
97
+ return o > t.height + 0.01;
98
+ }
99
+ export {
100
+ D as d,
101
+ W as r
102
+ };
@@ -0,0 +1,168 @@
1
+ import { H as R, I as W, R as y, J as C, E as O, m as X, G as z, K as H, b as K, P as Q, n as Y } from "./json-snapshot-D6ioHth9.js";
2
+ import { g as M } from "./report-params-B1RzkhJj.js";
3
+ import { d as $, r as Z, R as ee } from "./param-validation-Do7Eg8Zv.js";
4
+ import { t as P, b as x, D as te, v as se, c as T, R as D } from "./sha256-DTG-Gq8i.js";
5
+ import { a as ae } from "./template-registry-Cw3vRTX2.js";
6
+ import { T as re } from "./tree-CjVZLRw7.js";
7
+ import { r as j } from "./assets-CqIbfbTr.js";
8
+ import { s as S, a as J, d as oe, e as ne, r as ce } from "./prepared-DqtpvRTn.js";
9
+ function I(e = []) {
10
+ return e.map(({ code: s, message: r, severity: i, pageIndex: t, componentIndex: a }) => ({ code: s, message: r, severity: i, path: a < 0 ? `$.pages.${t}` : `$.pages.${t}.components.${a}` }));
11
+ }
12
+ async function _(e, s, r = Date.now()) {
13
+ const i = e.prepared, t = e.format === "pdf" ? await import("@agile-team/mach-report/pdf") : void 0;
14
+ P(e.signal);
15
+ const a = e.pdf?.customFontFaces ?? (e.pdf?.customFontBytes ? { regular: e.pdf.customFontBytes } : void 0), p = t && a ? t.createFontBytesMeasurer(a) : void 0, m = R(e), c = await m.run("encode", async () => {
16
+ let u;
17
+ if (e.format === "pdf") {
18
+ P(e.signal);
19
+ const n = await t.renderPlanToPdf(i.plan, { ...e.pdf, ...p ? { measurer: p } : {}, fidelity: e.fidelity, signal: e.signal, onProgress: (f, d) => m.progress("encode", f, d) });
20
+ u = n.bytes, i.diagnostics.push(...I(n.diagnostics)), i.diagnostics.push(...n.fidelityWarnings.map((f) => ({ code: "pdf-fidelity", message: f, severity: "warning" })), ...n.pageErrors.map((f) => ({ code: "pdf-page", message: f, severity: "error" }))), n.unsupportedTextCount && i.diagnostics.push({ code: "pdf-font", message: `${n.unsupportedTextCount} 段文本包含当前字体不支持的字符`, severity: "warning" });
21
+ } else {
22
+ const { renderPlanToXlsx: n } = await import("@agile-team/mach-report/xlsx");
23
+ P(e.signal);
24
+ const f = await n(i.plan, { ...e.xlsx, fidelity: e.fidelity, signal: e.signal, onProgress: (d, v) => m.progress("encode", d, v) });
25
+ u = new Uint8Array(f.buffer), i.diagnostics.push(...I(f.diagnostics)), i.diagnostics.push(...f.warnings.map((d) => ({ code: "xlsx-fidelity", message: d, severity: "warning" })));
26
+ }
27
+ return P(e.signal), u;
28
+ });
29
+ x(s, "maxOutputBytes", c.byteLength);
30
+ const { plan: o, ...w } = i;
31
+ return { ...w, bytes: c, format: e.format, contentType: e.format === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", stats: { ...w.stats, durationMs: Date.now() - r, outputBytes: c.byteLength } };
32
+ }
33
+ function N(e) {
34
+ return { ...e, reportIds: [...e.reportIds], ...e.params ? { params: { ...e.params } } : {} };
35
+ }
36
+ function A(e, s) {
37
+ if (s.length === 0) throw new y("config", "缺少报表 ID");
38
+ return s.map((r) => {
39
+ if (!Object.prototype.hasOwnProperty.call(e, r)) throw new y("config", `未注册报表 ${r}`);
40
+ return e[r];
41
+ });
42
+ }
43
+ function k(e) {
44
+ return e.grid?.cells.reduce((s, r) => s + r.reduce((i, t) => i + (t ? 1 + (t.children?.reduce((a, p) => a + k(p), 0) ?? 0) : 0), 0), 0) ?? 0;
45
+ }
46
+ function ie(e, s, r) {
47
+ return e.pages.reduce((i, t) => i + t.components.reduce((a, p) => p.kind !== "list" ? a + k(p) : a + Y(p, s, r), 0), 0);
48
+ }
49
+ function de(e, s = Object.keys(e)) {
50
+ return A(e, s).map((r, i) => {
51
+ const t = s[i], a = M(e, [t]);
52
+ return {
53
+ id: t,
54
+ params: JSON.parse(JSON.stringify(a)),
55
+ paramsSchema: Z(a),
56
+ datasetsSchema: Object.fromEntries(Object.entries(r.dataSchema ?? {}).map(([p, m]) => [p, W(typeof r.template == "function" ? void 0 : r.template, p, m)])),
57
+ capabilities: {
58
+ save: !!r.provider?.save,
59
+ export: !!r.provider?.export,
60
+ templates: !!r.provider?.templates
61
+ }
62
+ };
63
+ });
64
+ }
65
+ function U(e, s) {
66
+ A(e, s.reportIds);
67
+ const r = $(M(e, s.reportIds), s.params), i = s.reportIds.flatMap((a) => $(M(e, [a]), s.params).issues), t = new Map(i.map((a) => [JSON.stringify(a), a]));
68
+ return { ...r, ok: t.size === 0, issues: [...t.values()] };
69
+ }
70
+ function V(e, s) {
71
+ const r = ae(e.plan);
72
+ if (!r.ok) throw new y("validate", `执行器返回无效计划:${r.errors[0]?.path}`);
73
+ const i = e.plan.pages.length, t = e.plan.pages.reduce((a, p) => a + p.components.reduce((m, c) => m + k(c), 0), 0);
74
+ return x(s, "maxRows", e.stats.rows), x(s, "maxPages", i), x(s, "maxCells", t), { ...e, stats: { ...e.stats, pages: i, cells: t } };
75
+ }
76
+ function q(e, s) {
77
+ const r = U(e.reports, s);
78
+ if (!r.ok) throw new ee(r.issues);
79
+ }
80
+ function ye(e) {
81
+ const s = { ...te, ...e.budget };
82
+ se(s);
83
+ const r = async (t, a) => {
84
+ const p = Date.now();
85
+ let m = 0, c = 0;
86
+ const o = [], w = {}, u = [], n = Object.fromEntries(Object.entries(e.reports).map(([l, g]) => [l, {
87
+ ...g,
88
+ pagination: { ...e.pagination, ...g.pagination, ...a ? { measurer: a } : {} },
89
+ dataValidation: {
90
+ ...g.dataValidation,
91
+ maxRows: Math.min(s.maxRows ?? 1e5, g.dataValidation?.maxRows ?? 1 / 0),
92
+ maxCells: Math.min(s.maxCells ?? 2e6, g.dataValidation?.maxCells ?? 1 / 0)
93
+ }
94
+ }])), d = await X(n, { maxPages: s.maxPages, maxCells: s.maxCells, onDatasets: (l, g, h) => {
95
+ try {
96
+ m += z(h, g, { maxRows: s.maxRows, signal: t.signal });
97
+ } catch (b) {
98
+ throw b instanceof re ? new D("budget", b.message, "$.budget.maxRows") : b;
99
+ }
100
+ x(s, "maxRows", m), c += ie(h, g, n[l]?.pagination), x(s, "maxCells", c);
101
+ } })({ ...t, params: t.params ?? {}, onWarning: (l) => o.push({ code: "layout", message: l, severity: "warning" }), onQueryResult: (l, g, h = 0) => {
102
+ const b = H(h, l);
103
+ Object.defineProperty(w, l, { value: { revision: g.revision, sourceToken: g.sourceToken }, enumerable: !0, writable: !0 }), u.push({ reportId: l, reportIndex: h, reportScope: b, ...g.revision === void 0 ? {} : { revision: g.revision }, ...g.sourceToken === void 0 ? {} : { sourceToken: g.sourceToken } }), o.push(...(g.diagnostics ?? []).map((E) => ({ ...E, ...E.target ? { target: {
104
+ ...E.target,
105
+ reportScope: b,
106
+ ...E.target.tableId ? { tableId: JSON.stringify([h, l, E.target.tableId]) } : {}
107
+ } } : {} })));
108
+ } }).catch((l) => {
109
+ throw l instanceof y && l.cause instanceof K ? new D("budget", l.cause.message, "$.budget.maxPages") : l instanceof y && l.cause instanceof Q ? new D("budget", l.cause.message, "$.budget.maxCells") : l;
110
+ });
111
+ P(t.signal);
112
+ const v = e.assets ? await R(t).run("assets", () => j(d, { ...e.assets, signal: t.signal })) : { plan: d, diagnostics: [] }, F = v.plan;
113
+ o.push(...I(v.diagnostics));
114
+ const L = F.pages.reduce((l, g) => l + g.components.reduce((h, b) => h + k(b), 0), 0);
115
+ x(s, "maxPages", F.pages.length), x(s, "maxCells", L);
116
+ const B = ce(t.pdf), G = e.pagination?.measurer || Object.values(e.reports).some((l) => l.pagination?.measurer);
117
+ return { plan: F, diagnostics: o, revisions: w, sources: u, layout: { textMetrics: B ? "font-bytes" : G ? "provided" : "heuristic", ...B ? { fontFingerprint: B } : {} }, stats: { rows: m, pages: F.pages.length, cells: L, durationMs: Date.now() - p } };
118
+ }, i = async (t) => {
119
+ const a = Date.now();
120
+ if (t.format !== "pdf" && t.format !== "xlsx") throw new y("config", "不支持的报表导出格式");
121
+ const p = t.format === "pdf" ? await import("@agile-team/mach-report/pdf") : void 0;
122
+ P(t.signal);
123
+ const m = t.pdf?.customFontFaces ?? (t.pdf?.customFontBytes ? { regular: t.pdf.customFontBytes } : void 0), c = p && m ? p.createFontBytesMeasurer(m) : void 0, o = await r(t, c);
124
+ return P(t.signal), _({ ...t, prepared: o }, s, a);
125
+ };
126
+ return {
127
+ describe: (t) => de(e.reports, t),
128
+ validate: (t) => U(e.reports, t),
129
+ prepare: (t) => T(t.signal, s.maxDurationMs, async (a) => {
130
+ const { signal: p, onEvent: m, ...c } = N(t), o = { ...c, ...c.pdf ? { pdf: S(c.pdf) } : {}, taskId: c.taskId ?? C() }, w = m ? (v) => O(m, v, a) : void 0, u = { ...o, signal: a, onEvent: w };
131
+ R(u).runSync("validate", () => q(e, o));
132
+ let n;
133
+ const f = o.pdf?.customFontFaces ?? (o.pdf?.customFontBytes ? { regular: o.pdf.customFontBytes } : void 0);
134
+ if (!e.executor && f) {
135
+ const v = await import("@agile-team/mach-report/pdf");
136
+ P(a), n = v.createFontBytesMeasurer(f);
137
+ }
138
+ const d = e.executor ? await e.executor.prepare(o, a, w) : await r(u, n);
139
+ return V(d, s);
140
+ }),
141
+ exportPrepared: (t) => T(t.signal, s.maxDurationMs, async (a) => {
142
+ const p = Date.now(), { signal: m, onEvent: c, ...o } = t, w = V(oe(t.prepared, s.maxPreparedBytes ?? 64e6, a), s), u = { ...o, xlsx: J(o.xlsx), prepared: w, ...o.pdf ? { pdf: S(o.pdf) } : {}, taskId: o.taskId ?? C() };
143
+ if (u.format !== "pdf" && u.format !== "xlsx") throw new y("config", "不支持的报表导出格式");
144
+ const n = c ? (d) => O(c, d, a) : void 0;
145
+ if (e.executor) {
146
+ if (!e.executor.exportPrepared) throw new y("config", "执行器未实现 exportPrepared;请升级执行器或显式使用本地运行时");
147
+ const d = await e.executor.exportPrepared(u, a, n);
148
+ return x(s, "maxRows", d.stats.rows), x(s, "maxPages", d.stats.pages), x(s, "maxCells", d.stats.cells), x(s, "maxOutputBytes", d.bytes.byteLength), { ...d, stats: { ...d.stats, outputBytes: d.bytes.byteLength } };
149
+ }
150
+ const f = { ...u, signal: a, onEvent: n };
151
+ if (R(f).runSync("validate", () => ne(f)), e.assets) {
152
+ const d = await R(f).run("assets", () => j(w.plan, { ...e.assets, signal: a }));
153
+ w.plan = d.plan, w.diagnostics.push(...I(d.diagnostics));
154
+ }
155
+ return _(f, s, p);
156
+ }),
157
+ export: (t) => T(t.signal, s.maxDurationMs, async (a) => {
158
+ const { signal: p, onEvent: m, ...c } = N(t), o = { ...c, xlsx: J(c.xlsx), ...c.pdf ? { pdf: S(c.pdf) } : {}, taskId: c.taskId ?? C() }, w = m ? (f) => O(m, f, a) : void 0, u = { ...o, signal: a, onEvent: w };
159
+ if (R(u).runSync("validate", () => q(e, o)), o.format !== "pdf" && o.format !== "xlsx") throw new y("config", "不支持的报表导出格式");
160
+ const n = e.executor ? await e.executor.export(o, a, w) : await i(u);
161
+ return x(s, "maxRows", n.stats.rows), x(s, "maxPages", n.stats.pages), x(s, "maxCells", n.stats.cells), x(s, "maxOutputBytes", n.bytes.byteLength), { ...n, stats: { ...n.stats, outputBytes: n.bytes.byteLength } };
162
+ })
163
+ };
164
+ }
165
+ export {
166
+ ye as c,
167
+ V as e
168
+ };
@@ -0,0 +1 @@
1
+ "use strict";var J=Object.create;var D=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var U=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var W=(e,t,a,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of N(t))!X.call(e,s)&&s!==a&&D(e,s,{get:()=>t[s],enumerable:!(c=V(t,s))||c.enumerable});return e};var E=(e,t,a)=>(a=e!=null?J(U(e)):{},W(t||!e||!e.__esModule?D(a,"default",{value:e,enumerable:!0}):a,e));const n=require("./json-snapshot-DknkjvxP.cjs"),F=require("./report-params-WDGrA4oP.cjs"),k=require("./param-validation-C3HlcLLO.cjs"),o=require("./sha256-BshdOkCC.cjs"),z=require("./template-registry-C62vpv4a.cjs"),G=require("./tree-BX380Rr7.cjs"),M=require("./assets-e4YSke8n.cjs"),b=require("./prepared-DdrjLC7L.cjs");function I(e=[]){return e.map(({code:t,message:a,severity:c,pageIndex:s,componentIndex:r})=>({code:t,message:a,severity:c,path:r<0?`$.pages.${s}`:`$.pages.${s}.components.${r}`}))}async function q(e,t,a=Date.now()){const c=e.prepared,s=e.format==="pdf"?await import("@agile-team/mach-report/pdf"):void 0;o.throwIfAborted(e.signal);const r=e.pdf?.customFontFaces??(e.pdf?.customFontBytes?{regular:e.pdf.customFontBytes}:void 0),u=s&&r?s.createFontBytesMeasurer(r):void 0,m=n.createReportTaskReporter(e),p=await m.run("encode",async()=>{let x;if(e.format==="pdf"){o.throwIfAborted(e.signal);const d=await s.renderPlanToPdf(c.plan,{...e.pdf,...u?{measurer:u}:{},fidelity:e.fidelity,signal:e.signal,onProgress:(f,l)=>m.progress("encode",f,l)});x=d.bytes,c.diagnostics.push(...I(d.diagnostics)),c.diagnostics.push(...d.fidelityWarnings.map(f=>({code:"pdf-fidelity",message:f,severity:"warning"})),...d.pageErrors.map(f=>({code:"pdf-page",message:f,severity:"error"}))),d.unsupportedTextCount&&c.diagnostics.push({code:"pdf-font",message:`${d.unsupportedTextCount} 段文本包含当前字体不支持的字符`,severity:"warning"})}else{const{renderPlanToXlsx:d}=await import("@agile-team/mach-report/xlsx");o.throwIfAborted(e.signal);const f=await d(c.plan,{...e.xlsx,fidelity:e.fidelity,signal:e.signal,onProgress:(l,h)=>m.progress("encode",l,h)});x=new Uint8Array(f.buffer),c.diagnostics.push(...I(f.diagnostics)),c.diagnostics.push(...f.warnings.map(l=>({code:"xlsx-fidelity",message:l,severity:"warning"})))}return o.throwIfAborted(e.signal),x});o.assertBudget(t,"maxOutputBytes",p.byteLength);const{plan:i,...y}=c;return{...y,bytes:p,format:e.format,contentType:e.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",stats:{...y.stats,durationMs:Date.now()-a,outputBytes:p.byteLength}}}function A(e){return{...e,reportIds:[...e.reportIds],...e.params?{params:{...e.params}}:{}}}function $(e,t){if(t.length===0)throw new n.ReportSourceError("config","缺少报表 ID");return t.map(a=>{if(!Object.prototype.hasOwnProperty.call(e,a))throw new n.ReportSourceError("config",`未注册报表 ${a}`);return e[a]})}function T(e){return e.grid?.cells.reduce((t,a)=>t+a.reduce((c,s)=>c+(s?1+(s.children?.reduce((r,u)=>r+T(u),0)??0):0),0),0)??0}function Q(e,t,a){return e.pages.reduce((c,s)=>c+s.components.reduce((r,u)=>u.kind!=="list"?r+T(u):r+n.estimateListLayoutCells(u,t,a),0),0)}function H(e,t=Object.keys(e)){return $(e,t).map((a,c)=>{const s=t[c],r=F.getReportParamDefs(e,[s]);return{id:s,params:JSON.parse(JSON.stringify(r)),paramsSchema:k.reportParamsJsonSchema(r),datasetsSchema:Object.fromEntries(Object.entries(a.dataSchema??{}).map(([u,m])=>[u,n.templateDatasetJsonSchema(typeof a.template=="function"?void 0:a.template,u,m)])),capabilities:{save:!!a.provider?.save,export:!!a.provider?.export,templates:!!a.provider?.templates}}})}function j(e,t){$(e,t.reportIds);const a=k.validateReportParams(F.getReportParamDefs(e,t.reportIds),t.params),c=t.reportIds.flatMap(r=>k.validateReportParams(F.getReportParamDefs(e,[r]),t.params).issues),s=new Map(c.map(r=>[JSON.stringify(r),r]));return{...a,ok:s.size===0,issues:[...s.values()]}}function O(e,t){const a=z.validateRenderPlan(e.plan);if(!a.ok)throw new n.ReportSourceError("validate",`执行器返回无效计划:${a.errors[0]?.path}`);const c=e.plan.pages.length,s=e.plan.pages.reduce((r,u)=>r+u.components.reduce((m,p)=>m+T(p),0),0);return o.assertBudget(t,"maxRows",e.stats.rows),o.assertBudget(t,"maxPages",c),o.assertBudget(t,"maxCells",s),{...e,stats:{...e.stats,pages:c,cells:s}}}function L(e,t){const a=j(e.reports,t);if(!a.ok)throw new k.ReportParamValidationError(a.issues)}function K(e){const t={...o.DEFAULT_REPORT_RUNTIME_BUDGET,...e.budget};o.validateBudget(t);const a=async(s,r)=>{const u=Date.now();let m=0,p=0;const i=[],y={},x=[],d=Object.fromEntries(Object.entries(e.reports).map(([g,w])=>[g,{...w,pagination:{...e.pagination,...w.pagination,...r?{measurer:r}:{}},dataValidation:{...w.dataValidation,maxRows:Math.min(t.maxRows??1e5,w.dataValidation?.maxRows??1/0),maxCells:Math.min(t.maxCells??2e6,w.dataValidation?.maxCells??1/0)}}])),l=await n.createReportSource(d,{maxPages:t.maxPages,maxCells:t.maxCells,onDatasets:(g,w,v)=>{try{m+=n.templateDatasetRowCount(v,w,{maxRows:t.maxRows,signal:s.signal})}catch(R){throw R instanceof G.TreeRowLimitError?new o.ReportRuntimeError("budget",R.message,"$.budget.maxRows"):R}o.assertBudget(t,"maxRows",m),p+=Q(v,w,d[g]?.pagination),o.assertBudget(t,"maxCells",p)}})({...s,params:s.params??{},onWarning:g=>i.push({code:"layout",message:g,severity:"warning"}),onQueryResult:(g,w,v=0)=>{const R=n.reportOccurrenceScope(v,g);Object.defineProperty(y,g,{value:{revision:w.revision,sourceToken:w.sourceToken},enumerable:!0,writable:!0}),x.push({reportId:g,reportIndex:v,reportScope:R,...w.revision===void 0?{}:{revision:w.revision},...w.sourceToken===void 0?{}:{sourceToken:w.sourceToken}}),i.push(...(w.diagnostics??[]).map(P=>({...P,...P.target?{target:{...P.target,reportScope:R,...P.target.tableId?{tableId:JSON.stringify([v,g,P.target.tableId])}:{}}}:{}})))}}).catch(g=>{throw g instanceof n.ReportSourceError&&g.cause instanceof n.PaginatePageLimitError?new o.ReportRuntimeError("budget",g.cause.message,"$.budget.maxPages"):g instanceof n.ReportSourceError&&g.cause instanceof n.PaginateCellLimitError?new o.ReportRuntimeError("budget",g.cause.message,"$.budget.maxCells"):g});o.throwIfAborted(s.signal);const h=e.assets?await n.createReportTaskReporter(s).run("assets",()=>M.resolvePlanAssets(l,{...e.assets,signal:s.signal})):{plan:l,diagnostics:[]},B=h.plan;i.push(...I(h.diagnostics));const C=B.pages.reduce((g,w)=>g+w.components.reduce((v,R)=>v+T(R),0),0);o.assertBudget(t,"maxPages",B.pages.length),o.assertBudget(t,"maxCells",C);const S=b.reportFontFingerprint(s.pdf),_=e.pagination?.measurer||Object.values(e.reports).some(g=>g.pagination?.measurer);return{plan:B,diagnostics:i,revisions:y,sources:x,layout:{textMetrics:S?"font-bytes":_?"provided":"heuristic",...S?{fontFingerprint:S}:{}},stats:{rows:m,pages:B.pages.length,cells:C,durationMs:Date.now()-u}}},c=async s=>{const r=Date.now();if(s.format!=="pdf"&&s.format!=="xlsx")throw new n.ReportSourceError("config","不支持的报表导出格式");const u=s.format==="pdf"?await import("@agile-team/mach-report/pdf"):void 0;o.throwIfAborted(s.signal);const m=s.pdf?.customFontFaces??(s.pdf?.customFontBytes?{regular:s.pdf.customFontBytes}:void 0),p=u&&m?u.createFontBytesMeasurer(m):void 0,i=await a(s,p);return o.throwIfAborted(s.signal),q({...s,prepared:i},t,r)};return{describe:s=>H(e.reports,s),validate:s=>j(e.reports,s),prepare:s=>o.controlled(s.signal,t.maxDurationMs,async r=>{const{signal:u,onEvent:m,...p}=A(s),i={...p,...p.pdf?{pdf:b.snapshotPdfFonts(p.pdf)}:{},taskId:p.taskId??n.reportTaskId()},y=m?h=>n.notifyReportTaskEvent(m,h,r):void 0,x={...i,signal:r,onEvent:y};n.createReportTaskReporter(x).runSync("validate",()=>L(e,i));let d;const f=i.pdf?.customFontFaces??(i.pdf?.customFontBytes?{regular:i.pdf.customFontBytes}:void 0);if(!e.executor&&f){const h=await import("@agile-team/mach-report/pdf");o.throwIfAborted(r),d=h.createFontBytesMeasurer(f)}const l=e.executor?await e.executor.prepare(i,r,y):await a(x,d);return O(l,t)}),exportPrepared:s=>o.controlled(s.signal,t.maxDurationMs,async r=>{const u=Date.now(),{signal:m,onEvent:p,...i}=s,y=O(b.snapshotPreparedReport(s.prepared,t.maxPreparedBytes??64e6,r),t),x={...i,xlsx:b.snapshotXlsxOptions(i.xlsx),prepared:y,...i.pdf?{pdf:b.snapshotPdfFonts(i.pdf)}:{},taskId:i.taskId??n.reportTaskId()};if(x.format!=="pdf"&&x.format!=="xlsx")throw new n.ReportSourceError("config","不支持的报表导出格式");const d=p?l=>n.notifyReportTaskEvent(p,l,r):void 0;if(e.executor){if(!e.executor.exportPrepared)throw new n.ReportSourceError("config","执行器未实现 exportPrepared;请升级执行器或显式使用本地运行时");const l=await e.executor.exportPrepared(x,r,d);return o.assertBudget(t,"maxRows",l.stats.rows),o.assertBudget(t,"maxPages",l.stats.pages),o.assertBudget(t,"maxCells",l.stats.cells),o.assertBudget(t,"maxOutputBytes",l.bytes.byteLength),{...l,stats:{...l.stats,outputBytes:l.bytes.byteLength}}}const f={...x,signal:r,onEvent:d};if(n.createReportTaskReporter(f).runSync("validate",()=>b.checkPreparedFont(f)),e.assets){const l=await n.createReportTaskReporter(f).run("assets",()=>M.resolvePlanAssets(y.plan,{...e.assets,signal:r}));y.plan=l.plan,y.diagnostics.push(...I(l.diagnostics))}return q(f,t,u)}),export:s=>o.controlled(s.signal,t.maxDurationMs,async r=>{const{signal:u,onEvent:m,...p}=A(s),i={...p,xlsx:b.snapshotXlsxOptions(p.xlsx),...p.pdf?{pdf:b.snapshotPdfFonts(p.pdf)}:{},taskId:p.taskId??n.reportTaskId()},y=m?f=>n.notifyReportTaskEvent(m,f,r):void 0,x={...i,signal:r,onEvent:y};if(n.createReportTaskReporter(x).runSync("validate",()=>L(e,i)),i.format!=="pdf"&&i.format!=="xlsx")throw new n.ReportSourceError("config","不支持的报表导出格式");const d=e.executor?await e.executor.export(i,r,y):await c(x);return o.assertBudget(t,"maxRows",d.stats.rows),o.assertBudget(t,"maxPages",d.stats.pages),o.assertBudget(t,"maxCells",d.stats.cells),o.assertBudget(t,"maxOutputBytes",d.bytes.byteLength),{...d,stats:{...d.stats,outputBytes:d.bytes.byteLength}}})}}exports.createReportRuntime=K;exports.enforcePrepared=O;
@@ -6,7 +6,7 @@
6
6
  "component": {
7
7
  "type": "library",
8
8
  "name": "@agile-team/mach-report",
9
- "version": "2.15.0"
9
+ "version": "2.16.0"
10
10
  },
11
11
  "properties": [
12
12
  {
@@ -15,7 +15,7 @@
15
15
  },
16
16
  {
17
17
  "name": "mach-report:pnpm-lock-sha256",
18
- "value": "f1e4c95d99a99330d34b81c8d599595a6674a6ca23e22d6630d0e4d3ceae52cb"
18
+ "value": "fddd4c6493151407325d6e9b417bbecd0901d87a44543b1dbf4b96c0f3025ef7"
19
19
  }
20
20
  ]
21
21
  },
@@ -2,6 +2,15 @@
2
2
 
3
3
  import { WorkerOptions as WorkerOptions_2 } from 'node:worker_threads';
4
4
 
5
+ declare interface BrowserReportWorker {
6
+ postMessage(value: unknown, transfer?: Transferable[]): void;
7
+ terminate(): void;
8
+ addEventListener(type: "message", listener: (event: MessageEvent) => void): void;
9
+ addEventListener(type: "error" | "messageerror", listener: (event: Event) => void): void;
10
+ removeEventListener(type: "message", listener: (event: MessageEvent) => void): void;
11
+ removeEventListener(type: "error" | "messageerror", listener: (event: Event) => void): void;
12
+ }
13
+
5
14
  /** Serializable symbol settings. Encoders remain in the optional /codes entry. */
6
15
  declare interface CodeOptions {
7
16
  /** Explicit content, including an empty value, takes precedence over legacy fallbackText. */
@@ -72,6 +81,9 @@ declare interface ComponentStyle {
72
81
  rotateDeg?: number;
73
82
  }
74
83
 
84
+ /** Node needs no URL factory: this module is the isolated encoding entry in both ESM and CommonJS builds. */
85
+ export declare function createNodeAutoReportExporter(options?: Omit<ReportExportExecutionOptions, "workerFactory">): ReportAutoExporter;
86
+
75
87
  /** 独立 worker_threads 适配器;worker 入口注册自己的模板/Provider,不把函数跨线程序列化。 */
76
88
  export declare function createNodeReportExecutor(options: NodeReportExecutorOptions): ReportRuntimeExecutor;
77
89
 
@@ -85,6 +97,8 @@ export declare interface FileReportJobStoreOptions extends ReportJobStoreBudgetO
85
97
  }
86
98
 
87
99
  declare interface GridCell {
100
+ /** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
101
+ richParagraphs?: RichParagraph[];
88
102
  text?: string;
89
103
  rawText?: string;
90
104
  /** 原始值,仅供 Excel raw 模式消费;不参与预览、分页与 PDF 绘制。 */
@@ -108,6 +122,19 @@ declare interface GridCell {
108
122
  style?: ComponentStyle;
109
123
  }
110
124
 
125
+ /** Bounded binary image inspection shared by PDF, Excel and template import. No decoder is loaded. */
126
+ declare interface ImageMediaOptions {
127
+ maxImageBytes?: number;
128
+ maxTotalImageBytes?: number;
129
+ maxImages?: number;
130
+ /** Decoded pixels per unique image, default 16 million. */
131
+ maxImagePixels?: number;
132
+ /** Total decoded pixels for unique media, default 64 million. */
133
+ maxTotalImagePixels?: number;
134
+ /** Maximum source dimension, default 16384 pixels. */
135
+ maxImageDimension?: number;
136
+ }
137
+
111
138
  export declare interface NodeReportExecutorOptions extends ReportWorkerOptions {
112
139
  filename?: string | URL;
113
140
  workerUrl?: string | URL;
@@ -213,6 +240,16 @@ declare interface RenderPlan {
213
240
  /** Optional publication digest for Node hosts; use as reviewReportPublication({ digest }). */
214
241
  export declare function reportArtifactSha256(bytes: Uint8Array): string;
215
242
 
243
+ export declare interface ReportAutoExporter {
244
+ exportPrepared(input: ReportRuntimePreparedExportInput, localOverride?: ReportLocalExport): Promise<ReportAutoExportResult>;
245
+ cancel(): void;
246
+ dispose(): void;
247
+ }
248
+
249
+ export declare interface ReportAutoExportResult extends ReportRuntimeExportResult {
250
+ execution: ReportExportDecision;
251
+ }
252
+
216
253
  /** 可持久化的业务身份与计划坐标独立;权限及并发校验仍由业务服务器执行。 */
217
254
  declare interface ReportCellSource {
218
255
  /** Source identity across report occurrences; sharing must be explicitly declared. */
@@ -257,6 +294,38 @@ declare interface ReportDiagnostic {
257
294
  target?: ReportDataTarget;
258
295
  }
259
296
 
297
+ export declare interface ReportExportDecision {
298
+ mode: "local" | "worker";
299
+ reason: ReportExportDecisionReason;
300
+ /** Lower bounds: traversal stops as soon as isolation is warranted. No font or image hashing. */
301
+ estimate: {
302
+ pages: number;
303
+ cells: number;
304
+ bytes: number;
305
+ };
306
+ hardCancellation: boolean;
307
+ }
308
+
309
+ declare type ReportExportDecisionReason = "small-task" | "threshold" | "scan-limit" | "explicit-local" | "explicit-worker" | "worker-unavailable" | "worker-start-failed" | "nonserializable-options";
310
+
311
+ export declare interface ReportExportExecutionOptions {
312
+ mode?: "auto" | "worker" | "local";
313
+ /** A fresh bundler-managed module Worker for every call; never a shared worker. */
314
+ workerFactory?: () => BrowserReportWorker;
315
+ thresholds?: ReportExportThresholds;
316
+ /** Auto only. Startup unavailability may use local; encoding failures never retry. */
317
+ fallback?: "local" | "error";
318
+ timeoutMs?: number;
319
+ budget?: ReportRuntimeBudget;
320
+ onDecision?: (decision: ReportExportDecision) => void;
321
+ }
322
+
323
+ declare interface ReportExportThresholds {
324
+ cells?: number;
325
+ pages?: number;
326
+ bytes?: number;
327
+ }
328
+
260
329
  declare type ReportJobJson = null | boolean | number | string | ReportJobJson[] | {
261
330
  [key: string]: ReportJobJson;
262
331
  };
@@ -338,6 +407,8 @@ declare interface ReportJobTombstone {
338
407
  expiresAt: number;
339
408
  }
340
409
 
410
+ declare type ReportLocalExport = (input: ReportRuntimePreparedExportInput) => Promise<ReportRuntimeExportResult>;
411
+
341
412
  /** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
342
413
  declare interface ReportParamDef {
343
414
  /** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
@@ -402,6 +473,16 @@ declare interface ReportRuntime {
402
473
  exportPrepared(input: ReportRuntimePreparedExportInput): Promise<ReportRuntimeExportResult>;
403
474
  }
404
475
 
476
+ declare interface ReportRuntimeBudget {
477
+ maxRows?: number;
478
+ maxPages?: number;
479
+ maxCells?: number;
480
+ maxOutputBytes?: number;
481
+ /** Bound the plain JSON snapshot accepted by exportPrepared (default 64 MB). */
482
+ maxPreparedBytes?: number;
483
+ maxDurationMs?: number;
484
+ }
485
+
405
486
  /** 可用 worker_threads/进程/RPC 实现;接收可序列化请求,signal 由桥接层映射为取消消息。 */
406
487
  declare interface ReportRuntimeExecutor {
407
488
  /** Old custom executors may omit this; the runtime explicitly rejects unsupported prepared output. */
@@ -414,10 +495,11 @@ declare interface ReportRuntimeExportInput extends ReportRuntimeInput {
414
495
  format: "pdf" | "xlsx";
415
496
  /** strict 在编码前拒绝已识别的输出降级;默认保留诊断并继续。 */
416
497
  fidelity?: "warn" | "strict";
417
- xlsx?: {
498
+ xlsx?: ImageMediaOptions & {
418
499
  sheetMode?: "auto" | "pages" | "continuous";
419
500
  valueMode?: "text" | "raw";
420
501
  paperSize?: "auto" | "a3" | "a4" | "a5";
502
+ sheetName?: (sheetIndex: number) => string;
421
503
  };
422
504
  }
423
505
 
@@ -438,6 +520,8 @@ declare interface ReportRuntimeInput extends ReportTaskMonitoring {
438
520
  /** Encode an existing plan without querying providers or repaginating. */
439
521
  declare interface ReportRuntimePreparedExportInput extends ReportTaskMonitoring {
440
522
  prepared: PreparedReport;
523
+ /** verify checks font metric identity; preserve explicitly keeps existing geometry, with a diagnostic. Encoding fidelity is unchanged. */
524
+ layoutPolicy?: "verify" | "preserve";
441
525
  format: ReportRuntimeExportInput["format"];
442
526
  fidelity?: ReportRuntimeExportInput["fidelity"];
443
527
  pdf?: ReportPdfFontOptions;
@@ -494,6 +578,7 @@ export declare class ReportWorkerError extends Error {
494
578
 
495
579
  declare interface ReportWorkerOptions {
496
580
  timeoutMs?: number;
581
+ budget?: ReportRuntimeBudget;
497
582
  }
498
583
 
499
584
  declare interface RichParagraph {
@@ -2,6 +2,15 @@
2
2
 
3
3
  import { WorkerOptions as WorkerOptions_2 } from 'node:worker_threads';
4
4
 
5
+ declare interface BrowserReportWorker {
6
+ postMessage(value: unknown, transfer?: Transferable[]): void;
7
+ terminate(): void;
8
+ addEventListener(type: "message", listener: (event: MessageEvent) => void): void;
9
+ addEventListener(type: "error" | "messageerror", listener: (event: Event) => void): void;
10
+ removeEventListener(type: "message", listener: (event: MessageEvent) => void): void;
11
+ removeEventListener(type: "error" | "messageerror", listener: (event: Event) => void): void;
12
+ }
13
+
5
14
  /** Serializable symbol settings. Encoders remain in the optional /codes entry. */
6
15
  declare interface CodeOptions {
7
16
  /** Explicit content, including an empty value, takes precedence over legacy fallbackText. */
@@ -72,6 +81,9 @@ declare interface ComponentStyle {
72
81
  rotateDeg?: number;
73
82
  }
74
83
 
84
+ /** Node needs no URL factory: this module is the isolated encoding entry in both ESM and CommonJS builds. */
85
+ export declare function createNodeAutoReportExporter(options?: Omit<ReportExportExecutionOptions, "workerFactory">): ReportAutoExporter;
86
+
75
87
  /** 独立 worker_threads 适配器;worker 入口注册自己的模板/Provider,不把函数跨线程序列化。 */
76
88
  export declare function createNodeReportExecutor(options: NodeReportExecutorOptions): ReportRuntimeExecutor;
77
89
 
@@ -85,6 +97,8 @@ export declare interface FileReportJobStoreOptions extends ReportJobStoreBudgetO
85
97
  }
86
98
 
87
99
  declare interface GridCell {
100
+ /** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
101
+ richParagraphs?: RichParagraph[];
88
102
  text?: string;
89
103
  rawText?: string;
90
104
  /** 原始值,仅供 Excel raw 模式消费;不参与预览、分页与 PDF 绘制。 */
@@ -108,6 +122,19 @@ declare interface GridCell {
108
122
  style?: ComponentStyle;
109
123
  }
110
124
 
125
+ /** Bounded binary image inspection shared by PDF, Excel and template import. No decoder is loaded. */
126
+ declare interface ImageMediaOptions {
127
+ maxImageBytes?: number;
128
+ maxTotalImageBytes?: number;
129
+ maxImages?: number;
130
+ /** Decoded pixels per unique image, default 16 million. */
131
+ maxImagePixels?: number;
132
+ /** Total decoded pixels for unique media, default 64 million. */
133
+ maxTotalImagePixels?: number;
134
+ /** Maximum source dimension, default 16384 pixels. */
135
+ maxImageDimension?: number;
136
+ }
137
+
111
138
  export declare interface NodeReportExecutorOptions extends ReportWorkerOptions {
112
139
  filename?: string | URL;
113
140
  workerUrl?: string | URL;
@@ -213,6 +240,16 @@ declare interface RenderPlan {
213
240
  /** Optional publication digest for Node hosts; use as reviewReportPublication({ digest }). */
214
241
  export declare function reportArtifactSha256(bytes: Uint8Array): string;
215
242
 
243
+ export declare interface ReportAutoExporter {
244
+ exportPrepared(input: ReportRuntimePreparedExportInput, localOverride?: ReportLocalExport): Promise<ReportAutoExportResult>;
245
+ cancel(): void;
246
+ dispose(): void;
247
+ }
248
+
249
+ export declare interface ReportAutoExportResult extends ReportRuntimeExportResult {
250
+ execution: ReportExportDecision;
251
+ }
252
+
216
253
  /** 可持久化的业务身份与计划坐标独立;权限及并发校验仍由业务服务器执行。 */
217
254
  declare interface ReportCellSource {
218
255
  /** Source identity across report occurrences; sharing must be explicitly declared. */
@@ -257,6 +294,38 @@ declare interface ReportDiagnostic {
257
294
  target?: ReportDataTarget;
258
295
  }
259
296
 
297
+ export declare interface ReportExportDecision {
298
+ mode: "local" | "worker";
299
+ reason: ReportExportDecisionReason;
300
+ /** Lower bounds: traversal stops as soon as isolation is warranted. No font or image hashing. */
301
+ estimate: {
302
+ pages: number;
303
+ cells: number;
304
+ bytes: number;
305
+ };
306
+ hardCancellation: boolean;
307
+ }
308
+
309
+ declare type ReportExportDecisionReason = "small-task" | "threshold" | "scan-limit" | "explicit-local" | "explicit-worker" | "worker-unavailable" | "worker-start-failed" | "nonserializable-options";
310
+
311
+ export declare interface ReportExportExecutionOptions {
312
+ mode?: "auto" | "worker" | "local";
313
+ /** A fresh bundler-managed module Worker for every call; never a shared worker. */
314
+ workerFactory?: () => BrowserReportWorker;
315
+ thresholds?: ReportExportThresholds;
316
+ /** Auto only. Startup unavailability may use local; encoding failures never retry. */
317
+ fallback?: "local" | "error";
318
+ timeoutMs?: number;
319
+ budget?: ReportRuntimeBudget;
320
+ onDecision?: (decision: ReportExportDecision) => void;
321
+ }
322
+
323
+ declare interface ReportExportThresholds {
324
+ cells?: number;
325
+ pages?: number;
326
+ bytes?: number;
327
+ }
328
+
260
329
  declare type ReportJobJson = null | boolean | number | string | ReportJobJson[] | {
261
330
  [key: string]: ReportJobJson;
262
331
  };
@@ -338,6 +407,8 @@ declare interface ReportJobTombstone {
338
407
  expiresAt: number;
339
408
  }
340
409
 
410
+ declare type ReportLocalExport = (input: ReportRuntimePreparedExportInput) => Promise<ReportRuntimeExportResult>;
411
+
341
412
  /** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
342
413
  declare interface ReportParamDef {
343
414
  /** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
@@ -402,6 +473,16 @@ declare interface ReportRuntime {
402
473
  exportPrepared(input: ReportRuntimePreparedExportInput): Promise<ReportRuntimeExportResult>;
403
474
  }
404
475
 
476
+ declare interface ReportRuntimeBudget {
477
+ maxRows?: number;
478
+ maxPages?: number;
479
+ maxCells?: number;
480
+ maxOutputBytes?: number;
481
+ /** Bound the plain JSON snapshot accepted by exportPrepared (default 64 MB). */
482
+ maxPreparedBytes?: number;
483
+ maxDurationMs?: number;
484
+ }
485
+
405
486
  /** 可用 worker_threads/进程/RPC 实现;接收可序列化请求,signal 由桥接层映射为取消消息。 */
406
487
  declare interface ReportRuntimeExecutor {
407
488
  /** Old custom executors may omit this; the runtime explicitly rejects unsupported prepared output. */
@@ -414,10 +495,11 @@ declare interface ReportRuntimeExportInput extends ReportRuntimeInput {
414
495
  format: "pdf" | "xlsx";
415
496
  /** strict 在编码前拒绝已识别的输出降级;默认保留诊断并继续。 */
416
497
  fidelity?: "warn" | "strict";
417
- xlsx?: {
498
+ xlsx?: ImageMediaOptions & {
418
499
  sheetMode?: "auto" | "pages" | "continuous";
419
500
  valueMode?: "text" | "raw";
420
501
  paperSize?: "auto" | "a3" | "a4" | "a5";
502
+ sheetName?: (sheetIndex: number) => string;
421
503
  };
422
504
  }
423
505
 
@@ -438,6 +520,8 @@ declare interface ReportRuntimeInput extends ReportTaskMonitoring {
438
520
  /** Encode an existing plan without querying providers or repaginating. */
439
521
  declare interface ReportRuntimePreparedExportInput extends ReportTaskMonitoring {
440
522
  prepared: PreparedReport;
523
+ /** verify checks font metric identity; preserve explicitly keeps existing geometry, with a diagnostic. Encoding fidelity is unchanged. */
524
+ layoutPolicy?: "verify" | "preserve";
441
525
  format: ReportRuntimeExportInput["format"];
442
526
  fidelity?: ReportRuntimeExportInput["fidelity"];
443
527
  pdf?: ReportPdfFontOptions;
@@ -494,6 +578,7 @@ export declare class ReportWorkerError extends Error {
494
578
 
495
579
  declare interface ReportWorkerOptions {
496
580
  timeoutMs?: number;
581
+ budget?: ReportRuntimeBudget;
497
582
  }
498
583
 
499
584
  declare interface RichParagraph {