@agile-team/mach-report 2.23.1 → 2.24.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 (149) hide show
  1. package/README.md +8 -2
  2. package/dist/{ExcelBindingWizard-BrTmdo7f.cjs → ExcelBindingWizard-BV12hGiK.cjs} +1 -1
  3. package/dist/{ExcelBindingWizard-CcDMLO8Q.js → ExcelBindingWizard-Cy_lPjWV.js} +3 -3
  4. package/dist/ParamEditor-DenKjvKu.cjs +1 -0
  5. package/dist/ParamEditor-PyOqHzzw.js +750 -0
  6. package/dist/{ReportBatchPanel-CJB67WNd.js → ReportBatchPanel-8EFtMrKk.js} +2 -2
  7. package/dist/{ReportBatchPanel-CHxBtG9R.cjs → ReportBatchPanel-pQ6d0yqJ.cjs} +1 -1
  8. package/dist/ReportLabelStudio-B_KF3Zc_.cjs +1 -0
  9. package/dist/{ReportLabelStudio-Tplc1TLJ.js → ReportLabelStudio-HUeo2TsU.js} +68 -68
  10. package/dist/ReportParamPanel-8xR85nz-.cjs +1 -0
  11. package/dist/{ReportParamPanel-GI43aGa0.js → ReportParamPanel-DA-YpkvC.js} +328 -298
  12. package/dist/ReportPreview-CyUXJSVX.cjs +6 -0
  13. package/dist/ReportPreview-_wTJnsG1.js +7120 -0
  14. package/dist/{ReportTemplateLibrary-BFQIX0sg.cjs → ReportTemplateLibrary-CjArKxRG.cjs} +1 -1
  15. package/dist/{ReportTemplateLibrary-KqX4E2sN.js → ReportTemplateLibrary-DH8jl9IF.js} +28 -28
  16. package/dist/RuleEditor-Bmj98oC4.cjs +1 -0
  17. package/dist/{RuleEditor-OPX1awrH.js → RuleEditor-GDydlEHz.js} +846 -834
  18. package/dist/{TemplateOutlinePanel-CVYKVLv_.cjs → TemplateOutlinePanel-B554_qk1.cjs} +1 -1
  19. package/dist/{TemplateOutlinePanel-DQS-eOs6.js → TemplateOutlinePanel-DjPqzU9h.js} +10 -10
  20. package/dist/{TemplateReusePanel-CY6O93Zk.cjs → TemplateReusePanel-D0628OYc.cjs} +1 -1
  21. package/dist/{TemplateReusePanel-DKXiFTyB.js → TemplateReusePanel-DtYbCN7U.js} +2 -2
  22. package/dist/TemplateReviewPanel-CSwvCz3f.cjs +1 -0
  23. package/dist/TemplateReviewPanel-D_FR4ISq.js +602 -0
  24. package/dist/artifact-integrity.json +94 -94
  25. package/dist/assets-B4AJIOTB.cjs +1 -0
  26. package/dist/assets-D0FbszhB.js +137 -0
  27. package/dist/{auto-BB99S802.js → auto-BksreoKc.js} +5 -5
  28. package/dist/auto-C3mGqzJ8.cjs +1 -0
  29. package/dist/capabilities-CTwlcl8q.cjs +1 -0
  30. package/dist/capabilities-lqDEZSq5.js +121 -0
  31. package/dist/data-bar-2NLRzOCQ.cjs +1 -0
  32. package/dist/{data-bar-IkI6VvMQ.js → data-bar-BnGtnJ82.js} +1 -1
  33. package/dist/designer-BNf7NWd6.js +7589 -0
  34. package/dist/designer-DWnZZ_ej.cjs +2 -0
  35. package/dist/designer.cjs +1 -1
  36. package/dist/designer.d.cts +137 -4
  37. package/dist/designer.d.ts +137 -4
  38. package/dist/designer.js +5 -5
  39. package/dist/diagnostic-collector-1sqd7DQP.js +355 -0
  40. package/dist/diagnostic-collector-D3rlvxm3.cjs +1 -0
  41. package/dist/{dom-JWrchIre.js → dom-C90cTM6Y.js} +4 -4
  42. package/dist/dom-CxOkm_Sy.cjs +1 -0
  43. package/dist/{encoding-7lquyj0w.cjs → encoding-CkziAnZI.cjs} +1 -1
  44. package/dist/{encoding-CEd-dq9A.js → encoding-DSc9zv2F.js} +2 -2
  45. package/dist/{font-loader-D8pI87fL.cjs → font-loader-D-znWNWS.cjs} +1 -1
  46. package/dist/{font-loader-CNWXomuV.js → font-loader-i7lZbqH_.js} +1 -1
  47. package/dist/{grid-strokes-EoY66L2f.js → grid-strokes-BPiV1WHe.js} +1 -1
  48. package/dist/grid-strokes-DYf-6DMl.cjs +1 -0
  49. package/dist/index.cjs +5 -5
  50. package/dist/index.d.cts +46 -7
  51. package/dist/index.d.ts +46 -7
  52. package/dist/index.js +69 -68
  53. package/dist/{json-snapshot-BRnzKudk.js → json-snapshot-BJWZNryO.js} +919 -791
  54. package/dist/json-snapshot-C7QZrRBf.cjs +2 -0
  55. package/dist/{pdf-CJToa81Z.js → pdf-0_5XiTCx.js} +2499 -2492
  56. package/dist/{pdf-DpMkW72B.cjs → pdf-DWuq6uxx.cjs} +31 -31
  57. package/dist/pdf.cjs +1 -1
  58. package/dist/pdf.d.cts +18 -0
  59. package/dist/pdf.d.ts +18 -0
  60. package/dist/pdf.js +2 -2
  61. package/dist/{plugin-_BkUVc2z.js → plugin-B1ydqEmS.js} +1 -1
  62. package/dist/{plugin-BWTp-X7b.cjs → plugin-BQBz2vLG.cjs} +1 -1
  63. package/dist/prefill-2p9wrpn9.cjs +1 -0
  64. package/dist/{prefill-CWGdnqQd.js → prefill-Cuzh1wxf.js} +13 -13
  65. package/dist/prepared-CVbgO9KR.js +128 -0
  66. package/dist/prepared-DAwe8Il2.cjs +1 -0
  67. package/dist/protocol-BOri9qJL.js +105 -0
  68. package/dist/protocol-DD5dHSz-.cjs +1 -0
  69. package/dist/record-bindings-CAyM5tGg.cjs +1 -0
  70. package/dist/{record-bindings-DatJZv_e.js → record-bindings-fhav-NLG.js} +1 -1
  71. package/dist/{region-binding-workflow-DjrXuR1q.js → region-binding-workflow-Cm4mqhih.js} +2 -2
  72. package/dist/{region-binding-workflow-l7NGfagJ.cjs → region-binding-workflow-DWCUgjZl.cjs} +1 -1
  73. package/dist/report-encoding-worker.cjs +1 -1
  74. package/dist/report-encoding-worker.js +1 -1
  75. package/dist/rich-text-layout-X9YOz1JD.cjs +3 -0
  76. package/dist/{rich-text-layout-Ciwa6D2o.js → rich-text-layout-YJHtCWQI.js} +1 -1
  77. package/dist/runtime-BpSAgOw1.js +201 -0
  78. package/dist/runtime-Cd2UTnwe.cjs +1 -0
  79. package/dist/sbom.cdx.json +1 -1
  80. package/dist/server/node.d.cts +55 -7
  81. package/dist/server/node.d.ts +55 -7
  82. package/dist/server-node.cjs +5 -5
  83. package/dist/server-node.js +2721 -2430
  84. package/dist/server.cjs +1 -1
  85. package/dist/server.d.cts +47 -12
  86. package/dist/server.d.ts +47 -12
  87. package/dist/server.js +8 -8
  88. package/dist/style.css +1 -1
  89. package/dist/{template-catalog-DtrtT1FY.cjs → template-catalog--yBX169M.cjs} +1 -1
  90. package/dist/{template-catalog-CRuZL3pi.js → template-catalog-Bu7s7ReF.js} +3 -3
  91. package/dist/template-fragments-5EzVn7bm.cjs +1 -0
  92. package/dist/{template-fragments-CPpGpQoz.js → template-fragments-Di2vDFnx.js} +2 -2
  93. package/dist/{template-registry-O0hNIOfB.js → template-registry-BCBF2b8j.js} +10 -10
  94. package/dist/template-registry-Bnh5aEYf.cjs +1 -0
  95. package/dist/textwrap-BPFxhpOw.cjs +4 -0
  96. package/dist/{textwrap-D4ZksyMK.js → textwrap-CmVkhMhx.js} +1 -1
  97. package/dist/vue/async.d.cts +97 -18
  98. package/dist/vue/async.d.ts +97 -18
  99. package/dist/vue/index.d.cts +127 -28
  100. package/dist/vue/index.d.ts +127 -28
  101. package/dist/vue-async.cjs +1 -1
  102. package/dist/vue-async.js +3 -3
  103. package/dist/vue.cjs +1 -1
  104. package/dist/vue.js +192 -162
  105. package/dist/{workbook-session-C9ZmCBwY.js → workbook-session-B6P_-5a4.js} +2 -2
  106. package/dist/{workbook-session-C6-SrnCT.cjs → workbook-session-BnPK3T58.cjs} +1 -1
  107. package/dist/worker.cjs +1 -1
  108. package/dist/worker.d.cts +55 -7
  109. package/dist/worker.d.ts +55 -7
  110. package/dist/worker.js +4 -4
  111. package/dist/xlsx.cjs +4 -4
  112. package/dist/xlsx.d.cts +18 -1
  113. package/dist/xlsx.d.ts +18 -1
  114. package/dist/xlsx.js +279 -272
  115. package/package.json +1 -1
  116. package/dist/ParamEditor-BGjovFUe.js +0 -737
  117. package/dist/ParamEditor-CeNp4_zQ.cjs +0 -1
  118. package/dist/ReportLabelStudio-g8PkqJWn.cjs +0 -1
  119. package/dist/ReportParamPanel-C7fZTllk.cjs +0 -1
  120. package/dist/ReportPreview-BoGBGyRr.cjs +0 -6
  121. package/dist/ReportPreview-QLONCyci.js +0 -6257
  122. package/dist/RuleEditor-BZUP9yvL.cjs +0 -1
  123. package/dist/TemplateReviewPanel-DbeNC8Ms.cjs +0 -1
  124. package/dist/TemplateReviewPanel-Dijwm9YE.js +0 -593
  125. package/dist/assets-D2gHc4Mz.cjs +0 -1
  126. package/dist/assets-T_gDeFaz.js +0 -132
  127. package/dist/auto-BrPWo7Xm.cjs +0 -1
  128. package/dist/capabilities-DiBj4Qgl.cjs +0 -1
  129. package/dist/capabilities-pg7j7VLT.js +0 -106
  130. package/dist/data-bar-CeZuFmYl.cjs +0 -1
  131. package/dist/designer-BZoVWTgl.js +0 -7172
  132. package/dist/designer-zS2uKJmY.cjs +0 -2
  133. package/dist/dom-ChE5D-L-.cjs +0 -1
  134. package/dist/grid-strokes-Be24LGuV.cjs +0 -1
  135. package/dist/json-snapshot-DNiIbpOr.cjs +0 -2
  136. package/dist/prefill-PaAy6wLk.cjs +0 -1
  137. package/dist/prepared-CJy_qk7d.js +0 -94
  138. package/dist/prepared-D0yCSxSO.cjs +0 -1
  139. package/dist/progress-ByiOxUD3.js +0 -250
  140. package/dist/progress-WomPRP3B.cjs +0 -1
  141. package/dist/protocol-BG16rz6D.js +0 -90
  142. package/dist/protocol-wzhl1Fim.cjs +0 -1
  143. package/dist/record-bindings-MBxbeBsi.cjs +0 -1
  144. package/dist/rich-text-layout-DK7A_a5r.cjs +0 -3
  145. package/dist/runtime-DYMOS_gz.cjs +0 -1
  146. package/dist/runtime-PiCax9zQ.js +0 -171
  147. package/dist/template-fragments-GVjpew_q.cjs +0 -1
  148. package/dist/template-registry-DI59PXVK.cjs +0 -1
  149. package/dist/textwrap-DEHqAjKZ.cjs +0 -4
