@agile-team/mach-report 2.14.0 → 2.16.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 +26 -16
- package/THIRD_PARTY_NOTICES.md +3 -1
- package/dist/{ExcelBindingWizard-CLT2p7P3.cjs → ExcelBindingWizard-CP6h2x1f.cjs} +1 -1
- package/dist/{ExcelBindingWizard-CvsWR8Ga.js → ExcelBindingWizard-HhB3hAJE.js} +3 -3
- package/dist/ParamEditor-CUQLgoxa.cjs +1 -0
- package/dist/ParamEditor-OKesP_nO.js +594 -0
- package/dist/{ReportBatchPanel-DkxTzBkD.cjs → ReportBatchPanel-cZCAMAwH.cjs} +1 -1
- package/dist/{ReportBatchPanel-LqVgiqp7.js → ReportBatchPanel-ruxcbfY6.js} +39 -39
- package/dist/ReportPreview-BcDKCLiK.js +4834 -0
- package/dist/ReportPreview-Bk9nLfO9.cjs +6 -0
- package/dist/{ReportTemplateLibrary-cQ1sqNYo.cjs → ReportTemplateLibrary-BDlNT8JN.cjs} +1 -1
- package/dist/{ReportTemplateLibrary-MjWEtc7X.js → ReportTemplateLibrary-DcwrH-63.js} +1 -1
- package/dist/{RuleEditor-BaR6xUiI.cjs → RuleEditor-BX5S8RSF.cjs} +1 -1
- package/dist/{RuleEditor-ChuXMlei.js → RuleEditor-CGl9XY2s.js} +5 -5
- package/dist/{TemplateOutlinePanel-BHKP89Xz.cjs → TemplateOutlinePanel-CGrT5DFN.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-Dci6aRn1.js → TemplateOutlinePanel-SXCjaPKR.js} +2 -2
- package/dist/{TemplateReusePanel-CY5eO2Sh.cjs → TemplateReusePanel-6Z3wRFz8.cjs} +1 -1
- package/dist/{TemplateReusePanel-B7Gmyc1z.js → TemplateReusePanel-lHLOS9Wn.js} +2 -2
- package/dist/{TemplateReviewPanel-DjlX3xpt.js → TemplateReviewPanel-CJ9PLc48.js} +2 -2
- package/dist/{TemplateReviewPanel-JvZe9_4G.cjs → TemplateReviewPanel-Dpk7sLcF.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +5 -1
- package/dist/analytics.d.ts +5 -1
- package/dist/analytics.js +154 -60
- package/dist/artifact-integrity.json +143 -0
- package/dist/assets-CqIbfbTr.js +126 -0
- package/dist/assets-e4YSke8n.cjs +1 -0
- package/dist/auto-YR7a4BtF.js +240 -0
- package/dist/auto-uVBjX1j5.cjs +1 -0
- package/dist/batch-WzDIXJAt.js +220 -0
- package/dist/batch-z6Aw5GEY.cjs +1 -0
- package/dist/capabilities-DDwXr_cA.js +103 -0
- package/dist/capabilities-DNLyZdNw.cjs +1 -0
- package/dist/codes.d.cts +4 -0
- package/dist/codes.d.ts +4 -0
- package/dist/component-tree-Ca6YYfHq.js +61 -0
- package/dist/component-tree-DkGLEfZC.cjs +1 -0
- package/dist/{computed-Bvk0W15F.js → computed-C-4C2S5h.js} +3 -3
- package/dist/config-Dg_o8e7m.cjs +1 -0
- package/dist/config-XQ4qrQ7Q.js +844 -0
- package/dist/designer-BfQSahxq.js +5163 -0
- package/dist/designer-CPPdeM5_.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +197 -16
- package/dist/designer.d.ts +197 -16
- package/dist/designer.js +1 -1
- package/dist/diagnostic-notification-B9K9We3h.cjs +1 -0
- package/dist/diagnostic-notification-qGAYZdkB.js +7 -0
- package/dist/drill-CsdjgkRM.cjs +1 -0
- package/dist/drill-DIGsZfyB.js +145 -0
- package/dist/encoding-BOGq4qYL.js +21 -0
- package/dist/encoding-BYF9ZTl9.cjs +1 -0
- package/dist/{font-loader-DHto6Lra.js → font-loader-CzI1GuBc.js} +1 -1
- package/dist/{font-loader-vhCT8znW.cjs → font-loader-EKLzOJxf.cjs} +1 -1
- package/dist/index.cjs +8 -9
- package/dist/index.d.cts +84 -4
- package/dist/index.d.ts +84 -4
- package/dist/index.js +829 -833
- package/dist/json-snapshot-D6ioHth9.js +1702 -0
- package/dist/json-snapshot-DknkjvxP.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-AyJGb22z.cjs → pdf-ByVCb1i6.cjs} +49 -49
- package/dist/{pdf-8UPQebOE.js → pdf-DJ5S6ukC.js} +4924 -4872
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +20 -3
- package/dist/pdf.d.ts +20 -3
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BGKf-Tqg.js → plugin-C2j5_mhx.js} +2 -2
- package/dist/{plugin-CktLH_Iy.cjs → plugin-Dr39GBRG.cjs} +1 -1
- package/dist/prepared-DdrjLC7L.cjs +1 -0
- package/dist/prepared-DqtpvRTn.js +87 -0
- package/dist/progress-B0ctFpKf.cjs +1 -0
- package/dist/progress-BXzlVbIp.js +29 -0
- package/dist/progress-DJBd9Rb9.cjs +1 -0
- package/dist/progress-Hc2vxoCs.js +52 -0
- package/dist/protocol-BzwMP4Vw.cjs +1 -0
- package/dist/protocol-kt4Iy6-3.js +90 -0
- package/dist/record-bindings-CZWBJ1fU.js +195 -0
- package/dist/record-bindings-DUX1VMlR.cjs +1 -0
- package/dist/{region-binding-workflow-DEJbhpCv.js → region-binding-workflow-CWNvIjkV.js} +1 -1
- package/dist/{region-binding-workflow-BzfbxRiR.cjs → region-binding-workflow-CqSMxQ4p.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -0
- package/dist/report-encoding-worker.d.ts +1 -0
- package/dist/report-encoding-worker.js +2 -0
- 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/rich-text-layout-ALlMoYOG.cjs +3 -0
- package/dist/rich-text-layout-Ct5WrY1g.js +102 -0
- package/dist/runtime-BjKBI530.js +168 -0
- package/dist/runtime-CBFEPKEs.cjs +1 -0
- package/dist/sbom.cdx.json +3982 -0
- package/dist/server/node.d.cts +106 -2
- package/dist/server/node.d.ts +106 -2
- package/dist/server-node.cjs +5 -1
- package/dist/server-node.js +4634 -539
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +780 -5
- package/dist/server.d.ts +780 -5
- package/dist/server.js +773 -691
- package/dist/sha256-BshdOkCC.cjs +1 -0
- package/dist/sha256-DTG-Gq8i.js +157 -0
- package/dist/style-67OqfNed.js +73 -0
- package/dist/style-C22Pbv3T.cjs +1 -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-BtR2JmCL.js +414 -0
- package/dist/template-catalog-C2NLdrwB.cjs +1 -0
- package/dist/{template-fragments-DFUpq5QM.cjs → template-fragments-BVsbxs4a.cjs} +1 -1
- package/dist/{template-fragments-CLkGo6To.js → template-fragments-By0aZC1D.js} +21 -21
- 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-C62vpv4a.cjs +1 -0
- package/dist/template-registry-Cw3vRTX2.js +801 -0
- package/dist/textwrap-BEIg2w8y.js +110 -0
- package/dist/textwrap-BI-yJ6Wt.cjs +4 -0
- package/dist/{tree-CqcQ99NM.js → tree-CjVZLRw7.js} +1 -1
- package/dist/vue/async.d.cts +189 -14
- package/dist/vue/async.d.ts +189 -14
- package/dist/vue/index.d.cts +246 -22
- package/dist/vue/index.d.ts +246 -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-BfK1yHOO.js → workbook-session-BeSO8PFB.js} +5460 -5295
- package/dist/{workbook-session-DNa2RHNG.cjs → workbook-session-Cbts-22R.cjs} +19 -19
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +104 -2
- package/dist/worker.d.ts +104 -2
- package/dist/worker.js +12 -156
- package/dist/xlsx-node.cjs +35 -35
- package/dist/xlsx-node.js +2138 -2137
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.d.cts +24 -10
- package/dist/xlsx.d.ts +24 -10
- package/dist/xlsx.js +303 -277
- package/package.json +7 -4
- 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/defaults-DXhiM1ZD.js +0 -10
- package/dist/defaults-xhmcLLrf.cjs +0 -1
- package/dist/designer-Ci1LizA9.js +0 -5020
- package/dist/designer-rtmVIIdN.cjs +0 -2
- package/dist/grid-strokes-Cr7DwUux.cjs +0 -1
- package/dist/grid-strokes-DyyG1q_o.js +0 -53
- 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/render-plan-7xpGrCEl.cjs +0 -1
- package/dist/render-plan-Ck6koX9L.js +0 -13
- package/dist/style-CQ1PK8ZB.js +0 -67
- package/dist/style-UgIJSA1F.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-COXDEJEM.js +0 -570
- package/dist/template-registry-D3SjENi6.cjs +0 -1
- package/dist/validate-BJ5HIWY8.cjs +0 -1
- package/dist/validate-CkQBWCeg.js +0 -163
|
@@ -1,570 +0,0 @@
|
|
|
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 { b as L, d as K } from "./validate-CkQBWCeg.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
|
-
return e.kind === "list" ? e.id : e.nid;
|
|
9
|
-
}
|
|
10
|
-
function B(e) {
|
|
11
|
-
return e.kind === "list" ? !1 : e.pageAnchor !== void 0 || e.kind === "text" && typeof e.text == "string" && /\{(?:page|totalPages)\}/.test(e.text);
|
|
12
|
-
}
|
|
13
|
-
function X(e, i) {
|
|
14
|
-
const t = e.filter((n) => i.componentIds.includes(x(n) ?? ""));
|
|
15
|
-
if (t.filter((n) => n.kind === "list" && n.cardinality !== "record").length && t.length !== 1) throw new Error("纵向重复区域必须独占流式分段,不能与静态或单记录区域并排");
|
|
16
|
-
for (const n of t) {
|
|
17
|
-
const a = n.kind === "list" ? n.topMm + (n.rowHeightMm ?? 0) : n.topMm + n.heightMm;
|
|
18
|
-
if (n.topMm < i.topMm - 1e-3 || a > i.topMm + i.heightMm + 1e-3) throw new Error("流式分段应完整包含其组件的原始纵向范围");
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function Oe(e, i) {
|
|
22
|
-
if (!i) return e.map((s) => ({ components: [s] }));
|
|
23
|
-
const t = new Map(e.map((s) => [x(s), s]));
|
|
24
|
-
return i.bands.map((s) => ({ band: s, components: s.componentIds.map((n) => {
|
|
25
|
-
const a = t.get(n);
|
|
26
|
-
if (!a) throw new Error(`流式区域引用不存在的组件:${n}`);
|
|
27
|
-
return a;
|
|
28
|
-
}) }));
|
|
29
|
-
}
|
|
30
|
-
function Y(e, i) {
|
|
31
|
-
if (!i || !Array.isArray(i.bands) || !i.bands.length || i.bands.length > 1e4) throw new Error("流式排版应包含 1–10000 个区域");
|
|
32
|
-
const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
33
|
-
for (const n of e) {
|
|
34
|
-
if (B(n)) continue;
|
|
35
|
-
const a = x(n);
|
|
36
|
-
if (!a || t.has(a)) throw new Error("流式排版组件应具有唯一标识");
|
|
37
|
-
t.add(a);
|
|
38
|
-
}
|
|
39
|
-
if (q(e, i, t, s), s.size !== t.size) throw new Error("流式排版必须显式包含每个非锚点组件");
|
|
40
|
-
}
|
|
41
|
-
function q(e, i, t, s) {
|
|
42
|
-
let n = -1 / 0;
|
|
43
|
-
for (const a of i.bands) {
|
|
44
|
-
if (!Number.isFinite(a.topMm) || !Number.isFinite(a.heightMm) || a.topMm < 0 || a.heightMm <= 0 || a.topMm < n - 1e-3) throw new Error("流式区域应按原始位置排序,尺寸有效且不重叠");
|
|
45
|
-
if (!Array.isArray(a.componentIds) || !a.componentIds.length) throw new Error("流式区域不能没有组件");
|
|
46
|
-
for (const o of a.componentIds) {
|
|
47
|
-
if (!t.has(o) || s.has(o)) throw new Error(`流式区域组件缺失、重复或包含页锚点:${o}`);
|
|
48
|
-
s.add(o);
|
|
49
|
-
}
|
|
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;
|
|
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
|
-
});
|
|
102
|
-
}
|
|
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) {
|
|
117
|
-
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
118
|
-
}
|
|
119
|
-
function v(e, i, t) {
|
|
120
|
-
if (e !== void 0) {
|
|
121
|
-
if (!T(e)) {
|
|
122
|
-
t.push({ path: i, message: "条件应为对象" });
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
(typeof e.field != "string" || !e.field.trim()) && t.push({ path: `${i}.field`, message: "条件需要字段" }), e.numeric !== void 0 && e.numeric !== "number" && e.numeric !== "decimal" && t.push({ path: `${i}.numeric`, message: "未知条件数值模式" }), [">", ">=", "<", "<=", "==", "!="].includes(e.op) || t.push({ path: `${i}.op`, message: "未知条件运算符" }), typeof e.value != "string" && !(typeof e.value == "number" && Number.isFinite(e.value)) && t.push({
|
|
126
|
-
path: `${i}.value`,
|
|
127
|
-
message: "条件值应为字符串或有限数字"
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function I(e, i, t) {
|
|
132
|
-
if (e === void 0) return;
|
|
133
|
-
if (!Array.isArray(e) || e.length > 2048) {
|
|
134
|
-
t.push({ path: i, message: "聚合应为数组且最多 2048 项" });
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
const s = /* @__PURE__ */ new Set();
|
|
138
|
-
e.forEach((n, a) => {
|
|
139
|
-
const o = `${i}.${a}`;
|
|
140
|
-
if (!T(n)) {
|
|
141
|
-
t.push({ path: o, message: "聚合应为对象" });
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
const f = n.field;
|
|
145
|
-
typeof f != "string" || !f.trim() || s.has(f) ? t.push({
|
|
146
|
-
path: `${o}.field`,
|
|
147
|
-
message: "聚合输出字段应非空且唯一"
|
|
148
|
-
}) : s.add(f), n.numeric !== void 0 && n.numeric !== "number" && n.numeric !== "decimal" && t.push({
|
|
149
|
-
path: `${o}.numeric`,
|
|
150
|
-
message: "数值模式应为 number 或 decimal"
|
|
151
|
-
}), n.digits !== void 0 && (!Number.isInteger(n.digits) || Number(n.digits) < 0 || Number(n.digits) > 100) && t.push({
|
|
152
|
-
path: `${o}.digits`,
|
|
153
|
-
message: "小数位应为 0–100 的整数"
|
|
154
|
-
});
|
|
155
|
-
try {
|
|
156
|
-
D({
|
|
157
|
-
...n,
|
|
158
|
-
field: n.valueField ?? f
|
|
159
|
-
});
|
|
160
|
-
} catch (r) {
|
|
161
|
-
t.push({
|
|
162
|
-
path: o,
|
|
163
|
-
message: r instanceof Error ? r.message : String(r)
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
function se(e, i, t) {
|
|
169
|
-
if (e === void 0) return;
|
|
170
|
-
const s = j(e);
|
|
171
|
-
for (const n of s.errors) t.push({ path: i, message: n });
|
|
172
|
-
}
|
|
173
|
-
function ne(e, i, t) {
|
|
174
|
-
if (e !== void 0)
|
|
175
|
-
try {
|
|
176
|
-
J(e);
|
|
177
|
-
} catch (s) {
|
|
178
|
-
t.push({
|
|
179
|
-
path: i,
|
|
180
|
-
message: s instanceof Error ? s.message : String(s)
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
function ae(e, i, t) {
|
|
185
|
-
if (e.tree === void 0) return;
|
|
186
|
-
const s = `${i}.tree`;
|
|
187
|
-
try {
|
|
188
|
-
G(e.tree);
|
|
189
|
-
const n = e.tree;
|
|
190
|
-
if (e.matrix || e.detail || e.groupBy || Array.isArray(e.groups) && e.groups.length || e.rowVisibleWhen) throw new Error("树形布局不能同时配置普通分组、矩阵、主从或行可见条件");
|
|
191
|
-
if (e.rowKey !== void 0 && e.rowKey !== n.idField) throw new Error("树形 rowKey 应与 idField 一致");
|
|
192
|
-
if (!Array.isArray(e.columns) || !e.columns.some((a) => a && a.field === n.labelField && !a.hidden)) throw new Error("树形布局需要可见的标签列");
|
|
193
|
-
Array.isArray(e.computed) && z(n, e.computed);
|
|
194
|
-
} catch (n) {
|
|
195
|
-
t.push({ path: s, message: n instanceof Error ? n.message : String(n) });
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
const P = "1.0";
|
|
199
|
-
class A extends Error {
|
|
200
|
-
constructor(i) {
|
|
201
|
-
super(`模板校验失败:${i.slice(0, 3).map((t) => `${t.path}: ${t.message}`).join("; ")}`), this.errors = i, this.name = "ReportTemplateError";
|
|
202
|
-
}
|
|
203
|
-
}
|
|
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) {
|
|
206
|
-
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
207
|
-
}
|
|
208
|
-
function me(e, i, t) {
|
|
209
|
-
const s = Object.getPrototypeOf(e), n = Array.isArray(e);
|
|
210
|
-
if (n ? s !== Array.prototype : s !== Object.prototype && s !== null)
|
|
211
|
-
return t.push({ path: i, message: "模板对象必须使用普通 JSON 对象原型" }), !1;
|
|
212
|
-
if (n) {
|
|
213
|
-
const a = Object.keys(e);
|
|
214
|
-
if (a.length !== e.length || a.some((o) => !/^(0|[1-9]\d*)$/.test(o) || Number(o) >= e.length))
|
|
215
|
-
return t.push({ path: i, message: "模板数组不能包含空位或额外属性" }), !1;
|
|
216
|
-
}
|
|
217
|
-
return Object.getOwnPropertySymbols(e).length > 0 ? (t.push({ path: i, message: "模板不能包含 Symbol 键" }), !1) : !0;
|
|
218
|
-
}
|
|
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;
|
|
221
|
-
}
|
|
222
|
-
function ue(e) {
|
|
223
|
-
return e === null || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e);
|
|
224
|
-
}
|
|
225
|
-
function R(e, i) {
|
|
226
|
-
const t = /* @__PURE__ */ new Set();
|
|
227
|
-
let s = 0, n = 0, a = !1;
|
|
228
|
-
const o = (f, r, h) => {
|
|
229
|
-
if (!a) {
|
|
230
|
-
if (++s > N) {
|
|
231
|
-
s === N + 1 && i.push({ path: r, message: "模板超过 JSON 节点安全上限" });
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
if (h > he) {
|
|
235
|
-
i.push({ path: r, message: "模板嵌套层级过深" });
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
if (typeof f == "string") {
|
|
239
|
-
n += f.length, n > O && (a = !0, i.push({ path: r, message: "模板文本超过 1000 万字符的安全上限" }));
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
if (!ue(f)) {
|
|
243
|
-
if (!f || typeof f != "object") {
|
|
244
|
-
i.push({ path: r, message: "模板只允许 JSON 值,不允许函数、undefined 或非有限数字" });
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
if (t.has(f)) {
|
|
248
|
-
i.push({ path: r, message: "模板不能包含循环引用" });
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
if (me(f, r, i)) {
|
|
252
|
-
t.add(f);
|
|
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;
|
|
257
|
-
}
|
|
258
|
-
t.delete(f);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
o(e, "$", 0);
|
|
264
|
-
}
|
|
265
|
-
function u(e, i, t, s, n = !1) {
|
|
266
|
-
const a = e[i];
|
|
267
|
-
a === void 0 && !n || (typeof a != "string" || n && !a.trim()) && s.push({ path: `${t}.${i}`, message: n ? "应为非空字符串" : "应为字符串" });
|
|
268
|
-
}
|
|
269
|
-
function c(e, i, t, s, n = 0, a = !1) {
|
|
270
|
-
const o = e[i];
|
|
271
|
-
o === void 0 && !a || (typeof o != "number" || !Number.isFinite(o) || o < n) && s.push({ path: `${t}.${i}`, message: `应为大于等于 ${n} 的有限数字` });
|
|
272
|
-
}
|
|
273
|
-
function $(e, i, t, s) {
|
|
274
|
-
e[i] !== void 0 && typeof e[i] != "boolean" && s.push({ path: `${t}.${i}`, message: "应为布尔值" });
|
|
275
|
-
}
|
|
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)" : ""}` });
|
|
278
|
-
}
|
|
279
|
-
function l(e, i, t) {
|
|
280
|
-
if (e !== void 0) {
|
|
281
|
-
if (!d(e)) {
|
|
282
|
-
t.push({ path: i, message: "样式应为对象" });
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
w(e.align, `${i}.align`, t), e.verticalAlign !== void 0 && !["top", "middle", "bottom"].includes(e.verticalAlign) && t.push({ path: `${i}.verticalAlign`, message: "未知垂直对齐方式" });
|
|
286
|
-
for (const s of ["fontSize", "fontSizePx", "lineWidthPt", "lineHeight"]) c(e, s, i, t);
|
|
287
|
-
for (const s of ["letterSpacing", "rotateDeg"]) c(e, s, i, t, -1 / 0);
|
|
288
|
-
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"]) $(e, s, i, t);
|
|
290
|
-
for (const s of ["fontFamily", "color", "backgroundColor", "lineColor", "borderColor"]) u(e, s, i, t);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
function ce(e, i, t) {
|
|
294
|
-
if (e === void 0) return;
|
|
295
|
-
if (!Array.isArray(e)) {
|
|
296
|
-
t.push({ path: i, message: "参数定义应为数组" });
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
const s = /* @__PURE__ */ new Set(), n = t.length;
|
|
300
|
-
e.forEach((a, o) => {
|
|
301
|
-
const f = `${i}.${o}`;
|
|
302
|
-
if (!d(a)) {
|
|
303
|
-
t.push({ path: f, message: "参数定义应为对象" });
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
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: "未知参数类型" });
|
|
307
|
-
for (const r of ["label", "defaultValue", "placeholder"]) u(a, r, f, t);
|
|
308
|
-
$(a, "required", f, t);
|
|
309
|
-
for (const r of ["minLength", "maxLength"]) {
|
|
310
|
-
const h = a[r];
|
|
311
|
-
h !== void 0 && (typeof h != "number" || !Number.isSafeInteger(h) || h < 0) && t.push({ path: `${f}.${r}`, message: "长度边界应为非负整数" });
|
|
312
|
-
}
|
|
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: "选项应为对象" });
|
|
316
|
-
else
|
|
317
|
-
for (const g of ["label", "value"]) typeof r[g] != "string" && t.push({ path: `${m}.${g}`, message: "选项标签与值应为字符串(允许空白选项)" });
|
|
318
|
-
}) : t.push({ path: `${f}.options`, message: "选项应为数组" }));
|
|
319
|
-
}), t.length === n && t.push(...U(e).map((a) => ({ path: a.path.replace("$.paramDefs", i), message: a.message })));
|
|
320
|
-
}
|
|
321
|
-
function ge(e, i, t) {
|
|
322
|
-
for (const a of ["min", "max"]) {
|
|
323
|
-
const o = e[a];
|
|
324
|
-
if (o === void 0) continue;
|
|
325
|
-
W(e.type, o) || e.type === "number" && typeof o == "number" && Number.isFinite(o) || t.push({ path: `${i}.${a}`, message: "数字使用有限数字边界,日期/月/年使用对应规范字符串边界" });
|
|
326
|
-
}
|
|
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;
|
|
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: "最小长度不能大于最大长度" });
|
|
329
|
-
}
|
|
330
|
-
function C(e, i, t) {
|
|
331
|
-
if (!Array.isArray(e) || e.length === 0) {
|
|
332
|
-
t.push({ path: i, message: "列表至少需要一列" });
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
e.every((s) => d(s) && s.hidden === !0) && t.push({ path: i, message: "列表至少需要一列可见列" }), e.forEach((s, n) => {
|
|
336
|
-
const a = `${i}.${n}`;
|
|
337
|
-
if (!d(s)) {
|
|
338
|
-
t.push({ path: a, message: "列应为对象" });
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
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))
|
|
343
|
-
t.push({ path: `${a}.format`, message: "未知列格式" });
|
|
344
|
-
else {
|
|
345
|
-
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 的整数" }), $(s.format, "thousands", `${a}.format`, t), u(s.format, "pattern", `${a}.format`, t);
|
|
347
|
-
}
|
|
348
|
-
s.rules !== void 0 && (Array.isArray(s.rules) ? s.rules.forEach((o, f) => {
|
|
349
|
-
const r = `${a}.rules.${f}`;
|
|
350
|
-
if (!d(o) || !d(o.when)) {
|
|
351
|
-
t.push({ path: r, message: "条件格式缺少 when 对象" });
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
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);
|
|
355
|
-
}) : t.push({ path: `${a}.rules`, message: "条件格式应为数组" }));
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
function V(e, i, t) {
|
|
359
|
-
if (e !== void 0) {
|
|
360
|
-
if (!d(e)) {
|
|
361
|
-
t.push({ path: i, message: "分组应为对象" });
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
u(e, "field", i, t, !0);
|
|
365
|
-
for (const s of ["headerTemplate", "subtotalLabel"]) u(e, s, i, t);
|
|
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: "小计字段应为字符串数组" });
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
function pe(e, i, t) {
|
|
371
|
-
if (!(e === void 0 || typeof e == "boolean")) {
|
|
372
|
-
if (!d(e)) {
|
|
373
|
-
t.push({ path: i, message: "合计应为布尔值或对象" });
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
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: "合计字段应为字符串数组" });
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
function ye(e, i, t, s) {
|
|
380
|
-
const n = { kind: "rect", leftMm: 0, topMm: 0, widthMm: 1, heightMm: 1, grid: e };
|
|
381
|
-
if (L(n, t, s, []), F(n, t, s), !d(e) || !Array.isArray(e.cells)) return;
|
|
382
|
-
const a = e.cells, o = Array.isArray(i) ? i.length : 0;
|
|
383
|
-
if (a.length * o > N) {
|
|
384
|
-
s.push({ path: t, message: "表头逻辑网格超过 20 万格安全上限" });
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
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);
|
|
388
|
-
}
|
|
389
|
-
function le(e, i, t, s) {
|
|
390
|
-
const n = /* @__PURE__ */ new Set();
|
|
391
|
-
e.forEach((a, o) => {
|
|
392
|
-
if (!Array.isArray(a)) return;
|
|
393
|
-
let f = 0;
|
|
394
|
-
a.forEach((r, h) => {
|
|
395
|
-
for (; n.has(`${o}:${f}`); ) 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;
|
|
402
|
-
});
|
|
403
|
-
});
|
|
404
|
-
}
|
|
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;
|
|
407
|
-
const s = e.detail, n = `${i}.detail`;
|
|
408
|
-
if (!d(s)) {
|
|
409
|
-
t.push({ path: n, message: "主从关联应为对象" });
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
for (const a of ["dataset", "parentKey", "foreignKey"]) u(s, a, n, t, !0);
|
|
413
|
-
for (const a of ["rowKey", "revisionField", "sourceTokenField"]) u(s, a, n, t, s[a] !== void 0);
|
|
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" });
|
|
415
|
-
}
|
|
416
|
-
function be(e, i, t) {
|
|
417
|
-
for (const s of ["leftMm", "topMm"]) c(e, s, i, t, -1 / 0, !0);
|
|
418
|
-
c(e, "widthMm", i, t, Number.MIN_VALUE, !0), u(e, "dataset", i, t, !0), u(e, "title", i, t);
|
|
419
|
-
for (const s of ["rowKey", "revisionField", "sourceTokenField"]) u(e, s, i, t, e[s] !== 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);
|
|
421
|
-
for (const s of ["fontSizePt", "rowHeightMm"]) c(e, s, i, t, Number.MIN_VALUE);
|
|
422
|
-
c(e, "paddingMm", 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);
|
|
425
|
-
}
|
|
426
|
-
function F(e, i, t) {
|
|
427
|
-
l(e.style, `${i}.style`, t);
|
|
428
|
-
for (const n of ["text", "rawText", "imageData", "fallbackText", "nid", "rkey"]) u(e, n, i, t);
|
|
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) => {
|
|
430
|
-
if (!d(n)) return;
|
|
431
|
-
const o = `${i}.richParagraphs.${a}`;
|
|
432
|
-
w(n.align, `${o}.align`, t);
|
|
433
|
-
for (const f of ["lineHeight", "spaceBeforeMm", "spaceAfterMm", "indentMm"]) c(n, f, o, t);
|
|
434
|
-
Array.isArray(n.segments) && n.segments.forEach((f, r) => {
|
|
435
|
-
const h = `${o}.segments.${r}`;
|
|
436
|
-
if (!d(f)) {
|
|
437
|
-
t.push({ path: h, message: "富文本片段应为对象" });
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
|
-
f.kind !== void 0 && f.kind !== "text" && f.kind !== "field" && t.push({ path: `${h}.kind`, message: "未知富文本片段类型" });
|
|
441
|
-
for (const m of ["text", "field"]) u(f, m, h, t);
|
|
442
|
-
l(f.style, `${h}.style`, t);
|
|
443
|
-
});
|
|
444
|
-
}), !d(e.grid)) return;
|
|
445
|
-
const s = e.grid;
|
|
446
|
-
c(s, "gapMm", `${i}.grid`, t), c(s, "paddingMm", `${i}.grid`, t);
|
|
447
|
-
for (const n of ["colWidthsMm", "rowHeightsMm"]) {
|
|
448
|
-
const a = s[n];
|
|
449
|
-
a !== void 0 && (!Array.isArray(a) || a.some((o) => typeof o != "number" || !Number.isFinite(o) || o < 0)) && t.push({ path: `${i}.grid.${n}`, message: "网格尺寸应为有限非负数字数组" });
|
|
450
|
-
}
|
|
451
|
-
Array.isArray(s.cells) && s.cells.forEach((n, a) => {
|
|
452
|
-
Array.isArray(n) && n.forEach((o, f) => {
|
|
453
|
-
const r = `${i}.grid.cells.${a}.${f}`;
|
|
454
|
-
if (o !== null) {
|
|
455
|
-
if (!d(o)) {
|
|
456
|
-
t.push({ path: r, message: "网格单元格应为对象或 null" });
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
for (const h of ["text", "rawText", "numberFormat"]) u(o, h, r, t);
|
|
460
|
-
for (const h of ["colSpan", "rowSpan"]) {
|
|
461
|
-
const m = o[h];
|
|
462
|
-
m !== void 0 && (typeof m != "number" || !Number.isInteger(m) || m <= 0) && t.push({ path: `${r}.${h}`, message: "跨度应为正整数" });
|
|
463
|
-
}
|
|
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);
|
|
466
|
-
}) : t.push({ path: `${r}.children`, message: "嵌套组件应为数组" }));
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
function Ae(e, i, t) {
|
|
472
|
-
if (!(e.flow === void 0 || !Array.isArray(e.components)))
|
|
473
|
-
try {
|
|
474
|
-
Y(e.components, e.flow);
|
|
475
|
-
} catch (s) {
|
|
476
|
-
t.push({ path: `${i}.flow`, message: s instanceof Error ? s.message : String(s) });
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
function we(e) {
|
|
480
|
-
const i = [], t = [];
|
|
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) => {
|
|
482
|
-
const a = `$.pages.${n}`;
|
|
483
|
-
if (!d(s)) {
|
|
484
|
-
i.push({ path: a, message: "页应为对象" });
|
|
485
|
-
return;
|
|
486
|
-
}
|
|
487
|
-
c(s, "widthMm", a, i, Number.MIN_VALUE, !0), c(s, "heightMm", a, i, Number.MIN_VALUE, !0), s.layout !== void 0 && s.layout !== "page" && s.layout !== "wide" && i.push({ path: `${a}.layout`, message: "布局应为 page 或 wide" }), typeof s.heightMm == "number" && s.heightMm >= 5e3 && i.push({ path: `${a}.heightMm`, message: "页高应小于 5000mm" });
|
|
488
|
-
for (const o of ["marginTopMm", "marginBottomMm", "marginLeftMm", "marginRightMm"]) c(s, o, a, i);
|
|
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) => {
|
|
490
|
-
const r = `${a}.components.${f}`;
|
|
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);
|
|
493
|
-
})) : i.push({ path: "$", message: "模板应为对象" }), { ok: i.length === 0, errors: i, warnings: t });
|
|
494
|
-
}
|
|
495
|
-
function Me(e) {
|
|
496
|
-
const i = [], t = [];
|
|
497
|
-
if (R(e, i), i.length) return { ok: !1, errors: i, warnings: t };
|
|
498
|
-
if (!d(e)) i.push({ path: "$", message: "模板文档应为对象" });
|
|
499
|
-
else {
|
|
500
|
-
for (const n of Object.keys(e))
|
|
501
|
-
fe.has(n) || i.push({ path: `$.${n}`, message: "模板文档存在未知字段;只保存模板与描述,不保存取数或业务数据" });
|
|
502
|
-
e.schemaVersion !== P && i.push({ path: "$.schemaVersion", message: "不支持的模板文档版本" });
|
|
503
|
-
for (const n of ["id", "name"]) u(e, n, "$", i, !0);
|
|
504
|
-
for (const n of ["revision", "description"]) u(e, n, "$", i);
|
|
505
|
-
const s = we(e.template);
|
|
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)}` })));
|
|
507
|
-
}
|
|
508
|
-
return { ok: i.length === 0, errors: i, warnings: t };
|
|
509
|
-
}
|
|
510
|
-
function k(e) {
|
|
511
|
-
const i = Me(e);
|
|
512
|
-
if (!i.ok) throw new A(i.errors);
|
|
513
|
-
}
|
|
514
|
-
function Re(e) {
|
|
515
|
-
const i = [];
|
|
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);
|
|
519
|
-
}
|
|
520
|
-
function Fe(e) {
|
|
521
|
-
let i = e;
|
|
522
|
-
if (typeof e == "string") {
|
|
523
|
-
if (e.length > O)
|
|
524
|
-
throw new A([{ path: "$", message: "模板 JSON 超过 1000 万字符的导出/导入上限" }]);
|
|
525
|
-
try {
|
|
526
|
-
i = JSON.parse(e);
|
|
527
|
-
} catch {
|
|
528
|
-
throw new A([{ path: "$", message: "模板 JSON 语法无效" }]);
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
return k(i), S(i);
|
|
532
|
-
}
|
|
533
|
-
function Le(e) {
|
|
534
|
-
k(e);
|
|
535
|
-
const i = JSON.stringify(e, null, 2);
|
|
536
|
-
if (i.length > O) throw new A([{ path: "$", message: "模板 JSON 超过 1000 万字符的导出/导入上限" }]);
|
|
537
|
-
return i;
|
|
538
|
-
}
|
|
539
|
-
function S(e) {
|
|
540
|
-
return JSON.parse(JSON.stringify(e));
|
|
541
|
-
}
|
|
542
|
-
function _e(e = []) {
|
|
543
|
-
const i = /* @__PURE__ */ new Map(), t = {
|
|
544
|
-
get: (s) => {
|
|
545
|
-
const n = i.get(s);
|
|
546
|
-
return n ? S(n) : void 0;
|
|
547
|
-
},
|
|
548
|
-
list: () => Array.from(i.values(), ({ template: s, ...n }) => ({ ...n })),
|
|
549
|
-
register: (s, n = {}) => {
|
|
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));
|
|
552
|
-
},
|
|
553
|
-
remove: (s) => i.delete(s)
|
|
554
|
-
};
|
|
555
|
-
for (const s of e) t.register(s);
|
|
556
|
-
return t;
|
|
557
|
-
}
|
|
558
|
-
export {
|
|
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
|
|
570
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const G=require("./matrix-DVyWiYsd.cjs"),P=require("./computed-CGV2a809.cjs"),z=require("./render-plan-7xpGrCEl.cjs"),x=require("./validate-BJ5HIWY8.cjs"),I=require("./param-validation-DCK039V1.cjs"),L=require("./tree-BX380Rr7.cjs");function R(e){return e.kind==="list"?e.id:e.nid}function q(e){return e.kind==="list"?!1:e.pageAnchor!==void 0||e.kind==="text"&&typeof e.text=="string"&&/\{(?:page|totalPages)\}/.test(e.text)}function B(e,i){const t=e.filter(n=>i.componentIds.includes(R(n)??""));if(t.filter(n=>n.kind==="list"&&n.cardinality!=="record").length&&t.length!==1)throw new Error("纵向重复区域必须独占流式分段,不能与静态或单记录区域并排");for(const n of t){const a=n.kind==="list"?n.topMm+(n.rowHeightMm??0):n.topMm+n.heightMm;if(n.topMm<i.topMm-.001||a>i.topMm+i.heightMm+.001)throw new Error("流式分段应完整包含其组件的原始纵向范围")}}function X(e,i){if(!i)return e.map(s=>({components:[s]}));const t=new Map(e.map(s=>[R(s),s]));return i.bands.map(s=>({band:s,components:s.componentIds.map(n=>{const a=t.get(n);if(!a)throw new Error(`流式区域引用不存在的组件:${n}`);return a})}))}function C(e,i){if(!i||!Array.isArray(i.bands)||!i.bands.length||i.bands.length>1e4)throw new Error("流式排版应包含 1–10000 个区域");const t=new Set,s=new Set;for(const n of e){if(q(n))continue;const a=R(n);if(!a||t.has(a))throw new Error("流式排版组件应具有唯一标识");t.add(a)}if(Y(e,i,t,s),s.size!==t.size)throw new Error("流式排版必须显式包含每个非锚点组件")}function Y(e,i,t,s){let n=-1/0;for(const a of i.bands){if(!Number.isFinite(a.topMm)||!Number.isFinite(a.heightMm)||a.topMm<0||a.heightMm<=0||a.topMm<n-.001)throw new Error("流式区域应按原始位置排序,尺寸有效且不重叠");if(!Array.isArray(a.componentIds)||!a.componentIds.length)throw new Error("流式区域不能没有组件");for(const o of a.componentIds){if(!t.has(o)||s.has(o))throw new Error(`流式区域组件缺失、重复或包含页锚点:${o}`);s.add(o)}B(e,a),n=a.topMm+a.heightMm}}const Q=new Set(["__proto__","prototype","constructor"]);function y(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function M(e){return typeof e=="string"&&!!e.trim()&&!Q.has(e)}function N(e,i,t,s){for(const n of Object.keys(e))i.includes(n)||s.push({path:`${t}.${n}`,message:"存在未知配置字段"})}function Z(e,i,t){if(e!==void 0){if(!y(e)||!["number","percent","date"].includes(String(e.kind))){t.push({path:i,message:"绑定格式应为 number、percent 或 date"});return}N(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:"日期格式应为字符串"})}}function ee(e,i,t){const s=e.binding;if(s===void 0)return;const n=`${i}.binding`;if(!y(s)){t.push({path:n,message:"字段绑定应为对象"});return}(!["text","image","barcode","qrcode"].includes(String(e.kind))||e.grid!==void 0)&&t.push({path:n,message:"绑定仅支持独立文本、图片、条码与二维码组件"}),N(s,["field","format","prefix","suffix","emptyText"],n,t),M(s.field)||t.push({path:`${n}.field`,message:"绑定字段应为安全的非空字段名(按字面读取自有字段)"});for(const a of["prefix","suffix","emptyText"])s[a]!==void 0&&typeof s[a]!="string"&&t.push({path:`${n}.${a}`,message:"应为字符串"});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,不支持文本格式或前后缀"})}function te(e,i){if(!y(e)){i.push({path:"$.repeat",message:"逐记录配置应为对象"});return}N(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:"业务主键应为安全的非空字段名"});const t=e.copies;t!==void 0&&(y(t)?(N(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 整数"}))}function V(e,i,t,s){if(!y(e))return;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:"逐记录标签使用固定组件;动态列表请使用普通报表模板"});const n=e.grid;y(n)&&Array.isArray(n.cells)&&n.cells.forEach((a,o)=>{Array.isArray(a)&&a.forEach((f,r)=>{y(f)&&Array.isArray(f.children)&&f.children.forEach((d,h)=>V(d,`${i}.grid.cells.${o}.${r}.children.${h}`,t,s))})})}function D(e,i){const t=e.repeat!==void 0;t&&te(e.repeat,i),Array.isArray(e.pages)&&e.pages.forEach((s,n)=>{if(!y(s))return;const a=`$.pages.${n}`;t&&(s.layout==="wide"||s.flow!==void 0)&&i.push({path:a,message:"逐记录标签仅支持固定尺寸页面,不支持宽表或流式分区"}),Array.isArray(s.components)&&s.components.forEach((o,f)=>{const r=`${a}.components.${f}`;if(V(o,r,t,i),!t||!y(o))return;const{leftMm:d,topMm:h,widthMm:g,heightMm:p}=o;[d,h,g,p,s.widthMm,s.heightMm].every(b=>typeof b=="number"&&Number.isFinite(b))&&(Number(d)<0||Number(h)<0||Number(d)+Number(g)>Number(s.widthMm)+.001||Number(h)+Number(p)>Number(s.heightMm)+.001)&&i.push({path:r,message:"标签组件超出纸张边界,请调整位置或尺寸"})})})}function J(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function v(e,i,t){if(e!==void 0){if(!J(e)){t.push({path:i,message:"条件应为对象"});return}(typeof e.field!="string"||!e.field.trim())&&t.push({path:`${i}.field`,message:"条件需要字段"}),e.numeric!==void 0&&e.numeric!=="number"&&e.numeric!=="decimal"&&t.push({path:`${i}.numeric`,message:"未知条件数值模式"}),[">",">=","<","<=","==","!="].includes(e.op)||t.push({path:`${i}.op`,message:"未知条件运算符"}),typeof e.value!="string"&&!(typeof e.value=="number"&&Number.isFinite(e.value))&&t.push({path:`${i}.value`,message:"条件值应为字符串或有限数字"})}}function j(e,i,t){if(e===void 0)return;if(!Array.isArray(e)||e.length>2048){t.push({path:i,message:"聚合应为数组且最多 2048 项"});return}const s=new Set;e.forEach((n,a)=>{const o=`${i}.${a}`;if(!J(n)){t.push({path:o,message:"聚合应为对象"});return}const f=n.field;typeof f!="string"||!f.trim()||s.has(f)?t.push({path:`${o}.field`,message:"聚合输出字段应非空且唯一"}):s.add(f),n.numeric!==void 0&&n.numeric!=="number"&&n.numeric!=="decimal"&&t.push({path:`${o}.numeric`,message:"数值模式应为 number 或 decimal"}),n.digits!==void 0&&(!Number.isInteger(n.digits)||Number(n.digits)<0||Number(n.digits)>100)&&t.push({path:`${o}.digits`,message:"小数位应为 0–100 的整数"});try{P.createAggregateAccumulator({...n,field:n.valueField??f})}catch(r){t.push({path:o,message:r instanceof Error?r.message:String(r)})}})}function ie(e,i,t){if(e===void 0)return;const s=P.validateComputedFields(e);for(const n of s.errors)t.push({path:i,message:n})}function se(e,i,t){if(e!==void 0)try{G.validateMatrixOptions(e)}catch(s){t.push({path:i,message:s instanceof Error?s.message:String(s)})}}function ne(e,i,t){if(e.tree===void 0)return;const s=`${i}.tree`;try{L.validateTreeOptions(e.tree);const n=e.tree;if(e.matrix||e.detail||e.groupBy||Array.isArray(e.groups)&&e.groups.length||e.rowVisibleWhen)throw new Error("树形布局不能同时配置普通分组、矩阵、主从或行可见条件");if(e.rowKey!==void 0&&e.rowKey!==n.idField)throw new Error("树形 rowKey 应与 idField 一致");if(!Array.isArray(e.columns)||!e.columns.some(a=>a&&a.field===n.labelField&&!a.hidden))throw new Error("树形布局需要可见的标签列");Array.isArray(e.computed)&&L.validateTreeComputed(n,e.computed)}catch(n){t.push({path:s,message:n instanceof Error?n.message:String(n)})}}const T="1.0";class A extends Error{constructor(i){super(`模板校验失败:${i.slice(0,3).map(t=>`${t.path}: ${t.message}`).join("; ")}`),this.errors=i,this.name="ReportTemplateError"}}const ae=new Set(["__proto__","prototype","constructor"]),oe=new Set(["schemaVersion","id","name","revision","description","template"]),fe=new Set(["left","center","right","justify"]),E=2e5,re=64,O=1e7;function m(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function de(e,i,t){const s=Object.getPrototypeOf(e),n=Array.isArray(e);if(n?s!==Array.prototype:s!==Object.prototype&&s!==null)return t.push({path:i,message:"模板对象必须使用普通 JSON 对象原型"}),!1;if(n){const a=Object.keys(e);if(a.length!==e.length||a.some(o=>!/^(0|[1-9]\d*)$/.test(o)||Number(o)>=e.length))return t.push({path:i,message:"模板数组不能包含空位或额外属性"}),!1}return Object.getOwnPropertySymbols(e).length>0?(t.push({path:i,message:"模板不能包含 Symbol 键"}),!1):!0}function he(e,i,t,s){return ae.has(e)?(s.push({path:t,message:"模板不能包含可能污染原型的键"}),!1):i.get||i.set||!i.enumerable?(s.push({path:t,message:"模板不能包含访问器或不可枚举字段"}),!1):!0}function me(e){return e===null||typeof e=="boolean"||typeof e=="number"&&Number.isFinite(e)}function F(e,i){const t=new Set;let s=0,n=0,a=!1;const o=(f,r,d)=>{if(!a){if(++s>E){s===E+1&&i.push({path:r,message:"模板超过 JSON 节点安全上限"});return}if(d>re){i.push({path:r,message:"模板嵌套层级过深"});return}if(typeof f=="string"){n+=f.length,n>O&&(a=!0,i.push({path:r,message:"模板文本超过 1000 万字符的安全上限"}));return}if(!me(f)){if(!f||typeof f!="object"){i.push({path:r,message:"模板只允许 JSON 值,不允许函数、undefined 或非有限数字"});return}if(t.has(f)){i.push({path:r,message:"模板不能包含循环引用"});return}if(de(f,r,i)){t.add(f);for(const[h,g]of Object.entries(Object.getOwnPropertyDescriptors(f))){if(Array.isArray(f)&&h==="length")continue;const p=`${r}.${h}`;if(he(h,g,p,i)&&o(g.value,p,d+1),s>E||a)break}t.delete(f)}}}};o(e,"$",0)}function u(e,i,t,s,n=!1){const a=e[i];a===void 0&&!n||(typeof a!="string"||n&&!a.trim())&&s.push({path:`${t}.${i}`,message:n?"应为非空字符串":"应为字符串"})}function c(e,i,t,s,n=0,a=!1){const o=e[i];o===void 0&&!a||(typeof o!="number"||!Number.isFinite(o)||o<n)&&s.push({path:`${t}.${i}`,message:`应为大于等于 ${n} 的有限数字`})}function $(e,i,t,s){e[i]!==void 0&&typeof e[i]!="boolean"&&s.push({path:`${t}.${i}`,message:"应为布尔值"})}function w(e,i,t,s=!1){e!==void 0&&!fe.has(e)&&!(s&&e==="auto")&&t.push({path:i,message:`未知对齐方式${s?"(支持 auto)":""}`})}function l(e,i,t){if(e!==void 0){if(!m(e)){t.push({path:i,message:"样式应为对象"});return}w(e.align,`${i}.align`,t),e.verticalAlign!==void 0&&!["top","middle","bottom"].includes(e.verticalAlign)&&t.push({path:`${i}.verticalAlign`,message:"未知垂直对齐方式"});for(const s of["fontSize","fontSizePx","lineWidthPt","lineHeight"])c(e,s,i,t);for(const s of["letterSpacing","rotateDeg"])c(e,s,i,t,-1/0);c(e,"opacity",i,t),typeof e.opacity=="number"&&e.opacity>1&&t.push({path:`${i}.opacity`,message:"透明度不能大于 1"});for(const s of["bold","italic","underline","borderTop","borderRight","borderBottom","borderLeft"])$(e,s,i,t);for(const s of["fontFamily","color","backgroundColor","lineColor","borderColor"])u(e,s,i,t)}}function ue(e,i,t){if(e===void 0)return;if(!Array.isArray(e)){t.push({path:i,message:"参数定义应为数组"});return}const s=new Set,n=t.length;e.forEach((a,o)=>{const f=`${i}.${o}`;if(!m(a)){t.push({path:f,message:"参数定义应为对象"});return}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:"未知参数类型"});for(const r of["label","defaultValue","placeholder"])u(a,r,f,t);$(a,"required",f,t);for(const r of["minLength","maxLength"]){const d=a[r];d!==void 0&&(typeof d!="number"||!Number.isSafeInteger(d)||d<0)&&t.push({path:`${f}.${r}`,message:"长度边界应为非负整数"})}ce(a,f,t),a.options!==void 0&&(Array.isArray(a.options)?a.options.forEach((r,d)=>{const h=`${f}.options.${d}`;if(!m(r))t.push({path:h,message:"选项应为对象"});else for(const g of["label","value"])typeof r[g]!="string"&&t.push({path:`${h}.${g}`,message:"选项标签与值应为字符串(允许空白选项)"})}):t.push({path:`${f}.options`,message:"选项应为数组"}))}),t.length===n&&t.push(...I.validateReportParamDefinitions(e).map(a=>({path:a.path.replace("$.paramDefs",i),message:a.message})))}function ce(e,i,t){for(const a of["min","max"]){const o=e[a];if(o===void 0)continue;I.isReportTemporalBound(e.type,o)||e.type==="number"&&typeof o=="number"&&Number.isFinite(o)||t.push({path:`${i}.${a}`,message:"数字使用有限数字边界,日期/月/年使用对应规范字符串边界"})}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;(s||n)&&t.push({path:i,message:"最小边界不能大于最大边界"}),typeof e.minLength=="number"&&typeof e.maxLength=="number"&&e.minLength>e.maxLength&&t.push({path:i,message:"最小长度不能大于最大长度"})}function H(e,i,t){if(!Array.isArray(e)||e.length===0){t.push({path:i,message:"列表至少需要一列"});return}e.every(s=>m(s)&&s.hidden===!0)&&t.push({path:i,message:"列表至少需要一列可见列"}),e.forEach((s,n)=>{const a=`${i}.${n}`;if(!m(s)){t.push({path:a,message:"列应为对象"});return}if(x.validateEditableMetadata(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)if(!m(s.format)||!["number","percent","date"].includes(s.format.kind))t.push({path:`${a}.format`,message:"未知列格式"});else{const o=s.format.digits;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)}s.rules!==void 0&&(Array.isArray(s.rules)?s.rules.forEach((o,f)=>{const r=`${a}.rules.${f}`;if(!m(o)||!m(o.when)){t.push({path:r,message:"条件格式缺少 when 对象"});return}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)}):t.push({path:`${a}.rules`,message:"条件格式应为数组"}))})}function K(e,i,t){if(e!==void 0){if(!m(e)){t.push({path:i,message:"分组应为对象"});return}u(e,"field",i,t,!0);for(const s of["headerTemplate","subtotalLabel"])u(e,s,i,t);for(const s of["headerStyle","subtotalStyle"])l(e[s],`${i}.${s}`,t);$(e,"keepWithNext",i,t),$(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:"小计字段应为字符串数组"})}}function ge(e,i,t){if(!(e===void 0||typeof e=="boolean")){if(!m(e)){t.push({path:i,message:"合计应为布尔值或对象"});return}u(e,"label",i,t),j(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:"合计字段应为字符串数组"})}}function pe(e,i,t,s){const n={kind:"rect",leftMm:0,topMm:0,widthMm:1,heightMm:1,grid:e};if(x.validateComponent(n,t,s,[]),_(n,t,s),!m(e)||!Array.isArray(e.cells))return;const a=e.cells,o=Array.isArray(i)?i.length:0;if(a.length*o>E){s.push({path:t,message:"表头逻辑网格超过 20 万格安全上限"});return}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:"表头行高数量应与行数一致"}),ye(a,o,t,s)}function ye(e,i,t,s){const n=new Set;e.forEach((a,o)=>{if(!Array.isArray(a))return;let f=0;a.forEach((r,d)=>{for(;n.has(`${o}:${f}`);)f++;const h=m(r)&&typeof r.colSpan=="number"?r.colSpan:1,g=m(r)&&typeof r.rowSpan=="number"?r.rowSpan:1;(f+h>i||o+g>e.length)&&s.push({path:`${t}.cells.${o}.${d}`,message:"表头合并区域超出表头边界"});for(let p=o;p<Math.min(e.length,o+g);p++)for(let b=f;b<Math.min(i,f+h);b++)n.has(`${p}:${b}`)&&s.push({path:`${t}.cells.${o}.${d}`,message:"表头合并区域重叠"}),n.add(`${p}:${b}`);f+=h})})}function le(e,i,t){if(ne(e,i,t),ie(e.computed,`${i}.computed`,t),se(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)=>K(a,`${i}.groups.${o}`,t))),e.detail===void 0)return;const s=e.detail,n=`${i}.detail`;if(!m(s)){t.push({path:n,message:"主从关联应为对象"});return}for(const a of["dataset","parentKey","foreignKey"])u(s,a,n,t,!0);for(const a of["rowKey","revisionField","sourceTokenField"])u(s,a,n,t,s[a]!==void 0);u(s,"label",n,t),$(s,"header",n,t),c(s,"rowHeightMm",n,t,Number.MIN_VALUE),H(s.columns,`${n}.columns`,t),s.unmatched!==void 0&&s.unmatched!=="error"&&s.unmatched!=="ignore"&&t.push({path:`${n}.unmatched`,message:"未关联明细策略应为 error 或 ignore"})}function $e(e,i,t){for(const s of["leftMm","topMm"])c(e,s,i,t,-1/0,!0);c(e,"widthMm",i,t,Number.MIN_VALUE,!0),u(e,"dataset",i,t,!0),u(e,"title",i,t);for(const s of["rowKey","revisionField","sourceTokenField"])u(e,s,i,t,e[s]!==void 0);e.headerGrid!==void 0&&pe(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"}),H(e.columns,`${i}.columns`,t);for(const s of["fontSizePt","rowHeightMm"])c(e,s,i,t,Number.MIN_VALUE);c(e,"paddingMm",i,t);for(const s of["header","headerBold","headerEveryPage","border"])$(e,s,i,t);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),le(e,i,t),K(e.groupBy,`${i}.groupBy`,t),ge(e.grandTotal,`${i}.grandTotal`,t)}function _(e,i,t){l(e.style,`${i}.style`,t);for(const n of["text","rawText","imageData","fallbackText","nid","rkey"])u(e,n,i,t);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)=>{if(!m(n))return;const o=`${i}.richParagraphs.${a}`;w(n.align,`${o}.align`,t);for(const f of["lineHeight","spaceBeforeMm","spaceAfterMm","indentMm"])c(n,f,o,t);Array.isArray(n.segments)&&n.segments.forEach((f,r)=>{const d=`${o}.segments.${r}`;if(!m(f)){t.push({path:d,message:"富文本片段应为对象"});return}f.kind!==void 0&&f.kind!=="text"&&f.kind!=="field"&&t.push({path:`${d}.kind`,message:"未知富文本片段类型"});for(const h of["text","field"])u(f,h,d,t);l(f.style,`${d}.style`,t)})}),!m(e.grid))return;const s=e.grid;c(s,"gapMm",`${i}.grid`,t),c(s,"paddingMm",`${i}.grid`,t);for(const n of["colWidthsMm","rowHeightsMm"]){const a=s[n];a!==void 0&&(!Array.isArray(a)||a.some(o=>typeof o!="number"||!Number.isFinite(o)||o<0))&&t.push({path:`${i}.grid.${n}`,message:"网格尺寸应为有限非负数字数组"})}Array.isArray(s.cells)&&s.cells.forEach((n,a)=>{Array.isArray(n)&&n.forEach((o,f)=>{const r=`${i}.grid.cells.${a}.${f}`;if(o!==null){if(!m(o)){t.push({path:r,message:"网格单元格应为对象或 null"});return}for(const d of["text","rawText","numberFormat"])u(o,d,r,t);for(const d of["colSpan","rowSpan"]){const h=o[d];h!==void 0&&(typeof h!="number"||!Number.isInteger(h)||h<=0)&&t.push({path:`${r}.${d}`,message:"跨度应为正整数"})}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((d,h)=>{m(d)&&_(d,`${r}.children.${h}`,t)}):t.push({path:`${r}.children`,message:"嵌套组件应为数组"}))}})})}function be(e,i,t){if(!(e.flow===void 0||!Array.isArray(e.components)))try{C(e.components,e.flow)}catch(s){t.push({path:`${i}.flow`,message:s instanceof Error?s.message:String(s)})}}function U(e){const i=[],t=[];return F(e,i),i.length?{ok:!1,errors:i,warnings:t}:(m(e)?(e.schemaVersion!==void 0&&e.schemaVersion!==z.RENDER_PLAN_SCHEMA_VERSION&&i.push({path:"$.schemaVersion",message:"不支持的模板 schemaVersion"}),ue(e.params,"$.params",i),D(e,i),!Array.isArray(e.pages)||e.pages.length===0?i.push({path:"$.pages",message:"模板至少需要一页"}):e.pages.forEach((s,n)=>{const a=`$.pages.${n}`;if(!m(s)){i.push({path:a,message:"页应为对象"});return}c(s,"widthMm",a,i,Number.MIN_VALUE,!0),c(s,"heightMm",a,i,Number.MIN_VALUE,!0),s.layout!==void 0&&s.layout!=="page"&&s.layout!=="wide"&&i.push({path:`${a}.layout`,message:"布局应为 page 或 wide"}),typeof s.heightMm=="number"&&s.heightMm>=5e3&&i.push({path:`${a}.heightMm`,message:"页高应小于 5000mm"});for(const o of["marginTopMm","marginBottomMm","marginLeftMm","marginRightMm"])c(s,o,a,i);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)=>{const r=`${a}.components.${f}`;m(o)&&o.kind==="list"?$e(o,r,i):(x.validateComponent(o,r,i,t),m(o)&&_(o,r,i))}):i.push({path:`${a}.components`,message:"组件应为数组"}),be(s,a,i)})):i.push({path:"$",message:"模板应为对象"}),{ok:i.length===0,errors:i,warnings:t})}function W(e){const i=[],t=[];if(F(e,i),i.length)return{ok:!1,errors:i,warnings:t};if(!m(e))i.push({path:"$",message:"模板文档应为对象"});else{for(const n of Object.keys(e))oe.has(n)||i.push({path:`$.${n}`,message:"模板文档存在未知字段;只保存模板与描述,不保存取数或业务数据"});e.schemaVersion!==T&&i.push({path:"$.schemaVersion",message:"不支持的模板文档版本"});for(const n of["id","name"])u(e,n,"$",i,!0);for(const n of["revision","description"])u(e,n,"$",i);const s=U(e.template);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)}`})))}return{ok:i.length===0,errors:i,warnings:t}}function k(e){const i=W(e);if(!i.ok)throw new A(i.errors)}function Ae(e){const i=[];if(F(e,i),i.length)throw new A(i);const t={...e,schemaVersion:e.schemaVersion??T};return k(t),S(t)}function we(e){let i=e;if(typeof e=="string"){if(e.length>O)throw new A([{path:"$",message:"模板 JSON 超过 1000 万字符的导出/导入上限"}]);try{i=JSON.parse(e)}catch{throw new A([{path:"$",message:"模板 JSON 语法无效"}])}}return k(i),S(i)}function Me(e){k(e);const i=JSON.stringify(e,null,2);if(i.length>O)throw new A([{path:"$",message:"模板 JSON 超过 1000 万字符的导出/导入上限"}]);return i}function S(e){return JSON.parse(JSON.stringify(e))}function Ee(e=[]){const i=new Map,t={get:s=>{const n=i.get(s);return n?S(n):void 0},list:()=>Array.from(i.values(),({template:s,...n})=>({...n})),register:(s,n={})=>{if(k(s),i.has(s.id)&&!n.replace)throw new A([{path:"$.id",message:`模板 ID ${s.id} 已注册;更新需显式 replace:true`}]);i.set(s.id,S(s))},remove:s=>i.delete(s)};for(const s of e)t.register(s);return t}exports.REPORT_TEMPLATE_DOCUMENT_VERSION=T;exports.ReportTemplateError=A;exports.createTemplateRegistry=Ee;exports.defineReportTemplate=Ae;exports.parseReportTemplate=we;exports.reportFlowGroups=X;exports.serializeReportTemplate=Me;exports.validateReportPageFlow=C;exports.validateReportTemplate=U;exports.validateReportTemplateDocument=W;exports.validateTemplateRepeat=D;
|