@agile-team/mach-report 2.13.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.
Files changed (260) hide show
  1. package/README.md +20 -7
  2. package/THIRD_PARTY_NOTICES.md +3 -1
  3. package/dist/ExcelBindingWizard-BKH1nGNS.js +1485 -0
  4. package/dist/ExcelBindingWizard-Bs43BGNp.cjs +1 -0
  5. package/dist/ParamEditor-Da4akw6V.cjs +1 -0
  6. package/dist/ParamEditor-DoAhzJsm.js +594 -0
  7. package/dist/{ReportBatchPanel-CW2HV9I8.js → ReportBatchPanel-BMf6boMA.js} +39 -39
  8. package/dist/ReportBatchPanel-wP9m9Pj1.cjs +1 -0
  9. package/dist/ReportPreview-ChV19HBp.js +4619 -0
  10. package/dist/ReportPreview-DbLvvOUT.cjs +6 -0
  11. package/dist/{ReportTemplateLibrary-BZB-XWjj.js → ReportTemplateLibrary-C9wutIiT.js} +1 -1
  12. package/dist/ReportTemplateLibrary-Sxr3eD0J.cjs +1 -0
  13. package/dist/RuleEditor-C_Clasvd.js +2037 -0
  14. package/dist/RuleEditor-XhGHK8DE.cjs +1 -0
  15. package/dist/TemplateOutlinePanel-D6Bkny59.js +96 -0
  16. package/dist/TemplateOutlinePanel-JTSR53vJ.cjs +1 -0
  17. package/dist/TemplateReusePanel-Kx35S0Ql.cjs +1 -0
  18. package/dist/TemplateReusePanel-rVuK1kTz.js +388 -0
  19. package/dist/TemplateReviewPanel-B0ar9_zf.js +592 -0
  20. package/dist/TemplateReviewPanel-Dn6X9UmY.cjs +1 -0
  21. package/dist/analytics.cjs +1 -1
  22. package/dist/analytics.d.cts +3 -1
  23. package/dist/analytics.d.ts +3 -1
  24. package/dist/analytics.js +154 -60
  25. package/dist/artifact-integrity.json +135 -0
  26. package/dist/assets-B9ImAi6_.cjs +1 -0
  27. package/dist/assets-DEaz4qsp.js +124 -0
  28. package/dist/batch-BaP6pWDE.cjs +1 -0
  29. package/dist/batch-BfZHN1do.js +220 -0
  30. package/dist/batch-CGyt-b2W.js +273 -0
  31. package/dist/batch-CLpELXBl.cjs +1 -0
  32. package/dist/capabilities-CAh2Nrue.cjs +1 -0
  33. package/dist/capabilities-DskCHs3V.js +69 -0
  34. package/dist/codes.d.cts +2 -0
  35. package/dist/codes.d.ts +2 -0
  36. package/dist/{computed-Bvk0W15F.js → computed-C-4C2S5h.js} +3 -3
  37. package/dist/config-BVsJXSqS.js +842 -0
  38. package/dist/config-D10us76d.cjs +1 -0
  39. package/dist/data-explanation-B8MZRYVS.js +16 -0
  40. package/dist/data-explanation-DE55G30w.cjs +1 -0
  41. package/dist/designer-2bDlcNXQ.js +5136 -0
  42. package/dist/designer-BT7XCdbW.cjs +2 -0
  43. package/dist/designer.cjs +1 -2
  44. package/dist/designer.d.cts +432 -17
  45. package/dist/designer.d.ts +432 -17
  46. package/dist/designer.js +21 -4312
  47. package/dist/drill-ByJviLXS.js +145 -0
  48. package/dist/drill-DYTxuL3A.cjs +1 -0
  49. package/dist/font-loader-B_UkxpzC.cjs +1 -0
  50. package/dist/font-loader-Q3bQjmrI.js +297 -0
  51. package/dist/index.cjs +8 -8
  52. package/dist/index.d.cts +239 -5
  53. package/dist/index.d.ts +239 -5
  54. package/dist/index.js +939 -893
  55. package/dist/json-snapshot-DFb2eWkf.js +1416 -0
  56. package/dist/json-snapshot-WWSGlaHG.cjs +2 -0
  57. package/dist/licenses/_bwip-js_generic-4.11.4.txt +24 -0
  58. package/dist/licenses/_fast-csv_format-4.3.5.txt +22 -0
  59. package/dist/licenses/_fast-csv_parse-4.3.6.txt +22 -0
  60. package/dist/licenses/_pdf-lib_fontkit-1.1.1.txt +326 -0
  61. package/dist/licenses/_pdf-lib_standard-fonts-1.0.0.txt +22 -0
  62. package/dist/licenses/_pdf-lib_upng-1.0.1.txt +22 -0
  63. package/dist/licenses/_types_node-14.18.63.txt +22 -0
  64. package/dist/licenses/_types_pako-2.0.3.txt +22 -0
  65. package/dist/licenses/_types_pegjs-0.10.6.txt +22 -0
  66. package/dist/licenses/archiver-5.3.2.txt +23 -0
  67. package/dist/licenses/archiver-utils-2.1.0.txt +23 -0
  68. package/dist/licenses/archiver-utils-3.0.4.txt +23 -0
  69. package/dist/licenses/async-3.2.6.txt +20 -0
  70. package/dist/licenses/balanced-match-1.0.2.txt +22 -0
  71. package/dist/licenses/base64-js-1.5.1.txt +22 -0
  72. package/dist/licenses/big-integer-1.6.52.txt +25 -0
  73. package/dist/licenses/binary-0.3.0.txt +178 -0
  74. package/dist/licenses/bl-4.1.0.txt +14 -0
  75. package/dist/licenses/bluebird-3.4.7.txt +22 -0
  76. package/dist/licenses/brace-expansion-1.1.21.txt +22 -0
  77. package/dist/licenses/brace-expansion-2.1.7.txt +22 -0
  78. package/dist/licenses/buffer-5.7.1.txt +22 -0
  79. package/dist/licenses/buffer-crc32-0.2.13.txt +20 -0
  80. package/dist/licenses/buffer-indexof-polyfill-1.0.2.txt +23 -0
  81. package/dist/licenses/buffers-0.1.1.txt +140 -0
  82. package/dist/licenses/chainsaw-0.1.0.txt +184 -0
  83. package/dist/licenses/compress-commons-4.1.2.txt +23 -0
  84. package/dist/licenses/concat-map-0.0.1.txt +19 -0
  85. package/dist/licenses/core-util-is-1.0.3.txt +20 -0
  86. package/dist/licenses/crc-32-1.2.2.txt +202 -0
  87. package/dist/licenses/crc32-stream-4.0.3.txt +23 -0
  88. package/dist/licenses/dayjs-1.11.23.txt +22 -0
  89. package/dist/licenses/duplexer2-0.1.4.txt +27 -0
  90. package/dist/licenses/end-of-stream-1.4.5.txt +22 -0
  91. package/dist/licenses/exceljs-4.4.0.txt +23 -0
  92. package/dist/licenses/fast-csv-4.3.6.txt +22 -0
  93. package/dist/licenses/fast-png-6.4.0.txt +22 -0
  94. package/dist/licenses/fs-constants-1.0.0.txt +22 -0
  95. package/dist/licenses/fs.realpath-1.0.0.txt +44 -0
  96. package/dist/licenses/fstream-1.0.12.txt +16 -0
  97. package/dist/licenses/glob-7.2.3.txt +22 -0
  98. package/dist/licenses/graceful-fs-4.2.11.txt +16 -0
  99. package/dist/licenses/ieee754-1.2.1.txt +12 -0
  100. package/dist/licenses/immediate-3.0.6.txt +21 -0
  101. package/dist/licenses/inflight-1.0.6.txt +16 -0
  102. package/dist/licenses/inherits-2.0.4.txt +17 -0
  103. package/dist/licenses/iobuffer-5.4.0.txt +23 -0
  104. package/dist/licenses/isarray-1.0.0.txt +61 -0
  105. package/dist/licenses/jszip-3.10.2.txt +652 -0
  106. package/dist/licenses/lazystream-1.0.1.txt +24 -0
  107. package/dist/licenses/lie-3.3.0.txt +8 -0
  108. package/dist/licenses/listenercount-1.0.1.txt +6 -0
  109. package/dist/licenses/lodash.defaults-4.2.0.txt +48 -0
  110. package/dist/licenses/lodash.difference-4.5.0.txt +48 -0
  111. package/dist/licenses/lodash.escaperegexp-4.1.2.txt +48 -0
  112. package/dist/licenses/lodash.flatten-4.4.0.txt +48 -0
  113. package/dist/licenses/lodash.groupby-4.6.0.txt +48 -0
  114. package/dist/licenses/lodash.isboolean-3.0.3.txt +23 -0
  115. package/dist/licenses/lodash.isequal-4.5.0.txt +48 -0
  116. package/dist/licenses/lodash.isfunction-3.0.9.txt +48 -0
  117. package/dist/licenses/lodash.isnil-4.0.0.txt +23 -0
  118. package/dist/licenses/lodash.isplainobject-4.0.6.txt +48 -0
  119. package/dist/licenses/lodash.isundefined-3.0.1.txt +23 -0
  120. package/dist/licenses/lodash.union-4.6.0.txt +48 -0
  121. package/dist/licenses/lodash.uniq-4.5.0.txt +48 -0
  122. package/dist/licenses/minimatch-3.1.5.txt +16 -0
  123. package/dist/licenses/minimatch-5.1.9.txt +16 -0
  124. package/dist/licenses/minimist-1.2.8.txt +19 -0
  125. package/dist/licenses/mkdirp-0.5.6.txt +22 -0
  126. package/dist/licenses/node-sql-parser-5.4.0.txt +202 -0
  127. package/dist/licenses/normalize-path-3.0.0.txt +22 -0
  128. package/dist/licenses/once-1.4.0.txt +16 -0
  129. package/dist/licenses/pako-1.0.11.txt +22 -0
  130. package/dist/licenses/pako-2.2.0.txt +22 -0
  131. package/dist/licenses/path-is-absolute-1.0.1.txt +22 -0
  132. package/dist/licenses/pdf-lib-1.17.1.txt +22 -0
  133. package/dist/licenses/process-nextick-args-2.0.1.txt +20 -0
  134. package/dist/licenses/readable-stream-2.3.8.txt +48 -0
  135. package/dist/licenses/readable-stream-3.6.2.txt +48 -0
  136. package/dist/licenses/readdir-glob-1.1.3.txt +202 -0
  137. package/dist/licenses/rimraf-2.7.1.txt +16 -0
  138. package/dist/licenses/safe-buffer-5.1.2.txt +22 -0
  139. package/dist/licenses/safe-buffer-5.2.1.txt +22 -0
  140. package/dist/licenses/saxes-5.0.1.txt +397 -0
  141. package/dist/licenses/setimmediate-1.0.5.txt +21 -0
  142. package/dist/licenses/string_decoder-1.1.1.txt +49 -0
  143. package/dist/licenses/string_decoder-1.3.0.txt +49 -0
  144. package/dist/licenses/tar-stream-2.2.0.txt +22 -0
  145. package/dist/licenses/tmp-0.2.7.txt +22 -0
  146. package/dist/licenses/traverse-0.3.9.txt +25 -0
  147. package/dist/licenses/tslib-1.14.1.txt +13 -0
  148. package/dist/licenses/unzipper-0.10.14.txt +26 -0
  149. package/dist/licenses/util-deprecate-1.0.2.txt +25 -0
  150. package/dist/licenses/uuid-11.1.1.txt +10 -0
  151. package/dist/licenses/wrappy-1.0.2.txt +16 -0
  152. package/dist/licenses/xmlchars-2.2.0.txt +19 -0
  153. package/dist/licenses/zip-stream-4.1.1.txt +23 -0
  154. package/dist/matrix-CGRGkn5s.js +112 -0
  155. package/dist/matrix-gEO7ZM_u.cjs +1 -0
  156. package/dist/media-B7vnpD8k.cjs +1 -0
  157. package/dist/media-Y90dHK9z.js +70 -0
  158. package/dist/param-validation-C3HlcLLO.cjs +1 -0
  159. package/dist/param-validation-Do7Eg8Zv.js +181 -0
  160. package/dist/pdf-BwNyeGpt.js +36352 -0
  161. package/dist/pdf-CvvrjPQg.cjs +103 -0
  162. package/dist/pdf.cjs +1 -101
  163. package/dist/pdf.d.cts +18 -3
  164. package/dist/pdf.d.ts +18 -3
  165. package/dist/pdf.js +9 -36579
  166. package/dist/plugin-Ca_XZG3l.js +22 -0
  167. package/dist/{plugin-DzS6pxTA.cjs → plugin-DHO7X8z2.cjs} +1 -1
  168. package/dist/prepared-CFy9B75C.cjs +1 -0
  169. package/dist/prepared-ajM-H-9B.js +69 -0
  170. package/dist/progress-B0ctFpKf.cjs +1 -0
  171. package/dist/progress-D-OTpEav.js +52 -0
  172. package/dist/{record-bindings-D-5jQlTj.js → record-bindings-Do_b3h4V.js} +1 -1
  173. package/dist/{region-binding-workflow-CcUq8W2Q.js → region-binding-workflow-BMhK_TjP.js} +1 -1
  174. package/dist/{region-binding-workflow-BzfbxRiR.cjs → region-binding-workflow-DIYJdCUr.cjs} +1 -1
  175. package/dist/{report-params-B44imUd4.js → report-params-B1RzkhJj.js} +1 -1
  176. package/dist/{report-params-SJfhKgaX.cjs → report-params-WDGrA4oP.cjs} +1 -1
  177. package/dist/sbom.cdx.json +3982 -0
  178. package/dist/server/node.d.cts +66 -12
  179. package/dist/server/node.d.ts +66 -12
  180. package/dist/server-node.cjs +1 -1
  181. package/dist/server-node.js +405 -381
  182. package/dist/server.cjs +1 -1
  183. package/dist/server.d.cts +878 -15
  184. package/dist/server.d.ts +878 -15
  185. package/dist/server.js +1034 -534
  186. package/dist/sha256-ArEYjaTI.cjs +1 -0
  187. package/dist/sha256-DPEuJ3nh.js +155 -0
  188. package/dist/style.css +1 -1
  189. package/dist/template-bindings-C2SpvsMU.js +58 -0
  190. package/dist/template-bindings-CEtWyiLX.cjs +1 -0
  191. package/dist/template-catalog-FJE_c9Qe.cjs +1 -0
  192. package/dist/template-catalog-j2B1MJlL.js +414 -0
  193. package/dist/template-fragments-BGbQLGlV.js +187 -0
  194. package/dist/template-fragments-DcKeiylI.cjs +1 -0
  195. package/dist/template-outline-BwRV_eRo.cjs +1 -0
  196. package/dist/template-outline-cnWfT_LK.js +88 -0
  197. package/dist/{template-registry-BjE1VS6g.js → template-registry-BtaKPELV.js} +364 -201
  198. package/dist/template-registry-Co1zPq5e.cjs +1 -0
  199. package/dist/textwrap-CWHyzkBH.cjs +4 -0
  200. package/dist/textwrap-DE1kgcJB.js +110 -0
  201. package/dist/{tree-CqcQ99NM.js → tree-CjVZLRw7.js} +1 -1
  202. package/dist/{useLocalDraft-C07SYRnC.js → useLocalDraft-BnhcxXk_.js} +1 -1
  203. package/dist/{useLocalDraft-Yiw1wFgI.cjs → useLocalDraft-CioIfDb6.cjs} +1 -1
  204. package/dist/vue/async.d.cts +190 -15
  205. package/dist/vue/async.d.ts +190 -15
  206. package/dist/vue/index.d.cts +274 -24
  207. package/dist/vue/index.d.ts +274 -24
  208. package/dist/vue-async.cjs +1 -1
  209. package/dist/vue-async.js +5 -5
  210. package/dist/vue.cjs +1 -1
  211. package/dist/vue.js +90 -81
  212. package/dist/{workbook-session-DNa2RHNG.cjs → workbook-session-Bjv1YCRK.cjs} +18 -18
  213. package/dist/{workbook-session-BPb3TMnT.js → workbook-session-BvToI-Fd.js} +5440 -5288
  214. package/dist/worker.cjs +1 -1
  215. package/dist/worker.d.cts +66 -12
  216. package/dist/worker.d.ts +66 -12
  217. package/dist/worker.js +61 -56
  218. package/dist/xlsx-node.cjs +34 -34
  219. package/dist/xlsx-node.js +878 -870
  220. package/dist/xlsx.cjs +3 -4
  221. package/dist/xlsx.d.cts +22 -10
  222. package/dist/xlsx.d.ts +22 -10
  223. package/dist/xlsx.js +261 -253
  224. package/package.json +2 -2
  225. package/dist/ExcelBindingWizard-CeAf4QSE.js +0 -1465
  226. package/dist/ExcelBindingWizard-y0mT-AHR.cjs +0 -1
  227. package/dist/ParamEditor-BLaE5q5W.js +0 -522
  228. package/dist/ParamEditor-MBBC7lUE.cjs +0 -1
  229. package/dist/ReportBatchPanel-Fp1ePFag.cjs +0 -1
  230. package/dist/ReportPreview-BN6fk7Wz.cjs +0 -6
  231. package/dist/ReportPreview-D2Jkyh1U.js +0 -4243
  232. package/dist/ReportTemplateLibrary-5fk5CQBO.cjs +0 -1
  233. package/dist/RuleEditor-ChRzNQuF.cjs +0 -1
  234. package/dist/RuleEditor-DzAmW5YH.js +0 -2024
  235. package/dist/TemplateReviewPanel-BKofGrV9.js +0 -222
  236. package/dist/TemplateReviewPanel-DwtOcLue.cjs +0 -1
  237. package/dist/assets-C2U-e-Sz.cjs +0 -4
  238. package/dist/assets-Q0wUwNrV.js +0 -217
  239. package/dist/batch-Bt3Fd27Z.cjs +0 -1
  240. package/dist/batch-mRqhhhjt.js +0 -364
  241. package/dist/capabilities-CK_7hizc.js +0 -63
  242. package/dist/capabilities-CsZ-pNHR.cjs +0 -1
  243. package/dist/config-Bb7RiIO5.cjs +0 -1
  244. package/dist/config-XVwG87IA.js +0 -529
  245. package/dist/matrix-DVyWiYsd.cjs +0 -1
  246. package/dist/matrix-yZsGnldA.js +0 -227
  247. package/dist/page-window-index-CIuT4BAv.js +0 -43
  248. package/dist/page-window-index-DEjnM6IB.cjs +0 -1
  249. package/dist/param-validation-BlHHXs6u.js +0 -153
  250. package/dist/param-validation-DCK039V1.cjs +0 -1
  251. package/dist/plugin-D4wizDXB.js +0 -22
  252. package/dist/progress-7OSZbFok.js +0 -39
  253. package/dist/progress-BnLiS5eH.cjs +0 -1
  254. package/dist/task-events-DQ276fn2.cjs +0 -1
  255. package/dist/task-events-Dpsvf_t2.js +0 -47
  256. package/dist/template-registry-D3SjENi6.cjs +0 -1
  257. package/dist/template-review-DGwWOoCv.cjs +0 -2
  258. package/dist/template-review-PgEe_Wr9.js +0 -1742
  259. package/dist/validate-BJ5HIWY8.cjs +0 -1
  260. package/dist/validate-DbgEM1Hh.js +0 -163
