@agile-team/mach-report 2.20.0 → 2.21.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 +6 -2
- package/dist/{ExcelBindingWizard-B7aeRg46.cjs → ExcelBindingWizard-B2xXBOJu.cjs} +1 -1
- package/dist/{ExcelBindingWizard-Chn6ZC2-.js → ExcelBindingWizard-CixTPQAL.js} +3 -3
- package/dist/{ParamEditor-BdFMa1CX.cjs → ParamEditor-DhHlNxai.cjs} +1 -1
- package/dist/{ParamEditor-o-7E7WZZ.js → ParamEditor-gKhvEsnr.js} +1 -1
- package/dist/{ReportBatchPanel-DVpmB7tG.cjs → ReportBatchPanel-BUdUfTdm.cjs} +1 -1
- package/dist/{ReportBatchPanel-CNJ4Useq.js → ReportBatchPanel-D-lyWKyf.js} +1 -1
- package/dist/ReportLabelStudio-BcjQt73a.cjs +1 -0
- package/dist/ReportLabelStudio-N2w6DdaZ.js +764 -0
- package/dist/{ReportPreview-CGcxwkAn.js → ReportPreview-BBJNlu2U.js} +8 -8
- package/dist/{ReportPreview-hlwvZ1wf.cjs → ReportPreview-nf4Dk1Jc.cjs} +2 -2
- package/dist/{ReportTemplateLibrary-DjjyZnZB.cjs → ReportTemplateLibrary-Cs9WKneQ.cjs} +1 -1
- package/dist/{ReportTemplateLibrary-DyIJhJjX.js → ReportTemplateLibrary-WZl-AK-2.js} +1 -1
- package/dist/{RuleEditor-BeknHHOD.js → RuleEditor-DGpmjCko.js} +3 -3
- package/dist/RuleEditor-Dtcq-7LO.cjs +1 -0
- package/dist/{TemplateOutlinePanel-D6TXg1aV.cjs → TemplateOutlinePanel-CkCh506f.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-Bv8CxbXS.js → TemplateOutlinePanel-cxp95OT9.js} +1 -1
- package/dist/{TemplateReusePanel-CfousvPY.js → TemplateReusePanel-BZ8VTtrO.js} +2 -2
- package/dist/{TemplateReusePanel-wrSbd_mr.cjs → TemplateReusePanel-CwttuSta.cjs} +1 -1
- package/dist/{TemplateReviewPanel-BKFcSbTh.cjs → TemplateReviewPanel-C2YjiaEC.cjs} +1 -1
- package/dist/{TemplateReviewPanel-F2tqWNLO.js → TemplateReviewPanel-C9cTvsRs.js} +1 -1
- package/dist/artifact-integrity.json +90 -92
- package/dist/{assets-2eC3mOcV.js → assets-CxHunY_9.js} +2 -2
- package/dist/{assets-B0Hxn4l6.cjs → assets-vbjAGgk8.cjs} +1 -1
- package/dist/{auto-BlchZ1b8.js → auto-BkdGiNtr.js} +4 -4
- package/dist/{auto-B0EZFIK1.cjs → auto-Tq7ReIC1.cjs} +1 -1
- package/dist/{component-tree-CvW4lzpv.js → component-tree-1_QCiQJX.js} +1 -1
- package/dist/component-tree-BjZIp6w9.cjs +1 -0
- package/dist/{data-bar-PtjXhMgN.js → data-bar-8baGYEZ9.js} +1 -1
- package/dist/{data-bar-Ce38juRZ.cjs → data-bar-YltqGTaC.cjs} +1 -1
- package/dist/designer-CDqok4S5.cjs +2 -0
- package/dist/designer-CIDHt5xz.js +6869 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +25 -3
- package/dist/designer.d.ts +25 -3
- package/dist/designer.js +1 -1
- package/dist/{encoding-B--eZpp1.cjs → encoding-B79hW4zq.cjs} +1 -1
- package/dist/{encoding-mctOLocI.js → encoding-BSeUwrN7.js} +2 -2
- package/dist/{font-loader-DBBJ5KE9.cjs → font-loader-BB372_XN.cjs} +1 -1
- package/dist/{font-loader-DW8tIaNp.js → font-loader-Di0lQKFf.js} +1 -1
- package/dist/grid-geometry-D3SJgWFv.js +136 -0
- package/dist/grid-geometry-D8ReblRV.cjs +1 -0
- package/dist/index.cjs +6 -6
- package/dist/index.js +194 -195
- package/dist/json-snapshot-I5VI84Vp.cjs +2 -0
- package/dist/{json-snapshot-By4ZVVUt.js → json-snapshot-Kgn459Oj.js} +895 -879
- package/dist/{pdf-DqyxJ96U.cjs → pdf-CARdBcuw.cjs} +45 -45
- package/dist/{pdf-CKROKygt.js → pdf-DmlnL5eB.js} +13 -14
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BMsIIJDh.cjs → plugin-BaRUGORD.cjs} +1 -1
- package/dist/{plugin-Co1oKD7T.js → plugin-D4kAxfLG.js} +1 -1
- package/dist/{prefill-D7EswyTI.cjs → prefill-Bpyn58AZ.cjs} +1 -1
- package/dist/{prefill-B8H9qwE4.js → prefill-CJSazcVY.js} +2 -2
- package/dist/{prepared-CGVphji3.cjs → prepared-BiSz_9vN.cjs} +1 -1
- package/dist/{prepared-BE-4jfX5.js → prepared-BwjwEzFz.js} +1 -1
- package/dist/{protocol-Cr81vFSQ.js → protocol-Bs9-ohHN.js} +3 -3
- package/dist/{protocol-ByRVzzQG.cjs → protocol-C8VWF9An.cjs} +1 -1
- package/dist/record-bindings-Ct1HkPrc.cjs +1 -0
- package/dist/{record-bindings-DEJtmo3p.js → record-bindings-VZGS-Qd8.js} +1 -1
- package/dist/{region-binding-workflow-CBg0l_tj.js → region-binding-workflow-Cy4GIOUo.js} +2 -2
- package/dist/{region-binding-workflow-D05tOYn3.cjs → region-binding-workflow-JNowHd0A.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/rich-text-layout-K48VHUoW.cjs +3 -0
- package/dist/{rich-text-layout-Ct5WrY1g.js → rich-text-layout-wxBhnAS7.js} +1 -1
- package/dist/{runtime-CEMvybO7.js → runtime-BDf5x1i1.js} +5 -5
- package/dist/runtime-DsJt1PIf.cjs +1 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server-node.cjs +4 -4
- package/dist/server-node.js +1272 -1274
- package/dist/server.cjs +1 -1
- package/dist/server.js +8 -8
- package/dist/style.css +1 -1
- package/dist/{template-catalog-CmbWOJqy.js → template-catalog-DFwIS9aN.js} +3 -3
- package/dist/{template-catalog-Utu4GP09.cjs → template-catalog-D_2jdnkL.cjs} +1 -1
- package/dist/template-fragments-DZVUBhuB.cjs +1 -0
- package/dist/{template-fragments-DWgo9tlZ.js → template-fragments-Dng-AlHk.js} +11 -11
- package/dist/{template-registry-BIhIHOab.js → template-registry-DhBqoD7W.js} +120 -118
- package/dist/template-registry-DpLUSLwF.cjs +1 -0
- package/dist/{column-visual-BpgQVWwT.js → template-serialization-Cc3h-miv.js} +74 -65
- package/dist/{column-visual-CtYxnBCP.cjs → template-serialization-D1R5oAqh.cjs} +1 -1
- package/dist/{textwrap-BEIg2w8y.js → textwrap-CkGjRFT3.js} +1 -1
- package/dist/textwrap-OTOUMr4f.cjs +4 -0
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +4 -4
- package/dist/{workbook-session-B94EwVa_.cjs → workbook-session-NYv01LHe.cjs} +1 -1
- package/dist/{workbook-session-BoScoOg-.js → workbook-session-oinxX3qo.js} +2 -2
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.js +204 -205
- package/package.json +1 -1
- package/dist/ReportLabelStudio-Drsm9sAS.cjs +0 -1
- package/dist/ReportLabelStudio-r8VFnhGQ.js +0 -589
- package/dist/RuleEditor-BVuRn_OQ.cjs +0 -1
- package/dist/component-tree-6TV7W6Yj.cjs +0 -1
- package/dist/designer-B52ddmHO.js +0 -6676
- package/dist/designer-Dtsw_rh7.cjs +0 -2
- package/dist/grid-geometry-BNptEcMm.js +0 -65
- package/dist/grid-geometry-CZ_cYB6O.cjs +0 -1
- package/dist/json-snapshot-jiXff4lc.cjs +0 -2
- package/dist/record-bindings-ehjnCDHt.cjs +0 -1
- package/dist/rich-text-layout-ALlMoYOG.cjs +0 -3
- package/dist/runtime-CDA6d263.cjs +0 -1
- package/dist/style-67OqfNed.js +0 -73
- package/dist/style-C22Pbv3T.cjs +0 -1
- package/dist/template-fragments-C_zSHJAa.cjs +0 -1
- package/dist/template-registry-DzWswQI5.cjs +0 -1
- package/dist/textwrap-BI-yJ6Wt.cjs +0 -4
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { k as q, v as X, c as Y } from "./computed-C8NRZQss.js";
|
|
2
2
|
import { d as Q, v as Z } from "./matrix-Dy-tyY7E.js";
|
|
3
|
-
import { c as
|
|
3
|
+
import { c as C, v as ee, r as te, R as ie } from "./component-tree-1_QCiQJX.js";
|
|
4
4
|
import { c as se } from "./code-options-BKXXY7NI.js";
|
|
5
5
|
import { v as ne, m as ae } from "./param-validation-CnDEd2l-.js";
|
|
6
|
-
import { a as oe, b as fe, v as re } from "./
|
|
7
|
-
function
|
|
6
|
+
import { a as oe, b as fe, M as B, v as re, s as de } from "./template-serialization-Cc3h-miv.js";
|
|
7
|
+
function he(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 D(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 ue(e, i, t) {
|
|
14
|
+
D(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: "派生结果标记应为布尔值" }), V(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 V(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
|
+
he(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 D(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 me = /* @__PURE__ */ new Set([
|
|
33
33
|
"text",
|
|
34
34
|
"image",
|
|
35
35
|
"barcode",
|
|
@@ -42,19 +42,19 @@ const ue = /* @__PURE__ */ new Set([
|
|
|
42
42
|
function g(e) {
|
|
43
43
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function k(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 ce(e, i, t, s) {
|
|
49
49
|
const n = e[i];
|
|
50
|
-
(typeof n != "number" || !Number.isFinite(n)) && s.push({ path: `${t}.${i}`, message: `应为有限数字,实际 ${
|
|
50
|
+
(typeof n != "number" || !Number.isFinite(n)) && s.push({ path: `${t}.${i}`, message: `应为有限数字,实际 ${k(n)}` });
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function ge(e, i, t) {
|
|
53
53
|
if (e !== void 0) {
|
|
54
54
|
const s = `${i}.table`;
|
|
55
55
|
if (!g(e)) t.push({ path: s, message: "逻辑表来源应为对象" });
|
|
56
56
|
else {
|
|
57
|
-
|
|
57
|
+
V(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 ce(e, i, t) {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function pe(e, i, t, s) {
|
|
66
66
|
if (e !== void 0)
|
|
67
67
|
if (!g(e) || !Array.isArray(e.cells))
|
|
68
68
|
t.push({ path: `${i}.grid.cells`, message: "grid.cells 应为二维数组" });
|
|
@@ -80,7 +80,7 @@ function ge(e, i, t, s) {
|
|
|
80
80
|
t.push({ path: d, message: "网格单元格应为对象或 null" });
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
|
|
83
|
+
ue(f, d, t), f.dataBar !== void 0 && !ee(f.dataBar) && t.push({ path: `${d}.dataBar`, message: "数据条应包含 0–1 有序比例与 #RRGGBB 颜色" }), j(f.richParagraphs, d, t), Array.isArray(f.children) && f.children.forEach((h, p) => {
|
|
84
84
|
I(h, `${i}.grid.cells.${o}.${r}.children.${p}`, t, s);
|
|
85
85
|
});
|
|
86
86
|
});
|
|
@@ -96,7 +96,7 @@ function T(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 ye(e, i, t) {
|
|
100
100
|
if (e !== void 0) {
|
|
101
101
|
if (!g(e)) {
|
|
102
102
|
t.push({ path: i, message: "富文本样式应为对象" });
|
|
@@ -109,7 +109,7 @@ function pe(e, i, t) {
|
|
|
109
109
|
T(e, ["fontSize", "fontSizePx", "lineWidthPt", "lineHeight", "opacity"], i, t), T(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 le(e, i, t) {
|
|
113
113
|
if (!g(e)) {
|
|
114
114
|
t.push({ path: i, message: "富文本片段应为对象" });
|
|
115
115
|
return;
|
|
@@ -117,9 +117,9 @@ function ye(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
|
+
ye(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 V(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), T(s, ["lineHeight", "spaceBeforeMm", "spaceAfterMm", "indentMm"], a, t), s.segments.forEach((o, f) =>
|
|
134
|
+
N(s.align, ["left", "center", "right", "justify"], `${a}.align`, t), T(s, ["lineHeight", "spaceBeforeMm", "spaceAfterMm", "indentMm"], a, t), s.segments.forEach((o, f) => le(o, `${a}.segments.${f}`, t));
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
function K(e, i, t, s = []) {
|
|
139
|
-
const n =
|
|
139
|
+
const n = C([e], i);
|
|
140
140
|
if (n) {
|
|
141
141
|
t.push(n);
|
|
142
142
|
return;
|
|
@@ -149,18 +149,18 @@ function I(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 字符串" }) : me.has(n) || s.push({
|
|
153
153
|
path: `${i}.kind`,
|
|
154
|
-
message: `未知组件类型 ${
|
|
154
|
+
message: `未知组件类型 ${k(n)},将以兜底方式渲染`
|
|
155
155
|
});
|
|
156
156
|
for (const a of ["leftMm", "topMm", "widthMm", "heightMm"])
|
|
157
|
-
|
|
157
|
+
ce(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
|
+
ge(e.table, i, t), be(e.code, n, i, t), $e(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" }), pe(e.grid, i, t, s), j(e.richParagraphs, i, t);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function $e(e, i, t) {
|
|
164
164
|
if (e.chartBinding !== void 0)
|
|
165
165
|
try {
|
|
166
166
|
if (Q(e.chartBinding), e.kind !== "chart" || ["binding", "imageData", "grid", "pageAnchor"].some((s) => e[s] !== void 0)) throw new Error("绑定图表不能设置图片、网格、记录绑定或页眉页脚");
|
|
@@ -169,7 +169,7 @@ function le(e, i, t) {
|
|
|
169
169
|
t.push({ path: `${i}.chartBinding`, message: s instanceof Error ? s.message : String(s) });
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function be(e, i, t, s) {
|
|
173
173
|
if (e !== void 0)
|
|
174
174
|
for (const n of se(e, i)) s.push({ path: `${t}.code${n.path ? `.${n.path}` : ""}`, message: n.message });
|
|
175
175
|
}
|
|
@@ -183,18 +183,18 @@ function H(e, i, t) {
|
|
|
183
183
|
});
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Ae(e, i, t, s = []) {
|
|
187
187
|
if (!g(e)) {
|
|
188
188
|
t.push({ path: i, message: "页应为对象" });
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
191
|
const n = e.pageWidthMm, a = e.pageHeightMm;
|
|
192
|
-
(typeof n != "number" || !Number.isFinite(n) || n <= 0) && t.push({ path: `${i}.pageWidthMm`, message: `页宽非法: ${
|
|
192
|
+
(typeof n != "number" || !Number.isFinite(n) || n <= 0) && t.push({ path: `${i}.pageWidthMm`, message: `页宽非法: ${k(n)}` }), (typeof a != "number" || !(a > 0 && a < 5e3)) && t.push({ path: `${i}.pageHeightMm`, message: `页高非法: ${k(a)}` }), e.layout !== void 0 && e.layout !== "page" && e.layout !== "wide" && t.push({ path: `${i}.layout`, message: "布局应为 page 或 wide" });
|
|
193
193
|
const o = e.components;
|
|
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 = C(o, `${i}.components`);
|
|
198
198
|
if (f) {
|
|
199
199
|
t.push(f);
|
|
200
200
|
return;
|
|
@@ -204,7 +204,7 @@ function be(e, i, t, s = []) {
|
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function we(e) {
|
|
208
208
|
const i = [], t = [], s = g(e) ? e.pages : void 0;
|
|
209
209
|
if (g(e) && e.requiresRecalculation !== void 0 && typeof e.requiresRecalculation != "boolean" && i.push({ path: "$.requiresRecalculation", message: "重算能力要求应为布尔值" }), !Array.isArray(s))
|
|
210
210
|
i.push({
|
|
@@ -214,7 +214,7 @@ function Ae(e) {
|
|
|
214
214
|
else {
|
|
215
215
|
const n = te(s);
|
|
216
216
|
if (n) return { ok: !1, errors: [...i, n], warnings: t };
|
|
217
|
-
s.forEach((o, f) =>
|
|
217
|
+
s.forEach((o, f) => Ae(o, `$.pages.${f}`, i, t)), s.length > 2e3 && t.push({
|
|
218
218
|
path: "$.pages",
|
|
219
219
|
message: `页数异常大(${s.length} 页),渲染与打印耗时可能显著增加`
|
|
220
220
|
});
|
|
@@ -229,43 +229,43 @@ function Ae(e) {
|
|
|
229
229
|
}
|
|
230
230
|
return { ok: i.length === 0, errors: i, warnings: t };
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
const i =
|
|
232
|
+
function nt(e) {
|
|
233
|
+
const i = we(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 P(e) {
|
|
241
241
|
return e.kind === "list" ? e.id : e.nid;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function Me(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
|
-
function
|
|
247
|
-
const t = e.filter((n) => i.componentIds.includes(
|
|
246
|
+
function ve(e, i) {
|
|
247
|
+
const t = e.filter((n) => i.componentIds.includes(P(n) ?? ""));
|
|
248
248
|
if (t.filter((n) => n.kind === "list" && n.cardinality !== "record").length && t.length !== 1) throw new Error("纵向重复区域必须独占流式分段,不能与静态或单记录区域并排");
|
|
249
249
|
for (const n of t) {
|
|
250
250
|
const a = n.kind === "list" ? n.topMm + (n.rowHeightMm ?? 0) : n.topMm + n.heightMm;
|
|
251
251
|
if (n.topMm < i.topMm - 1e-3 || a > i.topMm + i.heightMm + 1e-3) throw new Error("流式分段应完整包含其组件的原始纵向范围");
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function at(e, i) {
|
|
255
255
|
if (!i) return e.map((s) => ({ components: [s] }));
|
|
256
|
-
const t = new Map(e.map((s) => [
|
|
256
|
+
const t = new Map(e.map((s) => [P(s), s]));
|
|
257
257
|
return i.bands.map((s) => ({ band: s, components: s.componentIds.map((n) => {
|
|
258
258
|
const a = t.get(n);
|
|
259
259
|
if (!a) throw new Error(`流式区域引用不存在的组件:${n}`);
|
|
260
260
|
return a;
|
|
261
261
|
}) }));
|
|
262
262
|
}
|
|
263
|
-
function
|
|
263
|
+
function Ee(e, i) {
|
|
264
264
|
if (!i || !Array.isArray(i.bands) || !i.bands.length || i.bands.length > 1e4) throw new Error("流式排版应包含 1–10000 个区域");
|
|
265
265
|
const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
266
266
|
for (const n of e) {
|
|
267
|
-
if (
|
|
268
|
-
const a =
|
|
267
|
+
if (Me(n)) continue;
|
|
268
|
+
const a = P(n);
|
|
269
269
|
if (!a || t.has(a)) throw new Error("流式排版组件应具有唯一标识");
|
|
270
270
|
t.add(a);
|
|
271
271
|
}
|
|
@@ -280,20 +280,20 @@ function ke(e, i, t, s) {
|
|
|
280
280
|
if (!t.has(o) || s.has(o)) throw new Error(`流式区域组件缺失、重复或包含页锚点:${o}`);
|
|
281
281
|
s.add(o);
|
|
282
282
|
}
|
|
283
|
-
|
|
283
|
+
ve(e, a), n = a.topMm + a.heightMm;
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
|
-
const
|
|
286
|
+
const Ne = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
287
287
|
function l(e) {
|
|
288
288
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
289
289
|
}
|
|
290
290
|
function v(e) {
|
|
291
|
-
return typeof e == "string" && !!e.trim() && !
|
|
291
|
+
return typeof e == "string" && !!e.trim() && !Ne.has(e);
|
|
292
292
|
}
|
|
293
293
|
function S(e, i, t, s) {
|
|
294
294
|
for (const n of Object.keys(e)) i.includes(n) || s.push({ path: `${t}.${n}`, message: "存在未知配置字段" });
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function Se(e, i, t) {
|
|
297
297
|
if (e !== void 0) {
|
|
298
298
|
if (!l(e) || !["number", "percent", "date"].includes(String(e.kind))) {
|
|
299
299
|
t.push({ path: i, message: "绑定格式应为 number、percent 或 date" });
|
|
@@ -302,7 +302,7 @@ function Ne(e, i, t) {
|
|
|
302
302
|
S(e, e.kind === "date" ? ["kind", "pattern"] : e.kind === "number" ? ["kind", "digits", "thousands"] : ["kind", "digits"], i, t), e.digits !== void 0 && (!Number.isInteger(e.digits) || Number(e.digits) < 0 || Number(e.digits) > 100) && t.push({ path: `${i}.digits`, message: "精度应为 0..100 整数" }), e.thousands !== void 0 && typeof e.thousands != "boolean" && t.push({ path: `${i}.thousands`, message: "千分位开关应为布尔值" }), e.pattern !== void 0 && typeof e.pattern != "string" && t.push({ path: `${i}.pattern`, message: "日期格式应为字符串" });
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function xe(e, i, t) {
|
|
306
306
|
const s = e.binding;
|
|
307
307
|
if (s === void 0) return;
|
|
308
308
|
const n = `${i}.binding`;
|
|
@@ -312,9 +312,9 @@ function Se(e, i, t) {
|
|
|
312
312
|
}
|
|
313
313
|
(!["text", "image", "barcode", "qrcode"].includes(String(e.kind)) || e.grid !== void 0) && t.push({ path: n, message: "绑定仅支持独立文本、图片、条码与二维码组件" }), S(s, ["field", "format", "prefix", "suffix", "emptyText"], n, t), v(s.field) || t.push({ path: `${n}.field`, message: "绑定字段应为安全的非空字段名(按字面读取自有字段)" });
|
|
314
314
|
for (const a of ["prefix", "suffix", "emptyText"]) s[a] !== void 0 && typeof s[a] != "string" && t.push({ path: `${n}.${a}`, message: "应为字符串" });
|
|
315
|
-
|
|
315
|
+
Se(s.format, `${n}.format`, t), e.kind === "image" && ["format", "prefix", "suffix"].some((a) => s[a] !== void 0) && t.push({ path: n, message: "图片绑定直接读取 PNG/JPEG data URL,不支持文本格式或前后缀" });
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function Re(e, i) {
|
|
318
318
|
if (!l(e)) {
|
|
319
319
|
i.push({ path: "$.repeat", message: "逐记录配置应为对象" });
|
|
320
320
|
return;
|
|
@@ -325,7 +325,7 @@ function xe(e, i) {
|
|
|
325
325
|
}
|
|
326
326
|
function J(e, i, t, s) {
|
|
327
327
|
if (!l(e)) return;
|
|
328
|
-
|
|
328
|
+
xe(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
329
|
const n = e.grid;
|
|
330
330
|
l(n) && Array.isArray(n.cells) && n.cells.forEach((a, o) => {
|
|
331
331
|
Array.isArray(a) && a.forEach((f, r) => {
|
|
@@ -333,9 +333,9 @@ function J(e, i, t, s) {
|
|
|
333
333
|
});
|
|
334
334
|
});
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function Te(e, i) {
|
|
337
337
|
const t = e.repeat !== void 0;
|
|
338
|
-
t &&
|
|
338
|
+
t && Re(e.repeat, i), Array.isArray(e.pages) && e.pages.forEach((s, n) => {
|
|
339
339
|
if (!l(s)) return;
|
|
340
340
|
const a = `$.pages.${n}`;
|
|
341
341
|
t && (s.layout === "wide" || s.flow !== void 0) && i.push({ path: a, message: "逐记录标签仅支持固定尺寸页面,不支持宽表或流式分区" }), Array.isArray(s.components) && s.components.forEach((o, f) => {
|
|
@@ -346,7 +346,7 @@ function Re(e, i) {
|
|
|
346
346
|
});
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function Fe(e) {
|
|
350
350
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
351
351
|
}
|
|
352
352
|
function F(e, i, t) {
|
|
@@ -366,7 +366,7 @@ function W(e, i, t) {
|
|
|
366
366
|
const s = /* @__PURE__ */ new Set();
|
|
367
367
|
e.forEach((n, a) => {
|
|
368
368
|
const o = `${i}.${a}`;
|
|
369
|
-
if (!
|
|
369
|
+
if (!Fe(n)) {
|
|
370
370
|
t.push({ path: o, message: "聚合应为对象" });
|
|
371
371
|
return;
|
|
372
372
|
}
|
|
@@ -394,12 +394,12 @@ function W(e, i, t) {
|
|
|
394
394
|
}
|
|
395
395
|
});
|
|
396
396
|
}
|
|
397
|
-
function
|
|
397
|
+
function Ie(e, i, t) {
|
|
398
398
|
if (e === void 0) return;
|
|
399
399
|
const s = X(e);
|
|
400
400
|
for (const n of s.errors) t.push({ path: i, message: n });
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function Pe(e, i, t) {
|
|
403
403
|
if (e !== void 0)
|
|
404
404
|
try {
|
|
405
405
|
Z(e);
|
|
@@ -430,11 +430,11 @@ class w extends Error {
|
|
|
430
430
|
super(`模板校验失败:${i.slice(0, 3).map((t) => `${t.path}: ${t.message}`).join("; ")}`), this.errors = i, this.name = "ReportTemplateError";
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
|
-
const
|
|
433
|
+
const Le = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]), _e = /* @__PURE__ */ new Set(["schemaVersion", "id", "name", "revision", "description", "template"]), Ce = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]), E = 2e5, Be = 64;
|
|
434
434
|
function u(e) {
|
|
435
435
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
436
436
|
}
|
|
437
|
-
function
|
|
437
|
+
function De(e, i, t) {
|
|
438
438
|
const s = Object.getPrototypeOf(e), n = Array.isArray(e);
|
|
439
439
|
if (n ? s !== Array.prototype : s !== Object.prototype && s !== null)
|
|
440
440
|
return t.push({ path: i, message: "模板对象必须使用普通 JSON 对象原型" }), !1;
|
|
@@ -445,30 +445,30 @@ function Be(e, i, t) {
|
|
|
445
445
|
}
|
|
446
446
|
return Object.getOwnPropertySymbols(e).length > 0 ? (t.push({ path: i, message: "模板不能包含 Symbol 键" }), !1) : !0;
|
|
447
447
|
}
|
|
448
|
-
function
|
|
449
|
-
return
|
|
448
|
+
function Ve(e, i, t, s) {
|
|
449
|
+
return Le.has(e) ? (s.push({ path: t, message: "模板不能包含可能污染原型的键" }), !1) : i.get || i.set || !i.enumerable ? (s.push({ path: t, message: "模板不能包含访问器或不可枚举字段" }), !1) : !0;
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function je(e) {
|
|
452
452
|
return e === null || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e);
|
|
453
453
|
}
|
|
454
|
-
function
|
|
454
|
+
function O(e, i) {
|
|
455
455
|
const t = /* @__PURE__ */ new Set();
|
|
456
456
|
let s = 0, n = 0, a = !1;
|
|
457
457
|
const o = (f, r, d) => {
|
|
458
458
|
if (!a) {
|
|
459
|
-
if (++s >
|
|
460
|
-
s ===
|
|
459
|
+
if (++s > E) {
|
|
460
|
+
s === E + 1 && i.push({ path: r, message: "模板超过 JSON 节点安全上限" });
|
|
461
461
|
return;
|
|
462
462
|
}
|
|
463
|
-
if (d >
|
|
463
|
+
if (d > Be) {
|
|
464
464
|
i.push({ path: r, message: "模板嵌套层级过深" });
|
|
465
465
|
return;
|
|
466
466
|
}
|
|
467
467
|
if (typeof f == "string") {
|
|
468
|
-
n += f.length, n >
|
|
468
|
+
n += f.length, n > B && (a = !0, i.push({ path: r, message: "模板文本超过 1000 万字符的安全上限" }));
|
|
469
469
|
return;
|
|
470
470
|
}
|
|
471
|
-
if (!
|
|
471
|
+
if (!je(f)) {
|
|
472
472
|
if (!f || typeof f != "object") {
|
|
473
473
|
i.push({ path: r, message: "模板只允许 JSON 值,不允许函数、undefined 或非有限数字" });
|
|
474
474
|
return;
|
|
@@ -477,12 +477,12 @@ function C(e, i) {
|
|
|
477
477
|
i.push({ path: r, message: "模板不能包含循环引用" });
|
|
478
478
|
return;
|
|
479
479
|
}
|
|
480
|
-
if (
|
|
480
|
+
if (De(f, r, i)) {
|
|
481
481
|
t.add(f);
|
|
482
482
|
for (const [h, p] of Object.entries(Object.getOwnPropertyDescriptors(f))) {
|
|
483
483
|
if (Array.isArray(f) && h === "length") continue;
|
|
484
484
|
const y = `${r}.${h}`;
|
|
485
|
-
if (
|
|
485
|
+
if (Ve(h, p, y, i) && o(p.value, y, d + 1), s > E || a) break;
|
|
486
486
|
}
|
|
487
487
|
t.delete(f);
|
|
488
488
|
}
|
|
@@ -503,7 +503,7 @@ function b(e, i, t, s) {
|
|
|
503
503
|
e[i] !== void 0 && typeof e[i] != "boolean" && s.push({ path: `${t}.${i}`, message: "应为布尔值" });
|
|
504
504
|
}
|
|
505
505
|
function M(e, i, t, s = !1) {
|
|
506
|
-
e !== void 0 && !
|
|
506
|
+
e !== void 0 && !Ce.has(e) && !(s && e === "auto") && t.push({ path: i, message: `未知对齐方式${s ? "(支持 auto)" : ""}` });
|
|
507
507
|
}
|
|
508
508
|
function $(e, i, t) {
|
|
509
509
|
if (e !== void 0) {
|
|
@@ -519,7 +519,7 @@ function $(e, i, t) {
|
|
|
519
519
|
for (const s of ["fontFamily", "color", "backgroundColor", "lineColor", "borderColor"]) m(e, s, i, t);
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
|
-
function
|
|
522
|
+
function Ke(e, i, t) {
|
|
523
523
|
if (e === void 0) return;
|
|
524
524
|
if (!Array.isArray(e)) {
|
|
525
525
|
t.push({ path: i, message: "参数定义应为数组" });
|
|
@@ -539,7 +539,7 @@ function Ve(e, i, t) {
|
|
|
539
539
|
const d = a[r];
|
|
540
540
|
d !== void 0 && (typeof d != "number" || !Number.isSafeInteger(d) || d < 0) && t.push({ path: `${f}.${r}`, message: "长度边界应为非负整数" });
|
|
541
541
|
}
|
|
542
|
-
|
|
542
|
+
He(a, f, t), a.options !== void 0 && (Array.isArray(a.options) ? a.options.forEach((r, d) => {
|
|
543
543
|
const h = `${f}.options.${d}`;
|
|
544
544
|
if (!u(r)) t.push({ path: h, message: "选项应为对象" });
|
|
545
545
|
else
|
|
@@ -547,7 +547,7 @@ function Ve(e, i, t) {
|
|
|
547
547
|
}) : t.push({ path: `${f}.options`, message: "选项应为数组" }));
|
|
548
548
|
}), t.length === n && t.push(...ne(e).map((a) => ({ path: a.path.replace("$.paramDefs", i), message: a.message })));
|
|
549
549
|
}
|
|
550
|
-
function
|
|
550
|
+
function He(e, i, t) {
|
|
551
551
|
for (const a of ["min", "max"]) {
|
|
552
552
|
const o = e[a];
|
|
553
553
|
if (o === void 0) continue;
|
|
@@ -567,7 +567,7 @@ function U(e, i, t) {
|
|
|
567
567
|
t.push({ path: a, message: "列应为对象" });
|
|
568
568
|
return;
|
|
569
569
|
}
|
|
570
|
-
if (
|
|
570
|
+
if (D(s, a, t), s.visual !== void 0 && !re(s.visual) && t.push({ path: `${a}.visual`, message: "列可视化配置无效,请检查类型、数值范围和颜色" }), b(s, "hidden", a, t), F(s.visibleWhen, `${a}.visibleWhen`, t), typeof s.header != "string" && t.push({ path: `${a}.header`, message: "表头应为字符串(允许空白表头)" }), m(s, "field", a, t, !0), c(s, "widthMm", a, t, Number.MIN_VALUE, !0), $(s.style, `${a}.style`, t), $(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)
|
|
571
571
|
if (!u(s.format) || !["number", "percent", "date"].includes(s.format.kind))
|
|
572
572
|
t.push({ path: `${a}.format`, message: "未知列格式" });
|
|
573
573
|
else {
|
|
@@ -596,7 +596,7 @@ function z(e, i, t) {
|
|
|
596
596
|
b(e, "keepWithNext", i, t), b(e, "repeatHeader", i, t), W(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: "小计字段应为字符串数组" });
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function Je(e, i, t) {
|
|
600
600
|
if (!(e === void 0 || typeof e == "boolean")) {
|
|
601
601
|
if (!u(e)) {
|
|
602
602
|
t.push({ path: i, message: "合计应为布尔值或对象" });
|
|
@@ -605,17 +605,17 @@ function He(e, i, t) {
|
|
|
605
605
|
m(e, "label", i, t), W(e.aggregates, `${i}.aggregates`, t), $(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: "合计字段应为字符串数组" });
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function We(e, i, t, s) {
|
|
609
609
|
const n = { kind: "rect", leftMm: 0, topMm: 0, widthMm: 1, heightMm: 1, grid: e };
|
|
610
610
|
if (K(n, t, s, []), L(n, t, s), !u(e) || !Array.isArray(e.cells)) return;
|
|
611
611
|
const a = e.cells, o = Array.isArray(i) ? i.length : 0;
|
|
612
|
-
if (a.length * o >
|
|
612
|
+
if (a.length * o > E) {
|
|
613
613
|
s.push({ path: t, message: "表头逻辑网格超过 20 万格安全上限" });
|
|
614
614
|
return;
|
|
615
615
|
}
|
|
616
|
-
e.cells.length || s.push({ path: `${t}.cells`, message: "表头至少需要一行" }), Array.isArray(e.colWidthsMm) && e.colWidthsMm.length !== o && s.push({ path: `${t}.colWidthsMm`, message: "表头列宽数量应与列表列数一致" }), Array.isArray(e.rowHeightsMm) && e.rowHeightsMm.length !== e.cells.length && s.push({ path: `${t}.rowHeightsMm`, message: "表头行高数量应与行数一致" }),
|
|
616
|
+
e.cells.length || s.push({ path: `${t}.cells`, message: "表头至少需要一行" }), Array.isArray(e.colWidthsMm) && e.colWidthsMm.length !== o && s.push({ path: `${t}.colWidthsMm`, message: "表头列宽数量应与列表列数一致" }), Array.isArray(e.rowHeightsMm) && e.rowHeightsMm.length !== e.cells.length && s.push({ path: `${t}.rowHeightsMm`, message: "表头行高数量应与行数一致" }), Ge(a, o, t, s);
|
|
617
617
|
}
|
|
618
|
-
function
|
|
618
|
+
function Ge(e, i, t, s) {
|
|
619
619
|
const n = /* @__PURE__ */ new Set();
|
|
620
620
|
e.forEach((a, o) => {
|
|
621
621
|
if (!Array.isArray(a)) return;
|
|
@@ -631,8 +631,8 @@ function We(e, i, t, s) {
|
|
|
631
631
|
});
|
|
632
632
|
});
|
|
633
633
|
}
|
|
634
|
-
function
|
|
635
|
-
if (Oe(e, i, t),
|
|
634
|
+
function Ue(e, i, t) {
|
|
635
|
+
if (Oe(e, i, t), Ie(e.computed, `${i}.computed`, t), Pe(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 汇总,不能同时配置普通分组、总计或主从明细" }), F(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;
|
|
636
636
|
const s = e.detail, n = `${i}.detail`;
|
|
637
637
|
if (!u(s)) {
|
|
638
638
|
t.push({ path: n, message: "主从关联应为对象" });
|
|
@@ -642,15 +642,15 @@ function Ge(e, i, t) {
|
|
|
642
642
|
for (const a of ["rowKey", "revisionField", "sourceTokenField"]) m(s, a, n, t, s[a] !== void 0);
|
|
643
643
|
m(s, "label", n, t), b(s, "header", n, t), c(s, "rowHeightMm", n, t, Number.MIN_VALUE), U(s.columns, `${n}.columns`, t), s.unmatched !== void 0 && s.unmatched !== "error" && s.unmatched !== "ignore" && t.push({ path: `${n}.unmatched`, message: "未关联明细策略应为 error 或 ignore" });
|
|
644
644
|
}
|
|
645
|
-
function
|
|
645
|
+
function ze(e, i, t) {
|
|
646
646
|
for (const s of ["leftMm", "topMm"]) c(e, s, i, t, -1 / 0, !0);
|
|
647
647
|
c(e, "widthMm", i, t, Number.MIN_VALUE, !0), m(e, "dataset", i, t, !0), m(e, "title", i, t);
|
|
648
648
|
for (const s of ["rowKey", "revisionField", "sourceTokenField"]) m(e, s, i, t, e[s] !== void 0);
|
|
649
|
-
e.headerGrid !== void 0 &&
|
|
649
|
+
e.headerGrid !== void 0 && We(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" }), U(e.columns, `${i}.columns`, t);
|
|
650
650
|
for (const s of ["fontSizePt", "rowHeightMm"]) c(e, s, i, t, Number.MIN_VALUE);
|
|
651
651
|
c(e, "paddingMm", i, t);
|
|
652
652
|
for (const s of ["header", "headerBold", "headerEveryPage", "border"]) b(e, s, i, t);
|
|
653
|
-
e.cardinality !== void 0 && e.cardinality !== "record" && t.push({ path: `${i}.cardinality`, message: "单记录区域类型应为 record" }), m(e, "headerBackgroundColor", i, t), M(e.align, `${i}.align`, t, !0), M(e.headerAlign, `${i}.headerAlign`, t), $(e.headerStyle, `${i}.headerStyle`, t),
|
|
653
|
+
e.cardinality !== void 0 && e.cardinality !== "record" && t.push({ path: `${i}.cardinality`, message: "单记录区域类型应为 record" }), m(e, "headerBackgroundColor", i, t), M(e.align, `${i}.align`, t, !0), M(e.headerAlign, `${i}.headerAlign`, t), $(e.headerStyle, `${i}.headerStyle`, t), Ue(e, i, t), z(e.groupBy, `${i}.groupBy`, t), Je(e.grandTotal, `${i}.grandTotal`, t);
|
|
654
654
|
}
|
|
655
655
|
function _(e, i, t) {
|
|
656
656
|
Array.isArray(e.richParagraphs) && e.richParagraphs.forEach((s, n) => {
|
|
@@ -700,17 +700,17 @@ function L(e, i, t) {
|
|
|
700
700
|
});
|
|
701
701
|
});
|
|
702
702
|
}
|
|
703
|
-
function
|
|
703
|
+
function qe(e, i, t) {
|
|
704
704
|
if (!(e.flow === void 0 || !Array.isArray(e.components)))
|
|
705
705
|
try {
|
|
706
|
-
|
|
706
|
+
Ee(e.components, e.flow);
|
|
707
707
|
} catch (s) {
|
|
708
708
|
t.push({ path: `${i}.flow`, message: s instanceof Error ? s.message : String(s) });
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
|
-
function
|
|
711
|
+
function Xe(e) {
|
|
712
712
|
const i = [], t = [];
|
|
713
|
-
return
|
|
713
|
+
return O(e, i), i.length ? { ok: !1, errors: i, warnings: t } : (u(e) ? (e.schemaVersion !== void 0 && e.schemaVersion !== ie && i.push({ path: "$.schemaVersion", message: "不支持的模板 schemaVersion" }), Ke(e.params, "$.params", i), Te(e, i), !Array.isArray(e.pages) || e.pages.length === 0 ? i.push({ path: "$.pages", message: "模板至少需要一页" }) : e.pages.forEach((s, n) => {
|
|
714
714
|
const a = `$.pages.${n}`;
|
|
715
715
|
if (!u(s)) {
|
|
716
716
|
i.push({ path: a, message: "页应为对象" });
|
|
@@ -720,39 +720,39 @@ function qe(e) {
|
|
|
720
720
|
for (const o of ["marginTopMm", "marginBottomMm", "marginLeftMm", "marginRightMm"]) c(s, o, a, i);
|
|
721
721
|
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) => {
|
|
722
722
|
const r = `${a}.components.${f}`;
|
|
723
|
-
u(o) && o.kind === "list" ?
|
|
724
|
-
}) : i.push({ path: `${a}.components`, message: "组件应为数组" }),
|
|
723
|
+
u(o) && o.kind === "list" ? ze(o, r, i) : (K(o, r, i, t), u(o) && L(o, r, i));
|
|
724
|
+
}) : i.push({ path: `${a}.components`, message: "组件应为数组" }), qe(s, a, i);
|
|
725
725
|
})) : i.push({ path: "$", message: "模板应为对象" }), { ok: i.length === 0, errors: i, warnings: t });
|
|
726
726
|
}
|
|
727
|
-
function
|
|
727
|
+
function Ye(e) {
|
|
728
728
|
const i = [], t = [];
|
|
729
|
-
if (
|
|
729
|
+
if (O(e, i), i.length) return { ok: !1, errors: i, warnings: t };
|
|
730
730
|
if (!u(e)) i.push({ path: "$", message: "模板文档应为对象" });
|
|
731
731
|
else {
|
|
732
732
|
for (const n of Object.keys(e))
|
|
733
|
-
|
|
733
|
+
_e.has(n) || i.push({ path: `$.${n}`, message: "模板文档存在未知字段;只保存模板与描述,不保存取数或业务数据" });
|
|
734
734
|
e.schemaVersion !== G && i.push({ path: "$.schemaVersion", message: "不支持的模板文档版本" });
|
|
735
735
|
for (const n of ["id", "name"]) m(e, n, "$", i, !0);
|
|
736
736
|
for (const n of ["revision", "description"]) m(e, n, "$", i);
|
|
737
|
-
const s =
|
|
737
|
+
const s = Xe(e.template);
|
|
738
738
|
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)}` })));
|
|
739
739
|
}
|
|
740
740
|
return { ok: i.length === 0, errors: i, warnings: t };
|
|
741
741
|
}
|
|
742
742
|
function R(e) {
|
|
743
|
-
const i =
|
|
743
|
+
const i = Ye(e);
|
|
744
744
|
if (!i.ok) throw new w(i.errors);
|
|
745
745
|
}
|
|
746
|
-
function
|
|
746
|
+
function ot(e) {
|
|
747
747
|
const i = [];
|
|
748
|
-
if (
|
|
748
|
+
if (O(e, i), i.length) throw new w(i);
|
|
749
749
|
const t = { ...e, schemaVersion: e.schemaVersion ?? G };
|
|
750
750
|
return R(t), x(t);
|
|
751
751
|
}
|
|
752
|
-
function
|
|
752
|
+
function ft(e) {
|
|
753
753
|
let i = e;
|
|
754
754
|
if (typeof e == "string") {
|
|
755
|
-
if (e.length >
|
|
755
|
+
if (e.length > B)
|
|
756
756
|
throw new w([{ path: "$", message: "模板 JSON 超过 1000 万字符的导出/导入上限" }]);
|
|
757
757
|
try {
|
|
758
758
|
i = JSON.parse(e);
|
|
@@ -762,16 +762,18 @@ function ot(e) {
|
|
|
762
762
|
}
|
|
763
763
|
return R(i), x(i);
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function rt(e) {
|
|
766
766
|
R(e);
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
767
|
+
try {
|
|
768
|
+
return de(e);
|
|
769
|
+
} catch (i) {
|
|
770
|
+
throw i instanceof RangeError ? new w([{ path: "$", message: i.message }]) : i;
|
|
771
|
+
}
|
|
770
772
|
}
|
|
771
773
|
function x(e) {
|
|
772
774
|
return JSON.parse(JSON.stringify(e));
|
|
773
775
|
}
|
|
774
|
-
function
|
|
776
|
+
function dt(e = []) {
|
|
775
777
|
const i = /* @__PURE__ */ new Map(), t = {
|
|
776
778
|
get: (s) => {
|
|
777
779
|
const n = i.get(s);
|
|
@@ -790,17 +792,17 @@ function rt(e = []) {
|
|
|
790
792
|
export {
|
|
791
793
|
w as R,
|
|
792
794
|
G as a,
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
795
|
+
we as b,
|
|
796
|
+
nt as c,
|
|
797
|
+
dt as d,
|
|
798
|
+
ot as e,
|
|
797
799
|
K as f,
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
800
|
+
Ae as g,
|
|
801
|
+
Ye as h,
|
|
802
|
+
Ee as i,
|
|
803
|
+
Te as j,
|
|
804
|
+
ft as p,
|
|
805
|
+
at as r,
|
|
806
|
+
rt as s,
|
|
807
|
+
Xe as v
|
|
806
808
|
};
|