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