@agile-team/mach-report 2.17.0 → 2.18.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.
- package/README.md +18 -9
- package/dist/{ExcelBindingWizard-Bq6FYME6.cjs → ExcelBindingWizard-Czn3C2yE.cjs} +1 -1
- package/dist/{ExcelBindingWizard-Co1svTsw.js → ExcelBindingWizard-DMGZj6I6.js} +3 -3
- package/dist/ParamEditor-KzDQvbHY.js +732 -0
- package/dist/ParamEditor-oDfD8LgE.cjs +1 -0
- package/dist/{ReportBatchPanel-uQh06usx.js → ReportBatchPanel-BJK7PvZ4.js} +39 -39
- package/dist/ReportBatchPanel-DnmNRssu.cjs +1 -0
- package/dist/ReportParamPanel-mQkeN70Q.js +1020 -0
- package/dist/ReportParamPanel-sOANVRz-.cjs +1 -0
- package/dist/ReportPreview-BxWWTUL5.js +5583 -0
- package/dist/ReportPreview-Yf99omi3.cjs +6 -0
- package/dist/{ReportTemplateLibrary-TIL_Oj2l.js → ReportTemplateLibrary-BFjB08Wu.js} +1 -1
- package/dist/{ReportTemplateLibrary-CnP7_1pH.cjs → ReportTemplateLibrary-BO42QnWd.cjs} +1 -1
- package/dist/RuleEditor-CqxT1a-W.js +2337 -0
- package/dist/RuleEditor-D7YWigD9.cjs +1 -0
- package/dist/{TemplateOutlinePanel-BlLxRrfu.cjs → TemplateOutlinePanel-B0XX350V.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-BouxsuqQ.js → TemplateOutlinePanel-zG0DrsIB.js} +2 -2
- package/dist/{TemplateReusePanel-yxsHSO40.cjs → TemplateReusePanel-BD0HSKp_.cjs} +1 -1
- package/dist/{TemplateReusePanel-BEACLPaN.js → TemplateReusePanel-Czwe5GbC.js} +2 -2
- package/dist/{TemplateReviewPanel-D9Cx0m2N.cjs → TemplateReviewPanel-CA5sdffM.cjs} +1 -1
- package/dist/{TemplateReviewPanel-B1OGRY2i.js → TemplateReviewPanel-NhmQI65C.js} +2 -2
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +100 -41
- package/dist/analytics.d.ts +100 -41
- package/dist/analytics.js +76 -141
- package/dist/artifact-integrity.json +108 -102
- package/dist/assets-2eC3mOcV.js +232 -0
- package/dist/assets-B0Hxn4l6.cjs +1 -0
- package/dist/{auto-DDHflI9v.cjs → auto-B0EZFIK1.cjs} +1 -1
- package/dist/{auto-BIOmtVhk.js → auto-BlchZ1b8.js} +19 -19
- package/dist/{batch-WzDIXJAt.js → batch-DGCt44XM.js} +1 -1
- package/dist/{batch-z6Aw5GEY.cjs → batch-DYcokH4v.cjs} +1 -1
- package/dist/charts-Dlv8j2AG.js +141 -0
- package/dist/charts-aCtoswXq.cjs +1 -0
- package/dist/codes.cjs +9 -9
- package/dist/codes.d.cts +54 -0
- package/dist/codes.d.ts +54 -0
- package/dist/codes.js +12097 -13668
- package/dist/column-visual-BpgQVWwT.js +238 -0
- package/dist/column-visual-CtYxnBCP.cjs +1 -0
- package/dist/component-tree-6TV7W6Yj.cjs +1 -0
- package/dist/component-tree-CvW4lzpv.js +67 -0
- package/dist/computed-4TnxzgIh.cjs +1 -0
- package/dist/computed-C8NRZQss.js +739 -0
- package/dist/data-bar-Ce38juRZ.cjs +1 -0
- package/dist/data-bar-PtjXhMgN.js +9 -0
- package/dist/designer--TKECSEc.cjs +2 -0
- package/dist/designer-d6hJS41w.js +5683 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +710 -42
- package/dist/designer.d.ts +710 -42
- package/dist/designer.js +23 -20
- package/dist/{encoding-BFMFIc4r.cjs → encoding-B--eZpp1.cjs} +1 -1
- package/dist/{encoding-DP_Eaf0A.js → encoding-mctOLocI.js} +2 -2
- package/dist/{font-loader-7FWVlykp.cjs → font-loader-DBBJ5KE9.cjs} +1 -1
- package/dist/{font-loader-CQZowp0I.js → font-loader-DW8tIaNp.js} +1 -1
- package/dist/index-CPh6tqge.js +1575 -0
- package/dist/index-CUNw7dL9.cjs +1 -0
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +361 -15
- package/dist/index.d.ts +361 -15
- package/dist/index.js +876 -835
- package/dist/json-snapshot-By4ZVVUt.js +1967 -0
- package/dist/json-snapshot-jiXff4lc.cjs +2 -0
- package/dist/matrix-0hywp0-F.cjs +1 -0
- package/dist/matrix-Dy-tyY7E.js +381 -0
- package/dist/param-validation-C-8sRJLq.cjs +1 -0
- package/dist/param-validation-CnDEd2l-.js +333 -0
- package/dist/{pdf-l3ea86di.js → pdf-CKROKygt.js} +1851 -1849
- package/dist/{pdf-B8JouyYv.cjs → pdf-DqyxJ96U.cjs} +46 -46
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +54 -0
- package/dist/pdf.d.ts +54 -0
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BBp74CQZ.js → plugin-ByjF2kiV.js} +5 -5
- package/dist/{plugin-CtFX9PFG.cjs → plugin-DM1M2wlI.cjs} +1 -1
- package/dist/prefill-B8H9qwE4.js +371 -0
- package/dist/prefill-D7EswyTI.cjs +1 -0
- package/dist/{prepared-CARicKYh.js → prepared-BE-4jfX5.js} +2 -2
- package/dist/{prepared-Ch1x_Gog.cjs → prepared-CGVphji3.cjs} +1 -1
- package/dist/{protocol-B5A2uom4.cjs → protocol-ByRVzzQG.cjs} +1 -1
- package/dist/{protocol-BaiWjq5w.js → protocol-Cr81vFSQ.js} +3 -3
- package/dist/{record-bindings-D4TuMzHs.js → record-bindings-DEJtmo3p.js} +67 -107
- package/dist/record-bindings-ehjnCDHt.cjs +1 -0
- package/dist/{region-binding-workflow-BNasF5kz.js → region-binding-workflow-CBg0l_tj.js} +1 -1
- package/dist/{region-binding-workflow-O2Cni3mF.cjs → region-binding-workflow-D05tOYn3.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/{report-params-B1RzkhJj.js → report-params-D9tBuM9B.js} +1 -1
- package/dist/{report-params-WDGrA4oP.cjs → report-params-VTg8MoCp.cjs} +1 -1
- package/dist/runtime-CDA6d263.cjs +1 -0
- package/dist/runtime-CEMvybO7.js +170 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server/node.d.cts +75 -7
- package/dist/server/node.d.ts +75 -7
- package/dist/server-node.cjs +4 -4
- package/dist/server-node.js +2692 -1990
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +243 -28
- package/dist/server.d.ts +243 -28
- package/dist/server.js +28 -28
- package/dist/sha256-BDQ1Qk7A.js +158 -0
- package/dist/sha256-DgZAKXqI.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/template-bindings-Cg5oBLFT.cjs +1 -0
- package/dist/template-bindings-TKnXM7ll.js +62 -0
- package/dist/{template-catalog-wT1fNeAP.js → template-catalog-CmbWOJqy.js} +16 -16
- package/dist/{template-catalog-Dua8h9ZA.cjs → template-catalog-Utu4GP09.cjs} +1 -1
- package/dist/{template-fragments-BajTajb4.cjs → template-fragments-C_zSHJAa.cjs} +1 -1
- package/dist/{template-fragments-DmX5XK4N.js → template-fragments-DWgo9tlZ.js} +2 -2
- package/dist/{template-outline-BwRV_eRo.cjs → template-outline-DWkzZXVC.cjs} +1 -1
- package/dist/{template-outline-cnWfT_LK.js → template-outline-DiADphlq.js} +1 -1
- package/dist/{template-registry-u11fPd8D.js → template-registry-BIhIHOab.js} +319 -314
- package/dist/template-registry-DzWswQI5.cjs +1 -0
- package/dist/vue/async.d.cts +528 -33
- package/dist/vue/async.d.ts +528 -33
- package/dist/vue/index.d.cts +616 -64
- package/dist/vue/index.d.ts +616 -64
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +94 -89
- package/dist/{workbook-session-DN5LSA5C.cjs → workbook-session-B94EwVa_.cjs} +1 -1
- package/dist/{workbook-session-B8pNW24X.js → workbook-session-BoScoOg-.js} +2 -2
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +75 -7
- package/dist/worker.d.ts +75 -7
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.d.cts +120 -13
- package/dist/xlsx.d.ts +120 -13
- package/dist/xlsx.js +313 -279
- package/package.json +1 -1
- package/dist/ParamEditor-B5UZRgxv.cjs +0 -1
- package/dist/ParamEditor-DNNARyeB.js +0 -594
- package/dist/ReportBatchPanel-Ctvs2t_9.cjs +0 -1
- package/dist/ReportPreview-BdQawRh0.js +0 -4879
- package/dist/ReportPreview-CJC_-j2I.cjs +0 -6
- package/dist/RuleEditor-DkRjOLlr.js +0 -2141
- package/dist/RuleEditor-h5anGsDB.cjs +0 -1
- package/dist/assets-BIMVwjQe.js +0 -231
- package/dist/assets-Dfs2ElxI.cjs +0 -1
- package/dist/component-tree-Ca6YYfHq.js +0 -61
- package/dist/component-tree-DkGLEfZC.cjs +0 -1
- package/dist/computed-BW5a8QFk.js +0 -612
- package/dist/computed-C2GD3XcE.cjs +0 -1
- package/dist/config-Dg_o8e7m.cjs +0 -1
- package/dist/config-XQ4qrQ7Q.js +0 -844
- package/dist/designer-D9XAxqSc.js +0 -5178
- package/dist/designer-uCDo5XSK.cjs +0 -2
- package/dist/drill-ByN8COs_.cjs +0 -1
- package/dist/drill-CKW3Xtfa.js +0 -145
- package/dist/json-snapshot-D7PE1NsU.cjs +0 -2
- package/dist/json-snapshot-DYmEe3sO.js +0 -1779
- package/dist/matrix-JLAXlux-.js +0 -302
- package/dist/matrix-gTHpDTGm.cjs +0 -1
- package/dist/param-validation-C3HlcLLO.cjs +0 -1
- package/dist/param-validation-Do7Eg8Zv.js +0 -181
- package/dist/record-bindings-B86Sur_y.cjs +0 -1
- package/dist/runtime-DakRXui3.js +0 -170
- package/dist/runtime-dL5ygIfa.cjs +0 -1
- package/dist/sha256-BshdOkCC.cjs +0 -1
- package/dist/sha256-DTG-Gq8i.js +0 -157
- package/dist/template-bindings-C2SpvsMU.js +0 -58
- package/dist/template-bindings-CEtWyiLX.cjs +0 -1
- package/dist/template-registry-CpysHAxy.cjs +0 -1
- package/dist/tree-CLpxYbKa.cjs +0 -1
- package/dist/tree-DNJorJUf.js +0 -172
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { R as y, Q as R, S as W, T as B, J as O, q as X, L as z, U as G, c as H, P as K, b as Y, r as Z } from "./json-snapshot-By4ZVVUt.js";
|
|
2
|
+
import { g as M } from "./report-params-D9tBuM9B.js";
|
|
3
|
+
import { l as $, r as ee, R as te } from "./param-validation-CnDEd2l-.js";
|
|
4
|
+
import { t as P, b as w, D as se, v as ae, c as D, R as F } from "./sha256-BDQ1Qk7A.js";
|
|
5
|
+
import { b as re } from "./template-registry-BIhIHOab.js";
|
|
6
|
+
import { T as oe } from "./column-visual-BpgQVWwT.js";
|
|
7
|
+
import { a as j } from "./assets-2eC3mOcV.js";
|
|
8
|
+
import { s as S, a as J, d as ne, e as ce, r as ie } from "./prepared-BE-4jfX5.js";
|
|
9
|
+
function k(e = []) {
|
|
10
|
+
return e.map(({ code: t, message: r, severity: n, pageIndex: s, componentIndex: a }) => ({ code: t, message: r, severity: n, path: a < 0 ? `$.pages.${s}` : `$.pages.${s}.components.${a}` }));
|
|
11
|
+
}
|
|
12
|
+
async function _(e, t, r = Date.now()) {
|
|
13
|
+
const n = e.prepared;
|
|
14
|
+
if (e.fidelity === "strict" && n.diagnostics.some((g) => g.code === "asset-render-failed" || g.code === "asset-budget-exceeded")) throw new y("validate", "严格输出拒绝已有资产渲染降级,请修复组件后重新准备报表。");
|
|
15
|
+
const s = e.format === "pdf" ? await import("@agile-team/mach-report/pdf") : void 0;
|
|
16
|
+
P(e.signal);
|
|
17
|
+
const a = e.pdf?.customFontFaces ?? (e.pdf?.customFontBytes ? { regular: e.pdf.customFontBytes } : void 0), l = s && a ? s.createFontBytesMeasurer(a) : void 0, m = R(e), p = await m.run("encode", async () => {
|
|
18
|
+
let g;
|
|
19
|
+
if (e.format === "pdf") {
|
|
20
|
+
P(e.signal);
|
|
21
|
+
const c = await s.renderPlanToPdf(n.plan, { ...e.pdf, ...l ? { measurer: l } : {}, fidelity: e.fidelity, signal: e.signal, onProgress: (f, i) => m.progress("encode", f, i) });
|
|
22
|
+
g = c.bytes, n.diagnostics.push(...k(c.diagnostics)), n.diagnostics.push(...c.fidelityWarnings.map((f) => ({ code: "pdf-fidelity", message: f, severity: "warning" })), ...c.pageErrors.map((f) => ({ code: "pdf-page", message: f, severity: "error" }))), c.unsupportedTextCount && n.diagnostics.push({ code: "pdf-font", message: `${c.unsupportedTextCount} 段文本包含当前字体不支持的字符`, severity: "warning" });
|
|
23
|
+
} else {
|
|
24
|
+
const { renderPlanToXlsx: c } = await import("@agile-team/mach-report/xlsx");
|
|
25
|
+
P(e.signal);
|
|
26
|
+
const f = await c(n.plan, { ...e.xlsx, fidelity: e.fidelity, signal: e.signal, onProgress: (i, v) => m.progress("encode", i, v) });
|
|
27
|
+
g = new Uint8Array(f.buffer), n.diagnostics.push(...k(f.diagnostics)), n.diagnostics.push(...f.warnings.map((i) => ({ code: "xlsx-fidelity", message: i, severity: "warning" }))), n.diagnostics.push(...(f.notes ?? []).map((i) => ({ code: "xlsx-snapshot", message: i, severity: "info" })));
|
|
28
|
+
}
|
|
29
|
+
return P(e.signal), g;
|
|
30
|
+
});
|
|
31
|
+
w(t, "maxOutputBytes", p.byteLength);
|
|
32
|
+
const { plan: o, ...x } = n;
|
|
33
|
+
return { ...x, bytes: p, format: e.format, contentType: e.format === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", stats: { ...x.stats, durationMs: Date.now() - r, outputBytes: p.byteLength } };
|
|
34
|
+
}
|
|
35
|
+
function q(e) {
|
|
36
|
+
return { ...e, reportIds: [...e.reportIds], ...e.params ? { params: { ...e.params } } : {} };
|
|
37
|
+
}
|
|
38
|
+
function V(e, t) {
|
|
39
|
+
if (t.length === 0) throw new y("config", "缺少报表 ID");
|
|
40
|
+
return t.map((r) => {
|
|
41
|
+
if (!Object.prototype.hasOwnProperty.call(e, r)) throw new y("config", `未注册报表 ${r}`);
|
|
42
|
+
return e[r];
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function I(e) {
|
|
46
|
+
return e.grid?.cells.reduce((t, r) => t + r.reduce((n, s) => n + (s ? 1 + (s.children?.reduce((a, l) => a + I(l), 0) ?? 0) : 0), 0), 0) ?? 0;
|
|
47
|
+
}
|
|
48
|
+
function de(e, t, r) {
|
|
49
|
+
return e.pages.reduce((n, s) => n + s.components.reduce((a, l) => l.kind !== "list" ? a + I(l) : a + Z(l, t, r), 0), 0);
|
|
50
|
+
}
|
|
51
|
+
function pe(e, t = Object.keys(e)) {
|
|
52
|
+
return V(e, t).map((r, n) => {
|
|
53
|
+
const s = t[n], a = M(e, [s]);
|
|
54
|
+
return {
|
|
55
|
+
id: s,
|
|
56
|
+
params: JSON.parse(JSON.stringify(a)),
|
|
57
|
+
paramsSchema: ee(a),
|
|
58
|
+
datasetsSchema: Object.fromEntries(Object.entries(r.dataSchema ?? {}).map(([l, m]) => [l, W(typeof r.template == "function" ? void 0 : r.template, l, m)])),
|
|
59
|
+
capabilities: {
|
|
60
|
+
save: !!r.provider?.save,
|
|
61
|
+
export: !!r.provider?.export,
|
|
62
|
+
templates: !!r.provider?.templates
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function A(e, t) {
|
|
68
|
+
V(e, t.reportIds);
|
|
69
|
+
const r = $(M(e, t.reportIds), t.params), n = t.reportIds.flatMap((a) => $(M(e, [a]), t.params).issues), s = new Map(n.map((a) => [JSON.stringify(a), a]));
|
|
70
|
+
return { ...r, ok: s.size === 0, issues: [...s.values()] };
|
|
71
|
+
}
|
|
72
|
+
function N(e, t) {
|
|
73
|
+
const r = re(e.plan);
|
|
74
|
+
if (!r.ok) throw new y("validate", `执行器返回无效计划:${r.errors[0]?.path}`);
|
|
75
|
+
const n = e.plan.pages.length, s = e.plan.pages.reduce((a, l) => a + l.components.reduce((m, p) => m + I(p), 0), 0);
|
|
76
|
+
return w(t, "maxRows", e.stats.rows), w(t, "maxPages", n), w(t, "maxCells", s), { ...e, stats: { ...e.stats, pages: n, cells: s } };
|
|
77
|
+
}
|
|
78
|
+
function U(e, t) {
|
|
79
|
+
const r = A(e.reports, t);
|
|
80
|
+
if (!r.ok) throw new te(r.issues);
|
|
81
|
+
}
|
|
82
|
+
function ve(e) {
|
|
83
|
+
const t = { ...se, ...e.budget };
|
|
84
|
+
ae(t);
|
|
85
|
+
const r = async (s, a) => {
|
|
86
|
+
const l = Date.now();
|
|
87
|
+
let m = 0, p = 0;
|
|
88
|
+
const o = [], x = {}, g = [], c = Object.fromEntries(Object.entries(e.reports).map(([d, u]) => [d, {
|
|
89
|
+
...u,
|
|
90
|
+
pagination: { ...e.pagination, ...u.pagination, ...a ? { measurer: a } : {} },
|
|
91
|
+
dataValidation: {
|
|
92
|
+
...u.dataValidation,
|
|
93
|
+
maxRows: Math.min(t.maxRows ?? 1e5, u.dataValidation?.maxRows ?? 1 / 0),
|
|
94
|
+
maxCells: Math.min(t.maxCells ?? 2e6, u.dataValidation?.maxCells ?? 1 / 0)
|
|
95
|
+
}
|
|
96
|
+
}])), i = await X(c, { maxPages: t.maxPages, maxCells: t.maxCells, maxChartComponents: t.maxChartComponents, onDatasets: (d, u, h) => {
|
|
97
|
+
try {
|
|
98
|
+
m += z(h, u, { maxRows: t.maxRows, signal: s.signal });
|
|
99
|
+
} catch (b) {
|
|
100
|
+
throw b instanceof oe ? new F("budget", b.message, "$.budget.maxRows") : b;
|
|
101
|
+
}
|
|
102
|
+
w(t, "maxRows", m), p += de(h, u, c[d]?.pagination), w(t, "maxCells", p);
|
|
103
|
+
} })({ ...s, params: s.params ?? {}, onWarning: (d) => o.push({ code: "layout", message: d, severity: "warning" }), onQueryResult: (d, u, h = 0) => {
|
|
104
|
+
const b = G(h, d);
|
|
105
|
+
Object.defineProperty(x, d, { value: { revision: u.revision, sourceToken: u.sourceToken }, enumerable: !0, writable: !0 }), g.push({ reportId: d, reportIndex: h, reportScope: b, ...u.revision === void 0 ? {} : { revision: u.revision }, ...u.sourceToken === void 0 ? {} : { sourceToken: u.sourceToken } }), o.push(...(u.diagnostics ?? []).map((C) => ({ ...C, ...C.target ? { target: {
|
|
106
|
+
...C.target,
|
|
107
|
+
reportScope: b,
|
|
108
|
+
...C.target.tableId ? { tableId: JSON.stringify([h, d, C.target.tableId]) } : {}
|
|
109
|
+
} } : {} })));
|
|
110
|
+
} }).catch((d) => {
|
|
111
|
+
throw d instanceof y && d.cause instanceof H ? new F("budget", d.cause.message, "$.budget.maxPages") : d instanceof y && d.cause instanceof K ? new F("budget", d.cause.message, "$.budget.maxCells") : d instanceof y && d.cause instanceof Y ? new F("budget", d.cause.message, "$.budget.maxChartComponents") : d;
|
|
112
|
+
});
|
|
113
|
+
P(s.signal);
|
|
114
|
+
const v = e.assets ? await R(s).run("assets", () => j(i, { ...e.assets, signal: s.signal })) : { plan: i, diagnostics: [] }, E = v.plan;
|
|
115
|
+
o.push(...k(v.diagnostics));
|
|
116
|
+
const L = E.pages.reduce((d, u) => d + u.components.reduce((h, b) => h + I(b), 0), 0);
|
|
117
|
+
w(t, "maxPages", E.pages.length), w(t, "maxCells", L);
|
|
118
|
+
const T = ie(s.pdf), Q = e.pagination?.measurer || Object.values(e.reports).some((d) => d.pagination?.measurer);
|
|
119
|
+
return { plan: E, diagnostics: o, revisions: x, sources: g, layout: { textMetrics: T ? "font-bytes" : Q ? "provided" : "heuristic", ...T ? { fontFingerprint: T } : {} }, stats: { rows: m, pages: E.pages.length, cells: L, durationMs: Date.now() - l } };
|
|
120
|
+
}, n = async (s) => {
|
|
121
|
+
const a = Date.now();
|
|
122
|
+
if (s.format !== "pdf" && s.format !== "xlsx") throw new y("config", "不支持的报表导出格式");
|
|
123
|
+
const l = s.format === "pdf" ? await import("@agile-team/mach-report/pdf") : void 0;
|
|
124
|
+
P(s.signal);
|
|
125
|
+
const m = s.pdf?.customFontFaces ?? (s.pdf?.customFontBytes ? { regular: s.pdf.customFontBytes } : void 0), p = l && m ? l.createFontBytesMeasurer(m) : void 0, o = await r(s, p);
|
|
126
|
+
return P(s.signal), _({ ...s, prepared: o }, t, a);
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
describe: (s) => pe(e.reports, s),
|
|
130
|
+
validate: (s) => A(e.reports, s),
|
|
131
|
+
prepare: (s) => D(s.signal, t.maxDurationMs, async (a) => {
|
|
132
|
+
const { signal: l, onEvent: m, ...p } = q(s), o = { ...p, ...p.pdf ? { pdf: S(p.pdf) } : {}, taskId: p.taskId ?? B() }, x = m ? (v) => O(m, v, a) : void 0, g = { ...o, signal: a, onEvent: x };
|
|
133
|
+
R(g).runSync("validate", () => U(e, o));
|
|
134
|
+
let c;
|
|
135
|
+
const f = o.pdf?.customFontFaces ?? (o.pdf?.customFontBytes ? { regular: o.pdf.customFontBytes } : void 0);
|
|
136
|
+
if (!e.executor && f) {
|
|
137
|
+
const v = await import("@agile-team/mach-report/pdf");
|
|
138
|
+
P(a), c = v.createFontBytesMeasurer(f);
|
|
139
|
+
}
|
|
140
|
+
const i = e.executor ? await e.executor.prepare(o, a, x) : await r(g, c);
|
|
141
|
+
return N(i, t);
|
|
142
|
+
}),
|
|
143
|
+
exportPrepared: (s) => D(s.signal, t.maxDurationMs, async (a) => {
|
|
144
|
+
const l = Date.now(), { signal: m, onEvent: p, ...o } = s, x = N(ne(s.prepared, t.maxPreparedBytes ?? 64e6, a), t), g = { ...o, xlsx: J(o.xlsx), prepared: x, ...o.pdf ? { pdf: S(o.pdf) } : {}, taskId: o.taskId ?? B() };
|
|
145
|
+
if (g.format !== "pdf" && g.format !== "xlsx") throw new y("config", "不支持的报表导出格式");
|
|
146
|
+
const c = p ? (i) => O(p, i, a) : void 0;
|
|
147
|
+
if (e.executor) {
|
|
148
|
+
if (!e.executor.exportPrepared) throw new y("config", "执行器未实现 exportPrepared;请升级执行器或显式使用本地运行时");
|
|
149
|
+
const i = await e.executor.exportPrepared(g, a, c);
|
|
150
|
+
return w(t, "maxRows", i.stats.rows), w(t, "maxPages", i.stats.pages), w(t, "maxCells", i.stats.cells), w(t, "maxOutputBytes", i.bytes.byteLength), { ...i, stats: { ...i.stats, outputBytes: i.bytes.byteLength } };
|
|
151
|
+
}
|
|
152
|
+
const f = { ...g, signal: a, onEvent: c };
|
|
153
|
+
if (R(f).runSync("validate", () => ce(f)), e.assets) {
|
|
154
|
+
const i = await R(f).run("assets", () => j(x.plan, { ...e.assets, signal: a }));
|
|
155
|
+
x.plan = i.plan, x.diagnostics.push(...k(i.diagnostics));
|
|
156
|
+
}
|
|
157
|
+
return _(f, t, l);
|
|
158
|
+
}),
|
|
159
|
+
export: (s) => D(s.signal, t.maxDurationMs, async (a) => {
|
|
160
|
+
const { signal: l, onEvent: m, ...p } = q(s), o = { ...p, xlsx: J(p.xlsx), ...p.pdf ? { pdf: S(p.pdf) } : {}, taskId: p.taskId ?? B() }, x = m ? (f) => O(m, f, a) : void 0, g = { ...o, signal: a, onEvent: x };
|
|
161
|
+
if (R(g).runSync("validate", () => U(e, o)), o.format !== "pdf" && o.format !== "xlsx") throw new y("config", "不支持的报表导出格式");
|
|
162
|
+
const c = e.executor ? await e.executor.export(o, a, x) : await n(g);
|
|
163
|
+
return w(t, "maxRows", c.stats.rows), w(t, "maxPages", c.stats.pages), w(t, "maxCells", c.stats.cells), w(t, "maxOutputBytes", c.bytes.byteLength), { ...c, stats: { ...c.stats, outputBytes: c.bytes.byteLength } };
|
|
164
|
+
})
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
export {
|
|
168
|
+
ve as c,
|
|
169
|
+
N as e
|
|
170
|
+
};
|
package/dist/sbom.cdx.json
CHANGED
package/dist/server/node.d.cts
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
import { WorkerOptions as WorkerOptions_2 } from 'node:worker_threads';
|
|
4
4
|
|
|
5
|
+
declare type AggregateOperation = "sum" | "count" | "avg" | "min" | "max" | "weightedAvg";
|
|
6
|
+
|
|
7
|
+
declare interface AggregateRequest {
|
|
8
|
+
op: AggregateOperation;
|
|
9
|
+
field?: string;
|
|
10
|
+
weightField?: string;
|
|
11
|
+
numeric?: "number" | "decimal";
|
|
12
|
+
digits?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
5
15
|
declare interface BrowserReportWorker {
|
|
6
16
|
postMessage(value: unknown, transfer?: Transferable[]): void;
|
|
7
17
|
terminate(): void;
|
|
@@ -105,6 +115,12 @@ export declare interface FileReportJobStoreOptions extends ReportJobStoreBudgetO
|
|
|
105
115
|
}
|
|
106
116
|
|
|
107
117
|
declare interface GridCell {
|
|
118
|
+
/** Resolved visual only. Original value, text, editability and source are unchanged. */
|
|
119
|
+
dataBar?: {
|
|
120
|
+
start: number;
|
|
121
|
+
end: number;
|
|
122
|
+
color: string;
|
|
123
|
+
};
|
|
108
124
|
/** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
|
|
109
125
|
richParagraphs?: RichParagraph[];
|
|
110
126
|
text?: string;
|
|
@@ -156,6 +172,8 @@ export declare function openFileReportDocumentStore(options: FileReportDocumentS
|
|
|
156
172
|
export declare function openFileReportJobStore(options: FileReportJobStoreOptions): Promise<FileReportJobStore>;
|
|
157
173
|
|
|
158
174
|
declare interface PlanComponent {
|
|
175
|
+
/** Template-only aggregate binding, expanded into shared primitives during layout. */
|
|
176
|
+
chartBinding?: ReportChartBinding;
|
|
159
177
|
/** Optional QR/barcode encoding configuration; no encoder is loaded by the core. */
|
|
160
178
|
code?: CodeOptions;
|
|
161
179
|
/** Template-only binding; resolved and removed before constructing the output plan. */
|
|
@@ -272,6 +290,42 @@ declare interface ReportCellSource {
|
|
|
272
290
|
sourceToken?: string;
|
|
273
291
|
}
|
|
274
292
|
|
|
293
|
+
/** Serializable binding; data and authorization continue to come from the existing report source. */
|
|
294
|
+
declare interface ReportChartBinding {
|
|
295
|
+
dataset: string;
|
|
296
|
+
categoryField: string;
|
|
297
|
+
measures: readonly ReportChartMeasure[];
|
|
298
|
+
type: ReportChartOptions["type"];
|
|
299
|
+
sort?: "asc" | "desc";
|
|
300
|
+
title?: string;
|
|
301
|
+
showValues?: boolean;
|
|
302
|
+
maxRows?: number;
|
|
303
|
+
maxCategories?: number;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
declare interface ReportChartMeasure extends AggregateRequest {
|
|
307
|
+
label?: string;
|
|
308
|
+
color?: string;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
declare interface ReportChartOptions {
|
|
312
|
+
type: "bar" | "line" | "stackedBar" | "percentBar";
|
|
313
|
+
categories: readonly string[];
|
|
314
|
+
series: readonly ReportChartSeries[];
|
|
315
|
+
leftMm: number;
|
|
316
|
+
topMm: number;
|
|
317
|
+
widthMm: number;
|
|
318
|
+
heightMm: number;
|
|
319
|
+
title?: string;
|
|
320
|
+
showValues?: boolean;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
declare interface ReportChartSeries {
|
|
324
|
+
name: string;
|
|
325
|
+
values: readonly (number | null)[];
|
|
326
|
+
color?: string;
|
|
327
|
+
}
|
|
328
|
+
|
|
275
329
|
declare interface ReportDataTarget {
|
|
276
330
|
datasetId: string;
|
|
277
331
|
field: string;
|
|
@@ -455,18 +509,17 @@ declare interface ReportJobTombstone {
|
|
|
455
509
|
|
|
456
510
|
declare type ReportLocalExport = (input: ReportRuntimePreparedExportInput) => Promise<ReportRuntimeExportResult>;
|
|
457
511
|
|
|
512
|
+
declare type ReportNumberRange = readonly [number, number];
|
|
513
|
+
|
|
458
514
|
/** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
|
|
459
515
|
declare interface ReportParamDef {
|
|
460
516
|
/** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
|
|
461
517
|
field: string;
|
|
462
518
|
/** 显示名(缺省用 field) */
|
|
463
519
|
label?: string;
|
|
464
|
-
type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select";
|
|
520
|
+
type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select" | "multiSelect" | "cascader" | "numberRange";
|
|
465
521
|
/** select 选项 */
|
|
466
|
-
options?:
|
|
467
|
-
label: string;
|
|
468
|
-
value: string;
|
|
469
|
-
}>;
|
|
522
|
+
options?: ReportParamTreeOption[];
|
|
470
523
|
/** Opaque host-resolved source key. No URL, credentials or executable code is stored. */
|
|
471
524
|
optionsSource?: string;
|
|
472
525
|
/** Select dependencies must be declared parameters; changing a parent clears descendants. */
|
|
@@ -479,6 +532,9 @@ declare interface ReportParamDef {
|
|
|
479
532
|
max?: number | string;
|
|
480
533
|
minLength?: number;
|
|
481
534
|
maxLength?: number;
|
|
535
|
+
/** multiSelect item count (maximum 100). Cascader paths are bounded to 16 levels. */
|
|
536
|
+
minItems?: number;
|
|
537
|
+
maxItems?: number;
|
|
482
538
|
}
|
|
483
539
|
|
|
484
540
|
declare interface ReportParamIssue {
|
|
@@ -488,14 +544,23 @@ declare interface ReportParamIssue {
|
|
|
488
544
|
message: string;
|
|
489
545
|
}
|
|
490
546
|
|
|
491
|
-
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength";
|
|
547
|
+
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength" | "minItems" | "maxItems";
|
|
548
|
+
|
|
549
|
+
/** Cascader values are unique within each sibling list. */
|
|
550
|
+
declare interface ReportParamTreeOption {
|
|
551
|
+
label: string;
|
|
552
|
+
value: string;
|
|
553
|
+
children?: ReportParamTreeOption[];
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
declare type ReportParamTypedValue = string | number | string[] | ReportNumberRange;
|
|
492
557
|
|
|
493
558
|
declare interface ReportParamValidation {
|
|
494
559
|
ok: boolean;
|
|
495
560
|
/** 保留历史取数契约的字符串形式;未知参数保留,不能代替接口权限白名单。 */
|
|
496
561
|
values: Record<string, string>;
|
|
497
562
|
/** JSON Schema 对应的规范值:number 参数转换为有限数字。 */
|
|
498
|
-
typedValues: Record<string,
|
|
563
|
+
typedValues: Record<string, ReportParamTypedValue>;
|
|
499
564
|
issues: ReportParamIssue[];
|
|
500
565
|
}
|
|
501
566
|
|
|
@@ -523,6 +588,8 @@ declare interface ReportRuntimeBudget {
|
|
|
523
588
|
maxRows?: number;
|
|
524
589
|
maxPages?: number;
|
|
525
590
|
maxCells?: number;
|
|
591
|
+
/** Aggregate bound-chart primitives per prepare, before expansion; default 50000, hard maximum 1000000. */
|
|
592
|
+
maxChartComponents?: number;
|
|
526
593
|
maxOutputBytes?: number;
|
|
527
594
|
/** Bound the plain JSON snapshot accepted by exportPrepared (default 64 MB). */
|
|
528
595
|
maxPreparedBytes?: number;
|
|
@@ -545,6 +612,7 @@ declare interface ReportRuntimeExportInput extends ReportRuntimeInput {
|
|
|
545
612
|
sheetMode?: "auto" | "pages" | "continuous";
|
|
546
613
|
valueMode?: "text" | "raw";
|
|
547
614
|
paperSize?: "auto" | "a3" | "a4" | "a5";
|
|
615
|
+
maxDataBars?: number;
|
|
548
616
|
sheetName?: (sheetIndex: number) => string;
|
|
549
617
|
};
|
|
550
618
|
}
|
package/dist/server/node.d.ts
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
import { WorkerOptions as WorkerOptions_2 } from 'node:worker_threads';
|
|
4
4
|
|
|
5
|
+
declare type AggregateOperation = "sum" | "count" | "avg" | "min" | "max" | "weightedAvg";
|
|
6
|
+
|
|
7
|
+
declare interface AggregateRequest {
|
|
8
|
+
op: AggregateOperation;
|
|
9
|
+
field?: string;
|
|
10
|
+
weightField?: string;
|
|
11
|
+
numeric?: "number" | "decimal";
|
|
12
|
+
digits?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
5
15
|
declare interface BrowserReportWorker {
|
|
6
16
|
postMessage(value: unknown, transfer?: Transferable[]): void;
|
|
7
17
|
terminate(): void;
|
|
@@ -105,6 +115,12 @@ export declare interface FileReportJobStoreOptions extends ReportJobStoreBudgetO
|
|
|
105
115
|
}
|
|
106
116
|
|
|
107
117
|
declare interface GridCell {
|
|
118
|
+
/** Resolved visual only. Original value, text, editability and source are unchanged. */
|
|
119
|
+
dataBar?: {
|
|
120
|
+
start: number;
|
|
121
|
+
end: number;
|
|
122
|
+
color: string;
|
|
123
|
+
};
|
|
108
124
|
/** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
|
|
109
125
|
richParagraphs?: RichParagraph[];
|
|
110
126
|
text?: string;
|
|
@@ -156,6 +172,8 @@ export declare function openFileReportDocumentStore(options: FileReportDocumentS
|
|
|
156
172
|
export declare function openFileReportJobStore(options: FileReportJobStoreOptions): Promise<FileReportJobStore>;
|
|
157
173
|
|
|
158
174
|
declare interface PlanComponent {
|
|
175
|
+
/** Template-only aggregate binding, expanded into shared primitives during layout. */
|
|
176
|
+
chartBinding?: ReportChartBinding;
|
|
159
177
|
/** Optional QR/barcode encoding configuration; no encoder is loaded by the core. */
|
|
160
178
|
code?: CodeOptions;
|
|
161
179
|
/** Template-only binding; resolved and removed before constructing the output plan. */
|
|
@@ -272,6 +290,42 @@ declare interface ReportCellSource {
|
|
|
272
290
|
sourceToken?: string;
|
|
273
291
|
}
|
|
274
292
|
|
|
293
|
+
/** Serializable binding; data and authorization continue to come from the existing report source. */
|
|
294
|
+
declare interface ReportChartBinding {
|
|
295
|
+
dataset: string;
|
|
296
|
+
categoryField: string;
|
|
297
|
+
measures: readonly ReportChartMeasure[];
|
|
298
|
+
type: ReportChartOptions["type"];
|
|
299
|
+
sort?: "asc" | "desc";
|
|
300
|
+
title?: string;
|
|
301
|
+
showValues?: boolean;
|
|
302
|
+
maxRows?: number;
|
|
303
|
+
maxCategories?: number;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
declare interface ReportChartMeasure extends AggregateRequest {
|
|
307
|
+
label?: string;
|
|
308
|
+
color?: string;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
declare interface ReportChartOptions {
|
|
312
|
+
type: "bar" | "line" | "stackedBar" | "percentBar";
|
|
313
|
+
categories: readonly string[];
|
|
314
|
+
series: readonly ReportChartSeries[];
|
|
315
|
+
leftMm: number;
|
|
316
|
+
topMm: number;
|
|
317
|
+
widthMm: number;
|
|
318
|
+
heightMm: number;
|
|
319
|
+
title?: string;
|
|
320
|
+
showValues?: boolean;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
declare interface ReportChartSeries {
|
|
324
|
+
name: string;
|
|
325
|
+
values: readonly (number | null)[];
|
|
326
|
+
color?: string;
|
|
327
|
+
}
|
|
328
|
+
|
|
275
329
|
declare interface ReportDataTarget {
|
|
276
330
|
datasetId: string;
|
|
277
331
|
field: string;
|
|
@@ -455,18 +509,17 @@ declare interface ReportJobTombstone {
|
|
|
455
509
|
|
|
456
510
|
declare type ReportLocalExport = (input: ReportRuntimePreparedExportInput) => Promise<ReportRuntimeExportResult>;
|
|
457
511
|
|
|
512
|
+
declare type ReportNumberRange = readonly [number, number];
|
|
513
|
+
|
|
458
514
|
/** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
|
|
459
515
|
declare interface ReportParamDef {
|
|
460
516
|
/** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
|
|
461
517
|
field: string;
|
|
462
518
|
/** 显示名(缺省用 field) */
|
|
463
519
|
label?: string;
|
|
464
|
-
type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select";
|
|
520
|
+
type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select" | "multiSelect" | "cascader" | "numberRange";
|
|
465
521
|
/** select 选项 */
|
|
466
|
-
options?:
|
|
467
|
-
label: string;
|
|
468
|
-
value: string;
|
|
469
|
-
}>;
|
|
522
|
+
options?: ReportParamTreeOption[];
|
|
470
523
|
/** Opaque host-resolved source key. No URL, credentials or executable code is stored. */
|
|
471
524
|
optionsSource?: string;
|
|
472
525
|
/** Select dependencies must be declared parameters; changing a parent clears descendants. */
|
|
@@ -479,6 +532,9 @@ declare interface ReportParamDef {
|
|
|
479
532
|
max?: number | string;
|
|
480
533
|
minLength?: number;
|
|
481
534
|
maxLength?: number;
|
|
535
|
+
/** multiSelect item count (maximum 100). Cascader paths are bounded to 16 levels. */
|
|
536
|
+
minItems?: number;
|
|
537
|
+
maxItems?: number;
|
|
482
538
|
}
|
|
483
539
|
|
|
484
540
|
declare interface ReportParamIssue {
|
|
@@ -488,14 +544,23 @@ declare interface ReportParamIssue {
|
|
|
488
544
|
message: string;
|
|
489
545
|
}
|
|
490
546
|
|
|
491
|
-
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength";
|
|
547
|
+
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength" | "minItems" | "maxItems";
|
|
548
|
+
|
|
549
|
+
/** Cascader values are unique within each sibling list. */
|
|
550
|
+
declare interface ReportParamTreeOption {
|
|
551
|
+
label: string;
|
|
552
|
+
value: string;
|
|
553
|
+
children?: ReportParamTreeOption[];
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
declare type ReportParamTypedValue = string | number | string[] | ReportNumberRange;
|
|
492
557
|
|
|
493
558
|
declare interface ReportParamValidation {
|
|
494
559
|
ok: boolean;
|
|
495
560
|
/** 保留历史取数契约的字符串形式;未知参数保留,不能代替接口权限白名单。 */
|
|
496
561
|
values: Record<string, string>;
|
|
497
562
|
/** JSON Schema 对应的规范值:number 参数转换为有限数字。 */
|
|
498
|
-
typedValues: Record<string,
|
|
563
|
+
typedValues: Record<string, ReportParamTypedValue>;
|
|
499
564
|
issues: ReportParamIssue[];
|
|
500
565
|
}
|
|
501
566
|
|
|
@@ -523,6 +588,8 @@ declare interface ReportRuntimeBudget {
|
|
|
523
588
|
maxRows?: number;
|
|
524
589
|
maxPages?: number;
|
|
525
590
|
maxCells?: number;
|
|
591
|
+
/** Aggregate bound-chart primitives per prepare, before expansion; default 50000, hard maximum 1000000. */
|
|
592
|
+
maxChartComponents?: number;
|
|
526
593
|
maxOutputBytes?: number;
|
|
527
594
|
/** Bound the plain JSON snapshot accepted by exportPrepared (default 64 MB). */
|
|
528
595
|
maxPreparedBytes?: number;
|
|
@@ -545,6 +612,7 @@ declare interface ReportRuntimeExportInput extends ReportRuntimeInput {
|
|
|
545
612
|
sheetMode?: "auto" | "pages" | "continuous";
|
|
546
613
|
valueMode?: "text" | "raw";
|
|
547
614
|
paperSize?: "auto" | "a3" | "a4" | "a5";
|
|
615
|
+
maxDataBars?: number;
|
|
548
616
|
sheetName?: (sheetIndex: number) => string;
|
|
549
617
|
};
|
|
550
618
|
}
|