@agile-team/mach-report 2.16.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -12
- package/dist/{ExcelBindingWizard-CP6h2x1f.cjs → ExcelBindingWizard-Czn3C2yE.cjs} +1 -1
- package/dist/{ExcelBindingWizard-HhB3hAJE.js → ExcelBindingWizard-DMGZj6I6.js} +3 -3
- package/dist/ParamEditor-KzDQvbHY.js +732 -0
- package/dist/ParamEditor-oDfD8LgE.cjs +1 -0
- package/dist/{ReportBatchPanel-ruxcbfY6.js → ReportBatchPanel-BJK7PvZ4.js} +39 -39
- package/dist/ReportBatchPanel-DnmNRssu.cjs +1 -0
- package/dist/ReportParamPanel-mQkeN70Q.js +1020 -0
- package/dist/ReportParamPanel-sOANVRz-.cjs +1 -0
- package/dist/ReportPreview-BxWWTUL5.js +5583 -0
- package/dist/ReportPreview-Yf99omi3.cjs +6 -0
- package/dist/{ReportTemplateLibrary-DcwrH-63.js → ReportTemplateLibrary-BFjB08Wu.js} +1 -1
- package/dist/{ReportTemplateLibrary-BDlNT8JN.cjs → ReportTemplateLibrary-BO42QnWd.cjs} +1 -1
- package/dist/RuleEditor-CqxT1a-W.js +2337 -0
- package/dist/RuleEditor-D7YWigD9.cjs +1 -0
- package/dist/{TemplateOutlinePanel-CGrT5DFN.cjs → TemplateOutlinePanel-B0XX350V.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-SXCjaPKR.js → TemplateOutlinePanel-zG0DrsIB.js} +2 -2
- package/dist/{TemplateReusePanel-6Z3wRFz8.cjs → TemplateReusePanel-BD0HSKp_.cjs} +1 -1
- package/dist/{TemplateReusePanel-lHLOS9Wn.js → TemplateReusePanel-Czwe5GbC.js} +2 -2
- package/dist/{TemplateReviewPanel-Dpk7sLcF.cjs → TemplateReviewPanel-CA5sdffM.cjs} +1 -1
- package/dist/{TemplateReviewPanel-CJ9PLc48.js → TemplateReviewPanel-NhmQI65C.js} +2 -2
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +163 -42
- package/dist/analytics.d.ts +163 -42
- package/dist/analytics.js +76 -141
- package/dist/artifact-integrity.json +110 -108
- package/dist/assets-2eC3mOcV.js +232 -0
- package/dist/assets-B0Hxn4l6.cjs +1 -0
- package/dist/{auto-uVBjX1j5.cjs → auto-B0EZFIK1.cjs} +1 -1
- package/dist/{auto-YR7a4BtF.js → auto-BlchZ1b8.js} +10 -10
- package/dist/{batch-WzDIXJAt.js → batch-DGCt44XM.js} +1 -1
- package/dist/{batch-z6Aw5GEY.cjs → batch-DYcokH4v.cjs} +1 -1
- package/dist/charts-Dlv8j2AG.js +141 -0
- package/dist/charts-aCtoswXq.cjs +1 -0
- package/dist/codes.cjs +9 -9
- package/dist/codes.d.cts +54 -0
- package/dist/codes.d.ts +54 -0
- package/dist/codes.js +12097 -13668
- package/dist/column-visual-BpgQVWwT.js +238 -0
- package/dist/column-visual-CtYxnBCP.cjs +1 -0
- package/dist/component-tree-6TV7W6Yj.cjs +1 -0
- package/dist/component-tree-CvW4lzpv.js +67 -0
- package/dist/computed-4TnxzgIh.cjs +1 -0
- package/dist/computed-C8NRZQss.js +739 -0
- package/dist/data-bar-Ce38juRZ.cjs +1 -0
- package/dist/data-bar-PtjXhMgN.js +9 -0
- package/dist/dataset-DL83majE.js +161 -0
- package/dist/dataset-IrlXbUvh.cjs +1 -0
- package/dist/designer--TKECSEc.cjs +2 -0
- package/dist/designer-d6hJS41w.js +5683 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +835 -45
- package/dist/designer.d.ts +835 -45
- package/dist/designer.js +23 -20
- package/dist/{encoding-BYF9ZTl9.cjs → encoding-B--eZpp1.cjs} +1 -1
- package/dist/{encoding-BOGq4qYL.js → encoding-mctOLocI.js} +2 -2
- package/dist/{font-loader-EKLzOJxf.cjs → font-loader-DBBJ5KE9.cjs} +1 -1
- package/dist/{font-loader-CzI1GuBc.js → font-loader-DW8tIaNp.js} +1 -1
- package/dist/index-CPh6tqge.js +1575 -0
- package/dist/index-CUNw7dL9.cjs +1 -0
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +534 -16
- package/dist/index.d.ts +534 -16
- package/dist/index.js +1393 -955
- package/dist/json-snapshot-By4ZVVUt.js +1967 -0
- package/dist/json-snapshot-jiXff4lc.cjs +2 -0
- package/dist/matrix-0hywp0-F.cjs +1 -0
- package/dist/matrix-Dy-tyY7E.js +381 -0
- package/dist/param-validation-C-8sRJLq.cjs +1 -0
- package/dist/param-validation-CnDEd2l-.js +333 -0
- package/dist/{pdf-DJ5S6ukC.js → pdf-CKROKygt.js} +1845 -1845
- package/dist/{pdf-ByVCb1i6.cjs → pdf-DqyxJ96U.cjs} +47 -47
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +66 -0
- package/dist/pdf.d.ts +66 -0
- package/dist/pdf.js +2 -2
- package/dist/{plugin-C2j5_mhx.js → plugin-ByjF2kiV.js} +5 -5
- package/dist/{plugin-Dr39GBRG.cjs → plugin-DM1M2wlI.cjs} +1 -1
- package/dist/prefill-B8H9qwE4.js +371 -0
- package/dist/prefill-D7EswyTI.cjs +1 -0
- package/dist/{prepared-DqtpvRTn.js → prepared-BE-4jfX5.js} +2 -2
- package/dist/{prepared-DdrjLC7L.cjs → prepared-CGVphji3.cjs} +1 -1
- package/dist/{protocol-BzwMP4Vw.cjs → protocol-ByRVzzQG.cjs} +1 -1
- package/dist/{protocol-kt4Iy6-3.js → protocol-Cr81vFSQ.js} +3 -3
- package/dist/{record-bindings-CZWBJ1fU.js → record-bindings-DEJtmo3p.js} +67 -107
- package/dist/record-bindings-ehjnCDHt.cjs +1 -0
- package/dist/{region-binding-workflow-CWNvIjkV.js → region-binding-workflow-CBg0l_tj.js} +2 -2
- package/dist/{region-binding-workflow-CqSMxQ4p.cjs → region-binding-workflow-D05tOYn3.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/{report-params-B1RzkhJj.js → report-params-D9tBuM9B.js} +1 -1
- package/dist/{report-params-WDGrA4oP.cjs → report-params-VTg8MoCp.cjs} +1 -1
- package/dist/runtime-CDA6d263.cjs +1 -0
- package/dist/runtime-CEMvybO7.js +170 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server/node.d.cts +121 -7
- package/dist/server/node.d.ts +121 -7
- package/dist/server-node.cjs +4 -4
- package/dist/server-node.js +3446 -2115
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +417 -29
- package/dist/server.d.ts +417 -29
- package/dist/server.js +787 -544
- package/dist/sha256-BDQ1Qk7A.js +158 -0
- package/dist/sha256-DgZAKXqI.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/template-bindings-Cg5oBLFT.cjs +1 -0
- package/dist/template-bindings-TKnXM7ll.js +62 -0
- package/dist/{template-catalog-BtR2JmCL.js → template-catalog-CmbWOJqy.js} +16 -16
- package/dist/template-catalog-Utu4GP09.cjs +1 -0
- package/dist/{template-fragments-BVsbxs4a.cjs → template-fragments-C_zSHJAa.cjs} +1 -1
- package/dist/{template-fragments-By0aZC1D.js → template-fragments-DWgo9tlZ.js} +2 -2
- package/dist/{template-outline-BwRV_eRo.cjs → template-outline-DWkzZXVC.cjs} +1 -1
- package/dist/{template-outline-cnWfT_LK.js → template-outline-DiADphlq.js} +1 -1
- package/dist/{template-registry-Cw3vRTX2.js → template-registry-BIhIHOab.js} +319 -314
- package/dist/template-registry-DzWswQI5.cjs +1 -0
- package/dist/vue/async.d.cts +636 -35
- package/dist/vue/async.d.ts +636 -35
- package/dist/vue/index.d.cts +746 -67
- package/dist/vue/index.d.ts +746 -67
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +94 -89
- package/dist/{workbook-session-Cbts-22R.cjs → workbook-session-B94EwVa_.cjs} +1 -1
- package/dist/{workbook-session-BeSO8PFB.js → workbook-session-BoScoOg-.js} +2 -2
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +75 -7
- package/dist/worker.d.ts +75 -7
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.d.cts +208 -15
- package/dist/xlsx.d.ts +208 -15
- package/dist/xlsx.js +288 -252
- package/package.json +1 -1
- package/dist/ParamEditor-CUQLgoxa.cjs +0 -1
- package/dist/ParamEditor-OKesP_nO.js +0 -594
- package/dist/ReportBatchPanel-cZCAMAwH.cjs +0 -1
- package/dist/ReportPreview-BcDKCLiK.js +0 -4834
- package/dist/ReportPreview-Bk9nLfO9.cjs +0 -6
- package/dist/RuleEditor-BX5S8RSF.cjs +0 -1
- package/dist/RuleEditor-CGl9XY2s.js +0 -2037
- package/dist/assets-CqIbfbTr.js +0 -126
- package/dist/assets-e4YSke8n.cjs +0 -1
- package/dist/capabilities-DDwXr_cA.js +0 -103
- package/dist/capabilities-DNLyZdNw.cjs +0 -1
- package/dist/component-tree-Ca6YYfHq.js +0 -61
- package/dist/component-tree-DkGLEfZC.cjs +0 -1
- package/dist/computed-C-4C2S5h.js +0 -521
- package/dist/computed-CGV2a809.cjs +0 -1
- package/dist/config-Dg_o8e7m.cjs +0 -1
- package/dist/config-XQ4qrQ7Q.js +0 -844
- package/dist/dataset-BkRmwgeJ.cjs +0 -1
- package/dist/dataset-H5pFuQGU.js +0 -121
- package/dist/designer-BfQSahxq.js +0 -5163
- package/dist/designer-CPPdeM5_.cjs +0 -2
- package/dist/diagnostic-notification-B9K9We3h.cjs +0 -1
- package/dist/diagnostic-notification-qGAYZdkB.js +0 -7
- package/dist/drill-CsdjgkRM.cjs +0 -1
- package/dist/drill-DIGsZfyB.js +0 -145
- package/dist/json-snapshot-D6ioHth9.js +0 -1702
- package/dist/json-snapshot-DknkjvxP.cjs +0 -2
- package/dist/matrix-CGRGkn5s.js +0 -112
- package/dist/matrix-gEO7ZM_u.cjs +0 -1
- package/dist/param-validation-C3HlcLLO.cjs +0 -1
- package/dist/param-validation-Do7Eg8Zv.js +0 -181
- package/dist/record-bindings-DUX1VMlR.cjs +0 -1
- package/dist/runtime-BjKBI530.js +0 -168
- package/dist/runtime-CBFEPKEs.cjs +0 -1
- package/dist/sha256-BshdOkCC.cjs +0 -1
- package/dist/sha256-DTG-Gq8i.js +0 -157
- package/dist/template-bindings-C2SpvsMU.js +0 -58
- package/dist/template-bindings-CEtWyiLX.cjs +0 -1
- package/dist/template-catalog-C2NLdrwB.cjs +0 -1
- package/dist/template-registry-C62vpv4a.cjs +0 -1
- package/dist/tree-BX380Rr7.cjs +0 -1
- package/dist/tree-CjVZLRw7.js +0 -172
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { v as X } from "./
|
|
2
|
-
import {
|
|
3
|
-
import { c as
|
|
4
|
-
import { c as
|
|
5
|
-
import { v as
|
|
6
|
-
import {
|
|
7
|
-
function
|
|
1
|
+
import { k as q, v as X, c as Y } from "./computed-C8NRZQss.js";
|
|
2
|
+
import { d as Q, v as Z } from "./matrix-Dy-tyY7E.js";
|
|
3
|
+
import { c as B, v as ee, r as te, R as ie } from "./component-tree-CvW4lzpv.js";
|
|
4
|
+
import { c as se } from "./code-options-BKXXY7NI.js";
|
|
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 "./column-visual-BpgQVWwT.js";
|
|
7
|
+
function de(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 j(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 he(e, i, t) {
|
|
14
|
+
j(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: "派生结果标记应为布尔值" }), D(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 D(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
|
-
|
|
24
|
-
for (const
|
|
25
|
-
(typeof n[
|
|
26
|
-
for (const
|
|
27
|
-
const
|
|
28
|
-
|
|
23
|
+
de(n.sourceScope, `${i}.sourceScope`, t);
|
|
24
|
+
for (const a of ["datasetId", ...s ? ["field"] : []])
|
|
25
|
+
(typeof n[a] != "string" || !n[a].trim()) && t.push({ path: `${i}.${a}`, message: "业务标识应为非空字符串" });
|
|
26
|
+
for (const a of ["rowKey", "revision"]) {
|
|
27
|
+
const o = n[a];
|
|
28
|
+
o === void 0 && !(s && a === "rowKey") || typeof o != "string" && !(typeof o == "number" && Number.isFinite(o)) && t.push({ path: `${i}.${a}`, message: "业务键及修订号应为字符串或有限数字" });
|
|
29
29
|
}
|
|
30
30
|
n.sourceToken !== void 0 && typeof n.sourceToken != "string" && t.push({ path: `${i}.sourceToken`, message: "来源令牌应为字符串" });
|
|
31
31
|
}
|
|
32
|
-
const
|
|
32
|
+
const ue = /* @__PURE__ */ new Set([
|
|
33
33
|
"text",
|
|
34
34
|
"image",
|
|
35
35
|
"barcode",
|
|
@@ -45,58 +45,58 @@ function g(e) {
|
|
|
45
45
|
function E(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 me(e, i, t, s) {
|
|
49
49
|
const n = e[i];
|
|
50
50
|
(typeof n != "number" || !Number.isFinite(n)) && s.push({ path: `${t}.${i}`, message: `应为有限数字,实际 ${E(n)}` });
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function ce(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
|
+
D(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
|
-
const
|
|
61
|
-
(typeof
|
|
60
|
+
const a = e.rowIndex;
|
|
61
|
+
(typeof a != "number" || !Number.isInteger(a) || (n === "header" ? a !== -1 : a < 0)) && t.push({ path: `${s}.rowIndex`, message: "表头索引应为 -1,内容行索引应为非负整数" }), (!Array.isArray(e.columnKeys) || e.columnKeys.some((o) => typeof o != "string")) && t.push({ path: `${s}.columnKeys`, message: "逻辑列字段应为字符串数组" }), e.layout !== void 0 && e.layout !== "page" && e.layout !== "wide" && t.push({ path: `${s}.layout`, message: "布局应为 page 或 wide" }), e.title !== void 0 && typeof e.title != "string" && t.push({ path: `${s}.title`, message: "逻辑表名称应为字符串" });
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function ge(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 应为二维数组" });
|
|
69
69
|
else {
|
|
70
70
|
const n = e.paddingMm;
|
|
71
|
-
n !== void 0 && (typeof n != "number" || !Number.isFinite(n) || n < 0) && t.push({ path: `${i}.grid.paddingMm`, message: "单元格内距应为有限非负数" }), e.cells.forEach((
|
|
72
|
-
if (!Array.isArray(
|
|
73
|
-
t.push({ path: `${i}.grid.cells.${
|
|
71
|
+
n !== void 0 && (typeof n != "number" || !Number.isFinite(n) || n < 0) && t.push({ path: `${i}.grid.paddingMm`, message: "单元格内距应为有限非负数" }), e.cells.forEach((a, o) => {
|
|
72
|
+
if (!Array.isArray(a)) {
|
|
73
|
+
t.push({ path: `${i}.grid.cells.${o}`, message: "行应为数组" });
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
a.forEach((f, r) => {
|
|
77
77
|
if (f == null) return;
|
|
78
|
-
const d = `${i}.grid.cells.${
|
|
78
|
+
const d = `${i}.grid.cells.${o}.${r}`;
|
|
79
79
|
if (!g(f)) {
|
|
80
80
|
t.push({ path: d, message: "网格单元格应为对象或 null" });
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
I(
|
|
83
|
+
he(f, d, t), f.dataBar !== void 0 && !ee(f.dataBar) && t.push({ path: `${d}.dataBar`, message: "数据条应包含 0–1 有序比例与 #RRGGBB 颜色" }), V(f.richParagraphs, d, t), Array.isArray(f.children) && f.children.forEach((h, p) => {
|
|
84
|
+
I(h, `${i}.grid.cells.${o}.${r}.children.${p}`, t, s);
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function N(e, i, t, s) {
|
|
91
91
|
e !== void 0 && !i.includes(e) && s.push({ path: t, message: "未知富文本属性值" });
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
for (const
|
|
95
|
-
const
|
|
96
|
-
|
|
93
|
+
function T(e, i, t, s, n = 0) {
|
|
94
|
+
for (const a of i) {
|
|
95
|
+
const o = e[a];
|
|
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 pe(e, i, t) {
|
|
100
100
|
if (e !== void 0) {
|
|
101
101
|
if (!g(e)) {
|
|
102
102
|
t.push({ path: i, message: "富文本样式应为对象" });
|
|
@@ -106,37 +106,37 @@ function me(e, i, t) {
|
|
|
106
106
|
e[s] !== void 0 && typeof e[s] != "string" && t.push({ path: `${i}.${s}`, message: "富文本样式应为字符串" });
|
|
107
107
|
for (const s of ["bold", "italic", "underline", "borderTop", "borderRight", "borderBottom", "borderLeft"])
|
|
108
108
|
e[s] !== void 0 && typeof e[s] != "boolean" && t.push({ path: `${i}.${s}`, message: "富文本样式应为布尔值" });
|
|
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 ye(e, i, t) {
|
|
113
113
|
if (!g(e)) {
|
|
114
114
|
t.push({ path: i, message: "富文本片段应为对象" });
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
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
|
+
pe(e.style, `${i}.style`, t);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function V(e, i, t) {
|
|
123
123
|
if (e !== void 0) {
|
|
124
124
|
if (!Array.isArray(e)) {
|
|
125
125
|
t.push({ path: `${i}.richParagraphs`, message: "richParagraphs 应为数组" });
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
e.forEach((s, n) => {
|
|
129
|
-
const
|
|
129
|
+
const a = `${i}.richParagraphs.${n}`;
|
|
130
130
|
if (!g(s) || !Array.isArray(s.segments)) {
|
|
131
|
-
t.push({ path:
|
|
131
|
+
t.push({ path: a, message: "段落缺少 segments 数组" });
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
N(s.align, ["left", "center", "right", "justify"], `${a}.align`, t), T(s, ["lineHeight", "spaceBeforeMm", "spaceAfterMm", "indentMm"], a, t), s.segments.forEach((o, f) => ye(o, `${a}.segments.${f}`, t));
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
const n =
|
|
138
|
+
function K(e, i, t, s = []) {
|
|
139
|
+
const n = B([e], i);
|
|
140
140
|
if (n) {
|
|
141
141
|
t.push(n);
|
|
142
142
|
return;
|
|
@@ -149,53 +149,62 @@ 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 字符串" }) : ue.has(n) || s.push({
|
|
153
153
|
path: `${i}.kind`,
|
|
154
154
|
message: `未知组件类型 ${E(n)},将以兜底方式渲染`
|
|
155
155
|
});
|
|
156
|
-
for (const
|
|
157
|
-
|
|
156
|
+
for (const a of ["leftMm", "topMm", "widthMm", "heightMm"])
|
|
157
|
+
me(e, a, i, t);
|
|
158
158
|
typeof e.leftMm == "number" && e.leftMm < -100 && t.push({ path: `${i}.leftMm`, message: "几何数值异常(leftMm<-100)" });
|
|
159
|
-
for (const
|
|
160
|
-
typeof e[
|
|
161
|
-
|
|
159
|
+
for (const a of ["widthMm", "heightMm"])
|
|
160
|
+
typeof e[a] == "number" && e[a] < 0 && t.push({ path: `${i}.${a}`, message: "组件尺寸不能为负数" });
|
|
161
|
+
ce(e.table, i, t), $e(e.code, n, i, t), le(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" }), ge(e.grid, i, t, s), V(e.richParagraphs, i, t);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function le(e, i, t) {
|
|
164
|
+
if (e.chartBinding !== void 0)
|
|
165
|
+
try {
|
|
166
|
+
if (Q(e.chartBinding), e.kind !== "chart" || ["binding", "imageData", "grid", "pageAnchor"].some((s) => e[s] !== void 0)) throw new Error("绑定图表不能设置图片、网格、记录绑定或页眉页脚");
|
|
167
|
+
if (typeof e.widthMm != "number" || e.widthMm < 45 || typeof e.heightMm != "number" || e.heightMm < 35) throw new Error("绑定图表至少需要 45×35mm");
|
|
168
|
+
} catch (s) {
|
|
169
|
+
t.push({ path: `${i}.chartBinding`, message: s instanceof Error ? s.message : String(s) });
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function $e(e, i, t, s) {
|
|
164
173
|
if (e !== void 0)
|
|
165
|
-
for (const n of
|
|
174
|
+
for (const n of se(e, i)) s.push({ path: `${t}.code${n.path ? `.${n.path}` : ""}`, message: n.message });
|
|
166
175
|
}
|
|
167
|
-
function
|
|
176
|
+
function H(e, i, t) {
|
|
168
177
|
if (!g(e)) return;
|
|
169
|
-
e.binding !== void 0 && t.push({ path: `${i}.binding`, message: "渲染计划不允许未解析字段绑定" });
|
|
178
|
+
e.binding !== void 0 && t.push({ path: `${i}.binding`, message: "渲染计划不允许未解析字段绑定" }), e.chartBinding !== void 0 && t.push({ path: `${i}.chartBinding`, message: "渲染计划不允许未解析图表绑定" });
|
|
170
179
|
const s = e.grid;
|
|
171
|
-
!g(s) || !Array.isArray(s.cells) || s.cells.forEach((n,
|
|
172
|
-
Array.isArray(n) && n.forEach((
|
|
173
|
-
!g(
|
|
180
|
+
!g(s) || !Array.isArray(s.cells) || s.cells.forEach((n, a) => {
|
|
181
|
+
Array.isArray(n) && n.forEach((o, f) => {
|
|
182
|
+
!g(o) || !Array.isArray(o.children) || o.children.forEach((r, d) => H(r, `${i}.grid.cells.${a}.${f}.children.${d}`, t));
|
|
174
183
|
});
|
|
175
184
|
});
|
|
176
185
|
}
|
|
177
|
-
function
|
|
186
|
+
function be(e, i, t, s = []) {
|
|
178
187
|
if (!g(e)) {
|
|
179
188
|
t.push({ path: i, message: "页应为对象" });
|
|
180
189
|
return;
|
|
181
190
|
}
|
|
182
|
-
const n = e.pageWidthMm,
|
|
183
|
-
(typeof n != "number" || !Number.isFinite(n) || n <= 0) && t.push({ path: `${i}.pageWidthMm`, message: `页宽非法: ${E(n)}` }), (typeof
|
|
184
|
-
const
|
|
185
|
-
if (!Array.isArray(
|
|
191
|
+
const n = e.pageWidthMm, a = e.pageHeightMm;
|
|
192
|
+
(typeof n != "number" || !Number.isFinite(n) || n <= 0) && t.push({ path: `${i}.pageWidthMm`, message: `页宽非法: ${E(n)}` }), (typeof a != "number" || !(a > 0 && a < 5e3)) && t.push({ path: `${i}.pageHeightMm`, message: `页高非法: ${E(a)}` }), e.layout !== void 0 && e.layout !== "page" && e.layout !== "wide" && t.push({ path: `${i}.layout`, message: "布局应为 page 或 wide" });
|
|
193
|
+
const o = e.components;
|
|
194
|
+
if (!Array.isArray(o))
|
|
186
195
|
t.push({ path: `${i}.components`, message: "components 应为数组" });
|
|
187
|
-
else if (Array.isArray(
|
|
188
|
-
const f =
|
|
196
|
+
else if (Array.isArray(o)) {
|
|
197
|
+
const f = B(o, `${i}.components`);
|
|
189
198
|
if (f) {
|
|
190
199
|
t.push(f);
|
|
191
200
|
return;
|
|
192
201
|
}
|
|
193
|
-
|
|
194
|
-
I(r, `${i}.components.${d}`, t, s),
|
|
202
|
+
o.forEach((r, d) => {
|
|
203
|
+
I(r, `${i}.components.${d}`, t, s), H(r, `${i}.components.${d}`, t);
|
|
195
204
|
});
|
|
196
205
|
}
|
|
197
206
|
}
|
|
198
|
-
function
|
|
207
|
+
function Ae(e) {
|
|
199
208
|
const i = [], t = [], s = g(e) ? e.pages : void 0;
|
|
200
209
|
if (g(e) && e.requiresRecalculation !== void 0 && typeof e.requiresRecalculation != "boolean" && i.push({ path: "$.requiresRecalculation", message: "重算能力要求应为布尔值" }), !Array.isArray(s))
|
|
201
210
|
i.push({
|
|
@@ -203,25 +212,25 @@ function ye(e) {
|
|
|
203
212
|
message: e == null ? "渲染计划为空" : "渲染计划缺少 pages 数组"
|
|
204
213
|
});
|
|
205
214
|
else {
|
|
206
|
-
const n =
|
|
215
|
+
const n = te(s);
|
|
207
216
|
if (n) return { ok: !1, errors: [...i, n], warnings: t };
|
|
208
|
-
s.forEach((
|
|
217
|
+
s.forEach((o, f) => be(o, `$.pages.${f}`, i, t)), s.length > 2e3 && t.push({
|
|
209
218
|
path: "$.pages",
|
|
210
219
|
message: `页数异常大(${s.length} 页),渲染与打印耗时可能显著增加`
|
|
211
220
|
});
|
|
212
|
-
const
|
|
213
|
-
(
|
|
221
|
+
const a = s.reduce(
|
|
222
|
+
(o, f) => o + (g(f) && Array.isArray(f.components) ? f.components.length : 0),
|
|
214
223
|
0
|
|
215
224
|
);
|
|
216
|
-
|
|
225
|
+
a > 5e4 && t.push({
|
|
217
226
|
path: "$.pages",
|
|
218
|
-
message: `组件总数异常大(${
|
|
227
|
+
message: `组件总数异常大(${a} 个),可能触发浏览器性能限制`
|
|
219
228
|
});
|
|
220
229
|
}
|
|
221
230
|
return { ok: i.length === 0, errors: i, warnings: t };
|
|
222
231
|
}
|
|
223
|
-
function
|
|
224
|
-
const i =
|
|
232
|
+
function st(e) {
|
|
233
|
+
const i = Ae(e);
|
|
225
234
|
if (!i.ok) {
|
|
226
235
|
const t = i.errors.slice(0, 3).map((s) => `${s.path}: ${s.message}`).join("; ");
|
|
227
236
|
throw new Error(`渲染计划校验失败(${i.errors.length} 处): ${t}`);
|
|
@@ -231,69 +240,69 @@ function Qe(e) {
|
|
|
231
240
|
function O(e) {
|
|
232
241
|
return e.kind === "list" ? e.id : e.nid;
|
|
233
242
|
}
|
|
234
|
-
function
|
|
243
|
+
function we(e) {
|
|
235
244
|
return e.kind === "list" ? !1 : e.pageAnchor !== void 0 || e.kind === "text" && typeof e.text == "string" && /\{(?:page|totalPages)\}/.test(e.text);
|
|
236
245
|
}
|
|
237
|
-
function
|
|
246
|
+
function Me(e, i) {
|
|
238
247
|
const t = e.filter((n) => i.componentIds.includes(O(n) ?? ""));
|
|
239
248
|
if (t.filter((n) => n.kind === "list" && n.cardinality !== "record").length && t.length !== 1) throw new Error("纵向重复区域必须独占流式分段,不能与静态或单记录区域并排");
|
|
240
249
|
for (const n of t) {
|
|
241
|
-
const
|
|
242
|
-
if (n.topMm < i.topMm - 1e-3 ||
|
|
250
|
+
const a = n.kind === "list" ? n.topMm + (n.rowHeightMm ?? 0) : n.topMm + n.heightMm;
|
|
251
|
+
if (n.topMm < i.topMm - 1e-3 || a > i.topMm + i.heightMm + 1e-3) throw new Error("流式分段应完整包含其组件的原始纵向范围");
|
|
243
252
|
}
|
|
244
253
|
}
|
|
245
|
-
function
|
|
254
|
+
function nt(e, i) {
|
|
246
255
|
if (!i) return e.map((s) => ({ components: [s] }));
|
|
247
256
|
const t = new Map(e.map((s) => [O(s), s]));
|
|
248
257
|
return i.bands.map((s) => ({ band: s, components: s.componentIds.map((n) => {
|
|
249
|
-
const
|
|
250
|
-
if (!
|
|
251
|
-
return
|
|
258
|
+
const a = t.get(n);
|
|
259
|
+
if (!a) throw new Error(`流式区域引用不存在的组件:${n}`);
|
|
260
|
+
return a;
|
|
252
261
|
}) }));
|
|
253
262
|
}
|
|
254
|
-
function
|
|
263
|
+
function ve(e, i) {
|
|
255
264
|
if (!i || !Array.isArray(i.bands) || !i.bands.length || i.bands.length > 1e4) throw new Error("流式排版应包含 1–10000 个区域");
|
|
256
265
|
const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
257
266
|
for (const n of e) {
|
|
258
|
-
if (
|
|
259
|
-
const
|
|
260
|
-
if (!
|
|
261
|
-
t.add(
|
|
267
|
+
if (we(n)) continue;
|
|
268
|
+
const a = O(n);
|
|
269
|
+
if (!a || t.has(a)) throw new Error("流式排版组件应具有唯一标识");
|
|
270
|
+
t.add(a);
|
|
262
271
|
}
|
|
263
|
-
if (
|
|
272
|
+
if (ke(e, i, t, s), s.size !== t.size) throw new Error("流式排版必须显式包含每个非锚点组件");
|
|
264
273
|
}
|
|
265
|
-
function
|
|
274
|
+
function ke(e, i, t, s) {
|
|
266
275
|
let n = -1 / 0;
|
|
267
|
-
for (const
|
|
268
|
-
if (!Number.isFinite(
|
|
269
|
-
if (!Array.isArray(
|
|
270
|
-
for (const
|
|
271
|
-
if (!t.has(
|
|
272
|
-
s.add(
|
|
276
|
+
for (const a of i.bands) {
|
|
277
|
+
if (!Number.isFinite(a.topMm) || !Number.isFinite(a.heightMm) || a.topMm < 0 || a.heightMm <= 0 || a.topMm < n - 1e-3) throw new Error("流式区域应按原始位置排序,尺寸有效且不重叠");
|
|
278
|
+
if (!Array.isArray(a.componentIds) || !a.componentIds.length) throw new Error("流式区域不能没有组件");
|
|
279
|
+
for (const o of a.componentIds) {
|
|
280
|
+
if (!t.has(o) || s.has(o)) throw new Error(`流式区域组件缺失、重复或包含页锚点:${o}`);
|
|
281
|
+
s.add(o);
|
|
273
282
|
}
|
|
274
|
-
|
|
283
|
+
Me(e, a), n = a.topMm + a.heightMm;
|
|
275
284
|
}
|
|
276
285
|
}
|
|
277
|
-
const
|
|
286
|
+
const Ee = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
278
287
|
function l(e) {
|
|
279
288
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
280
289
|
}
|
|
281
|
-
function
|
|
282
|
-
return typeof e == "string" && !!e.trim() && !
|
|
290
|
+
function v(e) {
|
|
291
|
+
return typeof e == "string" && !!e.trim() && !Ee.has(e);
|
|
283
292
|
}
|
|
284
|
-
function
|
|
293
|
+
function S(e, i, t, s) {
|
|
285
294
|
for (const n of Object.keys(e)) i.includes(n) || s.push({ path: `${t}.${n}`, message: "存在未知配置字段" });
|
|
286
295
|
}
|
|
287
|
-
function
|
|
296
|
+
function Ne(e, i, t) {
|
|
288
297
|
if (e !== void 0) {
|
|
289
298
|
if (!l(e) || !["number", "percent", "date"].includes(String(e.kind))) {
|
|
290
299
|
t.push({ path: i, message: "绑定格式应为 number、percent 或 date" });
|
|
291
300
|
return;
|
|
292
301
|
}
|
|
293
|
-
|
|
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: "日期格式应为字符串" });
|
|
294
303
|
}
|
|
295
304
|
}
|
|
296
|
-
function
|
|
305
|
+
function Se(e, i, t) {
|
|
297
306
|
const s = e.binding;
|
|
298
307
|
if (s === void 0) return;
|
|
299
308
|
const n = `${i}.binding`;
|
|
@@ -301,103 +310,99 @@ function Ne(e, i, t) {
|
|
|
301
310
|
t.push({ path: n, message: "字段绑定应为对象" });
|
|
302
311
|
return;
|
|
303
312
|
}
|
|
304
|
-
(!["text", "image", "barcode", "qrcode"].includes(String(e.kind)) || e.grid !== void 0) && t.push({ path: n, message: "绑定仅支持独立文本、图片、条码与二维码组件" }),
|
|
305
|
-
for (const
|
|
306
|
-
|
|
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
|
+
for (const a of ["prefix", "suffix", "emptyText"]) s[a] !== void 0 && typeof s[a] != "string" && t.push({ path: `${n}.${a}`, message: "应为字符串" });
|
|
315
|
+
Ne(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,不支持文本格式或前后缀" });
|
|
307
316
|
}
|
|
308
|
-
function
|
|
317
|
+
function xe(e, i) {
|
|
309
318
|
if (!l(e)) {
|
|
310
319
|
i.push({ path: "$.repeat", message: "逐记录配置应为对象" });
|
|
311
320
|
return;
|
|
312
321
|
}
|
|
313
|
-
|
|
322
|
+
S(e, ["dataset", "rowKey", "copies"], "$.repeat", i), v(e.dataset) || i.push({ path: "$.repeat.dataset", message: "数据集应为安全的非空名称" }), e.rowKey !== void 0 && !v(e.rowKey) && i.push({ path: "$.repeat.rowKey", message: "业务主键应为安全的非空字段名" });
|
|
314
323
|
const t = e.copies;
|
|
315
|
-
t !== void 0 && (l(t) ? (
|
|
324
|
+
t !== void 0 && (l(t) ? (S(t, ["field"], "$.repeat.copies", i), v(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 整数" }));
|
|
316
325
|
}
|
|
317
|
-
function
|
|
326
|
+
function J(e, i, t, s) {
|
|
318
327
|
if (!l(e)) return;
|
|
319
|
-
|
|
328
|
+
Se(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: "数据图表应放在普通报表的页面或流式分区,不放在逐记录标签或嵌套单元格内" });
|
|
320
329
|
const n = e.grid;
|
|
321
|
-
l(n) && Array.isArray(n.cells) && n.cells.forEach((
|
|
322
|
-
Array.isArray(
|
|
323
|
-
l(f) && Array.isArray(f.children) && f.children.forEach((d,
|
|
330
|
+
l(n) && Array.isArray(n.cells) && n.cells.forEach((a, o) => {
|
|
331
|
+
Array.isArray(a) && a.forEach((f, r) => {
|
|
332
|
+
l(f) && Array.isArray(f.children) && f.children.forEach((d, h) => J(d, `${i}.grid.cells.${o}.${r}.children.${h}`, t, s));
|
|
324
333
|
});
|
|
325
334
|
});
|
|
326
335
|
}
|
|
327
|
-
function
|
|
336
|
+
function Re(e, i) {
|
|
328
337
|
const t = e.repeat !== void 0;
|
|
329
|
-
t &&
|
|
338
|
+
t && xe(e.repeat, i), Array.isArray(e.pages) && e.pages.forEach((s, n) => {
|
|
330
339
|
if (!l(s)) return;
|
|
331
|
-
const
|
|
332
|
-
t && (s.layout === "wide" || s.flow !== void 0) && i.push({ path:
|
|
333
|
-
const r = `${
|
|
334
|
-
if (
|
|
335
|
-
const { leftMm: d, topMm:
|
|
336
|
-
[d,
|
|
340
|
+
const a = `$.pages.${n}`;
|
|
341
|
+
t && (s.layout === "wide" || s.flow !== void 0) && i.push({ path: a, message: "逐记录标签仅支持固定尺寸页面,不支持宽表或流式分区" }), Array.isArray(s.components) && s.components.forEach((o, f) => {
|
|
342
|
+
const r = `${a}.components.${f}`;
|
|
343
|
+
if (J(o, r, t, i), !t || !l(o)) return;
|
|
344
|
+
const { leftMm: d, topMm: h, widthMm: p, heightMm: y } = o;
|
|
345
|
+
[d, h, p, y, s.widthMm, s.heightMm].every((A) => typeof A == "number" && Number.isFinite(A)) && (Number(d) < 0 || Number(h) < 0 || Number(d) + Number(p) > Number(s.widthMm) + 1e-3 || Number(h) + Number(y) > Number(s.heightMm) + 1e-3) && i.push({ path: r, message: "标签组件超出纸张边界,请调整位置或尺寸" });
|
|
337
346
|
});
|
|
338
347
|
});
|
|
339
348
|
}
|
|
340
|
-
function
|
|
349
|
+
function Te(e) {
|
|
341
350
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
342
351
|
}
|
|
343
|
-
function
|
|
344
|
-
if (e !== void 0)
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
352
|
+
function F(e, i, t) {
|
|
353
|
+
if (e !== void 0)
|
|
354
|
+
try {
|
|
355
|
+
q(e);
|
|
356
|
+
} catch (s) {
|
|
357
|
+
t.push({ path: i, message: s instanceof Error ? s.message : String(s) });
|
|
348
358
|
}
|
|
349
|
-
(typeof e.field != "string" || !e.field.trim()) && t.push({ path: `${i}.field`, message: "条件需要字段" }), e.numeric !== void 0 && e.numeric !== "number" && e.numeric !== "decimal" && t.push({ path: `${i}.numeric`, message: "未知条件数值模式" }), [">", ">=", "<", "<=", "==", "!="].includes(e.op) || t.push({ path: `${i}.op`, message: "未知条件运算符" }), typeof e.value != "string" && !(typeof e.value == "number" && Number.isFinite(e.value)) && t.push({
|
|
350
|
-
path: `${i}.value`,
|
|
351
|
-
message: "条件值应为字符串或有限数字"
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
359
|
}
|
|
355
|
-
function
|
|
360
|
+
function W(e, i, t) {
|
|
356
361
|
if (e === void 0) return;
|
|
357
362
|
if (!Array.isArray(e) || e.length > 2048) {
|
|
358
363
|
t.push({ path: i, message: "聚合应为数组且最多 2048 项" });
|
|
359
364
|
return;
|
|
360
365
|
}
|
|
361
366
|
const s = /* @__PURE__ */ new Set();
|
|
362
|
-
e.forEach((n,
|
|
363
|
-
const
|
|
364
|
-
if (!
|
|
365
|
-
t.push({ path:
|
|
367
|
+
e.forEach((n, a) => {
|
|
368
|
+
const o = `${i}.${a}`;
|
|
369
|
+
if (!Te(n)) {
|
|
370
|
+
t.push({ path: o, message: "聚合应为对象" });
|
|
366
371
|
return;
|
|
367
372
|
}
|
|
368
373
|
const f = n.field;
|
|
369
374
|
typeof f != "string" || !f.trim() || s.has(f) ? t.push({
|
|
370
|
-
path: `${
|
|
375
|
+
path: `${o}.field`,
|
|
371
376
|
message: "聚合输出字段应非空且唯一"
|
|
372
377
|
}) : s.add(f), n.numeric !== void 0 && n.numeric !== "number" && n.numeric !== "decimal" && t.push({
|
|
373
|
-
path: `${
|
|
378
|
+
path: `${o}.numeric`,
|
|
374
379
|
message: "数值模式应为 number 或 decimal"
|
|
375
380
|
}), n.digits !== void 0 && (!Number.isInteger(n.digits) || Number(n.digits) < 0 || Number(n.digits) > 100) && t.push({
|
|
376
|
-
path: `${
|
|
381
|
+
path: `${o}.digits`,
|
|
377
382
|
message: "小数位应为 0–100 的整数"
|
|
378
383
|
});
|
|
379
384
|
try {
|
|
380
|
-
|
|
385
|
+
Y({
|
|
381
386
|
...n,
|
|
382
387
|
field: n.valueField ?? f
|
|
383
388
|
});
|
|
384
389
|
} catch (r) {
|
|
385
390
|
t.push({
|
|
386
|
-
path:
|
|
391
|
+
path: o,
|
|
387
392
|
message: r instanceof Error ? r.message : String(r)
|
|
388
393
|
});
|
|
389
394
|
}
|
|
390
395
|
});
|
|
391
396
|
}
|
|
392
|
-
function
|
|
397
|
+
function Fe(e, i, t) {
|
|
393
398
|
if (e === void 0) return;
|
|
394
|
-
const s =
|
|
399
|
+
const s = X(e);
|
|
395
400
|
for (const n of s.errors) t.push({ path: i, message: n });
|
|
396
401
|
}
|
|
397
|
-
function
|
|
402
|
+
function Ie(e, i, t) {
|
|
398
403
|
if (e !== void 0)
|
|
399
404
|
try {
|
|
400
|
-
|
|
405
|
+
Z(e);
|
|
401
406
|
} catch (s) {
|
|
402
407
|
t.push({
|
|
403
408
|
path: i,
|
|
@@ -405,65 +410,65 @@ function ve(e, i, t) {
|
|
|
405
410
|
});
|
|
406
411
|
}
|
|
407
412
|
}
|
|
408
|
-
function
|
|
413
|
+
function Oe(e, i, t) {
|
|
409
414
|
if (e.tree === void 0) return;
|
|
410
415
|
const s = `${i}.tree`;
|
|
411
416
|
try {
|
|
412
|
-
|
|
417
|
+
oe(e.tree);
|
|
413
418
|
const n = e.tree;
|
|
414
419
|
if (e.matrix || e.detail || e.groupBy || Array.isArray(e.groups) && e.groups.length || e.rowVisibleWhen) throw new Error("树形布局不能同时配置普通分组、矩阵、主从或行可见条件");
|
|
415
420
|
if (e.rowKey !== void 0 && e.rowKey !== n.idField) throw new Error("树形 rowKey 应与 idField 一致");
|
|
416
|
-
if (!Array.isArray(e.columns) || !e.columns.some((
|
|
417
|
-
Array.isArray(e.computed) &&
|
|
421
|
+
if (!Array.isArray(e.columns) || !e.columns.some((a) => a && a.field === n.labelField && !a.hidden)) throw new Error("树形布局需要可见的标签列");
|
|
422
|
+
Array.isArray(e.computed) && fe(n, e.computed);
|
|
418
423
|
} catch (n) {
|
|
419
424
|
t.push({ path: s, message: n instanceof Error ? n.message : String(n) });
|
|
420
425
|
}
|
|
421
426
|
}
|
|
422
|
-
const
|
|
427
|
+
const G = "1.0";
|
|
423
428
|
class w extends Error {
|
|
424
429
|
constructor(i) {
|
|
425
430
|
super(`模板校验失败:${i.slice(0, 3).map((t) => `${t.path}: ${t.message}`).join("; ")}`), this.errors = i, this.name = "ReportTemplateError";
|
|
426
431
|
}
|
|
427
432
|
}
|
|
428
|
-
const
|
|
429
|
-
function
|
|
433
|
+
const Pe = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]), Ce = /* @__PURE__ */ new Set(["schemaVersion", "id", "name", "revision", "description", "template"]), Le = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]), k = 2e5, _e = 64, P = 1e7;
|
|
434
|
+
function u(e) {
|
|
430
435
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
431
436
|
}
|
|
432
|
-
function
|
|
437
|
+
function Be(e, i, t) {
|
|
433
438
|
const s = Object.getPrototypeOf(e), n = Array.isArray(e);
|
|
434
439
|
if (n ? s !== Array.prototype : s !== Object.prototype && s !== null)
|
|
435
440
|
return t.push({ path: i, message: "模板对象必须使用普通 JSON 对象原型" }), !1;
|
|
436
441
|
if (n) {
|
|
437
|
-
const
|
|
438
|
-
if (
|
|
442
|
+
const a = Object.keys(e);
|
|
443
|
+
if (a.length !== e.length || a.some((o) => !/^(0|[1-9]\d*)$/.test(o) || Number(o) >= e.length))
|
|
439
444
|
return t.push({ path: i, message: "模板数组不能包含空位或额外属性" }), !1;
|
|
440
445
|
}
|
|
441
446
|
return Object.getOwnPropertySymbols(e).length > 0 ? (t.push({ path: i, message: "模板不能包含 Symbol 键" }), !1) : !0;
|
|
442
447
|
}
|
|
443
|
-
function
|
|
444
|
-
return
|
|
448
|
+
function je(e, i, t, s) {
|
|
449
|
+
return Pe.has(e) ? (s.push({ path: t, message: "模板不能包含可能污染原型的键" }), !1) : i.get || i.set || !i.enumerable ? (s.push({ path: t, message: "模板不能包含访问器或不可枚举字段" }), !1) : !0;
|
|
445
450
|
}
|
|
446
|
-
function
|
|
451
|
+
function De(e) {
|
|
447
452
|
return e === null || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e);
|
|
448
453
|
}
|
|
449
|
-
function
|
|
454
|
+
function C(e, i) {
|
|
450
455
|
const t = /* @__PURE__ */ new Set();
|
|
451
|
-
let s = 0, n = 0,
|
|
452
|
-
const
|
|
453
|
-
if (!
|
|
456
|
+
let s = 0, n = 0, a = !1;
|
|
457
|
+
const o = (f, r, d) => {
|
|
458
|
+
if (!a) {
|
|
454
459
|
if (++s > k) {
|
|
455
460
|
s === k + 1 && i.push({ path: r, message: "模板超过 JSON 节点安全上限" });
|
|
456
461
|
return;
|
|
457
462
|
}
|
|
458
|
-
if (d >
|
|
463
|
+
if (d > _e) {
|
|
459
464
|
i.push({ path: r, message: "模板嵌套层级过深" });
|
|
460
465
|
return;
|
|
461
466
|
}
|
|
462
467
|
if (typeof f == "string") {
|
|
463
|
-
n += f.length, n > P && (
|
|
468
|
+
n += f.length, n > P && (a = !0, i.push({ path: r, message: "模板文本超过 1000 万字符的安全上限" }));
|
|
464
469
|
return;
|
|
465
470
|
}
|
|
466
|
-
if (!
|
|
471
|
+
if (!De(f)) {
|
|
467
472
|
if (!f || typeof f != "object") {
|
|
468
473
|
i.push({ path: r, message: "模板只允许 JSON 值,不允许函数、undefined 或非有限数字" });
|
|
469
474
|
return;
|
|
@@ -472,37 +477,37 @@ function L(e, i) {
|
|
|
472
477
|
i.push({ path: r, message: "模板不能包含循环引用" });
|
|
473
478
|
return;
|
|
474
479
|
}
|
|
475
|
-
if (
|
|
480
|
+
if (Be(f, r, i)) {
|
|
476
481
|
t.add(f);
|
|
477
|
-
for (const [
|
|
478
|
-
if (Array.isArray(f) &&
|
|
479
|
-
const y = `${r}.${
|
|
480
|
-
if (
|
|
482
|
+
for (const [h, p] of Object.entries(Object.getOwnPropertyDescriptors(f))) {
|
|
483
|
+
if (Array.isArray(f) && h === "length") continue;
|
|
484
|
+
const y = `${r}.${h}`;
|
|
485
|
+
if (je(h, p, y, i) && o(p.value, y, d + 1), s > k || a) break;
|
|
481
486
|
}
|
|
482
487
|
t.delete(f);
|
|
483
488
|
}
|
|
484
489
|
}
|
|
485
490
|
}
|
|
486
491
|
};
|
|
487
|
-
|
|
492
|
+
o(e, "$", 0);
|
|
488
493
|
}
|
|
489
494
|
function m(e, i, t, s, n = !1) {
|
|
490
|
-
const o = e[i];
|
|
491
|
-
o === void 0 && !n || (typeof o != "string" || n && !o.trim()) && s.push({ path: `${t}.${i}`, message: n ? "应为非空字符串" : "应为字符串" });
|
|
492
|
-
}
|
|
493
|
-
function c(e, i, t, s, n = 0, o = !1) {
|
|
494
495
|
const a = e[i];
|
|
495
|
-
a === void 0 && !
|
|
496
|
+
a === void 0 && !n || (typeof a != "string" || n && !a.trim()) && s.push({ path: `${t}.${i}`, message: n ? "应为非空字符串" : "应为字符串" });
|
|
497
|
+
}
|
|
498
|
+
function c(e, i, t, s, n = 0, a = !1) {
|
|
499
|
+
const o = e[i];
|
|
500
|
+
o === void 0 && !a || (typeof o != "number" || !Number.isFinite(o) || o < n) && s.push({ path: `${t}.${i}`, message: `应为大于等于 ${n} 的有限数字` });
|
|
496
501
|
}
|
|
497
502
|
function b(e, i, t, s) {
|
|
498
503
|
e[i] !== void 0 && typeof e[i] != "boolean" && s.push({ path: `${t}.${i}`, message: "应为布尔值" });
|
|
499
504
|
}
|
|
500
505
|
function M(e, i, t, s = !1) {
|
|
501
|
-
e !== void 0 && !
|
|
506
|
+
e !== void 0 && !Le.has(e) && !(s && e === "auto") && t.push({ path: i, message: `未知对齐方式${s ? "(支持 auto)" : ""}` });
|
|
502
507
|
}
|
|
503
508
|
function $(e, i, t) {
|
|
504
509
|
if (e !== void 0) {
|
|
505
|
-
if (!
|
|
510
|
+
if (!u(e)) {
|
|
506
511
|
t.push({ path: i, message: "样式应为对象" });
|
|
507
512
|
return;
|
|
508
513
|
}
|
|
@@ -514,237 +519,237 @@ function $(e, i, t) {
|
|
|
514
519
|
for (const s of ["fontFamily", "color", "backgroundColor", "lineColor", "borderColor"]) m(e, s, i, t);
|
|
515
520
|
}
|
|
516
521
|
}
|
|
517
|
-
function
|
|
522
|
+
function Ve(e, i, t) {
|
|
518
523
|
if (e === void 0) return;
|
|
519
524
|
if (!Array.isArray(e)) {
|
|
520
525
|
t.push({ path: i, message: "参数定义应为数组" });
|
|
521
526
|
return;
|
|
522
527
|
}
|
|
523
528
|
const s = /* @__PURE__ */ new Set(), n = t.length;
|
|
524
|
-
e.forEach((
|
|
525
|
-
const f = `${i}.${
|
|
526
|
-
if (!
|
|
529
|
+
e.forEach((a, o) => {
|
|
530
|
+
const f = `${i}.${o}`;
|
|
531
|
+
if (!u(a)) {
|
|
527
532
|
t.push({ path: f, message: "参数定义应为对象" });
|
|
528
533
|
return;
|
|
529
534
|
}
|
|
530
|
-
m(
|
|
531
|
-
for (const r of ["label", "defaultValue", "placeholder"]) m(
|
|
532
|
-
b(
|
|
535
|
+
m(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: "未知参数类型" });
|
|
536
|
+
for (const r of ["label", "defaultValue", "placeholder"]) m(a, r, f, t);
|
|
537
|
+
b(a, "required", f, t);
|
|
533
538
|
for (const r of ["minLength", "maxLength"]) {
|
|
534
|
-
const d =
|
|
539
|
+
const d = a[r];
|
|
535
540
|
d !== void 0 && (typeof d != "number" || !Number.isSafeInteger(d) || d < 0) && t.push({ path: `${f}.${r}`, message: "长度边界应为非负整数" });
|
|
536
541
|
}
|
|
537
|
-
|
|
538
|
-
const
|
|
539
|
-
if (!
|
|
542
|
+
Ke(a, f, t), a.options !== void 0 && (Array.isArray(a.options) ? a.options.forEach((r, d) => {
|
|
543
|
+
const h = `${f}.options.${d}`;
|
|
544
|
+
if (!u(r)) t.push({ path: h, message: "选项应为对象" });
|
|
540
545
|
else
|
|
541
|
-
for (const p of ["label", "value"]) typeof r[p] != "string" && t.push({ path: `${
|
|
546
|
+
for (const p of ["label", "value"]) typeof r[p] != "string" && t.push({ path: `${h}.${p}`, message: "选项标签与值应为字符串(允许空白选项)" });
|
|
542
547
|
}) : t.push({ path: `${f}.options`, message: "选项应为数组" }));
|
|
543
|
-
}), t.length === n && t.push(...
|
|
548
|
+
}), t.length === n && t.push(...ne(e).map((a) => ({ path: a.path.replace("$.paramDefs", i), message: a.message })));
|
|
544
549
|
}
|
|
545
|
-
function
|
|
546
|
-
for (const
|
|
547
|
-
const
|
|
548
|
-
if (
|
|
549
|
-
|
|
550
|
+
function Ke(e, i, t) {
|
|
551
|
+
for (const a of ["min", "max"]) {
|
|
552
|
+
const o = e[a];
|
|
553
|
+
if (o === void 0) continue;
|
|
554
|
+
ae(e.type, o) || ["number", "numberRange"].includes(e.type) && typeof o == "number" && Number.isFinite(o) || t.push({ path: `${i}.${a}`, message: "数字使用有限数字边界,日期/月/年使用对应规范字符串边界" });
|
|
550
555
|
}
|
|
551
556
|
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;
|
|
552
557
|
(s || n) && t.push({ path: i, message: "最小边界不能大于最大边界" }), typeof e.minLength == "number" && typeof e.maxLength == "number" && e.minLength > e.maxLength && t.push({ path: i, message: "最小长度不能大于最大长度" });
|
|
553
558
|
}
|
|
554
|
-
function
|
|
559
|
+
function U(e, i, t) {
|
|
555
560
|
if (!Array.isArray(e) || e.length === 0) {
|
|
556
561
|
t.push({ path: i, message: "列表至少需要一列" });
|
|
557
562
|
return;
|
|
558
563
|
}
|
|
559
|
-
e.every((s) =>
|
|
560
|
-
const
|
|
561
|
-
if (!
|
|
562
|
-
t.push({ path:
|
|
564
|
+
e.every((s) => u(s) && s.hidden === !0) && t.push({ path: i, message: "列表至少需要一列可见列" }), e.forEach((s, n) => {
|
|
565
|
+
const a = `${i}.${n}`;
|
|
566
|
+
if (!u(s)) {
|
|
567
|
+
t.push({ path: a, message: "列应为对象" });
|
|
563
568
|
return;
|
|
564
569
|
}
|
|
565
|
-
if (
|
|
566
|
-
if (!
|
|
567
|
-
t.push({ path: `${
|
|
570
|
+
if (j(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
|
+
if (!u(s.format) || !["number", "percent", "date"].includes(s.format.kind))
|
|
572
|
+
t.push({ path: `${a}.format`, message: "未知列格式" });
|
|
568
573
|
else {
|
|
569
|
-
const
|
|
570
|
-
|
|
574
|
+
const o = s.format.digits;
|
|
575
|
+
o !== void 0 && (typeof o != "number" || !Number.isInteger(o) || o < 0 || o > 100) && t.push({ path: `${a}.format.digits`, message: "小数位应为 0–100 的整数" }), b(s.format, "thousands", `${a}.format`, t), m(s.format, "pattern", `${a}.format`, t);
|
|
571
576
|
}
|
|
572
|
-
s.rules !== void 0 && (Array.isArray(s.rules) ? s.rules.forEach((
|
|
573
|
-
const r = `${
|
|
574
|
-
if (!
|
|
577
|
+
s.rules !== void 0 && (Array.isArray(s.rules) ? s.rules.forEach((o, f) => {
|
|
578
|
+
const r = `${a}.rules.${f}`;
|
|
579
|
+
if (!u(o) || !u(o.when)) {
|
|
575
580
|
t.push({ path: r, message: "条件格式缺少 when 对象" });
|
|
576
581
|
return;
|
|
577
582
|
}
|
|
578
|
-
|
|
579
|
-
}) : t.push({ path: `${
|
|
583
|
+
F(o.when, `${r}.when`, t), $(o.style, `${r}.style`, t);
|
|
584
|
+
}) : t.push({ path: `${a}.rules`, message: "条件格式应为数组" }));
|
|
580
585
|
});
|
|
581
586
|
}
|
|
582
|
-
function
|
|
587
|
+
function z(e, i, t) {
|
|
583
588
|
if (e !== void 0) {
|
|
584
|
-
if (!
|
|
589
|
+
if (!u(e)) {
|
|
585
590
|
t.push({ path: i, message: "分组应为对象" });
|
|
586
591
|
return;
|
|
587
592
|
}
|
|
588
593
|
m(e, "field", i, t, !0);
|
|
589
594
|
for (const s of ["headerTemplate", "subtotalLabel"]) m(e, s, i, t);
|
|
590
595
|
for (const s of ["headerStyle", "subtotalStyle"]) $(e[s], `${i}.${s}`, t);
|
|
591
|
-
b(e, "keepWithNext", i, t), b(e, "repeatHeader", i, t),
|
|
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: "小计字段应为字符串数组" });
|
|
592
597
|
}
|
|
593
598
|
}
|
|
594
|
-
function
|
|
599
|
+
function He(e, i, t) {
|
|
595
600
|
if (!(e === void 0 || typeof e == "boolean")) {
|
|
596
|
-
if (!
|
|
601
|
+
if (!u(e)) {
|
|
597
602
|
t.push({ path: i, message: "合计应为布尔值或对象" });
|
|
598
603
|
return;
|
|
599
604
|
}
|
|
600
|
-
m(e, "label", i, t),
|
|
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: "合计字段应为字符串数组" });
|
|
601
606
|
}
|
|
602
607
|
}
|
|
603
|
-
function
|
|
608
|
+
function Je(e, i, t, s) {
|
|
604
609
|
const n = { kind: "rect", leftMm: 0, topMm: 0, widthMm: 1, heightMm: 1, grid: e };
|
|
605
|
-
if (
|
|
606
|
-
const
|
|
607
|
-
if (
|
|
610
|
+
if (K(n, t, s, []), L(n, t, s), !u(e) || !Array.isArray(e.cells)) return;
|
|
611
|
+
const a = e.cells, o = Array.isArray(i) ? i.length : 0;
|
|
612
|
+
if (a.length * o > k) {
|
|
608
613
|
s.push({ path: t, message: "表头逻辑网格超过 20 万格安全上限" });
|
|
609
614
|
return;
|
|
610
615
|
}
|
|
611
|
-
e.cells.length || s.push({ path: `${t}.cells`, message: "表头至少需要一行" }), Array.isArray(e.colWidthsMm) && e.colWidthsMm.length !==
|
|
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: "表头行高数量应与行数一致" }), We(a, o, t, s);
|
|
612
617
|
}
|
|
613
|
-
function
|
|
618
|
+
function We(e, i, t, s) {
|
|
614
619
|
const n = /* @__PURE__ */ new Set();
|
|
615
|
-
e.forEach((
|
|
616
|
-
if (!Array.isArray(
|
|
620
|
+
e.forEach((a, o) => {
|
|
621
|
+
if (!Array.isArray(a)) return;
|
|
617
622
|
let f = 0;
|
|
618
|
-
|
|
619
|
-
for (; n.has(`${
|
|
620
|
-
const
|
|
621
|
-
(f +
|
|
622
|
-
for (let y =
|
|
623
|
-
for (let A = f; A < Math.min(i, f +
|
|
624
|
-
n.has(`${y}:${A}`) && s.push({ path: `${t}.cells.${
|
|
625
|
-
f +=
|
|
623
|
+
a.forEach((r, d) => {
|
|
624
|
+
for (; n.has(`${o}:${f}`); ) f++;
|
|
625
|
+
const h = u(r) && typeof r.colSpan == "number" ? r.colSpan : 1, p = u(r) && typeof r.rowSpan == "number" ? r.rowSpan : 1;
|
|
626
|
+
(f + h > i || o + p > e.length) && s.push({ path: `${t}.cells.${o}.${d}`, message: "表头合并区域超出表头边界" });
|
|
627
|
+
for (let y = o; y < Math.min(e.length, o + p); y++)
|
|
628
|
+
for (let A = f; A < Math.min(i, f + h); A++)
|
|
629
|
+
n.has(`${y}:${A}`) && s.push({ path: `${t}.cells.${o}.${d}`, message: "表头合并区域重叠" }), n.add(`${y}:${A}`);
|
|
630
|
+
f += h;
|
|
626
631
|
});
|
|
627
632
|
});
|
|
628
633
|
}
|
|
629
|
-
function
|
|
630
|
-
if (
|
|
634
|
+
function Ge(e, i, t) {
|
|
635
|
+
if (Oe(e, i, t), Fe(e.computed, `${i}.computed`, t), Ie(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;
|
|
631
636
|
const s = e.detail, n = `${i}.detail`;
|
|
632
|
-
if (!
|
|
637
|
+
if (!u(s)) {
|
|
633
638
|
t.push({ path: n, message: "主从关联应为对象" });
|
|
634
639
|
return;
|
|
635
640
|
}
|
|
636
|
-
for (const
|
|
637
|
-
for (const
|
|
638
|
-
m(s, "label", n, t), b(s, "header", n, t), c(s, "rowHeightMm", n, t, Number.MIN_VALUE),
|
|
641
|
+
for (const a of ["dataset", "parentKey", "foreignKey"]) m(s, a, n, t, !0);
|
|
642
|
+
for (const a of ["rowKey", "revisionField", "sourceTokenField"]) m(s, a, n, t, s[a] !== void 0);
|
|
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" });
|
|
639
644
|
}
|
|
640
|
-
function
|
|
645
|
+
function Ue(e, i, t) {
|
|
641
646
|
for (const s of ["leftMm", "topMm"]) c(e, s, i, t, -1 / 0, !0);
|
|
642
647
|
c(e, "widthMm", i, t, Number.MIN_VALUE, !0), m(e, "dataset", i, t, !0), m(e, "title", i, t);
|
|
643
648
|
for (const s of ["rowKey", "revisionField", "sourceTokenField"]) m(e, s, i, t, e[s] !== void 0);
|
|
644
|
-
e.headerGrid !== void 0 &&
|
|
649
|
+
e.headerGrid !== void 0 && Je(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);
|
|
645
650
|
for (const s of ["fontSizePt", "rowHeightMm"]) c(e, s, i, t, Number.MIN_VALUE);
|
|
646
651
|
c(e, "paddingMm", i, t);
|
|
647
652
|
for (const s of ["header", "headerBold", "headerEveryPage", "border"]) b(e, s, i, t);
|
|
648
|
-
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), Ge(e, i, t), z(e.groupBy, `${i}.groupBy`, t), He(e.grandTotal, `${i}.grandTotal`, t);
|
|
649
654
|
}
|
|
650
|
-
function
|
|
655
|
+
function _(e, i, t) {
|
|
651
656
|
Array.isArray(e.richParagraphs) && e.richParagraphs.forEach((s, n) => {
|
|
652
|
-
if (!
|
|
653
|
-
const
|
|
654
|
-
M(s.align, `${
|
|
655
|
-
for (const
|
|
656
|
-
Array.isArray(s.segments) && s.segments.forEach((
|
|
657
|
-
const r = `${
|
|
658
|
-
if (!
|
|
657
|
+
if (!u(s)) return;
|
|
658
|
+
const a = `${i}.richParagraphs.${n}`;
|
|
659
|
+
M(s.align, `${a}.align`, t);
|
|
660
|
+
for (const o of ["lineHeight", "spaceBeforeMm", "spaceAfterMm", "indentMm"]) c(s, o, a, t);
|
|
661
|
+
Array.isArray(s.segments) && s.segments.forEach((o, f) => {
|
|
662
|
+
const r = `${a}.segments.${f}`;
|
|
663
|
+
if (!u(o)) {
|
|
659
664
|
t.push({ path: r, message: "富文本片段应为对象" });
|
|
660
665
|
return;
|
|
661
666
|
}
|
|
662
|
-
|
|
663
|
-
for (const d of ["text", "field"]) m(
|
|
664
|
-
$(
|
|
667
|
+
o.kind !== void 0 && o.kind !== "text" && o.kind !== "field" && t.push({ path: `${r}.kind`, message: "未知富文本片段类型" });
|
|
668
|
+
for (const d of ["text", "field"]) m(o, d, r, t);
|
|
669
|
+
$(o.style, `${r}.style`, t);
|
|
665
670
|
});
|
|
666
671
|
});
|
|
667
672
|
}
|
|
668
|
-
function
|
|
673
|
+
function L(e, i, t) {
|
|
669
674
|
$(e.style, `${i}.style`, t);
|
|
670
675
|
for (const n of ["text", "rawText", "imageData", "fallbackText", "nid", "rkey"]) m(e, n, i, t);
|
|
671
|
-
if (e.lines !== void 0 && (!Array.isArray(e.lines) || e.lines.some((n) => typeof n != "string")) && t.push({ path: `${i}.lines`, message: "文本行应为字符串数组" }),
|
|
676
|
+
if (e.lines !== void 0 && (!Array.isArray(e.lines) || e.lines.some((n) => typeof n != "string")) && t.push({ path: `${i}.lines`, message: "文本行应为字符串数组" }), _(e, i, t), !u(e.grid)) return;
|
|
672
677
|
const s = e.grid;
|
|
673
678
|
c(s, "gapMm", `${i}.grid`, t), c(s, "paddingMm", `${i}.grid`, t);
|
|
674
679
|
for (const n of ["colWidthsMm", "rowHeightsMm"]) {
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
}
|
|
678
|
-
Array.isArray(s.cells) && s.cells.forEach((n,
|
|
679
|
-
Array.isArray(n) && n.forEach((
|
|
680
|
-
const r = `${i}.grid.cells.${
|
|
681
|
-
if (
|
|
682
|
-
if (!
|
|
680
|
+
const a = s[n];
|
|
681
|
+
a !== void 0 && (!Array.isArray(a) || a.some((o) => typeof o != "number" || !Number.isFinite(o) || o < 0)) && t.push({ path: `${i}.grid.${n}`, message: "网格尺寸应为有限非负数字数组" });
|
|
682
|
+
}
|
|
683
|
+
Array.isArray(s.cells) && s.cells.forEach((n, a) => {
|
|
684
|
+
Array.isArray(n) && n.forEach((o, f) => {
|
|
685
|
+
const r = `${i}.grid.cells.${a}.${f}`;
|
|
686
|
+
if (o !== null) {
|
|
687
|
+
if (!u(o)) {
|
|
683
688
|
t.push({ path: r, message: "网格单元格应为对象或 null" });
|
|
684
689
|
return;
|
|
685
690
|
}
|
|
686
|
-
for (const d of ["text", "rawText", "numberFormat"]) m(
|
|
691
|
+
for (const d of ["text", "rawText", "numberFormat"]) m(o, d, r, t);
|
|
687
692
|
for (const d of ["colSpan", "rowSpan"]) {
|
|
688
|
-
const
|
|
689
|
-
|
|
693
|
+
const h = o[d];
|
|
694
|
+
h !== void 0 && (typeof h != "number" || !Number.isInteger(h) || h <= 0) && t.push({ path: `${r}.${d}`, message: "跨度应为正整数" });
|
|
690
695
|
}
|
|
691
|
-
|
|
692
|
-
|
|
696
|
+
o.value !== void 0 && o.value !== null && !["string", "number", "boolean"].includes(typeof o.value) && t.push({ path: `${r}.value`, message: "Excel 原始值应为字符串、数字、布尔值或 null" }), $(o.style, `${r}.style`, t), _(o, r, t), o.children !== void 0 && (Array.isArray(o.children) ? o.children.forEach((d, h) => {
|
|
697
|
+
u(d) && L(d, `${r}.children.${h}`, t);
|
|
693
698
|
}) : t.push({ path: `${r}.children`, message: "嵌套组件应为数组" }));
|
|
694
699
|
}
|
|
695
700
|
});
|
|
696
701
|
});
|
|
697
702
|
}
|
|
698
|
-
function
|
|
703
|
+
function ze(e, i, t) {
|
|
699
704
|
if (!(e.flow === void 0 || !Array.isArray(e.components)))
|
|
700
705
|
try {
|
|
701
|
-
|
|
706
|
+
ve(e.components, e.flow);
|
|
702
707
|
} catch (s) {
|
|
703
708
|
t.push({ path: `${i}.flow`, message: s instanceof Error ? s.message : String(s) });
|
|
704
709
|
}
|
|
705
710
|
}
|
|
706
|
-
function
|
|
711
|
+
function qe(e) {
|
|
707
712
|
const i = [], t = [];
|
|
708
|
-
return
|
|
709
|
-
const
|
|
710
|
-
if (!
|
|
711
|
-
i.push({ path:
|
|
713
|
+
return C(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" }), Ve(e.params, "$.params", i), Re(e, i), !Array.isArray(e.pages) || e.pages.length === 0 ? i.push({ path: "$.pages", message: "模板至少需要一页" }) : e.pages.forEach((s, n) => {
|
|
714
|
+
const a = `$.pages.${n}`;
|
|
715
|
+
if (!u(s)) {
|
|
716
|
+
i.push({ path: a, message: "页应为对象" });
|
|
712
717
|
return;
|
|
713
718
|
}
|
|
714
|
-
c(s, "widthMm",
|
|
715
|
-
for (const
|
|
716
|
-
typeof s.widthMm == "number" && Number(s.marginLeftMm ?? 0) + Number(s.marginRightMm ?? 0) >= s.widthMm && i.push({ path:
|
|
717
|
-
const r = `${
|
|
718
|
-
|
|
719
|
-
}) : i.push({ path: `${
|
|
719
|
+
c(s, "widthMm", a, i, Number.MIN_VALUE, !0), c(s, "heightMm", a, i, Number.MIN_VALUE, !0), s.layout !== void 0 && s.layout !== "page" && s.layout !== "wide" && i.push({ path: `${a}.layout`, message: "布局应为 page 或 wide" }), typeof s.heightMm == "number" && s.heightMm >= 5e3 && i.push({ path: `${a}.heightMm`, message: "页高应小于 5000mm" });
|
|
720
|
+
for (const o of ["marginTopMm", "marginBottomMm", "marginLeftMm", "marginRightMm"]) c(s, o, a, i);
|
|
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
|
+
const r = `${a}.components.${f}`;
|
|
723
|
+
u(o) && o.kind === "list" ? Ue(o, r, i) : (K(o, r, i, t), u(o) && L(o, r, i));
|
|
724
|
+
}) : i.push({ path: `${a}.components`, message: "组件应为数组" }), ze(s, a, i);
|
|
720
725
|
})) : i.push({ path: "$", message: "模板应为对象" }), { ok: i.length === 0, errors: i, warnings: t });
|
|
721
726
|
}
|
|
722
|
-
function
|
|
727
|
+
function Xe(e) {
|
|
723
728
|
const i = [], t = [];
|
|
724
|
-
if (
|
|
725
|
-
if (!
|
|
729
|
+
if (C(e, i), i.length) return { ok: !1, errors: i, warnings: t };
|
|
730
|
+
if (!u(e)) i.push({ path: "$", message: "模板文档应为对象" });
|
|
726
731
|
else {
|
|
727
732
|
for (const n of Object.keys(e))
|
|
728
|
-
|
|
729
|
-
e.schemaVersion !==
|
|
733
|
+
Ce.has(n) || i.push({ path: `$.${n}`, message: "模板文档存在未知字段;只保存模板与描述,不保存取数或业务数据" });
|
|
734
|
+
e.schemaVersion !== G && i.push({ path: "$.schemaVersion", message: "不支持的模板文档版本" });
|
|
730
735
|
for (const n of ["id", "name"]) m(e, n, "$", i, !0);
|
|
731
736
|
for (const n of ["revision", "description"]) m(e, n, "$", i);
|
|
732
|
-
const s =
|
|
737
|
+
const s = qe(e.template);
|
|
733
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)}` })));
|
|
734
739
|
}
|
|
735
740
|
return { ok: i.length === 0, errors: i, warnings: t };
|
|
736
741
|
}
|
|
737
742
|
function R(e) {
|
|
738
|
-
const i =
|
|
743
|
+
const i = Xe(e);
|
|
739
744
|
if (!i.ok) throw new w(i.errors);
|
|
740
745
|
}
|
|
741
|
-
function
|
|
746
|
+
function at(e) {
|
|
742
747
|
const i = [];
|
|
743
|
-
if (
|
|
744
|
-
const t = { ...e, schemaVersion: e.schemaVersion ??
|
|
748
|
+
if (C(e, i), i.length) throw new w(i);
|
|
749
|
+
const t = { ...e, schemaVersion: e.schemaVersion ?? G };
|
|
745
750
|
return R(t), x(t);
|
|
746
751
|
}
|
|
747
|
-
function
|
|
752
|
+
function ot(e) {
|
|
748
753
|
let i = e;
|
|
749
754
|
if (typeof e == "string") {
|
|
750
755
|
if (e.length > P)
|
|
@@ -757,7 +762,7 @@ function tt(e) {
|
|
|
757
762
|
}
|
|
758
763
|
return R(i), x(i);
|
|
759
764
|
}
|
|
760
|
-
function
|
|
765
|
+
function ft(e) {
|
|
761
766
|
R(e);
|
|
762
767
|
const i = JSON.stringify(e, null, 2);
|
|
763
768
|
if (i.length > P) throw new w([{ path: "$", message: "模板 JSON 超过 1000 万字符的导出/导入上限" }]);
|
|
@@ -766,7 +771,7 @@ function it(e) {
|
|
|
766
771
|
function x(e) {
|
|
767
772
|
return JSON.parse(JSON.stringify(e));
|
|
768
773
|
}
|
|
769
|
-
function
|
|
774
|
+
function rt(e = []) {
|
|
770
775
|
const i = /* @__PURE__ */ new Map(), t = {
|
|
771
776
|
get: (s) => {
|
|
772
777
|
const n = i.get(s);
|
|
@@ -784,18 +789,18 @@ function st(e = []) {
|
|
|
784
789
|
}
|
|
785
790
|
export {
|
|
786
791
|
w as R,
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
792
|
+
G as a,
|
|
793
|
+
Ae as b,
|
|
794
|
+
st as c,
|
|
795
|
+
rt as d,
|
|
796
|
+
at as e,
|
|
797
|
+
K as f,
|
|
798
|
+
be as g,
|
|
799
|
+
Xe as h,
|
|
800
|
+
ve as i,
|
|
801
|
+
Re as j,
|
|
802
|
+
ot as p,
|
|
803
|
+
nt as r,
|
|
804
|
+
ft as s,
|
|
805
|
+
qe as v
|
|
801
806
|
};
|