@agile-team/mach-report 2.19.1 → 2.21.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.
Files changed (122) hide show
  1. package/README.md +22 -3
  2. package/dist/ExcelBindingWizard-B2xXBOJu.cjs +1 -0
  3. package/dist/{ExcelBindingWizard-xJIYmnZ_.js → ExcelBindingWizard-CixTPQAL.js} +351 -351
  4. package/dist/ParamEditor-DhHlNxai.cjs +1 -0
  5. package/dist/{ParamEditor-D1wWemaf.js → ParamEditor-gKhvEsnr.js} +10 -10
  6. package/dist/{ReportBatchPanel-BkJFqeEW.cjs → ReportBatchPanel-BUdUfTdm.cjs} +1 -1
  7. package/dist/{ReportBatchPanel-B88R-fME.js → ReportBatchPanel-D-lyWKyf.js} +2 -2
  8. package/dist/ReportLabelStudio-BcjQt73a.cjs +1 -0
  9. package/dist/ReportLabelStudio-N2w6DdaZ.js +764 -0
  10. package/dist/ReportParamPanel-CVpK8mFc.cjs +1 -0
  11. package/dist/{ReportParamPanel-mQkeN70Q.js → ReportParamPanel-peB-KEmm.js} +10 -2
  12. package/dist/{ReportPreview-DBbctg6C.js → ReportPreview-BBJNlu2U.js} +2093 -1978
  13. package/dist/ReportPreview-nf4Dk1Jc.cjs +6 -0
  14. package/dist/{ReportTemplateLibrary-BOh2MgjQ.cjs → ReportTemplateLibrary-Cs9WKneQ.cjs} +1 -1
  15. package/dist/{ReportTemplateLibrary-BGELmgd3.js → ReportTemplateLibrary-WZl-AK-2.js} +1 -1
  16. package/dist/{RuleEditor-CoLqgehG.js → RuleEditor-DGpmjCko.js} +178 -174
  17. package/dist/RuleEditor-Dtcq-7LO.cjs +1 -0
  18. package/dist/{TemplateOutlinePanel-DiG8tRRe.cjs → TemplateOutlinePanel-CkCh506f.cjs} +1 -1
  19. package/dist/{TemplateOutlinePanel-DU95loB-.js → TemplateOutlinePanel-cxp95OT9.js} +1 -1
  20. package/dist/{TemplateReusePanel-DE1KSD6c.js → TemplateReusePanel-BZ8VTtrO.js} +2 -2
  21. package/dist/{TemplateReusePanel-G-Y299wc.cjs → TemplateReusePanel-CwttuSta.cjs} +1 -1
  22. package/dist/{TemplateReviewPanel-KQx9ts0D.cjs → TemplateReviewPanel-C2YjiaEC.cjs} +1 -1
  23. package/dist/{TemplateReviewPanel-vqFJ_Y9o.js → TemplateReviewPanel-C9cTvsRs.js} +1 -1
  24. package/dist/artifact-integrity.json +92 -94
  25. package/dist/{assets-2eC3mOcV.js → assets-CxHunY_9.js} +2 -2
  26. package/dist/{assets-B0Hxn4l6.cjs → assets-vbjAGgk8.cjs} +1 -1
  27. package/dist/{auto-BlchZ1b8.js → auto-BkdGiNtr.js} +4 -4
  28. package/dist/{auto-B0EZFIK1.cjs → auto-Tq7ReIC1.cjs} +1 -1
  29. package/dist/{component-tree-CvW4lzpv.js → component-tree-1_QCiQJX.js} +1 -1
  30. package/dist/component-tree-BjZIp6w9.cjs +1 -0
  31. package/dist/{data-bar-PtjXhMgN.js → data-bar-8baGYEZ9.js} +1 -1
  32. package/dist/{data-bar-Ce38juRZ.cjs → data-bar-YltqGTaC.cjs} +1 -1
  33. package/dist/designer-CDqok4S5.cjs +2 -0
  34. package/dist/designer-CIDHt5xz.js +6869 -0
  35. package/dist/designer.cjs +1 -1
  36. package/dist/designer.d.cts +166 -7
  37. package/dist/designer.d.ts +166 -7
  38. package/dist/designer.js +1 -1
  39. package/dist/{encoding-B--eZpp1.cjs → encoding-B79hW4zq.cjs} +1 -1
  40. package/dist/{encoding-mctOLocI.js → encoding-BSeUwrN7.js} +2 -2
  41. package/dist/{font-loader-DBBJ5KE9.cjs → font-loader-BB372_XN.cjs} +1 -1
  42. package/dist/{font-loader-DW8tIaNp.js → font-loader-Di0lQKFf.js} +1 -1
  43. package/dist/grid-geometry-D3SJgWFv.js +136 -0
  44. package/dist/grid-geometry-D8ReblRV.cjs +1 -0
  45. package/dist/index.cjs +6 -6
  46. package/dist/index.js +194 -195
  47. package/dist/json-snapshot-I5VI84Vp.cjs +2 -0
  48. package/dist/{json-snapshot-By4ZVVUt.js → json-snapshot-Kgn459Oj.js} +895 -879
  49. package/dist/{pdf-DqyxJ96U.cjs → pdf-CARdBcuw.cjs} +45 -45
  50. package/dist/{pdf-CKROKygt.js → pdf-DmlnL5eB.js} +13 -14
  51. package/dist/pdf.cjs +1 -1
  52. package/dist/pdf.js +2 -2
  53. package/dist/{plugin-CPyHs4UC.cjs → plugin-BaRUGORD.cjs} +1 -1
  54. package/dist/{plugin-DsXJRR6Q.js → plugin-D4kAxfLG.js} +1 -1
  55. package/dist/{prefill-D7EswyTI.cjs → prefill-Bpyn58AZ.cjs} +1 -1
  56. package/dist/{prefill-B8H9qwE4.js → prefill-CJSazcVY.js} +2 -2
  57. package/dist/{prepared-CGVphji3.cjs → prepared-BiSz_9vN.cjs} +1 -1
  58. package/dist/{prepared-BE-4jfX5.js → prepared-BwjwEzFz.js} +1 -1
  59. package/dist/{protocol-Cr81vFSQ.js → protocol-Bs9-ohHN.js} +3 -3
  60. package/dist/{protocol-ByRVzzQG.cjs → protocol-C8VWF9An.cjs} +1 -1
  61. package/dist/record-bindings-Ct1HkPrc.cjs +1 -0
  62. package/dist/{record-bindings-DEJtmo3p.js → record-bindings-VZGS-Qd8.js} +1 -1
  63. package/dist/{region-binding-workflow-CBg0l_tj.js → region-binding-workflow-Cy4GIOUo.js} +2 -2
  64. package/dist/{region-binding-workflow-D05tOYn3.cjs → region-binding-workflow-JNowHd0A.cjs} +1 -1
  65. package/dist/report-encoding-worker.cjs +1 -1
  66. package/dist/report-encoding-worker.js +1 -1
  67. package/dist/rich-text-layout-K48VHUoW.cjs +3 -0
  68. package/dist/{rich-text-layout-Ct5WrY1g.js → rich-text-layout-wxBhnAS7.js} +1 -1
  69. package/dist/{runtime-CEMvybO7.js → runtime-BDf5x1i1.js} +5 -5
  70. package/dist/runtime-DsJt1PIf.cjs +1 -0
  71. package/dist/sbom.cdx.json +1 -1
  72. package/dist/server-node.cjs +4 -4
  73. package/dist/server-node.js +1272 -1274
  74. package/dist/server.cjs +1 -1
  75. package/dist/server.js +8 -8
  76. package/dist/style.css +1 -1
  77. package/dist/{template-catalog-CmbWOJqy.js → template-catalog-DFwIS9aN.js} +3 -3
  78. package/dist/{template-catalog-Utu4GP09.cjs → template-catalog-D_2jdnkL.cjs} +1 -1
  79. package/dist/template-fragments-DZVUBhuB.cjs +1 -0
  80. package/dist/{template-fragments-DWgo9tlZ.js → template-fragments-Dng-AlHk.js} +11 -11
  81. package/dist/{template-registry-BIhIHOab.js → template-registry-DhBqoD7W.js} +120 -118
  82. package/dist/template-registry-DpLUSLwF.cjs +1 -0
  83. package/dist/{column-visual-BpgQVWwT.js → template-serialization-Cc3h-miv.js} +74 -65
  84. package/dist/{column-visual-CtYxnBCP.cjs → template-serialization-D1R5oAqh.cjs} +1 -1
  85. package/dist/{textwrap-BEIg2w8y.js → textwrap-CkGjRFT3.js} +1 -1
  86. package/dist/textwrap-OTOUMr4f.cjs +4 -0
  87. package/dist/vue/async.d.cts +8 -0
  88. package/dist/vue/async.d.ts +8 -0
  89. package/dist/vue/index.d.cts +10 -2
  90. package/dist/vue/index.d.ts +10 -2
  91. package/dist/vue-async.cjs +1 -1
  92. package/dist/vue-async.js +3 -3
  93. package/dist/vue.cjs +1 -1
  94. package/dist/vue.js +6 -6
  95. package/dist/{workbook-session-B94EwVa_.cjs → workbook-session-NYv01LHe.cjs} +1 -1
  96. package/dist/{workbook-session-BoScoOg-.js → workbook-session-oinxX3qo.js} +2 -2
  97. package/dist/worker.cjs +1 -1
  98. package/dist/worker.js +4 -4
  99. package/dist/xlsx.cjs +4 -4
  100. package/dist/xlsx.js +204 -205
  101. package/package.json +1 -1
  102. package/dist/ExcelBindingWizard-UHSApSG9.cjs +0 -1
  103. package/dist/ParamEditor-BZb-okUd.cjs +0 -1
  104. package/dist/ReportLabelStudio-B4WZ2XNN.js +0 -239
  105. package/dist/ReportLabelStudio-BN-fYNCr.cjs +0 -1
  106. package/dist/ReportParamPanel-sOANVRz-.cjs +0 -1
  107. package/dist/ReportPreview-CuoHl15N.cjs +0 -6
  108. package/dist/RuleEditor-XaLcCdTb.cjs +0 -1
  109. package/dist/component-tree-6TV7W6Yj.cjs +0 -1
  110. package/dist/designer-CyKXBhQg.cjs +0 -2
  111. package/dist/designer-fVvpYg8H.js +0 -5824
  112. package/dist/grid-geometry-BNptEcMm.js +0 -65
  113. package/dist/grid-geometry-CZ_cYB6O.cjs +0 -1
  114. package/dist/json-snapshot-jiXff4lc.cjs +0 -2
  115. package/dist/record-bindings-ehjnCDHt.cjs +0 -1
  116. package/dist/rich-text-layout-ALlMoYOG.cjs +0 -3
  117. package/dist/runtime-CDA6d263.cjs +0 -1
  118. package/dist/style-67OqfNed.js +0 -73
  119. package/dist/style-C22Pbv3T.cjs +0 -1
  120. package/dist/template-fragments-C_zSHJAa.cjs +0 -1
  121. package/dist/template-registry-DzWswQI5.cjs +0 -1
  122. package/dist/textwrap-BI-yJ6Wt.cjs +0 -4
