@agile-team/mach-report 2.11.2 → 2.12.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 +14 -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/{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/designer.cjs +2 -2
- package/dist/designer.d.cts +267 -0
- package/dist/designer.d.ts +267 -0
- package/dist/designer.js +2737 -1941
- 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 +80 -1
- package/dist/index.d.ts +80 -1
- package/dist/index.js +404 -374
- 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/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 +456 -433
- 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-BfCC8Ng9.cjs +2 -0
- package/dist/{template-review-BdcXSYbx.js → template-review-BzpcI-tR.js} +772 -666
- package/dist/validate-BJ5HIWY8.cjs +1 -0
- package/dist/validate-DbgEM1Hh.js +163 -0
- package/dist/vue/async.d.cts +121 -2
- package/dist/vue/async.d.ts +121 -2
- package/dist/vue/index.d.cts +114 -6
- package/dist/vue/index.d.ts +114 -6
- 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/assets-Bu6UohJx.cjs +0 -1
- package/dist/assets-DegqDNqY.js +0 -160
- 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,44 +1,44 @@
|
|
|
1
|
-
import { v as
|
|
2
|
-
import { v as
|
|
3
|
-
import { R as
|
|
4
|
-
import { v as
|
|
5
|
-
import { v as
|
|
6
|
-
import { v as
|
|
7
|
-
function
|
|
1
|
+
import { v as J } from "./matrix-yZsGnldA.js";
|
|
2
|
+
import { v as j, e as D } from "./computed-Bvk0W15F.js";
|
|
3
|
+
import { R as H } from "./render-plan-Ck6koX9L.js";
|
|
4
|
+
import { v as L, d as K } from "./validate-DbgEM1Hh.js";
|
|
5
|
+
import { v as U, e as W } from "./param-validation-BlHHXs6u.js";
|
|
6
|
+
import { v as G, a as z } from "./tree-CqcQ99NM.js";
|
|
7
|
+
function x(e) {
|
|
8
8
|
return e.kind === "list" ? e.id : e.nid;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function B(e) {
|
|
11
11
|
return e.kind === "list" ? !1 : e.pageAnchor !== void 0 || e.kind === "text" && typeof e.text == "string" && /\{(?:page|totalPages)\}/.test(e.text);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const t = e.filter((n) => i.componentIds.includes(
|
|
13
|
+
function X(e, i) {
|
|
14
|
+
const t = e.filter((n) => i.componentIds.includes(x(n) ?? ""));
|
|
15
15
|
if (t.filter((n) => n.kind === "list" && n.cardinality !== "record").length && t.length !== 1) throw new Error("纵向重复区域必须独占流式分段,不能与静态或单记录区域并排");
|
|
16
16
|
for (const n of t) {
|
|
17
17
|
const a = n.kind === "list" ? n.topMm + (n.rowHeightMm ?? 0) : n.topMm + n.heightMm;
|
|
18
18
|
if (n.topMm < i.topMm - 1e-3 || a > i.topMm + i.heightMm + 1e-3) throw new Error("流式分段应完整包含其组件的原始纵向范围");
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function Oe(e, i) {
|
|
22
22
|
if (!i) return e.map((s) => ({ components: [s] }));
|
|
23
|
-
const t = new Map(e.map((s) => [
|
|
23
|
+
const t = new Map(e.map((s) => [x(s), s]));
|
|
24
24
|
return i.bands.map((s) => ({ band: s, components: s.componentIds.map((n) => {
|
|
25
25
|
const a = t.get(n);
|
|
26
26
|
if (!a) throw new Error(`流式区域引用不存在的组件:${n}`);
|
|
27
27
|
return a;
|
|
28
28
|
}) }));
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function Y(e, i) {
|
|
31
31
|
if (!i || !Array.isArray(i.bands) || !i.bands.length || i.bands.length > 1e4) throw new Error("流式排版应包含 1–10000 个区域");
|
|
32
32
|
const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
33
33
|
for (const n of e) {
|
|
34
|
-
if (
|
|
35
|
-
const a =
|
|
34
|
+
if (B(n)) continue;
|
|
35
|
+
const a = x(n);
|
|
36
36
|
if (!a || t.has(a)) throw new Error("流式排版组件应具有唯一标识");
|
|
37
37
|
t.add(a);
|
|
38
38
|
}
|
|
39
|
-
if (
|
|
39
|
+
if (q(e, i, t, s), s.size !== t.size) throw new Error("流式排版必须显式包含每个非锚点组件");
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function q(e, i, t, s) {
|
|
42
42
|
let n = -1 / 0;
|
|
43
43
|
for (const a of i.bands) {
|
|
44
44
|
if (!Number.isFinite(a.topMm) || !Number.isFinite(a.heightMm) || a.topMm < 0 || a.heightMm <= 0 || a.topMm < n - 1e-3) throw new Error("流式区域应按原始位置排序,尺寸有效且不重叠");
|
|
@@ -47,15 +47,78 @@ function z(e, i, t, s) {
|
|
|
47
47
|
if (!t.has(o) || s.has(o)) throw new Error(`流式区域组件缺失、重复或包含页锚点:${o}`);
|
|
48
48
|
s.add(o);
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
X(e, a), n = a.topMm + a.heightMm;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const Q = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
54
|
+
function y(e) {
|
|
55
|
+
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
56
|
+
}
|
|
57
|
+
function M(e) {
|
|
58
|
+
return typeof e == "string" && !!e.trim() && !Q.has(e);
|
|
59
|
+
}
|
|
60
|
+
function E(e, i, t, s) {
|
|
61
|
+
for (const n of Object.keys(e)) i.includes(n) || s.push({ path: `${t}.${n}`, message: "存在未知配置字段" });
|
|
62
|
+
}
|
|
63
|
+
function Z(e, i, t) {
|
|
64
|
+
if (e !== void 0) {
|
|
65
|
+
if (!y(e) || !["number", "percent", "date"].includes(String(e.kind))) {
|
|
66
|
+
t.push({ path: i, message: "绑定格式应为 number、percent 或 date" });
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
E(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: "日期格式应为字符串" });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function ee(e, i, t) {
|
|
73
|
+
const s = e.binding;
|
|
74
|
+
if (s === void 0) return;
|
|
75
|
+
const n = `${i}.binding`;
|
|
76
|
+
if (!y(s)) {
|
|
77
|
+
t.push({ path: n, message: "字段绑定应为对象" });
|
|
78
|
+
return;
|
|
51
79
|
}
|
|
80
|
+
(!["text", "image", "barcode", "qrcode"].includes(String(e.kind)) || e.grid !== void 0) && t.push({ path: n, message: "绑定仅支持独立文本、图片、条码与二维码组件" }), E(s, ["field", "format", "prefix", "suffix", "emptyText"], n, t), M(s.field) || t.push({ path: `${n}.field`, message: "绑定字段应为安全的非空字段名(按字面读取自有字段)" });
|
|
81
|
+
for (const a of ["prefix", "suffix", "emptyText"]) s[a] !== void 0 && typeof s[a] != "string" && t.push({ path: `${n}.${a}`, message: "应为字符串" });
|
|
82
|
+
Z(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,不支持文本格式或前后缀" });
|
|
83
|
+
}
|
|
84
|
+
function te(e, i) {
|
|
85
|
+
if (!y(e)) {
|
|
86
|
+
i.push({ path: "$.repeat", message: "逐记录配置应为对象" });
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
E(e, ["dataset", "rowKey", "copies"], "$.repeat", i), M(e.dataset) || i.push({ path: "$.repeat.dataset", message: "数据集应为安全的非空名称" }), e.rowKey !== void 0 && !M(e.rowKey) && i.push({ path: "$.repeat.rowKey", message: "业务主键应为安全的非空字段名" });
|
|
90
|
+
const t = e.copies;
|
|
91
|
+
t !== void 0 && (y(t) ? (E(t, ["field"], "$.repeat.copies", i), M(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 整数" }));
|
|
92
|
+
}
|
|
93
|
+
function _(e, i, t, s) {
|
|
94
|
+
if (!y(e)) return;
|
|
95
|
+
ee(e, i, s), e.binding !== void 0 && !t && s.push({ path: `${i}.binding`, message: "字段绑定需要模板 repeat 数据集;普通报表请使用列表字段" }), t && e.kind === "list" && s.push({ path: i, message: "逐记录标签使用固定组件;动态列表请使用普通报表模板" });
|
|
96
|
+
const n = e.grid;
|
|
97
|
+
y(n) && Array.isArray(n.cells) && n.cells.forEach((a, o) => {
|
|
98
|
+
Array.isArray(a) && a.forEach((f, r) => {
|
|
99
|
+
y(f) && Array.isArray(f.children) && f.children.forEach((h, m) => _(h, `${i}.grid.cells.${o}.${r}.children.${m}`, t, s));
|
|
100
|
+
});
|
|
101
|
+
});
|
|
52
102
|
}
|
|
53
|
-
function
|
|
103
|
+
function ie(e, i) {
|
|
104
|
+
const t = e.repeat !== void 0;
|
|
105
|
+
t && te(e.repeat, i), Array.isArray(e.pages) && e.pages.forEach((s, n) => {
|
|
106
|
+
if (!y(s)) return;
|
|
107
|
+
const a = `$.pages.${n}`;
|
|
108
|
+
t && (s.layout === "wide" || s.flow !== void 0) && i.push({ path: a, message: "逐记录标签仅支持固定尺寸页面,不支持宽表或流式分区" }), Array.isArray(s.components) && s.components.forEach((o, f) => {
|
|
109
|
+
const r = `${a}.components.${f}`;
|
|
110
|
+
if (_(o, r, t, i), !t || !y(o)) return;
|
|
111
|
+
const { leftMm: h, topMm: m, widthMm: g, heightMm: p } = o;
|
|
112
|
+
[h, m, g, p, s.widthMm, s.heightMm].every((b) => typeof b == "number" && Number.isFinite(b)) && (Number(h) < 0 || Number(m) < 0 || Number(h) + Number(g) > Number(s.widthMm) + 1e-3 || Number(m) + Number(p) > Number(s.heightMm) + 1e-3) && i.push({ path: r, message: "标签组件超出纸张边界,请调整位置或尺寸" });
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function T(e) {
|
|
54
117
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
55
118
|
}
|
|
56
|
-
function
|
|
119
|
+
function v(e, i, t) {
|
|
57
120
|
if (e !== void 0) {
|
|
58
|
-
if (!
|
|
121
|
+
if (!T(e)) {
|
|
59
122
|
t.push({ path: i, message: "条件应为对象" });
|
|
60
123
|
return;
|
|
61
124
|
}
|
|
@@ -65,7 +128,7 @@ function E(e, i, t) {
|
|
|
65
128
|
});
|
|
66
129
|
}
|
|
67
130
|
}
|
|
68
|
-
function
|
|
131
|
+
function I(e, i, t) {
|
|
69
132
|
if (e === void 0) return;
|
|
70
133
|
if (!Array.isArray(e) || e.length > 2048) {
|
|
71
134
|
t.push({ path: i, message: "聚合应为数组且最多 2048 项" });
|
|
@@ -74,7 +137,7 @@ function L(e, i, t) {
|
|
|
74
137
|
const s = /* @__PURE__ */ new Set();
|
|
75
138
|
e.forEach((n, a) => {
|
|
76
139
|
const o = `${i}.${a}`;
|
|
77
|
-
if (!
|
|
140
|
+
if (!T(n)) {
|
|
78
141
|
t.push({ path: o, message: "聚合应为对象" });
|
|
79
142
|
return;
|
|
80
143
|
}
|
|
@@ -90,7 +153,7 @@ function L(e, i, t) {
|
|
|
90
153
|
message: "小数位应为 0–100 的整数"
|
|
91
154
|
});
|
|
92
155
|
try {
|
|
93
|
-
|
|
156
|
+
D({
|
|
94
157
|
...n,
|
|
95
158
|
field: n.valueField ?? f
|
|
96
159
|
});
|
|
@@ -102,15 +165,15 @@ function L(e, i, t) {
|
|
|
102
165
|
}
|
|
103
166
|
});
|
|
104
167
|
}
|
|
105
|
-
function
|
|
168
|
+
function se(e, i, t) {
|
|
106
169
|
if (e === void 0) return;
|
|
107
|
-
const s =
|
|
170
|
+
const s = j(e);
|
|
108
171
|
for (const n of s.errors) t.push({ path: i, message: n });
|
|
109
172
|
}
|
|
110
|
-
function
|
|
173
|
+
function ne(e, i, t) {
|
|
111
174
|
if (e !== void 0)
|
|
112
175
|
try {
|
|
113
|
-
|
|
176
|
+
J(e);
|
|
114
177
|
} catch (s) {
|
|
115
178
|
t.push({
|
|
116
179
|
path: i,
|
|
@@ -118,31 +181,31 @@ function X(e, i, t) {
|
|
|
118
181
|
});
|
|
119
182
|
}
|
|
120
183
|
}
|
|
121
|
-
function
|
|
184
|
+
function ae(e, i, t) {
|
|
122
185
|
if (e.tree === void 0) return;
|
|
123
186
|
const s = `${i}.tree`;
|
|
124
187
|
try {
|
|
125
|
-
|
|
188
|
+
G(e.tree);
|
|
126
189
|
const n = e.tree;
|
|
127
190
|
if (e.matrix || e.detail || e.groupBy || Array.isArray(e.groups) && e.groups.length || e.rowVisibleWhen) throw new Error("树形布局不能同时配置普通分组、矩阵、主从或行可见条件");
|
|
128
191
|
if (e.rowKey !== void 0 && e.rowKey !== n.idField) throw new Error("树形 rowKey 应与 idField 一致");
|
|
129
192
|
if (!Array.isArray(e.columns) || !e.columns.some((a) => a && a.field === n.labelField && !a.hidden)) throw new Error("树形布局需要可见的标签列");
|
|
130
|
-
Array.isArray(e.computed) &&
|
|
193
|
+
Array.isArray(e.computed) && z(n, e.computed);
|
|
131
194
|
} catch (n) {
|
|
132
195
|
t.push({ path: s, message: n instanceof Error ? n.message : String(n) });
|
|
133
196
|
}
|
|
134
197
|
}
|
|
135
|
-
const
|
|
136
|
-
class
|
|
198
|
+
const P = "1.0";
|
|
199
|
+
class A extends Error {
|
|
137
200
|
constructor(i) {
|
|
138
201
|
super(`模板校验失败:${i.slice(0, 3).map((t) => `${t.path}: ${t.message}`).join("; ")}`), this.errors = i, this.name = "ReportTemplateError";
|
|
139
202
|
}
|
|
140
203
|
}
|
|
141
|
-
const
|
|
142
|
-
function
|
|
204
|
+
const oe = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]), fe = /* @__PURE__ */ new Set(["schemaVersion", "id", "name", "revision", "description", "template"]), re = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]), N = 2e5, he = 64, O = 1e7;
|
|
205
|
+
function d(e) {
|
|
143
206
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
144
207
|
}
|
|
145
|
-
function
|
|
208
|
+
function me(e, i, t) {
|
|
146
209
|
const s = Object.getPrototypeOf(e), n = Array.isArray(e);
|
|
147
210
|
if (n ? s !== Array.prototype : s !== Object.prototype && s !== null)
|
|
148
211
|
return t.push({ path: i, message: "模板对象必须使用普通 JSON 对象原型" }), !1;
|
|
@@ -153,30 +216,30 @@ function te(e, i, t) {
|
|
|
153
216
|
}
|
|
154
217
|
return Object.getOwnPropertySymbols(e).length > 0 ? (t.push({ path: i, message: "模板不能包含 Symbol 键" }), !1) : !0;
|
|
155
218
|
}
|
|
156
|
-
function
|
|
157
|
-
return
|
|
219
|
+
function de(e, i, t, s) {
|
|
220
|
+
return oe.has(e) ? (s.push({ path: t, message: "模板不能包含可能污染原型的键" }), !1) : i.get || i.set || !i.enumerable ? (s.push({ path: t, message: "模板不能包含访问器或不可枚举字段" }), !1) : !0;
|
|
158
221
|
}
|
|
159
|
-
function
|
|
222
|
+
function ue(e) {
|
|
160
223
|
return e === null || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e);
|
|
161
224
|
}
|
|
162
|
-
function
|
|
225
|
+
function R(e, i) {
|
|
163
226
|
const t = /* @__PURE__ */ new Set();
|
|
164
227
|
let s = 0, n = 0, a = !1;
|
|
165
228
|
const o = (f, r, h) => {
|
|
166
229
|
if (!a) {
|
|
167
|
-
if (++s >
|
|
168
|
-
s ===
|
|
230
|
+
if (++s > N) {
|
|
231
|
+
s === N + 1 && i.push({ path: r, message: "模板超过 JSON 节点安全上限" });
|
|
169
232
|
return;
|
|
170
233
|
}
|
|
171
|
-
if (h >
|
|
234
|
+
if (h > he) {
|
|
172
235
|
i.push({ path: r, message: "模板嵌套层级过深" });
|
|
173
236
|
return;
|
|
174
237
|
}
|
|
175
238
|
if (typeof f == "string") {
|
|
176
|
-
n += f.length, n >
|
|
239
|
+
n += f.length, n > O && (a = !0, i.push({ path: r, message: "模板文本超过 1000 万字符的安全上限" }));
|
|
177
240
|
return;
|
|
178
241
|
}
|
|
179
|
-
if (!
|
|
242
|
+
if (!ue(f)) {
|
|
180
243
|
if (!f || typeof f != "object") {
|
|
181
244
|
i.push({ path: r, message: "模板只允许 JSON 值,不允许函数、undefined 或非有限数字" });
|
|
182
245
|
return;
|
|
@@ -185,12 +248,12 @@ function k(e, i) {
|
|
|
185
248
|
i.push({ path: r, message: "模板不能包含循环引用" });
|
|
186
249
|
return;
|
|
187
250
|
}
|
|
188
|
-
if (
|
|
251
|
+
if (me(f, r, i)) {
|
|
189
252
|
t.add(f);
|
|
190
|
-
for (const [
|
|
191
|
-
if (Array.isArray(f) &&
|
|
192
|
-
const
|
|
193
|
-
if (
|
|
253
|
+
for (const [m, g] of Object.entries(Object.getOwnPropertyDescriptors(f))) {
|
|
254
|
+
if (Array.isArray(f) && m === "length") continue;
|
|
255
|
+
const p = `${r}.${m}`;
|
|
256
|
+
if (de(m, g, p, i) && o(g.value, p, h + 1), s > N || a) break;
|
|
194
257
|
}
|
|
195
258
|
t.delete(f);
|
|
196
259
|
}
|
|
@@ -207,27 +270,27 @@ function c(e, i, t, s, n = 0, a = !1) {
|
|
|
207
270
|
const o = e[i];
|
|
208
271
|
o === void 0 && !a || (typeof o != "number" || !Number.isFinite(o) || o < n) && s.push({ path: `${t}.${i}`, message: `应为大于等于 ${n} 的有限数字` });
|
|
209
272
|
}
|
|
210
|
-
function
|
|
273
|
+
function $(e, i, t, s) {
|
|
211
274
|
e[i] !== void 0 && typeof e[i] != "boolean" && s.push({ path: `${t}.${i}`, message: "应为布尔值" });
|
|
212
275
|
}
|
|
213
|
-
function
|
|
214
|
-
e !== void 0 && !
|
|
276
|
+
function w(e, i, t, s = !1) {
|
|
277
|
+
e !== void 0 && !re.has(e) && !(s && e === "auto") && t.push({ path: i, message: `未知对齐方式${s ? "(支持 auto)" : ""}` });
|
|
215
278
|
}
|
|
216
|
-
function
|
|
279
|
+
function l(e, i, t) {
|
|
217
280
|
if (e !== void 0) {
|
|
218
|
-
if (!
|
|
281
|
+
if (!d(e)) {
|
|
219
282
|
t.push({ path: i, message: "样式应为对象" });
|
|
220
283
|
return;
|
|
221
284
|
}
|
|
222
|
-
|
|
285
|
+
w(e.align, `${i}.align`, t), e.verticalAlign !== void 0 && !["top", "middle", "bottom"].includes(e.verticalAlign) && t.push({ path: `${i}.verticalAlign`, message: "未知垂直对齐方式" });
|
|
223
286
|
for (const s of ["fontSize", "fontSizePx", "lineWidthPt", "lineHeight"]) c(e, s, i, t);
|
|
224
287
|
for (const s of ["letterSpacing", "rotateDeg"]) c(e, s, i, t, -1 / 0);
|
|
225
288
|
c(e, "opacity", i, t), typeof e.opacity == "number" && e.opacity > 1 && t.push({ path: `${i}.opacity`, message: "透明度不能大于 1" });
|
|
226
|
-
for (const s of ["bold", "italic", "underline", "borderTop", "borderRight", "borderBottom", "borderLeft"])
|
|
289
|
+
for (const s of ["bold", "italic", "underline", "borderTop", "borderRight", "borderBottom", "borderLeft"]) $(e, s, i, t);
|
|
227
290
|
for (const s of ["fontFamily", "color", "backgroundColor", "lineColor", "borderColor"]) u(e, s, i, t);
|
|
228
291
|
}
|
|
229
292
|
}
|
|
230
|
-
function
|
|
293
|
+
function ce(e, i, t) {
|
|
231
294
|
if (e === void 0) return;
|
|
232
295
|
if (!Array.isArray(e)) {
|
|
233
296
|
t.push({ path: i, message: "参数定义应为数组" });
|
|
@@ -236,149 +299,149 @@ function ne(e, i, t) {
|
|
|
236
299
|
const s = /* @__PURE__ */ new Set(), n = t.length;
|
|
237
300
|
e.forEach((a, o) => {
|
|
238
301
|
const f = `${i}.${o}`;
|
|
239
|
-
if (!
|
|
302
|
+
if (!d(a)) {
|
|
240
303
|
t.push({ path: f, message: "参数定义应为对象" });
|
|
241
304
|
return;
|
|
242
305
|
}
|
|
243
306
|
u(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"].includes(a.type) && t.push({ path: `${f}.type`, message: "未知参数类型" });
|
|
244
307
|
for (const r of ["label", "defaultValue", "placeholder"]) u(a, r, f, t);
|
|
245
|
-
|
|
308
|
+
$(a, "required", f, t);
|
|
246
309
|
for (const r of ["minLength", "maxLength"]) {
|
|
247
310
|
const h = a[r];
|
|
248
311
|
h !== void 0 && (typeof h != "number" || !Number.isSafeInteger(h) || h < 0) && t.push({ path: `${f}.${r}`, message: "长度边界应为非负整数" });
|
|
249
312
|
}
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
if (!
|
|
313
|
+
ge(a, f, t), a.options !== void 0 && (Array.isArray(a.options) ? a.options.forEach((r, h) => {
|
|
314
|
+
const m = `${f}.options.${h}`;
|
|
315
|
+
if (!d(r)) t.push({ path: m, message: "选项应为对象" });
|
|
253
316
|
else
|
|
254
|
-
for (const
|
|
317
|
+
for (const g of ["label", "value"]) typeof r[g] != "string" && t.push({ path: `${m}.${g}`, message: "选项标签与值应为字符串(允许空白选项)" });
|
|
255
318
|
}) : t.push({ path: `${f}.options`, message: "选项应为数组" }));
|
|
256
|
-
}), t.length === n && t.push(...
|
|
319
|
+
}), t.length === n && t.push(...U(e).map((a) => ({ path: a.path.replace("$.paramDefs", i), message: a.message })));
|
|
257
320
|
}
|
|
258
|
-
function
|
|
321
|
+
function ge(e, i, t) {
|
|
259
322
|
for (const a of ["min", "max"]) {
|
|
260
323
|
const o = e[a];
|
|
261
324
|
if (o === void 0) continue;
|
|
262
|
-
|
|
325
|
+
W(e.type, o) || e.type === "number" && typeof o == "number" && Number.isFinite(o) || t.push({ path: `${i}.${a}`, message: "数字使用有限数字边界,日期/月/年使用对应规范字符串边界" });
|
|
263
326
|
}
|
|
264
327
|
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;
|
|
265
328
|
(s || n) && t.push({ path: i, message: "最小边界不能大于最大边界" }), typeof e.minLength == "number" && typeof e.maxLength == "number" && e.minLength > e.maxLength && t.push({ path: i, message: "最小长度不能大于最大长度" });
|
|
266
329
|
}
|
|
267
|
-
function
|
|
330
|
+
function C(e, i, t) {
|
|
268
331
|
if (!Array.isArray(e) || e.length === 0) {
|
|
269
332
|
t.push({ path: i, message: "列表至少需要一列" });
|
|
270
333
|
return;
|
|
271
334
|
}
|
|
272
|
-
e.every((s) =>
|
|
335
|
+
e.every((s) => d(s) && s.hidden === !0) && t.push({ path: i, message: "列表至少需要一列可见列" }), e.forEach((s, n) => {
|
|
273
336
|
const a = `${i}.${n}`;
|
|
274
|
-
if (!
|
|
337
|
+
if (!d(s)) {
|
|
275
338
|
t.push({ path: a, message: "列应为对象" });
|
|
276
339
|
return;
|
|
277
340
|
}
|
|
278
|
-
if (
|
|
279
|
-
if (!
|
|
341
|
+
if (K(s, a, t), $(s, "hidden", a, t), v(s.visibleWhen, `${a}.visibleWhen`, t), typeof s.header != "string" && t.push({ path: `${a}.header`, message: "表头应为字符串(允许空白表头)" }), u(s, "field", a, t, !0), c(s, "widthMm", a, t, Number.MIN_VALUE, !0), l(s.style, `${a}.style`, t), l(s.headerStyle, `${a}.headerStyle`, t), w(s.align, `${a}.align`, t, !0), w(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)
|
|
342
|
+
if (!d(s.format) || !["number", "percent", "date"].includes(s.format.kind))
|
|
280
343
|
t.push({ path: `${a}.format`, message: "未知列格式" });
|
|
281
344
|
else {
|
|
282
345
|
const o = s.format.digits;
|
|
283
|
-
o !== void 0 && (typeof o != "number" || !Number.isInteger(o) || o < 0 || o > 100) && t.push({ path: `${a}.format.digits`, message: "小数位应为 0–100 的整数" }),
|
|
346
|
+
o !== void 0 && (typeof o != "number" || !Number.isInteger(o) || o < 0 || o > 100) && t.push({ path: `${a}.format.digits`, message: "小数位应为 0–100 的整数" }), $(s.format, "thousands", `${a}.format`, t), u(s.format, "pattern", `${a}.format`, t);
|
|
284
347
|
}
|
|
285
348
|
s.rules !== void 0 && (Array.isArray(s.rules) ? s.rules.forEach((o, f) => {
|
|
286
349
|
const r = `${a}.rules.${f}`;
|
|
287
|
-
if (!
|
|
350
|
+
if (!d(o) || !d(o.when)) {
|
|
288
351
|
t.push({ path: r, message: "条件格式缺少 when 对象" });
|
|
289
352
|
return;
|
|
290
353
|
}
|
|
291
|
-
|
|
354
|
+
v(o.when, `${r}.when`, t), u(o.when, "field", `${r}.when`, t, !0), [">", ">=", "<", "<=", "==", "!="].includes(o.when.op) || t.push({ path: `${r}.when.op`, message: "未知条件运算符" }), typeof o.when.value != "number" && typeof o.when.value != "string" && t.push({ path: `${r}.when.value`, message: "条件值应为数字或字符串" }), l(o.style, `${r}.style`, t);
|
|
292
355
|
}) : t.push({ path: `${a}.rules`, message: "条件格式应为数组" }));
|
|
293
356
|
});
|
|
294
357
|
}
|
|
295
|
-
function
|
|
358
|
+
function V(e, i, t) {
|
|
296
359
|
if (e !== void 0) {
|
|
297
|
-
if (!
|
|
360
|
+
if (!d(e)) {
|
|
298
361
|
t.push({ path: i, message: "分组应为对象" });
|
|
299
362
|
return;
|
|
300
363
|
}
|
|
301
364
|
u(e, "field", i, t, !0);
|
|
302
365
|
for (const s of ["headerTemplate", "subtotalLabel"]) u(e, s, i, t);
|
|
303
|
-
for (const s of ["headerStyle", "subtotalStyle"])
|
|
304
|
-
|
|
366
|
+
for (const s of ["headerStyle", "subtotalStyle"]) l(e[s], `${i}.${s}`, t);
|
|
367
|
+
$(e, "keepWithNext", i, t), $(e, "repeatHeader", i, t), I(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: "小计字段应为字符串数组" });
|
|
305
368
|
}
|
|
306
369
|
}
|
|
307
|
-
function
|
|
370
|
+
function pe(e, i, t) {
|
|
308
371
|
if (!(e === void 0 || typeof e == "boolean")) {
|
|
309
|
-
if (!
|
|
372
|
+
if (!d(e)) {
|
|
310
373
|
t.push({ path: i, message: "合计应为布尔值或对象" });
|
|
311
374
|
return;
|
|
312
375
|
}
|
|
313
|
-
u(e, "label", i, t),
|
|
376
|
+
u(e, "label", i, t), I(e.aggregates, `${i}.aggregates`, t), l(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: "合计字段应为字符串数组" });
|
|
314
377
|
}
|
|
315
378
|
}
|
|
316
|
-
function
|
|
379
|
+
function ye(e, i, t, s) {
|
|
317
380
|
const n = { kind: "rect", leftMm: 0, topMm: 0, widthMm: 1, heightMm: 1, grid: e };
|
|
318
|
-
if (
|
|
381
|
+
if (L(n, t, s, []), F(n, t, s), !d(e) || !Array.isArray(e.cells)) return;
|
|
319
382
|
const a = e.cells, o = Array.isArray(i) ? i.length : 0;
|
|
320
|
-
if (a.length * o >
|
|
383
|
+
if (a.length * o > N) {
|
|
321
384
|
s.push({ path: t, message: "表头逻辑网格超过 20 万格安全上限" });
|
|
322
385
|
return;
|
|
323
386
|
}
|
|
324
|
-
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: "表头行高数量应与行数一致" }),
|
|
387
|
+
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: "表头行高数量应与行数一致" }), le(a, o, t, s);
|
|
325
388
|
}
|
|
326
|
-
function
|
|
389
|
+
function le(e, i, t, s) {
|
|
327
390
|
const n = /* @__PURE__ */ new Set();
|
|
328
391
|
e.forEach((a, o) => {
|
|
329
392
|
if (!Array.isArray(a)) return;
|
|
330
393
|
let f = 0;
|
|
331
394
|
a.forEach((r, h) => {
|
|
332
395
|
for (; n.has(`${o}:${f}`); ) f++;
|
|
333
|
-
const
|
|
334
|
-
(f +
|
|
335
|
-
for (let
|
|
336
|
-
for (let
|
|
337
|
-
n.has(`${
|
|
338
|
-
f +=
|
|
396
|
+
const m = d(r) && typeof r.colSpan == "number" ? r.colSpan : 1, g = d(r) && typeof r.rowSpan == "number" ? r.rowSpan : 1;
|
|
397
|
+
(f + m > i || o + g > e.length) && s.push({ path: `${t}.cells.${o}.${h}`, message: "表头合并区域超出表头边界" });
|
|
398
|
+
for (let p = o; p < Math.min(e.length, o + g); p++)
|
|
399
|
+
for (let b = f; b < Math.min(i, f + m); b++)
|
|
400
|
+
n.has(`${p}:${b}`) && s.push({ path: `${t}.cells.${o}.${h}`, message: "表头合并区域重叠" }), n.add(`${p}:${b}`);
|
|
401
|
+
f += m;
|
|
339
402
|
});
|
|
340
403
|
});
|
|
341
404
|
}
|
|
342
|
-
function
|
|
343
|
-
if (
|
|
405
|
+
function $e(e, i, t) {
|
|
406
|
+
if (ae(e, i, t), se(e.computed, `${i}.computed`, t), ne(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 汇总,不能同时配置普通分组、总计或主从明细" }), v(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) => V(a, `${i}.groups.${o}`, t))), e.detail === void 0) return;
|
|
344
407
|
const s = e.detail, n = `${i}.detail`;
|
|
345
|
-
if (!
|
|
408
|
+
if (!d(s)) {
|
|
346
409
|
t.push({ path: n, message: "主从关联应为对象" });
|
|
347
410
|
return;
|
|
348
411
|
}
|
|
349
412
|
for (const a of ["dataset", "parentKey", "foreignKey"]) u(s, a, n, t, !0);
|
|
350
413
|
for (const a of ["rowKey", "revisionField", "sourceTokenField"]) u(s, a, n, t, s[a] !== void 0);
|
|
351
|
-
u(s, "label", n, t),
|
|
414
|
+
u(s, "label", n, t), $(s, "header", n, t), c(s, "rowHeightMm", n, t, Number.MIN_VALUE), C(s.columns, `${n}.columns`, t), s.unmatched !== void 0 && s.unmatched !== "error" && s.unmatched !== "ignore" && t.push({ path: `${n}.unmatched`, message: "未关联明细策略应为 error 或 ignore" });
|
|
352
415
|
}
|
|
353
|
-
function
|
|
416
|
+
function be(e, i, t) {
|
|
354
417
|
for (const s of ["leftMm", "topMm"]) c(e, s, i, t, -1 / 0, !0);
|
|
355
418
|
c(e, "widthMm", i, t, Number.MIN_VALUE, !0), u(e, "dataset", i, t, !0), u(e, "title", i, t);
|
|
356
419
|
for (const s of ["rowKey", "revisionField", "sourceTokenField"]) u(e, s, i, t, e[s] !== void 0);
|
|
357
|
-
e.headerGrid !== void 0 &&
|
|
420
|
+
e.headerGrid !== void 0 && ye(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" }), C(e.columns, `${i}.columns`, t);
|
|
358
421
|
for (const s of ["fontSizePt", "rowHeightMm"]) c(e, s, i, t, Number.MIN_VALUE);
|
|
359
422
|
c(e, "paddingMm", i, t);
|
|
360
|
-
for (const s of ["header", "headerBold", "headerEveryPage", "border"])
|
|
361
|
-
e.cardinality !== void 0 && e.cardinality !== "record" && t.push({ path: `${i}.cardinality`, message: "单记录区域类型应为 record" }), u(e, "headerBackgroundColor", i, t),
|
|
423
|
+
for (const s of ["header", "headerBold", "headerEveryPage", "border"]) $(e, s, i, t);
|
|
424
|
+
e.cardinality !== void 0 && e.cardinality !== "record" && t.push({ path: `${i}.cardinality`, message: "单记录区域类型应为 record" }), u(e, "headerBackgroundColor", i, t), w(e.align, `${i}.align`, t, !0), w(e.headerAlign, `${i}.headerAlign`, t), l(e.headerStyle, `${i}.headerStyle`, t), $e(e, i, t), V(e.groupBy, `${i}.groupBy`, t), pe(e.grandTotal, `${i}.grandTotal`, t);
|
|
362
425
|
}
|
|
363
|
-
function
|
|
364
|
-
|
|
426
|
+
function F(e, i, t) {
|
|
427
|
+
l(e.style, `${i}.style`, t);
|
|
365
428
|
for (const n of ["text", "rawText", "imageData", "fallbackText", "nid", "rkey"]) u(e, n, i, t);
|
|
366
429
|
if (e.lines !== void 0 && (!Array.isArray(e.lines) || e.lines.some((n) => typeof n != "string")) && t.push({ path: `${i}.lines`, message: "文本行应为字符串数组" }), Array.isArray(e.richParagraphs) && e.richParagraphs.forEach((n, a) => {
|
|
367
|
-
if (!
|
|
430
|
+
if (!d(n)) return;
|
|
368
431
|
const o = `${i}.richParagraphs.${a}`;
|
|
369
|
-
|
|
432
|
+
w(n.align, `${o}.align`, t);
|
|
370
433
|
for (const f of ["lineHeight", "spaceBeforeMm", "spaceAfterMm", "indentMm"]) c(n, f, o, t);
|
|
371
434
|
Array.isArray(n.segments) && n.segments.forEach((f, r) => {
|
|
372
435
|
const h = `${o}.segments.${r}`;
|
|
373
|
-
if (!
|
|
436
|
+
if (!d(f)) {
|
|
374
437
|
t.push({ path: h, message: "富文本片段应为对象" });
|
|
375
438
|
return;
|
|
376
439
|
}
|
|
377
440
|
f.kind !== void 0 && f.kind !== "text" && f.kind !== "field" && t.push({ path: `${h}.kind`, message: "未知富文本片段类型" });
|
|
378
|
-
for (const
|
|
379
|
-
|
|
441
|
+
for (const m of ["text", "field"]) u(f, m, h, t);
|
|
442
|
+
l(f.style, `${h}.style`, t);
|
|
380
443
|
});
|
|
381
|
-
}), !
|
|
444
|
+
}), !d(e.grid)) return;
|
|
382
445
|
const s = e.grid;
|
|
383
446
|
c(s, "gapMm", `${i}.grid`, t), c(s, "paddingMm", `${i}.grid`, t);
|
|
384
447
|
for (const n of ["colWidthsMm", "rowHeightsMm"]) {
|
|
@@ -389,35 +452,35 @@ function x(e, i, t) {
|
|
|
389
452
|
Array.isArray(n) && n.forEach((o, f) => {
|
|
390
453
|
const r = `${i}.grid.cells.${a}.${f}`;
|
|
391
454
|
if (o !== null) {
|
|
392
|
-
if (!
|
|
455
|
+
if (!d(o)) {
|
|
393
456
|
t.push({ path: r, message: "网格单元格应为对象或 null" });
|
|
394
457
|
return;
|
|
395
458
|
}
|
|
396
459
|
for (const h of ["text", "rawText", "numberFormat"]) u(o, h, r, t);
|
|
397
460
|
for (const h of ["colSpan", "rowSpan"]) {
|
|
398
|
-
const
|
|
399
|
-
|
|
461
|
+
const m = o[h];
|
|
462
|
+
m !== void 0 && (typeof m != "number" || !Number.isInteger(m) || m <= 0) && t.push({ path: `${r}.${h}`, message: "跨度应为正整数" });
|
|
400
463
|
}
|
|
401
|
-
o.value !== void 0 && o.value !== null && !["string", "number", "boolean"].includes(typeof o.value) && t.push({ path: `${r}.value`, message: "Excel 原始值应为字符串、数字、布尔值或 null" }),
|
|
402
|
-
|
|
464
|
+
o.value !== void 0 && o.value !== null && !["string", "number", "boolean"].includes(typeof o.value) && t.push({ path: `${r}.value`, message: "Excel 原始值应为字符串、数字、布尔值或 null" }), l(o.style, `${r}.style`, t), o.children !== void 0 && (Array.isArray(o.children) ? o.children.forEach((h, m) => {
|
|
465
|
+
d(h) && F(h, `${r}.children.${m}`, t);
|
|
403
466
|
}) : t.push({ path: `${r}.children`, message: "嵌套组件应为数组" }));
|
|
404
467
|
}
|
|
405
468
|
});
|
|
406
469
|
});
|
|
407
470
|
}
|
|
408
|
-
function
|
|
471
|
+
function Ae(e, i, t) {
|
|
409
472
|
if (!(e.flow === void 0 || !Array.isArray(e.components)))
|
|
410
473
|
try {
|
|
411
|
-
|
|
474
|
+
Y(e.components, e.flow);
|
|
412
475
|
} catch (s) {
|
|
413
476
|
t.push({ path: `${i}.flow`, message: s instanceof Error ? s.message : String(s) });
|
|
414
477
|
}
|
|
415
478
|
}
|
|
416
|
-
function
|
|
479
|
+
function we(e) {
|
|
417
480
|
const i = [], t = [];
|
|
418
|
-
return
|
|
481
|
+
return R(e, i), i.length ? { ok: !1, errors: i, warnings: t } : (d(e) ? (e.schemaVersion !== void 0 && e.schemaVersion !== H && i.push({ path: "$.schemaVersion", message: "不支持的模板 schemaVersion" }), ce(e.params, "$.params", i), ie(e, i), !Array.isArray(e.pages) || e.pages.length === 0 ? i.push({ path: "$.pages", message: "模板至少需要一页" }) : e.pages.forEach((s, n) => {
|
|
419
482
|
const a = `$.pages.${n}`;
|
|
420
|
-
if (!
|
|
483
|
+
if (!d(s)) {
|
|
421
484
|
i.push({ path: a, message: "页应为对象" });
|
|
422
485
|
return;
|
|
423
486
|
}
|
|
@@ -425,67 +488,67 @@ function de(e) {
|
|
|
425
488
|
for (const o of ["marginTopMm", "marginBottomMm", "marginLeftMm", "marginRightMm"]) c(s, o, a, i);
|
|
426
489
|
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) => {
|
|
427
490
|
const r = `${a}.components.${f}`;
|
|
428
|
-
|
|
429
|
-
}) : i.push({ path: `${a}.components`, message: "组件应为数组" }),
|
|
491
|
+
d(o) && o.kind === "list" ? be(o, r, i) : (L(o, r, i, t), d(o) && F(o, r, i));
|
|
492
|
+
}) : i.push({ path: `${a}.components`, message: "组件应为数组" }), Ae(s, a, i);
|
|
430
493
|
})) : i.push({ path: "$", message: "模板应为对象" }), { ok: i.length === 0, errors: i, warnings: t });
|
|
431
494
|
}
|
|
432
|
-
function
|
|
495
|
+
function Me(e) {
|
|
433
496
|
const i = [], t = [];
|
|
434
|
-
if (
|
|
435
|
-
if (!
|
|
497
|
+
if (R(e, i), i.length) return { ok: !1, errors: i, warnings: t };
|
|
498
|
+
if (!d(e)) i.push({ path: "$", message: "模板文档应为对象" });
|
|
436
499
|
else {
|
|
437
500
|
for (const n of Object.keys(e))
|
|
438
|
-
|
|
439
|
-
e.schemaVersion !==
|
|
501
|
+
fe.has(n) || i.push({ path: `$.${n}`, message: "模板文档存在未知字段;只保存模板与描述,不保存取数或业务数据" });
|
|
502
|
+
e.schemaVersion !== P && i.push({ path: "$.schemaVersion", message: "不支持的模板文档版本" });
|
|
440
503
|
for (const n of ["id", "name"]) u(e, n, "$", i, !0);
|
|
441
504
|
for (const n of ["revision", "description"]) u(e, n, "$", i);
|
|
442
|
-
const s =
|
|
505
|
+
const s = we(e.template);
|
|
443
506
|
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)}` })));
|
|
444
507
|
}
|
|
445
508
|
return { ok: i.length === 0, errors: i, warnings: t };
|
|
446
509
|
}
|
|
447
|
-
function
|
|
448
|
-
const i =
|
|
449
|
-
if (!i.ok) throw new
|
|
510
|
+
function k(e) {
|
|
511
|
+
const i = Me(e);
|
|
512
|
+
if (!i.ok) throw new A(i.errors);
|
|
450
513
|
}
|
|
451
|
-
function
|
|
514
|
+
function Re(e) {
|
|
452
515
|
const i = [];
|
|
453
|
-
if (
|
|
454
|
-
const t = { ...e, schemaVersion: e.schemaVersion ??
|
|
455
|
-
return
|
|
516
|
+
if (R(e, i), i.length) throw new A(i);
|
|
517
|
+
const t = { ...e, schemaVersion: e.schemaVersion ?? P };
|
|
518
|
+
return k(t), S(t);
|
|
456
519
|
}
|
|
457
|
-
function
|
|
520
|
+
function Fe(e) {
|
|
458
521
|
let i = e;
|
|
459
522
|
if (typeof e == "string") {
|
|
460
|
-
if (e.length >
|
|
461
|
-
throw new
|
|
523
|
+
if (e.length > O)
|
|
524
|
+
throw new A([{ path: "$", message: "模板 JSON 超过 1000 万字符的导出/导入上限" }]);
|
|
462
525
|
try {
|
|
463
526
|
i = JSON.parse(e);
|
|
464
527
|
} catch {
|
|
465
|
-
throw new
|
|
528
|
+
throw new A([{ path: "$", message: "模板 JSON 语法无效" }]);
|
|
466
529
|
}
|
|
467
530
|
}
|
|
468
|
-
return
|
|
531
|
+
return k(i), S(i);
|
|
469
532
|
}
|
|
470
|
-
function
|
|
471
|
-
|
|
533
|
+
function Le(e) {
|
|
534
|
+
k(e);
|
|
472
535
|
const i = JSON.stringify(e, null, 2);
|
|
473
|
-
if (i.length >
|
|
536
|
+
if (i.length > O) throw new A([{ path: "$", message: "模板 JSON 超过 1000 万字符的导出/导入上限" }]);
|
|
474
537
|
return i;
|
|
475
538
|
}
|
|
476
|
-
function
|
|
539
|
+
function S(e) {
|
|
477
540
|
return JSON.parse(JSON.stringify(e));
|
|
478
541
|
}
|
|
479
|
-
function
|
|
542
|
+
function _e(e = []) {
|
|
480
543
|
const i = /* @__PURE__ */ new Map(), t = {
|
|
481
544
|
get: (s) => {
|
|
482
545
|
const n = i.get(s);
|
|
483
|
-
return n ?
|
|
546
|
+
return n ? S(n) : void 0;
|
|
484
547
|
},
|
|
485
548
|
list: () => Array.from(i.values(), ({ template: s, ...n }) => ({ ...n })),
|
|
486
549
|
register: (s, n = {}) => {
|
|
487
|
-
if (
|
|
488
|
-
i.set(s.id,
|
|
550
|
+
if (k(s), i.has(s.id) && !n.replace) throw new A([{ path: "$.id", message: `模板 ID ${s.id} 已注册;更新需显式 replace:true` }]);
|
|
551
|
+
i.set(s.id, S(s));
|
|
489
552
|
},
|
|
490
553
|
remove: (s) => i.delete(s)
|
|
491
554
|
};
|
|
@@ -493,14 +556,15 @@ function Ee(e = []) {
|
|
|
493
556
|
return t;
|
|
494
557
|
}
|
|
495
558
|
export {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
559
|
+
A as R,
|
|
560
|
+
P as a,
|
|
561
|
+
Me as b,
|
|
562
|
+
_e as c,
|
|
563
|
+
Re as d,
|
|
564
|
+
Y as e,
|
|
565
|
+
ie as f,
|
|
566
|
+
Fe as p,
|
|
567
|
+
Oe as r,
|
|
568
|
+
Le as s,
|
|
569
|
+
we as v
|
|
506
570
|
};
|