package/dist/xlsx.js CHANGED
@@ -1,112 +1,112 @@
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)) });
1
+ import { v, m as p, a as W, r as R, y as E, t as _, o as T, z as P, i as C } from "./diagnostic-collector-1sqd7DQP.js";
2
+ import { e as U } from "./index-CPh6tqge.js";
3
+ import { d as X } from "./data-bar-BnGtnJ82.js";
4
+ import { e as K, E as J, m as F, i as V } from "./workbook-session-B6P_-5a4.js";
5
+ import { a as Ze, b as et, o as tt } from "./workbook-session-B6P_-5a4.js";
6
+ import { c as q } from "./media-Y90dHK9z.js";
7
+ import { c as Q } from "./capabilities-lqDEZSq5.js";
8
+ import { r as Y } from "./assets-D0FbszhB.js";
9
+ import { s as Z, a as ee } from "./workbook-sheets-D4M7XXBh.js";
10
+ import { b as rt, c as it, a as ot, d as at, e as st, f as lt, g as ct, h as dt, p as ht, i as ft, v as gt, j as ut, k as mt, l as wt, m as xt, n as pt } from "./region-binding-workflow-Cm4mqhih.js";
11
+ function te(e) {
12
+ const t = U({ 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)) });
13
13
  return `data:image/png;base64,${btoa(String.fromCharCode(...t))}`;
