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