@@ -1,227 +0,0 @@
1
- import { e as N } from "./computed-Bvk0W15F.js";
2
- function g(r, e) {
3
- return Object.prototype.hasOwnProperty.call(r, e) ? r[e] : void 0;
4
- }
5
- function x(r) {
6
- if (r == null) return "null";
7
- if (typeof r != "string" && typeof r != "boolean" && !(typeof r == "number" && Number.isFinite(r)))
8
- throw new Error("交叉表维度应为字符串、布尔、有限数字或空值");
9
- return JSON.stringify([typeof r, r]);
10
- }
11
- function E(r) {
12
- return r == null ? "" : String(r);
13
- }
14
- function y(r, e) {
15
- const l = r ?? e;
16
- if (!Number.isInteger(l) || l < 1)
17
- throw new Error("交叉表预算应为正整数");
18
- return l;
19
- }
20
- function A(r, e, l, t) {
21
- const m = l ? 1 : 0;
22
- if ((r + m) * (e + 1 + m) > t)
23
- throw new Error(
24
- "交叉表输出单元格超出 maxCells 预算,请减少维度或服务端预聚合"
25
- );
26
- }
27
- function z(r, e) {
28
- if (!Array.isArray(r)) throw new Error("交叉表数据应为对象数组");
29
- const l = e.aggregate ?? "sum";
30
- if (!["sum", "count", "avg", "min", "max", "weightedAvg"].includes(l))
31
- throw new Error("未知交叉表聚合类型");
32
- if (!e.rowField || !e.columnField || l !== "count" && !e.valueField)
33
- throw new Error("交叉表需要明确的行维度、列维度和度量字段");
34
- if (r.length > y(e.maxInputRows, 1e5))
35
- throw new Error("交叉表输入超出预算,请在服务端预聚合");
36
- const t = y(e.maxRows, 1e3), m = y(e.maxColumns, 200), w = y(e.maxCells, 2e6), i = () => N({
37
- op: l,
38
- field: l === "count" && e.countMode !== "nonNull" ? void 0 : e.valueField,
39
- weightField: e.weightField,
40
- numeric: e.numeric,
41
- digits: e.digits
42
- }), c = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), h = i();
43
- for (const n of r) {
44
- const s = x(g(n, e.rowField)), o = x(g(n, e.columnField));
45
- if (c.has(o) || c.set(o, E(g(n, e.columnField))), u.has(s) || u.set(s, {
46
- label: E(g(n, e.rowField)),
47
- cells: /* @__PURE__ */ new Map(),
48
- total: i()
49
- }), c.size > m || u.size > t)
50
- throw new Error("交叉表维度数量超出预算");
51
- A(u.size, c.size, e.totals, w);
52
- const d = u.get(s);
53
- d.cells.has(o) || d.cells.set(o, i()), f.has(o) || f.set(o, i());
54
- for (const F of [
55
- d.cells.get(o),
56
- d.total,
57
- f.get(o),
58
- h
59
- ])
60
- F.add(n);
61
- }
62
- const a = {
63
- columns: [
64
- {
65
- header: e.rowHeader ?? e.rowField,
66
- field: "rowLabel",
67
- semanticRole: "dimension"
68
- },
69
- ...[...c.values()].map(
70
- (n, s) => ({
71
- header: n,
72
- field: `c${s}`,
73
- semanticRole: "measure"
74
- })
75
- )
76
- ],
77
- rows: [...u.values()].map((n) => ({
78
- rowLabel: n.label,
79
- ...Object.fromEntries(
80
- [...c.keys()].map((s, o) => [
81
- `c${o}`,
82
- n.cells.get(s)?.value() ?? (l === "count" ? 0 : null)
83
- ])
84
- ),
85
- ...e.totals ? { total: n.total.value() } : {}
86
- }))
87
- };
88
- return e.totals && (a.columns.push({
89
- header: "合计",
90
- field: "total",
91
- semanticRole: "measure"
92
- }), r.length && a.rows.push({
93
- rowLabel: "合计",
94
- ...Object.fromEntries(
95
- [...c.keys()].map((n, s) => [
96
- `c${s}`,
97
- f.get(n)?.value() ?? (l === "count" ? 0 : null)
98
- ])
99
- ),
100
- total: h.value()
101
- })), a;
102
- }
103
- function b(r, e) {
104
- const l = e.map(
105
- (t) => Object.prototype.hasOwnProperty.call(r, t) ? r[t] : null
106
- );
107
- if (l.some(
108
- (t) => t != null && typeof t != "string" && typeof t != "boolean" && !(typeof t == "number" && Number.isFinite(t))
109
- ))
110
- throw new Error("矩阵维度必须是有限 JSON 标量");
111
- return {
112
- key: JSON.stringify(l.map((t) => [typeof t, t ?? null])),
113
- label: l.map((t) => t == null ? "" : String(t)).join(" / ")
114
- };
115
- }
116
- function M(r) {
117
- for (const e of [
118
- "maxRows",
119
- "maxColumns",
120
- "maxInputRows",
121
- "maxCells"
122
- ])
123
- if (r[e] !== void 0 && (!Number.isSafeInteger(r[e]) || r[e] < 1))
124
- throw new Error("矩阵预算应为正安全整数");
125
- for (const e of ["columnWidthMm", "rowWidthMm"])
126
- if (r[e] !== void 0 && (!Number.isFinite(r[e]) || r[e] <= 0))
127
- throw new Error("矩阵列宽应为正数");
128
- }
129
- function R(r) {
130
- if (!r || !Array.isArray(r.rowFields) || !Array.isArray(r.columnFields) || !Array.isArray(r.measures))
131
- throw new Error("矩阵需要行维度、列维度和度量数组");
132
- for (const l of [r.rowFields, r.columnFields])
133
- if (l.some((t) => typeof t != "string" || !t.trim()) || new Set(l).size !== l.length)
134
- throw new Error("矩阵维度字段应非空且唯一");
135
- if (M(r), !r.rowFields.length || !r.columnFields.length || r.rowFields.length > 16 || r.columnFields.length > 16)
136
- throw new Error("矩阵需要 1–16 个行/列维度");
137
- if (!r.measures.length || r.measures.length > 32)
138
- throw new Error("矩阵需要 1–32 个度量");
139
- if (r.measures.map((l) => {
140
- if (!l || typeof l != "object") throw new Error("矩阵度量应为对象");
141
- if (N({
142
- ...l,
143
- field: l.valueField ?? l.field
144
- }), l.label !== void 0 && typeof l.label != "string")
145
- throw new Error("矩阵度量标签应为字符串");
146
- return l.field;
147
- }).some((l) => typeof l != "string" || !l.trim()))
148
- throw new Error("矩阵度量字段应非空");
149
- }
150
- function O(r, e) {
151
- if (R(e), !Array.isArray(r) || r.length > (e.maxInputRows ?? 1e5))
152
- throw new Error("矩阵输入超出预算");
153
- const l = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
154
- for (const i of r) {
155
- if (!i || typeof i != "object" || Array.isArray(i))
156
- throw new Error("矩阵数据行应为对象");
157
- if (l.add(b(i, e.rowFields).key), t.add(b(i, e.columnFields).key), l.size > (e.maxRows ?? 1e3) || t.size > (e.maxColumns ?? 200))
158
- throw new Error("矩阵维度数量超出预算");
159
- if ((l.size + +!!e.totals) * ((t.size + +!!e.totals) * e.measures.length + 1) > (e.maxCells ?? 2e6))
160
- throw new Error("矩阵输出超出 maxCells 预算");
161
- }
162
- const m = l.size + +(!!e.totals && r.length > 0), w = (t.size + +!!e.totals) * e.measures.length + 1;
163
- return { rowCount: m, columnCount: w, cells: m * w };
164
- }
165
- function C(r, e) {
166
- let l = e;
167
- for (; r.some((t) => Object.prototype.hasOwnProperty.call(t, l)); )
168
- l += "_";
169
- return l;
170
- }
171
- function S(r, e) {
172
- O(r, e);
173
- const l = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), m = C(r, "__matrix_row"), w = C(r, "__matrix_column"), i = r.map((a) => {
174
- const n = b(a, e.rowFields), s = b(a, e.columnFields);
175
- return l.set(n.key, n.label), t.set(s.key, s.label), { ...a, [m]: n.key, [w]: s.key };
176
- }), c = e.maxCells ?? 2e6;
177
- if ((l.size + +!!e.totals) * ((t.size + +!!e.totals) * e.measures.length + 1) > c)
178
- throw new Error("矩阵输出超出 maxCells 预算");
179
- const u = e.measures.map(
180
- (a) => z(i, {
181
- rowField: m,
182
- columnField: w,
183
- valueField: a.valueField ?? a.field,
184
- aggregate: a.op,
185
- countMode: "nonNull",
186
- weightField: a.weightField,
187
- numeric: a.numeric,
188
- digits: a.digits,
189
- totals: e.totals,
190
- maxRows: e.maxRows,
191
- maxColumns: e.maxColumns,
192
- maxInputRows: e.maxInputRows,
193
- maxCells: c
194
- })
195
- ), f = u[0].rows.map(
196
- (a) => ({
197
- rowLabel: l.get(String(a.rowLabel)) ?? String(a.rowLabel)
198
- })
199
- ), h = [
200
- {
201
- field: "rowLabel",
202
- header: e.rowHeader ?? e.rowFields.join(" / "),
203
- semanticRole: "dimension"
204
- }
205
- ];
206
- for (let a = 0; a < u.length; a++) {
207
- const n = u[a], s = e.measures[a];
208
- for (const o of n.columns.slice(1)) {
209
- const d = `${o.field}_${a}`;
210
- h.push({
211
- ...o,
212
- field: d,
213
- ...s.digits === void 0 ? {} : { format: { kind: "number", digits: s.digits } },
214
- header: `${t.get(o.header) ?? o.header} · ${s.label ?? `${s.field} (${s.op})`}`
215
- }), n.rows.forEach((F, k) => {
216
- f[k][d] = F[o.field];
217
- });
218
- }
219
- }
220
- return { rows: f, columns: h };
221
- }
222
- export {
223
- S as a,
224
- z as c,
225
- O as e,
226
- R as v
227
- };
@@ -1,43 +0,0 @@
1
- function c(a) {
2
- return Number.isFinite(a) ? Math.max(0, a) : 0;
3
- }
4
- function b(a, g = 0) {
5
- const n = a.length, w = c(g), o = new Array(n + 1);
6
- o[0] = 0;
7
- for (let t = 0; t < n; t++)
8
- o[t + 1] = o[t] + c(a[t] ?? 0) + w;
9
- const d = o[n];
10
- function m(t) {
11
- let i = 0, r = n - 1, s = 0;
12
- for (; i <= r; ) {
13
- const e = i + r >>> 1;
14
- o[e] <= t ? (s = e, i = e + 1) : r = e - 1;
15
- }
16
- return s;
17
- }
18
- function P(t, i, r = 1) {
19
- if (n === 0) return { start: 0, end: -1, padTopPx: 0, padBottomPx: 0 };
20
- const s = Math.floor(c(r)), e = c(i), x = m(e), p = Math.max(0, x - s), A = e + c(t);
21
- let f = x, h = n - 1, u = n - 1;
22
- for (; f <= h; ) {
23
- const l = f + h >>> 1;
24
- o[l + 1] < A ? f = l + 1 : (u = l, h = l - 1);
25
- }
26
- const M = Math.min(n - 1, u + s);
27
- return {
28
- start: p,
29
- end: M,
30
- padTopPx: o[p],
31
- padBottomPx: Math.max(0, d - o[M + 1])
32
- };
33
- }
34
- return {
35
- totalHeightPx: d,
36
- pageAt: m,
37
- offsetAt: (t) => o[Math.max(0, Math.min(n, Math.floor(t)))] ?? 0,
38
- window: P
39
- };
40
- }
41
- export {
42
- b as c
43
- };
@@ -1 +0,0 @@
1
- "use strict";function c(a){return Number.isFinite(a)?Math.max(0,a):0}function b(a,g=0){const e=a.length,w=c(g),n=new Array(e+1);n[0]=0;for(let t=0;t<e;t++)n[t+1]=n[t]+c(a[t]??0)+w;const h=n[e];function m(t){let i=0,r=e-1,s=0;for(;i<=r;){const o=i+r>>>1;n[o]<=t?(s=o,i=o+1):r=o-1}return s}function P(t,i,r=1){if(e===0)return{start:0,end:-1,padTopPx:0,padBottomPx:0};const s=Math.floor(c(r)),o=c(i),x=m(o),u=Math.max(0,x-s),A=o+c(t);let d=x,f=e-1,p=e-1;for(;d<=f;){const l=d+f>>>1;n[l+1]<A?d=l+1:(p=l,f=l-1)}const M=Math.min(e-1,p+s);return{start:u,end:M,padTopPx:n[u],padBottomPx:Math.max(0,h-n[M+1])}}return{totalHeightPx:h,pageAt:m,offsetAt:t=>n[Math.max(0,Math.min(e,Math.floor(t)))]??0,window:P}}exports.createPageWindowIndex=b;
@@ -1,153 +0,0 @@
1
- function u(t) {
2
- if (!/^\d{4}-\d{2}-\d{2}$/.test(t) || t.startsWith("0000-")) return !1;
3
- const e = /* @__PURE__ */ new Date(`${t}T00:00:00.000Z`);
4
- return Number.isFinite(e.getTime()) && e.toISOString().slice(0, 10) === t;
5
- }
6
- function c(t) {
7
- return t.length === 4 && /^\d{4}$/.test(t) && t !== "0000";
8
- }
9
- function f(t) {
10
- return t.length === 7 && /^\d{4}-(?:0[1-9]|1[0-2])$/.test(t) && c(t.slice(0, 4));
11
- }
12
- function h(t) {
13
- const [e, r, n] = t.split("/");
14
- if (!(n !== void 0 || !e || !r || !u(e) || !u(r) || e > r))
15
- return { start: e, end: r };
16
- }
17
- function O(t) {
18
- const e = `${t.start}/${t.end}`;
19
- if (!h(e)) throw new RangeError("日期范围必须为完整且有序的 YYYY-MM-DD/YYYY-MM-DD");
20
- return e;
21
- }
22
- function x(t, e) {
23
- return typeof e != "string" ? !1 : t === "month" ? f(e) : t === "year" ? c(e) : (t === "date" || t === "dateRange") && u(e);
24
- }
25
- function $(t, e) {
26
- if (t === "date" && !u(e)) return "应为有效的 YYYY-MM-DD 日期";
27
- if (t === "month" && !f(e)) return "应为有效的 YYYY-MM 月份";
28
- if (t === "year" && !c(e)) return "应为 0001 至 9999 的四位年份";
29
- if (t === "dateRange" && !h(e)) return "应为完整且有序的 YYYY-MM-DD/YYYY-MM-DD 日期范围";
30
- }
31
- class g extends Error {
32
- constructor(e) {
33
- super(e.map((r) => `${r.field}: ${r.message}`).join("; ")), this.issues = e, this.code = "params", this.name = "ReportParamValidationError";
34
- }
35
- }
36
- function y(t) {
37
- return /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(t) && Number.isFinite(Number(t));
38
- }
39
- function b(t, e) {
40
- if (t.type === "number" && !y(e)) return [["type", "应为有限数字"]];
41
- const r = $(t.type, e);
42
- if (r) return [["type", r]];
43
- const n = [];
44
- t.type === "select" && t.options && !t.options.some((i) => i.value === e) && n.push(["option", "不在允许的选项中"]);
45
- const s = Array.from(e).length;
46
- return t.minLength !== void 0 && s < t.minLength && n.push(["minLength", `至少 ${t.minLength} 个字符`]), t.maxLength !== void 0 && s > t.maxLength && n.push(["maxLength", `最多 ${t.maxLength} 个字符`]), n.push(...Y(t, e)), n;
47
- }
48
- function Y(t, e) {
49
- const r = t.type === "dateRange" ? h(e) : void 0, n = r?.start ?? (t.type === "number" ? Number(e) : e), s = r?.end ?? n, i = [];
50
- return t.min !== void 0 && n < t.min && i.push(["minimum", `不能小于 ${t.min}`]), t.max !== void 0 && s > t.max && i.push(["maximum", `不能大于 ${t.max}`]), i;
51
- }
52
- function v(t) {
53
- const e = [];
54
- for (const s of ["min", "max"]) {
55
- const i = t[s];
56
- if (i === void 0) continue;
57
- x(t.type, i) || t.type === "number" && typeof i == "number" && Number.isFinite(i) || e.push(`${s} 应为数字的有限边界或日期/月/年的规范字符串边界`);
58
- }
59
- const r = typeof t.min == "number" && typeof t.max == "number" && t.min > t.max, n = typeof t.min == "string" && typeof t.max == "string" && t.min > t.max;
60
- return (r || n) && e.push("最小边界不能大于最大边界"), [...e, ...L(t)];
61
- }
62
- function L(t) {
63
- const e = [];
64
- t.type === "number" && (t.minLength !== void 0 || t.maxLength !== void 0) && e.push("number 参数使用 min/max 而不是文本长度约束");
65
- for (const r of ["minLength", "maxLength"]) {
66
- const n = t[r];
67
- n !== void 0 && (!Number.isSafeInteger(n) || n < 0) && e.push(`${r} 应为非负整数`);
68
- }
69
- return typeof t.minLength == "number" && typeof t.maxLength == "number" && t.minLength > t.maxLength && e.push("最小长度不能大于最大长度"), e;
70
- }
71
- function d(t) {
72
- if (!Array.isArray(t)) return [{ code: "definition", field: "", path: "$.paramDefs", message: "参数定义应为数组" }];
73
- const e = /* @__PURE__ */ new Set();
74
- return t.flatMap((r, n) => {
75
- const s = r && typeof r.field == "string" ? r.field : "";
76
- return V(r, e).map((o) => ({ code: "definition", field: s, path: `$.paramDefs.${n}`, message: o }));
77
- });
78
- }
79
- function R(t) {
80
- return Array.isArray(t) && t.every((e) => !!e && typeof e == "object" && typeof e.value == "string" && typeof e.label == "string");
81
- }
82
- function D(t) {
83
- const e = [];
84
- return t.type !== void 0 && !["text", "number", "date", "month", "year", "dateRange", "select"].includes(t.type) && e.push("未知参数类型"), t.label !== void 0 && typeof t.label != "string" && e.push("参数标签应为字符串"), t.placeholder !== void 0 && typeof t.placeholder != "string" && e.push("提示文字应为字符串"), t.required !== void 0 && typeof t.required != "boolean" && e.push("required 应为布尔值"), t.defaultValue !== void 0 && typeof t.defaultValue != "string" && e.push("默认值应为字符串"), t.options !== void 0 && !R(t.options) && e.push("选项应为包含字符串 label/value 的数组"), e;
85
- }
86
- function V(t, e) {
87
- if (!t || typeof t != "object" || Array.isArray(t)) return ["参数定义项应为对象"];
88
- const r = D(t);
89
- return typeof t.field != "string" || !t.field.trim() || e.has(t.field) ? r.push("参数名应为非空且不重复的字符串") : e.add(t.field), r.length || (r.push(...v(t)), r.length) || (t.options && new Set(t.options.map((n) => n.value)).size !== t.options.length && r.push("选项值不能重复"), t.defaultValue !== void 0 && (t.required && !t.defaultValue.trim() ? r.push("必填参数的默认值不能为空") : t.defaultValue.trim() && r.push(...b(t, t.defaultValue).map(([, n]) => `默认值${n}`)))), r;
90
- }
91
- function w(t, e, r) {
92
- for (const [n, s] of Object.entries(t))
93
- (typeof s == "string" || typeof s == "number" && Number.isFinite(s)) && (Object.defineProperty(e, n, { value: String(s), writable: !0, enumerable: !0, configurable: !0 }), Object.defineProperty(r, n, { value: s, writable: !0, enumerable: !0, configurable: !0 }));
94
- }
95
- function M(t) {
96
- return t == null || typeof t == "string" && !t.trim();
97
- }
98
- function j(t, e = {}) {
99
- const r = /* @__PURE__ */ Object.create(null), n = /* @__PURE__ */ Object.create(null), s = d(t);
100
- if ((!e || typeof e != "object" || Array.isArray(e)) && s.push({ code: "type", field: "", path: "$.params", message: "参数应为对象" }), s.length) return { ok: !1, values: r, typedValues: n, issues: s };
101
- w(e, r, n);
102
- for (const i of t) {
103
- const o = Object.prototype.hasOwnProperty.call(e, i.field) && e[i.field] !== void 0 ? e[i.field] : i.defaultValue, m = (p, l) => s.push({ code: p, path: `$.params.${i.field}`, field: i.field, message: l });
104
- if (M(o)) {
105
- i.required && m("required", "此参数为必填项"), typeof o == "string" && (r[i.field] = o), delete n[i.field];
106
- continue;
107
- }
108
- if (typeof o != "string" && !(typeof o == "number" && Number.isFinite(o))) {
109
- m("type", "参数应为字符串或有限数字");
110
- continue;
111
- }
112
- const a = String(o);
113
- r[i.field] = a, b(i, a).forEach(([p, l]) => m(p, l)), n[i.field] = i.type === "number" && y(a) ? Number(a) : a;
114
- }
115
- return { ok: s.length === 0, values: r, typedValues: n, issues: s };
116
- }
117
- function P(t, e = {}) {
118
- const r = j(t, e);
119
- if (!r.ok) throw new g(r.issues);
120
- return r.values;
121
- }
122
- function N(t) {
123
- const e = {}, r = "(?![\\s\\S])";
124
- return t.type === "date" && (e.format = "date"), t.type === "month" && (e.pattern = `^(?!0000)[0-9]{4}-(0[1-9]|1[0-2])${r}`), t.type === "year" && (e.pattern = `^(?!0000)[0-9]{4}${r}`), t.type === "dateRange" && (e.pattern = `^[0-9]{4}-[0-9]{2}-[0-9]{2}/[0-9]{4}-[0-9]{2}-[0-9]{2}${r}`), t.type === "dateRange" && (e["x-report-date-range"] = { separator: "/", ordered: !0, calendarDates: !0 }), e;
125
- }
126
- function S(t) {
127
- const e = { type: t.type === "number" ? "number" : "string", title: t.label ?? t.field, ...N(t) };
128
- return t.required && t.type !== "number" && !e.pattern && (e.pattern = "\\S"), t.type === "select" && t.options && (e.enum = t.options.map((r) => r.value)), t.defaultValue !== void 0 && (t.type !== "number" || t.defaultValue.trim()) && (e.default = t.type === "number" ? Number(t.defaultValue) : t.defaultValue), t.minLength !== void 0 && (e.minLength = t.minLength), t.maxLength !== void 0 && (e.maxLength = t.maxLength), typeof t.min == "number" && (e.minimum = t.min), typeof t.max == "number" && (e.maximum = t.max), typeof t.min == "string" && (e["x-report-minimum"] = t.min), typeof t.max == "string" && (e["x-report-maximum"] = t.max), e;
129
- }
130
- function q(t) {
131
- const e = d(t);
132
- if (e.length) throw new g(e);
133
- return {
134
- $schema: "https://json-schema.org/draft/2020-12/schema",
135
- type: "object",
136
- properties: Object.fromEntries(t.map((r) => [r.field, S(r)])),
137
- required: t.filter((r) => r.required).map((r) => r.field),
138
- additionalProperties: !0
139
- };
140
- }
141
- export {
142
- g as R,
143
- P as a,
144
- f as b,
145
- c,
146
- j as d,
147
- x as e,
148
- O as f,
149
- u as i,
150
- h as p,
151
- q as r,
152
- d as v
153
- };
@@ -1 +0,0 @@
1
- "use strict";function u(t){if(!/^\d{4}-\d{2}-\d{2}$/.test(t)||t.startsWith("0000-"))return!1;const e=new Date(`${t}T00:00:00.000Z`);return Number.isFinite(e.getTime())&&e.toISOString().slice(0,10)===t}function m(t){return t.length===4&&/^\d{4}$/.test(t)&&t!=="0000"}function f(t){return t.length===7&&/^\d{4}-(?:0[1-9]|1[0-2])$/.test(t)&&m(t.slice(0,4))}function p(t){const[e,r,n]=t.split("/");if(!(n!==void 0||!e||!r||!u(e)||!u(r)||e>r))return{start:e,end:r}}function Y(t){const e=`${t.start}/${t.end}`;if(!p(e))throw new RangeError("日期范围必须为完整且有序的 YYYY-MM-DD/YYYY-MM-DD");return e}function b(t,e){return typeof e!="string"?!1:t==="month"?f(e):t==="year"?m(e):(t==="date"||t==="dateRange")&&u(e)}function $(t,e){if(t==="date"&&!u(e))return"应为有效的 YYYY-MM-DD 日期";if(t==="month"&&!f(e))return"应为有效的 YYYY-MM 月份";if(t==="year"&&!m(e))return"应为 0001 至 9999 的四位年份";if(t==="dateRange"&&!p(e))return"应为完整且有序的 YYYY-MM-DD/YYYY-MM-DD 日期范围"}class g extends Error{constructor(e){super(e.map(r=>`${r.field}: ${r.message}`).join("; ")),this.issues=e,this.code="params",this.name="ReportParamValidationError"}}function d(t){return/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(t)&&Number.isFinite(Number(t))}function x(t,e){if(t.type==="number"&&!d(e))return[["type","应为有限数字"]];const r=$(t.type,e);if(r)return[["type",r]];const n=[];t.type==="select"&&t.options&&!t.options.some(i=>i.value===e)&&n.push(["option","不在允许的选项中"]);const o=Array.from(e).length;return t.minLength!==void 0&&o<t.minLength&&n.push(["minLength",`至少 ${t.minLength} 个字符`]),t.maxLength!==void 0&&o>t.maxLength&&n.push(["maxLength",`最多 ${t.maxLength} 个字符`]),n.push(...v(t,e)),n}function v(t,e){const r=t.type==="dateRange"?p(e):void 0,n=r?.start??(t.type==="number"?Number(e):e),o=r?.end??n,i=[];return t.min!==void 0&&n<t.min&&i.push(["minimum",`不能小于 ${t.min}`]),t.max!==void 0&&o>t.max&&i.push(["maximum",`不能大于 ${t.max}`]),i}function D(t){const e=[];for(const o of["min","max"]){const i=t[o];if(i===void 0)continue;b(t.type,i)||t.type==="number"&&typeof i=="number"&&Number.isFinite(i)||e.push(`${o} 应为数字的有限边界或日期/月/年的规范字符串边界`)}const r=typeof t.min=="number"&&typeof t.max=="number"&&t.min>t.max,n=typeof t.min=="string"&&typeof t.max=="string"&&t.min>t.max;return(r||n)&&e.push("最小边界不能大于最大边界"),[...e,...L(t)]}function L(t){const e=[];t.type==="number"&&(t.minLength!==void 0||t.maxLength!==void 0)&&e.push("number 参数使用 min/max 而不是文本长度约束");for(const r of["minLength","maxLength"]){const n=t[r];n!==void 0&&(!Number.isSafeInteger(n)||n<0)&&e.push(`${r} 应为非负整数`)}return typeof t.minLength=="number"&&typeof t.maxLength=="number"&&t.minLength>t.maxLength&&e.push("最小长度不能大于最大长度"),e}function y(t){if(!Array.isArray(t))return[{code:"definition",field:"",path:"$.paramDefs",message:"参数定义应为数组"}];const e=new Set;return t.flatMap((r,n)=>{const o=r&&typeof r.field=="string"?r.field:"";return P(r,e).map(s=>({code:"definition",field:o,path:`$.paramDefs.${n}`,message:s}))})}function V(t){return Array.isArray(t)&&t.every(e=>!!e&&typeof e=="object"&&typeof e.value=="string"&&typeof e.label=="string")}function M(t){const e=[];return t.type!==void 0&&!["text","number","date","month","year","dateRange","select"].includes(t.type)&&e.push("未知参数类型"),t.label!==void 0&&typeof t.label!="string"&&e.push("参数标签应为字符串"),t.placeholder!==void 0&&typeof t.placeholder!="string"&&e.push("提示文字应为字符串"),t.required!==void 0&&typeof t.required!="boolean"&&e.push("required 应为布尔值"),t.defaultValue!==void 0&&typeof t.defaultValue!="string"&&e.push("默认值应为字符串"),t.options!==void 0&&!V(t.options)&&e.push("选项应为包含字符串 label/value 的数组"),e}function P(t,e){if(!t||typeof t!="object"||Array.isArray(t))return["参数定义项应为对象"];const r=M(t);return typeof t.field!="string"||!t.field.trim()||e.has(t.field)?r.push("参数名应为非空且不重复的字符串"):e.add(t.field),r.length||(r.push(...D(t)),r.length)||(t.options&&new Set(t.options.map(n=>n.value)).size!==t.options.length&&r.push("选项值不能重复"),t.defaultValue!==void 0&&(t.required&&!t.defaultValue.trim()?r.push("必填参数的默认值不能为空"):t.defaultValue.trim()&&r.push(...x(t,t.defaultValue).map(([,n])=>`默认值${n}`)))),r}function w(t,e,r){for(const[n,o]of Object.entries(t))(typeof o=="string"||typeof o=="number"&&Number.isFinite(o))&&(Object.defineProperty(e,n,{value:String(o),writable:!0,enumerable:!0,configurable:!0}),Object.defineProperty(r,n,{value:o,writable:!0,enumerable:!0,configurable:!0}))}function j(t){return t==null||typeof t=="string"&&!t.trim()}function R(t,e={}){const r=Object.create(null),n=Object.create(null),o=y(t);if((!e||typeof e!="object"||Array.isArray(e))&&o.push({code:"type",field:"",path:"$.params",message:"参数应为对象"}),o.length)return{ok:!1,values:r,typedValues:n,issues:o};w(e,r,n);for(const i of t){const s=Object.prototype.hasOwnProperty.call(e,i.field)&&e[i.field]!==void 0?e[i.field]:i.defaultValue,l=(c,h)=>o.push({code:c,path:`$.params.${i.field}`,field:i.field,message:h});if(j(s)){i.required&&l("required","此参数为必填项"),typeof s=="string"&&(r[i.field]=s),delete n[i.field];continue}if(typeof s!="string"&&!(typeof s=="number"&&Number.isFinite(s))){l("type","参数应为字符串或有限数字");continue}const a=String(s);r[i.field]=a,x(i,a).forEach(([c,h])=>l(c,h)),n[i.field]=i.type==="number"&&d(a)?Number(a):a}return{ok:o.length===0,values:r,typedValues:n,issues:o}}function S(t,e={}){const r=R(t,e);if(!r.ok)throw new g(r.issues);return r.values}function N(t){const e={},r="(?![\\s\\S])";return t.type==="date"&&(e.format="date"),t.type==="month"&&(e.pattern=`^(?!0000)[0-9]{4}-(0[1-9]|1[0-2])${r}`),t.type==="year"&&(e.pattern=`^(?!0000)[0-9]{4}${r}`),t.type==="dateRange"&&(e.pattern=`^[0-9]{4}-[0-9]{2}-[0-9]{2}/[0-9]{4}-[0-9]{2}-[0-9]{2}${r}`),t.type==="dateRange"&&(e["x-report-date-range"]={separator:"/",ordered:!0,calendarDates:!0}),e}function I(t){const e={type:t.type==="number"?"number":"string",title:t.label??t.field,...N(t)};return t.required&&t.type!=="number"&&!e.pattern&&(e.pattern="\\S"),t.type==="select"&&t.options&&(e.enum=t.options.map(r=>r.value)),t.defaultValue!==void 0&&(t.type!=="number"||t.defaultValue.trim())&&(e.default=t.type==="number"?Number(t.defaultValue):t.defaultValue),t.minLength!==void 0&&(e.minLength=t.minLength),t.maxLength!==void 0&&(e.maxLength=t.maxLength),typeof t.min=="number"&&(e.minimum=t.min),typeof t.max=="number"&&(e.maximum=t.max),typeof t.min=="string"&&(e["x-report-minimum"]=t.min),typeof t.max=="string"&&(e["x-report-maximum"]=t.max),e}function O(t){const e=y(t);if(e.length)throw new g(e);return{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:Object.fromEntries(t.map(r=>[r.field,I(r)])),required:t.filter(r=>r.required).map(r=>r.field),additionalProperties:!0}}exports.ReportParamValidationError=g;exports.assertReportParams=S;exports.formatReportDateRange=Y;exports.isReportDate=u;exports.isReportMonth=f;exports.isReportTemporalBound=b;exports.isReportYear=m;exports.parseReportDateRange=p;exports.reportParamsJsonSchema=O;exports.validateReportParamDefinitions=y;exports.validateReportParams=R;
@@ -1,22 +0,0 @@
1
- import { defineAsyncComponent as c, computed as m } from "vue";
2
- import { b as i, c as l, a as d } from "./injection-keys-e85udZCp.js";
3
- import { g as s } from "./report-params-B44imUd4.js";
4
- const p = c(() => import("./ReportPreview-D2Jkyh1U.js").then((r) => r.o)), _ = {
5
- install(r, e = {}) {
6
- let t = e.fetcher;
7
- if (!t && e.reports) {
8
- const o = e.reports;
9
- let n;
10
- t = async (f) => (n ??= import("@agile-team/mach-report").then(({ createReportSource: a }) => a(o)), (await n)(f)), t.getParamDefs = (f) => s(o, f);
11
- }
12
- t && r.provide(i, t), e.pdfExporter && r.provide(l, e.pdfExporter), r.provide(d, m(() => {
13
- if (e.pdfFontUrl === void 0) return e.config ?? null;
14
- const o = e.config ?? { defaults: {}, presets: {} };
15
- return { ...o, defaults: { ...o.defaults, pdfFontUrl: e.pdfFontUrl } };
16
- })), e.globalComponent !== !1 && !r.component("MachReportPreview") && r.component("MachReportPreview", p);
17
- }
18
- };
19
- export {
20
- p as M,
21
- _ as m
22
- };
@@ -1,39 +0,0 @@
1
- function i(r) {
2
- if (r?.aborted) throw r.reason ?? new DOMException("The operation was aborted.", "AbortError");
3
- }
4
- function c(r, t, e) {
5
- i(r.signal);
6
- try {
7
- r.onProgress?.(t, e);
8
- } catch {
9
- }
10
- i(r.signal);
11
- }
12
- function b(r, t) {
13
- const e = Promise.resolve(r);
14
- return t?.aborted ? (e.catch(() => {
15
- }), Promise.reject(t.reason ?? new DOMException("The operation was aborted.", "AbortError"))) : t ? new Promise((o, u) => {
16
- const n = () => t.removeEventListener("abort", a), a = () => {
17
- n(), u(t.reason ?? new DOMException("The operation was aborted.", "AbortError"));
18
- };
19
- t.addEventListener("abort", a, { once: !0 }), e.then((s) => {
20
- n(), o(s);
21
- }, (s) => {
22
- n(), u(s);
23
- }), t.aborted && a();
24
- }) : e;
25
- }
26
- function f(r, t) {
27
- const e = () => t.abort(r?.reason);
28
- return r?.addEventListener("abort", e, { once: !0 }), r?.aborted && e(), () => r?.removeEventListener("abort", e);
29
- }
30
- async function d(r, t, e) {
31
- c(r, t, e), (r.signal || r.onProgress) && await new Promise((o) => setTimeout(o, 0)), i(r.signal);
32
- }
33
- export {
34
- i as a,
35
- f,
36
- c as n,
37
- d as o,
38
- b as w
39
- };
@@ -1 +0,0 @@
1
- "use strict";function o(t){if(t?.aborted)throw t.reason??new DOMException("The operation was aborted.","AbortError")}function c(t,r,e){o(t.signal);try{t.onProgress?.(r,e)}catch{}o(t.signal)}function b(t,r){const e=Promise.resolve(t);return r?.aborted?(e.catch(()=>{}),Promise.reject(r.reason??new DOMException("The operation was aborted.","AbortError"))):r?new Promise((n,s)=>{const a=()=>r.removeEventListener("abort",u),u=()=>{a(),s(r.reason??new DOMException("The operation was aborted.","AbortError"))};r.addEventListener("abort",u,{once:!0}),e.then(i=>{a(),n(i)},i=>{a(),s(i)}),r.aborted&&u()}):e}function f(t,r){const e=()=>r.abort(t?.reason);return t?.addEventListener("abort",e,{once:!0}),t?.aborted&&e(),()=>t?.removeEventListener("abort",e)}async function d(t,r,e){c(t,r,e),(t.signal||t.onProgress)&&await new Promise(n=>setTimeout(n,0)),o(t.signal)}exports.assertOutputActive=o;exports.forwardOutputAbort=f;exports.notifyOutputProgress=c;exports.outputCheckpoint=d;exports.waitForOutput=b;
@@ -1 +0,0 @@
1
- "use strict";let i=0;function d(){return`report-${Date.now()}-${++i}`}function s(e,a,o){if(!o?.aborted)try{const r=e?.({...a});r&&typeof r.then=="function"&&Promise.resolve(r).catch(()=>{})}catch{}}function l(e){const a=e.taskId??d(),o=(r,n,t)=>{s(e.onEvent,{taskId:a,...e.correlationId===void 0?{}:{correlationId:e.correlationId},stage:r,status:n,...t===void 0?{}:{reportId:t}},e.signal)};return{taskId:a,progress(r,n,t){s(e.onEvent,{taskId:a,...e.correlationId===void 0?{}:{correlationId:e.correlationId},stage:r,status:"started",completed:n,total:t},e.signal)},async run(r,n,t){o(r,"started",t);try{const c=await n();return o(r,"completed",t),c}catch(c){throw o(r,"failed",t),c}},runSync(r,n,t){o(r,"started",t);try{const c=n();return o(r,"completed",t),c}catch(c){throw o(r,"failed",t),c}}}}exports.createReportTaskReporter=l;exports.notifyReportTaskEvent=s;exports.reportTaskId=d;
@@ -1,47 +0,0 @@
1
- let d = 0;
2
- function i() {
3
- return `report-${Date.now()}-${++d}`;
4
- }
5
- function s(e, a, o) {
6
- if (!o?.aborted)
7
- try {
8
- const r = e?.({ ...a });
9
- r && typeof r.then == "function" && Promise.resolve(r).catch(() => {
10
- });
11
- } catch {
12
- }
13
- }
14
- function l(e) {
15
- const a = e.taskId ?? i(), o = (r, n, t) => {
16
- s(e.onEvent, { taskId: a, ...e.correlationId === void 0 ? {} : { correlationId: e.correlationId }, stage: r, status: n, ...t === void 0 ? {} : { reportId: t } }, e.signal);
17
- };
18
- return {
19
- taskId: a,
20
- progress(r, n, t) {
21
- s(e.onEvent, { taskId: a, ...e.correlationId === void 0 ? {} : { correlationId: e.correlationId }, stage: r, status: "started", completed: n, total: t }, e.signal);
22
- },
23
- async run(r, n, t) {
24
- o(r, "started", t);
25
- try {
26
- const c = await n();
27
- return o(r, "completed", t), c;
28
- } catch (c) {
29
- throw o(r, "failed", t), c;
30
- }
31
- },
32
- runSync(r, n, t) {
33
- o(r, "started", t);
34
- try {
35
- const c = n();
36
- return o(r, "completed", t), c;
37
- } catch (c) {
38
- throw o(r, "failed", t), c;
39
- }
40
- }
41
- };
42
- }
43
- export {
44
- l as c,
45
- s as n,
46
- i as r
47
- };
@@ -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;