@agile-team/mach-report 2.23.1 → 2.24.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 +8 -2
- package/dist/{ExcelBindingWizard-BrTmdo7f.cjs → ExcelBindingWizard-BV12hGiK.cjs} +1 -1
- package/dist/{ExcelBindingWizard-CcDMLO8Q.js → ExcelBindingWizard-Cy_lPjWV.js} +3 -3
- package/dist/ParamEditor-DenKjvKu.cjs +1 -0
- package/dist/ParamEditor-PyOqHzzw.js +750 -0
- package/dist/{ReportBatchPanel-CJB67WNd.js → ReportBatchPanel-8EFtMrKk.js} +2 -2
- package/dist/{ReportBatchPanel-CHxBtG9R.cjs → ReportBatchPanel-pQ6d0yqJ.cjs} +1 -1
- package/dist/ReportLabelStudio-B_KF3Zc_.cjs +1 -0
- package/dist/{ReportLabelStudio-Tplc1TLJ.js → ReportLabelStudio-HUeo2TsU.js} +68 -68
- package/dist/ReportParamPanel-8xR85nz-.cjs +1 -0
- package/dist/{ReportParamPanel-GI43aGa0.js → ReportParamPanel-DA-YpkvC.js} +328 -298
- package/dist/ReportPreview-CyUXJSVX.cjs +6 -0
- package/dist/ReportPreview-_wTJnsG1.js +7120 -0
- package/dist/{ReportTemplateLibrary-BFQIX0sg.cjs → ReportTemplateLibrary-CjArKxRG.cjs} +1 -1
- package/dist/{ReportTemplateLibrary-KqX4E2sN.js → ReportTemplateLibrary-DH8jl9IF.js} +28 -28
- package/dist/RuleEditor-Bmj98oC4.cjs +1 -0
- package/dist/{RuleEditor-OPX1awrH.js → RuleEditor-GDydlEHz.js} +846 -834
- package/dist/{TemplateOutlinePanel-CVYKVLv_.cjs → TemplateOutlinePanel-B554_qk1.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-DQS-eOs6.js → TemplateOutlinePanel-DjPqzU9h.js} +10 -10
- package/dist/{TemplateReusePanel-CY6O93Zk.cjs → TemplateReusePanel-D0628OYc.cjs} +1 -1
- package/dist/{TemplateReusePanel-DKXiFTyB.js → TemplateReusePanel-DtYbCN7U.js} +2 -2
- package/dist/TemplateReviewPanel-CSwvCz3f.cjs +1 -0
- package/dist/TemplateReviewPanel-D_FR4ISq.js +602 -0
- package/dist/artifact-integrity.json +94 -94
- package/dist/assets-B4AJIOTB.cjs +1 -0
- package/dist/assets-D0FbszhB.js +137 -0
- package/dist/{auto-BB99S802.js → auto-BksreoKc.js} +5 -5
- package/dist/auto-C3mGqzJ8.cjs +1 -0
- package/dist/capabilities-CTwlcl8q.cjs +1 -0
- package/dist/capabilities-lqDEZSq5.js +121 -0
- package/dist/data-bar-2NLRzOCQ.cjs +1 -0
- package/dist/{data-bar-IkI6VvMQ.js → data-bar-BnGtnJ82.js} +1 -1
- package/dist/designer-BNf7NWd6.js +7589 -0
- package/dist/designer-DWnZZ_ej.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +137 -4
- package/dist/designer.d.ts +137 -4
- package/dist/designer.js +5 -5
- package/dist/diagnostic-collector-1sqd7DQP.js +355 -0
- package/dist/diagnostic-collector-D3rlvxm3.cjs +1 -0
- package/dist/{dom-JWrchIre.js → dom-C90cTM6Y.js} +4 -4
- package/dist/dom-CxOkm_Sy.cjs +1 -0
- package/dist/{encoding-7lquyj0w.cjs → encoding-CkziAnZI.cjs} +1 -1
- package/dist/{encoding-CEd-dq9A.js → encoding-DSc9zv2F.js} +2 -2
- package/dist/{font-loader-D8pI87fL.cjs → font-loader-D-znWNWS.cjs} +1 -1
- package/dist/{font-loader-CNWXomuV.js → font-loader-i7lZbqH_.js} +1 -1
- package/dist/{grid-strokes-EoY66L2f.js → grid-strokes-BPiV1WHe.js} +1 -1
- package/dist/grid-strokes-DYf-6DMl.cjs +1 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +46 -7
- package/dist/index.d.ts +46 -7
- package/dist/index.js +69 -68
- package/dist/{json-snapshot-BRnzKudk.js → json-snapshot-BJWZNryO.js} +919 -791
- package/dist/json-snapshot-C7QZrRBf.cjs +2 -0
- package/dist/{pdf-CJToa81Z.js → pdf-0_5XiTCx.js} +2499 -2492
- package/dist/{pdf-DpMkW72B.cjs → pdf-DWuq6uxx.cjs} +31 -31
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +18 -0
- package/dist/pdf.d.ts +18 -0
- package/dist/pdf.js +2 -2
- package/dist/{plugin-_BkUVc2z.js → plugin-B1ydqEmS.js} +1 -1
- package/dist/{plugin-BWTp-X7b.cjs → plugin-BQBz2vLG.cjs} +1 -1
- package/dist/prefill-2p9wrpn9.cjs +1 -0
- package/dist/{prefill-CWGdnqQd.js → prefill-Cuzh1wxf.js} +13 -13
- package/dist/prepared-CVbgO9KR.js +128 -0
- package/dist/prepared-DAwe8Il2.cjs +1 -0
- package/dist/protocol-BOri9qJL.js +105 -0
- package/dist/protocol-DD5dHSz-.cjs +1 -0
- package/dist/record-bindings-CAyM5tGg.cjs +1 -0
- package/dist/{record-bindings-DatJZv_e.js → record-bindings-fhav-NLG.js} +1 -1
- package/dist/{region-binding-workflow-DjrXuR1q.js → region-binding-workflow-Cm4mqhih.js} +2 -2
- package/dist/{region-binding-workflow-l7NGfagJ.cjs → region-binding-workflow-DWCUgjZl.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/rich-text-layout-X9YOz1JD.cjs +3 -0
- package/dist/{rich-text-layout-Ciwa6D2o.js → rich-text-layout-YJHtCWQI.js} +1 -1
- package/dist/runtime-BpSAgOw1.js +201 -0
- package/dist/runtime-Cd2UTnwe.cjs +1 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server/node.d.cts +55 -7
- package/dist/server/node.d.ts +55 -7
- package/dist/server-node.cjs +5 -5
- package/dist/server-node.js +2721 -2430
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +47 -12
- package/dist/server.d.ts +47 -12
- package/dist/server.js +8 -8
- package/dist/style.css +1 -1
- package/dist/{template-catalog-DtrtT1FY.cjs → template-catalog--yBX169M.cjs} +1 -1
- package/dist/{template-catalog-CRuZL3pi.js → template-catalog-Bu7s7ReF.js} +3 -3
- package/dist/template-fragments-5EzVn7bm.cjs +1 -0
- package/dist/{template-fragments-CPpGpQoz.js → template-fragments-Di2vDFnx.js} +2 -2
- package/dist/{template-registry-O0hNIOfB.js → template-registry-BCBF2b8j.js} +10 -10
- package/dist/template-registry-Bnh5aEYf.cjs +1 -0
- package/dist/textwrap-BPFxhpOw.cjs +4 -0
- package/dist/{textwrap-D4ZksyMK.js → textwrap-CmVkhMhx.js} +1 -1
- package/dist/vue/async.d.cts +97 -18
- package/dist/vue/async.d.ts +97 -18
- package/dist/vue/index.d.cts +127 -28
- package/dist/vue/index.d.ts +127 -28
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +192 -162
- package/dist/{workbook-session-C9ZmCBwY.js → workbook-session-B6P_-5a4.js} +2 -2
- package/dist/{workbook-session-C6-SrnCT.cjs → workbook-session-BnPK3T58.cjs} +1 -1
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +55 -7
- package/dist/worker.d.ts +55 -7
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.d.cts +18 -1
- package/dist/xlsx.d.ts +18 -1
- package/dist/xlsx.js +279 -272
- package/package.json +1 -1
- package/dist/ParamEditor-BGjovFUe.js +0 -737
- package/dist/ParamEditor-CeNp4_zQ.cjs +0 -1
- package/dist/ReportLabelStudio-g8PkqJWn.cjs +0 -1
- package/dist/ReportParamPanel-C7fZTllk.cjs +0 -1
- package/dist/ReportPreview-BoGBGyRr.cjs +0 -6
- package/dist/ReportPreview-QLONCyci.js +0 -6257
- package/dist/RuleEditor-BZUP9yvL.cjs +0 -1
- package/dist/TemplateReviewPanel-DbeNC8Ms.cjs +0 -1
- package/dist/TemplateReviewPanel-Dijwm9YE.js +0 -593
- package/dist/assets-D2gHc4Mz.cjs +0 -1
- package/dist/assets-T_gDeFaz.js +0 -132
- package/dist/auto-BrPWo7Xm.cjs +0 -1
- package/dist/capabilities-DiBj4Qgl.cjs +0 -1
- package/dist/capabilities-pg7j7VLT.js +0 -106
- package/dist/data-bar-CeZuFmYl.cjs +0 -1
- package/dist/designer-BZoVWTgl.js +0 -7172
- package/dist/designer-zS2uKJmY.cjs +0 -2
- package/dist/dom-ChE5D-L-.cjs +0 -1
- package/dist/grid-strokes-Be24LGuV.cjs +0 -1
- package/dist/json-snapshot-DNiIbpOr.cjs +0 -2
- package/dist/prefill-PaAy6wLk.cjs +0 -1
- package/dist/prepared-CJy_qk7d.js +0 -94
- package/dist/prepared-D0yCSxSO.cjs +0 -1
- package/dist/progress-ByiOxUD3.js +0 -250
- package/dist/progress-WomPRP3B.cjs +0 -1
- package/dist/protocol-BG16rz6D.js +0 -90
- package/dist/protocol-wzhl1Fim.cjs +0 -1
- package/dist/record-bindings-MBxbeBsi.cjs +0 -1
- package/dist/rich-text-layout-DK7A_a5r.cjs +0 -3
- package/dist/runtime-DYMOS_gz.cjs +0 -1
- package/dist/runtime-PiCax9zQ.js +0 -171
- package/dist/template-fragments-GVjpew_q.cjs +0 -1
- package/dist/template-registry-DI59PXVK.cjs +0 -1
- package/dist/textwrap-DEHqAjKZ.cjs +0 -4
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
const G = 1.35, K = 10.5, W = '"Microsoft YaHei", sans-serif', q = 0.75, z = "#333333", F = "#000000", k = "1.0.0-mach", V = 25.4, Y = 96;
|
|
2
|
-
function O(t = 96) {
|
|
3
|
-
return t / 25.4;
|
|
4
|
-
}
|
|
5
|
-
function X(t, e = 96) {
|
|
6
|
-
return (t || 0) * O(e);
|
|
7
|
-
}
|
|
8
|
-
function Z(t, e = 96) {
|
|
9
|
-
return t / O(e);
|
|
10
|
-
}
|
|
11
|
-
function v(t, e = 96) {
|
|
12
|
-
return t * e / 72;
|
|
13
|
-
}
|
|
14
|
-
function J(t, e) {
|
|
15
|
-
const n = 10 ** e;
|
|
16
|
-
return Math.round(t * n) / n;
|
|
17
|
-
}
|
|
18
|
-
const Q = {
|
|
19
|
-
a3: { widthMm: 297, heightMm: 420 },
|
|
20
|
-
a4: { widthMm: 210, heightMm: 297 },
|
|
21
|
-
a5: { widthMm: 148, heightMm: 210 },
|
|
22
|
-
b4: { widthMm: 250, heightMm: 353 },
|
|
23
|
-
b5: { widthMm: 176, heightMm: 250 }
|
|
24
|
-
};
|
|
25
|
-
function tt(t, e = 96, n = 10.5) {
|
|
26
|
-
if (t?.fontSizePx != null)
|
|
27
|
-
return { fontSizePt: t.fontSizePx * 72 / e, fontSizePx: t.fontSizePx };
|
|
28
|
-
const o = t?.fontSize ?? n;
|
|
29
|
-
return { fontSizePt: o, fontSizePx: v(o, e) };
|
|
30
|
-
}
|
|
31
|
-
function et(t, e = z) {
|
|
32
|
-
return {
|
|
33
|
-
color: t?.borderColor ?? t?.lineColor ?? e,
|
|
34
|
-
widthPt: t?.lineWidthPt ?? 0.75
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function nt(t, e = F) {
|
|
38
|
-
return t?.color ?? e;
|
|
39
|
-
}
|
|
40
|
-
function ot(t) {
|
|
41
|
-
return t?.lineHeight ?? 1.35;
|
|
42
|
-
}
|
|
43
|
-
function rt(t) {
|
|
44
|
-
const e = t?.borderTop !== !1, n = t?.borderRight !== !1, o = t?.borderBottom !== !1, i = t?.borderLeft !== !1;
|
|
45
|
-
return { top: e, right: n, bottom: o, left: i, inner: e || n || o || i };
|
|
46
|
-
}
|
|
47
|
-
function st(t, e) {
|
|
48
|
-
const n = { ...t, ...e };
|
|
49
|
-
return e?.fontSize != null && e.fontSizePx == null && delete n.fontSizePx, e?.fontSizePx != null && e.fontSize == null && delete n.fontSize, n;
|
|
50
|
-
}
|
|
51
|
-
function H(t, e) {
|
|
52
|
-
const n = t.length;
|
|
53
|
-
if (n === 0) return [];
|
|
54
|
-
const o = t.reduce((f, h) => f + h, 0), i = o > 0 && e > 0 ? e / o : 1, a = [];
|
|
55
|
-
let u = 0;
|
|
56
|
-
for (let f = 0; f < n; f++) {
|
|
57
|
-
const h = Math.max(0, t[f] * i);
|
|
58
|
-
a.push({ pos: u, size: h }), u += h;
|
|
59
|
-
}
|
|
60
|
-
return a;
|
|
61
|
-
}
|
|
62
|
-
function L(t, e, n) {
|
|
63
|
-
return t?.length ? H(t, e) : Array.from({ length: n }, (o, i) => ({
|
|
64
|
-
pos: e * i / n,
|
|
65
|
-
size: e / n
|
|
66
|
-
}));
|
|
67
|
-
}
|
|
68
|
-
function it(t, e, n) {
|
|
69
|
-
const o = t.cells ?? [], i = Math.max(o.length, 1), a = t.colWidthsMm?.length ?? o.reduce((r, s) => Math.max(r, Array.isArray(s) ? s.length : 0), 1), u = L(t.colWidthsMm, e, a), f = (r) => r <= 0 ? 0 : r >= a ? u[u.length - 1].pos + u[u.length - 1].size : u[r].pos, h = L(t.rowHeightsMm, n, i), S = (r) => r <= 0 ? 0 : r >= i ? h[h.length - 1].pos + h[h.length - 1].size : h[r].pos, w = /* @__PURE__ */ new Set(), g = (r, s) => `${r}:${s}`, T = [], M = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Set(), x = (r, s) => `v${r}:${s}`, y = (r, s) => `h${r}:${s}`;
|
|
70
|
-
o.forEach((r, s) => {
|
|
71
|
-
if (!Array.isArray(r)) return;
|
|
72
|
-
let c = 0;
|
|
73
|
-
for (const m of r) {
|
|
74
|
-
for (; c < a && w.has(g(s, c)); ) c++;
|
|
75
|
-
if (c >= a) break;
|
|
76
|
-
const I = Math.max(1, Math.min(m?.colSpan ?? 1, a - c)), $ = Math.max(1, m?.rowSpan ?? 1), E = Math.min(i, s + $), p = Math.min(a, c + I);
|
|
77
|
-
for (let d = s; d < E; d++)
|
|
78
|
-
for (let l = c; l < p; l++)
|
|
79
|
-
w.add(g(d, l));
|
|
80
|
-
for (let d = c + 1; d < p; d++)
|
|
81
|
-
for (let l = s; l < E; l++) M.add(x(d, l));
|
|
82
|
-
for (let d = s + 1; d < E; d++)
|
|
83
|
-
for (let l = c; l < p; l++) _.add(y(d, l));
|
|
84
|
-
const D = f(c), C = S(s);
|
|
85
|
-
T.push({
|
|
86
|
-
ri: s,
|
|
87
|
-
ci: c,
|
|
88
|
-
cell: m ?? {},
|
|
89
|
-
xMm: D,
|
|
90
|
-
yMm: C,
|
|
91
|
-
widthMm: f(p) - D,
|
|
92
|
-
heightMm: S(E) - C
|
|
93
|
-
}), c = p;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
const b = [];
|
|
97
|
-
for (let r = 1; r < a; r++) {
|
|
98
|
-
let s = -1;
|
|
99
|
-
for (let c = 0; c <= i; c++) {
|
|
100
|
-
const m = c < i && !M.has(x(r, c));
|
|
101
|
-
m && s < 0 && (s = c), !m && s >= 0 && (b.push({ kind: "v", pos: f(r), from: S(s), to: S(c) }), s = -1);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
for (let r = 1; r < i; r++) {
|
|
105
|
-
let s = -1;
|
|
106
|
-
for (let c = 0; c <= a; c++) {
|
|
107
|
-
const m = c < a && !_.has(y(r, c));
|
|
108
|
-
m && s < 0 && (s = c), !m && s >= 0 && (b.push({ kind: "h", pos: S(r), from: f(s), to: f(c) }), s = -1);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return { columns: u, rows: h, cells: T, edges: b };
|
|
112
|
-
}
|
|
113
|
-
function ct(t) {
|
|
114
|
-
if (!t || typeof t != "object" || Array.isArray(t)) return !1;
|
|
115
|
-
const { start: e, end: n, color: o } = t;
|
|
116
|
-
return typeof e == "number" && typeof n == "number" && Number.isFinite(e) && Number.isFinite(n) && e >= 0 && n <= 1 && e <= n && typeof o == "string" && /^#[0-9a-f]{6}$/i.test(o);
|
|
117
|
-
}
|
|
118
|
-
const at = k;
|
|
119
|
-
function ft(t) {
|
|
120
|
-
return (t.kind === "image" || t.kind === "barcode" || t.kind === "qrcode" || t.kind === "chart") && !!t.imageData;
|
|
121
|
-
}
|
|
122
|
-
function ut(t) {
|
|
123
|
-
return t.kind === "text" && Array.isArray(t.richParagraphs) && t.richParagraphs.length > 0;
|
|
124
|
-
}
|
|
125
|
-
function A(t) {
|
|
126
|
-
return !!t && typeof t == "object";
|
|
127
|
-
}
|
|
128
|
-
function R(t, e, n, o, i) {
|
|
129
|
-
if (++i.nodes > 1e6) return { path: e, message: "组件树超过100万个结构节点预算" };
|
|
130
|
-
if (A(t)) {
|
|
131
|
-
if (n > 64) return { path: e, message: "组件嵌套超过64层预算" };
|
|
132
|
-
if (o.has(t)) return { path: e, message: "组件树包含循环引用" };
|
|
133
|
-
if (!(!A(t.grid) || !Array.isArray(t.grid.cells))) {
|
|
134
|
-
o.add(t);
|
|
135
|
-
try {
|
|
136
|
-
for (const [a, u] of t.grid.cells.entries())
|
|
137
|
-
if (Array.isArray(u))
|
|
138
|
-
for (const [f, h] of u.entries()) {
|
|
139
|
-
if (++i.nodes > 1e6) return { path: e, message: "组件树超过100万个结构节点预算" };
|
|
140
|
-
if (!(!A(h) || !Array.isArray(h.children)))
|
|
141
|
-
for (const [S, w] of h.children.entries()) {
|
|
142
|
-
const g = R(w, `${e}.grid.cells.${a}.${f}.children.${S}`, n + 1, o, i);
|
|
143
|
-
if (g) return g;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
} finally {
|
|
147
|
-
o.delete(t);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function N(t, e = "$.components", n = { nodes: 0 }) {
|
|
153
|
-
for (const [o, i] of t.entries()) {
|
|
154
|
-
const a = R(i, `${e}.${o}`, 0, /* @__PURE__ */ new Set(), n);
|
|
155
|
-
if (a) return a;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function B(t) {
|
|
159
|
-
const e = { nodes: 0 };
|
|
160
|
-
for (const [n, o] of t.entries()) {
|
|
161
|
-
if (!A(o) || !Array.isArray(o.components)) continue;
|
|
162
|
-
const i = N(o.components, `$.pages.${n}.components`, e);
|
|
163
|
-
if (i) return i;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function ht(t) {
|
|
167
|
-
const e = B(t.pages);
|
|
168
|
-
if (e) throw new TypeError(`${e.path}: ${e.message}`);
|
|
169
|
-
}
|
|
170
|
-
function P(t) {
|
|
171
|
-
if (t?.aborted) throw t.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
172
|
-
}
|
|
173
|
-
function U(t) {
|
|
174
|
-
try {
|
|
175
|
-
Promise.resolve(t()).catch(() => {
|
|
176
|
-
});
|
|
177
|
-
} catch {
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
function j(t, e, n) {
|
|
181
|
-
P(t.signal), U(() => t.onProgress?.(e, n)), P(t.signal);
|
|
182
|
-
}
|
|
183
|
-
function dt(t, e) {
|
|
184
|
-
const n = Promise.resolve(t);
|
|
185
|
-
return e?.aborted ? (n.catch(() => {
|
|
186
|
-
}), Promise.reject(e.reason ?? new DOMException("The operation was aborted.", "AbortError"))) : e ? new Promise((o, i) => {
|
|
187
|
-
const a = () => e.removeEventListener("abort", u), u = () => {
|
|
188
|
-
a(), i(e.reason ?? new DOMException("The operation was aborted.", "AbortError"));
|
|
189
|
-
};
|
|
190
|
-
e.addEventListener("abort", u, { once: !0 }), n.then((f) => {
|
|
191
|
-
a(), o(f);
|
|
192
|
-
}, (f) => {
|
|
193
|
-
a(), i(f);
|
|
194
|
-
}), e.aborted && u();
|
|
195
|
-
}) : n;
|
|
196
|
-
}
|
|
197
|
-
function lt(t, e) {
|
|
198
|
-
const n = () => e.abort(t?.reason);
|
|
199
|
-
return t?.addEventListener("abort", n, { once: !0 }), t?.aborted && n(), () => t?.removeEventListener("abort", n);
|
|
200
|
-
}
|
|
201
|
-
async function mt(t, e, n) {
|
|
202
|
-
j(t, e, n), (t.signal || t.onProgress) && await new Promise((o) => setTimeout(o, 0)), P(t.signal);
|
|
203
|
-
}
|
|
204
|
-
function St(t) {
|
|
205
|
-
let e = 0, n = Date.now();
|
|
206
|
-
return (o = 1) => {
|
|
207
|
-
if (P(t.signal), e += o, !(e < 4096 && Date.now() - n < 8))
|
|
208
|
-
return e = 0, new Promise((i) => setTimeout(i, 0)).then(() => {
|
|
209
|
-
n = Date.now(), P(t.signal);
|
|
210
|
-
});
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
export {
|
|
214
|
-
N as A,
|
|
215
|
-
B,
|
|
216
|
-
Y as C,
|
|
217
|
-
W as D,
|
|
218
|
-
ht as E,
|
|
219
|
-
G as L,
|
|
220
|
-
V as M,
|
|
221
|
-
Q as P,
|
|
222
|
-
at as R,
|
|
223
|
-
k as S,
|
|
224
|
-
tt as a,
|
|
225
|
-
ot as b,
|
|
226
|
-
nt as c,
|
|
227
|
-
et as d,
|
|
228
|
-
rt as e,
|
|
229
|
-
ut as f,
|
|
230
|
-
F as g,
|
|
231
|
-
q as h,
|
|
232
|
-
ft as i,
|
|
233
|
-
K as j,
|
|
234
|
-
z as k,
|
|
235
|
-
X as l,
|
|
236
|
-
st as m,
|
|
237
|
-
O as n,
|
|
238
|
-
mt as o,
|
|
239
|
-
v as p,
|
|
240
|
-
Z as q,
|
|
241
|
-
it as r,
|
|
242
|
-
J as s,
|
|
243
|
-
St as t,
|
|
244
|
-
U as u,
|
|
245
|
-
P as v,
|
|
246
|
-
dt as w,
|
|
247
|
-
j as x,
|
|
248
|
-
ct as y,
|
|
249
|
-
lt as z
|
|
250
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const G='"Microsoft YaHei", sans-serif';const I="#333333",F="#000000",y="1.0.0-mach";function M(e=96){return e/25.4}function K(e,t=96){return(e||0)*M(t)}function V(e,t=96){return e/M(t)}function N(e,t=96){return e*t/72}function j(e,t){const o=10**t;return Math.round(e*o)/o}const W={a3:{widthMm:297,heightMm:420},a4:{widthMm:210,heightMm:297},a5:{widthMm:148,heightMm:210},b4:{widthMm:250,heightMm:353},b5:{widthMm:176,heightMm:250}};function Y(e,t=96,o=10.5){if(e?.fontSizePx!=null)return{fontSizePt:e.fontSizePx*72/t,fontSizePx:e.fontSizePx};const n=e?.fontSize??o;return{fontSizePt:n,fontSizePx:N(n,t)}}function X(e,t=I){return{color:e?.borderColor??e?.lineColor??t,widthPt:e?.lineWidthPt??.75}}function Z(e,t=F){return e?.color??t}function q(e){return e?.lineHeight??1.35}function J(e){const t=e?.borderTop!==!1,o=e?.borderRight!==!1,n=e?.borderBottom!==!1,i=e?.borderLeft!==!1;return{top:t,right:o,bottom:n,left:i,inner:t||o||n||i}}function Q(e,t){const o={...e,...t};return t?.fontSize!=null&&t.fontSizePx==null&&delete o.fontSizePx,t?.fontSizePx!=null&&t.fontSize==null&&delete o.fontSize,o}function ee(e,t){const o=e.length;if(o===0)return[];const n=e.reduce((a,d)=>a+d,0),i=n>0&&t>0?t/n:1,u=[];let f=0;for(let a=0;a<o;a++){const d=Math.max(0,e[a]*i);u.push({pos:f,size:d}),f+=d}return u}function C(e,t,o){return e?.length?ee(e,t):Array.from({length:o},(n,i)=>({pos:t*i/o,size:t/o}))}function te(e,t,o){const n=e.cells??[],i=Math.max(n.length,1),u=e.colWidthsMm?.length??n.reduce((r,s)=>Math.max(r,Array.isArray(s)?s.length:0),1),f=C(e.colWidthsMm,t,u),a=r=>r<=0?0:r>=u?f[f.length-1].pos+f[f.length-1].size:f[r].pos,d=C(e.rowHeightsMm,o,i),E=r=>r<=0?0:r>=i?d[d.length-1].pos+d[d.length-1].size:d[r].pos,P=new Set,S=(r,s)=>`${r}:${s}`,w=[],O=new Set,b=new Set,D=(r,s)=>`v${r}:${s}`,x=(r,s)=>`h${r}:${s}`;n.forEach((r,s)=>{if(!Array.isArray(r))return;let c=0;for(const m of r){for(;c<u&&P.has(S(s,c));)c++;if(c>=u)break;const k=Math.max(1,Math.min(m?.colSpan??1,u-c)),U=Math.max(1,m?.rowSpan??1),p=Math.min(i,s+U),_=Math.min(u,c+k);for(let l=s;l<p;l++)for(let h=c;h<_;h++)P.add(S(l,h));for(let l=c+1;l<_;l++)for(let h=s;h<p;h++)O.add(D(l,h));for(let l=s+1;l<p;l++)for(let h=c;h<_;h++)b.add(x(l,h));const L=a(c),R=E(s);w.push({ri:s,ci:c,cell:m??{},xMm:L,yMm:R,widthMm:a(_)-L,heightMm:E(p)-R}),c=_}});const g=[];for(let r=1;r<u;r++){let s=-1;for(let c=0;c<=i;c++){const m=c<i&&!O.has(D(r,c));m&&s<0&&(s=c),!m&&s>=0&&(g.push({kind:"v",pos:a(r),from:E(s),to:E(c)}),s=-1)}}for(let r=1;r<i;r++){let s=-1;for(let c=0;c<=u;c++){const m=c<u&&!b.has(x(r,c));m&&s<0&&(s=c),!m&&s>=0&&(g.push({kind:"h",pos:E(r),from:a(s),to:a(c)}),s=-1)}}return{columns:f,rows:d,cells:w,edges:g}}function oe(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const{start:t,end:o,color:n}=e;return typeof t=="number"&&typeof o=="number"&&Number.isFinite(t)&&Number.isFinite(o)&&t>=0&&o<=1&&t<=o&&typeof n=="string"&&/^#[0-9a-f]{6}$/i.test(n)}const ne=y;function re(e){return(e.kind==="image"||e.kind==="barcode"||e.kind==="qrcode"||e.kind==="chart")&&!!e.imageData}function se(e){return e.kind==="text"&&Array.isArray(e.richParagraphs)&&e.richParagraphs.length>0}function A(e){return!!e&&typeof e=="object"}function H(e,t,o,n,i){if(++i.nodes>1e6)return{path:t,message:"组件树超过100万个结构节点预算"};if(A(e)){if(o>64)return{path:t,message:"组件嵌套超过64层预算"};if(n.has(e))return{path:t,message:"组件树包含循环引用"};if(!(!A(e.grid)||!Array.isArray(e.grid.cells))){n.add(e);try{for(const[u,f]of e.grid.cells.entries())if(Array.isArray(f))for(const[a,d]of f.entries()){if(++i.nodes>1e6)return{path:t,message:"组件树超过100万个结构节点预算"};if(!(!A(d)||!Array.isArray(d.children)))for(const[E,P]of d.children.entries()){const S=H(P,`${t}.grid.cells.${u}.${a}.children.${E}`,o+1,n,i);if(S)return S}}}finally{n.delete(e)}}}}function v(e,t="$.components",o={nodes:0}){for(const[n,i]of e.entries()){const u=H(i,`${t}.${n}`,0,new Set,o);if(u)return u}}function $(e){const t={nodes:0};for(const[o,n]of e.entries()){if(!A(n)||!Array.isArray(n.components))continue;const i=v(n.components,`$.pages.${o}.components`,t);if(i)return i}}function ie(e){const t=$(e.pages);if(t)throw new TypeError(`${t.path}: ${t.message}`)}function T(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted.","AbortError")}function z(e){try{Promise.resolve(e()).catch(()=>{})}catch{}}function B(e,t,o){T(e.signal),z(()=>e.onProgress?.(t,o)),T(e.signal)}function ce(e,t){const o=Promise.resolve(e);return t?.aborted?(o.catch(()=>{}),Promise.reject(t.reason??new DOMException("The operation was aborted.","AbortError"))):t?new Promise((n,i)=>{const u=()=>t.removeEventListener("abort",f),f=()=>{u(),i(t.reason??new DOMException("The operation was aborted.","AbortError"))};t.addEventListener("abort",f,{once:!0}),o.then(a=>{u(),n(a)},a=>{u(),i(a)}),t.aborted&&f()}):o}function ue(e,t){const o=()=>t.abort(e?.reason);return e?.addEventListener("abort",o,{once:!0}),e?.aborted&&o(),()=>e?.removeEventListener("abort",o)}async function ae(e,t,o){B(e,t,o),(e.signal||e.onProgress)&&await new Promise(n=>setTimeout(n,0)),T(e.signal)}function fe(e){let t=0,o=Date.now();return(n=1)=>{if(T(e.signal),t+=n,!(t<4096&&Date.now()-o<8))return t=0,new Promise(i=>setTimeout(i,0)).then(()=>{o=Date.now(),T(e.signal)})}}exports.CSS_DPI=96;exports.DEFAULT_BORDER_PT=.75;exports.DEFAULT_FONT_FAMILY=G;exports.DEFAULT_FONT_PT=10.5;exports.DEFAULT_STROKE_COLOR=I;exports.DEFAULT_TEXT_COLOR=F;exports.LINE_HEIGHT=1.35;exports.MM_PER_INCH=25.4;exports.PAPER_SIZES=W;exports.RENDER_PLAN_SCHEMA_VERSION=ne;exports.SCHEMA_VERSION_MACH=y;exports.assertBoundedRenderTree=ie;exports.assertOutputActive=T;exports.componentTreeIssue=v;exports.createOutputScheduler=fe;exports.forwardOutputAbort=ue;exports.isImageBackedComponent=re;exports.isRichText=se;exports.mergeComponentStyles=Q;exports.mmToPx=K;exports.mmToPxFactor=M;exports.notifyOutputProgress=B;exports.observeOutput=z;exports.outputCheckpoint=ae;exports.ptToPx=N;exports.pxToMm=V;exports.renderTreeIssue=$;exports.resolveBoxBorders=J;exports.resolveFontSize=Y;exports.resolveGridLayout=te;exports.resolveLineHeight=q;exports.resolveStroke=X;exports.resolveTextColor=Z;exports.round=j;exports.validDataBar=oe;exports.waitForOutput=ce;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { d as f } from "./prepared-CJy_qk7d.js";
|
|
2
|
-
import { v as a } from "./json-snapshot-BRnzKudk.js";
|
|
3
|
-
import { b as p } from "./template-registry-O0hNIOfB.js";
|
|
4
|
-
const i = "mach-report-worker/1";
|
|
5
|
-
class I extends Error {
|
|
6
|
-
constructor(r) {
|
|
7
|
-
super(r.message), this.name = r.name, this.code = r.code, this.path = r.path, this.issues = r.issues, this.diagnostics = r.diagnostics;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
function e(t) {
|
|
11
|
-
return !!t && typeof t == "object" && !Array.isArray(t);
|
|
12
|
-
}
|
|
13
|
-
function c(t) {
|
|
14
|
-
return e(t) ? ["rows", "pages", "cells"].every((r) => typeof t[r] == "number" && Number.isSafeInteger(t[r]) && t[r] >= 0) && typeof t.durationMs == "number" && Number.isFinite(t.durationMs) && t.durationMs >= 0 : !1;
|
|
15
|
-
}
|
|
16
|
-
function d(t) {
|
|
17
|
-
return Array.isArray(t) && t.every((r) => e(r) && typeof r.code == "string" && typeof r.message == "string" && ["info", "warning", "error"].includes(r.severity) && a(r));
|
|
18
|
-
}
|
|
19
|
-
function m(t) {
|
|
20
|
-
return e(t) && Object.values(t).every((r) => e(r) && (r.revision === void 0 || typeof r.revision == "string") && (r.sourceToken === void 0 || typeof r.sourceToken == "string"));
|
|
21
|
-
}
|
|
22
|
-
function y(t) {
|
|
23
|
-
return t === void 0 ? !0 : e(t) && ["heuristic", "provided", "font-bytes"].includes(t.textMetrics) && (t.fontFingerprint === void 0 || typeof t.fontFingerprint == "string" && /^[a-f0-9]{64}$/.test(t.fontFingerprint));
|
|
24
|
-
}
|
|
25
|
-
function R(t, r) {
|
|
26
|
-
if (!e(t) || !c(t.stats) || !d(t.diagnostics) || !m(t.revisions) || !y(t.layout) || !f(t.sources)) return !1;
|
|
27
|
-
if (r === "prepare") return p(t.plan).ok;
|
|
28
|
-
const o = t.format === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
29
|
-
return t.bytes instanceof Uint8Array && (t.format === "pdf" || t.format === "xlsx") && t.contentType === o;
|
|
30
|
-
}
|
|
31
|
-
function n(t) {
|
|
32
|
-
if (!t || typeof t != "object") return { message: String(t) };
|
|
33
|
-
const r = {};
|
|
34
|
-
for (const o of ["code", "path", "field", "message"]) {
|
|
35
|
-
const s = t[o];
|
|
36
|
-
typeof s == "string" && (r[o] = s);
|
|
37
|
-
}
|
|
38
|
-
return r;
|
|
39
|
-
}
|
|
40
|
-
function g(t) {
|
|
41
|
-
const r = n(t);
|
|
42
|
-
if (!e(t)) return r;
|
|
43
|
-
for (const o of ["format", "severity", "kind", "nid"]) typeof t[o] == "string" && (r[o] = t[o]);
|
|
44
|
-
for (const o of ["pageIndex", "componentIndex"]) Number.isSafeInteger(t[o]) && t[o] >= 0 && (r[o] = t[o]);
|
|
45
|
-
return Array.isArray(t.componentPath) && t.componentPath.every((o) => Number.isSafeInteger(o) && o >= 0) && (r.componentPath = t.componentPath), r;
|
|
46
|
-
}
|
|
47
|
-
function u(t) {
|
|
48
|
-
if (!(t instanceof Error)) return { name: "Error", message: String(t) };
|
|
49
|
-
const r = t;
|
|
50
|
-
return {
|
|
51
|
-
name: t.name,
|
|
52
|
-
message: t.message,
|
|
53
|
-
...typeof r.code == "string" ? { code: r.code } : {},
|
|
54
|
-
...typeof r.path == "string" ? { path: r.path } : {},
|
|
55
|
-
...Array.isArray(r.issues) ? { issues: r.issues.map(n) } : {},
|
|
56
|
-
...Array.isArray(r.diagnostics) ? { diagnostics: r.diagnostics.map(g) } : {}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function x(t) {
|
|
60
|
-
if (!t || typeof t != "object") return !1;
|
|
61
|
-
const r = t;
|
|
62
|
-
return r.protocol === i && typeof r.id == "string" && (r.operation === "prepare" || r.operation === "export" || r.operation === "exportPrepared") && !!r.input && typeof r.input == "object";
|
|
63
|
-
}
|
|
64
|
-
async function A(t, r, o) {
|
|
65
|
-
try {
|
|
66
|
-
const s = r.operation === "prepare" ? await t.prepare({ ...r.input, onEvent: o }) : r.operation === "exportPrepared" ? await t.exportPrepared({ ...r.input, onEvent: o }) : await t.export({ ...r.input, onEvent: o });
|
|
67
|
-
return { protocol: i, id: r.id, result: s };
|
|
68
|
-
} catch (s) {
|
|
69
|
-
return { protocol: i, id: r.id, error: u(s) };
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function P(t) {
|
|
73
|
-
const r = t.result;
|
|
74
|
-
return !r || !("bytes" in r) || !(r.bytes.buffer instanceof ArrayBuffer) ? [] : [r.bytes.buffer];
|
|
75
|
-
}
|
|
76
|
-
function E(t, r) {
|
|
77
|
-
if (!e(t) || typeof t.taskId != "string" || !t.taskId || r.taskId !== void 0 && t.taskId !== r.taskId || t.correlationId !== r.correlationId || t.reportId !== void 0 && (typeof t.reportId != "string" || !("reportIds" in r && r.reportIds.includes(t.reportId))) || !["query", "validate", "layout", "assets", "encode"].includes(t.stage) || !["started", "completed", "failed"].includes(t.status)) return !1;
|
|
78
|
-
for (const o of ["completed", "total"]) if (t[o] !== void 0 && (typeof t[o] != "number" || !Number.isFinite(t[o]) || t[o] < 0)) return !1;
|
|
79
|
-
return t.completed === void 0 || t.total === void 0 || t.completed <= t.total;
|
|
80
|
-
}
|
|
81
|
-
export {
|
|
82
|
-
i as R,
|
|
83
|
-
P as a,
|
|
84
|
-
I as b,
|
|
85
|
-
R as c,
|
|
86
|
-
x as i,
|
|
87
|
-
A as r,
|
|
88
|
-
u as s,
|
|
89
|
-
E as v
|
|
90
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const f=require("./prepared-D0yCSxSO.cjs"),c=require("./json-snapshot-DNiIbpOr.cjs"),a=require("./template-registry-DI59PXVK.cjs"),i="mach-report-worker/1";class d extends Error{constructor(t){super(t.message),this.name=t.name,this.code=t.code,this.path=t.path,this.issues=t.issues,this.diagnostics=t.diagnostics}}function o(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function y(r){return o(r)?["rows","pages","cells"].every(t=>typeof r[t]=="number"&&Number.isSafeInteger(r[t])&&r[t]>=0)&&typeof r.durationMs=="number"&&Number.isFinite(r.durationMs)&&r.durationMs>=0:!1}function g(r){return Array.isArray(r)&&r.every(t=>o(t)&&typeof t.code=="string"&&typeof t.message=="string"&&["info","warning","error"].includes(t.severity)&&c.hasValidDataExplanation(t))}function m(r){return o(r)&&Object.values(r).every(t=>o(t)&&(t.revision===void 0||typeof t.revision=="string")&&(t.sourceToken===void 0||typeof t.sourceToken=="string"))}function u(r){return r===void 0?!0:o(r)&&["heuristic","provided","font-bytes"].includes(r.textMetrics)&&(r.fontFingerprint===void 0||typeof r.fontFingerprint=="string"&&/^[a-f0-9]{64}$/.test(r.fontFingerprint))}function R(r,t){if(!o(r)||!y(r.stats)||!g(r.diagnostics)||!m(r.revisions)||!u(r.layout)||!f.validPreparedSources(r.sources))return!1;if(t==="prepare")return a.validateRenderPlan(r.plan).ok;const e=r.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";return r.bytes instanceof Uint8Array&&(r.format==="pdf"||r.format==="xlsx")&&r.contentType===e}function n(r){if(!r||typeof r!="object")return{message:String(r)};const t={};for(const e of["code","path","field","message"]){const s=r[e];typeof s=="string"&&(t[e]=s)}return t}function k(r){const t=n(r);if(!o(r))return t;for(const e of["format","severity","kind","nid"])typeof r[e]=="string"&&(t[e]=r[e]);for(const e of["pageIndex","componentIndex"])Number.isSafeInteger(r[e])&&r[e]>=0&&(t[e]=r[e]);return Array.isArray(r.componentPath)&&r.componentPath.every(e=>Number.isSafeInteger(e)&&e>=0)&&(t.componentPath=r.componentPath),t}function p(r){if(!(r instanceof Error))return{name:"Error",message:String(r)};const t=r;return{name:r.name,message:r.message,...typeof t.code=="string"?{code:t.code}:{},...typeof t.path=="string"?{path:t.path}:{},...Array.isArray(t.issues)?{issues:t.issues.map(n)}:{},...Array.isArray(t.diagnostics)?{diagnostics:t.diagnostics.map(k)}:{}}}function h(r){if(!r||typeof r!="object")return!1;const t=r;return t.protocol===i&&typeof t.id=="string"&&(t.operation==="prepare"||t.operation==="export"||t.operation==="exportPrepared")&&!!t.input&&typeof t.input=="object"}async function b(r,t,e){try{const s=t.operation==="prepare"?await r.prepare({...t.input,onEvent:e}):t.operation==="exportPrepared"?await r.exportPrepared({...t.input,onEvent:e}):await r.export({...t.input,onEvent:e});return{protocol:i,id:t.id,result:s}}catch(s){return{protocol:i,id:t.id,error:p(s)}}}function I(r){const t=r.result;return!t||!("bytes"in t)||!(t.bytes.buffer instanceof ArrayBuffer)?[]:[t.bytes.buffer]}function W(r,t){if(!o(r)||typeof r.taskId!="string"||!r.taskId||t.taskId!==void 0&&r.taskId!==t.taskId||r.correlationId!==t.correlationId||r.reportId!==void 0&&(typeof r.reportId!="string"||!("reportIds"in t&&t.reportIds.includes(r.reportId)))||!["query","validate","layout","assets","encode"].includes(r.stage)||!["started","completed","failed"].includes(r.status))return!1;for(const e of["completed","total"])if(r[e]!==void 0&&(typeof r[e]!="number"||!Number.isFinite(r[e])||r[e]<0))return!1;return r.completed===void 0||r.total===void 0||r.completed<=r.total}exports.REPORT_WORKER_PROTOCOL=i;exports.ReportWorkerError=d;exports.isReportWorkerRequest=h;exports.reportWorkerTransferList=I;exports.runReportWorkerRequest=b;exports.serializeError=p;exports.validReportWorkerEvent=W;exports.validReportWorkerResult=R;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const l=require("./progress-WomPRP3B.cjs"),y=require("./charts-Cjw5AYkg.cjs"),g=require("./computed-DK6BruFz.cjs");function S(e){if(!e||e.kind==="date")return;const t=e.digits;if(!(t!==void 0&&(!Number.isInteger(t)||t<0||t>100))){if(e.kind==="percent"){const r=t??2;return`0${r?`.${"0".repeat(r)}`:""}%`}return t===void 0?e.thousands?"#,##0.###############":void 0:`${e.thousands?"#,##0":"0"}${t?`.${"0".repeat(t)}`:""}`}}function C(e){const t=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(e.trim());if(t){const i=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return Number.isNaN(i.getTime())?null:i}const r=new Date(e);return Number.isNaN(r.getTime())?null:r}function u(e,t){return e.toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:t})}function x(e,t){const r=i=>String(i).padStart(2,"0");return t.replace(/YYYY/g,String(e.getFullYear())).replace(/MM/g,r(e.getMonth()+1)).replace(/DD/g,r(e.getDate())).replace(/hh/g,r(e.getHours())).replace(/mm/g,r(e.getMinutes())).replace(/ss/g,r(e.getSeconds()))}function F(e,t,r){return r!=null?t?u(e,r):e.toFixed(r):t?u(e):String(e)}function c(e){const t=typeof e=="number"?e:Number(String(e).replace(/,/g,""));return Number.isFinite(t)?t:null}function m(e,t){if(e==null||e===""||!t)return String(e??"");switch(t.kind){case"number":{if(typeof e=="string")try{return g.formatDecimal(e,t.digits,t.thousands===!0)}catch{return e}const r=c(e);return r==null?String(e):F(r,t.thousands===!0,t.digits)}case"percent":{if(typeof e=="string")try{return g.formatDecimal(e,t.digits??2,!0,!0)}catch{return e}const r=c(e);return r==null?String(e):`${u(r*100,t.digits??2)}%`}case"date":{const r=t.pattern??"YYYY-MM-DD",i=e instanceof Date?e:C(String(e));return i?x(i,r):String(e)}default:return String(e)}}function h(e,t){return g.compileReportPredicate(t)(e)}function M(e,t,r,i=e.paddingMm??1){return t.field!==e.tree.labelField?0:Math.min(r.depth*(e.tree.indentMm??3),Math.max(0,t.widthMm-i*2-4))}function L(e,t,r,i){const n=i.tree;(n.input==="nested"||[n.idField,n.parentField].includes(t.field))&&(e.editable=!1),r.hasChildren&&n.parentValues==="leaf-aggregate"&&n.aggregates?.some(a=>a.field===t.field)&&(e.derived=!0,e.editable=!1)}function T(e,t,r){return r==="identifier"||r==="dimension"||r==="date"?"center":r==="measure"?"right":r==="text"?"left":t?.kind==="number"||t?.kind==="percent"?"right":t?.kind==="date"||e instanceof Date||typeof e=="boolean"?"center":typeof e=="number"&&Number.isFinite(e)?"right":"left"}function w(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number")return String(e);if(typeof e=="boolean")return e?"是":"否";if(e instanceof Date)return e.toISOString().slice(0,10);try{return JSON.stringify(e)}catch{return String(e)}}function P(e,t){let r=l.mergeComponentStyles({fontSize:e.fontSizePt??l.DEFAULT_FONT_PT,bold:e.headerBold??!0,align:"center",verticalAlign:"middle",backgroundColor:e.headerBackgroundColor},t.style);return e.headerAlign!==void 0&&(r.align=e.headerAlign),r=l.mergeComponentStyles(r,e.headerStyle),t.headerAlign!==void 0&&(r.align=t.headerAlign),l.mergeComponentStyles(r,t.headerStyle)}function A(e,t,r){(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"&&Number.isFinite(r))&&(e.value=r);const i=t.format?.kind==="number"||t.format?.kind==="percent";t.valueType!==void 0?e.valueType=t.valueType:i&&(e.valueType="number"),t.editable!==void 0&&(e.editable=t.editable);const n=S(t.format);(typeof e.value=="number"||e.value==null)&&n!==void 0&&(e.numberFormat=n)}function N(e,t,r){const i=!!t.visibleWhen&&!h(r,t.visibleWhen),n=i?null:r[t.field],a=t.align??t.style?.align??e.align??"left";let s=l.mergeComponentStyles({fontSize:e.fontSizePt??l.DEFAULT_FONT_PT,verticalAlign:"middle"},t.style);s.align=a==="auto"?T(n,t.format,t.semanticRole):a;const o=t.rules?.find(f=>h(r,f.when));o&&(s=l.mergeComponentStyles(s,o.style));const d={text:t.format?m(n,t.format):w(n),style:s};return A(d,t,n),e.computed?.some(f=>f.field===t.field)&&(d.derived=!0,d.editable=!1),i&&(d.editable=!1),d}function R(e,t,r){const i=N(e,t,r.row),n=M(e,t,r);return t.field===e.tree.labelField&&(i.style={...i.style,align:"left"}),n&&(i.indentMm=n),L(i,t,r,e),i}class I extends Error{constructor(t,r){super(`报表页数超出上限 ${t}(至少 ${r} 页)`),this.limit=t,this.actual=r,this.code="page-limit",this.name="PaginatePageLimitError"}}class O extends Error{constructor(t,r){super(`报表单元格数量超出上限 ${t}(至少 ${r} 格)`),this.limit=t,this.actual=r,this.code="cell-limit",this.name="PaginateCellLimitError"}}class E extends Error{constructor(t,r){super(`报表图表图元数量预计超出上限 ${t}(本次估算 ${r})`),this.limit=t,this.estimated=r,this.code="chart-component-limit",this.name="PaginateChartComponentLimitError"}}const b=5e4;function D(e=b){if(!Number.isSafeInteger(e)||e<1||e>1e6)throw new RangeError("maxChartComponents 应为 1..1000000 的安全整数")}function k(e,t,r){const i=e.chartBinding;if(e.kind!=="chart"||e.grid||e.imageData||e.binding||e.pageAnchor)throw new TypeError("绑定图表不能同时设置图片、网格、记录绑定或页眉页脚");const n=Object.prototype.hasOwnProperty.call(t,i.dataset)?t[i.dataset]:void 0;if(!Array.isArray(n))throw new TypeError(`图表数据集 ${i.dataset} 未提供`);return{...g.createReportChartData(n,i,r),type:i.type,leftMm:e.leftMm,topMm:e.topMm,widthMm:e.widthMm,heightMm:e.heightMm,title:i.title,showValues:i.showValues}}function v(e,t,r=b){D(r);let i=0;return Object.assign(a=>{if(!a.chartBinding)return[a];const s=k(a,e,t),o=i+(s.categories.length?y.chartComponentUpperBound(s):1);if(!Number.isSafeInteger(o))throw new RangeError("图表图元估算应为有限安全整数");if(o>r)throw new E(r,o);const d=s.categories.length?y.createChartComponents(s):[{kind:"text",leftMm:a.leftMm,topMm:a.topMm,widthMm:a.widthMm,heightMm:a.heightMm,text:"—",style:{align:"center",verticalAlign:"middle",color:"#94a3b8",fontSize:10}}];return i+=d.length,d},{used:()=>i})}function B(e){return typeof e=="string"&&/^data:image\/(png|jpe?g);base64,[A-Za-z0-9+/\r\n]+=*$/.test(e)}class p extends Error{constructor(t,r,i,n){super(`${t}: ${r}`),this.path=t,this.rowIndex=i,this.field=n,this.code="report-binding",this.name="ReportBindingError"}}function $(e,t,r={}){const i=r.rowIndex??0,a=`$.datasets.${r.dataset??"label"}[${i}].${t}`,s=Object.getOwnPropertyDescriptor(e,t);if(!s||s.get||s.set)throw new p(a,"字段必须是记录的自有数据字段,不能缺失、使用访问器或从原型继承",i,t);const o=s.value;if(o==null||typeof o=="string"||typeof o=="boolean"||typeof o=="number"&&Number.isFinite(o))return o;throw new p(a,"绑定值应为字符串、有限数字、布尔值或空值",i,t)}function _(e,t,r={}){const i=$(t,e.field,r);return i==null||i===""?e.emptyText??"":`${e.prefix??""}${m(i,e.format)}${e.suffix??""}`}exports.DEFAULT_CHART_COMPONENT_LIMIT=b;exports.PaginateCellLimitError=O;exports.PaginateChartComponentLimitError=E;exports.PaginatePageLimitError=I;exports.ReportBindingError=p;exports.applyListTreeMetadata=L;exports.createChartResolver=v;exports.evalStyleRule=h;exports.formatValue=m;exports.isLabelImageData=B;exports.listCellText=w;exports.listTreeIndent=M;exports.parseDateLocal=C;exports.readRecordScalar=$;exports.resolveComponentBinding=_;exports.resolveListAutoAlignment=T;exports.resolveListHeaderStyle=P;exports.resolveListSampleCell=N;exports.resolveTreeListSampleCell=R;exports.toExcelNumberFormat=S;exports.toNumber=c;exports.validateChartComponentLimit=D;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";const u=require("./progress-WomPRP3B.cjs");function m(e){const n=u.resolveFontSize(e).fontSizePt;return{runs:[],width:0,height:n*u.resolveLineHeight(e),fontSize:n}}function v(e,n,h,a){const r=e.runs[e.runs.length-1];r?.style===h?(r.text+=n,r.width+=a):e.runs.push({text:n,style:h,width:a});const o=u.resolveFontSize(h).fontSizePt;e.width+=a,e.fontSize=Math.max(e.fontSize,o),e.height=Math.max(e.height,o*u.resolveLineHeight(h))}function M(e,n,h,a,r){const o=e.richParagraphs[n],l=u.mergeComponentStyles(e.style,{...o.lineHeight===void 0?{}:{lineHeight:o.lineHeight}}),t=[m(l)];for(const s of o.segments){const c=u.mergeComponentStyles(l,s.style),d=s.kind==="field"?s.field??"":s.text??"";for(const g of d.replace(/\r\n|\r/g,`
|
|
2
|
-
`)){let i=t[t.length-1];if(g===`
|
|
3
|
-
`){t.push(m(c));continue}const f=r.measure(g,c);i.runs.length&&i.width+f>h-(t.length===1?a:0)&&(i=m(c),t.push(i)),v(i,g,c,f)}}return t}function y(e,n,h){const a=e.richParagraphs.map((t,s)=>{const c=(t.indentMm??0)*72/25.4,d=M(e,s,n.width,c,h),g=d.reduce((i,f)=>i+f.height,0)+((t.spaceBeforeMm??0)+(t.spaceAfterMm??0))*72/25.4;return{paragraph:t,indent:c,lines:d,height:g}}),r=a.reduce((t,s)=>t+s.height,0),o=e.style?.verticalAlign;let l=n.yTop-(o==="middle"?(n.height-r)/2:o==="bottom"?n.height-r:0);for(const{paragraph:t,indent:s,lines:c}of a){l-=(t.spaceBeforeMm??0)*72/25.4;const d=Math.max(0,n.width-s);for(const[g,i]of c.entries()){const f=t.align??e.style?.align,S=g===0?s:0,w=g===0?d:n.width;let z=n.x+S+(f==="center"?(w-i.width)/2:f==="right"?w-i.width:0);for(const p of i.runs)h.draw(p.text,{...p.style,align:"left"},z,l-i.fontSize,p.width),z+=p.width;l-=i.height}l-=(t.spaceAfterMm??0)*72/25.4}return r>n.height+.01}exports.drawRichText=y;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var V=Object.create;var M=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var W=(e,t,a,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of U(t))!z.call(e,s)&&s!==a&&M(e,s,{get:()=>t[s],enumerable:!(n=N(t,s))||n.enumerable});return e};var B=(e,t,a)=>(a=e!=null?V(X(e)):{},W(t||!e||!e.__esModule?M(a,"default",{value:e,enumerable:!0}):a,e));const c=require("./json-snapshot-DNiIbpOr.cjs"),F=require("./report-params-VTg8MoCp.cjs"),k=require("./param-validation-C-8sRJLq.cjs"),o=require("./sha256-DgZAKXqI.cjs"),G=require("./template-registry-DI59PXVK.cjs"),Q=require("./template-serialization-CqQY4zDg.cjs"),$=require("./assets-D2gHc4Mz.cjs"),y=require("./prepared-D0yCSxSO.cjs"),T=require("./record-bindings-MBxbeBsi.cjs");function I(e=[]){return e.map(({code:t,message:a,severity:n,pageIndex:s,componentIndex:r})=>({code:t,message:a,severity:n,path:r<0?`$.pages.${s}`:`$.pages.${s}.components.${r}`}))}async function q(e,t,a=Date.now()){const n=e.prepared;if(y.assertPreparedOutputBudget(e,t),e.fidelity==="strict"&&n.diagnostics.some(w=>w.code==="asset-render-failed"||w.code==="asset-budget-exceeded"))throw new c.ReportSourceError("validate","严格输出拒绝已有资产渲染降级,请修复组件后重新准备报表。");const 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),m=s&&r?s.createFontBytesMeasurer(r):void 0,g=c.createReportTaskReporter(e),u=await g.run("encode",async()=>{let w;if(e.format==="pdf"){o.throwIfAborted(e.signal);const d=await s.renderPlanToPdf(n.plan,{...e.pdf,...m?{measurer:m}:{},fidelity:e.fidelity,signal:e.signal,onProgress:(f,p)=>g.progress("encode",f,p)});w=d.bytes,n.diagnostics.push(...I(d.diagnostics)),n.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&&n.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(n.plan,{...e.xlsx,fidelity:e.fidelity,signal:e.signal,onProgress:(p,v)=>g.progress("encode",p,v)});w=new Uint8Array(f.buffer),n.diagnostics.push(...I(f.diagnostics)),n.diagnostics.push(...f.warnings.map(p=>({code:"xlsx-fidelity",message:p,severity:"warning"}))),n.diagnostics.push(...(f.notes??[]).map(p=>({code:"xlsx-snapshot",message:p,severity:"info"})))}return o.throwIfAborted(e.signal),w});o.assertBudget(t,"maxOutputBytes",u.byteLength);const{plan:i,...h}=n;return{...h,bytes:u,format:e.format,contentType:e.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",stats:{...h.stats,durationMs:Date.now()-a,outputBytes:u.byteLength}}}function L(e){return{...e,reportIds:[...e.reportIds],...e.params?{params:{...e.params}}:{}}}function j(e,t){if(t.length===0)throw new c.ReportSourceError("config","缺少报表 ID");return t.map(a=>{if(!Object.prototype.hasOwnProperty.call(e,a))throw new c.ReportSourceError("config",`未注册报表 ${a}`);return e[a]})}function S(e){return e.grid?.cells.reduce((t,a)=>t+a.reduce((n,s)=>n+(s?1+(s.children?.reduce((r,m)=>r+S(m),0)??0):0),0),0)??0}function H(e,t,a){return e.pages.reduce((n,s)=>n+s.components.reduce((r,m)=>m.kind!=="list"?r+S(m):r+c.estimateListLayoutCells(m,t,a),0),0)}function K(e,t=Object.keys(e)){return j(e,t).map((a,n)=>{const s=t[n],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(([m,g])=>[m,c.templateDatasetJsonSchema(typeof a.template=="function"?void 0:a.template,m,g)])),capabilities:{save:!!a.provider?.save,export:!!a.provider?.export,templates:!!a.provider?.templates}}})}function _(e,t){j(e,t.reportIds);const a=k.validateReportParams(F.getReportParamDefs(e,t.reportIds),t.params),n=t.reportIds.flatMap(r=>k.validateReportParams(F.getReportParamDefs(e,[r]),t.params).issues),s=new Map(n.map(r=>[JSON.stringify(r),r]));return{...a,ok:s.size===0,issues:[...s.values()]}}function O(e,t){const a=G.validateRenderPlan(e.plan);if(!a.ok)throw new c.ReportSourceError("validate",`执行器返回无效计划:${a.errors[0]?.path}`);const n=e.plan.pages.length,s=e.plan.pages.reduce((r,m)=>r+m.components.reduce((g,u)=>g+S(u),0),0);return o.assertBudget(t,"maxRows",e.stats.rows),o.assertBudget(t,"maxPages",n),o.assertBudget(t,"maxCells",s),{...e,stats:{...e.stats,pages:n,cells:s}}}function A(e,t){const a=_(e.reports,t);if(!a.ok)throw new k.ReportParamValidationError(a.issues)}function Y(e){const t={...o.DEFAULT_REPORT_RUNTIME_BUDGET,...e.budget};o.validateBudget(t);const a=async(s,r)=>{const m=Date.now();let g=0,u=0;const i=[],h={},w=[],d=Object.fromEntries(Object.entries(e.reports).map(([l,x])=>[l,{...x,pagination:{...e.pagination,...x.pagination,...r?{measurer:r}:{}},dataValidation:{...x.dataValidation,maxRows:Math.min(t.maxRows??1e5,x.dataValidation?.maxRows??1/0),maxCells:Math.min(t.maxCells??2e6,x.dataValidation?.maxCells??1/0)}}])),p=await c.createReportSource(d,{maxPages:t.maxPages,maxCells:t.maxCells,maxChartComponents:t.maxChartComponents,onDatasets:(l,x,R)=>{try{g+=c.templateDatasetRowCount(R,x,{maxRows:t.maxRows,signal:s.signal})}catch(b){throw b instanceof Q.TreeRowLimitError?new o.ReportRuntimeError("budget",b.message,"$.budget.maxRows"):b}o.assertBudget(t,"maxRows",g),u+=H(R,x,d[l]?.pagination),o.assertBudget(t,"maxCells",u)}})({...s,params:s.params??{},onWarning:l=>i.push({code:"layout",message:l,severity:"warning"}),onQueryResult:(l,x,R=0)=>{const b=c.reportOccurrenceScope(R,l);Object.defineProperty(h,l,{value:{revision:x.revision,sourceToken:x.sourceToken},enumerable:!0,writable:!0}),w.push({reportId:l,reportIndex:R,reportScope:b,...x.revision===void 0?{}:{revision:x.revision},...x.sourceToken===void 0?{}:{sourceToken:x.sourceToken}}),i.push(...(x.diagnostics??[]).map(P=>({...P,...P.target?{target:{...P.target,reportScope:b,...P.target.tableId?{tableId:JSON.stringify([R,l,P.target.tableId])}:{}}}:{}})))}}).catch(l=>{throw l instanceof c.ReportSourceError&&l.cause instanceof T.PaginatePageLimitError?new o.ReportRuntimeError("budget",l.cause.message,"$.budget.maxPages"):l instanceof c.ReportSourceError&&l.cause instanceof T.PaginateCellLimitError?new o.ReportRuntimeError("budget",l.cause.message,"$.budget.maxCells"):l instanceof c.ReportSourceError&&l.cause instanceof T.PaginateChartComponentLimitError?new o.ReportRuntimeError("budget",l.cause.message,"$.budget.maxChartComponents"):l});o.throwIfAborted(s.signal);const v=e.assets?await c.createReportTaskReporter(s).run("assets",()=>$.resolvePlanAssets(p,{...e.assets,signal:s.signal})):{plan:p,diagnostics:[]},E=v.plan;i.push(...I(v.diagnostics));const D=E.pages.reduce((l,x)=>l+x.components.reduce((R,b)=>R+S(b),0),0);o.assertBudget(t,"maxPages",E.pages.length),o.assertBudget(t,"maxCells",D);const C=y.reportFontFingerprint(s.pdf),J=e.pagination?.measurer||Object.values(e.reports).some(l=>l.pagination?.measurer);return{plan:E,diagnostics:i,revisions:h,sources:w,layout:{textMetrics:C?"font-bytes":J?"provided":"heuristic",...C?{fontFingerprint:C}:{}},stats:{rows:g,pages:E.pages.length,cells:D,durationMs:Date.now()-m}}},n=async s=>{const r=Date.now();if(s.format!=="pdf"&&s.format!=="xlsx")throw new c.ReportSourceError("config","不支持的报表导出格式");const m=s.format==="pdf"?await import("@agile-team/mach-report/pdf"):void 0;o.throwIfAborted(s.signal);const g=s.pdf?.customFontFaces??(s.pdf?.customFontBytes?{regular:s.pdf.customFontBytes}:void 0),u=m&&g?m.createFontBytesMeasurer(g):void 0,i=await a(s,u);return o.throwIfAborted(s.signal),q({...s,prepared:i},t,r)};return{describe:s=>K(e.reports,s),validate:s=>_(e.reports,s),prepare:s=>o.controlled(s.signal,t.maxDurationMs,async r=>{const{signal:m,onEvent:g,...u}=L(s),i={...u,...u.pdf?{pdf:y.snapshotPdfFonts(u.pdf)}:{},taskId:u.taskId??c.reportTaskId()},h=g?v=>c.notifyReportTaskEvent(g,v,r):void 0,w={...i,signal:r,onEvent:h};c.createReportTaskReporter(w).runSync("validate",()=>A(e,i));let d;const f=i.pdf?.customFontFaces??(i.pdf?.customFontBytes?{regular:i.pdf.customFontBytes}:void 0);if(!e.executor&&f){const v=await import("@agile-team/mach-report/pdf");o.throwIfAborted(r),d=v.createFontBytesMeasurer(f)}const p=e.executor?await e.executor.prepare(i,r,h):await a(w,d);return O(p,t)}),exportPrepared:s=>o.controlled(s.signal,t.maxDurationMs,async r=>{const m=Date.now(),{signal:g,onEvent:u,...i}=s,h=O(y.snapshotPreparedReport(s.prepared,t.maxPreparedBytes??64e6,r),t),w={...i,xlsx:y.snapshotXlsxOptions(i.xlsx),prepared:h,...i.pdf?{pdf:y.snapshotPdfFonts(i.pdf)}:{},taskId:i.taskId??c.reportTaskId()};if(w.format!=="pdf"&&w.format!=="xlsx")throw new c.ReportSourceError("config","不支持的报表导出格式");const d=u?p=>c.notifyReportTaskEvent(u,p,r):void 0;if(e.executor){if(!e.executor.exportPrepared)throw new c.ReportSourceError("config","执行器未实现 exportPrepared;请升级执行器或显式使用本地运行时");const p=await e.executor.exportPrepared(w,r,d);return o.assertBudget(t,"maxRows",p.stats.rows),o.assertBudget(t,"maxPages",p.stats.pages),o.assertBudget(t,"maxCells",p.stats.cells),o.assertBudget(t,"maxOutputBytes",p.bytes.byteLength),{...p,stats:{...p.stats,outputBytes:p.bytes.byteLength}}}const f={...w,signal:r,onEvent:d};if(c.createReportTaskReporter(f).runSync("validate",()=>y.checkPreparedFont(f)),e.assets){const p=await c.createReportTaskReporter(f).run("assets",()=>$.resolvePlanAssets(h.plan,{...e.assets,signal:r}));h.plan=p.plan,h.diagnostics.push(...I(p.diagnostics))}return q(f,t,m)}),export:s=>o.controlled(s.signal,t.maxDurationMs,async r=>{const{signal:m,onEvent:g,...u}=L(s),i={...u,xlsx:y.snapshotXlsxOptions(u.xlsx),...u.pdf?{pdf:y.snapshotPdfFonts(u.pdf)}:{},taskId:u.taskId??c.reportTaskId()},h=g?f=>c.notifyReportTaskEvent(g,f,r):void 0,w={...i,signal:r,onEvent:h};if(c.createReportTaskReporter(w).runSync("validate",()=>A(e,i)),i.format!=="pdf"&&i.format!=="xlsx")throw new c.ReportSourceError("config","不支持的报表导出格式");const d=e.executor?await e.executor.export(i,r,h):await n(w);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=Y;exports.enforcePrepared=O;
|
package/dist/runtime-PiCax9zQ.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { R as y, N as R, O as W, P as I, H as T, n as X, J as z, Q as G, o as H } from "./json-snapshot-BRnzKudk.js";
|
|
2
|
-
import { g as M } from "./report-params-D9tBuM9B.js";
|
|
3
|
-
import { l as $, r as K, R as Y } from "./param-validation-CnDEd2l-.js";
|
|
4
|
-
import { t as P, b as w, D as Z, v as ee, c as D, R as F } from "./sha256-BDQ1Qk7A.js";
|
|
5
|
-
import { b as te } from "./template-registry-O0hNIOfB.js";
|
|
6
|
-
import { T as se } from "./template-serialization-CWmHq7lX.js";
|
|
7
|
-
import { r as j } from "./assets-T_gDeFaz.js";
|
|
8
|
-
import { b as ae, s as S, a as J, e as re, f as oe, r as ne } from "./prepared-CJy_qk7d.js";
|
|
9
|
-
import { f as ce, P as ie, e as de } from "./record-bindings-DatJZv_e.js";
|
|
10
|
-
function O(e = []) {
|
|
11
|
-
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}` }));
|
|
12
|
-
}
|
|
13
|
-
async function _(e, t, r = Date.now()) {
|
|
14
|
-
const n = e.prepared;
|
|
15
|
-
if (ae(e, t), e.fidelity === "strict" && n.diagnostics.some((g) => g.code === "asset-render-failed" || g.code === "asset-budget-exceeded")) throw new y("validate", "严格输出拒绝已有资产渲染降级,请修复组件后重新准备报表。");
|
|
16
|
-
const s = e.format === "pdf" ? await import("@agile-team/mach-report/pdf") : void 0;
|
|
17
|
-
P(e.signal);
|
|
18
|
-
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 () => {
|
|
19
|
-
let g;
|
|
20
|
-
if (e.format === "pdf") {
|
|
21
|
-
P(e.signal);
|
|
22
|
-
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) });
|
|
23
|
-
g = c.bytes, n.diagnostics.push(...O(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" });
|
|
24
|
-
} else {
|
|
25
|
-
const { renderPlanToXlsx: c } = await import("@agile-team/mach-report/xlsx");
|
|
26
|
-
P(e.signal);
|
|
27
|
-
const f = await c(n.plan, { ...e.xlsx, fidelity: e.fidelity, signal: e.signal, onProgress: (i, v) => m.progress("encode", i, v) });
|
|
28
|
-
g = new Uint8Array(f.buffer), n.diagnostics.push(...O(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" })));
|
|
29
|
-
}
|
|
30
|
-
return P(e.signal), g;
|
|
31
|
-
});
|
|
32
|
-
w(t, "maxOutputBytes", p.byteLength);
|
|
33
|
-
const { plan: o, ...x } = n;
|
|
34
|
-
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 } };
|
|
35
|
-
}
|
|
36
|
-
function N(e) {
|
|
37
|
-
return { ...e, reportIds: [...e.reportIds], ...e.params ? { params: { ...e.params } } : {} };
|
|
38
|
-
}
|
|
39
|
-
function A(e, t) {
|
|
40
|
-
if (t.length === 0) throw new y("config", "缺少报表 ID");
|
|
41
|
-
return t.map((r) => {
|
|
42
|
-
if (!Object.prototype.hasOwnProperty.call(e, r)) throw new y("config", `未注册报表 ${r}`);
|
|
43
|
-
return e[r];
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
function k(e) {
|
|
47
|
-
return e.grid?.cells.reduce((t, r) => t + r.reduce((n, s) => n + (s ? 1 + (s.children?.reduce((a, l) => a + k(l), 0) ?? 0) : 0), 0), 0) ?? 0;
|
|
48
|
-
}
|
|
49
|
-
function pe(e, t, r) {
|
|
50
|
-
return e.pages.reduce((n, s) => n + s.components.reduce((a, l) => l.kind !== "list" ? a + k(l) : a + H(l, t, r), 0), 0);
|
|
51
|
-
}
|
|
52
|
-
function le(e, t = Object.keys(e)) {
|
|
53
|
-
return A(e, t).map((r, n) => {
|
|
54
|
-
const s = t[n], a = M(e, [s]);
|
|
55
|
-
return {
|
|
56
|
-
id: s,
|
|
57
|
-
params: JSON.parse(JSON.stringify(a)),
|
|
58
|
-
paramsSchema: K(a),
|
|
59
|
-
datasetsSchema: Object.fromEntries(Object.entries(r.dataSchema ?? {}).map(([l, m]) => [l, W(typeof r.template == "function" ? void 0 : r.template, l, m)])),
|
|
60
|
-
capabilities: {
|
|
61
|
-
save: !!r.provider?.save,
|
|
62
|
-
export: !!r.provider?.export,
|
|
63
|
-
templates: !!r.provider?.templates
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
function U(e, t) {
|
|
69
|
-
A(e, t.reportIds);
|
|
70
|
-
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]));
|
|
71
|
-
return { ...r, ok: s.size === 0, issues: [...s.values()] };
|
|
72
|
-
}
|
|
73
|
-
function V(e, t) {
|
|
74
|
-
const r = te(e.plan);
|
|
75
|
-
if (!r.ok) throw new y("validate", `执行器返回无效计划:${r.errors[0]?.path}`);
|
|
76
|
-
const n = e.plan.pages.length, s = e.plan.pages.reduce((a, l) => a + l.components.reduce((m, p) => m + k(p), 0), 0);
|
|
77
|
-
return w(t, "maxRows", e.stats.rows), w(t, "maxPages", n), w(t, "maxCells", s), { ...e, stats: { ...e.stats, pages: n, cells: s } };
|
|
78
|
-
}
|
|
79
|
-
function q(e, t) {
|
|
80
|
-
const r = U(e.reports, t);
|
|
81
|
-
if (!r.ok) throw new Y(r.issues);
|
|
82
|
-
}
|
|
83
|
-
function be(e) {
|
|
84
|
-
const t = { ...Z, ...e.budget };
|
|
85
|
-
ee(t);
|
|
86
|
-
const r = async (s, a) => {
|
|
87
|
-
const l = Date.now();
|
|
88
|
-
let m = 0, p = 0;
|
|
89
|
-
const o = [], x = {}, g = [], c = Object.fromEntries(Object.entries(e.reports).map(([d, u]) => [d, {
|
|
90
|
-
...u,
|
|
91
|
-
pagination: { ...e.pagination, ...u.pagination, ...a ? { measurer: a } : {} },
|
|
92
|
-
dataValidation: {
|
|
93
|
-
...u.dataValidation,
|
|
94
|
-
maxRows: Math.min(t.maxRows ?? 1e5, u.dataValidation?.maxRows ?? 1 / 0),
|
|
95
|
-
maxCells: Math.min(t.maxCells ?? 2e6, u.dataValidation?.maxCells ?? 1 / 0)
|
|
96
|
-
}
|
|
97
|
-
}])), i = await X(c, { maxPages: t.maxPages, maxCells: t.maxCells, maxChartComponents: t.maxChartComponents, onDatasets: (d, u, h) => {
|
|
98
|
-
try {
|
|
99
|
-
m += z(h, u, { maxRows: t.maxRows, signal: s.signal });
|
|
100
|
-
} catch (b) {
|
|
101
|
-
throw b instanceof se ? new F("budget", b.message, "$.budget.maxRows") : b;
|
|
102
|
-
}
|
|
103
|
-
w(t, "maxRows", m), p += pe(h, u, c[d]?.pagination), w(t, "maxCells", p);
|
|
104
|
-
} })({ ...s, params: s.params ?? {}, onWarning: (d) => o.push({ code: "layout", message: d, severity: "warning" }), onQueryResult: (d, u, h = 0) => {
|
|
105
|
-
const b = G(h, d);
|
|
106
|
-
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: {
|
|
107
|
-
...C.target,
|
|
108
|
-
reportScope: b,
|
|
109
|
-
...C.target.tableId ? { tableId: JSON.stringify([h, d, C.target.tableId]) } : {}
|
|
110
|
-
} } : {} })));
|
|
111
|
-
} }).catch((d) => {
|
|
112
|
-
throw d instanceof y && d.cause instanceof ce ? new F("budget", d.cause.message, "$.budget.maxPages") : d instanceof y && d.cause instanceof ie ? new F("budget", d.cause.message, "$.budget.maxCells") : d instanceof y && d.cause instanceof de ? new F("budget", d.cause.message, "$.budget.maxChartComponents") : d;
|
|
113
|
-
});
|
|
114
|
-
P(s.signal);
|
|
115
|
-
const v = e.assets ? await R(s).run("assets", () => j(i, { ...e.assets, signal: s.signal })) : { plan: i, diagnostics: [] }, E = v.plan;
|
|
116
|
-
o.push(...O(v.diagnostics));
|
|
117
|
-
const L = E.pages.reduce((d, u) => d + u.components.reduce((h, b) => h + k(b), 0), 0);
|
|
118
|
-
w(t, "maxPages", E.pages.length), w(t, "maxCells", L);
|
|
119
|
-
const B = ne(s.pdf), Q = e.pagination?.measurer || Object.values(e.reports).some((d) => d.pagination?.measurer);
|
|
120
|
-
return { plan: E, diagnostics: o, revisions: x, sources: g, layout: { textMetrics: B ? "font-bytes" : Q ? "provided" : "heuristic", ...B ? { fontFingerprint: B } : {} }, stats: { rows: m, pages: E.pages.length, cells: L, durationMs: Date.now() - l } };
|
|
121
|
-
}, n = async (s) => {
|
|
122
|
-
const a = Date.now();
|
|
123
|
-
if (s.format !== "pdf" && s.format !== "xlsx") throw new y("config", "不支持的报表导出格式");
|
|
124
|
-
const l = s.format === "pdf" ? await import("@agile-team/mach-report/pdf") : void 0;
|
|
125
|
-
P(s.signal);
|
|
126
|
-
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);
|
|
127
|
-
return P(s.signal), _({ ...s, prepared: o }, t, a);
|
|
128
|
-
};
|
|
129
|
-
return {
|
|
130
|
-
describe: (s) => le(e.reports, s),
|
|
131
|
-
validate: (s) => U(e.reports, s),
|
|
132
|
-
prepare: (s) => D(s.signal, t.maxDurationMs, async (a) => {
|
|
133
|
-
const { signal: l, onEvent: m, ...p } = N(s), o = { ...p, ...p.pdf ? { pdf: S(p.pdf) } : {}, taskId: p.taskId ?? I() }, x = m ? (v) => T(m, v, a) : void 0, g = { ...o, signal: a, onEvent: x };
|
|
134
|
-
R(g).runSync("validate", () => q(e, o));
|
|
135
|
-
let c;
|
|
136
|
-
const f = o.pdf?.customFontFaces ?? (o.pdf?.customFontBytes ? { regular: o.pdf.customFontBytes } : void 0);
|
|
137
|
-
if (!e.executor && f) {
|
|
138
|
-
const v = await import("@agile-team/mach-report/pdf");
|
|
139
|
-
P(a), c = v.createFontBytesMeasurer(f);
|
|
140
|
-
}
|
|
141
|
-
const i = e.executor ? await e.executor.prepare(o, a, x) : await r(g, c);
|
|
142
|
-
return V(i, t);
|
|
143
|
-
}),
|
|
144
|
-
exportPrepared: (s) => D(s.signal, t.maxDurationMs, async (a) => {
|
|
145
|
-
const l = Date.now(), { signal: m, onEvent: p, ...o } = s, x = V(re(s.prepared, t.maxPreparedBytes ?? 64e6, a), t), g = { ...o, xlsx: J(o.xlsx), prepared: x, ...o.pdf ? { pdf: S(o.pdf) } : {}, taskId: o.taskId ?? I() };
|
|
146
|
-
if (g.format !== "pdf" && g.format !== "xlsx") throw new y("config", "不支持的报表导出格式");
|
|
147
|
-
const c = p ? (i) => T(p, i, a) : void 0;
|
|
148
|
-
if (e.executor) {
|
|
149
|
-
if (!e.executor.exportPrepared) throw new y("config", "执行器未实现 exportPrepared;请升级执行器或显式使用本地运行时");
|
|
150
|
-
const i = await e.executor.exportPrepared(g, a, c);
|
|
151
|
-
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 } };
|
|
152
|
-
}
|
|
153
|
-
const f = { ...g, signal: a, onEvent: c };
|
|
154
|
-
if (R(f).runSync("validate", () => oe(f)), e.assets) {
|
|
155
|
-
const i = await R(f).run("assets", () => j(x.plan, { ...e.assets, signal: a }));
|
|
156
|
-
x.plan = i.plan, x.diagnostics.push(...O(i.diagnostics));
|
|
157
|
-
}
|
|
158
|
-
return _(f, t, l);
|
|
159
|
-
}),
|
|
160
|
-
export: (s) => D(s.signal, t.maxDurationMs, async (a) => {
|
|
161
|
-
const { signal: l, onEvent: m, ...p } = N(s), o = { ...p, xlsx: J(p.xlsx), ...p.pdf ? { pdf: S(p.pdf) } : {}, taskId: p.taskId ?? I() }, x = m ? (f) => T(m, f, a) : void 0, g = { ...o, signal: a, onEvent: x };
|
|
162
|
-
if (R(g).runSync("validate", () => q(e, o)), o.format !== "pdf" && o.format !== "xlsx") throw new y("config", "不支持的报表导出格式");
|
|
163
|
-
const c = e.executor ? await e.executor.export(o, a, x) : await n(g);
|
|
164
|
-
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 } };
|
|
165
|
-
})
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
export {
|
|
169
|
-
be as c,
|
|
170
|
-
V as e
|
|
171
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const f=require("./template-registry-DI59PXVK.cjs"),T=require("./template-serialization-CqQY4zDg.cjs"),g=require("./progress-WomPRP3B.cjs");function p(t){return JSON.parse(JSON.stringify(t))}function u(t){return{...t.repeatDataset?{repeat:{dataset:t.repeatDataset}}:{},pages:[{widthMm:4999,heightMm:4999,components:t.components}]}}function y(t){if(!t.id.trim()||!t.name.trim()||!t.revision.trim())throw new Error("Fragment identity, name and revision are required");if(!t.components.length||t.components.length>200)throw new RangeError("A fragment must contain 1–200 components");f.parseReportTemplate({schemaVersion:"1.0",id:t.id,name:t.name,template:u(t)})}function E(t,n,e,a){const r=f.parseReportTemplate(t).template.pages[n];if(!r||!e.length||e.some(o=>!Number.isSafeInteger(o)||!r.components[o]))throw new Error("Select existing components to capture a fragment");const s=[...new Set(e)].map(o=>r.components[o]),l=Math.min(...s.map(o=>o.leftMm)),i=Math.min(...s.map(o=>o.topMm)),m={...a,...t.template.repeat?{repeatDataset:t.template.repeat.dataset}:{},components:p(s).map(o=>({...o,leftMm:o.leftMm-l,topMm:o.topMm-i}))};return y(m),m}function b(t){y(t);const n=new Map;for(const e of T.collectTemplateDatasetBindings(u(t))){const a=n.get(e.dataset)??new Set;for(const r of e.fields)!e.generated.has(r.field)&&!e.summaries.has(r.field)&&a.add(r.field);n.set(e.dataset,a)}return[...n].map(([e,a])=>({dataset:e,fields:[...a]}))}function S(t,n,e){const a=n.replace(/^\$\.template\./,"").replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const s of a.slice(0,-1))r=r[s];r[a[a.length-1]]=e}function F(t,n,e={}){const a=u({...t,components:n});for(const r of T.collectTemplateDatasetBindings(a)){for(const l of r.fields){const i=e.fields?.[r.dataset]?.[l.field];i!==void 0&&S(a,l.path,i)}const s=e.datasets?.[r.dataset];s!==void 0&&S(a,`${r.path}.dataset`,s)}}function h(t){if(!t||typeof t!="object")return;if(Array.isArray(t)){t.forEach(h);return}const n=t;for(const e of["nid","rkey","table","source"])delete n[e];if(n.kind==="list"&&delete n.id,n.meta&&typeof n.meta=="object")for(const e of["fragment","labelSource","record"])delete n.meta[e];Object.values(n).forEach(h)}function D(t){const n=new Set(t.template.pages.flatMap(a=>a.components.map(r=>r.meta?.fragment?.instance)));let e=1;for(;n.has(`fragment-${e}`);)e++;return`fragment-${e}`}function R(t,n,e){const a=e?t.components.flatMap((s,l)=>s.meta?.fragment?.instance===e?[l]:[]):[];if(e&&!a.length)throw new Error("Fragment instance no longer exists");const r=a.map(s=>t.components[s]);if(r.some(s=>s.meta?.fragment?.id!==n.id))throw new Error("An upgrade must use the same fragment identity");return{replacing:a,left:r.length?Math.min(...r.map(s=>s.leftMm)):t.marginLeftMm??0,top:r.length?Math.min(...r.map(s=>s.topMm)):t.marginTopMm??0}}function x(t,n){if(n.some(e=>e.leftMm<0||e.topMm<0||e.leftMm+e.widthMm>t.widthMm+.001||e.topMm+(e.kind==="list"?e.rowHeightMm??7:e.heightMm)>t.heightMm+.001))throw new Error("Fragment exceeds the target page; choose a larger page or adjust its placement")}function k(t,n,e){y(n);const a=f.parseReportTemplate(t),r=a.template.pages[e.pageIndex];if(!r||r.flow)throw new Error("Choose a fixed page before inserting a fragment");const s=R(r,n,e.replaceInstance),l=s.replacing,i=e.leftMm??s.left,m=e.topMm??s.top,o=p(n.components),M=e.replaceInstance??D(a);if(n.repeatDataset&&a.template.repeat?.dataset!==(e.bindings?.datasets?.[n.repeatDataset]??n.repeatDataset))throw new Error("Bind this label fragment to the current record dataset");F(n,o,e.bindings),o.forEach(h),o.forEach((c,d)=>{c.leftMm+=i,c.topMm+=m,c.meta={...c.meta,fragment:{id:n.id,revision:n.revision,instance:M,slot:d}}}),x(r,o);const w=l[0]??r.components.length;return r.components=r.components.filter((c,d)=>!l.includes(d)),r.components.splice(w,0,...o),{document:f.parseReportTemplate(a),componentIndices:o.map((c,d)=>w+d),instance:M}}function C(t,n,e,a){const r=f.parseReportTemplate(t),s=r.template.pages[n];if(!s)throw new Error("Page no longer exists");for(const l of e){const i=s.components[l];if(!i)throw new Error("Component no longer exists");i.kind==="list"?a.target==="header"?I(i,a.style):i.columns.forEach(m=>{m.style=g.mergeComponentStyles(m.style,p(a.style)),a.style.align&&(m.align=a.style.align)}):i.style=g.mergeComponentStyles(i.style,p(a.style))}return f.parseReportTemplate(r)}function I(t,n){if(t.headerStyle=g.mergeComponentStyles(t.headerStyle,p(n)),t.columns.forEach(e=>{e.headerStyle=g.mergeComponentStyles(e.headerStyle,p(n)),n.align&&(e.headerAlign=n.align)}),t.headerGrid)for(const e of t.headerGrid.cells)for(const a of e)a&&(a.style=g.mergeComponentStyles(a.style,p(n)))}exports.applyReportDocumentStyle=C;exports.captureTemplateFragment=E;exports.insertTemplateFragment=k;exports.inspectTemplateFragmentBindings=b;
|