14
14
  }
15
- function te(e, t, o) {
16
- const r = /* @__PURE__ */ new Map();
15
+ function ne(e, t, o) {
16
+ const n = /* @__PURE__ */ new Map();
17
17
  let i = 0;
18
- return (a, n, s, l) => {
19
- const c = U(n.cell.dataBar, n.widthMm, n.heightMm, l);
18
+ return (a, r, s, l) => {
19
+ const c = X(r.cell.dataBar, r.widthMm, r.heightMm, l);
20
20
  if (!c) return;
21
21
  if (++i > t) throw new Error(`Excel 数据条超过 ${t} 个绘图预算,请缩小范围或调整 maxDataBars`);
22
- let h = r.get(c.color);
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 });
22
+ let d = n.get(c.color);
23
+ d || (d = te(c.color), n.set(c.color, d)), i === 1 && o.push("数据条为静态半透明视觉快照,保留原始单元格值;Excel 编辑不会重算条形,绘图叠加文字的混色与预览可能略有差异。"), e.write(a, { kind: "image", leftMm: 0, topMm: 0, widthMm: c.width, heightMm: c.height, imageData: d }, s, { leftMm: r.xMm + c.x, offsetMm: c.y });
24
24
  };
25
25
  }
26
- async function ne(e, t, o) {
27
- const r = e.pages.flatMap((n) => n.components), i = v(o);
26
+ async function re(e, t, o) {
27
+ const n = e.pages.flatMap((r) => r.components), i = v(o);
28
28
  let a = 0;
29
- for (; r.length; ) {
30
- const n = r.pop();
31
- 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) {
32
32
  if (l?.dataBar && l.dataBar.end > l.dataBar.start && ++a > t) throw new Error(`Excel 数据条超过 ${t} 个绘图预算,请缩小范围或调整 maxDataBars`);
33
- l?.children && r.push(...l.children);
33
+ l?.children && n.push(...l.children);
34
34
  const c = i();
35
35
  c && await c;
36
36
  }
37
37
  }
38
38
  }
39
39
  function I(e, t) {
40
- return { richText: e.flatMap((o, r) => [
41
- ...r ? [{ text: `
40
+ return { richText: e.flatMap((o, n) => [
41
+ ...n ? [{ text: `
42
42
  ` }] : [],
43
43
  ...o.segments.map((i) => {
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()}` } } : {} } };
44
+ const a = p(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: W(a).fontSizePt, .../^[a-f\d]{6}$/i.test(r ?? "") ? { color: { argb: `FF${r.toUpperCase()}` } } : {} } };
46
46
  })
47
47
  ]) };
48
48
  }
