@agile-team/mach-report 2.24.0 → 2.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/{ExcelBindingWizard-Cy_lPjWV.js → ExcelBindingWizard-bs3F4dD8.js} +3 -3
- package/dist/{ExcelBindingWizard-BV12hGiK.cjs → ExcelBindingWizard-jSdjBtWw.cjs} +1 -1
- package/dist/{ParamEditor-PyOqHzzw.js → ParamEditor-B7YVD28E.js} +2 -2
- package/dist/{ParamEditor-DenKjvKu.cjs → ParamEditor-CGfaweYX.cjs} +1 -1
- package/dist/{ReportBatchPanel-pQ6d0yqJ.cjs → ReportBatchPanel-BRJt0TXp.cjs} +1 -1
- package/dist/{ReportBatchPanel-8EFtMrKk.js → ReportBatchPanel-BTKHtLTW.js} +2 -2
- package/dist/{ReportLabelStudio-B_KF3Zc_.cjs → ReportLabelStudio-BvK_WBke.cjs} +1 -1
- package/dist/{ReportLabelStudio-HUeo2TsU.js → ReportLabelStudio-CZwqyO3t.js} +3 -3
- package/dist/{ReportParamPanel-8xR85nz-.cjs → ReportParamPanel-B27IGJjk.cjs} +1 -1
- package/dist/{ReportParamPanel-DA-YpkvC.js → ReportParamPanel-DGXzBzl2.js} +1 -1
- package/dist/{ReportPreview-_wTJnsG1.js → ReportPreview-CnxaDTCO.js} +2392 -2342
- package/dist/ReportPreview-DqFBcsJQ.cjs +6 -0
- package/dist/{ReportTemplateLibrary-DH8jl9IF.js → ReportTemplateLibrary-C7sB0Jay.js} +1 -1
- package/dist/{ReportTemplateLibrary-CjArKxRG.cjs → ReportTemplateLibrary-ClwxhnC0.cjs} +1 -1
- package/dist/{RuleEditor-GDydlEHz.js → RuleEditor-CsDGFaWz.js} +3 -4
- package/dist/{RuleEditor-Bmj98oC4.cjs → RuleEditor-D-OdaGdR.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-DjPqzU9h.js → TemplateOutlinePanel-CXOT7d1r.js} +2 -2
- package/dist/{TemplateOutlinePanel-B554_qk1.cjs → TemplateOutlinePanel-DAqR9zQi.cjs} +1 -1
- package/dist/{TemplateReusePanel-DtYbCN7U.js → TemplateReusePanel-Dcfx3Hba.js} +2 -2
- package/dist/{TemplateReusePanel-D0628OYc.cjs → TemplateReusePanel-ygIi-Ajz.cjs} +1 -1
- package/dist/{TemplateReviewPanel-D_FR4ISq.js → TemplateReviewPanel-COU8FqPq.js} +1 -1
- package/dist/{TemplateReviewPanel-CSwvCz3f.cjs → TemplateReviewPanel-DyGULVxr.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +1 -1
- package/dist/analytics.d.ts +1 -1
- package/dist/analytics.js +2 -2
- package/dist/artifact-integrity.json +102 -102
- package/dist/{assets-B4AJIOTB.cjs → assets-BYdpkTIt.cjs} +1 -1
- package/dist/{assets-D0FbszhB.js → assets-C4MIvzQ4.js} +2 -2
- package/dist/{auto-BksreoKc.js → auto-D7x7QsWD.js} +10 -10
- package/dist/{auto-C3mGqzJ8.cjs → auto-mPK9W0y5.cjs} +1 -1
- package/dist/{capabilities-lqDEZSq5.js → capabilities-CN_kSVjO.js} +7 -7
- package/dist/{capabilities-CTwlcl8q.cjs → capabilities-D4nfhcvB.cjs} +1 -1
- package/dist/cell-style-B6Qffrx8.js +37 -0
- package/dist/cell-style-y_uh1pZp.cjs +1 -0
- package/dist/{data-bar-BnGtnJ82.js → data-bar-Bfh54sT4.js} +1 -1
- package/dist/{data-bar-2NLRzOCQ.cjs → data-bar-DzceAVeR.cjs} +1 -1
- package/dist/{designer-BNf7NWd6.js → designer-B597ZdC0.js} +2254 -2248
- package/dist/designer-DFIdv_n7.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +6 -6
- package/dist/designer.d.ts +6 -6
- package/dist/designer.js +1 -1
- package/dist/diagnostic-collector-gB07PHy2.js +392 -0
- package/dist/diagnostic-collector-wASg6Fzs.cjs +1 -0
- package/dist/dom-CXWMmwh-.cjs +1 -0
- package/dist/{dom-C90cTM6Y.js → dom-DxdCMLzs.js} +185 -185
- package/dist/{encoding-DSc9zv2F.js → encoding-Amq3XrtU.js} +2 -2
- package/dist/{encoding-CkziAnZI.cjs → encoding-DRVXs5xm.cjs} +1 -1
- package/dist/{font-loader-i7lZbqH_.js → font-loader-D4NLIKJL.js} +1 -1
- package/dist/{font-loader-D-znWNWS.cjs → font-loader-p_SyTvqt.cjs} +1 -1
- package/dist/{grid-strokes-BPiV1WHe.js → grid-strokes-DkZEZvcI.js} +1 -1
- package/dist/{grid-strokes-DYf-6DMl.cjs → grid-strokes-RFMR91jn.cjs} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +137 -137
- package/dist/{json-snapshot-BJWZNryO.js → json-snapshot-CBVWZvyC.js} +662 -615
- package/dist/json-snapshot-DCFEtfFw.cjs +2 -0
- package/dist/matrix-DUYPRL7t.cjs +1 -0
- package/dist/{matrix-C6e_r_vp.js → matrix-b6T291xo.js} +120 -104
- package/dist/{pdf-DWuq6uxx.cjs → pdf-C060D5UY.cjs} +2 -2
- package/dist/{pdf-0_5XiTCx.js → pdf-DU8HelKd.js} +17 -17
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.js +2 -2
- package/dist/{plugin-B1ydqEmS.js → plugin-BdCplNe1.js} +1 -1
- package/dist/{plugin-BQBz2vLG.cjs → plugin-DHe8y5pD.cjs} +1 -1
- package/dist/{prefill-Cuzh1wxf.js → prefill-Buy4NJ15.js} +2 -2
- package/dist/{prefill-2p9wrpn9.cjs → prefill-Cw4ZYGXZ.cjs} +1 -1
- package/dist/{prepared-DAwe8Il2.cjs → prepared-BlNeOjoO.cjs} +1 -1
- package/dist/{prepared-CVbgO9KR.js → prepared-CBJ7BkK0.js} +2 -2
- package/dist/protocol-BU_4sXP0.cjs +1 -0
- package/dist/protocol-CB19KXGr.js +96 -0
- package/dist/record-bindings-B7djSjNs.cjs +1 -0
- package/dist/{record-bindings-fhav-NLG.js → record-bindings-Cv7lFiof.js} +47 -47
- package/dist/{region-binding-workflow-Cm4mqhih.js → region-binding-workflow-EYxvUYJ-.js} +2 -2
- package/dist/{region-binding-workflow-DWCUgjZl.cjs → region-binding-workflow-NdkMSFCh.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/{rich-text-layout-YJHtCWQI.js → rich-text-layout-Ch_N0Ubu.js} +1 -1
- package/dist/{rich-text-layout-X9YOz1JD.cjs → rich-text-layout-yJGuThtC.cjs} +1 -1
- package/dist/runtime-B5d_lQNQ.js +227 -0
- package/dist/runtime-BRx8Agqr.cjs +1 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server-node.cjs +5 -5
- package/dist/server-node.js +1891 -1793
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +8 -8
- package/dist/style.css +1 -1
- package/dist/{template-catalog-Bu7s7ReF.js → template-catalog-CM6U_RlD.js} +3 -3
- package/dist/{template-catalog--yBX169M.cjs → template-catalog-Cj66M84u.cjs} +1 -1
- package/dist/{template-fragments-Di2vDFnx.js → template-fragments-BDxdCuMD.js} +2 -2
- package/dist/{template-fragments-5EzVn7bm.cjs → template-fragments-DbKdxI1z.cjs} +1 -1
- package/dist/template-registry-B-AK1oam.cjs +1 -0
- package/dist/{template-registry-BCBF2b8j.js → template-registry-DeVgwEZj.js} +145 -144
- package/dist/{textwrap-CmVkhMhx.js → textwrap-BywMBMXM.js} +1 -1
- package/dist/{textwrap-BPFxhpOw.cjs → textwrap-LhJkHWb1.cjs} +1 -1
- package/dist/vue/async.d.cts +4 -4
- package/dist/vue/async.d.ts +4 -4
- package/dist/vue/index.d.cts +6 -6
- package/dist/vue/index.d.ts +6 -6
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +7 -7
- package/dist/{workbook-session-B6P_-5a4.js → workbook-session-B6hRjTyX.js} +106 -107
- package/dist/{workbook-session-BnPK3T58.cjs → workbook-session-BclW7KKH.cjs} +3 -3
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +4 -4
- package/dist/xlsx/node.d.cts +30 -1
- package/dist/xlsx/node.d.ts +30 -1
- package/dist/xlsx-node.cjs +42 -42
- package/dist/xlsx-node.js +3908 -3889
- package/dist/xlsx.cjs +2 -2
- package/dist/xlsx.d.cts +2 -2
- package/dist/xlsx.d.ts +2 -2
- package/dist/xlsx.js +151 -151
- package/package.json +1 -1
- package/dist/ReportPreview-CyUXJSVX.cjs +0 -6
- package/dist/designer-DWnZZ_ej.cjs +0 -2
- package/dist/diagnostic-collector-1sqd7DQP.js +0 -355
- package/dist/diagnostic-collector-D3rlvxm3.cjs +0 -1
- package/dist/dom-CxOkm_Sy.cjs +0 -1
- package/dist/json-snapshot-C7QZrRBf.cjs +0 -2
- package/dist/matrix-B8QWbsGM.cjs +0 -1
- package/dist/progress-BXzlVbIp.js +0 -29
- package/dist/progress-DJBd9Rb9.cjs +0 -1
- package/dist/protocol-BOri9qJL.js +0 -105
- package/dist/protocol-DD5dHSz-.cjs +0 -1
- package/dist/record-bindings-CAyM5tGg.cjs +0 -1
- package/dist/runtime-BpSAgOw1.js +0 -201
- package/dist/runtime-Cd2UTnwe.cjs +0 -1
- package/dist/template-registry-Bnh5aEYf.cjs +0 -1
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { l as
|
|
2
|
-
import { v as
|
|
3
|
-
import {
|
|
4
|
-
import { c as
|
|
5
|
-
import { v as
|
|
6
|
-
import { a as
|
|
7
|
-
function
|
|
1
|
+
import { l as ee, n as te, v as ie, c as se } from "./computed-f3pOqWLX.js";
|
|
2
|
+
import { v as ne } from "./matrix-b6T291xo.js";
|
|
3
|
+
import { J as D, E as ae, K as oe, R as fe } from "./diagnostic-collector-gB07PHy2.js";
|
|
4
|
+
import { c as re } from "./code-options-BKXXY7NI.js";
|
|
5
|
+
import { v as de, m as he } from "./param-validation-CnDEd2l-.js";
|
|
6
|
+
import { a as ue, d as ce, b as me, M as K, v as ge, s as pe } from "./template-serialization-CWmHq7lX.js";
|
|
7
|
+
function ye(e, i, t) {
|
|
8
8
|
e !== void 0 && (typeof e != "string" || !e.trim() || e.length > 4096) && t.push({ path: i, message: "来源范围应为不超过 4096 字符的非空字符串" });
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function V(e, i, t) {
|
|
11
11
|
e.editable !== void 0 && typeof e.editable != "boolean" && t.push({ path: `${i}.editable`, message: "编辑控制应为布尔值" }), e.valueType !== void 0 && !["text", "number", "boolean"].includes(e.valueType) && t.push({ path: `${i}.valueType`, message: "编辑类型应为 text、number 或 boolean" });
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
13
|
+
function le(e, i, t) {
|
|
14
|
+
V(e, i, t), e.indentMm !== void 0 && (typeof e.indentMm != "number" || !Number.isFinite(e.indentMm) || e.indentMm < 0) && t.push({ path: `${i}.indentMm`, message: "单元格缩进应为有限非负数" }), e.derived !== void 0 && typeof e.derived != "boolean" && t.push({ path: `${i}.derived`, message: "派生结果标记应为布尔值" }), H(e.source, `${i}.source`, t, !0), e.formula !== void 0 && typeof e.formula != "string" && t.push({ path: `${i}.formula`, message: "单元格公式应为字符串" });
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function H(e, i, t, s = !1) {
|
|
17
17
|
if (e === void 0) return;
|
|
18
18
|
if (!e || typeof e != "object" || Array.isArray(e)) {
|
|
19
19
|
t.push({ path: i, message: "业务来源应为对象" });
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
const n = e;
|
|
23
|
-
|
|
23
|
+
ye(n.sourceScope, `${i}.sourceScope`, t);
|
|
24
24
|
for (const a of ["datasetId", ...s ? ["field"] : []])
|
|
25
25
|
(typeof n[a] != "string" || !n[a].trim()) && t.push({ path: `${i}.${a}`, message: "业务标识应为非空字符串" });
|
|
26
26
|
for (const a of ["rowKey", "revision"]) {
|
|
@@ -29,7 +29,7 @@ function J(e, i, t, s = !1) {
|
|
|
29
29
|
}
|
|
30
30
|
n.sourceToken !== void 0 && typeof n.sourceToken != "string" && t.push({ path: `${i}.sourceToken`, message: "来源令牌应为字符串" });
|
|
31
31
|
}
|
|
32
|
-
const
|
|
32
|
+
const $e = /* @__PURE__ */ new Set([
|
|
33
33
|
"text",
|
|
34
34
|
"image",
|
|
35
35
|
"barcode",
|
|
@@ -45,16 +45,16 @@ function p(e) {
|
|
|
45
45
|
function v(e) {
|
|
46
46
|
return e === null ? "null" : typeof e == "string" ? JSON.stringify(e.slice(0, 120)) : ["number", "boolean", "undefined"].includes(typeof e) ? String(e) : `[${typeof e}]`;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function be(e, i, t, s) {
|
|
49
49
|
const n = e[i];
|
|
50
50
|
(typeof n != "number" || !Number.isFinite(n)) && s.push({ path: `${t}.${i}`, message: `应为有限数字,实际 ${v(n)}` });
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function Ae(e, i, t) {
|
|
53
53
|
if (e !== void 0) {
|
|
54
54
|
const s = `${i}.table`;
|
|
55
55
|
if (!p(e)) t.push({ path: s, message: "逻辑表来源应为对象" });
|
|
56
56
|
else {
|
|
57
|
-
|
|
57
|
+
H(e.source, `${s}.source`, t), (typeof e.id != "string" || !e.id.trim()) && t.push({ path: `${s}.id`, message: "逻辑表 ID 应为非空字符串" });
|
|
58
58
|
const n = e.role;
|
|
59
59
|
["header", "body", "group-header", "subtotal", "grand-total"].includes(n) || t.push({ path: `${s}.role`, message: "未知逻辑表行角色" });
|
|
60
60
|
const a = e.rowIndex;
|
|
@@ -62,7 +62,7 @@ function be(e, i, t) {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function we(e, i, t, s) {
|
|
66
66
|
if (e !== void 0)
|
|
67
67
|
if (!p(e) || !Array.isArray(e.cells))
|
|
68
68
|
t.push({ path: `${i}.grid.cells`, message: "grid.cells 应为二维数组" });
|
|
@@ -80,7 +80,7 @@ function Ae(e, i, t, s) {
|
|
|
80
80
|
t.push({ path: d, message: "网格单元格应为对象或 null" });
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
|
|
83
|
+
le(f, d, t), f.dataBar !== void 0 && !ae(f.dataBar) && t.push({ path: `${d}.dataBar`, message: "数据条应包含 0–1 有序比例与 #RRGGBB 颜色" }), J(f.richParagraphs, d, t), Array.isArray(f.children) && f.children.forEach((h, m) => {
|
|
84
84
|
O(h, `${i}.grid.cells.${o}.${r}.children.${m}`, t, s);
|
|
85
85
|
});
|
|
86
86
|
});
|
|
@@ -96,7 +96,7 @@ function F(e, i, t, s, n = 0) {
|
|
|
96
96
|
o !== void 0 && (typeof o != "number" || !Number.isFinite(o) || o < n) && s.push({ path: `${t}.${a}`, message: "富文本数值应为范围内有限数字" });
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function Me(e, i, t) {
|
|
100
100
|
if (e !== void 0) {
|
|
101
101
|
if (!p(e)) {
|
|
102
102
|
t.push({ path: i, message: "富文本样式应为对象" });
|
|
@@ -109,7 +109,7 @@ function we(e, i, t) {
|
|
|
109
109
|
F(e, ["fontSize", "fontSizePx", "lineWidthPt", "lineHeight", "opacity"], i, t), F(e, ["letterSpacing", "rotateDeg"], i, t, -1 / 0), typeof e.opacity == "number" && e.opacity > 1 && t.push({ path: `${i}.opacity`, message: "透明度不能大于1" }), N(e.align, ["left", "center", "right", "justify"], `${i}.align`, t), N(e.verticalAlign, ["top", "middle", "bottom"], `${i}.verticalAlign`, t);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function ke(e, i, t) {
|
|
113
113
|
if (!p(e)) {
|
|
114
114
|
t.push({ path: i, message: "富文本片段应为对象" });
|
|
115
115
|
return;
|
|
@@ -117,9 +117,9 @@ function Me(e, i, t) {
|
|
|
117
117
|
N(e.kind, ["text", "field"], `${i}.kind`, t);
|
|
118
118
|
for (const s of ["text", "field"])
|
|
119
119
|
e[s] !== void 0 && typeof e[s] != "string" && t.push({ path: `${i}.${s}`, message: "富文本内容应为字符串" });
|
|
120
|
-
|
|
120
|
+
Me(e.style, `${i}.style`, t);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function J(e, i, t) {
|
|
123
123
|
if (e !== void 0) {
|
|
124
124
|
if (!Array.isArray(e)) {
|
|
125
125
|
t.push({ path: `${i}.richParagraphs`, message: "richParagraphs 应为数组" });
|
|
@@ -131,12 +131,12 @@ function W(e, i, t) {
|
|
|
131
131
|
t.push({ path: a, message: "段落缺少 segments 数组" });
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
|
-
N(s.align, ["left", "center", "right", "justify"], `${a}.align`, t), F(s, ["lineHeight", "spaceBeforeMm", "spaceAfterMm", "indentMm"], a, t), s.segments.forEach((o, f) =>
|
|
134
|
+
N(s.align, ["left", "center", "right", "justify"], `${a}.align`, t), F(s, ["lineHeight", "spaceBeforeMm", "spaceAfterMm", "indentMm"], a, t), s.segments.forEach((o, f) => ke(o, `${a}.segments.${f}`, t));
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
const n =
|
|
138
|
+
function W(e, i, t, s = []) {
|
|
139
|
+
const n = D([e], i);
|
|
140
140
|
if (n) {
|
|
141
141
|
t.push(n);
|
|
142
142
|
return;
|
|
@@ -149,41 +149,41 @@ function O(e, i, t, s = []) {
|
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
const n = e.kind;
|
|
152
|
-
typeof n != "string" ? t.push({ path: `${i}.kind`, message: "组件缺少 kind 字符串" }) :
|
|
152
|
+
typeof n != "string" ? t.push({ path: `${i}.kind`, message: "组件缺少 kind 字符串" }) : $e.has(n) || s.push({
|
|
153
153
|
path: `${i}.kind`,
|
|
154
154
|
message: `未知组件类型 ${v(n)},将以兜底方式渲染`
|
|
155
155
|
});
|
|
156
156
|
for (const a of ["leftMm", "topMm", "widthMm", "heightMm"])
|
|
157
|
-
|
|
157
|
+
be(e, a, i, t);
|
|
158
158
|
typeof e.leftMm == "number" && e.leftMm < -100 && t.push({ path: `${i}.leftMm`, message: "几何数值异常(leftMm<-100)" });
|
|
159
159
|
for (const a of ["widthMm", "heightMm"])
|
|
160
160
|
typeof e[a] == "number" && e[a] < 0 && t.push({ path: `${i}.${a}`, message: "组件尺寸不能为负数" });
|
|
161
|
-
|
|
161
|
+
Ae(e.table, i, t), Se(e.code, n, i, t), Ee(e, i, t), e.pageAnchor !== void 0 && !["header", "footer"].includes(e.pageAnchor) && t.push({ path: `${i}.pageAnchor`, message: "页面锚点应为 header 或 footer" }), e.lineDirection !== void 0 && !["down", "up"].includes(e.lineDirection) && t.push({ path: `${i}.lineDirection`, message: "线段方向应为 down 或 up" }), we(e.grid, i, t, s), J(e.richParagraphs, i, t);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function Ee(e, i, t) {
|
|
164
164
|
if (e.chartBinding !== void 0)
|
|
165
165
|
try {
|
|
166
|
-
if (
|
|
166
|
+
if (ee(e.chartBinding), e.kind !== "chart" || ["binding", "imageData", "grid", "pageAnchor"].some((s) => e[s] !== void 0)) throw new Error("绑定图表不能设置图片、网格、记录绑定或页眉页脚");
|
|
167
167
|
if (typeof e.widthMm != "number" || e.widthMm < 45 || typeof e.heightMm != "number" || e.heightMm < 35) throw new Error("绑定图表至少需要 45×35mm");
|
|
168
168
|
} catch (s) {
|
|
169
169
|
t.push({ path: `${i}.chartBinding`, message: s instanceof Error ? s.message : String(s) });
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function Se(e, i, t, s) {
|
|
173
173
|
if (e !== void 0)
|
|
174
|
-
for (const n of
|
|
174
|
+
for (const n of re(e, i)) s.push({ path: `${t}.code${n.path ? `.${n.path}` : ""}`, message: n.message });
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function G(e, i, t) {
|
|
177
177
|
if (!p(e)) return;
|
|
178
178
|
e.binding !== void 0 && t.push({ path: `${i}.binding`, message: "渲染计划不允许未解析字段绑定" }), e.chartBinding !== void 0 && t.push({ path: `${i}.chartBinding`, message: "渲染计划不允许未解析图表绑定" });
|
|
179
179
|
const s = e.grid;
|
|
180
180
|
!p(s) || !Array.isArray(s.cells) || s.cells.forEach((n, a) => {
|
|
181
181
|
Array.isArray(n) && n.forEach((o, f) => {
|
|
182
|
-
!p(o) || !Array.isArray(o.children) || o.children.forEach((r, d) =>
|
|
182
|
+
!p(o) || !Array.isArray(o.children) || o.children.forEach((r, d) => G(r, `${i}.grid.cells.${a}.${f}.children.${d}`, t));
|
|
183
183
|
});
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function ve(e, i, t, s = []) {
|
|
187
187
|
if (!p(e)) {
|
|
188
188
|
t.push({ path: i, message: "页应为对象" });
|
|
189
189
|
return;
|
|
@@ -194,17 +194,17 @@ function Se(e, i, t, s = []) {
|
|
|
194
194
|
if (!Array.isArray(o))
|
|
195
195
|
t.push({ path: `${i}.components`, message: "components 应为数组" });
|
|
196
196
|
else if (Array.isArray(o)) {
|
|
197
|
-
const f =
|
|
197
|
+
const f = D(o, `${i}.components`);
|
|
198
198
|
if (f) {
|
|
199
199
|
t.push(f);
|
|
200
200
|
return;
|
|
201
201
|
}
|
|
202
202
|
o.forEach((r, d) => {
|
|
203
|
-
O(r, `${i}.components.${d}`, t, s),
|
|
203
|
+
O(r, `${i}.components.${d}`, t, s), G(r, `${i}.components.${d}`, t);
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Ne(e) {
|
|
208
208
|
const i = [], t = [], s = p(e) ? e.pages : void 0;
|
|
209
209
|
if (p(e) && e.requiresRecalculation !== void 0 && typeof e.requiresRecalculation != "boolean" && i.push({ path: "$.requiresRecalculation", message: "重算能力要求应为布尔值" }), !Array.isArray(s))
|
|
210
210
|
i.push({
|
|
@@ -212,9 +212,9 @@ function ve(e) {
|
|
|
212
212
|
message: e == null ? "渲染计划为空" : "渲染计划缺少 pages 数组"
|
|
213
213
|
});
|
|
214
214
|
else {
|
|
215
|
-
const n =
|
|
215
|
+
const n = oe(s);
|
|
216
216
|
if (n) return { ok: !1, errors: [...i, n], warnings: t };
|
|
217
|
-
s.forEach((o, f) =>
|
|
217
|
+
s.forEach((o, f) => ve(o, `$.pages.${f}`, i, t)), s.length > 2e3 && t.push({
|
|
218
218
|
path: "$.pages",
|
|
219
219
|
message: `页数异常大(${s.length} 页),渲染与打印耗时可能显著增加`
|
|
220
220
|
});
|
|
@@ -230,30 +230,29 @@ function ve(e) {
|
|
|
230
230
|
return { ok: i.length === 0, errors: i, warnings: t };
|
|
231
231
|
}
|
|
232
232
|
function mt(e) {
|
|
233
|
-
const i =
|
|
233
|
+
const i = Ne(e);
|
|
234
234
|
if (!i.ok) {
|
|
235
235
|
const t = i.errors.slice(0, 3).map((s) => `${s.path}: ${s.message}`).join("; ");
|
|
236
236
|
throw new Error(`渲染计划校验失败(${i.errors.length} 处): ${t}`);
|
|
237
237
|
}
|
|
238
238
|
return e.pages;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function U(e) {
|
|
241
241
|
return e.kind === "list" ? e.id : e.nid;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function z(e) {
|
|
244
244
|
return e.kind === "list" ? !1 : e.pageAnchor !== void 0 || e.kind === "text" && typeof e.text == "string" && /\{(?:page|totalPages)\}/.test(e.text);
|
|
245
245
|
}
|
|
246
246
|
function xe(e, i) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if (n.topMm < i.topMm - 1e-3 || a > i.topMm + i.heightMm + 1e-3) throw new Error("流式分段应完整包含其组件的原始纵向范围");
|
|
247
|
+
if (e.filter((s) => s.kind === "list" && s.cardinality !== "record").length && e.length !== 1) throw new Error("纵向重复区域必须独占流式分段,不能与静态或单记录区域并排");
|
|
248
|
+
for (const s of e) {
|
|
249
|
+
const n = s.kind === "list" ? s.topMm + (s.rowHeightMm ?? 0) : s.topMm + s.heightMm;
|
|
250
|
+
if (s.topMm < i.topMm - 1e-3 || n > i.topMm + i.heightMm + 1e-3) throw new Error("流式分段应完整包含其组件的原始纵向范围");
|
|
252
251
|
}
|
|
253
252
|
}
|
|
254
253
|
function gt(e, i) {
|
|
255
254
|
if (!i) return e.map((s) => ({ components: [s] }));
|
|
256
|
-
const t = new Map(e.map((s) => [
|
|
255
|
+
const t = new Map(e.filter((s) => !z(s)).map((s) => [U(s), s]));
|
|
257
256
|
return i.bands.map((s) => ({ band: s, components: s.componentIds.map((n) => {
|
|
258
257
|
const a = t.get(n);
|
|
259
258
|
if (!a) throw new Error(`流式区域引用不存在的组件:${n}`);
|
|
@@ -262,25 +261,27 @@ function gt(e, i) {
|
|
|
262
261
|
}
|
|
263
262
|
function Re(e, i) {
|
|
264
263
|
if (!i || !Array.isArray(i.bands) || !i.bands.length || i.bands.length > 1e4) throw new Error("流式排版应包含 1–10000 个区域");
|
|
265
|
-
const t = /* @__PURE__ */ new
|
|
264
|
+
const t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
|
|
266
265
|
for (const n of e) {
|
|
267
|
-
if (
|
|
268
|
-
const a =
|
|
266
|
+
if (z(n)) continue;
|
|
267
|
+
const a = U(n);
|
|
269
268
|
if (!a || t.has(a)) throw new Error("流式排版组件应具有唯一标识");
|
|
270
|
-
t.
|
|
271
|
-
}
|
|
272
|
-
if (Te(
|
|
273
|
-
}
|
|
274
|
-
function Te(e, i, t
|
|
275
|
-
let
|
|
276
|
-
for (const
|
|
277
|
-
if (!Number.isFinite(
|
|
278
|
-
if (!Array.isArray(
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
269
|
+
t.set(a, n);
|
|
270
|
+
}
|
|
271
|
+
if (Te(i, t, s), s.size !== t.size) throw new Error("流式排版必须显式包含每个非锚点组件");
|
|
272
|
+
}
|
|
273
|
+
function Te(e, i, t) {
|
|
274
|
+
let s = -1 / 0;
|
|
275
|
+
for (const n of e.bands) {
|
|
276
|
+
if (!Number.isFinite(n.topMm) || !Number.isFinite(n.heightMm) || n.topMm < 0 || n.heightMm <= 0 || n.topMm < s - 1e-3) throw new Error("流式区域应按原始位置排序,尺寸有效且不重叠");
|
|
277
|
+
if (!Array.isArray(n.componentIds) || !n.componentIds.length) throw new Error("流式区域不能没有组件");
|
|
278
|
+
const a = [];
|
|
279
|
+
for (const o of n.componentIds) {
|
|
280
|
+
const f = i.get(o);
|
|
281
|
+
if (!f || t.has(o)) throw new Error(`流式区域组件缺失、重复或包含页锚点:${o}`);
|
|
282
|
+
t.add(o), a.push(f);
|
|
282
283
|
}
|
|
283
|
-
xe(
|
|
284
|
+
xe(a, n), s = n.topMm + n.heightMm;
|
|
284
285
|
}
|
|
285
286
|
}
|
|
286
287
|
const Fe = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
@@ -323,13 +324,13 @@ function Ie(e, i) {
|
|
|
323
324
|
const t = e.copies;
|
|
324
325
|
t !== void 0 && ($(t) ? (x(t, ["field"], "$.repeat.copies", i), k(t.field) || i.push({ path: "$.repeat.copies.field", message: "复制数字段应为安全的非空字段名" })) : (!Number.isSafeInteger(t) || Number(t) < 1 || Number(t) > 1e3) && i.push({ path: "$.repeat.copies", message: "每条记录复制数应为 1..1000 整数" }));
|
|
325
326
|
}
|
|
326
|
-
function
|
|
327
|
+
function q(e, i, t, s) {
|
|
327
328
|
if (!$(e)) return;
|
|
328
329
|
Pe(e, i, s), e.binding !== void 0 && !t && s.push({ path: `${i}.binding`, message: "字段绑定需要模板 repeat 数据集;普通报表请使用列表字段" }), t && e.kind === "list" && s.push({ path: i, message: "逐记录标签使用固定组件;动态列表请使用普通报表模板" }), e.chartBinding !== void 0 && (t || i.includes(".children.")) && s.push({ path: `${i}.chartBinding`, message: "数据图表应放在普通报表的页面或流式分区,不放在逐记录标签或嵌套单元格内" });
|
|
329
330
|
const n = e.grid;
|
|
330
331
|
$(n) && Array.isArray(n.cells) && n.cells.forEach((a, o) => {
|
|
331
332
|
Array.isArray(a) && a.forEach((f, r) => {
|
|
332
|
-
$(f) && Array.isArray(f.children) && f.children.forEach((d, h) =>
|
|
333
|
+
$(f) && Array.isArray(f.children) && f.children.forEach((d, h) => q(d, `${i}.grid.cells.${o}.${r}.children.${h}`, t, s));
|
|
333
334
|
});
|
|
334
335
|
});
|
|
335
336
|
}
|
|
@@ -340,7 +341,7 @@ function Oe(e, i) {
|
|
|
340
341
|
const a = `$.pages.${n}`;
|
|
341
342
|
t && (s.layout === "wide" || s.flow !== void 0) && i.push({ path: a, message: "逐记录标签仅支持固定尺寸页面,不支持宽表或流式分区" }), Array.isArray(s.components) && s.components.forEach((o, f) => {
|
|
342
343
|
const r = `${a}.components.${f}`;
|
|
343
|
-
if (
|
|
344
|
+
if (q(o, r, t, i), !t || !$(o)) return;
|
|
344
345
|
const { leftMm: d, topMm: h, widthMm: m, heightMm: y } = o;
|
|
345
346
|
[d, h, m, y, s.widthMm, s.heightMm].every((l) => typeof l == "number" && Number.isFinite(l)) && (Number(d) < 0 || Number(h) < 0 || Number(d) + Number(m) > Number(s.widthMm) + 1e-3 || Number(h) + Number(y) > Number(s.heightMm) + 1e-3) && i.push({ path: r, message: "标签组件超出纸张边界,请调整位置或尺寸" });
|
|
346
347
|
});
|
|
@@ -352,12 +353,12 @@ function _e(e) {
|
|
|
352
353
|
function C(e, i, t) {
|
|
353
354
|
if (e !== void 0)
|
|
354
355
|
try {
|
|
355
|
-
|
|
356
|
+
te(e);
|
|
356
357
|
} catch (s) {
|
|
357
358
|
t.push({ path: i, message: s instanceof Error ? s.message : String(s) });
|
|
358
359
|
}
|
|
359
360
|
}
|
|
360
|
-
function
|
|
361
|
+
function X(e, i, t) {
|
|
361
362
|
if (e === void 0) return;
|
|
362
363
|
if (!Array.isArray(e) || e.length > 2048) {
|
|
363
364
|
t.push({ path: i, message: "聚合应为数组且最多 2048 项" });
|
|
@@ -382,7 +383,7 @@ function q(e, i, t) {
|
|
|
382
383
|
message: "小数位应为 0–100 的整数"
|
|
383
384
|
});
|
|
384
385
|
try {
|
|
385
|
-
|
|
386
|
+
se({
|
|
386
387
|
...n,
|
|
387
388
|
field: n.valueField ?? f
|
|
388
389
|
});
|
|
@@ -396,13 +397,13 @@ function q(e, i, t) {
|
|
|
396
397
|
}
|
|
397
398
|
function Le(e, i, t) {
|
|
398
399
|
if (e === void 0) return;
|
|
399
|
-
const s =
|
|
400
|
+
const s = ie(e);
|
|
400
401
|
for (const n of s.errors) t.push({ path: i, message: n });
|
|
401
402
|
}
|
|
402
403
|
function je(e, i, t) {
|
|
403
404
|
if (e !== void 0)
|
|
404
405
|
try {
|
|
405
|
-
|
|
406
|
+
ne(e);
|
|
406
407
|
} catch (s) {
|
|
407
408
|
t.push({
|
|
408
409
|
path: i,
|
|
@@ -414,7 +415,7 @@ function Be(e, i, t) {
|
|
|
414
415
|
if (e.tree === void 0) return;
|
|
415
416
|
const s = `${i}.tree`;
|
|
416
417
|
try {
|
|
417
|
-
|
|
418
|
+
ue(e.tree);
|
|
418
419
|
const n = e.tree;
|
|
419
420
|
if (e.matrix || e.detail || e.groupBy || Array.isArray(e.groups) && e.groups.length || e.rowVisibleWhen) throw new Error("树形布局不能同时配置普通分组、矩阵、主从或行可见条件");
|
|
420
421
|
if (e.rowKey !== void 0 && e.rowKey !== n.idField) throw new Error("树形 rowKey 应与 idField 一致");
|
|
@@ -424,14 +425,14 @@ function Be(e, i, t) {
|
|
|
424
425
|
t.push({ path: s, message: n instanceof Error ? n.message : String(n) });
|
|
425
426
|
}
|
|
426
427
|
}
|
|
427
|
-
const De = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]),
|
|
428
|
+
const De = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]), Ke = /* @__PURE__ */ new Set(["text", "number", "boolean", "date", "decimal"]);
|
|
428
429
|
function E(e) {
|
|
429
430
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
430
431
|
}
|
|
431
432
|
function P(e) {
|
|
432
433
|
return typeof e == "string" && !!e.trim() && e.length <= 4096 && !De.has(e);
|
|
433
434
|
}
|
|
434
|
-
function
|
|
435
|
+
function Ve(e, i, t) {
|
|
435
436
|
if (!Array.isArray(e) || !e.length || e.length > 2048) {
|
|
436
437
|
t.push({ path: i, message: "绑定契约应包含 1–2048 个字段" });
|
|
437
438
|
return;
|
|
@@ -446,7 +447,7 @@ function Ke(e, i, t) {
|
|
|
446
447
|
s.add(n.field);
|
|
447
448
|
for (const f of ["label", "semanticKey", "unit"])
|
|
448
449
|
n[f] !== void 0 && (typeof n[f] != "string" || String(n[f]).length > 4096) && t.push({ path: `${o}.${f}`, message: "应为不超过 4096 位的字符串" });
|
|
449
|
-
n.type !== void 0 && !
|
|
450
|
+
n.type !== void 0 && !Ke.has(String(n.type)) && t.push({ path: `${o}.type`, message: "未知绑定字段类型" });
|
|
450
451
|
});
|
|
451
452
|
}
|
|
452
453
|
function I(e, i, t) {
|
|
@@ -460,10 +461,10 @@ function I(e, i, t) {
|
|
|
460
461
|
(!s.length || s.length > 256) && t.push({ path: `${i}.datasets`, message: "应声明 1–256 个数据集" });
|
|
461
462
|
for (const [n, a] of s) {
|
|
462
463
|
const o = `${i}.datasets.${n}`;
|
|
463
|
-
!P(n) || !E(a) ? t.push({ path: o, message: "数据集应使用安全名称和字段契约" }) :
|
|
464
|
+
!P(n) || !E(a) ? t.push({ path: o, message: "数据集应使用安全名称和字段契约" }) : Ve(a.fields, `${o}.fields`, t);
|
|
464
465
|
}
|
|
465
466
|
}
|
|
466
|
-
function
|
|
467
|
+
function j(e, i) {
|
|
467
468
|
return new Map(e.datasets[i]?.fields.map((t) => [t.field, t]) ?? []);
|
|
468
469
|
}
|
|
469
470
|
function He(e, i, t, s) {
|
|
@@ -478,8 +479,8 @@ function pt(e, i) {
|
|
|
478
479
|
if (!n) return { ok: !1, issues: [{ code: "contract", path: "$.template.dataContract", message: "模板未声明数据来源,请核对业务字段并重新绑定" }] };
|
|
479
480
|
n.source !== i.source && t.push({ code: "source", path: "$.template.dataContract.source", message: `模板来源与当前报表不一致(${n.source ?? "未声明"} → ${i.source ?? "未声明"}),请从当前报表创建或重新绑定模板` });
|
|
480
481
|
const a = /* @__PURE__ */ new Set();
|
|
481
|
-
for (const o of
|
|
482
|
-
const f =
|
|
482
|
+
for (const o of me(e)) {
|
|
483
|
+
const f = j(n, o.dataset), r = j(i, o.dataset);
|
|
483
484
|
if (!f.size || !r.size) {
|
|
484
485
|
t.push({ code: "dataset", dataset: o.dataset, path: o.path, message: `数据集“${o.dataset}”缺少来源或目标字段契约` });
|
|
485
486
|
continue;
|
|
@@ -495,14 +496,14 @@ function pt(e, i) {
|
|
|
495
496
|
}
|
|
496
497
|
return { ok: t.length === 0, issues: t };
|
|
497
498
|
}
|
|
498
|
-
const
|
|
499
|
+
const Y = "1.0";
|
|
499
500
|
class w extends Error {
|
|
500
501
|
constructor(i) {
|
|
501
502
|
super(`模板校验失败:${i.slice(0, 3).map((t) => `${t.path}: ${t.message}`).join("; ")}`), this.errors = i, this.name = "ReportTemplateError";
|
|
502
503
|
}
|
|
503
504
|
}
|
|
504
505
|
const Je = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]), We = /* @__PURE__ */ new Set(["schemaVersion", "id", "name", "revision", "description", "template"]), Ge = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]), S = 2e5, Ue = 64;
|
|
505
|
-
function
|
|
506
|
+
function u(e) {
|
|
506
507
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
507
508
|
}
|
|
508
509
|
function ze(e, i, t) {
|
|
@@ -522,7 +523,7 @@ function qe(e, i, t, s) {
|
|
|
522
523
|
function Xe(e) {
|
|
523
524
|
return e === null || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e);
|
|
524
525
|
}
|
|
525
|
-
function
|
|
526
|
+
function _(e, i) {
|
|
526
527
|
const t = /* @__PURE__ */ new Set();
|
|
527
528
|
let s = 0, n = 0, a = !1;
|
|
528
529
|
const o = (f, r, d) => {
|
|
@@ -562,7 +563,7 @@ function L(e, i) {
|
|
|
562
563
|
};
|
|
563
564
|
o(e, "$", 0);
|
|
564
565
|
}
|
|
565
|
-
function
|
|
566
|
+
function c(e, i, t, s, n = !1) {
|
|
566
567
|
const a = e[i];
|
|
567
568
|
a === void 0 && !n || (typeof a != "string" || n && !a.trim()) && s.push({ path: `${t}.${i}`, message: n ? "应为非空字符串" : "应为字符串" });
|
|
568
569
|
}
|
|
@@ -578,7 +579,7 @@ function M(e, i, t, s = !1) {
|
|
|
578
579
|
}
|
|
579
580
|
function b(e, i, t) {
|
|
580
581
|
if (e !== void 0) {
|
|
581
|
-
if (!
|
|
582
|
+
if (!u(e)) {
|
|
582
583
|
t.push({ path: i, message: "样式应为对象" });
|
|
583
584
|
return;
|
|
584
585
|
}
|
|
@@ -587,7 +588,7 @@ function b(e, i, t) {
|
|
|
587
588
|
for (const s of ["letterSpacing", "rotateDeg"]) g(e, s, i, t, -1 / 0);
|
|
588
589
|
g(e, "opacity", i, t), typeof e.opacity == "number" && e.opacity > 1 && t.push({ path: `${i}.opacity`, message: "透明度不能大于 1" });
|
|
589
590
|
for (const s of ["bold", "italic", "underline", "borderTop", "borderRight", "borderBottom", "borderLeft"]) A(e, s, i, t);
|
|
590
|
-
for (const s of ["fontFamily", "color", "backgroundColor", "lineColor", "borderColor"])
|
|
591
|
+
for (const s of ["fontFamily", "color", "backgroundColor", "lineColor", "borderColor"]) c(e, s, i, t);
|
|
591
592
|
}
|
|
592
593
|
}
|
|
593
594
|
function Ye(e, i, t) {
|
|
@@ -599,12 +600,12 @@ function Ye(e, i, t) {
|
|
|
599
600
|
const s = /* @__PURE__ */ new Set(), n = t.length;
|
|
600
601
|
e.forEach((a, o) => {
|
|
601
602
|
const f = `${i}.${o}`;
|
|
602
|
-
if (!
|
|
603
|
+
if (!u(a)) {
|
|
603
604
|
t.push({ path: f, message: "参数定义应为对象" });
|
|
604
605
|
return;
|
|
605
606
|
}
|
|
606
|
-
|
|
607
|
-
for (const r of ["label", "defaultValue", "placeholder"])
|
|
607
|
+
c(a, "field", f, t, !0), typeof a.field == "string" && (s.has(a.field) && t.push({ path: `${f}.field`, message: "参数名重复" }), s.add(a.field)), a.type !== void 0 && !["text", "number", "date", "month", "year", "dateRange", "select", "multiSelect", "cascader", "numberRange"].includes(a.type) && t.push({ path: `${f}.type`, message: "未知参数类型" });
|
|
608
|
+
for (const r of ["label", "defaultValue", "placeholder"]) c(a, r, f, t);
|
|
608
609
|
A(a, "required", f, t);
|
|
609
610
|
for (const r of ["minLength", "maxLength"]) {
|
|
610
611
|
const d = a[r];
|
|
@@ -612,42 +613,42 @@ function Ye(e, i, t) {
|
|
|
612
613
|
}
|
|
613
614
|
Qe(a, f, t), a.options !== void 0 && (Array.isArray(a.options) ? a.options.forEach((r, d) => {
|
|
614
615
|
const h = `${f}.options.${d}`;
|
|
615
|
-
if (!
|
|
616
|
+
if (!u(r)) t.push({ path: h, message: "选项应为对象" });
|
|
616
617
|
else
|
|
617
618
|
for (const m of ["label", "value"]) typeof r[m] != "string" && t.push({ path: `${h}.${m}`, message: "选项标签与值应为字符串(允许空白选项)" });
|
|
618
619
|
}) : t.push({ path: `${f}.options`, message: "选项应为数组" }));
|
|
619
|
-
}), t.length === n && t.push(...
|
|
620
|
+
}), t.length === n && t.push(...de(e).map((a) => ({ path: a.path.replace("$.paramDefs", i), message: a.message })));
|
|
620
621
|
}
|
|
621
622
|
function Qe(e, i, t) {
|
|
622
623
|
for (const a of ["min", "max"]) {
|
|
623
624
|
const o = e[a];
|
|
624
625
|
if (o === void 0) continue;
|
|
625
|
-
|
|
626
|
+
he(e.type, o) || ["number", "numberRange"].includes(e.type) && typeof o == "number" && Number.isFinite(o) || t.push({ path: `${i}.${a}`, message: "数字使用有限数字边界,日期/月/年使用对应规范字符串边界" });
|
|
626
627
|
}
|
|
627
628
|
const s = typeof e.min == "number" && typeof e.max == "number" && e.min > e.max, n = typeof e.min == "string" && typeof e.max == "string" && e.min > e.max;
|
|
628
629
|
(s || n) && t.push({ path: i, message: "最小边界不能大于最大边界" }), typeof e.minLength == "number" && typeof e.maxLength == "number" && e.minLength > e.maxLength && t.push({ path: i, message: "最小长度不能大于最大长度" });
|
|
629
630
|
}
|
|
630
|
-
function
|
|
631
|
+
function Q(e, i, t) {
|
|
631
632
|
if (!Array.isArray(e) || e.length === 0) {
|
|
632
633
|
t.push({ path: i, message: "列表至少需要一列" });
|
|
633
634
|
return;
|
|
634
635
|
}
|
|
635
|
-
e.every((s) =>
|
|
636
|
+
e.every((s) => u(s) && s.hidden === !0) && t.push({ path: i, message: "列表至少需要一列可见列" }), e.forEach((s, n) => {
|
|
636
637
|
const a = `${i}.${n}`;
|
|
637
|
-
if (!
|
|
638
|
+
if (!u(s)) {
|
|
638
639
|
t.push({ path: a, message: "列应为对象" });
|
|
639
640
|
return;
|
|
640
641
|
}
|
|
641
|
-
if (
|
|
642
|
-
if (!
|
|
642
|
+
if (V(s, a, t), s.visual !== void 0 && !ge(s.visual) && t.push({ path: `${a}.visual`, message: "列可视化配置无效,请检查类型、数值范围和颜色" }), A(s, "hidden", a, t), C(s.visibleWhen, `${a}.visibleWhen`, t), typeof s.header != "string" && t.push({ path: `${a}.header`, message: "表头应为字符串(允许空白表头)" }), c(s, "field", a, t, !0), g(s, "widthMm", a, t, Number.MIN_VALUE, !0), b(s.style, `${a}.style`, t), b(s.headerStyle, `${a}.headerStyle`, t), M(s.align, `${a}.align`, t, !0), M(s.headerAlign, `${a}.headerAlign`, t), s.semanticRole !== void 0 && !["identifier", "dimension", "measure", "date", "text"].includes(s.semanticRole) && t.push({ path: `${a}.semanticRole`, message: "未知列语义" }), s.format !== void 0)
|
|
643
|
+
if (!u(s.format) || !["number", "percent", "date"].includes(s.format.kind))
|
|
643
644
|
t.push({ path: `${a}.format`, message: "未知列格式" });
|
|
644
645
|
else {
|
|
645
646
|
const o = s.format.digits;
|
|
646
|
-
o !== void 0 && (typeof o != "number" || !Number.isInteger(o) || o < 0 || o > 100) && t.push({ path: `${a}.format.digits`, message: "小数位应为 0–100 的整数" }), A(s.format, "thousands", `${a}.format`, t),
|
|
647
|
+
o !== void 0 && (typeof o != "number" || !Number.isInteger(o) || o < 0 || o > 100) && t.push({ path: `${a}.format.digits`, message: "小数位应为 0–100 的整数" }), A(s.format, "thousands", `${a}.format`, t), c(s.format, "pattern", `${a}.format`, t);
|
|
647
648
|
}
|
|
648
649
|
s.rules !== void 0 && (Array.isArray(s.rules) ? s.rules.forEach((o, f) => {
|
|
649
650
|
const r = `${a}.rules.${f}`;
|
|
650
|
-
if (!
|
|
651
|
+
if (!u(o) || !u(o.when)) {
|
|
651
652
|
t.push({ path: r, message: "条件格式缺少 when 对象" });
|
|
652
653
|
return;
|
|
653
654
|
}
|
|
@@ -655,30 +656,30 @@ function Y(e, i, t) {
|
|
|
655
656
|
}) : t.push({ path: `${a}.rules`, message: "条件格式应为数组" }));
|
|
656
657
|
});
|
|
657
658
|
}
|
|
658
|
-
function
|
|
659
|
+
function Z(e, i, t) {
|
|
659
660
|
if (e !== void 0) {
|
|
660
|
-
if (!
|
|
661
|
+
if (!u(e)) {
|
|
661
662
|
t.push({ path: i, message: "分组应为对象" });
|
|
662
663
|
return;
|
|
663
664
|
}
|
|
664
|
-
|
|
665
|
-
for (const s of ["headerTemplate", "subtotalLabel"])
|
|
665
|
+
c(e, "field", i, t, !0);
|
|
666
|
+
for (const s of ["headerTemplate", "subtotalLabel"]) c(e, s, i, t);
|
|
666
667
|
for (const s of ["headerStyle", "subtotalStyle"]) b(e[s], `${i}.${s}`, t);
|
|
667
|
-
A(e, "keepWithNext", i, t), A(e, "repeatHeader", i, t),
|
|
668
|
+
A(e, "keepWithNext", i, t), A(e, "repeatHeader", i, t), X(e.aggregates, `${i}.aggregates`, t), e.subtotal !== void 0 && (!Array.isArray(e.subtotal) || e.subtotal.some((s) => typeof s != "string")) && t.push({ path: `${i}.subtotal`, message: "小计字段应为字符串数组" });
|
|
668
669
|
}
|
|
669
670
|
}
|
|
670
671
|
function Ze(e, i, t) {
|
|
671
672
|
if (!(e === void 0 || typeof e == "boolean")) {
|
|
672
|
-
if (!
|
|
673
|
+
if (!u(e)) {
|
|
673
674
|
t.push({ path: i, message: "合计应为布尔值或对象" });
|
|
674
675
|
return;
|
|
675
676
|
}
|
|
676
|
-
|
|
677
|
+
c(e, "label", i, t), X(e.aggregates, `${i}.aggregates`, t), b(e.style, `${i}.style`, t), e.fields !== void 0 && (!Array.isArray(e.fields) || e.fields.some((s) => typeof s != "string")) && t.push({ path: `${i}.fields`, message: "合计字段应为字符串数组" });
|
|
677
678
|
}
|
|
678
679
|
}
|
|
679
680
|
function et(e, i, t, s) {
|
|
680
681
|
const n = { kind: "rect", leftMm: 0, topMm: 0, widthMm: 1, heightMm: 1, grid: e };
|
|
681
|
-
if (
|
|
682
|
+
if (W(n, t, s, []), L(n, t, s), !u(e) || !Array.isArray(e.cells)) return;
|
|
682
683
|
const a = e.cells, o = Array.isArray(i) ? i.length : 0;
|
|
683
684
|
if (a.length * o > S) {
|
|
684
685
|
s.push({ path: t, message: "表头逻辑网格超过 20 万格安全上限" });
|
|
@@ -693,7 +694,7 @@ function tt(e, i, t, s) {
|
|
|
693
694
|
let f = 0;
|
|
694
695
|
a.forEach((r, d) => {
|
|
695
696
|
for (; n.has(`${o}:${f}`); ) f++;
|
|
696
|
-
const h =
|
|
697
|
+
const h = u(r) && typeof r.colSpan == "number" ? r.colSpan : 1, m = u(r) && typeof r.rowSpan == "number" ? r.rowSpan : 1;
|
|
697
698
|
(f + h > i || o + m > e.length) && s.push({ path: `${t}.cells.${o}.${d}`, message: "表头合并区域超出表头边界" });
|
|
698
699
|
for (let y = o; y < Math.min(e.length, o + m); y++)
|
|
699
700
|
for (let l = f; l < Math.min(i, f + h); l++)
|
|
@@ -703,48 +704,48 @@ function tt(e, i, t, s) {
|
|
|
703
704
|
});
|
|
704
705
|
}
|
|
705
706
|
function it(e, i, t) {
|
|
706
|
-
if (Be(e, i, t), Le(e.computed, `${i}.computed`, t), je(e.matrix, `${i}.matrix`, t), e.matrix && (e.detail || e.groupBy || Array.isArray(e.groups) && e.groups.length || e.grandTotal) && t.push({ path: `${i}.matrix`, message: "矩阵请使用自身 totals 汇总,不能同时配置普通分组、总计或主从明细" }), C(e.rowVisibleWhen, `${i}.rowVisibleWhen`, t), e.groups !== void 0 && (!Array.isArray(e.groups) || e.groups.length > 16 ? t.push({ path: `${i}.groups`, message: "分组应为数组,最多 16 级" }) : e.groups.forEach((a, o) =>
|
|
707
|
+
if (Be(e, i, t), Le(e.computed, `${i}.computed`, t), je(e.matrix, `${i}.matrix`, t), e.matrix && (e.detail || e.groupBy || Array.isArray(e.groups) && e.groups.length || e.grandTotal) && t.push({ path: `${i}.matrix`, message: "矩阵请使用自身 totals 汇总,不能同时配置普通分组、总计或主从明细" }), C(e.rowVisibleWhen, `${i}.rowVisibleWhen`, t), e.groups !== void 0 && (!Array.isArray(e.groups) || e.groups.length > 16 ? t.push({ path: `${i}.groups`, message: "分组应为数组,最多 16 级" }) : e.groups.forEach((a, o) => Z(a, `${i}.groups.${o}`, t))), e.detail === void 0) return;
|
|
707
708
|
const s = e.detail, n = `${i}.detail`;
|
|
708
|
-
if (!
|
|
709
|
+
if (!u(s)) {
|
|
709
710
|
t.push({ path: n, message: "主从关联应为对象" });
|
|
710
711
|
return;
|
|
711
712
|
}
|
|
712
|
-
for (const a of ["dataset", "parentKey", "foreignKey"])
|
|
713
|
-
for (const a of ["rowKey", "revisionField", "sourceTokenField"])
|
|
714
|
-
|
|
713
|
+
for (const a of ["dataset", "parentKey", "foreignKey"]) c(s, a, n, t, !0);
|
|
714
|
+
for (const a of ["rowKey", "revisionField", "sourceTokenField"]) c(s, a, n, t, s[a] !== void 0);
|
|
715
|
+
c(s, "label", n, t), A(s, "header", n, t), g(s, "rowHeightMm", n, t, Number.MIN_VALUE), Q(s.columns, `${n}.columns`, t), s.unmatched !== void 0 && s.unmatched !== "error" && s.unmatched !== "ignore" && t.push({ path: `${n}.unmatched`, message: "未关联明细策略应为 error 或 ignore" });
|
|
715
716
|
}
|
|
716
717
|
function st(e, i, t) {
|
|
717
718
|
for (const s of ["leftMm", "topMm"]) g(e, s, i, t, -1 / 0, !0);
|
|
718
|
-
g(e, "widthMm", i, t, Number.MIN_VALUE, !0),
|
|
719
|
-
for (const s of ["rowKey", "revisionField", "sourceTokenField"])
|
|
720
|
-
e.headerGrid !== void 0 && et(e.headerGrid, e.columns, `${i}.headerGrid`, t), e.layout !== void 0 && e.layout !== "page" && e.layout !== "wide" && t.push({ path: `${i}.layout`, message: "布局应为 page 或 wide" }),
|
|
719
|
+
g(e, "widthMm", i, t, Number.MIN_VALUE, !0), c(e, "dataset", i, t, !0), c(e, "title", i, t);
|
|
720
|
+
for (const s of ["rowKey", "revisionField", "sourceTokenField"]) c(e, s, i, t, e[s] !== void 0);
|
|
721
|
+
e.headerGrid !== void 0 && et(e.headerGrid, e.columns, `${i}.headerGrid`, t), e.layout !== void 0 && e.layout !== "page" && e.layout !== "wide" && t.push({ path: `${i}.layout`, message: "布局应为 page 或 wide" }), Q(e.columns, `${i}.columns`, t);
|
|
721
722
|
for (const s of ["fontSizePt", "rowHeightMm"]) g(e, s, i, t, Number.MIN_VALUE);
|
|
722
723
|
g(e, "paddingMm", i, t);
|
|
723
724
|
for (const s of ["header", "headerBold", "headerEveryPage", "border"]) A(e, s, i, t);
|
|
724
|
-
e.cardinality !== void 0 && e.cardinality !== "record" && t.push({ path: `${i}.cardinality`, message: "单记录区域类型应为 record" }),
|
|
725
|
+
e.cardinality !== void 0 && e.cardinality !== "record" && t.push({ path: `${i}.cardinality`, message: "单记录区域类型应为 record" }), c(e, "headerBackgroundColor", i, t), M(e.align, `${i}.align`, t, !0), M(e.headerAlign, `${i}.headerAlign`, t), b(e.headerStyle, `${i}.headerStyle`, t), it(e, i, t), Z(e.groupBy, `${i}.groupBy`, t), Ze(e.grandTotal, `${i}.grandTotal`, t);
|
|
725
726
|
}
|
|
726
|
-
function
|
|
727
|
+
function B(e, i, t) {
|
|
727
728
|
Array.isArray(e.richParagraphs) && e.richParagraphs.forEach((s, n) => {
|
|
728
|
-
if (!
|
|
729
|
+
if (!u(s)) return;
|
|
729
730
|
const a = `${i}.richParagraphs.${n}`;
|
|
730
731
|
M(s.align, `${a}.align`, t);
|
|
731
732
|
for (const o of ["lineHeight", "spaceBeforeMm", "spaceAfterMm", "indentMm"]) g(s, o, a, t);
|
|
732
733
|
Array.isArray(s.segments) && s.segments.forEach((o, f) => {
|
|
733
734
|
const r = `${a}.segments.${f}`;
|
|
734
|
-
if (!
|
|
735
|
+
if (!u(o)) {
|
|
735
736
|
t.push({ path: r, message: "富文本片段应为对象" });
|
|
736
737
|
return;
|
|
737
738
|
}
|
|
738
739
|
o.kind !== void 0 && o.kind !== "text" && o.kind !== "field" && t.push({ path: `${r}.kind`, message: "未知富文本片段类型" });
|
|
739
|
-
for (const d of ["text", "field"])
|
|
740
|
+
for (const d of ["text", "field"]) c(o, d, r, t);
|
|
740
741
|
b(o.style, `${r}.style`, t);
|
|
741
742
|
});
|
|
742
743
|
});
|
|
743
744
|
}
|
|
744
|
-
function
|
|
745
|
+
function L(e, i, t) {
|
|
745
746
|
b(e.style, `${i}.style`, t);
|
|
746
|
-
for (const n of ["text", "rawText", "imageData", "fallbackText", "nid", "rkey"])
|
|
747
|
-
if (e.lines !== void 0 && (!Array.isArray(e.lines) || e.lines.some((n) => typeof n != "string")) && t.push({ path: `${i}.lines`, message: "文本行应为字符串数组" }),
|
|
747
|
+
for (const n of ["text", "rawText", "imageData", "fallbackText", "nid", "rkey"]) c(e, n, i, t);
|
|
748
|
+
if (e.lines !== void 0 && (!Array.isArray(e.lines) || e.lines.some((n) => typeof n != "string")) && t.push({ path: `${i}.lines`, message: "文本行应为字符串数组" }), B(e, i, t), !u(e.grid)) return;
|
|
748
749
|
const s = e.grid;
|
|
749
750
|
g(s, "gapMm", `${i}.grid`, t), g(s, "paddingMm", `${i}.grid`, t);
|
|
750
751
|
for (const n of ["colWidthsMm", "rowHeightsMm"]) {
|
|
@@ -755,17 +756,17 @@ function j(e, i, t) {
|
|
|
755
756
|
Array.isArray(n) && n.forEach((o, f) => {
|
|
756
757
|
const r = `${i}.grid.cells.${a}.${f}`;
|
|
757
758
|
if (o !== null) {
|
|
758
|
-
if (!
|
|
759
|
+
if (!u(o)) {
|
|
759
760
|
t.push({ path: r, message: "网格单元格应为对象或 null" });
|
|
760
761
|
return;
|
|
761
762
|
}
|
|
762
|
-
for (const d of ["text", "rawText", "numberFormat"])
|
|
763
|
+
for (const d of ["text", "rawText", "numberFormat"]) c(o, d, r, t);
|
|
763
764
|
for (const d of ["colSpan", "rowSpan"]) {
|
|
764
765
|
const h = o[d];
|
|
765
766
|
h !== void 0 && (typeof h != "number" || !Number.isInteger(h) || h <= 0) && t.push({ path: `${r}.${d}`, message: "跨度应为正整数" });
|
|
766
767
|
}
|
|
767
|
-
o.value !== void 0 && o.value !== null && !["string", "number", "boolean"].includes(typeof o.value) && t.push({ path: `${r}.value`, message: "Excel 原始值应为字符串、数字、布尔值或 null" }), b(o.style, `${r}.style`, t),
|
|
768
|
-
|
|
768
|
+
o.value !== void 0 && o.value !== null && !["string", "number", "boolean"].includes(typeof o.value) && t.push({ path: `${r}.value`, message: "Excel 原始值应为字符串、数字、布尔值或 null" }), b(o.style, `${r}.style`, t), B(o, r, t), o.children !== void 0 && (Array.isArray(o.children) ? o.children.forEach((d, h) => {
|
|
769
|
+
u(d) && L(d, `${r}.children.${h}`, t);
|
|
769
770
|
}) : t.push({ path: `${r}.children`, message: "嵌套组件应为数组" }));
|
|
770
771
|
}
|
|
771
772
|
});
|
|
@@ -781,9 +782,9 @@ function nt(e, i, t) {
|
|
|
781
782
|
}
|
|
782
783
|
function at(e) {
|
|
783
784
|
const i = [], t = [];
|
|
784
|
-
return
|
|
785
|
+
return _(e, i), i.length ? { ok: !1, errors: i, warnings: t } : (u(e) ? (e.schemaVersion !== void 0 && e.schemaVersion !== fe && i.push({ path: "$.schemaVersion", message: "不支持的模板 schemaVersion" }), Ye(e.params, "$.params", i), I(e.dataContract, "$.dataContract", i), Oe(e, i), !Array.isArray(e.pages) || e.pages.length === 0 ? i.push({ path: "$.pages", message: "模板至少需要一页" }) : e.pages.forEach((s, n) => {
|
|
785
786
|
const a = `$.pages.${n}`;
|
|
786
|
-
if (!
|
|
787
|
+
if (!u(s)) {
|
|
787
788
|
i.push({ path: a, message: "页应为对象" });
|
|
788
789
|
return;
|
|
789
790
|
}
|
|
@@ -791,20 +792,20 @@ function at(e) {
|
|
|
791
792
|
for (const o of ["marginTopMm", "marginBottomMm", "marginLeftMm", "marginRightMm"]) g(s, o, a, i);
|
|
792
793
|
typeof s.widthMm == "number" && Number(s.marginLeftMm ?? 0) + Number(s.marginRightMm ?? 0) >= s.widthMm && i.push({ path: a, message: "横向页边距占满页面" }), typeof s.heightMm == "number" && Number(s.marginTopMm ?? 0) + Number(s.marginBottomMm ?? 0) >= s.heightMm && i.push({ path: a, message: "纵向页边距占满页面" }), Array.isArray(s.components) ? s.components.forEach((o, f) => {
|
|
793
794
|
const r = `${a}.components.${f}`;
|
|
794
|
-
|
|
795
|
+
u(o) && o.kind === "list" ? st(o, r, i) : (W(o, r, i, t), u(o) && L(o, r, i));
|
|
795
796
|
}) : i.push({ path: `${a}.components`, message: "组件应为数组" }), nt(s, a, i);
|
|
796
797
|
})) : i.push({ path: "$", message: "模板应为对象" }), { ok: i.length === 0, errors: i, warnings: t });
|
|
797
798
|
}
|
|
798
799
|
function ot(e) {
|
|
799
800
|
const i = [], t = [];
|
|
800
|
-
if (
|
|
801
|
-
if (!
|
|
801
|
+
if (_(e, i), i.length) return { ok: !1, errors: i, warnings: t };
|
|
802
|
+
if (!u(e)) i.push({ path: "$", message: "模板文档应为对象" });
|
|
802
803
|
else {
|
|
803
804
|
for (const n of Object.keys(e))
|
|
804
805
|
We.has(n) || i.push({ path: `$.${n}`, message: "模板文档存在未知字段;只保存模板与描述,不保存取数或业务数据" });
|
|
805
|
-
e.schemaVersion !==
|
|
806
|
-
for (const n of ["id", "name"])
|
|
807
|
-
for (const n of ["revision", "description"])
|
|
806
|
+
e.schemaVersion !== Y && i.push({ path: "$.schemaVersion", message: "不支持的模板文档版本" });
|
|
807
|
+
for (const n of ["id", "name"]) c(e, n, "$", i, !0);
|
|
808
|
+
for (const n of ["revision", "description"]) c(e, n, "$", i);
|
|
808
809
|
const s = at(e.template);
|
|
809
810
|
i.push(...s.errors.map((n) => ({ ...n, path: `$.template${n.path.slice(1)}` }))), t.push(...s.warnings.map((n) => ({ ...n, path: `$.template${n.path.slice(1)}` })));
|
|
810
811
|
}
|
|
@@ -816,8 +817,8 @@ function T(e) {
|
|
|
816
817
|
}
|
|
817
818
|
function yt(e) {
|
|
818
819
|
const i = [];
|
|
819
|
-
if (
|
|
820
|
-
const t = { ...e, schemaVersion: e.schemaVersion ??
|
|
820
|
+
if (_(e, i), i.length) throw new w(i);
|
|
821
|
+
const t = { ...e, schemaVersion: e.schemaVersion ?? Y };
|
|
821
822
|
return T(t), R(t);
|
|
822
823
|
}
|
|
823
824
|
function lt(e) {
|
|
@@ -836,7 +837,7 @@ function lt(e) {
|
|
|
836
837
|
function $t(e) {
|
|
837
838
|
T(e);
|
|
838
839
|
try {
|
|
839
|
-
return
|
|
840
|
+
return pe(e);
|
|
840
841
|
} catch (i) {
|
|
841
842
|
throw i instanceof RangeError ? new w([{ path: "$", message: i.message }]) : i;
|
|
842
843
|
}
|
|
@@ -862,13 +863,13 @@ function bt(e = []) {
|
|
|
862
863
|
}
|
|
863
864
|
export {
|
|
864
865
|
w as R,
|
|
865
|
-
|
|
866
|
-
|
|
866
|
+
Y as a,
|
|
867
|
+
Ne as b,
|
|
867
868
|
mt as c,
|
|
868
869
|
bt as d,
|
|
869
870
|
yt as e,
|
|
870
|
-
|
|
871
|
-
|
|
871
|
+
W as f,
|
|
872
|
+
ve as g,
|
|
872
873
|
ot as h,
|
|
873
874
|
pt as i,
|
|
874
875
|
Re as j,
|