@agile-team/mach-report 2.16.0 → 2.17.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 +10 -6
- package/dist/{ExcelBindingWizard-CP6h2x1f.cjs → ExcelBindingWizard-Bq6FYME6.cjs} +1 -1
- package/dist/{ExcelBindingWizard-HhB3hAJE.js → ExcelBindingWizard-Co1svTsw.js} +3 -3
- package/dist/{ParamEditor-CUQLgoxa.cjs → ParamEditor-B5UZRgxv.cjs} +1 -1
- package/dist/{ParamEditor-OKesP_nO.js → ParamEditor-DNNARyeB.js} +1 -1
- package/dist/{ReportBatchPanel-cZCAMAwH.cjs → ReportBatchPanel-Ctvs2t_9.cjs} +1 -1
- package/dist/{ReportBatchPanel-ruxcbfY6.js → ReportBatchPanel-uQh06usx.js} +1 -1
- package/dist/ReportPreview-BdQawRh0.js +4879 -0
- package/dist/ReportPreview-CJC_-j2I.cjs +6 -0
- package/dist/{ReportTemplateLibrary-BDlNT8JN.cjs → ReportTemplateLibrary-CnP7_1pH.cjs} +1 -1
- package/dist/{ReportTemplateLibrary-DcwrH-63.js → ReportTemplateLibrary-TIL_Oj2l.js} +1 -1
- package/dist/RuleEditor-DkRjOLlr.js +2141 -0
- package/dist/RuleEditor-h5anGsDB.cjs +1 -0
- package/dist/{TemplateOutlinePanel-CGrT5DFN.cjs → TemplateOutlinePanel-BlLxRrfu.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-SXCjaPKR.js → TemplateOutlinePanel-BouxsuqQ.js} +1 -1
- package/dist/{TemplateReusePanel-lHLOS9Wn.js → TemplateReusePanel-BEACLPaN.js} +2 -2
- package/dist/{TemplateReusePanel-6Z3wRFz8.cjs → TemplateReusePanel-yxsHSO40.cjs} +1 -1
- package/dist/{TemplateReviewPanel-CJ9PLc48.js → TemplateReviewPanel-B1OGRY2i.js} +1 -1
- package/dist/{TemplateReviewPanel-Dpk7sLcF.cjs → TemplateReviewPanel-D9Cx0m2N.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +63 -1
- package/dist/analytics.d.ts +63 -1
- package/dist/analytics.js +4 -4
- package/dist/artifact-integrity.json +86 -90
- package/dist/assets-BIMVwjQe.js +231 -0
- package/dist/assets-Dfs2ElxI.cjs +1 -0
- package/dist/{auto-YR7a4BtF.js → auto-BIOmtVhk.js} +14 -14
- package/dist/{auto-uVBjX1j5.cjs → auto-DDHflI9v.cjs} +1 -1
- package/dist/computed-BW5a8QFk.js +612 -0
- package/dist/computed-C2GD3XcE.cjs +1 -0
- package/dist/dataset-DL83majE.js +161 -0
- package/dist/dataset-IrlXbUvh.cjs +1 -0
- package/dist/{designer-BfQSahxq.js → designer-D9XAxqSc.js} +1194 -1179
- package/dist/designer-uCDo5XSK.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +125 -3
- package/dist/designer.d.ts +125 -3
- package/dist/designer.js +1 -1
- package/dist/{drill-CsdjgkRM.cjs → drill-ByN8COs_.cjs} +1 -1
- package/dist/{drill-DIGsZfyB.js → drill-CKW3Xtfa.js} +11 -11
- package/dist/{encoding-BYF9ZTl9.cjs → encoding-BFMFIc4r.cjs} +1 -1
- package/dist/{encoding-BOGq4qYL.js → encoding-DP_Eaf0A.js} +2 -2
- package/dist/{font-loader-EKLzOJxf.cjs → font-loader-7FWVlykp.cjs} +1 -1
- package/dist/{font-loader-CzI1GuBc.js → font-loader-CQZowp0I.js} +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +173 -1
- package/dist/index.d.ts +173 -1
- package/dist/index.js +1205 -808
- package/dist/json-snapshot-D7PE1NsU.cjs +2 -0
- package/dist/{json-snapshot-D6ioHth9.js → json-snapshot-DYmEe3sO.js} +769 -692
- package/dist/matrix-JLAXlux-.js +302 -0
- package/dist/matrix-gTHpDTGm.cjs +1 -0
- package/dist/{pdf-ByVCb1i6.cjs → pdf-B8JouyYv.cjs} +47 -47
- package/dist/{pdf-DJ5S6ukC.js → pdf-l3ea86di.js} +13 -15
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +12 -0
- package/dist/pdf.d.ts +12 -0
- package/dist/pdf.js +2 -2
- package/dist/{plugin-C2j5_mhx.js → plugin-BBp74CQZ.js} +1 -1
- package/dist/{plugin-Dr39GBRG.cjs → plugin-CtFX9PFG.cjs} +1 -1
- package/dist/{prepared-DqtpvRTn.js → prepared-CARicKYh.js} +1 -1
- package/dist/{prepared-DdrjLC7L.cjs → prepared-Ch1x_Gog.cjs} +1 -1
- package/dist/{protocol-BzwMP4Vw.cjs → protocol-B5A2uom4.cjs} +1 -1
- package/dist/{protocol-kt4Iy6-3.js → protocol-BaiWjq5w.js} +3 -3
- package/dist/{record-bindings-DUX1VMlR.cjs → record-bindings-B86Sur_y.cjs} +1 -1
- package/dist/{record-bindings-CZWBJ1fU.js → record-bindings-D4TuMzHs.js} +1 -1
- package/dist/{region-binding-workflow-CWNvIjkV.js → region-binding-workflow-BNasF5kz.js} +2 -2
- package/dist/{region-binding-workflow-CqSMxQ4p.cjs → region-binding-workflow-O2Cni3mF.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/runtime-DakRXui3.js +170 -0
- package/dist/runtime-dL5ygIfa.cjs +1 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server/node.d.cts +46 -0
- package/dist/server/node.d.ts +46 -0
- package/dist/server-node.cjs +4 -4
- package/dist/server-node.js +2540 -1911
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +174 -1
- package/dist/server.d.ts +174 -1
- package/dist/server.js +787 -544
- package/dist/style.css +1 -1
- package/dist/template-catalog-Dua8h9ZA.cjs +1 -0
- package/dist/{template-catalog-BtR2JmCL.js → template-catalog-wT1fNeAP.js} +4 -4
- package/dist/{template-fragments-BVsbxs4a.cjs → template-fragments-BajTajb4.cjs} +1 -1
- package/dist/{template-fragments-By0aZC1D.js → template-fragments-DmX5XK4N.js} +1 -1
- package/dist/{template-registry-C62vpv4a.cjs → template-registry-CpysHAxy.cjs} +1 -1
- package/dist/{template-registry-Cw3vRTX2.js → template-registry-u11fPd8D.js} +5 -5
- package/dist/{tree-BX380Rr7.cjs → tree-CLpxYbKa.cjs} +1 -1
- package/dist/{tree-CjVZLRw7.js → tree-DNJorJUf.js} +1 -1
- package/dist/vue/async.d.cts +108 -2
- package/dist/vue/async.d.ts +108 -2
- package/dist/vue/index.d.cts +130 -3
- package/dist/vue/index.d.ts +130 -3
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +4 -4
- package/dist/{workbook-session-BeSO8PFB.js → workbook-session-B8pNW24X.js} +1 -1
- package/dist/{workbook-session-Cbts-22R.cjs → workbook-session-DN5LSA5C.cjs} +1 -1
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.d.cts +88 -2
- package/dist/xlsx.d.ts +88 -2
- package/dist/xlsx.js +232 -230
- package/package.json +1 -1
- package/dist/ReportPreview-BcDKCLiK.js +0 -4834
- package/dist/ReportPreview-Bk9nLfO9.cjs +0 -6
- package/dist/RuleEditor-BX5S8RSF.cjs +0 -1
- package/dist/RuleEditor-CGl9XY2s.js +0 -2037
- package/dist/assets-CqIbfbTr.js +0 -126
- package/dist/assets-e4YSke8n.cjs +0 -1
- package/dist/capabilities-DDwXr_cA.js +0 -103
- package/dist/capabilities-DNLyZdNw.cjs +0 -1
- package/dist/computed-C-4C2S5h.js +0 -521
- package/dist/computed-CGV2a809.cjs +0 -1
- package/dist/dataset-BkRmwgeJ.cjs +0 -1
- package/dist/dataset-H5pFuQGU.js +0 -121
- package/dist/designer-CPPdeM5_.cjs +0 -2
- package/dist/diagnostic-notification-B9K9We3h.cjs +0 -1
- package/dist/diagnostic-notification-qGAYZdkB.js +0 -7
- package/dist/json-snapshot-DknkjvxP.cjs +0 -2
- package/dist/matrix-CGRGkn5s.js +0 -112
- package/dist/matrix-gEO7ZM_u.cjs +0 -1
- package/dist/runtime-BjKBI530.js +0 -168
- package/dist/runtime-CBFEPKEs.cjs +0 -1
- package/dist/template-catalog-C2NLdrwB.cjs +0 -1
package/dist/xlsx.js
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
import { f as
|
|
2
|
-
import { b as E, o as
|
|
3
|
-
import { e as
|
|
4
|
-
import { a as
|
|
1
|
+
import { f as m, r as k } from "./style-67OqfNed.js";
|
|
2
|
+
import { b as E, o as N, c as O } from "./progress-Hc2vxoCs.js";
|
|
3
|
+
import { e as L, E as j, m as $, i as G } from "./workbook-session-B8pNW24X.js";
|
|
4
|
+
import { a as ze, b as Be, o as Ne } from "./workbook-session-B8pNW24X.js";
|
|
5
5
|
import { i as S } from "./component-tree-Ca6YYfHq.js";
|
|
6
|
-
import { c as
|
|
6
|
+
import { c as H } from "./media-Y90dHK9z.js";
|
|
7
7
|
import { r as A } from "./grid-geometry-BNptEcMm.js";
|
|
8
|
-
import { r as
|
|
9
|
-
import { b as
|
|
10
|
-
function
|
|
8
|
+
import { a as _, r as D } from "./assets-BIMVwjQe.js";
|
|
9
|
+
import { b as Le, c as je, a as Ge, d as He, e as _e, f as De, g as Ue, h as Ke, p as Xe, i as Je, v as Ve, j as qe, k as Qe, l as Ye, m as Ze, n as et } from "./region-binding-workflow-BNasF5kz.js";
|
|
10
|
+
function R(e, t) {
|
|
11
11
|
return { richText: e.flatMap((o, n) => [
|
|
12
12
|
...n ? [{ text: `
|
|
13
13
|
` }] : [],
|
|
14
|
-
...o.segments.map((
|
|
15
|
-
const a =
|
|
16
|
-
return { text:
|
|
14
|
+
...o.segments.map((r) => {
|
|
15
|
+
const a = m(t, r.style), i = a.color?.replace(/^#/, "");
|
|
16
|
+
return { text: r.kind === "field" ? r.field ?? "" : r.text ?? "", font: { name: a.fontFamily, bold: a.bold, italic: a.italic, underline: a.underline, size: k(a).fontSizePt, .../^[a-f\d]{6}$/i.test(i ?? "") ? { color: { argb: `FF${i.toUpperCase()}` } } : {} } };
|
|
17
17
|
})
|
|
18
18
|
]) };
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function U(e, t) {
|
|
21
21
|
const o = e.children?.filter((a) => a.kind === "text" && !a.grid) ?? [];
|
|
22
22
|
if (!e.richParagraphs?.length && !o.length) return;
|
|
23
|
-
const n =
|
|
23
|
+
const n = m(t, e.style), r = e.richParagraphs?.length ? [...e.richParagraphs] : e.text ? [{ segments: [{ text: e.text }] }] : [];
|
|
24
24
|
for (const a of o) {
|
|
25
|
-
const
|
|
25
|
+
const i = m(n, a.style), s = a.richParagraphs?.length ? a.richParagraphs : [{ segments: [{ text: a.lines?.join(`
|
|
26
26
|
`) ?? a.text ?? "" }] }];
|
|
27
|
-
for (const l of s)
|
|
27
|
+
for (const l of s) r.push({ ...l, segments: l.segments.map((c) => ({ ...c, style: m(i, c.style) })) });
|
|
28
28
|
}
|
|
29
|
-
return
|
|
29
|
+
return R(r, n);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function K(e, t, o) {
|
|
32
32
|
let n = o * 72 / 25.4;
|
|
33
33
|
if (!Number.isFinite(n) || t + Math.ceil(n / 409) - 1 > 1048576) throw new Error("Excel 图片占位超过工作表行数上限");
|
|
34
34
|
for (; n > 0; ) {
|
|
35
35
|
if (t > 1048576) throw new Error("Excel 图片占位超过工作表行数上限");
|
|
36
|
-
const
|
|
37
|
-
e.getRow(t++).height =
|
|
36
|
+
const r = Math.min(409, n);
|
|
37
|
+
e.getRow(t++).height = r, n -= r;
|
|
38
38
|
}
|
|
39
39
|
return t;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
let n = Math.round(t * 36e3),
|
|
41
|
+
function X(e, t, o) {
|
|
42
|
+
let n = Math.round(t * 36e3), r = 0;
|
|
43
43
|
if (!Number.isSafeInteger(n)) throw new Error("Excel 图片锚点超出安全坐标范围");
|
|
44
|
-
for (e.properties.defaultColWidth ??= 8.43;
|
|
45
|
-
const a = e.getColumn(
|
|
46
|
-
if (!Number.isSafeInteger(
|
|
47
|
-
if (n <
|
|
48
|
-
n -=
|
|
44
|
+
for (e.properties.defaultColWidth ??= 8.43; r < 16384; ) {
|
|
45
|
+
const a = e.getColumn(r + 1).width ?? e.properties.defaultColWidth, i = Math.round(L(a) * 36e3);
|
|
46
|
+
if (!Number.isSafeInteger(i) || i <= 0) throw new Error("Excel 图片锚点所在列宽无效");
|
|
47
|
+
if (n < i) return { col: r + n / i, row: o - 1, nativeCol: r, nativeColOff: n, nativeRow: o - 1, nativeRowOff: 0 };
|
|
48
|
+
n -= i, r++;
|
|
49
49
|
}
|
|
50
50
|
throw new Error("Excel 图片锚点超过16384列上限");
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function J(e, t, o) {
|
|
53
53
|
let n = o * 72 / 25.4;
|
|
54
54
|
if (!Number.isFinite(n) || Math.abs(n) > 1048576 * 409) throw new Error("Excel 图片纵向偏移超过工作表范围");
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
if (!Number.isFinite(
|
|
58
|
-
return
|
|
55
|
+
const r = (a) => {
|
|
56
|
+
const i = e.getRow(a).height ?? e.properties.defaultRowHeight ?? 15;
|
|
57
|
+
if (!Number.isFinite(i) || i <= 0) throw new Error("Excel 图片锚点所在行高无效");
|
|
58
|
+
return i;
|
|
59
59
|
};
|
|
60
|
-
for (; n < 0 && t > 1; ) n +=
|
|
61
|
-
for (; t <= 1048576 && n >=
|
|
60
|
+
for (; n < 0 && t > 1; ) n += r(--t);
|
|
61
|
+
for (; t <= 1048576 && n >= r(t); ) n -= r(t++);
|
|
62
62
|
if (t > 1048576 || n < 0) throw new Error("Excel 图片移动到工作表边界之外");
|
|
63
63
|
return { nativeRow: t - 1, nativeRowOff: Math.round(n * 25.4 / 72 * 36e3) };
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
const n =
|
|
67
|
-
return { write(a,
|
|
68
|
-
if (![
|
|
69
|
-
if (!
|
|
70
|
-
if (!
|
|
71
|
-
return o.push(`${
|
|
72
|
-
const c = n(
|
|
73
|
-
let h =
|
|
74
|
-
h === void 0 && (h = e.addImage({ base64: c.dataUrl, extension: c.extension }),
|
|
75
|
-
const f = l ? s :
|
|
65
|
+
function V(e, t, o) {
|
|
66
|
+
const n = H(t), r = /* @__PURE__ */ new Map();
|
|
67
|
+
return { write(a, i, s, l) {
|
|
68
|
+
if (![i.widthMm, i.heightMm, i.leftMm].every(Number.isFinite) || i.widthMm < 0 || i.heightMm < 0 || i.leftMm < 0) throw new Error("Excel 图片尺寸无效");
|
|
69
|
+
if (!i.widthMm || !i.heightMm) return s;
|
|
70
|
+
if (!i.imageData || !/^data:image\/(png|jpe?g);base64,/i.test(i.imageData))
|
|
71
|
+
return o.push(`${i.nid ?? i.kind}: Excel 图片仅支持 PNG/JPEG data URI,已跳过`), s;
|
|
72
|
+
const c = n(i.imageData);
|
|
73
|
+
let h = r.get(c.dataUrl);
|
|
74
|
+
h === void 0 && (h = e.addImage({ base64: c.dataUrl, extension: c.extension }), r.set(c.dataUrl, h));
|
|
75
|
+
const f = l ? s : K(a, s, i.heightMm);
|
|
76
76
|
return a.addImage(h, {
|
|
77
|
-
tl: { ...
|
|
78
|
-
ext: { width:
|
|
77
|
+
tl: { ...X(a, l?.leftMm ?? i.leftMm, s), ...l ? J(a, s, l.offsetMm) : {} },
|
|
78
|
+
ext: { width: i.widthMm * 96 / 25.4, height: i.heightMm * 96 / 25.4 },
|
|
79
79
|
editAs: "oneCell"
|
|
80
80
|
}), f;
|
|
81
81
|
} };
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function F(e) {
|
|
84
84
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
85
85
|
}
|
|
86
86
|
function T(e, t) {
|
|
87
87
|
const o = e.meta?.xlsxFlow;
|
|
88
88
|
if (o === void 0) return;
|
|
89
|
-
if (!
|
|
89
|
+
if (!F(o) || o.version !== "1.0" || !Number.isSafeInteger(o.columnStart) || Number(o.columnStart) < 0) throw new Error("Excel 多区域几何标记无效,不能按列序猜测输出");
|
|
90
90
|
if (!e.grid) throw new Error("Excel 多区域输出只接受显式网格组件");
|
|
91
|
-
const n = o,
|
|
92
|
-
if (!
|
|
91
|
+
const n = o, r = e.grid.colWidthsMm;
|
|
92
|
+
if (!r?.length || n.columnStart + r.length > t.length || r.some((a, i) => Math.abs(a - t[n.columnStart + i]) > 1e-3)) throw new Error("Excel 多区域列位置与网格列宽不一致");
|
|
93
93
|
return n;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function P(e) {
|
|
96
96
|
const t = e.meta?.xlsxFlow;
|
|
97
97
|
if (t === void 0) {
|
|
98
98
|
if (e.components.some((n) => n.meta?.xlsxFlow !== void 0)) throw new Error("Excel 多区域页面缺少完整列几何标记");
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
const o =
|
|
101
|
+
const o = q(t, e.meta?.reportScope);
|
|
102
102
|
for (const n of e.components) {
|
|
103
|
-
const
|
|
104
|
-
if (!
|
|
105
|
-
const a = o.widths.slice(0,
|
|
106
|
-
if (Math.abs(a - n.leftMm) > 0.01 || Math.abs(
|
|
103
|
+
const r = T(n, o.widths);
|
|
104
|
+
if (!r) throw new Error("Excel 多区域页面混入没有区域几何的组件,请使用独立页面模板");
|
|
105
|
+
const a = o.widths.slice(0, r.columnStart).reduce((s, l) => s + l, e.marginLeftMm ?? 0), i = n.grid.colWidthsMm.reduce((s, l) => s + l, 0);
|
|
106
|
+
if (Math.abs(a - n.leftMm) > 0.01 || Math.abs(i - n.widthMm) > 0.01) throw new Error("Excel 多区域标记与真实横向位置不一致");
|
|
107
107
|
}
|
|
108
108
|
return o;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
if (!
|
|
110
|
+
function q(e, t) {
|
|
111
|
+
if (!F(e) || e.version !== "1.0" || typeof e.sheet != "string" || !e.sheet.trim() || typeof e.templateId != "string" || !e.templateId.trim()) throw new Error("Excel 多区域工作表标识无效");
|
|
112
112
|
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 多区域完整列宽无效");
|
|
113
113
|
if (t !== void 0 && (typeof t != "string" || !t.trim())) throw new Error("Excel 多区域报表命名空间无效");
|
|
114
114
|
return { key: JSON.stringify([t ?? e.templateId, e.sheet]), sheet: e.sheet, widths: e.fullWidthsMm };
|
|
@@ -116,76 +116,76 @@ function J(e, t) {
|
|
|
116
116
|
function y(e) {
|
|
117
117
|
return Math.round(e * 1e6) / 1e6;
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
return e.components.filter((a) => n ? a.pageAnchor === "header" ? t === 0 : a.pageAnchor === "footer" ? t === o - 1 : a.table?.role !== "header" ? !0 :
|
|
119
|
+
function Q(e, t, o, n, r) {
|
|
120
|
+
return e.components.filter((a) => n ? a.pageAnchor === "header" ? t === 0 : a.pageAnchor === "footer" ? t === o - 1 : a.table?.role !== "header" ? !0 : r.has(a.table.id) ? !1 : (r.add(a.table.id), !0) : !0);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
const
|
|
124
|
-
return t.map((
|
|
125
|
-
let s =
|
|
126
|
-
return o &&
|
|
122
|
+
function Y(e, t, o, n) {
|
|
123
|
+
const r = e.components.filter((i) => !t.includes(i) && i.table?.role === "header"), a = t.filter((i) => !i.pageAnchor).reduce((i, s) => Math.max(i, s.topMm + s.heightMm), e.marginTopMm ?? 0);
|
|
124
|
+
return t.map((i) => {
|
|
125
|
+
let s = i.topMm;
|
|
126
|
+
return o && i.pageAnchor === "footer" && (s = a), s -= r.filter((l) => l.topMm + l.heightMm <= s + 1e-3).reduce((l, c) => l + c.heightMm, 0), { component: i, layout: A(i.grid, i.widthMm, i.heightMm), top: s, column: T(i, n).columnStart };
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function Z(e, t, o) {
|
|
130
130
|
const n = t.length - 1;
|
|
131
131
|
if (n * o.length > 1e6) throw new Error("Excel 多区域单页超过 100 万几何单元格,请减小预览分页高度或列数");
|
|
132
|
-
const
|
|
132
|
+
const r = new Map(t.map((s, l) => [s, l])), a = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
133
133
|
for (const s of e) for (const l of s.layout.cells) {
|
|
134
134
|
if (!Object.keys(l.cell).length) continue;
|
|
135
|
-
const c =
|
|
136
|
-
for (let g = c; g < h; g++) for (let
|
|
137
|
-
const
|
|
138
|
-
if (
|
|
139
|
-
|
|
135
|
+
const c = r.get(y(s.top + l.yMm)), h = r.get(y(s.top + l.yMm + l.heightMm)), f = s.column + l.ci, u = f + (l.cell.colSpan ?? 1), d = `${c}:${f}`;
|
|
136
|
+
for (let g = c; g < h; g++) for (let p = f; p < u; p++) {
|
|
137
|
+
const x = `${g}:${p}`;
|
|
138
|
+
if (i.has(x)) throw new Error("Excel 多区域实际单元格互相覆盖,已终止输出,未覆盖已有内容");
|
|
139
|
+
i.set(x, d);
|
|
140
140
|
}
|
|
141
|
-
a.set(
|
|
141
|
+
a.set(d, { ...l.cell, style: m(s.component.style, l.cell.style), rowSpan: h - c, colSpan: u - f });
|
|
142
142
|
}
|
|
143
143
|
return Array.from({ length: n }, (s, l) => {
|
|
144
144
|
const c = [];
|
|
145
145
|
for (let h = 0; h < o.length; h++) {
|
|
146
|
-
const f = `${l}:${h}`,
|
|
147
|
-
|
|
146
|
+
const f = `${l}:${h}`, u = a.get(f);
|
|
147
|
+
u ? (c.push(u), h += (u.colSpan ?? 1) - 1) : i.has(f) || c.push(null);
|
|
148
148
|
}
|
|
149
149
|
return c;
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function ee(e, t) {
|
|
153
153
|
const o = /* @__PURE__ */ new Set(), n = [];
|
|
154
|
-
let
|
|
155
|
-
for (const [a, { page:
|
|
156
|
-
const s =
|
|
157
|
-
if (
|
|
158
|
-
|
|
159
|
-
const l =
|
|
154
|
+
let r;
|
|
155
|
+
for (const [a, { page: i }] of e.entries()) {
|
|
156
|
+
const s = P(i);
|
|
157
|
+
if (r && (s.key !== r.key || s.widths.length !== r.widths.length || s.widths.some((d, g) => Math.abs(d - r.widths[g]) > 1e-3))) throw new Error("Excel 多区域分页的工作表或列结构不一致");
|
|
158
|
+
r ??= s;
|
|
159
|
+
const l = Q(i, a, e.length, t, o), c = Y(i, l, t, s.widths);
|
|
160
160
|
if (!c.length) continue;
|
|
161
|
-
const h = [...new Set(c.flatMap((
|
|
162
|
-
n.push({ kind: "rect", leftMm: 0, topMm: 0, widthMm: s.widths.reduce((
|
|
161
|
+
const h = [...new Set(c.flatMap((d) => [...d.layout.rows.map((g) => y(d.top + g.pos)), y(d.top + d.component.heightMm)]))].sort((d, g) => d - g), f = Z(c, h, s.widths), u = h.slice(1).map((d, g) => d - h[g]);
|
|
162
|
+
n.push({ kind: "rect", leftMm: 0, topMm: 0, widthMm: s.widths.reduce((d, g) => d + g, 0), heightMm: u.reduce((d, g) => d + g, 0), grid: { cells: f, colWidthsMm: s.widths, rowHeightsMm: u } });
|
|
163
163
|
}
|
|
164
164
|
return n;
|
|
165
165
|
}
|
|
166
|
-
const
|
|
167
|
-
function
|
|
166
|
+
const W = 72 / 25.4, te = 32767, ne = 253;
|
|
167
|
+
function w(e, t) {
|
|
168
168
|
if (typeof e != "string") return;
|
|
169
|
-
if (e.length >
|
|
169
|
+
if (e.length > te)
|
|
170
170
|
throw new Error(`Excel 单元格 ${t} 最多支持 32767 个字符,无法无损导出;内容未裁剪`);
|
|
171
171
|
let o = 0;
|
|
172
172
|
for (let n = 0; n < e.length; n++)
|
|
173
|
-
if (e.charCodeAt(n) === 10 && ++o >
|
|
173
|
+
if (e.charCodeAt(n) === 10 && ++o > ne)
|
|
174
174
|
throw new Error(`Excel 单元格 ${t} 最多支持 253 个换行,无法无损导出;内容未改写`);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function M(e) {
|
|
177
177
|
if (!e) return;
|
|
178
178
|
const t = e.replace("#", "");
|
|
179
179
|
return /^[0-9a-fA-F]{6}$/.test(t) ? `FF${t.toUpperCase()}` : void 0;
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function I(e, t = {}) {
|
|
182
182
|
e.font = {
|
|
183
183
|
name: t.fontFamily,
|
|
184
184
|
bold: t.bold === !0,
|
|
185
185
|
italic: t.italic === !0,
|
|
186
186
|
underline: t.underline === !0,
|
|
187
187
|
size: k(t).fontSizePt,
|
|
188
|
-
color:
|
|
188
|
+
color: M(t.color) ? { argb: M(t.color) } : void 0
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
191
|
const b = {
|
|
@@ -193,29 +193,29 @@ const b = {
|
|
|
193
193
|
a4: { width: 210, height: 297, code: 9 },
|
|
194
194
|
a5: { width: 148, height: 210, code: 11 }
|
|
195
195
|
};
|
|
196
|
-
function
|
|
196
|
+
function ie(e, t, o, n) {
|
|
197
197
|
if (t && t !== "auto") return b[t].code;
|
|
198
|
-
const
|
|
199
|
-
return
|
|
198
|
+
const r = Math.min(e.pageWidthMm, e.pageHeightMm), a = Math.max(e.pageWidthMm, e.pageHeightMm), i = Object.values(b).find((s) => Math.abs(r - s.width) <= 1 && Math.abs(a - s.height) <= 1);
|
|
199
|
+
return i ? i.code : (n.push(`page ${o + 1}: 自定义纸张 ${e.pageWidthMm}×${e.pageHeightMm}mm 无对应 Excel 纸型,打印设置回退 A4;可显式配置 paperSize`), b.a4.code);
|
|
200
200
|
}
|
|
201
|
-
function
|
|
202
|
-
const
|
|
201
|
+
function re(e, t, o, n) {
|
|
202
|
+
const r = typeof t.text == "string" ? t.text : "";
|
|
203
203
|
if (o !== "raw" || !Object.prototype.hasOwnProperty.call(t, "value")) {
|
|
204
|
-
|
|
204
|
+
w(r, e.address), e.value = r;
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
207
|
const a = t.value;
|
|
208
208
|
if (a === null || typeof a == "string" || typeof a == "boolean" || typeof a == "number" && Number.isFinite(a)) {
|
|
209
|
-
|
|
209
|
+
w(a, e.address), e.value = a, t.numberFormat && (e.numFmt = t.numberFormat);
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
w(r, e.address), e.value = r, n.push(`原始单元格值无效,已保留显示文本:${e.address}`);
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
const t =
|
|
216
|
-
return t ? { id: `xlsx-flow:${t.key}`, title: t.sheet, wide: !0, flow: !0 } :
|
|
214
|
+
function oe(e) {
|
|
215
|
+
const t = P(e);
|
|
216
|
+
return t ? { id: `xlsx-flow:${t.key}`, title: t.sheet, wide: !0, flow: !0 } : ae(e);
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function ae(e) {
|
|
219
219
|
const o = e.components.filter((n) => n.table !== void 0)[0]?.table;
|
|
220
220
|
if (!(!o || typeof o.id != "string" || !o.id.trim() || !Array.isArray(o.columnKeys) || !o.columnKeys.length)) {
|
|
221
221
|
for (const n of e.components) {
|
|
@@ -228,99 +228,99 @@ function re(e) {
|
|
|
228
228
|
return { id: o.id, title: o.title, wide: o.layout === "wide" || e.layout === "wide" };
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function se(e, t) {
|
|
232
232
|
const o = /* @__PURE__ */ new Set();
|
|
233
|
-
for (const [n,
|
|
233
|
+
for (const [n, r] of e.pages.entries())
|
|
234
234
|
if (!t[n])
|
|
235
|
-
for (const a of
|
|
235
|
+
for (const a of r.components)
|
|
236
236
|
typeof a.table?.id == "string" && o.add(a.table.id);
|
|
237
237
|
return o;
|
|
238
238
|
}
|
|
239
239
|
function v(e) {
|
|
240
240
|
return e.layout === "wide" || e.components.some((t) => t.table?.layout === "wide");
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
const n = [],
|
|
244
|
-
for (const [
|
|
245
|
-
const l = i
|
|
242
|
+
function le(e, t, o) {
|
|
243
|
+
const n = [], r = e.pages.map(oe), a = se(e, r);
|
|
244
|
+
for (const [i, s] of e.pages.entries()) {
|
|
245
|
+
const l = r[i], c = l && !a.has(l.id), h = t === "pages" || !c ? void 0 : l;
|
|
246
246
|
if (t === "continuous" && !h)
|
|
247
|
-
throw new Error(`page ${
|
|
247
|
+
throw new Error(`page ${i + 1}: continuous Excel 需要完整、单一的逻辑表来源;自由布局请使用 sheetMode: 'pages'`);
|
|
248
248
|
const f = h !== void 0 && (t === "continuous" || h.wide);
|
|
249
|
-
!f && t !== "pages" && v(s) && o.push(`page ${
|
|
250
|
-
const
|
|
251
|
-
f &&
|
|
249
|
+
!f && t !== "pages" && v(s) && o.push(`page ${i + 1}: 混合或缺少逻辑表来源,已保留独立 Sheet,未猜测合并内容`);
|
|
250
|
+
const u = n[n.length - 1];
|
|
251
|
+
f && u?.continuous && u.tableId === h.id ? u.pages.push({ page: s, index: i }) : n.push({ pages: [{ page: s, index: i }], continuous: f, ...f ? { tableId: h.id, title: h.title } : {}, ...l?.flow ? { flow: !0, title: l.title } : {} });
|
|
252
252
|
}
|
|
253
253
|
return n;
|
|
254
254
|
}
|
|
255
255
|
function C(e, t, o) {
|
|
256
|
-
return !e || e.length === t.length && e.every((n,
|
|
257
|
-
}
|
|
258
|
-
function
|
|
259
|
-
const
|
|
260
|
-
if (
|
|
261
|
-
throw new Error(`page ${o + 1}: 连续 Excel 逻辑表 ${
|
|
262
|
-
if (n.keys ??=
|
|
263
|
-
if (
|
|
256
|
+
return !e || e.length === t.length && e.every((n, r) => o(n, t[r]));
|
|
257
|
+
}
|
|
258
|
+
function ce(e, t, o, n) {
|
|
259
|
+
const r = e.table, a = t.columns.map((l) => l.size), i = C(n.keys, r.columnKeys, (l, c) => l === c), s = C(n.widths, a, (l, c) => Math.abs(l - c) <= 1e-3);
|
|
260
|
+
if (r.columnKeys.length !== a.length || !i || !s)
|
|
261
|
+
throw new Error(`page ${o + 1}: 连续 Excel 逻辑表 ${r.id} 的列结构或列宽不一致`);
|
|
262
|
+
if (n.keys ??= r.columnKeys, n.widths ??= a, r.role === "header") {
|
|
263
|
+
if (r.rowIndex !== -1) throw new Error(`page ${o + 1}: 连续 Excel 表头 rowIndex 必须为 -1`);
|
|
264
264
|
n.headerSeen = !0;
|
|
265
265
|
} else {
|
|
266
|
-
if (!["body", "group-header", "subtotal", "grand-total"].includes(
|
|
266
|
+
if (!["body", "group-header", "subtotal", "grand-total"].includes(r.role) || r.rowIndex !== n.expectedRow)
|
|
267
267
|
throw new Error(`page ${o + 1}: 连续 Excel 逻辑行来源不连续或重复(期望 ${n.expectedRow})`);
|
|
268
268
|
n.expectedRow += t.rows.length;
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function he(e, t) {
|
|
272
272
|
const o = { expectedRow: 0, headerSeen: !1 };
|
|
273
|
-
for (const { page: n, index:
|
|
273
|
+
for (const { page: n, index: r } of e.pages)
|
|
274
274
|
for (const a of n.components) {
|
|
275
|
-
const
|
|
276
|
-
a.table &&
|
|
275
|
+
const i = t.get(a);
|
|
276
|
+
a.table && i && ce(a, i, r, o);
|
|
277
277
|
}
|
|
278
278
|
if (!o.headerSeen) throw new Error("连续 Excel 逻辑表缺少明确表头来源");
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function de(e, t, o) {
|
|
281
281
|
let n = (e?.replace(/[\\/*?:[\]]/g, " ").replace(/\s+/g, " ").trim() || `Sheet${t + 1}`).slice(0, 31).replace(/^'+|'+$/g, "").trim() || `Sheet${t + 1}`;
|
|
282
282
|
n.toLowerCase() === "history" && (n += " 报表");
|
|
283
|
-
let
|
|
284
|
-
for (; o.has(
|
|
285
|
-
const
|
|
286
|
-
|
|
283
|
+
let r = n, a = 1;
|
|
284
|
+
for (; o.has(r.toLowerCase()); ) {
|
|
285
|
+
const i = ` (${++a})`;
|
|
286
|
+
r = n.slice(0, 31 - i.length) + i;
|
|
287
287
|
}
|
|
288
|
-
return o.add(
|
|
288
|
+
return o.add(r.toLowerCase()), r;
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function fe(e) {
|
|
291
291
|
const t = /* @__PURE__ */ new Set();
|
|
292
|
-
function o(n,
|
|
293
|
-
return n <=
|
|
292
|
+
function o(n, r, a, i) {
|
|
293
|
+
return n <= r ? n : (t.has(a) || (e.push(i), t.add(a)), r);
|
|
294
294
|
}
|
|
295
295
|
return {
|
|
296
296
|
column: (n) => o(n, 255, "column", "Excel 单列宽度上限为 255 字符,超宽列已收敛至 255;单元格值完整保留,显示范围可能受限"),
|
|
297
297
|
row: (n) => o(n, 409, "row", "Excel 行高上限为 409pt,超高行已收敛至 409pt;单元格值完整保留,显示范围可能受限")
|
|
298
298
|
};
|
|
299
299
|
}
|
|
300
|
-
async function
|
|
301
|
-
const o = e.flow ?
|
|
302
|
-
let
|
|
303
|
-
for (const { comp:
|
|
304
|
-
if (
|
|
305
|
-
const s = A(
|
|
306
|
-
n.set(
|
|
300
|
+
async function ge(e, t) {
|
|
301
|
+
const o = e.flow ? ee(e.pages, e.continuous).map((i) => ({ comp: i, pageIndex: e.pages[0].index })) : e.pages.flatMap(({ page: i, index: s }, l) => i.components.filter((c) => !e.continuous || (c.pageAnchor !== "header" || l === 0) && (c.pageAnchor !== "footer" || l === e.pages.length - 1)).map((c) => ({ comp: c, pageIndex: s }))), n = /* @__PURE__ */ new Map();
|
|
302
|
+
let r = 1, a = 0;
|
|
303
|
+
for (const { comp: i } of o)
|
|
304
|
+
if (i.grid) {
|
|
305
|
+
const s = A(i.grid, i.widthMm, i.heightMm);
|
|
306
|
+
n.set(i, s), r = Math.max(r, s.columns.length);
|
|
307
307
|
const l = t(s.cells.length);
|
|
308
308
|
l && await l;
|
|
309
|
-
} else
|
|
310
|
-
if (
|
|
311
|
-
return { components: o, grids: n, columnCount:
|
|
309
|
+
} else i.kind === "text" && (a = Math.max(a, i.widthMm));
|
|
310
|
+
if (r > 16384) throw new Error("Excel 最多支持 16384 列,无法无损导出此报表");
|
|
311
|
+
return { components: o, grids: n, columnCount: r, textWidthMm: a };
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
const { page: n, index:
|
|
313
|
+
function ue(e, t, o) {
|
|
314
|
+
const { page: n, index: r } = e.pages[0], a = t !== void 0 && t !== "auto";
|
|
315
315
|
return (e.continuous || v(n)) && !a ? {} : { pageSetup: {
|
|
316
|
-
paperSize:
|
|
316
|
+
paperSize: ie(n, t, r, o),
|
|
317
317
|
orientation: n.pageWidthMm > n.pageHeightMm ? "landscape" : "portrait",
|
|
318
318
|
fitToPage: !0,
|
|
319
319
|
...e.continuous ? { fitToWidth: 1, fitToHeight: 0 } : {}
|
|
320
320
|
} };
|
|
321
321
|
}
|
|
322
|
-
function
|
|
323
|
-
const t =
|
|
322
|
+
function me(e) {
|
|
323
|
+
const t = M(e.borderColor ?? e.lineColor), o = { style: "thin", ...t ? { color: { argb: t } } : {} };
|
|
324
324
|
return {
|
|
325
325
|
...e.borderTop !== !1 ? { top: o } : {},
|
|
326
326
|
...e.borderLeft !== !1 ? { left: o } : {},
|
|
@@ -328,80 +328,80 @@ function ue(e) {
|
|
|
328
328
|
...e.borderRight !== !1 ? { right: o } : {}
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function we(e, t) {
|
|
332
332
|
e.alignment = { horizontal: t.align ?? "left", vertical: t.verticalAlign ?? "middle", wrapText: !0 };
|
|
333
|
-
const o =
|
|
334
|
-
o && (e.fill = { type: "pattern", pattern: "solid", fgColor: { argb: o } }), e.border =
|
|
333
|
+
const o = M(t.backgroundColor);
|
|
334
|
+
o && (e.fill = { type: "pattern", pattern: "solid", fgColor: { argb: o } }), e.border = me(t), I(e, t);
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function pe(e, t) {
|
|
337
337
|
for (const [o, n] of t.columns.entries()) {
|
|
338
|
-
const
|
|
339
|
-
(
|
|
338
|
+
const r = e.sheet.getColumn(o + 1), a = e.limits.column($(n.size));
|
|
339
|
+
(r.width == null || r.width < a) && (r.width = a);
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
|
-
function
|
|
343
|
-
for (const [n,
|
|
344
|
-
const a = e.sheet.getRow(o + n),
|
|
345
|
-
(a.height == null || a.height <
|
|
342
|
+
function xe(e, t, o) {
|
|
343
|
+
for (const [n, r] of t.rows.entries()) {
|
|
344
|
+
const a = e.sheet.getRow(o + n), i = e.limits.row(r.size * W);
|
|
345
|
+
(a.height == null || a.height < i) && (a.height = i);
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
|
-
function
|
|
349
|
-
const
|
|
350
|
-
(
|
|
348
|
+
function Me(e, t, o, n) {
|
|
349
|
+
const r = 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));
|
|
350
|
+
(r > 1 || a > 1) && e.mergeCells(n + t.ri, t.ci + 1, n + t.ri + a - 1, t.ci + r);
|
|
351
351
|
}
|
|
352
|
-
async function
|
|
352
|
+
async function Ee(e, t, o, n) {
|
|
353
353
|
if (n + o.rows.length - 1 > 1048576) throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");
|
|
354
|
-
|
|
355
|
-
for (const
|
|
356
|
-
const a = e.sheet.getCell(n +
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
|
|
354
|
+
xe(e, o, n);
|
|
355
|
+
for (const r of o.cells) {
|
|
356
|
+
const a = e.sheet.getCell(n + r.ri, r.ci + 1);
|
|
357
|
+
re(a, r.cell, e.valueMode, e.warnings);
|
|
358
|
+
const i = U(r.cell, t.style);
|
|
359
|
+
i && (w(i.richText.map((c) => c.text).join(""), a.address), a.value = i);
|
|
360
360
|
const s = t.grid?.paddingMm ?? 0.5;
|
|
361
|
-
for (const c of
|
|
362
|
-
S(c) && !c.grid && e.images.write(e.sheet, c, n +
|
|
363
|
-
|
|
361
|
+
for (const c of r.cell.children ?? [])
|
|
362
|
+
S(c) && !c.grid && e.images.write(e.sheet, c, n + r.ri, { leftMm: r.xMm + s + (r.cell.indentMm ?? 0) + c.leftMm, offsetMm: s + c.topMm });
|
|
363
|
+
we(a, m(t.style, r.cell.style)), r.cell.indentMm && (a.alignment = { ...a.alignment, indent: Math.min(250, Math.max(1, Math.round(r.cell.indentMm / 2.5))) }), Me(e.sheet, r, o, n);
|
|
364
364
|
const l = e.schedule();
|
|
365
365
|
l && await l;
|
|
366
366
|
}
|
|
367
367
|
return n + o.rows.length;
|
|
368
368
|
}
|
|
369
|
-
function
|
|
370
|
-
const
|
|
371
|
-
`) : t.text ?? "", a = e.sheet.getRow(o),
|
|
372
|
-
t.richParagraphs?.length ||
|
|
373
|
-
const s =
|
|
374
|
-
return s && (
|
|
369
|
+
function be(e, t, o, n) {
|
|
370
|
+
const r = Array.isArray(t.lines) && t.lines.length > 0 ? t.lines.join(`
|
|
371
|
+
`) : t.text ?? "", a = e.sheet.getRow(o), i = a.getCell(1);
|
|
372
|
+
t.richParagraphs?.length || w(r, i.address), i.value = t.richParagraphs?.length ? R(t.richParagraphs, t.style) : r, typeof i.value == "object" && i.value && "richText" in i.value && w(i.value.richText.map((l) => l.text).join(""), i.address), i.alignment = { horizontal: t.style?.align ?? "left", vertical: t.style?.verticalAlign ?? "middle", wrapText: !0 };
|
|
373
|
+
const s = M(t.style?.backgroundColor);
|
|
374
|
+
return s && (i.fill = { type: "pattern", pattern: "solid", fgColor: { argb: s } }), I(i, t.style), n > 1 && e.sheet.mergeCells(o, 1, o, n), a.height = e.limits.row(t.heightMm * W), o + 1;
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function ye(e, t, o) {
|
|
377
377
|
const n = t + o - 1;
|
|
378
378
|
e.views = [{ state: "frozen", ySplit: n, xSplit: 0 }], e.pageSetup.printTitlesRow = `1:${n}`;
|
|
379
379
|
}
|
|
380
|
-
async function
|
|
380
|
+
async function Se(e, t, o, n) {
|
|
381
381
|
!t.grids.size && t.textWidthMm > 0 && (e.sheet.getColumn(1).width = e.limits.column($(t.textWidthMm)));
|
|
382
|
-
for (const
|
|
383
|
-
|
|
384
|
-
const s = e.schedule(
|
|
382
|
+
for (const i of t.grids.values()) {
|
|
383
|
+
pe(e, i);
|
|
384
|
+
const s = e.schedule(i.columns.length);
|
|
385
385
|
s && await s;
|
|
386
386
|
}
|
|
387
|
-
let
|
|
388
|
-
for (const { comp:
|
|
389
|
-
const l = o &&
|
|
387
|
+
let r = 1, a = !1;
|
|
388
|
+
for (const { comp: i, pageIndex: s } of t.components) {
|
|
389
|
+
const l = o && i.table?.role === "header";
|
|
390
390
|
if (l && a) continue;
|
|
391
|
-
if (
|
|
392
|
-
const c = t.grids.get(
|
|
391
|
+
if (r > 1048576) throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");
|
|
392
|
+
const c = t.grids.get(i);
|
|
393
393
|
if (c)
|
|
394
|
-
l && (
|
|
395
|
-
else if (
|
|
396
|
-
|
|
397
|
-
else if (S(
|
|
398
|
-
const h =
|
|
399
|
-
h || (
|
|
394
|
+
l && (ye(e.sheet, r, c.rows.length), a = !0), r = await Ee(e, i, c, r);
|
|
395
|
+
else if (i.kind === "text")
|
|
396
|
+
r = be(e, i, r, t.columnCount);
|
|
397
|
+
else if (S(i)) {
|
|
398
|
+
const h = G(i, o), f = n.write(e.sheet, i, h?.row ?? r, h);
|
|
399
|
+
h || (r = f);
|
|
400
400
|
} else
|
|
401
|
-
e.warnings.push(`page ${s + 1} ${
|
|
401
|
+
e.warnings.push(`page ${s + 1} ${i.nid ?? i.kind}: 组件类型 ${i.kind} 暂不支持 xlsx 导出,已跳过`);
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
function
|
|
404
|
+
function ve(e) {
|
|
405
405
|
if (e.valueMode !== void 0 && e.valueMode !== "text" && e.valueMode !== "raw")
|
|
406
406
|
throw new Error("xlsx valueMode 必须是 text 或 raw");
|
|
407
407
|
if (e.paperSize !== void 0 && e.paperSize !== "auto" && !Object.prototype.hasOwnProperty.call(b, e.paperSize))
|
|
@@ -409,40 +409,42 @@ function ye(e) {
|
|
|
409
409
|
if (e.sheetMode !== void 0 && !["auto", "pages", "continuous"].includes(e.sheetMode))
|
|
410
410
|
throw new Error("xlsx sheetMode 必须是 auto、pages 或 continuous");
|
|
411
411
|
}
|
|
412
|
-
async function
|
|
413
|
-
|
|
414
|
-
const o =
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
const g =
|
|
419
|
-
|
|
420
|
-
const
|
|
421
|
-
|
|
412
|
+
async function Pe(e, t = {}) {
|
|
413
|
+
ve(t), E(t.signal);
|
|
414
|
+
const o = t.assetRegistry || t.assetRenderers ? await _(e, { ...t, format: "xlsx" }) : { plan: e, diagnostics: [] };
|
|
415
|
+
e = o.plan;
|
|
416
|
+
const n = [...o.diagnostics, ...D(e, "xlsx", t)], r = new j.Workbook(), a = [], i = V(r, t, a), s = fe(a), l = le(e, t.sheetMode, a), c = /* @__PURE__ */ new Set(), h = O(t);
|
|
417
|
+
for (const [u, d] of l.entries()) {
|
|
418
|
+
const g = await ge(d, h);
|
|
419
|
+
d.continuous && !d.flow && he(d, g.grids);
|
|
420
|
+
const p = d.pages[0].page, x = t.sheetName?.(u) ?? de(d.title, u, c);
|
|
421
|
+
c.add(x.toLowerCase());
|
|
422
|
+
const z = r.addWorksheet(x, ue(d, t.paperSize, a)), B = t.valueMode ?? (v(p) || d.continuous || d.flow ? "raw" : "text");
|
|
423
|
+
E(t.signal), await Se({ sheet: z, warnings: a, limits: s, valueMode: B, schedule: h, images: i }, g, d.continuous, i), await N(t, u + 1, l.length);
|
|
422
424
|
}
|
|
423
425
|
E(t.signal);
|
|
424
|
-
const
|
|
425
|
-
return E(t.signal), { workbook:
|
|
426
|
+
const f = await r.xlsx.writeBuffer();
|
|
427
|
+
return E(t.signal), { workbook: r, buffer: f, warnings: a, diagnostics: n };
|
|
426
428
|
}
|
|
427
429
|
export {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
430
|
+
Le as bindExcelTemplate,
|
|
431
|
+
je as createExcelBindingDocument,
|
|
432
|
+
Ge as createExcelBindingSession,
|
|
433
|
+
He as createExcelRegionBindingDocument,
|
|
434
|
+
_e as createExcelRegionBindingSession,
|
|
435
|
+
De as excelBindingCellRange,
|
|
436
|
+
Ue as excelBindingRowRange,
|
|
437
|
+
Ke as getExcelSheetWindow,
|
|
438
|
+
ze as importExcelTemplate,
|
|
439
|
+
Be as inspectExcelWorkbook,
|
|
440
|
+
Ne as openExcelWorkbook,
|
|
441
|
+
Xe as parseExcelBindingSession,
|
|
442
|
+
Je as parseExcelRegionBindingSession,
|
|
443
|
+
Pe as renderPlanToXlsx,
|
|
444
|
+
Ve as validateExcelBindingFields,
|
|
445
|
+
qe as validateExcelBindingRecipe,
|
|
446
|
+
Qe as validateExcelBindingRegions,
|
|
447
|
+
Ye as validateExcelRegionBindings,
|
|
448
|
+
Ze as validateExcelRegionFields,
|
|
449
|
+
et as validateExcelRegionGeometry
|
|
448
450
|
};
|