49
- function re(e, t) {
49
+ function ie(e, t) {
50
50
  const o = e.children?.filter((a) => a.kind === "text" && !a.grid) ?? [];
51
51
  if (!e.richParagraphs?.length && !o.length) return;
52
- const r = x(t, e.style), i = e.richParagraphs?.length ? [...e.richParagraphs] : e.text ? [{ segments: [{ text: e.text }] }] : [];
52
+ const n = p(t, e.style), i = e.richParagraphs?.length ? [...e.richParagraphs] : e.text ? [{ segments: [{ text: e.text }] }] : [];
53
53
  for (const a of o) {
54
- const n = x(r, a.style), s = a.richParagraphs?.length ? a.richParagraphs : [{ segments: [{ text: a.lines?.join(`
54
+ const r = p(n, a.style), s = a.richParagraphs?.length ? a.richParagraphs : [{ segments: [{ text: a.lines?.join(`
55
55
  `) ?? a.text ?? "" }] }];
56
- for (const l of s) i.push({ ...l, segments: l.segments.map((c) => ({ ...c, style: x(n, c.style) })) });
56
+ for (const l of s) i.push({ ...l, segments: l.segments.map((c) => ({ ...c, style: p(r, c.style) })) });
57
57
  }
58
- return I(i, r);
58
+ return I(i, n);
59
59
  }
60
- function ie(e, t, o) {
61
- let r = o * 72 / 25.4;
62
- if (!Number.isFinite(r) || t + Math.ceil(r / 409) - 1 > 1048576) throw new Error("Excel 图片占位超过工作表行数上限");
63
- for (; r > 0; ) {
60
+ function oe(e, t, o) {
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; ) {
64
64
  if (t > 1048576) throw new Error("Excel 图片占位超过工作表行数上限");
65
- const i = Math.min(409, r);
66
- e.getRow(t++).height = i, r -= i;
65
+ const i = Math.min(409, n);
66
+ e.getRow(t++).height = i, n -= i;
67
67
  }
68
68
  return t;
69
69
  }
70
- function oe(e, t, o) {
71
- let r = Math.round(t * 36e3), i = 0;
72
- if (!Number.isSafeInteger(r)) throw new Error("Excel 图片锚点超出安全坐标范围");
70
+ function ae(e, t, o) {
71
+ let n = Math.round(t * 36e3), i = 0;
72
+ if (!Number.isSafeInteger(n)) throw new Error("Excel 图片锚点超出安全坐标范围");
73
73
  for (e.properties.defaultColWidth ??= 8.43; i < 16384; ) {
74
- const a = e.getColumn(i + 1).width ?? e.properties.defaultColWidth, n = Math.round(X(a) * 36e3);
75
- if (!Number.isSafeInteger(n) || n <= 0) throw new Error("Excel 图片锚点所在列宽无效");
76
- if (r < n) return { col: i + r / n, row: o - 1, nativeCol: i, nativeColOff: r, nativeRow: o - 1, nativeRowOff: 0 };
77
- r -= n, i++;
74
+ const a = e.getColumn(i + 1).width ?? e.properties.defaultColWidth, r = Math.round(K(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++;
78
78
  }
79
79
  throw new Error("Excel 图片锚点超过16384列上限");
80
80
  }
81
- function ae(e, t, o) {
82
- let r = o * 72 / 25.4;
83
- if (!Number.isFinite(r) || Math.abs(r) > 1048576 * 409) throw new Error("Excel 图片纵向偏移超过工作表范围");
81
+ function se(e, t, o) {
82
+ let n = o * 72 / 25.4;
83
+ if (!Number.isFinite(n) || Math.abs(n) > 1048576 * 409) throw new Error("Excel 图片纵向偏移超过工作表范围");
84
84
  const i = (a) => {
85
- const n = e.getRow(a).height ?? e.properties.defaultRowHeight ?? 15;
86
- if (!Number.isFinite(n) || n <= 0) throw new Error("Excel 图片锚点所在行高无效");
87
- 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;
88
88
  };
89
- for (; r < 0 && t > 1; ) r += i(--t);
90
- for (; t <= 1048576 && r >= i(t); ) r -= i(t++);
91
- if (t > 1048576 || r < 0) throw new Error("Excel 图片移动到工作表边界之外");
92
- return { nativeRow: t - 1, nativeRowOff: Math.round(r * 25.4 / 72 * 36e3) };
93
- }
94
- function se(e, t, o) {
95
- const r = V(t), i = /* @__PURE__ */ new Map();
96
- return { write(a, n, s, l) {
97
- if (![n.widthMm, n.heightMm, n.leftMm].every(Number.isFinite) || n.widthMm < 0 || n.heightMm < 0 || n.leftMm < 0) throw new Error("Excel 图片尺寸无效");
98
- if (!n.widthMm || !n.heightMm) return s;
99
- if (!n.imageData || !/^data:image\/(png|jpe?g);base64,/i.test(n.imageData))
100
- return o.push(`${n.nid ?? n.kind}: Excel 图片仅支持 PNG/JPEG data URI,已跳过`), s;
101
- const c = r(n.imageData);
102
- let h = i.get(c.dataUrl);
103
- h === void 0 && (h = e.addImage({ base64: c.dataUrl, extension: c.extension }), i.set(c.dataUrl, h));
104
- const d = l ? s : ie(a, s, n.heightMm);
105
- return a.addImage(h, {
106
- tl: { ...oe(a, l?.leftMm ?? n.leftMm, s), ...l ? ae(a, s, l.offsetMm) : {} },
107
- ext: { width: n.widthMm * 96 / 25.4, height: n.heightMm * 96 / 25.4 },
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 le(e, t, o) {
95
+ const n = q(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);
102
+ let d = i.get(c.dataUrl);
103
+ d === void 0 && (d = e.addImage({ base64: c.dataUrl, extension: c.extension }), i.set(c.dataUrl, d));
104
+ const h = l ? s : oe(a, s, r.heightMm);
105
+ return a.addImage(d, {
106
+ tl: { ...ae(a, l?.leftMm ?? r.leftMm, s), ...l ? se(a, s, l.offsetMm) : {} },
107
+ ext: { width: r.widthMm * 96 / 25.4, height: r.heightMm * 96 / 25.4 },
108
108
  editAs: "oneCell"
109
- }), d;
109
+ }), h;
110
110
  } };
111
111
  }
112
112
  function z(e) {
@@ -117,26 +117,26 @@ function D(e, t) {
117
117
  if (o === void 0) return;
118
118
  if (!z(o) || o.version !== "1.0" || !Number.isSafeInteger(o.columnStart) || Number(o.columnStart) < 0) throw new Error("Excel 多区域几何标记无效,不能按列序猜测输出");
119
119
  if (!e.grid) throw new Error("Excel 多区域输出只接受显式网格组件");
120
- const r = o, i = e.grid.colWidthsMm;
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 多区域列位置与网格列宽不一致");
122
- 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;
123
123
  }
124
124
  function N(e) {
125
125
  const t = e.meta?.xlsxFlow;
126
126
  if (t === void 0) {
127
- 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 多区域页面缺少完整列几何标记");
128
128
  return;
129
129
  }
130
- const o = le(t, e.meta?.reportScope);
131
- for (const r of e.components) {
132
- const i = D(r, o.widths);
130
+ const o = ce(t, e.meta?.reportScope);
131
+ for (const n of e.components) {
132
+ const i = D(n, o.widths);
133
133
  if (!i) throw new Error("Excel 多区域页面混入没有区域几何的组件,请使用独立页面模板");
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);
135
- 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 多区域标记与真实横向位置不一致");
136
136
  }
137
137
  return o;
138
138
  }
139
- function le(e, t) {
139
+ function ce(e, t) {
140
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 多区域工作表标识无效");
141
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 多区域完整列宽无效");
142
142
  if (t !== void 0 && (typeof t != "string" || !t.trim())) throw new Error("Excel 多区域报表命名空间无效");
@@ -145,61 +145,61 @@ function le(e, t) {
145
145
  function S(e) {
146
146
  return Math.round(e * 1e6) / 1e6;
147
147
  }
148
- function ce(e, t, o, r, i) {
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);
148
+ function de(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);
150
150
  }
151
- function he(e, t, o, r) {
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);
153
- return t.map((n) => {
154
- let s = n.topMm;
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 };
151
+ function he(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: R(r.grid, r.widthMm, r.heightMm), top: s, column: D(r, n).columnStart };
156
156
  });
157
157
  }
158
- function de(e, t, o) {
159
- const r = t.length - 1;
160
- if (r * o.length > 1e6) throw new Error("Excel 多区域单页超过 100 万几何单元格,请减小预览分页高度或列数");
161
- const i = new Map(t.map((s, l) => [s, l])), a = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
158
+ function fe(e, t, o) {
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();
162
162
  for (const s of e) for (const l of s.layout.cells) {
163
163
  if (!Object.keys(l.cell).length) continue;
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);
164
+ const c = i.get(S(s.top + l.yMm)), d = i.get(S(s.top + l.yMm + l.heightMm)), h = s.column + l.ci, u = h + (l.cell.colSpan ?? 1), f = `${c}:${h}`;
165
+ for (let g = c; g < d; g++) for (let x = h; x < u; x++) {
166
+ const w = `${g}:${x}`;
167
+ if (r.has(w)) throw new Error("Excel 多区域实际单元格互相覆盖,已终止输出,未覆盖已有内容");
168
+ r.set(w, f);
169
169
  }
170
- a.set(f, { ...l.cell, style: x(s.component.style, l.cell.style), rowSpan: h - c, colSpan: u - d });
170
+ a.set(f, { ...l.cell, style: p(s.component.style, l.cell.style), rowSpan: d - c, colSpan: u - h });
171
171
  }
172
- return Array.from({ length: r }, (s, l) => {
172
+ return Array.from({ length: n }, (s, l) => {
173
173
  const c = [];
174
- for (let h = 0; h < o.length; h++) {
175
- const d = `${l}:${h}`, u = a.get(d);
176
- u ? (c.push(u), h += (u.colSpan ?? 1) - 1) : n.has(d) || c.push(null);
174
+ for (let d = 0; d < o.length; d++) {
175
+ const h = `${l}:${d}`, u = a.get(h);
176
+ u ? (c.push(u), d += (u.colSpan ?? 1) - 1) : r.has(h) || c.push(null);
177
177
  }
178
178
  return c;
179
179
  });
180
180
  }
181
- function fe(e, t) {
182
- const o = /* @__PURE__ */ new Set(), r = [];
181
+ function ge(e, t) {
182
+ const o = /* @__PURE__ */ new Set(), n = [];
183
183
  let i;
184
- for (const [a, { page: n }] of e.entries()) {
185
- const s = N(n);
184
+ for (const [a, { page: r }] of e.entries()) {
185
+ const s = N(r);
186
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 多区域分页的工作表或列结构不一致");
187
187
  i ??= s;
188
- const l = ce(n, a, e.length, t, o), c = he(n, l, t, s.widths);
188
+ const l = de(r, a, e.length, t, o), c = he(r, l, t, s.widths);
189
189
  if (!c.length) continue;
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]);
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 } });
190
+ const d = [...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), h = fe(c, d, s.widths), u = d.slice(1).map((f, g) => f - d[g]);
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: h, colWidthsMm: s.widths, rowHeightsMm: u } });
192
192
  }
193
- return r;
193
+ return n;
194
194
  }
195
- const O = 72 / 25.4, ge = 32767, ue = 253;
195
+ const L = 72 / 25.4, ue = 32767, me = 253;
196
196
  function M(e, t) {
197
197
  if (typeof e != "string") return;
198
- if (e.length > ge)
198
+ if (e.length > ue)
199
199
  throw new Error(`Excel 单元格 ${t} 最多支持 32767 个字符,无法无损导出;内容未裁剪`);
200
200
  let o = 0;
201
- for (let r = 0; r < e.length; r++)
202
- if (e.charCodeAt(r) === 10 && ++o > ue)
201
+ for (let n = 0; n < e.length; n++)
202
+ if (e.charCodeAt(n) === 10 && ++o > me)
203
203
  throw new Error(`Excel 单元格 ${t} 最多支持 253 个换行,无法无损导出;内容未改写`);
204
204
  }
205
205
  function b(e) {
@@ -207,7 +207,7 @@ function b(e) {
207
207
  const t = e.replace("#", "");
208
208
  return /^[0-9a-fA-F]{6}$/.test(t) ? `FF${t.toUpperCase()}` : void 0;
209
209
  }
210
- function L(e, t = {}) {
210
+ function O(e, t = {}) {
211
211
  e.font = {
212
212
  name: t.fontFamily,
213
213
  bold: t.bold === !0,
@@ -222,12 +222,12 @@ const y = {
222
222
  a4: { width: 210, height: 297, code: 9 },
223
223
  a5: { width: 148, height: 210, code: 11 }
224
224
  };
225
- function me(e, t, o, r) {
225
+ function we(e, t, o, n) {
226
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);
227
+ const i = Math.min(e.pageWidthMm, e.pageHeightMm), a = Math.max(e.pageWidthMm, e.pageHeightMm), r = Object.values(y).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`), y.a4.code);
229
229
  }
230
- function we(e, t, o, r) {
230
+ function xe(e, t, o, n) {
231
231
  const i = typeof t.text == "string" ? t.text : "";
232
232
  if (o !== "raw" || !Object.prototype.hasOwnProperty.call(t, "value")) {
233
233
  M(i, e.address), e.value = i;
@@ -238,29 +238,29 @@ function we(e, t, o, r) {
238
238
  M(a, e.address), e.value = a, t.numberFormat && (e.numFmt = t.numberFormat);
239
239
  return;
240
240
  }
241
- M(i, e.address), e.value = i, r.push(`原始单元格值无效,已保留显示文本:${e.address}`);
241
+ M(i, e.address), e.value = i, n.push(`原始单元格值无效,已保留显示文本:${e.address}`);
242
242
  }
243
243
  function pe(e) {
244
244
  const t = N(e);
245
- return t ? { id: `xlsx-flow:${t.key}`, title: t.sheet, wide: !0, flow: !0 } : xe(e);
245
+ return t ? { id: `xlsx-flow:${t.key}`, title: t.sheet, wide: !0, flow: !0 } : Me(e);
246
246
  }
247
- function xe(e) {
248
- const o = e.components.filter((r) => r.table !== void 0)[0]?.table;
247
+ function Me(e) {
248
+ const o = e.components.filter((n) => n.table !== void 0)[0]?.table;
249
249
  if (!(!o || typeof o.id != "string" || !o.id.trim() || !Array.isArray(o.columnKeys) || !o.columnKeys.length)) {
250
- for (const r of e.components) {
251
- if (r.table) {
252
- 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;
253
253
  continue;
254
254
  }
255
- if (r.grid || r.kind !== "text" && !C(r)) return;
255
+ if (n.grid || n.kind !== "text" && !C(n)) return;
256
256
  }
257
257
  return { id: o.id, title: o.title, wide: o.layout === "wide" || e.layout === "wide" };
258
258
  }
259
259
  }
260
- function Me(e, t) {
260
+ function Ee(e, t) {
261
261
  const o = /* @__PURE__ */ new Set();
262
- for (const [r, i] of e.pages.entries())
263
- if (!t[r])
262
+ for (const [n, i] of e.pages.entries())
263
+ if (!t[n])
264
264
  for (const a of i.components)
265
265
  typeof a.table?.id == "string" && o.add(a.table.id);
266
266
  return o;
@@ -268,87 +268,87 @@ function Me(e, t) {
268
268
  function k(e) {
269
269
  return e.layout === "wide" || e.components.some((t) => t.table?.layout === "wide");
270
270
  }
271
- function Ee(e, t, o) {
272
- const r = [], i = e.pages.map(pe), a = Me(e, i);
273
- for (const [n, s] of e.pages.entries()) {
274
- const l = i[n], c = l && !a.has(l.id), h = t === "pages" || !c ? void 0 : l;
275
- if (t === "continuous" && !h)
276
- throw new Error(`page ${n + 1}: continuous Excel 需要完整、单一的逻辑表来源;自由布局请使用 sheetMode: 'pages'`);
277
- const d = h !== void 0 && (t === "continuous" || h.wide);
278
- !d && t !== "pages" && k(s) && o.push(`page ${n + 1}: 混合或缺少逻辑表来源,已保留独立 Sheet,未猜测合并内容`);
279
- const u = r[r.length - 1];
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 } : {} });
271
+ function be(e, t, o) {
272
+ const n = [], i = e.pages.map(pe), a = Ee(e, i);
273
+ for (const [r, s] of e.pages.entries()) {
274
+ const l = i[r], c = l && !a.has(l.id), d = t === "pages" || !c ? void 0 : l;
275
+ if (t === "continuous" && !d)
276
+ throw new Error(`page ${r + 1}: continuous Excel 需要完整、单一的逻辑表来源;自由布局请使用 sheetMode: 'pages'`);
277
+ const h = d !== void 0 && (t === "continuous" || d.wide);
278
+ !h && t !== "pages" && k(s) && o.push(`page ${r + 1}: 混合或缺少逻辑表来源,已保留独立 Sheet,未猜测合并内容`);
279
+ const u = n[n.length - 1];
280
+ h && u?.continuous && u.tableId === d.id ? u.pages.push({ page: s, index: r }) : n.push({ pages: [{ page: s, index: r }], continuous: h, ...h ? { tableId: d.id, title: d.title } : {}, ...l?.flow ? { flow: !0, title: l.title } : {} });
281
281
  }
282
- return r;
282
+ return n;
283
283
  }
284
284
  function A(e, t, o) {
285
- 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]));
286
286
  }
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);
289
- if (i.columnKeys.length !== a.length || !n || !s)
287
+ function ye(e, t, o, n) {
288
+ const i = e.table, a = t.columns.map((l) => l.size), r = A(n.keys, i.columnKeys, (l, c) => l === c), s = A(n.widths, a, (l, c) => Math.abs(l - c) <= 1e-3);
289
+ if (i.columnKeys.length !== a.length || !r || !s)
290
290
  throw new Error(`page ${o + 1}: 连续 Excel 逻辑表 ${i.id} 的列结构或列宽不一致`);
291
- if (r.keys ??= i.columnKeys, r.widths ??= a, i.role === "header") {
291
+ if (n.keys ??= i.columnKeys, n.widths ??= a, i.role === "header") {
292
292
  if (i.rowIndex !== -1) throw new Error(`page ${o + 1}: 连续 Excel 表头 rowIndex 必须为 -1`);
293
- r.headerSeen = !0;
293
+ n.headerSeen = !0;
294
294
  } else {
295
- if (!["body", "group-header", "subtotal", "grand-total"].includes(i.role) || i.rowIndex !== r.expectedRow)
296
- throw new Error(`page ${o + 1}: 连续 Excel 逻辑行来源不连续或重复(期望 ${r.expectedRow})`);
297
- 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;
298
298
  }
299
299
  }
300
- function ye(e, t) {
300
+ function Se(e, t) {
301
301
  const o = { expectedRow: 0, headerSeen: !1 };
302
- for (const { page: r, index: i } of e.pages)
303
- for (const a of r.components) {
304
- const n = t.get(a);
305
- a.table && n && be(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 && ye(a, r, i, o);
306
306
  }
307
307
  if (!o.headerSeen) throw new Error("连续 Excel 逻辑表缺少明确表头来源");
308
308
  }
309
- function Se(e, t, o) {
310
- let r = (e?.replace(/[\\/*?:[\]]/g, " ").replace(/\s+/g, " ").trim() || `Sheet${t + 1}`).slice(0, 31).replace(/^'+|'+$/g, "").trim() || `Sheet${t + 1}`;
311
- r.toLowerCase() === "history" && (r += " 报表");
312
- let i = r, a = 1;
309
+ function ve(e, t, o) {
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;
313
313
  for (; o.has(i.toLowerCase()); ) {
314
- const n = ` (${++a})`;
315
- i = r.slice(0, 31 - n.length) + n;
314
+ const r = ` (${++a})`;
315
+ i = n.slice(0, 31 - r.length) + r;
316
316
  }
317
317
  return o.add(i.toLowerCase()), i;
318
318
  }
319
- function ve(e) {
319
+ function Ce(e) {
320
320
  const t = /* @__PURE__ */ new Set();
321
- function o(r, i, a, n) {
322
- 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);
323
323
  }
324
324
  return {
325
- column: (r) => o(r, 255, "column", "Excel 单列宽度上限为 255 字符,超宽列已收敛至 255;单元格值完整保留,显示范围可能受限"),
326
- 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;单元格值完整保留,显示范围可能受限")
327
327
  };
328
328
  }
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();
329
+ async function ke(e, t) {
330
+ const o = e.flow ? ge(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();
331
331
  let i = 1, a = 0;
332
- for (const { comp: n } of o)
333
- if (n.grid) {
334
- const s = T(n.grid, n.widthMm, n.heightMm);
335
- 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 = R(r.grid, r.widthMm, r.heightMm);
335
+ n.set(r, s), i = Math.max(i, s.columns.length);
336
336
  const l = t(s.cells.length);
337
337
  l && await l;
338
- } else n.kind === "text" && (a = Math.max(a, n.widthMm));
338
+ } else r.kind === "text" && (a = Math.max(a, r.widthMm));
339
339
  if (i > 16384) throw new Error("Excel 最多支持 16384 列,无法无损导出此报表");
340
- return { components: o, grids: r, columnCount: i, textWidthMm: a };
340
+ return { components: o, grids: n, columnCount: i, textWidthMm: a };
341
341
  }
342
- function ke(e, t, o) {
343
- const { page: r, index: i } = e.pages[0], a = t !== void 0 && t !== "auto";
344
- return (e.continuous || k(r)) && !a ? {} : { pageSetup: {
345
- paperSize: me(r, t, i, o),
346
- orientation: r.pageWidthMm > r.pageHeightMm ? "landscape" : "portrait",
342
+ function Be(e, t, o) {
343
+ const { page: n, index: i } = e.pages[0], a = t !== void 0 && t !== "auto";
344
+ return (e.continuous || k(n)) && !a ? {} : { pageSetup: {
345
+ paperSize: we(n, t, i, o),
346
+ orientation: n.pageWidthMm > n.pageHeightMm ? "landscape" : "portrait",
347
347
  fitToPage: !0,
348
348
  ...e.continuous ? { fitToWidth: 1, fitToHeight: 0 } : {}
349
349
  } };
350
350
  }
351
- function Be(e) {
351
+ function $e(e) {
352
352
  const t = b(e.borderColor ?? e.lineColor), o = { style: "thin", ...t ? { color: { argb: t } } : {} };
353
353
  return {
354
354
  ...e.borderTop !== !1 ? { top: o } : {},
@@ -357,81 +357,81 @@ function Be(e) {
357
357
  ...e.borderRight !== !1 ? { right: o } : {}
358
358
  };
359
359
  }
360
- function $e(e, t) {
360
+ function Pe(e, t) {
361
361
  e.alignment = { horizontal: t.align ?? "left", vertical: t.verticalAlign ?? "middle", wrapText: !0 };
362
362
  const o = b(t.backgroundColor);
363
- o && (e.fill = { type: "pattern", pattern: "solid", fgColor: { argb: o } }), e.border = Be(t), L(e, t);
363
+ o && (e.fill = { type: "pattern", pattern: "solid", fgColor: { argb: o } }), e.border = $e(t), O(e, t);
364
364
  }
365
- function Pe(e, t) {
366
- for (const [o, r] of t.columns.entries()) {
367
- const i = e.sheet.getColumn(o + 1), a = e.limits.column(F(r.size));
365
+ function Ae(e, t) {
366
+ for (const [o, n] of t.columns.entries()) {
367
+ const i = e.sheet.getColumn(o + 1), a = e.limits.column(F(n.size));
368
368
  (i.width == null || i.width < a) && (i.width = a);
369
369
  }
370
370
  }
371
- function Ae(e, t, o) {
372
- for (const [r, i] of t.rows.entries()) {
373
- const a = e.sheet.getRow(o + r), n = e.limits.row(i.size * O);
374
- (a.height == null || a.height < n) && (a.height = n);
371
+ function We(e, t, o) {
372
+ for (const [n, i] of t.rows.entries()) {
373
+ const a = e.sheet.getRow(o + n), r = e.limits.row(i.size * L);
374
+ (a.height == null || a.height < r) && (a.height = r);
375
375
  }
376
376
  }
377
- function We(e, t, o, r) {
377
+ function Re(e, t, o, n) {
378
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));
379
- (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);
380
380
  }
381
- async function Te(e, t, o, r) {
382
- if (r + o.rows.length - 1 > 1048576) throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");
383
- Ae(e, o, r);
381
+ async function Te(e, t, o, n) {
382
+ if (n + o.rows.length - 1 > 1048576) throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");
383
+ We(e, o, n);
384
384
  for (const i of o.cells) {
385
- const a = e.sheet.getCell(r + i.ri, i.ci + 1);
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);
385
+ const a = e.sheet.getCell(n + i.ri, i.ci + 1);
386
+ xe(a, i.cell, e.valueMode, e.warnings);
387
+ const r = ie(i.cell, t.style);
388
+ r && (M(r.richText.map((c) => c.text).join(""), a.address), a.value = r);
389
389
  const s = t.grid?.paddingMm ?? 0.5;
390
- e.dataBars(e.sheet, i, r + i.ri, s);
390
+ e.dataBars(e.sheet, i, n + i.ri, s);
391
391
  for (const c of i.cell.children ?? [])
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);
392
+ C(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
+ Pe(a, p(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))) }), Re(e.sheet, i, o, n);
394
394
  const l = e.schedule();
395
395
  l && await l;
396
396
  }
397
- return r + o.rows.length;
397
+ return n + o.rows.length;
398
398
  }
399
- function Re(e, t, o, r) {
399
+ function Fe(e, t, o, n) {
400
400
  const i = Array.isArray(t.lines) && t.lines.length > 0 ? t.lines.join(`
401
- `) : t.text ?? "", a = e.sheet.getRow(o), n = a.getCell(1);
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 };
401
+ `) : t.text ?? "", a = e.sheet.getRow(o), r = a.getCell(1);
402
+ t.richParagraphs?.length || M(i, r.address), r.value = t.richParagraphs?.length ? I(t.richParagraphs, t.style) : i, typeof r.value == "object" && r.value && "richText" in r.value && M(r.value.richText.map((l) => l.text).join(""), r.address), r.alignment = { horizontal: t.style?.align ?? "left", vertical: t.style?.verticalAlign ?? "middle", wrapText: !0 };
403
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;
404
+ return s && (r.fill = { type: "pattern", pattern: "solid", fgColor: { argb: s } }), O(r, t.style), n > 1 && e.sheet.mergeCells(o, 1, o, n), a.height = e.limits.row(t.heightMm * L), o + 1;
405
405
  }
406
- function Fe(e, t, o) {
407
- const r = t + o - 1;
408
- e.views = [{ state: "frozen", ySplit: r, xSplit: 0 }], e.pageSetup.printTitlesRow = `1:${r}`;
406
+ function Ie(e, t, o) {
407
+ const n = t + o - 1;
408
+ e.views = [{ state: "frozen", ySplit: n, xSplit: 0 }], e.pageSetup.printTitlesRow = `1:${n}`;
409
409
  }
410
- async function Ie(e, t, o, r) {
410
+ async function ze(e, t, o, n) {
411
411
  !t.grids.size && t.textWidthMm > 0 && (e.sheet.getColumn(1).width = e.limits.column(F(t.textWidthMm)));
412
- for (const n of t.grids.values()) {
413
- Pe(e, n);
414
- const s = e.schedule(n.columns.length);
412
+ for (const r of t.grids.values()) {
413
+ Ae(e, r);
414
+ const s = e.schedule(r.columns.length);
415
415
  s && await s;
416
416
  }
417
417
  let i = 1, a = !1;
418
- for (const { comp: n, pageIndex: s } of t.components) {
419
- 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";
420
420
  if (l && a) continue;
421
421
  if (i > 1048576) throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");
422
- const c = t.grids.get(n);
422
+ const c = t.grids.get(r);
423
423
  if (c)
424
- l && (Fe(e.sheet, i, c.rows.length), a = !0), i = await Te(e, n, c, i);
425
- else if (n.kind === "text")
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);
429
- h || (i = d);
424
+ l && (Ie(e.sheet, i, c.rows.length), a = !0), i = await Te(e, r, c, i);
425
+ else if (r.kind === "text")
426
+ i = Fe(e, r, i, t.columnCount);
427
+ else if (C(r)) {
428
+ const d = V(r, o), h = n.write(e.sheet, r, d?.row ?? i, d);
429
+ d || (i = h);
430
430
  } else
431
- 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 导出,已跳过`);
432
432
  }
433
433
  }
434
- function ze(e) {
434
+ function De(e) {
435
435
  if (e.maxDataBars !== void 0 && (!Number.isSafeInteger(e.maxDataBars) || e.maxDataBars < 0 || e.maxDataBars > 1e5)) throw new Error("xlsx maxDataBars 必须是 0–100000 的整数");
436
436
  if (e.valueMode !== void 0 && e.valueMode !== "text" && e.valueMode !== "raw")
437
437
  throw new Error("xlsx valueMode 必须是 text 或 raw");
@@ -440,69 +440,76 @@ function ze(e) {
440
440
  if (e.sheetMode !== void 0 && !["auto", "pages", "continuous"].includes(e.sheetMode))
441
441
  throw new Error("xlsx sheetMode 必须是 auto、pages 或 continuous");
442
442
  }
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: [] };
443
+ function Ne(e, t, o) {
444
+ const n = Q(e, "xlsx", t, o);
445
+ return { diagnostics: n.entries, ...t.diagnosticLimit === void 0 ? {} : { diagnosticSummary: n.snapshot() } };
446
+ }
447
+ function Le(e, t, o, n, i) {
448
+ return { workbook: e, warnings: t.entries, ...i === void 0 ? {} : { warningCount: t.total }, ...o, ...n.length ? { notes: n } : {} };
449
+ }
450
+ async function Oe(e, t = {}) {
451
+ const o = Z(t.additionalSheets), n = ee(t.sheetNames);
452
+ De(t), E(t.signal);
453
+ const i = t.assetRegistry || t.assetRenderers ? await Y(e, { ...t, format: "xlsx" }) : { plan: e, diagnostics: [] };
447
454
  e = i.plan;
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);
455
+ const a = Ne(e, t, i);
456
+ await re(e, t.maxDataBars ?? 1e4, t);
457
+ const r = new J.Workbook(), s = _(t.diagnosticLimit), l = le(r, t, s), c = [], d = ne(l, t.maxDataBars ?? 1e4, c), h = Ce(s), u = be(e, t.sheetMode, s), f = u.length + (o?.length ?? 0), g = /* @__PURE__ */ new Set(), x = v(t);
451
458
  for (const [w, m] of u.entries()) {
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);
459
+ const B = await ke(m, x);
460
+ m.continuous && !m.flow && Se(m, B.grids);
461
+ const j = m.pages[0].page, $ = n?.[w] ?? t.sheetName?.(w) ?? ve(m.title, w, g);
455
462
  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);
463
+ const G = r.addWorksheet($, Be(m, t.paperSize, s)), H = t.valueMode ?? (k(j) || m.continuous || m.flow ? "raw" : "text");
464
+ E(t.signal), await ze({ sheet: G, warnings: s, limits: h, valueMode: H, schedule: x, images: l, dataBars: d }, B, m.continuous, l), await T(t, w + 1, f);
458
465
  }
459
- return await Ne(n, o, t, u.length, f), { workbook: n, warnings: s, diagnostics: a, ...c.length ? { notes: c } : {} };
466
+ return await je(r, o, t, u.length, f), Le(r, s, a, c, t.diagnosticLimit);
460
467
  }
461
- async function Ne(e, t = [], o, r, i) {
468
+ async function je(e, t = [], o, n, i) {
462
469
  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) {
470
+ for (const r of t) {
471
+ if (E(o.signal), e.worksheets.some((l) => l.name.toLowerCase() === r.name.toLowerCase())) throw new TypeError(`附加工作表名称已被报表使用 ${r.name}`);
472
+ const s = e.addWorksheet(r.name);
473
+ r.columnWidths && (s.columns = r.columnWidths.map((l) => ({ width: l })));
474
+ for (const l of r.rows) {
468
475
  const c = s.addRow([...l]);
469
476
  c.alignment = { vertical: "top", wrapText: !0 };
470
- const h = a(l.length);
471
- h && await h;
477
+ const d = a(l.length);
478
+ d && await d;
472
479
  }
473
- await R(o, ++r, i);
480
+ await T(o, ++n, i);
474
481
  }
475
482
  E(o.signal);
476
483
  }
477
- async function Ke(e, t = {}) {
484
+ async function qe(e, t = {}) {
478
485
  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 });
486
+ const n = t.onProgress ? (r, s) => {
487
+ o = s + 1, P(t, r, o);
488
+ } : void 0, i = await Oe(e, { ...t, onProgress: n });
482
489
  E(t.signal);
483
490
  const a = await i.workbook.xlsx.writeBuffer();
484
491
  return E(t.signal), P(t, o, o), { ...i, buffer: a };
485
492
  }
486
493
  export {
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
494
+ rt as bindExcelTemplate,
495
+ it as createExcelBindingDocument,
496
+ ot as createExcelBindingSession,
497
+ at as createExcelRegionBindingDocument,
498
+ st as createExcelRegionBindingSession,
499
+ lt as excelBindingCellRange,
500
+ ct as excelBindingRowRange,
501
+ dt as getExcelSheetWindow,
502
+ Ze as importExcelTemplate,
503
+ et as inspectExcelWorkbook,
504
+ tt as openExcelWorkbook,
505
+ ht as parseExcelBindingSession,
506
+ ft as parseExcelRegionBindingSession,
507
+ Oe as renderPlanToWorkbook,
508
+ qe as renderPlanToXlsx,
509
+ gt as validateExcelBindingFields,
510
+ ut as validateExcelBindingRecipe,
511
+ mt as validateExcelBindingRegions,
512
+ wt as validateExcelRegionBindings,
513
+ xt as validateExcelRegionFields,
514
+ pt as validateExcelRegionGeometry
508
515
  };