@agile-team/mach-report 2.11.2 → 2.13.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 +30 -5
- package/THIRD_PARTY_NOTICES.md +270 -0
- package/dist/{ExcelBindingWizard-LWX6G1A2.js → ExcelBindingWizard-CeAf4QSE.js} +2 -2
- package/dist/{ExcelBindingWizard-a4kslPHF.cjs → ExcelBindingWizard-y0mT-AHR.cjs} +1 -1
- package/dist/{ReportBatchPanel-B5ClP9tm.js → ReportBatchPanel-CW2HV9I8.js} +1 -1
- package/dist/{ReportBatchPanel-Dc-SDkYA.cjs → ReportBatchPanel-Fp1ePFag.cjs} +1 -1
- package/dist/ReportPreview-BN6fk7Wz.cjs +6 -0
- package/dist/ReportPreview-D2Jkyh1U.js +4243 -0
- package/dist/{RuleEditor-C2QsOHOs.cjs → RuleEditor-ChRzNQuF.cjs} +1 -1
- package/dist/{RuleEditor-D9wQHrkf.js → RuleEditor-DzAmW5YH.js} +1 -1
- package/dist/analytics.d.cts +28 -0
- package/dist/analytics.d.ts +28 -0
- package/dist/assets-C2U-e-Sz.cjs +4 -0
- package/dist/assets-Q0wUwNrV.js +217 -0
- package/dist/code-options-BKXXY7NI.js +18 -0
- package/dist/code-options-BUTChiZZ.cjs +1 -0
- package/dist/codes.cjs +9 -0
- package/dist/codes.d.cts +223 -0
- package/dist/codes.d.ts +223 -0
- package/dist/codes.js +26917 -0
- package/dist/config-Bb7RiIO5.cjs +1 -0
- package/dist/{config-B612mw0x.js → config-XVwG87IA.js} +4 -0
- package/dist/designer.cjs +2 -2
- package/dist/designer.d.cts +283 -0
- package/dist/designer.d.ts +283 -0
- package/dist/designer.js +2852 -2010
- package/dist/grid-strokes-Cr7DwUux.cjs +1 -0
- package/dist/grid-strokes-DyyG1q_o.js +53 -0
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +105 -1
- package/dist/index.d.ts +105 -1
- package/dist/index.js +488 -439
- package/dist/pdf.cjs +76 -59
- package/dist/pdf.d.cts +51 -0
- package/dist/pdf.d.ts +51 -0
- package/dist/pdf.js +32128 -32048
- package/dist/{plugin-Cd5G2QQn.js → plugin-D4wizDXB.js} +1 -1
- package/dist/{plugin-BDTU4D94.cjs → plugin-DzS6pxTA.cjs} +1 -1
- package/dist/record-bindings-By_UKZ2g.cjs +1 -0
- package/dist/{list-cell-ClFra1zS.js → record-bindings-D-5jQlTj.js} +67 -44
- package/dist/{region-binding-workflow-DhQvu1co.cjs → region-binding-workflow-BzfbxRiR.cjs} +1 -1
- package/dist/{region-binding-workflow-CXDmt9Bs.js → region-binding-workflow-CcUq8W2Q.js} +1 -1
- package/dist/server/node.d.cts +52 -1
- package/dist/server/node.d.ts +52 -1
- package/dist/server-node.cjs +1 -1
- package/dist/server-node.js +239 -210
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +95 -3
- package/dist/server.d.ts +95 -3
- package/dist/server.js +457 -434
- package/dist/style.css +1 -1
- package/dist/{template-registry-WNXdkiET.js → template-registry-BjE1VS6g.js} +221 -157
- package/dist/template-registry-D3SjENi6.cjs +1 -0
- package/dist/template-review-DGwWOoCv.cjs +2 -0
- package/dist/{template-review-BdcXSYbx.js → template-review-PgEe_Wr9.js} +792 -666
- package/dist/validate-BJ5HIWY8.cjs +1 -0
- package/dist/validate-DbgEM1Hh.js +163 -0
- package/dist/vue/async.d.cts +125 -2
- package/dist/vue/async.d.ts +125 -2
- package/dist/vue/index.d.cts +121 -8
- package/dist/vue/index.d.ts +121 -8
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +5 -5
- package/dist/{workbook-session-BKOTwcoq.js → workbook-session-BPb3TMnT.js} +1 -1
- package/dist/{workbook-session-CLYLhZWu.cjs → workbook-session-DNa2RHNG.cjs} +1 -1
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +52 -1
- package/dist/worker.d.ts +52 -1
- package/dist/worker.js +2 -2
- package/dist/xlsx.cjs +1 -1
- package/dist/xlsx.d.cts +40 -0
- package/dist/xlsx.d.ts +40 -0
- package/dist/xlsx.js +3 -3
- package/package.json +16 -3
- package/dist/ReportPreview-DWXROHBP.cjs +0 -6
- package/dist/ReportPreview-DiNXhQI0.js +0 -4138
- package/dist/assets-Bu6UohJx.cjs +0 -1
- package/dist/assets-DegqDNqY.js +0 -160
- package/dist/config-BRoLo2oj.cjs +0 -1
- package/dist/list-cell-BuYn4tGF.cjs +0 -1
- package/dist/template-registry-ukBGlm8N.cjs +0 -1
- package/dist/template-review-BXp2oyqg.cjs +0 -1
- package/dist/textwrap-CWHyzkBH.cjs +0 -4
- package/dist/textwrap-DE1kgcJB.js +0 -110
- package/dist/validate-7s0yn6ii.js +0 -148
- package/dist/validate-DsRiNw8h.cjs +0 -1
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
function c(e, i, s) {
|
|
2
|
-
e.editable !== void 0 && typeof e.editable != "boolean" && s.push({ path: `${i}.editable`, message: "编辑控制应为布尔值" }), e.valueType !== void 0 && !["text", "number", "boolean"].includes(e.valueType) && s.push({ path: `${i}.valueType`, message: "编辑类型应为 text、number 或 boolean" });
|
|
3
|
-
}
|
|
4
|
-
function y(e, i, s) {
|
|
5
|
-
c(e, i, s), e.indentMm !== void 0 && (typeof e.indentMm != "number" || !Number.isFinite(e.indentMm) || e.indentMm < 0) && s.push({ path: `${i}.indentMm`, message: "单元格缩进应为有限非负数" }), e.derived !== void 0 && typeof e.derived != "boolean" && s.push({ path: `${i}.derived`, message: "派生结果标记应为布尔值" }), g(e.source, `${i}.source`, s, !0), e.formula !== void 0 && typeof e.formula != "string" && s.push({ path: `${i}.formula`, message: "单元格公式应为字符串" });
|
|
6
|
-
}
|
|
7
|
-
function g(e, i, s, t = !1) {
|
|
8
|
-
if (e === void 0) return;
|
|
9
|
-
if (!e || typeof e != "object" || Array.isArray(e)) {
|
|
10
|
-
s.push({ path: i, message: "业务来源应为对象" });
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const n = e;
|
|
14
|
-
for (const a of ["datasetId", ...t ? ["field"] : []])
|
|
15
|
-
(typeof n[a] != "string" || !n[a].trim()) && s.push({ path: `${i}.${a}`, message: "业务标识应为非空字符串" });
|
|
16
|
-
for (const a of ["rowKey", "revision"]) {
|
|
17
|
-
const o = n[a];
|
|
18
|
-
o === void 0 && !(t && a === "rowKey") || typeof o != "string" && !(typeof o == "number" && Number.isFinite(o)) && s.push({ path: `${i}.${a}`, message: "业务键及修订号应为字符串或有限数字" });
|
|
19
|
-
}
|
|
20
|
-
n.sourceToken !== void 0 && typeof n.sourceToken != "string" && s.push({ path: `${i}.sourceToken`, message: "来源令牌应为字符串" });
|
|
21
|
-
}
|
|
22
|
-
const $ = /* @__PURE__ */ new Set([
|
|
23
|
-
"text",
|
|
24
|
-
"image",
|
|
25
|
-
"barcode",
|
|
26
|
-
"qrcode",
|
|
27
|
-
"chart",
|
|
28
|
-
"line",
|
|
29
|
-
"rect",
|
|
30
|
-
"ellipse"
|
|
31
|
-
]);
|
|
32
|
-
function u(e) {
|
|
33
|
-
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
34
|
-
}
|
|
35
|
-
function l(e, i, s, t) {
|
|
36
|
-
const n = e[i];
|
|
37
|
-
(typeof n != "number" || !Number.isFinite(n)) && t.push({ path: `${s}.${i}`, message: `应为有限数字,实际 ${JSON.stringify(n)}` });
|
|
38
|
-
}
|
|
39
|
-
function v(e, i, s) {
|
|
40
|
-
if (e !== void 0) {
|
|
41
|
-
const t = `${i}.table`;
|
|
42
|
-
if (!u(e)) s.push({ path: t, message: "逻辑表来源应为对象" });
|
|
43
|
-
else {
|
|
44
|
-
g(e.source, `${t}.source`, s), (typeof e.id != "string" || !e.id.trim()) && s.push({ path: `${t}.id`, message: "逻辑表 ID 应为非空字符串" });
|
|
45
|
-
const n = e.role;
|
|
46
|
-
["header", "body", "group-header", "subtotal", "grand-total"].includes(n) || s.push({ path: `${t}.role`, message: "未知逻辑表行角色" });
|
|
47
|
-
const a = e.rowIndex;
|
|
48
|
-
(typeof a != "number" || !Number.isInteger(a) || (n === "header" ? a !== -1 : a < 0)) && s.push({ path: `${t}.rowIndex`, message: "表头索引应为 -1,内容行索引应为非负整数" }), (!Array.isArray(e.columnKeys) || e.columnKeys.some((o) => typeof o != "string")) && s.push({ path: `${t}.columnKeys`, message: "逻辑列字段应为字符串数组" }), e.layout !== void 0 && e.layout !== "page" && e.layout !== "wide" && s.push({ path: `${t}.layout`, message: "布局应为 page 或 wide" }), e.title !== void 0 && typeof e.title != "string" && s.push({ path: `${t}.title`, message: "逻辑表名称应为字符串" });
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function A(e, i, s, t) {
|
|
53
|
-
if (e !== void 0)
|
|
54
|
-
if (!u(e) || !Array.isArray(e.cells))
|
|
55
|
-
s.push({ path: `${i}.grid.cells`, message: "grid.cells 应为二维数组" });
|
|
56
|
-
else {
|
|
57
|
-
const n = e.paddingMm;
|
|
58
|
-
n !== void 0 && (typeof n != "number" || !Number.isFinite(n) || n < 0) && s.push({ path: `${i}.grid.paddingMm`, message: "单元格内距应为有限非负数" }), e.cells.forEach((a, o) => {
|
|
59
|
-
if (!Array.isArray(a)) {
|
|
60
|
-
s.push({ path: `${i}.grid.cells.${o}`, message: "行应为数组" });
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
a.forEach((f, d) => {
|
|
64
|
-
if (f == null) return;
|
|
65
|
-
const h = `${i}.grid.cells.${o}.${d}`;
|
|
66
|
-
if (!u(f)) {
|
|
67
|
-
s.push({ path: h, message: "网格单元格应为对象或 null" });
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
y(f, h, s), Array.isArray(f.children) && f.children.forEach((m, p) => {
|
|
71
|
-
r(m, `${i}.grid.cells.${o}.${d}.children.${p}`, s, t);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
function b(e, i, s) {
|
|
78
|
-
e !== void 0 && (Array.isArray(e) ? e.forEach((t, n) => {
|
|
79
|
-
(!u(t) || !Array.isArray(t.segments)) && s.push({ path: `${i}.richParagraphs.${n}`, message: "段落缺少 segments 数组" });
|
|
80
|
-
}) : s.push({ path: `${i}.richParagraphs`, message: "richParagraphs 应为数组" }));
|
|
81
|
-
}
|
|
82
|
-
function r(e, i, s, t = []) {
|
|
83
|
-
if (!u(e)) {
|
|
84
|
-
s.push({ path: i, message: "组件应为对象" });
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const n = e.kind;
|
|
88
|
-
typeof n != "string" ? s.push({ path: `${i}.kind`, message: "组件缺少 kind 字符串" }) : $.has(n) || t.push({
|
|
89
|
-
path: `${i}.kind`,
|
|
90
|
-
message: `未知组件类型 ${JSON.stringify(n)},将以兜底方式渲染`
|
|
91
|
-
});
|
|
92
|
-
for (const a of ["leftMm", "topMm", "widthMm", "heightMm"])
|
|
93
|
-
l(e, a, i, s);
|
|
94
|
-
typeof e.leftMm == "number" && e.leftMm < -100 && s.push({ path: `${i}.leftMm`, message: "几何数值异常(leftMm<-100)" });
|
|
95
|
-
for (const a of ["widthMm", "heightMm"])
|
|
96
|
-
typeof e[a] == "number" && e[a] < 0 && s.push({ path: `${i}.${a}`, message: "组件尺寸不能为负数" });
|
|
97
|
-
v(e.table, i, s), e.pageAnchor !== void 0 && !["header", "footer"].includes(e.pageAnchor) && s.push({ path: `${i}.pageAnchor`, message: "页面锚点应为 header 或 footer" }), e.lineDirection !== void 0 && !["down", "up"].includes(e.lineDirection) && s.push({ path: `${i}.lineDirection`, message: "线段方向应为 down 或 up" }), A(e.grid, i, s, t), b(e.richParagraphs, i, s);
|
|
98
|
-
}
|
|
99
|
-
function M(e, i, s, t = []) {
|
|
100
|
-
if (!u(e)) {
|
|
101
|
-
s.push({ path: i, message: "页应为对象" });
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
const n = e.pageWidthMm, a = e.pageHeightMm;
|
|
105
|
-
(typeof n != "number" || !Number.isFinite(n) || n <= 0) && s.push({ path: `${i}.pageWidthMm`, message: `页宽非法: ${JSON.stringify(n)}` }), (typeof a != "number" || !(a > 0 && a < 5e3)) && s.push({ path: `${i}.pageHeightMm`, message: `页高非法: ${JSON.stringify(a)}` }), e.layout !== void 0 && e.layout !== "page" && e.layout !== "wide" && s.push({ path: `${i}.layout`, message: "布局应为 page 或 wide" });
|
|
106
|
-
const o = e.components;
|
|
107
|
-
Array.isArray(o) ? Array.isArray(o) && o.forEach(
|
|
108
|
-
(f, d) => r(f, `${i}.components.${d}`, s, t)
|
|
109
|
-
) : s.push({ path: `${i}.components`, message: "components 应为数组" });
|
|
110
|
-
}
|
|
111
|
-
function w(e) {
|
|
112
|
-
const i = [], s = [], t = u(e) ? e.pages : void 0;
|
|
113
|
-
if (u(e) && e.requiresRecalculation !== void 0 && typeof e.requiresRecalculation != "boolean" && i.push({ path: "$.requiresRecalculation", message: "重算能力要求应为布尔值" }), !Array.isArray(t))
|
|
114
|
-
i.push({
|
|
115
|
-
path: "$.pages",
|
|
116
|
-
message: e == null ? "渲染计划为空" : "渲染计划缺少 pages 数组"
|
|
117
|
-
});
|
|
118
|
-
else {
|
|
119
|
-
t.forEach((a, o) => M(a, `$.pages.${o}`, i, s)), t.length > 2e3 && s.push({
|
|
120
|
-
path: "$.pages",
|
|
121
|
-
message: `页数异常大(${t.length} 页),渲染与打印耗时可能显著增加`
|
|
122
|
-
});
|
|
123
|
-
const n = t.reduce(
|
|
124
|
-
(a, o) => a + (u(o) && Array.isArray(o.components) ? o.components.length : 0),
|
|
125
|
-
0
|
|
126
|
-
);
|
|
127
|
-
n > 5e4 && s.push({
|
|
128
|
-
path: "$.pages",
|
|
129
|
-
message: `组件总数异常大(${n} 个),可能触发浏览器性能限制`
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
return { ok: i.length === 0, errors: i, warnings: s };
|
|
133
|
-
}
|
|
134
|
-
function k(e) {
|
|
135
|
-
const i = w(e);
|
|
136
|
-
if (!i.ok) {
|
|
137
|
-
const s = i.errors.slice(0, 3).map((t) => `${t.path}: ${t.message}`).join("; ");
|
|
138
|
-
throw new Error(`渲染计划校验失败(${i.errors.length} 处): ${s}`);
|
|
139
|
-
}
|
|
140
|
-
return e.pages;
|
|
141
|
-
}
|
|
142
|
-
export {
|
|
143
|
-
k as a,
|
|
144
|
-
M as b,
|
|
145
|
-
w as c,
|
|
146
|
-
c as d,
|
|
147
|
-
r as v
|
|
148
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function g(e,s,i){e.editable!==void 0&&typeof e.editable!="boolean"&&i.push({path:`${s}.editable`,message:"编辑控制应为布尔值"}),e.valueType!==void 0&&!["text","number","boolean"].includes(e.valueType)&&i.push({path:`${s}.valueType`,message:"编辑类型应为 text、number 或 boolean"})}function $(e,s,i){g(e,s,i),e.indentMm!==void 0&&(typeof e.indentMm!="number"||!Number.isFinite(e.indentMm)||e.indentMm<0)&&i.push({path:`${s}.indentMm`,message:"单元格缩进应为有限非负数"}),e.derived!==void 0&&typeof e.derived!="boolean"&&i.push({path:`${s}.derived`,message:"派生结果标记应为布尔值"}),m(e.source,`${s}.source`,i,!0),e.formula!==void 0&&typeof e.formula!="string"&&i.push({path:`${s}.formula`,message:"单元格公式应为字符串"})}function m(e,s,i,t=!1){if(e===void 0)return;if(!e||typeof e!="object"||Array.isArray(e)){i.push({path:s,message:"业务来源应为对象"});return}const a=e;for(const n of["datasetId",...t?["field"]:[]])(typeof a[n]!="string"||!a[n].trim())&&i.push({path:`${s}.${n}`,message:"业务标识应为非空字符串"});for(const n of["rowKey","revision"]){const o=a[n];o===void 0&&!(t&&n==="rowKey")||typeof o!="string"&&!(typeof o=="number"&&Number.isFinite(o))&&i.push({path:`${s}.${n}`,message:"业务键及修订号应为字符串或有限数字"})}a.sourceToken!==void 0&&typeof a.sourceToken!="string"&&i.push({path:`${s}.sourceToken`,message:"来源令牌应为字符串"})}const v=new Set(["text","image","barcode","qrcode","chart","line","rect","ellipse"]);function u(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function A(e,s,i,t){const a=e[s];(typeof a!="number"||!Number.isFinite(a))&&t.push({path:`${i}.${s}`,message:`应为有限数字,实际 ${JSON.stringify(a)}`})}function b(e,s,i){if(e!==void 0){const t=`${s}.table`;if(!u(e))i.push({path:t,message:"逻辑表来源应为对象"});else{m(e.source,`${t}.source`,i),(typeof e.id!="string"||!e.id.trim())&&i.push({path:`${t}.id`,message:"逻辑表 ID 应为非空字符串"});const a=e.role;["header","body","group-header","subtotal","grand-total"].includes(a)||i.push({path:`${t}.role`,message:"未知逻辑表行角色"});const n=e.rowIndex;(typeof n!="number"||!Number.isInteger(n)||(a==="header"?n!==-1:n<0))&&i.push({path:`${t}.rowIndex`,message:"表头索引应为 -1,内容行索引应为非负整数"}),(!Array.isArray(e.columnKeys)||e.columnKeys.some(o=>typeof o!="string"))&&i.push({path:`${t}.columnKeys`,message:"逻辑列字段应为字符串数组"}),e.layout!==void 0&&e.layout!=="page"&&e.layout!=="wide"&&i.push({path:`${t}.layout`,message:"布局应为 page 或 wide"}),e.title!==void 0&&typeof e.title!="string"&&i.push({path:`${t}.title`,message:"逻辑表名称应为字符串"})}}}function M(e,s,i,t){if(e!==void 0)if(!u(e)||!Array.isArray(e.cells))i.push({path:`${s}.grid.cells`,message:"grid.cells 应为二维数组"});else{const a=e.paddingMm;a!==void 0&&(typeof a!="number"||!Number.isFinite(a)||a<0)&&i.push({path:`${s}.grid.paddingMm`,message:"单元格内距应为有限非负数"}),e.cells.forEach((n,o)=>{if(!Array.isArray(n)){i.push({path:`${s}.grid.cells.${o}`,message:"行应为数组"});return}n.forEach((f,d)=>{if(f==null)return;const r=`${s}.grid.cells.${o}.${d}`;if(!u(f)){i.push({path:r,message:"网格单元格应为对象或 null"});return}$(f,r,i),Array.isArray(f.children)&&f.children.forEach((l,y)=>{h(l,`${s}.grid.cells.${o}.${d}.children.${y}`,i,t)})})})}}function w(e,s,i){e!==void 0&&(Array.isArray(e)?e.forEach((t,a)=>{(!u(t)||!Array.isArray(t.segments))&&i.push({path:`${s}.richParagraphs.${a}`,message:"段落缺少 segments 数组"})}):i.push({path:`${s}.richParagraphs`,message:"richParagraphs 应为数组"}))}function h(e,s,i,t=[]){if(!u(e)){i.push({path:s,message:"组件应为对象"});return}const a=e.kind;typeof a!="string"?i.push({path:`${s}.kind`,message:"组件缺少 kind 字符串"}):v.has(a)||t.push({path:`${s}.kind`,message:`未知组件类型 ${JSON.stringify(a)},将以兜底方式渲染`});for(const n of["leftMm","topMm","widthMm","heightMm"])A(e,n,s,i);typeof e.leftMm=="number"&&e.leftMm<-100&&i.push({path:`${s}.leftMm`,message:"几何数值异常(leftMm<-100)"});for(const n of["widthMm","heightMm"])typeof e[n]=="number"&&e[n]<0&&i.push({path:`${s}.${n}`,message:"组件尺寸不能为负数"});b(e.table,s,i),e.pageAnchor!==void 0&&!["header","footer"].includes(e.pageAnchor)&&i.push({path:`${s}.pageAnchor`,message:"页面锚点应为 header 或 footer"}),e.lineDirection!==void 0&&!["down","up"].includes(e.lineDirection)&&i.push({path:`${s}.lineDirection`,message:"线段方向应为 down 或 up"}),M(e.grid,s,i,t),w(e.richParagraphs,s,i)}function p(e,s,i,t=[]){if(!u(e)){i.push({path:s,message:"页应为对象"});return}const a=e.pageWidthMm,n=e.pageHeightMm;(typeof a!="number"||!Number.isFinite(a)||a<=0)&&i.push({path:`${s}.pageWidthMm`,message:`页宽非法: ${JSON.stringify(a)}`}),(typeof n!="number"||!(n>0&&n<5e3))&&i.push({path:`${s}.pageHeightMm`,message:`页高非法: ${JSON.stringify(n)}`}),e.layout!==void 0&&e.layout!=="page"&&e.layout!=="wide"&&i.push({path:`${s}.layout`,message:"布局应为 page 或 wide"});const o=e.components;Array.isArray(o)?Array.isArray(o)&&o.forEach((f,d)=>h(f,`${s}.components.${d}`,i,t)):i.push({path:`${s}.components`,message:"components 应为数组"})}function c(e){const s=[],i=[],t=u(e)?e.pages:void 0;if(u(e)&&e.requiresRecalculation!==void 0&&typeof e.requiresRecalculation!="boolean"&&s.push({path:"$.requiresRecalculation",message:"重算能力要求应为布尔值"}),!Array.isArray(t))s.push({path:"$.pages",message:e==null?"渲染计划为空":"渲染计划缺少 pages 数组"});else{t.forEach((n,o)=>p(n,`$.pages.${o}`,s,i)),t.length>2e3&&i.push({path:"$.pages",message:`页数异常大(${t.length} 页),渲染与打印耗时可能显著增加`});const a=t.reduce((n,o)=>n+(u(o)&&Array.isArray(o.components)?o.components.length:0),0);a>5e4&&i.push({path:"$.pages",message:`组件总数异常大(${a} 个),可能触发浏览器性能限制`})}return{ok:s.length===0,errors:s,warnings:i}}function k(e){const s=c(e);if(!s.ok){const i=s.errors.slice(0,3).map(t=>`${t.path}: ${t.message}`).join("; ");throw new Error(`渲染计划校验失败(${s.errors.length} 处): ${i}`)}return e.pages}exports.assertRenderPlan=k;exports.validateComponent=h;exports.validateEditableMetadata=g;exports.validatePage=p;exports.validateRenderPlan=c;
|