@agile-team/mach-report 2.22.0 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/{ExcelBindingWizard-CZyppD7I.js → ExcelBindingWizard-D4FLind-.js} +3 -3
- package/dist/{ExcelBindingWizard-CW79I6Gl.cjs → ExcelBindingWizard-D4RS5Bpg.cjs} +1 -1
- package/dist/{ParamEditor-CiYCJI0b.cjs → ParamEditor-C-6C9rd2.cjs} +1 -1
- package/dist/{ParamEditor-DQit-Gdf.js → ParamEditor-CASZt-Ma.js} +2 -2
- package/dist/{ReportBatchPanel-DKTpV7MU.js → ReportBatchPanel-Bq7t8a5r.js} +2 -2
- package/dist/{ReportBatchPanel-Db6TAfG5.cjs → ReportBatchPanel-YVj5IO5y.cjs} +1 -1
- package/dist/ReportLabelStudio-Cqhita1b.cjs +1 -0
- package/dist/{ReportLabelStudio-BYnRqmje.js → ReportLabelStudio-Dj7GXhuv.js} +295 -292
- package/dist/ReportParamPanel-DZbFVmDL.cjs +1 -0
- package/dist/{ReportParamPanel-BHSKVL8k.js → ReportParamPanel-Dgmqro1Y.js} +93 -79
- package/dist/ReportPreview-DeWzG8jQ.js +6257 -0
- package/dist/ReportPreview-FFIryrIr.cjs +6 -0
- package/dist/{ReportTemplateLibrary-DEXH07ND.cjs → ReportTemplateLibrary-BaWodmpm.cjs} +1 -1
- package/dist/{ReportTemplateLibrary-BZuKn0YK.js → ReportTemplateLibrary-DdAAAD2I.js} +1 -1
- package/dist/{RuleEditor-CIQn547x.js → RuleEditor-D2UwQGF6.js} +59 -59
- package/dist/{RuleEditor-zSUmPjKa.cjs → RuleEditor-DcT9xI1v.cjs} +1 -1
- package/dist/TemplateOutlinePanel-CUHFFiNM.cjs +1 -0
- package/dist/{TemplateOutlinePanel-D0PgOSQE.js → TemplateOutlinePanel-DrT7XN0m.js} +2 -2
- package/dist/{TemplateReusePanel-BKlAEF8-.js → TemplateReusePanel-4eejkNqi.js} +2 -2
- package/dist/{TemplateReusePanel-DAy_Hwqz.cjs → TemplateReusePanel-DZMyiX5I.cjs} +1 -1
- package/dist/{TemplateReviewPanel-div-EH_m.js → TemplateReviewPanel-BIhNLeNw.js} +2 -2
- package/dist/{TemplateReviewPanel-CowmHaQQ.cjs → TemplateReviewPanel-DnYImiXu.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.js +26 -26
- package/dist/artifact-integrity.json +106 -104
- package/dist/assets-D2gHc4Mz.cjs +1 -0
- package/dist/assets-T_gDeFaz.js +132 -0
- package/dist/auto-4pK9HePf.cjs +1 -0
- package/dist/auto-CTIJ6PnR.js +257 -0
- package/dist/capabilities-DiBj4Qgl.cjs +1 -0
- package/dist/capabilities-pg7j7VLT.js +106 -0
- package/dist/charts-Cjw5AYkg.cjs +1 -0
- package/dist/{charts-Dlv8j2AG.js → charts-CxJZ0XaY.js} +1 -1
- package/dist/computed-DK6BruFz.cjs +1 -0
- package/dist/{computed-C8NRZQss.js → computed-f3pOqWLX.js} +381 -301
- package/dist/data-bar-CeZuFmYl.cjs +1 -0
- package/dist/{data-bar-8baGYEZ9.js → data-bar-IkI6VvMQ.js} +1 -1
- package/dist/designer-DhrE7jzw.js +7169 -0
- package/dist/designer-IAZu6kBX.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +98 -45
- package/dist/designer.d.ts +98 -45
- package/dist/designer.js +3 -3
- package/dist/dom-ChE5D-L-.cjs +1 -0
- package/dist/dom-JWrchIre.js +452 -0
- package/dist/dom-cell-address-DLD1mkTB.cjs +1 -0
- package/dist/dom-cell-address-Fn-8nk7D.js +11 -0
- package/dist/{encoding-ncQAvyOv.cjs → encoding-BefcaHdp.cjs} +1 -1
- package/dist/{encoding-DbnhbwI8.js → encoding-CL6rXEkR.js} +2 -2
- package/dist/{font-loader-Di0lQKFf.js → font-loader-BT5baV-o.js} +1 -1
- package/dist/{font-loader-BB372_XN.cjs → font-loader-Ga51c2VC.cjs} +1 -1
- package/dist/grid-strokes-Be24LGuV.cjs +1 -0
- package/dist/grid-strokes-EoY66L2f.js +53 -0
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +944 -1259
- package/dist/json-snapshot-1tvQNzQE.cjs +2 -0
- package/dist/{json-snapshot-DvQbZlD7.js → json-snapshot-OqkPyUk5.js} +763 -776
- package/dist/matrix-B8QWbsGM.cjs +1 -0
- package/dist/matrix-C6e_r_vp.js +302 -0
- package/dist/{pdf-CARdBcuw.cjs → pdf-HiEeXe9H.cjs} +42 -42
- package/dist/{pdf-DmlnL5eB.js → pdf-aobetCsy.js} +20 -20
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.js +2 -2
- package/dist/{plugin-AcAQ2m9X.cjs → plugin-BFANt-i8.cjs} +1 -1
- package/dist/{plugin-w5Nyt08U.js → plugin-DeYYAL6F.js} +1 -1
- package/dist/{prefill-BXBxx5We.js → prefill-Dk4C6S5R.js} +21 -21
- package/dist/prefill-DsUD5OoK.cjs +1 -0
- package/dist/prepared-DCIxhKFo.js +94 -0
- package/dist/prepared-Dv-XM3i1.cjs +1 -0
- package/dist/progress-ByiOxUD3.js +250 -0
- package/dist/progress-WomPRP3B.cjs +1 -0
- package/dist/{protocol-C9ZaylID.cjs → protocol-B9YgfQ_d.cjs} +1 -1
- package/dist/{protocol-fjaeKkjf.js → protocol-DxeUKGYG.js} +3 -3
- package/dist/record-bindings-DatJZv_e.js +200 -0
- package/dist/record-bindings-MBxbeBsi.cjs +1 -0
- package/dist/{region-binding-workflow-aA8nxmkZ.js → region-binding-workflow-DjrXuR1q.js} +2 -2
- package/dist/{region-binding-workflow-BiJQ7NU6.cjs → region-binding-workflow-l7NGfagJ.cjs} +2 -2
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/rich-text-layout-Ciwa6D2o.js +52 -0
- package/dist/rich-text-layout-DK7A_a5r.cjs +3 -0
- package/dist/{runtime-BTtpjF3D.js → runtime-75Y5Oq5B.js} +52 -51
- package/dist/runtime-DKlGd_D4.cjs +1 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server-node.cjs +5 -5
- package/dist/server-node.js +1642 -1586
- package/dist/server.cjs +1 -1
- package/dist/server.js +24 -24
- package/dist/style.css +1 -1
- package/dist/{template-catalog-JSxSqk5y.js → template-catalog--cjxzgH7.js} +17 -17
- package/dist/template-catalog-CoT7jm_6.cjs +1 -0
- package/dist/{template-fragments-D2JFj7Du.js → template-fragments-CPpGpQoz.js} +12 -12
- package/dist/template-fragments-GVjpew_q.cjs +1 -0
- package/dist/template-registry-DI59PXVK.cjs +1 -0
- package/dist/{template-registry-Do1Uav2Z.js → template-registry-O0hNIOfB.js} +17 -17
- package/dist/{template-serialization-CU4n_Miu.js → template-serialization-CWmHq7lX.js} +1 -1
- package/dist/{template-serialization-CgqBo6s-.cjs → template-serialization-CqQY4zDg.cjs} +1 -1
- package/dist/{textwrap-CkGjRFT3.js → textwrap-BIjtEWmq.js} +1 -1
- package/dist/textwrap-Cy7o1hIR.cjs +4 -0
- package/dist/vue/async.d.cts +24 -0
- package/dist/vue/async.d.ts +24 -0
- package/dist/vue/index.d.cts +25 -1
- package/dist/vue/index.d.ts +25 -1
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +52 -47
- package/dist/{workbook-session-BvEBRRMz.cjs → workbook-session-C6-SrnCT.cjs} +4 -4
- package/dist/{workbook-session-f0wVlzst.js → workbook-session-C9ZmCBwY.js} +15 -16
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.js +184 -179
- package/package.json +1 -1
- package/dist/ReportLabelStudio-B0i9ohQj.cjs +0 -1
- package/dist/ReportParamPanel-lngONOEz.cjs +0 -1
- package/dist/ReportPreview-BDgKssYR.js +0 -5887
- package/dist/ReportPreview-Dw-4icG6.cjs +0 -6
- package/dist/TemplateOutlinePanel-B5SfGYVN.cjs +0 -1
- package/dist/assets-CxHunY_9.js +0 -232
- package/dist/assets-vbjAGgk8.cjs +0 -1
- package/dist/auto-DcUHlKob.cjs +0 -1
- package/dist/auto-moShblh1.js +0 -240
- package/dist/charts-aCtoswXq.cjs +0 -1
- package/dist/component-tree-1_QCiQJX.js +0 -67
- package/dist/component-tree-BjZIp6w9.cjs +0 -1
- package/dist/computed-4TnxzgIh.cjs +0 -1
- package/dist/data-bar-YltqGTaC.cjs +0 -1
- package/dist/designer-B7jJeAeG.js +0 -6914
- package/dist/designer-BWQVpJeN.cjs +0 -2
- package/dist/grid-geometry-D3SJgWFv.js +0 -136
- package/dist/grid-geometry-D8ReblRV.cjs +0 -1
- package/dist/json-snapshot-nyV63AbB.cjs +0 -2
- package/dist/matrix-0hywp0-F.cjs +0 -1
- package/dist/matrix-Dy-tyY7E.js +0 -381
- package/dist/prefill-DUvejVt1.cjs +0 -1
- package/dist/prepared-YXy-fVLw.cjs +0 -1
- package/dist/prepared-rXCKqdHY.js +0 -88
- package/dist/progress-B0ctFpKf.cjs +0 -1
- package/dist/progress-Hc2vxoCs.js +0 -52
- package/dist/record-bindings-Ct1HkPrc.cjs +0 -1
- package/dist/record-bindings-VZGS-Qd8.js +0 -155
- package/dist/rich-text-layout-K48VHUoW.cjs +0 -3
- package/dist/rich-text-layout-wxBhnAS7.js +0 -102
- package/dist/runtime-Dq0LUsyS.cjs +0 -1
- package/dist/template-catalog-CLAM4w7H.cjs +0 -1
- package/dist/template-fragments-Ca25Jt7e.cjs +0 -1
- package/dist/template-outline-CDWXptuj.js +0 -88
- package/dist/template-outline-K4jGhATu.cjs +0 -1
- package/dist/template-registry-CWnuGqyP.cjs +0 -1
- package/dist/textwrap-OTOUMr4f.cjs +0 -4
package/dist/xlsx.js
CHANGED
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { e as
|
|
3
|
-
import { d as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const t = G({ width: 1, height: 1, channels: 4, depth: 8, data: new Uint8Array([1, 3, 5].map((o) => parseInt(e.slice(o, o + 2), 16)).concat(89)) });
|
|
1
|
+
import { t as v, m as x, a as W, r as T, v as E, o as R, x as P, i as C } from "./progress-ByiOxUD3.js";
|
|
2
|
+
import { e as _ } from "./index-CPh6tqge.js";
|
|
3
|
+
import { d as U } from "./data-bar-IkI6VvMQ.js";
|
|
4
|
+
import { e as X, E as K, m as F, i as J } from "./workbook-session-C9ZmCBwY.js";
|
|
5
|
+
import { a as qe, b as Qe, o as Ye } from "./workbook-session-C9ZmCBwY.js";
|
|
6
|
+
import { c as V } from "./media-Y90dHK9z.js";
|
|
7
|
+
import { r as q } from "./capabilities-pg7j7VLT.js";
|
|
8
|
+
import { r as Q } from "./assets-T_gDeFaz.js";
|
|
9
|
+
import { s as Y, a as Z } from "./workbook-sheets-D4M7XXBh.js";
|
|
10
|
+
import { b as et, c as tt, a as nt, d as rt, e as it, f as ot, g as at, h as st, p as lt, i as ct, v as ht, j as dt, k as ft, l as gt, m as ut, n as mt } from "./region-binding-workflow-DjrXuR1q.js";
|
|
11
|
+
function ee(e) {
|
|
12
|
+
const t = _({ width: 1, height: 1, channels: 4, depth: 8, data: new Uint8Array([1, 3, 5].map((o) => parseInt(e.slice(o, o + 2), 16)).concat(89)) });
|
|
14
13
|
return `data:image/png;base64,${btoa(String.fromCharCode(...t))}`;
|
|
15
14
|
}
|
|
16
|
-
function
|
|
15
|
+
function te(e, t, o) {
|
|
17
16
|
const r = /* @__PURE__ */ new Map();
|
|
18
17
|
let i = 0;
|
|
19
18
|
return (a, n, s, l) => {
|
|
20
|
-
const c =
|
|
19
|
+
const c = U(n.cell.dataBar, n.widthMm, n.heightMm, l);
|
|
21
20
|
if (!c) return;
|
|
22
21
|
if (++i > t) throw new Error(`Excel 数据条超过 ${t} 个绘图预算,请缩小范围或调整 maxDataBars`);
|
|
23
22
|
let h = r.get(c.color);
|
|
24
|
-
h || (h =
|
|
23
|
+
h || (h = ee(c.color), r.set(c.color, h)), i === 1 && o.push("数据条为静态半透明视觉快照,保留原始单元格值;Excel 编辑不会重算条形,绘图叠加文字的混色与预览可能略有差异。"), e.write(a, { kind: "image", leftMm: 0, topMm: 0, widthMm: c.width, heightMm: c.height, imageData: h }, s, { leftMm: n.xMm + c.x, offsetMm: c.y });
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
|
-
async function
|
|
28
|
-
const r = e.pages.flatMap((n) => n.components), i =
|
|
26
|
+
async function ne(e, t, o) {
|
|
27
|
+
const r = e.pages.flatMap((n) => n.components), i = v(o);
|
|
29
28
|
let a = 0;
|
|
30
29
|
for (; r.length; ) {
|
|
31
30
|
const n = r.pop();
|
|
@@ -37,28 +36,28 @@ async function ee(e, t, o) {
|
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
|
-
function
|
|
39
|
+
function I(e, t) {
|
|
41
40
|
return { richText: e.flatMap((o, r) => [
|
|
42
41
|
...r ? [{ text: `
|
|
43
42
|
` }] : [],
|
|
44
43
|
...o.segments.map((i) => {
|
|
45
|
-
const a =
|
|
46
|
-
return { text: i.kind === "field" ? i.field ?? "" : i.text ?? "", font: { name: a.fontFamily, bold: a.bold, italic: a.italic, underline: a.underline, size:
|
|
44
|
+
const a = x(t, i.style), n = a.color?.replace(/^#/, "");
|
|
45
|
+
return { text: i.kind === "field" ? i.field ?? "" : i.text ?? "", font: { name: a.fontFamily, bold: a.bold, italic: a.italic, underline: a.underline, size: W(a).fontSizePt, .../^[a-f\d]{6}$/i.test(n ?? "") ? { color: { argb: `FF${n.toUpperCase()}` } } : {} } };
|
|
47
46
|
})
|
|
48
47
|
]) };
|
|
49
48
|
}
|
|
50
|
-
function
|
|
49
|
+
function re(e, t) {
|
|
51
50
|
const o = e.children?.filter((a) => a.kind === "text" && !a.grid) ?? [];
|
|
52
51
|
if (!e.richParagraphs?.length && !o.length) return;
|
|
53
|
-
const r =
|
|
52
|
+
const r = x(t, e.style), i = e.richParagraphs?.length ? [...e.richParagraphs] : e.text ? [{ segments: [{ text: e.text }] }] : [];
|
|
54
53
|
for (const a of o) {
|
|
55
|
-
const n =
|
|
54
|
+
const n = x(r, a.style), s = a.richParagraphs?.length ? a.richParagraphs : [{ segments: [{ text: a.lines?.join(`
|
|
56
55
|
`) ?? a.text ?? "" }] }];
|
|
57
|
-
for (const l of s) i.push({ ...l, segments: l.segments.map((c) => ({ ...c, style:
|
|
56
|
+
for (const l of s) i.push({ ...l, segments: l.segments.map((c) => ({ ...c, style: x(n, c.style) })) });
|
|
58
57
|
}
|
|
59
|
-
return
|
|
58
|
+
return I(i, r);
|
|
60
59
|
}
|
|
61
|
-
function
|
|
60
|
+
function ie(e, t, o) {
|
|
62
61
|
let r = o * 72 / 25.4;
|
|
63
62
|
if (!Number.isFinite(r) || t + Math.ceil(r / 409) - 1 > 1048576) throw new Error("Excel 图片占位超过工作表行数上限");
|
|
64
63
|
for (; r > 0; ) {
|
|
@@ -68,18 +67,18 @@ function ne(e, t, o) {
|
|
|
68
67
|
}
|
|
69
68
|
return t;
|
|
70
69
|
}
|
|
71
|
-
function
|
|
70
|
+
function oe(e, t, o) {
|
|
72
71
|
let r = Math.round(t * 36e3), i = 0;
|
|
73
72
|
if (!Number.isSafeInteger(r)) throw new Error("Excel 图片锚点超出安全坐标范围");
|
|
74
73
|
for (e.properties.defaultColWidth ??= 8.43; i < 16384; ) {
|
|
75
|
-
const a = e.getColumn(i + 1).width ?? e.properties.defaultColWidth, n = Math.round(
|
|
74
|
+
const a = e.getColumn(i + 1).width ?? e.properties.defaultColWidth, n = Math.round(X(a) * 36e3);
|
|
76
75
|
if (!Number.isSafeInteger(n) || n <= 0) throw new Error("Excel 图片锚点所在列宽无效");
|
|
77
76
|
if (r < n) return { col: i + r / n, row: o - 1, nativeCol: i, nativeColOff: r, nativeRow: o - 1, nativeRowOff: 0 };
|
|
78
77
|
r -= n, i++;
|
|
79
78
|
}
|
|
80
79
|
throw new Error("Excel 图片锚点超过16384列上限");
|
|
81
80
|
}
|
|
82
|
-
function
|
|
81
|
+
function ae(e, t, o) {
|
|
83
82
|
let r = o * 72 / 25.4;
|
|
84
83
|
if (!Number.isFinite(r) || Math.abs(r) > 1048576 * 409) throw new Error("Excel 图片纵向偏移超过工作表范围");
|
|
85
84
|
const i = (a) => {
|
|
@@ -92,8 +91,8 @@ function ie(e, t, o) {
|
|
|
92
91
|
if (t > 1048576 || r < 0) throw new Error("Excel 图片移动到工作表边界之外");
|
|
93
92
|
return { nativeRow: t - 1, nativeRowOff: Math.round(r * 25.4 / 72 * 36e3) };
|
|
94
93
|
}
|
|
95
|
-
function
|
|
96
|
-
const r =
|
|
94
|
+
function se(e, t, o) {
|
|
95
|
+
const r = V(t), i = /* @__PURE__ */ new Map();
|
|
97
96
|
return { write(a, n, s, l) {
|
|
98
97
|
if (![n.widthMm, n.heightMm, n.leftMm].every(Number.isFinite) || n.widthMm < 0 || n.heightMm < 0 || n.leftMm < 0) throw new Error("Excel 图片尺寸无效");
|
|
99
98
|
if (!n.widthMm || !n.heightMm) return s;
|
|
@@ -102,73 +101,73 @@ function oe(e, t, o) {
|
|
|
102
101
|
const c = r(n.imageData);
|
|
103
102
|
let h = i.get(c.dataUrl);
|
|
104
103
|
h === void 0 && (h = e.addImage({ base64: c.dataUrl, extension: c.extension }), i.set(c.dataUrl, h));
|
|
105
|
-
const d = l ? s :
|
|
104
|
+
const d = l ? s : ie(a, s, n.heightMm);
|
|
106
105
|
return a.addImage(h, {
|
|
107
|
-
tl: { ...
|
|
106
|
+
tl: { ...oe(a, l?.leftMm ?? n.leftMm, s), ...l ? ae(a, s, l.offsetMm) : {} },
|
|
108
107
|
ext: { width: n.widthMm * 96 / 25.4, height: n.heightMm * 96 / 25.4 },
|
|
109
108
|
editAs: "oneCell"
|
|
110
109
|
}), d;
|
|
111
110
|
} };
|
|
112
111
|
}
|
|
113
|
-
function
|
|
112
|
+
function z(e) {
|
|
114
113
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
115
114
|
}
|
|
116
|
-
function
|
|
115
|
+
function D(e, t) {
|
|
117
116
|
const o = e.meta?.xlsxFlow;
|
|
118
117
|
if (o === void 0) return;
|
|
119
|
-
if (!
|
|
118
|
+
if (!z(o) || o.version !== "1.0" || !Number.isSafeInteger(o.columnStart) || Number(o.columnStart) < 0) throw new Error("Excel 多区域几何标记无效,不能按列序猜测输出");
|
|
120
119
|
if (!e.grid) throw new Error("Excel 多区域输出只接受显式网格组件");
|
|
121
120
|
const r = o, i = e.grid.colWidthsMm;
|
|
122
121
|
if (!i?.length || r.columnStart + i.length > t.length || i.some((a, n) => Math.abs(a - t[r.columnStart + n]) > 1e-3)) throw new Error("Excel 多区域列位置与网格列宽不一致");
|
|
123
122
|
return r;
|
|
124
123
|
}
|
|
125
|
-
function
|
|
124
|
+
function N(e) {
|
|
126
125
|
const t = e.meta?.xlsxFlow;
|
|
127
126
|
if (t === void 0) {
|
|
128
127
|
if (e.components.some((r) => r.meta?.xlsxFlow !== void 0)) throw new Error("Excel 多区域页面缺少完整列几何标记");
|
|
129
128
|
return;
|
|
130
129
|
}
|
|
131
|
-
const o =
|
|
130
|
+
const o = le(t, e.meta?.reportScope);
|
|
132
131
|
for (const r of e.components) {
|
|
133
|
-
const i =
|
|
132
|
+
const i = D(r, o.widths);
|
|
134
133
|
if (!i) throw new Error("Excel 多区域页面混入没有区域几何的组件,请使用独立页面模板");
|
|
135
134
|
const a = o.widths.slice(0, i.columnStart).reduce((s, l) => s + l, e.marginLeftMm ?? 0), n = r.grid.colWidthsMm.reduce((s, l) => s + l, 0);
|
|
136
135
|
if (Math.abs(a - r.leftMm) > 0.01 || Math.abs(n - r.widthMm) > 0.01) throw new Error("Excel 多区域标记与真实横向位置不一致");
|
|
137
136
|
}
|
|
138
137
|
return o;
|
|
139
138
|
}
|
|
140
|
-
function
|
|
141
|
-
if (!
|
|
139
|
+
function le(e, t) {
|
|
140
|
+
if (!z(e) || e.version !== "1.0" || typeof e.sheet != "string" || !e.sheet.trim() || typeof e.templateId != "string" || !e.templateId.trim()) throw new Error("Excel 多区域工作表标识无效");
|
|
142
141
|
if (!Array.isArray(e.fullWidthsMm) || !e.fullWidthsMm.length || e.fullWidthsMm.length > 16384 || e.fullWidthsMm.some((o) => typeof o != "number" || !Number.isFinite(o) || o <= 0 || o > 2e3)) throw new Error("Excel 多区域完整列宽无效");
|
|
143
142
|
if (t !== void 0 && (typeof t != "string" || !t.trim())) throw new Error("Excel 多区域报表命名空间无效");
|
|
144
143
|
return { key: JSON.stringify([t ?? e.templateId, e.sheet]), sheet: e.sheet, widths: e.fullWidthsMm };
|
|
145
144
|
}
|
|
146
|
-
function
|
|
145
|
+
function S(e) {
|
|
147
146
|
return Math.round(e * 1e6) / 1e6;
|
|
148
147
|
}
|
|
149
|
-
function
|
|
148
|
+
function ce(e, t, o, r, i) {
|
|
150
149
|
return e.components.filter((a) => r ? a.pageAnchor === "header" ? t === 0 : a.pageAnchor === "footer" ? t === o - 1 : a.table?.role !== "header" ? !0 : i.has(a.table.id) ? !1 : (i.add(a.table.id), !0) : !0);
|
|
151
150
|
}
|
|
152
|
-
function
|
|
151
|
+
function he(e, t, o, r) {
|
|
153
152
|
const i = e.components.filter((n) => !t.includes(n) && n.table?.role === "header"), a = t.filter((n) => !n.pageAnchor).reduce((n, s) => Math.max(n, s.topMm + s.heightMm), e.marginTopMm ?? 0);
|
|
154
153
|
return t.map((n) => {
|
|
155
154
|
let s = n.topMm;
|
|
156
|
-
return o && n.pageAnchor === "footer" && (s = a), s -= i.filter((l) => l.topMm + l.heightMm <= s + 1e-3).reduce((l, c) => l + c.heightMm, 0), { component: n, layout:
|
|
155
|
+
return o && n.pageAnchor === "footer" && (s = a), s -= i.filter((l) => l.topMm + l.heightMm <= s + 1e-3).reduce((l, c) => l + c.heightMm, 0), { component: n, layout: T(n.grid, n.widthMm, n.heightMm), top: s, column: D(n, r).columnStart };
|
|
157
156
|
});
|
|
158
157
|
}
|
|
159
|
-
function
|
|
158
|
+
function de(e, t, o) {
|
|
160
159
|
const r = t.length - 1;
|
|
161
160
|
if (r * o.length > 1e6) throw new Error("Excel 多区域单页超过 100 万几何单元格,请减小预览分页高度或列数");
|
|
162
161
|
const i = new Map(t.map((s, l) => [s, l])), a = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
163
162
|
for (const s of e) for (const l of s.layout.cells) {
|
|
164
163
|
if (!Object.keys(l.cell).length) continue;
|
|
165
|
-
const c = i.get(
|
|
166
|
-
for (let g = c; g < h; g++) for (let
|
|
167
|
-
const
|
|
168
|
-
if (n.has(
|
|
169
|
-
n.set(
|
|
164
|
+
const c = i.get(S(s.top + l.yMm)), h = i.get(S(s.top + l.yMm + l.heightMm)), d = s.column + l.ci, u = d + (l.cell.colSpan ?? 1), f = `${c}:${d}`;
|
|
165
|
+
for (let g = c; g < h; g++) for (let p = d; p < u; p++) {
|
|
166
|
+
const w = `${g}:${p}`;
|
|
167
|
+
if (n.has(w)) throw new Error("Excel 多区域实际单元格互相覆盖,已终止输出,未覆盖已有内容");
|
|
168
|
+
n.set(w, f);
|
|
170
169
|
}
|
|
171
|
-
a.set(f, { ...l.cell, style:
|
|
170
|
+
a.set(f, { ...l.cell, style: x(s.component.style, l.cell.style), rowSpan: h - c, colSpan: u - d });
|
|
172
171
|
}
|
|
173
172
|
return Array.from({ length: r }, (s, l) => {
|
|
174
173
|
const c = [];
|
|
@@ -179,73 +178,73 @@ function ce(e, t, o) {
|
|
|
179
178
|
return c;
|
|
180
179
|
});
|
|
181
180
|
}
|
|
182
|
-
function
|
|
181
|
+
function fe(e, t) {
|
|
183
182
|
const o = /* @__PURE__ */ new Set(), r = [];
|
|
184
183
|
let i;
|
|
185
184
|
for (const [a, { page: n }] of e.entries()) {
|
|
186
|
-
const s =
|
|
185
|
+
const s = N(n);
|
|
187
186
|
if (i && (s.key !== i.key || s.widths.length !== i.widths.length || s.widths.some((f, g) => Math.abs(f - i.widths[g]) > 1e-3))) throw new Error("Excel 多区域分页的工作表或列结构不一致");
|
|
188
187
|
i ??= s;
|
|
189
|
-
const l =
|
|
188
|
+
const l = ce(n, a, e.length, t, o), c = he(n, l, t, s.widths);
|
|
190
189
|
if (!c.length) continue;
|
|
191
|
-
const h = [...new Set(c.flatMap((f) => [...f.layout.rows.map((g) =>
|
|
190
|
+
const h = [...new Set(c.flatMap((f) => [...f.layout.rows.map((g) => S(f.top + g.pos)), S(f.top + f.component.heightMm)]))].sort((f, g) => f - g), d = de(c, h, s.widths), u = h.slice(1).map((f, g) => f - h[g]);
|
|
192
191
|
r.push({ kind: "rect", leftMm: 0, topMm: 0, widthMm: s.widths.reduce((f, g) => f + g, 0), heightMm: u.reduce((f, g) => f + g, 0), grid: { cells: d, colWidthsMm: s.widths, rowHeightsMm: u } });
|
|
193
192
|
}
|
|
194
193
|
return r;
|
|
195
194
|
}
|
|
196
|
-
const
|
|
197
|
-
function
|
|
195
|
+
const O = 72 / 25.4, ge = 32767, ue = 253;
|
|
196
|
+
function M(e, t) {
|
|
198
197
|
if (typeof e != "string") return;
|
|
199
|
-
if (e.length >
|
|
198
|
+
if (e.length > ge)
|
|
200
199
|
throw new Error(`Excel 单元格 ${t} 最多支持 32767 个字符,无法无损导出;内容未裁剪`);
|
|
201
200
|
let o = 0;
|
|
202
201
|
for (let r = 0; r < e.length; r++)
|
|
203
|
-
if (e.charCodeAt(r) === 10 && ++o >
|
|
202
|
+
if (e.charCodeAt(r) === 10 && ++o > ue)
|
|
204
203
|
throw new Error(`Excel 单元格 ${t} 最多支持 253 个换行,无法无损导出;内容未改写`);
|
|
205
204
|
}
|
|
206
|
-
function
|
|
205
|
+
function b(e) {
|
|
207
206
|
if (!e) return;
|
|
208
207
|
const t = e.replace("#", "");
|
|
209
208
|
return /^[0-9a-fA-F]{6}$/.test(t) ? `FF${t.toUpperCase()}` : void 0;
|
|
210
209
|
}
|
|
211
|
-
function
|
|
210
|
+
function L(e, t = {}) {
|
|
212
211
|
e.font = {
|
|
213
212
|
name: t.fontFamily,
|
|
214
213
|
bold: t.bold === !0,
|
|
215
214
|
italic: t.italic === !0,
|
|
216
215
|
underline: t.underline === !0,
|
|
217
|
-
size:
|
|
218
|
-
color:
|
|
216
|
+
size: W(t).fontSizePt,
|
|
217
|
+
color: b(t.color) ? { argb: b(t.color) } : void 0
|
|
219
218
|
};
|
|
220
219
|
}
|
|
221
|
-
const
|
|
220
|
+
const y = {
|
|
222
221
|
a3: { width: 297, height: 420, code: 8 },
|
|
223
222
|
a4: { width: 210, height: 297, code: 9 },
|
|
224
223
|
a5: { width: 148, height: 210, code: 11 }
|
|
225
224
|
};
|
|
226
|
-
function
|
|
227
|
-
if (t && t !== "auto") return
|
|
228
|
-
const i = Math.min(e.pageWidthMm, e.pageHeightMm), a = Math.max(e.pageWidthMm, e.pageHeightMm), n = Object.values(
|
|
229
|
-
return n ? n.code : (r.push(`page ${o + 1}: 自定义纸张 ${e.pageWidthMm}×${e.pageHeightMm}mm 无对应 Excel 纸型,打印设置回退 A4;可显式配置 paperSize`),
|
|
225
|
+
function me(e, t, o, r) {
|
|
226
|
+
if (t && t !== "auto") return y[t].code;
|
|
227
|
+
const i = Math.min(e.pageWidthMm, e.pageHeightMm), a = Math.max(e.pageWidthMm, e.pageHeightMm), n = Object.values(y).find((s) => Math.abs(i - s.width) <= 1 && Math.abs(a - s.height) <= 1);
|
|
228
|
+
return n ? n.code : (r.push(`page ${o + 1}: 自定义纸张 ${e.pageWidthMm}×${e.pageHeightMm}mm 无对应 Excel 纸型,打印设置回退 A4;可显式配置 paperSize`), y.a4.code);
|
|
230
229
|
}
|
|
231
|
-
function
|
|
230
|
+
function we(e, t, o, r) {
|
|
232
231
|
const i = typeof t.text == "string" ? t.text : "";
|
|
233
232
|
if (o !== "raw" || !Object.prototype.hasOwnProperty.call(t, "value")) {
|
|
234
|
-
|
|
233
|
+
M(i, e.address), e.value = i;
|
|
235
234
|
return;
|
|
236
235
|
}
|
|
237
236
|
const a = t.value;
|
|
238
237
|
if (a === null || typeof a == "string" || typeof a == "boolean" || typeof a == "number" && Number.isFinite(a)) {
|
|
239
|
-
|
|
238
|
+
M(a, e.address), e.value = a, t.numberFormat && (e.numFmt = t.numberFormat);
|
|
240
239
|
return;
|
|
241
240
|
}
|
|
242
|
-
|
|
241
|
+
M(i, e.address), e.value = i, r.push(`原始单元格值无效,已保留显示文本:${e.address}`);
|
|
243
242
|
}
|
|
244
|
-
function
|
|
245
|
-
const t =
|
|
246
|
-
return t ? { id: `xlsx-flow:${t.key}`, title: t.sheet, wide: !0, flow: !0 } :
|
|
243
|
+
function pe(e) {
|
|
244
|
+
const t = N(e);
|
|
245
|
+
return t ? { id: `xlsx-flow:${t.key}`, title: t.sheet, wide: !0, flow: !0 } : xe(e);
|
|
247
246
|
}
|
|
248
|
-
function
|
|
247
|
+
function xe(e) {
|
|
249
248
|
const o = e.components.filter((r) => r.table !== void 0)[0]?.table;
|
|
250
249
|
if (!(!o || typeof o.id != "string" || !o.id.trim() || !Array.isArray(o.columnKeys) || !o.columnKeys.length)) {
|
|
251
250
|
for (const r of e.components) {
|
|
@@ -253,12 +252,12 @@ function we(e) {
|
|
|
253
252
|
if (!r.grid || r.table.id !== o.id) return;
|
|
254
253
|
continue;
|
|
255
254
|
}
|
|
256
|
-
if (r.grid || r.kind !== "text" && !
|
|
255
|
+
if (r.grid || r.kind !== "text" && !C(r)) return;
|
|
257
256
|
}
|
|
258
257
|
return { id: o.id, title: o.title, wide: o.layout === "wide" || e.layout === "wide" };
|
|
259
258
|
}
|
|
260
259
|
}
|
|
261
|
-
function
|
|
260
|
+
function Me(e, t) {
|
|
262
261
|
const o = /* @__PURE__ */ new Set();
|
|
263
262
|
for (const [r, i] of e.pages.entries())
|
|
264
263
|
if (!t[r])
|
|
@@ -266,27 +265,27 @@ function pe(e, t) {
|
|
|
266
265
|
typeof a.table?.id == "string" && o.add(a.table.id);
|
|
267
266
|
return o;
|
|
268
267
|
}
|
|
269
|
-
function
|
|
268
|
+
function k(e) {
|
|
270
269
|
return e.layout === "wide" || e.components.some((t) => t.table?.layout === "wide");
|
|
271
270
|
}
|
|
272
|
-
function
|
|
273
|
-
const r = [], i = e.pages.map(
|
|
271
|
+
function Ee(e, t, o) {
|
|
272
|
+
const r = [], i = e.pages.map(pe), a = Me(e, i);
|
|
274
273
|
for (const [n, s] of e.pages.entries()) {
|
|
275
274
|
const l = i[n], c = l && !a.has(l.id), h = t === "pages" || !c ? void 0 : l;
|
|
276
275
|
if (t === "continuous" && !h)
|
|
277
276
|
throw new Error(`page ${n + 1}: continuous Excel 需要完整、单一的逻辑表来源;自由布局请使用 sheetMode: 'pages'`);
|
|
278
277
|
const d = h !== void 0 && (t === "continuous" || h.wide);
|
|
279
|
-
!d && t !== "pages" &&
|
|
278
|
+
!d && t !== "pages" && k(s) && o.push(`page ${n + 1}: 混合或缺少逻辑表来源,已保留独立 Sheet,未猜测合并内容`);
|
|
280
279
|
const u = r[r.length - 1];
|
|
281
280
|
d && u?.continuous && u.tableId === h.id ? u.pages.push({ page: s, index: n }) : r.push({ pages: [{ page: s, index: n }], continuous: d, ...d ? { tableId: h.id, title: h.title } : {}, ...l?.flow ? { flow: !0, title: l.title } : {} });
|
|
282
281
|
}
|
|
283
282
|
return r;
|
|
284
283
|
}
|
|
285
|
-
function
|
|
284
|
+
function A(e, t, o) {
|
|
286
285
|
return !e || e.length === t.length && e.every((r, i) => o(r, t[i]));
|
|
287
286
|
}
|
|
288
|
-
function
|
|
289
|
-
const i = e.table, a = t.columns.map((l) => l.size), n =
|
|
287
|
+
function be(e, t, o, r) {
|
|
288
|
+
const i = e.table, a = t.columns.map((l) => l.size), n = A(r.keys, i.columnKeys, (l, c) => l === c), s = A(r.widths, a, (l, c) => Math.abs(l - c) <= 1e-3);
|
|
290
289
|
if (i.columnKeys.length !== a.length || !n || !s)
|
|
291
290
|
throw new Error(`page ${o + 1}: 连续 Excel 逻辑表 ${i.id} 的列结构或列宽不一致`);
|
|
292
291
|
if (r.keys ??= i.columnKeys, r.widths ??= a, i.role === "header") {
|
|
@@ -298,16 +297,16 @@ function Me(e, t, o, r) {
|
|
|
298
297
|
r.expectedRow += t.rows.length;
|
|
299
298
|
}
|
|
300
299
|
}
|
|
301
|
-
function
|
|
300
|
+
function ye(e, t) {
|
|
302
301
|
const o = { expectedRow: 0, headerSeen: !1 };
|
|
303
302
|
for (const { page: r, index: i } of e.pages)
|
|
304
303
|
for (const a of r.components) {
|
|
305
304
|
const n = t.get(a);
|
|
306
|
-
a.table && n &&
|
|
305
|
+
a.table && n && be(a, n, i, o);
|
|
307
306
|
}
|
|
308
307
|
if (!o.headerSeen) throw new Error("连续 Excel 逻辑表缺少明确表头来源");
|
|
309
308
|
}
|
|
310
|
-
function
|
|
309
|
+
function Se(e, t, o) {
|
|
311
310
|
let r = (e?.replace(/[\\/*?:[\]]/g, " ").replace(/\s+/g, " ").trim() || `Sheet${t + 1}`).slice(0, 31).replace(/^'+|'+$/g, "").trim() || `Sheet${t + 1}`;
|
|
312
311
|
r.toLowerCase() === "history" && (r += " 报表");
|
|
313
312
|
let i = r, a = 1;
|
|
@@ -317,7 +316,7 @@ function be(e, t, o) {
|
|
|
317
316
|
}
|
|
318
317
|
return o.add(i.toLowerCase()), i;
|
|
319
318
|
}
|
|
320
|
-
function
|
|
319
|
+
function ve(e) {
|
|
321
320
|
const t = /* @__PURE__ */ new Set();
|
|
322
321
|
function o(r, i, a, n) {
|
|
323
322
|
return r <= i ? r : (t.has(a) || (e.push(n), t.add(a)), i);
|
|
@@ -327,12 +326,12 @@ function ye(e) {
|
|
|
327
326
|
row: (r) => o(r, 409, "row", "Excel 行高上限为 409pt,超高行已收敛至 409pt;单元格值完整保留,显示范围可能受限")
|
|
328
327
|
};
|
|
329
328
|
}
|
|
330
|
-
async function
|
|
331
|
-
const o = e.flow ?
|
|
329
|
+
async function Ce(e, t) {
|
|
330
|
+
const o = e.flow ? fe(e.pages, e.continuous).map((n) => ({ comp: n, pageIndex: e.pages[0].index })) : e.pages.flatMap(({ page: n, index: s }, l) => n.components.filter((c) => !e.continuous || (c.pageAnchor !== "header" || l === 0) && (c.pageAnchor !== "footer" || l === e.pages.length - 1)).map((c) => ({ comp: c, pageIndex: s }))), r = /* @__PURE__ */ new Map();
|
|
332
331
|
let i = 1, a = 0;
|
|
333
332
|
for (const { comp: n } of o)
|
|
334
333
|
if (n.grid) {
|
|
335
|
-
const s =
|
|
334
|
+
const s = T(n.grid, n.widthMm, n.heightMm);
|
|
336
335
|
r.set(n, s), i = Math.max(i, s.columns.length);
|
|
337
336
|
const l = t(s.cells.length);
|
|
338
337
|
l && await l;
|
|
@@ -340,17 +339,17 @@ async function Se(e, t) {
|
|
|
340
339
|
if (i > 16384) throw new Error("Excel 最多支持 16384 列,无法无损导出此报表");
|
|
341
340
|
return { components: o, grids: r, columnCount: i, textWidthMm: a };
|
|
342
341
|
}
|
|
343
|
-
function
|
|
342
|
+
function ke(e, t, o) {
|
|
344
343
|
const { page: r, index: i } = e.pages[0], a = t !== void 0 && t !== "auto";
|
|
345
|
-
return (e.continuous ||
|
|
346
|
-
paperSize:
|
|
344
|
+
return (e.continuous || k(r)) && !a ? {} : { pageSetup: {
|
|
345
|
+
paperSize: me(r, t, i, o),
|
|
347
346
|
orientation: r.pageWidthMm > r.pageHeightMm ? "landscape" : "portrait",
|
|
348
347
|
fitToPage: !0,
|
|
349
348
|
...e.continuous ? { fitToWidth: 1, fitToHeight: 0 } : {}
|
|
350
349
|
} };
|
|
351
350
|
}
|
|
352
|
-
function
|
|
353
|
-
const t =
|
|
351
|
+
function Be(e) {
|
|
352
|
+
const t = b(e.borderColor ?? e.lineColor), o = { style: "thin", ...t ? { color: { argb: t } } : {} };
|
|
354
353
|
return {
|
|
355
354
|
...e.borderTop !== !1 ? { top: o } : {},
|
|
356
355
|
...e.borderLeft !== !1 ? { left: o } : {},
|
|
@@ -358,60 +357,60 @@ function Ce(e) {
|
|
|
358
357
|
...e.borderRight !== !1 ? { right: o } : {}
|
|
359
358
|
};
|
|
360
359
|
}
|
|
361
|
-
function
|
|
360
|
+
function $e(e, t) {
|
|
362
361
|
e.alignment = { horizontal: t.align ?? "left", vertical: t.verticalAlign ?? "middle", wrapText: !0 };
|
|
363
|
-
const o =
|
|
364
|
-
o && (e.fill = { type: "pattern", pattern: "solid", fgColor: { argb: o } }), e.border =
|
|
362
|
+
const o = b(t.backgroundColor);
|
|
363
|
+
o && (e.fill = { type: "pattern", pattern: "solid", fgColor: { argb: o } }), e.border = Be(t), L(e, t);
|
|
365
364
|
}
|
|
366
|
-
function
|
|
365
|
+
function Pe(e, t) {
|
|
367
366
|
for (const [o, r] of t.columns.entries()) {
|
|
368
|
-
const i = e.sheet.getColumn(o + 1), a = e.limits.column(
|
|
367
|
+
const i = e.sheet.getColumn(o + 1), a = e.limits.column(F(r.size));
|
|
369
368
|
(i.width == null || i.width < a) && (i.width = a);
|
|
370
369
|
}
|
|
371
370
|
}
|
|
372
|
-
function
|
|
371
|
+
function Ae(e, t, o) {
|
|
373
372
|
for (const [r, i] of t.rows.entries()) {
|
|
374
|
-
const a = e.sheet.getRow(o + r), n = e.limits.row(i.size *
|
|
373
|
+
const a = e.sheet.getRow(o + r), n = e.limits.row(i.size * O);
|
|
375
374
|
(a.height == null || a.height < n) && (a.height = n);
|
|
376
375
|
}
|
|
377
376
|
}
|
|
378
|
-
function
|
|
377
|
+
function We(e, t, o, r) {
|
|
379
378
|
const i = Math.max(1, Math.min(t.cell.colSpan ?? 1, o.columns.length - t.ci)), a = Math.max(1, Math.min(t.cell.rowSpan ?? 1, o.rows.length - t.ri));
|
|
380
379
|
(i > 1 || a > 1) && e.mergeCells(r + t.ri, t.ci + 1, r + t.ri + a - 1, t.ci + i);
|
|
381
380
|
}
|
|
382
|
-
async function
|
|
381
|
+
async function Te(e, t, o, r) {
|
|
383
382
|
if (r + o.rows.length - 1 > 1048576) throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");
|
|
384
|
-
|
|
383
|
+
Ae(e, o, r);
|
|
385
384
|
for (const i of o.cells) {
|
|
386
385
|
const a = e.sheet.getCell(r + i.ri, i.ci + 1);
|
|
387
|
-
|
|
388
|
-
const n =
|
|
389
|
-
n && (
|
|
386
|
+
we(a, i.cell, e.valueMode, e.warnings);
|
|
387
|
+
const n = re(i.cell, t.style);
|
|
388
|
+
n && (M(n.richText.map((c) => c.text).join(""), a.address), a.value = n);
|
|
390
389
|
const s = t.grid?.paddingMm ?? 0.5;
|
|
391
390
|
e.dataBars(e.sheet, i, r + i.ri, s);
|
|
392
391
|
for (const c of i.cell.children ?? [])
|
|
393
|
-
|
|
394
|
-
|
|
392
|
+
C(c) && !c.grid && e.images.write(e.sheet, c, r + i.ri, { leftMm: i.xMm + s + (i.cell.indentMm ?? 0) + c.leftMm, offsetMm: s + c.topMm });
|
|
393
|
+
$e(a, x(t.style, i.cell.style)), i.cell.indentMm && (a.alignment = { ...a.alignment, indent: Math.min(250, Math.max(1, Math.round(i.cell.indentMm / 2.5))) }), We(e.sheet, i, o, r);
|
|
395
394
|
const l = e.schedule();
|
|
396
395
|
l && await l;
|
|
397
396
|
}
|
|
398
397
|
return r + o.rows.length;
|
|
399
398
|
}
|
|
400
|
-
function
|
|
399
|
+
function Re(e, t, o, r) {
|
|
401
400
|
const i = Array.isArray(t.lines) && t.lines.length > 0 ? t.lines.join(`
|
|
402
401
|
`) : t.text ?? "", a = e.sheet.getRow(o), n = a.getCell(1);
|
|
403
|
-
t.richParagraphs?.length ||
|
|
404
|
-
const s =
|
|
405
|
-
return s && (n.fill = { type: "pattern", pattern: "solid", fgColor: { argb: s } }),
|
|
402
|
+
t.richParagraphs?.length || M(i, n.address), n.value = t.richParagraphs?.length ? I(t.richParagraphs, t.style) : i, typeof n.value == "object" && n.value && "richText" in n.value && M(n.value.richText.map((l) => l.text).join(""), n.address), n.alignment = { horizontal: t.style?.align ?? "left", vertical: t.style?.verticalAlign ?? "middle", wrapText: !0 };
|
|
403
|
+
const s = b(t.style?.backgroundColor);
|
|
404
|
+
return s && (n.fill = { type: "pattern", pattern: "solid", fgColor: { argb: s } }), L(n, t.style), r > 1 && e.sheet.mergeCells(o, 1, o, r), a.height = e.limits.row(t.heightMm * O), o + 1;
|
|
406
405
|
}
|
|
407
|
-
function
|
|
406
|
+
function Fe(e, t, o) {
|
|
408
407
|
const r = t + o - 1;
|
|
409
408
|
e.views = [{ state: "frozen", ySplit: r, xSplit: 0 }], e.pageSetup.printTitlesRow = `1:${r}`;
|
|
410
409
|
}
|
|
411
|
-
async function
|
|
412
|
-
!t.grids.size && t.textWidthMm > 0 && (e.sheet.getColumn(1).width = e.limits.column(
|
|
410
|
+
async function Ie(e, t, o, r) {
|
|
411
|
+
!t.grids.size && t.textWidthMm > 0 && (e.sheet.getColumn(1).width = e.limits.column(F(t.textWidthMm)));
|
|
413
412
|
for (const n of t.grids.values()) {
|
|
414
|
-
|
|
413
|
+
Pe(e, n);
|
|
415
414
|
const s = e.schedule(n.columns.length);
|
|
416
415
|
s && await s;
|
|
417
416
|
}
|
|
@@ -422,82 +421,88 @@ async function Re(e, t, o, r) {
|
|
|
422
421
|
if (i > 1048576) throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");
|
|
423
422
|
const c = t.grids.get(n);
|
|
424
423
|
if (c)
|
|
425
|
-
l && (
|
|
424
|
+
l && (Fe(e.sheet, i, c.rows.length), a = !0), i = await Te(e, n, c, i);
|
|
426
425
|
else if (n.kind === "text")
|
|
427
|
-
i =
|
|
428
|
-
else if (
|
|
429
|
-
const h =
|
|
426
|
+
i = Re(e, n, i, t.columnCount);
|
|
427
|
+
else if (C(n)) {
|
|
428
|
+
const h = J(n, o), d = r.write(e.sheet, n, h?.row ?? i, h);
|
|
430
429
|
h || (i = d);
|
|
431
430
|
} else
|
|
432
431
|
e.warnings.push(`page ${s + 1} ${n.nid ?? n.kind}: 组件类型 ${n.kind} 暂不支持 xlsx 导出,已跳过`);
|
|
433
432
|
}
|
|
434
433
|
}
|
|
435
|
-
function
|
|
434
|
+
function ze(e) {
|
|
436
435
|
if (e.maxDataBars !== void 0 && (!Number.isSafeInteger(e.maxDataBars) || e.maxDataBars < 0 || e.maxDataBars > 1e5)) throw new Error("xlsx maxDataBars 必须是 0–100000 的整数");
|
|
437
436
|
if (e.valueMode !== void 0 && e.valueMode !== "text" && e.valueMode !== "raw")
|
|
438
437
|
throw new Error("xlsx valueMode 必须是 text 或 raw");
|
|
439
|
-
if (e.paperSize !== void 0 && e.paperSize !== "auto" && !Object.prototype.hasOwnProperty.call(
|
|
438
|
+
if (e.paperSize !== void 0 && e.paperSize !== "auto" && !Object.prototype.hasOwnProperty.call(y, e.paperSize))
|
|
440
439
|
throw new Error("xlsx paperSize 必须是 auto、a3、a4 或 a5");
|
|
441
440
|
if (e.sheetMode !== void 0 && !["auto", "pages", "continuous"].includes(e.sheetMode))
|
|
442
441
|
throw new Error("xlsx sheetMode 必须是 auto、pages 或 continuous");
|
|
443
442
|
}
|
|
444
|
-
async function
|
|
445
|
-
const o =
|
|
446
|
-
|
|
447
|
-
const i = t.assetRegistry || t.assetRenderers ? await
|
|
443
|
+
async function De(e, t = {}) {
|
|
444
|
+
const o = Y(t.additionalSheets), r = Z(t.sheetNames);
|
|
445
|
+
ze(t), E(t.signal);
|
|
446
|
+
const i = t.assetRegistry || t.assetRenderers ? await Q(e, { ...t, format: "xlsx" }) : { plan: e, diagnostics: [] };
|
|
448
447
|
e = i.plan;
|
|
449
|
-
const a = [...i.diagnostics, ...
|
|
450
|
-
await
|
|
451
|
-
const n = new
|
|
448
|
+
const a = [...i.diagnostics, ...q(e, "xlsx", t)];
|
|
449
|
+
await ne(e, t.maxDataBars ?? 1e4, t);
|
|
450
|
+
const n = new K.Workbook(), s = [], l = se(n, t, s), c = [], h = te(l, t.maxDataBars ?? 1e4, c), d = ve(s), u = Ee(e, t.sheetMode, s), f = u.length + (o?.length ?? 0), g = /* @__PURE__ */ new Set(), p = v(t);
|
|
452
451
|
for (const [w, m] of u.entries()) {
|
|
453
|
-
const
|
|
454
|
-
m.continuous && !m.flow &&
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
const
|
|
458
|
-
|
|
452
|
+
const B = await Ce(m, p);
|
|
453
|
+
m.continuous && !m.flow && ye(m, B.grids);
|
|
454
|
+
const j = m.pages[0].page, $ = r?.[w] ?? t.sheetName?.(w) ?? Se(m.title, w, g);
|
|
455
|
+
g.add($.toLowerCase());
|
|
456
|
+
const G = n.addWorksheet($, ke(m, t.paperSize, s)), H = t.valueMode ?? (k(j) || m.continuous || m.flow ? "raw" : "text");
|
|
457
|
+
E(t.signal), await Ie({ sheet: G, warnings: s, limits: d, valueMode: H, schedule: p, images: l, dataBars: h }, B, m.continuous, l), await R(t, w + 1, f);
|
|
459
458
|
}
|
|
460
|
-
return await
|
|
461
|
-
}
|
|
462
|
-
async function
|
|
463
|
-
const
|
|
464
|
-
for (const
|
|
465
|
-
if (
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
for (const
|
|
469
|
-
const
|
|
470
|
-
|
|
459
|
+
return await Ne(n, o, t, u.length, f), { workbook: n, warnings: s, diagnostics: a, ...c.length ? { notes: c } : {} };
|
|
460
|
+
}
|
|
461
|
+
async function Ne(e, t = [], o, r, i) {
|
|
462
|
+
const a = v(o);
|
|
463
|
+
for (const n of t) {
|
|
464
|
+
if (E(o.signal), e.worksheets.some((l) => l.name.toLowerCase() === n.name.toLowerCase())) throw new TypeError(`附加工作表名称已被报表使用 ${n.name}`);
|
|
465
|
+
const s = e.addWorksheet(n.name);
|
|
466
|
+
n.columnWidths && (s.columns = n.columnWidths.map((l) => ({ width: l })));
|
|
467
|
+
for (const l of n.rows) {
|
|
468
|
+
const c = s.addRow([...l]);
|
|
469
|
+
c.alignment = { vertical: "top", wrapText: !0 };
|
|
470
|
+
const h = a(l.length);
|
|
471
|
+
h && await h;
|
|
471
472
|
}
|
|
473
|
+
await R(o, ++r, i);
|
|
472
474
|
}
|
|
473
|
-
|
|
475
|
+
E(o.signal);
|
|
474
476
|
}
|
|
475
|
-
async function
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
477
|
+
async function Ke(e, t = {}) {
|
|
478
|
+
let o = 1;
|
|
479
|
+
const r = t.onProgress ? (n, s) => {
|
|
480
|
+
o = s + 1, P(t, n, o);
|
|
481
|
+
} : void 0, i = await De(e, { ...t, onProgress: r });
|
|
482
|
+
E(t.signal);
|
|
483
|
+
const a = await i.workbook.xlsx.writeBuffer();
|
|
484
|
+
return E(t.signal), P(t, o, o), { ...i, buffer: a };
|
|
480
485
|
}
|
|
481
486
|
export {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
487
|
+
et as bindExcelTemplate,
|
|
488
|
+
tt as createExcelBindingDocument,
|
|
489
|
+
nt as createExcelBindingSession,
|
|
490
|
+
rt as createExcelRegionBindingDocument,
|
|
491
|
+
it as createExcelRegionBindingSession,
|
|
492
|
+
ot as excelBindingCellRange,
|
|
493
|
+
at as excelBindingRowRange,
|
|
494
|
+
st as getExcelSheetWindow,
|
|
495
|
+
qe as importExcelTemplate,
|
|
496
|
+
Qe as inspectExcelWorkbook,
|
|
497
|
+
Ye as openExcelWorkbook,
|
|
498
|
+
lt as parseExcelBindingSession,
|
|
499
|
+
ct as parseExcelRegionBindingSession,
|
|
500
|
+
De as renderPlanToWorkbook,
|
|
501
|
+
Ke as renderPlanToXlsx,
|
|
502
|
+
ht as validateExcelBindingFields,
|
|
503
|
+
dt as validateExcelBindingRecipe,
|
|
504
|
+
ft as validateExcelBindingRegions,
|
|
505
|
+
gt as validateExcelRegionBindings,
|
|
506
|
+
ut as validateExcelRegionFields,
|
|
507
|
+
mt as validateExcelRegionGeometry
|
|
503
508
|
};
|