@agile-team/mach-report 2.22.0 → 2.23.0

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