@agile-team/mach-report 2.14.0 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -11
- package/THIRD_PARTY_NOTICES.md +3 -1
- package/dist/{ExcelBindingWizard-CvsWR8Ga.js → ExcelBindingWizard-BKH1nGNS.js} +3 -3
- package/dist/{ExcelBindingWizard-CLT2p7P3.cjs → ExcelBindingWizard-Bs43BGNp.cjs} +1 -1
- package/dist/ParamEditor-Da4akw6V.cjs +1 -0
- package/dist/ParamEditor-DoAhzJsm.js +594 -0
- package/dist/{ReportBatchPanel-LqVgiqp7.js → ReportBatchPanel-BMf6boMA.js} +39 -39
- package/dist/{ReportBatchPanel-DkxTzBkD.cjs → ReportBatchPanel-wP9m9Pj1.cjs} +1 -1
- package/dist/ReportPreview-ChV19HBp.js +4619 -0
- package/dist/ReportPreview-DbLvvOUT.cjs +6 -0
- package/dist/{ReportTemplateLibrary-MjWEtc7X.js → ReportTemplateLibrary-C9wutIiT.js} +1 -1
- package/dist/{ReportTemplateLibrary-cQ1sqNYo.cjs → ReportTemplateLibrary-Sxr3eD0J.cjs} +1 -1
- package/dist/{RuleEditor-ChuXMlei.js → RuleEditor-C_Clasvd.js} +5 -5
- package/dist/{RuleEditor-BaR6xUiI.cjs → RuleEditor-XhGHK8DE.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-Dci6aRn1.js → TemplateOutlinePanel-D6Bkny59.js} +2 -2
- package/dist/{TemplateOutlinePanel-BHKP89Xz.cjs → TemplateOutlinePanel-JTSR53vJ.cjs} +1 -1
- package/dist/{TemplateReusePanel-CY5eO2Sh.cjs → TemplateReusePanel-Kx35S0Ql.cjs} +1 -1
- package/dist/{TemplateReusePanel-B7Gmyc1z.js → TemplateReusePanel-rVuK1kTz.js} +2 -2
- package/dist/{TemplateReviewPanel-DjlX3xpt.js → TemplateReviewPanel-B0ar9_zf.js} +2 -2
- package/dist/{TemplateReviewPanel-JvZe9_4G.cjs → TemplateReviewPanel-Dn6X9UmY.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +3 -1
- package/dist/analytics.d.ts +3 -1
- package/dist/analytics.js +154 -60
- package/dist/artifact-integrity.json +135 -0
- package/dist/assets-B9ImAi6_.cjs +1 -0
- package/dist/assets-DEaz4qsp.js +124 -0
- package/dist/batch-BaP6pWDE.cjs +1 -0
- package/dist/batch-BfZHN1do.js +220 -0
- package/dist/batch-CGyt-b2W.js +273 -0
- package/dist/batch-CLpELXBl.cjs +1 -0
- package/dist/capabilities-CAh2Nrue.cjs +1 -0
- package/dist/capabilities-DskCHs3V.js +69 -0
- package/dist/codes.d.cts +2 -0
- package/dist/codes.d.ts +2 -0
- package/dist/{computed-Bvk0W15F.js → computed-C-4C2S5h.js} +3 -3
- package/dist/config-BVsJXSqS.js +842 -0
- package/dist/config-D10us76d.cjs +1 -0
- package/dist/data-explanation-B8MZRYVS.js +16 -0
- package/dist/data-explanation-DE55G30w.cjs +1 -0
- package/dist/designer-2bDlcNXQ.js +5136 -0
- package/dist/designer-BT7XCdbW.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +144 -16
- package/dist/designer.d.ts +144 -16
- package/dist/designer.js +1 -1
- package/dist/drill-ByJviLXS.js +145 -0
- package/dist/drill-DYTxuL3A.cjs +1 -0
- package/dist/{font-loader-vhCT8znW.cjs → font-loader-B_UkxpzC.cjs} +1 -1
- package/dist/{font-loader-DHto6Lra.js → font-loader-Q3bQjmrI.js} +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +82 -4
- package/dist/index.d.ts +82 -4
- package/dist/index.js +785 -820
- package/dist/json-snapshot-DFb2eWkf.js +1416 -0
- package/dist/json-snapshot-WWSGlaHG.cjs +2 -0
- package/dist/licenses/_bwip-js_generic-4.11.4.txt +24 -0
- package/dist/licenses/_fast-csv_format-4.3.5.txt +22 -0
- package/dist/licenses/_fast-csv_parse-4.3.6.txt +22 -0
- package/dist/licenses/_pdf-lib_fontkit-1.1.1.txt +326 -0
- package/dist/licenses/_pdf-lib_standard-fonts-1.0.0.txt +22 -0
- package/dist/licenses/_pdf-lib_upng-1.0.1.txt +22 -0
- package/dist/licenses/_types_node-14.18.63.txt +22 -0
- package/dist/licenses/_types_pako-2.0.3.txt +22 -0
- package/dist/licenses/_types_pegjs-0.10.6.txt +22 -0
- package/dist/licenses/archiver-5.3.2.txt +23 -0
- package/dist/licenses/archiver-utils-2.1.0.txt +23 -0
- package/dist/licenses/archiver-utils-3.0.4.txt +23 -0
- package/dist/licenses/async-3.2.6.txt +20 -0
- package/dist/licenses/balanced-match-1.0.2.txt +22 -0
- package/dist/licenses/base64-js-1.5.1.txt +22 -0
- package/dist/licenses/big-integer-1.6.52.txt +25 -0
- package/dist/licenses/binary-0.3.0.txt +178 -0
- package/dist/licenses/bl-4.1.0.txt +14 -0
- package/dist/licenses/bluebird-3.4.7.txt +22 -0
- package/dist/licenses/brace-expansion-1.1.21.txt +22 -0
- package/dist/licenses/brace-expansion-2.1.7.txt +22 -0
- package/dist/licenses/buffer-5.7.1.txt +22 -0
- package/dist/licenses/buffer-crc32-0.2.13.txt +20 -0
- package/dist/licenses/buffer-indexof-polyfill-1.0.2.txt +23 -0
- package/dist/licenses/buffers-0.1.1.txt +140 -0
- package/dist/licenses/chainsaw-0.1.0.txt +184 -0
- package/dist/licenses/compress-commons-4.1.2.txt +23 -0
- package/dist/licenses/concat-map-0.0.1.txt +19 -0
- package/dist/licenses/core-util-is-1.0.3.txt +20 -0
- package/dist/licenses/crc-32-1.2.2.txt +202 -0
- package/dist/licenses/crc32-stream-4.0.3.txt +23 -0
- package/dist/licenses/dayjs-1.11.23.txt +22 -0
- package/dist/licenses/duplexer2-0.1.4.txt +27 -0
- package/dist/licenses/end-of-stream-1.4.5.txt +22 -0
- package/dist/licenses/exceljs-4.4.0.txt +23 -0
- package/dist/licenses/fast-csv-4.3.6.txt +22 -0
- package/dist/licenses/fast-png-6.4.0.txt +22 -0
- package/dist/licenses/fs-constants-1.0.0.txt +22 -0
- package/dist/licenses/fs.realpath-1.0.0.txt +44 -0
- package/dist/licenses/fstream-1.0.12.txt +16 -0
- package/dist/licenses/glob-7.2.3.txt +22 -0
- package/dist/licenses/graceful-fs-4.2.11.txt +16 -0
- package/dist/licenses/ieee754-1.2.1.txt +12 -0
- package/dist/licenses/immediate-3.0.6.txt +21 -0
- package/dist/licenses/inflight-1.0.6.txt +16 -0
- package/dist/licenses/inherits-2.0.4.txt +17 -0
- package/dist/licenses/iobuffer-5.4.0.txt +23 -0
- package/dist/licenses/isarray-1.0.0.txt +61 -0
- package/dist/licenses/jszip-3.10.2.txt +652 -0
- package/dist/licenses/lazystream-1.0.1.txt +24 -0
- package/dist/licenses/lie-3.3.0.txt +8 -0
- package/dist/licenses/listenercount-1.0.1.txt +6 -0
- package/dist/licenses/lodash.defaults-4.2.0.txt +48 -0
- package/dist/licenses/lodash.difference-4.5.0.txt +48 -0
- package/dist/licenses/lodash.escaperegexp-4.1.2.txt +48 -0
- package/dist/licenses/lodash.flatten-4.4.0.txt +48 -0
- package/dist/licenses/lodash.groupby-4.6.0.txt +48 -0
- package/dist/licenses/lodash.isboolean-3.0.3.txt +23 -0
- package/dist/licenses/lodash.isequal-4.5.0.txt +48 -0
- package/dist/licenses/lodash.isfunction-3.0.9.txt +48 -0
- package/dist/licenses/lodash.isnil-4.0.0.txt +23 -0
- package/dist/licenses/lodash.isplainobject-4.0.6.txt +48 -0
- package/dist/licenses/lodash.isundefined-3.0.1.txt +23 -0
- package/dist/licenses/lodash.union-4.6.0.txt +48 -0
- package/dist/licenses/lodash.uniq-4.5.0.txt +48 -0
- package/dist/licenses/minimatch-3.1.5.txt +16 -0
- package/dist/licenses/minimatch-5.1.9.txt +16 -0
- package/dist/licenses/minimist-1.2.8.txt +19 -0
- package/dist/licenses/mkdirp-0.5.6.txt +22 -0
- package/dist/licenses/node-sql-parser-5.4.0.txt +202 -0
- package/dist/licenses/normalize-path-3.0.0.txt +22 -0
- package/dist/licenses/once-1.4.0.txt +16 -0
- package/dist/licenses/pako-1.0.11.txt +22 -0
- package/dist/licenses/pako-2.2.0.txt +22 -0
- package/dist/licenses/path-is-absolute-1.0.1.txt +22 -0
- package/dist/licenses/pdf-lib-1.17.1.txt +22 -0
- package/dist/licenses/process-nextick-args-2.0.1.txt +20 -0
- package/dist/licenses/readable-stream-2.3.8.txt +48 -0
- package/dist/licenses/readable-stream-3.6.2.txt +48 -0
- package/dist/licenses/readdir-glob-1.1.3.txt +202 -0
- package/dist/licenses/rimraf-2.7.1.txt +16 -0
- package/dist/licenses/safe-buffer-5.1.2.txt +22 -0
- package/dist/licenses/safe-buffer-5.2.1.txt +22 -0
- package/dist/licenses/saxes-5.0.1.txt +397 -0
- package/dist/licenses/setimmediate-1.0.5.txt +21 -0
- package/dist/licenses/string_decoder-1.1.1.txt +49 -0
- package/dist/licenses/string_decoder-1.3.0.txt +49 -0
- package/dist/licenses/tar-stream-2.2.0.txt +22 -0
- package/dist/licenses/tmp-0.2.7.txt +22 -0
- package/dist/licenses/traverse-0.3.9.txt +25 -0
- package/dist/licenses/tslib-1.14.1.txt +13 -0
- package/dist/licenses/unzipper-0.10.14.txt +26 -0
- package/dist/licenses/util-deprecate-1.0.2.txt +25 -0
- package/dist/licenses/uuid-11.1.1.txt +10 -0
- package/dist/licenses/wrappy-1.0.2.txt +16 -0
- package/dist/licenses/xmlchars-2.2.0.txt +19 -0
- package/dist/licenses/zip-stream-4.1.1.txt +23 -0
- package/dist/matrix-CGRGkn5s.js +112 -0
- package/dist/matrix-gEO7ZM_u.cjs +1 -0
- package/dist/media-B7vnpD8k.cjs +1 -0
- package/dist/media-Y90dHK9z.js +70 -0
- package/dist/param-validation-C3HlcLLO.cjs +1 -0
- package/dist/param-validation-Do7Eg8Zv.js +181 -0
- package/dist/{pdf-8UPQebOE.js → pdf-BwNyeGpt.js} +4385 -4321
- package/dist/{pdf-AyJGb22z.cjs → pdf-CvvrjPQg.cjs} +51 -49
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +18 -3
- package/dist/pdf.d.ts +18 -3
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BGKf-Tqg.js → plugin-Ca_XZG3l.js} +2 -2
- package/dist/{plugin-CktLH_Iy.cjs → plugin-DHO7X8z2.cjs} +1 -1
- package/dist/prepared-CFy9B75C.cjs +1 -0
- package/dist/prepared-ajM-H-9B.js +69 -0
- package/dist/progress-B0ctFpKf.cjs +1 -0
- package/dist/progress-D-OTpEav.js +52 -0
- package/dist/record-bindings-By_UKZ2g.cjs +1 -0
- package/dist/record-bindings-Do_b3h4V.js +196 -0
- package/dist/{region-binding-workflow-DEJbhpCv.js → region-binding-workflow-BMhK_TjP.js} +1 -1
- package/dist/{region-binding-workflow-BzfbxRiR.cjs → region-binding-workflow-DIYJdCUr.cjs} +1 -1
- package/dist/{report-params-B44imUd4.js → report-params-B1RzkhJj.js} +1 -1
- package/dist/{report-params-SJfhKgaX.cjs → report-params-WDGrA4oP.cjs} +1 -1
- package/dist/sbom.cdx.json +3982 -0
- package/dist/server/node.d.cts +20 -1
- package/dist/server/node.d.ts +20 -1
- package/dist/server-node.cjs +1 -1
- package/dist/server-node.js +247 -237
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +772 -4
- package/dist/server.d.ts +772 -4
- package/dist/server.js +885 -645
- package/dist/sha256-ArEYjaTI.cjs +1 -0
- package/dist/sha256-DPEuJ3nh.js +155 -0
- package/dist/style.css +1 -1
- package/dist/template-bindings-C2SpvsMU.js +58 -0
- package/dist/template-bindings-CEtWyiLX.cjs +1 -0
- package/dist/template-catalog-FJE_c9Qe.cjs +1 -0
- package/dist/template-catalog-j2B1MJlL.js +414 -0
- package/dist/{template-fragments-CLkGo6To.js → template-fragments-BGbQLGlV.js} +21 -21
- package/dist/{template-fragments-DFUpq5QM.cjs → template-fragments-DcKeiylI.cjs} +1 -1
- package/dist/{template-outline-B3xVkzSv.cjs → template-outline-BwRV_eRo.cjs} +1 -1
- package/dist/{template-outline-CFenM1PV.js → template-outline-cnWfT_LK.js} +3 -3
- package/dist/{template-registry-COXDEJEM.js → template-registry-BtaKPELV.js} +364 -201
- package/dist/template-registry-Co1zPq5e.cjs +1 -0
- package/dist/textwrap-CWHyzkBH.cjs +4 -0
- package/dist/textwrap-DE1kgcJB.js +110 -0
- package/dist/{tree-CqcQ99NM.js → tree-CjVZLRw7.js} +1 -1
- package/dist/vue/async.d.cts +123 -14
- package/dist/vue/async.d.ts +123 -14
- package/dist/vue/index.d.cts +158 -22
- package/dist/vue/index.d.ts +158 -22
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +80 -78
- package/dist/{workbook-session-DNa2RHNG.cjs → workbook-session-Bjv1YCRK.cjs} +18 -18
- package/dist/{workbook-session-BfK1yHOO.js → workbook-session-BvToI-Fd.js} +5440 -5288
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +20 -1
- package/dist/worker.d.ts +20 -1
- package/dist/worker.js +33 -32
- package/dist/xlsx-node.cjs +34 -34
- package/dist/xlsx-node.js +878 -870
- package/dist/xlsx.cjs +3 -4
- package/dist/xlsx.d.cts +22 -10
- package/dist/xlsx.d.ts +22 -10
- package/dist/xlsx.js +261 -253
- package/package.json +2 -2
- package/dist/ParamEditor-CflQV3eQ.js +0 -526
- package/dist/ParamEditor-vIDzvpPV.cjs +0 -1
- package/dist/ReportPreview-CvbqLUzM.cjs +0 -6
- package/dist/ReportPreview-D_ywJ_-H.js +0 -4533
- package/dist/assets-C2U-e-Sz.cjs +0 -4
- package/dist/assets-Q0wUwNrV.js +0 -217
- package/dist/batch-DzaTNLWI.js +0 -371
- package/dist/batch-xMkqYiTr.cjs +0 -1
- package/dist/capabilities-CK_7hizc.js +0 -63
- package/dist/capabilities-CsZ-pNHR.cjs +0 -1
- package/dist/config-0UIohTS7.cjs +0 -1
- package/dist/config-Dt9NtCPl.js +0 -566
- package/dist/data-explanation-BktvER5B.cjs +0 -1
- package/dist/data-explanation-C_J6jYNi.js +0 -16
- package/dist/designer-Ci1LizA9.js +0 -5020
- package/dist/designer-rtmVIIdN.cjs +0 -2
- package/dist/json-snapshot-BeFT3Tso.js +0 -1952
- package/dist/json-snapshot-D1NTP2oI.cjs +0 -2
- package/dist/matrix-DVyWiYsd.cjs +0 -1
- package/dist/matrix-yZsGnldA.js +0 -227
- package/dist/page-window-index-CIuT4BAv.js +0 -43
- package/dist/page-window-index-DEjnM6IB.cjs +0 -1
- package/dist/param-validation-BlHHXs6u.js +0 -153
- package/dist/param-validation-DCK039V1.cjs +0 -1
- package/dist/progress-7OSZbFok.js +0 -39
- package/dist/progress-BnLiS5eH.cjs +0 -1
- package/dist/task-events-DQ276fn2.cjs +0 -1
- package/dist/task-events-Dpsvf_t2.js +0 -47
- package/dist/template-bindings-BJR4k7qZ.cjs +0 -1
- package/dist/template-bindings-Daui7hLF.js +0 -252
- package/dist/template-registry-D3SjENi6.cjs +0 -1
- package/dist/validate-BJ5HIWY8.cjs +0 -1
- package/dist/validate-CkQBWCeg.js +0 -163
package/dist/xlsx.js
CHANGED
|
@@ -1,103 +1,93 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { e as
|
|
3
|
-
import {
|
|
4
|
-
import { i as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { r as
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
34
|
-
e.getRow(t++).height =
|
|
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
|
|
39
|
-
let n = Math.round(t * 36e3),
|
|
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;
|
|
42
|
-
const
|
|
43
|
-
if (!Number.isSafeInteger(
|
|
44
|
-
if (n <
|
|
45
|
-
n -=
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (!
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
}),
|
|
59
|
+
}), h;
|
|
70
60
|
} };
|
|
71
61
|
}
|
|
72
|
-
function
|
|
62
|
+
function F(e) {
|
|
73
63
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
74
64
|
}
|
|
75
|
-
function
|
|
65
|
+
function R(e, t) {
|
|
76
66
|
const r = e.meta?.xlsxFlow;
|
|
77
67
|
if (r === void 0) return;
|
|
78
|
-
if (!
|
|
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,
|
|
81
|
-
if (!
|
|
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
|
|
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 =
|
|
80
|
+
const r = K(t, e.meta?.reportScope);
|
|
91
81
|
for (const n of e.components) {
|
|
92
|
-
const
|
|
93
|
-
if (!
|
|
94
|
-
const
|
|
95
|
-
if (Math.abs(
|
|
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
|
|
100
|
-
if (!
|
|
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
|
|
109
|
-
return e.components.filter((
|
|
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
|
|
112
|
-
const
|
|
113
|
-
return t.map((
|
|
114
|
-
let
|
|
115
|
-
return r &&
|
|
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
|
|
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
|
|
122
|
-
for (const
|
|
123
|
-
if (!Object.keys(
|
|
124
|
-
const
|
|
125
|
-
for (let
|
|
126
|
-
const
|
|
127
|
-
if (
|
|
128
|
-
|
|
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
|
-
|
|
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 }, (
|
|
133
|
-
const
|
|
134
|
-
for (let
|
|
135
|
-
const
|
|
136
|
-
f ? (
|
|
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
|
|
128
|
+
return c;
|
|
139
129
|
});
|
|
140
130
|
}
|
|
141
|
-
function
|
|
131
|
+
function q(e, t) {
|
|
142
132
|
const r = /* @__PURE__ */ new Set(), n = [];
|
|
143
|
-
let
|
|
144
|
-
for (const [
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
if (!
|
|
150
|
-
const
|
|
151
|
-
n.push({ kind: "rect", leftMm: 0, topMm: 0, widthMm:
|
|
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
|
|
156
|
-
function
|
|
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 >
|
|
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 >
|
|
152
|
+
if (e.charCodeAt(n) === 10 && ++r > Y)
|
|
163
153
|
throw new Error(`Excel 单元格 ${t} 最多支持 253 个换行,无法无损导出;内容未改写`);
|
|
164
154
|
}
|
|
165
|
-
function
|
|
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:
|
|
177
|
-
color:
|
|
166
|
+
size: A(t).fontSizePt,
|
|
167
|
+
color: m(t.color) ? { argb: m(t.color) } : void 0
|
|
178
168
|
};
|
|
179
169
|
}
|
|
180
|
-
const
|
|
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
|
|
187
|
-
const
|
|
188
|
-
return
|
|
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
|
|
191
|
-
const
|
|
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
|
-
|
|
183
|
+
p(o, e.address), e.value = o;
|
|
194
184
|
return;
|
|
195
185
|
}
|
|
196
|
-
const
|
|
197
|
-
if (
|
|
198
|
-
|
|
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
|
-
|
|
191
|
+
p(o, e.address), e.value = o, n.push(`原始单元格值无效,已保留显示文本:${e.address}`);
|
|
202
192
|
}
|
|
203
|
-
function
|
|
204
|
-
const t =
|
|
205
|
-
return t ? { id: `xlsx-flow:${t.key}`, title: t.sheet, wide: !0, flow: !0 } :
|
|
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
|
|
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" &&
|
|
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
|
|
210
|
+
function ie(e, t) {
|
|
221
211
|
const r = /* @__PURE__ */ new Set();
|
|
222
|
-
for (const [n,
|
|
212
|
+
for (const [n, o] of e.pages.entries())
|
|
223
213
|
if (!t[n])
|
|
224
|
-
for (const
|
|
225
|
-
typeof
|
|
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
|
|
232
|
-
const n = [],
|
|
233
|
-
for (const [
|
|
234
|
-
const
|
|
235
|
-
if (t === "continuous" && !
|
|
236
|
-
throw new Error(`page ${
|
|
237
|
-
const
|
|
238
|
-
!
|
|
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
|
-
|
|
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,
|
|
246
|
-
}
|
|
247
|
-
function
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
250
|
-
throw new Error(`page ${r + 1}: 连续 Excel 逻辑表 ${
|
|
251
|
-
if (n.keys ??=
|
|
252
|
-
if (
|
|
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(
|
|
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((
|
|
249
|
+
if (t.cells.some((s) => s.cell.children?.length))
|
|
260
250
|
throw new Error(`page ${r + 1}: 连续 Excel 暂不支持嵌套组件;请使用独立 Sheet 导出并检查告警`);
|
|
261
251
|
}
|
|
262
|
-
function
|
|
252
|
+
function ae(e, t) {
|
|
263
253
|
const r = { expectedRow: 0, headerSeen: !1 };
|
|
264
|
-
for (const { page: n, index:
|
|
265
|
-
for (const
|
|
266
|
-
const
|
|
267
|
-
|
|
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
|
|
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
|
|
275
|
-
for (; r.has(
|
|
276
|
-
const
|
|
277
|
-
|
|
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(
|
|
269
|
+
return r.add(o.toLowerCase()), o;
|
|
280
270
|
}
|
|
281
|
-
function
|
|
271
|
+
function se(e) {
|
|
282
272
|
const t = /* @__PURE__ */ new Set();
|
|
283
|
-
function r(n,
|
|
284
|
-
return n <=
|
|
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
|
|
292
|
-
const
|
|
293
|
-
let
|
|
294
|
-
for (const { comp:
|
|
295
|
-
if (
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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
|
|
312
|
-
const 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
|
|
312
|
+
function fe(e, t) {
|
|
321
313
|
e.alignment = { horizontal: t.align ?? "left", vertical: t.verticalAlign ?? "middle", wrapText: !0 };
|
|
322
|
-
const r =
|
|
323
|
-
r && (e.fill = { type: "pattern", pattern: "solid", fgColor: { argb: r } }), e.border =
|
|
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
|
|
317
|
+
function ue(e, t) {
|
|
326
318
|
for (const [r, n] of t.columns.entries()) {
|
|
327
|
-
const
|
|
328
|
-
(
|
|
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
|
|
332
|
-
for (const [n,
|
|
333
|
-
const
|
|
334
|
-
(
|
|
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
|
|
338
|
-
const
|
|
339
|
-
(
|
|
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
|
|
333
|
+
async function we(e, t, r, n, o) {
|
|
342
334
|
if (n + r.rows.length - 1 > 1048576) throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");
|
|
343
|
-
|
|
344
|
-
for (const
|
|
345
|
-
const
|
|
346
|
-
|
|
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
|
|
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
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
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
|
|
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
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
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
|
|
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(
|
|
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
|
|
387
|
-
|
|
388
|
-
const r = G(e, "xlsx", t), n = new
|
|
389
|
-
for (const [
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
const g =
|
|
393
|
-
|
|
394
|
-
const
|
|
395
|
-
|
|
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
|
-
|
|
398
|
-
const
|
|
399
|
-
return
|
|
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
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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
|
};
|