@agile-team/mach-report 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -4
- package/LICENSING.md +15 -0
- package/README.md +232 -76
- package/dist/ReportPreview-Dwdsyk9b.js +1558 -0
- package/dist/ReportPreview-VHAIfsz1.cjs +6 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +738 -13
- package/dist/index.d.ts +738 -13
- package/dist/index.js +821 -631
- package/dist/pdf.cjs +47 -47
- package/dist/pdf.d.cts +155 -6
- package/dist/pdf.d.ts +155 -6
- package/dist/pdf.js +3542 -3466
- package/dist/plugin-Bl00j_CP.cjs +1 -0
- package/dist/plugin-DVScnZ4C.js +25 -0
- package/dist/report-params-BB85g7mg.js +10 -0
- package/dist/report-params-D1NeY-eR.cjs +1 -0
- package/dist/sql.cjs +65 -64
- package/dist/sql.d.cts +109 -5
- package/dist/sql.d.ts +109 -5
- package/dist/sql.js +7947 -7922
- package/dist/style.css +1 -1
- package/dist/vue/async.d.cts +769 -320
- package/dist/vue/async.d.ts +769 -320
- package/dist/vue/index.d.cts +1321 -14
- package/dist/vue/index.d.ts +1321 -14
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +11 -12
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +129 -49
- package/dist/xlsx.cjs +20 -20
- package/dist/xlsx.d.cts +2292 -5
- package/dist/xlsx.d.ts +2292 -5
- package/dist/xlsx.js +5452 -5443
- package/package.json +6 -2
- package/dist/ReportPreview-Cr0IH1Rz.cjs +0 -6
- package/dist/ReportPreview-DwknBgsJ.js +0 -1266
- package/dist/builder/template-builder.d.ts +0 -69
- package/dist/defaults.d.ts +0 -23
- package/dist/format.d.ts +0 -48
- package/dist/layout/paginate.d.ts +0 -97
- package/dist/layout/textwrap.d.ts +0 -36
- package/dist/pdf/font-loader.d.ts +0 -6
- package/dist/pdf/index.d.ts +0 -2
- package/dist/pdf/render-pdf.d.ts +0 -25
- package/dist/plugin-Cj3c2wJc.cjs +0 -1
- package/dist/plugin-DJf_6_fl.js +0 -18
- package/dist/render/canvas.d.ts +0 -76
- package/dist/render/dom.d.ts +0 -10
- package/dist/render/grid-geometry.d.ts +0 -41
- package/dist/render/style.d.ts +0 -33
- package/dist/render/window.d.ts +0 -23
- package/dist/schema/render-plan.d.ts +0 -88
- package/dist/schema/validate.d.ts +0 -15
- package/dist/sql/ast-check.d.ts +0 -14
- package/dist/sql/compile.d.ts +0 -31
- package/dist/sql/expr.d.ts +0 -21
- package/dist/sql/index.d.ts +0 -4
- package/dist/sql/tokenizer.d.ts +0 -25
- package/dist/units.d.ts +0 -11
- package/dist/vue/ReportParamPanel.d.ts +0 -19
- package/dist/vue/ReportPreview.d.ts +0 -200
- package/dist/vue/ReportToolbar.d.ts +0 -42
- package/dist/vue/adapters.d.ts +0 -34
- package/dist/vue/composables/useHighlight.d.ts +0 -8
- package/dist/vue/composables/usePageWindow.d.ts +0 -25
- package/dist/vue/composables/usePrintExport.d.ts +0 -40
- package/dist/vue/composables/useReportSearch.d.ts +0 -73
- package/dist/vue/composables/useZoom.d.ts +0 -15
- package/dist/vue/config.d.ts +0 -108
- package/dist/vue/controller.d.ts +0 -29
- package/dist/vue/errors.d.ts +0 -16
- package/dist/vue/injection-keys.d.ts +0 -14
- package/dist/vue/local-adapter.d.ts +0 -11
- package/dist/vue/pdf-exporter.d.ts +0 -13
- package/dist/vue/plugin.d.ts +0 -332
- package/dist/xlsx/render-xlsx.d.ts +0 -20
package/dist/index.js
CHANGED
|
@@ -1,90 +1,91 @@
|
|
|
1
|
-
import { h as
|
|
2
|
-
import { C as
|
|
3
|
-
import { r as
|
|
4
|
-
|
|
1
|
+
import { h as ie, R as pe, D as Q, w as Z, L as ee, i as He, r as q, m as Re, a as V, b as Me, c as Y, d as te, p as K, e as Ne, f as we, g as Be, P as X } from "./style-DnmtG7Gl.js";
|
|
2
|
+
import { C as St, j as vt, k as Pt, M as Tt, S as xt, l as $t, n as kt, o as Et, q as Ct, s as At, t as Ht } from "./style-DnmtG7Gl.js";
|
|
3
|
+
import { r as Le } from "./grid-geometry-Bs8QXz1X.js";
|
|
4
|
+
import { g as ze } from "./report-params-BB85g7mg.js";
|
|
5
|
+
function Fe(e) {
|
|
5
6
|
const t = /^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(e.trim());
|
|
6
7
|
if (t) {
|
|
7
|
-
const
|
|
8
|
-
return Number.isNaN(
|
|
8
|
+
const r = new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3]));
|
|
9
|
+
return Number.isNaN(r.getTime()) ? null : r;
|
|
9
10
|
}
|
|
10
|
-
const
|
|
11
|
-
return Number.isNaN(
|
|
11
|
+
const n = new Date(e);
|
|
12
|
+
return Number.isNaN(n.getTime()) ? null : n;
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
+
function re(e, t) {
|
|
14
15
|
return e.toLocaleString("en-US", {
|
|
15
16
|
minimumFractionDigits: t,
|
|
16
17
|
maximumFractionDigits: t
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
return t.replace(/YYYY/g, String(e.getFullYear())).replace(/MM/g,
|
|
20
|
+
function De(e, t) {
|
|
21
|
+
const n = (r) => String(r).padStart(2, "0");
|
|
22
|
+
return t.replace(/YYYY/g, String(e.getFullYear())).replace(/MM/g, n(e.getMonth() + 1)).replace(/DD/g, n(e.getDate())).replace(/hh/g, n(e.getHours())).replace(/mm/g, n(e.getMinutes())).replace(/ss/g, n(e.getSeconds()));
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
-
return
|
|
24
|
+
function We(e, t, n) {
|
|
25
|
+
return n != null ? t ? re(e, n) : e.toFixed(n) : t ? re(e) : String(e);
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function oe(e) {
|
|
27
28
|
const t = typeof e == "number" ? e : Number(String(e).replace(/,/g, ""));
|
|
28
29
|
return Number.isFinite(t) ? t : null;
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function be(e, t) {
|
|
31
32
|
if (e == null || e === "" || !t) return String(e ?? "");
|
|
32
33
|
switch (t.kind) {
|
|
33
34
|
case "number": {
|
|
34
|
-
const
|
|
35
|
-
return
|
|
35
|
+
const n = oe(e);
|
|
36
|
+
return n == null ? String(e) : We(n, t.thousands === !0, t.digits);
|
|
36
37
|
}
|
|
37
38
|
case "percent": {
|
|
38
|
-
const
|
|
39
|
-
return
|
|
39
|
+
const n = oe(e);
|
|
40
|
+
return n == null ? String(e) : `${re(n * 100, t.digits ?? 2)}%`;
|
|
40
41
|
}
|
|
41
42
|
case "date": {
|
|
42
|
-
const
|
|
43
|
-
return
|
|
43
|
+
const n = t.pattern ?? "YYYY-MM-DD", r = e instanceof Date ? e : Fe(String(e));
|
|
44
|
+
return r ? De(r, n) : String(e);
|
|
44
45
|
}
|
|
45
46
|
default:
|
|
46
47
|
return String(e);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
50
|
+
function je(e, t) {
|
|
51
|
+
const n = e[t.field];
|
|
52
|
+
if (n == null || n === "") return !1;
|
|
52
53
|
if (typeof t.value == "number") {
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
54
|
+
const i = oe(n);
|
|
55
|
+
if (i == null) return !1;
|
|
55
56
|
switch (t.op) {
|
|
56
57
|
case ">":
|
|
57
|
-
return
|
|
58
|
+
return i > t.value;
|
|
58
59
|
case ">=":
|
|
59
|
-
return
|
|
60
|
+
return i >= t.value;
|
|
60
61
|
case "<":
|
|
61
|
-
return
|
|
62
|
+
return i < t.value;
|
|
62
63
|
case "<=":
|
|
63
|
-
return
|
|
64
|
+
return i <= t.value;
|
|
64
65
|
case "==":
|
|
65
|
-
return
|
|
66
|
+
return i === t.value;
|
|
66
67
|
case "!=":
|
|
67
|
-
return
|
|
68
|
+
return i !== t.value;
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
|
-
const
|
|
71
|
+
const r = String(n), o = String(t.value);
|
|
71
72
|
switch (t.op) {
|
|
72
73
|
case "==":
|
|
73
|
-
return
|
|
74
|
+
return r === o;
|
|
74
75
|
case "!=":
|
|
75
|
-
return
|
|
76
|
+
return r !== o;
|
|
76
77
|
case ">":
|
|
77
|
-
return
|
|
78
|
+
return r > o;
|
|
78
79
|
case ">=":
|
|
79
|
-
return
|
|
80
|
+
return r >= o;
|
|
80
81
|
case "<":
|
|
81
|
-
return
|
|
82
|
+
return r < o;
|
|
82
83
|
case "<=":
|
|
83
|
-
return
|
|
84
|
+
return r <= o;
|
|
84
85
|
}
|
|
85
86
|
return !1;
|
|
86
87
|
}
|
|
87
|
-
const
|
|
88
|
+
const Oe = /* @__PURE__ */ new Set([
|
|
88
89
|
"text",
|
|
89
90
|
"image",
|
|
90
91
|
"barcode",
|
|
@@ -94,87 +95,89 @@ const ze = /* @__PURE__ */ new Set([
|
|
|
94
95
|
"rect",
|
|
95
96
|
"ellipse"
|
|
96
97
|
]);
|
|
97
|
-
function
|
|
98
|
+
function _(e) {
|
|
98
99
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
-
const
|
|
102
|
-
|
|
101
|
+
function _e(e, t, n, r) {
|
|
102
|
+
const o = e[t];
|
|
103
|
+
(typeof o != "number" || !Number.isFinite(o)) && r.push({ path: `${n}.${t}`, message: `应为有限数字,实际 ${JSON.stringify(o)}` });
|
|
103
104
|
}
|
|
104
|
-
function
|
|
105
|
-
if (!
|
|
106
|
-
|
|
105
|
+
function ye(e, t, n, r = []) {
|
|
106
|
+
if (!_(e)) {
|
|
107
|
+
n.push({ path: t, message: "组件应为对象" });
|
|
107
108
|
return;
|
|
108
109
|
}
|
|
109
|
-
const
|
|
110
|
-
typeof
|
|
110
|
+
const o = e.kind;
|
|
111
|
+
typeof o != "string" ? n.push({ path: `${t}.kind`, message: "组件缺少 kind 字符串" }) : Oe.has(o) || r.push({
|
|
111
112
|
path: `${t}.kind`,
|
|
112
|
-
message: `未知组件类型 ${JSON.stringify(
|
|
113
|
+
message: `未知组件类型 ${JSON.stringify(o)},将以兜底方式渲染`
|
|
113
114
|
});
|
|
114
|
-
for (const
|
|
115
|
-
|
|
116
|
-
e.leftMm
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
for (const s of ["leftMm", "topMm", "widthMm", "heightMm"])
|
|
116
|
+
_e(e, s, t, n);
|
|
117
|
+
typeof e.leftMm == "number" && e.leftMm < -100 && n.push({ path: `${t}.leftMm`, message: "几何数值异常(leftMm<-100)" });
|
|
118
|
+
for (const s of ["widthMm", "heightMm"])
|
|
119
|
+
typeof e[s] == "number" && e[s] < 0 && n.push({ path: `${t}.${s}`, message: "组件尺寸不能为负数" });
|
|
120
|
+
const i = e.grid;
|
|
121
|
+
i !== void 0 && (!_(i) || !Array.isArray(i.cells) ? n.push({ path: `${t}.grid.cells`, message: "grid.cells 应为二维数组" }) : i.cells.forEach((s, l) => {
|
|
122
|
+
if (!Array.isArray(s)) {
|
|
123
|
+
n.push({ path: `${t}.grid.cells.${l}`, message: "行应为数组" });
|
|
121
124
|
return;
|
|
122
125
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
+
s.forEach((d, h) => {
|
|
127
|
+
d != null && _(d) && Array.isArray(d.children) && d.children.forEach((m, c) => {
|
|
128
|
+
ye(m, `${t}.grid.cells.${l}.${h}.children.${c}`, n, r);
|
|
126
129
|
});
|
|
127
130
|
});
|
|
128
131
|
}));
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
(!
|
|
132
|
-
}) :
|
|
132
|
+
const a = e.richParagraphs;
|
|
133
|
+
a !== void 0 && (Array.isArray(a) ? a.forEach((s, l) => {
|
|
134
|
+
(!_(s) || !Array.isArray(s.segments)) && n.push({ path: `${t}.richParagraphs.${l}`, message: "段落缺少 segments 数组" });
|
|
135
|
+
}) : n.push({ path: `${t}.richParagraphs`, message: "richParagraphs 应为数组" }));
|
|
133
136
|
}
|
|
134
|
-
function
|
|
135
|
-
if (!
|
|
136
|
-
|
|
137
|
+
function Ie(e, t, n, r = []) {
|
|
138
|
+
if (!_(e)) {
|
|
139
|
+
n.push({ path: t, message: "页应为对象" });
|
|
137
140
|
return;
|
|
138
141
|
}
|
|
139
|
-
const
|
|
140
|
-
(typeof
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
(
|
|
144
|
-
);
|
|
142
|
+
const o = e.pageWidthMm, i = e.pageHeightMm;
|
|
143
|
+
(typeof o != "number" || !(o > 0 && o < 3e3)) && n.push({ path: `${t}.pageWidthMm`, message: `页宽非法: ${JSON.stringify(o)}` }), (typeof i != "number" || !(i > 0 && i < 5e3)) && n.push({ path: `${t}.pageHeightMm`, message: `页高非法: ${JSON.stringify(i)}` });
|
|
144
|
+
const a = e.components;
|
|
145
|
+
Array.isArray(a) ? Array.isArray(a) && a.forEach(
|
|
146
|
+
(s, l) => ye(s, `${t}.components.${l}`, n, r)
|
|
147
|
+
) : n.push({ path: `${t}.components`, message: "components 应为数组" });
|
|
145
148
|
}
|
|
146
|
-
function
|
|
147
|
-
const t = [],
|
|
148
|
-
if (!Array.isArray(
|
|
149
|
+
function Se(e) {
|
|
150
|
+
const t = [], n = [], r = _(e) ? e.pages : void 0;
|
|
151
|
+
if (!Array.isArray(r))
|
|
149
152
|
t.push({
|
|
150
153
|
path: "$.pages",
|
|
151
154
|
message: e == null ? "渲染计划为空" : "渲染计划缺少 pages 数组"
|
|
152
155
|
});
|
|
153
156
|
else {
|
|
154
|
-
|
|
157
|
+
r.forEach((i, a) => Ie(i, `$.pages.${a}`, t, n)), r.length > 2e3 && n.push({
|
|
155
158
|
path: "$.pages",
|
|
156
|
-
message: `页数异常大(${
|
|
159
|
+
message: `页数异常大(${r.length} 页),渲染与打印耗时可能显著增加`
|
|
157
160
|
});
|
|
158
|
-
const
|
|
159
|
-
(
|
|
161
|
+
const o = r.reduce(
|
|
162
|
+
(i, a) => i + (_(a) && Array.isArray(a.components) ? a.components.length : 0),
|
|
160
163
|
0
|
|
161
164
|
);
|
|
162
|
-
|
|
165
|
+
o > 5e4 && n.push({
|
|
163
166
|
path: "$.pages",
|
|
164
|
-
message: `组件总数异常大(${
|
|
167
|
+
message: `组件总数异常大(${o} 个),可能触发浏览器性能限制`
|
|
165
168
|
});
|
|
166
169
|
}
|
|
167
|
-
return { ok: t.length === 0, errors: t, warnings:
|
|
170
|
+
return { ok: t.length === 0, errors: t, warnings: n };
|
|
168
171
|
}
|
|
169
|
-
function
|
|
170
|
-
const t =
|
|
172
|
+
function dt(e) {
|
|
173
|
+
const t = Se(e);
|
|
171
174
|
if (!t.ok) {
|
|
172
|
-
const
|
|
173
|
-
throw new Error(`渲染计划校验失败(${t.errors.length} 处): ${
|
|
175
|
+
const n = t.errors.slice(0, 3).map((r) => `${r.path}: ${r.message}`).join("; ");
|
|
176
|
+
throw new Error(`渲染计划校验失败(${t.errors.length} 处): ${n}`);
|
|
174
177
|
}
|
|
175
178
|
return e.pages;
|
|
176
179
|
}
|
|
177
|
-
function
|
|
180
|
+
function fe(e) {
|
|
178
181
|
return {
|
|
179
182
|
widthMm: e.widthMm,
|
|
180
183
|
heightMm: e.heightMm,
|
|
@@ -185,14 +188,14 @@ function de(e) {
|
|
|
185
188
|
components: []
|
|
186
189
|
};
|
|
187
190
|
}
|
|
188
|
-
function
|
|
191
|
+
function Ge(e, t) {
|
|
189
192
|
return t.heightMm - (e.marginBottomMm ?? t.marginBottomMm);
|
|
190
193
|
}
|
|
191
|
-
function
|
|
192
|
-
const
|
|
193
|
-
return Math.max(e.rowHeightMm ?? 0, t *
|
|
194
|
+
function Ye(e, t) {
|
|
195
|
+
const r = (e.fontSizePt ?? Q) * ee * 25.4 / 72, o = (e.paddingMm ?? 1) * 2;
|
|
196
|
+
return Math.max(e.rowHeightMm ?? 0, t * r + o);
|
|
194
197
|
}
|
|
195
|
-
function
|
|
198
|
+
function ve(e) {
|
|
196
199
|
if (e == null) return "";
|
|
197
200
|
if (typeof e == "string") return e;
|
|
198
201
|
if (typeof e == "number") return String(e);
|
|
@@ -204,239 +207,257 @@ function pe(e) {
|
|
|
204
207
|
return String(e);
|
|
205
208
|
}
|
|
206
209
|
}
|
|
207
|
-
function
|
|
208
|
-
const
|
|
209
|
-
(
|
|
210
|
-
),
|
|
211
|
-
(
|
|
210
|
+
function qe(e, t) {
|
|
211
|
+
const n = e.fontSizePt ?? Q, r = e.paddingMm ?? 1, o = e.columns.map(
|
|
212
|
+
(g) => ({ fontSize: n, align: "left", verticalAlign: "middle", ...g.style })
|
|
213
|
+
), i = e.columns.map(
|
|
214
|
+
(g) => ({
|
|
215
|
+
fontSize: n,
|
|
212
216
|
bold: e.headerBold ?? !0,
|
|
213
217
|
align: "center",
|
|
214
218
|
verticalAlign: "middle",
|
|
215
219
|
backgroundColor: e.headerBackgroundColor,
|
|
216
|
-
...
|
|
220
|
+
...g.style || {}
|
|
217
221
|
})
|
|
218
|
-
),
|
|
219
|
-
(
|
|
220
|
-
|
|
221
|
-
e.columns[f].widthMm -
|
|
222
|
-
{ fontSizePt:
|
|
222
|
+
), a = e.columns.map((g) => g.header), s = a.map(
|
|
223
|
+
(g, f) => Z(
|
|
224
|
+
g,
|
|
225
|
+
e.columns[f].widthMm - r * 2,
|
|
226
|
+
{ fontSizePt: n, bold: e.headerBold ?? !0 },
|
|
223
227
|
t
|
|
224
228
|
)
|
|
225
|
-
),
|
|
226
|
-
text:
|
|
227
|
-
style:
|
|
228
|
-
})),
|
|
229
|
+
), l = Math.max(...s.map((g) => g.length), 1), d = Ye(e, l), h = a.map((g, f) => ({
|
|
230
|
+
text: g,
|
|
231
|
+
style: i[f]
|
|
232
|
+
})), m = e.border === !1 ? { borderTop: !1, borderRight: !1, borderBottom: !1, borderLeft: !1 } : { borderBottom: !0, borderLeft: !0, borderRight: !0, borderTop: !0 }, c = e.columns.map((g) => g.widthMm);
|
|
229
233
|
return {
|
|
230
|
-
fontSizePt:
|
|
231
|
-
paddingMm:
|
|
232
|
-
cellStyles:
|
|
233
|
-
borderStyle:
|
|
234
|
-
headerHeightMm:
|
|
235
|
-
headerGrid: {
|
|
234
|
+
fontSizePt: n,
|
|
235
|
+
paddingMm: r,
|
|
236
|
+
cellStyles: o,
|
|
237
|
+
borderStyle: m,
|
|
238
|
+
headerHeightMm: d,
|
|
239
|
+
headerGrid: {
|
|
240
|
+
cells: [h],
|
|
241
|
+
colWidthsMm: c,
|
|
242
|
+
rowHeightsMm: [d]
|
|
243
|
+
},
|
|
244
|
+
colWidthsMm: c,
|
|
236
245
|
columns: e.columns
|
|
237
246
|
};
|
|
238
247
|
}
|
|
239
|
-
function
|
|
240
|
-
const
|
|
241
|
-
let
|
|
242
|
-
for (let
|
|
243
|
-
const
|
|
244
|
-
|
|
248
|
+
function ge(e, t, n) {
|
|
249
|
+
const r = e.columns, o = new Array(r.length);
|
|
250
|
+
let i = 1;
|
|
251
|
+
for (let h = 0; h < r.length; h++) {
|
|
252
|
+
const m = r[h];
|
|
253
|
+
o[h] = m.format ? be(t[m.field], m.format) : ve(t[m.field]);
|
|
245
254
|
}
|
|
246
|
-
const
|
|
247
|
-
for (let
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
|
|
255
|
+
const a = new Array(r.length);
|
|
256
|
+
for (let h = 0; h < r.length; h++) {
|
|
257
|
+
const m = Z(
|
|
258
|
+
o[h],
|
|
259
|
+
r[h].widthMm - e.paddingMm * 2,
|
|
251
260
|
{ fontSizePt: e.fontSizePt },
|
|
252
|
-
|
|
261
|
+
n
|
|
253
262
|
);
|
|
254
|
-
|
|
263
|
+
a[h] = m, m.length > i && (i = m.length);
|
|
255
264
|
}
|
|
256
|
-
const
|
|
265
|
+
const s = e.fontSizePt * ee * 25.4 / 72, l = Math.max(
|
|
257
266
|
e.rowHeightFloorMm,
|
|
258
|
-
|
|
259
|
-
),
|
|
260
|
-
for (let
|
|
261
|
-
const
|
|
262
|
-
let
|
|
263
|
-
if (
|
|
264
|
-
for (const
|
|
265
|
-
if (
|
|
266
|
-
|
|
267
|
+
i * s + e.paddingMm * 2
|
|
268
|
+
), d = new Array(r.length);
|
|
269
|
+
for (let h = 0; h < r.length; h++) {
|
|
270
|
+
const m = r[h];
|
|
271
|
+
let c = e.cellStyles[h];
|
|
272
|
+
if (m.rules) {
|
|
273
|
+
for (const g of m.rules)
|
|
274
|
+
if (je(t, g.when)) {
|
|
275
|
+
c = { ...c ?? {}, ...g.style };
|
|
267
276
|
break;
|
|
268
277
|
}
|
|
269
278
|
}
|
|
270
|
-
|
|
279
|
+
d[h] = { text: o[h], style: c };
|
|
271
280
|
}
|
|
272
|
-
return {
|
|
281
|
+
return {
|
|
282
|
+
grid: { cells: [d], colWidthsMm: e.colWidthsMm, rowHeightsMm: [l] },
|
|
283
|
+
heightMm: l
|
|
284
|
+
};
|
|
273
285
|
}
|
|
274
|
-
function
|
|
275
|
-
const
|
|
276
|
-
let
|
|
277
|
-
const
|
|
278
|
-
for (const
|
|
279
|
-
const
|
|
280
|
-
if (
|
|
281
|
-
pageWidthMm:
|
|
282
|
-
pageHeightMm:
|
|
283
|
-
marginTopMm:
|
|
284
|
-
marginBottomMm:
|
|
285
|
-
marginLeftMm:
|
|
286
|
-
marginRightMm:
|
|
287
|
-
components:
|
|
286
|
+
function Ve(e, t, n = {}) {
|
|
287
|
+
const r = typeof n == "number" ? { mmPerRow: n } : n, o = r.mmPerRow ?? 0, i = r.measurer ?? ie, a = [], s = [];
|
|
288
|
+
let l = 0;
|
|
289
|
+
const d = (m) => `${m}_${(++l).toString(36)}`, h = [];
|
|
290
|
+
for (const m of e.pages) {
|
|
291
|
+
const c = fe(m), g = () => Ge(m, c), f = c.marginTopMm, y = [], P = () => {
|
|
292
|
+
if (s.push({
|
|
293
|
+
pageWidthMm: c.widthMm,
|
|
294
|
+
pageHeightMm: c.heightMm,
|
|
295
|
+
marginTopMm: c.marginTopMm,
|
|
296
|
+
marginBottomMm: c.marginBottomMm,
|
|
297
|
+
marginLeftMm: c.marginLeftMm,
|
|
298
|
+
marginRightMm: c.marginRightMm,
|
|
299
|
+
components: c.components
|
|
288
300
|
}), y.length > 0) {
|
|
289
|
-
const
|
|
290
|
-
for (const
|
|
301
|
+
const x = s.length;
|
|
302
|
+
for (const M of y) {
|
|
291
303
|
const v = {
|
|
292
|
-
...
|
|
293
|
-
text: String(
|
|
304
|
+
...M,
|
|
305
|
+
text: String(M.text ?? "").replace(/\{page\}/g, String(x))
|
|
294
306
|
};
|
|
295
|
-
|
|
307
|
+
s[s.length - 1].components.push(v), v.text.includes("{totalPages}") && h.push(v);
|
|
296
308
|
}
|
|
297
309
|
}
|
|
298
310
|
};
|
|
299
|
-
for (const
|
|
300
|
-
if (
|
|
301
|
-
if (
|
|
302
|
-
const
|
|
303
|
-
if (
|
|
304
|
-
y.push(
|
|
311
|
+
for (const x of m.components) {
|
|
312
|
+
if (x.kind !== "list") {
|
|
313
|
+
if (x.kind === "text" && typeof x.text == "string") {
|
|
314
|
+
const b = x.text;
|
|
315
|
+
if (b.includes("{page}") || b.includes("{totalPages}")) {
|
|
316
|
+
y.push(x);
|
|
305
317
|
continue;
|
|
306
318
|
}
|
|
307
319
|
}
|
|
308
|
-
|
|
320
|
+
c.components.push(x);
|
|
309
321
|
continue;
|
|
310
322
|
}
|
|
311
|
-
const
|
|
312
|
-
Array.isArray(v) ||
|
|
313
|
-
const
|
|
314
|
-
...
|
|
315
|
-
rowHeightFloorMm:
|
|
316
|
-
},
|
|
323
|
+
const M = x, v = t[M.dataset];
|
|
324
|
+
Array.isArray(v) || a.push(`数据集 ${M.dataset} 未提供数据,列表 ${M.id ?? ""} 输出为空`);
|
|
325
|
+
const u = Array.isArray(v) ? v : [], T = M.columns.reduce((b, p) => b + p.widthMm, 0), I = T > M.widthMm ? M.widthMm / T : 1, E = I === 1 ? M : { ...M, columns: M.columns.map((b) => ({ ...b, widthMm: b.widthMm * I })) }, $ = {
|
|
326
|
+
...qe(E, i),
|
|
327
|
+
rowHeightFloorMm: E.rowHeightMm ?? 0
|
|
328
|
+
}, G = {
|
|
317
329
|
kind: "rect",
|
|
318
|
-
leftMm:
|
|
330
|
+
leftMm: M.leftMm,
|
|
319
331
|
topMm: 0,
|
|
320
|
-
widthMm:
|
|
332
|
+
widthMm: M.widthMm,
|
|
321
333
|
heightMm: $.headerHeightMm,
|
|
322
334
|
grid: $.headerGrid,
|
|
323
|
-
nid:
|
|
335
|
+
nid: d("listh"),
|
|
324
336
|
style: $.borderStyle
|
|
325
337
|
};
|
|
326
|
-
let
|
|
327
|
-
const
|
|
328
|
-
|
|
338
|
+
let w = M.topMm;
|
|
339
|
+
const H = (b, p) => {
|
|
340
|
+
b.components.push({ ...G, topMm: p });
|
|
329
341
|
};
|
|
330
|
-
|
|
331
|
-
const
|
|
332
|
-
if (
|
|
333
|
-
|
|
334
|
-
const
|
|
335
|
-
|
|
342
|
+
H(c, w), w += $.headerHeightMm + o;
|
|
343
|
+
const B = (b) => {
|
|
344
|
+
if (w + b > g()) {
|
|
345
|
+
P();
|
|
346
|
+
const p = fe(m);
|
|
347
|
+
c.components = p.components, c.heightMm = p.heightMm, E.headerEveryPage !== !1 ? (H(c, M.topMm), w = M.topMm + $.headerHeightMm) : w = f;
|
|
336
348
|
}
|
|
337
|
-
},
|
|
338
|
-
|
|
349
|
+
}, S = (b, p, k) => {
|
|
350
|
+
const C = E.headerEveryPage !== !1 ? M.topMm + $.headerHeightMm : f, z = g() - C;
|
|
351
|
+
p > z && a.push(
|
|
352
|
+
`列表 ${M.id ?? M.dataset} 行高 ${p.toFixed(2)}mm 超出单页可用高度 ${z.toFixed(2)}mm,预览与打印可能截断内容`
|
|
353
|
+
), B(p), c.components.push({
|
|
339
354
|
kind: "rect",
|
|
340
|
-
leftMm:
|
|
341
|
-
topMm:
|
|
342
|
-
widthMm:
|
|
343
|
-
heightMm:
|
|
344
|
-
grid:
|
|
345
|
-
nid:
|
|
355
|
+
leftMm: M.leftMm,
|
|
356
|
+
topMm: w,
|
|
357
|
+
widthMm: M.widthMm,
|
|
358
|
+
heightMm: p,
|
|
359
|
+
grid: b,
|
|
360
|
+
nid: d(k),
|
|
346
361
|
style: $.borderStyle
|
|
347
|
-
}),
|
|
348
|
-
},
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
for (let
|
|
352
|
-
const
|
|
353
|
-
|
|
362
|
+
}), w += p;
|
|
363
|
+
}, R = () => ge($, {}, i).heightMm, A = (b, p, k, C) => {
|
|
364
|
+
const z = [], de = Math.max(1, Math.min(C, E.columns.length)), me = { fontSize: $.fontSizePt, ...k };
|
|
365
|
+
z.push({ text: b, colSpan: de, style: { bold: !0, ...me } });
|
|
366
|
+
for (let ne = de; ne < E.columns.length; ne++) {
|
|
367
|
+
const Ae = E.columns[ne];
|
|
368
|
+
z.push({ text: p.get(Ae.field) ?? "", style: me });
|
|
354
369
|
}
|
|
355
|
-
const
|
|
356
|
-
return {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
370
|
+
const Ce = $.fontSizePt * ee * 25.4 / 72, he = Math.max($.rowHeightFloorMm, Ce + $.paddingMm * 2);
|
|
371
|
+
return {
|
|
372
|
+
grid: { cells: [z], colWidthsMm: $.colWidthsMm, rowHeightsMm: [he] },
|
|
373
|
+
heightMm: he
|
|
374
|
+
};
|
|
375
|
+
}, j = (b, p) => {
|
|
376
|
+
let k = 0;
|
|
377
|
+
for (const C of b) {
|
|
378
|
+
const z = typeof C[p] == "number" ? C[p] : Number(C[p]);
|
|
379
|
+
Number.isFinite(z) && (k += z);
|
|
362
380
|
}
|
|
363
|
-
return
|
|
364
|
-
},
|
|
365
|
-
const
|
|
366
|
-
return
|
|
367
|
-
},
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
381
|
+
return k;
|
|
382
|
+
}, U = (b, p) => {
|
|
383
|
+
const k = E.columns.find((C) => C.field === p);
|
|
384
|
+
return be(j(b, p), k?.format ?? { kind: "number", thousands: !0 });
|
|
385
|
+
}, L = E.groupBy, le = (b) => {
|
|
386
|
+
const p = E.columns.findIndex((k) => b.includes(k.field));
|
|
387
|
+
return p > 0 ? p : 1;
|
|
388
|
+
}, J = [];
|
|
389
|
+
if (L) {
|
|
390
|
+
const b = /* @__PURE__ */ new Map();
|
|
391
|
+
for (const p of u) {
|
|
392
|
+
const k = ve(p[L.field]), C = b.get(k);
|
|
393
|
+
C ? C.push(p) : b.set(k, [p]);
|
|
373
394
|
}
|
|
374
|
-
for (const [
|
|
375
|
-
|
|
395
|
+
for (const [p, k] of b) {
|
|
396
|
+
J.push({
|
|
376
397
|
kind: "groupHeader",
|
|
377
|
-
label: (
|
|
398
|
+
label: (L.headerTemplate ?? "{value}").replace(/\{value\}/g, p)
|
|
378
399
|
});
|
|
379
|
-
for (const
|
|
380
|
-
|
|
400
|
+
for (const C of k) J.push({ kind: "row", row: C });
|
|
401
|
+
L.subtotal && L.subtotal.length > 0 && J.push({
|
|
381
402
|
kind: "subtotal",
|
|
382
|
-
label:
|
|
383
|
-
rows:
|
|
403
|
+
label: L.subtotalLabel ?? "小计",
|
|
404
|
+
rows: k
|
|
384
405
|
});
|
|
385
406
|
}
|
|
386
407
|
} else
|
|
387
|
-
for (const
|
|
388
|
-
const
|
|
389
|
-
for (const
|
|
390
|
-
if (
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
} else if (
|
|
394
|
-
const
|
|
395
|
-
|
|
408
|
+
for (const b of u) J.push({ kind: "row", row: b });
|
|
409
|
+
const ce = R();
|
|
410
|
+
for (const b of J)
|
|
411
|
+
if (b.kind === "row") {
|
|
412
|
+
const p = ge($, b.row, i);
|
|
413
|
+
S(p.grid, p.heightMm, "listr");
|
|
414
|
+
} else if (b.kind === "groupHeader") {
|
|
415
|
+
const p = A(
|
|
416
|
+
b.label,
|
|
396
417
|
/* @__PURE__ */ new Map(),
|
|
397
|
-
|
|
398
|
-
|
|
418
|
+
L?.headerStyle ?? {},
|
|
419
|
+
E.columns.length
|
|
399
420
|
);
|
|
400
|
-
|
|
401
|
-
} else if (
|
|
402
|
-
const
|
|
403
|
-
for (const
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
421
|
+
L?.keepWithNext !== !1 && w + p.heightMm + ce > g() && B(p.heightMm + ce), S(p.grid, p.heightMm, "listg");
|
|
422
|
+
} else if (b.kind === "subtotal") {
|
|
423
|
+
const p = /* @__PURE__ */ new Map();
|
|
424
|
+
for (const C of L.subtotal ?? []) p.set(C, U(b.rows, C));
|
|
425
|
+
const k = A(
|
|
426
|
+
b.label,
|
|
427
|
+
p,
|
|
428
|
+
L?.subtotalStyle ?? {},
|
|
429
|
+
le(L.subtotal ?? [])
|
|
409
430
|
);
|
|
410
|
-
|
|
431
|
+
S(k.grid, k.heightMm, "listst");
|
|
411
432
|
}
|
|
412
|
-
if (
|
|
413
|
-
const
|
|
414
|
-
if (
|
|
415
|
-
const
|
|
416
|
-
for (const
|
|
417
|
-
const
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
433
|
+
if (E.grandTotal) {
|
|
434
|
+
const b = typeof E.grandTotal == "object" ? E.grandTotal : void 0, p = b?.fields ?? L?.subtotal ?? [];
|
|
435
|
+
if (p.length > 0) {
|
|
436
|
+
const k = /* @__PURE__ */ new Map();
|
|
437
|
+
for (const z of p) k.set(z, U(u, z));
|
|
438
|
+
const C = A(
|
|
439
|
+
b?.label ?? "合计",
|
|
440
|
+
k,
|
|
441
|
+
b?.style ?? {},
|
|
442
|
+
le(p)
|
|
422
443
|
);
|
|
423
|
-
|
|
444
|
+
S(C.grid, C.heightMm, "listgt");
|
|
424
445
|
} else
|
|
425
|
-
|
|
446
|
+
a.push(`列表 ${M.id ?? ""} 配置了 grandTotal 但未提供合计字段(groupBy.subtotal 或 grandTotal.fields)`);
|
|
426
447
|
}
|
|
427
448
|
}
|
|
428
|
-
|
|
449
|
+
P();
|
|
429
450
|
}
|
|
430
|
-
for (const
|
|
431
|
-
const
|
|
432
|
-
typeof
|
|
451
|
+
for (const m of h) {
|
|
452
|
+
const c = m.text;
|
|
453
|
+
typeof c == "string" && c.includes("{totalPages}") && (m.text = c.replace(/\{totalPages\}/g, String(s.length)));
|
|
433
454
|
}
|
|
434
455
|
return {
|
|
435
|
-
plan: { schemaVersion:
|
|
436
|
-
warnings:
|
|
456
|
+
plan: { schemaVersion: pe, pages: s },
|
|
457
|
+
warnings: a
|
|
437
458
|
};
|
|
438
459
|
}
|
|
439
|
-
const
|
|
460
|
+
const Je = {
|
|
440
461
|
root: "mr-root",
|
|
441
462
|
page: "mr-page",
|
|
442
463
|
comp: "mr-comp",
|
|
@@ -454,404 +475,404 @@ const je = {
|
|
|
454
475
|
unknown: "mr-unknown"
|
|
455
476
|
};
|
|
456
477
|
function N(e, t) {
|
|
457
|
-
return t?.classNames?.[e] ??
|
|
478
|
+
return t?.classNames?.[e] ?? Je[e];
|
|
458
479
|
}
|
|
459
|
-
class
|
|
480
|
+
class F {
|
|
460
481
|
constructor() {
|
|
461
482
|
this.props = [];
|
|
462
483
|
}
|
|
463
|
-
add(t,
|
|
464
|
-
return
|
|
484
|
+
add(t, n) {
|
|
485
|
+
return n == null || n === !1 || n === "" ? this : (this.props.push([t, String(n)]), this);
|
|
465
486
|
}
|
|
466
|
-
mm(t,
|
|
467
|
-
return this.add(t, `${
|
|
487
|
+
mm(t, n, r, o = 2) {
|
|
488
|
+
return this.add(t, `${q(Re(n, r), o)}px`);
|
|
468
489
|
}
|
|
469
490
|
toString() {
|
|
470
491
|
let t = "";
|
|
471
|
-
for (const [
|
|
472
|
-
t += `${
|
|
492
|
+
for (const [n, r] of this.props)
|
|
493
|
+
t += `${n}:${r};`;
|
|
473
494
|
return t;
|
|
474
495
|
}
|
|
475
496
|
applyTo(t) {
|
|
476
|
-
const
|
|
477
|
-
|
|
497
|
+
const n = this.toString();
|
|
498
|
+
n && (t.style.cssText = n);
|
|
478
499
|
}
|
|
479
500
|
}
|
|
480
|
-
function
|
|
481
|
-
const
|
|
482
|
-
e.add("color",
|
|
483
|
-
const
|
|
484
|
-
e.add("font-size", `${
|
|
501
|
+
function Pe(e, t, n) {
|
|
502
|
+
const r = t.style || {};
|
|
503
|
+
e.add("color", r.color).add("background-color", r.backgroundColor).add("font-family", r.fontFamily).add("font-weight", r.bold ? "700" : void 0).add("font-style", r.italic ? "italic" : void 0).add("text-decoration", r.underline ? "underline" : void 0).add("letter-spacing", r.letterSpacing != null ? `${r.letterSpacing}pt` : void 0).add("opacity", r.opacity != null ? String(r.opacity) : void 0).add("transform", r.rotateDeg ? `rotate(${r.rotateDeg}deg)` : void 0);
|
|
504
|
+
const o = V(r, n);
|
|
505
|
+
e.add("font-size", `${q(o.fontSizePx, 2)}px`);
|
|
485
506
|
}
|
|
486
|
-
function
|
|
487
|
-
const
|
|
488
|
-
if (
|
|
489
|
-
const
|
|
490
|
-
for (const
|
|
491
|
-
const
|
|
492
|
-
new
|
|
507
|
+
function Ue(e, t, n, r, o) {
|
|
508
|
+
const i = o.createElement("table");
|
|
509
|
+
if (i.className = N("grid", r), new F().add("width", "100%").add("height", "100%").add("border-collapse", "collapse").add("table-layout", e.colWidthsMm ? "fixed" : "auto").applyTo(i), e.colWidthsMm) {
|
|
510
|
+
const d = o.createElement("colgroup");
|
|
511
|
+
for (const h of e.colWidthsMm) {
|
|
512
|
+
const m = o.createElement("col");
|
|
513
|
+
new F().mm("width", h, n).applyTo(m), d.appendChild(m);
|
|
493
514
|
}
|
|
494
|
-
|
|
515
|
+
i.appendChild(d);
|
|
495
516
|
}
|
|
496
|
-
const
|
|
497
|
-
return e.cells.forEach((
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
const
|
|
503
|
-
if (
|
|
504
|
-
const y =
|
|
505
|
-
|
|
517
|
+
const a = te(t.style), s = Y(t.style), l = a.inner ? `${q(s.widthPt * n / 72, 2)}px solid ${s.color}` : "";
|
|
518
|
+
return e.cells.forEach((d, h) => {
|
|
519
|
+
const m = o.createElement("tr");
|
|
520
|
+
m.className = N("row", r), e.rowHeightsMm?.[h] != null && new F().mm("height", e.rowHeightsMm[h], n).applyTo(m), (d || []).forEach((c) => {
|
|
521
|
+
const g = o.createElement("td");
|
|
522
|
+
g.className = N("cell", r), c?.colSpan && (g.colSpan = c.colSpan), c?.rowSpan && (g.rowSpan = c.rowSpan);
|
|
523
|
+
const f = new F();
|
|
524
|
+
if (l && f.add("border", l), c?.style) {
|
|
525
|
+
const y = c.style;
|
|
526
|
+
f.add("text-align", y.align).add("vertical-align", y.verticalAlign).add("background-color", y.backgroundColor).add("color", y.color).add("font-weight", y.bold ? "700" : void 0), f.add("font-size", `${q(V(y, n).fontSizePx, 2)}px`);
|
|
506
527
|
}
|
|
507
|
-
if (
|
|
508
|
-
for (const y of
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}),
|
|
512
|
-
}),
|
|
528
|
+
if (f.applyTo(g), c?.text != null && (g.textContent = c.text), c?.children?.length)
|
|
529
|
+
for (const y of c.children)
|
|
530
|
+
g.appendChild(Te(y, n, r, o));
|
|
531
|
+
m.appendChild(g);
|
|
532
|
+
}), i.appendChild(m);
|
|
533
|
+
}), i;
|
|
513
534
|
}
|
|
514
|
-
function
|
|
515
|
-
const
|
|
516
|
-
|
|
517
|
-
const
|
|
535
|
+
function Ke(e, t, n, r) {
|
|
536
|
+
const o = r.createElement("div");
|
|
537
|
+
o.className = N("text", n);
|
|
538
|
+
const i = e.style || {}, a = new F().add("text-align", i.align).add("display", "flex").add("flex-direction", "column").add(
|
|
518
539
|
"justify-content",
|
|
519
|
-
|
|
540
|
+
i.verticalAlign === "middle" ? "center" : i.verticalAlign === "bottom" ? "flex-end" : "flex-start"
|
|
520
541
|
).add("overflow", "hidden");
|
|
521
|
-
if (
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
for (const
|
|
525
|
-
const
|
|
526
|
-
|
|
527
|
-
for (const
|
|
528
|
-
const
|
|
529
|
-
if (
|
|
530
|
-
const
|
|
531
|
-
|
|
542
|
+
if (Pe(a, e, t), a.applyTo(o), Me(e)) {
|
|
543
|
+
const s = r.createElement("div");
|
|
544
|
+
s.className = N("rich", n);
|
|
545
|
+
for (const l of e.richParagraphs) {
|
|
546
|
+
const d = r.createElement("div");
|
|
547
|
+
d.className = N("paragraph", n), new F().add("text-align", l.align).add("line-height", l.lineHeight != null ? String(l.lineHeight) : void 0).mm("margin-top", l.spaceBeforeMm ?? 0, t).mm("margin-bottom", l.spaceAfterMm ?? 0, t).mm("text-indent", l.indentMm ?? 0, t).applyTo(d);
|
|
548
|
+
for (const m of l.segments || []) {
|
|
549
|
+
const c = r.createElement("span");
|
|
550
|
+
if (c.className = N("segment", n), c.textContent = m.kind === "field" ? m.field ?? "" : m.text ?? "", m.style) {
|
|
551
|
+
const g = new F().add("color", m.style.color).add("font-weight", m.style.bold ? "700" : void 0);
|
|
552
|
+
g.add("font-size", `${q(V(m.style, t).fontSizePx, 2)}px`), g.applyTo(c);
|
|
532
553
|
}
|
|
533
|
-
|
|
554
|
+
d.appendChild(c);
|
|
534
555
|
}
|
|
535
|
-
|
|
556
|
+
s.appendChild(d);
|
|
536
557
|
}
|
|
537
|
-
return
|
|
558
|
+
return o.appendChild(s), o;
|
|
538
559
|
}
|
|
539
560
|
if (Array.isArray(e.lines) && e.lines.length > 0) {
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
for (const
|
|
543
|
-
const
|
|
544
|
-
|
|
561
|
+
const s = r.createElement("div");
|
|
562
|
+
s.className = N("lines", n), i.lineHeight != null && new F().add("line-height", String(i.lineHeight)).applyTo(s);
|
|
563
|
+
for (const l of e.lines) {
|
|
564
|
+
const d = r.createElement("div");
|
|
565
|
+
d.className = N("line", n), d.textContent = l, s.appendChild(d);
|
|
545
566
|
}
|
|
546
|
-
return
|
|
567
|
+
return o.appendChild(s), o;
|
|
547
568
|
}
|
|
548
|
-
return
|
|
569
|
+
return o.textContent = e.text ?? "", o;
|
|
549
570
|
}
|
|
550
|
-
function
|
|
551
|
-
const
|
|
552
|
-
return
|
|
571
|
+
function Xe(e, t, n) {
|
|
572
|
+
const r = n.createElement("img");
|
|
573
|
+
return r.className = N("image", t), r.src = e.imageData, new F().add("width", "100%").add("height", "100%").add("object-fit", "contain").add("display", "block").applyTo(r), r.alt = e.kind, r;
|
|
553
574
|
}
|
|
554
|
-
function
|
|
555
|
-
const
|
|
556
|
-
|
|
557
|
-
const
|
|
558
|
-
return e.grid || e.kind === "rect" ? (
|
|
575
|
+
function ue(e, t, n, r) {
|
|
576
|
+
const o = r.createElement("div");
|
|
577
|
+
o.className = N("shape", n);
|
|
578
|
+
const i = e.style || {}, a = Y(i), s = te(i), l = `${q(a.widthPt * t / 72, 2)}px solid ${a.color}`, d = new F();
|
|
579
|
+
return e.grid || e.kind === "rect" ? (s.top && d.add("border-top", l), s.right && d.add("border-right", l), s.bottom && d.add("border-bottom", l), s.left && d.add("border-left", l)) : e.kind === "ellipse" ? (s.inner && d.add("border", l).add("border-radius", "50%"), i.backgroundColor && d.add("background-color", i.backgroundColor)) : e.kind === "line" && d.add("height", "0").add("border-top", l), d.add("box-sizing", "border-box").add("width", "100%").add("height", "100%"), d.applyTo(o), o;
|
|
559
580
|
}
|
|
560
|
-
function
|
|
561
|
-
const
|
|
562
|
-
|
|
563
|
-
const
|
|
564
|
-
if (
|
|
565
|
-
return
|
|
581
|
+
function Te(e, t, n, r) {
|
|
582
|
+
const o = r.createElement("div");
|
|
583
|
+
o.className = `${N("comp", n)} mr-kind-${e.kind}`;
|
|
584
|
+
const i = new F().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");
|
|
585
|
+
if (Pe(i, e, t), i.applyTo(o), He(e))
|
|
586
|
+
return o.appendChild(Xe(e, n, r)), o;
|
|
566
587
|
if (e.kind === "text")
|
|
567
|
-
return
|
|
588
|
+
return o.appendChild(Ke(e, t, n, r)), o;
|
|
568
589
|
if (e.grid) {
|
|
569
|
-
const
|
|
570
|
-
return
|
|
590
|
+
const s = ue(e, t, n, r);
|
|
591
|
+
return s.appendChild(Ue(e.grid, e, t, n, r)), o.appendChild(s), o;
|
|
571
592
|
}
|
|
572
593
|
if (e.kind === "line" || e.kind === "rect" || e.kind === "ellipse" || e.kind === "chart")
|
|
573
|
-
return
|
|
574
|
-
const
|
|
575
|
-
return
|
|
594
|
+
return o.appendChild(ue(e, t, n, r)), o;
|
|
595
|
+
const a = r.createElement("div");
|
|
596
|
+
return a.className = N("unknown", n), a.textContent = e.fallbackText ?? "", o.appendChild(a), o;
|
|
576
597
|
}
|
|
577
|
-
function
|
|
578
|
-
const
|
|
579
|
-
|
|
580
|
-
for (const
|
|
581
|
-
|
|
582
|
-
return
|
|
598
|
+
function Qe(e, t, n, r) {
|
|
599
|
+
const o = r.createElement("div");
|
|
600
|
+
o.className = N("page", n), new F().add("position", "relative").mm("width", e.pageWidthMm, t).mm("height", e.pageHeightMm, t).add("background-color", "#fff").add("overflow", "hidden").add("box-sizing", "border-box").applyTo(o);
|
|
601
|
+
for (const i of e.components)
|
|
602
|
+
o.appendChild(Te(i, t, n, r));
|
|
603
|
+
return o;
|
|
583
604
|
}
|
|
584
|
-
function
|
|
585
|
-
const
|
|
586
|
-
return
|
|
587
|
-
|
|
588
|
-
}),
|
|
605
|
+
function mt(e, t, n = {}) {
|
|
606
|
+
const r = n.dpi ?? 96, o = t.createElement("div");
|
|
607
|
+
return o.className = N("root", n), o.dataset.schemaVersion = e.schemaVersion, e.pages.forEach((i) => {
|
|
608
|
+
o.appendChild(Qe(i, r, n, t));
|
|
609
|
+
}), o;
|
|
589
610
|
}
|
|
590
|
-
function
|
|
591
|
-
const { pageHeightsPx: t, viewportHeightPx:
|
|
592
|
-
if (
|
|
611
|
+
function Ze(e) {
|
|
612
|
+
const { pageHeightsPx: t, viewportHeightPx: n, scrollTopPx: r, overscan: o = 1, gapPx: i = 0 } = e, a = t.length;
|
|
613
|
+
if (a === 0)
|
|
593
614
|
return { start: 0, end: -1, padTopPx: 0, padBottomPx: 0 };
|
|
594
|
-
const
|
|
595
|
-
|
|
596
|
-
for (let
|
|
597
|
-
|
|
598
|
-
const
|
|
599
|
-
let
|
|
600
|
-
for (;
|
|
601
|
-
const
|
|
602
|
-
|
|
615
|
+
const s = Math.max(0, i), l = new Array(a + 1);
|
|
616
|
+
l[0] = 0;
|
|
617
|
+
for (let u = 0; u < a; u++)
|
|
618
|
+
l[u + 1] = l[u] + Math.max(0, t[u] ?? 0) + s;
|
|
619
|
+
const d = l[a], h = Math.max(0, r);
|
|
620
|
+
let m = 0, c = 0, g = a - 1;
|
|
621
|
+
for (; c <= g; ) {
|
|
622
|
+
const u = c + g >> 1;
|
|
623
|
+
l[u] <= h ? (m = u, c = u + 1) : g = u - 1;
|
|
603
624
|
}
|
|
604
|
-
const
|
|
605
|
-
let
|
|
606
|
-
for (
|
|
607
|
-
const
|
|
608
|
-
|
|
625
|
+
const f = Math.max(0, Math.min(a - 1, m - o)), y = l[m] + Math.max(0, n);
|
|
626
|
+
let P = a - 1;
|
|
627
|
+
for (c = 0, g = a - 1; c <= g; ) {
|
|
628
|
+
const u = c + g >> 1;
|
|
629
|
+
l[u + 1] < y ? c = u + 1 : (P = u, g = u - 1);
|
|
609
630
|
}
|
|
610
|
-
const
|
|
611
|
-
return { start:
|
|
631
|
+
const x = Math.min(a - 1, P + o), M = l[f], v = Math.max(0, d - l[x + 1]);
|
|
632
|
+
return { start: f, end: x, padTopPx: M, padBottomPx: v };
|
|
612
633
|
}
|
|
613
|
-
const
|
|
614
|
-
function
|
|
615
|
-
const
|
|
634
|
+
const ae = 96 / 25.4;
|
|
635
|
+
function xe(e, t = 96) {
|
|
636
|
+
const n = t / 96 * ae;
|
|
616
637
|
return {
|
|
617
|
-
widthPx: Math.max(1, Math.round(e.pageWidthMm *
|
|
618
|
-
heightPx: Math.max(1, Math.round(e.pageHeightMm *
|
|
638
|
+
widthPx: Math.max(1, Math.round(e.pageWidthMm * n)),
|
|
639
|
+
heightPx: Math.max(1, Math.round(e.pageHeightMm * n))
|
|
619
640
|
};
|
|
620
641
|
}
|
|
621
|
-
function
|
|
622
|
-
const
|
|
623
|
-
|
|
624
|
-
const
|
|
625
|
-
if (!
|
|
642
|
+
function et(e, t, n) {
|
|
643
|
+
const r = document.createElement("canvas"), { widthPx: o, heightPx: i } = xe(e, n);
|
|
644
|
+
r.width = Math.round(o * t), r.height = Math.round(i * t), r.style.width = `${o}px`, r.style.height = `${i}px`;
|
|
645
|
+
const a = r.getContext("2d");
|
|
646
|
+
if (!a)
|
|
626
647
|
throw new Error("当前环境不支持 Canvas 2D(测试需真浏览器,见 e2e/canvas.spec.ts)");
|
|
627
|
-
return
|
|
648
|
+
return a.scale(t, t), a.fillStyle = "#ffffff", a.fillRect(0, 0, o, i), { canvas: r, ctx: a };
|
|
628
649
|
}
|
|
629
|
-
function
|
|
630
|
-
return
|
|
650
|
+
function ht(e, t = 96) {
|
|
651
|
+
return V(e, t).fontSizePx;
|
|
631
652
|
}
|
|
632
|
-
function
|
|
633
|
-
e.font = `${t.bold ? "bold " : ""}${t.fontSizePx}px ${
|
|
634
|
-
const
|
|
635
|
-
`),
|
|
636
|
-
let
|
|
637
|
-
|
|
653
|
+
function $e(e, t, n, r, o, i, a, s = "top") {
|
|
654
|
+
e.font = `${t.bold ? "bold " : ""}${t.fontSizePx}px ${a}`, e.fillStyle = t.color, e.textBaseline = "alphabetic";
|
|
655
|
+
const l = t.fontSizePx * t.lineHeight, d = t.text === "" ? [""] : t.text.split(`
|
|
656
|
+
`), h = d.length * l;
|
|
657
|
+
let m = r;
|
|
658
|
+
s === "middle" ? m = r + (i - h) / 2 : s === "bottom" && (m = r + i - h), d.forEach((c, g) => {
|
|
638
659
|
e.textAlign = t.align === "center" ? "center" : t.align === "right" ? "right" : "left";
|
|
639
|
-
const
|
|
640
|
-
e.fillText(
|
|
660
|
+
const f = t.align === "center" ? n + o / 2 : t.align === "right" ? n + o : n;
|
|
661
|
+
e.fillText(c, f, m + g * l + t.fontSizePx * 0.8, o);
|
|
641
662
|
}), e.textAlign = "left";
|
|
642
663
|
}
|
|
643
|
-
function
|
|
644
|
-
const
|
|
645
|
-
for (const
|
|
646
|
-
const y =
|
|
664
|
+
function tt(e, t, n, r, o, i, a, s, l, d, h) {
|
|
665
|
+
const m = Le(t, i / s, a / s), c = te(n.style), g = Y(n.style);
|
|
666
|
+
for (const f of m.cells) {
|
|
667
|
+
const y = f.cell.style?.backgroundColor;
|
|
647
668
|
y && (e.fillStyle = y, e.fillRect(
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
669
|
+
r + f.xMm * s,
|
|
670
|
+
o + f.yMm * s,
|
|
671
|
+
f.widthMm * s,
|
|
672
|
+
f.heightMm * s
|
|
652
673
|
));
|
|
653
674
|
}
|
|
654
|
-
if (
|
|
655
|
-
e.strokeStyle =
|
|
656
|
-
for (const
|
|
657
|
-
e.beginPath(),
|
|
658
|
-
e.beginPath(),
|
|
675
|
+
if (c.inner) {
|
|
676
|
+
e.strokeStyle = g.color, e.lineWidth = K(g.widthPt, l);
|
|
677
|
+
for (const f of m.edges)
|
|
678
|
+
e.beginPath(), f.kind === "v" ? (e.moveTo(r + f.pos * s, o + f.from * s), e.lineTo(r + f.pos * s, o + f.to * s)) : (e.moveTo(r + f.from * s, o + f.pos * s), e.lineTo(r + f.to * s, o + f.pos * s)), e.stroke();
|
|
679
|
+
e.beginPath(), c.top && (e.moveTo(r, o), e.lineTo(r + i, o)), c.right && (e.moveTo(r + i, o), e.lineTo(r + i, o + a)), c.bottom && (e.moveTo(r + i, o + a), e.lineTo(r, o + a)), c.left && (e.moveTo(r, o + a), e.lineTo(r, o)), e.stroke();
|
|
659
680
|
}
|
|
660
|
-
for (const
|
|
661
|
-
const y = typeof
|
|
681
|
+
for (const f of m.cells) {
|
|
682
|
+
const y = typeof f.cell.text == "string" ? f.cell.text : "";
|
|
662
683
|
if (!y) continue;
|
|
663
|
-
const
|
|
684
|
+
const P = f.cell.style, x = P?.fontSize ?? Q, M = Z(
|
|
664
685
|
y,
|
|
665
|
-
|
|
666
|
-
{ fontSizePt:
|
|
667
|
-
|
|
686
|
+
f.widthMm - 1,
|
|
687
|
+
{ fontSizePt: x },
|
|
688
|
+
h
|
|
668
689
|
).join(`
|
|
669
690
|
`);
|
|
670
|
-
|
|
691
|
+
$e(
|
|
671
692
|
e,
|
|
672
693
|
{
|
|
673
|
-
text:
|
|
674
|
-
fontSizePx:
|
|
675
|
-
bold:
|
|
676
|
-
color:
|
|
677
|
-
align:
|
|
678
|
-
lineHeight:
|
|
694
|
+
text: M,
|
|
695
|
+
fontSizePx: V(P, l).fontSizePx,
|
|
696
|
+
bold: P?.bold ?? !1,
|
|
697
|
+
color: P?.color ?? we(n.style, Be),
|
|
698
|
+
align: P?.align ?? "left",
|
|
699
|
+
lineHeight: ee
|
|
679
700
|
},
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
Math.max(0, (
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
701
|
+
r + (f.xMm + 0.5) * s,
|
|
702
|
+
o + f.yMm * s,
|
|
703
|
+
Math.max(0, (f.widthMm - 1) * s),
|
|
704
|
+
f.heightMm * s,
|
|
705
|
+
d,
|
|
706
|
+
P?.verticalAlign ?? "middle"
|
|
686
707
|
);
|
|
687
708
|
}
|
|
688
709
|
}
|
|
689
|
-
function
|
|
690
|
-
const
|
|
710
|
+
function ke(e, t, n, r, o, i) {
|
|
711
|
+
const a = t.leftMm * n, s = t.topMm * n, l = t.widthMm * n, d = t.heightMm * n, h = t.style ?? {};
|
|
691
712
|
if (t.grid) {
|
|
692
|
-
|
|
713
|
+
tt(e, t.grid, t, a, s, l, d, n, r, o, i);
|
|
693
714
|
return;
|
|
694
715
|
}
|
|
695
716
|
switch (t.kind) {
|
|
696
717
|
case "text": {
|
|
697
|
-
const
|
|
718
|
+
const m = h.fontSize ?? Q, c = Me(t) ? t.richParagraphs.map((g) => (g.segments ?? []).map((f) => f.text ?? f.field ?? "").join("")).join(`
|
|
698
719
|
`) : Array.isArray(t.lines) && t.lines.length > 0 ? t.lines.join(`
|
|
699
|
-
`) :
|
|
720
|
+
`) : Z(t.text ?? "", t.widthMm, { fontSizePt: m }, i).join(`
|
|
700
721
|
`);
|
|
701
|
-
|
|
722
|
+
$e(
|
|
702
723
|
e,
|
|
703
724
|
{
|
|
704
|
-
text:
|
|
705
|
-
fontSizePx:
|
|
706
|
-
bold:
|
|
707
|
-
color:
|
|
708
|
-
align:
|
|
709
|
-
lineHeight:
|
|
725
|
+
text: c,
|
|
726
|
+
fontSizePx: V(h, r).fontSizePx,
|
|
727
|
+
bold: h.bold ?? !1,
|
|
728
|
+
color: we(h),
|
|
729
|
+
align: h.align ?? "left",
|
|
730
|
+
lineHeight: Ne(h)
|
|
710
731
|
},
|
|
732
|
+
a,
|
|
733
|
+
s,
|
|
711
734
|
l,
|
|
712
|
-
i,
|
|
713
735
|
d,
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
m.verticalAlign
|
|
736
|
+
o,
|
|
737
|
+
h.verticalAlign
|
|
717
738
|
);
|
|
718
739
|
break;
|
|
719
740
|
}
|
|
720
741
|
case "rect": {
|
|
721
|
-
const
|
|
722
|
-
|
|
742
|
+
const m = Y(h), c = te(h);
|
|
743
|
+
h.backgroundColor && (e.fillStyle = h.backgroundColor, e.fillRect(a, s, l, d)), c.inner && (e.strokeStyle = m.color, e.lineWidth = K(m.widthPt, r), e.beginPath(), c.top && (e.moveTo(a, s), e.lineTo(a + l, s)), c.right && (e.moveTo(a + l, s), e.lineTo(a + l, s + d)), c.bottom && (e.moveTo(a + l, s + d), e.lineTo(a, s + d)), c.left && (e.moveTo(a, s + d), e.lineTo(a, s)), e.stroke());
|
|
723
744
|
break;
|
|
724
745
|
}
|
|
725
746
|
case "line": {
|
|
726
|
-
const
|
|
727
|
-
e.strokeStyle =
|
|
747
|
+
const m = Y({ ...h, borderColor: h.lineColor ?? h.borderColor });
|
|
748
|
+
e.strokeStyle = m.color, e.lineWidth = K(m.widthPt, r), e.beginPath(), e.moveTo(a, s + d / 2), e.lineTo(a + l, s + d / 2), e.stroke();
|
|
728
749
|
break;
|
|
729
750
|
}
|
|
730
751
|
case "ellipse": {
|
|
731
|
-
const
|
|
732
|
-
e.strokeStyle =
|
|
752
|
+
const m = Y(h);
|
|
753
|
+
e.strokeStyle = m.color, e.lineWidth = K(m.widthPt, r), h.backgroundColor && (e.fillStyle = h.backgroundColor, e.beginPath(), e.ellipse(a + l / 2, s + d / 2, l / 2, d / 2, 0, 0, Math.PI * 2), e.fill()), e.beginPath(), e.ellipse(a + l / 2, s + d / 2, l / 2, d / 2, 0, 0, Math.PI * 2), e.stroke();
|
|
733
754
|
break;
|
|
734
755
|
}
|
|
735
756
|
}
|
|
736
757
|
}
|
|
737
|
-
async function
|
|
758
|
+
async function ft(e, t = {}) {
|
|
738
759
|
if (typeof document > "u")
|
|
739
760
|
throw new Error("renderPlanToImages 需要浏览器环境(SSR/Node 请在客户端钩子中调用)");
|
|
740
|
-
const { format:
|
|
741
|
-
for (const
|
|
742
|
-
|
|
761
|
+
const { format: n = "png", quality: r = 0.92, ...o } = t, { canvases: i } = nt(e, o), a = n === "jpeg" ? "image/jpeg" : "image/png", s = [];
|
|
762
|
+
for (const l of i)
|
|
763
|
+
s.push(
|
|
743
764
|
await new Promise(
|
|
744
|
-
(
|
|
745
|
-
) ?? new Blob([], { type:
|
|
765
|
+
(d) => l.toBlob((h) => d(h), a, r)
|
|
766
|
+
) ?? new Blob([], { type: a })
|
|
746
767
|
);
|
|
747
|
-
return { blobs:
|
|
768
|
+
return { blobs: s };
|
|
748
769
|
}
|
|
749
|
-
function
|
|
770
|
+
function nt(e, t = {}) {
|
|
750
771
|
if (typeof document > "u")
|
|
751
772
|
throw new Error("renderPlanToCanvas 需要浏览器环境(SSR 请在客户端钩子中调用)");
|
|
752
|
-
const
|
|
753
|
-
for (let
|
|
754
|
-
const
|
|
755
|
-
for (const
|
|
756
|
-
|
|
757
|
-
|
|
773
|
+
const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, o = r / 96 * ae, i = t.fontFamily ?? '"Microsoft YaHei", sans-serif', a = t.measurer ?? ie, s = Math.max(0, t.start ?? 0), l = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1), d = [];
|
|
774
|
+
for (let h = s; h <= l; h++) {
|
|
775
|
+
const m = e.pages[h], { canvas: c, ctx: g } = et(m, n, r);
|
|
776
|
+
for (const f of m.components)
|
|
777
|
+
ke(g, f, o, r, i, a);
|
|
778
|
+
d.push(c);
|
|
758
779
|
}
|
|
759
|
-
return { canvases:
|
|
780
|
+
return { canvases: d };
|
|
760
781
|
}
|
|
761
|
-
function
|
|
762
|
-
const
|
|
763
|
-
let
|
|
764
|
-
function
|
|
765
|
-
const
|
|
766
|
-
|
|
767
|
-
const
|
|
768
|
-
for (let
|
|
769
|
-
const
|
|
770
|
-
|
|
782
|
+
function gt(e, t = {}) {
|
|
783
|
+
const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, o = r / 96 * ae, i = t.fontFamily ?? '"Microsoft YaHei", sans-serif', a = t.measurer ?? ie, s = t.overscan ?? 1, l = t.gapPx ?? 18, d = t.pagesPerFrame ?? 1, h = e.pages.map((w) => w.pageHeightMm * o), m = Math.max(1, ...e.pages.map((w) => w.pageWidthMm * o)), c = { start: 0, end: -1 };
|
|
784
|
+
let g = null, f = null, y = null, P = null, x = [], M = 0, v = [];
|
|
785
|
+
function u() {
|
|
786
|
+
const w = g;
|
|
787
|
+
w.innerHTML = "", f = document.createElement("div"), f.style.cssText = `width:${m}px;margin:0 auto;`, y = document.createElement("div"), P = document.createElement("div"), f.appendChild(y), x = [];
|
|
788
|
+
const H = Math.min(e.pages.length, 3 + s * 2);
|
|
789
|
+
for (let B = 0; B < H; B++) {
|
|
790
|
+
const S = document.createElement("div");
|
|
791
|
+
S.style.cssText = `margin:0 auto ${l}px;box-shadow:0 2px 8px rgba(0,0,0,.35);background:#fff;`, f.appendChild(S), x.push(S);
|
|
771
792
|
}
|
|
772
|
-
|
|
793
|
+
f.appendChild(P), w.appendChild(f);
|
|
773
794
|
}
|
|
774
|
-
function
|
|
775
|
-
const
|
|
776
|
-
let
|
|
777
|
-
(!
|
|
778
|
-
const
|
|
779
|
-
if (
|
|
780
|
-
|
|
781
|
-
for (const
|
|
782
|
-
|
|
783
|
-
|
|
795
|
+
function T(w, H) {
|
|
796
|
+
const B = e.pages[H], { widthPx: S, heightPx: R } = xe(B, r);
|
|
797
|
+
let A = w.firstElementChild;
|
|
798
|
+
(!A || A.tagName !== "CANVAS") && (A = document.createElement("canvas"), w.innerHTML = "", w.appendChild(A)), A.width = Math.round(S * n), A.height = Math.round(R * n), A.style.width = `${S}px`, A.style.height = `${R}px`;
|
|
799
|
+
const j = A.getContext("2d");
|
|
800
|
+
if (j) {
|
|
801
|
+
j.setTransform(1, 0, 0, 1, 0, 0), j.scale(n, n), j.fillStyle = "#ffffff", j.fillRect(0, 0, S, R);
|
|
802
|
+
for (const U of B.components)
|
|
803
|
+
ke(j, U, o, r, i, a);
|
|
804
|
+
A.dataset.canvasPage = String(H), w.style.height = `${R}px`, w.style.width = `${S}px`;
|
|
784
805
|
}
|
|
785
806
|
}
|
|
786
|
-
function
|
|
787
|
-
|
|
788
|
-
const
|
|
789
|
-
|
|
790
|
-
const
|
|
791
|
-
|
|
792
|
-
if (
|
|
793
|
-
|
|
794
|
-
const
|
|
795
|
-
|
|
807
|
+
function I(w) {
|
|
808
|
+
c.start = w.start, c.end = w.end, y.style.height = `${w.start * l + h.slice(0, w.start).reduce((S, R) => S + R, 0)}px`;
|
|
809
|
+
const H = e.pages.length - 1 - w.end;
|
|
810
|
+
P.style.height = `${H * l + h.slice(w.end + 1).reduce((S, R) => S + R, 0)}px`;
|
|
811
|
+
const B = w.end - w.start + 1;
|
|
812
|
+
x.forEach((S, R) => {
|
|
813
|
+
if (R < B) {
|
|
814
|
+
S.style.display = "";
|
|
815
|
+
const A = w.start + R;
|
|
816
|
+
S.style.height = `${h[A] ?? 0}px`;
|
|
796
817
|
} else
|
|
797
|
-
|
|
818
|
+
S.style.display = "none";
|
|
798
819
|
}), v = [];
|
|
799
|
-
for (let
|
|
800
|
-
const
|
|
801
|
-
if (!
|
|
802
|
-
|
|
820
|
+
for (let S = w.start; S <= w.end; S++) {
|
|
821
|
+
const R = x[S - w.start];
|
|
822
|
+
if (!R) continue;
|
|
823
|
+
R.firstElementChild?.dataset?.canvasPage !== String(S) && v.push(S);
|
|
803
824
|
}
|
|
804
|
-
|
|
825
|
+
E();
|
|
805
826
|
}
|
|
806
|
-
function
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
let
|
|
810
|
-
for (; v.length > 0 &&
|
|
811
|
-
const
|
|
812
|
-
|
|
827
|
+
function E() {
|
|
828
|
+
M || v.length === 0 || (M = requestAnimationFrame(() => {
|
|
829
|
+
M = 0;
|
|
830
|
+
let w = Math.max(1, d);
|
|
831
|
+
for (; v.length > 0 && w-- > 0; ) {
|
|
832
|
+
const H = v.shift(), B = x[H - c.start];
|
|
833
|
+
B && T(B, H);
|
|
813
834
|
}
|
|
814
|
-
v.length > 0 &&
|
|
835
|
+
v.length > 0 && E();
|
|
815
836
|
}));
|
|
816
837
|
}
|
|
817
838
|
function $() {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
const
|
|
821
|
-
pageHeightsPx:
|
|
822
|
-
viewportHeightPx:
|
|
823
|
-
scrollTopPx:
|
|
824
|
-
overscan:
|
|
825
|
-
gapPx:
|
|
839
|
+
M || (M = requestAnimationFrame(() => {
|
|
840
|
+
M = 0;
|
|
841
|
+
const w = g, H = Ze({
|
|
842
|
+
pageHeightsPx: h,
|
|
843
|
+
viewportHeightPx: w.clientHeight,
|
|
844
|
+
scrollTopPx: w.scrollTop,
|
|
845
|
+
overscan: s,
|
|
846
|
+
gapPx: l
|
|
826
847
|
});
|
|
827
|
-
|
|
848
|
+
H.start !== c.start || H.end !== c.end ? I(H) : E();
|
|
828
849
|
}));
|
|
829
850
|
}
|
|
830
|
-
let
|
|
851
|
+
let G = null;
|
|
831
852
|
return {
|
|
832
|
-
attach(
|
|
853
|
+
attach(w) {
|
|
833
854
|
if (typeof document > "u")
|
|
834
855
|
throw new Error("createCanvasPager 需要浏览器环境(SSR 请在客户端钩子中调用 attach)");
|
|
835
|
-
|
|
856
|
+
g = w, u(), w.addEventListener("scroll", $, { passive: !0 }), typeof ResizeObserver < "u" && (G = new ResizeObserver(() => $()), G.observe(w)), $();
|
|
836
857
|
},
|
|
837
858
|
destroy() {
|
|
838
|
-
|
|
859
|
+
M && cancelAnimationFrame(M), M = 0, G?.disconnect(), G = null, g?.removeEventListener("scroll", $), v = [], f?.remove(), g = null;
|
|
839
860
|
},
|
|
840
861
|
window() {
|
|
841
|
-
return { ...
|
|
862
|
+
return { ...c };
|
|
842
863
|
}
|
|
843
864
|
};
|
|
844
865
|
}
|
|
845
|
-
function
|
|
846
|
-
let
|
|
866
|
+
function Ee(e, t, n) {
|
|
867
|
+
let r, o;
|
|
847
868
|
if (typeof e == "string") {
|
|
848
|
-
const
|
|
849
|
-
if (!
|
|
850
|
-
|
|
851
|
-
} else typeof e == "number" ? (
|
|
852
|
-
return
|
|
869
|
+
const i = X[e];
|
|
870
|
+
if (!i) throw new Error(`未知纸张预设 "${e}"(可用:${Object.keys(X).join("/")})`);
|
|
871
|
+
r = i.widthMm, o = i.heightMm;
|
|
872
|
+
} else typeof e == "number" ? (r = e, o = t ?? 297) : (r = e.widthMm, o = e.heightMm);
|
|
873
|
+
return n ? { widthMm: o, heightMm: r } : { widthMm: r, heightMm: o };
|
|
853
874
|
}
|
|
854
|
-
class
|
|
875
|
+
class rt {
|
|
855
876
|
constructor() {
|
|
856
877
|
this.pages = [], this.pending = null, this.templateParams = void 0;
|
|
857
878
|
}
|
|
@@ -878,20 +899,20 @@ class Ze {
|
|
|
878
899
|
* - 数字:.page(210, 297)(第三参数兼容旧 margins 对象或新 options)
|
|
879
900
|
* - 对象:.page({ widthMm: 210, heightMm: 297 })
|
|
880
901
|
*/
|
|
881
|
-
page(t = "a4",
|
|
902
|
+
page(t = "a4", n = {}, r) {
|
|
882
903
|
this.collect();
|
|
883
|
-
const
|
|
904
|
+
const i = 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: a, heightMm: s } = Ee(
|
|
884
905
|
t,
|
|
885
|
-
typeof
|
|
886
|
-
|
|
887
|
-
),
|
|
888
|
-
return this.pending = new
|
|
889
|
-
widthMm:
|
|
890
|
-
heightMm:
|
|
891
|
-
marginTopMm:
|
|
892
|
-
marginBottomMm:
|
|
893
|
-
marginLeftMm:
|
|
894
|
-
marginRightMm:
|
|
906
|
+
typeof n == "number" ? n : void 0,
|
|
907
|
+
i.landscape
|
|
908
|
+
), l = i.margins ?? {};
|
|
909
|
+
return this.pending = new ot(this, {
|
|
910
|
+
widthMm: a,
|
|
911
|
+
heightMm: s,
|
|
912
|
+
marginTopMm: l.marginTopMm ?? 10,
|
|
913
|
+
marginBottomMm: l.marginBottomMm ?? 10,
|
|
914
|
+
marginLeftMm: l.marginLeftMm ?? 10,
|
|
915
|
+
marginRightMm: l.marginRightMm ?? 10
|
|
895
916
|
}), this.pending;
|
|
896
917
|
}
|
|
897
918
|
collect() {
|
|
@@ -903,62 +924,62 @@ class Ze {
|
|
|
903
924
|
return this.templateParams ? { params: this.templateParams, pages: this.pages } : { pages: this.pages };
|
|
904
925
|
}
|
|
905
926
|
}
|
|
906
|
-
class
|
|
907
|
-
constructor(t,
|
|
908
|
-
this.parent = t, this.page =
|
|
927
|
+
class ot {
|
|
928
|
+
constructor(t, n) {
|
|
929
|
+
this.parent = t, this.page = n, this.components = [];
|
|
909
930
|
}
|
|
910
|
-
text(t,
|
|
931
|
+
text(t, n = {}, r = {}) {
|
|
911
932
|
return this.components.push({
|
|
912
933
|
kind: "text",
|
|
913
|
-
leftMm:
|
|
914
|
-
topMm:
|
|
915
|
-
widthMm:
|
|
916
|
-
heightMm:
|
|
934
|
+
leftMm: n.leftMm ?? 0,
|
|
935
|
+
topMm: n.topMm ?? 0,
|
|
936
|
+
widthMm: n.widthMm ?? 60,
|
|
937
|
+
heightMm: n.heightMm ?? 8,
|
|
917
938
|
text: t,
|
|
918
|
-
style:
|
|
939
|
+
style: r
|
|
919
940
|
}), this;
|
|
920
941
|
}
|
|
921
|
-
list(t,
|
|
942
|
+
list(t, n, r, o = {}) {
|
|
922
943
|
return this.components.push({
|
|
923
944
|
kind: "list",
|
|
924
|
-
leftMm:
|
|
925
|
-
topMm:
|
|
926
|
-
widthMm:
|
|
945
|
+
leftMm: n.leftMm ?? 10,
|
|
946
|
+
topMm: n.topMm ?? 30,
|
|
947
|
+
widthMm: n.widthMm ?? 180,
|
|
927
948
|
dataset: t,
|
|
928
|
-
columns:
|
|
929
|
-
...
|
|
949
|
+
columns: r,
|
|
950
|
+
...o
|
|
930
951
|
}), this;
|
|
931
952
|
}
|
|
932
|
-
rect(t,
|
|
933
|
-
return this.components.push({ kind: "rect", ...t, style:
|
|
953
|
+
rect(t, n = {}) {
|
|
954
|
+
return this.components.push({ kind: "rect", ...t, style: n }), this;
|
|
934
955
|
}
|
|
935
|
-
line(t,
|
|
956
|
+
line(t, n, r, o = {}) {
|
|
936
957
|
return this.components.push({
|
|
937
958
|
kind: "line",
|
|
938
959
|
leftMm: t,
|
|
939
|
-
topMm:
|
|
940
|
-
widthMm:
|
|
960
|
+
topMm: n,
|
|
961
|
+
widthMm: r,
|
|
941
962
|
heightMm: 0.5,
|
|
942
|
-
style:
|
|
963
|
+
style: o
|
|
943
964
|
}), this;
|
|
944
965
|
}
|
|
945
|
-
barcode(t,
|
|
966
|
+
barcode(t, n) {
|
|
946
967
|
return this.components.push({
|
|
947
968
|
kind: "barcode",
|
|
948
|
-
leftMm:
|
|
949
|
-
topMm:
|
|
950
|
-
widthMm:
|
|
951
|
-
heightMm:
|
|
969
|
+
leftMm: n.leftMm ?? 0,
|
|
970
|
+
topMm: n.topMm ?? 0,
|
|
971
|
+
widthMm: n.widthMm ?? 40,
|
|
972
|
+
heightMm: n.heightMm ?? 12,
|
|
952
973
|
fallbackText: t
|
|
953
974
|
}), this;
|
|
954
975
|
}
|
|
955
|
-
qrcode(t,
|
|
976
|
+
qrcode(t, n, r, o) {
|
|
956
977
|
return this.components.push({
|
|
957
978
|
kind: "qrcode",
|
|
958
|
-
leftMm:
|
|
959
|
-
topMm:
|
|
960
|
-
widthMm:
|
|
961
|
-
heightMm:
|
|
979
|
+
leftMm: r,
|
|
980
|
+
topMm: o,
|
|
981
|
+
widthMm: n,
|
|
982
|
+
heightMm: n,
|
|
962
983
|
fallbackText: t
|
|
963
984
|
}), this;
|
|
964
985
|
}
|
|
@@ -972,60 +993,229 @@ class Qe {
|
|
|
972
993
|
return this.done().build();
|
|
973
994
|
}
|
|
974
995
|
}
|
|
975
|
-
function
|
|
976
|
-
return new
|
|
996
|
+
function ut() {
|
|
997
|
+
return new rt();
|
|
998
|
+
}
|
|
999
|
+
function D(e, t, n = !1) {
|
|
1000
|
+
if (!Number.isFinite(e) || (n ? e < 0 : e <= 0))
|
|
1001
|
+
throw new Error(`${t} 必须是有限${n ? "非负" : "正"}数`);
|
|
1002
|
+
}
|
|
1003
|
+
function pt(e) {
|
|
1004
|
+
if (!e || typeof e != "object")
|
|
1005
|
+
throw new Error("标准明细模板需要 options 对象");
|
|
1006
|
+
if (!Array.isArray(e.columns) || e.columns.length === 0)
|
|
1007
|
+
throw new Error("columns 至少需要一列");
|
|
1008
|
+
const t = e.paper === void 0 ? "a4" : e.paper;
|
|
1009
|
+
if (typeof t != "string" && (typeof t != "object" || t === null) || e.landscape !== void 0 && typeof e.landscape != "boolean")
|
|
1010
|
+
throw new Error("paper 必须是纸张预设名或 { widthMm, heightMm } 对象,landscape 必须是布尔值");
|
|
1011
|
+
if (typeof t == "string" && !Object.prototype.hasOwnProperty.call(X, t))
|
|
1012
|
+
throw new Error(`未知纸张预设 "${t}"(可用:${Object.keys(X).join("/")})`);
|
|
1013
|
+
const { widthMm: n, heightMm: r } = Ee(t, void 0, e.landscape);
|
|
1014
|
+
if (D(n, "纸张 widthMm"), D(r, "纸张 heightMm"), e.margins !== void 0 && (!e.margins || typeof e.margins != "object" || Array.isArray(e.margins)))
|
|
1015
|
+
throw new Error("margins 必须是页边距对象");
|
|
1016
|
+
const o = e.margins ?? {}, i = {
|
|
1017
|
+
marginTopMm: o.marginTopMm === void 0 ? 10 : o.marginTopMm,
|
|
1018
|
+
marginBottomMm: o.marginBottomMm === void 0 ? 10 : o.marginBottomMm,
|
|
1019
|
+
marginLeftMm: o.marginLeftMm === void 0 ? 10 : o.marginLeftMm,
|
|
1020
|
+
marginRightMm: o.marginRightMm === void 0 ? 10 : o.marginRightMm
|
|
1021
|
+
};
|
|
1022
|
+
for (const [u, T] of Object.entries(i)) D(T, u, !0);
|
|
1023
|
+
const a = n - i.marginLeftMm - i.marginRightMm, s = r - i.marginTopMm - i.marginBottomMm;
|
|
1024
|
+
if (a <= 0 || s <= 0)
|
|
1025
|
+
throw new Error("页边距占满纸张,必须保留正的可用宽度和高度");
|
|
1026
|
+
const l = e.dataset === void 0 ? "detail" : e.dataset;
|
|
1027
|
+
if (typeof l != "string" || !l.trim())
|
|
1028
|
+
throw new Error("dataset 必须是非空字符串");
|
|
1029
|
+
if (e.title !== void 0 && typeof e.title != "string")
|
|
1030
|
+
throw new Error("title 必须是字符串");
|
|
1031
|
+
const d = e.titleHeightMm === void 0 ? 10 : e.titleHeightMm, h = e.titleGapMm === void 0 ? 4 : e.titleGapMm;
|
|
1032
|
+
D(d, "titleHeightMm"), D(h, "titleGapMm", !0);
|
|
1033
|
+
const m = e.title !== void 0 && e.title.length > 0, c = m ? d + h : 0;
|
|
1034
|
+
if (c >= s)
|
|
1035
|
+
throw new Error("标题高度与间距占满页面,必须为表格保留可用高度");
|
|
1036
|
+
if (e.listOptions !== void 0 && (!e.listOptions || typeof e.listOptions != "object" || Array.isArray(e.listOptions)))
|
|
1037
|
+
throw new Error("listOptions 必须是列表配置对象");
|
|
1038
|
+
const g = e.listOptions ?? {};
|
|
1039
|
+
for (const u of ["fontSizePt", "rowHeightMm", "paddingMm"]) {
|
|
1040
|
+
const T = g[u];
|
|
1041
|
+
T !== void 0 && D(T, `listOptions.${u}`, u === "paddingMm");
|
|
1042
|
+
}
|
|
1043
|
+
let f = 0, y = 0;
|
|
1044
|
+
for (const [u, T] of e.columns.entries()) {
|
|
1045
|
+
if (!T || typeof T.header != "string" || typeof T.field != "string" || !T.field.trim())
|
|
1046
|
+
throw new Error(`columns[${u}] 需要字符串 header 与非空 field`);
|
|
1047
|
+
T.flex !== void 0 && D(T.flex, `columns[${u}].flex`), T.widthMm !== void 0 ? (D(T.widthMm, `columns[${u}].widthMm`), f += T.widthMm) : y = Math.max(y, T.flex ?? 1);
|
|
1048
|
+
}
|
|
1049
|
+
if (f > a)
|
|
1050
|
+
throw new Error(`固定列宽 ${f}mm 超出页面可用宽度 ${a}mm`);
|
|
1051
|
+
const P = a - f;
|
|
1052
|
+
if (y > 0 && P <= 0)
|
|
1053
|
+
throw new Error("固定列占满页面可用宽度,自动列需要正的剩余宽度");
|
|
1054
|
+
const x = y > 0 ? e.columns.reduce((u, T) => u + (T.widthMm === void 0 ? (T.flex ?? 1) / y : 0), 0) : 0, M = e.columns.map(({ widthMm: u, flex: T, ...I }, E) => {
|
|
1055
|
+
const $ = u ?? P * ((T ?? 1) / y) / x;
|
|
1056
|
+
return D($, `columns[${E}] 分配后的 widthMm`), { ...I, widthMm: $ };
|
|
1057
|
+
}), v = { widthMm: n, heightMm: r, ...i, components: [] };
|
|
1058
|
+
return m && v.components.push({
|
|
1059
|
+
kind: "text",
|
|
1060
|
+
text: e.title,
|
|
1061
|
+
leftMm: i.marginLeftMm,
|
|
1062
|
+
topMm: i.marginTopMm,
|
|
1063
|
+
widthMm: a,
|
|
1064
|
+
heightMm: d,
|
|
1065
|
+
style: { fontSize: 16, bold: !0, align: "center", verticalAlign: "middle", ...e.titleStyle }
|
|
1066
|
+
}), v.components.push({
|
|
1067
|
+
...g,
|
|
1068
|
+
kind: "list",
|
|
1069
|
+
dataset: l,
|
|
1070
|
+
columns: M,
|
|
1071
|
+
leftMm: i.marginLeftMm,
|
|
1072
|
+
topMm: i.marginTopMm + c,
|
|
1073
|
+
widthMm: y > 0 ? a : f
|
|
1074
|
+
}), e.params === void 0 ? { pages: [v] } : { params: e.params, pages: [v] };
|
|
1075
|
+
}
|
|
1076
|
+
function Mt(e) {
|
|
1077
|
+
if (!("mapData" in e)) return e;
|
|
1078
|
+
const { load: t, mapData: n, ...r } = e;
|
|
1079
|
+
return { ...r, load: async (o) => {
|
|
1080
|
+
const i = await t(o);
|
|
1081
|
+
O(o.signal);
|
|
1082
|
+
try {
|
|
1083
|
+
return n(i, o);
|
|
1084
|
+
} catch (a) {
|
|
1085
|
+
throw new W("validate", `报表 ${o.reportId} 数据映射失败`, a);
|
|
1086
|
+
}
|
|
1087
|
+
} };
|
|
1088
|
+
}
|
|
1089
|
+
class W extends Error {
|
|
1090
|
+
constructor(t, n, r) {
|
|
1091
|
+
super(n), this.name = "ReportSourceError", this.code = t, this.cause = r;
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
function se(e) {
|
|
1095
|
+
const t = new Error("报表加载已取消");
|
|
1096
|
+
return t.name = "AbortError", Object.defineProperty(t, "cause", { value: e.reason }), t;
|
|
1097
|
+
}
|
|
1098
|
+
function O(e) {
|
|
1099
|
+
if (e?.aborted) throw se(e);
|
|
1100
|
+
}
|
|
1101
|
+
function it(e, t) {
|
|
1102
|
+
return t ? new Promise((n, r) => {
|
|
1103
|
+
const o = () => t.removeEventListener("abort", i), i = () => {
|
|
1104
|
+
o(), r(se(t));
|
|
1105
|
+
};
|
|
1106
|
+
t.addEventListener("abort", i, { once: !0 }), t.aborted && i(), Promise.resolve(e).then(
|
|
1107
|
+
(a) => {
|
|
1108
|
+
o(), n(a);
|
|
1109
|
+
},
|
|
1110
|
+
(a) => {
|
|
1111
|
+
o(), r(a);
|
|
1112
|
+
}
|
|
1113
|
+
);
|
|
1114
|
+
}) : Promise.resolve(e);
|
|
1115
|
+
}
|
|
1116
|
+
function at(e, t) {
|
|
1117
|
+
if (!e || typeof e != "object" || Array.isArray(e))
|
|
1118
|
+
throw new W("validate", `报表 ${t} 的数据集应为对象`);
|
|
1119
|
+
for (const [n, r] of Object.entries(e))
|
|
1120
|
+
if (!Array.isArray(r) || r.some((o) => !o || typeof o != "object" || Array.isArray(o)))
|
|
1121
|
+
throw new W("validate", `报表 ${t} 的数据集 ${n} 应为对象数组`);
|
|
1122
|
+
}
|
|
1123
|
+
function wt(e, t = {}) {
|
|
1124
|
+
function n(o) {
|
|
1125
|
+
const i = Object.prototype.hasOwnProperty.call(e, o) ? e[o] : void 0;
|
|
1126
|
+
if (!i) throw new W("config", `未注册报表 ${o}`);
|
|
1127
|
+
return i;
|
|
1128
|
+
}
|
|
1129
|
+
return Object.assign(async ({ reportIds: o, params: i, signal: a, onWarning: s }) => {
|
|
1130
|
+
if (O(a), o.length === 0) throw new W("config", "缺少报表 ID");
|
|
1131
|
+
const l = o.map(n), d = [], h = [];
|
|
1132
|
+
for (const [f, y] of l.entries()) {
|
|
1133
|
+
O(a);
|
|
1134
|
+
const P = o[f], x = { reportId: P, params: { ...i }, signal: a };
|
|
1135
|
+
let M;
|
|
1136
|
+
try {
|
|
1137
|
+
M = await it(y.load ? y.load(x) : y.datasets ?? {}, a);
|
|
1138
|
+
} catch (u) {
|
|
1139
|
+
throw a?.aborted ? se(a) : u instanceof W ? u : new W("fetch", `报表 ${P} 取数失败:${u instanceof Error ? u.message : String(u)}`, u);
|
|
1140
|
+
}
|
|
1141
|
+
O(a), at(M, P);
|
|
1142
|
+
let v;
|
|
1143
|
+
try {
|
|
1144
|
+
v = Ve(y.template, M, y.pagination);
|
|
1145
|
+
} catch (u) {
|
|
1146
|
+
throw new W("validate", `报表 ${P} 排版失败:${u instanceof Error ? u.message : String(u)}`, u);
|
|
1147
|
+
}
|
|
1148
|
+
for (const u of v.plan.pages) d.push(u);
|
|
1149
|
+
h.push(...v.warnings.map((u) => `${P}: ${u}`));
|
|
1150
|
+
}
|
|
1151
|
+
O(a);
|
|
1152
|
+
const m = { schemaVersion: pe, pages: d }, c = Se(m);
|
|
1153
|
+
if (!c.ok)
|
|
1154
|
+
throw new W("validate", `渲染计划校验失败:${c.errors.slice(0, 3).map((f) => `${f.path}: ${f.message}`).join("; ")}`);
|
|
1155
|
+
h.push(...c.warnings.map((f) => `${f.path}: ${f.message}`));
|
|
1156
|
+
const g = s ?? t.onWarning ?? ((f) => console.warn("[mach-report]", f));
|
|
1157
|
+
for (const f of h)
|
|
1158
|
+
O(a), g(f);
|
|
1159
|
+
return O(a), m;
|
|
1160
|
+
}, {
|
|
1161
|
+
getParamDefs: (o) => ze(e, o)
|
|
1162
|
+
});
|
|
977
1163
|
}
|
|
978
1164
|
export {
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1165
|
+
St as CSS_DPI,
|
|
1166
|
+
vt as DEFAULT_BORDER_PT,
|
|
1167
|
+
Q as DEFAULT_FONT_PT,
|
|
1168
|
+
Pt as DEFAULT_STROKE_COLOR,
|
|
1169
|
+
Be as DEFAULT_TEXT_COLOR,
|
|
1170
|
+
ee as LINE_HEIGHT,
|
|
1171
|
+
Tt as MM_PER_INCH,
|
|
1172
|
+
X as PAPER_SIZES,
|
|
1173
|
+
ot as PageBuilder,
|
|
1174
|
+
pe as RENDER_PLAN_SCHEMA_VERSION,
|
|
1175
|
+
W as ReportSourceError,
|
|
1176
|
+
xt as SCHEMA_VERSION_MACH,
|
|
1177
|
+
rt as TemplateBuilder,
|
|
1178
|
+
dt as assertRenderPlan,
|
|
1179
|
+
$t as charWidthEm,
|
|
993
1180
|
N as classOf,
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1181
|
+
Ze as computePageWindow,
|
|
1182
|
+
kt as createCanvasMeasurer,
|
|
1183
|
+
gt as createCanvasPager,
|
|
1184
|
+
Et as createHeuristicMeasurer,
|
|
1185
|
+
wt as createReportSource,
|
|
1186
|
+
pt as createTableTemplate,
|
|
1187
|
+
ut as createTemplate,
|
|
1188
|
+
Mt as defineReport,
|
|
1189
|
+
je as evalStyleRule,
|
|
1190
|
+
be as formatValue,
|
|
1191
|
+
ie as heuristicMeasurer,
|
|
1192
|
+
He as isImageBackedComponent,
|
|
1193
|
+
Me as isRichText,
|
|
1194
|
+
xe as measurePageSizePx,
|
|
1195
|
+
Ct as measureTextMm,
|
|
1196
|
+
Re as mmToPx,
|
|
1197
|
+
At as mmToPxFactor,
|
|
1198
|
+
Ve as paginateTemplate,
|
|
1199
|
+
Fe as parseDateLocal,
|
|
1200
|
+
ht as planFontSizePx,
|
|
1201
|
+
K as ptToPx,
|
|
1202
|
+
Ht as pxToMm,
|
|
1203
|
+
Te as renderComponent,
|
|
1204
|
+
Qe as renderPage,
|
|
1205
|
+
mt as renderPlan,
|
|
1206
|
+
nt as renderPlanToCanvas,
|
|
1207
|
+
ft as renderPlanToImages,
|
|
1208
|
+
te as resolveBoxBorders,
|
|
1209
|
+
V as resolveFontSize,
|
|
1210
|
+
Le as resolveGridLayout,
|
|
1211
|
+
Ne as resolveLineHeight,
|
|
1212
|
+
Ee as resolvePaper,
|
|
1213
|
+
Y as resolveStroke,
|
|
1214
|
+
we as resolveTextColor,
|
|
1215
|
+
q as round,
|
|
1216
|
+
oe as toNumber,
|
|
1217
|
+
ye as validateComponent,
|
|
1218
|
+
Ie as validatePage,
|
|
1219
|
+
Se as validateRenderPlan,
|
|
1220
|
+
Z as wrapText
|
|
1031
1221
|
};
|