@agile-team/mach-report 2.14.0 → 2.15.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 +16 -11
- package/THIRD_PARTY_NOTICES.md +3 -1
- package/dist/{ExcelBindingWizard-CvsWR8Ga.js → ExcelBindingWizard-BKH1nGNS.js} +3 -3
- package/dist/{ExcelBindingWizard-CLT2p7P3.cjs → ExcelBindingWizard-Bs43BGNp.cjs} +1 -1
- package/dist/ParamEditor-Da4akw6V.cjs +1 -0
- package/dist/ParamEditor-DoAhzJsm.js +594 -0
- package/dist/{ReportBatchPanel-LqVgiqp7.js → ReportBatchPanel-BMf6boMA.js} +39 -39
- package/dist/{ReportBatchPanel-DkxTzBkD.cjs → ReportBatchPanel-wP9m9Pj1.cjs} +1 -1
- package/dist/ReportPreview-ChV19HBp.js +4619 -0
- package/dist/ReportPreview-DbLvvOUT.cjs +6 -0
- package/dist/{ReportTemplateLibrary-MjWEtc7X.js → ReportTemplateLibrary-C9wutIiT.js} +1 -1
- package/dist/{ReportTemplateLibrary-cQ1sqNYo.cjs → ReportTemplateLibrary-Sxr3eD0J.cjs} +1 -1
- package/dist/{RuleEditor-ChuXMlei.js → RuleEditor-C_Clasvd.js} +5 -5
- package/dist/{RuleEditor-BaR6xUiI.cjs → RuleEditor-XhGHK8DE.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-Dci6aRn1.js → TemplateOutlinePanel-D6Bkny59.js} +2 -2
- package/dist/{TemplateOutlinePanel-BHKP89Xz.cjs → TemplateOutlinePanel-JTSR53vJ.cjs} +1 -1
- package/dist/{TemplateReusePanel-CY5eO2Sh.cjs → TemplateReusePanel-Kx35S0Ql.cjs} +1 -1
- package/dist/{TemplateReusePanel-B7Gmyc1z.js → TemplateReusePanel-rVuK1kTz.js} +2 -2
- package/dist/{TemplateReviewPanel-DjlX3xpt.js → TemplateReviewPanel-B0ar9_zf.js} +2 -2
- package/dist/{TemplateReviewPanel-JvZe9_4G.cjs → TemplateReviewPanel-Dn6X9UmY.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +3 -1
- package/dist/analytics.d.ts +3 -1
- package/dist/analytics.js +154 -60
- package/dist/artifact-integrity.json +135 -0
- package/dist/assets-B9ImAi6_.cjs +1 -0
- package/dist/assets-DEaz4qsp.js +124 -0
- package/dist/batch-BaP6pWDE.cjs +1 -0
- package/dist/batch-BfZHN1do.js +220 -0
- package/dist/batch-CGyt-b2W.js +273 -0
- package/dist/batch-CLpELXBl.cjs +1 -0
- package/dist/capabilities-CAh2Nrue.cjs +1 -0
- package/dist/capabilities-DskCHs3V.js +69 -0
- package/dist/codes.d.cts +2 -0
- package/dist/codes.d.ts +2 -0
- package/dist/{computed-Bvk0W15F.js → computed-C-4C2S5h.js} +3 -3
- package/dist/config-BVsJXSqS.js +842 -0
- package/dist/config-D10us76d.cjs +1 -0
- package/dist/data-explanation-B8MZRYVS.js +16 -0
- package/dist/data-explanation-DE55G30w.cjs +1 -0
- package/dist/designer-2bDlcNXQ.js +5136 -0
- package/dist/designer-BT7XCdbW.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +144 -16
- package/dist/designer.d.ts +144 -16
- package/dist/designer.js +1 -1
- package/dist/drill-ByJviLXS.js +145 -0
- package/dist/drill-DYTxuL3A.cjs +1 -0
- package/dist/{font-loader-vhCT8znW.cjs → font-loader-B_UkxpzC.cjs} +1 -1
- package/dist/{font-loader-DHto6Lra.js → font-loader-Q3bQjmrI.js} +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +82 -4
- package/dist/index.d.ts +82 -4
- package/dist/index.js +785 -820
- package/dist/json-snapshot-DFb2eWkf.js +1416 -0
- package/dist/json-snapshot-WWSGlaHG.cjs +2 -0
- package/dist/licenses/_bwip-js_generic-4.11.4.txt +24 -0
- package/dist/licenses/_fast-csv_format-4.3.5.txt +22 -0
- package/dist/licenses/_fast-csv_parse-4.3.6.txt +22 -0
- package/dist/licenses/_pdf-lib_fontkit-1.1.1.txt +326 -0
- package/dist/licenses/_pdf-lib_standard-fonts-1.0.0.txt +22 -0
- package/dist/licenses/_pdf-lib_upng-1.0.1.txt +22 -0
- package/dist/licenses/_types_node-14.18.63.txt +22 -0
- package/dist/licenses/_types_pako-2.0.3.txt +22 -0
- package/dist/licenses/_types_pegjs-0.10.6.txt +22 -0
- package/dist/licenses/archiver-5.3.2.txt +23 -0
- package/dist/licenses/archiver-utils-2.1.0.txt +23 -0
- package/dist/licenses/archiver-utils-3.0.4.txt +23 -0
- package/dist/licenses/async-3.2.6.txt +20 -0
- package/dist/licenses/balanced-match-1.0.2.txt +22 -0
- package/dist/licenses/base64-js-1.5.1.txt +22 -0
- package/dist/licenses/big-integer-1.6.52.txt +25 -0
- package/dist/licenses/binary-0.3.0.txt +178 -0
- package/dist/licenses/bl-4.1.0.txt +14 -0
- package/dist/licenses/bluebird-3.4.7.txt +22 -0
- package/dist/licenses/brace-expansion-1.1.21.txt +22 -0
- package/dist/licenses/brace-expansion-2.1.7.txt +22 -0
- package/dist/licenses/buffer-5.7.1.txt +22 -0
- package/dist/licenses/buffer-crc32-0.2.13.txt +20 -0
- package/dist/licenses/buffer-indexof-polyfill-1.0.2.txt +23 -0
- package/dist/licenses/buffers-0.1.1.txt +140 -0
- package/dist/licenses/chainsaw-0.1.0.txt +184 -0
- package/dist/licenses/compress-commons-4.1.2.txt +23 -0
- package/dist/licenses/concat-map-0.0.1.txt +19 -0
- package/dist/licenses/core-util-is-1.0.3.txt +20 -0
- package/dist/licenses/crc-32-1.2.2.txt +202 -0
- package/dist/licenses/crc32-stream-4.0.3.txt +23 -0
- package/dist/licenses/dayjs-1.11.23.txt +22 -0
- package/dist/licenses/duplexer2-0.1.4.txt +27 -0
- package/dist/licenses/end-of-stream-1.4.5.txt +22 -0
- package/dist/licenses/exceljs-4.4.0.txt +23 -0
- package/dist/licenses/fast-csv-4.3.6.txt +22 -0
- package/dist/licenses/fast-png-6.4.0.txt +22 -0
- package/dist/licenses/fs-constants-1.0.0.txt +22 -0
- package/dist/licenses/fs.realpath-1.0.0.txt +44 -0
- package/dist/licenses/fstream-1.0.12.txt +16 -0
- package/dist/licenses/glob-7.2.3.txt +22 -0
- package/dist/licenses/graceful-fs-4.2.11.txt +16 -0
- package/dist/licenses/ieee754-1.2.1.txt +12 -0
- package/dist/licenses/immediate-3.0.6.txt +21 -0
- package/dist/licenses/inflight-1.0.6.txt +16 -0
- package/dist/licenses/inherits-2.0.4.txt +17 -0
- package/dist/licenses/iobuffer-5.4.0.txt +23 -0
- package/dist/licenses/isarray-1.0.0.txt +61 -0
- package/dist/licenses/jszip-3.10.2.txt +652 -0
- package/dist/licenses/lazystream-1.0.1.txt +24 -0
- package/dist/licenses/lie-3.3.0.txt +8 -0
- package/dist/licenses/listenercount-1.0.1.txt +6 -0
- package/dist/licenses/lodash.defaults-4.2.0.txt +48 -0
- package/dist/licenses/lodash.difference-4.5.0.txt +48 -0
- package/dist/licenses/lodash.escaperegexp-4.1.2.txt +48 -0
- package/dist/licenses/lodash.flatten-4.4.0.txt +48 -0
- package/dist/licenses/lodash.groupby-4.6.0.txt +48 -0
- package/dist/licenses/lodash.isboolean-3.0.3.txt +23 -0
- package/dist/licenses/lodash.isequal-4.5.0.txt +48 -0
- package/dist/licenses/lodash.isfunction-3.0.9.txt +48 -0
- package/dist/licenses/lodash.isnil-4.0.0.txt +23 -0
- package/dist/licenses/lodash.isplainobject-4.0.6.txt +48 -0
- package/dist/licenses/lodash.isundefined-3.0.1.txt +23 -0
- package/dist/licenses/lodash.union-4.6.0.txt +48 -0
- package/dist/licenses/lodash.uniq-4.5.0.txt +48 -0
- package/dist/licenses/minimatch-3.1.5.txt +16 -0
- package/dist/licenses/minimatch-5.1.9.txt +16 -0
- package/dist/licenses/minimist-1.2.8.txt +19 -0
- package/dist/licenses/mkdirp-0.5.6.txt +22 -0
- package/dist/licenses/node-sql-parser-5.4.0.txt +202 -0
- package/dist/licenses/normalize-path-3.0.0.txt +22 -0
- package/dist/licenses/once-1.4.0.txt +16 -0
- package/dist/licenses/pako-1.0.11.txt +22 -0
- package/dist/licenses/pako-2.2.0.txt +22 -0
- package/dist/licenses/path-is-absolute-1.0.1.txt +22 -0
- package/dist/licenses/pdf-lib-1.17.1.txt +22 -0
- package/dist/licenses/process-nextick-args-2.0.1.txt +20 -0
- package/dist/licenses/readable-stream-2.3.8.txt +48 -0
- package/dist/licenses/readable-stream-3.6.2.txt +48 -0
- package/dist/licenses/readdir-glob-1.1.3.txt +202 -0
- package/dist/licenses/rimraf-2.7.1.txt +16 -0
- package/dist/licenses/safe-buffer-5.1.2.txt +22 -0
- package/dist/licenses/safe-buffer-5.2.1.txt +22 -0
- package/dist/licenses/saxes-5.0.1.txt +397 -0
- package/dist/licenses/setimmediate-1.0.5.txt +21 -0
- package/dist/licenses/string_decoder-1.1.1.txt +49 -0
- package/dist/licenses/string_decoder-1.3.0.txt +49 -0
- package/dist/licenses/tar-stream-2.2.0.txt +22 -0
- package/dist/licenses/tmp-0.2.7.txt +22 -0
- package/dist/licenses/traverse-0.3.9.txt +25 -0
- package/dist/licenses/tslib-1.14.1.txt +13 -0
- package/dist/licenses/unzipper-0.10.14.txt +26 -0
- package/dist/licenses/util-deprecate-1.0.2.txt +25 -0
- package/dist/licenses/uuid-11.1.1.txt +10 -0
- package/dist/licenses/wrappy-1.0.2.txt +16 -0
- package/dist/licenses/xmlchars-2.2.0.txt +19 -0
- package/dist/licenses/zip-stream-4.1.1.txt +23 -0
- package/dist/matrix-CGRGkn5s.js +112 -0
- package/dist/matrix-gEO7ZM_u.cjs +1 -0
- package/dist/media-B7vnpD8k.cjs +1 -0
- package/dist/media-Y90dHK9z.js +70 -0
- package/dist/param-validation-C3HlcLLO.cjs +1 -0
- package/dist/param-validation-Do7Eg8Zv.js +181 -0
- package/dist/{pdf-8UPQebOE.js → pdf-BwNyeGpt.js} +4385 -4321
- package/dist/{pdf-AyJGb22z.cjs → pdf-CvvrjPQg.cjs} +51 -49
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +18 -3
- package/dist/pdf.d.ts +18 -3
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BGKf-Tqg.js → plugin-Ca_XZG3l.js} +2 -2
- package/dist/{plugin-CktLH_Iy.cjs → plugin-DHO7X8z2.cjs} +1 -1
- package/dist/prepared-CFy9B75C.cjs +1 -0
- package/dist/prepared-ajM-H-9B.js +69 -0
- package/dist/progress-B0ctFpKf.cjs +1 -0
- package/dist/progress-D-OTpEav.js +52 -0
- package/dist/record-bindings-By_UKZ2g.cjs +1 -0
- package/dist/record-bindings-Do_b3h4V.js +196 -0
- package/dist/{region-binding-workflow-DEJbhpCv.js → region-binding-workflow-BMhK_TjP.js} +1 -1
- package/dist/{region-binding-workflow-BzfbxRiR.cjs → region-binding-workflow-DIYJdCUr.cjs} +1 -1
- package/dist/{report-params-B44imUd4.js → report-params-B1RzkhJj.js} +1 -1
- package/dist/{report-params-SJfhKgaX.cjs → report-params-WDGrA4oP.cjs} +1 -1
- package/dist/sbom.cdx.json +3982 -0
- package/dist/server/node.d.cts +20 -1
- package/dist/server/node.d.ts +20 -1
- package/dist/server-node.cjs +1 -1
- package/dist/server-node.js +247 -237
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +772 -4
- package/dist/server.d.ts +772 -4
- package/dist/server.js +885 -645
- package/dist/sha256-ArEYjaTI.cjs +1 -0
- package/dist/sha256-DPEuJ3nh.js +155 -0
- package/dist/style.css +1 -1
- package/dist/template-bindings-C2SpvsMU.js +58 -0
- package/dist/template-bindings-CEtWyiLX.cjs +1 -0
- package/dist/template-catalog-FJE_c9Qe.cjs +1 -0
- package/dist/template-catalog-j2B1MJlL.js +414 -0
- package/dist/{template-fragments-CLkGo6To.js → template-fragments-BGbQLGlV.js} +21 -21
- package/dist/{template-fragments-DFUpq5QM.cjs → template-fragments-DcKeiylI.cjs} +1 -1
- package/dist/{template-outline-B3xVkzSv.cjs → template-outline-BwRV_eRo.cjs} +1 -1
- package/dist/{template-outline-CFenM1PV.js → template-outline-cnWfT_LK.js} +3 -3
- package/dist/{template-registry-COXDEJEM.js → template-registry-BtaKPELV.js} +364 -201
- package/dist/template-registry-Co1zPq5e.cjs +1 -0
- package/dist/textwrap-CWHyzkBH.cjs +4 -0
- package/dist/textwrap-DE1kgcJB.js +110 -0
- package/dist/{tree-CqcQ99NM.js → tree-CjVZLRw7.js} +1 -1
- package/dist/vue/async.d.cts +123 -14
- package/dist/vue/async.d.ts +123 -14
- package/dist/vue/index.d.cts +158 -22
- package/dist/vue/index.d.ts +158 -22
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +80 -78
- package/dist/{workbook-session-DNa2RHNG.cjs → workbook-session-Bjv1YCRK.cjs} +18 -18
- package/dist/{workbook-session-BfK1yHOO.js → workbook-session-BvToI-Fd.js} +5440 -5288
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +20 -1
- package/dist/worker.d.ts +20 -1
- package/dist/worker.js +33 -32
- package/dist/xlsx-node.cjs +34 -34
- package/dist/xlsx-node.js +878 -870
- package/dist/xlsx.cjs +3 -4
- package/dist/xlsx.d.cts +22 -10
- package/dist/xlsx.d.ts +22 -10
- package/dist/xlsx.js +261 -253
- package/package.json +2 -2
- package/dist/ParamEditor-CflQV3eQ.js +0 -526
- package/dist/ParamEditor-vIDzvpPV.cjs +0 -1
- package/dist/ReportPreview-CvbqLUzM.cjs +0 -6
- package/dist/ReportPreview-D_ywJ_-H.js +0 -4533
- package/dist/assets-C2U-e-Sz.cjs +0 -4
- package/dist/assets-Q0wUwNrV.js +0 -217
- package/dist/batch-DzaTNLWI.js +0 -371
- package/dist/batch-xMkqYiTr.cjs +0 -1
- package/dist/capabilities-CK_7hizc.js +0 -63
- package/dist/capabilities-CsZ-pNHR.cjs +0 -1
- package/dist/config-0UIohTS7.cjs +0 -1
- package/dist/config-Dt9NtCPl.js +0 -566
- package/dist/data-explanation-BktvER5B.cjs +0 -1
- package/dist/data-explanation-C_J6jYNi.js +0 -16
- package/dist/designer-Ci1LizA9.js +0 -5020
- package/dist/designer-rtmVIIdN.cjs +0 -2
- package/dist/json-snapshot-BeFT3Tso.js +0 -1952
- package/dist/json-snapshot-D1NTP2oI.cjs +0 -2
- package/dist/matrix-DVyWiYsd.cjs +0 -1
- package/dist/matrix-yZsGnldA.js +0 -227
- package/dist/page-window-index-CIuT4BAv.js +0 -43
- package/dist/page-window-index-DEjnM6IB.cjs +0 -1
- package/dist/param-validation-BlHHXs6u.js +0 -153
- package/dist/param-validation-DCK039V1.cjs +0 -1
- package/dist/progress-7OSZbFok.js +0 -39
- package/dist/progress-BnLiS5eH.cjs +0 -1
- package/dist/task-events-DQ276fn2.cjs +0 -1
- package/dist/task-events-Dpsvf_t2.js +0 -47
- package/dist/template-bindings-BJR4k7qZ.cjs +0 -1
- package/dist/template-bindings-Daui7hLF.js +0 -252
- package/dist/template-registry-D3SjENi6.cjs +0 -1
- package/dist/validate-BJ5HIWY8.cjs +0 -1
- package/dist/validate-CkQBWCeg.js +0 -163
|
@@ -1,44 +1,203 @@
|
|
|
1
|
-
import { v as
|
|
2
|
-
import { v as
|
|
3
|
-
import { R as
|
|
4
|
-
import {
|
|
5
|
-
import { v as
|
|
6
|
-
import { v as
|
|
7
|
-
function
|
|
1
|
+
import { v as H } from "./matrix-CGRGkn5s.js";
|
|
2
|
+
import { v as W, c as G } from "./computed-C-4C2S5h.js";
|
|
3
|
+
import { R as U } from "./render-plan-Ck6koX9L.js";
|
|
4
|
+
import { c as B } from "./code-options-BKXXY7NI.js";
|
|
5
|
+
import { v as z, e as q } from "./param-validation-Do7Eg8Zv.js";
|
|
6
|
+
import { v as X, a as Y } from "./tree-CjVZLRw7.js";
|
|
7
|
+
function Q(e, i, t) {
|
|
8
|
+
e !== void 0 && (typeof e != "string" || !e.trim() || e.length > 4096) && t.push({ path: i, message: "来源范围应为不超过 4096 字符的非空字符串" });
|
|
9
|
+
}
|
|
10
|
+
function P(e, i, t) {
|
|
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
|
+
}
|
|
13
|
+
function Z(e, i, t) {
|
|
14
|
+
P(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: "派生结果标记应为布尔值" }), _(e.source, `${i}.source`, t, !0), e.formula !== void 0 && typeof e.formula != "string" && t.push({ path: `${i}.formula`, message: "单元格公式应为字符串" });
|
|
15
|
+
}
|
|
16
|
+
function _(e, i, t, s = !1) {
|
|
17
|
+
if (e === void 0) return;
|
|
18
|
+
if (!e || typeof e != "object" || Array.isArray(e)) {
|
|
19
|
+
t.push({ path: i, message: "业务来源应为对象" });
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const n = e;
|
|
23
|
+
Q(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
|
+
}
|
|
30
|
+
n.sourceToken !== void 0 && typeof n.sourceToken != "string" && t.push({ path: `${i}.sourceToken`, message: "来源令牌应为字符串" });
|
|
31
|
+
}
|
|
32
|
+
const ee = /* @__PURE__ */ new Set([
|
|
33
|
+
"text",
|
|
34
|
+
"image",
|
|
35
|
+
"barcode",
|
|
36
|
+
"qrcode",
|
|
37
|
+
"chart",
|
|
38
|
+
"line",
|
|
39
|
+
"rect",
|
|
40
|
+
"ellipse"
|
|
41
|
+
]);
|
|
42
|
+
function p(e) {
|
|
43
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
44
|
+
}
|
|
45
|
+
function te(e, i, t, s) {
|
|
46
|
+
const n = e[i];
|
|
47
|
+
(typeof n != "number" || !Number.isFinite(n)) && s.push({ path: `${t}.${i}`, message: `应为有限数字,实际 ${JSON.stringify(n)}` });
|
|
48
|
+
}
|
|
49
|
+
function ie(e, i, t) {
|
|
50
|
+
if (e !== void 0) {
|
|
51
|
+
const s = `${i}.table`;
|
|
52
|
+
if (!p(e)) t.push({ path: s, message: "逻辑表来源应为对象" });
|
|
53
|
+
else {
|
|
54
|
+
_(e.source, `${s}.source`, t), (typeof e.id != "string" || !e.id.trim()) && t.push({ path: `${s}.id`, message: "逻辑表 ID 应为非空字符串" });
|
|
55
|
+
const n = e.role;
|
|
56
|
+
["header", "body", "group-header", "subtotal", "grand-total"].includes(n) || t.push({ path: `${s}.role`, message: "未知逻辑表行角色" });
|
|
57
|
+
const a = e.rowIndex;
|
|
58
|
+
(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: "逻辑表名称应为字符串" });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function se(e, i, t, s) {
|
|
63
|
+
if (e !== void 0)
|
|
64
|
+
if (!p(e) || !Array.isArray(e.cells))
|
|
65
|
+
t.push({ path: `${i}.grid.cells`, message: "grid.cells 应为二维数组" });
|
|
66
|
+
else {
|
|
67
|
+
const n = e.paddingMm;
|
|
68
|
+
n !== void 0 && (typeof n != "number" || !Number.isFinite(n) || n < 0) && t.push({ path: `${i}.grid.paddingMm`, message: "单元格内距应为有限非负数" }), e.cells.forEach((a, o) => {
|
|
69
|
+
if (!Array.isArray(a)) {
|
|
70
|
+
t.push({ path: `${i}.grid.cells.${o}`, message: "行应为数组" });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
a.forEach((f, r) => {
|
|
74
|
+
if (f == null) return;
|
|
75
|
+
const d = `${i}.grid.cells.${o}.${r}`;
|
|
76
|
+
if (!p(f)) {
|
|
77
|
+
t.push({ path: d, message: "网格单元格应为对象或 null" });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
Z(f, d, t), Array.isArray(f.children) && f.children.forEach((h, g) => {
|
|
81
|
+
S(h, `${i}.grid.cells.${o}.${r}.children.${g}`, t, s);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function ne(e, i, t) {
|
|
88
|
+
e !== void 0 && (Array.isArray(e) ? e.forEach((s, n) => {
|
|
89
|
+
(!p(s) || !Array.isArray(s.segments)) && t.push({ path: `${i}.richParagraphs.${n}`, message: "段落缺少 segments 数组" });
|
|
90
|
+
}) : t.push({ path: `${i}.richParagraphs`, message: "richParagraphs 应为数组" }));
|
|
91
|
+
}
|
|
92
|
+
function S(e, i, t, s = []) {
|
|
93
|
+
if (!p(e)) {
|
|
94
|
+
t.push({ path: i, message: "组件应为对象" });
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const n = e.kind;
|
|
98
|
+
typeof n != "string" ? t.push({ path: `${i}.kind`, message: "组件缺少 kind 字符串" }) : ee.has(n) || s.push({
|
|
99
|
+
path: `${i}.kind`,
|
|
100
|
+
message: `未知组件类型 ${JSON.stringify(n)},将以兜底方式渲染`
|
|
101
|
+
});
|
|
102
|
+
for (const a of ["leftMm", "topMm", "widthMm", "heightMm"])
|
|
103
|
+
te(e, a, i, t);
|
|
104
|
+
typeof e.leftMm == "number" && e.leftMm < -100 && t.push({ path: `${i}.leftMm`, message: "几何数值异常(leftMm<-100)" });
|
|
105
|
+
for (const a of ["widthMm", "heightMm"])
|
|
106
|
+
typeof e[a] == "number" && e[a] < 0 && t.push({ path: `${i}.${a}`, message: "组件尺寸不能为负数" });
|
|
107
|
+
ie(e.table, i, t), ae(e.code, n, 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" }), se(e.grid, i, t, s), ne(e.richParagraphs, i, t);
|
|
108
|
+
}
|
|
109
|
+
function ae(e, i, t, s) {
|
|
110
|
+
if (e !== void 0)
|
|
111
|
+
for (const n of B(e, i)) s.push({ path: `${t}.code${n.path ? `.${n.path}` : ""}`, message: n.message });
|
|
112
|
+
}
|
|
113
|
+
function L(e, i, t) {
|
|
114
|
+
if (!p(e)) return;
|
|
115
|
+
e.binding !== void 0 && t.push({ path: `${i}.binding`, message: "渲染计划不允许未解析字段绑定" });
|
|
116
|
+
const s = e.grid;
|
|
117
|
+
!p(s) || !Array.isArray(s.cells) || s.cells.forEach((n, a) => {
|
|
118
|
+
Array.isArray(n) && n.forEach((o, f) => {
|
|
119
|
+
!p(o) || !Array.isArray(o.children) || o.children.forEach((r, d) => L(r, `${i}.grid.cells.${a}.${f}.children.${d}`, t));
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function oe(e, i, t, s = []) {
|
|
124
|
+
if (!p(e)) {
|
|
125
|
+
t.push({ path: i, message: "页应为对象" });
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const n = e.pageWidthMm, a = e.pageHeightMm;
|
|
129
|
+
(typeof n != "number" || !Number.isFinite(n) || n <= 0) && t.push({ path: `${i}.pageWidthMm`, message: `页宽非法: ${JSON.stringify(n)}` }), (typeof a != "number" || !(a > 0 && a < 5e3)) && t.push({ path: `${i}.pageHeightMm`, message: `页高非法: ${JSON.stringify(a)}` }), e.layout !== void 0 && e.layout !== "page" && e.layout !== "wide" && t.push({ path: `${i}.layout`, message: "布局应为 page 或 wide" });
|
|
130
|
+
const o = e.components;
|
|
131
|
+
Array.isArray(o) ? Array.isArray(o) && o.forEach((f, r) => {
|
|
132
|
+
S(f, `${i}.components.${r}`, t, s), L(f, `${i}.components.${r}`, t);
|
|
133
|
+
}) : t.push({ path: `${i}.components`, message: "components 应为数组" });
|
|
134
|
+
}
|
|
135
|
+
function fe(e) {
|
|
136
|
+
const i = [], t = [], s = p(e) ? e.pages : void 0;
|
|
137
|
+
if (p(e) && e.requiresRecalculation !== void 0 && typeof e.requiresRecalculation != "boolean" && i.push({ path: "$.requiresRecalculation", message: "重算能力要求应为布尔值" }), !Array.isArray(s))
|
|
138
|
+
i.push({
|
|
139
|
+
path: "$.pages",
|
|
140
|
+
message: e == null ? "渲染计划为空" : "渲染计划缺少 pages 数组"
|
|
141
|
+
});
|
|
142
|
+
else {
|
|
143
|
+
s.forEach((a, o) => oe(a, `$.pages.${o}`, i, t)), s.length > 2e3 && t.push({
|
|
144
|
+
path: "$.pages",
|
|
145
|
+
message: `页数异常大(${s.length} 页),渲染与打印耗时可能显著增加`
|
|
146
|
+
});
|
|
147
|
+
const n = s.reduce(
|
|
148
|
+
(a, o) => a + (p(o) && Array.isArray(o.components) ? o.components.length : 0),
|
|
149
|
+
0
|
|
150
|
+
);
|
|
151
|
+
n > 5e4 && t.push({
|
|
152
|
+
path: "$.pages",
|
|
153
|
+
message: `组件总数异常大(${n} 个),可能触发浏览器性能限制`
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return { ok: i.length === 0, errors: i, warnings: t };
|
|
157
|
+
}
|
|
158
|
+
function He(e) {
|
|
159
|
+
const i = fe(e);
|
|
160
|
+
if (!i.ok) {
|
|
161
|
+
const t = i.errors.slice(0, 3).map((s) => `${s.path}: ${s.message}`).join("; ");
|
|
162
|
+
throw new Error(`渲染计划校验失败(${i.errors.length} 处): ${t}`);
|
|
163
|
+
}
|
|
164
|
+
return e.pages;
|
|
165
|
+
}
|
|
166
|
+
function R(e) {
|
|
8
167
|
return e.kind === "list" ? e.id : e.nid;
|
|
9
168
|
}
|
|
10
|
-
function
|
|
169
|
+
function re(e) {
|
|
11
170
|
return e.kind === "list" ? !1 : e.pageAnchor !== void 0 || e.kind === "text" && typeof e.text == "string" && /\{(?:page|totalPages)\}/.test(e.text);
|
|
12
171
|
}
|
|
13
|
-
function
|
|
14
|
-
const t = e.filter((n) => i.componentIds.includes(
|
|
172
|
+
function de(e, i) {
|
|
173
|
+
const t = e.filter((n) => i.componentIds.includes(R(n) ?? ""));
|
|
15
174
|
if (t.filter((n) => n.kind === "list" && n.cardinality !== "record").length && t.length !== 1) throw new Error("纵向重复区域必须独占流式分段,不能与静态或单记录区域并排");
|
|
16
175
|
for (const n of t) {
|
|
17
176
|
const a = n.kind === "list" ? n.topMm + (n.rowHeightMm ?? 0) : n.topMm + n.heightMm;
|
|
18
177
|
if (n.topMm < i.topMm - 1e-3 || a > i.topMm + i.heightMm + 1e-3) throw new Error("流式分段应完整包含其组件的原始纵向范围");
|
|
19
178
|
}
|
|
20
179
|
}
|
|
21
|
-
function
|
|
180
|
+
function We(e, i) {
|
|
22
181
|
if (!i) return e.map((s) => ({ components: [s] }));
|
|
23
|
-
const t = new Map(e.map((s) => [
|
|
182
|
+
const t = new Map(e.map((s) => [R(s), s]));
|
|
24
183
|
return i.bands.map((s) => ({ band: s, components: s.componentIds.map((n) => {
|
|
25
184
|
const a = t.get(n);
|
|
26
185
|
if (!a) throw new Error(`流式区域引用不存在的组件:${n}`);
|
|
27
186
|
return a;
|
|
28
187
|
}) }));
|
|
29
188
|
}
|
|
30
|
-
function
|
|
189
|
+
function he(e, i) {
|
|
31
190
|
if (!i || !Array.isArray(i.bands) || !i.bands.length || i.bands.length > 1e4) throw new Error("流式排版应包含 1–10000 个区域");
|
|
32
191
|
const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
33
192
|
for (const n of e) {
|
|
34
|
-
if (
|
|
35
|
-
const a =
|
|
193
|
+
if (re(n)) continue;
|
|
194
|
+
const a = R(n);
|
|
36
195
|
if (!a || t.has(a)) throw new Error("流式排版组件应具有唯一标识");
|
|
37
196
|
t.add(a);
|
|
38
197
|
}
|
|
39
|
-
if (
|
|
198
|
+
if (ue(e, i, t, s), s.size !== t.size) throw new Error("流式排版必须显式包含每个非锚点组件");
|
|
40
199
|
}
|
|
41
|
-
function
|
|
200
|
+
function ue(e, i, t, s) {
|
|
42
201
|
let n = -1 / 0;
|
|
43
202
|
for (const a of i.bands) {
|
|
44
203
|
if (!Number.isFinite(a.topMm) || !Number.isFinite(a.heightMm) || a.topMm < 0 || a.heightMm <= 0 || a.topMm < n - 1e-3) throw new Error("流式区域应按原始位置排序,尺寸有效且不重叠");
|
|
@@ -47,78 +206,78 @@ function q(e, i, t, s) {
|
|
|
47
206
|
if (!t.has(o) || s.has(o)) throw new Error(`流式区域组件缺失、重复或包含页锚点:${o}`);
|
|
48
207
|
s.add(o);
|
|
49
208
|
}
|
|
50
|
-
|
|
209
|
+
de(e, a), n = a.topMm + a.heightMm;
|
|
51
210
|
}
|
|
52
211
|
}
|
|
53
|
-
const
|
|
54
|
-
function
|
|
212
|
+
const me = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
213
|
+
function l(e) {
|
|
55
214
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
56
215
|
}
|
|
57
|
-
function
|
|
58
|
-
return typeof e == "string" && !!e.trim() && !
|
|
216
|
+
function v(e) {
|
|
217
|
+
return typeof e == "string" && !!e.trim() && !me.has(e);
|
|
59
218
|
}
|
|
60
219
|
function E(e, i, t, s) {
|
|
61
220
|
for (const n of Object.keys(e)) i.includes(n) || s.push({ path: `${t}.${n}`, message: "存在未知配置字段" });
|
|
62
221
|
}
|
|
63
|
-
function
|
|
222
|
+
function ce(e, i, t) {
|
|
64
223
|
if (e !== void 0) {
|
|
65
|
-
if (!
|
|
224
|
+
if (!l(e) || !["number", "percent", "date"].includes(String(e.kind))) {
|
|
66
225
|
t.push({ path: i, message: "绑定格式应为 number、percent 或 date" });
|
|
67
226
|
return;
|
|
68
227
|
}
|
|
69
228
|
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
229
|
}
|
|
71
230
|
}
|
|
72
|
-
function
|
|
231
|
+
function ge(e, i, t) {
|
|
73
232
|
const s = e.binding;
|
|
74
233
|
if (s === void 0) return;
|
|
75
234
|
const n = `${i}.binding`;
|
|
76
|
-
if (!
|
|
235
|
+
if (!l(s)) {
|
|
77
236
|
t.push({ path: n, message: "字段绑定应为对象" });
|
|
78
237
|
return;
|
|
79
238
|
}
|
|
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),
|
|
239
|
+
(!["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), v(s.field) || t.push({ path: `${n}.field`, message: "绑定字段应为安全的非空字段名(按字面读取自有字段)" });
|
|
81
240
|
for (const a of ["prefix", "suffix", "emptyText"]) s[a] !== void 0 && typeof s[a] != "string" && t.push({ path: `${n}.${a}`, message: "应为字符串" });
|
|
82
|
-
|
|
241
|
+
ce(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
242
|
}
|
|
84
|
-
function
|
|
85
|
-
if (!
|
|
243
|
+
function pe(e, i) {
|
|
244
|
+
if (!l(e)) {
|
|
86
245
|
i.push({ path: "$.repeat", message: "逐记录配置应为对象" });
|
|
87
246
|
return;
|
|
88
247
|
}
|
|
89
|
-
E(e, ["dataset", "rowKey", "copies"], "$.repeat", i),
|
|
248
|
+
E(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: "业务主键应为安全的非空字段名" });
|
|
90
249
|
const t = e.copies;
|
|
91
|
-
t !== void 0 && (
|
|
250
|
+
t !== void 0 && (l(t) ? (E(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 整数" }));
|
|
92
251
|
}
|
|
93
|
-
function
|
|
94
|
-
if (!
|
|
95
|
-
|
|
252
|
+
function C(e, i, t, s) {
|
|
253
|
+
if (!l(e)) return;
|
|
254
|
+
ge(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
255
|
const n = e.grid;
|
|
97
|
-
|
|
256
|
+
l(n) && Array.isArray(n.cells) && n.cells.forEach((a, o) => {
|
|
98
257
|
Array.isArray(a) && a.forEach((f, r) => {
|
|
99
|
-
|
|
258
|
+
l(f) && Array.isArray(f.children) && f.children.forEach((d, h) => C(d, `${i}.grid.cells.${o}.${r}.children.${h}`, t, s));
|
|
100
259
|
});
|
|
101
260
|
});
|
|
102
261
|
}
|
|
103
|
-
function
|
|
262
|
+
function ye(e, i) {
|
|
104
263
|
const t = e.repeat !== void 0;
|
|
105
|
-
t &&
|
|
106
|
-
if (!
|
|
264
|
+
t && pe(e.repeat, i), Array.isArray(e.pages) && e.pages.forEach((s, n) => {
|
|
265
|
+
if (!l(s)) return;
|
|
107
266
|
const a = `$.pages.${n}`;
|
|
108
267
|
t && (s.layout === "wide" || s.flow !== void 0) && i.push({ path: a, message: "逐记录标签仅支持固定尺寸页面,不支持宽表或流式分区" }), Array.isArray(s.components) && s.components.forEach((o, f) => {
|
|
109
268
|
const r = `${a}.components.${f}`;
|
|
110
|
-
if (
|
|
111
|
-
const { leftMm:
|
|
112
|
-
[
|
|
269
|
+
if (C(o, r, t, i), !t || !l(o)) return;
|
|
270
|
+
const { leftMm: d, topMm: h, widthMm: g, heightMm: y } = o;
|
|
271
|
+
[d, h, g, y, s.widthMm, s.heightMm].every((A) => typeof A == "number" && Number.isFinite(A)) && (Number(d) < 0 || Number(h) < 0 || Number(d) + Number(g) > Number(s.widthMm) + 1e-3 || Number(h) + Number(y) > Number(s.heightMm) + 1e-3) && i.push({ path: r, message: "标签组件超出纸张边界,请调整位置或尺寸" });
|
|
113
272
|
});
|
|
114
273
|
});
|
|
115
274
|
}
|
|
116
|
-
function
|
|
275
|
+
function j(e) {
|
|
117
276
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
118
277
|
}
|
|
119
|
-
function
|
|
278
|
+
function O(e, i, t) {
|
|
120
279
|
if (e !== void 0) {
|
|
121
|
-
if (!
|
|
280
|
+
if (!j(e)) {
|
|
122
281
|
t.push({ path: i, message: "条件应为对象" });
|
|
123
282
|
return;
|
|
124
283
|
}
|
|
@@ -128,7 +287,7 @@ function v(e, i, t) {
|
|
|
128
287
|
});
|
|
129
288
|
}
|
|
130
289
|
}
|
|
131
|
-
function
|
|
290
|
+
function J(e, i, t) {
|
|
132
291
|
if (e === void 0) return;
|
|
133
292
|
if (!Array.isArray(e) || e.length > 2048) {
|
|
134
293
|
t.push({ path: i, message: "聚合应为数组且最多 2048 项" });
|
|
@@ -137,7 +296,7 @@ function I(e, i, t) {
|
|
|
137
296
|
const s = /* @__PURE__ */ new Set();
|
|
138
297
|
e.forEach((n, a) => {
|
|
139
298
|
const o = `${i}.${a}`;
|
|
140
|
-
if (!
|
|
299
|
+
if (!j(n)) {
|
|
141
300
|
t.push({ path: o, message: "聚合应为对象" });
|
|
142
301
|
return;
|
|
143
302
|
}
|
|
@@ -153,7 +312,7 @@ function I(e, i, t) {
|
|
|
153
312
|
message: "小数位应为 0–100 的整数"
|
|
154
313
|
});
|
|
155
314
|
try {
|
|
156
|
-
|
|
315
|
+
G({
|
|
157
316
|
...n,
|
|
158
317
|
field: n.valueField ?? f
|
|
159
318
|
});
|
|
@@ -165,15 +324,15 @@ function I(e, i, t) {
|
|
|
165
324
|
}
|
|
166
325
|
});
|
|
167
326
|
}
|
|
168
|
-
function
|
|
327
|
+
function le(e, i, t) {
|
|
169
328
|
if (e === void 0) return;
|
|
170
|
-
const s =
|
|
329
|
+
const s = W(e);
|
|
171
330
|
for (const n of s.errors) t.push({ path: i, message: n });
|
|
172
331
|
}
|
|
173
|
-
function
|
|
332
|
+
function $e(e, i, t) {
|
|
174
333
|
if (e !== void 0)
|
|
175
334
|
try {
|
|
176
|
-
|
|
335
|
+
H(e);
|
|
177
336
|
} catch (s) {
|
|
178
337
|
t.push({
|
|
179
338
|
path: i,
|
|
@@ -181,31 +340,31 @@ function ne(e, i, t) {
|
|
|
181
340
|
});
|
|
182
341
|
}
|
|
183
342
|
}
|
|
184
|
-
function
|
|
343
|
+
function be(e, i, t) {
|
|
185
344
|
if (e.tree === void 0) return;
|
|
186
345
|
const s = `${i}.tree`;
|
|
187
346
|
try {
|
|
188
|
-
|
|
347
|
+
X(e.tree);
|
|
189
348
|
const n = e.tree;
|
|
190
349
|
if (e.matrix || e.detail || e.groupBy || Array.isArray(e.groups) && e.groups.length || e.rowVisibleWhen) throw new Error("树形布局不能同时配置普通分组、矩阵、主从或行可见条件");
|
|
191
350
|
if (e.rowKey !== void 0 && e.rowKey !== n.idField) throw new Error("树形 rowKey 应与 idField 一致");
|
|
192
351
|
if (!Array.isArray(e.columns) || !e.columns.some((a) => a && a.field === n.labelField && !a.hidden)) throw new Error("树形布局需要可见的标签列");
|
|
193
|
-
Array.isArray(e.computed) &&
|
|
352
|
+
Array.isArray(e.computed) && Y(n, e.computed);
|
|
194
353
|
} catch (n) {
|
|
195
354
|
t.push({ path: s, message: n instanceof Error ? n.message : String(n) });
|
|
196
355
|
}
|
|
197
356
|
}
|
|
198
|
-
const
|
|
199
|
-
class
|
|
357
|
+
const D = "1.0";
|
|
358
|
+
class w extends Error {
|
|
200
359
|
constructor(i) {
|
|
201
360
|
super(`模板校验失败:${i.slice(0, 3).map((t) => `${t.path}: ${t.message}`).join("; ")}`), this.errors = i, this.name = "ReportTemplateError";
|
|
202
361
|
}
|
|
203
362
|
}
|
|
204
|
-
const
|
|
205
|
-
function
|
|
363
|
+
const Ae = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]), we = /* @__PURE__ */ new Set(["schemaVersion", "id", "name", "revision", "description", "template"]), Me = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]), N = 2e5, ve = 64, F = 1e7;
|
|
364
|
+
function u(e) {
|
|
206
365
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
207
366
|
}
|
|
208
|
-
function
|
|
367
|
+
function Ne(e, i, t) {
|
|
209
368
|
const s = Object.getPrototypeOf(e), n = Array.isArray(e);
|
|
210
369
|
if (n ? s !== Array.prototype : s !== Object.prototype && s !== null)
|
|
211
370
|
return t.push({ path: i, message: "模板对象必须使用普通 JSON 对象原型" }), !1;
|
|
@@ -216,30 +375,30 @@ function me(e, i, t) {
|
|
|
216
375
|
}
|
|
217
376
|
return Object.getOwnPropertySymbols(e).length > 0 ? (t.push({ path: i, message: "模板不能包含 Symbol 键" }), !1) : !0;
|
|
218
377
|
}
|
|
219
|
-
function
|
|
220
|
-
return
|
|
378
|
+
function Ee(e, i, t, s) {
|
|
379
|
+
return Ae.has(e) ? (s.push({ path: t, message: "模板不能包含可能污染原型的键" }), !1) : i.get || i.set || !i.enumerable ? (s.push({ path: t, message: "模板不能包含访问器或不可枚举字段" }), !1) : !0;
|
|
221
380
|
}
|
|
222
|
-
function
|
|
381
|
+
function ke(e) {
|
|
223
382
|
return e === null || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e);
|
|
224
383
|
}
|
|
225
|
-
function
|
|
384
|
+
function T(e, i) {
|
|
226
385
|
const t = /* @__PURE__ */ new Set();
|
|
227
386
|
let s = 0, n = 0, a = !1;
|
|
228
|
-
const o = (f, r,
|
|
387
|
+
const o = (f, r, d) => {
|
|
229
388
|
if (!a) {
|
|
230
389
|
if (++s > N) {
|
|
231
390
|
s === N + 1 && i.push({ path: r, message: "模板超过 JSON 节点安全上限" });
|
|
232
391
|
return;
|
|
233
392
|
}
|
|
234
|
-
if (
|
|
393
|
+
if (d > ve) {
|
|
235
394
|
i.push({ path: r, message: "模板嵌套层级过深" });
|
|
236
395
|
return;
|
|
237
396
|
}
|
|
238
397
|
if (typeof f == "string") {
|
|
239
|
-
n += f.length, n >
|
|
398
|
+
n += f.length, n > F && (a = !0, i.push({ path: r, message: "模板文本超过 1000 万字符的安全上限" }));
|
|
240
399
|
return;
|
|
241
400
|
}
|
|
242
|
-
if (!
|
|
401
|
+
if (!ke(f)) {
|
|
243
402
|
if (!f || typeof f != "object") {
|
|
244
403
|
i.push({ path: r, message: "模板只允许 JSON 值,不允许函数、undefined 或非有限数字" });
|
|
245
404
|
return;
|
|
@@ -248,12 +407,12 @@ function R(e, i) {
|
|
|
248
407
|
i.push({ path: r, message: "模板不能包含循环引用" });
|
|
249
408
|
return;
|
|
250
409
|
}
|
|
251
|
-
if (
|
|
410
|
+
if (Ne(f, r, i)) {
|
|
252
411
|
t.add(f);
|
|
253
|
-
for (const [
|
|
254
|
-
if (Array.isArray(f) &&
|
|
255
|
-
const
|
|
256
|
-
if (
|
|
412
|
+
for (const [h, g] of Object.entries(Object.getOwnPropertyDescriptors(f))) {
|
|
413
|
+
if (Array.isArray(f) && h === "length") continue;
|
|
414
|
+
const y = `${r}.${h}`;
|
|
415
|
+
if (Ee(h, g, y, i) && o(g.value, y, d + 1), s > N || a) break;
|
|
257
416
|
}
|
|
258
417
|
t.delete(f);
|
|
259
418
|
}
|
|
@@ -262,7 +421,7 @@ function R(e, i) {
|
|
|
262
421
|
};
|
|
263
422
|
o(e, "$", 0);
|
|
264
423
|
}
|
|
265
|
-
function
|
|
424
|
+
function m(e, i, t, s, n = !1) {
|
|
266
425
|
const a = e[i];
|
|
267
426
|
a === void 0 && !n || (typeof a != "string" || n && !a.trim()) && s.push({ path: `${t}.${i}`, message: n ? "应为非空字符串" : "应为字符串" });
|
|
268
427
|
}
|
|
@@ -270,27 +429,27 @@ function c(e, i, t, s, n = 0, a = !1) {
|
|
|
270
429
|
const o = e[i];
|
|
271
430
|
o === void 0 && !a || (typeof o != "number" || !Number.isFinite(o) || o < n) && s.push({ path: `${t}.${i}`, message: `应为大于等于 ${n} 的有限数字` });
|
|
272
431
|
}
|
|
273
|
-
function
|
|
432
|
+
function b(e, i, t, s) {
|
|
274
433
|
e[i] !== void 0 && typeof e[i] != "boolean" && s.push({ path: `${t}.${i}`, message: "应为布尔值" });
|
|
275
434
|
}
|
|
276
|
-
function
|
|
277
|
-
e !== void 0 && !
|
|
435
|
+
function M(e, i, t, s = !1) {
|
|
436
|
+
e !== void 0 && !Me.has(e) && !(s && e === "auto") && t.push({ path: i, message: `未知对齐方式${s ? "(支持 auto)" : ""}` });
|
|
278
437
|
}
|
|
279
|
-
function
|
|
438
|
+
function $(e, i, t) {
|
|
280
439
|
if (e !== void 0) {
|
|
281
|
-
if (!
|
|
440
|
+
if (!u(e)) {
|
|
282
441
|
t.push({ path: i, message: "样式应为对象" });
|
|
283
442
|
return;
|
|
284
443
|
}
|
|
285
|
-
|
|
444
|
+
M(e.align, `${i}.align`, t), e.verticalAlign !== void 0 && !["top", "middle", "bottom"].includes(e.verticalAlign) && t.push({ path: `${i}.verticalAlign`, message: "未知垂直对齐方式" });
|
|
286
445
|
for (const s of ["fontSize", "fontSizePx", "lineWidthPt", "lineHeight"]) c(e, s, i, t);
|
|
287
446
|
for (const s of ["letterSpacing", "rotateDeg"]) c(e, s, i, t, -1 / 0);
|
|
288
447
|
c(e, "opacity", i, t), typeof e.opacity == "number" && e.opacity > 1 && t.push({ path: `${i}.opacity`, message: "透明度不能大于 1" });
|
|
289
|
-
for (const s of ["bold", "italic", "underline", "borderTop", "borderRight", "borderBottom", "borderLeft"])
|
|
290
|
-
for (const s of ["fontFamily", "color", "backgroundColor", "lineColor", "borderColor"])
|
|
448
|
+
for (const s of ["bold", "italic", "underline", "borderTop", "borderRight", "borderBottom", "borderLeft"]) b(e, s, i, t);
|
|
449
|
+
for (const s of ["fontFamily", "color", "backgroundColor", "lineColor", "borderColor"]) m(e, s, i, t);
|
|
291
450
|
}
|
|
292
451
|
}
|
|
293
|
-
function
|
|
452
|
+
function Se(e, i, t) {
|
|
294
453
|
if (e === void 0) return;
|
|
295
454
|
if (!Array.isArray(e)) {
|
|
296
455
|
t.push({ path: i, message: "参数定义应为数组" });
|
|
@@ -299,149 +458,149 @@ function ce(e, i, t) {
|
|
|
299
458
|
const s = /* @__PURE__ */ new Set(), n = t.length;
|
|
300
459
|
e.forEach((a, o) => {
|
|
301
460
|
const f = `${i}.${o}`;
|
|
302
|
-
if (!
|
|
461
|
+
if (!u(a)) {
|
|
303
462
|
t.push({ path: f, message: "参数定义应为对象" });
|
|
304
463
|
return;
|
|
305
464
|
}
|
|
306
|
-
|
|
307
|
-
for (const r of ["label", "defaultValue", "placeholder"])
|
|
308
|
-
|
|
465
|
+
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"].includes(a.type) && t.push({ path: `${f}.type`, message: "未知参数类型" });
|
|
466
|
+
for (const r of ["label", "defaultValue", "placeholder"]) m(a, r, f, t);
|
|
467
|
+
b(a, "required", f, t);
|
|
309
468
|
for (const r of ["minLength", "maxLength"]) {
|
|
310
|
-
const
|
|
311
|
-
|
|
469
|
+
const d = a[r];
|
|
470
|
+
d !== void 0 && (typeof d != "number" || !Number.isSafeInteger(d) || d < 0) && t.push({ path: `${f}.${r}`, message: "长度边界应为非负整数" });
|
|
312
471
|
}
|
|
313
|
-
|
|
314
|
-
const
|
|
315
|
-
if (!
|
|
472
|
+
xe(a, f, t), a.options !== void 0 && (Array.isArray(a.options) ? a.options.forEach((r, d) => {
|
|
473
|
+
const h = `${f}.options.${d}`;
|
|
474
|
+
if (!u(r)) t.push({ path: h, message: "选项应为对象" });
|
|
316
475
|
else
|
|
317
|
-
for (const g of ["label", "value"]) typeof r[g] != "string" && t.push({ path: `${
|
|
476
|
+
for (const g of ["label", "value"]) typeof r[g] != "string" && t.push({ path: `${h}.${g}`, message: "选项标签与值应为字符串(允许空白选项)" });
|
|
318
477
|
}) : t.push({ path: `${f}.options`, message: "选项应为数组" }));
|
|
319
|
-
}), t.length === n && t.push(...
|
|
478
|
+
}), t.length === n && t.push(...z(e).map((a) => ({ path: a.path.replace("$.paramDefs", i), message: a.message })));
|
|
320
479
|
}
|
|
321
|
-
function
|
|
480
|
+
function xe(e, i, t) {
|
|
322
481
|
for (const a of ["min", "max"]) {
|
|
323
482
|
const o = e[a];
|
|
324
483
|
if (o === void 0) continue;
|
|
325
|
-
|
|
484
|
+
q(e.type, o) || e.type === "number" && typeof o == "number" && Number.isFinite(o) || t.push({ path: `${i}.${a}`, message: "数字使用有限数字边界,日期/月/年使用对应规范字符串边界" });
|
|
326
485
|
}
|
|
327
486
|
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;
|
|
328
487
|
(s || n) && t.push({ path: i, message: "最小边界不能大于最大边界" }), typeof e.minLength == "number" && typeof e.maxLength == "number" && e.minLength > e.maxLength && t.push({ path: i, message: "最小长度不能大于最大长度" });
|
|
329
488
|
}
|
|
330
|
-
function
|
|
489
|
+
function K(e, i, t) {
|
|
331
490
|
if (!Array.isArray(e) || e.length === 0) {
|
|
332
491
|
t.push({ path: i, message: "列表至少需要一列" });
|
|
333
492
|
return;
|
|
334
493
|
}
|
|
335
|
-
e.every((s) =>
|
|
494
|
+
e.every((s) => u(s) && s.hidden === !0) && t.push({ path: i, message: "列表至少需要一列可见列" }), e.forEach((s, n) => {
|
|
336
495
|
const a = `${i}.${n}`;
|
|
337
|
-
if (!
|
|
496
|
+
if (!u(s)) {
|
|
338
497
|
t.push({ path: a, message: "列应为对象" });
|
|
339
498
|
return;
|
|
340
499
|
}
|
|
341
|
-
if (
|
|
342
|
-
if (!
|
|
500
|
+
if (P(s, a, t), b(s, "hidden", a, t), O(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)
|
|
501
|
+
if (!u(s.format) || !["number", "percent", "date"].includes(s.format.kind))
|
|
343
502
|
t.push({ path: `${a}.format`, message: "未知列格式" });
|
|
344
503
|
else {
|
|
345
504
|
const o = s.format.digits;
|
|
346
|
-
o !== void 0 && (typeof o != "number" || !Number.isInteger(o) || o < 0 || o > 100) && t.push({ path: `${a}.format.digits`, message: "小数位应为 0–100 的整数" }),
|
|
505
|
+
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);
|
|
347
506
|
}
|
|
348
507
|
s.rules !== void 0 && (Array.isArray(s.rules) ? s.rules.forEach((o, f) => {
|
|
349
508
|
const r = `${a}.rules.${f}`;
|
|
350
|
-
if (!
|
|
509
|
+
if (!u(o) || !u(o.when)) {
|
|
351
510
|
t.push({ path: r, message: "条件格式缺少 when 对象" });
|
|
352
511
|
return;
|
|
353
512
|
}
|
|
354
|
-
|
|
513
|
+
O(o.when, `${r}.when`, t), m(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: "条件值应为数字或字符串" }), $(o.style, `${r}.style`, t);
|
|
355
514
|
}) : t.push({ path: `${a}.rules`, message: "条件格式应为数组" }));
|
|
356
515
|
});
|
|
357
516
|
}
|
|
358
517
|
function V(e, i, t) {
|
|
359
518
|
if (e !== void 0) {
|
|
360
|
-
if (!
|
|
519
|
+
if (!u(e)) {
|
|
361
520
|
t.push({ path: i, message: "分组应为对象" });
|
|
362
521
|
return;
|
|
363
522
|
}
|
|
364
|
-
|
|
365
|
-
for (const s of ["headerTemplate", "subtotalLabel"])
|
|
366
|
-
for (const s of ["headerStyle", "subtotalStyle"])
|
|
367
|
-
|
|
523
|
+
m(e, "field", i, t, !0);
|
|
524
|
+
for (const s of ["headerTemplate", "subtotalLabel"]) m(e, s, i, t);
|
|
525
|
+
for (const s of ["headerStyle", "subtotalStyle"]) $(e[s], `${i}.${s}`, t);
|
|
526
|
+
b(e, "keepWithNext", i, t), b(e, "repeatHeader", i, t), J(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: "小计字段应为字符串数组" });
|
|
368
527
|
}
|
|
369
528
|
}
|
|
370
|
-
function
|
|
529
|
+
function Oe(e, i, t) {
|
|
371
530
|
if (!(e === void 0 || typeof e == "boolean")) {
|
|
372
|
-
if (!
|
|
531
|
+
if (!u(e)) {
|
|
373
532
|
t.push({ path: i, message: "合计应为布尔值或对象" });
|
|
374
533
|
return;
|
|
375
534
|
}
|
|
376
|
-
|
|
535
|
+
m(e, "label", i, t), J(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: "合计字段应为字符串数组" });
|
|
377
536
|
}
|
|
378
537
|
}
|
|
379
|
-
function
|
|
538
|
+
function Re(e, i, t, s) {
|
|
380
539
|
const n = { kind: "rect", leftMm: 0, topMm: 0, widthMm: 1, heightMm: 1, grid: e };
|
|
381
|
-
if (
|
|
540
|
+
if (S(n, t, s, []), I(n, t, s), !u(e) || !Array.isArray(e.cells)) return;
|
|
382
541
|
const a = e.cells, o = Array.isArray(i) ? i.length : 0;
|
|
383
542
|
if (a.length * o > N) {
|
|
384
543
|
s.push({ path: t, message: "表头逻辑网格超过 20 万格安全上限" });
|
|
385
544
|
return;
|
|
386
545
|
}
|
|
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: "表头行高数量应与行数一致" }),
|
|
546
|
+
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: "表头行高数量应与行数一致" }), Fe(a, o, t, s);
|
|
388
547
|
}
|
|
389
|
-
function
|
|
548
|
+
function Fe(e, i, t, s) {
|
|
390
549
|
const n = /* @__PURE__ */ new Set();
|
|
391
550
|
e.forEach((a, o) => {
|
|
392
551
|
if (!Array.isArray(a)) return;
|
|
393
552
|
let f = 0;
|
|
394
|
-
a.forEach((r,
|
|
553
|
+
a.forEach((r, d) => {
|
|
395
554
|
for (; n.has(`${o}:${f}`); ) f++;
|
|
396
|
-
const
|
|
397
|
-
(f +
|
|
398
|
-
for (let
|
|
399
|
-
for (let
|
|
400
|
-
n.has(`${
|
|
401
|
-
f +=
|
|
555
|
+
const h = u(r) && typeof r.colSpan == "number" ? r.colSpan : 1, g = u(r) && typeof r.rowSpan == "number" ? r.rowSpan : 1;
|
|
556
|
+
(f + h > i || o + g > e.length) && s.push({ path: `${t}.cells.${o}.${d}`, message: "表头合并区域超出表头边界" });
|
|
557
|
+
for (let y = o; y < Math.min(e.length, o + g); y++)
|
|
558
|
+
for (let A = f; A < Math.min(i, f + h); A++)
|
|
559
|
+
n.has(`${y}:${A}`) && s.push({ path: `${t}.cells.${o}.${d}`, message: "表头合并区域重叠" }), n.add(`${y}:${A}`);
|
|
560
|
+
f += h;
|
|
402
561
|
});
|
|
403
562
|
});
|
|
404
563
|
}
|
|
405
|
-
function
|
|
406
|
-
if (
|
|
564
|
+
function Te(e, i, t) {
|
|
565
|
+
if (be(e, i, t), le(e.computed, `${i}.computed`, t), $e(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 汇总,不能同时配置普通分组、总计或主从明细" }), O(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;
|
|
407
566
|
const s = e.detail, n = `${i}.detail`;
|
|
408
|
-
if (!
|
|
567
|
+
if (!u(s)) {
|
|
409
568
|
t.push({ path: n, message: "主从关联应为对象" });
|
|
410
569
|
return;
|
|
411
570
|
}
|
|
412
|
-
for (const a of ["dataset", "parentKey", "foreignKey"])
|
|
413
|
-
for (const a of ["rowKey", "revisionField", "sourceTokenField"])
|
|
414
|
-
|
|
571
|
+
for (const a of ["dataset", "parentKey", "foreignKey"]) m(s, a, n, t, !0);
|
|
572
|
+
for (const a of ["rowKey", "revisionField", "sourceTokenField"]) m(s, a, n, t, s[a] !== void 0);
|
|
573
|
+
m(s, "label", n, t), b(s, "header", n, t), c(s, "rowHeightMm", n, t, Number.MIN_VALUE), K(s.columns, `${n}.columns`, t), s.unmatched !== void 0 && s.unmatched !== "error" && s.unmatched !== "ignore" && t.push({ path: `${n}.unmatched`, message: "未关联明细策略应为 error 或 ignore" });
|
|
415
574
|
}
|
|
416
|
-
function
|
|
575
|
+
function Ie(e, i, t) {
|
|
417
576
|
for (const s of ["leftMm", "topMm"]) c(e, s, i, t, -1 / 0, !0);
|
|
418
|
-
c(e, "widthMm", i, t, Number.MIN_VALUE, !0),
|
|
419
|
-
for (const s of ["rowKey", "revisionField", "sourceTokenField"])
|
|
420
|
-
e.headerGrid !== void 0 &&
|
|
577
|
+
c(e, "widthMm", i, t, Number.MIN_VALUE, !0), m(e, "dataset", i, t, !0), m(e, "title", i, t);
|
|
578
|
+
for (const s of ["rowKey", "revisionField", "sourceTokenField"]) m(e, s, i, t, e[s] !== void 0);
|
|
579
|
+
e.headerGrid !== void 0 && Re(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" }), K(e.columns, `${i}.columns`, t);
|
|
421
580
|
for (const s of ["fontSizePt", "rowHeightMm"]) c(e, s, i, t, Number.MIN_VALUE);
|
|
422
581
|
c(e, "paddingMm", i, t);
|
|
423
|
-
for (const s of ["header", "headerBold", "headerEveryPage", "border"])
|
|
424
|
-
e.cardinality !== void 0 && e.cardinality !== "record" && t.push({ path: `${i}.cardinality`, message: "单记录区域类型应为 record" }),
|
|
582
|
+
for (const s of ["header", "headerBold", "headerEveryPage", "border"]) b(e, s, i, t);
|
|
583
|
+
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), Te(e, i, t), V(e.groupBy, `${i}.groupBy`, t), Oe(e.grandTotal, `${i}.grandTotal`, t);
|
|
425
584
|
}
|
|
426
|
-
function
|
|
427
|
-
|
|
428
|
-
for (const n of ["text", "rawText", "imageData", "fallbackText", "nid", "rkey"])
|
|
585
|
+
function I(e, i, t) {
|
|
586
|
+
$(e.style, `${i}.style`, t);
|
|
587
|
+
for (const n of ["text", "rawText", "imageData", "fallbackText", "nid", "rkey"]) m(e, n, i, t);
|
|
429
588
|
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) => {
|
|
430
|
-
if (!
|
|
589
|
+
if (!u(n)) return;
|
|
431
590
|
const o = `${i}.richParagraphs.${a}`;
|
|
432
|
-
|
|
591
|
+
M(n.align, `${o}.align`, t);
|
|
433
592
|
for (const f of ["lineHeight", "spaceBeforeMm", "spaceAfterMm", "indentMm"]) c(n, f, o, t);
|
|
434
593
|
Array.isArray(n.segments) && n.segments.forEach((f, r) => {
|
|
435
|
-
const
|
|
436
|
-
if (!
|
|
437
|
-
t.push({ path:
|
|
594
|
+
const d = `${o}.segments.${r}`;
|
|
595
|
+
if (!u(f)) {
|
|
596
|
+
t.push({ path: d, message: "富文本片段应为对象" });
|
|
438
597
|
return;
|
|
439
598
|
}
|
|
440
|
-
f.kind !== void 0 && f.kind !== "text" && f.kind !== "field" && t.push({ path: `${
|
|
441
|
-
for (const
|
|
442
|
-
|
|
599
|
+
f.kind !== void 0 && f.kind !== "text" && f.kind !== "field" && t.push({ path: `${d}.kind`, message: "未知富文本片段类型" });
|
|
600
|
+
for (const h of ["text", "field"]) m(f, h, d, t);
|
|
601
|
+
$(f.style, `${d}.style`, t);
|
|
443
602
|
});
|
|
444
|
-
}), !
|
|
603
|
+
}), !u(e.grid)) return;
|
|
445
604
|
const s = e.grid;
|
|
446
605
|
c(s, "gapMm", `${i}.grid`, t), c(s, "paddingMm", `${i}.grid`, t);
|
|
447
606
|
for (const n of ["colWidthsMm", "rowHeightsMm"]) {
|
|
@@ -452,35 +611,35 @@ function F(e, i, t) {
|
|
|
452
611
|
Array.isArray(n) && n.forEach((o, f) => {
|
|
453
612
|
const r = `${i}.grid.cells.${a}.${f}`;
|
|
454
613
|
if (o !== null) {
|
|
455
|
-
if (!
|
|
614
|
+
if (!u(o)) {
|
|
456
615
|
t.push({ path: r, message: "网格单元格应为对象或 null" });
|
|
457
616
|
return;
|
|
458
617
|
}
|
|
459
|
-
for (const
|
|
460
|
-
for (const
|
|
461
|
-
const
|
|
462
|
-
|
|
618
|
+
for (const d of ["text", "rawText", "numberFormat"]) m(o, d, r, t);
|
|
619
|
+
for (const d of ["colSpan", "rowSpan"]) {
|
|
620
|
+
const h = o[d];
|
|
621
|
+
h !== void 0 && (typeof h != "number" || !Number.isInteger(h) || h <= 0) && t.push({ path: `${r}.${d}`, message: "跨度应为正整数" });
|
|
463
622
|
}
|
|
464
|
-
o.value !== void 0 && o.value !== null && !["string", "number", "boolean"].includes(typeof o.value) && t.push({ path: `${r}.value`, message: "Excel 原始值应为字符串、数字、布尔值或 null" }),
|
|
465
|
-
d
|
|
623
|
+
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.children !== void 0 && (Array.isArray(o.children) ? o.children.forEach((d, h) => {
|
|
624
|
+
u(d) && I(d, `${r}.children.${h}`, t);
|
|
466
625
|
}) : t.push({ path: `${r}.children`, message: "嵌套组件应为数组" }));
|
|
467
626
|
}
|
|
468
627
|
});
|
|
469
628
|
});
|
|
470
629
|
}
|
|
471
|
-
function
|
|
630
|
+
function Pe(e, i, t) {
|
|
472
631
|
if (!(e.flow === void 0 || !Array.isArray(e.components)))
|
|
473
632
|
try {
|
|
474
|
-
|
|
633
|
+
he(e.components, e.flow);
|
|
475
634
|
} catch (s) {
|
|
476
635
|
t.push({ path: `${i}.flow`, message: s instanceof Error ? s.message : String(s) });
|
|
477
636
|
}
|
|
478
637
|
}
|
|
479
|
-
function
|
|
638
|
+
function _e(e) {
|
|
480
639
|
const i = [], t = [];
|
|
481
|
-
return
|
|
640
|
+
return T(e, i), i.length ? { ok: !1, errors: i, warnings: t } : (u(e) ? (e.schemaVersion !== void 0 && e.schemaVersion !== U && i.push({ path: "$.schemaVersion", message: "不支持的模板 schemaVersion" }), Se(e.params, "$.params", i), ye(e, i), !Array.isArray(e.pages) || e.pages.length === 0 ? i.push({ path: "$.pages", message: "模板至少需要一页" }) : e.pages.forEach((s, n) => {
|
|
482
641
|
const a = `$.pages.${n}`;
|
|
483
|
-
if (!
|
|
642
|
+
if (!u(s)) {
|
|
484
643
|
i.push({ path: a, message: "页应为对象" });
|
|
485
644
|
return;
|
|
486
645
|
}
|
|
@@ -488,67 +647,67 @@ function we(e) {
|
|
|
488
647
|
for (const o of ["marginTopMm", "marginBottomMm", "marginLeftMm", "marginRightMm"]) c(s, o, a, i);
|
|
489
648
|
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) => {
|
|
490
649
|
const r = `${a}.components.${f}`;
|
|
491
|
-
|
|
492
|
-
}) : i.push({ path: `${a}.components`, message: "组件应为数组" }),
|
|
650
|
+
u(o) && o.kind === "list" ? Ie(o, r, i) : (S(o, r, i, t), u(o) && I(o, r, i));
|
|
651
|
+
}) : i.push({ path: `${a}.components`, message: "组件应为数组" }), Pe(s, a, i);
|
|
493
652
|
})) : i.push({ path: "$", message: "模板应为对象" }), { ok: i.length === 0, errors: i, warnings: t });
|
|
494
653
|
}
|
|
495
|
-
function
|
|
654
|
+
function Le(e) {
|
|
496
655
|
const i = [], t = [];
|
|
497
|
-
if (
|
|
498
|
-
if (!
|
|
656
|
+
if (T(e, i), i.length) return { ok: !1, errors: i, warnings: t };
|
|
657
|
+
if (!u(e)) i.push({ path: "$", message: "模板文档应为对象" });
|
|
499
658
|
else {
|
|
500
659
|
for (const n of Object.keys(e))
|
|
501
|
-
|
|
502
|
-
e.schemaVersion !==
|
|
503
|
-
for (const n of ["id", "name"])
|
|
504
|
-
for (const n of ["revision", "description"])
|
|
505
|
-
const s =
|
|
660
|
+
we.has(n) || i.push({ path: `$.${n}`, message: "模板文档存在未知字段;只保存模板与描述,不保存取数或业务数据" });
|
|
661
|
+
e.schemaVersion !== D && i.push({ path: "$.schemaVersion", message: "不支持的模板文档版本" });
|
|
662
|
+
for (const n of ["id", "name"]) m(e, n, "$", i, !0);
|
|
663
|
+
for (const n of ["revision", "description"]) m(e, n, "$", i);
|
|
664
|
+
const s = _e(e.template);
|
|
506
665
|
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)}` })));
|
|
507
666
|
}
|
|
508
667
|
return { ok: i.length === 0, errors: i, warnings: t };
|
|
509
668
|
}
|
|
510
|
-
function
|
|
511
|
-
const i =
|
|
512
|
-
if (!i.ok) throw new
|
|
669
|
+
function x(e) {
|
|
670
|
+
const i = Le(e);
|
|
671
|
+
if (!i.ok) throw new w(i.errors);
|
|
513
672
|
}
|
|
514
|
-
function
|
|
673
|
+
function Ge(e) {
|
|
515
674
|
const i = [];
|
|
516
|
-
if (
|
|
517
|
-
const t = { ...e, schemaVersion: e.schemaVersion ??
|
|
518
|
-
return
|
|
675
|
+
if (T(e, i), i.length) throw new w(i);
|
|
676
|
+
const t = { ...e, schemaVersion: e.schemaVersion ?? D };
|
|
677
|
+
return x(t), k(t);
|
|
519
678
|
}
|
|
520
|
-
function
|
|
679
|
+
function Ue(e) {
|
|
521
680
|
let i = e;
|
|
522
681
|
if (typeof e == "string") {
|
|
523
|
-
if (e.length >
|
|
524
|
-
throw new
|
|
682
|
+
if (e.length > F)
|
|
683
|
+
throw new w([{ path: "$", message: "模板 JSON 超过 1000 万字符的导出/导入上限" }]);
|
|
525
684
|
try {
|
|
526
685
|
i = JSON.parse(e);
|
|
527
686
|
} catch {
|
|
528
|
-
throw new
|
|
687
|
+
throw new w([{ path: "$", message: "模板 JSON 语法无效" }]);
|
|
529
688
|
}
|
|
530
689
|
}
|
|
531
|
-
return
|
|
690
|
+
return x(i), k(i);
|
|
532
691
|
}
|
|
533
|
-
function
|
|
534
|
-
|
|
692
|
+
function Be(e) {
|
|
693
|
+
x(e);
|
|
535
694
|
const i = JSON.stringify(e, null, 2);
|
|
536
|
-
if (i.length >
|
|
695
|
+
if (i.length > F) throw new w([{ path: "$", message: "模板 JSON 超过 1000 万字符的导出/导入上限" }]);
|
|
537
696
|
return i;
|
|
538
697
|
}
|
|
539
|
-
function
|
|
698
|
+
function k(e) {
|
|
540
699
|
return JSON.parse(JSON.stringify(e));
|
|
541
700
|
}
|
|
542
|
-
function
|
|
701
|
+
function ze(e = []) {
|
|
543
702
|
const i = /* @__PURE__ */ new Map(), t = {
|
|
544
703
|
get: (s) => {
|
|
545
704
|
const n = i.get(s);
|
|
546
|
-
return n ?
|
|
705
|
+
return n ? k(n) : void 0;
|
|
547
706
|
},
|
|
548
707
|
list: () => Array.from(i.values(), ({ template: s, ...n }) => ({ ...n })),
|
|
549
708
|
register: (s, n = {}) => {
|
|
550
|
-
if (
|
|
551
|
-
i.set(s.id,
|
|
709
|
+
if (x(s), i.has(s.id) && !n.replace) throw new w([{ path: "$.id", message: `模板 ID ${s.id} 已注册;更新需显式 replace:true` }]);
|
|
710
|
+
i.set(s.id, k(s));
|
|
552
711
|
},
|
|
553
712
|
remove: (s) => i.delete(s)
|
|
554
713
|
};
|
|
@@ -556,15 +715,19 @@ function _e(e = []) {
|
|
|
556
715
|
return t;
|
|
557
716
|
}
|
|
558
717
|
export {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
718
|
+
w as R,
|
|
719
|
+
fe as a,
|
|
720
|
+
D as b,
|
|
721
|
+
He as c,
|
|
722
|
+
ze as d,
|
|
723
|
+
Ge as e,
|
|
724
|
+
S as f,
|
|
725
|
+
oe as g,
|
|
726
|
+
Le as h,
|
|
727
|
+
he as i,
|
|
728
|
+
ye as j,
|
|
729
|
+
Ue as p,
|
|
730
|
+
We as r,
|
|
731
|
+
Be as s,
|
|
732
|
+
_e as v
|
|
570
733
|
};
|