@agile-team/mach-report 2.14.0 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/README.md +16 -11
  2. package/THIRD_PARTY_NOTICES.md +3 -1
  3. package/dist/{ExcelBindingWizard-CvsWR8Ga.js → ExcelBindingWizard-BKH1nGNS.js} +3 -3
  4. package/dist/{ExcelBindingWizard-CLT2p7P3.cjs → ExcelBindingWizard-Bs43BGNp.cjs} +1 -1
  5. package/dist/ParamEditor-Da4akw6V.cjs +1 -0
  6. package/dist/ParamEditor-DoAhzJsm.js +594 -0
  7. package/dist/{ReportBatchPanel-LqVgiqp7.js → ReportBatchPanel-BMf6boMA.js} +39 -39
  8. package/dist/{ReportBatchPanel-DkxTzBkD.cjs → ReportBatchPanel-wP9m9Pj1.cjs} +1 -1
  9. package/dist/ReportPreview-ChV19HBp.js +4619 -0
  10. package/dist/ReportPreview-DbLvvOUT.cjs +6 -0
  11. package/dist/{ReportTemplateLibrary-MjWEtc7X.js → ReportTemplateLibrary-C9wutIiT.js} +1 -1
  12. package/dist/{ReportTemplateLibrary-cQ1sqNYo.cjs → ReportTemplateLibrary-Sxr3eD0J.cjs} +1 -1
  13. package/dist/{RuleEditor-ChuXMlei.js → RuleEditor-C_Clasvd.js} +5 -5
  14. package/dist/{RuleEditor-BaR6xUiI.cjs → RuleEditor-XhGHK8DE.cjs} +1 -1
  15. package/dist/{TemplateOutlinePanel-Dci6aRn1.js → TemplateOutlinePanel-D6Bkny59.js} +2 -2
  16. package/dist/{TemplateOutlinePanel-BHKP89Xz.cjs → TemplateOutlinePanel-JTSR53vJ.cjs} +1 -1
  17. package/dist/{TemplateReusePanel-CY5eO2Sh.cjs → TemplateReusePanel-Kx35S0Ql.cjs} +1 -1
  18. package/dist/{TemplateReusePanel-B7Gmyc1z.js → TemplateReusePanel-rVuK1kTz.js} +2 -2
  19. package/dist/{TemplateReviewPanel-DjlX3xpt.js → TemplateReviewPanel-B0ar9_zf.js} +2 -2
  20. package/dist/{TemplateReviewPanel-JvZe9_4G.cjs → TemplateReviewPanel-Dn6X9UmY.cjs} +1 -1
  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 -1
  44. package/dist/designer.d.cts +144 -16
  45. package/dist/designer.d.ts +144 -16
  46. package/dist/designer.js +1 -1
  47. package/dist/drill-ByJviLXS.js +145 -0
  48. package/dist/drill-DYTxuL3A.cjs +1 -0
  49. package/dist/{font-loader-vhCT8znW.cjs → font-loader-B_UkxpzC.cjs} +1 -1
  50. package/dist/{font-loader-DHto6Lra.js → font-loader-Q3bQjmrI.js} +1 -1
  51. package/dist/index.cjs +8 -8
  52. package/dist/index.d.cts +82 -4
  53. package/dist/index.d.ts +82 -4
  54. package/dist/index.js +785 -820
  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-8UPQebOE.js → pdf-BwNyeGpt.js} +4385 -4321
  161. package/dist/{pdf-AyJGb22z.cjs → pdf-CvvrjPQg.cjs} +51 -49
  162. package/dist/pdf.cjs +1 -1
  163. package/dist/pdf.d.cts +18 -3
  164. package/dist/pdf.d.ts +18 -3
  165. package/dist/pdf.js +2 -2
  166. package/dist/{plugin-BGKf-Tqg.js → plugin-Ca_XZG3l.js} +2 -2
  167. package/dist/{plugin-CktLH_Iy.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-By_UKZ2g.cjs +1 -0
  173. package/dist/record-bindings-Do_b3h4V.js +196 -0
  174. package/dist/{region-binding-workflow-DEJbhpCv.js → region-binding-workflow-BMhK_TjP.js} +1 -1
  175. package/dist/{region-binding-workflow-BzfbxRiR.cjs → region-binding-workflow-DIYJdCUr.cjs} +1 -1
  176. package/dist/{report-params-B44imUd4.js → report-params-B1RzkhJj.js} +1 -1
  177. package/dist/{report-params-SJfhKgaX.cjs → report-params-WDGrA4oP.cjs} +1 -1
  178. package/dist/sbom.cdx.json +3982 -0
  179. package/dist/server/node.d.cts +20 -1
  180. package/dist/server/node.d.ts +20 -1
  181. package/dist/server-node.cjs +1 -1
  182. package/dist/server-node.js +247 -237
  183. package/dist/server.cjs +1 -1
  184. package/dist/server.d.cts +772 -4
  185. package/dist/server.d.ts +772 -4
  186. package/dist/server.js +885 -645
  187. package/dist/sha256-ArEYjaTI.cjs +1 -0
  188. package/dist/sha256-DPEuJ3nh.js +155 -0
  189. package/dist/style.css +1 -1
  190. package/dist/template-bindings-C2SpvsMU.js +58 -0
  191. package/dist/template-bindings-CEtWyiLX.cjs +1 -0
  192. package/dist/template-catalog-FJE_c9Qe.cjs +1 -0
  193. package/dist/template-catalog-j2B1MJlL.js +414 -0
  194. package/dist/{template-fragments-CLkGo6To.js → template-fragments-BGbQLGlV.js} +21 -21
  195. package/dist/{template-fragments-DFUpq5QM.cjs → template-fragments-DcKeiylI.cjs} +1 -1
  196. package/dist/{template-outline-B3xVkzSv.cjs → template-outline-BwRV_eRo.cjs} +1 -1
  197. package/dist/{template-outline-CFenM1PV.js → template-outline-cnWfT_LK.js} +3 -3
  198. package/dist/{template-registry-COXDEJEM.js → template-registry-BtaKPELV.js} +364 -201
  199. package/dist/template-registry-Co1zPq5e.cjs +1 -0
  200. package/dist/textwrap-CWHyzkBH.cjs +4 -0
  201. package/dist/textwrap-DE1kgcJB.js +110 -0
  202. package/dist/{tree-CqcQ99NM.js → tree-CjVZLRw7.js} +1 -1
  203. package/dist/vue/async.d.cts +123 -14
  204. package/dist/vue/async.d.ts +123 -14
  205. package/dist/vue/index.d.cts +158 -22
  206. package/dist/vue/index.d.ts +158 -22
  207. package/dist/vue-async.cjs +1 -1
  208. package/dist/vue-async.js +3 -3
  209. package/dist/vue.cjs +1 -1
  210. package/dist/vue.js +80 -78
  211. package/dist/{workbook-session-DNa2RHNG.cjs → workbook-session-Bjv1YCRK.cjs} +18 -18
  212. package/dist/{workbook-session-BfK1yHOO.js → workbook-session-BvToI-Fd.js} +5440 -5288
  213. package/dist/worker.cjs +1 -1
  214. package/dist/worker.d.cts +20 -1
  215. package/dist/worker.d.ts +20 -1
  216. package/dist/worker.js +33 -32
  217. package/dist/xlsx-node.cjs +34 -34
  218. package/dist/xlsx-node.js +878 -870
  219. package/dist/xlsx.cjs +3 -4
  220. package/dist/xlsx.d.cts +22 -10
  221. package/dist/xlsx.d.ts +22 -10
  222. package/dist/xlsx.js +261 -253
  223. package/package.json +2 -2
  224. package/dist/ParamEditor-CflQV3eQ.js +0 -526
  225. package/dist/ParamEditor-vIDzvpPV.cjs +0 -1
  226. package/dist/ReportPreview-CvbqLUzM.cjs +0 -6
  227. package/dist/ReportPreview-D_ywJ_-H.js +0 -4533
  228. package/dist/assets-C2U-e-Sz.cjs +0 -4
  229. package/dist/assets-Q0wUwNrV.js +0 -217
  230. package/dist/batch-DzaTNLWI.js +0 -371
  231. package/dist/batch-xMkqYiTr.cjs +0 -1
  232. package/dist/capabilities-CK_7hizc.js +0 -63
  233. package/dist/capabilities-CsZ-pNHR.cjs +0 -1
  234. package/dist/config-0UIohTS7.cjs +0 -1
  235. package/dist/config-Dt9NtCPl.js +0 -566
  236. package/dist/data-explanation-BktvER5B.cjs +0 -1
  237. package/dist/data-explanation-C_J6jYNi.js +0 -16
  238. package/dist/designer-Ci1LizA9.js +0 -5020
  239. package/dist/designer-rtmVIIdN.cjs +0 -2
  240. package/dist/json-snapshot-BeFT3Tso.js +0 -1952
  241. package/dist/json-snapshot-D1NTP2oI.cjs +0 -2
  242. package/dist/matrix-DVyWiYsd.cjs +0 -1
  243. package/dist/matrix-yZsGnldA.js +0 -227
  244. package/dist/page-window-index-CIuT4BAv.js +0 -43
  245. package/dist/page-window-index-DEjnM6IB.cjs +0 -1
  246. package/dist/param-validation-BlHHXs6u.js +0 -153
  247. package/dist/param-validation-DCK039V1.cjs +0 -1
  248. package/dist/progress-7OSZbFok.js +0 -39
  249. package/dist/progress-BnLiS5eH.cjs +0 -1
  250. package/dist/task-events-DQ276fn2.cjs +0 -1
  251. package/dist/task-events-Dpsvf_t2.js +0 -47
  252. package/dist/template-bindings-BJR4k7qZ.cjs +0 -1
  253. package/dist/template-bindings-Daui7hLF.js +0 -252
  254. package/dist/template-registry-D3SjENi6.cjs +0 -1
  255. package/dist/validate-BJ5HIWY8.cjs +0 -1
  256. package/dist/validate-CkQBWCeg.js +0 -163
package/dist/xlsx.js CHANGED
@@ -1,103 +1,93 @@
1
- import { a as x, o as z } from "./progress-7OSZbFok.js";
2
- import { e as P, E as B, m as C } from "./workbook-session-BfK1yHOO.js";
3
- import { i as ke, a as We, o as Ae } from "./workbook-session-BfK1yHOO.js";
4
- import { i as $ } from "./render-plan-Ck6koX9L.js";
5
- import { r as k } from "./grid-geometry-BNptEcMm.js";
6
- import { e as W, r as N } from "./style-CQ1PK8ZB.js";
7
- import { r as G } from "./capabilities-CK_7hizc.js";
8
- import { b as Fe, c as Re, a as Te, d as ze, e as Pe, f as Be, g as Ne, h as Ge, p as Le, i as Oe, v as je, j as De, k as _e, l as He, m as Ke, n as Xe } from "./region-binding-workflow-DEJbhpCv.js";
9
- function y(e, t) {
10
- const r = e ?? t;
11
- if (!Number.isSafeInteger(r) || r <= 0) throw new Error("Excel 图片字节预算应为正安全整数");
12
- return r;
13
- }
14
- function L(e, t) {
15
- const r = e.imageData;
16
- if (!r || !/^data:image\/(png|jpe?g);base64,/i.test(r)) return;
17
- if (r.length > Math.ceil(t / 3) * 4 + 64) throw new Error("Excel 单张图片超过字节预算");
18
- const n = r.indexOf(","), i = r.slice(n + 1);
19
- if (!/^[A-Za-z0-9+/]+={0,2}$/.test(i) || i.length % 4 !== 0) throw new Error("Excel 图片不是有效的 base64 数据");
20
- const o = i.length / 4 * 3 - (i.endsWith("==") ? 2 : i.endsWith("=") ? 1 : 0);
21
- if (o > t) throw new Error("Excel 单张图片超过字节预算");
22
- const s = /^data:image\/png;/i.test(r) ? "png" : "jpeg", a = atob(i.slice(0, 12));
23
- if (s === "png" ? !a.startsWith(`‰PNG\r
24
- 
25
- `) : !a.startsWith("ÿØÿ")) throw new Error("Excel 图片内容与 PNG/JPEG 类型不一致");
26
- return { base64: `data:image/${s};base64,${i}`, key: `${s}:${i}`, extension: s, bytes: o };
27
- }
28
- function O(e, t, r) {
1
+ import { a as M, o as P, c as B } from "./progress-D-OTpEav.js";
2
+ import { e as N, E as O, m as C, i as L } from "./workbook-session-BvToI-Fd.js";
3
+ import { a as We, b as Ie, o as Te } from "./workbook-session-BvToI-Fd.js";
4
+ import { i as k } from "./render-plan-Ck6koX9L.js";
5
+ import { c as j } from "./media-Y90dHK9z.js";
6
+ import { r as $ } from "./grid-geometry-BNptEcMm.js";
7
+ import { e as y, r as A } from "./style-CQ1PK8ZB.js";
8
+ import { r as G } from "./capabilities-DskCHs3V.js";
9
+ import { b as Pe, c as Be, a as Ne, d as Oe, e as Le, f as je, g as Ge, h as He, p as _e, i as De, v as Ue, j as Ke, k as Xe, l as Je, m as Ve, n as qe } from "./region-binding-workflow-BMhK_TjP.js";
10
+ function H(e, t, r) {
29
11
  let n = r * 72 / 25.4;
30
12
  if (!Number.isFinite(n) || t + Math.ceil(n / 409) - 1 > 1048576) throw new Error("Excel 图片占位超过工作表行数上限");
31
13
  for (; n > 0; ) {
32
14
  if (t > 1048576) throw new Error("Excel 图片占位超过工作表行数上限");
33
- const i = Math.min(409, n);
34
- e.getRow(t++).height = i, n -= i;
15
+ const o = Math.min(409, n);
16
+ e.getRow(t++).height = o, n -= o;
35
17
  }
36
18
  return t;
37
19
  }
38
- function j(e, t, r) {
39
- let n = Math.round(t * 36e3), i = 0;
20
+ function _(e, t, r) {
21
+ let n = Math.round(t * 36e3), o = 0;
40
22
  if (!Number.isSafeInteger(n)) throw new Error("Excel 图片锚点超出安全坐标范围");
41
- for (e.properties.defaultColWidth ??= 8.43; i < 16384; ) {
42
- const o = e.getColumn(i + 1).width ?? e.properties.defaultColWidth, s = Math.round(P(o) * 36e3);
43
- if (!Number.isSafeInteger(s) || s <= 0) throw new Error("Excel 图片锚点所在列宽无效");
44
- if (n < s) return { col: i + n / s, row: r - 1, nativeCol: i, nativeColOff: n, nativeRow: r - 1, nativeRowOff: 0 };
45
- n -= s, i++;
23
+ for (e.properties.defaultColWidth ??= 8.43; o < 16384; ) {
24
+ const a = e.getColumn(o + 1).width ?? e.properties.defaultColWidth, i = Math.round(N(a) * 36e3);
25
+ if (!Number.isSafeInteger(i) || i <= 0) throw new Error("Excel 图片锚点所在列宽无效");
26
+ if (n < i) return { col: o + n / i, row: r - 1, nativeCol: o, nativeColOff: n, nativeRow: r - 1, nativeRowOff: 0 };
27
+ n -= i, o++;
46
28
  }
47
29
  throw new Error("Excel 图片锚点超过16384列上限");
48
30
  }
49
31
  function D(e, t, r) {
50
- const n = y(t.maxImageBytes, 16777216), i = y(t.maxTotalImageBytes, 32 * 1024 * 1024), o = y(t.maxImages, 1e3), s = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
51
- let l = 0;
52
- return { write(h, c, d) {
53
- if (![c.widthMm, c.heightMm, c.leftMm].every(Number.isFinite) || c.widthMm < 0 || c.heightMm < 0 || c.leftMm < 0) throw new Error("Excel 图片尺寸无效");
54
- if (!c.widthMm || !c.heightMm) return d;
55
- const f = a.get(c.imageData) ?? L(c, n);
56
- if (f && a.set(c.imageData, f), !f)
57
- return r.push(`${c.nid ?? c.kind}: Excel 图片仅支持 PNG/JPEG data URI,已跳过`), d;
58
- let g = s.get(f.key);
59
- if (g === void 0) {
60
- if (s.size >= o) throw new Error("Excel 唯一图片数量超过预算");
61
- if (l + f.bytes > i) throw new Error("Excel 图片总字节数超过预算");
62
- g = e.addImage({ base64: f.base64, extension: f.extension }), s.set(f.key, g), l += f.bytes;
63
- }
64
- const u = O(h, d, c.heightMm);
65
- return h.addImage(g, {
66
- tl: j(h, c.leftMm, d),
67
- ext: { width: c.widthMm * 96 / 25.4, height: c.heightMm * 96 / 25.4 },
32
+ let n = r * 72 / 25.4;
33
+ if (!Number.isFinite(n) || Math.abs(n) > 1048576 * 409) throw new Error("Excel 图片纵向偏移超过工作表范围");
34
+ const o = (a) => {
35
+ const i = e.getRow(a).height ?? e.properties.defaultRowHeight ?? 15;
36
+ if (!Number.isFinite(i) || i <= 0) throw new Error("Excel 图片锚点所在行高无效");
37
+ return i;
38
+ };
39
+ for (; n < 0 && t > 1; ) n += o(--t);
40
+ for (; t <= 1048576 && n >= o(t); ) n -= o(t++);
41
+ if (t > 1048576 || n < 0) throw new Error("Excel 图片移动到工作表边界之外");
42
+ return { nativeRow: t - 1, nativeRowOff: Math.round(n * 25.4 / 72 * 36e3) };
43
+ }
44
+ function U(e, t, r) {
45
+ const n = j(t), o = /* @__PURE__ */ new Map();
46
+ return { write(a, i, l, s) {
47
+ if (![i.widthMm, i.heightMm, i.leftMm].every(Number.isFinite) || i.widthMm < 0 || i.heightMm < 0 || i.leftMm < 0) throw new Error("Excel 图片尺寸无效");
48
+ if (!i.widthMm || !i.heightMm) return l;
49
+ if (!i.imageData || !/^data:image\/(png|jpe?g);base64,/i.test(i.imageData))
50
+ return r.push(`${i.nid ?? i.kind}: Excel 图片仅支持 PNG/JPEG data URI,已跳过`), l;
51
+ const c = n(i.imageData);
52
+ let d = o.get(c.dataUrl);
53
+ d === void 0 && (d = e.addImage({ base64: c.dataUrl, extension: c.extension }), o.set(c.dataUrl, d));
54
+ const h = s ? l : H(a, l, i.heightMm);
55
+ return a.addImage(d, {
56
+ tl: { ..._(a, s?.leftMm ?? i.leftMm, l), ...s ? D(a, l, s.offsetMm) : {} },
57
+ ext: { width: i.widthMm * 96 / 25.4, height: i.heightMm * 96 / 25.4 },
68
58
  editAs: "oneCell"
69
- }), u;
59
+ }), h;
70
60
  } };
71
61
  }
72
- function A(e) {
62
+ function F(e) {
73
63
  return !!e && typeof e == "object" && !Array.isArray(e);
74
64
  }
75
- function I(e, t) {
65
+ function R(e, t) {
76
66
  const r = e.meta?.xlsxFlow;
77
67
  if (r === void 0) return;
78
- if (!A(r) || r.version !== "1.0" || !Number.isSafeInteger(r.columnStart) || Number(r.columnStart) < 0) throw new Error("Excel 多区域几何标记无效,不能按列序猜测输出");
68
+ if (!F(r) || r.version !== "1.0" || !Number.isSafeInteger(r.columnStart) || Number(r.columnStart) < 0) throw new Error("Excel 多区域几何标记无效,不能按列序猜测输出");
79
69
  if (!e.grid) throw new Error("Excel 多区域输出只接受显式网格组件");
80
- const n = r, i = e.grid.colWidthsMm;
81
- if (!i?.length || n.columnStart + i.length > t.length || i.some((o, s) => Math.abs(o - t[n.columnStart + s]) > 1e-3)) throw new Error("Excel 多区域列位置与网格列宽不一致");
70
+ const n = r, o = e.grid.colWidthsMm;
71
+ if (!o?.length || n.columnStart + o.length > t.length || o.some((a, i) => Math.abs(a - t[n.columnStart + i]) > 1e-3)) throw new Error("Excel 多区域列位置与网格列宽不一致");
82
72
  return n;
83
73
  }
84
- function F(e) {
74
+ function W(e) {
85
75
  const t = e.meta?.xlsxFlow;
86
76
  if (t === void 0) {
87
77
  if (e.components.some((n) => n.meta?.xlsxFlow !== void 0)) throw new Error("Excel 多区域页面缺少完整列几何标记");
88
78
  return;
89
79
  }
90
- const r = _(t, e.meta?.reportScope);
80
+ const r = K(t, e.meta?.reportScope);
91
81
  for (const n of e.components) {
92
- const i = I(n, r.widths);
93
- if (!i) throw new Error("Excel 多区域页面混入没有区域几何的组件,请使用独立页面模板");
94
- const o = r.widths.slice(0, i.columnStart).reduce((a, l) => a + l, e.marginLeftMm ?? 0), s = n.grid.colWidthsMm.reduce((a, l) => a + l, 0);
95
- if (Math.abs(o - n.leftMm) > 0.01 || Math.abs(s - n.widthMm) > 0.01) throw new Error("Excel 多区域标记与真实横向位置不一致");
82
+ const o = R(n, r.widths);
83
+ if (!o) throw new Error("Excel 多区域页面混入没有区域几何的组件,请使用独立页面模板");
84
+ const a = r.widths.slice(0, o.columnStart).reduce((l, s) => l + s, e.marginLeftMm ?? 0), i = n.grid.colWidthsMm.reduce((l, s) => l + s, 0);
85
+ if (Math.abs(a - n.leftMm) > 0.01 || Math.abs(i - n.widthMm) > 0.01) throw new Error("Excel 多区域标记与真实横向位置不一致");
96
86
  }
97
87
  return r;
98
88
  }
99
- function _(e, t) {
100
- if (!A(e) || e.version !== "1.0" || typeof e.sheet != "string" || !e.sheet.trim() || typeof e.templateId != "string" || !e.templateId.trim()) throw new Error("Excel 多区域工作表标识无效");
89
+ function K(e, t) {
90
+ if (!F(e) || e.version !== "1.0" || typeof e.sheet != "string" || !e.sheet.trim() || typeof e.templateId != "string" || !e.templateId.trim()) throw new Error("Excel 多区域工作表标识无效");
101
91
  if (!Array.isArray(e.fullWidthsMm) || !e.fullWidthsMm.length || e.fullWidthsMm.length > 16384 || e.fullWidthsMm.some((r) => typeof r != "number" || !Number.isFinite(r) || r <= 0 || r > 2e3)) throw new Error("Excel 多区域完整列宽无效");
102
92
  if (t !== void 0 && (typeof t != "string" || !t.trim())) throw new Error("Excel 多区域报表命名空间无效");
103
93
  return { key: JSON.stringify([t ?? e.templateId, e.sheet]), sheet: e.sheet, widths: e.fullWidthsMm };
@@ -105,64 +95,64 @@ function _(e, t) {
105
95
  function b(e) {
106
96
  return Math.round(e * 1e6) / 1e6;
107
97
  }
108
- function H(e, t, r, n, i) {
109
- return e.components.filter((o) => n ? o.pageAnchor === "header" ? t === 0 : o.pageAnchor === "footer" ? t === r - 1 : o.table?.role !== "header" ? !0 : i.has(o.table.id) ? !1 : (i.add(o.table.id), !0) : !0);
98
+ function X(e, t, r, n, o) {
99
+ return e.components.filter((a) => n ? a.pageAnchor === "header" ? t === 0 : a.pageAnchor === "footer" ? t === r - 1 : a.table?.role !== "header" ? !0 : o.has(a.table.id) ? !1 : (o.add(a.table.id), !0) : !0);
110
100
  }
111
- function K(e, t, r, n) {
112
- const i = e.components.filter((s) => !t.includes(s) && s.table?.role === "header"), o = t.filter((s) => !s.pageAnchor).reduce((s, a) => Math.max(s, a.topMm + a.heightMm), e.marginTopMm ?? 0);
113
- return t.map((s) => {
114
- let a = s.topMm;
115
- return r && s.pageAnchor === "footer" && (a = o), a -= i.filter((l) => l.topMm + l.heightMm <= a + 1e-3).reduce((l, h) => l + h.heightMm, 0), { component: s, layout: k(s.grid, s.widthMm, s.heightMm), top: a, column: I(s, n).columnStart };
101
+ function J(e, t, r, n) {
102
+ const o = e.components.filter((i) => !t.includes(i) && i.table?.role === "header"), a = t.filter((i) => !i.pageAnchor).reduce((i, l) => Math.max(i, l.topMm + l.heightMm), e.marginTopMm ?? 0);
103
+ return t.map((i) => {
104
+ let l = i.topMm;
105
+ return r && i.pageAnchor === "footer" && (l = a), l -= o.filter((s) => s.topMm + s.heightMm <= l + 1e-3).reduce((s, c) => s + c.heightMm, 0), { component: i, layout: $(i.grid, i.widthMm, i.heightMm), top: l, column: R(i, n).columnStart };
116
106
  });
117
107
  }
118
- function X(e, t, r) {
108
+ function V(e, t, r) {
119
109
  const n = t.length - 1;
120
110
  if (n * r.length > 1e6) throw new Error("Excel 多区域单页超过 100 万几何单元格,请减小预览分页高度或列数");
121
- const i = new Map(t.map((a, l) => [a, l])), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
122
- for (const a of e) for (const l of a.layout.cells) {
123
- if (!Object.keys(l.cell).length) continue;
124
- const h = i.get(b(a.top + l.yMm)), c = i.get(b(a.top + l.yMm + l.heightMm)), d = a.column + l.ci, f = d + (l.cell.colSpan ?? 1), g = `${h}:${d}`;
125
- for (let u = h; u < c; u++) for (let m = d; m < f; m++) {
126
- const p = `${u}:${m}`;
127
- if (s.has(p)) throw new Error("Excel 多区域实际单元格互相覆盖,已终止输出,未覆盖已有内容");
128
- s.set(p, g);
111
+ const o = new Map(t.map((l, s) => [l, s])), a = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
112
+ for (const l of e) for (const s of l.layout.cells) {
113
+ if (!Object.keys(s.cell).length) continue;
114
+ const c = o.get(b(l.top + s.yMm)), d = o.get(b(l.top + s.yMm + s.heightMm)), h = l.column + s.ci, f = h + (s.cell.colSpan ?? 1), u = `${c}:${h}`;
115
+ for (let g = c; g < d; g++) for (let w = h; w < f; w++) {
116
+ const x = `${g}:${w}`;
117
+ if (i.has(x)) throw new Error("Excel 多区域实际单元格互相覆盖,已终止输出,未覆盖已有内容");
118
+ i.set(x, u);
129
119
  }
130
- o.set(g, { ...l.cell, style: W(a.component.style, l.cell.style), rowSpan: c - h, colSpan: f - d });
120
+ a.set(u, { ...s.cell, style: y(l.component.style, s.cell.style), rowSpan: d - c, colSpan: f - h });
131
121
  }
132
- return Array.from({ length: n }, (a, l) => {
133
- const h = [];
134
- for (let c = 0; c < r.length; c++) {
135
- const d = `${l}:${c}`, f = o.get(d);
136
- f ? (h.push(f), c += (f.colSpan ?? 1) - 1) : s.has(d) || h.push(null);
122
+ return Array.from({ length: n }, (l, s) => {
123
+ const c = [];
124
+ for (let d = 0; d < r.length; d++) {
125
+ const h = `${s}:${d}`, f = a.get(h);
126
+ f ? (c.push(f), d += (f.colSpan ?? 1) - 1) : i.has(h) || c.push(null);
137
127
  }
138
- return h;
128
+ return c;
139
129
  });
140
130
  }
141
- function J(e, t) {
131
+ function q(e, t) {
142
132
  const r = /* @__PURE__ */ new Set(), n = [];
143
- let i;
144
- for (const [o, { page: s }] of e.entries()) {
145
- const a = F(s);
146
- if (i && (a.key !== i.key || a.widths.length !== i.widths.length || a.widths.some((g, u) => Math.abs(g - i.widths[u]) > 1e-3))) throw new Error("Excel 多区域分页的工作表或列结构不一致");
147
- i ??= a;
148
- const l = H(s, o, e.length, t, r), h = K(s, l, t, a.widths);
149
- if (!h.length) continue;
150
- const c = [...new Set(h.flatMap((g) => [...g.layout.rows.map((u) => b(g.top + u.pos)), b(g.top + g.component.heightMm)]))].sort((g, u) => g - u), d = X(h, c, a.widths), f = c.slice(1).map((g, u) => g - c[u]);
151
- n.push({ kind: "rect", leftMm: 0, topMm: 0, widthMm: a.widths.reduce((g, u) => g + u, 0), heightMm: f.reduce((g, u) => g + u, 0), grid: { cells: d, colWidthsMm: a.widths, rowHeightsMm: f } });
133
+ let o;
134
+ for (const [a, { page: i }] of e.entries()) {
135
+ const l = W(i);
136
+ if (o && (l.key !== o.key || l.widths.length !== o.widths.length || l.widths.some((u, g) => Math.abs(u - o.widths[g]) > 1e-3))) throw new Error("Excel 多区域分页的工作表或列结构不一致");
137
+ o ??= l;
138
+ const s = X(i, a, e.length, t, r), c = J(i, s, t, l.widths);
139
+ if (!c.length) continue;
140
+ const d = [...new Set(c.flatMap((u) => [...u.layout.rows.map((g) => b(u.top + g.pos)), b(u.top + u.component.heightMm)]))].sort((u, g) => u - g), h = V(c, d, l.widths), f = d.slice(1).map((u, g) => u - d[g]);
141
+ n.push({ kind: "rect", leftMm: 0, topMm: 0, widthMm: l.widths.reduce((u, g) => u + g, 0), heightMm: f.reduce((u, g) => u + g, 0), grid: { cells: h, colWidthsMm: l.widths, rowHeightsMm: f } });
152
142
  }
153
143
  return n;
154
144
  }
155
- const R = 72 / 25.4, U = 32767, V = 253;
156
- function E(e, t) {
145
+ const I = 72 / 25.4, Q = 32767, Y = 253;
146
+ function p(e, t) {
157
147
  if (typeof e != "string") return;
158
- if (e.length > U)
148
+ if (e.length > Q)
159
149
  throw new Error(`Excel 单元格 ${t} 最多支持 32767 个字符,无法无损导出;内容未裁剪`);
160
150
  let r = 0;
161
151
  for (let n = 0; n < e.length; n++)
162
- if (e.charCodeAt(n) === 10 && ++r > V)
152
+ if (e.charCodeAt(n) === 10 && ++r > Y)
163
153
  throw new Error(`Excel 单元格 ${t} 最多支持 253 个换行,无法无损导出;内容未改写`);
164
154
  }
165
- function w(e) {
155
+ function m(e) {
166
156
  if (!e) return;
167
157
  const t = e.replace("#", "");
168
158
  return /^[0-9a-fA-F]{6}$/.test(t) ? `FF${t.toUpperCase()}` : void 0;
@@ -173,38 +163,38 @@ function T(e, t = {}) {
173
163
  bold: t.bold === !0,
174
164
  italic: t.italic === !0,
175
165
  underline: t.underline === !0,
176
- size: N(t).fontSizePt,
177
- color: w(t.color) ? { argb: w(t.color) } : void 0
166
+ size: A(t).fontSizePt,
167
+ color: m(t.color) ? { argb: m(t.color) } : void 0
178
168
  };
179
169
  }
180
- const M = {
170
+ const E = {
181
171
  a3: { width: 297, height: 420, code: 8 },
182
172
  a4: { width: 210, height: 297, code: 9 },
183
173
  a5: { width: 148, height: 210, code: 11 }
184
174
  };
185
175
  function Z(e, t, r, n) {
186
- if (t && t !== "auto") return M[t].code;
187
- const i = Math.min(e.pageWidthMm, e.pageHeightMm), o = Math.max(e.pageWidthMm, e.pageHeightMm), s = Object.values(M).find((a) => Math.abs(i - a.width) <= 1 && Math.abs(o - a.height) <= 1);
188
- return s ? s.code : (n.push(`page ${r + 1}: 自定义纸张 ${e.pageWidthMm}×${e.pageHeightMm}mm 无对应 Excel 纸型,打印设置回退 A4;可显式配置 paperSize`), M.a4.code);
176
+ if (t && t !== "auto") return E[t].code;
177
+ const o = Math.min(e.pageWidthMm, e.pageHeightMm), a = Math.max(e.pageWidthMm, e.pageHeightMm), i = Object.values(E).find((l) => Math.abs(o - l.width) <= 1 && Math.abs(a - l.height) <= 1);
178
+ return i ? i.code : (n.push(`page ${r + 1}: 自定义纸张 ${e.pageWidthMm}×${e.pageHeightMm}mm 无对应 Excel 纸型,打印设置回退 A4;可显式配置 paperSize`), E.a4.code);
189
179
  }
190
- function q(e, t, r, n) {
191
- const i = typeof t.text == "string" ? t.text : "";
180
+ function ee(e, t, r, n) {
181
+ const o = typeof t.text == "string" ? t.text : "";
192
182
  if (r !== "raw" || !Object.prototype.hasOwnProperty.call(t, "value")) {
193
- E(i, e.address), e.value = i;
183
+ p(o, e.address), e.value = o;
194
184
  return;
195
185
  }
196
- const o = t.value;
197
- if (o === null || typeof o == "string" || typeof o == "boolean" || typeof o == "number" && Number.isFinite(o)) {
198
- E(o, e.address), e.value = o, t.numberFormat && (e.numFmt = t.numberFormat);
186
+ const a = t.value;
187
+ if (a === null || typeof a == "string" || typeof a == "boolean" || typeof a == "number" && Number.isFinite(a)) {
188
+ p(a, e.address), e.value = a, t.numberFormat && (e.numFmt = t.numberFormat);
199
189
  return;
200
190
  }
201
- E(i, e.address), e.value = i, n.push(`原始单元格值无效,已保留显示文本:${e.address}`);
191
+ p(o, e.address), e.value = o, n.push(`原始单元格值无效,已保留显示文本:${e.address}`);
202
192
  }
203
- function Q(e) {
204
- const t = F(e);
205
- return t ? { id: `xlsx-flow:${t.key}`, title: t.sheet, wide: !0, flow: !0 } : Y(e);
193
+ function te(e) {
194
+ const t = W(e);
195
+ return t ? { id: `xlsx-flow:${t.key}`, title: t.sheet, wide: !0, flow: !0 } : ne(e);
206
196
  }
207
- function Y(e) {
197
+ function ne(e) {
208
198
  const r = e.components.filter((n) => n.table !== void 0)[0]?.table;
209
199
  if (!(!r || typeof r.id != "string" || !r.id.trim() || !Array.isArray(r.columnKeys) || !r.columnKeys.length)) {
210
200
  for (const n of e.components) {
@@ -212,104 +202,106 @@ function Y(e) {
212
202
  if (!n.grid || n.table.id !== r.id) return;
213
203
  continue;
214
204
  }
215
- if (n.grid || n.kind !== "text" && !$(n) || n.richParagraphs?.length && !n.text && !n.lines?.length) return;
205
+ if (n.grid || n.kind !== "text" && !k(n)) return;
216
206
  }
217
207
  return { id: r.id, title: r.title, wide: r.layout === "wide" || e.layout === "wide" };
218
208
  }
219
209
  }
220
- function ee(e, t) {
210
+ function ie(e, t) {
221
211
  const r = /* @__PURE__ */ new Set();
222
- for (const [n, i] of e.pages.entries())
212
+ for (const [n, o] of e.pages.entries())
223
213
  if (!t[n])
224
- for (const o of i.components)
225
- typeof o.table?.id == "string" && r.add(o.table.id);
214
+ for (const a of o.components)
215
+ typeof a.table?.id == "string" && r.add(a.table.id);
226
216
  return r;
227
217
  }
228
218
  function S(e) {
229
219
  return e.layout === "wide" || e.components.some((t) => t.table?.layout === "wide");
230
220
  }
231
- function te(e, t, r) {
232
- const n = [], i = e.pages.map(Q), o = ee(e, i);
233
- for (const [s, a] of e.pages.entries()) {
234
- const l = i[s], h = l && !o.has(l.id), c = t === "pages" || !h ? void 0 : l;
235
- if (t === "continuous" && !c)
236
- throw new Error(`page ${s + 1}: continuous Excel 需要完整、单一的逻辑表来源;自由布局请使用 sheetMode: 'pages'`);
237
- const d = c !== void 0 && (t === "continuous" || c.wide);
238
- !d && t !== "pages" && S(a) && r.push(`page ${s + 1}: 混合或缺少逻辑表来源,已保留独立 Sheet,未猜测合并内容`);
221
+ function re(e, t, r) {
222
+ const n = [], o = e.pages.map(te), a = ie(e, o);
223
+ for (const [i, l] of e.pages.entries()) {
224
+ const s = o[i], c = s && !a.has(s.id), d = t === "pages" || !c ? void 0 : s;
225
+ if (t === "continuous" && !d)
226
+ throw new Error(`page ${i + 1}: continuous Excel 需要完整、单一的逻辑表来源;自由布局请使用 sheetMode: 'pages'`);
227
+ const h = d !== void 0 && (t === "continuous" || d.wide);
228
+ !h && t !== "pages" && S(l) && r.push(`page ${i + 1}: 混合或缺少逻辑表来源,已保留独立 Sheet,未猜测合并内容`);
239
229
  const f = n[n.length - 1];
240
- d && f?.continuous && f.tableId === c.id ? f.pages.push({ page: a, index: s }) : n.push({ pages: [{ page: a, index: s }], continuous: d, ...d ? { tableId: c.id, title: c.title } : {}, ...l?.flow ? { flow: !0, title: l.title } : {} });
230
+ h && f?.continuous && f.tableId === d.id ? f.pages.push({ page: l, index: i }) : n.push({ pages: [{ page: l, index: i }], continuous: h, ...h ? { tableId: d.id, title: d.title } : {}, ...s?.flow ? { flow: !0, title: s.title } : {} });
241
231
  }
242
232
  return n;
243
233
  }
244
234
  function v(e, t, r) {
245
- return !e || e.length === t.length && e.every((n, i) => r(n, t[i]));
246
- }
247
- function ne(e, t, r, n) {
248
- const i = e.table, o = t.columns.map((l) => l.size), s = v(n.keys, i.columnKeys, (l, h) => l === h), a = v(n.widths, o, (l, h) => Math.abs(l - h) <= 1e-3);
249
- if (i.columnKeys.length !== o.length || !s || !a)
250
- throw new Error(`page ${r + 1}: 连续 Excel 逻辑表 ${i.id} 的列结构或列宽不一致`);
251
- if (n.keys ??= i.columnKeys, n.widths ??= o, i.role === "header") {
252
- if (i.rowIndex !== -1) throw new Error(`page ${r + 1}: 连续 Excel 表头 rowIndex 必须为 -1`);
235
+ return !e || e.length === t.length && e.every((n, o) => r(n, t[o]));
236
+ }
237
+ function oe(e, t, r, n) {
238
+ const o = e.table, a = t.columns.map((s) => s.size), i = v(n.keys, o.columnKeys, (s, c) => s === c), l = v(n.widths, a, (s, c) => Math.abs(s - c) <= 1e-3);
239
+ if (o.columnKeys.length !== a.length || !i || !l)
240
+ throw new Error(`page ${r + 1}: 连续 Excel 逻辑表 ${o.id} 的列结构或列宽不一致`);
241
+ if (n.keys ??= o.columnKeys, n.widths ??= a, o.role === "header") {
242
+ if (o.rowIndex !== -1) throw new Error(`page ${r + 1}: 连续 Excel 表头 rowIndex 必须为 -1`);
253
243
  n.headerSeen = !0;
254
244
  } else {
255
- if (!["body", "group-header", "subtotal", "grand-total"].includes(i.role) || i.rowIndex !== n.expectedRow)
245
+ if (!["body", "group-header", "subtotal", "grand-total"].includes(o.role) || o.rowIndex !== n.expectedRow)
256
246
  throw new Error(`page ${r + 1}: 连续 Excel 逻辑行来源不连续或重复(期望 ${n.expectedRow})`);
257
247
  n.expectedRow += t.rows.length;
258
248
  }
259
- if (t.cells.some((l) => l.cell.children?.length))
249
+ if (t.cells.some((s) => s.cell.children?.length))
260
250
  throw new Error(`page ${r + 1}: 连续 Excel 暂不支持嵌套组件;请使用独立 Sheet 导出并检查告警`);
261
251
  }
262
- function re(e, t) {
252
+ function ae(e, t) {
263
253
  const r = { expectedRow: 0, headerSeen: !1 };
264
- for (const { page: n, index: i } of e.pages)
265
- for (const o of n.components) {
266
- const s = t.get(o);
267
- o.table && s && ne(o, s, i, r);
254
+ for (const { page: n, index: o } of e.pages)
255
+ for (const a of n.components) {
256
+ const i = t.get(a);
257
+ a.table && i && oe(a, i, o, r);
268
258
  }
269
259
  if (!r.headerSeen) throw new Error("连续 Excel 逻辑表缺少明确表头来源");
270
260
  }
271
- function ie(e, t, r) {
261
+ function le(e, t, r) {
272
262
  let n = (e?.replace(/[\\/*?:[\]]/g, " ").replace(/\s+/g, " ").trim() || `Sheet${t + 1}`).slice(0, 31).replace(/^'+|'+$/g, "").trim() || `Sheet${t + 1}`;
273
263
  n.toLowerCase() === "history" && (n += " 报表");
274
- let i = n, o = 1;
275
- for (; r.has(i.toLowerCase()); ) {
276
- const s = ` (${++o})`;
277
- i = n.slice(0, 31 - s.length) + s;
264
+ let o = n, a = 1;
265
+ for (; r.has(o.toLowerCase()); ) {
266
+ const i = ` (${++a})`;
267
+ o = n.slice(0, 31 - i.length) + i;
278
268
  }
279
- return r.add(i.toLowerCase()), i;
269
+ return r.add(o.toLowerCase()), o;
280
270
  }
281
- function oe(e) {
271
+ function se(e) {
282
272
  const t = /* @__PURE__ */ new Set();
283
- function r(n, i, o, s) {
284
- return n <= i ? n : (t.has(o) || (e.push(s), t.add(o)), i);
273
+ function r(n, o, a, i) {
274
+ return n <= o ? n : (t.has(a) || (e.push(i), t.add(a)), o);
285
275
  }
286
276
  return {
287
277
  column: (n) => r(n, 255, "column", "Excel 单列宽度上限为 255 字符,超宽列已收敛至 255;单元格值完整保留,显示范围可能受限"),
288
278
  row: (n) => r(n, 409, "row", "Excel 行高上限为 409pt,超高行已收敛至 409pt;单元格值完整保留,显示范围可能受限")
289
279
  };
290
280
  }
291
- function se(e) {
292
- const t = e.flow ? J(e.pages, e.continuous).map((o) => ({ comp: o, pageIndex: e.pages[0].index })) : e.pages.flatMap(({ page: o, index: s }, a) => o.components.filter((l) => !e.continuous || (l.pageAnchor !== "header" || a === 0) && (l.pageAnchor !== "footer" || a === e.pages.length - 1)).map((l) => ({ comp: l, pageIndex: s }))), r = /* @__PURE__ */ new Map();
293
- let n = 1, i = 0;
294
- for (const { comp: o } of t)
295
- if (o.grid) {
296
- const s = k(o.grid, o.widthMm, o.heightMm);
297
- r.set(o, s), n = Math.max(n, s.columns.length);
298
- } else o.kind === "text" && (i = Math.max(i, o.widthMm));
299
- if (n > 16384) throw new Error("Excel 最多支持 16384 列,无法无损导出此报表");
300
- return { components: t, grids: r, columnCount: n, textWidthMm: i };
301
- }
302
- function ae(e, t, r) {
303
- const { page: n, index: i } = e.pages[0], o = t !== void 0 && t !== "auto";
304
- return (e.continuous || S(n)) && !o ? {} : { pageSetup: {
305
- paperSize: Z(n, t, i, r),
281
+ async function ce(e, t) {
282
+ const r = e.flow ? q(e.pages, e.continuous).map((i) => ({ comp: i, pageIndex: e.pages[0].index })) : e.pages.flatMap(({ page: i, index: l }, s) => i.components.filter((c) => !e.continuous || (c.pageAnchor !== "header" || s === 0) && (c.pageAnchor !== "footer" || s === e.pages.length - 1)).map((c) => ({ comp: c, pageIndex: l }))), n = /* @__PURE__ */ new Map();
283
+ let o = 1, a = 0;
284
+ for (const { comp: i } of r)
285
+ if (i.grid) {
286
+ const l = $(i.grid, i.widthMm, i.heightMm);
287
+ n.set(i, l), o = Math.max(o, l.columns.length);
288
+ const s = t(l.cells.length);
289
+ s && await s;
290
+ } else i.kind === "text" && (a = Math.max(a, i.widthMm));
291
+ if (o > 16384) throw new Error("Excel 最多支持 16384 列,无法无损导出此报表");
292
+ return { components: r, grids: n, columnCount: o, textWidthMm: a };
293
+ }
294
+ function de(e, t, r) {
295
+ const { page: n, index: o } = e.pages[0], a = t !== void 0 && t !== "auto";
296
+ return (e.continuous || S(n)) && !a ? {} : { pageSetup: {
297
+ paperSize: Z(n, t, o, r),
306
298
  orientation: n.pageWidthMm > n.pageHeightMm ? "landscape" : "portrait",
307
299
  fitToPage: !0,
308
300
  ...e.continuous ? { fitToWidth: 1, fitToHeight: 0 } : {}
309
301
  } };
310
302
  }
311
- function le(e) {
312
- const t = w(e.borderColor ?? e.lineColor), r = { style: "thin", ...t ? { color: { argb: t } } : {} };
303
+ function he(e) {
304
+ const t = m(e.borderColor ?? e.lineColor), r = { style: "thin", ...t ? { color: { argb: t } } : {} };
313
305
  return {
314
306
  ...e.borderTop !== !1 ? { top: r } : {},
315
307
  ...e.borderLeft !== !1 ? { left: r } : {},
@@ -317,106 +309,122 @@ function le(e) {
317
309
  ...e.borderRight !== !1 ? { right: r } : {}
318
310
  };
319
311
  }
320
- function ce(e, t) {
312
+ function fe(e, t) {
321
313
  e.alignment = { horizontal: t.align ?? "left", vertical: t.verticalAlign ?? "middle", wrapText: !0 };
322
- const r = w(t.backgroundColor);
323
- r && (e.fill = { type: "pattern", pattern: "solid", fgColor: { argb: r } }), e.border = le(t), T(e, t);
314
+ const r = m(t.backgroundColor);
315
+ r && (e.fill = { type: "pattern", pattern: "solid", fgColor: { argb: r } }), e.border = he(t), T(e, t);
324
316
  }
325
- function he(e, t) {
317
+ function ue(e, t) {
326
318
  for (const [r, n] of t.columns.entries()) {
327
- const i = e.sheet.getColumn(r + 1), o = e.limits.column(C(n.size));
328
- (i.width == null || i.width < o) && (i.width = o);
319
+ const o = e.sheet.getColumn(r + 1), a = e.limits.column(C(n.size));
320
+ (o.width == null || o.width < a) && (o.width = a);
329
321
  }
330
322
  }
331
- function de(e, t, r) {
332
- for (const [n, i] of t.rows.entries()) {
333
- const o = e.sheet.getRow(r + n), s = e.limits.row(i.size * R);
334
- (o.height == null || o.height < s) && (o.height = s);
323
+ function ge(e, t, r) {
324
+ for (const [n, o] of t.rows.entries()) {
325
+ const a = e.sheet.getRow(r + n), i = e.limits.row(o.size * I);
326
+ (a.height == null || a.height < i) && (a.height = i);
335
327
  }
336
328
  }
337
- function fe(e, t, r, n) {
338
- const i = Math.max(1, Math.min(t.cell.colSpan ?? 1, r.columns.length - t.ci)), o = Math.max(1, Math.min(t.cell.rowSpan ?? 1, r.rows.length - t.ri));
339
- (i > 1 || o > 1) && e.mergeCells(n + t.ri, t.ci + 1, n + t.ri + o - 1, t.ci + i);
329
+ function me(e, t, r, n) {
330
+ const o = Math.max(1, Math.min(t.cell.colSpan ?? 1, r.columns.length - t.ci)), a = Math.max(1, Math.min(t.cell.rowSpan ?? 1, r.rows.length - t.ri));
331
+ (o > 1 || a > 1) && e.mergeCells(n + t.ri, t.ci + 1, n + t.ri + a - 1, t.ci + o);
340
332
  }
341
- function ge(e, t, r, n, i) {
333
+ async function we(e, t, r, n, o) {
342
334
  if (n + r.rows.length - 1 > 1048576) throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");
343
- de(e, r, n);
344
- for (const o of r.cells) {
345
- const s = e.sheet.getCell(n + o.ri, o.ci + 1);
346
- q(s, o.cell, e.valueMode, e.warnings), o.cell.children?.length && e.warnings.push(`page ${i + 1} ${t.nid ?? t.kind} cell ${o.ri + 1}:${o.ci + 1}: 嵌套组件内容暂不支持 xlsx 导出,已跳过`), ce(s, W(t.style, o.cell.style)), o.cell.indentMm && (s.alignment = { ...s.alignment, indent: Math.min(250, Math.max(1, Math.round(o.cell.indentMm / 2.5))) }), fe(e.sheet, o, r, n);
335
+ ge(e, r, n);
336
+ for (const a of r.cells) {
337
+ const i = e.sheet.getCell(n + a.ri, a.ci + 1);
338
+ ee(i, a.cell, e.valueMode, e.warnings), a.cell.children?.length && e.warnings.push(`page ${o + 1} ${t.nid ?? t.kind} cell ${a.ri + 1}:${a.ci + 1}: 嵌套组件内容暂不支持 xlsx 导出,已跳过`), fe(i, y(t.style, a.cell.style)), a.cell.indentMm && (i.alignment = { ...i.alignment, indent: Math.min(250, Math.max(1, Math.round(a.cell.indentMm / 2.5))) }), me(e.sheet, a, r, n);
339
+ const l = e.schedule();
340
+ l && await l;
347
341
  }
348
342
  return n + r.rows.length;
349
343
  }
350
- function ue(e, t, r, n, i) {
344
+ function pe(e, t, r, n) {
351
345
  const o = Array.isArray(t.lines) && t.lines.length > 0 ? t.lines.join(`
352
- `) : t.text ?? "";
353
- if (t.richParagraphs?.length) {
354
- const h = o.length === 0 ? "富文本内容暂不支持 xlsx 导出,已跳过" : "富文本按已有文本回退导出,内联样式未保留";
355
- e.warnings.push(`page ${i + 1} ${t.nid ?? t.kind}: ${h}`);
356
- }
357
- const s = e.sheet.getRow(r), a = s.getCell(1);
358
- E(o, a.address), a.value = o, a.alignment = { horizontal: t.style?.align ?? "left", vertical: t.style?.verticalAlign ?? "middle", wrapText: !0 };
359
- const l = w(t.style?.backgroundColor);
360
- return l && (a.fill = { type: "pattern", pattern: "solid", fgColor: { argb: l } }), T(a, t.style), n > 1 && e.sheet.mergeCells(r, 1, r, n), s.height = e.limits.row(t.heightMm * R), r + 1;
361
- }
362
- function me(e, t, r) {
346
+ `) : t.text ?? "", a = e.sheet.getRow(r), i = a.getCell(1);
347
+ t.richParagraphs?.length || p(o, i.address), i.value = t.richParagraphs?.length ? { richText: t.richParagraphs.flatMap((s, c) => [
348
+ ...c ? [{ text: `
349
+ ` }] : [],
350
+ ...s.segments.map((d) => {
351
+ const h = y(t.style, d.style);
352
+ return { text: d.kind === "field" ? d.field ?? "" : d.text ?? "", font: { name: h.fontFamily, bold: h.bold, italic: h.italic, underline: h.underline, size: A(h).fontSizePt, ...m(h.color) ? { color: { argb: m(h.color) } } : {} } };
353
+ })
354
+ ]) } : o, typeof i.value == "object" && i.value && "richText" in i.value && p(i.value.richText.map((s) => s.text).join(""), i.address), i.alignment = { horizontal: t.style?.align ?? "left", vertical: t.style?.verticalAlign ?? "middle", wrapText: !0 };
355
+ const l = m(t.style?.backgroundColor);
356
+ return l && (i.fill = { type: "pattern", pattern: "solid", fgColor: { argb: l } }), T(i, t.style), n > 1 && e.sheet.mergeCells(r, 1, r, n), a.height = e.limits.row(t.heightMm * I), r + 1;
357
+ }
358
+ function xe(e, t, r) {
363
359
  const n = t + r - 1;
364
360
  e.views = [{ state: "frozen", ySplit: n, xSplit: 0 }], e.pageSetup.printTitlesRow = `1:${n}`;
365
361
  }
366
- function we(e, t, r, n) {
362
+ async function Me(e, t, r, n) {
367
363
  !t.grids.size && t.textWidthMm > 0 && (e.sheet.getColumn(1).width = e.limits.column(C(t.textWidthMm)));
368
- for (const s of t.grids.values()) he(e, s);
369
- let i = 1, o = !1;
370
- for (const { comp: s, pageIndex: a } of t.components) {
371
- const l = r && s.table?.role === "header";
372
- if (l && o) continue;
373
- if (i > 1048576) throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");
374
- const h = t.grids.get(s);
375
- h ? (l && (me(e.sheet, i, h.rows.length), o = !0), i = ge(e, s, h, i, a)) : s.kind === "text" ? i = ue(e, s, i, t.columnCount, a) : $(s) ? i = n.write(e.sheet, s, i) : e.warnings.push(`page ${a + 1} ${s.nid ?? s.kind}: 组件类型 ${s.kind} 暂不支持 xlsx 导出,已跳过`);
364
+ for (const i of t.grids.values()) {
365
+ ue(e, i);
366
+ const l = e.schedule(i.columns.length);
367
+ l && await l;
368
+ }
369
+ let o = 1, a = !1;
370
+ for (const { comp: i, pageIndex: l } of t.components) {
371
+ const s = r && i.table?.role === "header";
372
+ if (s && a) continue;
373
+ if (o > 1048576) throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");
374
+ const c = t.grids.get(i);
375
+ if (c)
376
+ s && (xe(e.sheet, o, c.rows.length), a = !0), o = await we(e, i, c, o, l);
377
+ else if (i.kind === "text")
378
+ o = pe(e, i, o, t.columnCount);
379
+ else if (k(i)) {
380
+ const d = L(i, r), h = n.write(e.sheet, i, d?.row ?? o, d);
381
+ d || (o = h);
382
+ } else
383
+ e.warnings.push(`page ${l + 1} ${i.nid ?? i.kind}: 组件类型 ${i.kind} 暂不支持 xlsx 导出,已跳过`);
376
384
  }
377
385
  }
378
- function pe(e) {
386
+ function Ee(e) {
379
387
  if (e.valueMode !== void 0 && e.valueMode !== "text" && e.valueMode !== "raw")
380
388
  throw new Error("xlsx valueMode 必须是 text 或 raw");
381
- if (e.paperSize !== void 0 && e.paperSize !== "auto" && !Object.prototype.hasOwnProperty.call(M, e.paperSize))
389
+ if (e.paperSize !== void 0 && e.paperSize !== "auto" && !Object.prototype.hasOwnProperty.call(E, e.paperSize))
382
390
  throw new Error("xlsx paperSize 必须是 auto、a3、a4 或 a5");
383
391
  if (e.sheetMode !== void 0 && !["auto", "pages", "continuous"].includes(e.sheetMode))
384
392
  throw new Error("xlsx sheetMode 必须是 auto、pages 或 continuous");
385
393
  }
386
- async function ve(e, t = {}) {
387
- pe(t), x(t.signal);
388
- const r = G(e, "xlsx", t), n = new B.Workbook(), i = [], o = D(n, t, i), s = oe(i), a = te(e, t.sheetMode, i), l = /* @__PURE__ */ new Set();
389
- for (const [c, d] of a.entries()) {
390
- const f = se(d);
391
- d.continuous && !d.flow && re(d, f.grids);
392
- const g = d.pages[0].page, u = t.sheetName?.(c) ?? ie(d.title, c, l);
393
- l.add(u.toLowerCase());
394
- const m = n.addWorksheet(u, ae(d, t.paperSize, i)), p = t.valueMode ?? (S(g) || d.continuous || d.flow ? "raw" : "text");
395
- x(t.signal), we({ sheet: m, warnings: i, limits: s, valueMode: p }, f, d.continuous, o), await z(t, c + 1, a.length);
394
+ async function Ae(e, t = {}) {
395
+ Ee(t), M(t.signal);
396
+ const r = G(e, "xlsx", t), n = new O.Workbook(), o = [], a = U(n, t, o), i = se(o), l = re(e, t.sheetMode, o), s = /* @__PURE__ */ new Set(), c = B(t);
397
+ for (const [h, f] of l.entries()) {
398
+ const u = await ce(f, c);
399
+ f.continuous && !f.flow && ae(f, u.grids);
400
+ const g = f.pages[0].page, w = t.sheetName?.(h) ?? le(f.title, h, s);
401
+ s.add(w.toLowerCase());
402
+ const x = n.addWorksheet(w, de(f, t.paperSize, o)), z = t.valueMode ?? (S(g) || f.continuous || f.flow ? "raw" : "text");
403
+ M(t.signal), await Me({ sheet: x, warnings: o, limits: i, valueMode: z, schedule: c }, u, f.continuous, a), await P(t, h + 1, l.length);
396
404
  }
397
- x(t.signal);
398
- const h = await n.xlsx.writeBuffer();
399
- return x(t.signal), { workbook: n, buffer: h, warnings: i, diagnostics: r };
405
+ M(t.signal);
406
+ const d = await n.xlsx.writeBuffer();
407
+ return M(t.signal), { workbook: n, buffer: d, warnings: o, diagnostics: r };
400
408
  }
401
409
  export {
402
- Fe as bindExcelTemplate,
403
- Re as createExcelBindingDocument,
404
- Te as createExcelBindingSession,
405
- ze as createExcelRegionBindingDocument,
406
- Pe as createExcelRegionBindingSession,
407
- Be as excelBindingCellRange,
408
- Ne as excelBindingRowRange,
409
- Ge as getExcelSheetWindow,
410
- ke as importExcelTemplate,
411
- We as inspectExcelWorkbook,
412
- Ae as openExcelWorkbook,
413
- Le as parseExcelBindingSession,
414
- Oe as parseExcelRegionBindingSession,
415
- ve as renderPlanToXlsx,
416
- je as validateExcelBindingFields,
417
- De as validateExcelBindingRecipe,
418
- _e as validateExcelBindingRegions,
419
- He as validateExcelRegionBindings,
420
- Ke as validateExcelRegionFields,
421
- Xe as validateExcelRegionGeometry
410
+ Pe as bindExcelTemplate,
411
+ Be as createExcelBindingDocument,
412
+ Ne as createExcelBindingSession,
413
+ Oe as createExcelRegionBindingDocument,
414
+ Le as createExcelRegionBindingSession,
415
+ je as excelBindingCellRange,
416
+ Ge as excelBindingRowRange,
417
+ He as getExcelSheetWindow,
418
+ We as importExcelTemplate,
419
+ Ie as inspectExcelWorkbook,
420
+ Te as openExcelWorkbook,
421
+ _e as parseExcelBindingSession,
422
+ De as parseExcelRegionBindingSession,
423
+ Ae as renderPlanToXlsx,
424
+ Ue as validateExcelBindingFields,
425
+ Ke as validateExcelBindingRecipe,
426
+ Xe as validateExcelBindingRegions,
427
+ Je as validateExcelRegionBindings,
428
+ Ve as validateExcelRegionFields,
429
+ qe as validateExcelRegionGeometry
422
430
  };