package/dist/xlsx.js CHANGED
@@ -1,111 +1,110 @@
1
1
  import { c as B, b as E, o as L } from "./progress-Hc2vxoCs.js";
2
2
  import { e as j } from "./index-CPh6tqge.js";
3
- import { d as G } from "./data-bar-PtjXhMgN.js";
4
- import { f as w, r as $ } from "./style-67OqfNed.js";
5
- import { e as H, E as _, m as A, i as U } from "./workbook-session-BoScoOg-.js";
6
- import { a as _e, b as Ue, o as Xe } from "./workbook-session-BoScoOg-.js";
7
- import { i as S } from "./component-tree-CvW4lzpv.js";
3
+ import { d as G } from "./data-bar-8baGYEZ9.js";
4
+ import { g as w, a as $, r as A } from "./grid-geometry-D3SJgWFv.js";
5
+ import { e as H, E as _, m as F, i as U } from "./workbook-session-oinxX3qo.js";
6
+ import { a as He, b as _e, o as Ue } from "./workbook-session-oinxX3qo.js";
7
+ import { i as S } from "./component-tree-1_QCiQJX.js";
8
8
  import { c as X } from "./media-Y90dHK9z.js";
9
- import { r as F } from "./grid-geometry-BNptEcMm.js";
10
- import { a as K, r as J } from "./assets-2eC3mOcV.js";
11
- import { b as Je, c as Ve, a as qe, d as Qe, e as Ye, f as Ze, g as et, h as tt, p as rt, i as nt, v as it, j as ot, k as at, l as st, m as lt, n as ct } from "./region-binding-workflow-CBg0l_tj.js";
9
+ import { a as K, r as J } from "./assets-CxHunY_9.js";
10
+ import { b as Ke, c as Je, a as Ve, d as qe, e as Qe, f as Ye, g as Ze, h as et, p as tt, i as nt, v as rt, j as it, k as ot, l as at, m as st, n as lt } from "./region-binding-workflow-Cy4GIOUo.js";
12
11
  function V(e) {
13
12
  const t = j({ 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
15
  function q(e, t, o) {
17
- const r = /* @__PURE__ */ new Map();
16
+ const n = /* @__PURE__ */ new Map();
18
17
  let i = 0;
19
- return (a, n, s, l) => {
20
- const c = G(n.cell.dataBar, n.widthMm, n.heightMm, l);
18
+ return (a, r, s, l) => {
19
+ const c = G(r.cell.dataBar, r.widthMm, r.heightMm, l);
21
20
  if (!c) return;
22
21
  if (++i > t) throw new Error(`Excel 数据条超过 ${t} 个绘图预算,请缩小范围或调整 maxDataBars`);
23
- let h = r.get(c.color);
24
- h || (h = V(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 });
22
+ let h = n.get(c.color);
23
+ h || (h = V(c.color), n.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: r.xMm + c.x, offsetMm: c.y });
25
24
  };
26
25
  }
27
26
  async function Q(e, t, o) {
28
- const r = e.pages.flatMap((n) => n.components), i = B(o);
27
+ const n = e.pages.flatMap((r) => r.components), i = B(o);
29
28
  let a = 0;
30
- for (; r.length; ) {
31
- const n = r.pop();
32
- for (const s of n.grid?.cells ?? []) for (const l of s) {
29
+ for (; n.length; ) {
30
+ const r = n.pop();
31
+ for (const s of r.grid?.cells ?? []) for (const l of s) {
33
32
  if (l?.dataBar && l.dataBar.end > l.dataBar.start && ++a > t) throw new Error(`Excel 数据条超过 ${t} 个绘图预算,请缩小范围或调整 maxDataBars`);
34
- l?.children && r.push(...l.children);
33
+ l?.children && n.push(...l.children);
35
34
  const c = i();
36
35
  c && await c;
37
36
  }
38
37
  }
39
38
  }
40
39
  function P(e, t) {
41
- return { richText: e.flatMap((o, r) => [
42
- ...r ? [{ text: `
40
+ return { richText: e.flatMap((o, n) => [
41
+ ...n ? [{ text: `
43
42
  ` }] : [],
44
43
  ...o.segments.map((i) => {
45
- const a = w(t, i.style), n = a.color?.replace(/^#/, "");
46
- return { text: i.kind === "field" ? i.field ?? "" : i.text ?? "", font: { name: a.fontFamily, bold: a.bold, italic: a.italic, underline: a.underline, size: $(a).fontSizePt, .../^[a-f\d]{6}$/i.test(n ?? "") ? { color: { argb: `FF${n.toUpperCase()}` } } : {} } };
44
+ const a = w(t, i.style), r = 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: $(a).fontSizePt, .../^[a-f\d]{6}$/i.test(r ?? "") ? { color: { argb: `FF${r.toUpperCase()}` } } : {} } };
47
46
  })
48
47
  ]) };
49
48
  }
50
49
  function Y(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 = w(t, e.style), i = e.richParagraphs?.length ? [...e.richParagraphs] : e.text ? [{ segments: [{ text: e.text }] }] : [];
52
+ const n = w(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 = w(r, a.style), s = a.richParagraphs?.length ? a.richParagraphs : [{ segments: [{ text: a.lines?.join(`
54
+ const r = w(n, 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: w(n, c.style) })) });
56
+ for (const l of s) i.push({ ...l, segments: l.segments.map((c) => ({ ...c, style: w(r, c.style) })) });
58
57
  }
59
- return P(i, r);
58
+ return P(i, n);
60
59
  }
61
60
  function Z(e, t, o) {
62
- let r = o * 72 / 25.4;
63
- if (!Number.isFinite(r) || t + Math.ceil(r / 409) - 1 > 1048576) throw new Error("Excel 图片占位超过工作表行数上限");
64
- for (; r > 0; ) {
61
+ let n = o * 72 / 25.4;
62
+ if (!Number.isFinite(n) || t + Math.ceil(n / 409) - 1 > 1048576) throw new Error("Excel 图片占位超过工作表行数上限");
63
+ for (; n > 0; ) {
65
64
  if (t > 1048576) throw new Error("Excel 图片占位超过工作表行数上限");
66
- const i = Math.min(409, r);
67
- e.getRow(t++).height = i, r -= i;
65
+ const i = Math.min(409, n);
66
+ e.getRow(t++).height = i, n -= i;
68
67
  }
69
68
  return t;
70
69
  }
71
70
  function ee(e, t, o) {
72
- let r = Math.round(t * 36e3), i = 0;
73
- if (!Number.isSafeInteger(r)) throw new Error("Excel 图片锚点超出安全坐标范围");
71
+ let n = Math.round(t * 36e3), i = 0;
72
+ if (!Number.isSafeInteger(n)) 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(H(a) * 36e3);
76
- if (!Number.isSafeInteger(n) || n <= 0) throw new Error("Excel 图片锚点所在列宽无效");
77
- if (r < n) return { col: i + r / n, row: o - 1, nativeCol: i, nativeColOff: r, nativeRow: o - 1, nativeRowOff: 0 };
78
- r -= n, i++;
74
+ const a = e.getColumn(i + 1).width ?? e.properties.defaultColWidth, r = Math.round(H(a) * 36e3);
75
+ if (!Number.isSafeInteger(r) || r <= 0) throw new Error("Excel 图片锚点所在列宽无效");
76
+ if (n < r) return { col: i + n / r, row: o - 1, nativeCol: i, nativeColOff: n, nativeRow: o - 1, nativeRowOff: 0 };
77
+ n -= r, i++;
79
78
  }
80
79
  throw new Error("Excel 图片锚点超过16384列上限");
81
80
  }
82
81
  function te(e, t, o) {
83
- let r = o * 72 / 25.4;
84
- if (!Number.isFinite(r) || Math.abs(r) > 1048576 * 409) throw new Error("Excel 图片纵向偏移超过工作表范围");
82
+ let n = o * 72 / 25.4;
83
+ if (!Number.isFinite(n) || Math.abs(n) > 1048576 * 409) throw new Error("Excel 图片纵向偏移超过工作表范围");
85
84
  const i = (a) => {
86
- const n = e.getRow(a).height ?? e.properties.defaultRowHeight ?? 15;
87
- if (!Number.isFinite(n) || n <= 0) throw new Error("Excel 图片锚点所在行高无效");
88
- return n;
85
+ const r = e.getRow(a).height ?? e.properties.defaultRowHeight ?? 15;
86
+ if (!Number.isFinite(r) || r <= 0) throw new Error("Excel 图片锚点所在行高无效");
87
+ return r;
89
88
  };
90
- for (; r < 0 && t > 1; ) r += i(--t);
91
- for (; t <= 1048576 && r >= i(t); ) r -= i(t++);
92
- if (t > 1048576 || r < 0) throw new Error("Excel 图片移动到工作表边界之外");
93
- return { nativeRow: t - 1, nativeRowOff: Math.round(r * 25.4 / 72 * 36e3) };
94
- }
95
- function re(e, t, o) {
96
- const r = X(t), i = /* @__PURE__ */ new Map();
97
- return { write(a, n, s, l) {
98
- if (![n.widthMm, n.heightMm, n.leftMm].every(Number.isFinite) || n.widthMm < 0 || n.heightMm < 0 || n.leftMm < 0) throw new Error("Excel 图片尺寸无效");
99
- if (!n.widthMm || !n.heightMm) return s;
100
- if (!n.imageData || !/^data:image\/(png|jpe?g);base64,/i.test(n.imageData))
101
- return o.push(`${n.nid ?? n.kind}: Excel 图片仅支持 PNG/JPEG data URI,已跳过`), s;
102
- const c = r(n.imageData);
89
+ for (; n < 0 && t > 1; ) n += i(--t);
90
+ for (; t <= 1048576 && n >= i(t); ) n -= i(t++);
91
+ if (t > 1048576 || n < 0) throw new Error("Excel 图片移动到工作表边界之外");
92
+ return { nativeRow: t - 1, nativeRowOff: Math.round(n * 25.4 / 72 * 36e3) };
93
+ }
94
+ function ne(e, t, o) {
95
+ const n = X(t), i = /* @__PURE__ */ new Map();
96
+ return { write(a, r, s, l) {
97
+ if (![r.widthMm, r.heightMm, r.leftMm].every(Number.isFinite) || r.widthMm < 0 || r.heightMm < 0 || r.leftMm < 0) throw new Error("Excel 图片尺寸无效");
98
+ if (!r.widthMm || !r.heightMm) return s;
99
+ if (!r.imageData || !/^data:image\/(png|jpe?g);base64,/i.test(r.imageData))
100
+ return o.push(`${r.nid ?? r.kind}: Excel 图片仅支持 PNG/JPEG data URI,已跳过`), s;
101
+ const c = n(r.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 : Z(a, s, n.heightMm);
104
+ const d = l ? s : Z(a, s, r.heightMm);
106
105
  return a.addImage(h, {
107
- tl: { ...ee(a, l?.leftMm ?? n.leftMm, s), ...l ? te(a, s, l.offsetMm) : {} },
108
- ext: { width: n.widthMm * 96 / 25.4, height: n.heightMm * 96 / 25.4 },
106
+ tl: { ...ee(a, l?.leftMm ?? r.leftMm, s), ...l ? te(a, s, l.offsetMm) : {} },
107
+ ext: { width: r.widthMm * 96 / 25.4, height: r.heightMm * 96 / 25.4 },
109
108
  editAs: "oneCell"
110
109
  }), d;
111
110
  } };
@@ -118,26 +117,26 @@ function I(e, t) {
118
117
  if (o === void 0) return;
119
118
  if (!R(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
- const r = o, i = e.grid.colWidthsMm;
122
- 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
- return r;
120
+ const n = o, i = e.grid.colWidthsMm;
121
+ if (!i?.length || n.columnStart + i.length > t.length || i.some((a, r) => Math.abs(a - t[n.columnStart + r]) > 1e-3)) throw new Error("Excel 多区域列位置与网格列宽不一致");
122
+ return n;
124
123
  }
125
124
  function T(e) {
126
125
  const t = e.meta?.xlsxFlow;
127
126
  if (t === void 0) {
128
- if (e.components.some((r) => r.meta?.xlsxFlow !== void 0)) throw new Error("Excel 多区域页面缺少完整列几何标记");
127
+ if (e.components.some((n) => n.meta?.xlsxFlow !== void 0)) throw new Error("Excel 多区域页面缺少完整列几何标记");
129
128
  return;
130
129
  }
131
- const o = ne(t, e.meta?.reportScope);
132
- for (const r of e.components) {
133
- const i = I(r, o.widths);
130
+ const o = re(t, e.meta?.reportScope);
131
+ for (const n of e.components) {
132
+ const i = I(n, o.widths);
134
133
  if (!i) throw new Error("Excel 多区域页面混入没有区域几何的组件,请使用独立页面模板");
135
- 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
- if (Math.abs(a - r.leftMm) > 0.01 || Math.abs(n - r.widthMm) > 0.01) throw new Error("Excel 多区域标记与真实横向位置不一致");
134
+ const a = o.widths.slice(0, i.columnStart).reduce((s, l) => s + l, e.marginLeftMm ?? 0), r = n.grid.colWidthsMm.reduce((s, l) => s + l, 0);
135
+ if (Math.abs(a - n.leftMm) > 0.01 || Math.abs(r - n.widthMm) > 0.01) throw new Error("Excel 多区域标记与真实横向位置不一致");
137
136
  }
138
137
  return o;
139
138
  }
140
- function ne(e, t) {
139
+ function re(e, t) {
141
140
  if (!R(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 多区域报表命名空间无效");
@@ -146,52 +145,52 @@ function ne(e, t) {
146
145
  function y(e) {
147
146
  return Math.round(e * 1e6) / 1e6;
148
147
  }
149
- function ie(e, t, o, r, i) {
150
- 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);
148
+ function ie(e, t, o, n, i) {
149
+ return e.components.filter((a) => n ? 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 oe(e, t, o, r) {
153
- 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
- return t.map((n) => {
155
- 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: F(n.grid, n.widthMm, n.heightMm), top: s, column: I(n, r).columnStart };
151
+ function oe(e, t, o, n) {
152
+ const i = e.components.filter((r) => !t.includes(r) && r.table?.role === "header"), a = t.filter((r) => !r.pageAnchor).reduce((r, s) => Math.max(r, s.topMm + s.heightMm), e.marginTopMm ?? 0);
153
+ return t.map((r) => {
154
+ let s = r.topMm;
155
+ return o && r.pageAnchor === "footer" && (s = a), s -= i.filter((l) => l.topMm + l.heightMm <= s + 1e-3).reduce((l, c) => l + c.heightMm, 0), { component: r, layout: A(r.grid, r.widthMm, r.heightMm), top: s, column: I(r, n).columnStart };
157
156
  });
158
157
  }
159
158
  function ae(e, t, o) {
160
- const r = t.length - 1;
161
- if (r * o.length > 1e6) throw new Error("Excel 多区域单页超过 100 万几何单元格,请减小预览分页高度或列数");
162
- const i = new Map(t.map((s, l) => [s, l])), a = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
159
+ const n = t.length - 1;
160
+ if (n * o.length > 1e6) throw new Error("Excel 多区域单页超过 100 万几何单元格,请减小预览分页高度或列数");
161
+ const i = new Map(t.map((s, l) => [s, l])), a = /* @__PURE__ */ new Map(), r = /* @__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
164
  const c = i.get(y(s.top + l.yMm)), h = i.get(y(s.top + l.yMm + l.heightMm)), d = s.column + l.ci, u = d + (l.cell.colSpan ?? 1), f = `${c}:${d}`;
166
165
  for (let g = c; g < h; g++) for (let m = d; m < u; m++) {
167
166
  const x = `${g}:${m}`;
168
- if (n.has(x)) throw new Error("Excel 多区域实际单元格互相覆盖,已终止输出,未覆盖已有内容");
169
- n.set(x, f);
167
+ if (r.has(x)) throw new Error("Excel 多区域实际单元格互相覆盖,已终止输出,未覆盖已有内容");
168
+ r.set(x, f);
170
169
  }
171
170
  a.set(f, { ...l.cell, style: w(s.component.style, l.cell.style), rowSpan: h - c, colSpan: u - d });
172
171
  }
173
- return Array.from({ length: r }, (s, l) => {
172
+ return Array.from({ length: n }, (s, l) => {
174
173
  const c = [];
175
174
  for (let h = 0; h < o.length; h++) {
176
175
  const d = `${l}:${h}`, u = a.get(d);
177
- u ? (c.push(u), h += (u.colSpan ?? 1) - 1) : n.has(d) || c.push(null);
176
+ u ? (c.push(u), h += (u.colSpan ?? 1) - 1) : r.has(d) || c.push(null);
178
177
  }
179
178
  return c;
180
179
  });
181
180
  }
182
181
  function se(e, t) {
183
- const o = /* @__PURE__ */ new Set(), r = [];
182
+ const o = /* @__PURE__ */ new Set(), n = [];
184
183
  let i;
185
- for (const [a, { page: n }] of e.entries()) {
186
- const s = T(n);
184
+ for (const [a, { page: r }] of e.entries()) {
185
+ const s = T(r);
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 = ie(n, a, e.length, t, o), c = oe(n, l, t, s.widths);
188
+ const l = ie(r, a, e.length, t, o), c = oe(r, l, t, s.widths);
190
189
  if (!c.length) continue;
191
190
  const h = [...new Set(c.flatMap((f) => [...f.layout.rows.map((g) => y(f.top + g.pos)), y(f.top + f.component.heightMm)]))].sort((f, g) => f - g), d = ae(c, h, s.widths), u = h.slice(1).map((f, g) => f - h[g]);
192
- 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 } });
191
+ n.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
- return r;
193
+ return n;
195
194
  }
196
195
  const W = 72 / 25.4, le = 32767, ce = 253;
197
196
  function p(e, t) {
@@ -199,8 +198,8 @@ function p(e, t) {
199
198
  if (e.length > le)
200
199
  throw new Error(`Excel 单元格 ${t} 最多支持 32767 个字符,无法无损导出;内容未裁剪`);
201
200
  let o = 0;
202
- for (let r = 0; r < e.length; r++)
203
- if (e.charCodeAt(r) === 10 && ++o > ce)
201
+ for (let n = 0; n < e.length; n++)
202
+ if (e.charCodeAt(n) === 10 && ++o > ce)
204
203
  throw new Error(`Excel 单元格 ${t} 最多支持 253 个换行,无法无损导出;内容未改写`);
205
204
  }
206
205
  function M(e) {
@@ -223,12 +222,12 @@ const b = {
223
222
  a4: { width: 210, height: 297, code: 9 },
224
223
  a5: { width: 148, height: 210, code: 11 }
225
224
  };
226
- function he(e, t, o, r) {
225
+ function he(e, t, o, n) {
227
226
  if (t && t !== "auto") return b[t].code;
228
- const i = Math.min(e.pageWidthMm, e.pageHeightMm), a = Math.max(e.pageWidthMm, e.pageHeightMm), n = Object.values(b).find((s) => Math.abs(i - s.width) <= 1 && Math.abs(a - s.height) <= 1);
229
- return n ? n.code : (r.push(`page ${o + 1}: 自定义纸张 ${e.pageWidthMm}×${e.pageHeightMm}mm 无对应 Excel 纸型,打印设置回退 A4;可显式配置 paperSize`), b.a4.code);
227
+ const i = Math.min(e.pageWidthMm, e.pageHeightMm), a = Math.max(e.pageWidthMm, e.pageHeightMm), r = Object.values(b).find((s) => Math.abs(i - s.width) <= 1 && Math.abs(a - s.height) <= 1);
228
+ return r ? r.code : (n.push(`page ${o + 1}: 自定义纸张 ${e.pageWidthMm}×${e.pageHeightMm}mm 无对应 Excel 纸型,打印设置回退 A4;可显式配置 paperSize`), b.a4.code);
230
229
  }
231
- function de(e, t, o, r) {
230
+ function de(e, t, o, n) {
232
231
  const i = typeof t.text == "string" ? t.text : "";
233
232
  if (o !== "raw" || !Object.prototype.hasOwnProperty.call(t, "value")) {
234
233
  p(i, e.address), e.value = i;
@@ -239,29 +238,29 @@ function de(e, t, o, r) {
239
238
  p(a, e.address), e.value = a, t.numberFormat && (e.numFmt = t.numberFormat);
240
239
  return;
241
240
  }
242
- p(i, e.address), e.value = i, r.push(`原始单元格值无效,已保留显示文本:${e.address}`);
241
+ p(i, e.address), e.value = i, n.push(`原始单元格值无效,已保留显示文本:${e.address}`);
243
242
  }
244
243
  function fe(e) {
245
244
  const t = T(e);
246
245
  return t ? { id: `xlsx-flow:${t.key}`, title: t.sheet, wide: !0, flow: !0 } : ge(e);
247
246
  }
248
247
  function ge(e) {
249
- const o = e.components.filter((r) => r.table !== void 0)[0]?.table;
248
+ const o = e.components.filter((n) => n.table !== void 0)[0]?.table;
250
249
  if (!(!o || typeof o.id != "string" || !o.id.trim() || !Array.isArray(o.columnKeys) || !o.columnKeys.length)) {
251
- for (const r of e.components) {
252
- if (r.table) {
253
- if (!r.grid || r.table.id !== o.id) return;
250
+ for (const n of e.components) {
251
+ if (n.table) {
252
+ if (!n.grid || n.table.id !== o.id) return;
254
253
  continue;
255
254
  }
256
- if (r.grid || r.kind !== "text" && !S(r)) return;
255
+ if (n.grid || n.kind !== "text" && !S(n)) return;
257
256
  }
258
257
  return { id: o.id, title: o.title, wide: o.layout === "wide" || e.layout === "wide" };
259
258
  }
260
259
  }
261
260
  function ue(e, t) {
262
261
  const o = /* @__PURE__ */ new Set();
263
- for (const [r, i] of e.pages.entries())
264
- if (!t[r])
262
+ for (const [n, i] of e.pages.entries())
263
+ if (!t[n])
265
264
  for (const a of i.components)
266
265
  typeof a.table?.id == "string" && o.add(a.table.id);
267
266
  return o;
@@ -270,81 +269,81 @@ function v(e) {
270
269
  return e.layout === "wide" || e.components.some((t) => t.table?.layout === "wide");
271
270
  }
272
271
  function me(e, t, o) {
273
- const r = [], i = e.pages.map(fe), a = ue(e, i);
274
- for (const [n, s] of e.pages.entries()) {
275
- const l = i[n], c = l && !a.has(l.id), h = t === "pages" || !c ? void 0 : l;
272
+ const n = [], i = e.pages.map(fe), a = ue(e, i);
273
+ for (const [r, s] of e.pages.entries()) {
274
+ const l = i[r], c = l && !a.has(l.id), h = t === "pages" || !c ? void 0 : l;
276
275
  if (t === "continuous" && !h)
277
- throw new Error(`page ${n + 1}: continuous Excel 需要完整、单一的逻辑表来源;自由布局请使用 sheetMode: 'pages'`);
276
+ throw new Error(`page ${r + 1}: continuous Excel 需要完整、单一的逻辑表来源;自由布局请使用 sheetMode: 'pages'`);
278
277
  const d = h !== void 0 && (t === "continuous" || h.wide);
279
- !d && t !== "pages" && v(s) && o.push(`page ${n + 1}: 混合或缺少逻辑表来源,已保留独立 Sheet,未猜测合并内容`);
280
- const u = r[r.length - 1];
281
- 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 } : {} });
278
+ !d && t !== "pages" && v(s) && o.push(`page ${r + 1}: 混合或缺少逻辑表来源,已保留独立 Sheet,未猜测合并内容`);
279
+ const u = n[n.length - 1];
280
+ d && u?.continuous && u.tableId === h.id ? u.pages.push({ page: s, index: r }) : n.push({ pages: [{ page: s, index: r }], continuous: d, ...d ? { tableId: h.id, title: h.title } : {}, ...l?.flow ? { flow: !0, title: l.title } : {} });
282
281
  }
283
- return r;
282
+ return n;
284
283
  }
285
284
  function k(e, t, o) {
286
- return !e || e.length === t.length && e.every((r, i) => o(r, t[i]));
285
+ return !e || e.length === t.length && e.every((n, i) => o(n, t[i]));
287
286
  }
288
- function we(e, t, o, r) {
289
- const i = e.table, a = t.columns.map((l) => l.size), n = k(r.keys, i.columnKeys, (l, c) => l === c), s = k(r.widths, a, (l, c) => Math.abs(l - c) <= 1e-3);
290
- if (i.columnKeys.length !== a.length || !n || !s)
287
+ function we(e, t, o, n) {
288
+ const i = e.table, a = t.columns.map((l) => l.size), r = k(n.keys, i.columnKeys, (l, c) => l === c), s = k(n.widths, a, (l, c) => Math.abs(l - c) <= 1e-3);
289
+ if (i.columnKeys.length !== a.length || !r || !s)
291
290
  throw new Error(`page ${o + 1}: 连续 Excel 逻辑表 ${i.id} 的列结构或列宽不一致`);
292
- if (r.keys ??= i.columnKeys, r.widths ??= a, i.role === "header") {
291
+ if (n.keys ??= i.columnKeys, n.widths ??= a, i.role === "header") {
293
292
  if (i.rowIndex !== -1) throw new Error(`page ${o + 1}: 连续 Excel 表头 rowIndex 必须为 -1`);
294
- r.headerSeen = !0;
293
+ n.headerSeen = !0;
295
294
  } else {
296
- if (!["body", "group-header", "subtotal", "grand-total"].includes(i.role) || i.rowIndex !== r.expectedRow)
297
- throw new Error(`page ${o + 1}: 连续 Excel 逻辑行来源不连续或重复(期望 ${r.expectedRow})`);
298
- r.expectedRow += t.rows.length;
295
+ if (!["body", "group-header", "subtotal", "grand-total"].includes(i.role) || i.rowIndex !== n.expectedRow)
296
+ throw new Error(`page ${o + 1}: 连续 Excel 逻辑行来源不连续或重复(期望 ${n.expectedRow})`);
297
+ n.expectedRow += t.rows.length;
299
298
  }
300
299
  }
301
300
  function pe(e, t) {
302
301
  const o = { expectedRow: 0, headerSeen: !1 };
303
- for (const { page: r, index: i } of e.pages)
304
- for (const a of r.components) {
305
- const n = t.get(a);
306
- a.table && n && we(a, n, i, o);
302
+ for (const { page: n, index: i } of e.pages)
303
+ for (const a of n.components) {
304
+ const r = t.get(a);
305
+ a.table && r && we(a, r, i, o);
307
306
  }
308
307
  if (!o.headerSeen) throw new Error("连续 Excel 逻辑表缺少明确表头来源");
309
308
  }
310
309
  function xe(e, t, o) {
311
- let r = (e?.replace(/[\\/*?:[\]]/g, " ").replace(/\s+/g, " ").trim() || `Sheet${t + 1}`).slice(0, 31).replace(/^'+|'+$/g, "").trim() || `Sheet${t + 1}`;
312
- r.toLowerCase() === "history" && (r += " 报表");
313
- let i = r, a = 1;
310
+ let n = (e?.replace(/[\\/*?:[\]]/g, " ").replace(/\s+/g, " ").trim() || `Sheet${t + 1}`).slice(0, 31).replace(/^'+|'+$/g, "").trim() || `Sheet${t + 1}`;
311
+ n.toLowerCase() === "history" && (n += " 报表");
312
+ let i = n, a = 1;
314
313
  for (; o.has(i.toLowerCase()); ) {
315
- const n = ` (${++a})`;
316
- i = r.slice(0, 31 - n.length) + n;
314
+ const r = ` (${++a})`;
315
+ i = n.slice(0, 31 - r.length) + r;
317
316
  }
318
317
  return o.add(i.toLowerCase()), i;
319
318
  }
320
319
  function Me(e) {
321
320
  const t = /* @__PURE__ */ new Set();
322
- function o(r, i, a, n) {
323
- return r <= i ? r : (t.has(a) || (e.push(n), t.add(a)), i);
321
+ function o(n, i, a, r) {
322
+ return n <= i ? n : (t.has(a) || (e.push(r), t.add(a)), i);
324
323
  }
325
324
  return {
326
- column: (r) => o(r, 255, "column", "Excel 单列宽度上限为 255 字符,超宽列已收敛至 255;单元格值完整保留,显示范围可能受限"),
327
- row: (r) => o(r, 409, "row", "Excel 行高上限为 409pt,超高行已收敛至 409pt;单元格值完整保留,显示范围可能受限")
325
+ column: (n) => o(n, 255, "column", "Excel 单列宽度上限为 255 字符,超宽列已收敛至 255;单元格值完整保留,显示范围可能受限"),
326
+ row: (n) => o(n, 409, "row", "Excel 行高上限为 409pt,超高行已收敛至 409pt;单元格值完整保留,显示范围可能受限")
328
327
  };
329
328
  }
330
329
  async function Ee(e, t) {
331
- const o = e.flow ? se(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();
330
+ const o = e.flow ? se(e.pages, e.continuous).map((r) => ({ comp: r, pageIndex: e.pages[0].index })) : e.pages.flatMap(({ page: r, index: s }, l) => r.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();
332
331
  let i = 1, a = 0;
333
- for (const { comp: n } of o)
334
- if (n.grid) {
335
- const s = F(n.grid, n.widthMm, n.heightMm);
336
- r.set(n, s), i = Math.max(i, s.columns.length);
332
+ for (const { comp: r } of o)
333
+ if (r.grid) {
334
+ const s = A(r.grid, r.widthMm, r.heightMm);
335
+ n.set(r, s), i = Math.max(i, s.columns.length);
337
336
  const l = t(s.cells.length);
338
337
  l && await l;
339
- } else n.kind === "text" && (a = Math.max(a, n.widthMm));
338
+ } else r.kind === "text" && (a = Math.max(a, r.widthMm));
340
339
  if (i > 16384) throw new Error("Excel 最多支持 16384 列,无法无损导出此报表");
341
- return { components: o, grids: r, columnCount: i, textWidthMm: a };
340
+ return { components: o, grids: n, columnCount: i, textWidthMm: a };
342
341
  }
343
342
  function be(e, t, o) {
344
- const { page: r, index: i } = e.pages[0], a = t !== void 0 && t !== "auto";
345
- return (e.continuous || v(r)) && !a ? {} : { pageSetup: {
346
- paperSize: he(r, t, i, o),
347
- orientation: r.pageWidthMm > r.pageHeightMm ? "landscape" : "portrait",
343
+ const { page: n, index: i } = e.pages[0], a = t !== void 0 && t !== "auto";
344
+ return (e.continuous || v(n)) && !a ? {} : { pageSetup: {
345
+ paperSize: he(n, t, i, o),
346
+ orientation: n.pageWidthMm > n.pageHeightMm ? "landscape" : "portrait",
348
347
  fitToPage: !0,
349
348
  ...e.continuous ? { fitToWidth: 1, fitToHeight: 0 } : {}
350
349
  } };
@@ -364,72 +363,72 @@ function Se(e, t) {
364
363
  o && (e.fill = { type: "pattern", pattern: "solid", fgColor: { argb: o } }), e.border = ye(t), z(e, t);
365
364
  }
366
365
  function ve(e, t) {
367
- for (const [o, r] of t.columns.entries()) {
368
- const i = e.sheet.getColumn(o + 1), a = e.limits.column(A(r.size));
366
+ for (const [o, n] of t.columns.entries()) {
367
+ const i = e.sheet.getColumn(o + 1), a = e.limits.column(F(n.size));
369
368
  (i.width == null || i.width < a) && (i.width = a);
370
369
  }
371
370
  }
372
371
  function Ce(e, t, o) {
373
- for (const [r, i] of t.rows.entries()) {
374
- const a = e.sheet.getRow(o + r), n = e.limits.row(i.size * W);
375
- (a.height == null || a.height < n) && (a.height = n);
372
+ for (const [n, i] of t.rows.entries()) {
373
+ const a = e.sheet.getRow(o + n), r = e.limits.row(i.size * W);
374
+ (a.height == null || a.height < r) && (a.height = r);
376
375
  }
377
376
  }
378
- function ke(e, t, o, r) {
377
+ function ke(e, t, o, n) {
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
- (i > 1 || a > 1) && e.mergeCells(r + t.ri, t.ci + 1, r + t.ri + a - 1, t.ci + i);
379
+ (i > 1 || a > 1) && e.mergeCells(n + t.ri, t.ci + 1, n + t.ri + a - 1, t.ci + i);
381
380
  }
382
- async function Be(e, t, o, r) {
383
- if (r + o.rows.length - 1 > 1048576) throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");
384
- Ce(e, o, r);
381
+ async function Be(e, t, o, n) {
382
+ if (n + o.rows.length - 1 > 1048576) throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");
383
+ Ce(e, o, n);
385
384
  for (const i of o.cells) {
386
- const a = e.sheet.getCell(r + i.ri, i.ci + 1);
385
+ const a = e.sheet.getCell(n + i.ri, i.ci + 1);
387
386
  de(a, i.cell, e.valueMode, e.warnings);
388
- const n = Y(i.cell, t.style);
389
- n && (p(n.richText.map((c) => c.text).join(""), a.address), a.value = n);
387
+ const r = Y(i.cell, t.style);
388
+ r && (p(r.richText.map((c) => c.text).join(""), a.address), a.value = r);
390
389
  const s = t.grid?.paddingMm ?? 0.5;
391
- e.dataBars(e.sheet, i, r + i.ri, s);
390
+ e.dataBars(e.sheet, i, n + i.ri, s);
392
391
  for (const c of i.cell.children ?? [])
393
- S(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 });
394
- Se(a, w(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))) }), ke(e.sheet, i, o, r);
392
+ S(c) && !c.grid && e.images.write(e.sheet, c, n + i.ri, { leftMm: i.xMm + s + (i.cell.indentMm ?? 0) + c.leftMm, offsetMm: s + c.topMm });
393
+ Se(a, w(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))) }), ke(e.sheet, i, o, n);
395
394
  const l = e.schedule();
396
395
  l && await l;
397
396
  }
398
- return r + o.rows.length;
397
+ return n + o.rows.length;
399
398
  }
400
- function $e(e, t, o, r) {
399
+ function $e(e, t, o, n) {
401
400
  const i = Array.isArray(t.lines) && t.lines.length > 0 ? t.lines.join(`
402
- `) : t.text ?? "", a = e.sheet.getRow(o), n = a.getCell(1);
403
- t.richParagraphs?.length || p(i, n.address), n.value = t.richParagraphs?.length ? P(t.richParagraphs, t.style) : i, typeof n.value == "object" && n.value && "richText" in n.value && p(n.value.richText.map((l) => l.text).join(""), n.address), n.alignment = { horizontal: t.style?.align ?? "left", vertical: t.style?.verticalAlign ?? "middle", wrapText: !0 };
401
+ `) : t.text ?? "", a = e.sheet.getRow(o), r = a.getCell(1);
402
+ t.richParagraphs?.length || p(i, r.address), r.value = t.richParagraphs?.length ? P(t.richParagraphs, t.style) : i, typeof r.value == "object" && r.value && "richText" in r.value && p(r.value.richText.map((l) => l.text).join(""), r.address), r.alignment = { horizontal: t.style?.align ?? "left", vertical: t.style?.verticalAlign ?? "middle", wrapText: !0 };
404
403
  const s = M(t.style?.backgroundColor);
405
- return s && (n.fill = { type: "pattern", pattern: "solid", fgColor: { argb: s } }), z(n, t.style), r > 1 && e.sheet.mergeCells(o, 1, o, r), a.height = e.limits.row(t.heightMm * W), o + 1;
404
+ return s && (r.fill = { type: "pattern", pattern: "solid", fgColor: { argb: s } }), z(r, t.style), n > 1 && e.sheet.mergeCells(o, 1, o, n), a.height = e.limits.row(t.heightMm * W), o + 1;
406
405
  }
407
406
  function Ae(e, t, o) {
408
- const r = t + o - 1;
409
- e.views = [{ state: "frozen", ySplit: r, xSplit: 0 }], e.pageSetup.printTitlesRow = `1:${r}`;
410
- }
411
- async function Fe(e, t, o, r) {
412
- !t.grids.size && t.textWidthMm > 0 && (e.sheet.getColumn(1).width = e.limits.column(A(t.textWidthMm)));
413
- for (const n of t.grids.values()) {
414
- ve(e, n);
415
- const s = e.schedule(n.columns.length);
407
+ const n = t + o - 1;
408
+ e.views = [{ state: "frozen", ySplit: n, xSplit: 0 }], e.pageSetup.printTitlesRow = `1:${n}`;
409
+ }
410
+ async function Fe(e, t, o, n) {
411
+ !t.grids.size && t.textWidthMm > 0 && (e.sheet.getColumn(1).width = e.limits.column(F(t.textWidthMm)));
412
+ for (const r of t.grids.values()) {
413
+ ve(e, r);
414
+ const s = e.schedule(r.columns.length);
416
415
  s && await s;
417
416
  }
418
417
  let i = 1, a = !1;
419
- for (const { comp: n, pageIndex: s } of t.components) {
420
- const l = o && n.table?.role === "header";
418
+ for (const { comp: r, pageIndex: s } of t.components) {
419
+ const l = o && r.table?.role === "header";
421
420
  if (l && a) continue;
422
421
  if (i > 1048576) throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");
423
- const c = t.grids.get(n);
422
+ const c = t.grids.get(r);
424
423
  if (c)
425
- l && (Ae(e.sheet, i, c.rows.length), a = !0), i = await Be(e, n, c, i);
426
- else if (n.kind === "text")
427
- i = $e(e, n, i, t.columnCount);
428
- else if (S(n)) {
429
- const h = U(n, o), d = r.write(e.sheet, n, h?.row ?? i, h);
424
+ l && (Ae(e.sheet, i, c.rows.length), a = !0), i = await Be(e, r, c, i);
425
+ else if (r.kind === "text")
426
+ i = $e(e, r, i, t.columnCount);
427
+ else if (S(r)) {
428
+ const h = U(r, o), d = n.write(e.sheet, r, h?.row ?? i, h);
430
429
  h || (i = d);
431
430
  } else
432
- e.warnings.push(`page ${s + 1} ${n.nid ?? n.kind}: 组件类型 ${n.kind} 暂不支持 xlsx 导出,已跳过`);
431
+ e.warnings.push(`page ${s + 1} ${r.nid ?? r.kind}: 组件类型 ${r.kind} 暂不支持 xlsx 导出,已跳过`);
433
432
  }
434
433
  }
435
434
  function Pe(e) {
@@ -441,44 +440,44 @@ function Pe(e) {
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 je(e, t = {}) {
443
+ async function Le(e, t = {}) {
445
444
  Pe(t), E(t.signal);
446
445
  const o = t.assetRegistry || t.assetRenderers ? await K(e, { ...t, format: "xlsx" }) : { plan: e, diagnostics: [] };
447
446
  e = o.plan;
448
- const r = [...o.diagnostics, ...J(e, "xlsx", t)];
447
+ const n = [...o.diagnostics, ...J(e, "xlsx", t)];
449
448
  await Q(e, t.maxDataBars ?? 1e4, t);
450
- const i = new _.Workbook(), a = [], n = re(i, t, a), s = [], l = q(n, t.maxDataBars ?? 1e4, s), c = Me(a), h = me(e, t.sheetMode, a), d = /* @__PURE__ */ new Set(), u = B(t);
449
+ const i = new _.Workbook(), a = [], r = ne(i, t, a), s = [], l = q(r, t.maxDataBars ?? 1e4, s), c = Me(a), h = me(e, t.sheetMode, a), d = /* @__PURE__ */ new Set(), u = B(t);
451
450
  for (const [g, m] of h.entries()) {
452
451
  const x = await Ee(m, u);
453
452
  m.continuous && !m.flow && pe(m, x.grids);
454
453
  const D = m.pages[0].page, C = t.sheetName?.(g) ?? xe(m.title, g, d);
455
454
  d.add(C.toLowerCase());
456
455
  const N = i.addWorksheet(C, be(m, t.paperSize, a)), O = t.valueMode ?? (v(D) || m.continuous || m.flow ? "raw" : "text");
457
- E(t.signal), await Fe({ sheet: N, warnings: a, limits: c, valueMode: O, schedule: u, images: n, dataBars: l }, x, m.continuous, n), await L(t, g + 1, h.length);
456
+ E(t.signal), await Fe({ sheet: N, warnings: a, limits: c, valueMode: O, schedule: u, images: r, dataBars: l }, x, m.continuous, r), await L(t, g + 1, h.length);
458
457
  }
459
458
  E(t.signal);
460
459
  const f = await i.xlsx.writeBuffer();
461
- return E(t.signal), { workbook: i, buffer: f, warnings: a, diagnostics: r, ...s.length ? { notes: s } : {} };
460
+ return E(t.signal), { workbook: i, buffer: f, warnings: a, diagnostics: n, ...s.length ? { notes: s } : {} };
462
461
  }
463
462
  export {
464
- Je as bindExcelTemplate,
465
- Ve as createExcelBindingDocument,
466
- qe as createExcelBindingSession,
467
- Qe as createExcelRegionBindingDocument,
468
- Ye as createExcelRegionBindingSession,
469
- Ze as excelBindingCellRange,
470
- et as excelBindingRowRange,
471
- tt as getExcelSheetWindow,
472
- _e as importExcelTemplate,
473
- Ue as inspectExcelWorkbook,
474
- Xe as openExcelWorkbook,
475
- rt as parseExcelBindingSession,
463
+ Ke as bindExcelTemplate,
464
+ Je as createExcelBindingDocument,
465
+ Ve as createExcelBindingSession,
466
+ qe as createExcelRegionBindingDocument,
467
+ Qe as createExcelRegionBindingSession,
468
+ Ye as excelBindingCellRange,
469
+ Ze as excelBindingRowRange,
470
+ et as getExcelSheetWindow,
471
+ He as importExcelTemplate,
472
+ _e as inspectExcelWorkbook,
473
+ Ue as openExcelWorkbook,
474
+ tt as parseExcelBindingSession,
476
475
  nt as parseExcelRegionBindingSession,
477
- je as renderPlanToXlsx,
478
- it as validateExcelBindingFields,
479
- ot as validateExcelBindingRecipe,
480
- at as validateExcelBindingRegions,
481
- st as validateExcelRegionBindings,
482
- lt as validateExcelRegionFields,
483
- ct as validateExcelRegionGeometry
476
+ Le as renderPlanToXlsx,
477
+ rt as validateExcelBindingFields,
478
+ it as validateExcelBindingRecipe,
479
+ ot as validateExcelBindingRegions,
480
+ at as validateExcelRegionBindings,
481
+ st as validateExcelRegionFields,
482
+ lt as validateExcelRegionGeometry
484
483
  };