@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/index.js
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
import { D as te, a as
|
|
2
|
-
import { b as
|
|
3
|
-
import { R as
|
|
4
|
-
import { a as j, r as
|
|
5
|
-
import { C as
|
|
6
|
-
import { i as re, a as
|
|
7
|
-
import { R as
|
|
8
|
-
import { v as
|
|
9
|
-
import {
|
|
10
|
-
import { v as
|
|
11
|
-
import { d as
|
|
12
|
-
import { h as le,
|
|
13
|
-
import {
|
|
14
|
-
import { R as
|
|
15
|
-
import { D as
|
|
16
|
-
import { r as
|
|
17
|
-
import { r as
|
|
18
|
-
import { r as q, n as
|
|
19
|
-
import { i as
|
|
20
|
-
import { o as
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import { R as
|
|
25
|
-
import {
|
|
26
|
-
import { c as
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
|
|
1
|
+
import { D as te, a as Te } from "./defaults-DXhiM1ZD.js";
|
|
2
|
+
import { b as Yn, c as Kn, d as Jn, L as Xn, S as Zn } from "./defaults-DXhiM1ZD.js";
|
|
3
|
+
import { R as er, e as tr, f as nr, p as rr, b as ar, t as ir, d as or } from "./record-bindings-Do_b3h4V.js";
|
|
4
|
+
import { a as j, r as _, b as ne, c as G, d as Ce, m as se, e as Re, p as W, f as Pe, P as Z } from "./style-CQ1PK8ZB.js";
|
|
5
|
+
import { C as lr, M as cr, g as mr, h as dr } from "./style-CQ1PK8ZB.js";
|
|
6
|
+
import { i as re, a as Ae } from "./render-plan-Ck6koX9L.js";
|
|
7
|
+
import { R as gr } from "./render-plan-Ck6koX9L.js";
|
|
8
|
+
import { v as $e, R as ke, p as U, a as Je } from "./template-registry-BtaKPELV.js";
|
|
9
|
+
import { b as ur, c as pr, d as wr, e as br, s as Mr, f as yr, g as vr, h as xr } from "./template-registry-BtaKPELV.js";
|
|
10
|
+
import { v as Xe } from "./dataset-H5pFuQGU.js";
|
|
11
|
+
import { d as Sr } from "./dataset-H5pFuQGU.js";
|
|
12
|
+
import { h as le, w as Ie } from "./textwrap-DE1kgcJB.js";
|
|
13
|
+
import { c as Cr, a as Rr, b as Pr, m as Ar } from "./textwrap-DE1kgcJB.js";
|
|
14
|
+
import { R as ce, d as Ze, s as Qe } from "./json-snapshot-DFb2eWkf.js";
|
|
15
|
+
import { D as kr, P as Ir, a as Nr, b as Lr, c as Dr, e as Fr, f as Or, g as Hr, h as zr, i as Wr, p as Br, j as jr, k as _r, r as Ur, l as Gr } from "./json-snapshot-DFb2eWkf.js";
|
|
16
|
+
import { r as Ne } from "./grid-geometry-BNptEcMm.js";
|
|
17
|
+
import { r as Le } from "./grid-strokes-DyyG1q_o.js";
|
|
18
|
+
import { r as q, n as De, O as et } from "./capabilities-DskCHs3V.js";
|
|
19
|
+
import { i as qr } from "./capabilities-DskCHs3V.js";
|
|
20
|
+
import { o as tt } from "./progress-D-OTpEav.js";
|
|
21
|
+
import { r as me } from "./assets-DEaz4qsp.js";
|
|
22
|
+
import { O as Kr } from "./assets-DEaz4qsp.js";
|
|
23
|
+
import { c as nt } from "./drill-ByJviLXS.js";
|
|
24
|
+
import { R as Xr, a as Zr, m as Qr, r as ea, v as ta } from "./drill-ByJviLXS.js";
|
|
25
|
+
import { R as ra, a as aa, f as ia, i as oa, b as sa, c as la, p as ca, r as ma, v as da, d as ha } from "./param-validation-Do7Eg8Zv.js";
|
|
26
|
+
import { c as fa, a as ua, d as pa, r as wa, b as ba } from "./template-catalog-j2B1MJlL.js";
|
|
27
|
+
import { h as ya, i as va, a as xa } from "./data-explanation-B8MZRYVS.js";
|
|
28
|
+
import { c as Sa, i as Ta, t as Ca } from "./template-outline-cnWfT_LK.js";
|
|
29
|
+
import { a as Pa, c as Aa, i as $a, b as ka } from "./template-fragments-BGbQLGlV.js";
|
|
30
|
+
import { R as rt, p as at } from "./batch-CGyt-b2W.js";
|
|
31
|
+
import { a as Na, b as La, c as Da, d as Fa, e as Oa, f as Ha, g as za, r as Wa, s as Ba } from "./batch-CGyt-b2W.js";
|
|
32
|
+
import { T as _a, c as Ua, v as Ga } from "./tree-CjVZLRw7.js";
|
|
33
|
+
const it = {
|
|
30
34
|
root: "mr-root",
|
|
31
35
|
page: "mr-page",
|
|
32
36
|
comp: "mr-comp",
|
|
@@ -44,17 +48,17 @@ const ot = {
|
|
|
44
48
|
unknown: "mr-unknown"
|
|
45
49
|
};
|
|
46
50
|
function T(e, t) {
|
|
47
|
-
return t?.classNames?.[e] ??
|
|
51
|
+
return t?.classNames?.[e] ?? it[e];
|
|
48
52
|
}
|
|
49
|
-
class
|
|
53
|
+
class ot {
|
|
50
54
|
constructor() {
|
|
51
55
|
this.props = [];
|
|
52
56
|
}
|
|
53
57
|
add(t, n) {
|
|
54
58
|
return n == null || n === !1 || n === "" ? this : (this.props.push([t, String(n)]), this);
|
|
55
59
|
}
|
|
56
|
-
mm(t, n, r,
|
|
57
|
-
return this.add(t, `${j(se(n, r),
|
|
60
|
+
mm(t, n, r, a = 2) {
|
|
61
|
+
return this.add(t, `${j(se(n, r), a)}px`);
|
|
58
62
|
}
|
|
59
63
|
toString() {
|
|
60
64
|
let t = "";
|
|
@@ -67,176 +71,176 @@ class st {
|
|
|
67
71
|
n && (t.style.cssText = n);
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
|
-
function
|
|
71
|
-
return new
|
|
74
|
+
function y(e, t = "unset") {
|
|
75
|
+
return new ot().add("all", t).add("display", e).add("box-sizing", "border-box");
|
|
72
76
|
}
|
|
73
|
-
function
|
|
77
|
+
function Fe(e, t, n) {
|
|
74
78
|
e.add("color", t.color).add("font-family", t.fontFamily).add("font-weight", t.bold != null ? t.bold ? "700" : "400" : void 0).add("font-style", t.italic != null ? t.italic ? "italic" : "normal" : void 0).add("text-decoration", t.underline != null ? t.underline ? "underline" : "none" : void 0).add("letter-spacing", t.letterSpacing != null ? `${t.letterSpacing}pt` : void 0).add("line-height", String(ne(t))).add("text-align", t.align);
|
|
75
|
-
const r =
|
|
79
|
+
const r = _(t, n);
|
|
76
80
|
e.add("font-size", `${j(r.fontSizePx, 2)}px`);
|
|
77
81
|
}
|
|
78
|
-
function
|
|
82
|
+
function st(e, t, n) {
|
|
79
83
|
const r = t.style ?? {};
|
|
80
|
-
|
|
84
|
+
Fe(e, r, n), e.add("background-color", r.backgroundColor).add("opacity", r.opacity != null ? String(r.opacity) : void 0).add("transform", r.rotateDeg ? `rotate(${r.rotateDeg}deg)` : void 0);
|
|
81
85
|
}
|
|
82
|
-
function
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
86
|
+
function lt(e, t, n, r, a, o) {
|
|
87
|
+
const l = e.cell, i = o.createElement("td");
|
|
88
|
+
i.className = T("cell", a), i.dataset.mrRowIndex = String(e.ri), i.dataset.mrColumnIndex = String(e.ci), i.setAttribute("role", t.table?.role === "header" ? "columnheader" : "cell"), l.colSpan && (i.colSpan = l.colSpan), l.rowSpan && (i.rowSpan = l.rowSpan);
|
|
89
|
+
const s = Re(t.style, l.style), c = y("block").add("position", "absolute").mm("left", e.xMm, r).mm("top", e.yMm, r).mm("width", e.widthMm, r).mm("height", e.heightMm, r).add("background-color", s.backgroundColor).add("vertical-align", s.verticalAlign ?? "middle");
|
|
90
|
+
Fe(c, s, r), c.applyTo(i);
|
|
87
91
|
const m = o.createElement("div");
|
|
88
|
-
m.className = "mr-cell-content",
|
|
89
|
-
for (const d of
|
|
90
|
-
return
|
|
91
|
-
}
|
|
92
|
-
function
|
|
93
|
-
return
|
|
94
|
-
const o = `${j(
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
return
|
|
92
|
+
m.className = "mr-cell-content", y("flex").add("position", "absolute").mm("left", n + (l.indentMm ?? 0), r).mm("right", n, r).mm("top", n, r).mm("bottom", n, r).add("flex-direction", "column").add("justify-content", s.verticalAlign === "top" ? "flex-start" : s.verticalAlign === "bottom" ? "flex-end" : "center").add("overflow-wrap", "anywhere").add("overflow", "hidden").applyTo(m), l.text != null && m.append(l.text);
|
|
93
|
+
for (const d of l.children ?? []) m.appendChild(Oe(d, r, a, o));
|
|
94
|
+
return i.appendChild(m), i;
|
|
95
|
+
}
|
|
96
|
+
function ct(e, t, n, r) {
|
|
97
|
+
return Le(e, t).map((a) => {
|
|
98
|
+
const o = `${j(a.widthPt * n / 72, 2)}px solid ${a.color}`, l = r.createElement("div");
|
|
99
|
+
l.className = "mr-grid-edge", l.setAttribute("aria-hidden", "true");
|
|
100
|
+
const i = a.kind === "h";
|
|
101
|
+
return y("block").add("position", "absolute").add("pointer-events", "none").mm("left", i ? a.from : a.pos, n).mm("top", i ? a.pos : a.from, n).mm("width", i ? a.to - a.from : 0, n).mm("height", i ? 0 : a.to - a.from, n).add(i ? "border-top" : "border-left", o).applyTo(l), l;
|
|
98
102
|
});
|
|
99
103
|
}
|
|
100
|
-
function
|
|
101
|
-
const o =
|
|
102
|
-
o.className = T("grid", r), o.setAttribute("role", "table"),
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
const m =
|
|
107
|
-
return m.className = T("row", r), m.setAttribute("role", "row"),
|
|
104
|
+
function mt(e, t, n, r, a) {
|
|
105
|
+
const o = a.createElement("table");
|
|
106
|
+
o.className = T("grid", r), o.setAttribute("role", "table"), y("block").add("position", "relative").add("width", "100%").add("height", "100%").applyTo(o);
|
|
107
|
+
const l = Ne(e, t.widthMm, t.heightMm), i = a.createElement("tbody");
|
|
108
|
+
y("contents").applyTo(i), o.appendChild(i);
|
|
109
|
+
const s = e.cells.map(() => {
|
|
110
|
+
const m = a.createElement("tr");
|
|
111
|
+
return m.className = T("row", r), m.setAttribute("role", "row"), y("contents").applyTo(m), i.appendChild(m), m;
|
|
108
112
|
});
|
|
109
|
-
for (const m of
|
|
110
|
-
|
|
111
|
-
const c =
|
|
112
|
-
return
|
|
113
|
-
}
|
|
114
|
-
function
|
|
115
|
-
const
|
|
116
|
-
|
|
113
|
+
for (const m of l.cells)
|
|
114
|
+
s[m.ri].appendChild(lt(m, t, e.paddingMm ?? 0.5, n, r, a));
|
|
115
|
+
const c = a.createElement("div");
|
|
116
|
+
return y("block").add("position", "relative").add("width", "100%").add("height", "100%").applyTo(c), c.append(o, ...ct(l, t, n, a)), c;
|
|
117
|
+
}
|
|
118
|
+
function dt(e, t, n, r) {
|
|
119
|
+
const a = r.createElement("div");
|
|
120
|
+
a.className = T("paragraph", n), y("block").add("text-align", e.align).add("line-height", e.lineHeight != null ? String(e.lineHeight) : void 0).mm("margin-top", e.spaceBeforeMm ?? 0, t).mm("margin-bottom", e.spaceAfterMm ?? 0, t).mm("text-indent", e.indentMm ?? 0, t).applyTo(a);
|
|
117
121
|
for (const o of e.segments || []) {
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
const
|
|
122
|
+
const l = r.createElement("span");
|
|
123
|
+
l.className = T("segment", n), l.textContent = o.kind === "field" ? o.field ?? "" : o.text ?? "";
|
|
124
|
+
const i = y("inline");
|
|
121
125
|
if (o.style) {
|
|
122
|
-
const
|
|
123
|
-
|
|
126
|
+
const s = o.style;
|
|
127
|
+
i.add("color", s.color).add("font-family", s.fontFamily).add("font-weight", s.bold != null ? s.bold ? "700" : "400" : void 0).add("font-style", s.italic != null ? s.italic ? "italic" : "normal" : void 0).add("text-decoration", s.underline != null ? s.underline ? "underline" : "none" : void 0), (s.fontSize != null || s.fontSizePx != null) && i.add("font-size", `${j(_(s, t).fontSizePx, 2)}px`);
|
|
124
128
|
}
|
|
125
|
-
|
|
129
|
+
i.applyTo(l), a.appendChild(l);
|
|
126
130
|
}
|
|
127
|
-
return
|
|
131
|
+
return a;
|
|
128
132
|
}
|
|
129
|
-
function
|
|
130
|
-
if (
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
for (const o of e.richParagraphs)
|
|
134
|
-
return
|
|
133
|
+
function ht(e, t, n, r) {
|
|
134
|
+
if (Ae(e)) {
|
|
135
|
+
const a = r.createElement("div");
|
|
136
|
+
a.className = T("rich", n), y("block").applyTo(a);
|
|
137
|
+
for (const o of e.richParagraphs) a.appendChild(dt(o, t, n, r));
|
|
138
|
+
return a;
|
|
135
139
|
}
|
|
136
140
|
if (Array.isArray(e.lines) && e.lines.length > 0) {
|
|
137
|
-
const
|
|
138
|
-
|
|
141
|
+
const a = r.createElement("div");
|
|
142
|
+
a.className = T("lines", n), y("block").applyTo(a);
|
|
139
143
|
for (const o of e.lines) {
|
|
140
|
-
const
|
|
141
|
-
|
|
144
|
+
const l = r.createElement("div");
|
|
145
|
+
l.className = T("line", n), l.textContent = o, y("block").add("white-space", "pre").add("min-height", "1lh").applyTo(l), a.appendChild(l);
|
|
142
146
|
}
|
|
143
|
-
return
|
|
147
|
+
return a;
|
|
144
148
|
}
|
|
145
149
|
return e.text ?? "";
|
|
146
150
|
}
|
|
147
|
-
function
|
|
148
|
-
const
|
|
149
|
-
|
|
151
|
+
function gt(e, t, n, r) {
|
|
152
|
+
const a = r.createElement("div");
|
|
153
|
+
a.className = T("text", n);
|
|
150
154
|
const o = e.style || {};
|
|
151
|
-
return
|
|
155
|
+
return y("flex").add("width", "100%").add("height", "100%").add("flex-direction", "column").add("justify-content", o.verticalAlign === "middle" ? "center" : o.verticalAlign === "bottom" ? "flex-end" : "flex-start").add("overflow-wrap", "anywhere").add("overflow", "hidden").applyTo(a), a.append(ht(e, t, n, r)), a;
|
|
152
156
|
}
|
|
153
|
-
function
|
|
157
|
+
function ft(e, t, n) {
|
|
154
158
|
const r = n.createElement("img");
|
|
155
|
-
return r.className = T("image", t), r.src = e.imageData,
|
|
159
|
+
return r.className = T("image", t), r.src = e.imageData, y("block").add("width", "100%").add("height", "100%").add("object-fit", "contain").applyTo(r), r.alt = e.kind, r;
|
|
156
160
|
}
|
|
157
161
|
function be(e, t, n, r) {
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
const o = e.style || {},
|
|
161
|
-
return e.grid ? c.add("position", "relative") : e.kind === "rect" ? (
|
|
162
|
-
}
|
|
163
|
-
function
|
|
164
|
-
const r = n.createElementNS("http://www.w3.org/2000/svg", "svg"),
|
|
165
|
-
r.setAttribute("width", String(Math.max(1,
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
return
|
|
170
|
-
}
|
|
171
|
-
function
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
const o =
|
|
175
|
-
if (
|
|
176
|
-
return
|
|
162
|
+
const a = r.createElement("div");
|
|
163
|
+
a.className = T("shape", n);
|
|
164
|
+
const o = e.style || {}, l = G(o), i = Ce(o), s = `${j(l.widthPt * t / 72, 2)}px solid ${l.color}`, c = y("block");
|
|
165
|
+
return e.grid ? c.add("position", "relative") : e.kind === "rect" ? (i.top && c.add("border-top", s), i.right && c.add("border-right", s), i.bottom && c.add("border-bottom", s), i.left && c.add("border-left", s)) : e.kind === "ellipse" ? (i.inner && c.add("border", s).add("border-radius", "50%"), o.backgroundColor && c.add("background-color", o.backgroundColor)) : e.kind === "line" && c.add("height", "0").add("border-top", s), c.add("box-sizing", "border-box").add("width", "100%").add("height", "100%"), c.applyTo(a), a;
|
|
166
|
+
}
|
|
167
|
+
function ut(e, t, n) {
|
|
168
|
+
const r = n.createElementNS("http://www.w3.org/2000/svg", "svg"), a = se(e.widthMm, t), o = se(e.heightMm, t);
|
|
169
|
+
r.setAttribute("width", String(Math.max(1, a))), r.setAttribute("height", String(Math.max(1, o))), r.setAttribute("aria-hidden", "true"), r.style.overflow = "visible", r.style.display = "block";
|
|
170
|
+
const l = n.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
171
|
+
l.setAttribute("x1", "0"), l.setAttribute("x2", String(a)), l.setAttribute("y1", e.lineDirection === "up" ? String(o) : "0"), l.setAttribute("y2", e.lineDirection === "up" ? "0" : String(o));
|
|
172
|
+
const i = G({ ...e.style, borderColor: e.style?.lineColor ?? e.style?.borderColor });
|
|
173
|
+
return l.setAttribute("stroke", i.color), l.setAttribute("stroke-width", String(i.widthPt * t / 72)), r.appendChild(l), r;
|
|
174
|
+
}
|
|
175
|
+
function Oe(e, t, n, r) {
|
|
176
|
+
const a = r.createElement("div");
|
|
177
|
+
a.className = `${T("comp", n)} mr-kind-${e.kind}`;
|
|
178
|
+
const o = y("block").add("position", "absolute").mm("left", e.leftMm, t).mm("top", e.topMm, t).mm("width", e.widthMm, t).mm("height", e.heightMm, t).add("box-sizing", "border-box");
|
|
179
|
+
if (st(o, e, t), o.applyTo(a), re(e))
|
|
180
|
+
return a.appendChild(ft(e, n, r)), a;
|
|
177
181
|
if (e.kind === "text")
|
|
178
|
-
return
|
|
182
|
+
return a.appendChild(gt(e, t, n, r)), a;
|
|
179
183
|
if (e.grid) {
|
|
180
|
-
const
|
|
181
|
-
return
|
|
184
|
+
const i = be(e, t, n, r);
|
|
185
|
+
return i.appendChild(mt(e.grid, e, t, n, r)), a.appendChild(i), a;
|
|
182
186
|
}
|
|
183
187
|
if (e.kind === "line" && e.lineDirection)
|
|
184
|
-
return
|
|
188
|
+
return a.appendChild(ut(e, t, r)), a;
|
|
185
189
|
if (e.kind === "line" || e.kind === "rect" || e.kind === "ellipse")
|
|
186
|
-
return
|
|
187
|
-
const
|
|
188
|
-
return
|
|
189
|
-
}
|
|
190
|
-
function
|
|
191
|
-
const
|
|
192
|
-
return
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
}),
|
|
196
|
-
}
|
|
197
|
-
function
|
|
190
|
+
return a.appendChild(be(e, t, n, r)), a;
|
|
191
|
+
const l = r.createElement("div");
|
|
192
|
+
return l.className = T("unknown", n), y("block").applyTo(l), l.textContent = e.fallbackText ?? `[${e.kind}]`, l.dataset.mrUnsupported = e.kind, l.setAttribute("role", "note"), a.appendChild(l), a;
|
|
193
|
+
}
|
|
194
|
+
function pt(e, t, n, r) {
|
|
195
|
+
const a = r.createElement("div");
|
|
196
|
+
return a.className = T("page", n), y("block", "initial").add("position", "relative").add("font-family", te).add("font-size", `${j(_(void 0, t).fontSizePx, 2)}px`).add("line-height", String(ne(void 0))).add("white-space", "pre-wrap").add("direction", "ltr").mm("width", e.pageWidthMm, t).mm("height", e.pageHeightMm, t).add("background-color", "#fff").add("color", Te).add("overflow", "hidden").add("box-sizing", "border-box").applyTo(a), e.components.forEach((o, l) => {
|
|
197
|
+
const i = Oe(o, t, n, r);
|
|
198
|
+
i.dataset.mrComponentIndex = String(l), a.appendChild(i);
|
|
199
|
+
}), a;
|
|
200
|
+
}
|
|
201
|
+
function Rn(e, t, n = {}) {
|
|
198
202
|
const r = n.dpi ?? 96;
|
|
199
203
|
q(e, "dom", n);
|
|
200
|
-
const
|
|
201
|
-
return
|
|
202
|
-
|
|
203
|
-
}),
|
|
204
|
+
const a = t.createElement("div");
|
|
205
|
+
return a.className = T("root", n), y("block").applyTo(a), a.dataset.schemaVersion = e.schemaVersion, e.pages.forEach((o) => {
|
|
206
|
+
a.appendChild(pt(o, r, n, t));
|
|
207
|
+
}), a;
|
|
204
208
|
}
|
|
205
209
|
function $(e) {
|
|
206
210
|
if (e?.aborted) throw e.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
207
211
|
}
|
|
208
|
-
const
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
},
|
|
212
|
-
o(),
|
|
212
|
+
const wt = (e, t) => ($(t), /^data:image\/(?:png|jpe?g|webp|gif|svg\+xml)[;,]/i.test(e) ? new Promise((n, r) => {
|
|
213
|
+
const a = new Image(), o = () => {
|
|
214
|
+
a.onload = null, a.onerror = null, t?.removeEventListener("abort", l);
|
|
215
|
+
}, l = () => {
|
|
216
|
+
o(), a.src = "", r(t?.reason ?? new DOMException("The operation was aborted.", "AbortError"));
|
|
213
217
|
};
|
|
214
|
-
|
|
215
|
-
o(), n(
|
|
216
|
-
},
|
|
218
|
+
a.onload = () => {
|
|
219
|
+
o(), n(a);
|
|
220
|
+
}, a.onerror = () => {
|
|
217
221
|
o(), r(new Error("Image could not be decoded for Canvas output."));
|
|
218
|
-
}, t?.addEventListener("abort",
|
|
222
|
+
}, t?.addEventListener("abort", l, { once: !0 }), a.src = e;
|
|
219
223
|
}) : Promise.reject(new TypeError("Canvas imageData must be an image data URL; provide imageLoader for other sources.")));
|
|
220
|
-
function
|
|
221
|
-
return $(n), n ? new Promise((r,
|
|
222
|
-
const o = () =>
|
|
223
|
-
n.addEventListener("abort", o, { once: !0 }), Promise.resolve().then(() => e(t, n)).then(r,
|
|
224
|
+
function bt(e, t, n) {
|
|
225
|
+
return $(n), n ? new Promise((r, a) => {
|
|
226
|
+
const o = () => a(n.reason ?? new DOMException("The operation was aborted.", "AbortError"));
|
|
227
|
+
n.addEventListener("abort", o, { once: !0 }), Promise.resolve().then(() => e(t, n)).then(r, a).finally(() => n.removeEventListener("abort", o));
|
|
224
228
|
}) : e(t);
|
|
225
229
|
}
|
|
226
|
-
async function
|
|
230
|
+
async function Mt(e, t, n) {
|
|
227
231
|
const r = /* @__PURE__ */ new Map();
|
|
228
|
-
for (const
|
|
229
|
-
!re(
|
|
232
|
+
for (const a of e.components)
|
|
233
|
+
!re(a) || r.has(a.imageData) || r.set(a.imageData, await bt(t, a.imageData, n));
|
|
230
234
|
return $(n), r;
|
|
231
235
|
}
|
|
232
|
-
function
|
|
233
|
-
const
|
|
234
|
-
if (
|
|
235
|
-
const c = Math.min(
|
|
236
|
-
e.drawImage(t, n + (
|
|
236
|
+
function yt(e, t, n, r, a, o) {
|
|
237
|
+
const l = t, i = l.naturalWidth ?? l.width ?? a, s = l.naturalHeight ?? l.height ?? o;
|
|
238
|
+
if (i <= 0 || s <= 0) throw new RangeError("Decoded Canvas image dimensions must be positive.");
|
|
239
|
+
const c = Math.min(a / i, o / s), m = i * c, d = s * c;
|
|
240
|
+
e.drawImage(t, n + (a - m) / 2, r + (o - d) / 2, m, d);
|
|
237
241
|
}
|
|
238
|
-
function
|
|
239
|
-
return
|
|
242
|
+
function vt(e) {
|
|
243
|
+
return nt(e.pageHeightsPx, e.gapPx).window(e.viewportHeightPx, e.scrollTopPx, e.overscan);
|
|
240
244
|
}
|
|
241
245
|
const de = 96 / 25.4;
|
|
242
246
|
function he(e, t = 96) {
|
|
@@ -246,67 +250,67 @@ function he(e, t = 96) {
|
|
|
246
250
|
heightPx: Math.max(1, Math.round(e.pageHeightMm * n))
|
|
247
251
|
};
|
|
248
252
|
}
|
|
249
|
-
function
|
|
253
|
+
function He(e, t, n, r = 64e6) {
|
|
250
254
|
if (!Number.isFinite(t) || t <= 0 || !Number.isFinite(n) || n <= 0) throw new RangeError("Canvas dpr and dpi must be positive finite numbers.");
|
|
251
255
|
if (!Number.isFinite(r) || r <= 0) throw new RangeError("maxCanvasPixels must be positive and finite.");
|
|
252
|
-
const
|
|
253
|
-
if (!Number.isSafeInteger(o) || !Number.isSafeInteger(
|
|
254
|
-
return { width: o, height:
|
|
255
|
-
}
|
|
256
|
-
function
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
const
|
|
260
|
-
if (!
|
|
256
|
+
const a = he(e, n), o = Math.round(a.widthPx * t), l = Math.round(a.heightPx * t);
|
|
257
|
+
if (!Number.isSafeInteger(o) || !Number.isSafeInteger(l) || o * l > r) throw new RangeError("Canvas page exceeds maxCanvasPixels; reduce resolution or split the report.");
|
|
258
|
+
return { width: o, height: l };
|
|
259
|
+
}
|
|
260
|
+
function ze(e, t, n, r) {
|
|
261
|
+
const a = document.createElement("canvas"), { widthPx: o, heightPx: l } = he(e, n), i = He(e, t, n, r);
|
|
262
|
+
a.width = i.width, a.height = i.height, a.style.width = `${o}px`, a.style.height = `${l}px`;
|
|
263
|
+
const s = a.getContext("2d");
|
|
264
|
+
if (!s)
|
|
261
265
|
throw new Error("当前环境不支持 Canvas 2D(测试需真浏览器,见 e2e/canvas.spec.ts)");
|
|
262
|
-
return
|
|
266
|
+
return s.scale(t, t), s.fillStyle = "#ffffff", s.fillRect(0, 0, o, l), { canvas: a, ctx: s };
|
|
263
267
|
}
|
|
264
|
-
function
|
|
265
|
-
return
|
|
268
|
+
function Pn(e, t = 96) {
|
|
269
|
+
return _(e, t).fontSizePx;
|
|
266
270
|
}
|
|
267
|
-
function We(e, t, n, r,
|
|
268
|
-
e.font = `${t.italic ? "italic " : ""}${t.bold ? "bold " : ""}${t.fontSizePx}px ${
|
|
269
|
-
const
|
|
270
|
-
`), m = c.length *
|
|
271
|
+
function We(e, t, n, r, a, o, l, i = "top") {
|
|
272
|
+
e.font = `${t.italic ? "italic " : ""}${t.bold ? "bold " : ""}${t.fontSizePx}px ${l}`, "letterSpacing" in e && (e.letterSpacing = "0px"), e.fillStyle = t.color, e.textBaseline = "alphabetic";
|
|
273
|
+
const s = t.fontSizePx * t.lineHeight, c = t.text === "" ? [""] : t.text.split(`
|
|
274
|
+
`), m = c.length * s;
|
|
271
275
|
let d = r;
|
|
272
|
-
|
|
273
|
-
|
|
276
|
+
i === "middle" ? d = r + (o - m) / 2 : i === "bottom" && (d = r + o - m), c.forEach((h, g) => {
|
|
277
|
+
xt(e, h, t, n, d + g * s + t.fontSizePx * 0.8, a);
|
|
274
278
|
}), e.textAlign = "left";
|
|
275
279
|
}
|
|
276
|
-
function
|
|
277
|
-
const
|
|
278
|
-
if (!
|
|
280
|
+
function xt(e, t, n, r, a, o) {
|
|
281
|
+
const l = Array.from(t), i = n.letterSpacingPx ?? 0;
|
|
282
|
+
if (!i) {
|
|
279
283
|
e.textAlign = n.align === "center" ? "center" : n.align === "right" ? "right" : "left";
|
|
280
284
|
const d = n.align === "center" ? r + o / 2 : n.align === "right" ? r + o : r;
|
|
281
|
-
e.fillText(t, d,
|
|
285
|
+
e.fillText(t, d, a);
|
|
282
286
|
return;
|
|
283
287
|
}
|
|
284
|
-
const
|
|
288
|
+
const s = e.measureText(t).width + Math.max(0, l.length - 1) * i, c = n.align === "center" ? r + (o - s) / 2 : n.align === "right" ? r + o - s : r;
|
|
285
289
|
e.textAlign = "left";
|
|
286
290
|
let m = "";
|
|
287
|
-
|
|
288
|
-
e.fillText(d, c + e.measureText(m).width + h *
|
|
291
|
+
l.forEach((d, h) => {
|
|
292
|
+
e.fillText(d, c + e.measureText(m).width + h * i, a), m += d;
|
|
289
293
|
});
|
|
290
294
|
}
|
|
291
|
-
function
|
|
292
|
-
for (const
|
|
293
|
-
e.strokeStyle =
|
|
295
|
+
function Et(e, t, n, r, a, o, l) {
|
|
296
|
+
for (const i of Le(t, n))
|
|
297
|
+
e.strokeStyle = i.color, e.lineWidth = W(i.widthPt, l), e.beginPath(), i.kind === "v" ? (e.moveTo(r + i.pos * o, a + i.from * o), e.lineTo(r + i.pos * o, a + i.to * o)) : (e.moveTo(r + i.from * o, a + i.pos * o), e.lineTo(r + i.to * o, a + i.pos * o)), e.stroke();
|
|
294
298
|
}
|
|
295
|
-
function
|
|
296
|
-
e.beginPath(), t.top && (e.moveTo(n, r), e.lineTo(n +
|
|
299
|
+
function St(e, t, n, r, a, o) {
|
|
300
|
+
e.beginPath(), t.top && (e.moveTo(n, r), e.lineTo(n + a, r)), t.right && (e.moveTo(n + a, r), e.lineTo(n + a, r + o)), t.bottom && (e.moveTo(n + a, r + o), e.lineTo(n, r + o)), t.left && (e.moveTo(n, r + o), e.lineTo(n, r)), e.stroke();
|
|
297
301
|
}
|
|
298
|
-
function
|
|
299
|
-
const d =
|
|
302
|
+
function Tt(e, t, n, r, a, o, l, i, s, c, m) {
|
|
303
|
+
const d = Ne(t, o / i, l / i);
|
|
300
304
|
for (const g of d.cells) {
|
|
301
305
|
const f = g.cell.style?.backgroundColor ?? n.style?.backgroundColor;
|
|
302
|
-
f && (e.fillStyle = f, e.fillRect(r + g.xMm *
|
|
306
|
+
f && (e.fillStyle = f, e.fillRect(r + g.xMm * i, a + g.yMm * i, g.widthMm * i, g.heightMm * i));
|
|
303
307
|
}
|
|
304
|
-
|
|
308
|
+
Et(e, d, n, r, a, i, s);
|
|
305
309
|
const h = t.paddingMm ?? 0.5;
|
|
306
310
|
for (const g of d.cells) {
|
|
307
311
|
const f = g.cell.text ?? "";
|
|
308
312
|
if (!f) continue;
|
|
309
|
-
const w =
|
|
313
|
+
const w = Re(n.style, g.cell.style), C = _(w, s), x = g.cell.indentMm ?? 0, v = Math.max(0, g.widthMm - 2 * h - x), R = Ie(f, v, { fontSizePt: C.fontSizePt, bold: w.bold, italic: w.italic, fontFamily: w.fontFamily ?? c, letterSpacingPt: w.letterSpacing }, m).join(`
|
|
310
314
|
`);
|
|
311
315
|
We(
|
|
312
316
|
e,
|
|
@@ -315,274 +319,274 @@ function Ct(e, t, n, r, i, o, s, a, l, c, m) {
|
|
|
315
319
|
fontSizePx: C.fontSizePx,
|
|
316
320
|
bold: w.bold ?? !1,
|
|
317
321
|
italic: w.italic,
|
|
318
|
-
color:
|
|
322
|
+
color: Pe(w, Te),
|
|
319
323
|
align: w.align ?? "left",
|
|
320
324
|
lineHeight: ne(w),
|
|
321
|
-
letterSpacingPx: W(w.letterSpacing ?? 0,
|
|
325
|
+
letterSpacingPx: W(w.letterSpacing ?? 0, s)
|
|
322
326
|
},
|
|
323
|
-
r + (g.xMm + h + x) *
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
Math.max(0, g.heightMm - 2 * h) *
|
|
327
|
+
r + (g.xMm + h + x) * i,
|
|
328
|
+
a + (g.yMm + h) * i,
|
|
329
|
+
v * i,
|
|
330
|
+
Math.max(0, g.heightMm - 2 * h) * i,
|
|
327
331
|
w.fontFamily ?? c,
|
|
328
332
|
w.verticalAlign ?? "middle"
|
|
329
333
|
);
|
|
330
334
|
}
|
|
331
335
|
}
|
|
332
|
-
function
|
|
333
|
-
const c = t.style ?? {}, m =
|
|
336
|
+
function Ct(e, t, n, r, a, o, l, i, s) {
|
|
337
|
+
const c = t.style ?? {}, m = _(c, l), d = Ae(t) ? t.richParagraphs.map((h) => h.segments.map((g) => g.text ?? g.field ?? "").join("")).join(`
|
|
334
338
|
`) : t.lines?.length ? t.lines.join(`
|
|
335
|
-
`) :
|
|
339
|
+
`) : Ie(t.text ?? "", t.widthMm, { fontSizePt: m.fontSizePt, bold: c.bold, italic: c.italic, fontFamily: c.fontFamily ?? i, letterSpacingPt: c.letterSpacing }, s).join(`
|
|
336
340
|
`);
|
|
337
341
|
We(e, {
|
|
338
342
|
text: d,
|
|
339
343
|
fontSizePx: m.fontSizePx,
|
|
340
344
|
bold: c.bold ?? !1,
|
|
341
345
|
italic: c.italic,
|
|
342
|
-
color:
|
|
346
|
+
color: Pe(c),
|
|
343
347
|
align: c.align ?? "left",
|
|
344
348
|
lineHeight: ne(c),
|
|
345
|
-
letterSpacingPx: W(c.letterSpacing ?? 0,
|
|
346
|
-
}, n, r,
|
|
349
|
+
letterSpacingPx: W(c.letterSpacing ?? 0, l)
|
|
350
|
+
}, n, r, a, o, c.fontFamily ?? i, c.verticalAlign);
|
|
347
351
|
}
|
|
348
|
-
function ge(e, t, n, r,
|
|
349
|
-
const
|
|
352
|
+
function ge(e, t, n, r, a, o, l) {
|
|
353
|
+
const i = t.leftMm * n, s = t.topMm * n, c = t.widthMm * n, m = t.heightMm * n, d = t.style ?? {};
|
|
350
354
|
if (re(t)) {
|
|
351
|
-
const h =
|
|
352
|
-
h ?
|
|
355
|
+
const h = l?.get(t.imageData);
|
|
356
|
+
h ? yt(e, h, i, s, c, m) : Me(e, t, i, s, c, m);
|
|
353
357
|
return;
|
|
354
358
|
}
|
|
355
359
|
if (t.grid) {
|
|
356
|
-
|
|
360
|
+
Tt(e, t.grid, t, i, s, c, m, n, r, a, o);
|
|
357
361
|
return;
|
|
358
362
|
}
|
|
359
363
|
switch (t.kind) {
|
|
360
364
|
case "text": {
|
|
361
|
-
|
|
365
|
+
Ct(e, t, i, s, c, m, r, a, o);
|
|
362
366
|
break;
|
|
363
367
|
}
|
|
364
368
|
case "rect": {
|
|
365
|
-
const h = G(d), g =
|
|
366
|
-
d.backgroundColor && (e.fillStyle = d.backgroundColor, e.fillRect(
|
|
369
|
+
const h = G(d), g = Ce(d);
|
|
370
|
+
d.backgroundColor && (e.fillStyle = d.backgroundColor, e.fillRect(i, s, c, m)), g.inner && (e.strokeStyle = h.color, e.lineWidth = W(h.widthPt, r), St(e, g, i, s, c, m));
|
|
367
371
|
break;
|
|
368
372
|
}
|
|
369
373
|
case "line": {
|
|
370
374
|
const h = G({ ...d, borderColor: d.lineColor ?? d.borderColor });
|
|
371
375
|
e.strokeStyle = h.color, e.lineWidth = W(h.widthPt, r), e.beginPath();
|
|
372
|
-
const g = t.lineDirection === "up" ?
|
|
373
|
-
e.moveTo(
|
|
376
|
+
const g = t.lineDirection === "up" ? s + m : t.lineDirection === "down" ? s : s + m / 2, f = t.lineDirection === "up" ? s : t.lineDirection === "down" ? s + m : s + m / 2;
|
|
377
|
+
e.moveTo(i, g), e.lineTo(i + c, f), e.stroke();
|
|
374
378
|
break;
|
|
375
379
|
}
|
|
376
380
|
case "ellipse": {
|
|
377
381
|
const h = G(d);
|
|
378
|
-
e.strokeStyle = h.color, e.lineWidth = W(h.widthPt, r), d.backgroundColor && (e.fillStyle = d.backgroundColor, e.beginPath(), e.ellipse(
|
|
382
|
+
e.strokeStyle = h.color, e.lineWidth = W(h.widthPt, r), d.backgroundColor && (e.fillStyle = d.backgroundColor, e.beginPath(), e.ellipse(i + c / 2, s + m / 2, c / 2, m / 2, 0, 0, Math.PI * 2), e.fill()), e.beginPath(), e.ellipse(i + c / 2, s + m / 2, c / 2, m / 2, 0, 0, Math.PI * 2), e.stroke();
|
|
379
383
|
break;
|
|
380
384
|
}
|
|
381
385
|
default:
|
|
382
|
-
|
|
386
|
+
Me(e, t, i, s, c, m);
|
|
383
387
|
break;
|
|
384
388
|
}
|
|
385
389
|
}
|
|
386
|
-
function
|
|
387
|
-
e.save(), e.strokeStyle = "#94a3b8", e.strokeRect(n, r,
|
|
390
|
+
function Me(e, t, n, r, a, o) {
|
|
391
|
+
e.save(), e.strokeStyle = "#94a3b8", e.strokeRect(n, r, a, o), e.fillStyle = "#64748b", e.font = "12px sans-serif", e.fillText(t.fallbackText ?? `[${t.kind}]`, n + 3, r + 14), e.restore();
|
|
388
392
|
}
|
|
389
|
-
async function
|
|
393
|
+
async function An(e, t = {}) {
|
|
390
394
|
if (typeof document > "u")
|
|
391
395
|
throw new Error("renderPlanToImages 需要浏览器环境(SSR/Node 请在客户端钩子中调用)");
|
|
392
|
-
const { format: n = "png", quality: r = 0.92, ...
|
|
396
|
+
const { format: n = "png", quality: r = 0.92, ...a } = t;
|
|
393
397
|
if (n !== "png" && n !== "jpeg") throw new TypeError("Image format must be png or jpeg.");
|
|
394
398
|
if (!Number.isFinite(r) || r < 0 || r > 1) throw new RangeError("Image quality must be between 0 and 1.");
|
|
395
399
|
$(t.signal);
|
|
396
|
-
const o = await
|
|
400
|
+
const o = await me(e, { ...t, format: "canvas" });
|
|
397
401
|
e = o.plan;
|
|
398
|
-
const
|
|
402
|
+
const l = [...o.diagnostics, ...q(e, "canvas", t)], i = n === "jpeg" ? "image/jpeg" : "image/png", s = [], c = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1);
|
|
399
403
|
for (let m = Math.max(0, t.start ?? 0); m <= c; m++) {
|
|
400
404
|
$(t.signal);
|
|
401
|
-
const d = await
|
|
405
|
+
const d = await Be(e.pages[m], m, a, l);
|
|
402
406
|
try {
|
|
403
|
-
|
|
407
|
+
s.push(await Rt(d, i, r, t.signal));
|
|
404
408
|
} finally {
|
|
405
409
|
d.width = 0, d.height = 0;
|
|
406
410
|
}
|
|
407
|
-
await
|
|
411
|
+
await tt(t, s.length, c - Math.max(0, t.start ?? 0) + 1);
|
|
408
412
|
}
|
|
409
|
-
return $(t.signal), { blobs:
|
|
413
|
+
return $(t.signal), { blobs: s, diagnostics: l };
|
|
410
414
|
}
|
|
411
|
-
function
|
|
412
|
-
return $(r), new Promise((
|
|
413
|
-
const
|
|
414
|
-
r?.addEventListener("abort",
|
|
415
|
+
function Rt(e, t, n, r) {
|
|
416
|
+
return $(r), new Promise((a, o) => {
|
|
417
|
+
const l = () => o(r?.reason ?? new DOMException("The operation was aborted.", "AbortError"));
|
|
418
|
+
r?.addEventListener("abort", l, { once: !0 });
|
|
415
419
|
try {
|
|
416
|
-
e.toBlob((
|
|
417
|
-
r?.removeEventListener("abort",
|
|
420
|
+
e.toBlob((i) => {
|
|
421
|
+
r?.removeEventListener("abort", l), i ? a(i) : o(new Error("Canvas encoding failed; no empty image was emitted."));
|
|
418
422
|
}, t, n);
|
|
419
|
-
} catch (
|
|
420
|
-
r?.removeEventListener("abort",
|
|
423
|
+
} catch (i) {
|
|
424
|
+
r?.removeEventListener("abort", l), o(i);
|
|
421
425
|
}
|
|
422
426
|
});
|
|
423
427
|
}
|
|
424
|
-
function
|
|
428
|
+
function $n(e, t = {}) {
|
|
425
429
|
if ($(t.signal), typeof document > "u")
|
|
426
430
|
throw new Error("renderPlanToCanvas 需要浏览器环境(SSR 请在客户端钩子中调用)");
|
|
427
|
-
const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96,
|
|
431
|
+
const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, a = r / 96 * de, o = t.fontFamily ?? te, l = t.measurer ?? le, i = Math.max(0, t.start ?? 0), s = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1), c = [], m = q(e, "canvas", t), d = Pt(e, i, s);
|
|
428
432
|
for (const h of d)
|
|
429
|
-
|
|
430
|
-
if (t.fidelity === "strict" && d.length) throw new
|
|
431
|
-
for (let h =
|
|
433
|
+
De(h, t), m.push(h);
|
|
434
|
+
if (t.fidelity === "strict" && d.length) throw new et(m);
|
|
435
|
+
for (let h = i; h <= s; h++) {
|
|
432
436
|
$(t.signal);
|
|
433
|
-
const g = e.pages[h], { canvas: f, ctx: w } =
|
|
437
|
+
const g = e.pages[h], { canvas: f, ctx: w } = ze(g, n, r, t.maxCanvasPixels);
|
|
434
438
|
for (const C of g.components)
|
|
435
|
-
ge(w, C,
|
|
439
|
+
ge(w, C, a, r, o, l);
|
|
436
440
|
c.push(f);
|
|
437
441
|
}
|
|
438
442
|
return { canvases: c, diagnostics: m };
|
|
439
443
|
}
|
|
440
|
-
function
|
|
441
|
-
return n < t ? [] : e.pages.slice(t, n + 1).flatMap((r,
|
|
444
|
+
function Pt(e, t, n) {
|
|
445
|
+
return n < t ? [] : e.pages.slice(t, n + 1).flatMap((r, a) => r.components.flatMap((o, l) => re(o) ? [{
|
|
442
446
|
code: "async-image-required",
|
|
443
447
|
severity: "warning",
|
|
444
448
|
format: "canvas",
|
|
445
|
-
pageIndex: t +
|
|
446
|
-
componentIndex:
|
|
449
|
+
pageIndex: t + a,
|
|
450
|
+
componentIndex: l,
|
|
447
451
|
kind: o.kind,
|
|
448
452
|
nid: o.nid,
|
|
449
453
|
message: "Use renderPlanToCanvasAsync or renderPlanToImages to decode and include images."
|
|
450
454
|
}] : []));
|
|
451
455
|
}
|
|
452
|
-
async function
|
|
456
|
+
async function kn(e, t = {}) {
|
|
453
457
|
if (typeof document > "u") throw new Error("renderPlanToCanvasAsync 需要浏览器环境(Node 请使用 PDF 或 XLSX 输出)");
|
|
454
458
|
$(t.signal);
|
|
455
|
-
const n = await
|
|
459
|
+
const n = await me(e, { ...t, format: "canvas" });
|
|
456
460
|
e = n.plan;
|
|
457
|
-
const r = [...n.diagnostics, ...q(e, "canvas", t)],
|
|
458
|
-
for (let
|
|
459
|
-
|
|
460
|
-
return { canvases:
|
|
461
|
+
const r = [...n.diagnostics, ...q(e, "canvas", t)], a = [], o = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1);
|
|
462
|
+
for (let l = Math.max(0, t.start ?? 0); l <= o; l++)
|
|
463
|
+
a.push(await Be(e.pages[l], l, t, r));
|
|
464
|
+
return { canvases: a, diagnostics: r };
|
|
461
465
|
}
|
|
462
|
-
async function
|
|
463
|
-
const
|
|
466
|
+
async function Be(e, t, n, r) {
|
|
467
|
+
const a = n.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), o = n.dpi ?? 96, l = n.fontFamily ?? te, i = await je(e, t, n, r);
|
|
464
468
|
$(n.signal);
|
|
465
|
-
const { canvas:
|
|
466
|
-
for (const m of e.components) ge(c, m, o / 25.4, o,
|
|
467
|
-
return
|
|
469
|
+
const { canvas: s, ctx: c } = ze(e, a, o, n.maxCanvasPixels);
|
|
470
|
+
for (const m of e.components) ge(c, m, o / 25.4, o, l, n.measurer ?? le, i);
|
|
471
|
+
return s;
|
|
468
472
|
}
|
|
469
473
|
async function je(e, t, n, r) {
|
|
470
|
-
const
|
|
471
|
-
return
|
|
474
|
+
const a = n.imageLoader ?? wt;
|
|
475
|
+
return Mt(e, async (o, l) => {
|
|
472
476
|
try {
|
|
473
|
-
return await
|
|
474
|
-
} catch (
|
|
475
|
-
if (
|
|
476
|
-
const
|
|
477
|
-
throw r.push(m),
|
|
477
|
+
return await a(o, l);
|
|
478
|
+
} catch (i) {
|
|
479
|
+
if (l?.aborted) throw i;
|
|
480
|
+
const s = e.components.findIndex((d) => d.imageData === o), c = e.components[s], m = { code: "image-decode-failed", severity: "warning", format: "canvas", pageIndex: t, componentIndex: s, kind: c.kind, nid: c.nid, message: "Image decoding failed; raster output was cancelled instead of omitting the image." };
|
|
481
|
+
throw r.push(m), De(m, n), i;
|
|
478
482
|
}
|
|
479
483
|
}, n.signal);
|
|
480
484
|
}
|
|
481
|
-
function
|
|
482
|
-
const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96,
|
|
483
|
-
let g = null, f = null, w = null, C = null, x = [],
|
|
485
|
+
function In(e, t = {}) {
|
|
486
|
+
const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, a = r / 96 * de, o = t.fontFamily ?? te, l = t.measurer ?? le, i = t.overscan ?? 1, s = t.gapPx ?? 18, c = t.pagesPerFrame ?? 1, m = e.pages.map((u) => u.pageHeightMm * a), d = Math.max(1, ...e.pages.map((u) => u.pageWidthMm * a)), h = { start: 0, end: -1 };
|
|
487
|
+
let g = null, f = null, w = null, C = null, x = [], v = 0, R = [], H = 0, N = new AbortController();
|
|
484
488
|
const ue = [];
|
|
485
|
-
function
|
|
489
|
+
function Ve() {
|
|
486
490
|
const u = g;
|
|
487
491
|
u.innerHTML = "", f = document.createElement("div"), f.style.cssText = `width:${d}px;margin:0 auto;`, w = document.createElement("div"), C = document.createElement("div"), f.appendChild(w), x = [];
|
|
488
|
-
const E = Math.min(e.pages.length, 3 +
|
|
489
|
-
for (let
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
+
const E = Math.min(e.pages.length, 3 + i * 2);
|
|
493
|
+
for (let F = 0; F < E; F++) {
|
|
494
|
+
const M = document.createElement("div");
|
|
495
|
+
M.style.cssText = `margin:0 auto ${s}px;box-shadow:0 2px 8px rgba(0,0,0,.35);background:#fff;`, f.appendChild(M), x.push(M);
|
|
492
496
|
}
|
|
493
497
|
f.appendChild(C), u.appendChild(f);
|
|
494
498
|
}
|
|
495
|
-
async function
|
|
496
|
-
const
|
|
497
|
-
ue.push(...
|
|
498
|
-
const P =
|
|
499
|
-
if (
|
|
500
|
-
const { widthPx:
|
|
501
|
-
let
|
|
502
|
-
(!
|
|
503
|
-
const we =
|
|
504
|
-
|
|
505
|
-
const
|
|
506
|
-
if (
|
|
507
|
-
|
|
499
|
+
async function qe(u, E) {
|
|
500
|
+
const F = H, M = await me(e, { ...t, signal: N.signal, format: "canvas", start: E, end: E });
|
|
501
|
+
ue.push(...M.diagnostics);
|
|
502
|
+
const P = M.plan.pages[E], J = await je(P, E, { ...t, signal: N.signal }, ue);
|
|
503
|
+
if (F !== H || !g) return;
|
|
504
|
+
const { widthPx: ie, heightPx: oe } = he(P, r);
|
|
505
|
+
let L = u.firstElementChild;
|
|
506
|
+
(!L || L.tagName !== "CANVAS") && (L = document.createElement("canvas"), u.innerHTML = "", u.appendChild(L));
|
|
507
|
+
const we = He(P, n, r, t.maxCanvasPixels);
|
|
508
|
+
L.width = we.width, L.height = we.height, L.style.width = `${ie}px`, L.style.height = `${oe}px`;
|
|
509
|
+
const z = L.getContext("2d");
|
|
510
|
+
if (z) {
|
|
511
|
+
z.setTransform(1, 0, 0, 1, 0, 0), z.scale(n, n), z.fillStyle = "#ffffff", z.fillRect(0, 0, ie, oe);
|
|
508
512
|
for (const Ke of P.components)
|
|
509
|
-
ge(
|
|
510
|
-
|
|
513
|
+
ge(z, Ke, a, r, o, l, J);
|
|
514
|
+
L.dataset.canvasPage = String(E), u.style.height = `${oe}px`, u.style.width = `${ie}px`;
|
|
511
515
|
}
|
|
512
516
|
}
|
|
513
517
|
function Ye(u) {
|
|
514
|
-
|
|
518
|
+
H++, h.start = u.start, h.end = u.end, w.style.height = `${u.start * s + m.slice(0, u.start).reduce((M, P) => M + P, 0)}px`;
|
|
515
519
|
const E = e.pages.length - 1 - u.end;
|
|
516
|
-
C.style.height = `${E *
|
|
517
|
-
const
|
|
518
|
-
x.forEach((
|
|
519
|
-
if (P <
|
|
520
|
-
|
|
521
|
-
const
|
|
522
|
-
|
|
520
|
+
C.style.height = `${E * s + m.slice(u.end + 1).reduce((M, P) => M + P, 0)}px`;
|
|
521
|
+
const F = u.end - u.start + 1;
|
|
522
|
+
x.forEach((M, P) => {
|
|
523
|
+
if (P < F) {
|
|
524
|
+
M.style.display = "";
|
|
525
|
+
const J = u.start + P;
|
|
526
|
+
M.style.height = `${m[J] ?? 0}px`;
|
|
523
527
|
} else
|
|
524
|
-
|
|
528
|
+
M.style.display = "none";
|
|
525
529
|
}), R = [];
|
|
526
|
-
for (let
|
|
527
|
-
const P = x[
|
|
530
|
+
for (let M = u.start; M <= u.end; M++) {
|
|
531
|
+
const P = x[M - u.start];
|
|
528
532
|
if (!P) continue;
|
|
529
|
-
P.firstElementChild?.dataset?.canvasPage !== String(
|
|
533
|
+
P.firstElementChild?.dataset?.canvasPage !== String(M) && R.push(M);
|
|
530
534
|
}
|
|
531
|
-
|
|
535
|
+
ae();
|
|
532
536
|
}
|
|
533
|
-
function
|
|
534
|
-
|
|
535
|
-
|
|
537
|
+
function ae() {
|
|
538
|
+
v || R.length === 0 || (v = requestAnimationFrame(() => {
|
|
539
|
+
v = 0;
|
|
536
540
|
let u = Math.max(1, c);
|
|
537
541
|
for (; R.length > 0 && u-- > 0; ) {
|
|
538
|
-
const E = R.shift(),
|
|
539
|
-
|
|
542
|
+
const E = R.shift(), F = x[E - h.start];
|
|
543
|
+
F && qe(F, E).catch(() => {
|
|
540
544
|
});
|
|
541
545
|
}
|
|
542
|
-
R.length > 0 &&
|
|
546
|
+
R.length > 0 && ae();
|
|
543
547
|
}));
|
|
544
548
|
}
|
|
545
|
-
function
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
const u = g, E =
|
|
549
|
+
function Y() {
|
|
550
|
+
v || (v = requestAnimationFrame(() => {
|
|
551
|
+
v = 0;
|
|
552
|
+
const u = g, E = vt({
|
|
549
553
|
pageHeightsPx: m,
|
|
550
554
|
viewportHeightPx: u.clientHeight,
|
|
551
555
|
scrollTopPx: u.scrollTop,
|
|
552
|
-
overscan:
|
|
553
|
-
gapPx:
|
|
556
|
+
overscan: i,
|
|
557
|
+
gapPx: s
|
|
554
558
|
});
|
|
555
|
-
E.start !== h.start || E.end !== h.end ? Ye(E) :
|
|
559
|
+
E.start !== h.start || E.end !== h.end ? Ye(E) : ae();
|
|
556
560
|
}));
|
|
557
561
|
}
|
|
558
|
-
let
|
|
562
|
+
let K = null;
|
|
559
563
|
return {
|
|
560
564
|
attach(u) {
|
|
561
565
|
if (typeof document > "u")
|
|
562
566
|
throw new Error("createCanvasPager 需要浏览器环境(SSR 请在客户端钩子中调用 attach)");
|
|
563
|
-
$(t.signal),
|
|
567
|
+
$(t.signal), N = new AbortController(), t.signal?.addEventListener("abort", pe, { once: !0 }), q(e, "canvas", t), g = u, Ve(), u.addEventListener("scroll", Y, { passive: !0 }), typeof ResizeObserver < "u" && (K = new ResizeObserver(() => Y()), K.observe(u)), Y();
|
|
564
568
|
},
|
|
565
569
|
destroy() {
|
|
566
|
-
|
|
570
|
+
H++, N.abort(), t.signal?.removeEventListener("abort", pe), v && cancelAnimationFrame(v), v = 0, K?.disconnect(), K = null, g?.removeEventListener("scroll", Y), R = [], f?.remove(), g = null;
|
|
567
571
|
},
|
|
568
572
|
window() {
|
|
569
573
|
return { ...h };
|
|
570
574
|
}
|
|
571
575
|
};
|
|
572
576
|
function pe() {
|
|
573
|
-
|
|
577
|
+
N.abort(t.signal?.reason);
|
|
574
578
|
}
|
|
575
579
|
}
|
|
576
|
-
function
|
|
577
|
-
let r,
|
|
580
|
+
function _e(e, t, n) {
|
|
581
|
+
let r, a;
|
|
578
582
|
if (typeof e == "string") {
|
|
579
583
|
const o = Z[e];
|
|
580
584
|
if (!o) throw new Error(`未知纸张预设 "${e}"(可用:${Object.keys(Z).join("/")})`);
|
|
581
|
-
r = o.widthMm,
|
|
582
|
-
} else typeof e == "number" ? (r = e,
|
|
583
|
-
return n ? { widthMm:
|
|
585
|
+
r = o.widthMm, a = o.heightMm;
|
|
586
|
+
} else typeof e == "number" ? (r = e, a = t ?? 297) : (r = e.widthMm, a = e.heightMm);
|
|
587
|
+
return n ? { widthMm: a, heightMm: r } : { widthMm: r, heightMm: a };
|
|
584
588
|
}
|
|
585
|
-
class
|
|
589
|
+
class At {
|
|
586
590
|
constructor() {
|
|
587
591
|
this.pages = [], this.pending = null, this.templateParams = void 0;
|
|
588
592
|
}
|
|
@@ -615,18 +619,18 @@ class $t {
|
|
|
615
619
|
*/
|
|
616
620
|
page(t = "a4", n = {}, r) {
|
|
617
621
|
this.collect();
|
|
618
|
-
const o = r != null && !("margins" in r) && !("landscape" in r) && ("marginTopMm" in r || "marginBottomMm" in r || "marginLeftMm" in r || "marginRightMm" in r) ? { margins: r } : typeof n == "number" ? r ?? {} : n, { widthMm:
|
|
622
|
+
const o = r != null && !("margins" in r) && !("landscape" in r) && ("marginTopMm" in r || "marginBottomMm" in r || "marginLeftMm" in r || "marginRightMm" in r) ? { margins: r } : typeof n == "number" ? r ?? {} : n, { widthMm: l, heightMm: i } = _e(
|
|
619
623
|
t,
|
|
620
624
|
typeof n == "number" ? n : void 0,
|
|
621
625
|
o.landscape
|
|
622
|
-
),
|
|
623
|
-
return this.pending = new
|
|
624
|
-
widthMm:
|
|
625
|
-
heightMm:
|
|
626
|
-
marginTopMm:
|
|
627
|
-
marginBottomMm:
|
|
628
|
-
marginLeftMm:
|
|
629
|
-
marginRightMm:
|
|
626
|
+
), s = o.margins ?? {};
|
|
627
|
+
return this.pending = new $t(this, {
|
|
628
|
+
widthMm: l,
|
|
629
|
+
heightMm: i,
|
|
630
|
+
marginTopMm: s.marginTopMm ?? 10,
|
|
631
|
+
marginBottomMm: s.marginBottomMm ?? 10,
|
|
632
|
+
marginLeftMm: s.marginLeftMm ?? 10,
|
|
633
|
+
marginRightMm: s.marginRightMm ?? 10
|
|
630
634
|
}), this.pending;
|
|
631
635
|
}
|
|
632
636
|
collect() {
|
|
@@ -642,7 +646,7 @@ class $t {
|
|
|
642
646
|
};
|
|
643
647
|
}
|
|
644
648
|
}
|
|
645
|
-
class
|
|
649
|
+
class $t {
|
|
646
650
|
constructor(t, n) {
|
|
647
651
|
this.parent = t, this.page = n, this.components = [];
|
|
648
652
|
}
|
|
@@ -657,7 +661,7 @@ class kt {
|
|
|
657
661
|
style: r
|
|
658
662
|
}), this;
|
|
659
663
|
}
|
|
660
|
-
list(t, n, r,
|
|
664
|
+
list(t, n, r, a = {}) {
|
|
661
665
|
return this.components.push({
|
|
662
666
|
kind: "list",
|
|
663
667
|
leftMm: n.leftMm ?? 10,
|
|
@@ -665,20 +669,20 @@ class kt {
|
|
|
665
669
|
widthMm: n.widthMm ?? 180,
|
|
666
670
|
dataset: t,
|
|
667
671
|
columns: r,
|
|
668
|
-
...
|
|
672
|
+
...a
|
|
669
673
|
}), this;
|
|
670
674
|
}
|
|
671
675
|
rect(t, n = {}) {
|
|
672
676
|
return this.components.push({ kind: "rect", ...t, style: n }), this;
|
|
673
677
|
}
|
|
674
|
-
line(t, n, r,
|
|
678
|
+
line(t, n, r, a = {}) {
|
|
675
679
|
return this.components.push({
|
|
676
680
|
kind: "line",
|
|
677
681
|
leftMm: t,
|
|
678
682
|
topMm: n,
|
|
679
683
|
widthMm: r,
|
|
680
684
|
heightMm: 0.5,
|
|
681
|
-
style:
|
|
685
|
+
style: a
|
|
682
686
|
}), this;
|
|
683
687
|
}
|
|
684
688
|
barcode(t, n) {
|
|
@@ -691,11 +695,11 @@ class kt {
|
|
|
691
695
|
fallbackText: t
|
|
692
696
|
}), this;
|
|
693
697
|
}
|
|
694
|
-
qrcode(t, n, r,
|
|
698
|
+
qrcode(t, n, r, a) {
|
|
695
699
|
return this.components.push({
|
|
696
700
|
kind: "qrcode",
|
|
697
701
|
leftMm: r,
|
|
698
|
-
topMm:
|
|
702
|
+
topMm: a,
|
|
699
703
|
widthMm: n,
|
|
700
704
|
heightMm: n,
|
|
701
705
|
fallbackText: t
|
|
@@ -711,11 +715,11 @@ class kt {
|
|
|
711
715
|
return this.done().build();
|
|
712
716
|
}
|
|
713
717
|
}
|
|
714
|
-
function
|
|
715
|
-
return new
|
|
718
|
+
function Nn() {
|
|
719
|
+
return new At();
|
|
716
720
|
}
|
|
717
|
-
function
|
|
718
|
-
return
|
|
721
|
+
function Ln(e, t = {}) {
|
|
722
|
+
return Xe([], e), e.fields.map((n) => ({
|
|
719
723
|
field: n.field,
|
|
720
724
|
header: `${n.label ?? n.field}${n.unit ? ` (${n.unit})` : ""}`,
|
|
721
725
|
semanticRole: n.semanticRole ?? (n.type === "number" || n.type === "decimal" ? "measure" : n.type === "date" ? "date" : n.enum ? "dimension" : "text"),
|
|
@@ -730,7 +734,7 @@ function Q(e, t, n) {
|
|
|
730
734
|
if (e !== void 0 && !["left", "center", "right", "justify", ...n ? ["auto"] : []].includes(e))
|
|
731
735
|
throw new Error(`${t} 必须是 left/center/right/justify${n ? "/auto" : ""}`);
|
|
732
736
|
}
|
|
733
|
-
function
|
|
737
|
+
function kt(e) {
|
|
734
738
|
const t = e.layout ?? "page";
|
|
735
739
|
if (t !== "page" && t !== "wide")
|
|
736
740
|
throw new Error("layout 必须是 page 或 wide");
|
|
@@ -741,16 +745,16 @@ function It(e) {
|
|
|
741
745
|
const n = e.columnWidthMm ?? 30;
|
|
742
746
|
return k(n, "columnWidthMm"), { layout: t, columnWidthMm: n };
|
|
743
747
|
}
|
|
744
|
-
function
|
|
748
|
+
function It(e) {
|
|
745
749
|
const t = e.paper === void 0 ? "a4" : e.paper;
|
|
746
750
|
if (typeof t != "string" && (typeof t != "object" || t === null) || e.landscape !== void 0 && typeof e.landscape != "boolean")
|
|
747
751
|
throw new Error("paper 必须是纸张预设名或 { widthMm, heightMm } 对象,landscape 必须是布尔值");
|
|
748
752
|
if (typeof t == "string" && !Object.prototype.hasOwnProperty.call(Z, t))
|
|
749
753
|
throw new Error(`未知纸张预设 "${t}"(可用:${Object.keys(Z).join("/")})`);
|
|
750
|
-
const n =
|
|
751
|
-
return k(r, "纸张 widthMm"), k(
|
|
754
|
+
const n = _e(t, void 0, e.landscape), r = n.widthMm, a = n.heightMm;
|
|
755
|
+
return k(r, "纸张 widthMm"), k(a, "纸张 heightMm"), { widthMm: r, heightMm: a };
|
|
752
756
|
}
|
|
753
|
-
function
|
|
757
|
+
function Nt(e) {
|
|
754
758
|
if (e.margins !== void 0 && (!e.margins || typeof e.margins != "object" || Array.isArray(e.margins)))
|
|
755
759
|
throw new Error("margins 必须是页边距对象");
|
|
756
760
|
const t = e.margins ?? {}, n = {
|
|
@@ -759,23 +763,23 @@ function Lt(e) {
|
|
|
759
763
|
marginLeftMm: t.marginLeftMm === void 0 ? 10 : t.marginLeftMm,
|
|
760
764
|
marginRightMm: t.marginRightMm === void 0 ? 10 : t.marginRightMm
|
|
761
765
|
};
|
|
762
|
-
for (const [r,
|
|
766
|
+
for (const [r, a] of Object.entries(n)) k(a, r, !0);
|
|
763
767
|
return n;
|
|
764
768
|
}
|
|
765
|
-
function
|
|
769
|
+
function Lt(e, t) {
|
|
766
770
|
const n = e.dataset === void 0 ? "detail" : e.dataset;
|
|
767
771
|
if (typeof n != "string" || !n.trim())
|
|
768
772
|
throw new Error("dataset 必须是非空字符串");
|
|
769
773
|
if (e.title !== void 0 && typeof e.title != "string")
|
|
770
774
|
throw new Error("title 必须是字符串");
|
|
771
|
-
const r = e.titleHeightMm === void 0 ? 10 : e.titleHeightMm,
|
|
772
|
-
k(r, "titleHeightMm"), k(
|
|
773
|
-
const o = e.title !== void 0 && e.title.length > 0,
|
|
774
|
-
if (
|
|
775
|
+
const r = e.titleHeightMm === void 0 ? 10 : e.titleHeightMm, a = e.titleGapMm === void 0 ? 4 : e.titleGapMm;
|
|
776
|
+
k(r, "titleHeightMm"), k(a, "titleGapMm", !0);
|
|
777
|
+
const o = e.title !== void 0 && e.title.length > 0, l = o ? r + a : 0;
|
|
778
|
+
if (l >= t)
|
|
775
779
|
throw new Error("标题高度与间距占满页面,必须为表格保留可用高度");
|
|
776
|
-
return { dataset: n, titleHeightMm: r, hasTitle: o, titleSpaceMm:
|
|
780
|
+
return { dataset: n, titleHeightMm: r, hasTitle: o, titleSpaceMm: l };
|
|
777
781
|
}
|
|
778
|
-
function
|
|
782
|
+
function Dt(e) {
|
|
779
783
|
if (e.listOptions !== void 0 && (!e.listOptions || typeof e.listOptions != "object" || Array.isArray(e.listOptions)))
|
|
780
784
|
throw new Error("listOptions 必须是列表配置对象");
|
|
781
785
|
const t = e.listOptions ?? {};
|
|
@@ -786,49 +790,49 @@ function Ft(e) {
|
|
|
786
790
|
}
|
|
787
791
|
return t;
|
|
788
792
|
}
|
|
789
|
-
function
|
|
793
|
+
function Ft(e) {
|
|
790
794
|
let t = 0, n = 0;
|
|
791
|
-
for (const [r,
|
|
792
|
-
if (!
|
|
795
|
+
for (const [r, a] of e.entries()) {
|
|
796
|
+
if (!a || typeof a.header != "string" || typeof a.field != "string" || !a.field.trim())
|
|
793
797
|
throw new Error(`columns[${r}] 需要字符串 header 与非空 field`);
|
|
794
|
-
Q(
|
|
798
|
+
Q(a.align, `columns[${r}].align`, !0), Q(a.headerAlign, `columns[${r}].headerAlign`, !1), a.flex !== void 0 && k(a.flex, `columns[${r}].flex`), a.widthMm !== void 0 ? (k(a.widthMm, `columns[${r}].widthMm`), t += a.widthMm) : n = Math.max(n, a.flex ?? 1);
|
|
795
799
|
}
|
|
796
800
|
return { fixedWidthMm: t, maxFlex: n };
|
|
797
801
|
}
|
|
798
|
-
function
|
|
799
|
-
const { fixedWidthMm:
|
|
800
|
-
if (t === "page" &&
|
|
801
|
-
throw new Error(`固定列宽 ${
|
|
802
|
-
const
|
|
803
|
-
if (t === "page" && o > 0 &&
|
|
802
|
+
function Ot(e, t, n, r) {
|
|
803
|
+
const { fixedWidthMm: a, maxFlex: o } = Ft(e.columns);
|
|
804
|
+
if (t === "page" && a > r)
|
|
805
|
+
throw new Error(`固定列宽 ${a}mm 超出页面可用宽度 ${r}mm`);
|
|
806
|
+
const l = r - a;
|
|
807
|
+
if (t === "page" && o > 0 && l <= 0)
|
|
804
808
|
throw new Error("固定列占满页面可用宽度,自动列需要正的剩余宽度");
|
|
805
|
-
const
|
|
809
|
+
const i = o > 0 ? e.columns.reduce((c, m) => c + (m.widthMm === void 0 ? (m.flex ?? 1) / o : 0), 0) : 0;
|
|
806
810
|
return { columns: e.columns.map(({ widthMm: c, flex: m, ...d }, h) => {
|
|
807
|
-
const g = c ?? (t === "wide" ? n * (m ?? 1) :
|
|
811
|
+
const g = c ?? (t === "wide" ? n * (m ?? 1) : l * ((m ?? 1) / o) / i);
|
|
808
812
|
return k(g, `columns[${h}] 分配后的 widthMm`), { ...d, widthMm: g };
|
|
809
|
-
}), fixedWidthMm:
|
|
813
|
+
}), fixedWidthMm: a, maxFlex: o };
|
|
810
814
|
}
|
|
811
|
-
function
|
|
815
|
+
function Dn(e) {
|
|
812
816
|
if (!e || typeof e != "object")
|
|
813
817
|
throw new Error("标准明细模板需要 options 对象");
|
|
814
818
|
if (!Array.isArray(e.columns) || e.columns.length === 0)
|
|
815
819
|
throw new Error("columns 至少需要一列");
|
|
816
|
-
const { layout: t, columnWidthMm: n } =
|
|
817
|
-
let
|
|
818
|
-
const o = r.heightMm,
|
|
819
|
-
let
|
|
820
|
-
const
|
|
821
|
-
if (t === "page" &&
|
|
820
|
+
const { layout: t, columnWidthMm: n } = kt(e), r = It(e);
|
|
821
|
+
let a = r.widthMm;
|
|
822
|
+
const o = r.heightMm, l = Nt(e);
|
|
823
|
+
let i = a - l.marginLeftMm - l.marginRightMm;
|
|
824
|
+
const s = o - l.marginTopMm - l.marginBottomMm;
|
|
825
|
+
if (t === "page" && i <= 0 || s <= 0)
|
|
822
826
|
throw new Error("页边距占满纸张,必须保留正的可用宽度和高度");
|
|
823
|
-
const { dataset: c, titleHeightMm: m, hasTitle: d, titleSpaceMm: h } =
|
|
824
|
-
t === "wide" && (
|
|
825
|
-
const x = { widthMm:
|
|
827
|
+
const { dataset: c, titleHeightMm: m, hasTitle: d, titleSpaceMm: h } = Lt(e, s), g = Dt(e), { columns: f, fixedWidthMm: w, maxFlex: C } = Ot(e, t, n, i);
|
|
828
|
+
t === "wide" && (i = f.reduce((v, R) => v + R.widthMm, 0), k(i, "宽表总列宽"), a = i + l.marginLeftMm + l.marginRightMm, k(a, "宽表总宽度"));
|
|
829
|
+
const x = { widthMm: a, heightMm: o, ...l, components: [], ...t === "wide" ? { layout: t } : {} };
|
|
826
830
|
return d && x.components.push({
|
|
827
831
|
kind: "text",
|
|
828
832
|
text: e.title,
|
|
829
|
-
leftMm:
|
|
830
|
-
topMm:
|
|
831
|
-
widthMm:
|
|
833
|
+
leftMm: l.marginLeftMm,
|
|
834
|
+
topMm: l.marginTopMm,
|
|
835
|
+
widthMm: i,
|
|
832
836
|
heightMm: m,
|
|
833
837
|
style: { fontSize: 16, bold: !0, align: "center", verticalAlign: "middle", ...e.titleStyle }
|
|
834
838
|
}), x.components.push({
|
|
@@ -840,52 +844,52 @@ function Fn(e) {
|
|
|
840
844
|
...d ? { title: e.title } : {},
|
|
841
845
|
dataset: c,
|
|
842
846
|
columns: f,
|
|
843
|
-
leftMm:
|
|
844
|
-
topMm:
|
|
845
|
-
widthMm: t === "wide" || C > 0 ?
|
|
847
|
+
leftMm: l.marginLeftMm,
|
|
848
|
+
topMm: l.marginTopMm + h,
|
|
849
|
+
widthMm: t === "wide" || C > 0 ? i : w
|
|
846
850
|
}), e.params === void 0 ? { pages: [x] } : { params: e.params, pages: [x] };
|
|
847
851
|
}
|
|
848
|
-
function
|
|
852
|
+
function Fn(e) {
|
|
849
853
|
if (e.components !== void 0 && e.pages !== void 0) throw new TypeError("标签 components 与 pages 只能选择一种");
|
|
850
|
-
const { dataset: t, rowKey: n, copies: r, params:
|
|
854
|
+
const { dataset: t, rowKey: n, copies: r, params: a } = e, o = e.pages ?? [{ components: e.components ?? [] }], l = {
|
|
851
855
|
repeat: { dataset: t, ...n === void 0 ? {} : { rowKey: n }, ...r === void 0 ? {} : { copies: r } },
|
|
852
|
-
...
|
|
853
|
-
pages: o.map((
|
|
854
|
-
widthMm:
|
|
855
|
-
heightMm:
|
|
856
|
+
...a === void 0 ? {} : { params: a },
|
|
857
|
+
pages: o.map((s) => ({
|
|
858
|
+
widthMm: s.widthMm ?? e.widthMm ?? 80,
|
|
859
|
+
heightMm: s.heightMm ?? e.heightMm ?? 55,
|
|
856
860
|
marginTopMm: 0,
|
|
857
861
|
marginRightMm: 0,
|
|
858
862
|
marginBottomMm: 0,
|
|
859
863
|
marginLeftMm: 0,
|
|
860
|
-
components:
|
|
861
|
-
...
|
|
864
|
+
components: s.components,
|
|
865
|
+
...s.meta === void 0 ? {} : { meta: s.meta }
|
|
862
866
|
}))
|
|
863
|
-
},
|
|
864
|
-
if (!
|
|
865
|
-
return JSON.parse(JSON.stringify(
|
|
867
|
+
}, i = $e(l);
|
|
868
|
+
if (!i.ok) throw new ke(i.errors);
|
|
869
|
+
return JSON.parse(JSON.stringify(l));
|
|
866
870
|
}
|
|
867
|
-
function
|
|
871
|
+
function Ht(e) {
|
|
868
872
|
if (!e || typeof e != "object" || !e.repeat)
|
|
869
|
-
throw new
|
|
870
|
-
const t =
|
|
871
|
-
if (!t.ok) throw new
|
|
873
|
+
throw new ce("config", "defineLabelReport 需要带 repeat 的固定标签模板");
|
|
874
|
+
const t = $e(e);
|
|
875
|
+
if (!t.ok) throw new ke(t.errors);
|
|
872
876
|
return e.repeat.dataset;
|
|
873
877
|
}
|
|
874
|
-
function
|
|
875
|
-
if (!Array.isArray(e)) throw new
|
|
878
|
+
function ye(e, t) {
|
|
879
|
+
if (!Array.isArray(e)) throw new ce("validate", "标签数据应为对象数组;请从业务响应中提取行数组");
|
|
876
880
|
return { [t]: e };
|
|
877
881
|
}
|
|
878
|
-
function
|
|
879
|
-
const { template: t, rows: n, load: r, dataSchema:
|
|
882
|
+
function On(e) {
|
|
883
|
+
const { template: t, rows: n, load: r, dataSchema: a, params: o, pagination: l, dataValidation: i } = e, s = Ht(t);
|
|
880
884
|
if (n !== void 0 == (r !== void 0) || r !== void 0 && typeof r != "function")
|
|
881
|
-
throw new
|
|
882
|
-
const c = { template: t, params: o, pagination:
|
|
883
|
-
return r ?
|
|
885
|
+
throw new ce("config", "标签报表应且只能配置 rows 或 load 其中一种数据来源");
|
|
886
|
+
const c = { template: t, params: o, pagination: l, dataValidation: i, ...a === void 0 ? {} : { dataSchema: { [s]: a } } };
|
|
887
|
+
return r ? Ze({ ...c, load: r, mapData: (m) => ye(m, s) }) : { ...c, datasets: ye(n, s) };
|
|
884
888
|
}
|
|
885
|
-
function
|
|
889
|
+
function Hn(e) {
|
|
886
890
|
return e;
|
|
887
891
|
}
|
|
888
|
-
class
|
|
892
|
+
class D extends Error {
|
|
889
893
|
constructor(t, n) {
|
|
890
894
|
super(n), this.code = t, this.name = "ReportTemplateStoreError";
|
|
891
895
|
}
|
|
@@ -898,73 +902,73 @@ function S(e) {
|
|
|
898
902
|
const t = new Error("模板操作已取消");
|
|
899
903
|
throw t.name = "AbortError", t;
|
|
900
904
|
}
|
|
901
|
-
function
|
|
905
|
+
function ve(e) {
|
|
902
906
|
const t = e ? Number(e.revision) : 0;
|
|
903
|
-
if (!Number.isSafeInteger(t) || t < 0 || t >= Number.MAX_SAFE_INTEGER) throw new
|
|
907
|
+
if (!Number.isSafeInteger(t) || t < 0 || t >= Number.MAX_SAFE_INTEGER) throw new D("history", "修订号无效或已达上限");
|
|
904
908
|
return String(t + 1);
|
|
905
909
|
}
|
|
906
|
-
function
|
|
907
|
-
const n = async (
|
|
908
|
-
S(
|
|
909
|
-
const
|
|
910
|
-
return S(
|
|
911
|
-
}, r = async (
|
|
912
|
-
const
|
|
913
|
-
if ((
|
|
914
|
-
return
|
|
915
|
-
},
|
|
916
|
-
if (S(
|
|
917
|
-
return I(
|
|
918
|
-
}, o = async (
|
|
910
|
+
function zn(e, t = {}) {
|
|
911
|
+
const n = async (l, i) => {
|
|
912
|
+
S(i);
|
|
913
|
+
const s = await e.read(l, i);
|
|
914
|
+
return S(i), s ? I(s) : void 0;
|
|
915
|
+
}, r = async (l, i) => {
|
|
916
|
+
const s = await n(l, i.signal);
|
|
917
|
+
if ((s?.revision ?? null) !== i.expectedRevision) throw new D("conflict", "模板已变化,请重新读取后提交");
|
|
918
|
+
return s;
|
|
919
|
+
}, a = async (l, i, s) => {
|
|
920
|
+
if (S(i.signal), !await e.compareAndSwap(l.id, i.expectedRevision, I(l), { signal: i.signal, ...s ? { publication: I(s) } : {} })) throw new D("conflict", "模板已被其他请求更新");
|
|
921
|
+
return I(l);
|
|
922
|
+
}, o = async (l, i, s, c) => {
|
|
919
923
|
if (t.beforePublish) {
|
|
920
|
-
S(
|
|
921
|
-
const g = await t.beforePublish({ document:
|
|
922
|
-
if (!g || g.ok !== !0) throw new
|
|
923
|
-
S(
|
|
924
|
+
S(s.signal);
|
|
925
|
+
const g = await t.beforePublish({ document: U(i), previous: l.published ? U(l.published) : void 0, signal: s.signal });
|
|
926
|
+
if (!g || g.ok !== !0) throw new D("review", g?.issues?.find((f) => f.severity === "error")?.message ?? "模板发布检查未通过");
|
|
927
|
+
S(s.signal);
|
|
924
928
|
}
|
|
925
|
-
const m =
|
|
926
|
-
return c !== void 0 && (h.restoredFrom = c),
|
|
929
|
+
const m = ve(l), d = U({ ...i, revision: m }), h = { revision: m, document: d, publishedAt: (t.now?.() ?? /* @__PURE__ */ new Date()).toISOString() };
|
|
930
|
+
return c !== void 0 && (h.restoredFrom = c), a({ id: l.id, revision: m, publishedRevision: m, published: d }, s, h);
|
|
927
931
|
};
|
|
928
932
|
return {
|
|
929
|
-
list: async (
|
|
930
|
-
S(
|
|
931
|
-
const
|
|
932
|
-
return S(
|
|
933
|
+
list: async (l) => {
|
|
934
|
+
S(l);
|
|
935
|
+
const i = await e.list(l);
|
|
936
|
+
return S(l), I(i);
|
|
933
937
|
},
|
|
934
|
-
get: async (
|
|
935
|
-
const
|
|
936
|
-
return c ?
|
|
938
|
+
get: async (l, i = {}) => {
|
|
939
|
+
const s = await n(l, i.signal), c = i.draft ? s?.draft : s?.published;
|
|
940
|
+
return c ? U(c) : void 0;
|
|
937
941
|
},
|
|
938
|
-
history: async (
|
|
939
|
-
S(
|
|
940
|
-
const
|
|
941
|
-
return S(
|
|
942
|
+
history: async (l, i) => {
|
|
943
|
+
S(i);
|
|
944
|
+
const s = await e.history(l, i);
|
|
945
|
+
return S(i), I(s);
|
|
942
946
|
},
|
|
943
|
-
saveDraft: async (
|
|
944
|
-
|
|
945
|
-
const
|
|
946
|
-
return
|
|
947
|
-
id:
|
|
947
|
+
saveDraft: async (l, i) => {
|
|
948
|
+
i = { ...i }, S(i.signal);
|
|
949
|
+
const s = U(t.migrate ? await t.migrate(l) : l), c = await r(s.id, i), m = ve(c);
|
|
950
|
+
return a({
|
|
951
|
+
id: s.id,
|
|
948
952
|
revision: m,
|
|
949
|
-
draft: { ...
|
|
953
|
+
draft: { ...s, revision: m },
|
|
950
954
|
...c?.publishedRevision ? { publishedRevision: c.publishedRevision, published: c.published } : {}
|
|
951
|
-
},
|
|
955
|
+
}, i);
|
|
952
956
|
},
|
|
953
|
-
publish: async (
|
|
954
|
-
|
|
955
|
-
const
|
|
956
|
-
if (!
|
|
957
|
-
if (!
|
|
958
|
-
return o(
|
|
957
|
+
publish: async (l, i) => {
|
|
958
|
+
i = { ...i };
|
|
959
|
+
const s = await r(l, i);
|
|
960
|
+
if (!s) throw new D("missing", "模板不存在");
|
|
961
|
+
if (!s.draft) throw new D("draft", "没有可发布的草稿");
|
|
962
|
+
return o(s, s.draft, i);
|
|
959
963
|
},
|
|
960
|
-
rollback: async (
|
|
961
|
-
|
|
962
|
-
const c = await r(
|
|
963
|
-
if (!c) throw new
|
|
964
|
-
S(
|
|
965
|
-
const m = await e.getVersion(
|
|
966
|
-
if (!m) throw new
|
|
967
|
-
return o(c, m.document,
|
|
964
|
+
rollback: async (l, i, s) => {
|
|
965
|
+
s = { ...s };
|
|
966
|
+
const c = await r(l, s);
|
|
967
|
+
if (!c) throw new D("missing", "模板不存在");
|
|
968
|
+
S(s.signal);
|
|
969
|
+
const m = await e.getVersion(l, i, s.signal);
|
|
970
|
+
if (!m) throw new D("history", "历史修订不存在");
|
|
971
|
+
return o(c, m.document, s, i);
|
|
968
972
|
}
|
|
969
973
|
};
|
|
970
974
|
}
|
|
@@ -973,188 +977,143 @@ function Wn() {
|
|
|
973
977
|
return {
|
|
974
978
|
read: async (n, r) => {
|
|
975
979
|
S(r);
|
|
976
|
-
const
|
|
977
|
-
return
|
|
980
|
+
const a = e.get(n);
|
|
981
|
+
return a ? I(a) : void 0;
|
|
978
982
|
},
|
|
979
|
-
list: async (n) => (S(n), Array.from(e.values(), ({ id: r, revision:
|
|
980
|
-
history: async (n, r) => (S(r), Array.from(t.get(n)?.values() ?? [], (
|
|
981
|
-
getVersion: async (n, r,
|
|
982
|
-
S(
|
|
983
|
+
list: async (n) => (S(n), Array.from(e.values(), ({ id: r, revision: a, publishedRevision: o }) => ({ id: r, revision: a, ...o ? { publishedRevision: o } : {} }))),
|
|
984
|
+
history: async (n, r) => (S(r), Array.from(t.get(n)?.values() ?? [], (a) => I(a))),
|
|
985
|
+
getVersion: async (n, r, a) => {
|
|
986
|
+
S(a);
|
|
983
987
|
const o = t.get(n)?.get(r);
|
|
984
988
|
return o ? I(o) : void 0;
|
|
985
989
|
},
|
|
986
|
-
compareAndSwap: async (n, r,
|
|
990
|
+
compareAndSwap: async (n, r, a, o) => {
|
|
987
991
|
if (S(o.signal), (e.get(n)?.revision ?? null) !== r) return !1;
|
|
988
|
-
if (
|
|
989
|
-
const
|
|
990
|
-
if (
|
|
991
|
-
const
|
|
992
|
-
if (
|
|
993
|
-
|
|
992
|
+
if (a.id !== n) throw new D("history", "状态 ID 与存储 ID 不一致");
|
|
993
|
+
const l = I(a), i = o.publication;
|
|
994
|
+
if (i) {
|
|
995
|
+
const s = t.get(n) ?? /* @__PURE__ */ new Map();
|
|
996
|
+
if (s.has(i.revision) || i.revision !== a.revision || i.document.id !== n) throw new D("history", "发布修订不可覆盖,且必须与状态修订和模板 ID 一致");
|
|
997
|
+
s.set(i.revision, I(i)), t.set(n, s);
|
|
994
998
|
}
|
|
995
|
-
return e.set(n,
|
|
996
|
-
}
|
|
997
|
-
};
|
|
998
|
-
}
|
|
999
|
-
function Bt(e, t) {
|
|
1000
|
-
const n = e.publishedRevision ?? e.published?.revision;
|
|
1001
|
-
for (const r of [e.draftRevision, n]) if (r !== void 0 && (typeof r != "string" || !r.trim())) throw new TypeError("模板生命周期修订应为非空字符串");
|
|
1002
|
-
if (e.draftRevision !== void 0 && e.draftRevision !== t.revision) throw new TypeError("可编辑文档应与草稿修订一致");
|
|
1003
|
-
if (e.published && (e.published.id !== t.id || e.published.revision !== n)) throw new TypeError("发布文档身份或修订不一致");
|
|
1004
|
-
if (!e.published && n !== void 0 && n !== t.revision) throw new TypeError("发布修订需要对应的独立文档");
|
|
1005
|
-
return { ...e.draftRevision === void 0 ? {} : { draftRevision: e.draftRevision }, ...n === void 0 ? {} : { publishedRevision: n } };
|
|
1006
|
-
}
|
|
1007
|
-
function _n(e, t) {
|
|
1008
|
-
const n = N(e);
|
|
1009
|
-
if (t.id === n.id) throw new Error("复制模板应使用新的 ID");
|
|
1010
|
-
const { revision: r, ...i } = n;
|
|
1011
|
-
return N({ ...i, id: t.id, name: t.name });
|
|
1012
|
-
}
|
|
1013
|
-
function jn(e) {
|
|
1014
|
-
if (!Array.isArray(e) || e.length > 1e3) throw new RangeError("本地模板目录最多 1000 项");
|
|
1015
|
-
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = [];
|
|
1016
|
-
for (const i of e) {
|
|
1017
|
-
const o = N(i.document);
|
|
1018
|
-
if (t.has(o.id)) throw new Error(`模板 ID 重复:${o.id}`);
|
|
1019
|
-
if (i.category !== void 0 && (typeof i.category != "string" || i.category.length > 128) || i.tags !== void 0 && (!Array.isArray(i.tags) || i.tags.length > 20 || i.tags.some((c) => typeof c != "string" || c.length > 128))) throw new TypeError("模板分类和标签无效");
|
|
1020
|
-
const s = Bt(i, o), { template: a, ...l } = o;
|
|
1021
|
-
t.set(o.id, o), i.published ? n.set(o.id, N(i.published)) : s.publishedRevision && n.set(o.id, N(o)), r.push({ ...l, ...s, ...i.category ? { category: i.category } : {}, ...i.tags ? { tags: [...i.tags] } : {} });
|
|
1022
|
-
}
|
|
1023
|
-
return r.sort((i, o) => i.id < o.id ? -1 : 1), {
|
|
1024
|
-
search: async (i) => {
|
|
1025
|
-
xe(i.signal);
|
|
1026
|
-
const o = i.limit ?? 30;
|
|
1027
|
-
if (!Number.isSafeInteger(o) || o < 1 || o > 100) throw new RangeError("模板每页数量应为 1–100");
|
|
1028
|
-
const s = i.query?.trim().toLocaleLowerCase() ?? "", a = r.filter((c) => (!i.category || c.category === i.category) && (!i.cursor || c.id > i.cursor) && (!s || [c.id, c.name, c.description, ...c.tags ?? []].some((m) => m?.toLocaleLowerCase().includes(s)))), l = /* @__PURE__ */ new Map();
|
|
1029
|
-
for (const c of r) c.category && l.set(c.category, (l.get(c.category) ?? 0) + 1);
|
|
1030
|
-
return JSON.parse(JSON.stringify({ items: a.slice(0, o), ...a.length > o ? { next: a[o - 1].id } : {}, categories: Array.from(l, ([c, m]) => ({ id: c, label: c, count: m })) }));
|
|
1031
|
-
},
|
|
1032
|
-
get: async (i, o) => {
|
|
1033
|
-
xe(o.signal);
|
|
1034
|
-
const s = o.mode === "published" ? n.get(i) : t.get(i);
|
|
1035
|
-
return s ? N(s) : void 0;
|
|
999
|
+
return e.set(n, l), !0;
|
|
1036
1000
|
}
|
|
1037
1001
|
};
|
|
1038
1002
|
}
|
|
1039
|
-
function
|
|
1040
|
-
if (!e?.aborted) return;
|
|
1041
|
-
const t = new Error("模板目录操作已取消");
|
|
1042
|
-
throw t.name = "AbortError", t;
|
|
1043
|
-
}
|
|
1044
|
-
function Un(e) {
|
|
1003
|
+
function Bn(e) {
|
|
1045
1004
|
return e.map((t) => t.map((n) => /[\t\r\n"]/.test(n) ? `"${n.replace(/"/g, '""')}"` : n).join(" ")).join(`\r
|
|
1046
1005
|
`);
|
|
1047
1006
|
}
|
|
1048
|
-
function
|
|
1007
|
+
function zt(e, t) {
|
|
1049
1008
|
const n = e[e.length - 1];
|
|
1050
1009
|
e.length > 1 && n?.length === 1 && n[0] === "" && /[\r\n]$/.test(t) && e.pop();
|
|
1051
1010
|
}
|
|
1052
|
-
function
|
|
1011
|
+
function jn(e, t = 1e4) {
|
|
1053
1012
|
if (e.length > 4 * 1024 * 1024) throw new Error("Clipboard text limit exceeded");
|
|
1054
1013
|
const n = [[]];
|
|
1055
|
-
let r = "",
|
|
1056
|
-
function
|
|
1057
|
-
if (++
|
|
1014
|
+
let r = "", a = !1, o = !1, l = 0;
|
|
1015
|
+
function i() {
|
|
1016
|
+
if (++l > t) throw new Error("Clipboard cell limit exceeded");
|
|
1058
1017
|
n[n.length - 1].push(r), r = "", o = !1;
|
|
1059
1018
|
}
|
|
1060
|
-
for (let
|
|
1061
|
-
const c = e[
|
|
1062
|
-
if (
|
|
1019
|
+
for (let s = 0; s < e.length; s++) {
|
|
1020
|
+
const c = e[s];
|
|
1021
|
+
if (a) {
|
|
1063
1022
|
if (c !== '"') {
|
|
1064
1023
|
r += c;
|
|
1065
1024
|
continue;
|
|
1066
1025
|
}
|
|
1067
|
-
if (e[
|
|
1068
|
-
r += '"',
|
|
1026
|
+
if (e[s + 1] === '"') {
|
|
1027
|
+
r += '"', s++;
|
|
1069
1028
|
continue;
|
|
1070
1029
|
}
|
|
1071
|
-
|
|
1030
|
+
a = !1, o = !0;
|
|
1072
1031
|
continue;
|
|
1073
1032
|
}
|
|
1074
1033
|
if (c === '"' && !r && !o) {
|
|
1075
|
-
|
|
1034
|
+
a = !0;
|
|
1076
1035
|
continue;
|
|
1077
1036
|
}
|
|
1078
1037
|
if (c === " ") {
|
|
1079
|
-
|
|
1038
|
+
i();
|
|
1080
1039
|
continue;
|
|
1081
1040
|
}
|
|
1082
1041
|
if (c === "\r" || c === `
|
|
1083
1042
|
`) {
|
|
1084
|
-
|
|
1085
|
-
` &&
|
|
1043
|
+
i(), n.push([]), c === "\r" && e[s + 1] === `
|
|
1044
|
+
` && s++;
|
|
1086
1045
|
continue;
|
|
1087
1046
|
}
|
|
1088
1047
|
if (o) throw new Error("Invalid quoted clipboard value");
|
|
1089
1048
|
r += c;
|
|
1090
1049
|
}
|
|
1091
|
-
if (
|
|
1092
|
-
return
|
|
1050
|
+
if (a) throw new Error("Unclosed clipboard quote");
|
|
1051
|
+
return i(), zt(n, e), n;
|
|
1093
1052
|
}
|
|
1094
|
-
class
|
|
1053
|
+
class Wt extends Error {
|
|
1095
1054
|
constructor(t, n, r) {
|
|
1096
|
-
const
|
|
1097
|
-
definition: `${
|
|
1098
|
-
type: `${
|
|
1099
|
-
required: `${
|
|
1100
|
-
min: `${
|
|
1101
|
-
max: `${
|
|
1102
|
-
precision: `${
|
|
1103
|
-
length: `${
|
|
1104
|
-
choice: `${
|
|
1105
|
-
date: `${
|
|
1055
|
+
const a = typeof n.label == "string" ? n.label : "单元格", o = {
|
|
1056
|
+
definition: `${a}的编辑器配置无效`,
|
|
1057
|
+
type: `${a}的编辑器与数据类型不一致`,
|
|
1058
|
+
required: `${a}不能为空`,
|
|
1059
|
+
min: `${a}不能小于 ${r}`,
|
|
1060
|
+
max: `${a}不能大于 ${r}`,
|
|
1061
|
+
precision: `${a}最多保留 ${r} 位小数`,
|
|
1062
|
+
length: `${a}最多允许 ${r} 个字符`,
|
|
1063
|
+
choice: `${a}请选择有效选项`,
|
|
1064
|
+
date: `${a}请输入有效日期(YYYY-MM-DD)`
|
|
1106
1065
|
};
|
|
1107
1066
|
super(o[t]), this.code = t, this.field = n, this.expected = r, this.name = "ReportCellFieldError";
|
|
1108
1067
|
}
|
|
1109
1068
|
}
|
|
1110
1069
|
function p(e, t, n) {
|
|
1111
|
-
throw new
|
|
1070
|
+
throw new Wt(t, e, n);
|
|
1112
1071
|
}
|
|
1113
|
-
function
|
|
1072
|
+
function Ue(e) {
|
|
1114
1073
|
if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}$/.test(e) || e.startsWith("0000-")) return !1;
|
|
1115
1074
|
const t = /* @__PURE__ */ new Date(`${e}T00:00:00.000Z`);
|
|
1116
1075
|
return Number.isFinite(t.getTime()) && t.toISOString().slice(0, 10) === e;
|
|
1117
1076
|
}
|
|
1118
|
-
function
|
|
1077
|
+
function Bt(e) {
|
|
1119
1078
|
const [t = "", n = "0"] = String(e).toLowerCase().split("e");
|
|
1120
1079
|
return Math.max(0, (t.split(".")[1]?.length ?? 0) - Number(n));
|
|
1121
1080
|
}
|
|
1122
|
-
function
|
|
1123
|
-
e.min !== void 0 && t < e.min && p(e, "min", e.min), e.max !== void 0 && t > e.max && p(e, "max", e.max), e.precision !== void 0 &&
|
|
1081
|
+
function jt(e, t) {
|
|
1082
|
+
e.min !== void 0 && t < e.min && p(e, "min", e.min), e.max !== void 0 && t > e.max && p(e, "max", e.max), e.precision !== void 0 && Bt(t) > e.precision && p(e, "precision", e.precision);
|
|
1124
1083
|
}
|
|
1125
|
-
function
|
|
1126
|
-
|
|
1084
|
+
function _t(e, t) {
|
|
1085
|
+
Ue(t) || p(e, "date"), e.min !== void 0 && t < e.min && p(e, "min", e.min), e.max !== void 0 && t > e.max && p(e, "max", e.max);
|
|
1127
1086
|
}
|
|
1128
|
-
function
|
|
1087
|
+
function Ut(e) {
|
|
1129
1088
|
[e.min, e.max].some((t) => t !== void 0 && !Number.isFinite(t)) && p(e, "definition"), e.min !== void 0 && e.max !== void 0 && e.min > e.max && p(e, "definition"), e.precision !== void 0 && (!Number.isInteger(e.precision) || e.precision < 0 || e.precision > 15) && p(e, "definition");
|
|
1130
1089
|
}
|
|
1131
|
-
function
|
|
1132
|
-
[e.min, e.max].some((t) => t !== void 0 && !
|
|
1090
|
+
function Gt(e) {
|
|
1091
|
+
[e.min, e.max].some((t) => t !== void 0 && !Ue(t)) && p(e, "definition"), e.min !== void 0 && e.max !== void 0 && e.min > e.max && p(e, "definition");
|
|
1133
1092
|
}
|
|
1134
|
-
function
|
|
1093
|
+
function Vt(e, t) {
|
|
1135
1094
|
(!Array.isArray(t.options) || !t.options.length) && p(t, "definition");
|
|
1136
1095
|
const n = e.valueType === "text" ? "string" : e.valueType, r = /* @__PURE__ */ new Set();
|
|
1137
|
-
for (const
|
|
1138
|
-
(!
|
|
1096
|
+
for (const a of t.options)
|
|
1097
|
+
(!a || typeof a.value !== n || typeof a.value == "number" && !Number.isFinite(a.value)) && p(t, "definition"), a.label !== void 0 && typeof a.label != "string" && p(t, "definition"), r.has(a.value) && p(t, "definition"), r.add(a.value);
|
|
1139
1098
|
}
|
|
1140
|
-
function
|
|
1099
|
+
function qt(e) {
|
|
1141
1100
|
e.required !== void 0 && typeof e.required != "boolean" && p(e, "definition"), [e.label, e.hint, e.unit].some((t) => t !== void 0 && typeof t != "string") && p(e, "definition"), e.type === "boolean" && [e.trueLabel, e.falseLabel].some((t) => t !== void 0 && typeof t != "string") && p(e, "definition");
|
|
1142
1101
|
}
|
|
1143
|
-
function
|
|
1144
|
-
(!t || typeof t != "object" || Array.isArray(t) || !["text", "number", "boolean", "enum", "date"].includes(t.type)) && p(t ?? { type: "text" }, "definition"),
|
|
1102
|
+
function Yt(e, t) {
|
|
1103
|
+
(!t || typeof t != "object" || Array.isArray(t) || !["text", "number", "boolean", "enum", "date"].includes(t.type)) && p(t ?? { type: "text" }, "definition"), qt(t), (t.type === "number" || t.type === "boolean") && e.valueType !== t.type && p(t, "type"), (t.type === "text" || t.type === "date") && e.valueType !== "text" && p(t, "type"), t.type === "number" && Ut(t), t.type === "text" && t.maxLength !== void 0 && (!Number.isInteger(t.maxLength) || t.maxLength < 0) && p(t, "definition"), t.type === "date" && Gt(t), t.type === "enum" && Vt(e, t);
|
|
1145
1104
|
}
|
|
1146
|
-
function
|
|
1147
|
-
if (!e.editable) throw new
|
|
1148
|
-
n &&
|
|
1149
|
-
const r =
|
|
1150
|
-
return n ? (n.required && typeof r == "string" && !r.trim() && p(n, "required"), r === null || r === "" ? (n.required && p(n, "required"), r) : (n.type === "number" &&
|
|
1105
|
+
function _n(e, t, n) {
|
|
1106
|
+
if (!e.editable) throw new rt("readonly");
|
|
1107
|
+
n && Yt(e, n);
|
|
1108
|
+
const r = at(e, t);
|
|
1109
|
+
return n ? (n.required && typeof r == "string" && !r.trim() && p(n, "required"), r === null || r === "" ? (n.required && p(n, "required"), r) : (n.type === "number" && jt(n, r), n.type === "date" && _t(n, r), n.type === "text" && n.maxLength !== void 0 && [...String(r)].length > n.maxLength && p(n, "length", n.maxLength), n.type === "enum" && !n.options.some((a) => Object.is(a.value, r)) && p(n, "choice"), r)) : r;
|
|
1151
1110
|
}
|
|
1152
1111
|
class b extends Error {
|
|
1153
1112
|
constructor(t) {
|
|
1154
1113
|
super(`Report calculation: ${t}`), this.code = t, this.name = "ReportCalculationError";
|
|
1155
1114
|
}
|
|
1156
1115
|
}
|
|
1157
|
-
function
|
|
1116
|
+
function B(e) {
|
|
1158
1117
|
if (!e?.aborted) return;
|
|
1159
1118
|
const t = new Error("Calculation cancelled");
|
|
1160
1119
|
throw t.name = "AbortError", t;
|
|
@@ -1162,95 +1121,95 @@ function _(e) {
|
|
|
1162
1121
|
async function ee(e, t = 1) {
|
|
1163
1122
|
const n = Math.floor(e.scanned / 2048);
|
|
1164
1123
|
if (e.scanned += t, e.scanned > e.maxScanned) throw new b("limit");
|
|
1165
|
-
|
|
1124
|
+
B(e.signal), Math.floor(e.scanned / 2048) > n && (await e.yieldToHost(), B(e.signal));
|
|
1166
1125
|
}
|
|
1167
1126
|
function fe(e) {
|
|
1168
1127
|
return e.table?.role === "header" ? -Math.max(1, e.grid?.cells.length ?? 1) : e.table?.rowIndex ?? 0;
|
|
1169
1128
|
}
|
|
1170
|
-
function
|
|
1171
|
-
if (![t.pageIndex, t.componentIndex, t.rowIndex, t.columnIndex].every((
|
|
1129
|
+
function xe(e, t, n) {
|
|
1130
|
+
if (![t.pageIndex, t.componentIndex, t.rowIndex, t.columnIndex].every((i) => Number.isSafeInteger(i) && i >= 0)) throw new b("selection");
|
|
1172
1131
|
const r = e.pages[t.pageIndex]?.components[t.componentIndex];
|
|
1173
1132
|
if (!r?.grid || t.rowIndex >= r.grid.cells.length) throw new b("selection");
|
|
1174
|
-
const
|
|
1175
|
-
if (t.columnIndex >=
|
|
1176
|
-
const o = r.table,
|
|
1177
|
-
if (o &&
|
|
1178
|
-
const
|
|
1179
|
-
if (
|
|
1180
|
-
return { grid: o.id, row: fe(r) + t.rowIndex, column:
|
|
1133
|
+
const a = r.grid.colWidthsMm?.length ?? r.grid.cells.reduce((i, s) => Math.max(i, s.length), 1);
|
|
1134
|
+
if (t.columnIndex >= a) throw new b("selection");
|
|
1135
|
+
const o = r.table, l = e.pages[n.pageIndex]?.components[n.componentIndex]?.table;
|
|
1136
|
+
if (o && l && o.id === l.id) {
|
|
1137
|
+
const i = l.columnKeys.indexOf(o.columnKeys[t.columnIndex] ?? "");
|
|
1138
|
+
if (i < 0) throw new b("selection");
|
|
1139
|
+
return { grid: o.id, row: fe(r) + t.rowIndex, column: i };
|
|
1181
1140
|
}
|
|
1182
1141
|
return { grid: `${t.pageIndex}:${t.componentIndex}`, row: t.rowIndex, column: t.columnIndex };
|
|
1183
1142
|
}
|
|
1184
|
-
function
|
|
1185
|
-
const r =
|
|
1186
|
-
if (r.grid !==
|
|
1187
|
-
const o = (Math.abs(r.row -
|
|
1143
|
+
function Kt(e, t, n) {
|
|
1144
|
+
const r = xe(e, t.anchor, t.anchor), a = xe(e, t.focus, t.anchor);
|
|
1145
|
+
if (r.grid !== a.grid) throw new b("selection");
|
|
1146
|
+
const o = (Math.abs(r.row - a.row) + 1) * (Math.abs(r.column - a.column) + 1);
|
|
1188
1147
|
if (!Number.isSafeInteger(o) || o > n) throw new b("limit");
|
|
1189
|
-
return { grid: r.grid, rowStart: Math.min(r.row,
|
|
1148
|
+
return { grid: r.grid, rowStart: Math.min(r.row, a.row), rowEnd: Math.max(r.row, a.row), columnStart: Math.min(r.column, a.column), columnEnd: Math.max(r.column, a.column), origin: e.pages[t.anchor.pageIndex].components[t.anchor.componentIndex].table };
|
|
1190
1149
|
}
|
|
1191
|
-
function
|
|
1150
|
+
function Jt(e) {
|
|
1192
1151
|
if (!e) return !1;
|
|
1193
1152
|
const t = e.replace(/"[^"]*"|\\.|\[(?![hms]+\])[^\]]*\]/gi, "");
|
|
1194
1153
|
return /[ymdhs]/i.test(t);
|
|
1195
1154
|
}
|
|
1196
|
-
function
|
|
1197
|
-
if (e.valueType === "text" || e.valueType === "boolean" ||
|
|
1155
|
+
function Xt(e) {
|
|
1156
|
+
if (e.valueType === "text" || e.valueType === "boolean" || Jt(e.numberFormat)) return null;
|
|
1198
1157
|
const t = e.value;
|
|
1199
1158
|
if (typeof t != "number" || !Number.isFinite(t)) return null;
|
|
1200
1159
|
if (Number.isInteger(t) && !Number.isSafeInteger(t)) throw new b("precision");
|
|
1201
1160
|
return t;
|
|
1202
1161
|
}
|
|
1203
|
-
function
|
|
1162
|
+
function Zt(e, t, n) {
|
|
1204
1163
|
if (e.seen.has(n)) return;
|
|
1205
1164
|
e.seen.add(n), e.selected++;
|
|
1206
|
-
const r = t ?
|
|
1165
|
+
const r = t ? Xt(t) : null;
|
|
1207
1166
|
r === null ? e.excluded++ : e.values.push(r);
|
|
1208
1167
|
}
|
|
1209
|
-
function
|
|
1168
|
+
function Qt(e, t, n, r) {
|
|
1210
1169
|
return r.origin ? e.table?.id === r.origin.id : `${t}:${n}` === r.grid;
|
|
1211
1170
|
}
|
|
1212
|
-
function
|
|
1171
|
+
function en(e, t, n) {
|
|
1213
1172
|
return n.origin ? n.origin.columnKeys.indexOf(e.table.columnKeys[t] ?? "") : t;
|
|
1214
1173
|
}
|
|
1215
|
-
function
|
|
1216
|
-
const
|
|
1217
|
-
return
|
|
1174
|
+
function tn(e, t, n, r) {
|
|
1175
|
+
const a = r.origin ? fe(e) + t : t, o = en(e, n, r);
|
|
1176
|
+
return a < r.rowStart || a > r.rowEnd || o < r.columnStart || o > r.columnEnd ? null : `${r.grid}:${a}:${o}`;
|
|
1218
1177
|
}
|
|
1219
|
-
function
|
|
1220
|
-
const n = t.origin ? fe(e) : 0, r = Math.max(0, t.rowStart - n),
|
|
1221
|
-
return
|
|
1178
|
+
function nn(e, t) {
|
|
1179
|
+
const n = t.origin ? fe(e) : 0, r = Math.max(0, t.rowStart - n), a = Math.min(e.grid.cells.length, t.rowEnd - n + 1);
|
|
1180
|
+
return a > r ? a : 0;
|
|
1222
1181
|
}
|
|
1223
|
-
async function
|
|
1182
|
+
async function rn(e, t, n, r, a) {
|
|
1224
1183
|
const o = e.grid;
|
|
1225
1184
|
if (t > r.maxScanned) throw new b("limit");
|
|
1226
|
-
const
|
|
1227
|
-
if (
|
|
1228
|
-
const
|
|
1229
|
-
for (let
|
|
1230
|
-
|
|
1185
|
+
const l = o.colWidthsMm?.length ?? o.cells.reduce((s, c) => Math.max(s, c.length), 1);
|
|
1186
|
+
if (l > r.maxScanned) throw new b("limit");
|
|
1187
|
+
const i = /* @__PURE__ */ new Map();
|
|
1188
|
+
for (let s = 0; s < t; s++) {
|
|
1189
|
+
s > 0 && s % 2048 === 0 && (await r.yieldToHost(), B(r.signal));
|
|
1231
1190
|
let c = 0;
|
|
1232
|
-
for (const m of o.cells[
|
|
1233
|
-
for (await ee(r); c <
|
|
1234
|
-
if (c >=
|
|
1235
|
-
const d = Math.max(1, Math.min(m?.colSpan ?? 1,
|
|
1191
|
+
for (const m of o.cells[s]) {
|
|
1192
|
+
for (await ee(r); c < l && (i.get(c) ?? 0) > s; ) c++;
|
|
1193
|
+
if (c >= l) break;
|
|
1194
|
+
const d = Math.max(1, Math.min(m?.colSpan ?? 1, l - c)), h = Math.min(o.cells.length, s + Math.max(1, m?.rowSpan ?? 1));
|
|
1236
1195
|
d > 1 && await ee(r, d - 1);
|
|
1237
|
-
for (let f = c; f < c + d; f++)
|
|
1238
|
-
const g =
|
|
1239
|
-
g &&
|
|
1196
|
+
for (let f = c; f < c + d; f++) i.set(f, h);
|
|
1197
|
+
const g = tn(e, s, c, n);
|
|
1198
|
+
g && Zt(a, m, g), c += d;
|
|
1240
1199
|
}
|
|
1241
1200
|
}
|
|
1242
1201
|
}
|
|
1243
|
-
async function
|
|
1202
|
+
async function an(e, t, n) {
|
|
1244
1203
|
const r = { values: [], seen: /* @__PURE__ */ new Set(), excluded: 0, selected: 0 };
|
|
1245
|
-
for (let
|
|
1204
|
+
for (let a = 0; a < e.pages.length; a++) {
|
|
1246
1205
|
await ee(n);
|
|
1247
|
-
const o = e.pages[
|
|
1248
|
-
for (let
|
|
1206
|
+
const o = e.pages[a];
|
|
1207
|
+
for (let l = 0; l < o.components.length; l++) {
|
|
1249
1208
|
await ee(n);
|
|
1250
|
-
const
|
|
1251
|
-
if (!
|
|
1252
|
-
const
|
|
1253
|
-
|
|
1209
|
+
const i = o.components[l];
|
|
1210
|
+
if (!i.grid || !Qt(i, a, l, t) || i.table && i.table.role !== "body") continue;
|
|
1211
|
+
const s = nn(i, t);
|
|
1212
|
+
s && await rn(i, s, t, n, r);
|
|
1254
1213
|
}
|
|
1255
1214
|
}
|
|
1256
1215
|
return r;
|
|
@@ -1259,90 +1218,90 @@ function V(e) {
|
|
|
1259
1218
|
if (!Number.isFinite(e)) throw new b("overflow");
|
|
1260
1219
|
return e;
|
|
1261
1220
|
}
|
|
1262
|
-
function
|
|
1221
|
+
function on(e) {
|
|
1263
1222
|
let t = 0, n = 0;
|
|
1264
1223
|
for (const r of e) {
|
|
1265
|
-
const
|
|
1266
|
-
n = o - t -
|
|
1224
|
+
const a = r - n, o = V(t + a);
|
|
1225
|
+
n = o - t - a, t = o;
|
|
1267
1226
|
}
|
|
1268
1227
|
return t;
|
|
1269
1228
|
}
|
|
1270
|
-
async function
|
|
1229
|
+
async function Ee(e, t) {
|
|
1271
1230
|
let n = [...e], r = new Array(e.length);
|
|
1272
1231
|
for (let o = 1; o < e.length; o *= 2) {
|
|
1273
|
-
for (let
|
|
1274
|
-
const
|
|
1275
|
-
let c =
|
|
1276
|
-
for (let d =
|
|
1277
|
-
r[d] = m >=
|
|
1232
|
+
for (let l = 0; l < e.length; l += o * 2) {
|
|
1233
|
+
const i = Math.min(l + o, e.length), s = Math.min(l + o * 2, e.length);
|
|
1234
|
+
let c = l, m = i;
|
|
1235
|
+
for (let d = l; d < s; d++)
|
|
1236
|
+
r[d] = m >= s || c < i && n[c] <= n[m] ? n[c++] : n[m++], d % 2048 === 0 && (await t.yieldToHost(), B(t.signal));
|
|
1278
1237
|
}
|
|
1279
1238
|
[n, r] = [r, n];
|
|
1280
1239
|
}
|
|
1281
|
-
const
|
|
1282
|
-
return n.length % 2 ? n[
|
|
1240
|
+
const a = Math.floor(n.length / 2);
|
|
1241
|
+
return n.length % 2 ? n[a] : V(n[a - 1] / 2 + n[a] / 2);
|
|
1283
1242
|
}
|
|
1284
|
-
function
|
|
1285
|
-
const t =
|
|
1243
|
+
function sn(e) {
|
|
1244
|
+
const t = on(e);
|
|
1286
1245
|
let n = 1 / 0, r = -1 / 0;
|
|
1287
|
-
for (const
|
|
1288
|
-
n = Math.min(n,
|
|
1246
|
+
for (const a of e)
|
|
1247
|
+
n = Math.min(n, a), r = Math.max(r, a);
|
|
1289
1248
|
return { SUM: t, AVERAGE: t / e.length, AVG: t / e.length, MIN: n, MAX: r, COUNT: e.length };
|
|
1290
1249
|
}
|
|
1291
|
-
function
|
|
1250
|
+
function ln(e, t) {
|
|
1292
1251
|
if (typeof e != "string" || e.length > 256) throw new b("expression");
|
|
1293
1252
|
const n = e.toUpperCase().match(/(?:\d+(?:\.\d*)?|\.\d+)(?:E[+-]?\d+)?|[A-Z_]+|[()+\-*/]|\S/g) ?? [];
|
|
1294
1253
|
if (!n.length || n.length > 64) throw new b("expression");
|
|
1295
1254
|
let r = 0;
|
|
1296
|
-
function i
|
|
1297
|
-
if (
|
|
1298
|
-
const
|
|
1299
|
-
if (
|
|
1300
|
-
if (
|
|
1301
|
-
const c = o(0,
|
|
1255
|
+
function a(i) {
|
|
1256
|
+
if (i > 16) throw new b("expression");
|
|
1257
|
+
const s = n[r++];
|
|
1258
|
+
if (s === "+" || s === "-") return (s === "-" ? -1 : 1) * a(i + 1);
|
|
1259
|
+
if (s === "(") {
|
|
1260
|
+
const c = o(0, i + 1);
|
|
1302
1261
|
if (n[r++] !== ")") throw new b("expression");
|
|
1303
1262
|
return c;
|
|
1304
1263
|
}
|
|
1305
|
-
if (
|
|
1306
|
-
if (
|
|
1264
|
+
if (s && /^(?:SUM|AVERAGE|AVG|MIN|MAX|COUNT|MEDIAN)$/.test(s) && Object.prototype.hasOwnProperty.call(t, s)) return V(t[s]);
|
|
1265
|
+
if (s && /^(?:\d+(?:\.\d*)?|\.\d+)(?:E[+-]?\d+)?$/.test(s)) return V(Number(s));
|
|
1307
1266
|
throw new b("expression");
|
|
1308
1267
|
}
|
|
1309
|
-
function o(
|
|
1310
|
-
let c =
|
|
1268
|
+
function o(i, s) {
|
|
1269
|
+
let c = a(s);
|
|
1311
1270
|
for (; r < n.length; ) {
|
|
1312
1271
|
const m = n[r], d = m === "+" || m === "-" ? 1 : m === "*" || m === "/" ? 2 : 0;
|
|
1313
|
-
if (!d || d <
|
|
1272
|
+
if (!d || d < i) break;
|
|
1314
1273
|
r++;
|
|
1315
|
-
const h = o(d + 1,
|
|
1274
|
+
const h = o(d + 1, s + 1);
|
|
1316
1275
|
if (m === "/" && h === 0) throw new b("division");
|
|
1317
1276
|
c = V(m === "+" ? c + h : m === "-" ? c - h : m === "*" ? c * h : c / h);
|
|
1318
1277
|
}
|
|
1319
1278
|
return c;
|
|
1320
1279
|
}
|
|
1321
|
-
const
|
|
1280
|
+
const l = o(1, 0);
|
|
1322
1281
|
if (r !== n.length) throw new b("expression");
|
|
1323
|
-
return
|
|
1282
|
+
return l;
|
|
1324
1283
|
}
|
|
1325
|
-
function
|
|
1284
|
+
function cn(e) {
|
|
1326
1285
|
const t = e.maxCells ?? 1e5, n = e.maxScannedCells ?? 2e5, r = e.precision ?? 2;
|
|
1327
|
-
if (![t, n].every((
|
|
1286
|
+
if (![t, n].every((a) => Number.isSafeInteger(a) && a >= 1 && a <= 2e6)) throw new b("limit");
|
|
1328
1287
|
if (!Number.isInteger(r) || r < 0 || r > 12) throw new b("precision");
|
|
1329
1288
|
return { maxCells: t, maxScanned: n, precision: r };
|
|
1330
1289
|
}
|
|
1331
|
-
async function
|
|
1332
|
-
const r =
|
|
1333
|
-
|
|
1334
|
-
const o = await
|
|
1335
|
-
if (!["sum", "average", "min", "max", "count", "median", "expression"].includes(
|
|
1336
|
-
let
|
|
1337
|
-
if (
|
|
1290
|
+
async function Un(e, t, n = {}) {
|
|
1291
|
+
const r = cn(n), a = { scanned: 0, maxScanned: r.maxScanned, signal: n.signal, yieldToHost: n.yieldToHost ?? (() => new Promise((s) => setTimeout(s, 0))) };
|
|
1292
|
+
B(a.signal);
|
|
1293
|
+
const o = await an(e, Kt(e, t, r.maxCells), a), l = n.operation ?? "sum";
|
|
1294
|
+
if (!["sum", "average", "min", "max", "count", "median", "expression"].includes(l)) throw new b("expression");
|
|
1295
|
+
let i = null;
|
|
1296
|
+
if (l === "count") i = o.values.length;
|
|
1338
1297
|
else if (o.values.length)
|
|
1339
|
-
if (
|
|
1298
|
+
if (l === "median") i = await Ee(o.values, a);
|
|
1340
1299
|
else {
|
|
1341
|
-
const
|
|
1342
|
-
|
|
1300
|
+
const s = sn(o.values);
|
|
1301
|
+
l === "expression" ? (/\bMEDIAN\b/i.test(n.expression ?? "") && (s.MEDIAN = await Ee(o.values, a)), i = ln(n.expression ?? "", s)) : i = s[l.toUpperCase()];
|
|
1343
1302
|
}
|
|
1344
|
-
if (
|
|
1345
|
-
return { value:
|
|
1303
|
+
if (B(a.signal), i !== null && Number.isInteger(i) && !Number.isSafeInteger(i)) throw new b("precision");
|
|
1304
|
+
return { value: i, formatted: i === null ? "—" : i.toFixed(r.precision), numericCells: o.values.length, excludedCells: o.excluded, selectedCells: o.selected, precision: r.precision };
|
|
1346
1305
|
}
|
|
1347
1306
|
class A extends Error {
|
|
1348
1307
|
constructor(t, n) {
|
|
@@ -1355,203 +1314,209 @@ function X(e) {
|
|
|
1355
1314
|
throw t.name = "AbortError", t;
|
|
1356
1315
|
}
|
|
1357
1316
|
}
|
|
1358
|
-
function
|
|
1317
|
+
function O(e, t, n = !1) {
|
|
1359
1318
|
if (!Number.isFinite(e) || e <= 0 || n && !Number.isSafeInteger(e)) throw new A("应为正有限数字,数量应为安全整数", t);
|
|
1360
1319
|
return e;
|
|
1361
1320
|
}
|
|
1362
|
-
function
|
|
1321
|
+
function Se(e, t) {
|
|
1363
1322
|
if (!Number.isFinite(e) || e < 0) throw new A("应为非负有限数字", t);
|
|
1364
1323
|
return e;
|
|
1365
1324
|
}
|
|
1366
|
-
function
|
|
1325
|
+
function mn(e) {
|
|
1367
1326
|
const t = typeof e.marginMm == "object" ? e.marginMm : { top: e.marginMm ?? 0, left: e.marginMm ?? 0, bottom: e.marginMm ?? 0, right: e.marginMm ?? 0 }, n = typeof e.gapMm == "object" ? e.gapMm : { horizontal: e.gapMm ?? 0, vertical: e.gapMm ?? 0 };
|
|
1368
|
-
for (const r of ["top", "left", "bottom", "right"])
|
|
1369
|
-
for (const r of ["horizontal", "vertical"])
|
|
1327
|
+
for (const r of ["top", "left", "bottom", "right"]) Se(t?.[r], `$.marginMm.${r}`);
|
|
1328
|
+
for (const r of ["horizontal", "vertical"]) Se(n?.[r], `$.gapMm.${r}`);
|
|
1370
1329
|
return { margin: t, gap: n };
|
|
1371
1330
|
}
|
|
1372
|
-
function
|
|
1331
|
+
function dn(e) {
|
|
1373
1332
|
const t = e.paper === void 0 || e.paper === "a4" ? { widthMm: 210, heightMm: 297 } : e.paper;
|
|
1374
|
-
|
|
1375
|
-
const n =
|
|
1376
|
-
if (
|
|
1377
|
-
const { margin: o, gap:
|
|
1378
|
-
if (!Number.isSafeInteger(
|
|
1379
|
-
if (!Number.isFinite(
|
|
1380
|
-
return { paper: t, columns: n, rows: r, capacity:
|
|
1381
|
-
}
|
|
1382
|
-
function
|
|
1383
|
-
return 1 + (e.grid?.cells.reduce((t, n) => t + n.length + 1 + n.reduce((r,
|
|
1384
|
-
}
|
|
1385
|
-
function
|
|
1386
|
-
if (!
|
|
1333
|
+
O(t.widthMm, "$.paper.widthMm"), O(t.heightMm, "$.paper.heightMm");
|
|
1334
|
+
const n = O(e.columns, "$.columns", !0), r = O(e.rows, "$.rows", !0), a = n * r;
|
|
1335
|
+
if (a > 1e3) throw new A("每张纸不能超过 1000 个位置", "$.columns");
|
|
1336
|
+
const { margin: o, gap: l } = mn(e), i = e.startSlot ?? 0, s = e.offsetMm ?? { x: 0, y: 0 };
|
|
1337
|
+
if (!Number.isSafeInteger(i) || i < 0 || i >= a) throw new A("起始位置应在首张纸的有效位置内", "$.startSlot");
|
|
1338
|
+
if (!Number.isFinite(s.x) || !Number.isFinite(s.y)) throw new A("校准偏移应为有限毫米值", "$.offsetMm");
|
|
1339
|
+
return { paper: t, columns: n, rows: r, capacity: a, margin: o, gap: l, startSlot: i, offset: s };
|
|
1340
|
+
}
|
|
1341
|
+
function Ge(e) {
|
|
1342
|
+
return 1 + (e.grid?.cells.reduce((t, n) => t + n.length + 1 + n.reduce((r, a) => r + (a?.children?.reduce((o, l) => o + Ge(l), 0) ?? 0), 0), 0) ?? 0);
|
|
1343
|
+
}
|
|
1344
|
+
function hn(e, t, n) {
|
|
1345
|
+
if (!Je(e).ok) throw new A("标签计划无效", "$.plan");
|
|
1387
1346
|
const r = e.pages[0];
|
|
1388
1347
|
if (!r) return;
|
|
1389
|
-
const { paper:
|
|
1390
|
-
if (
|
|
1348
|
+
const { paper: a, columns: o, rows: l, margin: i, gap: s, offset: c } = n;
|
|
1349
|
+
if (i.left + c.x < 0 || i.top + c.y < 0 || i.left + c.x + o * r.pageWidthMm + (o - 1) * s.horizontal + i.right > a.widthMm + 1e-6 || i.top + c.y + l * r.pageHeightMm + (l - 1) * s.vertical + i.bottom > a.heightMm + 1e-6) throw new A("标签、间距、边距及校准偏移超过纸张尺寸;不会自动缩小标签", "$.paper");
|
|
1391
1350
|
let m = 0;
|
|
1392
1351
|
for (const [d, h] of e.pages.entries()) {
|
|
1393
1352
|
if (X(t.signal), h.layout === "wide" || h.pageWidthMm !== r.pageWidthMm || h.pageHeightMm !== r.pageHeightMm) throw new A("拼版需要尺寸相同的固定标签页面", `$.pages.${d}`);
|
|
1394
|
-
if (m += h.components.reduce((g, f) => g +
|
|
1353
|
+
if (m += h.components.reduce((g, f) => g + Ge(f), 0), m > O(t.maxComponents ?? 25e4, "$.maxComponents", !0)) throw new A("拼版组件总量超过预算", "$.maxComponents");
|
|
1395
1354
|
for (const g of h.components) if (g.leftMm < 0 || g.topMm < 0 || g.leftMm + g.widthMm > h.pageWidthMm + 1e-6 || g.topMm + g.heightMm > h.pageHeightMm + 1e-6) throw new A("标签内容超出标签边界", `$.pages.${d}.components`);
|
|
1396
1355
|
}
|
|
1397
1356
|
}
|
|
1398
|
-
function
|
|
1357
|
+
function Gn(e, t) {
|
|
1399
1358
|
X(t.signal);
|
|
1400
|
-
const n =
|
|
1401
|
-
if (m >
|
|
1402
|
-
|
|
1403
|
-
const d =
|
|
1359
|
+
const n = dn(t), { paper: r, columns: a, capacity: o, margin: l, gap: i, startSlot: s, offset: c } = n, m = e.pages.length ? Math.ceil((s + e.pages.length) / o) : 0;
|
|
1360
|
+
if (m > O(t.maxSheets ?? 1e4, "$.maxSheets", !0)) throw new A("拼版纸张数量超过预算", "$.maxSheets");
|
|
1361
|
+
O(t.maxComponents ?? 25e4, "$.maxComponents", !0), hn(e, t, n);
|
|
1362
|
+
const d = Qe(e, { maxBytes: O(t.maxSnapshotBytes ?? 64e6, "$.maxSnapshotBytes", !0), check: () => X(t.signal), error: (g, f) => new A(f, "$.maxSnapshotBytes") }), h = Array.from({ length: m }, () => ({ pageWidthMm: r.widthMm, pageHeightMm: r.heightMm, components: [], meta: { labelSheet: { columns: a, rows: n.rows, slots: [] } } }));
|
|
1404
1363
|
for (const [g, f] of d.pages.entries()) {
|
|
1405
1364
|
X(t.signal);
|
|
1406
|
-
const w =
|
|
1407
|
-
x.meta.labelSheet.slots.push(
|
|
1365
|
+
const w = s + g, C = w % o, x = h[Math.floor(w / o)], v = l.left + c.x + C % a * (f.pageWidthMm + i.horizontal), R = l.top + c.y + Math.floor(C / a) * (f.pageHeightMm + i.vertical), H = { sourcePageIndex: g, slotIndex: C, xMm: v, yMm: R, widthMm: f.pageWidthMm, heightMm: f.pageHeightMm, ...f.meta ? { sourceMeta: f.meta } : {} };
|
|
1366
|
+
x.meta.labelSheet.slots.push(H), x.components.push(...f.components.map((N) => ({ ...N, leftMm: N.leftMm + v, topMm: N.topMm + R, meta: { ...N.meta, labelSheet: H } })));
|
|
1408
1367
|
}
|
|
1409
1368
|
return { ...d, pages: h };
|
|
1410
1369
|
}
|
|
1411
1370
|
export {
|
|
1412
|
-
|
|
1413
|
-
|
|
1371
|
+
lr as CSS_DPI,
|
|
1372
|
+
Yn as DEFAULT_BORDER_PT,
|
|
1414
1373
|
te as DEFAULT_FONT_FAMILY,
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1374
|
+
Kn as DEFAULT_FONT_PT,
|
|
1375
|
+
kr as DEFAULT_LABEL_PAGE_LIMIT,
|
|
1376
|
+
Jn as DEFAULT_STROKE_COLOR,
|
|
1377
|
+
Te as DEFAULT_TEXT_COLOR,
|
|
1378
|
+
Xn as LINE_HEIGHT,
|
|
1420
1379
|
A as LabelSheetError,
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1380
|
+
cr as MM_PER_INCH,
|
|
1381
|
+
Kr as OutputAssetError,
|
|
1382
|
+
et as OutputFidelityError,
|
|
1424
1383
|
Z as PAPER_SIZES,
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1384
|
+
$t as PageBuilder,
|
|
1385
|
+
Ir as PaginateCellLimitError,
|
|
1386
|
+
Nr as PaginatePageLimitError,
|
|
1387
|
+
gr as RENDER_PLAN_SCHEMA_VERSION,
|
|
1388
|
+
ur as REPORT_TEMPLATE_DOCUMENT_VERSION,
|
|
1389
|
+
er as ReportBindingError,
|
|
1431
1390
|
b as ReportCalculationError,
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1391
|
+
rt as ReportCellEditError,
|
|
1392
|
+
Wt as ReportCellFieldError,
|
|
1393
|
+
Xr as ReportDrillError,
|
|
1394
|
+
ra as ReportParamValidationError,
|
|
1395
|
+
ce as ReportSourceError,
|
|
1396
|
+
ke as ReportTemplateError,
|
|
1397
|
+
D as ReportTemplateStoreError,
|
|
1398
|
+
Zn as SCHEMA_VERSION_MACH,
|
|
1399
|
+
At as TemplateBuilder,
|
|
1400
|
+
_a as TreeRowLimitError,
|
|
1401
|
+
Na as applyReportCellEdit,
|
|
1402
|
+
La as applyReportCellEditBatch,
|
|
1403
|
+
Pa as applyReportDocumentStyle,
|
|
1404
|
+
Lr as applyReportEditResult,
|
|
1405
|
+
Dr as applyReportSourceMetadata,
|
|
1406
|
+
pr as assertRenderPlan,
|
|
1407
|
+
aa as assertReportParams,
|
|
1408
|
+
Un as calculateReportSelection,
|
|
1409
|
+
Aa as captureTemplateFragment,
|
|
1410
|
+
Cr as charWidthEm,
|
|
1450
1411
|
T as classOf,
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1412
|
+
fa as cloneReportTemplate,
|
|
1413
|
+
Sa as collectTemplateOutline,
|
|
1414
|
+
Ln as columnsFromContract,
|
|
1415
|
+
vt as computePageWindow,
|
|
1455
1416
|
Fr as countTemplatePages,
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1417
|
+
Rr as createCanvasMeasurer,
|
|
1418
|
+
In as createCanvasPager,
|
|
1419
|
+
Pr as createHeuristicMeasurer,
|
|
1420
|
+
Fn as createLabelTemplate,
|
|
1421
|
+
ua as createLocalTemplateCatalog,
|
|
1461
1422
|
Wn as createMemoryTemplateStore,
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1423
|
+
Hn as createProviderReport,
|
|
1424
|
+
Da as createReportCellEdit,
|
|
1425
|
+
Fa as createReportCellEditBatch,
|
|
1426
|
+
Oa as createReportCellResolver,
|
|
1427
|
+
Zr as createReportDrillRequest,
|
|
1428
|
+
Or as createReportEditSession,
|
|
1429
|
+
Hr as createReportSource,
|
|
1430
|
+
Dn as createTableTemplate,
|
|
1431
|
+
Nn as createTemplate,
|
|
1432
|
+
zn as createTemplateManager,
|
|
1433
|
+
wr as createTemplateRegistry,
|
|
1434
|
+
Ua as createTreeTable,
|
|
1435
|
+
Sr as datasetJsonSchema,
|
|
1436
|
+
On as defineLabelReport,
|
|
1437
|
+
Ze as defineReport,
|
|
1438
|
+
br as defineReportTemplate,
|
|
1439
|
+
pa as diffReportTemplates,
|
|
1440
|
+
zr as estimateListLayoutCells,
|
|
1441
|
+
tr as evalStyleRule,
|
|
1442
|
+
ln as evaluateReportAggregateExpression,
|
|
1443
|
+
Ha as formatReportCellEdit,
|
|
1444
|
+
Bn as formatReportClipboard,
|
|
1445
|
+
ia as formatReportDateRange,
|
|
1446
|
+
nr as formatValue,
|
|
1447
|
+
za as getReportCellContext,
|
|
1448
|
+
Wr as getReportEditSession,
|
|
1449
|
+
ya as hasValidDataExplanation,
|
|
1488
1450
|
le as heuristicMeasurer,
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1451
|
+
Gn as imposeLabelSheets,
|
|
1452
|
+
$a as insertTemplateFragment,
|
|
1453
|
+
qr as inspectOutputCapabilities,
|
|
1454
|
+
Ta as inspectTemplateFieldUsage,
|
|
1455
|
+
ka as inspectTemplateFragmentBindings,
|
|
1494
1456
|
re as isImageBackedComponent,
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1457
|
+
va as isReportDataTarget,
|
|
1458
|
+
oa as isReportDate,
|
|
1459
|
+
sa as isReportMonth,
|
|
1460
|
+
xa as isReportValueState,
|
|
1461
|
+
la as isReportYear,
|
|
1462
|
+
Ae as isRichText,
|
|
1463
|
+
Qr as matchReportDrillActions,
|
|
1501
1464
|
he as measurePageSizePx,
|
|
1502
|
-
|
|
1503
|
-
|
|
1465
|
+
Ar as measureTextMm,
|
|
1466
|
+
Re as mergeComponentStyles,
|
|
1504
1467
|
se as mmToPx,
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1468
|
+
mr as mmToPxFactor,
|
|
1469
|
+
Br as paginateTemplate,
|
|
1470
|
+
jr as paginateTemplatePages,
|
|
1471
|
+
rr as parseDateLocal,
|
|
1472
|
+
_n as parseReportCellFieldInput,
|
|
1473
|
+
at as parseReportCellInput,
|
|
1474
|
+
jn as parseReportClipboard,
|
|
1475
|
+
ca as parseReportDateRange,
|
|
1476
|
+
U as parseReportTemplate,
|
|
1477
|
+
Pn as planFontSizePx,
|
|
1478
|
+
_r as projectListColumns,
|
|
1516
1479
|
W as ptToPx,
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1480
|
+
dr as pxToMm,
|
|
1481
|
+
Ur as registerReportEditSession,
|
|
1482
|
+
Gr as relocateReportCellEdits,
|
|
1483
|
+
Oe as renderComponent,
|
|
1484
|
+
pt as renderPage,
|
|
1485
|
+
Rn as renderPlan,
|
|
1486
|
+
$n as renderPlanToCanvas,
|
|
1487
|
+
kn as renderPlanToCanvasAsync,
|
|
1488
|
+
An as renderPlanToImages,
|
|
1489
|
+
Wa as reportCellEditKey,
|
|
1527
1490
|
q as reportOutputDiagnostics,
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1491
|
+
ma as reportParamsJsonSchema,
|
|
1492
|
+
Ce as resolveBoxBorders,
|
|
1493
|
+
ar as resolveComponentBinding,
|
|
1494
|
+
_ as resolveFontSize,
|
|
1495
|
+
Ne as resolveGridLayout,
|
|
1533
1496
|
ne as resolveLineHeight,
|
|
1534
|
-
|
|
1535
|
-
|
|
1497
|
+
_e as resolvePaper,
|
|
1498
|
+
me as resolvePlanAssets,
|
|
1499
|
+
ea as resolveReportDrillReturn,
|
|
1536
1500
|
G as resolveStroke,
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1501
|
+
Pe as resolveTextColor,
|
|
1502
|
+
wa as reviewReportTemplate,
|
|
1503
|
+
ba as reviewReportTemplateAsync,
|
|
1540
1504
|
j as round,
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1505
|
+
Mr as serializeReportTemplate,
|
|
1506
|
+
Ba as summarizeReportCellEdits,
|
|
1507
|
+
Ca as templatePathLocation,
|
|
1508
|
+
ir as toExcelNumberFormat,
|
|
1509
|
+
or as toNumber,
|
|
1546
1510
|
yr as validateComponent,
|
|
1547
|
-
|
|
1511
|
+
Xe as validateDatasetRows,
|
|
1548
1512
|
vr as validatePage,
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1513
|
+
Je as validateRenderPlan,
|
|
1514
|
+
Yt as validateReportCellFieldDefinition,
|
|
1515
|
+
ta as validateReportDrillActions,
|
|
1516
|
+
da as validateReportParamDefinitions,
|
|
1517
|
+
ha as validateReportParams,
|
|
1518
|
+
$e as validateReportTemplate,
|
|
1519
|
+
xr as validateReportTemplateDocument,
|
|
1520
|
+
Ga as validateTreeOptions,
|
|
1521
|
+
Ie as wrapText
|
|
1557
1522
|
};
|