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